From 61b7ae97e658b8b44bdf764f1894d21c9b02ac7b Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Sun, 21 Feb 2016 11:45:11 -0600 Subject: [PATCH 1/8] Use Babel's UMD wrapper * Will work the same as the current UMD wrapper after Babel 6.6.0 --- .babelrc | 10 ++++++++++ gulpfile.js | 26 ++++++++++++++++++++------ package.json | 4 ++++ src/github.js | 30 +++++++----------------------- 4 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..cb4b32ad --- /dev/null +++ b/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": ["es2015"], + "plugins": [ + ["transform-es2015-modules-umd", { + "globals": { + "es6-promise": "Promise" + } + }] + ] +} diff --git a/gulpfile.js b/gulpfile.js index cd693819..4da37a2b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,6 +13,7 @@ var del = require('del'); var stylish = require('gulp-jscs-stylish'); var path = require('path'); var karma = require('karma'); +var babel = require('gulp-babel'); function runTests(singleRun, isCI, done) { var reporters = ['mocha']; @@ -107,34 +108,47 @@ gulp.task('clean', function () { }); gulp.task('build', function() { - var browserifyInstance = browserify({ + var bundler = browserify({ debug: true, entries: 'src/github.js', standalone: 'Github' }); - browserifyInstance + bundler + .transform('babelify') .bundle() .pipe(source('github.js')) .pipe(buffer()) .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(uglify()) + .pipe(uglify()) .pipe(rename({ extname: '.bundle.min.js' })) .pipe(sourcemaps.write('.')) - .pipe(gulp.dest('dist')); + .pipe(gulp.dest('dist')) + ; + + var babeled = gulp.src('src/github.js') + .pipe(babel()) + ; + + babeled + .pipe(sourcemaps.init()) + .pipe(sourcemaps.write('.')) + .pipe(gulp.dest('dist')) + ; - return gulp.src('src/github.js') + return babeled .pipe(sourcemaps.init()) .pipe(rename({ extname: '.min.js' })) .pipe(uglify()) .pipe(sourcemaps.write('.')) - .pipe(gulp.dest('dist')); + .pipe(gulp.dest('dist')) + ; }); gulp.task('default', ['clean'], function() { diff --git a/package.json b/package.json index 15501508..f5fdb956 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,16 @@ "utf8": "^2.1.1" }, "devDependencies": { + "babel-plugin-transform-es2015-modules-umd": "^6.5.0", + "babel-preset-es2015": "^6.5.0", + "babelify": "^7.2.0", "browserify": "^13.0.0", "browserify-istanbul": "^0.2.1", "chai": "^3.4.1", "codecov": "^1.0.1", "del": "^2.2.0", "gulp": "^3.9.0", + "gulp-babel": "^6.1.2", "gulp-jscs": "^3.0.2", "gulp-jscs-stylish": "^1.3.0", "gulp-jshint": "^2.0.0", diff --git a/src/github.js b/src/github.js index dd4da081..915f9a00 100644 --- a/src/github.js +++ b/src/github.js @@ -11,26 +11,11 @@ */ 'use strict'; -(function (root, factory) { - /* istanbul ignore next */ - if (typeof define === 'function' && define.amd) { - define( - [ - 'es6-promise', - 'base-64', - 'utf8', - 'axios' - ], - function (Promise, Base64, Utf8, axios) { - return (root.Github = factory(Promise, Base64, Utf8, axios)); - } - ); - } else if (typeof module === 'object' && module.exports) { - module.exports = factory(require('es6-promise'), require('base-64'), require('utf8'), require('axios')); - } else { - root.Github = factory(root.Promise, root.base64, root.utf8, root.axios); - } -}(this, function(Promise, Base64, Utf8, axios) { // jshint ignore:line +var Utf8 = require('utf8'); +var axios = require('axios'); +var Base64 = require('base-64'); +var Promise = require('es6-promise'); + function b64encode(string) { return Base64.encode(Utf8.encode(string)); } @@ -42,7 +27,7 @@ // Initial Setup // ------------- - var Github = function (options) { + function Github(options) { options = options || {}; var API_URL = options.apiUrl || 'https://api.github.com'; @@ -1146,5 +1131,4 @@ return new Github.RateLimit(); }; - return Github; -})); +module.exports = Github; From f8178b4b829fef44fc2f67647350008fe2475f00 Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Sun, 21 Feb 2016 11:45:31 -0600 Subject: [PATCH 2/8] Don't keep the dist/ files in git --- .gitignore | 5 ++++- dist/github.bundle.min.js | 3 --- dist/github.bundle.min.js.map | 1 - dist/github.min.js | 2 -- dist/github.min.js.map | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 dist/github.bundle.min.js delete mode 100644 dist/github.bundle.min.js.map delete mode 100644 dist/github.min.js delete mode 100644 dist/github.min.js.map diff --git a/.gitignore b/.gitignore index 8bcfe81d..1aacec2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ .DS_Store .idea node_modules/ -npm-debug.log coverage/ +dist/*.js +dist/*.map + +npm-debug.log sauce.json diff --git a/dist/github.bundle.min.js b/dist/github.bundle.min.js deleted file mode 100644 index 56b02112..00000000 --- a/dist/github.bundle.min.js +++ /dev/null @@ -1,3 +0,0 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Github=e()}}(function(){var e;return function t(e,n,r){function o(s,u){if(!n[s]){if(!e[s]){var a="function"==typeof require&&require;if(!u&&a)return a(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[s]={exports:{}};e[s][0].call(f.exports,function(t){var n=e[s][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s=200&&o.status<300||!("status"in p)&&o.responseText?t:n)(o),p=null}},p.onerror=function(){n(new Error("Network Error")),p=null},r.isStandardBrowserEnv()){var m=e("./../helpers/cookies"),g=c.withCredentials||u(c.url)?m.read(c.xsrfCookieName):void 0;g&&(l[c.xsrfHeaderName]=g)}if("setRequestHeader"in p&&r.forEach(l,function(e,t){"undefined"==typeof f&&"content-type"===t.toLowerCase()?delete l[t]:p.setRequestHeader(t,e)}),c.withCredentials&&(p.withCredentials=!0),c.responseType)try{p.responseType=c.responseType}catch(v){if("json"!==p.responseType)throw v}r.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},{"./../helpers/btoa":8,"./../helpers/buildURL":9,"./../helpers/cookies":11,"./../helpers/isURLSameOrigin":13,"./../helpers/parseHeaders":14,"./../helpers/transformData":16,"./../utils":17}],3:[function(e,t,n){"use strict";function r(e){this.defaults=i.merge({},e),this.interceptors={request:new u,response:new u}}var o=e("./defaults"),i=e("./utils"),s=e("./core/dispatchRequest"),u=e("./core/InterceptorManager"),a=e("./helpers/isAbsoluteURL"),c=e("./helpers/combineURLs"),f=e("./helpers/bind"),l=e("./helpers/transformData");r.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(o,this.defaults,{method:"get"},e),e.baseURL&&!a(e.url)&&(e.url=c(e.baseURL,e.url)),e.withCredentials=e.withCredentials||this.defaults.withCredentials,e.data=l(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),i.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=[s,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n};var p=new r(o),h=t.exports=f(r.prototype.request,p);h.create=function(e){return new r(e)},h.defaults=p.defaults,h.all=function(e){return Promise.all(e)},h.spread=e("./helpers/spread"),h.interceptors=p.interceptors,i.forEach(["delete","get","head"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))},h[e]=f(r.prototype[e],p)}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))},h[e]=f(r.prototype[e],p)})},{"./core/InterceptorManager":4,"./core/dispatchRequest":5,"./defaults":6,"./helpers/bind":7,"./helpers/combineURLs":10,"./helpers/isAbsoluteURL":12,"./helpers/spread":15,"./helpers/transformData":16,"./utils":17}],4:[function(e,t,n){"use strict";function r(){this.handlers=[]}var o=e("./../utils");r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},t.exports=r},{"./../utils":17}],5:[function(e,t,n){(function(n){"use strict";t.exports=function(t){return new Promise(function(r,o){try{var i;"function"==typeof t.adapter?i=t.adapter:"undefined"!=typeof XMLHttpRequest?i=e("../adapters/xhr"):"undefined"!=typeof n&&(i=e("../adapters/http")),"function"==typeof i&&i(r,o,t)}catch(s){o(s)}})}}).call(this,e("_process"))},{"../adapters/http":2,"../adapters/xhr":2,_process:20}],6:[function(e,t,n){"use strict";var r=e("./utils"),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(e,t){return r.isFormData(e)?e:r.isArrayBuffer(e)?e:r.isArrayBufferView(e)?e.buffer:!r.isObject(e)||r.isFile(e)||r.isBlob(e)?e:(r.isUndefined(t)||(r.forEach(t,function(e,n){"content-type"===n.toLowerCase()&&(t["Content-Type"]=e)}),r.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(e))}],transformResponse:[function(e){if("string"==typeof e){e=e.replace(o,"");try{e=JSON.parse(e)}catch(t){}}return e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},{"./utils":17}],7:[function(e,t,n){"use strict";t.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r>8-u%1*8)){if(n=o.charCodeAt(u+=.75),n>255)throw new r("INVALID_CHARACTER_ERR: DOM Exception 5");t=t<<8|n}return s}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",t.exports=o},{}],9:[function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=e("./../utils");t.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)&&(t+="[]"),o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))}))}),i=s.join("&")}return i&&(e+=(-1===e.indexOf("?")?"?":"&")+i),e}},{"./../utils":17}],10:[function(e,t,n){"use strict";t.exports=function(e,t){return e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"")}},{}],11:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},{"./../utils":17}],12:[function(e,t,n){"use strict";t.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},{}],13:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},{"./../utils":17}],14:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=function(e){var t,n,o,i={};return e?(r.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t&&(i[t]=i[t]?i[t]+", "+n:n)}),i):i}},{"./../utils":17}],15:[function(e,t,n){"use strict";t.exports=function(e){return function(t){return e.apply(null,t)}}},{}],16:[function(e,t,n){"use strict";var r=e("./../utils");t.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},{"./../utils":17}],17:[function(e,t,n){"use strict";function r(e){return"[object Array]"===y.call(e)}function o(e){return"[object ArrayBuffer]"===y.call(e)}function i(e){return"[object FormData]"===y.call(e)}function s(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function a(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function l(e){return"[object Date]"===y.call(e)}function p(e){return"[object File]"===y.call(e)}function h(e){return"[object Blob]"===y.call(e)}function d(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function m(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function g(e,t){if(null!==e&&"undefined"!=typeof e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;o>n;n++)t.call(null,e[n],n,e);else for(var i in e)e.hasOwnProperty(i)&&t.call(null,e[i],i,e)}function v(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=v(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;r>n;n++)g(arguments[n],e);return t}var y=Object.prototype.toString;t.exports={isArray:r,isArrayBuffer:o,isFormData:i,isArrayBufferView:s,isString:u,isNumber:a,isObject:f,isUndefined:c,isDate:l,isFile:p,isBlob:h,isStandardBrowserEnv:m,forEach:g,merge:v,trim:d}},{}],18:[function(t,n,r){(function(t){!function(o){var i="object"==typeof r&&r,s="object"==typeof n&&n&&n.exports==i&&n,u="object"==typeof t&&t;(u.global===u||u.window===u)&&(o=u);var a=function(e){this.message=e};a.prototype=new Error,a.prototype.name="InvalidCharacterError";var c=function(e){throw new a(e)},f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=/[\t\n\f\r ]/g,p=function(e){e=String(e).replace(l,"");var t=e.length;t%4==0&&(e=e.replace(/==?$/,""),t=e.length),(t%4==1||/[^+a-zA-Z0-9\/]/.test(e))&&c("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,o=0,i="",s=-1;++s>(-2*o&6)));return i},h=function(e){e=String(e),/[^\0-\xFF]/.test(e)&&c("The string to be encoded contains characters outside of the Latin1 range.");for(var t,n,r,o,i=e.length%3,s="",u=-1,a=e.length-i;++u>18&63)+f.charAt(o>>12&63)+f.charAt(o>>6&63)+f.charAt(63&o);return 2==i?(t=e.charCodeAt(u)<<8,n=e.charCodeAt(++u),o=t+n,s+=f.charAt(o>>10)+f.charAt(o>>4&63)+f.charAt(o<<2&63)+"="):1==i&&(o=e.charCodeAt(u),s+=f.charAt(o>>2)+f.charAt(o<<4&63)+"=="),s},d={encode:h,decode:p,version:"0.1.0"};if("function"==typeof e&&"object"==typeof e.amd&&e.amd)e(function(){return d});else if(i&&!i.nodeType)if(s)s.exports=d;else for(var m in d)d.hasOwnProperty(m)&&(i[m]=d[m]);else o.base64=d}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,n,r){(function(r,o){(function(){"use strict";function i(e){return"function"==typeof e||"object"==typeof e&&null!==e}function s(e){return"function"==typeof e}function u(e){V=e}function a(e){$=e}function c(){return function(){r.nextTick(d)}}function f(){return function(){z(d)}}function l(){var e=0,t=new Q(d),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function p(){var e=new MessageChannel;return e.port1.onmessage=d,function(){e.port2.postMessage(0)}}function h(){return function(){setTimeout(d,1)}}function d(){for(var e=0;Y>e;e+=2){var t=ne[e],n=ne[e+1];t(n),ne[e]=void 0,ne[e+1]=void 0}Y=0}function m(){try{var e=t,n=e("vertx");return z=n.runOnLoop||n.runOnContext,f()}catch(r){return h()}}function g(e,t){var n=this,r=n._state;if(r===se&&!e||r===ue&&!t)return this;var o=new this.constructor(y),i=n._result;if(r){var s=arguments[r-1];$(function(){P(r,o,s,i)})}else j(n,o,e,t);return o}function v(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(y);return C(n,e),n}function y(){}function w(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function E(e){try{return e.then}catch(t){return ae.error=t,ae}}function T(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function R(e,t,n){$(function(e){var r=!1,o=T(n,t,function(n){r||(r=!0,t!==n?C(e,n):S(e,n))},function(t){r||(r=!0,U(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,U(e,o))},e)}function _(e,t){t._state===se?S(e,t._result):t._state===ue?U(e,t._result):j(t,void 0,function(t){C(e,t)},function(t){U(e,t)})}function A(e,t,n){t.constructor===e.constructor&&n===re&&constructor.resolve===oe?_(e,t):n===ae?U(e,ae.error):void 0===n?S(e,t):s(n)?R(e,t,n):S(e,t)}function C(e,t){e===t?U(e,w()):i(t)?A(e,t,E(t)):S(e,t)}function x(e){e._onerror&&e._onerror(e._result),I(e)}function S(e,t){e._state===ie&&(e._result=t,e._state=se,0!==e._subscribers.length&&$(I,e))}function U(e,t){e._state===ie&&(e._state=ue,e._result=t,$(x,e))}function j(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+se]=n,o[i+ue]=r,0===i&&e._state&&$(I,e)}function I(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,o,i=e._result,s=0;ss;s++)j(r.resolve(e[s]),void 0,t,n);return o}function q(e){var t=this,n=new t(y);return U(n,e),n}function H(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function F(e){this._id=he++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==e&&("function"!=typeof e&&H(),this instanceof F?D(this,e):B())}function N(e,t){this._instanceConstructor=e,this.promise=new e(y),Array.isArray(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):U(this.promise,this._validationError())}function M(){var e;if("undefined"!=typeof o)e=o;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=de)}var X;X=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var z,V,J,K=X,Y=0,$=function(e,t){ne[Y]=e,ne[Y+1]=t,Y+=2,2===Y&&(V?V(d):J())},W="undefined"!=typeof window?window:void 0,Z=W||{},Q=Z.MutationObserver||Z.WebKitMutationObserver,ee="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),te="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ne=new Array(1e3);J=ee?c():Q?l():te?p():void 0===W&&"function"==typeof t?m():h();var re=g,oe=v,ie=void 0,se=1,ue=2,ae=new O,ce=new O,fe=L,le=k,pe=q,he=0,de=F;F.all=fe,F.race=le,F.resolve=oe,F.reject=pe,F._setScheduler=u,F._setAsap=a,F._asap=$,F.prototype={constructor:F,then:re,"catch":function(e){return this.then(null,e)}};var me=N;N.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},N.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===ie&&e>n;n++)this._eachEntry(t[n],n)},N.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===oe){var o=E(e);if(o===re&&e._state!==ie)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===de){var i=new n(y);A(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},N.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===ie&&(this._remaining--,e===ue?U(r,n):this._result[t]=n),0===this._remaining&&S(r,this._result)},N.prototype._willSettleAt=function(e,t){var n=this;j(e,void 0,function(e){n._settledAt(se,t,e)},function(e){n._settledAt(ue,t,e)})};var ge=M,ve={Promise:de,polyfill:ge};"function"==typeof e&&e.amd?e(function(){return ve}):"undefined"!=typeof n&&n.exports?n.exports=ve:"undefined"!=typeof this&&(this.ES6Promise=ve),ge()}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:20}],20:[function(e,t,n){function r(){f=!1,u.length?c=u.concat(c):l=-1,c.length&&o()}function o(){if(!f){var e=setTimeout(r);f=!0;for(var t=c.length;t;){for(u=c,c=[];++l1)for(var n=1;no;)t=e.charCodeAt(o++),t>=55296&&56319>=t&&i>o?(n=e.charCodeAt(o++),56320==(64512&n)?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--)):r.push(t);return r}function s(e){for(var t,n=e.length,r=-1,o="";++r65535&&(t-=65536,o+=b(t>>>10&1023|55296),t=56320|1023&t),o+=b(t);return o}function u(e){if(e>=55296&&57343>=e)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function a(e,t){return b(e>>t&63|128)}function c(e){if(0==(4294967168&e))return b(e);var t="";return 0==(4294965248&e)?t=b(e>>6&31|192):0==(4294901760&e)?(u(e),t=b(e>>12&15|224),t+=a(e,6)):0==(4292870144&e)&&(t=b(e>>18&7|240),t+=a(e,12),t+=a(e,6)),t+=b(63&e|128)}function f(e){for(var t,n=i(e),r=n.length,o=-1,s="";++o=y)throw Error("Invalid byte index");var e=255&v[w];if(w++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function p(){var e,t,n,r,o;if(w>y)throw Error("Invalid byte index");if(w==y)return!1;if(e=255&v[w],w++,0==(128&e))return e;if(192==(224&e)){var t=l();if(o=(31&e)<<6|t,o>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&e)){if(t=l(),n=l(),o=(15&e)<<12|t<<6|n,o>=2048)return u(o),o;throw Error("Invalid continuation byte")}if(240==(248&e)&&(t=l(),n=l(),r=l(),o=(15&e)<<18|t<<12|n<<6|r,o>=65536&&1114111>=o))return o;throw Error("Invalid UTF-8 detected")}function h(e){v=i(e),y=v.length,w=0;for(var t,n=[];(t=p())!==!1;)n.push(t);return s(n)}var d="object"==typeof r&&r,m="object"==typeof n&&n&&n.exports==d&&n,g="object"==typeof t&&t;(g.global===g||g.window===g)&&(o=g);var v,y,w,b=String.fromCharCode,E={version:"2.0.0",encode:f,decode:h};if("function"==typeof e&&"object"==typeof e.amd&&e.amd)e(function(){return E});else if(d&&!d.nodeType)if(m)m.exports=E;else{var T={},R=T.hasOwnProperty;for(var _ in E)R.call(E,_)&&(d[_]=E[_])}else o.utf8=E}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],22:[function(t,n,r){"use strict";!function(r,o){"function"==typeof e&&e.amd?e(["es6-promise","base-64","utf8","axios"],function(e,t,n,i){return r.Github=o(e,t,n,i)}):"object"==typeof n&&n.exports?n.exports=o(t("es6-promise"),t("base-64"),t("utf8"),t("axios")):r.Github=o(r.Promise,r.base64,r.utf8,r.axios)}(this,function(e,t,n,r){function o(e){return t.encode(n.encode(e))}e.polyfill&&e.polyfill();var i=function(e){e=e||{};var t=e.apiUrl||"https://api.github.com",n=i._request=function(n,i,s,u,a){function c(){var e=i.indexOf("//")>=0?i:t+i;if(e+=/\?/.test(e)?"&":"?",s&&"object"==typeof s&&["GET","HEAD","DELETE"].indexOf(n)>-1)for(var r in s)s.hasOwnProperty(r)&&(e+="&"+encodeURIComponent(r)+"="+encodeURIComponent(s[r]));return e.replace(/(×tamp=\d+)/,"")+("undefined"!=typeof window?"×tamp="+(new Date).getTime():"")}var f={headers:{Accept:a?"application/vnd.github.v3.raw+json":"application/vnd.github.v3+json","Content-Type":"application/json;charset=UTF-8"},method:n,data:s?s:{},url:c()};return(e.token||e.username&&e.password)&&(f.headers.Authorization=e.token?"token "+e.token:"Basic "+o(e.username+":"+e.password)),r(f).then(function(e){u(null,e.data||!0,e.request)},function(e){304===e.status?u(null,e.data||!0,e.request):u({path:i,request:e.request,error:e.status})})},s=i._requestAllPages=function(e,t){var r=[];!function o(){n("GET",e,null,function(n,i,s){if(n)return t(n);i instanceof Array||(i=[i]),r.push.apply(r,i);var u=(s.getResponseHeader("link")||"").split(",").filter(function(e){return/rel="next"/.test(e)}).map(function(e){return(/<(.*)>/.exec(e)||[])[1]}).pop();u?(e=u,o()):t(n,r,s)})}()};return i.User=function(){this.repos=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};var n="/user/repos",r=[];r.push("type="+encodeURIComponent(e.type||"all")),r.push("sort="+encodeURIComponent(e.sort||"updated")),r.push("per_page="+encodeURIComponent(e.per_page||"100")),e.page&&r.push("page="+encodeURIComponent(e.page)),n+="?"+r.join("&"),s(n,t)},this.orgs=function(e){n("GET","/user/orgs",null,e)},this.gists=function(e){n("GET","/gists",null,e)},this.notifications=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};var r="/notifications",o=[];if(e.all&&o.push("all=true"),e.participating&&o.push("participating=true"),e.since){var i=e.since;i.constructor===Date&&(i=i.toISOString()),o.push("since="+encodeURIComponent(i))}if(e.before){var s=e.before;s.constructor===Date&&(s=s.toISOString()),o.push("before="+encodeURIComponent(s))}e.page&&o.push("page="+encodeURIComponent(e.page)),o.length>0&&(r+="?"+o.join("&")),n("GET",r,null,t)},this.show=function(e,t){var r=e?"/users/"+e:"/user";n("GET",r,null,t)},this.userRepos=function(e,t,n){"function"==typeof t&&(n=t,t={});var r="/users/"+e+"/repos",o=[];o.push("type="+encodeURIComponent(t.type||"all")),o.push("sort="+encodeURIComponent(t.sort||"updated")),o.push("per_page="+encodeURIComponent(t.per_page||"100")),t.page&&o.push("page="+encodeURIComponent(t.page)),r+="?"+o.join("&"),s(r,n)},this.userStarred=function(e,t){s("/users/"+e+"/starred?type=all&per_page=100",t)},this.userGists=function(e,t){n("GET","/users/"+e+"/gists",null,t)},this.orgRepos=function(e,t){s("/orgs/"+e+"/repos?type=all&&page_num=1000&sort=updated&direction=desc",t)},this.follow=function(e,t){n("PUT","/user/following/"+e,null,t)},this.unfollow=function(e,t){n("DELETE","/user/following/"+e,null,t)},this.createRepo=function(e,t){n("POST","/user/repos",e,t)}},i.Repository=function(e){function t(e,t){return e===f.branch&&f.sha?t(null,f.sha):void c.getRef("heads/"+e,function(n,r){f.branch=e,f.sha=r,t(n,r)})}var r,s=e.name,u=e.user,a=e.fullname,c=this;r=a?"/repos/"+a:"/repos/"+u+"/"+s;var f={branch:null,sha:null};this.getRef=function(e,t){n("GET",r+"/git/refs/"+e,null,function(e,n,r){return e?t(e):void t(null,n.object.sha,r)})},this.createRef=function(e,t){n("POST",r+"/git/refs",e,t)},this.deleteRef=function(t,o){n("DELETE",r+"/git/refs/"+t,e,o)},this.deleteRepo=function(t){n("DELETE",r,e,t)},this.listTags=function(e){n("GET",r+"/tags",null,e)},this.listPulls=function(e,t){e=e||{};var o=r+"/pulls",i=[];"string"==typeof e?i.push("state="+e):(e.state&&i.push("state="+encodeURIComponent(e.state)),e.head&&i.push("head="+encodeURIComponent(e.head)),e.base&&i.push("base="+encodeURIComponent(e.base)),e.sort&&i.push("sort="+encodeURIComponent(e.sort)),e.direction&&i.push("direction="+encodeURIComponent(e.direction)),e.page&&i.push("page="+e.page),e.per_page&&i.push("per_page="+e.per_page)),i.length>0&&(o+="?"+i.join("&")),n("GET",o,null,t)},this.getPull=function(e,t){n("GET",r+"/pulls/"+e,null,t)},this.compare=function(e,t,o){n("GET",r+"/compare/"+e+"..."+t,null,o)},this.listBranches=function(e){n("GET",r+"/git/refs/heads",null,function(t,n,r){return t?e(t):(n=n.map(function(e){return e.ref.replace(/^refs\/heads\//,"")}),void e(null,n,r))})},this.getBlob=function(e,t){n("GET",r+"/git/blobs/"+e,null,t,"raw")},this.getCommit=function(e,t,o){n("GET",r+"/git/commits/"+t,null,o)},this.getSha=function(e,t,o){return t&&""!==t?void n("GET",r+"/contents/"+t+(e?"?ref="+e:""),null,function(e,t,n){return e?o(e):void o(null,t.sha,n)}):c.getRef("heads/"+e,o)},this.getStatuses=function(e,t){n("GET",r+"/statuses/"+e,null,t)},this.getTree=function(e,t){n("GET",r+"/git/trees/"+e,null,function(e,n,r){return e?t(e):void t(null,n.tree,r)})},this.postBlob=function(e,t){e="string"==typeof e?{content:e,encoding:"utf-8"}:{content:o(e),encoding:"base64"},n("POST",r+"/git/blobs",e,function(e,n,r){return e?t(e):void t(null,n.sha,r)})},this.updateTree=function(e,t,o,i){var s={base_tree:e,tree:[{path:t,mode:"100644",type:"blob",sha:o}]};n("POST",r+"/git/trees",s,function(e,t,n){return e?i(e):void i(null,t.sha,n)})},this.postTree=function(e,t){n("POST",r+"/git/trees",{tree:e},function(e,n,r){return e?t(e):void t(null,n.sha,r)})},this.commit=function(t,o,s,u){var a=new i.User;a.show(null,function(i,a){if(i)return u(i);var c={message:s,author:{name:e.user,email:a.email},parents:[t],tree:o};n("POST",r+"/git/commits",c,function(e,t,n){return e?u(e):(f.sha=t.sha,void u(null,t.sha,n))})})},this.updateHead=function(e,t,o){n("PATCH",r+"/git/refs/heads/"+e,{sha:t},o)},this.show=function(e){n("GET",r,null,e)},this.contributors=function(e,t){t=t||1e3;var o=this;n("GET",r+"/stats/contributors",null,function(n,r,i){return n?e(n):void(202===i.status?setTimeout(function(){o.contributors(e,t)},t):e(n,r,i))})},this.contents=function(e,t,o){t=encodeURI(t),n("GET",r+"/contents"+(t?"/"+t:""),{ref:e},o)},this.fork=function(e){n("POST",r+"/forks",null,e)},this.listForks=function(e){n("GET",r+"/forks",null,e)},this.branch=function(e,t,n){2===arguments.length&&"function"==typeof arguments[1]&&(n=t,t=e,e="master"),this.getRef("heads/"+e,function(e,r){return e&&n?n(e):void c.createRef({ref:"refs/heads/"+t,sha:r},n)})},this.createPullRequest=function(e,t){n("POST",r+"/pulls",e,t)},this.listHooks=function(e){n("GET",r+"/hooks",null,e)},this.getHook=function(e,t){n("GET",r+"/hooks/"+e,null,t)},this.createHook=function(e,t){n("POST",r+"/hooks",e,t)},this.editHook=function(e,t,o){n("PATCH",r+"/hooks/"+e,t,o)},this.deleteHook=function(e,t){n("DELETE",r+"/hooks/"+e,null,t)},this.read=function(e,t,o){n("GET",r+"/contents/"+encodeURI(t)+(e?"?ref="+e:""),null,o,!0)},this.remove=function(e,t,o){c.getSha(e,t,function(i,s){return i?o(i):void n("DELETE",r+"/contents/"+t,{message:t+" is removed",sha:s,branch:e},o)})},this["delete"]=this.remove,this.move=function(e,n,r,o){t(e,function(t,i){c.getTree(i+"?recursive=true",function(t,s){s.forEach(function(e){e.path===n&&(e.path=r),"tree"===e.type&&delete e.sha}),c.postTree(s,function(t,r){c.commit(i,r,"Deleted "+n,function(t,n){c.updateHead(e,n,o)})})})})},this.write=function(e,t,i,s,u,a){"function"==typeof u&&(a=u,u={}),c.getSha(e,encodeURI(t),function(c,f){var l={message:s,content:"undefined"==typeof u.encode||u.encode?o(i):i,branch:e,committer:u&&u.committer?u.committer:void 0,author:u&&u.author?u.author:void 0};c&&404!==c.error||(l.sha=f),n("PUT",r+"/contents/"+encodeURI(t),l,a)})},this.getCommits=function(e,t){e=e||{};var o=r+"/commits",i=[];if(e.sha&&i.push("sha="+encodeURIComponent(e.sha)),e.path&&i.push("path="+encodeURIComponent(e.path)),e.author&&i.push("author="+encodeURIComponent(e.author)),e.since){var s=e.since;s.constructor===Date&&(s=s.toISOString()),i.push("since="+encodeURIComponent(s))}if(e.until){var u=e.until;u.constructor===Date&&(u=u.toISOString()),i.push("until="+encodeURIComponent(u))}e.page&&i.push("page="+e.page),e.perpage&&i.push("per_page="+e.perpage),i.length>0&&(o+="?"+i.join("&")),n("GET",o,null,t)},this.isStarred=function(e,t,r){n("GET","/user/starred/"+e+"/"+t,null,r)},this.star=function(e,t,r){n("PUT","/user/starred/"+e+"/"+t,null,r)},this.unstar=function(e,t,r){n("DELETE","/user/starred/"+e+"/"+t,null,r)},this.createRelease=function(e,t){n("POST",r+"/releases",e,t)},this.editRelease=function(e,t,o){n("PATCH",r+"/releases/"+e,t,o)},this.getRelease=function(e,t){n("GET",r+"/releases/"+e,null,t)},this.deleteRelease=function(e,t){n("DELETE",r+"/releases/"+e,null,t)}},i.Gist=function(e){var t=e.id,r="/gists/"+t;this.read=function(e){n("GET",r,null,e)},this.create=function(e,t){n("POST","/gists",e,t)},this["delete"]=function(e){n("DELETE",r,null,e)},this.fork=function(e){n("POST",r+"/fork",null,e)},this.update=function(e,t){n("PATCH",r,e,t)},this.star=function(e){n("PUT",r+"/star",null,e)},this.unstar=function(e){n("DELETE",r+"/star",null,e)},this.isStarred=function(e){n("GET",r+"/star",null,e)}},i.Issue=function(e){var t="/repos/"+e.user+"/"+e.repo+"/issues";this.create=function(e,r){n("POST",t,e,r)},this.list=function(e,n){var r=[];for(var o in e)e.hasOwnProperty(o)&&r.push(encodeURIComponent(o)+"="+encodeURIComponent(e[o]));s(t+"?"+r.join("&"),n)},this.comment=function(e,t,r){n("POST",e.comments_url,{body:t},r)},this.edit=function(e,r,o){n("PATCH",t+"/"+e,r,o)},this.get=function(e,r){n("GET",t+"/"+e,null,r)}},i.Search=function(e){var t="/search/",r="?q="+e.query;this.repositories=function(e,o){n("GET",t+"repositories"+r,e,o)},this.code=function(e,o){n("GET",t+"code"+r,e,o)},this.issues=function(e,o){n("GET",t+"issues"+r,e,o)},this.users=function(e,o){n("GET",t+"users"+r,e,o)}},i.RateLimit=function(){this.getRateLimit=function(e){n("GET","/rate_limit",null,e)}},i};return i.getIssues=function(e,t){return new i.Issue({user:e,repo:t})},i.getRepo=function(e,t){ -return t?new i.Repository({user:e,name:t}):new i.Repository({fullname:e})},i.getUser=function(){return new i.User},i.getGist=function(e){return new i.Gist({id:e})},i.getSearch=function(e){return new i.Search({query:e})},i.getRateLimit=function(){return new i.RateLimit},i})},{axios:1,"base-64":18,"es6-promise":19,utf8:21}]},{},[22])(22)}); -//# sourceMappingURL=github.bundle.min.js.map diff --git a/dist/github.bundle.min.js.map b/dist/github.bundle.min.js.map deleted file mode 100644 index 7580a0bd..00000000 --- a/dist/github.bundle.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["node_modules/browser-pack/_prelude.js","node_modules/axios/index.js","github.js","node_modules/axios/lib/adapters/xhr.js","node_modules/axios/lib/axios.js","node_modules/axios/lib/core/InterceptorManager.js","node_modules/axios/lib/core/dispatchRequest.js","node_modules/axios/lib/defaults.js","node_modules/axios/lib/helpers/bind.js","node_modules/axios/lib/helpers/btoa.js","node_modules/axios/lib/helpers/buildURL.js","node_modules/axios/lib/helpers/combineURLs.js","node_modules/axios/lib/helpers/cookies.js","node_modules/axios/lib/helpers/isAbsoluteURL.js","node_modules/axios/lib/helpers/isURLSameOrigin.js","node_modules/axios/lib/helpers/parseHeaders.js","node_modules/axios/lib/helpers/spread.js","node_modules/axios/lib/helpers/transformData.js","node_modules/axios/lib/utils.js","node_modules/base-64/base64.js","node_modules/es6-promise/dist/es6-promise.js","node_modules/process/browser.js","node_modules/utf8/utf8.js","src/github.js"],"names":["f","exports","module","define","amd","g","window","global","self","this","Github","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length",1,"./lib/axios",2,"utils","buildURL","parseHeaders","transformData","isURLSameOrigin","btoa","resolve","reject","config","requestData","data","requestHeaders","headers","isFormData","request","XMLHttpRequest","XDomainRequest","url","auth","username","password","Authorization","open","method","toUpperCase","params","paramsSerializer","timeout","onload","responseHeaders","getAllResponseHeaders","responseData","indexOf","responseType","responseText","response","transformResponse","status","statusText","onerror","isStandardBrowserEnv","cookies","xsrfValue","withCredentials","read","xsrfCookieName","undefined","xsrfHeaderName","forEach","val","key","toLowerCase","setRequestHeader","isArrayBuffer","DataView","send","./../helpers/btoa","./../helpers/buildURL","./../helpers/cookies","./../helpers/isURLSameOrigin","./../helpers/parseHeaders","./../helpers/transformData","./../utils",3,"Axios","defaultConfig","defaults","merge","interceptors","InterceptorManager","dispatchRequest","isAbsoluteURL","combineURLs","bind","prototype","arguments","baseURL","transformRequest","common","chain","promise","Promise","interceptor","unshift","fulfilled","rejected","push","then","shift","defaultInstance","axios","create","all","promises","spread","./core/InterceptorManager","./core/dispatchRequest","./defaults","./helpers/bind","./helpers/combineURLs","./helpers/isAbsoluteURL","./helpers/spread","./helpers/transformData","./utils",4,"handlers","use","eject","id","fn","h",5,"process","adapter","../adapters/http","../adapters/xhr","_process",6,"PROTECTION_PREFIX","DEFAULT_CONTENT_TYPE","Content-Type","isArrayBufferView","buffer","isObject","isFile","isBlob","isUndefined","JSON","stringify","replace","parse","Accept","patch","post","put",7,"thisArg","args","Array","apply",8,"InvalidCharacterError","message","input","block","charCode","str","String","output","idx","map","chars","charAt","charCodeAt","name",9,"encode","encodeURIComponent","serializedParams","parts","isArray","v","isDate","toISOString","join",10,"relativeURL",11,"write","value","expires","path","domain","secure","cookie","isNumber","Date","toGMTString","isString","document","match","RegExp","decodeURIComponent","remove","now",12,"test",13,"resolveURL","href","msie","urlParsingNode","setAttribute","protocol","host","search","hash","hostname","port","pathname","originURL","navigator","userAgent","createElement","location","requestURL","parsed",14,"split","line","trim","substr",15,"callback","arr",16,"fns",17,"toString","result","ArrayBuffer","isView","obj","hasOwnProperty","assignValue","Object",18,"root","freeExports","freeModule","freeGlobal","error","TABLE","REGEX_SPACE_CHARACTERS","decode","bitStorage","bitCounter","position","fromCharCode","b","c","padding","base64","version","nodeType",19,"lib$es6$promise$utils$$objectOrFunction","x","lib$es6$promise$utils$$isFunction","lib$es6$promise$asap$$setScheduler","scheduleFn","lib$es6$promise$asap$$customSchedulerFn","lib$es6$promise$asap$$setAsap","asapFn","lib$es6$promise$asap$$asap","lib$es6$promise$asap$$useNextTick","nextTick","lib$es6$promise$asap$$flush","lib$es6$promise$asap$$useVertxTimer","lib$es6$promise$asap$$vertxNext","lib$es6$promise$asap$$useMutationObserver","iterations","observer","lib$es6$promise$asap$$BrowserMutationObserver","node","createTextNode","observe","characterData","lib$es6$promise$asap$$useMessageChannel","channel","MessageChannel","port1","onmessage","port2","postMessage","lib$es6$promise$asap$$useSetTimeout","setTimeout","lib$es6$promise$asap$$len","lib$es6$promise$asap$$queue","arg","lib$es6$promise$asap$$attemptVertx","vertx","runOnLoop","runOnContext","lib$es6$promise$then$$then","onFulfillment","onRejection","parent","state","_state","lib$es6$promise$$internal$$FULFILLED","lib$es6$promise$$internal$$REJECTED","child","constructor","lib$es6$promise$$internal$$noop","_result","lib$es6$promise$$internal$$invokeCallback","lib$es6$promise$$internal$$subscribe","lib$es6$promise$promise$resolve$$resolve","object","Constructor","lib$es6$promise$$internal$$resolve","lib$es6$promise$$internal$$selfFulfillment","TypeError","lib$es6$promise$$internal$$cannotReturnOwn","lib$es6$promise$$internal$$getThen","lib$es6$promise$$internal$$GET_THEN_ERROR","lib$es6$promise$$internal$$tryThen","fulfillmentHandler","rejectionHandler","lib$es6$promise$$internal$$handleForeignThenable","thenable","sealed","lib$es6$promise$$internal$$fulfill","reason","lib$es6$promise$$internal$$reject","_label","lib$es6$promise$$internal$$handleOwnThenable","lib$es6$promise$$internal$$handleMaybeThenable","maybeThenable","lib$es6$promise$then$$default","lib$es6$promise$promise$resolve$$default","lib$es6$promise$$internal$$publishRejection","_onerror","lib$es6$promise$$internal$$publish","lib$es6$promise$$internal$$PENDING","_subscribers","subscribers","settled","detail","lib$es6$promise$$internal$$ErrorObject","lib$es6$promise$$internal$$tryCatch","lib$es6$promise$$internal$$TRY_CATCH_ERROR","succeeded","failed","hasCallback","lib$es6$promise$$internal$$initializePromise","resolver","lib$es6$promise$promise$all$$all","entries","lib$es6$promise$enumerator$$default","lib$es6$promise$promise$race$$race","lib$es6$promise$utils$$isArray","lib$es6$promise$promise$reject$$reject","lib$es6$promise$promise$$needsResolver","lib$es6$promise$promise$$needsNew","lib$es6$promise$promise$$Promise","_id","lib$es6$promise$promise$$counter","lib$es6$promise$enumerator$$Enumerator","_instanceConstructor","_input","_remaining","_enumerate","_validationError","lib$es6$promise$polyfill$$polyfill","local","Function","P","cast","lib$es6$promise$promise$$default","lib$es6$promise$utils$$_isArray","lib$es6$promise$asap$$scheduleFlush","lib$es6$promise$asap$$browserWindow","lib$es6$promise$asap$$browserGlobal","MutationObserver","WebKitMutationObserver","lib$es6$promise$asap$$isNode","lib$es6$promise$asap$$isWorker","Uint8ClampedArray","importScripts","lib$es6$promise$promise$all$$default","lib$es6$promise$promise$race$$default","lib$es6$promise$promise$reject$$default","race","_setScheduler","_setAsap","_asap","catch","_eachEntry","entry","_settledAt","_willSettleAt","enumerator","lib$es6$promise$polyfill$$default","lib$es6$promise$umd$$ES6Promise","polyfill",20,"cleanUpNextTick","draining","currentQueue","queue","concat","queueIndex","drainQueue","len","run","clearTimeout","Item","fun","array","noop","title","browser","env","argv","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","binding","cwd","chdir","dir","umask",21,"ucs2decode","string","extra","counter","ucs2encode","index","stringFromCharCode","checkScalarValue","codePoint","createByte","encodeCodePoint","symbol","utf8encode","codePoints","byteString","readContinuationByte","byteIndex","byteCount","continuationByte","byteArray","decodeSymbol","byte1","byte2","byte3","byte4","utf8decode","tmp","utf8",22,"factory","Base64","Utf8","b64encode","options","API_URL","apiUrl","_request","cb","raw","getURL","param","getTime","token","_requestAllPages","results","iterate","err","res","xhr","next","getResponseHeader","filter","link","exec","pop","User","repos","type","sort","per_page","page","orgs","gists","notifications","participating","since","before","show","command","userRepos","userStarred","userGists","orgRepos","orgname","follow","unfollow","createRepo","Repository","updateTree","branch","currentTree","sha","that","getRef","repoPath","repo","user","fullname","ref","createRef","deleteRef","deleteRepo","listTags","listPulls","head","base","direction","getPull","number","compare","listBranches","heads","getBlob","getCommit","getSha","pathContent","getStatuses","getTree","tree","postBlob","content","encoding","baseTree","blob","base_tree","mode","postTree","commit","userData","author","email","parents","updateHead","contributors","retry","contents","encodeURI","fork","listForks","oldBranch","newBranch","createPullRequest","listHooks","getHook","createHook","editHook","deleteHook","move","newPath","latestCommit","rootTree","writeOptions","committer","getCommits","until","perpage","isStarred","owner","repository","star","unstar","createRelease","editRelease","getRelease","deleteRelease","Gist","gistPath","update","Issue","list","query","comment","issue","comments_url","body","edit","get","Search","repositories","issues","users","RateLimit","getRateLimit","getIssues","getRepo","getUser","getGist","getSearch","base-64","es6-promise"],"mappings":"CAAA,SAAAA,GAAA,GAAA,gBAAAC,UAAA,mBAAAC,QAAAA,OAAAD,QAAAD,QAAA,IAAA,kBAAAG,SAAAA,OAAAC,IAAAD,UAAAH,OAAA,CAAA,GAAAK,EAAAA,GAAA,mBAAAC,QAAAA,OAAA,mBAAAC,QAAAA,OAAA,mBAAAC,MAAAA,KAAAC,KAAAJ,EAAAK,OAAAV,MAAA,WAAA,GAAAG,EAAA,OAAA,SAAAQ,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,GAAA,kBAAAC,UAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,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+V,IANA,GAAA5gB,GAAAogB,YACAU,SAAAD,KAUA7gB,EAAAsmB,QAAA,WACA,MAAA,IAAAtmB,GAAA8e,MAGA9e,EAAAumB,QAAA,SAAAxe,GACA,MAAA,IAAA/H,GAAAklB,MACAnd,GAAAA,KAIA/H,EAAAwmB,UAAA,SAAAjB,GACA,MAAA,IAAAvlB,GAAA8lB,QACAP,MAAAA,KAIAvlB,EAAAmmB,aAAA,WACA,MAAA,IAAAnmB,GAAAkmB,WAGAlmB,MrBq8EG6G,MAAQ,EAAE4f,UAAU,GAAGC,cAAc,GAAGxJ,KAAO,UAAU,KAAK","file":"github.bundle.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o= 200 && response.status < 300) ||\r\n (!('status' in request) && response.responseText) ?\r\n resolve :\r\n reject)(response);\r\n\r\n // Clean up request\r\n request = null;\r\n };\r\n\r\n // Handle low level network errors\r\n request.onerror = function handleError() {\r\n // Real errors are hidden from us by the browser\r\n // onerror should only fire if it's a network error\r\n reject(new Error('Network Error'));\r\n\r\n // Clean up request\r\n request = null;\r\n };\r\n\r\n // Add xsrf header\r\n // This is only done if running in a standard browser environment.\r\n // Specifically not if we're in a web worker, or react-native.\r\n if (utils.isStandardBrowserEnv()) {\r\n var cookies = require('./../helpers/cookies');\r\n\r\n // Add xsrf header\r\n var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?\r\n cookies.read(config.xsrfCookieName) :\r\n undefined;\r\n\r\n if (xsrfValue) {\r\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\r\n }\r\n }\r\n\r\n // Add headers to the request\r\n if ('setRequestHeader' in request) {\r\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\r\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\r\n // Remove Content-Type if data is undefined\r\n delete requestHeaders[key];\r\n } else {\r\n // Otherwise add header to the request\r\n request.setRequestHeader(key, val);\r\n }\r\n });\r\n }\r\n\r\n // Add withCredentials to request if needed\r\n if (config.withCredentials) {\r\n request.withCredentials = true;\r\n }\r\n\r\n // Add responseType to request if needed\r\n if (config.responseType) {\r\n try {\r\n request.responseType = config.responseType;\r\n } catch (e) {\r\n if (request.responseType !== 'json') {\r\n throw e;\r\n }\r\n }\r\n }\r\n\r\n if (utils.isArrayBuffer(requestData)) {\r\n requestData = new DataView(requestData);\r\n }\r\n\r\n // Send the request\r\n request.send(requestData);\r\n};\r\n\n},{\"./../helpers/btoa\":8,\"./../helpers/buildURL\":9,\"./../helpers/cookies\":11,\"./../helpers/isURLSameOrigin\":13,\"./../helpers/parseHeaders\":14,\"./../helpers/transformData\":16,\"./../utils\":17}],3:[function(require,module,exports){\n'use strict';\r\n\r\nvar defaults = require('./defaults');\r\nvar utils = require('./utils');\r\nvar dispatchRequest = require('./core/dispatchRequest');\r\nvar InterceptorManager = require('./core/InterceptorManager');\r\nvar isAbsoluteURL = require('./helpers/isAbsoluteURL');\r\nvar combineURLs = require('./helpers/combineURLs');\r\nvar bind = require('./helpers/bind');\r\nvar transformData = require('./helpers/transformData');\r\n\r\nfunction Axios(defaultConfig) {\r\n this.defaults = utils.merge({}, defaultConfig);\r\n this.interceptors = {\r\n request: new InterceptorManager(),\r\n response: new InterceptorManager()\r\n };\r\n}\r\n\r\nAxios.prototype.request = function request(config) {\r\n /*eslint no-param-reassign:0*/\r\n // Allow for axios('example/url'[, config]) a la fetch API\r\n if (typeof config === 'string') {\r\n config = utils.merge({\r\n url: arguments[0]\r\n }, arguments[1]);\r\n }\r\n\r\n config = utils.merge(defaults, this.defaults, { method: 'get' }, config);\r\n\r\n // Support baseURL config\r\n if (config.baseURL && !isAbsoluteURL(config.url)) {\r\n config.url = combineURLs(config.baseURL, config.url);\r\n }\r\n\r\n // Don't allow overriding defaults.withCredentials\r\n config.withCredentials = config.withCredentials || this.defaults.withCredentials;\r\n\r\n // Transform request data\r\n config.data = transformData(\r\n config.data,\r\n config.headers,\r\n config.transformRequest\r\n );\r\n\r\n // Flatten headers\r\n config.headers = utils.merge(\r\n config.headers.common || {},\r\n config.headers[config.method] || {},\r\n config.headers || {}\r\n );\r\n\r\n utils.forEach(\r\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\r\n function cleanHeaderConfig(method) {\r\n delete config.headers[method];\r\n }\r\n );\r\n\r\n // Hook up interceptors middleware\r\n var chain = [dispatchRequest, undefined];\r\n var promise = Promise.resolve(config);\r\n\r\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\r\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\r\n });\r\n\r\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\r\n chain.push(interceptor.fulfilled, interceptor.rejected);\r\n });\r\n\r\n while (chain.length) {\r\n promise = promise.then(chain.shift(), chain.shift());\r\n }\r\n\r\n return promise;\r\n};\r\n\r\nvar defaultInstance = new Axios(defaults);\r\nvar axios = module.exports = bind(Axios.prototype.request, defaultInstance);\r\n\r\naxios.create = function create(defaultConfig) {\r\n return new Axios(defaultConfig);\r\n};\r\n\r\n// Expose defaults\r\naxios.defaults = defaultInstance.defaults;\r\n\r\n// Expose all/spread\r\naxios.all = function all(promises) {\r\n return Promise.all(promises);\r\n};\r\naxios.spread = require('./helpers/spread');\r\n\r\n// Expose interceptors\r\naxios.interceptors = defaultInstance.interceptors;\r\n\r\n// Provide aliases for supported request methods\r\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\r\n /*eslint func-names:0*/\r\n Axios.prototype[method] = function(url, config) {\r\n return this.request(utils.merge(config || {}, {\r\n method: method,\r\n url: url\r\n }));\r\n };\r\n axios[method] = bind(Axios.prototype[method], defaultInstance);\r\n});\r\n\r\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\r\n /*eslint func-names:0*/\r\n Axios.prototype[method] = function(url, data, config) {\r\n return this.request(utils.merge(config || {}, {\r\n method: method,\r\n url: url,\r\n data: data\r\n }));\r\n };\r\n axios[method] = bind(Axios.prototype[method], defaultInstance);\r\n});\r\n\n},{\"./core/InterceptorManager\":4,\"./core/dispatchRequest\":5,\"./defaults\":6,\"./helpers/bind\":7,\"./helpers/combineURLs\":10,\"./helpers/isAbsoluteURL\":12,\"./helpers/spread\":15,\"./helpers/transformData\":16,\"./utils\":17}],4:[function(require,module,exports){\n'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\nfunction InterceptorManager() {\r\n this.handlers = [];\r\n}\r\n\r\n/**\r\n * Add a new interceptor to the stack\r\n *\r\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\r\n * @param {Function} rejected The function to handle `reject` for a `Promise`\r\n *\r\n * @return {Number} An ID used to remove interceptor later\r\n */\r\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\r\n this.handlers.push({\r\n fulfilled: fulfilled,\r\n rejected: rejected\r\n });\r\n return this.handlers.length - 1;\r\n};\r\n\r\n/**\r\n * Remove an interceptor from the stack\r\n *\r\n * @param {Number} id The ID that was returned by `use`\r\n */\r\nInterceptorManager.prototype.eject = function eject(id) {\r\n if (this.handlers[id]) {\r\n this.handlers[id] = null;\r\n }\r\n};\r\n\r\n/**\r\n * Iterate over all the registered interceptors\r\n *\r\n * This method is particularly useful for skipping over any\r\n * interceptors that may have become `null` calling `eject`.\r\n *\r\n * @param {Function} fn The function to call for each interceptor\r\n */\r\nInterceptorManager.prototype.forEach = function forEach(fn) {\r\n utils.forEach(this.handlers, function forEachHandler(h) {\r\n if (h !== null) {\r\n fn(h);\r\n }\r\n });\r\n};\r\n\r\nmodule.exports = InterceptorManager;\r\n\n},{\"./../utils\":17}],5:[function(require,module,exports){\n(function (process){\n'use strict';\r\n\r\n/**\r\n * Dispatch a request to the server using whichever adapter\r\n * is supported by the current environment.\r\n *\r\n * @param {object} config The config that is to be used for the request\r\n * @returns {Promise} The Promise to be fulfilled\r\n */\r\nmodule.exports = function dispatchRequest(config) {\r\n return new Promise(function executor(resolve, reject) {\r\n try {\r\n var adapter;\r\n\r\n if (typeof config.adapter === 'function') {\r\n // For custom adapter support\r\n adapter = config.adapter;\r\n } else if (typeof XMLHttpRequest !== 'undefined') {\r\n // For browsers use XHR adapter\r\n adapter = require('../adapters/xhr');\r\n } else if (typeof process !== 'undefined') {\r\n // For node use HTTP adapter\r\n adapter = require('../adapters/http');\r\n }\r\n\r\n if (typeof adapter === 'function') {\r\n adapter(resolve, reject, config);\r\n }\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n};\r\n\r\n\n}).call(this,require('_process'))\n\n},{\"../adapters/http\":2,\"../adapters/xhr\":2,\"_process\":20}],6:[function(require,module,exports){\n'use strict';\r\n\r\nvar utils = require('./utils');\r\n\r\nvar PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\r\nvar DEFAULT_CONTENT_TYPE = {\r\n 'Content-Type': 'application/x-www-form-urlencoded'\r\n};\r\n\r\nmodule.exports = {\r\n transformRequest: [function transformResponseJSON(data, headers) {\r\n if (utils.isFormData(data)) {\r\n return data;\r\n }\r\n if (utils.isArrayBuffer(data)) {\r\n return data;\r\n }\r\n if (utils.isArrayBufferView(data)) {\r\n return data.buffer;\r\n }\r\n if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {\r\n // Set application/json if no Content-Type has been specified\r\n if (!utils.isUndefined(headers)) {\r\n utils.forEach(headers, function processContentTypeHeader(val, key) {\r\n if (key.toLowerCase() === 'content-type') {\r\n headers['Content-Type'] = val;\r\n }\r\n });\r\n\r\n if (utils.isUndefined(headers['Content-Type'])) {\r\n headers['Content-Type'] = 'application/json;charset=utf-8';\r\n }\r\n }\r\n return JSON.stringify(data);\r\n }\r\n return data;\r\n }],\r\n\r\n transformResponse: [function transformResponseJSON(data) {\r\n /*eslint no-param-reassign:0*/\r\n if (typeof data === 'string') {\r\n data = data.replace(PROTECTION_PREFIX, '');\r\n try {\r\n data = JSON.parse(data);\r\n } catch (e) { /* Ignore */ }\r\n }\r\n return data;\r\n }],\r\n\r\n headers: {\r\n common: {\r\n 'Accept': 'application/json, text/plain, */*'\r\n },\r\n patch: utils.merge(DEFAULT_CONTENT_TYPE),\r\n post: utils.merge(DEFAULT_CONTENT_TYPE),\r\n put: utils.merge(DEFAULT_CONTENT_TYPE)\r\n },\r\n\r\n timeout: 0,\r\n\r\n xsrfCookieName: 'XSRF-TOKEN',\r\n xsrfHeaderName: 'X-XSRF-TOKEN'\r\n};\r\n\n},{\"./utils\":17}],7:[function(require,module,exports){\n'use strict';\r\n\r\nmodule.exports = function bind(fn, thisArg) {\r\n return function wrap() {\r\n var args = new Array(arguments.length);\r\n for (var i = 0; i < args.length; i++) {\r\n args[i] = arguments[i];\r\n }\r\n return fn.apply(thisArg, args);\r\n };\r\n};\r\n\n},{}],8:[function(require,module,exports){\n'use strict';\r\n\r\n// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js\r\n\r\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\r\n\r\nfunction InvalidCharacterError(message) {\r\n this.message = message;\r\n}\r\nInvalidCharacterError.prototype = new Error;\r\nInvalidCharacterError.prototype.code = 5;\r\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\r\n\r\nfunction btoa(input) {\r\n var str = String(input);\r\n var output = '';\r\n for (\r\n // initialize result and counter\r\n var block, charCode, idx = 0, map = chars;\r\n // if the next str index does not exist:\r\n // change the mapping table to \"=\"\r\n // check if d has no fractional digits\r\n str.charAt(idx | 0) || (map = '=', idx % 1);\r\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\r\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\r\n ) {\r\n charCode = str.charCodeAt(idx += 3 / 4);\r\n if (charCode > 0xFF) {\r\n throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');\r\n }\r\n block = block << 8 | charCode;\r\n }\r\n return output;\r\n}\r\n\r\nmodule.exports = btoa;\r\n\n},{}],9:[function(require,module,exports){\n'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\nfunction encode(val) {\r\n return encodeURIComponent(val).\r\n replace(/%40/gi, '@').\r\n replace(/%3A/gi, ':').\r\n replace(/%24/g, '$').\r\n replace(/%2C/gi, ',').\r\n replace(/%20/g, '+').\r\n replace(/%5B/gi, '[').\r\n replace(/%5D/gi, ']');\r\n}\r\n\r\n/**\r\n * Build a URL by appending params to the end\r\n *\r\n * @param {string} url The base of the url (e.g., http://www.google.com)\r\n * @param {object} [params] The params to be appended\r\n * @returns {string} The formatted url\r\n */\r\nmodule.exports = function buildURL(url, params, paramsSerializer) {\r\n /*eslint no-param-reassign:0*/\r\n if (!params) {\r\n return url;\r\n }\r\n\r\n var serializedParams;\r\n if (paramsSerializer) {\r\n serializedParams = paramsSerializer(params);\r\n } else {\r\n var parts = [];\r\n\r\n utils.forEach(params, function serialize(val, key) {\r\n if (val === null || typeof val === 'undefined') {\r\n return;\r\n }\r\n\r\n if (utils.isArray(val)) {\r\n key = key + '[]';\r\n }\r\n\r\n if (!utils.isArray(val)) {\r\n val = [val];\r\n }\r\n\r\n utils.forEach(val, function parseValue(v) {\r\n if (utils.isDate(v)) {\r\n v = v.toISOString();\r\n } else if (utils.isObject(v)) {\r\n v = JSON.stringify(v);\r\n }\r\n parts.push(encode(key) + '=' + encode(v));\r\n });\r\n });\r\n\r\n serializedParams = parts.join('&');\r\n }\r\n\r\n if (serializedParams) {\r\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\r\n }\r\n\r\n return url;\r\n};\r\n\r\n\n},{\"./../utils\":17}],10:[function(require,module,exports){\n'use strict';\r\n\r\n/**\r\n * Creates a new URL by combining the specified URLs\r\n *\r\n * @param {string} baseURL The base URL\r\n * @param {string} relativeURL The relative URL\r\n * @returns {string} The combined URL\r\n */\r\nmodule.exports = function combineURLs(baseURL, relativeURL) {\r\n return baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '');\r\n};\r\n\n},{}],11:[function(require,module,exports){\n'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\nmodule.exports = (\r\n utils.isStandardBrowserEnv() ?\r\n\r\n // Standard browser envs support document.cookie\r\n (function standardBrowserEnv() {\r\n return {\r\n write: function write(name, value, expires, path, domain, secure) {\r\n var cookie = [];\r\n cookie.push(name + '=' + encodeURIComponent(value));\r\n\r\n if (utils.isNumber(expires)) {\r\n cookie.push('expires=' + new Date(expires).toGMTString());\r\n }\r\n\r\n if (utils.isString(path)) {\r\n cookie.push('path=' + path);\r\n }\r\n\r\n if (utils.isString(domain)) {\r\n cookie.push('domain=' + domain);\r\n }\r\n\r\n if (secure === true) {\r\n cookie.push('secure');\r\n }\r\n\r\n document.cookie = cookie.join('; ');\r\n },\r\n\r\n read: function read(name) {\r\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\r\n return (match ? decodeURIComponent(match[3]) : null);\r\n },\r\n\r\n remove: function remove(name) {\r\n this.write(name, '', Date.now() - 86400000);\r\n }\r\n };\r\n })() :\r\n\r\n // Non standard browser env (web workers, react-native) lack needed support.\r\n (function nonStandardBrowserEnv() {\r\n return {\r\n write: function write() {},\r\n read: function read() { return null; },\r\n remove: function remove() {}\r\n };\r\n })()\r\n);\r\n\n},{\"./../utils\":17}],12:[function(require,module,exports){\n'use strict';\r\n\r\n/**\r\n * Determines whether the specified URL is absolute\r\n *\r\n * @param {string} url The URL to test\r\n * @returns {boolean} True if the specified URL is absolute, otherwise false\r\n */\r\nmodule.exports = function isAbsoluteURL(url) {\r\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\r\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\r\n // by any combination of letters, digits, plus, period, or hyphen.\r\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\r\n};\r\n\n},{}],13:[function(require,module,exports){\n'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\nmodule.exports = (\r\n utils.isStandardBrowserEnv() ?\r\n\r\n // Standard browser envs have full support of the APIs needed to test\r\n // whether the request URL is of the same origin as current location.\r\n (function standardBrowserEnv() {\r\n var msie = /(msie|trident)/i.test(navigator.userAgent);\r\n var urlParsingNode = document.createElement('a');\r\n var originURL;\r\n\r\n /**\r\n * Parse a URL to discover it's components\r\n *\r\n * @param {String} url The URL to be parsed\r\n * @returns {Object}\r\n */\r\n function resolveURL(url) {\r\n var href = url;\r\n\r\n if (msie) {\r\n // IE needs attribute set twice to normalize properties\r\n urlParsingNode.setAttribute('href', href);\r\n href = urlParsingNode.href;\r\n }\r\n\r\n urlParsingNode.setAttribute('href', href);\r\n\r\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\r\n return {\r\n href: urlParsingNode.href,\r\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\r\n host: urlParsingNode.host,\r\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\r\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\r\n hostname: urlParsingNode.hostname,\r\n port: urlParsingNode.port,\r\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\r\n urlParsingNode.pathname :\r\n '/' + urlParsingNode.pathname\r\n };\r\n }\r\n\r\n originURL = resolveURL(window.location.href);\r\n\r\n /**\r\n * Determine if a URL shares the same origin as the current location\r\n *\r\n * @param {String} requestURL The URL to test\r\n * @returns {boolean} True if URL shares the same origin, otherwise false\r\n */\r\n return function isURLSameOrigin(requestURL) {\r\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\r\n return (parsed.protocol === originURL.protocol &&\r\n parsed.host === originURL.host);\r\n };\r\n })() :\r\n\r\n // Non standard browser envs (web workers, react-native) lack needed support.\r\n (function nonStandardBrowserEnv() {\r\n return function isURLSameOrigin() {\r\n return true;\r\n };\r\n })()\r\n);\r\n\n},{\"./../utils\":17}],14:[function(require,module,exports){\n'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\n/**\r\n * Parse headers into an object\r\n *\r\n * ```\r\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\r\n * Content-Type: application/json\r\n * Connection: keep-alive\r\n * Transfer-Encoding: chunked\r\n * ```\r\n *\r\n * @param {String} headers Headers needing to be parsed\r\n * @returns {Object} Headers parsed into an object\r\n */\r\nmodule.exports = function parseHeaders(headers) {\r\n var parsed = {};\r\n var key;\r\n var val;\r\n var i;\r\n\r\n if (!headers) { return parsed; }\r\n\r\n utils.forEach(headers.split('\\n'), function parser(line) {\r\n i = line.indexOf(':');\r\n key = utils.trim(line.substr(0, i)).toLowerCase();\r\n val = utils.trim(line.substr(i + 1));\r\n\r\n if (key) {\r\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\r\n }\r\n });\r\n\r\n return parsed;\r\n};\r\n\n},{\"./../utils\":17}],15:[function(require,module,exports){\n'use strict';\r\n\r\n/**\r\n * Syntactic sugar for invoking a function and expanding an array for arguments.\r\n *\r\n * Common use case would be to use `Function.prototype.apply`.\r\n *\r\n * ```js\r\n * function f(x, y, z) {}\r\n * var args = [1, 2, 3];\r\n * f.apply(null, args);\r\n * ```\r\n *\r\n * With `spread` this example can be re-written.\r\n *\r\n * ```js\r\n * spread(function(x, y, z) {})([1, 2, 3]);\r\n * ```\r\n *\r\n * @param {Function} callback\r\n * @returns {Function}\r\n */\r\nmodule.exports = function spread(callback) {\r\n return function wrap(arr) {\r\n return callback.apply(null, arr);\r\n };\r\n};\r\n\n},{}],16:[function(require,module,exports){\n'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\n/**\r\n * Transform the data for a request or a response\r\n *\r\n * @param {Object|String} data The data to be transformed\r\n * @param {Array} headers The headers for the request or response\r\n * @param {Array|Function} fns A single function or Array of functions\r\n * @returns {*} The resulting transformed data\r\n */\r\nmodule.exports = function transformData(data, headers, fns) {\r\n /*eslint no-param-reassign:0*/\r\n utils.forEach(fns, function transform(fn) {\r\n data = fn(data, headers);\r\n });\r\n\r\n return data;\r\n};\r\n\n},{\"./../utils\":17}],17:[function(require,module,exports){\n'use strict';\r\n\r\n/*global toString:true*/\r\n\r\n// utils is a library of generic helper functions non-specific to axios\r\n\r\nvar toString = Object.prototype.toString;\r\n\r\n/**\r\n * Determine if a value is an Array\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is an Array, otherwise false\r\n */\r\nfunction isArray(val) {\r\n return toString.call(val) === '[object Array]';\r\n}\r\n\r\n/**\r\n * Determine if a value is an ArrayBuffer\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\r\n */\r\nfunction isArrayBuffer(val) {\r\n return toString.call(val) === '[object ArrayBuffer]';\r\n}\r\n\r\n/**\r\n * Determine if a value is a FormData\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is an FormData, otherwise false\r\n */\r\nfunction isFormData(val) {\r\n return toString.call(val) === '[object FormData]';\r\n}\r\n\r\n/**\r\n * Determine if a value is a view on an ArrayBuffer\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\r\n */\r\nfunction isArrayBufferView(val) {\r\n var result;\r\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\r\n result = ArrayBuffer.isView(val);\r\n } else {\r\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Determine if a value is a String\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a String, otherwise false\r\n */\r\nfunction isString(val) {\r\n return typeof val === 'string';\r\n}\r\n\r\n/**\r\n * Determine if a value is a Number\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a Number, otherwise false\r\n */\r\nfunction isNumber(val) {\r\n return typeof val === 'number';\r\n}\r\n\r\n/**\r\n * Determine if a value is undefined\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if the value is undefined, otherwise false\r\n */\r\nfunction isUndefined(val) {\r\n return typeof val === 'undefined';\r\n}\r\n\r\n/**\r\n * Determine if a value is an Object\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is an Object, otherwise false\r\n */\r\nfunction isObject(val) {\r\n return val !== null && typeof val === 'object';\r\n}\r\n\r\n/**\r\n * Determine if a value is a Date\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a Date, otherwise false\r\n */\r\nfunction isDate(val) {\r\n return toString.call(val) === '[object Date]';\r\n}\r\n\r\n/**\r\n * Determine if a value is a File\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a File, otherwise false\r\n */\r\nfunction isFile(val) {\r\n return toString.call(val) === '[object File]';\r\n}\r\n\r\n/**\r\n * Determine if a value is a Blob\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a Blob, otherwise false\r\n */\r\nfunction isBlob(val) {\r\n return toString.call(val) === '[object Blob]';\r\n}\r\n\r\n/**\r\n * Trim excess whitespace off the beginning and end of a string\r\n *\r\n * @param {String} str The String to trim\r\n * @returns {String} The String freed of excess whitespace\r\n */\r\nfunction trim(str) {\r\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\r\n}\r\n\r\n/**\r\n * Determine if we're running in a standard browser environment\r\n *\r\n * This allows axios to run in a web worker, and react-native.\r\n * Both environments support XMLHttpRequest, but not fully standard globals.\r\n *\r\n * web workers:\r\n * typeof window -> undefined\r\n * typeof document -> undefined\r\n *\r\n * react-native:\r\n * typeof document.createElement -> undefined\r\n */\r\nfunction isStandardBrowserEnv() {\r\n return (\r\n typeof window !== 'undefined' &&\r\n typeof document !== 'undefined' &&\r\n typeof document.createElement === 'function'\r\n );\r\n}\r\n\r\n/**\r\n * Iterate over an Array or an Object invoking a function for each item.\r\n *\r\n * If `obj` is an Array callback will be called passing\r\n * the value, index, and complete array for each item.\r\n *\r\n * If 'obj' is an Object callback will be called passing\r\n * the value, key, and complete object for each property.\r\n *\r\n * @param {Object|Array} obj The object to iterate\r\n * @param {Function} fn The callback to invoke for each item\r\n */\r\nfunction forEach(obj, fn) {\r\n // Don't bother if no value provided\r\n if (obj === null || typeof obj === 'undefined') {\r\n return;\r\n }\r\n\r\n // Force an array if not already something iterable\r\n if (typeof obj !== 'object' && !isArray(obj)) {\r\n /*eslint no-param-reassign:0*/\r\n obj = [obj];\r\n }\r\n\r\n if (isArray(obj)) {\r\n // Iterate over array values\r\n for (var i = 0, l = obj.length; i < l; i++) {\r\n fn.call(null, obj[i], i, obj);\r\n }\r\n } else {\r\n // Iterate over object keys\r\n for (var key in obj) {\r\n if (obj.hasOwnProperty(key)) {\r\n fn.call(null, obj[key], key, obj);\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Accepts varargs expecting each argument to be an object, then\r\n * immutably merges the properties of each object and returns result.\r\n *\r\n * When multiple objects contain the same key the later object in\r\n * the arguments list will take precedence.\r\n *\r\n * Example:\r\n *\r\n * ```js\r\n * var result = merge({foo: 123}, {foo: 456});\r\n * console.log(result.foo); // outputs 456\r\n * ```\r\n *\r\n * @param {Object} obj1 Object to merge\r\n * @returns {Object} Result of all merge properties\r\n */\r\nfunction merge(/* obj1, obj2, obj3, ... */) {\r\n var result = {};\r\n function assignValue(val, key) {\r\n if (typeof result[key] === 'object' && typeof val === 'object') {\r\n result[key] = merge(result[key], val);\r\n } else {\r\n result[key] = val;\r\n }\r\n }\r\n\r\n for (var i = 0, l = arguments.length; i < l; i++) {\r\n forEach(arguments[i], assignValue);\r\n }\r\n return result;\r\n}\r\n\r\nmodule.exports = {\r\n isArray: isArray,\r\n isArrayBuffer: isArrayBuffer,\r\n isFormData: isFormData,\r\n isArrayBufferView: isArrayBufferView,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isObject: isObject,\r\n isUndefined: isUndefined,\r\n isDate: isDate,\r\n isFile: isFile,\r\n isBlob: isBlob,\r\n isStandardBrowserEnv: isStandardBrowserEnv,\r\n forEach: forEach,\r\n merge: merge,\r\n trim: trim\r\n};\r\n\n},{}],18:[function(require,module,exports){\n(function (global){\n/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */\n;(function(root) {\n\n\t// Detect free variables `exports`.\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`.\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code, and use\n\t// it as `root`.\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar InvalidCharacterError = function(message) {\n\t\tthis.message = message;\n\t};\n\tInvalidCharacterError.prototype = new Error;\n\tInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n\tvar error = function(message) {\n\t\t// Note: the error messages used throughout this file match those used by\n\t\t// the native `atob`/`btoa` implementation in Chromium.\n\t\tthrow new InvalidCharacterError(message);\n\t};\n\n\tvar TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\t// http://whatwg.org/html/common-microsyntaxes.html#space-character\n\tvar REGEX_SPACE_CHARACTERS = /[\\t\\n\\f\\r ]/g;\n\n\t// `decode` is designed to be fully compatible with `atob` as described in the\n\t// HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob\n\t// The optimized base64-decoding algorithm used is based on @atk’s excellent\n\t// implementation. https://gist.github.com/atk/1020396\n\tvar decode = function(input) {\n\t\tinput = String(input)\n\t\t\t.replace(REGEX_SPACE_CHARACTERS, '');\n\t\tvar length = input.length;\n\t\tif (length % 4 == 0) {\n\t\t\tinput = input.replace(/==?$/, '');\n\t\t\tlength = input.length;\n\t\t}\n\t\tif (\n\t\t\tlength % 4 == 1 ||\n\t\t\t// http://whatwg.org/C#alphanumeric-ascii-characters\n\t\t\t/[^+a-zA-Z0-9/]/.test(input)\n\t\t) {\n\t\t\terror(\n\t\t\t\t'Invalid character: the string to be decoded is not correctly encoded.'\n\t\t\t);\n\t\t}\n\t\tvar bitCounter = 0;\n\t\tvar bitStorage;\n\t\tvar buffer;\n\t\tvar output = '';\n\t\tvar position = -1;\n\t\twhile (++position < length) {\n\t\t\tbuffer = TABLE.indexOf(input.charAt(position));\n\t\t\tbitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;\n\t\t\t// Unless this is the first of a group of 4 characters…\n\t\t\tif (bitCounter++ % 4) {\n\t\t\t\t// …convert the first 8 bits to a single ASCII character.\n\t\t\t\toutput += String.fromCharCode(\n\t\t\t\t\t0xFF & bitStorage >> (-2 * bitCounter & 6)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t};\n\n\t// `encode` is designed to be fully compatible with `btoa` as described in the\n\t// HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa\n\tvar encode = function(input) {\n\t\tinput = String(input);\n\t\tif (/[^\\0-\\xFF]/.test(input)) {\n\t\t\t// Note: no need to special-case astral symbols here, as surrogates are\n\t\t\t// matched, and the input is supposed to only contain ASCII anyway.\n\t\t\terror(\n\t\t\t\t'The string to be encoded contains characters outside of the ' +\n\t\t\t\t'Latin1 range.'\n\t\t\t);\n\t\t}\n\t\tvar padding = input.length % 3;\n\t\tvar output = '';\n\t\tvar position = -1;\n\t\tvar a;\n\t\tvar b;\n\t\tvar c;\n\t\tvar d;\n\t\tvar buffer;\n\t\t// Make sure any padding is handled outside of the loop.\n\t\tvar length = input.length - padding;\n\n\t\twhile (++position < length) {\n\t\t\t// Read three bytes, i.e. 24 bits.\n\t\t\ta = input.charCodeAt(position) << 16;\n\t\t\tb = input.charCodeAt(++position) << 8;\n\t\t\tc = input.charCodeAt(++position);\n\t\t\tbuffer = a + b + c;\n\t\t\t// Turn the 24 bits into four chunks of 6 bits each, and append the\n\t\t\t// matching character for each of them to the output.\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 18 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer >> 12 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer >> 6 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer & 0x3F)\n\t\t\t);\n\t\t}\n\n\t\tif (padding == 2) {\n\t\t\ta = input.charCodeAt(position) << 8;\n\t\t\tb = input.charCodeAt(++position);\n\t\t\tbuffer = a + b;\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 10) +\n\t\t\t\tTABLE.charAt((buffer >> 4) & 0x3F) +\n\t\t\t\tTABLE.charAt((buffer << 2) & 0x3F) +\n\t\t\t\t'='\n\t\t\t);\n\t\t} else if (padding == 1) {\n\t\t\tbuffer = input.charCodeAt(position);\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 2) +\n\t\t\t\tTABLE.charAt((buffer << 4) & 0x3F) +\n\t\t\t\t'=='\n\t\t\t);\n\t\t}\n\n\t\treturn output;\n\t};\n\n\tvar base64 = {\n\t\t'encode': encode,\n\t\t'decode': decode,\n\t\t'version': '0.1.0'\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn base64;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = base64;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (var key in base64) {\n\t\t\t\tbase64.hasOwnProperty(key) && (freeExports[key] = base64[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.base64 = base64;\n\t}\n\n}(this));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}],19:[function(require,module,exports){\n(function (process,global){\n/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE\n * @version 3.1.2\n */\n\n(function() {\n \"use strict\";\n function lib$es6$promise$utils$$objectOrFunction(x) {\n return typeof x === 'function' || (typeof x === 'object' && x !== null);\n }\n\n function lib$es6$promise$utils$$isFunction(x) {\n return typeof x === 'function';\n }\n\n function lib$es6$promise$utils$$isMaybeThenable(x) {\n return typeof x === 'object' && x !== null;\n }\n\n var lib$es6$promise$utils$$_isArray;\n if (!Array.isArray) {\n lib$es6$promise$utils$$_isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n } else {\n lib$es6$promise$utils$$_isArray = Array.isArray;\n }\n\n var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;\n var lib$es6$promise$asap$$len = 0;\n var lib$es6$promise$asap$$vertxNext;\n var lib$es6$promise$asap$$customSchedulerFn;\n\n var lib$es6$promise$asap$$asap = function asap(callback, arg) {\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;\n lib$es6$promise$asap$$len += 2;\n if (lib$es6$promise$asap$$len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (lib$es6$promise$asap$$customSchedulerFn) {\n lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);\n } else {\n lib$es6$promise$asap$$scheduleFlush();\n }\n }\n }\n\n function lib$es6$promise$asap$$setScheduler(scheduleFn) {\n lib$es6$promise$asap$$customSchedulerFn = scheduleFn;\n }\n\n function lib$es6$promise$asap$$setAsap(asapFn) {\n lib$es6$promise$asap$$asap = asapFn;\n }\n\n var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;\n var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};\n var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;\n var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n // test for web worker but not in IE10\n var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&\n typeof importScripts !== 'undefined' &&\n typeof MessageChannel !== 'undefined';\n\n // node\n function lib$es6$promise$asap$$useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function() {\n process.nextTick(lib$es6$promise$asap$$flush);\n };\n }\n\n // vertx\n function lib$es6$promise$asap$$useVertxTimer() {\n return function() {\n lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);\n };\n }\n\n function lib$es6$promise$asap$$useMutationObserver() {\n var iterations = 0;\n var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function() {\n node.data = (iterations = ++iterations % 2);\n };\n }\n\n // web worker\n function lib$es6$promise$asap$$useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = lib$es6$promise$asap$$flush;\n return function () {\n channel.port2.postMessage(0);\n };\n }\n\n function lib$es6$promise$asap$$useSetTimeout() {\n return function() {\n setTimeout(lib$es6$promise$asap$$flush, 1);\n };\n }\n\n var lib$es6$promise$asap$$queue = new Array(1000);\n function lib$es6$promise$asap$$flush() {\n for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {\n var callback = lib$es6$promise$asap$$queue[i];\n var arg = lib$es6$promise$asap$$queue[i+1];\n\n callback(arg);\n\n lib$es6$promise$asap$$queue[i] = undefined;\n lib$es6$promise$asap$$queue[i+1] = undefined;\n }\n\n lib$es6$promise$asap$$len = 0;\n }\n\n function lib$es6$promise$asap$$attemptVertx() {\n try {\n var r = require;\n var vertx = r('vertx');\n lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return lib$es6$promise$asap$$useVertxTimer();\n } catch(e) {\n return lib$es6$promise$asap$$useSetTimeout();\n }\n }\n\n var lib$es6$promise$asap$$scheduleFlush;\n // Decide what async method to use to triggering processing of queued callbacks:\n if (lib$es6$promise$asap$$isNode) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();\n } else if (lib$es6$promise$asap$$BrowserMutationObserver) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();\n } else if (lib$es6$promise$asap$$isWorker) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();\n } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();\n } else {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();\n }\n function lib$es6$promise$then$$then(onFulfillment, onRejection) {\n var parent = this;\n var state = parent._state;\n\n if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {\n return this;\n }\n\n var child = new this.constructor(lib$es6$promise$$internal$$noop);\n var result = parent._result;\n\n if (state) {\n var callback = arguments[state - 1];\n lib$es6$promise$asap$$asap(function(){\n lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);\n });\n } else {\n lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n }\n var lib$es6$promise$then$$default = lib$es6$promise$then$$then;\n function lib$es6$promise$promise$resolve$$resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$resolve(promise, object);\n return promise;\n }\n var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;\n\n function lib$es6$promise$$internal$$noop() {}\n\n var lib$es6$promise$$internal$$PENDING = void 0;\n var lib$es6$promise$$internal$$FULFILLED = 1;\n var lib$es6$promise$$internal$$REJECTED = 2;\n\n var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n }\n\n function lib$es6$promise$$internal$$cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n }\n\n function lib$es6$promise$$internal$$getThen(promise) {\n try {\n return promise.then;\n } catch(error) {\n lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;\n return lib$es6$promise$$internal$$GET_THEN_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch(e) {\n return e;\n }\n }\n\n function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {\n lib$es6$promise$asap$$asap(function(promise) {\n var sealed = false;\n var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {\n if (sealed) { return; }\n sealed = true;\n if (thenable !== value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }, function(reason) {\n if (sealed) { return; }\n sealed = true;\n\n lib$es6$promise$$internal$$reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n lib$es6$promise$$internal$$reject(promise, error);\n }\n }, promise);\n }\n\n function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {\n if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, thenable._result);\n } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, thenable._result);\n } else {\n lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n }\n }\n\n function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) {\n if (maybeThenable.constructor === promise.constructor &&\n then === lib$es6$promise$then$$default &&\n constructor.resolve === lib$es6$promise$promise$resolve$$default) {\n lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);\n } else {\n if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);\n } else if (then === undefined) {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n } else if (lib$es6$promise$utils$$isFunction(then)) {\n lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n }\n }\n }\n\n function lib$es6$promise$$internal$$resolve(promise, value) {\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());\n } else if (lib$es6$promise$utils$$objectOrFunction(value)) {\n lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value));\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n lib$es6$promise$$internal$$publish(promise);\n }\n\n function lib$es6$promise$$internal$$fulfill(promise, value) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n\n promise._result = value;\n promise._state = lib$es6$promise$$internal$$FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);\n }\n }\n\n function lib$es6$promise$$internal$$reject(promise, reason) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n promise._state = lib$es6$promise$$internal$$REJECTED;\n promise._result = reason;\n\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);\n }\n\n function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {\n var subscribers = parent._subscribers;\n var length = subscribers.length;\n\n parent._onerror = null;\n\n subscribers[length] = child;\n subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;\n subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);\n }\n }\n\n function lib$es6$promise$$internal$$publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) { return; }\n\n var child, callback, detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n }\n\n function lib$es6$promise$$internal$$ErrorObject() {\n this.error = null;\n }\n\n var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$tryCatch(callback, detail) {\n try {\n return callback(detail);\n } catch(e) {\n lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;\n return lib$es6$promise$$internal$$TRY_CATCH_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {\n var hasCallback = lib$es6$promise$utils$$isFunction(callback),\n value, error, succeeded, failed;\n\n if (hasCallback) {\n value = lib$es6$promise$$internal$$tryCatch(callback, detail);\n\n if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value = null;\n } else {\n succeeded = true;\n }\n\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());\n return;\n }\n\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (promise._state !== lib$es6$promise$$internal$$PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else if (failed) {\n lib$es6$promise$$internal$$reject(promise, error);\n } else if (settled === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, value);\n } else if (settled === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value){\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function rejectPromise(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n } catch(e) {\n lib$es6$promise$$internal$$reject(promise, e);\n }\n }\n\n function lib$es6$promise$promise$all$$all(entries) {\n return new lib$es6$promise$enumerator$$default(this, entries).promise;\n }\n var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;\n function lib$es6$promise$promise$race$$race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (!lib$es6$promise$utils$$isArray(entries)) {\n lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));\n return promise;\n }\n\n var length = entries.length;\n\n function onFulfillment(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }\n\n function onRejection(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n }\n\n for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);\n }\n\n return promise;\n }\n var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;\n function lib$es6$promise$promise$reject$$reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$reject(promise, reason);\n return promise;\n }\n var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;\n\n var lib$es6$promise$promise$$counter = 0;\n\n function lib$es6$promise$promise$$needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n }\n\n function lib$es6$promise$promise$$needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n }\n\n var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;\n /**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n var promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {function} resolver\n Useful for tooling.\n @constructor\n */\n function lib$es6$promise$promise$$Promise(resolver) {\n this._id = lib$es6$promise$promise$$counter++;\n this._state = undefined;\n this._result = undefined;\n this._subscribers = [];\n\n if (lib$es6$promise$$internal$$noop !== resolver) {\n typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver();\n this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew();\n }\n }\n\n lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;\n lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;\n lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;\n lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;\n lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;\n lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;\n lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;\n\n lib$es6$promise$promise$$Promise.prototype = {\n constructor: lib$es6$promise$promise$$Promise,\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n\n Chaining\n --------\n\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n\n Assimilation\n ------------\n\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n\n If the assimliated promise rejects, then the downstream promise will also reject.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n\n Simple Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var result;\n\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n\n Advanced Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var author, books;\n\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n\n function foundBooks(books) {\n\n }\n\n function failure(reason) {\n\n }\n\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n then: lib$es6$promise$then$$default,\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n };\n var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;\n function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (Array.isArray(input)) {\n this._input = input;\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate();\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n }\n }\n } else {\n lib$es6$promise$$internal$$reject(this.promise, this._validationError());\n }\n }\n\n lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {\n return new Error('Array Methods must be provided an Array');\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {\n var length = this.length;\n var input = this._input;\n\n for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {\n var c = this._instanceConstructor;\n var resolve = c.resolve;\n\n if (resolve === lib$es6$promise$promise$resolve$$default) {\n var then = lib$es6$promise$$internal$$getThen(entry);\n\n if (then === lib$es6$promise$then$$default &&\n entry._state !== lib$es6$promise$$internal$$PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === lib$es6$promise$promise$$default) {\n var promise = new c(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then);\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);\n }\n } else {\n this._willSettleAt(resolve(entry), i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {\n var promise = this.promise;\n\n if (promise._state === lib$es6$promise$$internal$$PENDING) {\n this._remaining--;\n\n if (state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(promise, this._result);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {\n var enumerator = this;\n\n lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {\n enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);\n }, function(reason) {\n enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);\n });\n };\n function lib$es6$promise$polyfill$$polyfill() {\n var local;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {\n return;\n }\n\n local.Promise = lib$es6$promise$promise$$default;\n }\n var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;\n\n var lib$es6$promise$umd$$ES6Promise = {\n 'Promise': lib$es6$promise$promise$$default,\n 'polyfill': lib$es6$promise$polyfill$$default\n };\n\n /* global define:true module:true window: true */\n if (typeof define === 'function' && define['amd']) {\n define(function() { return lib$es6$promise$umd$$ES6Promise; });\n } else if (typeof module !== 'undefined' && module['exports']) {\n module['exports'] = lib$es6$promise$umd$$ES6Promise;\n } else if (typeof this !== 'undefined') {\n this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;\n }\n\n lib$es6$promise$polyfill$$default();\n}).call(this);\n\n\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{\"_process\":20}],20:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],21:[function(require,module,exports){\n(function (global){\n/*! https://mths.be/utf8js v2.0.0 by @mathias */\n;(function(root) {\n\n\t// Detect free variables `exports`\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code,\n\t// and use it as `root`\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar stringFromCharCode = String.fromCharCode;\n\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2decode(string) {\n\t\tvar output = [];\n\t\tvar counter = 0;\n\t\tvar length = string.length;\n\t\tvar value;\n\t\tvar extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2encode(array) {\n\t\tvar length = array.length;\n\t\tvar index = -1;\n\t\tvar value;\n\t\tvar output = '';\n\t\twhile (++index < length) {\n\t\t\tvalue = array[index];\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t}\n\t\treturn output;\n\t}\n\n\tfunction checkScalarValue(codePoint) {\n\t\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t}\n\t/*--------------------------------------------------------------------------*/\n\n\tfunction createByte(codePoint, shift) {\n\t\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n\t}\n\n\tfunction encodeCodePoint(codePoint) {\n\t\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\t\treturn stringFromCharCode(codePoint);\n\t\t}\n\t\tvar symbol = '';\n\t\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t\t}\n\t\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\t\tcheckScalarValue(codePoint);\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\t\tsymbol += createByte(codePoint, 12);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\t\treturn symbol;\n\t}\n\n\tfunction utf8encode(string) {\n\t\tvar codePoints = ucs2decode(string);\n\t\tvar length = codePoints.length;\n\t\tvar index = -1;\n\t\tvar codePoint;\n\t\tvar byteString = '';\n\t\twhile (++index < length) {\n\t\t\tcodePoint = codePoints[index];\n\t\t\tbyteString += encodeCodePoint(codePoint);\n\t\t}\n\t\treturn byteString;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tfunction readContinuationByte() {\n\t\tif (byteIndex >= byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\n\t\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\n\t\tif ((continuationByte & 0xC0) == 0x80) {\n\t\t\treturn continuationByte & 0x3F;\n\t\t}\n\n\t\t// If we end up here, it’s not a continuation byte\n\t\tthrow Error('Invalid continuation byte');\n\t}\n\n\tfunction decodeSymbol() {\n\t\tvar byte1;\n\t\tvar byte2;\n\t\tvar byte3;\n\t\tvar byte4;\n\t\tvar codePoint;\n\n\t\tif (byteIndex > byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\n\t\tif (byteIndex == byteCount) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Read first byte\n\t\tbyte1 = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\n\t\t// 1-byte sequence (no continuation bytes)\n\t\tif ((byte1 & 0x80) == 0) {\n\t\t\treturn byte1;\n\t\t}\n\n\t\t// 2-byte sequence\n\t\tif ((byte1 & 0xE0) == 0xC0) {\n\t\t\tvar byte2 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\t\tif (codePoint >= 0x80) {\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\n\t\t// 3-byte sequence (may include unpaired surrogates)\n\t\tif ((byte1 & 0xF0) == 0xE0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\t\tif (codePoint >= 0x0800) {\n\t\t\t\tcheckScalarValue(codePoint);\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\n\t\t// 4-byte sequence\n\t\tif ((byte1 & 0xF8) == 0xF0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tbyte4 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |\n\t\t\t\t(byte3 << 0x06) | byte4;\n\t\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\t\treturn codePoint;\n\t\t\t}\n\t\t}\n\n\t\tthrow Error('Invalid UTF-8 detected');\n\t}\n\n\tvar byteArray;\n\tvar byteCount;\n\tvar byteIndex;\n\tfunction utf8decode(byteString) {\n\t\tbyteArray = ucs2decode(byteString);\n\t\tbyteCount = byteArray.length;\n\t\tbyteIndex = 0;\n\t\tvar codePoints = [];\n\t\tvar tmp;\n\t\twhile ((tmp = decodeSymbol()) !== false) {\n\t\t\tcodePoints.push(tmp);\n\t\t}\n\t\treturn ucs2encode(codePoints);\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar utf8 = {\n\t\t'version': '2.0.0',\n\t\t'encode': utf8encode,\n\t\t'decode': utf8decode\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn utf8;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = utf8;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tvar object = {};\n\t\t\tvar hasOwnProperty = object.hasOwnProperty;\n\t\t\tfor (var key in utf8) {\n\t\t\t\thasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.utf8 = utf8;\n\t}\n\n}(this));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}],22:[function(require,module,exports){\n/*!\r\n * @overview Github.js\r\n *\r\n * @copyright (c) 2013 Michael Aufreiter, Development Seed\r\n * Github.js is freely distributable.\r\n *\r\n * @license Licensed under BSD-3-Clause-Clear\r\n *\r\n * For all details and documentation:\r\n * http://substance.io/michael/github\r\n */\r\n'use strict';\r\n\r\n(function (root, factory) {\r\n /* istanbul ignore next */\r\n if (typeof define === 'function' && define.amd) {\r\n define(\r\n [\r\n 'es6-promise',\r\n 'base-64',\r\n 'utf8',\r\n 'axios'\r\n ],\r\n function (Promise, Base64, Utf8, axios) {\r\n return (root.Github = factory(Promise, Base64, Utf8, axios));\r\n }\r\n );\r\n } else if (typeof module === 'object' && module.exports) {\r\n module.exports = factory(require('es6-promise'), require('base-64'), require('utf8'), require('axios'));\r\n } else {\r\n root.Github = factory(root.Promise, root.base64, root.utf8, root.axios);\r\n }\r\n}(this, function(Promise, Base64, Utf8, axios) { // jshint ignore:line\r\n function b64encode(string) {\r\n return Base64.encode(Utf8.encode(string));\r\n }\r\n\r\n if (Promise.polyfill) {\r\n Promise.polyfill();\r\n }\r\n\r\n // Initial Setup\r\n // -------------\r\n\r\n var Github = function (options) {\r\n options = options || {};\r\n\r\n var API_URL = options.apiUrl || 'https://api.github.com';\r\n\r\n // HTTP Request Abstraction\r\n // =======\r\n //\r\n // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec.\r\n\r\n var _request = Github._request = function _request(method, path, data, cb, raw) {\r\n function getURL() {\r\n var url = path.indexOf('//') >= 0 ? path : API_URL + path;\r\n\r\n url += ((/\\?/).test(url) ? '&' : '?');\r\n\r\n if (data && typeof data === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) {\r\n for(var param in data) {\r\n if (data.hasOwnProperty(param)) {\r\n url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]);\r\n }\r\n }\r\n }\r\n\r\n return url.replace(/(×tamp=\\d+)/, '') +\r\n (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : '');\r\n }\r\n\r\n var config = {\r\n headers: {\r\n Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json',\r\n 'Content-Type': 'application/json;charset=UTF-8'\r\n },\r\n method: method,\r\n data: data ? data : {},\r\n url: getURL()\r\n };\r\n\r\n if ((options.token) || (options.username && options.password)) {\r\n config.headers.Authorization = options.token ?\r\n 'token ' + options.token :\r\n 'Basic ' + b64encode(options.username + ':' + options.password);\r\n }\r\n\r\n return axios(config)\r\n .then(function (response) {\r\n cb(\r\n null,\r\n response.data || true,\r\n response.request\r\n );\r\n }, function (response) {\r\n if (response.status === 304) {\r\n cb(\r\n null,\r\n response.data || true,\r\n response.request\r\n );\r\n } else {\r\n cb({\r\n path: path,\r\n request: response.request,\r\n error: response.status\r\n });\r\n }\r\n });\r\n };\r\n\r\n var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, cb) {\r\n var results = [];\r\n\r\n (function iterate() {\r\n _request('GET', path, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n if (!(res instanceof Array)) {\r\n res = [res];\r\n }\r\n\r\n results.push.apply(results, res);\r\n\r\n var next = (xhr.getResponseHeader('link') || '')\r\n .split(',')\r\n .filter(function(link) {\r\n return /rel=\"next\"/.test(link);\r\n })\r\n .map(function(link) {\r\n return (/<(.*)>/.exec(link) || [])[1];\r\n })\r\n .pop();\r\n\r\n if (!next) {\r\n cb(err, results, xhr);\r\n } else {\r\n path = next;\r\n iterate();\r\n }\r\n });\r\n })();\r\n };\r\n\r\n // User API\r\n // =======\r\n\r\n Github.User = function () {\r\n this.repos = function (options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n options = options || {};\r\n\r\n var url = '/user/repos';\r\n var params = [];\r\n\r\n params.push('type=' + encodeURIComponent(options.type || 'all'));\r\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\r\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n url += '?' + params.join('&');\r\n\r\n _requestAllPages(url, cb);\r\n };\r\n\r\n // List user organizations\r\n // -------\r\n\r\n this.orgs = function (cb) {\r\n _request('GET', '/user/orgs', null, cb);\r\n };\r\n\r\n // List authenticated user's gists\r\n // -------\r\n\r\n this.gists = function (cb) {\r\n _request('GET', '/gists', null, cb);\r\n };\r\n\r\n // List authenticated user's unread notifications\r\n // -------\r\n\r\n this.notifications = function (options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n options = options || {};\r\n var url = '/notifications';\r\n var params = [];\r\n\r\n if (options.all) {\r\n params.push('all=true');\r\n }\r\n\r\n if (options.participating) {\r\n params.push('participating=true');\r\n }\r\n\r\n if (options.since) {\r\n var since = options.since;\r\n\r\n if (since.constructor === Date) {\r\n since = since.toISOString();\r\n }\r\n\r\n params.push('since=' + encodeURIComponent(since));\r\n }\r\n\r\n if (options.before) {\r\n var before = options.before;\r\n\r\n if (before.constructor === Date) {\r\n before = before.toISOString();\r\n }\r\n\r\n params.push('before=' + encodeURIComponent(before));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Show user information\r\n // -------\r\n\r\n this.show = function (username, cb) {\r\n var command = username ? '/users/' + username : '/user';\r\n\r\n _request('GET', command, null, cb);\r\n };\r\n\r\n // List user repositories\r\n // -------\r\n\r\n this.userRepos = function (username, options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n var url = '/users/' + username + '/repos';\r\n var params = [];\r\n\r\n params.push('type=' + encodeURIComponent(options.type || 'all'));\r\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\r\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n url += '?' + params.join('&');\r\n\r\n _requestAllPages(url, cb);\r\n };\r\n\r\n // List user starred repositories\r\n // -------\r\n\r\n this.userStarred = function (username, cb) {\r\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\r\n _requestAllPages('/users/' + username + '/starred?type=all&per_page=100', cb);\r\n };\r\n\r\n // List a user's gists\r\n // -------\r\n\r\n this.userGists = function (username, cb) {\r\n _request('GET', '/users/' + username + '/gists', null, cb);\r\n };\r\n\r\n // List organization repositories\r\n // -------\r\n\r\n this.orgRepos = function (orgname, cb) {\r\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\r\n _requestAllPages('/orgs/' + orgname + '/repos?type=all&&page_num=1000&sort=updated&direction=desc', cb);\r\n };\r\n\r\n // Follow user\r\n // -------\r\n\r\n this.follow = function (username, cb) {\r\n _request('PUT', '/user/following/' + username, null, cb);\r\n };\r\n\r\n // Unfollow user\r\n // -------\r\n\r\n this.unfollow = function (username, cb) {\r\n _request('DELETE', '/user/following/' + username, null, cb);\r\n };\r\n\r\n // Create a repo\r\n // -------\r\n this.createRepo = function (options, cb) {\r\n _request('POST', '/user/repos', options, cb);\r\n };\r\n };\r\n\r\n // Repository API\r\n // =======\r\n\r\n Github.Repository = function (options) {\r\n var repo = options.name;\r\n var user = options.user;\r\n var fullname = options.fullname;\r\n\r\n var that = this;\r\n var repoPath;\r\n\r\n if (fullname) {\r\n repoPath = '/repos/' + fullname;\r\n } else {\r\n repoPath = '/repos/' + user + '/' + repo;\r\n }\r\n\r\n var currentTree = {\r\n branch: null,\r\n sha: null\r\n };\r\n\r\n // Uses the cache if branch has not been changed\r\n // -------\r\n\r\n function updateTree(branch, cb) {\r\n if (branch === currentTree.branch && currentTree.sha) {\r\n return cb(null, currentTree.sha);\r\n }\r\n\r\n that.getRef('heads/' + branch, function (err, sha) {\r\n currentTree.branch = branch;\r\n currentTree.sha = sha;\r\n cb(err, sha);\r\n });\r\n }\r\n\r\n // Get a particular reference\r\n // -------\r\n\r\n this.getRef = function (ref, cb) {\r\n _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.object.sha, xhr);\r\n });\r\n };\r\n\r\n // Create a new reference\r\n // --------\r\n //\r\n // {\r\n // \"ref\": \"refs/heads/my-new-branch-name\",\r\n // \"sha\": \"827efc6d56897b048c772eb4087f854f46256132\"\r\n // }\r\n\r\n this.createRef = function (options, cb) {\r\n _request('POST', repoPath + '/git/refs', options, cb);\r\n };\r\n\r\n // Delete a reference\r\n // --------\r\n //\r\n // Repo.deleteRef('heads/gh-pages')\r\n // repo.deleteRef('tags/v1.0')\r\n\r\n this.deleteRef = function (ref, cb) {\r\n _request('DELETE', repoPath + '/git/refs/' + ref, options, cb);\r\n };\r\n\r\n // Delete a repo\r\n // --------\r\n\r\n this.deleteRepo = function (cb) {\r\n _request('DELETE', repoPath, options, cb);\r\n };\r\n\r\n // List all tags of a repository\r\n // -------\r\n\r\n this.listTags = function (cb) {\r\n _request('GET', repoPath + '/tags', null, cb);\r\n };\r\n\r\n // List all pull requests of a respository\r\n // -------\r\n\r\n this.listPulls = function (options, cb) {\r\n options = options || {};\r\n var url = repoPath + '/pulls';\r\n var params = [];\r\n\r\n if (typeof options === 'string') {\r\n // Backward compatibility\r\n params.push('state=' + options);\r\n } else {\r\n if (options.state) {\r\n params.push('state=' + encodeURIComponent(options.state));\r\n }\r\n\r\n if (options.head) {\r\n params.push('head=' + encodeURIComponent(options.head));\r\n }\r\n\r\n if (options.base) {\r\n params.push('base=' + encodeURIComponent(options.base));\r\n }\r\n\r\n if (options.sort) {\r\n params.push('sort=' + encodeURIComponent(options.sort));\r\n }\r\n\r\n if (options.direction) {\r\n params.push('direction=' + encodeURIComponent(options.direction));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + options.page);\r\n }\r\n\r\n if (options.per_page) {\r\n params.push('per_page=' + options.per_page);\r\n }\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Gets details for a specific pull request\r\n // -------\r\n\r\n this.getPull = function (number, cb) {\r\n _request('GET', repoPath + '/pulls/' + number, null, cb);\r\n };\r\n\r\n // Retrieve the changes made between base and head\r\n // -------\r\n\r\n this.compare = function (base, head, cb) {\r\n _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb);\r\n };\r\n\r\n // List all branches of a repository\r\n // -------\r\n\r\n this.listBranches = function (cb) {\r\n _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n heads = heads.map(function (head) {\r\n return head.ref.replace(/^refs\\/heads\\//, '');\r\n });\r\n\r\n cb(null, heads, xhr);\r\n });\r\n };\r\n\r\n // Retrieve the contents of a blob\r\n // -------\r\n\r\n this.getBlob = function (sha, cb) {\r\n _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw');\r\n };\r\n\r\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\r\n // -------\r\n\r\n this.getCommit = function (branch, sha, cb) {\r\n _request('GET', repoPath + '/git/commits/' + sha, null, cb);\r\n };\r\n\r\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\r\n // -------\r\n\r\n this.getSha = function (branch, path, cb) {\r\n if (!path || path === '') {\r\n return that.getRef('heads/' + branch, cb);\r\n }\r\n\r\n _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''),\r\n null, function (err, pathContent, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, pathContent.sha, xhr);\r\n });\r\n };\r\n\r\n // Get the statuses for a particular SHA\r\n // -------\r\n\r\n this.getStatuses = function (sha, cb) {\r\n _request('GET', repoPath + '/statuses/' + sha, null, cb);\r\n };\r\n\r\n // Retrieve the tree a commit points to\r\n // -------\r\n\r\n this.getTree = function (tree, cb) {\r\n _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.tree, xhr);\r\n });\r\n };\r\n\r\n // Post a new blob object, getting a blob SHA back\r\n // -------\r\n\r\n this.postBlob = function (content, cb) {\r\n if (typeof content === 'string') {\r\n content = {\r\n content: content,\r\n encoding: 'utf-8'\r\n };\r\n } else {\r\n content = {\r\n content: b64encode(content),\r\n encoding: 'base64'\r\n };\r\n }\r\n\r\n _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Update an existing tree adding a new blob object getting a tree SHA back\r\n // -------\r\n\r\n this.updateTree = function (baseTree, path, blob, cb) {\r\n var data = {\r\n base_tree: baseTree,\r\n tree: [\r\n {\r\n path: path,\r\n mode: '100644',\r\n type: 'blob',\r\n sha: blob\r\n }\r\n ]\r\n };\r\n\r\n _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Post a new tree object having a file path pointer replaced\r\n // with a new blob SHA getting a tree SHA back\r\n // -------\r\n\r\n this.postTree = function (tree, cb) {\r\n _request('POST', repoPath + '/git/trees', {\r\n tree: tree\r\n }, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Create a new commit object with the current commit SHA as the parent\r\n // and the new tree SHA, getting a commit SHA back\r\n // -------\r\n\r\n this.commit = function (parent, tree, message, cb) {\r\n var user = new Github.User();\r\n\r\n user.show(null, function (err, userData) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n var data = {\r\n message: message,\r\n author: {\r\n name: options.user,\r\n email: userData.email\r\n },\r\n parents: [\r\n parent\r\n ],\r\n tree: tree\r\n };\r\n\r\n _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n currentTree.sha = res.sha; // Update latest commit\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n });\r\n };\r\n\r\n // Update the reference of your head to point to the new commit SHA\r\n // -------\r\n\r\n this.updateHead = function (head, commit, cb) {\r\n _request('PATCH', repoPath + '/git/refs/heads/' + head, {\r\n sha: commit\r\n }, cb);\r\n };\r\n\r\n // Show repository information\r\n // -------\r\n\r\n this.show = function (cb) {\r\n _request('GET', repoPath, null, cb);\r\n };\r\n\r\n // Show repository contributors\r\n // -------\r\n\r\n this.contributors = function (cb, retry) {\r\n retry = retry || 1000;\r\n var that = this;\r\n\r\n _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n if (xhr.status === 202) {\r\n setTimeout(\r\n function () {\r\n that.contributors(cb, retry);\r\n },\r\n retry\r\n );\r\n } else {\r\n cb(err, data, xhr);\r\n }\r\n });\r\n };\r\n\r\n // Get contents\r\n // --------\r\n\r\n this.contents = function (ref, path, cb) {\r\n path = encodeURI(path);\r\n _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), {\r\n ref: ref\r\n }, cb);\r\n };\r\n\r\n // Fork repository\r\n // -------\r\n\r\n this.fork = function (cb) {\r\n _request('POST', repoPath + '/forks', null, cb);\r\n };\r\n\r\n // List forks\r\n // --------\r\n\r\n this.listForks = function (cb) {\r\n _request('GET', repoPath + '/forks', null, cb);\r\n };\r\n\r\n // Branch repository\r\n // --------\r\n\r\n this.branch = function (oldBranch, newBranch, cb) {\r\n if (arguments.length === 2 && typeof arguments[1] === 'function') {\r\n cb = newBranch;\r\n newBranch = oldBranch;\r\n oldBranch = 'master';\r\n }\r\n\r\n this.getRef('heads/' + oldBranch, function (err, ref) {\r\n if (err && cb) {\r\n return cb(err);\r\n }\r\n\r\n that.createRef({\r\n ref: 'refs/heads/' + newBranch,\r\n sha: ref\r\n }, cb);\r\n });\r\n };\r\n\r\n // Create pull request\r\n // --------\r\n\r\n this.createPullRequest = function (options, cb) {\r\n _request('POST', repoPath + '/pulls', options, cb);\r\n };\r\n\r\n // List hooks\r\n // --------\r\n\r\n this.listHooks = function (cb) {\r\n _request('GET', repoPath + '/hooks', null, cb);\r\n };\r\n\r\n // Get a hook\r\n // --------\r\n\r\n this.getHook = function (id, cb) {\r\n _request('GET', repoPath + '/hooks/' + id, null, cb);\r\n };\r\n\r\n // Create a hook\r\n // --------\r\n\r\n this.createHook = function (options, cb) {\r\n _request('POST', repoPath + '/hooks', options, cb);\r\n };\r\n\r\n // Edit a hook\r\n // --------\r\n\r\n this.editHook = function (id, options, cb) {\r\n _request('PATCH', repoPath + '/hooks/' + id, options, cb);\r\n };\r\n\r\n // Delete a hook\r\n // --------\r\n\r\n this.deleteHook = function (id, cb) {\r\n _request('DELETE', repoPath + '/hooks/' + id, null, cb);\r\n };\r\n\r\n // Read file at given path\r\n // -------\r\n\r\n this.read = function (branch, path, cb) {\r\n _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''),\r\n null, cb, true);\r\n };\r\n\r\n // Remove a file\r\n // -------\r\n\r\n this.remove = function (branch, path, cb) {\r\n that.getSha(branch, path, function (err, sha) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n _request('DELETE', repoPath + '/contents/' + path, {\r\n message: path + ' is removed',\r\n sha: sha,\r\n branch: branch\r\n }, cb);\r\n });\r\n };\r\n\r\n // Alias for repo.remove for backwards comapt.\r\n // -------\r\n this.delete = this.remove;\r\n\r\n // Move a file to a new location\r\n // -------\r\n\r\n this.move = function (branch, path, newPath, cb) {\r\n updateTree(branch, function (err, latestCommit) {\r\n that.getTree(latestCommit + '?recursive=true', function (err, tree) {\r\n // Update Tree\r\n tree.forEach(function (ref) {\r\n if (ref.path === path) {\r\n ref.path = newPath;\r\n }\r\n\r\n if (ref.type === 'tree') {\r\n delete ref.sha;\r\n }\r\n });\r\n\r\n that.postTree(tree, function (err, rootTree) {\r\n that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) {\r\n that.updateHead(branch, commit, cb);\r\n });\r\n });\r\n });\r\n });\r\n };\r\n\r\n // Write file contents to a given branch and path\r\n // -------\r\n\r\n this.write = function (branch, path, content, message, options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n that.getSha(branch, encodeURI(path), function (err, sha) {\r\n var writeOptions = {\r\n message: message,\r\n content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content,\r\n branch: branch,\r\n committer: options && options.committer ? options.committer : undefined,\r\n author: options && options.author ? options.author : undefined\r\n };\r\n\r\n // If no error, we set the sha to overwrite an existing file\r\n if (!(err && err.error !== 404)) {\r\n writeOptions.sha = sha;\r\n }\r\n\r\n _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb);\r\n });\r\n };\r\n\r\n // List commits on a repository. Takes an object of optional parameters:\r\n // sha: SHA or branch to start listing commits from\r\n // path: Only commits containing this file path will be returned\r\n // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address\r\n // since: ISO 8601 date - only commits after this date will be returned\r\n // until: ISO 8601 date - only commits before this date will be returned\r\n // -------\r\n\r\n this.getCommits = function (options, cb) {\r\n options = options || {};\r\n var url = repoPath + '/commits';\r\n var params = [];\r\n\r\n if (options.sha) {\r\n params.push('sha=' + encodeURIComponent(options.sha));\r\n }\r\n\r\n if (options.path) {\r\n params.push('path=' + encodeURIComponent(options.path));\r\n }\r\n\r\n if (options.author) {\r\n params.push('author=' + encodeURIComponent(options.author));\r\n }\r\n\r\n if (options.since) {\r\n var since = options.since;\r\n\r\n if (since.constructor === Date) {\r\n since = since.toISOString();\r\n }\r\n\r\n params.push('since=' + encodeURIComponent(since));\r\n }\r\n\r\n if (options.until) {\r\n var until = options.until;\r\n\r\n if (until.constructor === Date) {\r\n until = until.toISOString();\r\n }\r\n\r\n params.push('until=' + encodeURIComponent(until));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + options.page);\r\n }\r\n\r\n if (options.perpage) {\r\n params.push('per_page=' + options.perpage);\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Check if a repository is starred.\r\n // --------\r\n\r\n this.isStarred = function(owner, repository, cb) {\r\n _request('GET', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Star a repository.\r\n // --------\r\n\r\n this.star = function(owner, repository, cb) {\r\n _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Unstar a repository.\r\n // --------\r\n\r\n this.unstar = function(owner, repository, cb) {\r\n _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Create a new release\r\n // --------\r\n\r\n this.createRelease = function(options, cb) {\r\n _request('POST', repoPath + '/releases', options, cb);\r\n };\r\n\r\n // Edit a release\r\n // --------\r\n\r\n this.editRelease = function(id, options, cb) {\r\n _request('PATCH', repoPath + '/releases/' + id, options, cb);\r\n };\r\n\r\n // Get a single release\r\n // --------\r\n\r\n this.getRelease = function(id, cb) {\r\n _request('GET', repoPath + '/releases/' + id, null, cb);\r\n };\r\n\r\n // Remove a release\r\n // --------\r\n\r\n this.deleteRelease = function(id, cb) {\r\n _request('DELETE', repoPath + '/releases/' + id, null, cb);\r\n };\r\n };\r\n\r\n // Gists API\r\n // =======\r\n\r\n Github.Gist = function (options) {\r\n var id = options.id;\r\n var gistPath = '/gists/' + id;\r\n\r\n // Read the gist\r\n // --------\r\n\r\n this.read = function (cb) {\r\n _request('GET', gistPath, null, cb);\r\n };\r\n\r\n // Create the gist\r\n // --------\r\n // {\r\n // \"description\": \"the description for this gist\",\r\n // \"public\": true,\r\n // \"files\": {\r\n // \"file1.txt\": {\r\n // \"content\": \"String file contents\"\r\n // }\r\n // }\r\n // }\r\n\r\n this.create = function (options, cb) {\r\n _request('POST', '/gists', options, cb);\r\n };\r\n\r\n // Delete the gist\r\n // --------\r\n\r\n this.delete = function (cb) {\r\n _request('DELETE', gistPath, null, cb);\r\n };\r\n\r\n // Fork a gist\r\n // --------\r\n\r\n this.fork = function (cb) {\r\n _request('POST', gistPath + '/fork', null, cb);\r\n };\r\n\r\n // Update a gist with the new stuff\r\n // --------\r\n\r\n this.update = function (options, cb) {\r\n _request('PATCH', gistPath, options, cb);\r\n };\r\n\r\n // Star a gist\r\n // --------\r\n\r\n this.star = function (cb) {\r\n _request('PUT', gistPath + '/star', null, cb);\r\n };\r\n\r\n // Untar a gist\r\n // --------\r\n\r\n this.unstar = function (cb) {\r\n _request('DELETE', gistPath + '/star', null, cb);\r\n };\r\n\r\n // Check if a gist is starred\r\n // --------\r\n\r\n this.isStarred = function (cb) {\r\n _request('GET', gistPath + '/star', null, cb);\r\n };\r\n };\r\n\r\n // Issues API\r\n // ==========\r\n\r\n Github.Issue = function (options) {\r\n var path = '/repos/' + options.user + '/' + options.repo + '/issues';\r\n\r\n this.create = function(options, cb) {\r\n _request('POST', path, options, cb);\r\n };\r\n\r\n this.list = function (options, cb) {\r\n var query = [];\r\n\r\n for(var key in options) {\r\n if (options.hasOwnProperty(key)) {\r\n query.push(encodeURIComponent(key) + '=' + encodeURIComponent(options[key]));\r\n }\r\n }\r\n\r\n _requestAllPages(path + '?' + query.join('&'), cb);\r\n };\r\n\r\n this.comment = function (issue, comment, cb) {\r\n _request('POST', issue.comments_url, {\r\n body: comment\r\n }, cb);\r\n };\r\n\r\n this.edit = function (issue, options, cb) {\r\n _request('PATCH', path + '/' + issue, options, cb);\r\n };\r\n\r\n this.get = function (issue, cb) {\r\n _request('GET', path + '/' + issue, null, cb);\r\n };\r\n };\r\n\r\n // Search API\r\n // ==========\r\n\r\n Github.Search = function (options) {\r\n var path = '/search/';\r\n var query = '?q=' + options.query;\r\n\r\n this.repositories = function (options, cb) {\r\n _request('GET', path + 'repositories' + query, options, cb);\r\n };\r\n\r\n this.code = function (options, cb) {\r\n _request('GET', path + 'code' + query, options, cb);\r\n };\r\n\r\n this.issues = function (options, cb) {\r\n _request('GET', path + 'issues' + query, options, cb);\r\n };\r\n\r\n this.users = function (options, cb) {\r\n _request('GET', path + 'users' + query, options, cb);\r\n };\r\n };\r\n\r\n // Rate Limit API\r\n // ==========\r\n\r\n Github.RateLimit = function() {\r\n this.getRateLimit = function(cb) {\r\n _request('GET', '/rate_limit', null, cb);\r\n };\r\n };\r\n\r\n return Github;\r\n };\r\n\r\n // Top Level API\r\n // -------\r\n\r\n Github.getIssues = function (user, repo) {\r\n return new Github.Issue({\r\n user: user,\r\n repo: repo\r\n });\r\n };\r\n\r\n Github.getRepo = function (user, repo) {\r\n if (!repo) {\r\n return new Github.Repository({\r\n fullname: user\r\n });\r\n } else {\r\n return new Github.Repository({\r\n user: user,\r\n name: repo\r\n });\r\n }\r\n };\r\n\r\n Github.getUser = function () {\r\n return new Github.User();\r\n };\r\n\r\n Github.getGist = function (id) {\r\n return new Github.Gist({\r\n id: id\r\n });\r\n };\r\n\r\n Github.getSearch = function (query) {\r\n return new Github.Search({\r\n query: query\r\n });\r\n };\r\n\r\n Github.getRateLimit = function() {\r\n return new Github.RateLimit();\r\n };\r\n\r\n return Github;\r\n}));\r\n\n},{\"axios\":1,\"base-64\":18,\"es6-promise\":19,\"utf8\":21}]},{},[22])(22)\n});\n\n","'use strict';\r\n\r\nvar utils = require('./../utils');\r\nvar buildURL = require('./../helpers/buildURL');\r\nvar parseHeaders = require('./../helpers/parseHeaders');\r\nvar transformData = require('./../helpers/transformData');\r\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\r\nvar btoa = window.btoa || require('./../helpers/btoa');\r\n\r\nmodule.exports = function xhrAdapter(resolve, reject, config) {\r\n var requestData = config.data;\r\n var requestHeaders = config.headers;\r\n\r\n if (utils.isFormData(requestData)) {\r\n delete requestHeaders['Content-Type']; // Let the browser set it\r\n }\r\n\r\n var request = new XMLHttpRequest();\r\n\r\n // For IE 8/9 CORS support\r\n // Only supports POST and GET calls and doesn't returns the response headers.\r\n if (window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {\r\n request = new window.XDomainRequest();\r\n }\r\n\r\n // HTTP basic authentication\r\n if (config.auth) {\r\n var username = config.auth.username || '';\r\n var password = config.auth.password || '';\r\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\r\n }\r\n\r\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\r\n\r\n // Set the request timeout in MS\r\n request.timeout = config.timeout;\r\n\r\n // Listen for ready state\r\n request.onload = function handleLoad() {\r\n if (!request) {\r\n return;\r\n }\r\n // Prepare the response\r\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\r\n var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response;\r\n var response = {\r\n data: transformData(\r\n responseData,\r\n responseHeaders,\r\n config.transformResponse\r\n ),\r\n // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)\r\n status: request.status === 1223 ? 204 : request.status,\r\n statusText: request.status === 1223 ? 'No Content' : request.statusText,\r\n headers: responseHeaders,\r\n config: config,\r\n request: request\r\n };\r\n\r\n // Resolve or reject the Promise based on the status\r\n ((response.status >= 200 && response.status < 300) ||\r\n (!('status' in request) && response.responseText) ?\r\n resolve :\r\n reject)(response);\r\n\r\n // Clean up request\r\n request = null;\r\n };\r\n\r\n // Handle low level network errors\r\n request.onerror = function handleError() {\r\n // Real errors are hidden from us by the browser\r\n // onerror should only fire if it's a network error\r\n reject(new Error('Network Error'));\r\n\r\n // Clean up request\r\n request = null;\r\n };\r\n\r\n // Add xsrf header\r\n // This is only done if running in a standard browser environment.\r\n // Specifically not if we're in a web worker, or react-native.\r\n if (utils.isStandardBrowserEnv()) {\r\n var cookies = require('./../helpers/cookies');\r\n\r\n // Add xsrf header\r\n var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?\r\n cookies.read(config.xsrfCookieName) :\r\n undefined;\r\n\r\n if (xsrfValue) {\r\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\r\n }\r\n }\r\n\r\n // Add headers to the request\r\n if ('setRequestHeader' in request) {\r\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\r\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\r\n // Remove Content-Type if data is undefined\r\n delete requestHeaders[key];\r\n } else {\r\n // Otherwise add header to the request\r\n request.setRequestHeader(key, val);\r\n }\r\n });\r\n }\r\n\r\n // Add withCredentials to request if needed\r\n if (config.withCredentials) {\r\n request.withCredentials = true;\r\n }\r\n\r\n // Add responseType to request if needed\r\n if (config.responseType) {\r\n try {\r\n request.responseType = config.responseType;\r\n } catch (e) {\r\n if (request.responseType !== 'json') {\r\n throw e;\r\n }\r\n }\r\n }\r\n\r\n if (utils.isArrayBuffer(requestData)) {\r\n requestData = new DataView(requestData);\r\n }\r\n\r\n // Send the request\r\n request.send(requestData);\r\n};\r\n","'use strict';\r\n\r\nvar defaults = require('./defaults');\r\nvar utils = require('./utils');\r\nvar dispatchRequest = require('./core/dispatchRequest');\r\nvar InterceptorManager = require('./core/InterceptorManager');\r\nvar isAbsoluteURL = require('./helpers/isAbsoluteURL');\r\nvar combineURLs = require('./helpers/combineURLs');\r\nvar bind = require('./helpers/bind');\r\nvar transformData = require('./helpers/transformData');\r\n\r\nfunction Axios(defaultConfig) {\r\n this.defaults = utils.merge({}, defaultConfig);\r\n this.interceptors = {\r\n request: new InterceptorManager(),\r\n response: new InterceptorManager()\r\n };\r\n}\r\n\r\nAxios.prototype.request = function request(config) {\r\n /*eslint no-param-reassign:0*/\r\n // Allow for axios('example/url'[, config]) a la fetch API\r\n if (typeof config === 'string') {\r\n config = utils.merge({\r\n url: arguments[0]\r\n }, arguments[1]);\r\n }\r\n\r\n config = utils.merge(defaults, this.defaults, { method: 'get' }, config);\r\n\r\n // Support baseURL config\r\n if (config.baseURL && !isAbsoluteURL(config.url)) {\r\n config.url = combineURLs(config.baseURL, config.url);\r\n }\r\n\r\n // Don't allow overriding defaults.withCredentials\r\n config.withCredentials = config.withCredentials || this.defaults.withCredentials;\r\n\r\n // Transform request data\r\n config.data = transformData(\r\n config.data,\r\n config.headers,\r\n config.transformRequest\r\n );\r\n\r\n // Flatten headers\r\n config.headers = utils.merge(\r\n config.headers.common || {},\r\n config.headers[config.method] || {},\r\n config.headers || {}\r\n );\r\n\r\n utils.forEach(\r\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\r\n function cleanHeaderConfig(method) {\r\n delete config.headers[method];\r\n }\r\n );\r\n\r\n // Hook up interceptors middleware\r\n var chain = [dispatchRequest, undefined];\r\n var promise = Promise.resolve(config);\r\n\r\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\r\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\r\n });\r\n\r\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\r\n chain.push(interceptor.fulfilled, interceptor.rejected);\r\n });\r\n\r\n while (chain.length) {\r\n promise = promise.then(chain.shift(), chain.shift());\r\n }\r\n\r\n return promise;\r\n};\r\n\r\nvar defaultInstance = new Axios(defaults);\r\nvar axios = module.exports = bind(Axios.prototype.request, defaultInstance);\r\n\r\naxios.create = function create(defaultConfig) {\r\n return new Axios(defaultConfig);\r\n};\r\n\r\n// Expose defaults\r\naxios.defaults = defaultInstance.defaults;\r\n\r\n// Expose all/spread\r\naxios.all = function all(promises) {\r\n return Promise.all(promises);\r\n};\r\naxios.spread = require('./helpers/spread');\r\n\r\n// Expose interceptors\r\naxios.interceptors = defaultInstance.interceptors;\r\n\r\n// Provide aliases for supported request methods\r\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\r\n /*eslint func-names:0*/\r\n Axios.prototype[method] = function(url, config) {\r\n return this.request(utils.merge(config || {}, {\r\n method: method,\r\n url: url\r\n }));\r\n };\r\n axios[method] = bind(Axios.prototype[method], defaultInstance);\r\n});\r\n\r\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\r\n /*eslint func-names:0*/\r\n Axios.prototype[method] = function(url, data, config) {\r\n return this.request(utils.merge(config || {}, {\r\n method: method,\r\n url: url,\r\n data: data\r\n }));\r\n };\r\n axios[method] = bind(Axios.prototype[method], defaultInstance);\r\n});\r\n","'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\nfunction InterceptorManager() {\r\n this.handlers = [];\r\n}\r\n\r\n/**\r\n * Add a new interceptor to the stack\r\n *\r\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\r\n * @param {Function} rejected The function to handle `reject` for a `Promise`\r\n *\r\n * @return {Number} An ID used to remove interceptor later\r\n */\r\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\r\n this.handlers.push({\r\n fulfilled: fulfilled,\r\n rejected: rejected\r\n });\r\n return this.handlers.length - 1;\r\n};\r\n\r\n/**\r\n * Remove an interceptor from the stack\r\n *\r\n * @param {Number} id The ID that was returned by `use`\r\n */\r\nInterceptorManager.prototype.eject = function eject(id) {\r\n if (this.handlers[id]) {\r\n this.handlers[id] = null;\r\n }\r\n};\r\n\r\n/**\r\n * Iterate over all the registered interceptors\r\n *\r\n * This method is particularly useful for skipping over any\r\n * interceptors that may have become `null` calling `eject`.\r\n *\r\n * @param {Function} fn The function to call for each interceptor\r\n */\r\nInterceptorManager.prototype.forEach = function forEach(fn) {\r\n utils.forEach(this.handlers, function forEachHandler(h) {\r\n if (h !== null) {\r\n fn(h);\r\n }\r\n });\r\n};\r\n\r\nmodule.exports = InterceptorManager;\r\n","'use strict';\r\n\r\n/**\r\n * Dispatch a request to the server using whichever adapter\r\n * is supported by the current environment.\r\n *\r\n * @param {object} config The config that is to be used for the request\r\n * @returns {Promise} The Promise to be fulfilled\r\n */\r\nmodule.exports = function dispatchRequest(config) {\r\n return new Promise(function executor(resolve, reject) {\r\n try {\r\n var adapter;\r\n\r\n if (typeof config.adapter === 'function') {\r\n // For custom adapter support\r\n adapter = config.adapter;\r\n } else if (typeof XMLHttpRequest !== 'undefined') {\r\n // For browsers use XHR adapter\r\n adapter = require('../adapters/xhr');\r\n } else if (typeof process !== 'undefined') {\r\n // For node use HTTP adapter\r\n adapter = require('../adapters/http');\r\n }\r\n\r\n if (typeof adapter === 'function') {\r\n adapter(resolve, reject, config);\r\n }\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n};\r\n\r\n","'use strict';\r\n\r\nvar utils = require('./utils');\r\n\r\nvar PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\r\nvar DEFAULT_CONTENT_TYPE = {\r\n 'Content-Type': 'application/x-www-form-urlencoded'\r\n};\r\n\r\nmodule.exports = {\r\n transformRequest: [function transformResponseJSON(data, headers) {\r\n if (utils.isFormData(data)) {\r\n return data;\r\n }\r\n if (utils.isArrayBuffer(data)) {\r\n return data;\r\n }\r\n if (utils.isArrayBufferView(data)) {\r\n return data.buffer;\r\n }\r\n if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {\r\n // Set application/json if no Content-Type has been specified\r\n if (!utils.isUndefined(headers)) {\r\n utils.forEach(headers, function processContentTypeHeader(val, key) {\r\n if (key.toLowerCase() === 'content-type') {\r\n headers['Content-Type'] = val;\r\n }\r\n });\r\n\r\n if (utils.isUndefined(headers['Content-Type'])) {\r\n headers['Content-Type'] = 'application/json;charset=utf-8';\r\n }\r\n }\r\n return JSON.stringify(data);\r\n }\r\n return data;\r\n }],\r\n\r\n transformResponse: [function transformResponseJSON(data) {\r\n /*eslint no-param-reassign:0*/\r\n if (typeof data === 'string') {\r\n data = data.replace(PROTECTION_PREFIX, '');\r\n try {\r\n data = JSON.parse(data);\r\n } catch (e) { /* Ignore */ }\r\n }\r\n return data;\r\n }],\r\n\r\n headers: {\r\n common: {\r\n 'Accept': 'application/json, text/plain, */*'\r\n },\r\n patch: utils.merge(DEFAULT_CONTENT_TYPE),\r\n post: utils.merge(DEFAULT_CONTENT_TYPE),\r\n put: utils.merge(DEFAULT_CONTENT_TYPE)\r\n },\r\n\r\n timeout: 0,\r\n\r\n xsrfCookieName: 'XSRF-TOKEN',\r\n xsrfHeaderName: 'X-XSRF-TOKEN'\r\n};\r\n","'use strict';\r\n\r\nmodule.exports = function bind(fn, thisArg) {\r\n return function wrap() {\r\n var args = new Array(arguments.length);\r\n for (var i = 0; i < args.length; i++) {\r\n args[i] = arguments[i];\r\n }\r\n return fn.apply(thisArg, args);\r\n };\r\n};\r\n","'use strict';\r\n\r\n// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js\r\n\r\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\r\n\r\nfunction InvalidCharacterError(message) {\r\n this.message = message;\r\n}\r\nInvalidCharacterError.prototype = new Error;\r\nInvalidCharacterError.prototype.code = 5;\r\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\r\n\r\nfunction btoa(input) {\r\n var str = String(input);\r\n var output = '';\r\n for (\r\n // initialize result and counter\r\n var block, charCode, idx = 0, map = chars;\r\n // if the next str index does not exist:\r\n // change the mapping table to \"=\"\r\n // check if d has no fractional digits\r\n str.charAt(idx | 0) || (map = '=', idx % 1);\r\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\r\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\r\n ) {\r\n charCode = str.charCodeAt(idx += 3 / 4);\r\n if (charCode > 0xFF) {\r\n throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');\r\n }\r\n block = block << 8 | charCode;\r\n }\r\n return output;\r\n}\r\n\r\nmodule.exports = btoa;\r\n","'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\nfunction encode(val) {\r\n return encodeURIComponent(val).\r\n replace(/%40/gi, '@').\r\n replace(/%3A/gi, ':').\r\n replace(/%24/g, '$').\r\n replace(/%2C/gi, ',').\r\n replace(/%20/g, '+').\r\n replace(/%5B/gi, '[').\r\n replace(/%5D/gi, ']');\r\n}\r\n\r\n/**\r\n * Build a URL by appending params to the end\r\n *\r\n * @param {string} url The base of the url (e.g., http://www.google.com)\r\n * @param {object} [params] The params to be appended\r\n * @returns {string} The formatted url\r\n */\r\nmodule.exports = function buildURL(url, params, paramsSerializer) {\r\n /*eslint no-param-reassign:0*/\r\n if (!params) {\r\n return url;\r\n }\r\n\r\n var serializedParams;\r\n if (paramsSerializer) {\r\n serializedParams = paramsSerializer(params);\r\n } else {\r\n var parts = [];\r\n\r\n utils.forEach(params, function serialize(val, key) {\r\n if (val === null || typeof val === 'undefined') {\r\n return;\r\n }\r\n\r\n if (utils.isArray(val)) {\r\n key = key + '[]';\r\n }\r\n\r\n if (!utils.isArray(val)) {\r\n val = [val];\r\n }\r\n\r\n utils.forEach(val, function parseValue(v) {\r\n if (utils.isDate(v)) {\r\n v = v.toISOString();\r\n } else if (utils.isObject(v)) {\r\n v = JSON.stringify(v);\r\n }\r\n parts.push(encode(key) + '=' + encode(v));\r\n });\r\n });\r\n\r\n serializedParams = parts.join('&');\r\n }\r\n\r\n if (serializedParams) {\r\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\r\n }\r\n\r\n return url;\r\n};\r\n\r\n","'use strict';\r\n\r\n/**\r\n * Creates a new URL by combining the specified URLs\r\n *\r\n * @param {string} baseURL The base URL\r\n * @param {string} relativeURL The relative URL\r\n * @returns {string} The combined URL\r\n */\r\nmodule.exports = function combineURLs(baseURL, relativeURL) {\r\n return baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '');\r\n};\r\n","'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\nmodule.exports = (\r\n utils.isStandardBrowserEnv() ?\r\n\r\n // Standard browser envs support document.cookie\r\n (function standardBrowserEnv() {\r\n return {\r\n write: function write(name, value, expires, path, domain, secure) {\r\n var cookie = [];\r\n cookie.push(name + '=' + encodeURIComponent(value));\r\n\r\n if (utils.isNumber(expires)) {\r\n cookie.push('expires=' + new Date(expires).toGMTString());\r\n }\r\n\r\n if (utils.isString(path)) {\r\n cookie.push('path=' + path);\r\n }\r\n\r\n if (utils.isString(domain)) {\r\n cookie.push('domain=' + domain);\r\n }\r\n\r\n if (secure === true) {\r\n cookie.push('secure');\r\n }\r\n\r\n document.cookie = cookie.join('; ');\r\n },\r\n\r\n read: function read(name) {\r\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\r\n return (match ? decodeURIComponent(match[3]) : null);\r\n },\r\n\r\n remove: function remove(name) {\r\n this.write(name, '', Date.now() - 86400000);\r\n }\r\n };\r\n })() :\r\n\r\n // Non standard browser env (web workers, react-native) lack needed support.\r\n (function nonStandardBrowserEnv() {\r\n return {\r\n write: function write() {},\r\n read: function read() { return null; },\r\n remove: function remove() {}\r\n };\r\n })()\r\n);\r\n","'use strict';\r\n\r\n/**\r\n * Determines whether the specified URL is absolute\r\n *\r\n * @param {string} url The URL to test\r\n * @returns {boolean} True if the specified URL is absolute, otherwise false\r\n */\r\nmodule.exports = function isAbsoluteURL(url) {\r\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\r\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\r\n // by any combination of letters, digits, plus, period, or hyphen.\r\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\r\n};\r\n","'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\nmodule.exports = (\r\n utils.isStandardBrowserEnv() ?\r\n\r\n // Standard browser envs have full support of the APIs needed to test\r\n // whether the request URL is of the same origin as current location.\r\n (function standardBrowserEnv() {\r\n var msie = /(msie|trident)/i.test(navigator.userAgent);\r\n var urlParsingNode = document.createElement('a');\r\n var originURL;\r\n\r\n /**\r\n * Parse a URL to discover it's components\r\n *\r\n * @param {String} url The URL to be parsed\r\n * @returns {Object}\r\n */\r\n function resolveURL(url) {\r\n var href = url;\r\n\r\n if (msie) {\r\n // IE needs attribute set twice to normalize properties\r\n urlParsingNode.setAttribute('href', href);\r\n href = urlParsingNode.href;\r\n }\r\n\r\n urlParsingNode.setAttribute('href', href);\r\n\r\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\r\n return {\r\n href: urlParsingNode.href,\r\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\r\n host: urlParsingNode.host,\r\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\r\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\r\n hostname: urlParsingNode.hostname,\r\n port: urlParsingNode.port,\r\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\r\n urlParsingNode.pathname :\r\n '/' + urlParsingNode.pathname\r\n };\r\n }\r\n\r\n originURL = resolveURL(window.location.href);\r\n\r\n /**\r\n * Determine if a URL shares the same origin as the current location\r\n *\r\n * @param {String} requestURL The URL to test\r\n * @returns {boolean} True if URL shares the same origin, otherwise false\r\n */\r\n return function isURLSameOrigin(requestURL) {\r\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\r\n return (parsed.protocol === originURL.protocol &&\r\n parsed.host === originURL.host);\r\n };\r\n })() :\r\n\r\n // Non standard browser envs (web workers, react-native) lack needed support.\r\n (function nonStandardBrowserEnv() {\r\n return function isURLSameOrigin() {\r\n return true;\r\n };\r\n })()\r\n);\r\n","'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\n/**\r\n * Parse headers into an object\r\n *\r\n * ```\r\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\r\n * Content-Type: application/json\r\n * Connection: keep-alive\r\n * Transfer-Encoding: chunked\r\n * ```\r\n *\r\n * @param {String} headers Headers needing to be parsed\r\n * @returns {Object} Headers parsed into an object\r\n */\r\nmodule.exports = function parseHeaders(headers) {\r\n var parsed = {};\r\n var key;\r\n var val;\r\n var i;\r\n\r\n if (!headers) { return parsed; }\r\n\r\n utils.forEach(headers.split('\\n'), function parser(line) {\r\n i = line.indexOf(':');\r\n key = utils.trim(line.substr(0, i)).toLowerCase();\r\n val = utils.trim(line.substr(i + 1));\r\n\r\n if (key) {\r\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\r\n }\r\n });\r\n\r\n return parsed;\r\n};\r\n","'use strict';\r\n\r\n/**\r\n * Syntactic sugar for invoking a function and expanding an array for arguments.\r\n *\r\n * Common use case would be to use `Function.prototype.apply`.\r\n *\r\n * ```js\r\n * function f(x, y, z) {}\r\n * var args = [1, 2, 3];\r\n * f.apply(null, args);\r\n * ```\r\n *\r\n * With `spread` this example can be re-written.\r\n *\r\n * ```js\r\n * spread(function(x, y, z) {})([1, 2, 3]);\r\n * ```\r\n *\r\n * @param {Function} callback\r\n * @returns {Function}\r\n */\r\nmodule.exports = function spread(callback) {\r\n return function wrap(arr) {\r\n return callback.apply(null, arr);\r\n };\r\n};\r\n","'use strict';\r\n\r\nvar utils = require('./../utils');\r\n\r\n/**\r\n * Transform the data for a request or a response\r\n *\r\n * @param {Object|String} data The data to be transformed\r\n * @param {Array} headers The headers for the request or response\r\n * @param {Array|Function} fns A single function or Array of functions\r\n * @returns {*} The resulting transformed data\r\n */\r\nmodule.exports = function transformData(data, headers, fns) {\r\n /*eslint no-param-reassign:0*/\r\n utils.forEach(fns, function transform(fn) {\r\n data = fn(data, headers);\r\n });\r\n\r\n return data;\r\n};\r\n","'use strict';\r\n\r\n/*global toString:true*/\r\n\r\n// utils is a library of generic helper functions non-specific to axios\r\n\r\nvar toString = Object.prototype.toString;\r\n\r\n/**\r\n * Determine if a value is an Array\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is an Array, otherwise false\r\n */\r\nfunction isArray(val) {\r\n return toString.call(val) === '[object Array]';\r\n}\r\n\r\n/**\r\n * Determine if a value is an ArrayBuffer\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\r\n */\r\nfunction isArrayBuffer(val) {\r\n return toString.call(val) === '[object ArrayBuffer]';\r\n}\r\n\r\n/**\r\n * Determine if a value is a FormData\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is an FormData, otherwise false\r\n */\r\nfunction isFormData(val) {\r\n return toString.call(val) === '[object FormData]';\r\n}\r\n\r\n/**\r\n * Determine if a value is a view on an ArrayBuffer\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\r\n */\r\nfunction isArrayBufferView(val) {\r\n var result;\r\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\r\n result = ArrayBuffer.isView(val);\r\n } else {\r\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Determine if a value is a String\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a String, otherwise false\r\n */\r\nfunction isString(val) {\r\n return typeof val === 'string';\r\n}\r\n\r\n/**\r\n * Determine if a value is a Number\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a Number, otherwise false\r\n */\r\nfunction isNumber(val) {\r\n return typeof val === 'number';\r\n}\r\n\r\n/**\r\n * Determine if a value is undefined\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if the value is undefined, otherwise false\r\n */\r\nfunction isUndefined(val) {\r\n return typeof val === 'undefined';\r\n}\r\n\r\n/**\r\n * Determine if a value is an Object\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is an Object, otherwise false\r\n */\r\nfunction isObject(val) {\r\n return val !== null && typeof val === 'object';\r\n}\r\n\r\n/**\r\n * Determine if a value is a Date\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a Date, otherwise false\r\n */\r\nfunction isDate(val) {\r\n return toString.call(val) === '[object Date]';\r\n}\r\n\r\n/**\r\n * Determine if a value is a File\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a File, otherwise false\r\n */\r\nfunction isFile(val) {\r\n return toString.call(val) === '[object File]';\r\n}\r\n\r\n/**\r\n * Determine if a value is a Blob\r\n *\r\n * @param {Object} val The value to test\r\n * @returns {boolean} True if value is a Blob, otherwise false\r\n */\r\nfunction isBlob(val) {\r\n return toString.call(val) === '[object Blob]';\r\n}\r\n\r\n/**\r\n * Trim excess whitespace off the beginning and end of a string\r\n *\r\n * @param {String} str The String to trim\r\n * @returns {String} The String freed of excess whitespace\r\n */\r\nfunction trim(str) {\r\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\r\n}\r\n\r\n/**\r\n * Determine if we're running in a standard browser environment\r\n *\r\n * This allows axios to run in a web worker, and react-native.\r\n * Both environments support XMLHttpRequest, but not fully standard globals.\r\n *\r\n * web workers:\r\n * typeof window -> undefined\r\n * typeof document -> undefined\r\n *\r\n * react-native:\r\n * typeof document.createElement -> undefined\r\n */\r\nfunction isStandardBrowserEnv() {\r\n return (\r\n typeof window !== 'undefined' &&\r\n typeof document !== 'undefined' &&\r\n typeof document.createElement === 'function'\r\n );\r\n}\r\n\r\n/**\r\n * Iterate over an Array or an Object invoking a function for each item.\r\n *\r\n * If `obj` is an Array callback will be called passing\r\n * the value, index, and complete array for each item.\r\n *\r\n * If 'obj' is an Object callback will be called passing\r\n * the value, key, and complete object for each property.\r\n *\r\n * @param {Object|Array} obj The object to iterate\r\n * @param {Function} fn The callback to invoke for each item\r\n */\r\nfunction forEach(obj, fn) {\r\n // Don't bother if no value provided\r\n if (obj === null || typeof obj === 'undefined') {\r\n return;\r\n }\r\n\r\n // Force an array if not already something iterable\r\n if (typeof obj !== 'object' && !isArray(obj)) {\r\n /*eslint no-param-reassign:0*/\r\n obj = [obj];\r\n }\r\n\r\n if (isArray(obj)) {\r\n // Iterate over array values\r\n for (var i = 0, l = obj.length; i < l; i++) {\r\n fn.call(null, obj[i], i, obj);\r\n }\r\n } else {\r\n // Iterate over object keys\r\n for (var key in obj) {\r\n if (obj.hasOwnProperty(key)) {\r\n fn.call(null, obj[key], key, obj);\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Accepts varargs expecting each argument to be an object, then\r\n * immutably merges the properties of each object and returns result.\r\n *\r\n * When multiple objects contain the same key the later object in\r\n * the arguments list will take precedence.\r\n *\r\n * Example:\r\n *\r\n * ```js\r\n * var result = merge({foo: 123}, {foo: 456});\r\n * console.log(result.foo); // outputs 456\r\n * ```\r\n *\r\n * @param {Object} obj1 Object to merge\r\n * @returns {Object} Result of all merge properties\r\n */\r\nfunction merge(/* obj1, obj2, obj3, ... */) {\r\n var result = {};\r\n function assignValue(val, key) {\r\n if (typeof result[key] === 'object' && typeof val === 'object') {\r\n result[key] = merge(result[key], val);\r\n } else {\r\n result[key] = val;\r\n }\r\n }\r\n\r\n for (var i = 0, l = arguments.length; i < l; i++) {\r\n forEach(arguments[i], assignValue);\r\n }\r\n return result;\r\n}\r\n\r\nmodule.exports = {\r\n isArray: isArray,\r\n isArrayBuffer: isArrayBuffer,\r\n isFormData: isFormData,\r\n isArrayBufferView: isArrayBufferView,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isObject: isObject,\r\n isUndefined: isUndefined,\r\n isDate: isDate,\r\n isFile: isFile,\r\n isBlob: isBlob,\r\n isStandardBrowserEnv: isStandardBrowserEnv,\r\n forEach: forEach,\r\n merge: merge,\r\n trim: trim\r\n};\r\n","/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */\n;(function(root) {\n\n\t// Detect free variables `exports`.\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`.\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code, and use\n\t// it as `root`.\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar InvalidCharacterError = function(message) {\n\t\tthis.message = message;\n\t};\n\tInvalidCharacterError.prototype = new Error;\n\tInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n\tvar error = function(message) {\n\t\t// Note: the error messages used throughout this file match those used by\n\t\t// the native `atob`/`btoa` implementation in Chromium.\n\t\tthrow new InvalidCharacterError(message);\n\t};\n\n\tvar TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\t// http://whatwg.org/html/common-microsyntaxes.html#space-character\n\tvar REGEX_SPACE_CHARACTERS = /[\\t\\n\\f\\r ]/g;\n\n\t// `decode` is designed to be fully compatible with `atob` as described in the\n\t// HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob\n\t// The optimized base64-decoding algorithm used is based on @atk’s excellent\n\t// implementation. https://gist.github.com/atk/1020396\n\tvar decode = function(input) {\n\t\tinput = String(input)\n\t\t\t.replace(REGEX_SPACE_CHARACTERS, '');\n\t\tvar length = input.length;\n\t\tif (length % 4 == 0) {\n\t\t\tinput = input.replace(/==?$/, '');\n\t\t\tlength = input.length;\n\t\t}\n\t\tif (\n\t\t\tlength % 4 == 1 ||\n\t\t\t// http://whatwg.org/C#alphanumeric-ascii-characters\n\t\t\t/[^+a-zA-Z0-9/]/.test(input)\n\t\t) {\n\t\t\terror(\n\t\t\t\t'Invalid character: the string to be decoded is not correctly encoded.'\n\t\t\t);\n\t\t}\n\t\tvar bitCounter = 0;\n\t\tvar bitStorage;\n\t\tvar buffer;\n\t\tvar output = '';\n\t\tvar position = -1;\n\t\twhile (++position < length) {\n\t\t\tbuffer = TABLE.indexOf(input.charAt(position));\n\t\t\tbitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;\n\t\t\t// Unless this is the first of a group of 4 characters…\n\t\t\tif (bitCounter++ % 4) {\n\t\t\t\t// …convert the first 8 bits to a single ASCII character.\n\t\t\t\toutput += String.fromCharCode(\n\t\t\t\t\t0xFF & bitStorage >> (-2 * bitCounter & 6)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t};\n\n\t// `encode` is designed to be fully compatible with `btoa` as described in the\n\t// HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa\n\tvar encode = function(input) {\n\t\tinput = String(input);\n\t\tif (/[^\\0-\\xFF]/.test(input)) {\n\t\t\t// Note: no need to special-case astral symbols here, as surrogates are\n\t\t\t// matched, and the input is supposed to only contain ASCII anyway.\n\t\t\terror(\n\t\t\t\t'The string to be encoded contains characters outside of the ' +\n\t\t\t\t'Latin1 range.'\n\t\t\t);\n\t\t}\n\t\tvar padding = input.length % 3;\n\t\tvar output = '';\n\t\tvar position = -1;\n\t\tvar a;\n\t\tvar b;\n\t\tvar c;\n\t\tvar d;\n\t\tvar buffer;\n\t\t// Make sure any padding is handled outside of the loop.\n\t\tvar length = input.length - padding;\n\n\t\twhile (++position < length) {\n\t\t\t// Read three bytes, i.e. 24 bits.\n\t\t\ta = input.charCodeAt(position) << 16;\n\t\t\tb = input.charCodeAt(++position) << 8;\n\t\t\tc = input.charCodeAt(++position);\n\t\t\tbuffer = a + b + c;\n\t\t\t// Turn the 24 bits into four chunks of 6 bits each, and append the\n\t\t\t// matching character for each of them to the output.\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 18 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer >> 12 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer >> 6 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer & 0x3F)\n\t\t\t);\n\t\t}\n\n\t\tif (padding == 2) {\n\t\t\ta = input.charCodeAt(position) << 8;\n\t\t\tb = input.charCodeAt(++position);\n\t\t\tbuffer = a + b;\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 10) +\n\t\t\t\tTABLE.charAt((buffer >> 4) & 0x3F) +\n\t\t\t\tTABLE.charAt((buffer << 2) & 0x3F) +\n\t\t\t\t'='\n\t\t\t);\n\t\t} else if (padding == 1) {\n\t\t\tbuffer = input.charCodeAt(position);\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 2) +\n\t\t\t\tTABLE.charAt((buffer << 4) & 0x3F) +\n\t\t\t\t'=='\n\t\t\t);\n\t\t}\n\n\t\treturn output;\n\t};\n\n\tvar base64 = {\n\t\t'encode': encode,\n\t\t'decode': decode,\n\t\t'version': '0.1.0'\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn base64;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = base64;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (var key in base64) {\n\t\t\t\tbase64.hasOwnProperty(key) && (freeExports[key] = base64[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.base64 = base64;\n\t}\n\n}(this));\n","/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE\n * @version 3.1.2\n */\n\n(function() {\n \"use strict\";\n function lib$es6$promise$utils$$objectOrFunction(x) {\n return typeof x === 'function' || (typeof x === 'object' && x !== null);\n }\n\n function lib$es6$promise$utils$$isFunction(x) {\n return typeof x === 'function';\n }\n\n function lib$es6$promise$utils$$isMaybeThenable(x) {\n return typeof x === 'object' && x !== null;\n }\n\n var lib$es6$promise$utils$$_isArray;\n if (!Array.isArray) {\n lib$es6$promise$utils$$_isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n } else {\n lib$es6$promise$utils$$_isArray = Array.isArray;\n }\n\n var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;\n var lib$es6$promise$asap$$len = 0;\n var lib$es6$promise$asap$$vertxNext;\n var lib$es6$promise$asap$$customSchedulerFn;\n\n var lib$es6$promise$asap$$asap = function asap(callback, arg) {\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;\n lib$es6$promise$asap$$len += 2;\n if (lib$es6$promise$asap$$len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (lib$es6$promise$asap$$customSchedulerFn) {\n lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);\n } else {\n lib$es6$promise$asap$$scheduleFlush();\n }\n }\n }\n\n function lib$es6$promise$asap$$setScheduler(scheduleFn) {\n lib$es6$promise$asap$$customSchedulerFn = scheduleFn;\n }\n\n function lib$es6$promise$asap$$setAsap(asapFn) {\n lib$es6$promise$asap$$asap = asapFn;\n }\n\n var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;\n var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};\n var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;\n var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n // test for web worker but not in IE10\n var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&\n typeof importScripts !== 'undefined' &&\n typeof MessageChannel !== 'undefined';\n\n // node\n function lib$es6$promise$asap$$useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function() {\n process.nextTick(lib$es6$promise$asap$$flush);\n };\n }\n\n // vertx\n function lib$es6$promise$asap$$useVertxTimer() {\n return function() {\n lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);\n };\n }\n\n function lib$es6$promise$asap$$useMutationObserver() {\n var iterations = 0;\n var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function() {\n node.data = (iterations = ++iterations % 2);\n };\n }\n\n // web worker\n function lib$es6$promise$asap$$useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = lib$es6$promise$asap$$flush;\n return function () {\n channel.port2.postMessage(0);\n };\n }\n\n function lib$es6$promise$asap$$useSetTimeout() {\n return function() {\n setTimeout(lib$es6$promise$asap$$flush, 1);\n };\n }\n\n var lib$es6$promise$asap$$queue = new Array(1000);\n function lib$es6$promise$asap$$flush() {\n for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {\n var callback = lib$es6$promise$asap$$queue[i];\n var arg = lib$es6$promise$asap$$queue[i+1];\n\n callback(arg);\n\n lib$es6$promise$asap$$queue[i] = undefined;\n lib$es6$promise$asap$$queue[i+1] = undefined;\n }\n\n lib$es6$promise$asap$$len = 0;\n }\n\n function lib$es6$promise$asap$$attemptVertx() {\n try {\n var r = require;\n var vertx = r('vertx');\n lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return lib$es6$promise$asap$$useVertxTimer();\n } catch(e) {\n return lib$es6$promise$asap$$useSetTimeout();\n }\n }\n\n var lib$es6$promise$asap$$scheduleFlush;\n // Decide what async method to use to triggering processing of queued callbacks:\n if (lib$es6$promise$asap$$isNode) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();\n } else if (lib$es6$promise$asap$$BrowserMutationObserver) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();\n } else if (lib$es6$promise$asap$$isWorker) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();\n } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();\n } else {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();\n }\n function lib$es6$promise$then$$then(onFulfillment, onRejection) {\n var parent = this;\n var state = parent._state;\n\n if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {\n return this;\n }\n\n var child = new this.constructor(lib$es6$promise$$internal$$noop);\n var result = parent._result;\n\n if (state) {\n var callback = arguments[state - 1];\n lib$es6$promise$asap$$asap(function(){\n lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);\n });\n } else {\n lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n }\n var lib$es6$promise$then$$default = lib$es6$promise$then$$then;\n function lib$es6$promise$promise$resolve$$resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$resolve(promise, object);\n return promise;\n }\n var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;\n\n function lib$es6$promise$$internal$$noop() {}\n\n var lib$es6$promise$$internal$$PENDING = void 0;\n var lib$es6$promise$$internal$$FULFILLED = 1;\n var lib$es6$promise$$internal$$REJECTED = 2;\n\n var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n }\n\n function lib$es6$promise$$internal$$cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n }\n\n function lib$es6$promise$$internal$$getThen(promise) {\n try {\n return promise.then;\n } catch(error) {\n lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;\n return lib$es6$promise$$internal$$GET_THEN_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch(e) {\n return e;\n }\n }\n\n function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {\n lib$es6$promise$asap$$asap(function(promise) {\n var sealed = false;\n var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {\n if (sealed) { return; }\n sealed = true;\n if (thenable !== value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }, function(reason) {\n if (sealed) { return; }\n sealed = true;\n\n lib$es6$promise$$internal$$reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n lib$es6$promise$$internal$$reject(promise, error);\n }\n }, promise);\n }\n\n function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {\n if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, thenable._result);\n } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, thenable._result);\n } else {\n lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n }\n }\n\n function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) {\n if (maybeThenable.constructor === promise.constructor &&\n then === lib$es6$promise$then$$default &&\n constructor.resolve === lib$es6$promise$promise$resolve$$default) {\n lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);\n } else {\n if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);\n } else if (then === undefined) {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n } else if (lib$es6$promise$utils$$isFunction(then)) {\n lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n }\n }\n }\n\n function lib$es6$promise$$internal$$resolve(promise, value) {\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());\n } else if (lib$es6$promise$utils$$objectOrFunction(value)) {\n lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value));\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n lib$es6$promise$$internal$$publish(promise);\n }\n\n function lib$es6$promise$$internal$$fulfill(promise, value) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n\n promise._result = value;\n promise._state = lib$es6$promise$$internal$$FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);\n }\n }\n\n function lib$es6$promise$$internal$$reject(promise, reason) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n promise._state = lib$es6$promise$$internal$$REJECTED;\n promise._result = reason;\n\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);\n }\n\n function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {\n var subscribers = parent._subscribers;\n var length = subscribers.length;\n\n parent._onerror = null;\n\n subscribers[length] = child;\n subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;\n subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);\n }\n }\n\n function lib$es6$promise$$internal$$publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) { return; }\n\n var child, callback, detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n }\n\n function lib$es6$promise$$internal$$ErrorObject() {\n this.error = null;\n }\n\n var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$tryCatch(callback, detail) {\n try {\n return callback(detail);\n } catch(e) {\n lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;\n return lib$es6$promise$$internal$$TRY_CATCH_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {\n var hasCallback = lib$es6$promise$utils$$isFunction(callback),\n value, error, succeeded, failed;\n\n if (hasCallback) {\n value = lib$es6$promise$$internal$$tryCatch(callback, detail);\n\n if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value = null;\n } else {\n succeeded = true;\n }\n\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());\n return;\n }\n\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (promise._state !== lib$es6$promise$$internal$$PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else if (failed) {\n lib$es6$promise$$internal$$reject(promise, error);\n } else if (settled === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, value);\n } else if (settled === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value){\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function rejectPromise(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n } catch(e) {\n lib$es6$promise$$internal$$reject(promise, e);\n }\n }\n\n function lib$es6$promise$promise$all$$all(entries) {\n return new lib$es6$promise$enumerator$$default(this, entries).promise;\n }\n var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;\n function lib$es6$promise$promise$race$$race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (!lib$es6$promise$utils$$isArray(entries)) {\n lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));\n return promise;\n }\n\n var length = entries.length;\n\n function onFulfillment(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }\n\n function onRejection(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n }\n\n for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);\n }\n\n return promise;\n }\n var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;\n function lib$es6$promise$promise$reject$$reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$reject(promise, reason);\n return promise;\n }\n var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;\n\n var lib$es6$promise$promise$$counter = 0;\n\n function lib$es6$promise$promise$$needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n }\n\n function lib$es6$promise$promise$$needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n }\n\n var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;\n /**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n var promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {function} resolver\n Useful for tooling.\n @constructor\n */\n function lib$es6$promise$promise$$Promise(resolver) {\n this._id = lib$es6$promise$promise$$counter++;\n this._state = undefined;\n this._result = undefined;\n this._subscribers = [];\n\n if (lib$es6$promise$$internal$$noop !== resolver) {\n typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver();\n this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew();\n }\n }\n\n lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;\n lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;\n lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;\n lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;\n lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;\n lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;\n lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;\n\n lib$es6$promise$promise$$Promise.prototype = {\n constructor: lib$es6$promise$promise$$Promise,\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n\n Chaining\n --------\n\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n\n Assimilation\n ------------\n\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n\n If the assimliated promise rejects, then the downstream promise will also reject.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n\n Simple Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var result;\n\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n\n Advanced Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var author, books;\n\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n\n function foundBooks(books) {\n\n }\n\n function failure(reason) {\n\n }\n\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n then: lib$es6$promise$then$$default,\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n };\n var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;\n function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (Array.isArray(input)) {\n this._input = input;\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate();\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n }\n }\n } else {\n lib$es6$promise$$internal$$reject(this.promise, this._validationError());\n }\n }\n\n lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {\n return new Error('Array Methods must be provided an Array');\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {\n var length = this.length;\n var input = this._input;\n\n for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {\n var c = this._instanceConstructor;\n var resolve = c.resolve;\n\n if (resolve === lib$es6$promise$promise$resolve$$default) {\n var then = lib$es6$promise$$internal$$getThen(entry);\n\n if (then === lib$es6$promise$then$$default &&\n entry._state !== lib$es6$promise$$internal$$PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === lib$es6$promise$promise$$default) {\n var promise = new c(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then);\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);\n }\n } else {\n this._willSettleAt(resolve(entry), i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {\n var promise = this.promise;\n\n if (promise._state === lib$es6$promise$$internal$$PENDING) {\n this._remaining--;\n\n if (state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(promise, this._result);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {\n var enumerator = this;\n\n lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {\n enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);\n }, function(reason) {\n enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);\n });\n };\n function lib$es6$promise$polyfill$$polyfill() {\n var local;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {\n return;\n }\n\n local.Promise = lib$es6$promise$promise$$default;\n }\n var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;\n\n var lib$es6$promise$umd$$ES6Promise = {\n 'Promise': lib$es6$promise$promise$$default,\n 'polyfill': lib$es6$promise$polyfill$$default\n };\n\n /* global define:true module:true window: true */\n if (typeof define === 'function' && define['amd']) {\n define(function() { return lib$es6$promise$umd$$ES6Promise; });\n } else if (typeof module !== 'undefined' && module['exports']) {\n module['exports'] = lib$es6$promise$umd$$ES6Promise;\n } else if (typeof this !== 'undefined') {\n this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;\n }\n\n lib$es6$promise$polyfill$$default();\n}).call(this);\n\n","// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/*! https://mths.be/utf8js v2.0.0 by @mathias */\n;(function(root) {\n\n\t// Detect free variables `exports`\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code,\n\t// and use it as `root`\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar stringFromCharCode = String.fromCharCode;\n\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2decode(string) {\n\t\tvar output = [];\n\t\tvar counter = 0;\n\t\tvar length = string.length;\n\t\tvar value;\n\t\tvar extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2encode(array) {\n\t\tvar length = array.length;\n\t\tvar index = -1;\n\t\tvar value;\n\t\tvar output = '';\n\t\twhile (++index < length) {\n\t\t\tvalue = array[index];\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t}\n\t\treturn output;\n\t}\n\n\tfunction checkScalarValue(codePoint) {\n\t\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t}\n\t/*--------------------------------------------------------------------------*/\n\n\tfunction createByte(codePoint, shift) {\n\t\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n\t}\n\n\tfunction encodeCodePoint(codePoint) {\n\t\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\t\treturn stringFromCharCode(codePoint);\n\t\t}\n\t\tvar symbol = '';\n\t\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t\t}\n\t\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\t\tcheckScalarValue(codePoint);\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\t\tsymbol += createByte(codePoint, 12);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\t\treturn symbol;\n\t}\n\n\tfunction utf8encode(string) {\n\t\tvar codePoints = ucs2decode(string);\n\t\tvar length = codePoints.length;\n\t\tvar index = -1;\n\t\tvar codePoint;\n\t\tvar byteString = '';\n\t\twhile (++index < length) {\n\t\t\tcodePoint = codePoints[index];\n\t\t\tbyteString += encodeCodePoint(codePoint);\n\t\t}\n\t\treturn byteString;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tfunction readContinuationByte() {\n\t\tif (byteIndex >= byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\n\t\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\n\t\tif ((continuationByte & 0xC0) == 0x80) {\n\t\t\treturn continuationByte & 0x3F;\n\t\t}\n\n\t\t// If we end up here, it’s not a continuation byte\n\t\tthrow Error('Invalid continuation byte');\n\t}\n\n\tfunction decodeSymbol() {\n\t\tvar byte1;\n\t\tvar byte2;\n\t\tvar byte3;\n\t\tvar byte4;\n\t\tvar codePoint;\n\n\t\tif (byteIndex > byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\n\t\tif (byteIndex == byteCount) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Read first byte\n\t\tbyte1 = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\n\t\t// 1-byte sequence (no continuation bytes)\n\t\tif ((byte1 & 0x80) == 0) {\n\t\t\treturn byte1;\n\t\t}\n\n\t\t// 2-byte sequence\n\t\tif ((byte1 & 0xE0) == 0xC0) {\n\t\t\tvar byte2 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\t\tif (codePoint >= 0x80) {\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\n\t\t// 3-byte sequence (may include unpaired surrogates)\n\t\tif ((byte1 & 0xF0) == 0xE0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\t\tif (codePoint >= 0x0800) {\n\t\t\t\tcheckScalarValue(codePoint);\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\n\t\t// 4-byte sequence\n\t\tif ((byte1 & 0xF8) == 0xF0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tbyte4 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |\n\t\t\t\t(byte3 << 0x06) | byte4;\n\t\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\t\treturn codePoint;\n\t\t\t}\n\t\t}\n\n\t\tthrow Error('Invalid UTF-8 detected');\n\t}\n\n\tvar byteArray;\n\tvar byteCount;\n\tvar byteIndex;\n\tfunction utf8decode(byteString) {\n\t\tbyteArray = ucs2decode(byteString);\n\t\tbyteCount = byteArray.length;\n\t\tbyteIndex = 0;\n\t\tvar codePoints = [];\n\t\tvar tmp;\n\t\twhile ((tmp = decodeSymbol()) !== false) {\n\t\t\tcodePoints.push(tmp);\n\t\t}\n\t\treturn ucs2encode(codePoints);\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar utf8 = {\n\t\t'version': '2.0.0',\n\t\t'encode': utf8encode,\n\t\t'decode': utf8decode\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn utf8;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = utf8;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tvar object = {};\n\t\t\tvar hasOwnProperty = object.hasOwnProperty;\n\t\t\tfor (var key in utf8) {\n\t\t\t\thasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.utf8 = utf8;\n\t}\n\n}(this));\n","/*!\r\n * @overview Github.js\r\n *\r\n * @copyright (c) 2013 Michael Aufreiter, Development Seed\r\n * Github.js is freely distributable.\r\n *\r\n * @license Licensed under BSD-3-Clause-Clear\r\n *\r\n * For all details and documentation:\r\n * http://substance.io/michael/github\r\n */\r\n'use strict';\r\n\r\n(function (root, factory) {\r\n /* istanbul ignore next */\r\n if (typeof define === 'function' && define.amd) {\r\n define(\r\n [\r\n 'es6-promise',\r\n 'base-64',\r\n 'utf8',\r\n 'axios'\r\n ],\r\n function (Promise, Base64, Utf8, axios) {\r\n return (root.Github = factory(Promise, Base64, Utf8, axios));\r\n }\r\n );\r\n } else if (typeof module === 'object' && module.exports) {\r\n module.exports = factory(require('es6-promise'), require('base-64'), require('utf8'), require('axios'));\r\n } else {\r\n root.Github = factory(root.Promise, root.base64, root.utf8, root.axios);\r\n }\r\n}(this, function(Promise, Base64, Utf8, axios) { // jshint ignore:line\r\n function b64encode(string) {\r\n return Base64.encode(Utf8.encode(string));\r\n }\r\n\r\n if (Promise.polyfill) {\r\n Promise.polyfill();\r\n }\r\n\r\n // Initial Setup\r\n // -------------\r\n\r\n var Github = function (options) {\r\n options = options || {};\r\n\r\n var API_URL = options.apiUrl || 'https://api.github.com';\r\n\r\n // HTTP Request Abstraction\r\n // =======\r\n //\r\n // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec.\r\n\r\n var _request = Github._request = function _request(method, path, data, cb, raw) {\r\n function getURL() {\r\n var url = path.indexOf('//') >= 0 ? path : API_URL + path;\r\n\r\n url += ((/\\?/).test(url) ? '&' : '?');\r\n\r\n if (data && typeof data === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) {\r\n for(var param in data) {\r\n if (data.hasOwnProperty(param)) {\r\n url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]);\r\n }\r\n }\r\n }\r\n\r\n return url.replace(/(×tamp=\\d+)/, '') +\r\n (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : '');\r\n }\r\n\r\n var config = {\r\n headers: {\r\n Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json',\r\n 'Content-Type': 'application/json;charset=UTF-8'\r\n },\r\n method: method,\r\n data: data ? data : {},\r\n url: getURL()\r\n };\r\n\r\n if ((options.token) || (options.username && options.password)) {\r\n config.headers.Authorization = options.token ?\r\n 'token ' + options.token :\r\n 'Basic ' + b64encode(options.username + ':' + options.password);\r\n }\r\n\r\n return axios(config)\r\n .then(function (response) {\r\n cb(\r\n null,\r\n response.data || true,\r\n response.request\r\n );\r\n }, function (response) {\r\n if (response.status === 304) {\r\n cb(\r\n null,\r\n response.data || true,\r\n response.request\r\n );\r\n } else {\r\n cb({\r\n path: path,\r\n request: response.request,\r\n error: response.status\r\n });\r\n }\r\n });\r\n };\r\n\r\n var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, cb) {\r\n var results = [];\r\n\r\n (function iterate() {\r\n _request('GET', path, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n if (!(res instanceof Array)) {\r\n res = [res];\r\n }\r\n\r\n results.push.apply(results, res);\r\n\r\n var next = (xhr.getResponseHeader('link') || '')\r\n .split(',')\r\n .filter(function(link) {\r\n return /rel=\"next\"/.test(link);\r\n })\r\n .map(function(link) {\r\n return (/<(.*)>/.exec(link) || [])[1];\r\n })\r\n .pop();\r\n\r\n if (!next) {\r\n cb(err, results, xhr);\r\n } else {\r\n path = next;\r\n iterate();\r\n }\r\n });\r\n })();\r\n };\r\n\r\n // User API\r\n // =======\r\n\r\n Github.User = function () {\r\n this.repos = function (options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n options = options || {};\r\n\r\n var url = '/user/repos';\r\n var params = [];\r\n\r\n params.push('type=' + encodeURIComponent(options.type || 'all'));\r\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\r\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n url += '?' + params.join('&');\r\n\r\n _requestAllPages(url, cb);\r\n };\r\n\r\n // List user organizations\r\n // -------\r\n\r\n this.orgs = function (cb) {\r\n _request('GET', '/user/orgs', null, cb);\r\n };\r\n\r\n // List authenticated user's gists\r\n // -------\r\n\r\n this.gists = function (cb) {\r\n _request('GET', '/gists', null, cb);\r\n };\r\n\r\n // List authenticated user's unread notifications\r\n // -------\r\n\r\n this.notifications = function (options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n options = options || {};\r\n var url = '/notifications';\r\n var params = [];\r\n\r\n if (options.all) {\r\n params.push('all=true');\r\n }\r\n\r\n if (options.participating) {\r\n params.push('participating=true');\r\n }\r\n\r\n if (options.since) {\r\n var since = options.since;\r\n\r\n if (since.constructor === Date) {\r\n since = since.toISOString();\r\n }\r\n\r\n params.push('since=' + encodeURIComponent(since));\r\n }\r\n\r\n if (options.before) {\r\n var before = options.before;\r\n\r\n if (before.constructor === Date) {\r\n before = before.toISOString();\r\n }\r\n\r\n params.push('before=' + encodeURIComponent(before));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Show user information\r\n // -------\r\n\r\n this.show = function (username, cb) {\r\n var command = username ? '/users/' + username : '/user';\r\n\r\n _request('GET', command, null, cb);\r\n };\r\n\r\n // List user repositories\r\n // -------\r\n\r\n this.userRepos = function (username, options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n var url = '/users/' + username + '/repos';\r\n var params = [];\r\n\r\n params.push('type=' + encodeURIComponent(options.type || 'all'));\r\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\r\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n url += '?' + params.join('&');\r\n\r\n _requestAllPages(url, cb);\r\n };\r\n\r\n // List user starred repositories\r\n // -------\r\n\r\n this.userStarred = function (username, cb) {\r\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\r\n _requestAllPages('/users/' + username + '/starred?type=all&per_page=100', cb);\r\n };\r\n\r\n // List a user's gists\r\n // -------\r\n\r\n this.userGists = function (username, cb) {\r\n _request('GET', '/users/' + username + '/gists', null, cb);\r\n };\r\n\r\n // List organization repositories\r\n // -------\r\n\r\n this.orgRepos = function (orgname, cb) {\r\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\r\n _requestAllPages('/orgs/' + orgname + '/repos?type=all&&page_num=1000&sort=updated&direction=desc', cb);\r\n };\r\n\r\n // Follow user\r\n // -------\r\n\r\n this.follow = function (username, cb) {\r\n _request('PUT', '/user/following/' + username, null, cb);\r\n };\r\n\r\n // Unfollow user\r\n // -------\r\n\r\n this.unfollow = function (username, cb) {\r\n _request('DELETE', '/user/following/' + username, null, cb);\r\n };\r\n\r\n // Create a repo\r\n // -------\r\n this.createRepo = function (options, cb) {\r\n _request('POST', '/user/repos', options, cb);\r\n };\r\n };\r\n\r\n // Repository API\r\n // =======\r\n\r\n Github.Repository = function (options) {\r\n var repo = options.name;\r\n var user = options.user;\r\n var fullname = options.fullname;\r\n\r\n var that = this;\r\n var repoPath;\r\n\r\n if (fullname) {\r\n repoPath = '/repos/' + fullname;\r\n } else {\r\n repoPath = '/repos/' + user + '/' + repo;\r\n }\r\n\r\n var currentTree = {\r\n branch: null,\r\n sha: null\r\n };\r\n\r\n // Uses the cache if branch has not been changed\r\n // -------\r\n\r\n function updateTree(branch, cb) {\r\n if (branch === currentTree.branch && currentTree.sha) {\r\n return cb(null, currentTree.sha);\r\n }\r\n\r\n that.getRef('heads/' + branch, function (err, sha) {\r\n currentTree.branch = branch;\r\n currentTree.sha = sha;\r\n cb(err, sha);\r\n });\r\n }\r\n\r\n // Get a particular reference\r\n // -------\r\n\r\n this.getRef = function (ref, cb) {\r\n _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.object.sha, xhr);\r\n });\r\n };\r\n\r\n // Create a new reference\r\n // --------\r\n //\r\n // {\r\n // \"ref\": \"refs/heads/my-new-branch-name\",\r\n // \"sha\": \"827efc6d56897b048c772eb4087f854f46256132\"\r\n // }\r\n\r\n this.createRef = function (options, cb) {\r\n _request('POST', repoPath + '/git/refs', options, cb);\r\n };\r\n\r\n // Delete a reference\r\n // --------\r\n //\r\n // Repo.deleteRef('heads/gh-pages')\r\n // repo.deleteRef('tags/v1.0')\r\n\r\n this.deleteRef = function (ref, cb) {\r\n _request('DELETE', repoPath + '/git/refs/' + ref, options, cb);\r\n };\r\n\r\n // Delete a repo\r\n // --------\r\n\r\n this.deleteRepo = function (cb) {\r\n _request('DELETE', repoPath, options, cb);\r\n };\r\n\r\n // List all tags of a repository\r\n // -------\r\n\r\n this.listTags = function (cb) {\r\n _request('GET', repoPath + '/tags', null, cb);\r\n };\r\n\r\n // List all pull requests of a respository\r\n // -------\r\n\r\n this.listPulls = function (options, cb) {\r\n options = options || {};\r\n var url = repoPath + '/pulls';\r\n var params = [];\r\n\r\n if (typeof options === 'string') {\r\n // Backward compatibility\r\n params.push('state=' + options);\r\n } else {\r\n if (options.state) {\r\n params.push('state=' + encodeURIComponent(options.state));\r\n }\r\n\r\n if (options.head) {\r\n params.push('head=' + encodeURIComponent(options.head));\r\n }\r\n\r\n if (options.base) {\r\n params.push('base=' + encodeURIComponent(options.base));\r\n }\r\n\r\n if (options.sort) {\r\n params.push('sort=' + encodeURIComponent(options.sort));\r\n }\r\n\r\n if (options.direction) {\r\n params.push('direction=' + encodeURIComponent(options.direction));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + options.page);\r\n }\r\n\r\n if (options.per_page) {\r\n params.push('per_page=' + options.per_page);\r\n }\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Gets details for a specific pull request\r\n // -------\r\n\r\n this.getPull = function (number, cb) {\r\n _request('GET', repoPath + '/pulls/' + number, null, cb);\r\n };\r\n\r\n // Retrieve the changes made between base and head\r\n // -------\r\n\r\n this.compare = function (base, head, cb) {\r\n _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb);\r\n };\r\n\r\n // List all branches of a repository\r\n // -------\r\n\r\n this.listBranches = function (cb) {\r\n _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n heads = heads.map(function (head) {\r\n return head.ref.replace(/^refs\\/heads\\//, '');\r\n });\r\n\r\n cb(null, heads, xhr);\r\n });\r\n };\r\n\r\n // Retrieve the contents of a blob\r\n // -------\r\n\r\n this.getBlob = function (sha, cb) {\r\n _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw');\r\n };\r\n\r\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\r\n // -------\r\n\r\n this.getCommit = function (branch, sha, cb) {\r\n _request('GET', repoPath + '/git/commits/' + sha, null, cb);\r\n };\r\n\r\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\r\n // -------\r\n\r\n this.getSha = function (branch, path, cb) {\r\n if (!path || path === '') {\r\n return that.getRef('heads/' + branch, cb);\r\n }\r\n\r\n _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''),\r\n null, function (err, pathContent, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, pathContent.sha, xhr);\r\n });\r\n };\r\n\r\n // Get the statuses for a particular SHA\r\n // -------\r\n\r\n this.getStatuses = function (sha, cb) {\r\n _request('GET', repoPath + '/statuses/' + sha, null, cb);\r\n };\r\n\r\n // Retrieve the tree a commit points to\r\n // -------\r\n\r\n this.getTree = function (tree, cb) {\r\n _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.tree, xhr);\r\n });\r\n };\r\n\r\n // Post a new blob object, getting a blob SHA back\r\n // -------\r\n\r\n this.postBlob = function (content, cb) {\r\n if (typeof content === 'string') {\r\n content = {\r\n content: content,\r\n encoding: 'utf-8'\r\n };\r\n } else {\r\n content = {\r\n content: b64encode(content),\r\n encoding: 'base64'\r\n };\r\n }\r\n\r\n _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Update an existing tree adding a new blob object getting a tree SHA back\r\n // -------\r\n\r\n this.updateTree = function (baseTree, path, blob, cb) {\r\n var data = {\r\n base_tree: baseTree,\r\n tree: [\r\n {\r\n path: path,\r\n mode: '100644',\r\n type: 'blob',\r\n sha: blob\r\n }\r\n ]\r\n };\r\n\r\n _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Post a new tree object having a file path pointer replaced\r\n // with a new blob SHA getting a tree SHA back\r\n // -------\r\n\r\n this.postTree = function (tree, cb) {\r\n _request('POST', repoPath + '/git/trees', {\r\n tree: tree\r\n }, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Create a new commit object with the current commit SHA as the parent\r\n // and the new tree SHA, getting a commit SHA back\r\n // -------\r\n\r\n this.commit = function (parent, tree, message, cb) {\r\n var user = new Github.User();\r\n\r\n user.show(null, function (err, userData) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n var data = {\r\n message: message,\r\n author: {\r\n name: options.user,\r\n email: userData.email\r\n },\r\n parents: [\r\n parent\r\n ],\r\n tree: tree\r\n };\r\n\r\n _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n currentTree.sha = res.sha; // Update latest commit\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n });\r\n };\r\n\r\n // Update the reference of your head to point to the new commit SHA\r\n // -------\r\n\r\n this.updateHead = function (head, commit, cb) {\r\n _request('PATCH', repoPath + '/git/refs/heads/' + head, {\r\n sha: commit\r\n }, cb);\r\n };\r\n\r\n // Show repository information\r\n // -------\r\n\r\n this.show = function (cb) {\r\n _request('GET', repoPath, null, cb);\r\n };\r\n\r\n // Show repository contributors\r\n // -------\r\n\r\n this.contributors = function (cb, retry) {\r\n retry = retry || 1000;\r\n var that = this;\r\n\r\n _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n if (xhr.status === 202) {\r\n setTimeout(\r\n function () {\r\n that.contributors(cb, retry);\r\n },\r\n retry\r\n );\r\n } else {\r\n cb(err, data, xhr);\r\n }\r\n });\r\n };\r\n\r\n // Get contents\r\n // --------\r\n\r\n this.contents = function (ref, path, cb) {\r\n path = encodeURI(path);\r\n _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), {\r\n ref: ref\r\n }, cb);\r\n };\r\n\r\n // Fork repository\r\n // -------\r\n\r\n this.fork = function (cb) {\r\n _request('POST', repoPath + '/forks', null, cb);\r\n };\r\n\r\n // List forks\r\n // --------\r\n\r\n this.listForks = function (cb) {\r\n _request('GET', repoPath + '/forks', null, cb);\r\n };\r\n\r\n // Branch repository\r\n // --------\r\n\r\n this.branch = function (oldBranch, newBranch, cb) {\r\n if (arguments.length === 2 && typeof arguments[1] === 'function') {\r\n cb = newBranch;\r\n newBranch = oldBranch;\r\n oldBranch = 'master';\r\n }\r\n\r\n this.getRef('heads/' + oldBranch, function (err, ref) {\r\n if (err && cb) {\r\n return cb(err);\r\n }\r\n\r\n that.createRef({\r\n ref: 'refs/heads/' + newBranch,\r\n sha: ref\r\n }, cb);\r\n });\r\n };\r\n\r\n // Create pull request\r\n // --------\r\n\r\n this.createPullRequest = function (options, cb) {\r\n _request('POST', repoPath + '/pulls', options, cb);\r\n };\r\n\r\n // List hooks\r\n // --------\r\n\r\n this.listHooks = function (cb) {\r\n _request('GET', repoPath + '/hooks', null, cb);\r\n };\r\n\r\n // Get a hook\r\n // --------\r\n\r\n this.getHook = function (id, cb) {\r\n _request('GET', repoPath + '/hooks/' + id, null, cb);\r\n };\r\n\r\n // Create a hook\r\n // --------\r\n\r\n this.createHook = function (options, cb) {\r\n _request('POST', repoPath + '/hooks', options, cb);\r\n };\r\n\r\n // Edit a hook\r\n // --------\r\n\r\n this.editHook = function (id, options, cb) {\r\n _request('PATCH', repoPath + '/hooks/' + id, options, cb);\r\n };\r\n\r\n // Delete a hook\r\n // --------\r\n\r\n this.deleteHook = function (id, cb) {\r\n _request('DELETE', repoPath + '/hooks/' + id, null, cb);\r\n };\r\n\r\n // Read file at given path\r\n // -------\r\n\r\n this.read = function (branch, path, cb) {\r\n _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''),\r\n null, cb, true);\r\n };\r\n\r\n // Remove a file\r\n // -------\r\n\r\n this.remove = function (branch, path, cb) {\r\n that.getSha(branch, path, function (err, sha) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n _request('DELETE', repoPath + '/contents/' + path, {\r\n message: path + ' is removed',\r\n sha: sha,\r\n branch: branch\r\n }, cb);\r\n });\r\n };\r\n\r\n // Alias for repo.remove for backwards comapt.\r\n // -------\r\n this.delete = this.remove;\r\n\r\n // Move a file to a new location\r\n // -------\r\n\r\n this.move = function (branch, path, newPath, cb) {\r\n updateTree(branch, function (err, latestCommit) {\r\n that.getTree(latestCommit + '?recursive=true', function (err, tree) {\r\n // Update Tree\r\n tree.forEach(function (ref) {\r\n if (ref.path === path) {\r\n ref.path = newPath;\r\n }\r\n\r\n if (ref.type === 'tree') {\r\n delete ref.sha;\r\n }\r\n });\r\n\r\n that.postTree(tree, function (err, rootTree) {\r\n that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) {\r\n that.updateHead(branch, commit, cb);\r\n });\r\n });\r\n });\r\n });\r\n };\r\n\r\n // Write file contents to a given branch and path\r\n // -------\r\n\r\n this.write = function (branch, path, content, message, options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n that.getSha(branch, encodeURI(path), function (err, sha) {\r\n var writeOptions = {\r\n message: message,\r\n content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content,\r\n branch: branch,\r\n committer: options && options.committer ? options.committer : undefined,\r\n author: options && options.author ? options.author : undefined\r\n };\r\n\r\n // If no error, we set the sha to overwrite an existing file\r\n if (!(err && err.error !== 404)) {\r\n writeOptions.sha = sha;\r\n }\r\n\r\n _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb);\r\n });\r\n };\r\n\r\n // List commits on a repository. Takes an object of optional parameters:\r\n // sha: SHA or branch to start listing commits from\r\n // path: Only commits containing this file path will be returned\r\n // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address\r\n // since: ISO 8601 date - only commits after this date will be returned\r\n // until: ISO 8601 date - only commits before this date will be returned\r\n // -------\r\n\r\n this.getCommits = function (options, cb) {\r\n options = options || {};\r\n var url = repoPath + '/commits';\r\n var params = [];\r\n\r\n if (options.sha) {\r\n params.push('sha=' + encodeURIComponent(options.sha));\r\n }\r\n\r\n if (options.path) {\r\n params.push('path=' + encodeURIComponent(options.path));\r\n }\r\n\r\n if (options.author) {\r\n params.push('author=' + encodeURIComponent(options.author));\r\n }\r\n\r\n if (options.since) {\r\n var since = options.since;\r\n\r\n if (since.constructor === Date) {\r\n since = since.toISOString();\r\n }\r\n\r\n params.push('since=' + encodeURIComponent(since));\r\n }\r\n\r\n if (options.until) {\r\n var until = options.until;\r\n\r\n if (until.constructor === Date) {\r\n until = until.toISOString();\r\n }\r\n\r\n params.push('until=' + encodeURIComponent(until));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + options.page);\r\n }\r\n\r\n if (options.perpage) {\r\n params.push('per_page=' + options.perpage);\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Check if a repository is starred.\r\n // --------\r\n\r\n this.isStarred = function(owner, repository, cb) {\r\n _request('GET', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Star a repository.\r\n // --------\r\n\r\n this.star = function(owner, repository, cb) {\r\n _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Unstar a repository.\r\n // --------\r\n\r\n this.unstar = function(owner, repository, cb) {\r\n _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Create a new release\r\n // --------\r\n\r\n this.createRelease = function(options, cb) {\r\n _request('POST', repoPath + '/releases', options, cb);\r\n };\r\n\r\n // Edit a release\r\n // --------\r\n\r\n this.editRelease = function(id, options, cb) {\r\n _request('PATCH', repoPath + '/releases/' + id, options, cb);\r\n };\r\n\r\n // Get a single release\r\n // --------\r\n\r\n this.getRelease = function(id, cb) {\r\n _request('GET', repoPath + '/releases/' + id, null, cb);\r\n };\r\n\r\n // Remove a release\r\n // --------\r\n\r\n this.deleteRelease = function(id, cb) {\r\n _request('DELETE', repoPath + '/releases/' + id, null, cb);\r\n };\r\n };\r\n\r\n // Gists API\r\n // =======\r\n\r\n Github.Gist = function (options) {\r\n var id = options.id;\r\n var gistPath = '/gists/' + id;\r\n\r\n // Read the gist\r\n // --------\r\n\r\n this.read = function (cb) {\r\n _request('GET', gistPath, null, cb);\r\n };\r\n\r\n // Create the gist\r\n // --------\r\n // {\r\n // \"description\": \"the description for this gist\",\r\n // \"public\": true,\r\n // \"files\": {\r\n // \"file1.txt\": {\r\n // \"content\": \"String file contents\"\r\n // }\r\n // }\r\n // }\r\n\r\n this.create = function (options, cb) {\r\n _request('POST', '/gists', options, cb);\r\n };\r\n\r\n // Delete the gist\r\n // --------\r\n\r\n this.delete = function (cb) {\r\n _request('DELETE', gistPath, null, cb);\r\n };\r\n\r\n // Fork a gist\r\n // --------\r\n\r\n this.fork = function (cb) {\r\n _request('POST', gistPath + '/fork', null, cb);\r\n };\r\n\r\n // Update a gist with the new stuff\r\n // --------\r\n\r\n this.update = function (options, cb) {\r\n _request('PATCH', gistPath, options, cb);\r\n };\r\n\r\n // Star a gist\r\n // --------\r\n\r\n this.star = function (cb) {\r\n _request('PUT', gistPath + '/star', null, cb);\r\n };\r\n\r\n // Untar a gist\r\n // --------\r\n\r\n this.unstar = function (cb) {\r\n _request('DELETE', gistPath + '/star', null, cb);\r\n };\r\n\r\n // Check if a gist is starred\r\n // --------\r\n\r\n this.isStarred = function (cb) {\r\n _request('GET', gistPath + '/star', null, cb);\r\n };\r\n };\r\n\r\n // Issues API\r\n // ==========\r\n\r\n Github.Issue = function (options) {\r\n var path = '/repos/' + options.user + '/' + options.repo + '/issues';\r\n\r\n this.create = function(options, cb) {\r\n _request('POST', path, options, cb);\r\n };\r\n\r\n this.list = function (options, cb) {\r\n var query = [];\r\n\r\n for(var key in options) {\r\n if (options.hasOwnProperty(key)) {\r\n query.push(encodeURIComponent(key) + '=' + encodeURIComponent(options[key]));\r\n }\r\n }\r\n\r\n _requestAllPages(path + '?' + query.join('&'), cb);\r\n };\r\n\r\n this.comment = function (issue, comment, cb) {\r\n _request('POST', issue.comments_url, {\r\n body: comment\r\n }, cb);\r\n };\r\n\r\n this.edit = function (issue, options, cb) {\r\n _request('PATCH', path + '/' + issue, options, cb);\r\n };\r\n\r\n this.get = function (issue, cb) {\r\n _request('GET', path + '/' + issue, null, cb);\r\n };\r\n };\r\n\r\n // Search API\r\n // ==========\r\n\r\n Github.Search = function (options) {\r\n var path = '/search/';\r\n var query = '?q=' + options.query;\r\n\r\n this.repositories = function (options, cb) {\r\n _request('GET', path + 'repositories' + query, options, cb);\r\n };\r\n\r\n this.code = function (options, cb) {\r\n _request('GET', path + 'code' + query, options, cb);\r\n };\r\n\r\n this.issues = function (options, cb) {\r\n _request('GET', path + 'issues' + query, options, cb);\r\n };\r\n\r\n this.users = function (options, cb) {\r\n _request('GET', path + 'users' + query, options, cb);\r\n };\r\n };\r\n\r\n // Rate Limit API\r\n // ==========\r\n\r\n Github.RateLimit = function() {\r\n this.getRateLimit = function(cb) {\r\n _request('GET', '/rate_limit', null, cb);\r\n };\r\n };\r\n\r\n return Github;\r\n };\r\n\r\n // Top Level API\r\n // -------\r\n\r\n Github.getIssues = function (user, repo) {\r\n return new Github.Issue({\r\n user: user,\r\n repo: repo\r\n });\r\n };\r\n\r\n Github.getRepo = function (user, repo) {\r\n if (!repo) {\r\n return new Github.Repository({\r\n fullname: user\r\n });\r\n } else {\r\n return new Github.Repository({\r\n user: user,\r\n name: repo\r\n });\r\n }\r\n };\r\n\r\n Github.getUser = function () {\r\n return new Github.User();\r\n };\r\n\r\n Github.getGist = function (id) {\r\n return new Github.Gist({\r\n id: id\r\n });\r\n };\r\n\r\n Github.getSearch = function (query) {\r\n return new Github.Search({\r\n query: query\r\n });\r\n };\r\n\r\n Github.getRateLimit = function() {\r\n return new Github.RateLimit();\r\n };\r\n\r\n return Github;\r\n}));\r\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/github.min.js b/dist/github.min.js deleted file mode 100644 index e178e5da..00000000 --- a/dist/github.min.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";!function(e,t){"function"==typeof define&&define.amd?define(["es6-promise","base-64","utf8","axios"],function(n,o,s,i){return e.Github=t(n,o,s,i)}):"object"==typeof module&&module.exports?module.exports=t(require("es6-promise"),require("base-64"),require("utf8"),require("axios")):e.Github=t(e.Promise,e.base64,e.utf8,e.axios)}(this,function(e,t,n,o){function s(e){return t.encode(n.encode(e))}e.polyfill&&e.polyfill();var i=function(e){e=e||{};var t=e.apiUrl||"https://api.github.com",n=i._request=function(n,i,u,r,a){function c(){var e=i.indexOf("//")>=0?i:t+i;if(e+=/\?/.test(e)?"&":"?",u&&"object"==typeof u&&["GET","HEAD","DELETE"].indexOf(n)>-1)for(var o in u)u.hasOwnProperty(o)&&(e+="&"+encodeURIComponent(o)+"="+encodeURIComponent(u[o]));return e.replace(/(×tamp=\d+)/,"")+("undefined"!=typeof window?"×tamp="+(new Date).getTime():"")}var l={headers:{Accept:a?"application/vnd.github.v3.raw+json":"application/vnd.github.v3+json","Content-Type":"application/json;charset=UTF-8"},method:n,data:u?u:{},url:c()};return(e.token||e.username&&e.password)&&(l.headers.Authorization=e.token?"token "+e.token:"Basic "+s(e.username+":"+e.password)),o(l).then(function(e){r(null,e.data||!0,e.request)},function(e){304===e.status?r(null,e.data||!0,e.request):r({path:i,request:e.request,error:e.status})})},u=i._requestAllPages=function(e,t){var o=[];!function s(){n("GET",e,null,function(n,i,u){if(n)return t(n);i instanceof Array||(i=[i]),o.push.apply(o,i);var r=(u.getResponseHeader("link")||"").split(",").filter(function(e){return/rel="next"/.test(e)}).map(function(e){return(/<(.*)>/.exec(e)||[])[1]}).pop();r?(e=r,s()):t(n,o,u)})}()};return i.User=function(){this.repos=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};var n="/user/repos",o=[];o.push("type="+encodeURIComponent(e.type||"all")),o.push("sort="+encodeURIComponent(e.sort||"updated")),o.push("per_page="+encodeURIComponent(e.per_page||"100")),e.page&&o.push("page="+encodeURIComponent(e.page)),n+="?"+o.join("&"),u(n,t)},this.orgs=function(e){n("GET","/user/orgs",null,e)},this.gists=function(e){n("GET","/gists",null,e)},this.notifications=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};var o="/notifications",s=[];if(e.all&&s.push("all=true"),e.participating&&s.push("participating=true"),e.since){var i=e.since;i.constructor===Date&&(i=i.toISOString()),s.push("since="+encodeURIComponent(i))}if(e.before){var u=e.before;u.constructor===Date&&(u=u.toISOString()),s.push("before="+encodeURIComponent(u))}e.page&&s.push("page="+encodeURIComponent(e.page)),s.length>0&&(o+="?"+s.join("&")),n("GET",o,null,t)},this.show=function(e,t){var o=e?"/users/"+e:"/user";n("GET",o,null,t)},this.userRepos=function(e,t,n){"function"==typeof t&&(n=t,t={});var o="/users/"+e+"/repos",s=[];s.push("type="+encodeURIComponent(t.type||"all")),s.push("sort="+encodeURIComponent(t.sort||"updated")),s.push("per_page="+encodeURIComponent(t.per_page||"100")),t.page&&s.push("page="+encodeURIComponent(t.page)),o+="?"+s.join("&"),u(o,n)},this.userStarred=function(e,t){u("/users/"+e+"/starred?type=all&per_page=100",t)},this.userGists=function(e,t){n("GET","/users/"+e+"/gists",null,t)},this.orgRepos=function(e,t){u("/orgs/"+e+"/repos?type=all&&page_num=1000&sort=updated&direction=desc",t)},this.follow=function(e,t){n("PUT","/user/following/"+e,null,t)},this.unfollow=function(e,t){n("DELETE","/user/following/"+e,null,t)},this.createRepo=function(e,t){n("POST","/user/repos",e,t)}},i.Repository=function(e){function t(e,t){return e===l.branch&&l.sha?t(null,l.sha):void c.getRef("heads/"+e,function(n,o){l.branch=e,l.sha=o,t(n,o)})}var o,u=e.name,r=e.user,a=e.fullname,c=this;o=a?"/repos/"+a:"/repos/"+r+"/"+u;var l={branch:null,sha:null};this.getRef=function(e,t){n("GET",o+"/git/refs/"+e,null,function(e,n,o){return e?t(e):void t(null,n.object.sha,o)})},this.createRef=function(e,t){n("POST",o+"/git/refs",e,t)},this.deleteRef=function(t,s){n("DELETE",o+"/git/refs/"+t,e,s)},this.deleteRepo=function(t){n("DELETE",o,e,t)},this.listTags=function(e){n("GET",o+"/tags",null,e)},this.listPulls=function(e,t){e=e||{};var s=o+"/pulls",i=[];"string"==typeof e?i.push("state="+e):(e.state&&i.push("state="+encodeURIComponent(e.state)),e.head&&i.push("head="+encodeURIComponent(e.head)),e.base&&i.push("base="+encodeURIComponent(e.base)),e.sort&&i.push("sort="+encodeURIComponent(e.sort)),e.direction&&i.push("direction="+encodeURIComponent(e.direction)),e.page&&i.push("page="+e.page),e.per_page&&i.push("per_page="+e.per_page)),i.length>0&&(s+="?"+i.join("&")),n("GET",s,null,t)},this.getPull=function(e,t){n("GET",o+"/pulls/"+e,null,t)},this.compare=function(e,t,s){n("GET",o+"/compare/"+e+"..."+t,null,s)},this.listBranches=function(e){n("GET",o+"/git/refs/heads",null,function(t,n,o){return t?e(t):(n=n.map(function(e){return e.ref.replace(/^refs\/heads\//,"")}),void e(null,n,o))})},this.getBlob=function(e,t){n("GET",o+"/git/blobs/"+e,null,t,"raw")},this.getCommit=function(e,t,s){n("GET",o+"/git/commits/"+t,null,s)},this.getSha=function(e,t,s){return t&&""!==t?void n("GET",o+"/contents/"+t+(e?"?ref="+e:""),null,function(e,t,n){return e?s(e):void s(null,t.sha,n)}):c.getRef("heads/"+e,s)},this.getStatuses=function(e,t){n("GET",o+"/statuses/"+e,null,t)},this.getTree=function(e,t){n("GET",o+"/git/trees/"+e,null,function(e,n,o){return e?t(e):void t(null,n.tree,o)})},this.postBlob=function(e,t){e="string"==typeof e?{content:e,encoding:"utf-8"}:{content:s(e),encoding:"base64"},n("POST",o+"/git/blobs",e,function(e,n,o){return e?t(e):void t(null,n.sha,o)})},this.updateTree=function(e,t,s,i){var u={base_tree:e,tree:[{path:t,mode:"100644",type:"blob",sha:s}]};n("POST",o+"/git/trees",u,function(e,t,n){return e?i(e):void i(null,t.sha,n)})},this.postTree=function(e,t){n("POST",o+"/git/trees",{tree:e},function(e,n,o){return e?t(e):void t(null,n.sha,o)})},this.commit=function(t,s,u,r){var a=new i.User;a.show(null,function(i,a){if(i)return r(i);var c={message:u,author:{name:e.user,email:a.email},parents:[t],tree:s};n("POST",o+"/git/commits",c,function(e,t,n){return e?r(e):(l.sha=t.sha,void r(null,t.sha,n))})})},this.updateHead=function(e,t,s){n("PATCH",o+"/git/refs/heads/"+e,{sha:t},s)},this.show=function(e){n("GET",o,null,e)},this.contributors=function(e,t){t=t||1e3;var s=this;n("GET",o+"/stats/contributors",null,function(n,o,i){return n?e(n):void(202===i.status?setTimeout(function(){s.contributors(e,t)},t):e(n,o,i))})},this.contents=function(e,t,s){t=encodeURI(t),n("GET",o+"/contents"+(t?"/"+t:""),{ref:e},s)},this.fork=function(e){n("POST",o+"/forks",null,e)},this.listForks=function(e){n("GET",o+"/forks",null,e)},this.branch=function(e,t,n){2===arguments.length&&"function"==typeof arguments[1]&&(n=t,t=e,e="master"),this.getRef("heads/"+e,function(e,o){return e&&n?n(e):void c.createRef({ref:"refs/heads/"+t,sha:o},n)})},this.createPullRequest=function(e,t){n("POST",o+"/pulls",e,t)},this.listHooks=function(e){n("GET",o+"/hooks",null,e)},this.getHook=function(e,t){n("GET",o+"/hooks/"+e,null,t)},this.createHook=function(e,t){n("POST",o+"/hooks",e,t)},this.editHook=function(e,t,s){n("PATCH",o+"/hooks/"+e,t,s)},this.deleteHook=function(e,t){n("DELETE",o+"/hooks/"+e,null,t)},this.read=function(e,t,s){n("GET",o+"/contents/"+encodeURI(t)+(e?"?ref="+e:""),null,s,!0)},this.remove=function(e,t,s){c.getSha(e,t,function(i,u){return i?s(i):void n("DELETE",o+"/contents/"+t,{message:t+" is removed",sha:u,branch:e},s)})},this["delete"]=this.remove,this.move=function(e,n,o,s){t(e,function(t,i){c.getTree(i+"?recursive=true",function(t,u){u.forEach(function(e){e.path===n&&(e.path=o),"tree"===e.type&&delete e.sha}),c.postTree(u,function(t,o){c.commit(i,o,"Deleted "+n,function(t,n){c.updateHead(e,n,s)})})})})},this.write=function(e,t,i,u,r,a){"function"==typeof r&&(a=r,r={}),c.getSha(e,encodeURI(t),function(c,l){var f={message:u,content:"undefined"==typeof r.encode||r.encode?s(i):i,branch:e,committer:r&&r.committer?r.committer:void 0,author:r&&r.author?r.author:void 0};c&&404!==c.error||(f.sha=l),n("PUT",o+"/contents/"+encodeURI(t),f,a)})},this.getCommits=function(e,t){e=e||{};var s=o+"/commits",i=[];if(e.sha&&i.push("sha="+encodeURIComponent(e.sha)),e.path&&i.push("path="+encodeURIComponent(e.path)),e.author&&i.push("author="+encodeURIComponent(e.author)),e.since){var u=e.since;u.constructor===Date&&(u=u.toISOString()),i.push("since="+encodeURIComponent(u))}if(e.until){var r=e.until;r.constructor===Date&&(r=r.toISOString()),i.push("until="+encodeURIComponent(r))}e.page&&i.push("page="+e.page),e.perpage&&i.push("per_page="+e.perpage),i.length>0&&(s+="?"+i.join("&")),n("GET",s,null,t)},this.isStarred=function(e,t,o){n("GET","/user/starred/"+e+"/"+t,null,o)},this.star=function(e,t,o){n("PUT","/user/starred/"+e+"/"+t,null,o)},this.unstar=function(e,t,o){n("DELETE","/user/starred/"+e+"/"+t,null,o)},this.createRelease=function(e,t){n("POST",o+"/releases",e,t)},this.editRelease=function(e,t,s){n("PATCH",o+"/releases/"+e,t,s)},this.getRelease=function(e,t){n("GET",o+"/releases/"+e,null,t)},this.deleteRelease=function(e,t){n("DELETE",o+"/releases/"+e,null,t)}},i.Gist=function(e){var t=e.id,o="/gists/"+t;this.read=function(e){n("GET",o,null,e)},this.create=function(e,t){n("POST","/gists",e,t)},this["delete"]=function(e){n("DELETE",o,null,e)},this.fork=function(e){n("POST",o+"/fork",null,e)},this.update=function(e,t){n("PATCH",o,e,t)},this.star=function(e){n("PUT",o+"/star",null,e)},this.unstar=function(e){n("DELETE",o+"/star",null,e)},this.isStarred=function(e){n("GET",o+"/star",null,e)}},i.Issue=function(e){var t="/repos/"+e.user+"/"+e.repo+"/issues";this.create=function(e,o){n("POST",t,e,o)},this.list=function(e,n){var o=[];for(var s in e)e.hasOwnProperty(s)&&o.push(encodeURIComponent(s)+"="+encodeURIComponent(e[s]));u(t+"?"+o.join("&"),n)},this.comment=function(e,t,o){n("POST",e.comments_url,{body:t},o)},this.edit=function(e,o,s){n("PATCH",t+"/"+e,o,s)},this.get=function(e,o){n("GET",t+"/"+e,null,o)}},i.Search=function(e){var t="/search/",o="?q="+e.query;this.repositories=function(e,s){n("GET",t+"repositories"+o,e,s)},this.code=function(e,s){n("GET",t+"code"+o,e,s)},this.issues=function(e,s){n("GET",t+"issues"+o,e,s)},this.users=function(e,s){n("GET",t+"users"+o,e,s)}},i.RateLimit=function(){this.getRateLimit=function(e){n("GET","/rate_limit",null,e)}},i};return i.getIssues=function(e,t){return new i.Issue({user:e,repo:t})},i.getRepo=function(e,t){return t?new i.Repository({user:e,name:t}):new i.Repository({fullname:e})},i.getUser=function(){return new i.User},i.getGist=function(e){return new i.Gist({id:e})},i.getSearch=function(e){return new i.Search({query:e})},i.getRateLimit=function(){return new i.RateLimit},i}); -//# sourceMappingURL=github.min.js.map diff --git a/dist/github.min.js.map b/dist/github.min.js.map deleted file mode 100644 index 920d463b..00000000 --- a/dist/github.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["github.min.js"],"names":["root","factory","define","amd","Promise","Base64","Utf8","axios","Github","module","exports","require","base64","utf8","this","b64encode","string","encode","polyfill","options","API_URL","apiUrl","_request","method","path","data","cb","raw","getURL","url","indexOf","test","param","hasOwnProperty","encodeURIComponent","replace","window","Date","getTime","config","headers","Accept","Content-Type","username","password","Authorization","token","then","response","request","status","error","_requestAllPages","results","iterate","err","res","xhr","Array","push","apply","next","getResponseHeader","split","filter","link","map","exec","pop","User","repos","params","type","sort","per_page","page","join","orgs","gists","notifications","all","participating","since","constructor","toISOString","before","length","show","command","userRepos","userStarred","userGists","orgRepos","orgname","follow","unfollow","createRepo","Repository","updateTree","branch","currentTree","sha","that","getRef","repoPath","repo","name","user","fullname","ref","object","createRef","deleteRef","deleteRepo","listTags","listPulls","state","head","base","direction","getPull","number","compare","listBranches","heads","getBlob","getCommit","getSha","pathContent","getStatuses","getTree","tree","postBlob","content","encoding","baseTree","blob","base_tree","mode","postTree","commit","parent","message","userData","author","email","parents","updateHead","contributors","retry","setTimeout","contents","encodeURI","fork","listForks","oldBranch","newBranch","arguments","createPullRequest","listHooks","getHook","id","createHook","editHook","deleteHook","read","remove","move","newPath","latestCommit","forEach","rootTree","write","writeOptions","committer","undefined","getCommits","until","perpage","isStarred","owner","repository","star","unstar","createRelease","editRelease","getRelease","deleteRelease","Gist","gistPath","create","update","Issue","list","query","key","comment","issue","comments_url","body","edit","get","Search","repositories","code","issues","users","RateLimit","getRateLimit","getIssues","getRepo","getUser","getGist","getSearch"],"mappings":"AAWA,cAEC,SAAUA,EAAMC,GAEQ,kBAAXC,SAAyBA,OAAOC,IACxCD,QAEM,cACA,UACA,OACA,SAEH,SAAUE,EAASC,EAAQC,EAAMC,GAC9B,MAAQP,GAAKQ,OAASP,EAAQG,EA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SAAUnD,GACxB,MAAO,IAAIzJ,GAAOoL,MACf3B,GAAIA,KAIVzJ,EAAO6M,UAAY,SAAUnB,GAC1B,MAAO,IAAI1L,GAAOkM,QACfR,MAAOA,KAIb1L,EAAOwM,aAAe,WACnB,MAAO,IAAIxM,GAAOuM,WAGdvM","file":"github.min.js","sourcesContent":["/*!\r\n * @overview Github.js\r\n *\r\n * @copyright (c) 2013 Michael Aufreiter, Development Seed\r\n * Github.js is freely distributable.\r\n *\r\n * @license Licensed under BSD-3-Clause-Clear\r\n *\r\n * For all details and documentation:\r\n * http://substance.io/michael/github\r\n */\r\n'use strict';\r\n\r\n(function (root, factory) {\r\n /* istanbul ignore next */\r\n if (typeof define === 'function' && define.amd) {\r\n define(\r\n [\r\n 'es6-promise',\r\n 'base-64',\r\n 'utf8',\r\n 'axios'\r\n ],\r\n function (Promise, Base64, Utf8, axios) {\r\n return (root.Github = factory(Promise, Base64, Utf8, axios));\r\n }\r\n );\r\n } else if (typeof module === 'object' && module.exports) {\r\n module.exports = factory(require('es6-promise'), require('base-64'), require('utf8'), require('axios'));\r\n } else {\r\n root.Github = factory(root.Promise, root.base64, root.utf8, root.axios);\r\n }\r\n}(this, function(Promise, Base64, Utf8, axios) { // jshint ignore:line\r\n function b64encode(string) {\r\n return Base64.encode(Utf8.encode(string));\r\n }\r\n\r\n if (Promise.polyfill) {\r\n Promise.polyfill();\r\n }\r\n\r\n // Initial Setup\r\n // -------------\r\n\r\n var Github = function (options) {\r\n options = options || {};\r\n\r\n var API_URL = options.apiUrl || 'https://api.github.com';\r\n\r\n // HTTP Request Abstraction\r\n // =======\r\n //\r\n // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec.\r\n\r\n var _request = Github._request = function _request(method, path, data, cb, raw) {\r\n function getURL() {\r\n var url = path.indexOf('//') >= 0 ? path : API_URL + path;\r\n\r\n url += ((/\\?/).test(url) ? '&' : '?');\r\n\r\n if (data && typeof data === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) {\r\n for(var param in data) {\r\n if (data.hasOwnProperty(param)) {\r\n url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]);\r\n }\r\n }\r\n }\r\n\r\n return url.replace(/(×tamp=\\d+)/, '') +\r\n (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : '');\r\n }\r\n\r\n var config = {\r\n headers: {\r\n Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json',\r\n 'Content-Type': 'application/json;charset=UTF-8'\r\n },\r\n method: method,\r\n data: data ? data : {},\r\n url: getURL()\r\n };\r\n\r\n if ((options.token) || (options.username && options.password)) {\r\n config.headers.Authorization = options.token ?\r\n 'token ' + options.token :\r\n 'Basic ' + b64encode(options.username + ':' + options.password);\r\n }\r\n\r\n return axios(config)\r\n .then(function (response) {\r\n cb(\r\n null,\r\n response.data || true,\r\n response.request\r\n );\r\n }, function (response) {\r\n if (response.status === 304) {\r\n cb(\r\n null,\r\n response.data || true,\r\n response.request\r\n );\r\n } else {\r\n cb({\r\n path: path,\r\n request: response.request,\r\n error: response.status\r\n });\r\n }\r\n });\r\n };\r\n\r\n var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, cb) {\r\n var results = [];\r\n\r\n (function iterate() {\r\n _request('GET', path, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n if (!(res instanceof Array)) {\r\n res = [res];\r\n }\r\n\r\n results.push.apply(results, res);\r\n\r\n var next = (xhr.getResponseHeader('link') || '')\r\n .split(',')\r\n .filter(function(link) {\r\n return /rel=\"next\"/.test(link);\r\n })\r\n .map(function(link) {\r\n return (/<(.*)>/.exec(link) || [])[1];\r\n })\r\n .pop();\r\n\r\n if (!next) {\r\n cb(err, results, xhr);\r\n } else {\r\n path = next;\r\n iterate();\r\n }\r\n });\r\n })();\r\n };\r\n\r\n // User API\r\n // =======\r\n\r\n Github.User = function () {\r\n this.repos = function (options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n options = options || {};\r\n\r\n var url = '/user/repos';\r\n var params = [];\r\n\r\n params.push('type=' + encodeURIComponent(options.type || 'all'));\r\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\r\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n url += '?' + params.join('&');\r\n\r\n _requestAllPages(url, cb);\r\n };\r\n\r\n // List user organizations\r\n // -------\r\n\r\n this.orgs = function (cb) {\r\n _request('GET', '/user/orgs', null, cb);\r\n };\r\n\r\n // List authenticated user's gists\r\n // -------\r\n\r\n this.gists = function (cb) {\r\n _request('GET', '/gists', null, cb);\r\n };\r\n\r\n // List authenticated user's unread notifications\r\n // -------\r\n\r\n this.notifications = function (options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n options = options || {};\r\n var url = '/notifications';\r\n var params = [];\r\n\r\n if (options.all) {\r\n params.push('all=true');\r\n }\r\n\r\n if (options.participating) {\r\n params.push('participating=true');\r\n }\r\n\r\n if (options.since) {\r\n var since = options.since;\r\n\r\n if (since.constructor === Date) {\r\n since = since.toISOString();\r\n }\r\n\r\n params.push('since=' + encodeURIComponent(since));\r\n }\r\n\r\n if (options.before) {\r\n var before = options.before;\r\n\r\n if (before.constructor === Date) {\r\n before = before.toISOString();\r\n }\r\n\r\n params.push('before=' + encodeURIComponent(before));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Show user information\r\n // -------\r\n\r\n this.show = function (username, cb) {\r\n var command = username ? '/users/' + username : '/user';\r\n\r\n _request('GET', command, null, cb);\r\n };\r\n\r\n // List user repositories\r\n // -------\r\n\r\n this.userRepos = function (username, options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n var url = '/users/' + username + '/repos';\r\n var params = [];\r\n\r\n params.push('type=' + encodeURIComponent(options.type || 'all'));\r\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\r\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\r\n\r\n if (options.page) {\r\n params.push('page=' + encodeURIComponent(options.page));\r\n }\r\n\r\n url += '?' + params.join('&');\r\n\r\n _requestAllPages(url, cb);\r\n };\r\n\r\n // List user starred repositories\r\n // -------\r\n\r\n this.userStarred = function (username, cb) {\r\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\r\n _requestAllPages('/users/' + username + '/starred?type=all&per_page=100', cb);\r\n };\r\n\r\n // List a user's gists\r\n // -------\r\n\r\n this.userGists = function (username, cb) {\r\n _request('GET', '/users/' + username + '/gists', null, cb);\r\n };\r\n\r\n // List organization repositories\r\n // -------\r\n\r\n this.orgRepos = function (orgname, cb) {\r\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\r\n _requestAllPages('/orgs/' + orgname + '/repos?type=all&&page_num=1000&sort=updated&direction=desc', cb);\r\n };\r\n\r\n // Follow user\r\n // -------\r\n\r\n this.follow = function (username, cb) {\r\n _request('PUT', '/user/following/' + username, null, cb);\r\n };\r\n\r\n // Unfollow user\r\n // -------\r\n\r\n this.unfollow = function (username, cb) {\r\n _request('DELETE', '/user/following/' + username, null, cb);\r\n };\r\n\r\n // Create a repo\r\n // -------\r\n this.createRepo = function (options, cb) {\r\n _request('POST', '/user/repos', options, cb);\r\n };\r\n };\r\n\r\n // Repository API\r\n // =======\r\n\r\n Github.Repository = function (options) {\r\n var repo = options.name;\r\n var user = options.user;\r\n var fullname = options.fullname;\r\n\r\n var that = this;\r\n var repoPath;\r\n\r\n if (fullname) {\r\n repoPath = '/repos/' + fullname;\r\n } else {\r\n repoPath = '/repos/' + user + '/' + repo;\r\n }\r\n\r\n var currentTree = {\r\n branch: null,\r\n sha: null\r\n };\r\n\r\n // Uses the cache if branch has not been changed\r\n // -------\r\n\r\n function updateTree(branch, cb) {\r\n if (branch === currentTree.branch && currentTree.sha) {\r\n return cb(null, currentTree.sha);\r\n }\r\n\r\n that.getRef('heads/' + branch, function (err, sha) {\r\n currentTree.branch = branch;\r\n currentTree.sha = sha;\r\n cb(err, sha);\r\n });\r\n }\r\n\r\n // Get a particular reference\r\n // -------\r\n\r\n this.getRef = function (ref, cb) {\r\n _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.object.sha, xhr);\r\n });\r\n };\r\n\r\n // Create a new reference\r\n // --------\r\n //\r\n // {\r\n // \"ref\": \"refs/heads/my-new-branch-name\",\r\n // \"sha\": \"827efc6d56897b048c772eb4087f854f46256132\"\r\n // }\r\n\r\n this.createRef = function (options, cb) {\r\n _request('POST', repoPath + '/git/refs', options, cb);\r\n };\r\n\r\n // Delete a reference\r\n // --------\r\n //\r\n // Repo.deleteRef('heads/gh-pages')\r\n // repo.deleteRef('tags/v1.0')\r\n\r\n this.deleteRef = function (ref, cb) {\r\n _request('DELETE', repoPath + '/git/refs/' + ref, options, cb);\r\n };\r\n\r\n // Delete a repo\r\n // --------\r\n\r\n this.deleteRepo = function (cb) {\r\n _request('DELETE', repoPath, options, cb);\r\n };\r\n\r\n // List all tags of a repository\r\n // -------\r\n\r\n this.listTags = function (cb) {\r\n _request('GET', repoPath + '/tags', null, cb);\r\n };\r\n\r\n // List all pull requests of a respository\r\n // -------\r\n\r\n this.listPulls = function (options, cb) {\r\n options = options || {};\r\n var url = repoPath + '/pulls';\r\n var params = [];\r\n\r\n if (typeof options === 'string') {\r\n // Backward compatibility\r\n params.push('state=' + options);\r\n } else {\r\n if (options.state) {\r\n params.push('state=' + encodeURIComponent(options.state));\r\n }\r\n\r\n if (options.head) {\r\n params.push('head=' + encodeURIComponent(options.head));\r\n }\r\n\r\n if (options.base) {\r\n params.push('base=' + encodeURIComponent(options.base));\r\n }\r\n\r\n if (options.sort) {\r\n params.push('sort=' + encodeURIComponent(options.sort));\r\n }\r\n\r\n if (options.direction) {\r\n params.push('direction=' + encodeURIComponent(options.direction));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + options.page);\r\n }\r\n\r\n if (options.per_page) {\r\n params.push('per_page=' + options.per_page);\r\n }\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Gets details for a specific pull request\r\n // -------\r\n\r\n this.getPull = function (number, cb) {\r\n _request('GET', repoPath + '/pulls/' + number, null, cb);\r\n };\r\n\r\n // Retrieve the changes made between base and head\r\n // -------\r\n\r\n this.compare = function (base, head, cb) {\r\n _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb);\r\n };\r\n\r\n // List all branches of a repository\r\n // -------\r\n\r\n this.listBranches = function (cb) {\r\n _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n heads = heads.map(function (head) {\r\n return head.ref.replace(/^refs\\/heads\\//, '');\r\n });\r\n\r\n cb(null, heads, xhr);\r\n });\r\n };\r\n\r\n // Retrieve the contents of a blob\r\n // -------\r\n\r\n this.getBlob = function (sha, cb) {\r\n _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw');\r\n };\r\n\r\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\r\n // -------\r\n\r\n this.getCommit = function (branch, sha, cb) {\r\n _request('GET', repoPath + '/git/commits/' + sha, null, cb);\r\n };\r\n\r\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\r\n // -------\r\n\r\n this.getSha = function (branch, path, cb) {\r\n if (!path || path === '') {\r\n return that.getRef('heads/' + branch, cb);\r\n }\r\n\r\n _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''),\r\n null, function (err, pathContent, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, pathContent.sha, xhr);\r\n });\r\n };\r\n\r\n // Get the statuses for a particular SHA\r\n // -------\r\n\r\n this.getStatuses = function (sha, cb) {\r\n _request('GET', repoPath + '/statuses/' + sha, null, cb);\r\n };\r\n\r\n // Retrieve the tree a commit points to\r\n // -------\r\n\r\n this.getTree = function (tree, cb) {\r\n _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.tree, xhr);\r\n });\r\n };\r\n\r\n // Post a new blob object, getting a blob SHA back\r\n // -------\r\n\r\n this.postBlob = function (content, cb) {\r\n if (typeof content === 'string') {\r\n content = {\r\n content: content,\r\n encoding: 'utf-8'\r\n };\r\n } else {\r\n content = {\r\n content: b64encode(content),\r\n encoding: 'base64'\r\n };\r\n }\r\n\r\n _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Update an existing tree adding a new blob object getting a tree SHA back\r\n // -------\r\n\r\n this.updateTree = function (baseTree, path, blob, cb) {\r\n var data = {\r\n base_tree: baseTree,\r\n tree: [\r\n {\r\n path: path,\r\n mode: '100644',\r\n type: 'blob',\r\n sha: blob\r\n }\r\n ]\r\n };\r\n\r\n _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Post a new tree object having a file path pointer replaced\r\n // with a new blob SHA getting a tree SHA back\r\n // -------\r\n\r\n this.postTree = function (tree, cb) {\r\n _request('POST', repoPath + '/git/trees', {\r\n tree: tree\r\n }, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n };\r\n\r\n // Create a new commit object with the current commit SHA as the parent\r\n // and the new tree SHA, getting a commit SHA back\r\n // -------\r\n\r\n this.commit = function (parent, tree, message, cb) {\r\n var user = new Github.User();\r\n\r\n user.show(null, function (err, userData) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n var data = {\r\n message: message,\r\n author: {\r\n name: options.user,\r\n email: userData.email\r\n },\r\n parents: [\r\n parent\r\n ],\r\n tree: tree\r\n };\r\n\r\n _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n currentTree.sha = res.sha; // Update latest commit\r\n\r\n cb(null, res.sha, xhr);\r\n });\r\n });\r\n };\r\n\r\n // Update the reference of your head to point to the new commit SHA\r\n // -------\r\n\r\n this.updateHead = function (head, commit, cb) {\r\n _request('PATCH', repoPath + '/git/refs/heads/' + head, {\r\n sha: commit\r\n }, cb);\r\n };\r\n\r\n // Show repository information\r\n // -------\r\n\r\n this.show = function (cb) {\r\n _request('GET', repoPath, null, cb);\r\n };\r\n\r\n // Show repository contributors\r\n // -------\r\n\r\n this.contributors = function (cb, retry) {\r\n retry = retry || 1000;\r\n var that = this;\r\n\r\n _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n if (xhr.status === 202) {\r\n setTimeout(\r\n function () {\r\n that.contributors(cb, retry);\r\n },\r\n retry\r\n );\r\n } else {\r\n cb(err, data, xhr);\r\n }\r\n });\r\n };\r\n\r\n // Get contents\r\n // --------\r\n\r\n this.contents = function (ref, path, cb) {\r\n path = encodeURI(path);\r\n _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), {\r\n ref: ref\r\n }, cb);\r\n };\r\n\r\n // Fork repository\r\n // -------\r\n\r\n this.fork = function (cb) {\r\n _request('POST', repoPath + '/forks', null, cb);\r\n };\r\n\r\n // List forks\r\n // --------\r\n\r\n this.listForks = function (cb) {\r\n _request('GET', repoPath + '/forks', null, cb);\r\n };\r\n\r\n // Branch repository\r\n // --------\r\n\r\n this.branch = function (oldBranch, newBranch, cb) {\r\n if (arguments.length === 2 && typeof arguments[1] === 'function') {\r\n cb = newBranch;\r\n newBranch = oldBranch;\r\n oldBranch = 'master';\r\n }\r\n\r\n this.getRef('heads/' + oldBranch, function (err, ref) {\r\n if (err && cb) {\r\n return cb(err);\r\n }\r\n\r\n that.createRef({\r\n ref: 'refs/heads/' + newBranch,\r\n sha: ref\r\n }, cb);\r\n });\r\n };\r\n\r\n // Create pull request\r\n // --------\r\n\r\n this.createPullRequest = function (options, cb) {\r\n _request('POST', repoPath + '/pulls', options, cb);\r\n };\r\n\r\n // List hooks\r\n // --------\r\n\r\n this.listHooks = function (cb) {\r\n _request('GET', repoPath + '/hooks', null, cb);\r\n };\r\n\r\n // Get a hook\r\n // --------\r\n\r\n this.getHook = function (id, cb) {\r\n _request('GET', repoPath + '/hooks/' + id, null, cb);\r\n };\r\n\r\n // Create a hook\r\n // --------\r\n\r\n this.createHook = function (options, cb) {\r\n _request('POST', repoPath + '/hooks', options, cb);\r\n };\r\n\r\n // Edit a hook\r\n // --------\r\n\r\n this.editHook = function (id, options, cb) {\r\n _request('PATCH', repoPath + '/hooks/' + id, options, cb);\r\n };\r\n\r\n // Delete a hook\r\n // --------\r\n\r\n this.deleteHook = function (id, cb) {\r\n _request('DELETE', repoPath + '/hooks/' + id, null, cb);\r\n };\r\n\r\n // Read file at given path\r\n // -------\r\n\r\n this.read = function (branch, path, cb) {\r\n _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''),\r\n null, cb, true);\r\n };\r\n\r\n // Remove a file\r\n // -------\r\n\r\n this.remove = function (branch, path, cb) {\r\n that.getSha(branch, path, function (err, sha) {\r\n if (err) {\r\n return cb(err);\r\n }\r\n\r\n _request('DELETE', repoPath + '/contents/' + path, {\r\n message: path + ' is removed',\r\n sha: sha,\r\n branch: branch\r\n }, cb);\r\n });\r\n };\r\n\r\n // Alias for repo.remove for backwards comapt.\r\n // -------\r\n this.delete = this.remove;\r\n\r\n // Move a file to a new location\r\n // -------\r\n\r\n this.move = function (branch, path, newPath, cb) {\r\n updateTree(branch, function (err, latestCommit) {\r\n that.getTree(latestCommit + '?recursive=true', function (err, tree) {\r\n // Update Tree\r\n tree.forEach(function (ref) {\r\n if (ref.path === path) {\r\n ref.path = newPath;\r\n }\r\n\r\n if (ref.type === 'tree') {\r\n delete ref.sha;\r\n }\r\n });\r\n\r\n that.postTree(tree, function (err, rootTree) {\r\n that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) {\r\n that.updateHead(branch, commit, cb);\r\n });\r\n });\r\n });\r\n });\r\n };\r\n\r\n // Write file contents to a given branch and path\r\n // -------\r\n\r\n this.write = function (branch, path, content, message, options, cb) {\r\n if (typeof options === 'function') {\r\n cb = options;\r\n options = {};\r\n }\r\n\r\n that.getSha(branch, encodeURI(path), function (err, sha) {\r\n var writeOptions = {\r\n message: message,\r\n content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content,\r\n branch: branch,\r\n committer: options && options.committer ? options.committer : undefined,\r\n author: options && options.author ? options.author : undefined\r\n };\r\n\r\n // If no error, we set the sha to overwrite an existing file\r\n if (!(err && err.error !== 404)) {\r\n writeOptions.sha = sha;\r\n }\r\n\r\n _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb);\r\n });\r\n };\r\n\r\n // List commits on a repository. Takes an object of optional parameters:\r\n // sha: SHA or branch to start listing commits from\r\n // path: Only commits containing this file path will be returned\r\n // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address\r\n // since: ISO 8601 date - only commits after this date will be returned\r\n // until: ISO 8601 date - only commits before this date will be returned\r\n // -------\r\n\r\n this.getCommits = function (options, cb) {\r\n options = options || {};\r\n var url = repoPath + '/commits';\r\n var params = [];\r\n\r\n if (options.sha) {\r\n params.push('sha=' + encodeURIComponent(options.sha));\r\n }\r\n\r\n if (options.path) {\r\n params.push('path=' + encodeURIComponent(options.path));\r\n }\r\n\r\n if (options.author) {\r\n params.push('author=' + encodeURIComponent(options.author));\r\n }\r\n\r\n if (options.since) {\r\n var since = options.since;\r\n\r\n if (since.constructor === Date) {\r\n since = since.toISOString();\r\n }\r\n\r\n params.push('since=' + encodeURIComponent(since));\r\n }\r\n\r\n if (options.until) {\r\n var until = options.until;\r\n\r\n if (until.constructor === Date) {\r\n until = until.toISOString();\r\n }\r\n\r\n params.push('until=' + encodeURIComponent(until));\r\n }\r\n\r\n if (options.page) {\r\n params.push('page=' + options.page);\r\n }\r\n\r\n if (options.perpage) {\r\n params.push('per_page=' + options.perpage);\r\n }\r\n\r\n if (params.length > 0) {\r\n url += '?' + params.join('&');\r\n }\r\n\r\n _request('GET', url, null, cb);\r\n };\r\n\r\n // Check if a repository is starred.\r\n // --------\r\n\r\n this.isStarred = function(owner, repository, cb) {\r\n _request('GET', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Star a repository.\r\n // --------\r\n\r\n this.star = function(owner, repository, cb) {\r\n _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Unstar a repository.\r\n // --------\r\n\r\n this.unstar = function(owner, repository, cb) {\r\n _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb);\r\n };\r\n\r\n // Create a new release\r\n // --------\r\n\r\n this.createRelease = function(options, cb) {\r\n _request('POST', repoPath + '/releases', options, cb);\r\n };\r\n\r\n // Edit a release\r\n // --------\r\n\r\n this.editRelease = function(id, options, cb) {\r\n _request('PATCH', repoPath + '/releases/' + id, options, cb);\r\n };\r\n\r\n // Get a single release\r\n // --------\r\n\r\n this.getRelease = function(id, cb) {\r\n _request('GET', repoPath + '/releases/' + id, null, cb);\r\n };\r\n\r\n // Remove a release\r\n // --------\r\n\r\n this.deleteRelease = function(id, cb) {\r\n _request('DELETE', repoPath + '/releases/' + id, null, cb);\r\n };\r\n };\r\n\r\n // Gists API\r\n // =======\r\n\r\n Github.Gist = function (options) {\r\n var id = options.id;\r\n var gistPath = '/gists/' + id;\r\n\r\n // Read the gist\r\n // --------\r\n\r\n this.read = function (cb) {\r\n _request('GET', gistPath, null, cb);\r\n };\r\n\r\n // Create the gist\r\n // --------\r\n // {\r\n // \"description\": \"the description for this gist\",\r\n // \"public\": true,\r\n // \"files\": {\r\n // \"file1.txt\": {\r\n // \"content\": \"String file contents\"\r\n // }\r\n // }\r\n // }\r\n\r\n this.create = function (options, cb) {\r\n _request('POST', '/gists', options, cb);\r\n };\r\n\r\n // Delete the gist\r\n // --------\r\n\r\n this.delete = function (cb) {\r\n _request('DELETE', gistPath, null, cb);\r\n };\r\n\r\n // Fork a gist\r\n // --------\r\n\r\n this.fork = function (cb) {\r\n _request('POST', gistPath + '/fork', null, cb);\r\n };\r\n\r\n // Update a gist with the new stuff\r\n // --------\r\n\r\n this.update = function (options, cb) {\r\n _request('PATCH', gistPath, options, cb);\r\n };\r\n\r\n // Star a gist\r\n // --------\r\n\r\n this.star = function (cb) {\r\n _request('PUT', gistPath + '/star', null, cb);\r\n };\r\n\r\n // Untar a gist\r\n // --------\r\n\r\n this.unstar = function (cb) {\r\n _request('DELETE', gistPath + '/star', null, cb);\r\n };\r\n\r\n // Check if a gist is starred\r\n // --------\r\n\r\n this.isStarred = function (cb) {\r\n _request('GET', gistPath + '/star', null, cb);\r\n };\r\n };\r\n\r\n // Issues API\r\n // ==========\r\n\r\n Github.Issue = function (options) {\r\n var path = '/repos/' + options.user + '/' + options.repo + '/issues';\r\n\r\n this.create = function(options, cb) {\r\n _request('POST', path, options, cb);\r\n };\r\n\r\n this.list = function (options, cb) {\r\n var query = [];\r\n\r\n for(var key in options) {\r\n if (options.hasOwnProperty(key)) {\r\n query.push(encodeURIComponent(key) + '=' + encodeURIComponent(options[key]));\r\n }\r\n }\r\n\r\n _requestAllPages(path + '?' + query.join('&'), cb);\r\n };\r\n\r\n this.comment = function (issue, comment, cb) {\r\n _request('POST', issue.comments_url, {\r\n body: comment\r\n }, cb);\r\n };\r\n\r\n this.edit = function (issue, options, cb) {\r\n _request('PATCH', path + '/' + issue, options, cb);\r\n };\r\n\r\n this.get = function (issue, cb) {\r\n _request('GET', path + '/' + issue, null, cb);\r\n };\r\n };\r\n\r\n // Search API\r\n // ==========\r\n\r\n Github.Search = function (options) {\r\n var path = '/search/';\r\n var query = '?q=' + options.query;\r\n\r\n this.repositories = function (options, cb) {\r\n _request('GET', path + 'repositories' + query, options, cb);\r\n };\r\n\r\n this.code = function (options, cb) {\r\n _request('GET', path + 'code' + query, options, cb);\r\n };\r\n\r\n this.issues = function (options, cb) {\r\n _request('GET', path + 'issues' + query, options, cb);\r\n };\r\n\r\n this.users = function (options, cb) {\r\n _request('GET', path + 'users' + query, options, cb);\r\n };\r\n };\r\n\r\n // Rate Limit API\r\n // ==========\r\n\r\n Github.RateLimit = function() {\r\n this.getRateLimit = function(cb) {\r\n _request('GET', '/rate_limit', null, cb);\r\n };\r\n };\r\n\r\n return Github;\r\n };\r\n\r\n // Top Level API\r\n // -------\r\n\r\n Github.getIssues = function (user, repo) {\r\n return new Github.Issue({\r\n user: user,\r\n repo: repo\r\n });\r\n };\r\n\r\n Github.getRepo = function (user, repo) {\r\n if (!repo) {\r\n return new Github.Repository({\r\n fullname: user\r\n });\r\n } else {\r\n return new Github.Repository({\r\n user: user,\r\n name: repo\r\n });\r\n }\r\n };\r\n\r\n Github.getUser = function () {\r\n return new Github.User();\r\n };\r\n\r\n Github.getGist = function (id) {\r\n return new Github.Gist({\r\n id: id\r\n });\r\n };\r\n\r\n Github.getSearch = function (query) {\r\n return new Github.Search({\r\n query: query\r\n });\r\n };\r\n\r\n Github.getRateLimit = function() {\r\n return new Github.RateLimit();\r\n };\r\n\r\n return Github;\r\n}));\r\n"],"sourceRoot":"/source/"} \ No newline at end of file From fdaa29cbf4d07579d73293093b071b87cbc7971d Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Wed, 2 Mar 2016 17:13:53 -0600 Subject: [PATCH 3/8] Restructure tests to run in mocha --- .travis.yml | 10 +- gulpfile.js | 34 +- package.json | 4 +- src/github.js | 8 +- test/{ => fixtures}/gh.png | Bin test/fixtures/gist.json | 9 + test/fixtures/imageBlob.js | 55 +++ test/{ => fixtures}/user.json | 0 test/helpers.js | 49 ++ test/test.auth.js | 95 ++-- test/test.gist.js | 121 ++--- test/test.issue.js | 98 ++-- test/test.rate-limit.js | 28 +- test/test.repo.js | 896 ++++++++++++++-------------------- test/test.search.js | 43 +- test/test.user.js | 149 ++---- 16 files changed, 739 insertions(+), 860 deletions(-) rename test/{ => fixtures}/gh.png (100%) create mode 100644 test/fixtures/gist.json create mode 100644 test/fixtures/imageBlob.js rename test/{ => fixtures}/user.json (100%) create mode 100644 test/helpers.js diff --git a/.travis.yml b/.travis.yml index 88181684..ed70c5c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,9 @@ language: node_js sudo: false node_js: - - "4.1" - - "4.0" + - "5.7" + - "4.3" - "0.12" - - "0.11" - "0.10" cache: @@ -18,6 +17,5 @@ before_install: script: - gulp lint - - gulp test:ci - - mocha test/ - - npm run-script codecov + - gulp test:mocha + # - zuul -- some tests diff --git a/gulpfile.js b/gulpfile.js index 4da37a2b..5680bb3f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,19 +1,22 @@ 'use strict'; var gulp = require('gulp'); -var jshint = require('gulp-jshint'); + +var babel = require('gulp-babel'); var jscs = require('gulp-jscs'); +var jshint = require('gulp-jshint'); +var mocha = require('gulp-mocha'); var rename = require('gulp-rename'); +var stylish = require('gulp-jscs-stylish'); + var browserify = require('browserify'); -var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); -var uglify = require('gulp-uglify'); -var sourcemaps = require('gulp-sourcemaps'); var del = require('del'); -var stylish = require('gulp-jscs-stylish'); var path = require('path'); var karma = require('karma'); -var babel = require('gulp-babel'); +var source = require('vinyl-source-stream'); +var sourcemaps = require('gulp-sourcemaps'); +var uglify = require('gulp-uglify'); function runTests(singleRun, isCI, done) { var reporters = ['mocha']; @@ -92,17 +95,24 @@ gulp.task('lint', function() { .pipe(gulp.dest('.')); }); -gulp.task('test', function(done) { - runTests(true, false, done); +gulp.task('test:mocha', function() { + var srcOpts = { + read: false + }; + var mochaOpts = { + timeout: 30000, + slow: 5000 + }; + + return gulp.src('test/test.*.js', srcOpts) + .pipe(mocha(mochaOpts)) + ; }); -gulp.task('test:ci', function(done) { +gulp.task('test:browser', function(done) { runTests(true, true, done); }); -gulp.task('test:auto', function(done) { - runTests(false, false, done); -}); gulp.task('clean', function () { return del('dist/*'); }); diff --git a/package.json b/package.json index f5fdb956..a9fa2e47 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "babelify": "^7.2.0", "browserify": "^13.0.0", "browserify-istanbul": "^0.2.1", - "chai": "^3.4.1", "codecov": "^1.0.1", "del": "^2.2.0", "gulp": "^3.9.0", @@ -23,6 +22,7 @@ "gulp-jscs": "^3.0.2", "gulp-jscs-stylish": "^1.3.0", "gulp-jshint": "^2.0.0", + "gulp-mocha": "^2.2.0", "gulp-rename": "^1.2.2", "gulp-sourcemaps": "^1.6.0", "gulp-uglify": "^1.5.1", @@ -31,7 +31,6 @@ "jshint-stylish": "^2.1.0", "karma": "^0.13.19", "karma-browserify": "^4.4.2", - "karma-chai": "^0.1.0", "karma-coverage": "^0.5.3", "karma-json-fixtures-preprocessor": "0.0.6", "karma-mocha": "^0.2.1", @@ -39,6 +38,7 @@ "karma-phantomjs-launcher": "^0.2.3", "karma-sauce-launcher": "^0.3.0", "mocha": "^2.3.4", + "must": "^0.13.1", "phantomjs": "^2.1.3", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0" diff --git a/src/github.js b/src/github.js index 915f9a00..54ed0d3e 100644 --- a/src/github.js +++ b/src/github.js @@ -76,19 +76,19 @@ var Promise = require('es6-promise'); cb( null, response.data || true, - response.request + response ); }, function (response) { if (response.status === 304) { cb( null, response.data || true, - response.request + response ); } else { cb({ path: path, - request: response.request, + request: response, error: response.status }); } @@ -110,7 +110,7 @@ var Promise = require('es6-promise'); results.push.apply(results, res); - var next = (xhr.getResponseHeader('link') || '') + var next = (xhr.headers.link || '') .split(',') .filter(function(link) { return /rel="next"/.test(link); diff --git a/test/gh.png b/test/fixtures/gh.png similarity index 100% rename from test/gh.png rename to test/fixtures/gh.png diff --git a/test/fixtures/gist.json b/test/fixtures/gist.json new file mode 100644 index 00000000..7a78e6e7 --- /dev/null +++ b/test/fixtures/gist.json @@ -0,0 +1,9 @@ +{ + "description": "This is a test gist", + "public": true, + "files": { + "README.md": { + "content": "Hello World" + } + } +} diff --git a/test/fixtures/imageBlob.js b/test/fixtures/imageBlob.js new file mode 100644 index 00000000..c8f295e4 --- /dev/null +++ b/test/fixtures/imageBlob.js @@ -0,0 +1,55 @@ +'use strict'; + +function loadImage(imageReady) { + if (typeof window === 'undefined') { // We're in NodeJS + loadInNode(imageReady); + } else { // We're in the browser + if (typeof window._phantom !== 'undefined') { + loadInPhantom(imageReady); + } else { + loadInRealBrowser(imageReady); + } + } +} + +function loadInNode(imageReady) { + var fs = require('fs'); + var path = require('path'); + + var imageBlob = fs.readFileSync(path.join(__dirname, 'gh.png')); // This is a Buffer(). + var imageB64 = imageBlob.toString('base64'); + + imageReady(imageB64, imageBlob); +} + +function loadInPhantom(imageReady) { + var xhr = new XMLHttpRequest(); + + xhr.responseType = 'blob'; + xhr.open('GET', 'base/test/fixtures/gh.png'); + xhr.onload = function() { + var reader = new FileReader(); + + reader.onloadend = function() { + var imageB64 = btoa(reader.result); + var imageBlob = reader.result; + + imageReady(imageB64, imageBlob); + }; + + reader.readAsBinaryString(xhr.response); + }; + + xhr.send(); +} + +function loadInRealBrowser(imageReady) { + // jscs:disable + var imageB64 = 'iVBORw0KGgoAAAANSUhEUgAAACsAAAAmCAAAAAB4qD3CAAABgElEQVQ4y9XUsUocURQGYN/pAyMWBhGtrEIMiFiooGuVIoYsSBAsRSQvYGFWC4uFhUBYsilXLERQsDA20YAguIbo5PQp3F3inVFTheSvZoavGO79z+mJP0/Pv2nPtlfLpfLq9tljNquO62S8mj1kmy/8nrHm/Xaz1930bt5n1+SzVmyrilItsod9ON0td1V59xR9hwV2HsMRsbfROLo4amzsRcQw5vO2CZPJEU5CM2cXYTCxg7CY2mwIVhK7AkNZYg9g4CqxVwNwkNg6zOTKMQP1xFZgKWeXoJLYdSjl7BysJ7YBIzk7Ap8TewLOE3oOTtIz6y/64bfQn55ZTIAPd2gNTOTurcbzp7z50v1y/Pq2Q7Wczca8vFjG6LvbMo92hiPL96xO+eYVPkVExMdONetFXZ+l+eP9cuV7RER8a9PZwrloTXv2tfv285ZOt4rnrTXlydxCu9sZmGrdN8eXC3ATERHXsHD5wC7ZL3HdsaX9R3bUzlb7YWvn/9ipf93+An8cHsx3W3WHAAAAAElFTkSuQmCC'; + var imageBlob = new Blob(); + // jscs:enable + + imageReady(imageB64, imageBlob); +} + +module.exports = loadImage; diff --git a/test/user.json b/test/fixtures/user.json similarity index 100% rename from test/user.json rename to test/fixtures/user.json diff --git a/test/helpers.js b/test/helpers.js new file mode 100644 index 00000000..d85f3f94 --- /dev/null +++ b/test/helpers.js @@ -0,0 +1,49 @@ +'use strict'; + +var expect = require('must'); +var STANDARD_DELAY = 200; // 200ms between nested calls to the API so things settle + +function assertSuccessful(done, cb) { + return function(err, res, xhr) { + try { + expect(err).not.to.exist(); + expect(res).to.exist(); + expect(xhr).to.be.an.object(); + + if (cb) { + setTimeout(function () { + cb(err, res, xhr); + }, STANDARD_DELAY); + } else { + done(); + } + } catch(e) { + done(e); + } + }; +} + +function assertFailure(done, cb) { + return function(err) { + try { + expect(err).to.exist(); + expect(err).to.have.ownProperty('path'); + expect(err.request).to.exist(); + + if (cb) { + setTimeout(function () { + cb(err); + }, STANDARD_DELAY); + } else { + done(); + } + } catch(e) { + done(e); + } + }; +} + +module.exports = { + assertSuccessful: assertSuccessful, + assertFailure: assertFailure +}; diff --git a/test/test.auth.js b/test/test.auth.js index 154a3cae..59c2e11d 100644 --- a/test/test.auth.js +++ b/test/test.auth.js @@ -1,59 +1,76 @@ 'use strict'; var Github = require('../src/github.js'); -var testUser = require('./user.json'); -var github, user; -describe('Github constructor', function() { - before(function() { - github = new Github({ - username: testUser.USERNAME, - password: testUser.PASSWORD, - auth: 'basic' +var expect = require('must'); +var testUser = require('./fixtures/user.json'); +var assertSuccessful = require('./helpers').assertSuccessful; +var assertFailure = require('./helpers').assertFailure; + +describe('Github', function() { + var github, user; + + describe('with authentication', function() { + before(function() { + github = new Github({ + username: testUser.USERNAME, + password: testUser.PASSWORD, + auth: 'basic' + }); + + user = github.getUser(); }); - user = github.getUser(); - }); + // 200ms between tests so that Github has a chance to settle + beforeEach(function(done) { + setTimeout(done, 200); + }); - it('should authenticate and return no errors', function(done) { - user.notifications(function(err) { - should.not.exist(err); - done(); + it('should authenticate and return no errors', function(done) { + user.notifications(assertSuccessful(done)); }); }); -}); -describe('Github constructor without authentication data', function() { - it('should read public information', function(done) { - var github = new Github(); - var gist = github.getGist('f1c0f84e53aa6b98ec03'); + describe('without authentication', function() { + before(function() { + github = new Github(); + }); - gist.read(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.should.be.an('object'); + // 200ms between tests so that Github has a chance to settle + beforeEach(function(done) { + setTimeout(done, 200); + }); - done(); + it('should read public information', function(done) { + var gist = github.getGist('f1c0f84e53aa6b98ec03'); + + gist.read(assertSuccessful(done)); }); }); -}); -describe('Github constructor (failing case)', function() { - before(function() { - github = new Github({ - username: testUser.USERNAME, - password: 'fake124', - auth: 'basic' + describe('with bad authentication', function() { + before(function() { + github = new Github({ + username: testUser.USERNAME, + password: 'fake124', + auth: 'basic' + }); + + user = github.getUser(); }); - user = github.getUser(); - }); + // 200ms between tests so that Github has a chance to settle + beforeEach(function(done) { + setTimeout(done, 200); + }); + + it('should fail authentication and return err', function(done) { + user.notifications(assertFailure(done, function(err) { + expect(err.error).to.be.equal(401, 'Return 401 status for bad auth'); + expect(err.request.data.message).to.equal('Bad credentials'); - it('should fail authentication and return err', function(done) { - user.notifications(function(err) { - err.error.should.equal(401, 'Return 401 status for bad auth'); - JSON.parse(err.request.responseText).message.should.equal('Bad credentials'); - done(); + done(); + })); }); }); -}); \ No newline at end of file +}); diff --git a/test/test.gist.js b/test/test.gist.js index a20f6724..2f8bc8a4 100644 --- a/test/test.gist.js +++ b/test/test.gist.js @@ -1,11 +1,14 @@ 'use strict'; var Github = require('../src/github.js'); -var testUser = require('./user.json'); -var github; + +var expect = require('must'); +var testUser = require('./fixtures/user.json'); +var testGist = require('./fixtures/gist.json'); +var assertSuccessful = require('./helpers').assertSuccessful; describe('Github.Gist', function() { - var gist; + var gist, gistId, github; before(function() { github = new Github({ @@ -13,92 +16,68 @@ describe('Github.Gist', function() { password: testUser.PASSWORD, auth: 'basic' }); - - gist = github.getGist('f1c0f84e53aa6b98ec03'); }); - it('should read gist', function(done) { - gist.read(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.should.have.property('description', 'This is a test gist'); - res.files['README.md'].should.have.property('content', 'Hello World'); - - done(); + describe('reading', function() { + before(function() { + gist = github.getGist('f1c0f84e53aa6b98ec03'); }); - }); - - it('should star', function(done) { - gist.star(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - gist.isStarred(function(err) { - should.not.exist(err); + it('should read a gist', function(done) { + gist.read(assertSuccessful(done, function(err, gist) { + expect(gist).to.have.own('description', testGist.description); + expect(gist.files).to.have.keys(Object.keys(testGist.files)); + expect(gist.files['README.md']).to.have.own('content', testGist.files['README.md'].content); done(); - }); + })); }); }); -}); -describe('Creating new Github.Gist', function() { - var gist; + describe('creating/modifiying', function() { + before(function() { + gist = github.getGist(); + }); - before(function() { - gist = github.getGist(); - }); + // 200ms between tests so that Github has a chance to settle + beforeEach(function(done) { + setTimeout(done, 200); + }); - it('should create gist', function(done) { - var gistData = { - description: 'This is a test gist', - public: true, - files: { - 'README.md': { - content: 'Hello World' - } - } - }; + it('should create gist', function(done) { + gist.create(testGist, assertSuccessful(done, function(err, gist) { + expect(gist).to.have.own('id'); + expect(gist).to.have.own('public', testGist.public); + expect(gist).to.have.own('description', testGist.description); + gistId = gist.id; - gist.create(gistData, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.should.have.property('description', gistData.description); - res.should.have.property('public', gistData.public); - res.should.have.property('id').to.be.a('string'); + done(); + })); + }); - done(); + it('should star a gist', function(done) { + gist = github.getGist(gistId); + gist.star(assertSuccessful(done, function() { + gist.isStarred(assertSuccessful(done, function(err, result) { + expect(result).to.be(true); + done(); + })); + })); }); }); -}); - -describe('deleting a Github.Gist', function() { - var gist; - - before(function(done) { - var gistData = { - description: 'This is a test gist', - public: true, - files: { - 'README.md': { - content: 'Hello World' - } - } - }; - github.getGist().create(gistData, function(err, res) { - gist = github.getGist(res.id); - - done(); + describe('deleting', function() { + before(function() { + gist = github.getGist(gistId); }); - }); - it('should delete gist', function(done) { - gist.delete(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + // 200ms between tests so that Github has a chance to settle + beforeEach(function(done) { + setTimeout(done, 200); + }); - done(); + it('should delete gist', function(done) { + gist.delete(assertSuccessful(done)); }); }); -}); \ No newline at end of file +}); diff --git a/test/test.issue.js b/test/test.issue.js index a4c6c1a9..1b8e8058 100644 --- a/test/test.issue.js +++ b/test/test.issue.js @@ -1,11 +1,13 @@ 'use strict'; var Github = require('../src/github.js'); -var testUser = require('./user.json'); -var github, issues; + +var expect = require('must'); +var testUser = require('./fixtures/user.json'); +var assertSuccessful = require('./helpers').assertSuccessful; describe('Github.Issue', function() { - var issue; + var github, remoteIssues, remoteIssue; before(function() { github = new Github({ @@ -14,65 +16,67 @@ describe('Github.Issue', function() { auth: 'basic' }); - issues = github.getIssues(testUser.USERNAME, 'TestRepo'); + remoteIssues = github.getIssues(testUser.USERNAME, 'TestRepo'); }); - it('should create issue', function(done) { - issues.create({ - title: 'New issue', - body: 'New issue body' - }, function(err, issue, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - should.exist(issue.url); - issue.title.should.equal('New issue'); - issue.body.should.equal('New issue body'); - - done(); - }); - }); + describe('reading', function() { + it('should list issues', function(done) { + remoteIssues.list({}, assertSuccessful(done, function(err, issues) { + expect(issues).to.be.an.array(); + remoteIssue = issues[0]; - it('should list issues', function(done) { - issues.list({}, function(err, issues, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - issues.should.have.length.above(0); + done(); + })); + }); - issue = issues[0]; + it('should get issue', function(done) { + remoteIssues.get(remoteIssue.number, assertSuccessful(done, function(err, issue) { + expect(issue).to.have.own('number', remoteIssue.number); - done(); + done(); + })); }); }); - it('should post issue comment', function(done) { - issues.comment(issue, 'Comment test', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.body.should.equal('Comment test'); + describe('creating/modifiying', function() { + // 200ms between tests so that Github has a chance to settle + beforeEach(function(done) { + setTimeout(done, 200); + }); + + it('should create issue', function(done) { + var issue = { + title: 'New issue', + body: 'New issue body' + }; + + remoteIssues.create(issue, assertSuccessful(done, function(err, issue) { + expect(issue).to.have.own('url'); + expect(issue).to.have.own('title', issue.title); + expect(issue).to.have.own('body', issue.body); - done(); + done(); + })); }); - }); - it('should edit issues title', function(done) { - issues.edit(issue.number, { - title: 'Edited title' - }, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.title.should.equal('Edited title'); + it('should post issue comment', function(done) { + remoteIssues.comment(remoteIssue, 'Comment test', assertSuccessful(done, function(err, issue) { + expect(issue).to.have.own('body', 'Comment test'); - done(); + done(); + })); }); - }); - it('should get issue', function(done) { - issues.get(issue.number, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.number.should.equal(issue.number); + it('should edit issues title', function(done) { + var newProps = { + title: 'Edited title' + }; + + remoteIssues.edit(remoteIssue.number, newProps, assertSuccessful(done, function(err, issue) { + expect(issue).to.have.own('title', newProps.title); - done(); + done(); + })); }); }); }); diff --git a/test/test.rate-limit.js b/test/test.rate-limit.js index ec4d0083..b3d85fb4 100644 --- a/test/test.rate-limit.js +++ b/test/test.rate-limit.js @@ -1,10 +1,14 @@ 'use strict'; var Github = require('../src/github.js'); -var testUser = require('./user.json'); -var github, rateLimit; + +var expect = require('must'); +var testUser = require('./fixtures/user.json'); +var assertSuccessful = require('./helpers').assertSuccessful; describe('Github.RateLimit', function() { + var github, rateLimit; + before(function() { github = new Github({ username: testUser.USERNAME, @@ -16,17 +20,17 @@ describe('Github.RateLimit', function() { }); it('should get rate limit', function(done) { - rateLimit.getRateLimit(function(err, rateInfo, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - rateInfo.should.be.an('object'); - rateInfo.should.have.deep.property('rate.limit'); - rateInfo.rate.limit.should.be.a('number'); - rateInfo.should.have.deep.property('rate.remaining'); - rateInfo.rate.remaining.should.be.a('number'); - rateInfo.rate.remaining.should.be.at.most(rateInfo.rate.limit); + rateLimit.getRateLimit(assertSuccessful(done, function(err, rateInfo) { + var rate = rateInfo.rate; + + expect(rate).to.be.an.object(); + expect(rate).to.have.own('limit'); + expect(rate).to.have.own('remaining'); + expect(rate.limit).to.be.a.number(); + expect(rate.remaining).to.be.a.number(); + expect(rate.remaining).to.be.at.most(rateInfo.rate.limit); done(); - }); + })); }); }); diff --git a/test/test.repo.js b/test/test.repo.js index 16a72982..5d032347 100644 --- a/test/test.repo.js +++ b/test/test.repo.js @@ -1,678 +1,532 @@ 'use strict'; var Github = require('../src/github.js'); -var testUser = require('./user.json'); -var RELEASE_TAG = 'foo'; -var RELEASE_NAME = 'My awesome release'; -var RELEASE_BODY = 'Foo bar bazzy baz'; -var STATUS_URL = 'https://api.github.com/repos/michael/github/statuses/20fcff9129005d14cc97b9d59b8a3d37f4fb633b'; -var github, repo, user, imageB64, imageBlob, sha, releaseId; - -if (typeof window === 'undefined') { // We're in NodeJS - var fs = require('fs'); - var path = require('path'); - - imageBlob = fs.readFileSync(path.join(__dirname, 'gh.png')); // This is a Buffer(). - imageB64 = imageBlob.toString('base64'); -} else { // We're in the browser - if (typeof window._phantom !== 'undefined') { - var xhr = new XMLHttpRequest(); - - xhr.responseType = 'blob'; - xhr.open('GET', 'base/test/gh.png'); - xhr.onload = function() { - var reader = new FileReader(); - - reader.onloadend = function() { - imageB64 = btoa(reader.result); - imageBlob = reader.result; - console.log(imageBlob); - }; - - reader.readAsBinaryString(xhr.response); - }; - - xhr.send(); - } else { - // jscs:disable - imageB64 = 'iVBORw0KGgoAAAANSUhEUgAAACsAAAAmCAAAAAB4qD3CAAABgElEQVQ4y9XUsUocURQGYN/pAyMWBhGtrEIMiFiooGuVIoYsSBAsRSQvYGFWC4uFhUBYsilXLERQsDA20YAguIbo5PQp3F3inVFTheSvZoavGO79z+mJP0/Pv2nPtlfLpfLq9tljNquO62S8mj1kmy/8nrHm/Xaz1930bt5n1+SzVmyrilItsod9ON0td1V59xR9hwV2HsMRsbfROLo4amzsRcQw5vO2CZPJEU5CM2cXYTCxg7CY2mwIVhK7AkNZYg9g4CqxVwNwkNg6zOTKMQP1xFZgKWeXoJLYdSjl7BysJ7YBIzk7Ap8TewLOE3oOTtIz6y/64bfQn55ZTIAPd2gNTOTurcbzp7z50v1y/Pq2Q7Wczca8vFjG6LvbMo92hiPL96xO+eYVPkVExMdONetFXZ+l+eP9cuV7RER8a9PZwrloTXv2tfv285ZOt4rnrTXlydxCu9sZmGrdN8eXC3ATERHXsHD5wC7ZL3HdsaX9R3bUzlb7YWvn/9ipf93+An8cHsx3W3WHAAAAAElFTkSuQmCC'; - imageBlob = new Blob(); - // jscs:enable - } -} +var expect = require('must'); +var testUser = require('./fixtures/user.json'); +var loadImage = require('./fixtures/imageBlob'); +var assertSuccessful = require('./helpers').assertSuccessful; +var assertFailure = require('./helpers').assertFailure; describe('Github.Repository', function() { - before(function() { + var github, remoteRepo, user, imageB64, imageBlob; + var testRepoName = Math.floor(Math.random() * 100000).toString(); + var v10_4sha = '20fcff9129005d14cc97b9d59b8a3d37f4fb633b'; + var statusUrl = 'https://api.github.com/repos/michael/github/statuses/20fcff9129005d14cc97b9d59b8a3d37f4fb633b'; + + before(function(done) { github = new Github({ username: testUser.USERNAME, password: testUser.PASSWORD, auth: 'basic' }); - repo = github.getRepo('michael', 'github'); - }); - - it('should show repo', function(done) { - repo.show(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.full_name.should.equal('michael/github'); // jscs:ignore - + loadImage(function(b64, blob) { + imageB64 = b64; + imageBlob = blob; done(); }); }); - it('should get blob', function(done) { - repo.getSha('master', 'README.md', function(err, sha) { - repo.getBlob(sha, function(err, content, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - content.indexOf('# Github.js').should.be.above(-1); + describe('reading', function() { + before(function() { + remoteRepo = github.getRepo('michael', 'github'); + }); + + it('should show repo', function(done) { + remoteRepo.show(assertSuccessful(done, function(err, repo) { + expect(repo).to.have.own('full_name', 'michael/github'); done(); - }); + })); }); - }); - it('should show repo contents', function(done) { - repo.contents('master', '', function(err, contents, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - contents.should.be.instanceof(Array); + it('should get blob', function(done) { + remoteRepo.getSha('master', 'README.md', assertSuccessful(done, function(err, sha) { + remoteRepo.getBlob(sha, assertSuccessful(done, function(err, content) { + expect(content).to.be.include('# Github.js'); - var readme = contents.filter(function(content) { - return content.path === 'README.md'; - }); + done(); + })); + })); + }); - readme.should.have.length(1); - readme[0].should.have.property('type', 'file'); + it('should show repo contents', function(done) { + remoteRepo.contents('master', '', assertSuccessful(done, function(err, contents) { + expect(contents).to.be.an.array(); - done(); - }); - }); + var readme = contents.filter(function(content) { + return content.path === 'README.md'; + }); - it('should get tree', function(done) { - repo.getTree('master', function(err, tree, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - tree.should.be.instanceof(Array); - tree.should.have.length.above(0); + expect(readme).to.have.length(1); + expect(readme[0]).to.have.own('type', 'file'); - done(); + done(); + })); }); - }); - it('should fork repo', function(done) { - repo.fork(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should get tree', function(done) { + remoteRepo.getTree('master', assertSuccessful(done, function(err, tree) { + expect(tree).to.be.an.array(); + expect(tree.length).to.be.above(0); - // @TODO write better assertion. - done(); + done(); + })); }); - }); - it('should list forks of repo', function(done) { - repo.listForks(function(err, forks, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should fork repo', function(done) { + remoteRepo.fork(assertSuccessful(done)); + }); - // @TODO write better assertion. - done(); + it('should list forks of repo', function(done) { + remoteRepo.listForks(assertSuccessful(done, function(err, forks) { + expect(forks).to.be.an.array(); + expect(forks.length).to.be.above(0); + done(); + })); }); - }); - it('should list commits with no options', function(done) { - repo.getCommits(null, function(err, commits, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - commits.should.be.instanceof(Array); - commits.should.have.length.above(0); - commits[0].should.have.property('commit'); - commits[0].should.have.property('author'); + it('should list commits with no options', function(done) { + remoteRepo.getCommits(null, assertSuccessful(done, function(err, commits) { + expect(commits).to.be.an.array(); + expect(commits.length).to.be.above(0); - done(); - }); - }); + expect(commits[0]).to.have.own('commit'); + expect(commits[0]).to.have.own('author'); - it('should list commits with all options', function(done) { - var sinceDate = new Date(2015, 0, 1); - var untilDate = new Date(2016, 0, 20); - var options = { - sha: 'master', - path: 'test', - author: 'AurelioDeRosa', - since: sinceDate, - until: untilDate - }; - - repo.getCommits(options, function(err, commits, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - commits.should.be.instanceof(Array); - commits.should.have.length.above(0); - commits[0].should.have.property('commit'); - commits[0].should.have.deep.property('author.login', 'AurelioDeRosa'); - (new Date(commits[0].commit.author.date)).getTime().should.be.within(sinceDate.getTime(), untilDate.getTime()); + done(); + })); + }); + + it('should list commits with all options', function(done) { + var sinceDate = new Date(2015, 0, 1); + var untilDate = new Date(2016, 0, 20); + var options = { + sha: 'master', + path: 'test', + author: 'AurelioDeRosa', + since: sinceDate, + until: untilDate + }; - done(); - }); - }); + remoteRepo.getCommits(options, assertSuccessful(done, function(err, commits) { + expect(commits).to.be.an.array(); + expect(commits.length).to.be.above(0); - it('should show repo contributors', function(done) { - repo.contributors(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.should.be.instanceof(Array); - res.should.have.length.above(1); - should.exist(res[0].author); - should.exist(res[0].total); - should.exist(res[0].weeks); + var commit = commits[0]; + var commitDate = new Date(commit.commit.author.date); - done(); + expect(commit).to.have.own('commit'); + expect(commit.author).to.have.own('login', 'AurelioDeRosa'); + expect(commitDate.getTime()).to.be.between(sinceDate.getTime(), untilDate.getTime()); + done(); + })); }); - }); - - // @TODO repo.branch, repo.pull - it('should list repo branches', function(done) { - repo.listBranches(function(err, branches, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should show repo contributors', function(done) { + remoteRepo.contributors(assertSuccessful(done, function(err, contributors) { + expect(contributors).to.be.an.array(); + expect(contributors.length).to.be.above(1); - done(); - }); - }); + var contributor = contributors[0]; - it('should read repo', function(done) { - repo.read('master', 'README.md', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.indexOf('# Github.js').should.be.above(-1); + expect(contributor).to.have.own('author'); + expect(contributor).to.have.own('total'); + expect(contributor).to.have.own('weeks'); - done(); + done(); + })); }); - }); - it('should get commit from repo', function(done) { - repo.getCommit('master', '20fcff9129005d14cc97b9d59b8a3d37f4fb633b', function(err, commit, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - commit.message.should.equal('v0.10.4'); - commit.author.date.should.equal('2015-03-20T17:01:42Z'); + // @TODO repo.branch, repo.pull - done(); + it('should list repo branches', function(done) { + remoteRepo.listBranches(assertSuccessful(done)); }); - }); - it('should get statuses for a SHA from a repo', function(done) { - repo.getStatuses('20fcff9129005d14cc97b9d59b8a3d37f4fb633b', function(err, statuses, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - statuses.length.should.equal(6); - statuses.every(function(status) { - return status.url === STATUS_URL; - }).should.equal(true); + it('should read repo', function(done) { + remoteRepo.read('master', 'README.md', assertSuccessful(done, function(err, text) { + expect(text).to.contain('# Github.js'); - done(); + done(); + })); }); - }); - it('should get a SHA from a repo', function(done) { - repo.getSha('master', '.gitignore', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should get commit from repo', function(done) { + remoteRepo.getCommit('master', v10_4sha, assertSuccessful(done, function(err, commit) { + expect(commit.message).to.equal('v0.10.4'); + expect(commit.author.date).to.equal('2015-03-20T17:01:42Z'); - done(); + done(); + })); }); - }); - it('should get a repo by fullname', function(done) { - var repo2 = github.getRepo('michael/github'); + it('should get statuses for a SHA from a repo', function(done) { + remoteRepo.getStatuses(v10_4sha, assertSuccessful(done, function(err, statuses) { + expect(statuses).to.be.an.array(); + expect(statuses.length).to.equal(6); - repo2.show(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.full_name.should.equal('michael/github'); // jscs:ignore - - done(); - }); - }); + var correctUrls = statuses.every(function(status) { + return status.url === statusUrl; + }); - it('should check if the repo is starred', function(done) { - repo.isStarred('michael', 'github', function(err) { - err.error.should.equal(404); - err.request.should.be.instanceof(XMLHttpRequest); + expect(correctUrls).to.be(true); - done(); + done(); + })); }); - }); -}); - -var repoTest = Math.floor(Math.random() * 100000); -describe('Creating new Github.Repository', function() { - before(function() { - github = new Github({ - username: testUser.USERNAME, - password: testUser.PASSWORD, - auth: 'basic' + it('should get a SHA from a repo', function(done) { + remoteRepo.getSha('master', '.gitignore', assertSuccessful(done)); }); - user = github.getUser(); - repo = github.getRepo(testUser.USERNAME, repoTest); - }); + it('should get a repo by fullname', function(done) { + var repoByName = github.getRepo('michael/github'); - it('should create repo', function(done) { - user.createRepo({ - name: repoTest - }, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.name.should.equal(repoTest.toString()); + repoByName.show(assertSuccessful(done, function(err, repo) { + expect(repo).to.have.own('full_name', 'michael/github'); - done(); + done(); + })); }); - }); - - it('should write to repo', function(done) { - repo.write('master', 'TEST.md', 'THIS IS A TEST', 'Creating test', function(err) { - should.not.exist(err); - repo.read('master', 'TEST.md', function(err, res) { - should.not.exist(err); - res.should.equal('THIS IS A TEST'); + it('should check if the repo is starred', function(done) { + remoteRepo.isStarred('michael', 'github', assertFailure(done, function(err) { + expect(err.error).to.be(404); done(); - }); + })); }); }); - it('should write to repo branch', function(done) { - repo.branch('master', 'dev', function(err) { - should.not.exist(err); - repo.write('dev', 'TEST.md', 'THIS IS AN UPDATED TEST', 'Updating test', function(err) { - should.not.exist(err); - repo.read('dev', 'TEST.md', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.should.equal('THIS IS AN UPDATED TEST'); + describe('creating/modifiying', function() { + var fileName = 'test.md'; - done(); - }); - }); - }); - }); + var initialText = 'This is a test.'; + var initialMessage = 'Test file create.'; - it('should compare two branches', function(done) { - repo.branch('master', 'compare', function() { - repo.write('compare', 'TEST.md', 'THIS IS AN UPDATED TEST', 'Updating test', function() { - repo.compare('master', 'compare', function(err, diff, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - diff.should.have.property('total_commits', 1); - diff.should.have.deep.property('files[0].filename', 'TEST.md'); + var updatedText = 'This file has been updated.'; + var updatedMessage = 'Test file update.'; - done(); - }); - }); - }); - }); + var fileToDelete = 'tmp.md'; + var deleteMessage = 'Removing file'; - it('should submit a pull request', function(done) { - var baseBranch = 'master'; - var headBranch = 'pull-request'; - var pullRequestTitle = 'Test pull request'; - var pullRequestBody = 'This is a test pull request'; - - repo.branch(baseBranch, headBranch, function() { - repo.write(headBranch, 'TEST.md', 'THIS IS AN UPDATED TEST', 'Updating test', function() { - repo.createPullRequest( - { - title: pullRequestTitle, - body: pullRequestBody, - base: baseBranch, - head: headBranch - }, - function(err, pullRequest, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - pullRequest.should.have.property('number').above(0); - pullRequest.should.have.property('title', pullRequestTitle); - pullRequest.should.have.property('body', pullRequestBody); + var unicodeFileName = '\u4E2D\u6587\u6D4B\u8BD5.md'; + var unicodeText = '\u00A1\u00D3i de m\u00ED, que verg\u00FCenza!'; + var unicodeMessage = 'Such na\u00EFvet\u00E9\u2026'; - done(); - } - ); - }); - }); - }); + var imageFileName = 'image.png'; - it('should get ref from repo', function(done) { - repo.getRef('heads/master', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + var releaseTag = 'foo'; + var releaseName = 'My awesome release'; + var releaseBody = 'Foo bar bazzy baz'; + var sha, releaseId; - // @TODO write better assertion - done(); + before(function() { + user = github.getUser(); + remoteRepo = github.getRepo(testUser.USERNAME, testRepoName); + }); + + // 200ms between tests so that Github has a chance to settle + beforeEach(function(done) { + setTimeout(done, 200); }); - }); - it('should create ref on repo', function(done) { - repo.getRef('heads/master', function(err, sha) { - var refSpec = { - ref: 'refs/heads/new-test-branch', sha: sha + it('should create repo', function(done) { + var repoDef = { + name: testRepoName }; - repo.createRef(refSpec, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + user.createRepo(repoDef, assertSuccessful(done, function(err, repo) { + expect(repo).to.have.own('name', testRepoName); - // @TODO write better assertion done(); - }); + })); }); - }); - it('should delete ref on repo', function(done) { - repo.deleteRef('heads/new-test-branch', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should write to repo', function(done) { + remoteRepo.write('master', fileName, initialText, initialMessage, assertSuccessful(done, function() { + remoteRepo.read('master', fileName, assertSuccessful(done, function(err, fileText) { + expect(fileText).to.be(initialText); - // @TODO write better assertion - done(); + done(); + })); + })); }); - }); - it('should list tags on repo', function(done) { - repo.listTags(function(err, tags, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should write to repo branch', function(done) { + remoteRepo.branch('master', 'dev', assertSuccessful(done, function() { + remoteRepo.write('dev', fileName, updatedText, updatedMessage, assertSuccessful(done, function() { + remoteRepo.read('dev', fileName, assertSuccessful(done, function(err, fileText) { + expect(fileText).to.be(updatedText); - // @TODO write better assertion - done(); + done(); + })); + })); + })); }); - }); - it('should list pulls on repo', function(done) { - var repo = github.getRepo('michael', 'github'); - var options = { - state: 'all', - sort: 'updated', - direction: 'desc', - page: 1, - per_page: 10 - }; - - repo.listPulls(options, function(err, pullRequests, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - pullRequests.should.be.instanceof(Array); - pullRequests.should.have.length(10); - should.exist(pullRequests[0].title); - should.exist(pullRequests[0].body); - should.exist(pullRequests[0].url); + it('should compare two branches', function(done) { + remoteRepo.branch('master', 'compare', assertSuccessful(done, function() { + remoteRepo.write('compare', fileName, updatedText, updatedMessage, assertSuccessful(done, function() { + remoteRepo.compare('master', 'compare', assertSuccessful(done, function(err, diff) { + expect(diff).to.have.own('total_commits', 1); + expect(diff.files[0]).to.have.own('filename', fileName); - done(); - }); - }); + done(); + })); + })); + })); + }); + + it('should submit a pull request', function(done) { + var baseBranch = 'master'; + var headBranch = 'pull-request'; + var pullRequestTitle = 'Test pull request'; + var pullRequestBody = 'This is a test pull request'; + var pr = { + title: pullRequestTitle, + body: pullRequestBody, + base: baseBranch, + head: headBranch + }; - it('should get pull requests on repo', function(done) { - var repo = github.getRepo('michael', 'github'); + remoteRepo.branch(baseBranch, headBranch, assertSuccessful(done, function() { + remoteRepo.write(headBranch, fileName, updatedText, updatedMessage, assertSuccessful(done, function() { + remoteRepo.createPullRequest(pr, assertSuccessful(done, function(err, pullRequest) { + expect(pullRequest).to.have.own('number'); + expect(pullRequest.number).to.be.above(0); + expect(pullRequest).to.have.own('title', pullRequestTitle); + expect(pullRequest).to.have.own('body', pullRequestBody); - repo.getPull(153, function(err, pullRequest, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + done(); + })); + })); + })); + }); - // @TODO write better assertion - done(); + it('should get ref from repo', function(done) { + remoteRepo.getRef('heads/master', assertSuccessful(done)); }); - }); - it('should delete a file on the repo', function(done) { - repo.write('master', 'REMOVE-TEST.md', 'THIS IS A TEST', 'Remove test', function(err) { - should.not.exist(err); + it('should create ref on repo', function(done) { + remoteRepo.getRef('heads/master', assertSuccessful(done, function(err, sha) { + var refSpec = { + ref: 'refs/heads/new-test-branch', sha: sha + }; - repo.remove('master', 'REMOVE-TEST.md', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + remoteRepo.createRef(refSpec, assertSuccessful(done)); + })); + }); - done(); - }); + it('should delete ref on repo', function(done) { + remoteRepo.deleteRef('heads/new-test-branch', assertSuccessful(done)); }); - }); - it('should use repo.delete as an alias for repo.remove', function(done) { - repo.write('master', 'REMOVE-TEST.md', 'THIS IS A TEST', 'Remove test', function(err) { - should.not.exist(err); + it('should list tags on repo', function(done) { + remoteRepo.listTags(assertSuccessful(done)); + }); + + it('should list pulls on repo', function(done) { + var options = { + state: 'all', + sort: 'updated', + direction: 'desc', + page: 1, + per_page: 10 + }; - repo.delete('master', 'REMOVE-TEST.md', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + remoteRepo.listPulls(options, assertSuccessful(done, function(err, pullRequests) { + expect(pullRequests).to.be.an.array(); + expect(pullRequests).to.have.length(1); done(); - }); + })); }); - }); - it('should write author and committer to repo', function(done) { - var options = { - author: { - name: 'Author Name', email: 'author@example.com' - }, - committer: { - name: 'Committer Name', email: 'committer@example.com' - } - }; - - repo.write('dev', 'TEST.md', 'THIS IS A TEST BY AUTHOR AND COMMITTER', 'Updating', options, function(err, res) { - should.not.exist(err); - repo.getCommit('dev', res.commit.sha, function(err, commit, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - commit.author.name.should.equal('Author Name'); - commit.author.email.should.equal('author@example.com'); - commit.committer.name.should.equal('Committer Name'); - commit.committer.email.should.equal('committer@example.com'); + it('should get pull requests on repo', function(done) { + var repo = github.getRepo('michael', 'github'); + + repo.getPull(153, assertSuccessful(done, function(err, pr) { + expect(pr).to.have.own('title'); + expect(pr).to.have.own('body'); + expect(pr).to.have.own('url'); done(); - }); + })); }); - }); - it('should be able to write CJK unicode to repo', function(done) { - repo.write('master', '中文测试.md', 'THIS IS A TEST', 'Creating test', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - // @TODO write better assertion - done(); + it('should delete a file on the repo', function(done) { + remoteRepo.write('master', fileToDelete, initialText, deleteMessage, assertSuccessful(done, function() { + remoteRepo.remove('master', fileToDelete, assertSuccessful(done)); + })); }); - }); - it('should be able to write unicode to repo', function(done) { - repo.write('master', 'TEST_unicode.md', '\u2014', 'Long dash unicode', function(err) { - should.not.exist(err); - - repo.read('master', 'TEST_unicode.md', function(err, obj, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - obj.should.equal('\u2014'); - - done(); - }); + it('should use repo.delete as an alias for repo.remove', function(done) { + remoteRepo.write('master', fileToDelete, initialText, deleteMessage, assertSuccessful(done, function() { + remoteRepo.delete('master', fileToDelete, assertSuccessful(done)); + })); }); - }); - it('should pass a regression test for _request (#14)', function(done) { - repo.getRef('heads/master', function(err, sha) { - var refSpec = { - ref: 'refs/heads/testing-14', sha: sha + it('should write author and committer to repo', function(done) { + var options = { + author: { + name: 'Author Name', email: 'author@example.com' + }, + committer: { + name: 'Committer Name', email: 'committer@example.com' + } }; - repo.createRef(refSpec, function(err) { - should.not.exist(err); + remoteRepo.write('dev', fileName, initialText, initialMessage, options, assertSuccessful(done, function(e, r) { + remoteRepo.getCommit('dev', r.commit.sha, assertSuccessful(done, function(err, commit) { + expect(commit.author.name).to.be('Author Name'); + expect(commit.author.email).to.be('author@example.com'); + expect(commit.committer.name).to.be('Committer Name'); + expect(commit.committer.email).to.be('committer@example.com'); - // Triggers GET: - // https://api.github.com/repos/michael/cmake_cdt7_stalled/git/refs/heads/prose-integration - repo.getRef('heads/master', function(err) { - should.not.exist(err); + done(); + })); + })); + }); - // Triggers DELETE: - // https://api.github.com/repos/michael/cmake_cdt7_stalled/git/refs/heads/prose-integration - repo.deleteRef('heads/testing-14', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - xhr.status.should.equal(204); + it('should be able to write all the unicode', function(done) { + remoteRepo.write('master', unicodeFileName, unicodeText, unicodeMessage, assertSuccessful(done, + function(err, commit) { + expect(commit.content.name).to.be(unicodeFileName); + expect(commit.commit.message).to.be(unicodeMessage); + + remoteRepo.read('master', unicodeFileName, assertSuccessful(done, function(err, fileText) { + expect(fileText).to.be(unicodeText); done(); - }); - }); - }); + })); + })); }); - }); - it('should be able to write an image to the repo', function(done) { - repo.write('master', 'TEST_image.png', imageB64, 'Image test', { - encode: false - }, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - sha = res.commit.sha; + it('should pass a regression test for _request (#14)', function(done) { + remoteRepo.getRef('heads/master', assertSuccessful(done, function(err, sha) { + var refSpec = { + ref: 'refs/heads/testing-14', sha: sha + }; - done(); - }); - }); - - it('should be able to write a blob to the repo', function(done) { - repo.postBlob('String test', function(err, res, xhr) { // Test strings - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + remoteRepo.createRef(refSpec, assertSuccessful(done, function() { + // Triggers GET: + // https://api.github.com/repos/michael/cmake_cdt7_stalled/git/refs/heads/prose-integration + remoteRepo.getRef('heads/master', assertSuccessful(done, function() { + // Triggers DELETE: + // https://api.github.com/repos/michael/cmake_cdt7_stalled/git/refs/heads/prose-integration + remoteRepo.deleteRef('heads/testing-14', assertSuccessful(done, function(err, res, xhr) { + expect(xhr.status).to.be(204); + + done(); + })); + })); + })); + })); + }); + + it('should be able to write an image to the repo', function(done) { + var opts = { + encode: false + }; - repo.postBlob(imageBlob, function(err, res, xhr) { // Test non-strings - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + remoteRepo.write('master', imageFileName, imageB64, initialMessage, opts, assertSuccessful(done, + function(err, commit) { + sha = commit.sha; - done(); - }); + done(); + })); }); - }); - it('should star the repo', function(done) { - repo.star(testUser.USERNAME, repoTest, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should be able to write a string blob to the repo', function(done) { + remoteRepo.postBlob('String test', assertSuccessful(done)); + }); - repo.isStarred(testUser.USERNAME, repoTest, function(err) { - should.not.exist(err); + it('should be able to write a file blob to the repo', function(done) { + remoteRepo.postBlob(imageBlob, assertSuccessful(done)); + }); - done(); - }); + it('should star the repo', function(done) { + remoteRepo.star(testUser.USERNAME, testRepoName, assertSuccessful(done, function() { + remoteRepo.isStarred(testUser.USERNAME, testRepoName, assertSuccessful(done)); + })); }); - }); - it('should unstar the repo', function(done) { - repo.unstar(testUser.USERNAME, repoTest, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should unstar the repo', function(done) { + remoteRepo.unstar(testUser.USERNAME, testRepoName, assertSuccessful(done, function() { + remoteRepo.isStarred(testUser.USERNAME, testRepoName, assertFailure(done, function(err) { + expect(err.error).to.be(404); + + done(); + })); + })); + }); - repo.isStarred(testUser.USERNAME, repoTest, function(err) { - err.error.should.equal(404); + it('should fail on broken commit', function(done) { + remoteRepo.commit('broken-parent-hash', 'broken-tree-hash', initialMessage, assertFailure(done, function(err) { + expect(err.error).to.be(422); done(); - }); + })); }); - }); - - it('should create a release', function(done) { - var options = { - tag_name: RELEASE_TAG, - target_commitish: sha - }; - repo.createRelease(options, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); + it('should create a release', function(done) { + var options = { + tag_name: releaseTag, + target_commitish: sha + }; - releaseId = res.id; - done(); + remoteRepo.createRelease(options, assertSuccessful(done, function(err, res) { + releaseId = res.id; + done(); + })); }); - }); - it('should edit a release', function(done) { - var options = { - name: RELEASE_NAME, - body: RELEASE_BODY - }; + it('should edit a release', function(done) { + var options = { + name: releaseName, + body: releaseBody + }; - repo.editRelease(releaseId, options, function(err, res, xhr) { - should.not.exist(err); - res.name.should.equal(RELEASE_NAME); - res.body.should.equal(RELEASE_BODY); - xhr.should.be.instanceof(XMLHttpRequest); + remoteRepo.editRelease(releaseId, options, assertSuccessful(done, function(err, release) { + expect(release).to.have.own('name', releaseName); + expect(release).to.have.own('body', releaseBody); - done(); + done(); + })); }); - }); - it('should read a release', function(done) { - repo.getRelease(releaseId, function(err, res, xhr) { - should.not.exist(err); - res.name.should.equal(RELEASE_NAME); - xhr.should.be.instanceof(XMLHttpRequest); - done(); - }); - }); + it('should read a release', function(done) { + remoteRepo.getRelease(releaseId, assertSuccessful(done, function(err, release) { + expect(release).to.have.own('name', releaseName); - it('should delete a release', function(done) { - repo.deleteRelease(releaseId, function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - done(); + done(); + })); }); - }); -}); -describe('deleting a Github.Repository', function() { - before(function() { - github = new Github({ - username: testUser.USERNAME, - password: testUser.PASSWORD, - auth: 'basic' + it('should delete a release', function(done) { + remoteRepo.deleteRelease(releaseId, assertSuccessful(done)); }); - repo = github.getRepo(testUser.USERNAME, repoTest); }); - it('should delete the repo', function(done) { - repo.deleteRepo(function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.should.be.true; // jshint ignore:line - - done(); + describe('deleting', function() { + before(function() { + remoteRepo = github.getRepo(testUser.USERNAME, testRepoName); }); - }); -}); -describe('Repo returns commit errors correctly', function() { - before(function() { - github = new Github({ - username: testUser.USERNAME, - password: testUser.PASSWORD, - auth: 'basic' + // 200ms between tests so that Github has a chance to settle + beforeEach(function(done) { + setTimeout(done, 200); }); - repo = github.getRepo(testUser.USERNAME, testUser.REPO); - }); - it('should fail on broken commit', function(done) { - repo.commit('broken-parent-hash', 'broken-tree-hash', 'commit message', function(err) { - should.exist(err); - should.exist(err.request); - err.request.should.be.instanceof(XMLHttpRequest); - err.error.should.equal(422); + it('should delete the repo', function(done) { + remoteRepo.deleteRepo(assertSuccessful(done, function(err, result) { + expect(result).to.be(true); - done(); + done(); + })); }); }); }); diff --git a/test/test.search.js b/test/test.search.js index f6bb51fa..bb416851 100644 --- a/test/test.search.js +++ b/test/test.search.js @@ -1,10 +1,13 @@ 'use strict'; var Github = require('../src/github.js'); -var testUser = require('./user.json'); -var github; + +var testUser = require('./fixtures/user.json'); +var assertSuccessful = require('./helpers').assertSuccessful; describe('Github.Search', function() { + var github; + before(function() { github = new Github({ username: testUser.USERNAME, @@ -13,51 +16,31 @@ describe('Github.Search', function() { }); }); - it('should search.repositories', function(done) { + it('should search repositories', function(done) { var search = github.getSearch('tetris+language:assembly&sort=stars&order=desc'); var options = null; - search.repositories(options, function (err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + search.repositories(options, assertSuccessful(done)); }); - it('should search.code', function(done) { + it('should search code', function(done) { var search = github.getSearch('addClass+in:file+language:js+repo:jquery/jquery'); var options = null; - search.code(options, function (err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + search.code(options, assertSuccessful(done)); }); - it('should search.issues', function(done) { + it('should search issues', function(done) { var search = github.getSearch('windows+label:bug+language:python+state:open&sort=created&order=asc'); var options = null; - search.issues(options, function (err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + search.issues(options, assertSuccessful(done)); }); - it('should search.users', function(done) { + it('should search users', function(done) { var search = github.getSearch('tom+repos:%3E42+followers:%3E1000'); var options = null; - search.users(options, function (err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + search.users(options, assertSuccessful(done)); }); }); diff --git a/test/test.user.js b/test/test.user.js index 9ccdb0ff..a00e2784 100644 --- a/test/test.user.js +++ b/test/test.user.js @@ -1,10 +1,21 @@ 'use strict'; var Github = require('../src/github.js'); -var testUser = require('./user.json'); -var github, user; + +var expect = require('must'); +var testUser = require('./fixtures/user.json'); +var assertSuccessful = require('./helpers').assertSuccessful; + +function assertArray(done) { + return assertSuccessful(done, function(err, result) { + expect(result).to.be.an.array(); + done(); + }); +} describe('Github.User', function() { + var github, user; + before(function() { github = new Github({ username: testUser.USERNAME, @@ -14,17 +25,11 @@ describe('Github.User', function() { user = github.getUser(); }); - it('should get user.repos', function(done) { - user.repos(function(err, repos, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - repos.should.be.instanceof(Array); - - done(); - }); + it('should get user repos', function(done) { + user.repos(assertArray(done)); }); - it('should get user.repos with options', function(done) { + it('should get user repos with options', function(done) { var options = { type: 'owner', sort: 'updated', @@ -32,43 +37,22 @@ describe('Github.User', function() { page: 10 }; - user.repos(options, function(err, repos, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - repos.should.be.instanceof(Array); - - done(); - }); + user.repos(options, assertArray(done)); }); - it('should get user.orgs', function(done) { - user.orgs(function(err, orgs, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + it('should get user orgs', function(done) { + user.orgs(assertArray(done)); }); - it('should get user.gists', function(done) { - user.gists(function(err, gists, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + it('should get user gists', function(done) { + user.gists(assertArray(done)); }); - it('should get user.notifications', function(done) { - user.notifications(function(err, notifications, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + it('should get user notifications', function(done) { + user.notifications(assertArray(done)); }); - it('should get user.notifications with options', function(done) { + it('should get user notifications with options', function(done) { var options = { all: true, participating: true, @@ -76,31 +60,15 @@ describe('Github.User', function() { before: '2015-02-01T00:00:00Z' }; - user.notifications(options, function(err, notifications, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + user.notifications(options, assertArray(done)); }); it('should show user', function(done) { - user.show('ingalls', function(err, info, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + user.show('ingalls', assertSuccessful(done)); }); it('should show user\'s repos', function(done) { - user.userRepos('aendrew', function(err, repos, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - repos.should.be.instanceof(Array); - - done(); - }); + user.userRepos('aendrew', assertArray(done)); }); it('should show user\'s repos with options', function(done) { @@ -111,77 +79,26 @@ describe('Github.User', function() { page: 1 }; - user.userRepos('aendrew', options, function(err, repos, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - repos.should.be.instanceof(Array); - - done(); - }); + user.userRepos('aendrew', options, assertArray(done)); }); it('should show user\'s starred repos', function(done) { - user.userStarred(testUser.USERNAME, function(err, repos, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + user.userStarred(testUser.USERNAME, assertArray(done)); }); it('should show user\'s gists', function(done) { - user.userGists(testUser.USERNAME, function(err, gists, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + user.userGists(testUser.USERNAME, assertArray(done)); }); it('should show user\'s organisation repos', function(done) { - user.orgRepos('openaddresses', function(err, repos, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + user.orgRepos('openaddresses', assertArray(done)); }); it('should follow user', function(done) { - user.follow('ingalls', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); + user.follow('ingalls', assertSuccessful(done)); }); it('should unfollow user', function(done) { - user.unfollow('ingalls', function(err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - - done(); - }); - }); - - it('should create a repo', function(done) { - var repoTest = Math.floor(Math.random() * (100000 - 0)) + 0; - var github = new Github({ - username: testUser.USERNAME, - password: testUser.PASSWORD, - auth: 'basic' - }); - var user = github.getUser(); - - user.createRepo({ - name: repoTest - }, function (err, res, xhr) { - should.not.exist(err); - xhr.should.be.instanceof(XMLHttpRequest); - res.name.should.equal(repoTest.toString()); - - done(); - }); + user.unfollow('ingalls', assertSuccessful(done)); }); }); From 0c03e790b36827be323ae7130dc54c6b44ac739b Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Wed, 2 Mar 2016 17:14:30 -0600 Subject: [PATCH 4/8] Fetch single page when page is specified --- src/github.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/github.js b/src/github.js index 54ed0d3e..b9749d35 100644 --- a/src/github.js +++ b/src/github.js @@ -95,7 +95,7 @@ var Promise = require('es6-promise'); }); }; - var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, cb) { + var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, singlePage, cb) { var results = []; (function iterate() { @@ -120,7 +120,7 @@ var Promise = require('es6-promise'); }) .pop(); - if (!next) { + if (!next || singlePage) { cb(err, results, xhr); } else { path = next; @@ -155,7 +155,7 @@ var Promise = require('es6-promise'); url += '?' + params.join('&'); - _requestAllPages(url, cb); + _requestAllPages(url, !!options.page, cb); }; // List user organizations @@ -255,7 +255,7 @@ var Promise = require('es6-promise'); url += '?' + params.join('&'); - _requestAllPages(url, cb); + _requestAllPages(url, !!options.page, cb); }; // List user starred repositories @@ -263,7 +263,8 @@ var Promise = require('es6-promise'); this.userStarred = function (username, cb) { // Github does not always honor the 1000 limit so we want to iterate over the data set. - _requestAllPages('/users/' + username + '/starred?type=all&per_page=100', cb); + var request = '/users/' + username + '/starred?type=all&per_page=100'; + _requestAllPages(request, false, cb); }; // List a user's gists @@ -278,7 +279,8 @@ var Promise = require('es6-promise'); this.orgRepos = function (orgname, cb) { // Github does not always honor the 1000 limit so we want to iterate over the data set. - _requestAllPages('/orgs/' + orgname + '/repos?type=all&&page_num=1000&sort=updated&direction=desc', cb); + var request = '/orgs/' + orgname + '/repos?type=all&&page_num=100&sort=updated&direction=desc'; + _requestAllPages(request, false, cb); }; // Follow user @@ -1028,13 +1030,11 @@ var Promise = require('es6-promise'); this.list = function (options, cb) { var query = []; - for(var key in options) { - if (options.hasOwnProperty(key)) { - query.push(encodeURIComponent(key) + '=' + encodeURIComponent(options[key])); - } - } + Object.keys(options).forEach(function(option) { + query.push(encodeURIComponent(option) + '=' + encodeURIComponent(options[option])); + }); - _requestAllPages(path + '?' + query.join('&'), cb); + _requestAllPages(path + '?' + query.join('&'), !!options.page, cb); }; this.comment = function (issue, comment, cb) { From 1af7e041acd1550a399d6abf95669e9dff12e240 Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Wed, 2 Mar 2016 17:14:47 -0600 Subject: [PATCH 5/8] postBlob compatibility for node --- src/github.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/github.js b/src/github.js index b9749d35..0fe7678c 100644 --- a/src/github.js +++ b/src/github.js @@ -527,14 +527,24 @@ var Promise = require('es6-promise'); this.postBlob = function (content, cb) { if (typeof content === 'string') { content = { - content: content, + content: Utf8.encode(content), encoding: 'utf-8' }; } else { - content = { - content: b64encode(content), - encoding: 'base64' - }; + if (typeof Buffer !== 'undefined' && content instanceof Buffer) { + // in NodeJS + content = { + content: content.toString('base64'), + encoding: 'base64' + }; + } else if (typeof Blob !== 'undefined' && content instanceof Blob) { + content = { + content: b64encode(content), + encoding: 'base64' + }; + } else { + throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)'); + } } _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) { From d40b45c3c77bed45bd936683460fffcc4f5f05d3 Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Wed, 2 Mar 2016 21:19:36 -0600 Subject: [PATCH 6/8] Allow unauthenticated API call to fail when ratelimited --- test/test.auth.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/test.auth.js b/test/test.auth.js index 59c2e11d..09d0cc0b 100644 --- a/test/test.auth.js +++ b/test/test.auth.js @@ -44,7 +44,27 @@ describe('Github', function() { it('should read public information', function(done) { var gist = github.getGist('f1c0f84e53aa6b98ec03'); - gist.read(assertSuccessful(done)); + gist.read(function(err, res, xhr) { + try { + expect(err).not.to.exist(); + expect(res).to.exist(); + expect(xhr).to.be.an.object(); + + done(); + } catch(e) { + try { + if (err && err.request.headers['x-ratelimit-remaining'] === '0') { + done(); + + return; + } + } catch(e2) { + done(e); + } + + done(e); + } + }); }); }); From 41782f3c253375e6f7148333c96a73e791f88fa7 Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Tue, 8 Mar 2016 10:00:43 -0600 Subject: [PATCH 7/8] Add code coverage back to testing --- .editorconfig | 3 + .gitignore | 3 +- .jshintrc | 139 ++-- .travis.yml | 2 +- dist/github.bundle.min.js | 3 + dist/github.bundle.min.js.map | 1 + dist/github.js | 1136 +++++++++++++++++++++++++++++++++ dist/github.js.map | 1 + dist/github.min.js | 2 + dist/github.min.js.map | 1 + gulpfile.js | 158 +---- package.json | 13 +- test/.jshintrc | 9 + 13 files changed, 1248 insertions(+), 223 deletions(-) create mode 100644 dist/github.bundle.min.js create mode 100644 dist/github.bundle.min.js.map create mode 100644 dist/github.js create mode 100644 dist/github.js.map create mode 100644 dist/github.min.js create mode 100644 dist/github.min.js.map create mode 100644 test/.jshintrc diff --git a/.editorconfig b/.editorconfig index 101a559e..321b598f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,8 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +[*.yml] +indent_size = 2 + [*.md] trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index 1aacec2f..23179d4d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,7 @@ .idea node_modules/ coverage/ -dist/*.js -dist/*.map +.zuulrc npm-debug.log sauce.json diff --git a/.jshintrc b/.jshintrc index d7c494f7..509fef3c 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,92 +1,65 @@ { - // JSHint Default Configuration File (as on JSHint website) - // See http://jshint.com/docs/ for more details - - "maxerr" : 50, // {int} Maximum error before stopping + "maxerr" : 50, // Enforcing - "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) - "camelcase" : false, // true: Identifiers must be in camelCase - "curly" : false, // true: Require {} for every new block or scope - "eqeqeq" : true, // true: Require triple equals (===) for comparison - "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() - "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. - "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` - "indent" : 2, // {int} Number of spaces to use for indentation - "latedef" : false, // true: Require variables/functions to be defined before being used - "newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()` - "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` - "noempty" : true, // true: Prohibit use of empty blocks - "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. - "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) - "plusplus" : false, // true: Prohibit use of `++` & `--` - "quotmark" : false, // Quotation mark consistency: - // false : do nothing (default) - // true : ensure whatever is used is consistent - // "single" : require single quotes - // "double" : require double quotes - "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) - "unused" : true, // true: Require all defined variables be used - "strict" : true, // true: Requires all functions run in ES5 Strict Mode - "maxparams" : false, // {int} Max number of formal params allowed per function - "maxdepth" : false, // {int} Max depth of nested blocks (within functions) - "maxstatements" : false, // {int} Max number statements per function - "maxcomplexity" : false, // {int} Max cyclomatic complexity per function - "maxlen" : false, // {int} Max number of characters per line + "bitwise" : true, + "camelcase" : false, + "curly" : false, + "eqeqeq" : true, + "forin" : true, + "freeze" : true, + "immed" : false, + "indent" : 2, + "latedef" : false, + "newcap" : false, + "noarg" : true, + "noempty" : true, + "nonbsp" : true, + "nonew" : false, + "plusplus" : false, + "quotmark" : false, + "undef" : true, + "unused" : true, + "strict" : true, + "maxparams" : false, + "maxdepth" : false, + "maxstatements" : false, + "maxcomplexity" : false, + "maxlen" : false, // Relaxing - "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) - "boss" : false, // true: Tolerate assignments where comparisons would be expected - "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. - "eqnull" : false, // true: Tolerate use of `== null` - "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) - "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) - "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) - // (ex: `for each`, multiple try/catch, function expression…) - "evil" : false, // true: Tolerate use of `eval` and `new Function()` - "expr" : false, // true: Tolerate `ExpressionStatement` as Programs - "funcscope" : false, // true: Tolerate defining variables inside control statements - "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') - "iterator" : false, // true: Tolerate using the `__iterator__` property - "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block - "laxbreak" : false, // true: Tolerate possibly unsafe line breakings - "laxcomma" : false, // true: Tolerate comma-first style coding - "loopfunc" : false, // true: Tolerate functions being defined in loops - "multistr" : false, // true: Tolerate multi-line strings - "noyield" : false, // true: Tolerate generator functions with no yield statement in them. - "notypeof" : false, // true: Tolerate invalid typeof operator values - "proto" : false, // true: Tolerate using the `__proto__` property - "scripturl" : false, // true: Tolerate script-targeted URLs - "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` - "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation - "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` - "validthis" : false, // true: Tolerate using this in a non-constructor function + "asi" : false, + "boss" : false, + "debug" : false, + "eqnull" : false, + "es5" : false, + "esnext" : false, + "moz" : false, + "evil" : false, + "expr" : false, + "funcscope" : false, + "globalstrict" : false, + "iterator" : false, + "lastsemic" : false, + "laxbreak" : false, + "laxcomma" : false, + "loopfunc" : false, + "multistr" : false, + "noyield" : false, + "notypeof" : false, + "proto" : false, + "scripturl" : false, + "shadow" : false, + "sub" : false, + "supernew" : false, + "validthis" : false, - // Environments - "browser" : true, // Web Browser (window, document, etc) - "browserify" : false, // Browserify (node.js code in the browser) - "couch" : false, // CouchDB - "devel" : true, // Development/debugging (alert, confirm, etc) - "dojo" : false, // Dojo Toolkit - "jasmine" : false, // Jasmine - "jquery" : false, // jQuery - "mocha" : true, // Mocha - "mootools" : false, // MooTools - "node" : true, // Node.js - "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) - "prototypejs" : false, // Prototype and Scriptaculous - "qunit" : false, // QUnit - "rhino" : false, // Rhino - "shelljs" : false, // ShellJS - "worker" : false, // Web Workers - "wsh" : false, // Windows Scripting Host - "yui" : false, // Yahoo User Interface + "browser" : true, + "devel" : true, + "node" : true, - // Custom Globals "globals" : { - "require": false, - "define": false, - "escape": false, - "should": false - } // additional predefined global variables + "require" : false, + "define" : false + } } diff --git a/.travis.yml b/.travis.yml index ed70c5c0..67df9cb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,4 +18,4 @@ before_install: script: - gulp lint - gulp test:mocha - # - zuul -- some tests + - npm run codecov diff --git a/dist/github.bundle.min.js b/dist/github.bundle.min.js new file mode 100644 index 00000000..b53ebbbd --- /dev/null +++ b/dist/github.bundle.min.js @@ -0,0 +1,3 @@ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Github=t()}}(function(){var t;return function e(t,n,r){function o(s,u){if(!n[s]){if(!t[s]){var a="function"==typeof require&&require;if(!u&&a)return a(s,!0);if(i)return i(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s=200&&o.status<300||!("status"in l)&&o.responseText?e:n)(o),l=null}},l.onerror=function(){n(new Error("Network Error")),l=null},r.isStandardBrowserEnv()){var g=t("./../helpers/cookies"),y=f.withCredentials||u(f.url)?g.read(f.xsrfCookieName):void 0;y&&(h[f.xsrfHeaderName]=y)}if("setRequestHeader"in l&&r.forEach(h,function(t,e){"undefined"==typeof c&&"content-type"===e.toLowerCase()?delete h[e]:l.setRequestHeader(e,t)}),f.withCredentials&&(l.withCredentials=!0),f.responseType)try{l.responseType=f.responseType}catch(v){if("json"!==l.responseType)throw v}r.isArrayBuffer(c)&&(c=new DataView(c)),l.send(c)}},{"./../helpers/btoa":8,"./../helpers/buildURL":9,"./../helpers/cookies":11,"./../helpers/isURLSameOrigin":13,"./../helpers/parseHeaders":14,"./../helpers/transformData":16,"./../utils":17}],3:[function(t,e,n){"use strict";function r(t){this.defaults=i.merge({},t),this.interceptors={request:new u,response:new u}}var o=t("./defaults"),i=t("./utils"),s=t("./core/dispatchRequest"),u=t("./core/InterceptorManager"),a=t("./helpers/isAbsoluteURL"),f=t("./helpers/combineURLs"),c=t("./helpers/bind"),h=t("./helpers/transformData");r.prototype.request=function(t){"string"==typeof t&&(t=i.merge({url:arguments[0]},arguments[1])),t=i.merge(o,this.defaults,{method:"get"},t),t.baseURL&&!a(t.url)&&(t.url=f(t.baseURL,t.url)),t.withCredentials=t.withCredentials||this.defaults.withCredentials,t.data=h(t.data,t.headers,t.transformRequest),t.headers=i.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),i.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]});var e=[s,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n};var l=new r(o),p=e.exports=c(r.prototype.request,l);p.create=function(t){return new r(t)},p.defaults=l.defaults,p.all=function(t){return Promise.all(t)},p.spread=t("./helpers/spread"),p.interceptors=l.interceptors,i.forEach(["delete","get","head"],function(t){r.prototype[t]=function(e,n){return this.request(i.merge(n||{},{method:t,url:e}))},p[t]=c(r.prototype[t],l)}),i.forEach(["post","put","patch"],function(t){r.prototype[t]=function(e,n,r){return this.request(i.merge(r||{},{method:t,url:e,data:n}))},p[t]=c(r.prototype[t],l)})},{"./core/InterceptorManager":4,"./core/dispatchRequest":5,"./defaults":6,"./helpers/bind":7,"./helpers/combineURLs":10,"./helpers/isAbsoluteURL":12,"./helpers/spread":15,"./helpers/transformData":16,"./utils":17}],4:[function(t,e,n){"use strict";function r(){this.handlers=[]}var o=t("./../utils");r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},e.exports=r},{"./../utils":17}],5:[function(t,e,n){(function(n){"use strict";e.exports=function(e){return new Promise(function(r,o){try{var i;"function"==typeof e.adapter?i=e.adapter:"undefined"!=typeof XMLHttpRequest?i=t("../adapters/xhr"):"undefined"!=typeof n&&(i=t("../adapters/http")),"function"==typeof i&&i(r,o,e)}catch(s){o(s)}})}}).call(this,t("_process"))},{"../adapters/http":2,"../adapters/xhr":2,_process:24}],6:[function(t,e,n){"use strict";var r=t("./utils"),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};e.exports={transformRequest:[function(t,e){return r.isFormData(t)?t:r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(r.isUndefined(e)||(r.forEach(e,function(t,n){"content-type"===n.toLowerCase()&&(e["Content-Type"]=t)}),r.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(t))}],transformResponse:[function(t){if("string"==typeof t){t=t.replace(o,"");try{t=JSON.parse(t)}catch(e){}}return t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},{"./utils":17}],7:[function(t,e,n){"use strict";e.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r>8-u%1*8)){if(n=o.charCodeAt(u+=.75),n>255)throw new r("INVALID_CHARACTER_ERR: DOM Exception 5");e=e<<8|n}return s}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=o},{}],9:[function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=t("./../utils");e.exports=function(t,e,n){if(!e)return t;var i;if(n)i=n(e);else{var s=[];o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)&&(e+="[]"),o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),s.push(r(e)+"="+r(t))}))}),i=s.join("&")}return i&&(t+=(-1===t.indexOf("?")?"?":"&")+i),t}},{"./../utils":17}],10:[function(t,e,n){"use strict";e.exports=function(t,e){return t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,"")}},{}],11:[function(t,e,n){"use strict";var r=t("./../utils");e.exports=r.isStandardBrowserEnv()?function(){return{write:function(t,e,n,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},{"./../utils":17}],12:[function(t,e,n){"use strict";e.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},{}],13:[function(t,e,n){"use strict";var r=t("./../utils");e.exports=r.isStandardBrowserEnv()?function(){function t(t){var e=t;return n&&(o.setAttribute("href",e),e=o.href),o.setAttribute("href",e),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var e,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return e=t(window.location.href),function(n){var o=r.isString(n)?t(n):n;return o.protocol===e.protocol&&o.host===e.host}}():function(){return function(){return!0}}()},{"./../utils":17}],14:[function(t,e,n){"use strict";var r=t("./../utils");e.exports=function(t){var e,n,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+n:n)}),i):i}},{"./../utils":17}],15:[function(t,e,n){"use strict";e.exports=function(t){return function(e){return t.apply(null,e)}}},{}],16:[function(t,e,n){"use strict";var r=t("./../utils");e.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},{"./../utils":17}],17:[function(t,e,n){"use strict";function r(t){return"[object Array]"===m.call(t)}function o(t){return"[object ArrayBuffer]"===m.call(t)}function i(t){return"[object FormData]"===m.call(t)}function s(t){var e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function u(t){return"string"==typeof t}function a(t){return"number"==typeof t}function f(t){return"undefined"==typeof t}function c(t){return null!==t&&"object"==typeof t}function h(t){return"[object Date]"===m.call(t)}function l(t){return"[object File]"===m.call(t)}function p(t){return"[object Blob]"===m.call(t)}function d(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function y(t,e){if(null!==t&&"undefined"!=typeof t)if("object"==typeof t||r(t)||(t=[t]),r(t))for(var n=0,o=t.length;o>n;n++)e.call(null,t[n],n,t);else for(var i in t)t.hasOwnProperty(i)&&e.call(null,t[i],i,t)}function v(){function t(t,n){"object"==typeof e[n]&&"object"==typeof t?e[n]=v(e[n],t):e[n]=t}for(var e={},n=0,r=arguments.length;r>n;n++)y(arguments[n],t);return e}var m=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:o,isFormData:i,isArrayBufferView:s,isString:u,isNumber:a,isObject:c,isUndefined:f,isDate:h,isFile:l,isBlob:p,isStandardBrowserEnv:g,forEach:y,merge:v,trim:d}},{}],18:[function(e,n,r){(function(e){!function(o){var i="object"==typeof r&&r,s="object"==typeof n&&n&&n.exports==i&&n,u="object"==typeof e&&e;u.global!==u&&u.window!==u||(o=u);var a=function(t){this.message=t};a.prototype=new Error,a.prototype.name="InvalidCharacterError";var f=function(t){throw new a(t)},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=/[\t\n\f\r ]/g,l=function(t){t=String(t).replace(h,"");var e=t.length;e%4==0&&(t=t.replace(/==?$/,""),e=t.length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&f("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,o=0,i="",s=-1;++s>(-2*o&6)));return i},p=function(t){t=String(t),/[^\0-\xFF]/.test(t)&&f("The string to be encoded contains characters outside of the Latin1 range.");for(var e,n,r,o,i=t.length%3,s="",u=-1,a=t.length-i;++u>18&63)+c.charAt(o>>12&63)+c.charAt(o>>6&63)+c.charAt(63&o);return 2==i?(e=t.charCodeAt(u)<<8,n=t.charCodeAt(++u),o=e+n,s+=c.charAt(o>>10)+c.charAt(o>>4&63)+c.charAt(o<<2&63)+"="):1==i&&(o=t.charCodeAt(u),s+=c.charAt(o>>2)+c.charAt(o<<4&63)+"=="),s},d={encode:p,decode:l,version:"0.1.0"};if("function"==typeof t&&"object"==typeof t.amd&&t.amd)t(function(){return d});else if(i&&!i.nodeType)if(s)s.exports=d;else for(var g in d)d.hasOwnProperty(g)&&(i[g]=d[g]);else o.base64=d}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e,n){"use strict";function r(){var t,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=e.length;for(t=0;n>t;t++)a[t]=e[t];for(t=0;n>t;++t)f[e.charCodeAt(t)]=t;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63}function o(t){var e,n,r,o,i,s,u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[u-2]?2:"="===t[u-1]?1:0,s=new c(3*u/4-i),r=i>0?u-4:u;var a=0;for(e=0,n=0;r>e;e+=4,n+=3)o=f[t.charCodeAt(e)]<<18|f[t.charCodeAt(e+1)]<<12|f[t.charCodeAt(e+2)]<<6|f[t.charCodeAt(e+3)],s[a++]=(16711680&o)>>16,s[a++]=(65280&o)>>8,s[a++]=255&o;return 2===i?(o=f[t.charCodeAt(e)]<<2|f[t.charCodeAt(e+1)]>>4,s[a++]=255&o):1===i&&(o=f[t.charCodeAt(e)]<<10|f[t.charCodeAt(e+1)]<<4|f[t.charCodeAt(e+2)]>>2,s[a++]=o>>8&255,s[a++]=255&o),s}function i(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}function s(t,e,n){for(var r,o=[],s=e;n>s;s+=3)r=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(i(r));return o.join("")}function u(t){for(var e,n=t.length,r=n%3,o="",i=[],u=16383,f=0,c=n-r;c>f;f+=u)i.push(s(t,f,f+u>c?c:f+u));return 1===r?(e=t[n-1],o+=a[e>>2],o+=a[e<<4&63],o+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],o+=a[e>>10],o+=a[e>>4&63],o+=a[e<<2&63],o+="="),i.push(o),i.join("")}n.toByteArray=o,n.fromByteArray=u;var a=[],f=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array;r()},{}],20:[function(t,e,n){(function(e){"use strict";function r(){try{var t=new Uint8Array(1);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function o(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t){return this instanceof i?(i.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof t?s(this,t):"string"==typeof t?u(this,t,arguments.length>1?arguments[1]:"utf8"):a(this,t)):arguments.length>1?new i(t,arguments[1]):new i(t)}function s(t,e){if(t=g(t,0>e?0:0|y(e)),!i.TYPED_ARRAY_SUPPORT)for(var n=0;e>n;n++)t[n]=0;return t}function u(t,e,n){"string"==typeof n&&""!==n||(n="utf8");var r=0|m(e,n);return t=g(t,r),t.write(e,n),t}function a(t,e){if(i.isBuffer(e))return f(t,e);if($(e))return c(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return h(t,e);if(e instanceof ArrayBuffer)return l(t,e)}return e.length?p(t,e):d(t,e)}function f(t,e){var n=0|y(e.length);return t=g(t,n),e.copy(t,0,0,n),t}function c(t,e){var n=0|y(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function h(t,e){var n=0|y(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function l(t,e){return e.byteLength,i.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=i.prototype):t=h(t,new Uint8Array(e)),t}function p(t,e){var n=0|y(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function d(t,e){var n,r=0;"Buffer"===e.type&&$(e.data)&&(n=e.data,r=0|y(n.length)),t=g(t,r);for(var o=0;r>o;o+=1)t[o]=255&n[o];return t}function g(t,e){i.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=i.prototype):t.length=e;var n=0!==e&&e<=i.poolSize>>>1;return n&&(t.parent=Z),t}function y(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function v(t,e){if(!(this instanceof v))return new v(t,e);var n=new i(t,e);return delete n.parent,n}function m(t,e){"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return n;case"utf8":case"utf-8":return H(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(t).length;default:if(r)return H(t).length;e=(""+e).toLowerCase(),r=!0}}function w(t,e,n){var r=!1;if(e=0|e,n=void 0===n||n===1/0?this.length:0|n,t||(t="utf8"),0>e&&(e=0),n>this.length&&(n=this.length),e>=n)return"";for(;;)switch(t){case"hex":return I(this,e,n);case"utf8":case"utf-8":return C(this,e,n);case"ascii":return P(this,e,n);case"binary":return x(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function b(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r),r>o&&(r=o)):r=o;var i=e.length;if(i%2!==0)throw new Error("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;r>s;s++){var u=parseInt(e.substr(2*s,2),16);if(isNaN(u))throw new Error("Invalid hex string");t[n+s]=u}return s}function E(t,e,n,r){return V(H(e,t.length-n),t,n,r)}function A(t,e,n,r){return V(F(e),t,n,r)}function T(t,e,n,r){return A(t,e,n,r)}function R(t,e,n,r){return V(X(e),t,n,r)}function _(t,e,n,r){return V(z(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?J.fromByteArray(t):J.fromByteArray(t.slice(e,n))}function C(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;n>o;){var i=t[o],s=null,u=i>239?4:i>223?3:i>191?2:1;if(n>=o+u){var a,f,c,h;switch(u){case 1:128>i&&(s=i);break;case 2:a=t[o+1],128===(192&a)&&(h=(31&i)<<6|63&a,h>127&&(s=h));break;case 3:a=t[o+1],f=t[o+2],128===(192&a)&&128===(192&f)&&(h=(15&i)<<12|(63&a)<<6|63&f,h>2047&&(55296>h||h>57343)&&(s=h));break;case 4:a=t[o+1],f=t[o+2],c=t[o+3],128===(192&a)&&128===(192&f)&&128===(192&c)&&(h=(15&i)<<18|(63&a)<<12|(63&f)<<6|63&c,h>65535&&1114112>h&&(s=h))}}null===s?(s=65533,u=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),o+=u}return U(r)}function U(t){var e=t.length;if(W>=e)return String.fromCharCode.apply(String,t);for(var n="",r=0;e>r;)n+=String.fromCharCode.apply(String,t.slice(r,r+=W));return n}function P(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;n>o;o++)r+=String.fromCharCode(127&t[o]);return r}function x(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;n>o;o++)r+=String.fromCharCode(t[o]);return r}function I(t,e,n){var r=t.length;(!e||0>e)&&(e=0),(!n||0>n||n>r)&&(n=r);for(var o="",i=e;n>i;i++)o+=q(t[i]);return o}function O(t,e,n){for(var r=t.slice(e,n),o="",i=0;it)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,r,o,s){if(!i.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>o||s>e)throw new RangeError("value is out of bounds");if(n+r>t.length)throw new RangeError("index out of range")}function L(t,e,n,r){0>e&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);i>o;o++)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function j(t,e,n,r){0>e&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);i>o;o++)t[n+o]=e>>>8*(r?o:3-o)&255}function Y(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("index out of range");if(0>n)throw new RangeError("index out of range")}function k(t,e,n,r,o){return o||Y(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,n,r,23,4),n+4}function M(t,e,n,r,o){return o||Y(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,n,r,52,8),n+8}function G(t){if(t=N(t).replace(Q,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function N(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return 16>t?"0"+t.toString(16):t.toString(16)}function H(t,e){e=e||1/0;for(var n,r=t.length,o=null,i=[],s=0;r>s;s++){if(n=t.charCodeAt(s),n>55295&&57344>n){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(56320>n){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=(o-55296<<10|n-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,128>n){if((e-=1)<0)break;i.push(n)}else if(2048>n){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(65536>n){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(1114112>n))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function F(t){for(var e=[],n=0;n>8,o=n%256,i.push(o),i.push(r);return i}function X(t){return J.toByteArray(G(t))}function V(t,e,n,r){for(var o=0;r>o&&!(o+n>=e.length||o>=t.length);o++)e[o+n]=t[o];return o}var J=t("base64-js"),K=t("ieee754"),$=t("isarray");n.Buffer=i,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50,i.poolSize=8192;var Z={};i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:r(),i._augment=function(t){return t.__proto__=i.prototype,t},i.TYPED_ARRAY_SUPPORT?(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0})):(i.prototype.length=void 0,i.prototype.parent=void 0),i.isBuffer=function(t){return!(null==t||!t._isBuffer)},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,s=Math.min(n,r);s>o&&t[o]===e[o];)++o;return o!==s&&(n=t[o],r=e[o]),r>n?-1:n>r?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!$(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new i(0);var n;if(void 0===e)for(e=0,n=0;n0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:i.compare(this,t)},i.prototype.indexOf=function(t,e){function n(t,e,n){for(var r=-1,o=0;n+o2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(i.isBuffer(t))return n(this,t,e);if("number"==typeof t)return i.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):n(this,[t],e);throw new TypeError("val must be string, number or Buffer")},i.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(n)?(n=0|n,void 0===r&&(r="utf8")):(r=n,n=void 0);else{var o=r;r=e,e=0|n,n=o}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(0>n||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":return A(this,t,e,n);case"binary":return T(this,t,e,n);case"base64":return R(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var W=4096;i.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),t>e&&(e=t);var r;if(i.TYPED_ARRAY_SUPPORT)r=this.subarray(t,e),r.__proto__=i.prototype;else{var o=e-t;r=new i(o,void 0);for(var s=0;o>s;s++)r[s]=this[s+t]}return r.length&&(r.parent=this.parent||this),r},i.prototype.readUIntLE=function(t,e,n){t=0|t,e=0|e,n||B(t,e,this.length);for(var r=this[t],o=1,i=0;++i0&&(o*=256);)r+=this[t+--e]*o;return r},i.prototype.readUInt8=function(t,e){return e||B(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return e||B(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return e||B(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,n){t=0|t,e=0|e,n||B(t,e,this.length);for(var r=this[t],o=1,i=0;++i=o&&(r-=Math.pow(2,8*e)),r},i.prototype.readIntBE=function(t,e,n){t=0|t,e=0|e,n||B(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){e||B(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(t,e){e||B(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(t,e){return e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return e||B(t,4,this.length),K.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return e||B(t,4,this.length),K.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return e||B(t,8,this.length),K.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return e||B(t,8,this.length),K.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,n,r){t=+t,e=0|e,n=0|n,r||D(this,t,e,n,Math.pow(2,8*n),0);var o=1,i=0;for(this[e]=255&t;++i=0&&(i*=256);)this[e+o]=t/i&255;return e+n},i.prototype.writeUInt8=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,1,255,0),i.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},i.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},i.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},i.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},i.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e=0|e,!r){var o=Math.pow(2,8*n-1);D(this,t,e,n,o-1,-o)}var i=0,s=1,u=0>t?1:0;for(this[e]=255&t;++i>0)-u&255;return e+n},i.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e=0|e,!r){var o=Math.pow(2,8*n-1);D(this,t,e,n,o-1,-o)}var i=n-1,s=1,u=0>t?1:0;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=(t/s>>0)-u&255;return e+n},i.prototype.writeInt8=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,1,127,-128),i.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},i.prototype.writeInt16BE=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},i.prototype.writeInt32LE=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},i.prototype.writeInt32BE=function(t,e,n){return t=+t,e=0|e,n||D(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},i.prototype.writeFloatLE=function(t,e,n){return k(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){return k(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){return M(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){return M(this,t,e,!1,n)},i.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&n>r&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-en&&r>e)for(o=s-1;o>=0;o--)t[o+e]=this[o+n];else if(1e3>s||!i.TYPED_ARRAY_SUPPORT)for(o=0;s>o;o++)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},i.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),e>n)throw new RangeError("end < start");if(n!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>n||n>this.length)throw new RangeError("end out of bounds");var r;if("number"==typeof t)for(r=e;n>r;r++)this[r]=t;else{var o=H(t.toString()),i=o.length;for(r=e;n>r;r++)this[r]=o[r%i]}return this}};var Q=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":19,ieee754:23,isarray:21}],21:[function(t,e,n){var r={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},{}],22:[function(e,n,r){(function(r,o){(function(){"use strict";function i(t){return"function"==typeof t||"object"==typeof t&&null!==t}function s(t){return"function"==typeof t}function u(t){X=t}function a(t){$=t}function f(){return function(){r.nextTick(d)}}function c(){return function(){z(d)}}function h(){var t=0,e=new Q(d),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function l(){var t=new MessageChannel;return t.port1.onmessage=d,function(){t.port2.postMessage(0)}}function p(){return function(){setTimeout(d,1)}}function d(){for(var t=0;K>t;t+=2){var e=nt[t],n=nt[t+1];e(n),nt[t]=void 0,nt[t+1]=void 0}K=0}function g(){try{var t=e,n=t("vertx");return z=n.runOnLoop||n.runOnContext,c()}catch(r){return p()}}function y(t,e){var n=this,r=n._state;if(r===st&&!t||r===ut&&!e)return this;var o=new this.constructor(m),i=n._result;if(r){var s=arguments[r-1];$(function(){D(r,o,s,i)})}else x(n,o,t,e);return o}function v(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(m);return S(n,t),n}function m(){}function w(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function E(t){try{return t.then; +}catch(e){return at.error=e,at}}function A(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function T(t,e,n){$(function(t){var r=!1,o=A(n,e,function(n){r||(r=!0,e!==n?S(t,n):U(t,n))},function(e){r||(r=!0,P(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,P(t,o))},t)}function R(t,e){e._state===st?U(t,e._result):e._state===ut?P(t,e._result):x(e,void 0,function(e){S(t,e)},function(e){P(t,e)})}function _(t,e,n){e.constructor===t.constructor&&n===rt&&constructor.resolve===ot?R(t,e):n===at?P(t,at.error):void 0===n?U(t,e):s(n)?T(t,e,n):U(t,e)}function S(t,e){t===e?P(t,w()):i(e)?_(t,e,E(e)):U(t,e)}function C(t){t._onerror&&t._onerror(t._result),I(t)}function U(t,e){t._state===it&&(t._result=e,t._state=st,0!==t._subscribers.length&&$(I,t))}function P(t,e){t._state===it&&(t._state=ut,t._result=e,$(C,t))}function x(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+st]=n,o[i+ut]=r,0===i&&t._state&&$(I,t)}function I(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;ss;s++)x(r.resolve(t[s]),void 0,e,n);return o}function k(t){var e=this,n=new e(m);return P(n,t),n}function M(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function G(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(t){this._id=pt++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&("function"!=typeof t&&M(),this instanceof N?L(this,t):G())}function q(t,e){this._instanceConstructor=t,this.promise=new t(m),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?U(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&U(this.promise,this._result))):P(this.promise,this._validationError())}function H(){var t;if("undefined"!=typeof o)t=o;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(t.Promise=dt)}var F;F=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var z,X,V,J=F,K=0,$=function(t,e){nt[K]=t,nt[K+1]=e,K+=2,2===K&&(X?X(d):V())},Z="undefined"!=typeof window?window:void 0,W=Z||{},Q=W.MutationObserver||W.WebKitMutationObserver,tt="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);V=tt?f():Q?h():et?l():void 0===Z&&"function"==typeof e?g():p();var rt=y,ot=v,it=void 0,st=1,ut=2,at=new O,ft=new O,ct=j,ht=Y,lt=k,pt=0,dt=N;N.all=ct,N.race=ht,N.resolve=ot,N.reject=lt,N._setScheduler=u,N._setAsap=a,N._asap=$,N.prototype={constructor:N,then:rt,"catch":function(t){return this.then(null,t)}};var gt=q;q.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},q.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===it&&t>n;n++)this._eachEntry(e[n],n)},q.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===ot){var o=E(t);if(o===rt&&t._state!==it)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===dt){var i=new n(m);_(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},q.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===it&&(this._remaining--,t===ut?P(r,n):this._result[e]=n),0===this._remaining&&U(r,this._result)},q.prototype._willSettleAt=function(t,e){var n=this;x(t,void 0,function(t){n._settledAt(st,e,t)},function(t){n._settledAt(ut,e,t)})};var yt=H,vt={Promise:dt,polyfill:yt};"function"==typeof t&&t.amd?t(function(){return vt}):"undefined"!=typeof n&&n.exports?n.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),yt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:24}],23:[function(t,e,n){n.read=function(t,e,n,r,o){var i,s,u=8*o-r-1,a=(1<>1,c=-7,h=n?o-1:0,l=n?-1:1,p=t[e+h];for(h+=l,i=p&(1<<-c)-1,p>>=-c,c+=u;c>0;i=256*i+t[e+h],h+=l,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=r;c>0;s=256*s+t[e+h],h+=l,c-=8);if(0===i)i=1-f;else{if(i===a)return s?NaN:(p?-1:1)*(1/0);s+=Math.pow(2,r),i-=f}return(p?-1:1)*s*Math.pow(2,i-r)},n.write=function(t,e,n,r,o,i){var s,u,a,f=8*i-o-1,c=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),e+=s+h>=1?l/a:l*Math.pow(2,1-h),e*a>=2&&(s++,a/=2),s+h>=c?(u=0,s=c):s+h>=1?(u=(e*a-1)*Math.pow(2,o),s+=h):(u=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[n+p]=255&u,p+=d,u/=256,o-=8);for(s=s<0;t[n+p]=255&s,p+=d,s/=256,f-=8);t[n+p-d]|=128*g}},{}],24:[function(t,e,n){function r(){c=!1,u.length?f=u.concat(f):h=-1,f.length&&o()}function o(){if(!c){var t=setTimeout(r);c=!0;for(var e=f.length;e;){for(u=f,f=[];++h1)for(var n=1;no;)e=t.charCodeAt(o++),e>=55296&&56319>=e&&i>o?(n=t.charCodeAt(o++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--)):r.push(e);return r}function s(t){for(var e,n=t.length,r=-1,o="";++r65535&&(e-=65536,o+=b(e>>>10&1023|55296),e=56320|1023&e),o+=b(e);return o}function u(t){if(t>=55296&&57343>=t)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function a(t,e){return b(t>>e&63|128)}function f(t){if(0==(4294967168&t))return b(t);var e="";return 0==(4294965248&t)?e=b(t>>6&31|192):0==(4294901760&t)?(u(t),e=b(t>>12&15|224),e+=a(t,6)):0==(4292870144&t)&&(e=b(t>>18&7|240),e+=a(t,12),e+=a(t,6)),e+=b(63&t|128)}function c(t){for(var e,n=i(t),r=n.length,o=-1,s="";++o=m)throw Error("Invalid byte index");var t=255&v[w];if(w++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(){var t,e,n,r,o;if(w>m)throw Error("Invalid byte index");if(w==m)return!1;if(t=255&v[w],w++,0==(128&t))return t;if(192==(224&t)){var e=h();if(o=(31&t)<<6|e,o>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&t)){if(e=h(),n=h(),o=(15&t)<<12|e<<6|n,o>=2048)return u(o),o;throw Error("Invalid continuation byte")}if(240==(248&t)&&(e=h(),n=h(),r=h(),o=(15&t)<<18|e<<12|n<<6|r,o>=65536&&1114111>=o))return o;throw Error("Invalid UTF-8 detected")}function p(t){v=i(t),m=v.length,w=0;for(var e,n=[];(e=l())!==!1;)n.push(e);return s(n)}var d="object"==typeof r&&r,g="object"==typeof n&&n&&n.exports==d&&n,y="object"==typeof e&&e;y.global!==y&&y.window!==y||(o=y);var v,m,w,b=String.fromCharCode,E={version:"2.0.0",encode:c,decode:p};if("function"==typeof t&&"object"==typeof t.amd&&t.amd)t(function(){return E});else if(d&&!d.nodeType)if(g)g.exports=E;else{var A={},T=A.hasOwnProperty;for(var R in E)T.call(E,R)&&(d[R]=E[R])}else o.utf8=E}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],26:[function(e,n,r){(function(o){!function(o,i){if("function"==typeof t&&t.amd)t(["module","utf8","axios","base-64","es6-promise"],i);else if("undefined"!=typeof r)i(n,e("utf8"),e("axios"),e("base-64"),e("es6-promise"));else{var s={exports:{}};i(s,o.utf8,o.axios,o.base64,o.Promise),o.github=s.exports}}(this,function(t,e,n,r,i){"use strict";function s(t){return r.encode(e.encode(t))}function u(t){t=t||{};var r=t.apiUrl||"https://api.github.com",i=u._request=function(e,o,i,u,f){function c(){var t=o.indexOf("//")>=0?o:r+o;if(t+=/\?/.test(t)?"&":"?",i&&"object"===("undefined"==typeof i?"undefined":a(i))&&["GET","HEAD","DELETE"].indexOf(e)>-1)for(var n in i)i.hasOwnProperty(n)&&(t+="&"+encodeURIComponent(n)+"="+encodeURIComponent(i[n]));return t.replace(/(×tamp=\d+)/,"")+("undefined"!=typeof window?"×tamp="+(new Date).getTime():"")}var h={headers:{Accept:f?"application/vnd.github.v3.raw+json":"application/vnd.github.v3+json","Content-Type":"application/json;charset=UTF-8"},method:e,data:i?i:{},url:c()};return(t.token||t.username&&t.password)&&(h.headers.Authorization=t.token?"token "+t.token:"Basic "+s(t.username+":"+t.password)),n(h).then(function(t){u(null,t.data||!0,t)},function(t){304===t.status?u(null,t.data||!0,t):u({path:o,request:t,error:t.status})})},f=u._requestAllPages=function(t,e,n){var r=[];!function o(){i("GET",t,null,function(i,s,u){if(i)return n(i);s instanceof Array||(s=[s]),r.push.apply(r,s);var a=(u.headers.link||"").split(",").filter(function(t){return/rel="next"/.test(t)}).map(function(t){return(/<(.*)>/.exec(t)||[])[1]}).pop();!a||e?n(i,r,u):(t=a,o())})}()};return u.User=function(){this.repos=function(t,e){"function"==typeof t&&(e=t,t={}),t=t||{};var n="/user/repos",r=[];r.push("type="+encodeURIComponent(t.type||"all")),r.push("sort="+encodeURIComponent(t.sort||"updated")),r.push("per_page="+encodeURIComponent(t.per_page||"100")),t.page&&r.push("page="+encodeURIComponent(t.page)),n+="?"+r.join("&"),f(n,!!t.page,e)},this.orgs=function(t){i("GET","/user/orgs",null,t)},this.gists=function(t){i("GET","/gists",null,t)},this.notifications=function(t,e){"function"==typeof t&&(e=t,t={}),t=t||{};var n="/notifications",r=[];if(t.all&&r.push("all=true"),t.participating&&r.push("participating=true"),t.since){var o=t.since;o.constructor===Date&&(o=o.toISOString()),r.push("since="+encodeURIComponent(o))}if(t.before){var s=t.before;s.constructor===Date&&(s=s.toISOString()),r.push("before="+encodeURIComponent(s))}t.page&&r.push("page="+encodeURIComponent(t.page)),r.length>0&&(n+="?"+r.join("&")),i("GET",n,null,e)},this.show=function(t,e){var n=t?"/users/"+t:"/user";i("GET",n,null,e)},this.userRepos=function(t,e,n){"function"==typeof e&&(n=e,e={});var r="/users/"+t+"/repos",o=[];o.push("type="+encodeURIComponent(e.type||"all")),o.push("sort="+encodeURIComponent(e.sort||"updated")),o.push("per_page="+encodeURIComponent(e.per_page||"100")),e.page&&o.push("page="+encodeURIComponent(e.page)),r+="?"+o.join("&"),f(r,!!e.page,n)},this.userStarred=function(t,e){var n="/users/"+t+"/starred?type=all&per_page=100";f(n,!1,e)},this.userGists=function(t,e){i("GET","/users/"+t+"/gists",null,e)},this.orgRepos=function(t,e){var n="/orgs/"+t+"/repos?type=all&&page_num=100&sort=updated&direction=desc";f(n,!1,e)},this.follow=function(t,e){i("PUT","/user/following/"+t,null,e)},this.unfollow=function(t,e){i("DELETE","/user/following/"+t,null,e)},this.createRepo=function(t,e){i("POST","/user/repos",t,e)}},u.Repository=function(t){function n(t,e){return t===l.branch&&l.sha?e(null,l.sha):void h.getRef("heads/"+t,function(n,r){l.branch=t,l.sha=r,e(n,r)})}var r,a=t.name,f=t.user,c=t.fullname,h=this;r=c?"/repos/"+c:"/repos/"+f+"/"+a;var l={branch:null,sha:null};this.getRef=function(t,e){i("GET",r+"/git/refs/"+t,null,function(t,n,r){return t?e(t):void e(null,n.object.sha,r)})},this.createRef=function(t,e){i("POST",r+"/git/refs",t,e)},this.deleteRef=function(e,n){i("DELETE",r+"/git/refs/"+e,t,n)},this.deleteRepo=function(e){i("DELETE",r,t,e)},this.listTags=function(t){i("GET",r+"/tags",null,t)},this.listPulls=function(t,e){t=t||{};var n=r+"/pulls",o=[];"string"==typeof t?o.push("state="+t):(t.state&&o.push("state="+encodeURIComponent(t.state)),t.head&&o.push("head="+encodeURIComponent(t.head)),t.base&&o.push("base="+encodeURIComponent(t.base)),t.sort&&o.push("sort="+encodeURIComponent(t.sort)),t.direction&&o.push("direction="+encodeURIComponent(t.direction)),t.page&&o.push("page="+t.page),t.per_page&&o.push("per_page="+t.per_page)),o.length>0&&(n+="?"+o.join("&")),i("GET",n,null,e)},this.getPull=function(t,e){i("GET",r+"/pulls/"+t,null,e)},this.compare=function(t,e,n){i("GET",r+"/compare/"+t+"..."+e,null,n)},this.listBranches=function(t){i("GET",r+"/git/refs/heads",null,function(e,n,r){return e?t(e):(n=n.map(function(t){return t.ref.replace(/^refs\/heads\//,"")}),void t(null,n,r))})},this.getBlob=function(t,e){i("GET",r+"/git/blobs/"+t,null,e,"raw")},this.getCommit=function(t,e,n){i("GET",r+"/git/commits/"+e,null,n)},this.getSha=function(t,e,n){return e&&""!==e?void i("GET",r+"/contents/"+e+(t?"?ref="+t:""),null,function(t,e,r){return t?n(t):void n(null,e.sha,r)}):h.getRef("heads/"+t,n)},this.getStatuses=function(t,e){i("GET",r+"/statuses/"+t,null,e)},this.getTree=function(t,e){i("GET",r+"/git/trees/"+t,null,function(t,n,r){return t?e(t):void e(null,n.tree,r)})},this.postBlob=function(t,n){if("string"==typeof t)t={content:e.encode(t),encoding:"utf-8"};else if("undefined"!=typeof o&&t instanceof o)t={content:t.toString("base64"),encoding:"base64"};else{if(!("undefined"!=typeof Blob&&t instanceof Blob))throw new Error("Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)");t={content:s(t),encoding:"base64"}}i("POST",r+"/git/blobs",t,function(t,e,r){return t?n(t):void n(null,e.sha,r)})},this.updateTree=function(t,e,n,o){var s={base_tree:t,tree:[{path:e,mode:"100644",type:"blob",sha:n}]};i("POST",r+"/git/trees",s,function(t,e,n){return t?o(t):void o(null,e.sha,n)})},this.postTree=function(t,e){i("POST",r+"/git/trees",{tree:t},function(t,n,r){return t?e(t):void e(null,n.sha,r)})},this.commit=function(e,n,o,s){var a=new u.User;a.show(null,function(u,a){if(u)return s(u);var f={message:o,author:{name:t.user,email:a.email},parents:[e],tree:n};i("POST",r+"/git/commits",f,function(t,e,n){return t?s(t):(l.sha=e.sha,void s(null,e.sha,n))})})},this.updateHead=function(t,e,n){i("PATCH",r+"/git/refs/heads/"+t,{sha:e},n)},this.show=function(t){i("GET",r,null,t)},this.contributors=function(t,e){e=e||1e3;var n=this;i("GET",r+"/stats/contributors",null,function(r,o,i){return r?t(r):void(202===i.status?setTimeout(function(){n.contributors(t,e)},e):t(r,o,i))})},this.contents=function(t,e,n){e=encodeURI(e),i("GET",r+"/contents"+(e?"/"+e:""),{ref:t},n)},this.fork=function(t){i("POST",r+"/forks",null,t)},this.listForks=function(t){i("GET",r+"/forks",null,t)},this.branch=function(t,e,n){2===arguments.length&&"function"==typeof arguments[1]&&(n=e,e=t,t="master"),this.getRef("heads/"+t,function(t,r){return t&&n?n(t):void h.createRef({ref:"refs/heads/"+e,sha:r},n)})},this.createPullRequest=function(t,e){i("POST",r+"/pulls",t,e)},this.listHooks=function(t){i("GET",r+"/hooks",null,t)},this.getHook=function(t,e){i("GET",r+"/hooks/"+t,null,e)},this.createHook=function(t,e){i("POST",r+"/hooks",t,e)},this.editHook=function(t,e,n){i("PATCH",r+"/hooks/"+t,e,n)},this.deleteHook=function(t,e){i("DELETE",r+"/hooks/"+t,null,e)},this.read=function(t,e,n){i("GET",r+"/contents/"+encodeURI(e)+(t?"?ref="+t:""),null,n,!0)},this.remove=function(t,e,n){h.getSha(t,e,function(o,s){return o?n(o):void i("DELETE",r+"/contents/"+e,{message:e+" is removed",sha:s,branch:t},n)})},this["delete"]=this.remove,this.move=function(t,e,r,o){n(t,function(n,i){h.getTree(i+"?recursive=true",function(n,s){s.forEach(function(t){t.path===e&&(t.path=r),"tree"===t.type&&delete t.sha}),h.postTree(s,function(n,r){h.commit(i,r,"Deleted "+e,function(e,n){h.updateHead(t,n,o)})})})})},this.write=function(t,e,n,o,u,a){"function"==typeof u&&(a=u,u={}),h.getSha(t,encodeURI(e),function(f,c){var h={message:o,content:"undefined"==typeof u.encode||u.encode?s(n):n,branch:t,committer:u&&u.committer?u.committer:void 0,author:u&&u.author?u.author:void 0};f&&404!==f.error||(h.sha=c),i("PUT",r+"/contents/"+encodeURI(e),h,a)})},this.getCommits=function(t,e){t=t||{};var n=r+"/commits",o=[];if(t.sha&&o.push("sha="+encodeURIComponent(t.sha)),t.path&&o.push("path="+encodeURIComponent(t.path)),t.author&&o.push("author="+encodeURIComponent(t.author)),t.since){var s=t.since;s.constructor===Date&&(s=s.toISOString()),o.push("since="+encodeURIComponent(s))}if(t.until){var u=t.until;u.constructor===Date&&(u=u.toISOString()),o.push("until="+encodeURIComponent(u))}t.page&&o.push("page="+t.page),t.perpage&&o.push("per_page="+t.perpage),o.length>0&&(n+="?"+o.join("&")),i("GET",n,null,e)},this.isStarred=function(t,e,n){i("GET","/user/starred/"+t+"/"+e,null,n)},this.star=function(t,e,n){i("PUT","/user/starred/"+t+"/"+e,null,n)},this.unstar=function(t,e,n){i("DELETE","/user/starred/"+t+"/"+e,null,n)},this.createRelease=function(t,e){i("POST",r+"/releases",t,e)},this.editRelease=function(t,e,n){i("PATCH",r+"/releases/"+t,e,n)},this.getRelease=function(t,e){i("GET",r+"/releases/"+t,null,e)},this.deleteRelease=function(t,e){i("DELETE",r+"/releases/"+t,null,e)}},u.Gist=function(t){var e=t.id,n="/gists/"+e;this.read=function(t){i("GET",n,null,t)},this.create=function(t,e){i("POST","/gists",t,e)},this["delete"]=function(t){i("DELETE",n,null,t)},this.fork=function(t){i("POST",n+"/fork",null,t)},this.update=function(t,e){i("PATCH",n,t,e)},this.star=function(t){i("PUT",n+"/star",null,t)},this.unstar=function(t){i("DELETE",n+"/star",null,t)},this.isStarred=function(t){i("GET",n+"/star",null,t)}},u.Issue=function(t){var e="/repos/"+t.user+"/"+t.repo+"/issues";this.create=function(t,n){i("POST",e,t,n)},this.list=function(t,n){var r=[];Object.keys(t).forEach(function(e){r.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]))}),f(e+"?"+r.join("&"),!!t.page,n)},this.comment=function(t,e,n){i("POST",t.comments_url,{body:e},n)},this.edit=function(t,n,r){i("PATCH",e+"/"+t,n,r)},this.get=function(t,n){i("GET",e+"/"+t,null,n)}},u.Search=function(t){var e="/search/",n="?q="+t.query;this.repositories=function(t,r){i("GET",e+"repositories"+n,t,r)},this.code=function(t,r){i("GET",e+"code"+n,t,r)},this.issues=function(t,r){i("GET",e+"issues"+n,t,r)},this.users=function(t,r){i("GET",e+"users"+n,t,r)}},u.RateLimit=function(){this.getRateLimit=function(t){i("GET","/rate_limit",null,t)}},u}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};i.polyfill&&i.polyfill(),u.getIssues=function(t,e){return new u.Issue({user:t,repo:e})},u.getRepo=function(t,e){return e?new u.Repository({user:t,name:e}):new u.Repository({fullname:t})},u.getUser=function(){return new u.User},u.getGist=function(t){return new u.Gist({id:t})},u.getSearch=function(t){return new u.Search({query:t})},u.getRateLimit=function(){return new u.RateLimit},t.exports=u})}).call(this,e("buffer").Buffer)},{axios:1,"base-64":18,buffer:20,"es6-promise":22,utf8:25}]},{},[26])(26)}); +//# sourceMappingURL=github.bundle.min.js.map diff --git a/dist/github.bundle.min.js.map b/dist/github.bundle.min.js.map new file mode 100644 index 00000000..1e78aff2 --- /dev/null +++ b/dist/github.bundle.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["node_modules/browser-pack/_prelude.js","node_modules/axios/index.js","github.js","node_modules/axios/lib/adapters/xhr.js","node_modules/axios/lib/axios.js","node_modules/axios/lib/core/InterceptorManager.js","node_modules/axios/lib/core/dispatchRequest.js","node_modules/axios/lib/defaults.js","node_modules/axios/lib/helpers/bind.js","node_modules/axios/lib/helpers/btoa.js","node_modules/axios/lib/helpers/buildURL.js","node_modules/axios/lib/helpers/combineURLs.js","node_modules/axios/lib/helpers/cookies.js","node_modules/axios/lib/helpers/isAbsoluteURL.js","node_modules/axios/lib/helpers/isURLSameOrigin.js","node_modules/axios/lib/helpers/parseHeaders.js","node_modules/axios/lib/helpers/spread.js","node_modules/axios/lib/helpers/transformData.js","node_modules/axios/lib/utils.js","node_modules/base-64/base64.js","node_modules/base64-js/lib/b64.js","node_modules/buffer/index.js","node_modules/buffer/node_modules/isarray/index.js","node_modules/es6-promise/dist/es6-promise.js","node_modules/ieee754/index.js","node_modules/process/browser.js","node_modules/utf8/utf8.js","src/github.js"],"names":["f","exports","module","define","amd","g","window","global","self","this","Github","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length",1,"./lib/axios",2,"utils","buildURL","parseHeaders","transformData","isURLSameOrigin","btoa","resolve","reject","config","requestData","data","requestHeaders","headers","isFormData","request","XMLHttpRequest","XDomainRequest","url","auth","username","password","Authorization","open","method","toUpperCase","params","paramsSerializer","timeout","onload","responseHeaders","getAllResponseHeaders","responseData","indexOf","responseType","responseText","response","transformResponse","status","statusText","onerror","isStandardBrowserEnv","cookies","xsrfValue","withCredentials","read","xsrfCookieName","undefined","xsrfHeaderName","forEach","val","key","toLowerCase","setRequestHeader","isArrayBuffer","DataView","send","./../helpers/btoa","./../helpers/buildURL","./../helpers/cookies","./../helpers/isURLSameOrigin","./../helpers/parseHeaders","./../helpers/transformData","./../utils",3,"Axios","defaultConfig","defaults","merge","interceptors","InterceptorManager","dispatchRequest","isAbsoluteURL","combineURLs","bind","prototype","arguments","baseURL","transformRequest","common","chain","promise","Promise","interceptor","unshift","fulfilled","rejected","push","then","shift","defaultInstance","axios","create","all","promises","spread","./core/InterceptorManager","./core/dispatchRequest","./defaults","./helpers/bind","./helpers/combineURLs","./helpers/isAbsoluteURL","./helpers/spread","./helpers/transformData","./utils",4,"handlers","use","eject","id","fn","h",5,"process","adapter","../adapters/http","../adapters/xhr","_process",6,"PROTECTION_PREFIX","DEFAULT_CONTENT_TYPE","Content-Type","isArrayBufferView","buffer","isObject","isFile","isBlob","isUndefined","JSON","stringify","replace","parse","Accept","patch","post","put",7,"thisArg","args","Array","apply",8,"InvalidCharacterError","message","input","block","charCode","str","String","output","idx","map","chars","charAt","charCodeAt","name",9,"encode","encodeURIComponent","serializedParams","parts","isArray","v","isDate","toISOString","join",10,"relativeURL",11,"write","value","expires","path","domain","secure","cookie","isNumber","Date","toGMTString","isString","document","match","RegExp","decodeURIComponent","remove","now",12,"test",13,"resolveURL","href","msie","urlParsingNode","setAttribute","protocol","host","search","hash","hostname","port","pathname","originURL","navigator","userAgent","createElement","location","requestURL","parsed",14,"split","line","trim","substr",15,"callback","arr",16,"fns",17,"toString","result","ArrayBuffer","isView","obj","hasOwnProperty","assignValue","Object",18,"root","freeExports","freeModule","freeGlobal","error","TABLE","REGEX_SPACE_CHARACTERS","decode","bitStorage","bitCounter","position","fromCharCode","b","c","padding","base64","version","nodeType",19,"init","len","lookup","revLookup","toByteArray","b64","j","tmp","placeHolders","Arr","L","tripletToBase64","num","encodeChunk","uint8","start","end","fromByteArray","extraBytes","maxChunkLength","len2","Uint8Array",20,"typedArraySupport","foo","subarray","byteLength","kMaxLength","Buffer","TYPED_ARRAY_SUPPORT","arg","parent","fromNumber","fromString","fromObject","that","allocate","checked","string","encoding","object","isBuffer","fromBuffer","fromArray","TypeError","fromTypedArray","fromArrayBuffer","fromArrayLike","fromJsonObject","copy","array","__proto__","type","fromPool","poolSize","rootParent","RangeError","SlowBuffer","subject","buf","loweredCase","utf8ToBytes","base64ToBytes","slowToString","Infinity","hexSlice","utf8Slice","asciiSlice","binarySlice","base64Slice","utf16leSlice","hexWrite","offset","Number","remaining","strLen","parseInt","isNaN","utf8Write","blitBuffer","asciiWrite","asciiToBytes","binaryWrite","base64Write","ucs2Write","utf16leToBytes","slice","Math","min","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","decodeCodePointsArray","codePoints","MAX_ARGUMENTS_LENGTH","ret","out","toHex","bytes","checkOffset","ext","checkInt","max","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","ieee754","writeDouble","base64clean","stringtrim","INVALID_BASE64_RE","units","leadSurrogate","byteArray","hi","lo","src","dst","INSPECT_MAX_BYTES","_augment","Symbol","species","defineProperty","configurable","_isBuffer","compare","x","y","isEncoding","concat","list","pos","item","equals","inspect","byteOffset","arrayIndexOf","foundIndex","isFinite","swap","toJSON","_arr","newBuf","sliceLen","readUIntLE","mul","readUIntBE","readUInt8","readUInt16LE","readUInt16BE","readUInt32LE","readUInt32BE","readIntLE","pow","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","writeUIntBE","writeUInt8","floor","writeUInt16LE","writeUInt16BE","writeUInt32LE","writeUInt32BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","target","targetStart","set","fill","base64-js","isarray",21,22,"lib$es6$promise$utils$$objectOrFunction","lib$es6$promise$utils$$isFunction","lib$es6$promise$asap$$setScheduler","scheduleFn","lib$es6$promise$asap$$customSchedulerFn","lib$es6$promise$asap$$setAsap","asapFn","lib$es6$promise$asap$$asap","lib$es6$promise$asap$$useNextTick","nextTick","lib$es6$promise$asap$$flush","lib$es6$promise$asap$$useVertxTimer","lib$es6$promise$asap$$vertxNext","lib$es6$promise$asap$$useMutationObserver","iterations","observer","lib$es6$promise$asap$$BrowserMutationObserver","node","createTextNode","observe","characterData","lib$es6$promise$asap$$useMessageChannel","channel","MessageChannel","port1","onmessage","port2","postMessage","lib$es6$promise$asap$$useSetTimeout","setTimeout","lib$es6$promise$asap$$len","lib$es6$promise$asap$$queue","lib$es6$promise$asap$$attemptVertx","vertx","runOnLoop","runOnContext","lib$es6$promise$then$$then","onFulfillment","onRejection","state","_state","lib$es6$promise$$internal$$FULFILLED","lib$es6$promise$$internal$$REJECTED","child","constructor","lib$es6$promise$$internal$$noop","_result","lib$es6$promise$$internal$$invokeCallback","lib$es6$promise$$internal$$subscribe","lib$es6$promise$promise$resolve$$resolve","Constructor","lib$es6$promise$$internal$$resolve","lib$es6$promise$$internal$$selfFulfillment","lib$es6$promise$$internal$$cannotReturnOwn","lib$es6$promise$$internal$$getThen","lib$es6$promise$$internal$$GET_THEN_ERROR","lib$es6$promise$$internal$$tryThen","fulfillmentHandler","rejectionHandler","lib$es6$promise$$internal$$handleForeignThenable","thenable","sealed","lib$es6$promise$$internal$$fulfill","reason","lib$es6$promise$$internal$$reject","_label","lib$es6$promise$$internal$$handleOwnThenable","lib$es6$promise$$internal$$handleMaybeThenable","maybeThenable","lib$es6$promise$then$$default","lib$es6$promise$promise$resolve$$default","lib$es6$promise$$internal$$publishRejection","_onerror","lib$es6$promise$$internal$$publish","lib$es6$promise$$internal$$PENDING","_subscribers","subscribers","settled","detail","lib$es6$promise$$internal$$ErrorObject","lib$es6$promise$$internal$$tryCatch","lib$es6$promise$$internal$$TRY_CATCH_ERROR","succeeded","failed","hasCallback","lib$es6$promise$$internal$$initializePromise","resolver","lib$es6$promise$promise$all$$all","entries","lib$es6$promise$enumerator$$default","lib$es6$promise$promise$race$$race","lib$es6$promise$utils$$isArray","lib$es6$promise$promise$reject$$reject","lib$es6$promise$promise$$needsResolver","lib$es6$promise$promise$$needsNew","lib$es6$promise$promise$$Promise","_id","lib$es6$promise$promise$$counter","lib$es6$promise$enumerator$$Enumerator","_instanceConstructor","_input","_remaining","_enumerate","_validationError","lib$es6$promise$polyfill$$polyfill","local","Function","P","cast","lib$es6$promise$promise$$default","lib$es6$promise$utils$$_isArray","lib$es6$promise$asap$$scheduleFlush","lib$es6$promise$asap$$browserWindow","lib$es6$promise$asap$$browserGlobal","MutationObserver","WebKitMutationObserver","lib$es6$promise$asap$$isNode","lib$es6$promise$asap$$isWorker","Uint8ClampedArray","importScripts","lib$es6$promise$promise$all$$default","lib$es6$promise$promise$race$$default","lib$es6$promise$promise$reject$$default","race","_setScheduler","_setAsap","_asap","catch","_eachEntry","entry","_settledAt","_willSettleAt","enumerator","lib$es6$promise$polyfill$$default","lib$es6$promise$umd$$ES6Promise","polyfill",23,"isLE","mLen","nBytes","m","eLen","eMax","eBias","nBits","d","NaN","rt","abs","log","LN2",24,"cleanUpNextTick","draining","currentQueue","queue","queueIndex","drainQueue","run","clearTimeout","Item","fun","noop","title","browser","env","argv","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","binding","cwd","chdir","dir","umask",25,"ucs2decode","extra","counter","ucs2encode","index","stringFromCharCode","checkScalarValue","createByte","encodeCodePoint","symbol","utf8encode","byteString","readContinuationByte","byteIndex","byteCount","continuationByte","decodeSymbol","byte1","byte2","byte3","byte4","utf8decode","utf8",26,"factory","mod","github","Utf8","Base64","b64encode","options","API_URL","apiUrl","_request","cb","raw","getURL","_typeof","param","getTime","token","_requestAllPages","singlePage","results","iterate","err","xhr","next","link","filter","exec","pop","User","repos","sort","per_page","page","orgs","gists","notifications","participating","since","before","show","command","userRepos","userStarred","userGists","orgRepos","orgname","follow","unfollow","createRepo","Repository","updateTree","branch","currentTree","sha","getRef","repoPath","repo","user","fullname","ref","createRef","deleteRef","deleteRepo","listTags","listPulls","head","base","direction","getPull","number","listBranches","heads","getBlob","getCommit","getSha","pathContent","getStatuses","getTree","tree","postBlob","content","Blob","baseTree","blob","base_tree","mode","postTree","commit","userData","author","email","parents","updateHead","contributors","retry","contents","encodeURI","fork","listForks","oldBranch","newBranch","createPullRequest","listHooks","getHook","createHook","editHook","deleteHook","move","newPath","latestCommit","rootTree","writeOptions","committer","getCommits","until","perpage","isStarred","owner","repository","star","unstar","createRelease","editRelease","getRelease","deleteRelease","Gist","gistPath","update","Issue","query","keys","option","comment","issue","comments_url","body","edit","get","Search","repositories","issues","users","RateLimit","getRateLimit","iterator","getIssues","getRepo","getUser","getGist","getSearch","base-64","es6-promise"],"mappings":"CAAA,SAAAA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AIV/H,EAAOozB,UAAY,SAAUpB,GAC1B,MAAO,IAAIhyB,GAAOyyB,QACfT,MAAOA,KAIbhyB,EAAO8yB,aAAe,WACnB,MAAO,IAAI9yB,GAAO6yB,WAGxBrzB,EAAOD,QAAUS,MzBwkIdc,KAAKf,KAAKU,EAAQ,UAAU4R,UAE5BxL,MAAQ,EAAEwsB,UAAU,GAAGxqB,OAAS,GAAGyqB,cAAc,GAAGzJ,KAAO,UAAU,KAAK","file":"github.bundle.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o= 200 && response.status < 300) ||\n (!('status' in request) && response.responseText) ?\n resolve :\n reject)(response);\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new Error('Network Error'));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = require('./../helpers/cookies');\n\n // Add xsrf header\n var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n if (request.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n if (utils.isArrayBuffer(requestData)) {\n requestData = new DataView(requestData);\n }\n\n // Send the request\n request.send(requestData);\n};\n\n},{\"./../helpers/btoa\":8,\"./../helpers/buildURL\":9,\"./../helpers/cookies\":11,\"./../helpers/isURLSameOrigin\":13,\"./../helpers/parseHeaders\":14,\"./../helpers/transformData\":16,\"./../utils\":17}],3:[function(require,module,exports){\n'use strict';\n\nvar defaults = require('./defaults');\nvar utils = require('./utils');\nvar dispatchRequest = require('./core/dispatchRequest');\nvar InterceptorManager = require('./core/InterceptorManager');\nvar isAbsoluteURL = require('./helpers/isAbsoluteURL');\nvar combineURLs = require('./helpers/combineURLs');\nvar bind = require('./helpers/bind');\nvar transformData = require('./helpers/transformData');\n\nfunction Axios(defaultConfig) {\n this.defaults = utils.merge({}, defaultConfig);\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = utils.merge({\n url: arguments[0]\n }, arguments[1]);\n }\n\n config = utils.merge(defaults, this.defaults, { method: 'get' }, config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Don't allow overriding defaults.withCredentials\n config.withCredentials = config.withCredentials || this.defaults.withCredentials;\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nvar defaultInstance = new Axios(defaults);\nvar axios = module.exports = bind(Axios.prototype.request, defaultInstance);\n\naxios.create = function create(defaultConfig) {\n return new Axios(defaultConfig);\n};\n\n// Expose defaults\naxios.defaults = defaultInstance.defaults;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose interceptors\naxios.interceptors = defaultInstance.interceptors;\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n axios[method] = bind(Axios.prototype[method], defaultInstance);\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n axios[method] = bind(Axios.prototype[method], defaultInstance);\n});\n\n},{\"./core/InterceptorManager\":4,\"./core/dispatchRequest\":5,\"./defaults\":6,\"./helpers/bind\":7,\"./helpers/combineURLs\":10,\"./helpers/isAbsoluteURL\":12,\"./helpers/spread\":15,\"./helpers/transformData\":16,\"./utils\":17}],4:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n\n},{\"./../utils\":17}],5:[function(require,module,exports){\n(function (process){\n'use strict';\n\n/**\n * Dispatch a request to the server using whichever adapter\n * is supported by the current environment.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n return new Promise(function executor(resolve, reject) {\n try {\n var adapter;\n\n if (typeof config.adapter === 'function') {\n // For custom adapter support\n adapter = config.adapter;\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('../adapters/xhr');\n } else if (typeof process !== 'undefined') {\n // For node use HTTP adapter\n adapter = require('../adapters/http');\n }\n\n if (typeof adapter === 'function') {\n adapter(resolve, reject, config);\n }\n } catch (e) {\n reject(e);\n }\n });\n};\n\n\n}).call(this,require('_process'))\n\n},{\"../adapters/http\":2,\"../adapters/xhr\":2,\"_process\":24}],6:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\n\nvar PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nmodule.exports = {\n transformRequest: [function transformResponseJSON(data, headers) {\n if (utils.isFormData(data)) {\n return data;\n }\n if (utils.isArrayBuffer(data)) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {\n // Set application/json if no Content-Type has been specified\n if (!utils.isUndefined(headers)) {\n utils.forEach(headers, function processContentTypeHeader(val, key) {\n if (key.toLowerCase() === 'content-type') {\n headers['Content-Type'] = val;\n }\n });\n\n if (utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = 'application/json;charset=utf-8';\n }\n }\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponseJSON(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n data = data.replace(PROTECTION_PREFIX, '');\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n },\n patch: utils.merge(DEFAULT_CONTENT_TYPE),\n post: utils.merge(DEFAULT_CONTENT_TYPE),\n put: utils.merge(DEFAULT_CONTENT_TYPE)\n },\n\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN'\n};\n\n},{\"./utils\":17}],7:[function(require,module,exports){\n'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\n// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\nInvalidCharacterError.prototype = new Error;\nInvalidCharacterError.prototype.code = 5;\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction btoa(input) {\n var str = String(input);\n var output = '';\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars;\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3 / 4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');\n }\n block = block << 8 | charCode;\n }\n return output;\n}\n\nmodule.exports = btoa;\n\n},{}],9:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n }\n\n if (!utils.isArray(val)) {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n\n},{\"./../utils\":17}],10:[function(require,module,exports){\n'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '');\n};\n\n},{}],11:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n\n},{\"./../utils\":17}],12:[function(require,module,exports){\n'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n\n},{}],13:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n\n},{\"./../utils\":17}],14:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n\n},{\"./../utils\":17}],15:[function(require,module,exports){\n'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n\n},{}],16:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n\n},{\"./../utils\":17}],17:[function(require,module,exports){\n'use strict';\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return toString.call(val) === '[object FormData]';\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * typeof document.createElement -> undefined\n */\nfunction isStandardBrowserEnv() {\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined' &&\n typeof document.createElement === 'function'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object' && !isArray(obj)) {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n trim: trim\n};\n\n},{}],18:[function(require,module,exports){\n(function (global){\n/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */\n;(function(root) {\n\n\t// Detect free variables `exports`.\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`.\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code, and use\n\t// it as `root`.\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar InvalidCharacterError = function(message) {\n\t\tthis.message = message;\n\t};\n\tInvalidCharacterError.prototype = new Error;\n\tInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n\tvar error = function(message) {\n\t\t// Note: the error messages used throughout this file match those used by\n\t\t// the native `atob`/`btoa` implementation in Chromium.\n\t\tthrow new InvalidCharacterError(message);\n\t};\n\n\tvar TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\t// http://whatwg.org/html/common-microsyntaxes.html#space-character\n\tvar REGEX_SPACE_CHARACTERS = /[\\t\\n\\f\\r ]/g;\n\n\t// `decode` is designed to be fully compatible with `atob` as described in the\n\t// HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob\n\t// The optimized base64-decoding algorithm used is based on @atk’s excellent\n\t// implementation. https://gist.github.com/atk/1020396\n\tvar decode = function(input) {\n\t\tinput = String(input)\n\t\t\t.replace(REGEX_SPACE_CHARACTERS, '');\n\t\tvar length = input.length;\n\t\tif (length % 4 == 0) {\n\t\t\tinput = input.replace(/==?$/, '');\n\t\t\tlength = input.length;\n\t\t}\n\t\tif (\n\t\t\tlength % 4 == 1 ||\n\t\t\t// http://whatwg.org/C#alphanumeric-ascii-characters\n\t\t\t/[^+a-zA-Z0-9/]/.test(input)\n\t\t) {\n\t\t\terror(\n\t\t\t\t'Invalid character: the string to be decoded is not correctly encoded.'\n\t\t\t);\n\t\t}\n\t\tvar bitCounter = 0;\n\t\tvar bitStorage;\n\t\tvar buffer;\n\t\tvar output = '';\n\t\tvar position = -1;\n\t\twhile (++position < length) {\n\t\t\tbuffer = TABLE.indexOf(input.charAt(position));\n\t\t\tbitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;\n\t\t\t// Unless this is the first of a group of 4 characters…\n\t\t\tif (bitCounter++ % 4) {\n\t\t\t\t// …convert the first 8 bits to a single ASCII character.\n\t\t\t\toutput += String.fromCharCode(\n\t\t\t\t\t0xFF & bitStorage >> (-2 * bitCounter & 6)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t};\n\n\t// `encode` is designed to be fully compatible with `btoa` as described in the\n\t// HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa\n\tvar encode = function(input) {\n\t\tinput = String(input);\n\t\tif (/[^\\0-\\xFF]/.test(input)) {\n\t\t\t// Note: no need to special-case astral symbols here, as surrogates are\n\t\t\t// matched, and the input is supposed to only contain ASCII anyway.\n\t\t\terror(\n\t\t\t\t'The string to be encoded contains characters outside of the ' +\n\t\t\t\t'Latin1 range.'\n\t\t\t);\n\t\t}\n\t\tvar padding = input.length % 3;\n\t\tvar output = '';\n\t\tvar position = -1;\n\t\tvar a;\n\t\tvar b;\n\t\tvar c;\n\t\tvar d;\n\t\tvar buffer;\n\t\t// Make sure any padding is handled outside of the loop.\n\t\tvar length = input.length - padding;\n\n\t\twhile (++position < length) {\n\t\t\t// Read three bytes, i.e. 24 bits.\n\t\t\ta = input.charCodeAt(position) << 16;\n\t\t\tb = input.charCodeAt(++position) << 8;\n\t\t\tc = input.charCodeAt(++position);\n\t\t\tbuffer = a + b + c;\n\t\t\t// Turn the 24 bits into four chunks of 6 bits each, and append the\n\t\t\t// matching character for each of them to the output.\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 18 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer >> 12 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer >> 6 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer & 0x3F)\n\t\t\t);\n\t\t}\n\n\t\tif (padding == 2) {\n\t\t\ta = input.charCodeAt(position) << 8;\n\t\t\tb = input.charCodeAt(++position);\n\t\t\tbuffer = a + b;\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 10) +\n\t\t\t\tTABLE.charAt((buffer >> 4) & 0x3F) +\n\t\t\t\tTABLE.charAt((buffer << 2) & 0x3F) +\n\t\t\t\t'='\n\t\t\t);\n\t\t} else if (padding == 1) {\n\t\t\tbuffer = input.charCodeAt(position);\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 2) +\n\t\t\t\tTABLE.charAt((buffer << 4) & 0x3F) +\n\t\t\t\t'=='\n\t\t\t);\n\t\t}\n\n\t\treturn output;\n\t};\n\n\tvar base64 = {\n\t\t'encode': encode,\n\t\t'decode': decode,\n\t\t'version': '0.1.0'\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn base64;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = base64;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (var key in base64) {\n\t\t\t\tbase64.hasOwnProperty(key) && (freeExports[key] = base64[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.base64 = base64;\n\t}\n\n}(this));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}],19:[function(require,module,exports){\n'use strict'\n\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nfunction init () {\n var i\n var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n var len = code.length\n\n for (i = 0; i < len; i++) {\n lookup[i] = code[i]\n }\n\n for (i = 0; i < len; ++i) {\n revLookup[code.charCodeAt(i)] = i\n }\n revLookup['-'.charCodeAt(0)] = 62\n revLookup['_'.charCodeAt(0)] = 63\n}\n\ninit()\n\nfunction toByteArray (b64) {\n var i, j, l, tmp, placeHolders, arr\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n\n // base64 is 4/3 + up to two characters of the original data\n arr = new Arr(len * 3 / 4 - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0, j = 0; i < l; i += 4, j += 3) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp & 0xFF0000) >> 16\n arr[L++] = (tmp & 0xFF00) >> 8\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n\n},{}],20:[function(require,module,exports){\n(function (global){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.foo = function () { return 42 }\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\nfunction Buffer (arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1) return new Buffer(arg, arguments[1])\n return new Buffer(arg)\n }\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0\n this.parent = undefined\n }\n\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg)\n }\n\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n }\n\n // Unusual.\n return fromObject(this, arg)\n}\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction fromNumber (that, length) {\n that = allocate(that, length < 0 ? 0 : checked(length) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < length; i++) {\n that[i] = 0\n }\n }\n return that\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'\n\n // Assumption: byteLength() return value is always < kMaxLength.\n var length = byteLength(string, encoding) | 0\n that = allocate(that, length)\n\n that.write(string, encoding)\n return that\n}\n\nfunction fromObject (that, object) {\n if (Buffer.isBuffer(object)) return fromBuffer(that, object)\n\n if (isArray(object)) return fromArray(that, object)\n\n if (object == null) {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (typeof ArrayBuffer !== 'undefined') {\n if (object.buffer instanceof ArrayBuffer) {\n return fromTypedArray(that, object)\n }\n if (object instanceof ArrayBuffer) {\n return fromArrayBuffer(that, object)\n }\n }\n\n if (object.length) return fromArrayLike(that, object)\n\n return fromJsonObject(that, object)\n}\n\nfunction fromBuffer (that, buffer) {\n var length = checked(buffer.length) | 0\n that = allocate(that, length)\n buffer.copy(that, 0, 0, length)\n return that\n}\n\nfunction fromArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Duplicate of fromArray() to keep fromArray() monomorphic.\nfunction fromTypedArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(array)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromTypedArray(that, new Uint8Array(array))\n }\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.\n// Returns a zero-length buffer for inputs that don't conform to the spec.\nfunction fromJsonObject (that, object) {\n var array\n var length = 0\n\n if (object.type === 'Buffer' && isArray(object.data)) {\n array = object.data\n length = checked(array.length) | 0\n }\n that = allocate(that, length)\n\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n} else {\n // pre-set for values that may exist in the future\n Buffer.prototype.length = undefined\n Buffer.prototype.parent = undefined\n}\n\nfunction allocate (that, length) {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that.length = length\n }\n\n var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1\n if (fromPool) that.parent = rootParent\n\n return that\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (subject, encoding) {\n if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n var buf = new Buffer(subject, encoding)\n delete buf.parent\n return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n var i = 0\n var len = Math.min(x, y)\n while (i < len) {\n if (a[i] !== b[i]) break\n\n ++i\n }\n\n if (i !== len) {\n x = a[i]\n y = b[i]\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'binary':\n case 'base64':\n case 'raw':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n if (list.length === 0) {\n return new Buffer(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; i++) {\n length += list[i].length\n }\n }\n\n var buf = new Buffer(length)\n var pos = 0\n for (i = 0; i < list.length; i++) {\n var item = list[i]\n item.copy(buf, pos)\n pos += item.length\n }\n return buf\n}\n\nfunction byteLength (string, encoding) {\n if (typeof string !== 'string') string = '' + string\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'binary':\n // Deprecated\n case 'raw':\n case 'raws':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n start = start | 0\n end = end === undefined || end === Infinity ? this.length : end | 0\n\n if (!encoding) encoding = 'utf8'\n if (start < 0) start = 0\n if (end > this.length) end = this.length\n if (end <= start) return ''\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'binary':\n return binarySlice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return 0\n return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n byteOffset >>= 0\n\n if (this.length === 0) return -1\n if (byteOffset >= this.length) return -1\n\n // Negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n if (typeof val === 'string') {\n if (val.length === 0) return -1 // special case: looking for empty string always fails\n return String.prototype.indexOf.call(this, val, byteOffset)\n }\n if (Buffer.isBuffer(val)) {\n return arrayIndexOf(this, val, byteOffset)\n }\n if (typeof val === 'number') {\n if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n }\n return arrayIndexOf(this, [ val ], byteOffset)\n }\n\n function arrayIndexOf (arr, val, byteOffset) {\n var foundIndex = -1\n for (var i = 0; byteOffset + i < arr.length; i++) {\n if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n } else {\n foundIndex = -1\n }\n }\n return -1\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; i++) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) throw new Error('Invalid hex string')\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n var swap = encoding\n encoding = offset\n offset = length | 0\n length = swap\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'binary':\n return binaryWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction binarySlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; i++) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; i++) {\n newBuf[i] = this[i + start]\n }\n }\n\n if (newBuf.length) newBuf.parent = this.parent || this\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; i--) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; i++) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n if (!value) value = 0\n if (!start) start = 0\n if (!end) end = this.length\n\n if (end < start) throw new RangeError('end < start')\n\n // Fill 0 bytes; we're done\n if (end === start) return\n if (this.length === 0) return\n\n if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n var i\n if (typeof value === 'number') {\n for (i = start; i < end; i++) {\n this[i] = value\n }\n } else {\n var bytes = utf8ToBytes(value.toString())\n var len = bytes.length\n for (i = start; i < end; i++) {\n this[i] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; i++) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; i++) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{\"base64-js\":19,\"ieee754\":23,\"isarray\":21}],21:[function(require,module,exports){\nvar toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n},{}],22:[function(require,module,exports){\n(function (process,global){\n/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE\n * @version 3.1.2\n */\n\n(function() {\n \"use strict\";\n function lib$es6$promise$utils$$objectOrFunction(x) {\n return typeof x === 'function' || (typeof x === 'object' && x !== null);\n }\n\n function lib$es6$promise$utils$$isFunction(x) {\n return typeof x === 'function';\n }\n\n function lib$es6$promise$utils$$isMaybeThenable(x) {\n return typeof x === 'object' && x !== null;\n }\n\n var lib$es6$promise$utils$$_isArray;\n if (!Array.isArray) {\n lib$es6$promise$utils$$_isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n } else {\n lib$es6$promise$utils$$_isArray = Array.isArray;\n }\n\n var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;\n var lib$es6$promise$asap$$len = 0;\n var lib$es6$promise$asap$$vertxNext;\n var lib$es6$promise$asap$$customSchedulerFn;\n\n var lib$es6$promise$asap$$asap = function asap(callback, arg) {\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;\n lib$es6$promise$asap$$len += 2;\n if (lib$es6$promise$asap$$len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (lib$es6$promise$asap$$customSchedulerFn) {\n lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);\n } else {\n lib$es6$promise$asap$$scheduleFlush();\n }\n }\n }\n\n function lib$es6$promise$asap$$setScheduler(scheduleFn) {\n lib$es6$promise$asap$$customSchedulerFn = scheduleFn;\n }\n\n function lib$es6$promise$asap$$setAsap(asapFn) {\n lib$es6$promise$asap$$asap = asapFn;\n }\n\n var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;\n var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};\n var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;\n var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n // test for web worker but not in IE10\n var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&\n typeof importScripts !== 'undefined' &&\n typeof MessageChannel !== 'undefined';\n\n // node\n function lib$es6$promise$asap$$useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function() {\n process.nextTick(lib$es6$promise$asap$$flush);\n };\n }\n\n // vertx\n function lib$es6$promise$asap$$useVertxTimer() {\n return function() {\n lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);\n };\n }\n\n function lib$es6$promise$asap$$useMutationObserver() {\n var iterations = 0;\n var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function() {\n node.data = (iterations = ++iterations % 2);\n };\n }\n\n // web worker\n function lib$es6$promise$asap$$useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = lib$es6$promise$asap$$flush;\n return function () {\n channel.port2.postMessage(0);\n };\n }\n\n function lib$es6$promise$asap$$useSetTimeout() {\n return function() {\n setTimeout(lib$es6$promise$asap$$flush, 1);\n };\n }\n\n var lib$es6$promise$asap$$queue = new Array(1000);\n function lib$es6$promise$asap$$flush() {\n for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {\n var callback = lib$es6$promise$asap$$queue[i];\n var arg = lib$es6$promise$asap$$queue[i+1];\n\n callback(arg);\n\n lib$es6$promise$asap$$queue[i] = undefined;\n lib$es6$promise$asap$$queue[i+1] = undefined;\n }\n\n lib$es6$promise$asap$$len = 0;\n }\n\n function lib$es6$promise$asap$$attemptVertx() {\n try {\n var r = require;\n var vertx = r('vertx');\n lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return lib$es6$promise$asap$$useVertxTimer();\n } catch(e) {\n return lib$es6$promise$asap$$useSetTimeout();\n }\n }\n\n var lib$es6$promise$asap$$scheduleFlush;\n // Decide what async method to use to triggering processing of queued callbacks:\n if (lib$es6$promise$asap$$isNode) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();\n } else if (lib$es6$promise$asap$$BrowserMutationObserver) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();\n } else if (lib$es6$promise$asap$$isWorker) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();\n } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();\n } else {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();\n }\n function lib$es6$promise$then$$then(onFulfillment, onRejection) {\n var parent = this;\n var state = parent._state;\n\n if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {\n return this;\n }\n\n var child = new this.constructor(lib$es6$promise$$internal$$noop);\n var result = parent._result;\n\n if (state) {\n var callback = arguments[state - 1];\n lib$es6$promise$asap$$asap(function(){\n lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);\n });\n } else {\n lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n }\n var lib$es6$promise$then$$default = lib$es6$promise$then$$then;\n function lib$es6$promise$promise$resolve$$resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$resolve(promise, object);\n return promise;\n }\n var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;\n\n function lib$es6$promise$$internal$$noop() {}\n\n var lib$es6$promise$$internal$$PENDING = void 0;\n var lib$es6$promise$$internal$$FULFILLED = 1;\n var lib$es6$promise$$internal$$REJECTED = 2;\n\n var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n }\n\n function lib$es6$promise$$internal$$cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n }\n\n function lib$es6$promise$$internal$$getThen(promise) {\n try {\n return promise.then;\n } catch(error) {\n lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;\n return lib$es6$promise$$internal$$GET_THEN_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch(e) {\n return e;\n }\n }\n\n function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {\n lib$es6$promise$asap$$asap(function(promise) {\n var sealed = false;\n var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {\n if (sealed) { return; }\n sealed = true;\n if (thenable !== value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }, function(reason) {\n if (sealed) { return; }\n sealed = true;\n\n lib$es6$promise$$internal$$reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n lib$es6$promise$$internal$$reject(promise, error);\n }\n }, promise);\n }\n\n function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {\n if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, thenable._result);\n } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, thenable._result);\n } else {\n lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n }\n }\n\n function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) {\n if (maybeThenable.constructor === promise.constructor &&\n then === lib$es6$promise$then$$default &&\n constructor.resolve === lib$es6$promise$promise$resolve$$default) {\n lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);\n } else {\n if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);\n } else if (then === undefined) {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n } else if (lib$es6$promise$utils$$isFunction(then)) {\n lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n }\n }\n }\n\n function lib$es6$promise$$internal$$resolve(promise, value) {\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());\n } else if (lib$es6$promise$utils$$objectOrFunction(value)) {\n lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value));\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n lib$es6$promise$$internal$$publish(promise);\n }\n\n function lib$es6$promise$$internal$$fulfill(promise, value) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n\n promise._result = value;\n promise._state = lib$es6$promise$$internal$$FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);\n }\n }\n\n function lib$es6$promise$$internal$$reject(promise, reason) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n promise._state = lib$es6$promise$$internal$$REJECTED;\n promise._result = reason;\n\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);\n }\n\n function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {\n var subscribers = parent._subscribers;\n var length = subscribers.length;\n\n parent._onerror = null;\n\n subscribers[length] = child;\n subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;\n subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);\n }\n }\n\n function lib$es6$promise$$internal$$publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) { return; }\n\n var child, callback, detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n }\n\n function lib$es6$promise$$internal$$ErrorObject() {\n this.error = null;\n }\n\n var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$tryCatch(callback, detail) {\n try {\n return callback(detail);\n } catch(e) {\n lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;\n return lib$es6$promise$$internal$$TRY_CATCH_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {\n var hasCallback = lib$es6$promise$utils$$isFunction(callback),\n value, error, succeeded, failed;\n\n if (hasCallback) {\n value = lib$es6$promise$$internal$$tryCatch(callback, detail);\n\n if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value = null;\n } else {\n succeeded = true;\n }\n\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());\n return;\n }\n\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (promise._state !== lib$es6$promise$$internal$$PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else if (failed) {\n lib$es6$promise$$internal$$reject(promise, error);\n } else if (settled === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, value);\n } else if (settled === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value){\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function rejectPromise(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n } catch(e) {\n lib$es6$promise$$internal$$reject(promise, e);\n }\n }\n\n function lib$es6$promise$promise$all$$all(entries) {\n return new lib$es6$promise$enumerator$$default(this, entries).promise;\n }\n var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;\n function lib$es6$promise$promise$race$$race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (!lib$es6$promise$utils$$isArray(entries)) {\n lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));\n return promise;\n }\n\n var length = entries.length;\n\n function onFulfillment(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }\n\n function onRejection(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n }\n\n for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);\n }\n\n return promise;\n }\n var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;\n function lib$es6$promise$promise$reject$$reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$reject(promise, reason);\n return promise;\n }\n var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;\n\n var lib$es6$promise$promise$$counter = 0;\n\n function lib$es6$promise$promise$$needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n }\n\n function lib$es6$promise$promise$$needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n }\n\n var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;\n /**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n var promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {function} resolver\n Useful for tooling.\n @constructor\n */\n function lib$es6$promise$promise$$Promise(resolver) {\n this._id = lib$es6$promise$promise$$counter++;\n this._state = undefined;\n this._result = undefined;\n this._subscribers = [];\n\n if (lib$es6$promise$$internal$$noop !== resolver) {\n typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver();\n this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew();\n }\n }\n\n lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;\n lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;\n lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;\n lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;\n lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;\n lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;\n lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;\n\n lib$es6$promise$promise$$Promise.prototype = {\n constructor: lib$es6$promise$promise$$Promise,\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n\n Chaining\n --------\n\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n\n Assimilation\n ------------\n\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n\n If the assimliated promise rejects, then the downstream promise will also reject.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n\n Simple Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var result;\n\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n\n Advanced Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var author, books;\n\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n\n function foundBooks(books) {\n\n }\n\n function failure(reason) {\n\n }\n\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n then: lib$es6$promise$then$$default,\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n };\n var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;\n function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (Array.isArray(input)) {\n this._input = input;\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate();\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n }\n }\n } else {\n lib$es6$promise$$internal$$reject(this.promise, this._validationError());\n }\n }\n\n lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {\n return new Error('Array Methods must be provided an Array');\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {\n var length = this.length;\n var input = this._input;\n\n for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {\n var c = this._instanceConstructor;\n var resolve = c.resolve;\n\n if (resolve === lib$es6$promise$promise$resolve$$default) {\n var then = lib$es6$promise$$internal$$getThen(entry);\n\n if (then === lib$es6$promise$then$$default &&\n entry._state !== lib$es6$promise$$internal$$PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === lib$es6$promise$promise$$default) {\n var promise = new c(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then);\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);\n }\n } else {\n this._willSettleAt(resolve(entry), i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {\n var promise = this.promise;\n\n if (promise._state === lib$es6$promise$$internal$$PENDING) {\n this._remaining--;\n\n if (state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(promise, this._result);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {\n var enumerator = this;\n\n lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {\n enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);\n }, function(reason) {\n enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);\n });\n };\n function lib$es6$promise$polyfill$$polyfill() {\n var local;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {\n return;\n }\n\n local.Promise = lib$es6$promise$promise$$default;\n }\n var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;\n\n var lib$es6$promise$umd$$ES6Promise = {\n 'Promise': lib$es6$promise$promise$$default,\n 'polyfill': lib$es6$promise$polyfill$$default\n };\n\n /* global define:true module:true window: true */\n if (typeof define === 'function' && define['amd']) {\n define(function() { return lib$es6$promise$umd$$ES6Promise; });\n } else if (typeof module !== 'undefined' && module['exports']) {\n module['exports'] = lib$es6$promise$umd$$ES6Promise;\n } else if (typeof this !== 'undefined') {\n this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;\n }\n\n lib$es6$promise$polyfill$$default();\n}).call(this);\n\n\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{\"_process\":24}],23:[function(require,module,exports){\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n},{}],24:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],25:[function(require,module,exports){\n(function (global){\n/*! https://mths.be/utf8js v2.0.0 by @mathias */\n;(function(root) {\n\n\t// Detect free variables `exports`\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code,\n\t// and use it as `root`\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar stringFromCharCode = String.fromCharCode;\n\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2decode(string) {\n\t\tvar output = [];\n\t\tvar counter = 0;\n\t\tvar length = string.length;\n\t\tvar value;\n\t\tvar extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2encode(array) {\n\t\tvar length = array.length;\n\t\tvar index = -1;\n\t\tvar value;\n\t\tvar output = '';\n\t\twhile (++index < length) {\n\t\t\tvalue = array[index];\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t}\n\t\treturn output;\n\t}\n\n\tfunction checkScalarValue(codePoint) {\n\t\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t}\n\t/*--------------------------------------------------------------------------*/\n\n\tfunction createByte(codePoint, shift) {\n\t\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n\t}\n\n\tfunction encodeCodePoint(codePoint) {\n\t\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\t\treturn stringFromCharCode(codePoint);\n\t\t}\n\t\tvar symbol = '';\n\t\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t\t}\n\t\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\t\tcheckScalarValue(codePoint);\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\t\tsymbol += createByte(codePoint, 12);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\t\treturn symbol;\n\t}\n\n\tfunction utf8encode(string) {\n\t\tvar codePoints = ucs2decode(string);\n\t\tvar length = codePoints.length;\n\t\tvar index = -1;\n\t\tvar codePoint;\n\t\tvar byteString = '';\n\t\twhile (++index < length) {\n\t\t\tcodePoint = codePoints[index];\n\t\t\tbyteString += encodeCodePoint(codePoint);\n\t\t}\n\t\treturn byteString;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tfunction readContinuationByte() {\n\t\tif (byteIndex >= byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\n\t\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\n\t\tif ((continuationByte & 0xC0) == 0x80) {\n\t\t\treturn continuationByte & 0x3F;\n\t\t}\n\n\t\t// If we end up here, it’s not a continuation byte\n\t\tthrow Error('Invalid continuation byte');\n\t}\n\n\tfunction decodeSymbol() {\n\t\tvar byte1;\n\t\tvar byte2;\n\t\tvar byte3;\n\t\tvar byte4;\n\t\tvar codePoint;\n\n\t\tif (byteIndex > byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\n\t\tif (byteIndex == byteCount) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Read first byte\n\t\tbyte1 = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\n\t\t// 1-byte sequence (no continuation bytes)\n\t\tif ((byte1 & 0x80) == 0) {\n\t\t\treturn byte1;\n\t\t}\n\n\t\t// 2-byte sequence\n\t\tif ((byte1 & 0xE0) == 0xC0) {\n\t\t\tvar byte2 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\t\tif (codePoint >= 0x80) {\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\n\t\t// 3-byte sequence (may include unpaired surrogates)\n\t\tif ((byte1 & 0xF0) == 0xE0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\t\tif (codePoint >= 0x0800) {\n\t\t\t\tcheckScalarValue(codePoint);\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\n\t\t// 4-byte sequence\n\t\tif ((byte1 & 0xF8) == 0xF0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tbyte4 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |\n\t\t\t\t(byte3 << 0x06) | byte4;\n\t\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\t\treturn codePoint;\n\t\t\t}\n\t\t}\n\n\t\tthrow Error('Invalid UTF-8 detected');\n\t}\n\n\tvar byteArray;\n\tvar byteCount;\n\tvar byteIndex;\n\tfunction utf8decode(byteString) {\n\t\tbyteArray = ucs2decode(byteString);\n\t\tbyteCount = byteArray.length;\n\t\tbyteIndex = 0;\n\t\tvar codePoints = [];\n\t\tvar tmp;\n\t\twhile ((tmp = decodeSymbol()) !== false) {\n\t\t\tcodePoints.push(tmp);\n\t\t}\n\t\treturn ucs2encode(codePoints);\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar utf8 = {\n\t\t'version': '2.0.0',\n\t\t'encode': utf8encode,\n\t\t'decode': utf8decode\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn utf8;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = utf8;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tvar object = {};\n\t\t\tvar hasOwnProperty = object.hasOwnProperty;\n\t\t\tfor (var key in utf8) {\n\t\t\t\thasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.utf8 = utf8;\n\t}\n\n}(this));\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}],26:[function(require,module,exports){\n(function (Buffer){\n(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(['module', 'utf8', 'axios', 'base-64', 'es6-promise'], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(module, require('utf8'), require('axios'), require('base-64'), require('es6-promise'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, global.utf8, global.axios, global.base64, global.Promise);\n global.github = mod.exports;\n }\n})(this, function (module, Utf8, axios, Base64, Promise) {\n /*!\n * @overview Github.js\n *\n * @copyright (c) 2013 Michael Aufreiter, Development Seed\n * Github.js is freely distributable.\n *\n * @license Licensed under BSD-3-Clause-Clear\n *\n * For all details and documentation:\n * http://substance.io/michael/github\n */\n 'use strict';\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n };\n\n function b64encode(string) {\n return Base64.encode(Utf8.encode(string));\n }\n\n if (Promise.polyfill) {\n Promise.polyfill();\n }\n\n // Initial Setup\n // -------------\n\n function Github(options) {\n options = options || {};\n\n var API_URL = options.apiUrl || 'https://api.github.com';\n\n // HTTP Request Abstraction\n // =======\n //\n // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec.\n\n var _request = Github._request = function _request(method, path, data, cb, raw) {\n function getURL() {\n var url = path.indexOf('//') >= 0 ? path : API_URL + path;\n\n url += /\\?/.test(url) ? '&' : '?';\n\n if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) {\n for (var param in data) {\n if (data.hasOwnProperty(param)) {\n url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]);\n }\n }\n }\n\n return url.replace(/(×tamp=\\d+)/, '') + (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : '');\n }\n\n var config = {\n headers: {\n Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json',\n 'Content-Type': 'application/json;charset=UTF-8'\n },\n method: method,\n data: data ? data : {},\n url: getURL()\n };\n\n if (options.token || options.username && options.password) {\n config.headers.Authorization = options.token ? 'token ' + options.token : 'Basic ' + b64encode(options.username + ':' + options.password);\n }\n\n return axios(config).then(function (response) {\n cb(null, response.data || true, response);\n }, function (response) {\n if (response.status === 304) {\n cb(null, response.data || true, response);\n } else {\n cb({\n path: path,\n request: response,\n error: response.status\n });\n }\n });\n };\n\n var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, singlePage, cb) {\n var results = [];\n\n (function iterate() {\n _request('GET', path, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n if (!(res instanceof Array)) {\n res = [res];\n }\n\n results.push.apply(results, res);\n\n var next = (xhr.headers.link || '').split(',').filter(function (link) {\n return (/rel=\"next\"/.test(link)\n );\n }).map(function (link) {\n return (/<(.*)>/.exec(link) || [])[1];\n }).pop();\n\n if (!next || singlePage) {\n cb(err, results, xhr);\n } else {\n path = next;\n iterate();\n }\n });\n })();\n };\n\n // User API\n // =======\n\n Github.User = function () {\n this.repos = function (options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = options || {};\n\n var url = '/user/repos';\n var params = [];\n\n params.push('type=' + encodeURIComponent(options.type || 'all'));\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n url += '?' + params.join('&');\n\n _requestAllPages(url, !!options.page, cb);\n };\n\n // List user organizations\n // -------\n\n this.orgs = function (cb) {\n _request('GET', '/user/orgs', null, cb);\n };\n\n // List authenticated user's gists\n // -------\n\n this.gists = function (cb) {\n _request('GET', '/gists', null, cb);\n };\n\n // List authenticated user's unread notifications\n // -------\n\n this.notifications = function (options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = options || {};\n var url = '/notifications';\n var params = [];\n\n if (options.all) {\n params.push('all=true');\n }\n\n if (options.participating) {\n params.push('participating=true');\n }\n\n if (options.since) {\n var since = options.since;\n\n if (since.constructor === Date) {\n since = since.toISOString();\n }\n\n params.push('since=' + encodeURIComponent(since));\n }\n\n if (options.before) {\n var before = options.before;\n\n if (before.constructor === Date) {\n before = before.toISOString();\n }\n\n params.push('before=' + encodeURIComponent(before));\n }\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Show user information\n // -------\n\n this.show = function (username, cb) {\n var command = username ? '/users/' + username : '/user';\n\n _request('GET', command, null, cb);\n };\n\n // List user repositories\n // -------\n\n this.userRepos = function (username, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n var url = '/users/' + username + '/repos';\n var params = [];\n\n params.push('type=' + encodeURIComponent(options.type || 'all'));\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n url += '?' + params.join('&');\n\n _requestAllPages(url, !!options.page, cb);\n };\n\n // List user starred repositories\n // -------\n\n this.userStarred = function (username, cb) {\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\n var request = '/users/' + username + '/starred?type=all&per_page=100';\n _requestAllPages(request, false, cb);\n };\n\n // List a user's gists\n // -------\n\n this.userGists = function (username, cb) {\n _request('GET', '/users/' + username + '/gists', null, cb);\n };\n\n // List organization repositories\n // -------\n\n this.orgRepos = function (orgname, cb) {\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\n var request = '/orgs/' + orgname + '/repos?type=all&&page_num=100&sort=updated&direction=desc';\n _requestAllPages(request, false, cb);\n };\n\n // Follow user\n // -------\n\n this.follow = function (username, cb) {\n _request('PUT', '/user/following/' + username, null, cb);\n };\n\n // Unfollow user\n // -------\n\n this.unfollow = function (username, cb) {\n _request('DELETE', '/user/following/' + username, null, cb);\n };\n\n // Create a repo\n // -------\n this.createRepo = function (options, cb) {\n _request('POST', '/user/repos', options, cb);\n };\n };\n\n // Repository API\n // =======\n\n Github.Repository = function (options) {\n var repo = options.name;\n var user = options.user;\n var fullname = options.fullname;\n\n var that = this;\n var repoPath;\n\n if (fullname) {\n repoPath = '/repos/' + fullname;\n } else {\n repoPath = '/repos/' + user + '/' + repo;\n }\n\n var currentTree = {\n branch: null,\n sha: null\n };\n\n // Uses the cache if branch has not been changed\n // -------\n\n function updateTree(branch, cb) {\n if (branch === currentTree.branch && currentTree.sha) {\n return cb(null, currentTree.sha);\n }\n\n that.getRef('heads/' + branch, function (err, sha) {\n currentTree.branch = branch;\n currentTree.sha = sha;\n cb(err, sha);\n });\n }\n\n // Get a particular reference\n // -------\n\n this.getRef = function (ref, cb) {\n _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.object.sha, xhr);\n });\n };\n\n // Create a new reference\n // --------\n //\n // {\n // \"ref\": \"refs/heads/my-new-branch-name\",\n // \"sha\": \"827efc6d56897b048c772eb4087f854f46256132\"\n // }\n\n this.createRef = function (options, cb) {\n _request('POST', repoPath + '/git/refs', options, cb);\n };\n\n // Delete a reference\n // --------\n //\n // Repo.deleteRef('heads/gh-pages')\n // repo.deleteRef('tags/v1.0')\n\n this.deleteRef = function (ref, cb) {\n _request('DELETE', repoPath + '/git/refs/' + ref, options, cb);\n };\n\n // Delete a repo\n // --------\n\n this.deleteRepo = function (cb) {\n _request('DELETE', repoPath, options, cb);\n };\n\n // List all tags of a repository\n // -------\n\n this.listTags = function (cb) {\n _request('GET', repoPath + '/tags', null, cb);\n };\n\n // List all pull requests of a respository\n // -------\n\n this.listPulls = function (options, cb) {\n options = options || {};\n var url = repoPath + '/pulls';\n var params = [];\n\n if (typeof options === 'string') {\n // Backward compatibility\n params.push('state=' + options);\n } else {\n if (options.state) {\n params.push('state=' + encodeURIComponent(options.state));\n }\n\n if (options.head) {\n params.push('head=' + encodeURIComponent(options.head));\n }\n\n if (options.base) {\n params.push('base=' + encodeURIComponent(options.base));\n }\n\n if (options.sort) {\n params.push('sort=' + encodeURIComponent(options.sort));\n }\n\n if (options.direction) {\n params.push('direction=' + encodeURIComponent(options.direction));\n }\n\n if (options.page) {\n params.push('page=' + options.page);\n }\n\n if (options.per_page) {\n params.push('per_page=' + options.per_page);\n }\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Gets details for a specific pull request\n // -------\n\n this.getPull = function (number, cb) {\n _request('GET', repoPath + '/pulls/' + number, null, cb);\n };\n\n // Retrieve the changes made between base and head\n // -------\n\n this.compare = function (base, head, cb) {\n _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb);\n };\n\n // List all branches of a repository\n // -------\n\n this.listBranches = function (cb) {\n _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) {\n if (err) {\n return cb(err);\n }\n\n heads = heads.map(function (head) {\n return head.ref.replace(/^refs\\/heads\\//, '');\n });\n\n cb(null, heads, xhr);\n });\n };\n\n // Retrieve the contents of a blob\n // -------\n\n this.getBlob = function (sha, cb) {\n _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw');\n };\n\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\n // -------\n\n this.getCommit = function (branch, sha, cb) {\n _request('GET', repoPath + '/git/commits/' + sha, null, cb);\n };\n\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\n // -------\n\n this.getSha = function (branch, path, cb) {\n if (!path || path === '') {\n return that.getRef('heads/' + branch, cb);\n }\n\n _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''), null, function (err, pathContent, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, pathContent.sha, xhr);\n });\n };\n\n // Get the statuses for a particular SHA\n // -------\n\n this.getStatuses = function (sha, cb) {\n _request('GET', repoPath + '/statuses/' + sha, null, cb);\n };\n\n // Retrieve the tree a commit points to\n // -------\n\n this.getTree = function (tree, cb) {\n _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.tree, xhr);\n });\n };\n\n // Post a new blob object, getting a blob SHA back\n // -------\n\n this.postBlob = function (content, cb) {\n if (typeof content === 'string') {\n content = {\n content: Utf8.encode(content),\n encoding: 'utf-8'\n };\n } else {\n if (typeof Buffer !== 'undefined' && content instanceof Buffer) {\n // in NodeJS\n content = {\n content: content.toString('base64'),\n encoding: 'base64'\n };\n } else if (typeof Blob !== 'undefined' && content instanceof Blob) {\n content = {\n content: b64encode(content),\n encoding: 'base64'\n };\n } else {\n throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)');\n }\n }\n\n _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Update an existing tree adding a new blob object getting a tree SHA back\n // -------\n\n this.updateTree = function (baseTree, path, blob, cb) {\n var data = {\n base_tree: baseTree,\n tree: [{\n path: path,\n mode: '100644',\n type: 'blob',\n sha: blob\n }]\n };\n\n _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Post a new tree object having a file path pointer replaced\n // with a new blob SHA getting a tree SHA back\n // -------\n\n this.postTree = function (tree, cb) {\n _request('POST', repoPath + '/git/trees', {\n tree: tree\n }, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Create a new commit object with the current commit SHA as the parent\n // and the new tree SHA, getting a commit SHA back\n // -------\n\n this.commit = function (parent, tree, message, cb) {\n var user = new Github.User();\n\n user.show(null, function (err, userData) {\n if (err) {\n return cb(err);\n }\n\n var data = {\n message: message,\n author: {\n name: options.user,\n email: userData.email\n },\n parents: [parent],\n tree: tree\n };\n\n _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n currentTree.sha = res.sha; // Update latest commit\n\n cb(null, res.sha, xhr);\n });\n });\n };\n\n // Update the reference of your head to point to the new commit SHA\n // -------\n\n this.updateHead = function (head, commit, cb) {\n _request('PATCH', repoPath + '/git/refs/heads/' + head, {\n sha: commit\n }, cb);\n };\n\n // Show repository information\n // -------\n\n this.show = function (cb) {\n _request('GET', repoPath, null, cb);\n };\n\n // Show repository contributors\n // -------\n\n this.contributors = function (cb, retry) {\n retry = retry || 1000;\n var that = this;\n\n _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) {\n if (err) {\n return cb(err);\n }\n\n if (xhr.status === 202) {\n setTimeout(function () {\n that.contributors(cb, retry);\n }, retry);\n } else {\n cb(err, data, xhr);\n }\n });\n };\n\n // Get contents\n // --------\n\n this.contents = function (ref, path, cb) {\n path = encodeURI(path);\n _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), {\n ref: ref\n }, cb);\n };\n\n // Fork repository\n // -------\n\n this.fork = function (cb) {\n _request('POST', repoPath + '/forks', null, cb);\n };\n\n // List forks\n // --------\n\n this.listForks = function (cb) {\n _request('GET', repoPath + '/forks', null, cb);\n };\n\n // Branch repository\n // --------\n\n this.branch = function (oldBranch, newBranch, cb) {\n if (arguments.length === 2 && typeof arguments[1] === 'function') {\n cb = newBranch;\n newBranch = oldBranch;\n oldBranch = 'master';\n }\n\n this.getRef('heads/' + oldBranch, function (err, ref) {\n if (err && cb) {\n return cb(err);\n }\n\n that.createRef({\n ref: 'refs/heads/' + newBranch,\n sha: ref\n }, cb);\n });\n };\n\n // Create pull request\n // --------\n\n this.createPullRequest = function (options, cb) {\n _request('POST', repoPath + '/pulls', options, cb);\n };\n\n // List hooks\n // --------\n\n this.listHooks = function (cb) {\n _request('GET', repoPath + '/hooks', null, cb);\n };\n\n // Get a hook\n // --------\n\n this.getHook = function (id, cb) {\n _request('GET', repoPath + '/hooks/' + id, null, cb);\n };\n\n // Create a hook\n // --------\n\n this.createHook = function (options, cb) {\n _request('POST', repoPath + '/hooks', options, cb);\n };\n\n // Edit a hook\n // --------\n\n this.editHook = function (id, options, cb) {\n _request('PATCH', repoPath + '/hooks/' + id, options, cb);\n };\n\n // Delete a hook\n // --------\n\n this.deleteHook = function (id, cb) {\n _request('DELETE', repoPath + '/hooks/' + id, null, cb);\n };\n\n // Read file at given path\n // -------\n\n this.read = function (branch, path, cb) {\n _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''), null, cb, true);\n };\n\n // Remove a file\n // -------\n\n this.remove = function (branch, path, cb) {\n that.getSha(branch, path, function (err, sha) {\n if (err) {\n return cb(err);\n }\n\n _request('DELETE', repoPath + '/contents/' + path, {\n message: path + ' is removed',\n sha: sha,\n branch: branch\n }, cb);\n });\n };\n\n // Alias for repo.remove for backwards comapt.\n // -------\n this.delete = this.remove;\n\n // Move a file to a new location\n // -------\n\n this.move = function (branch, path, newPath, cb) {\n updateTree(branch, function (err, latestCommit) {\n that.getTree(latestCommit + '?recursive=true', function (err, tree) {\n // Update Tree\n tree.forEach(function (ref) {\n if (ref.path === path) {\n ref.path = newPath;\n }\n\n if (ref.type === 'tree') {\n delete ref.sha;\n }\n });\n\n that.postTree(tree, function (err, rootTree) {\n that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) {\n that.updateHead(branch, commit, cb);\n });\n });\n });\n });\n };\n\n // Write file contents to a given branch and path\n // -------\n\n this.write = function (branch, path, content, message, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n that.getSha(branch, encodeURI(path), function (err, sha) {\n var writeOptions = {\n message: message,\n content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content,\n branch: branch,\n committer: options && options.committer ? options.committer : undefined,\n author: options && options.author ? options.author : undefined\n };\n\n // If no error, we set the sha to overwrite an existing file\n if (!(err && err.error !== 404)) {\n writeOptions.sha = sha;\n }\n\n _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb);\n });\n };\n\n // List commits on a repository. Takes an object of optional parameters:\n // sha: SHA or branch to start listing commits from\n // path: Only commits containing this file path will be returned\n // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address\n // since: ISO 8601 date - only commits after this date will be returned\n // until: ISO 8601 date - only commits before this date will be returned\n // -------\n\n this.getCommits = function (options, cb) {\n options = options || {};\n var url = repoPath + '/commits';\n var params = [];\n\n if (options.sha) {\n params.push('sha=' + encodeURIComponent(options.sha));\n }\n\n if (options.path) {\n params.push('path=' + encodeURIComponent(options.path));\n }\n\n if (options.author) {\n params.push('author=' + encodeURIComponent(options.author));\n }\n\n if (options.since) {\n var since = options.since;\n\n if (since.constructor === Date) {\n since = since.toISOString();\n }\n\n params.push('since=' + encodeURIComponent(since));\n }\n\n if (options.until) {\n var until = options.until;\n\n if (until.constructor === Date) {\n until = until.toISOString();\n }\n\n params.push('until=' + encodeURIComponent(until));\n }\n\n if (options.page) {\n params.push('page=' + options.page);\n }\n\n if (options.perpage) {\n params.push('per_page=' + options.perpage);\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Check if a repository is starred.\n // --------\n\n this.isStarred = function (owner, repository, cb) {\n _request('GET', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Star a repository.\n // --------\n\n this.star = function (owner, repository, cb) {\n _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Unstar a repository.\n // --------\n\n this.unstar = function (owner, repository, cb) {\n _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Create a new release\n // --------\n\n this.createRelease = function (options, cb) {\n _request('POST', repoPath + '/releases', options, cb);\n };\n\n // Edit a release\n // --------\n\n this.editRelease = function (id, options, cb) {\n _request('PATCH', repoPath + '/releases/' + id, options, cb);\n };\n\n // Get a single release\n // --------\n\n this.getRelease = function (id, cb) {\n _request('GET', repoPath + '/releases/' + id, null, cb);\n };\n\n // Remove a release\n // --------\n\n this.deleteRelease = function (id, cb) {\n _request('DELETE', repoPath + '/releases/' + id, null, cb);\n };\n };\n\n // Gists API\n // =======\n\n Github.Gist = function (options) {\n var id = options.id;\n var gistPath = '/gists/' + id;\n\n // Read the gist\n // --------\n\n this.read = function (cb) {\n _request('GET', gistPath, null, cb);\n };\n\n // Create the gist\n // --------\n // {\n // \"description\": \"the description for this gist\",\n // \"public\": true,\n // \"files\": {\n // \"file1.txt\": {\n // \"content\": \"String file contents\"\n // }\n // }\n // }\n\n this.create = function (options, cb) {\n _request('POST', '/gists', options, cb);\n };\n\n // Delete the gist\n // --------\n\n this.delete = function (cb) {\n _request('DELETE', gistPath, null, cb);\n };\n\n // Fork a gist\n // --------\n\n this.fork = function (cb) {\n _request('POST', gistPath + '/fork', null, cb);\n };\n\n // Update a gist with the new stuff\n // --------\n\n this.update = function (options, cb) {\n _request('PATCH', gistPath, options, cb);\n };\n\n // Star a gist\n // --------\n\n this.star = function (cb) {\n _request('PUT', gistPath + '/star', null, cb);\n };\n\n // Untar a gist\n // --------\n\n this.unstar = function (cb) {\n _request('DELETE', gistPath + '/star', null, cb);\n };\n\n // Check if a gist is starred\n // --------\n\n this.isStarred = function (cb) {\n _request('GET', gistPath + '/star', null, cb);\n };\n };\n\n // Issues API\n // ==========\n\n Github.Issue = function (options) {\n var path = '/repos/' + options.user + '/' + options.repo + '/issues';\n\n this.create = function (options, cb) {\n _request('POST', path, options, cb);\n };\n\n this.list = function (options, cb) {\n var query = [];\n\n Object.keys(options).forEach(function (option) {\n query.push(encodeURIComponent(option) + '=' + encodeURIComponent(options[option]));\n });\n\n _requestAllPages(path + '?' + query.join('&'), !!options.page, cb);\n };\n\n this.comment = function (issue, comment, cb) {\n _request('POST', issue.comments_url, {\n body: comment\n }, cb);\n };\n\n this.edit = function (issue, options, cb) {\n _request('PATCH', path + '/' + issue, options, cb);\n };\n\n this.get = function (issue, cb) {\n _request('GET', path + '/' + issue, null, cb);\n };\n };\n\n // Search API\n // ==========\n\n Github.Search = function (options) {\n var path = '/search/';\n var query = '?q=' + options.query;\n\n this.repositories = function (options, cb) {\n _request('GET', path + 'repositories' + query, options, cb);\n };\n\n this.code = function (options, cb) {\n _request('GET', path + 'code' + query, options, cb);\n };\n\n this.issues = function (options, cb) {\n _request('GET', path + 'issues' + query, options, cb);\n };\n\n this.users = function (options, cb) {\n _request('GET', path + 'users' + query, options, cb);\n };\n };\n\n // Rate Limit API\n // ==========\n\n Github.RateLimit = function () {\n this.getRateLimit = function (cb) {\n _request('GET', '/rate_limit', null, cb);\n };\n };\n\n return Github;\n };\n\n // Top Level API\n // -------\n\n Github.getIssues = function (user, repo) {\n return new Github.Issue({\n user: user,\n repo: repo\n });\n };\n\n Github.getRepo = function (user, repo) {\n if (!repo) {\n return new Github.Repository({\n fullname: user\n });\n } else {\n return new Github.Repository({\n user: user,\n name: repo\n });\n }\n };\n\n Github.getUser = function () {\n return new Github.User();\n };\n\n Github.getGist = function (id) {\n return new Github.Gist({\n id: id\n });\n };\n\n Github.getSearch = function (query) {\n return new Github.Search({\n query: query\n });\n };\n\n Github.getRateLimit = function () {\n return new Github.RateLimit();\n };\n\n module.exports = Github;\n});\n\n}).call(this,require(\"buffer\").Buffer)\n\n},{\"axios\":1,\"base-64\":18,\"buffer\":20,\"es6-promise\":22,\"utf8\":25}]},{},[26])(26)\n});\n\n","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('./../helpers/buildURL');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar transformData = require('./../helpers/transformData');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar btoa = window.btoa || require('./../helpers/btoa');\n\nmodule.exports = function xhrAdapter(resolve, reject, config) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // For IE 8/9 CORS support\n // Only supports POST and GET calls and doesn't returns the response headers.\n if (window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {\n request = new window.XDomainRequest();\n }\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onload = function handleLoad() {\n if (!request) {\n return;\n }\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response;\n var response = {\n data: transformData(\n responseData,\n responseHeaders,\n config.transformResponse\n ),\n // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)\n status: request.status === 1223 ? 204 : request.status,\n statusText: request.status === 1223 ? 'No Content' : request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n // Resolve or reject the Promise based on the status\n ((response.status >= 200 && response.status < 300) ||\n (!('status' in request) && response.responseText) ?\n resolve :\n reject)(response);\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new Error('Network Error'));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = require('./../helpers/cookies');\n\n // Add xsrf header\n var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n if (request.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n if (utils.isArrayBuffer(requestData)) {\n requestData = new DataView(requestData);\n }\n\n // Send the request\n request.send(requestData);\n};\n","'use strict';\n\nvar defaults = require('./defaults');\nvar utils = require('./utils');\nvar dispatchRequest = require('./core/dispatchRequest');\nvar InterceptorManager = require('./core/InterceptorManager');\nvar isAbsoluteURL = require('./helpers/isAbsoluteURL');\nvar combineURLs = require('./helpers/combineURLs');\nvar bind = require('./helpers/bind');\nvar transformData = require('./helpers/transformData');\n\nfunction Axios(defaultConfig) {\n this.defaults = utils.merge({}, defaultConfig);\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = utils.merge({\n url: arguments[0]\n }, arguments[1]);\n }\n\n config = utils.merge(defaults, this.defaults, { method: 'get' }, config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Don't allow overriding defaults.withCredentials\n config.withCredentials = config.withCredentials || this.defaults.withCredentials;\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nvar defaultInstance = new Axios(defaults);\nvar axios = module.exports = bind(Axios.prototype.request, defaultInstance);\n\naxios.create = function create(defaultConfig) {\n return new Axios(defaultConfig);\n};\n\n// Expose defaults\naxios.defaults = defaultInstance.defaults;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose interceptors\naxios.interceptors = defaultInstance.interceptors;\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n axios[method] = bind(Axios.prototype[method], defaultInstance);\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n axios[method] = bind(Axios.prototype[method], defaultInstance);\n});\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n","'use strict';\n\n/**\n * Dispatch a request to the server using whichever adapter\n * is supported by the current environment.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n return new Promise(function executor(resolve, reject) {\n try {\n var adapter;\n\n if (typeof config.adapter === 'function') {\n // For custom adapter support\n adapter = config.adapter;\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('../adapters/xhr');\n } else if (typeof process !== 'undefined') {\n // For node use HTTP adapter\n adapter = require('../adapters/http');\n }\n\n if (typeof adapter === 'function') {\n adapter(resolve, reject, config);\n }\n } catch (e) {\n reject(e);\n }\n });\n};\n\n","'use strict';\n\nvar utils = require('./utils');\n\nvar PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nmodule.exports = {\n transformRequest: [function transformResponseJSON(data, headers) {\n if (utils.isFormData(data)) {\n return data;\n }\n if (utils.isArrayBuffer(data)) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {\n // Set application/json if no Content-Type has been specified\n if (!utils.isUndefined(headers)) {\n utils.forEach(headers, function processContentTypeHeader(val, key) {\n if (key.toLowerCase() === 'content-type') {\n headers['Content-Type'] = val;\n }\n });\n\n if (utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = 'application/json;charset=utf-8';\n }\n }\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponseJSON(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n data = data.replace(PROTECTION_PREFIX, '');\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n },\n patch: utils.merge(DEFAULT_CONTENT_TYPE),\n post: utils.merge(DEFAULT_CONTENT_TYPE),\n put: utils.merge(DEFAULT_CONTENT_TYPE)\n },\n\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN'\n};\n","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","'use strict';\n\n// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\nInvalidCharacterError.prototype = new Error;\nInvalidCharacterError.prototype.code = 5;\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction btoa(input) {\n var str = String(input);\n var output = '';\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars;\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3 / 4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');\n }\n block = block << 8 | charCode;\n }\n return output;\n}\n\nmodule.exports = btoa;\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n }\n\n if (!utils.isArray(val)) {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '');\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n","'use strict';\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return toString.call(val) === '[object FormData]';\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * typeof document.createElement -> undefined\n */\nfunction isStandardBrowserEnv() {\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined' &&\n typeof document.createElement === 'function'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object' && !isArray(obj)) {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n trim: trim\n};\n","/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */\n;(function(root) {\n\n\t// Detect free variables `exports`.\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`.\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code, and use\n\t// it as `root`.\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar InvalidCharacterError = function(message) {\n\t\tthis.message = message;\n\t};\n\tInvalidCharacterError.prototype = new Error;\n\tInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n\tvar error = function(message) {\n\t\t// Note: the error messages used throughout this file match those used by\n\t\t// the native `atob`/`btoa` implementation in Chromium.\n\t\tthrow new InvalidCharacterError(message);\n\t};\n\n\tvar TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\t// http://whatwg.org/html/common-microsyntaxes.html#space-character\n\tvar REGEX_SPACE_CHARACTERS = /[\\t\\n\\f\\r ]/g;\n\n\t// `decode` is designed to be fully compatible with `atob` as described in the\n\t// HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob\n\t// The optimized base64-decoding algorithm used is based on @atk’s excellent\n\t// implementation. https://gist.github.com/atk/1020396\n\tvar decode = function(input) {\n\t\tinput = String(input)\n\t\t\t.replace(REGEX_SPACE_CHARACTERS, '');\n\t\tvar length = input.length;\n\t\tif (length % 4 == 0) {\n\t\t\tinput = input.replace(/==?$/, '');\n\t\t\tlength = input.length;\n\t\t}\n\t\tif (\n\t\t\tlength % 4 == 1 ||\n\t\t\t// http://whatwg.org/C#alphanumeric-ascii-characters\n\t\t\t/[^+a-zA-Z0-9/]/.test(input)\n\t\t) {\n\t\t\terror(\n\t\t\t\t'Invalid character: the string to be decoded is not correctly encoded.'\n\t\t\t);\n\t\t}\n\t\tvar bitCounter = 0;\n\t\tvar bitStorage;\n\t\tvar buffer;\n\t\tvar output = '';\n\t\tvar position = -1;\n\t\twhile (++position < length) {\n\t\t\tbuffer = TABLE.indexOf(input.charAt(position));\n\t\t\tbitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;\n\t\t\t// Unless this is the first of a group of 4 characters…\n\t\t\tif (bitCounter++ % 4) {\n\t\t\t\t// …convert the first 8 bits to a single ASCII character.\n\t\t\t\toutput += String.fromCharCode(\n\t\t\t\t\t0xFF & bitStorage >> (-2 * bitCounter & 6)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t};\n\n\t// `encode` is designed to be fully compatible with `btoa` as described in the\n\t// HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa\n\tvar encode = function(input) {\n\t\tinput = String(input);\n\t\tif (/[^\\0-\\xFF]/.test(input)) {\n\t\t\t// Note: no need to special-case astral symbols here, as surrogates are\n\t\t\t// matched, and the input is supposed to only contain ASCII anyway.\n\t\t\terror(\n\t\t\t\t'The string to be encoded contains characters outside of the ' +\n\t\t\t\t'Latin1 range.'\n\t\t\t);\n\t\t}\n\t\tvar padding = input.length % 3;\n\t\tvar output = '';\n\t\tvar position = -1;\n\t\tvar a;\n\t\tvar b;\n\t\tvar c;\n\t\tvar d;\n\t\tvar buffer;\n\t\t// Make sure any padding is handled outside of the loop.\n\t\tvar length = input.length - padding;\n\n\t\twhile (++position < length) {\n\t\t\t// Read three bytes, i.e. 24 bits.\n\t\t\ta = input.charCodeAt(position) << 16;\n\t\t\tb = input.charCodeAt(++position) << 8;\n\t\t\tc = input.charCodeAt(++position);\n\t\t\tbuffer = a + b + c;\n\t\t\t// Turn the 24 bits into four chunks of 6 bits each, and append the\n\t\t\t// matching character for each of them to the output.\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 18 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer >> 12 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer >> 6 & 0x3F) +\n\t\t\t\tTABLE.charAt(buffer & 0x3F)\n\t\t\t);\n\t\t}\n\n\t\tif (padding == 2) {\n\t\t\ta = input.charCodeAt(position) << 8;\n\t\t\tb = input.charCodeAt(++position);\n\t\t\tbuffer = a + b;\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 10) +\n\t\t\t\tTABLE.charAt((buffer >> 4) & 0x3F) +\n\t\t\t\tTABLE.charAt((buffer << 2) & 0x3F) +\n\t\t\t\t'='\n\t\t\t);\n\t\t} else if (padding == 1) {\n\t\t\tbuffer = input.charCodeAt(position);\n\t\t\toutput += (\n\t\t\t\tTABLE.charAt(buffer >> 2) +\n\t\t\t\tTABLE.charAt((buffer << 4) & 0x3F) +\n\t\t\t\t'=='\n\t\t\t);\n\t\t}\n\n\t\treturn output;\n\t};\n\n\tvar base64 = {\n\t\t'encode': encode,\n\t\t'decode': decode,\n\t\t'version': '0.1.0'\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn base64;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = base64;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (var key in base64) {\n\t\t\t\tbase64.hasOwnProperty(key) && (freeExports[key] = base64[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.base64 = base64;\n\t}\n\n}(this));\n","'use strict'\n\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nfunction init () {\n var i\n var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n var len = code.length\n\n for (i = 0; i < len; i++) {\n lookup[i] = code[i]\n }\n\n for (i = 0; i < len; ++i) {\n revLookup[code.charCodeAt(i)] = i\n }\n revLookup['-'.charCodeAt(0)] = 62\n revLookup['_'.charCodeAt(0)] = 63\n}\n\ninit()\n\nfunction toByteArray (b64) {\n var i, j, l, tmp, placeHolders, arr\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n\n // base64 is 4/3 + up to two characters of the original data\n arr = new Arr(len * 3 / 4 - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0, j = 0; i < l; i += 4, j += 3) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp & 0xFF0000) >> 16\n arr[L++] = (tmp & 0xFF00) >> 8\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.foo = function () { return 42 }\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\nfunction Buffer (arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1) return new Buffer(arg, arguments[1])\n return new Buffer(arg)\n }\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0\n this.parent = undefined\n }\n\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg)\n }\n\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n }\n\n // Unusual.\n return fromObject(this, arg)\n}\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction fromNumber (that, length) {\n that = allocate(that, length < 0 ? 0 : checked(length) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < length; i++) {\n that[i] = 0\n }\n }\n return that\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'\n\n // Assumption: byteLength() return value is always < kMaxLength.\n var length = byteLength(string, encoding) | 0\n that = allocate(that, length)\n\n that.write(string, encoding)\n return that\n}\n\nfunction fromObject (that, object) {\n if (Buffer.isBuffer(object)) return fromBuffer(that, object)\n\n if (isArray(object)) return fromArray(that, object)\n\n if (object == null) {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (typeof ArrayBuffer !== 'undefined') {\n if (object.buffer instanceof ArrayBuffer) {\n return fromTypedArray(that, object)\n }\n if (object instanceof ArrayBuffer) {\n return fromArrayBuffer(that, object)\n }\n }\n\n if (object.length) return fromArrayLike(that, object)\n\n return fromJsonObject(that, object)\n}\n\nfunction fromBuffer (that, buffer) {\n var length = checked(buffer.length) | 0\n that = allocate(that, length)\n buffer.copy(that, 0, 0, length)\n return that\n}\n\nfunction fromArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Duplicate of fromArray() to keep fromArray() monomorphic.\nfunction fromTypedArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(array)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromTypedArray(that, new Uint8Array(array))\n }\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.\n// Returns a zero-length buffer for inputs that don't conform to the spec.\nfunction fromJsonObject (that, object) {\n var array\n var length = 0\n\n if (object.type === 'Buffer' && isArray(object.data)) {\n array = object.data\n length = checked(array.length) | 0\n }\n that = allocate(that, length)\n\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n} else {\n // pre-set for values that may exist in the future\n Buffer.prototype.length = undefined\n Buffer.prototype.parent = undefined\n}\n\nfunction allocate (that, length) {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that.length = length\n }\n\n var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1\n if (fromPool) that.parent = rootParent\n\n return that\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (subject, encoding) {\n if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n var buf = new Buffer(subject, encoding)\n delete buf.parent\n return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n var i = 0\n var len = Math.min(x, y)\n while (i < len) {\n if (a[i] !== b[i]) break\n\n ++i\n }\n\n if (i !== len) {\n x = a[i]\n y = b[i]\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'binary':\n case 'base64':\n case 'raw':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n if (list.length === 0) {\n return new Buffer(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; i++) {\n length += list[i].length\n }\n }\n\n var buf = new Buffer(length)\n var pos = 0\n for (i = 0; i < list.length; i++) {\n var item = list[i]\n item.copy(buf, pos)\n pos += item.length\n }\n return buf\n}\n\nfunction byteLength (string, encoding) {\n if (typeof string !== 'string') string = '' + string\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'binary':\n // Deprecated\n case 'raw':\n case 'raws':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n start = start | 0\n end = end === undefined || end === Infinity ? this.length : end | 0\n\n if (!encoding) encoding = 'utf8'\n if (start < 0) start = 0\n if (end > this.length) end = this.length\n if (end <= start) return ''\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'binary':\n return binarySlice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return 0\n return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n byteOffset >>= 0\n\n if (this.length === 0) return -1\n if (byteOffset >= this.length) return -1\n\n // Negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n if (typeof val === 'string') {\n if (val.length === 0) return -1 // special case: looking for empty string always fails\n return String.prototype.indexOf.call(this, val, byteOffset)\n }\n if (Buffer.isBuffer(val)) {\n return arrayIndexOf(this, val, byteOffset)\n }\n if (typeof val === 'number') {\n if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n }\n return arrayIndexOf(this, [ val ], byteOffset)\n }\n\n function arrayIndexOf (arr, val, byteOffset) {\n var foundIndex = -1\n for (var i = 0; byteOffset + i < arr.length; i++) {\n if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n } else {\n foundIndex = -1\n }\n }\n return -1\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; i++) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) throw new Error('Invalid hex string')\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n var swap = encoding\n encoding = offset\n offset = length | 0\n length = swap\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'binary':\n return binaryWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction binarySlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; i++) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; i++) {\n newBuf[i] = this[i + start]\n }\n }\n\n if (newBuf.length) newBuf.parent = this.parent || this\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; i--) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; i++) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n if (!value) value = 0\n if (!start) start = 0\n if (!end) end = this.length\n\n if (end < start) throw new RangeError('end < start')\n\n // Fill 0 bytes; we're done\n if (end === start) return\n if (this.length === 0) return\n\n if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n var i\n if (typeof value === 'number') {\n for (i = start; i < end; i++) {\n this[i] = value\n }\n } else {\n var bytes = utf8ToBytes(value.toString())\n var len = bytes.length\n for (i = start; i < end; i++) {\n this[i] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; i++) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; i++) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE\n * @version 3.1.2\n */\n\n(function() {\n \"use strict\";\n function lib$es6$promise$utils$$objectOrFunction(x) {\n return typeof x === 'function' || (typeof x === 'object' && x !== null);\n }\n\n function lib$es6$promise$utils$$isFunction(x) {\n return typeof x === 'function';\n }\n\n function lib$es6$promise$utils$$isMaybeThenable(x) {\n return typeof x === 'object' && x !== null;\n }\n\n var lib$es6$promise$utils$$_isArray;\n if (!Array.isArray) {\n lib$es6$promise$utils$$_isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n } else {\n lib$es6$promise$utils$$_isArray = Array.isArray;\n }\n\n var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;\n var lib$es6$promise$asap$$len = 0;\n var lib$es6$promise$asap$$vertxNext;\n var lib$es6$promise$asap$$customSchedulerFn;\n\n var lib$es6$promise$asap$$asap = function asap(callback, arg) {\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;\n lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;\n lib$es6$promise$asap$$len += 2;\n if (lib$es6$promise$asap$$len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (lib$es6$promise$asap$$customSchedulerFn) {\n lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);\n } else {\n lib$es6$promise$asap$$scheduleFlush();\n }\n }\n }\n\n function lib$es6$promise$asap$$setScheduler(scheduleFn) {\n lib$es6$promise$asap$$customSchedulerFn = scheduleFn;\n }\n\n function lib$es6$promise$asap$$setAsap(asapFn) {\n lib$es6$promise$asap$$asap = asapFn;\n }\n\n var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;\n var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};\n var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;\n var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n // test for web worker but not in IE10\n var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&\n typeof importScripts !== 'undefined' &&\n typeof MessageChannel !== 'undefined';\n\n // node\n function lib$es6$promise$asap$$useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function() {\n process.nextTick(lib$es6$promise$asap$$flush);\n };\n }\n\n // vertx\n function lib$es6$promise$asap$$useVertxTimer() {\n return function() {\n lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);\n };\n }\n\n function lib$es6$promise$asap$$useMutationObserver() {\n var iterations = 0;\n var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function() {\n node.data = (iterations = ++iterations % 2);\n };\n }\n\n // web worker\n function lib$es6$promise$asap$$useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = lib$es6$promise$asap$$flush;\n return function () {\n channel.port2.postMessage(0);\n };\n }\n\n function lib$es6$promise$asap$$useSetTimeout() {\n return function() {\n setTimeout(lib$es6$promise$asap$$flush, 1);\n };\n }\n\n var lib$es6$promise$asap$$queue = new Array(1000);\n function lib$es6$promise$asap$$flush() {\n for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {\n var callback = lib$es6$promise$asap$$queue[i];\n var arg = lib$es6$promise$asap$$queue[i+1];\n\n callback(arg);\n\n lib$es6$promise$asap$$queue[i] = undefined;\n lib$es6$promise$asap$$queue[i+1] = undefined;\n }\n\n lib$es6$promise$asap$$len = 0;\n }\n\n function lib$es6$promise$asap$$attemptVertx() {\n try {\n var r = require;\n var vertx = r('vertx');\n lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return lib$es6$promise$asap$$useVertxTimer();\n } catch(e) {\n return lib$es6$promise$asap$$useSetTimeout();\n }\n }\n\n var lib$es6$promise$asap$$scheduleFlush;\n // Decide what async method to use to triggering processing of queued callbacks:\n if (lib$es6$promise$asap$$isNode) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();\n } else if (lib$es6$promise$asap$$BrowserMutationObserver) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();\n } else if (lib$es6$promise$asap$$isWorker) {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();\n } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();\n } else {\n lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();\n }\n function lib$es6$promise$then$$then(onFulfillment, onRejection) {\n var parent = this;\n var state = parent._state;\n\n if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {\n return this;\n }\n\n var child = new this.constructor(lib$es6$promise$$internal$$noop);\n var result = parent._result;\n\n if (state) {\n var callback = arguments[state - 1];\n lib$es6$promise$asap$$asap(function(){\n lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);\n });\n } else {\n lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n }\n var lib$es6$promise$then$$default = lib$es6$promise$then$$then;\n function lib$es6$promise$promise$resolve$$resolve(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$resolve(promise, object);\n return promise;\n }\n var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;\n\n function lib$es6$promise$$internal$$noop() {}\n\n var lib$es6$promise$$internal$$PENDING = void 0;\n var lib$es6$promise$$internal$$FULFILLED = 1;\n var lib$es6$promise$$internal$$REJECTED = 2;\n\n var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n }\n\n function lib$es6$promise$$internal$$cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n }\n\n function lib$es6$promise$$internal$$getThen(promise) {\n try {\n return promise.then;\n } catch(error) {\n lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;\n return lib$es6$promise$$internal$$GET_THEN_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {\n try {\n then.call(value, fulfillmentHandler, rejectionHandler);\n } catch(e) {\n return e;\n }\n }\n\n function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {\n lib$es6$promise$asap$$asap(function(promise) {\n var sealed = false;\n var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {\n if (sealed) { return; }\n sealed = true;\n if (thenable !== value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }, function(reason) {\n if (sealed) { return; }\n sealed = true;\n\n lib$es6$promise$$internal$$reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n lib$es6$promise$$internal$$reject(promise, error);\n }\n }, promise);\n }\n\n function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {\n if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, thenable._result);\n } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, thenable._result);\n } else {\n lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n }\n }\n\n function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) {\n if (maybeThenable.constructor === promise.constructor &&\n then === lib$es6$promise$then$$default &&\n constructor.resolve === lib$es6$promise$promise$resolve$$default) {\n lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);\n } else {\n if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);\n } else if (then === undefined) {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n } else if (lib$es6$promise$utils$$isFunction(then)) {\n lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);\n } else {\n lib$es6$promise$$internal$$fulfill(promise, maybeThenable);\n }\n }\n }\n\n function lib$es6$promise$$internal$$resolve(promise, value) {\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());\n } else if (lib$es6$promise$utils$$objectOrFunction(value)) {\n lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value));\n } else {\n lib$es6$promise$$internal$$fulfill(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n lib$es6$promise$$internal$$publish(promise);\n }\n\n function lib$es6$promise$$internal$$fulfill(promise, value) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n\n promise._result = value;\n promise._state = lib$es6$promise$$internal$$FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);\n }\n }\n\n function lib$es6$promise$$internal$$reject(promise, reason) {\n if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }\n promise._state = lib$es6$promise$$internal$$REJECTED;\n promise._result = reason;\n\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);\n }\n\n function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {\n var subscribers = parent._subscribers;\n var length = subscribers.length;\n\n parent._onerror = null;\n\n subscribers[length] = child;\n subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;\n subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);\n }\n }\n\n function lib$es6$promise$$internal$$publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) { return; }\n\n var child, callback, detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n }\n\n function lib$es6$promise$$internal$$ErrorObject() {\n this.error = null;\n }\n\n var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();\n\n function lib$es6$promise$$internal$$tryCatch(callback, detail) {\n try {\n return callback(detail);\n } catch(e) {\n lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;\n return lib$es6$promise$$internal$$TRY_CATCH_ERROR;\n }\n }\n\n function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {\n var hasCallback = lib$es6$promise$utils$$isFunction(callback),\n value, error, succeeded, failed;\n\n if (hasCallback) {\n value = lib$es6$promise$$internal$$tryCatch(callback, detail);\n\n if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value = null;\n } else {\n succeeded = true;\n }\n\n if (promise === value) {\n lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());\n return;\n }\n\n } else {\n value = detail;\n succeeded = true;\n }\n\n if (promise._state !== lib$es6$promise$$internal$$PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n lib$es6$promise$$internal$$resolve(promise, value);\n } else if (failed) {\n lib$es6$promise$$internal$$reject(promise, error);\n } else if (settled === lib$es6$promise$$internal$$FULFILLED) {\n lib$es6$promise$$internal$$fulfill(promise, value);\n } else if (settled === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n }\n }\n\n function lib$es6$promise$$internal$$initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value){\n lib$es6$promise$$internal$$resolve(promise, value);\n }, function rejectPromise(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n });\n } catch(e) {\n lib$es6$promise$$internal$$reject(promise, e);\n }\n }\n\n function lib$es6$promise$promise$all$$all(entries) {\n return new lib$es6$promise$enumerator$$default(this, entries).promise;\n }\n var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;\n function lib$es6$promise$promise$race$$race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (!lib$es6$promise$utils$$isArray(entries)) {\n lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));\n return promise;\n }\n\n var length = entries.length;\n\n function onFulfillment(value) {\n lib$es6$promise$$internal$$resolve(promise, value);\n }\n\n function onRejection(reason) {\n lib$es6$promise$$internal$$reject(promise, reason);\n }\n\n for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);\n }\n\n return promise;\n }\n var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;\n function lib$es6$promise$promise$reject$$reject(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$reject(promise, reason);\n return promise;\n }\n var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;\n\n var lib$es6$promise$promise$$counter = 0;\n\n function lib$es6$promise$promise$$needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n }\n\n function lib$es6$promise$promise$$needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n }\n\n var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;\n /**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n var promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {function} resolver\n Useful for tooling.\n @constructor\n */\n function lib$es6$promise$promise$$Promise(resolver) {\n this._id = lib$es6$promise$promise$$counter++;\n this._state = undefined;\n this._result = undefined;\n this._subscribers = [];\n\n if (lib$es6$promise$$internal$$noop !== resolver) {\n typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver();\n this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew();\n }\n }\n\n lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;\n lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;\n lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;\n lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;\n lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;\n lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;\n lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;\n\n lib$es6$promise$promise$$Promise.prototype = {\n constructor: lib$es6$promise$promise$$Promise,\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n\n Chaining\n --------\n\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n\n Assimilation\n ------------\n\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n\n If the assimliated promise rejects, then the downstream promise will also reject.\n\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n\n Simple Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var result;\n\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n\n Advanced Example\n --------------\n\n Synchronous Example\n\n ```javascript\n var author, books;\n\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n\n Errback Example\n\n ```js\n\n function foundBooks(books) {\n\n }\n\n function failure(reason) {\n\n }\n\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n\n Promise Example;\n\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n then: lib$es6$promise$then$$default,\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n 'catch': function(onRejection) {\n return this.then(null, onRejection);\n }\n };\n var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;\n function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(lib$es6$promise$$internal$$noop);\n\n if (Array.isArray(input)) {\n this._input = input;\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate();\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(this.promise, this._result);\n }\n }\n } else {\n lib$es6$promise$$internal$$reject(this.promise, this._validationError());\n }\n }\n\n lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {\n return new Error('Array Methods must be provided an Array');\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {\n var length = this.length;\n var input = this._input;\n\n for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {\n var c = this._instanceConstructor;\n var resolve = c.resolve;\n\n if (resolve === lib$es6$promise$promise$resolve$$default) {\n var then = lib$es6$promise$$internal$$getThen(entry);\n\n if (then === lib$es6$promise$then$$default &&\n entry._state !== lib$es6$promise$$internal$$PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === lib$es6$promise$promise$$default) {\n var promise = new c(lib$es6$promise$$internal$$noop);\n lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then);\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);\n }\n } else {\n this._willSettleAt(resolve(entry), i);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {\n var promise = this.promise;\n\n if (promise._state === lib$es6$promise$$internal$$PENDING) {\n this._remaining--;\n\n if (state === lib$es6$promise$$internal$$REJECTED) {\n lib$es6$promise$$internal$$reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n lib$es6$promise$$internal$$fulfill(promise, this._result);\n }\n };\n\n lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {\n var enumerator = this;\n\n lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {\n enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);\n }, function(reason) {\n enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);\n });\n };\n function lib$es6$promise$polyfill$$polyfill() {\n var local;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {\n return;\n }\n\n local.Promise = lib$es6$promise$promise$$default;\n }\n var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;\n\n var lib$es6$promise$umd$$ES6Promise = {\n 'Promise': lib$es6$promise$promise$$default,\n 'polyfill': lib$es6$promise$polyfill$$default\n };\n\n /* global define:true module:true window: true */\n if (typeof define === 'function' && define['amd']) {\n define(function() { return lib$es6$promise$umd$$ES6Promise; });\n } else if (typeof module !== 'undefined' && module['exports']) {\n module['exports'] = lib$es6$promise$umd$$ES6Promise;\n } else if (typeof this !== 'undefined') {\n this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;\n }\n\n lib$es6$promise$polyfill$$default();\n}).call(this);\n\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/*! https://mths.be/utf8js v2.0.0 by @mathias */\n;(function(root) {\n\n\t// Detect free variables `exports`\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code,\n\t// and use it as `root`\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar stringFromCharCode = String.fromCharCode;\n\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2decode(string) {\n\t\tvar output = [];\n\t\tvar counter = 0;\n\t\tvar length = string.length;\n\t\tvar value;\n\t\tvar extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t// Taken from https://mths.be/punycode\n\tfunction ucs2encode(array) {\n\t\tvar length = array.length;\n\t\tvar index = -1;\n\t\tvar value;\n\t\tvar output = '';\n\t\twhile (++index < length) {\n\t\t\tvalue = array[index];\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t}\n\t\treturn output;\n\t}\n\n\tfunction checkScalarValue(codePoint) {\n\t\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t}\n\t/*--------------------------------------------------------------------------*/\n\n\tfunction createByte(codePoint, shift) {\n\t\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n\t}\n\n\tfunction encodeCodePoint(codePoint) {\n\t\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\t\treturn stringFromCharCode(codePoint);\n\t\t}\n\t\tvar symbol = '';\n\t\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t\t}\n\t\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\t\tcheckScalarValue(codePoint);\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\t\tsymbol += createByte(codePoint, 12);\n\t\t\tsymbol += createByte(codePoint, 6);\n\t\t}\n\t\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\t\treturn symbol;\n\t}\n\n\tfunction utf8encode(string) {\n\t\tvar codePoints = ucs2decode(string);\n\t\tvar length = codePoints.length;\n\t\tvar index = -1;\n\t\tvar codePoint;\n\t\tvar byteString = '';\n\t\twhile (++index < length) {\n\t\t\tcodePoint = codePoints[index];\n\t\t\tbyteString += encodeCodePoint(codePoint);\n\t\t}\n\t\treturn byteString;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tfunction readContinuationByte() {\n\t\tif (byteIndex >= byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\n\t\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\n\t\tif ((continuationByte & 0xC0) == 0x80) {\n\t\t\treturn continuationByte & 0x3F;\n\t\t}\n\n\t\t// If we end up here, it’s not a continuation byte\n\t\tthrow Error('Invalid continuation byte');\n\t}\n\n\tfunction decodeSymbol() {\n\t\tvar byte1;\n\t\tvar byte2;\n\t\tvar byte3;\n\t\tvar byte4;\n\t\tvar codePoint;\n\n\t\tif (byteIndex > byteCount) {\n\t\t\tthrow Error('Invalid byte index');\n\t\t}\n\n\t\tif (byteIndex == byteCount) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Read first byte\n\t\tbyte1 = byteArray[byteIndex] & 0xFF;\n\t\tbyteIndex++;\n\n\t\t// 1-byte sequence (no continuation bytes)\n\t\tif ((byte1 & 0x80) == 0) {\n\t\t\treturn byte1;\n\t\t}\n\n\t\t// 2-byte sequence\n\t\tif ((byte1 & 0xE0) == 0xC0) {\n\t\t\tvar byte2 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\t\tif (codePoint >= 0x80) {\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\n\t\t// 3-byte sequence (may include unpaired surrogates)\n\t\tif ((byte1 & 0xF0) == 0xE0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\t\tif (codePoint >= 0x0800) {\n\t\t\t\tcheckScalarValue(codePoint);\n\t\t\t\treturn codePoint;\n\t\t\t} else {\n\t\t\t\tthrow Error('Invalid continuation byte');\n\t\t\t}\n\t\t}\n\n\t\t// 4-byte sequence\n\t\tif ((byte1 & 0xF8) == 0xF0) {\n\t\t\tbyte2 = readContinuationByte();\n\t\t\tbyte3 = readContinuationByte();\n\t\t\tbyte4 = readContinuationByte();\n\t\t\tcodePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |\n\t\t\t\t(byte3 << 0x06) | byte4;\n\t\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\t\treturn codePoint;\n\t\t\t}\n\t\t}\n\n\t\tthrow Error('Invalid UTF-8 detected');\n\t}\n\n\tvar byteArray;\n\tvar byteCount;\n\tvar byteIndex;\n\tfunction utf8decode(byteString) {\n\t\tbyteArray = ucs2decode(byteString);\n\t\tbyteCount = byteArray.length;\n\t\tbyteIndex = 0;\n\t\tvar codePoints = [];\n\t\tvar tmp;\n\t\twhile ((tmp = decodeSymbol()) !== false) {\n\t\t\tcodePoints.push(tmp);\n\t\t}\n\t\treturn ucs2encode(codePoints);\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar utf8 = {\n\t\t'version': '2.0.0',\n\t\t'encode': utf8encode,\n\t\t'decode': utf8decode\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn utf8;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = utf8;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tvar object = {};\n\t\t\tvar hasOwnProperty = object.hasOwnProperty;\n\t\t\tfor (var key in utf8) {\n\t\t\t\thasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.utf8 = utf8;\n\t}\n\n}(this));\n","/*!\n * @overview Github.js\n *\n * @copyright (c) 2013 Michael Aufreiter, Development Seed\n * Github.js is freely distributable.\n *\n * @license Licensed under BSD-3-Clause-Clear\n *\n * For all details and documentation:\n * http://substance.io/michael/github\n */\n'use strict';\n\nvar Utf8 = require('utf8');\nvar axios = require('axios');\nvar Base64 = require('base-64');\nvar Promise = require('es6-promise');\n\n function b64encode(string) {\n return Base64.encode(Utf8.encode(string));\n }\n\n if (Promise.polyfill) {\n Promise.polyfill();\n }\n\n // Initial Setup\n // -------------\n\n function Github(options) {\n options = options || {};\n\n var API_URL = options.apiUrl || 'https://api.github.com';\n\n // HTTP Request Abstraction\n // =======\n //\n // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec.\n\n var _request = Github._request = function _request(method, path, data, cb, raw) {\n function getURL() {\n var url = path.indexOf('//') >= 0 ? path : API_URL + path;\n\n url += ((/\\?/).test(url) ? '&' : '?');\n\n if (data && typeof data === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) {\n for(var param in data) {\n if (data.hasOwnProperty(param)) {\n url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]);\n }\n }\n }\n\n return url.replace(/(×tamp=\\d+)/, '') +\n (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : '');\n }\n\n var config = {\n headers: {\n Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json',\n 'Content-Type': 'application/json;charset=UTF-8'\n },\n method: method,\n data: data ? data : {},\n url: getURL()\n };\n\n if ((options.token) || (options.username && options.password)) {\n config.headers.Authorization = options.token ?\n 'token ' + options.token :\n 'Basic ' + b64encode(options.username + ':' + options.password);\n }\n\n return axios(config)\n .then(function (response) {\n cb(\n null,\n response.data || true,\n response\n );\n }, function (response) {\n if (response.status === 304) {\n cb(\n null,\n response.data || true,\n response\n );\n } else {\n cb({\n path: path,\n request: response,\n error: response.status\n });\n }\n });\n };\n\n var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, singlePage, cb) {\n var results = [];\n\n (function iterate() {\n _request('GET', path, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n if (!(res instanceof Array)) {\n res = [res];\n }\n\n results.push.apply(results, res);\n\n var next = (xhr.headers.link || '')\n .split(',')\n .filter(function(link) {\n return /rel=\"next\"/.test(link);\n })\n .map(function(link) {\n return (/<(.*)>/.exec(link) || [])[1];\n })\n .pop();\n\n if (!next || singlePage) {\n cb(err, results, xhr);\n } else {\n path = next;\n iterate();\n }\n });\n })();\n };\n\n // User API\n // =======\n\n Github.User = function () {\n this.repos = function (options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = options || {};\n\n var url = '/user/repos';\n var params = [];\n\n params.push('type=' + encodeURIComponent(options.type || 'all'));\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n url += '?' + params.join('&');\n\n _requestAllPages(url, !!options.page, cb);\n };\n\n // List user organizations\n // -------\n\n this.orgs = function (cb) {\n _request('GET', '/user/orgs', null, cb);\n };\n\n // List authenticated user's gists\n // -------\n\n this.gists = function (cb) {\n _request('GET', '/gists', null, cb);\n };\n\n // List authenticated user's unread notifications\n // -------\n\n this.notifications = function (options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = options || {};\n var url = '/notifications';\n var params = [];\n\n if (options.all) {\n params.push('all=true');\n }\n\n if (options.participating) {\n params.push('participating=true');\n }\n\n if (options.since) {\n var since = options.since;\n\n if (since.constructor === Date) {\n since = since.toISOString();\n }\n\n params.push('since=' + encodeURIComponent(since));\n }\n\n if (options.before) {\n var before = options.before;\n\n if (before.constructor === Date) {\n before = before.toISOString();\n }\n\n params.push('before=' + encodeURIComponent(before));\n }\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Show user information\n // -------\n\n this.show = function (username, cb) {\n var command = username ? '/users/' + username : '/user';\n\n _request('GET', command, null, cb);\n };\n\n // List user repositories\n // -------\n\n this.userRepos = function (username, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n var url = '/users/' + username + '/repos';\n var params = [];\n\n params.push('type=' + encodeURIComponent(options.type || 'all'));\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n url += '?' + params.join('&');\n\n _requestAllPages(url, !!options.page, cb);\n };\n\n // List user starred repositories\n // -------\n\n this.userStarred = function (username, cb) {\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\n var request = '/users/' + username + '/starred?type=all&per_page=100';\n _requestAllPages(request, false, cb);\n };\n\n // List a user's gists\n // -------\n\n this.userGists = function (username, cb) {\n _request('GET', '/users/' + username + '/gists', null, cb);\n };\n\n // List organization repositories\n // -------\n\n this.orgRepos = function (orgname, cb) {\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\n var request = '/orgs/' + orgname + '/repos?type=all&&page_num=100&sort=updated&direction=desc';\n _requestAllPages(request, false, cb);\n };\n\n // Follow user\n // -------\n\n this.follow = function (username, cb) {\n _request('PUT', '/user/following/' + username, null, cb);\n };\n\n // Unfollow user\n // -------\n\n this.unfollow = function (username, cb) {\n _request('DELETE', '/user/following/' + username, null, cb);\n };\n\n // Create a repo\n // -------\n this.createRepo = function (options, cb) {\n _request('POST', '/user/repos', options, cb);\n };\n };\n\n // Repository API\n // =======\n\n Github.Repository = function (options) {\n var repo = options.name;\n var user = options.user;\n var fullname = options.fullname;\n\n var that = this;\n var repoPath;\n\n if (fullname) {\n repoPath = '/repos/' + fullname;\n } else {\n repoPath = '/repos/' + user + '/' + repo;\n }\n\n var currentTree = {\n branch: null,\n sha: null\n };\n\n // Uses the cache if branch has not been changed\n // -------\n\n function updateTree(branch, cb) {\n if (branch === currentTree.branch && currentTree.sha) {\n return cb(null, currentTree.sha);\n }\n\n that.getRef('heads/' + branch, function (err, sha) {\n currentTree.branch = branch;\n currentTree.sha = sha;\n cb(err, sha);\n });\n }\n\n // Get a particular reference\n // -------\n\n this.getRef = function (ref, cb) {\n _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.object.sha, xhr);\n });\n };\n\n // Create a new reference\n // --------\n //\n // {\n // \"ref\": \"refs/heads/my-new-branch-name\",\n // \"sha\": \"827efc6d56897b048c772eb4087f854f46256132\"\n // }\n\n this.createRef = function (options, cb) {\n _request('POST', repoPath + '/git/refs', options, cb);\n };\n\n // Delete a reference\n // --------\n //\n // Repo.deleteRef('heads/gh-pages')\n // repo.deleteRef('tags/v1.0')\n\n this.deleteRef = function (ref, cb) {\n _request('DELETE', repoPath + '/git/refs/' + ref, options, cb);\n };\n\n // Delete a repo\n // --------\n\n this.deleteRepo = function (cb) {\n _request('DELETE', repoPath, options, cb);\n };\n\n // List all tags of a repository\n // -------\n\n this.listTags = function (cb) {\n _request('GET', repoPath + '/tags', null, cb);\n };\n\n // List all pull requests of a respository\n // -------\n\n this.listPulls = function (options, cb) {\n options = options || {};\n var url = repoPath + '/pulls';\n var params = [];\n\n if (typeof options === 'string') {\n // Backward compatibility\n params.push('state=' + options);\n } else {\n if (options.state) {\n params.push('state=' + encodeURIComponent(options.state));\n }\n\n if (options.head) {\n params.push('head=' + encodeURIComponent(options.head));\n }\n\n if (options.base) {\n params.push('base=' + encodeURIComponent(options.base));\n }\n\n if (options.sort) {\n params.push('sort=' + encodeURIComponent(options.sort));\n }\n\n if (options.direction) {\n params.push('direction=' + encodeURIComponent(options.direction));\n }\n\n if (options.page) {\n params.push('page=' + options.page);\n }\n\n if (options.per_page) {\n params.push('per_page=' + options.per_page);\n }\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Gets details for a specific pull request\n // -------\n\n this.getPull = function (number, cb) {\n _request('GET', repoPath + '/pulls/' + number, null, cb);\n };\n\n // Retrieve the changes made between base and head\n // -------\n\n this.compare = function (base, head, cb) {\n _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb);\n };\n\n // List all branches of a repository\n // -------\n\n this.listBranches = function (cb) {\n _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) {\n if (err) {\n return cb(err);\n }\n\n heads = heads.map(function (head) {\n return head.ref.replace(/^refs\\/heads\\//, '');\n });\n\n cb(null, heads, xhr);\n });\n };\n\n // Retrieve the contents of a blob\n // -------\n\n this.getBlob = function (sha, cb) {\n _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw');\n };\n\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\n // -------\n\n this.getCommit = function (branch, sha, cb) {\n _request('GET', repoPath + '/git/commits/' + sha, null, cb);\n };\n\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\n // -------\n\n this.getSha = function (branch, path, cb) {\n if (!path || path === '') {\n return that.getRef('heads/' + branch, cb);\n }\n\n _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''),\n null, function (err, pathContent, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, pathContent.sha, xhr);\n });\n };\n\n // Get the statuses for a particular SHA\n // -------\n\n this.getStatuses = function (sha, cb) {\n _request('GET', repoPath + '/statuses/' + sha, null, cb);\n };\n\n // Retrieve the tree a commit points to\n // -------\n\n this.getTree = function (tree, cb) {\n _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.tree, xhr);\n });\n };\n\n // Post a new blob object, getting a blob SHA back\n // -------\n\n this.postBlob = function (content, cb) {\n if (typeof content === 'string') {\n content = {\n content: Utf8.encode(content),\n encoding: 'utf-8'\n };\n } else {\n if (typeof Buffer !== 'undefined' && content instanceof Buffer) {\n // in NodeJS\n content = {\n content: content.toString('base64'),\n encoding: 'base64'\n };\n } else if (typeof Blob !== 'undefined' && content instanceof Blob) {\n content = {\n content: b64encode(content),\n encoding: 'base64'\n };\n } else {\n throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)');\n }\n }\n\n _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Update an existing tree adding a new blob object getting a tree SHA back\n // -------\n\n this.updateTree = function (baseTree, path, blob, cb) {\n var data = {\n base_tree: baseTree,\n tree: [\n {\n path: path,\n mode: '100644',\n type: 'blob',\n sha: blob\n }\n ]\n };\n\n _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Post a new tree object having a file path pointer replaced\n // with a new blob SHA getting a tree SHA back\n // -------\n\n this.postTree = function (tree, cb) {\n _request('POST', repoPath + '/git/trees', {\n tree: tree\n }, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Create a new commit object with the current commit SHA as the parent\n // and the new tree SHA, getting a commit SHA back\n // -------\n\n this.commit = function (parent, tree, message, cb) {\n var user = new Github.User();\n\n user.show(null, function (err, userData) {\n if (err) {\n return cb(err);\n }\n\n var data = {\n message: message,\n author: {\n name: options.user,\n email: userData.email\n },\n parents: [\n parent\n ],\n tree: tree\n };\n\n _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n currentTree.sha = res.sha; // Update latest commit\n\n cb(null, res.sha, xhr);\n });\n });\n };\n\n // Update the reference of your head to point to the new commit SHA\n // -------\n\n this.updateHead = function (head, commit, cb) {\n _request('PATCH', repoPath + '/git/refs/heads/' + head, {\n sha: commit\n }, cb);\n };\n\n // Show repository information\n // -------\n\n this.show = function (cb) {\n _request('GET', repoPath, null, cb);\n };\n\n // Show repository contributors\n // -------\n\n this.contributors = function (cb, retry) {\n retry = retry || 1000;\n var that = this;\n\n _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) {\n if (err) {\n return cb(err);\n }\n\n if (xhr.status === 202) {\n setTimeout(\n function () {\n that.contributors(cb, retry);\n },\n retry\n );\n } else {\n cb(err, data, xhr);\n }\n });\n };\n\n // Get contents\n // --------\n\n this.contents = function (ref, path, cb) {\n path = encodeURI(path);\n _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), {\n ref: ref\n }, cb);\n };\n\n // Fork repository\n // -------\n\n this.fork = function (cb) {\n _request('POST', repoPath + '/forks', null, cb);\n };\n\n // List forks\n // --------\n\n this.listForks = function (cb) {\n _request('GET', repoPath + '/forks', null, cb);\n };\n\n // Branch repository\n // --------\n\n this.branch = function (oldBranch, newBranch, cb) {\n if (arguments.length === 2 && typeof arguments[1] === 'function') {\n cb = newBranch;\n newBranch = oldBranch;\n oldBranch = 'master';\n }\n\n this.getRef('heads/' + oldBranch, function (err, ref) {\n if (err && cb) {\n return cb(err);\n }\n\n that.createRef({\n ref: 'refs/heads/' + newBranch,\n sha: ref\n }, cb);\n });\n };\n\n // Create pull request\n // --------\n\n this.createPullRequest = function (options, cb) {\n _request('POST', repoPath + '/pulls', options, cb);\n };\n\n // List hooks\n // --------\n\n this.listHooks = function (cb) {\n _request('GET', repoPath + '/hooks', null, cb);\n };\n\n // Get a hook\n // --------\n\n this.getHook = function (id, cb) {\n _request('GET', repoPath + '/hooks/' + id, null, cb);\n };\n\n // Create a hook\n // --------\n\n this.createHook = function (options, cb) {\n _request('POST', repoPath + '/hooks', options, cb);\n };\n\n // Edit a hook\n // --------\n\n this.editHook = function (id, options, cb) {\n _request('PATCH', repoPath + '/hooks/' + id, options, cb);\n };\n\n // Delete a hook\n // --------\n\n this.deleteHook = function (id, cb) {\n _request('DELETE', repoPath + '/hooks/' + id, null, cb);\n };\n\n // Read file at given path\n // -------\n\n this.read = function (branch, path, cb) {\n _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''),\n null, cb, true);\n };\n\n // Remove a file\n // -------\n\n this.remove = function (branch, path, cb) {\n that.getSha(branch, path, function (err, sha) {\n if (err) {\n return cb(err);\n }\n\n _request('DELETE', repoPath + '/contents/' + path, {\n message: path + ' is removed',\n sha: sha,\n branch: branch\n }, cb);\n });\n };\n\n // Alias for repo.remove for backwards comapt.\n // -------\n this.delete = this.remove;\n\n // Move a file to a new location\n // -------\n\n this.move = function (branch, path, newPath, cb) {\n updateTree(branch, function (err, latestCommit) {\n that.getTree(latestCommit + '?recursive=true', function (err, tree) {\n // Update Tree\n tree.forEach(function (ref) {\n if (ref.path === path) {\n ref.path = newPath;\n }\n\n if (ref.type === 'tree') {\n delete ref.sha;\n }\n });\n\n that.postTree(tree, function (err, rootTree) {\n that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) {\n that.updateHead(branch, commit, cb);\n });\n });\n });\n });\n };\n\n // Write file contents to a given branch and path\n // -------\n\n this.write = function (branch, path, content, message, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n that.getSha(branch, encodeURI(path), function (err, sha) {\n var writeOptions = {\n message: message,\n content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content,\n branch: branch,\n committer: options && options.committer ? options.committer : undefined,\n author: options && options.author ? options.author : undefined\n };\n\n // If no error, we set the sha to overwrite an existing file\n if (!(err && err.error !== 404)) {\n writeOptions.sha = sha;\n }\n\n _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb);\n });\n };\n\n // List commits on a repository. Takes an object of optional parameters:\n // sha: SHA or branch to start listing commits from\n // path: Only commits containing this file path will be returned\n // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address\n // since: ISO 8601 date - only commits after this date will be returned\n // until: ISO 8601 date - only commits before this date will be returned\n // -------\n\n this.getCommits = function (options, cb) {\n options = options || {};\n var url = repoPath + '/commits';\n var params = [];\n\n if (options.sha) {\n params.push('sha=' + encodeURIComponent(options.sha));\n }\n\n if (options.path) {\n params.push('path=' + encodeURIComponent(options.path));\n }\n\n if (options.author) {\n params.push('author=' + encodeURIComponent(options.author));\n }\n\n if (options.since) {\n var since = options.since;\n\n if (since.constructor === Date) {\n since = since.toISOString();\n }\n\n params.push('since=' + encodeURIComponent(since));\n }\n\n if (options.until) {\n var until = options.until;\n\n if (until.constructor === Date) {\n until = until.toISOString();\n }\n\n params.push('until=' + encodeURIComponent(until));\n }\n\n if (options.page) {\n params.push('page=' + options.page);\n }\n\n if (options.perpage) {\n params.push('per_page=' + options.perpage);\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Check if a repository is starred.\n // --------\n\n this.isStarred = function(owner, repository, cb) {\n _request('GET', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Star a repository.\n // --------\n\n this.star = function(owner, repository, cb) {\n _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Unstar a repository.\n // --------\n\n this.unstar = function(owner, repository, cb) {\n _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Create a new release\n // --------\n\n this.createRelease = function(options, cb) {\n _request('POST', repoPath + '/releases', options, cb);\n };\n\n // Edit a release\n // --------\n\n this.editRelease = function(id, options, cb) {\n _request('PATCH', repoPath + '/releases/' + id, options, cb);\n };\n\n // Get a single release\n // --------\n\n this.getRelease = function(id, cb) {\n _request('GET', repoPath + '/releases/' + id, null, cb);\n };\n\n // Remove a release\n // --------\n\n this.deleteRelease = function(id, cb) {\n _request('DELETE', repoPath + '/releases/' + id, null, cb);\n };\n };\n\n // Gists API\n // =======\n\n Github.Gist = function (options) {\n var id = options.id;\n var gistPath = '/gists/' + id;\n\n // Read the gist\n // --------\n\n this.read = function (cb) {\n _request('GET', gistPath, null, cb);\n };\n\n // Create the gist\n // --------\n // {\n // \"description\": \"the description for this gist\",\n // \"public\": true,\n // \"files\": {\n // \"file1.txt\": {\n // \"content\": \"String file contents\"\n // }\n // }\n // }\n\n this.create = function (options, cb) {\n _request('POST', '/gists', options, cb);\n };\n\n // Delete the gist\n // --------\n\n this.delete = function (cb) {\n _request('DELETE', gistPath, null, cb);\n };\n\n // Fork a gist\n // --------\n\n this.fork = function (cb) {\n _request('POST', gistPath + '/fork', null, cb);\n };\n\n // Update a gist with the new stuff\n // --------\n\n this.update = function (options, cb) {\n _request('PATCH', gistPath, options, cb);\n };\n\n // Star a gist\n // --------\n\n this.star = function (cb) {\n _request('PUT', gistPath + '/star', null, cb);\n };\n\n // Untar a gist\n // --------\n\n this.unstar = function (cb) {\n _request('DELETE', gistPath + '/star', null, cb);\n };\n\n // Check if a gist is starred\n // --------\n\n this.isStarred = function (cb) {\n _request('GET', gistPath + '/star', null, cb);\n };\n };\n\n // Issues API\n // ==========\n\n Github.Issue = function (options) {\n var path = '/repos/' + options.user + '/' + options.repo + '/issues';\n\n this.create = function(options, cb) {\n _request('POST', path, options, cb);\n };\n\n this.list = function (options, cb) {\n var query = [];\n\n Object.keys(options).forEach(function(option) {\n query.push(encodeURIComponent(option) + '=' + encodeURIComponent(options[option]));\n });\n\n _requestAllPages(path + '?' + query.join('&'), !!options.page, cb);\n };\n\n this.comment = function (issue, comment, cb) {\n _request('POST', issue.comments_url, {\n body: comment\n }, cb);\n };\n\n this.edit = function (issue, options, cb) {\n _request('PATCH', path + '/' + issue, options, cb);\n };\n\n this.get = function (issue, cb) {\n _request('GET', path + '/' + issue, null, cb);\n };\n };\n\n // Search API\n // ==========\n\n Github.Search = function (options) {\n var path = '/search/';\n var query = '?q=' + options.query;\n\n this.repositories = function (options, cb) {\n _request('GET', path + 'repositories' + query, options, cb);\n };\n\n this.code = function (options, cb) {\n _request('GET', path + 'code' + query, options, cb);\n };\n\n this.issues = function (options, cb) {\n _request('GET', path + 'issues' + query, options, cb);\n };\n\n this.users = function (options, cb) {\n _request('GET', path + 'users' + query, options, cb);\n };\n };\n\n // Rate Limit API\n // ==========\n\n Github.RateLimit = function() {\n this.getRateLimit = function(cb) {\n _request('GET', '/rate_limit', null, cb);\n };\n };\n\n return Github;\n };\n\n // Top Level API\n // -------\n\n Github.getIssues = function (user, repo) {\n return new Github.Issue({\n user: user,\n repo: repo\n });\n };\n\n Github.getRepo = function (user, repo) {\n if (!repo) {\n return new Github.Repository({\n fullname: user\n });\n } else {\n return new Github.Repository({\n user: user,\n name: repo\n });\n }\n };\n\n Github.getUser = function () {\n return new Github.User();\n };\n\n Github.getGist = function (id) {\n return new Github.Gist({\n id: id\n });\n };\n\n Github.getSearch = function (query) {\n return new Github.Search({\n query: query\n });\n };\n\n Github.getRateLimit = function() {\n return new Github.RateLimit();\n };\n\nmodule.exports = Github;\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/github.js b/dist/github.js new file mode 100644 index 00000000..b5dd38a2 --- /dev/null +++ b/dist/github.js @@ -0,0 +1,1136 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define(['module', 'utf8', 'axios', 'base-64', 'es6-promise'], factory); + } else if (typeof exports !== "undefined") { + factory(module, require('utf8'), require('axios'), require('base-64'), require('es6-promise')); + } else { + var mod = { + exports: {} + }; + factory(mod, global.utf8, global.axios, global.base64, global.Promise); + global.github = mod.exports; + } +})(this, function (module, Utf8, axios, Base64, Promise) { + /*! + * @overview Github.js + * + * @copyright (c) 2013 Michael Aufreiter, Development Seed + * Github.js is freely distributable. + * + * @license Licensed under BSD-3-Clause-Clear + * + * For all details and documentation: + * http://substance.io/michael/github + */ + 'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; + }; + + function b64encode(string) { + return Base64.encode(Utf8.encode(string)); + } + + if (Promise.polyfill) { + Promise.polyfill(); + } + + // Initial Setup + // ------------- + + function Github(options) { + options = options || {}; + + var API_URL = options.apiUrl || 'https://api.github.com'; + + // HTTP Request Abstraction + // ======= + // + // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec. + + var _request = Github._request = function _request(method, path, data, cb, raw) { + function getURL() { + var url = path.indexOf('//') >= 0 ? path : API_URL + path; + + url += /\?/.test(url) ? '&' : '?'; + + if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) { + for (var param in data) { + if (data.hasOwnProperty(param)) { + url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]); + } + } + } + + return url.replace(/(×tamp=\d+)/, '') + (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : ''); + } + + var config = { + headers: { + Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json', + 'Content-Type': 'application/json;charset=UTF-8' + }, + method: method, + data: data ? data : {}, + url: getURL() + }; + + if (options.token || options.username && options.password) { + config.headers.Authorization = options.token ? 'token ' + options.token : 'Basic ' + b64encode(options.username + ':' + options.password); + } + + return axios(config).then(function (response) { + cb(null, response.data || true, response); + }, function (response) { + if (response.status === 304) { + cb(null, response.data || true, response); + } else { + cb({ + path: path, + request: response, + error: response.status + }); + } + }); + }; + + var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, singlePage, cb) { + var results = []; + + (function iterate() { + _request('GET', path, null, function (err, res, xhr) { + if (err) { + return cb(err); + } + + if (!(res instanceof Array)) { + res = [res]; + } + + results.push.apply(results, res); + + var next = (xhr.headers.link || '').split(',').filter(function (link) { + return (/rel="next"/.test(link) + ); + }).map(function (link) { + return (/<(.*)>/.exec(link) || [])[1]; + }).pop(); + + if (!next || singlePage) { + cb(err, results, xhr); + } else { + path = next; + iterate(); + } + }); + })(); + }; + + // User API + // ======= + + Github.User = function () { + this.repos = function (options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + options = options || {}; + + var url = '/user/repos'; + var params = []; + + params.push('type=' + encodeURIComponent(options.type || 'all')); + params.push('sort=' + encodeURIComponent(options.sort || 'updated')); + params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore + + if (options.page) { + params.push('page=' + encodeURIComponent(options.page)); + } + + url += '?' + params.join('&'); + + _requestAllPages(url, !!options.page, cb); + }; + + // List user organizations + // ------- + + this.orgs = function (cb) { + _request('GET', '/user/orgs', null, cb); + }; + + // List authenticated user's gists + // ------- + + this.gists = function (cb) { + _request('GET', '/gists', null, cb); + }; + + // List authenticated user's unread notifications + // ------- + + this.notifications = function (options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + options = options || {}; + var url = '/notifications'; + var params = []; + + if (options.all) { + params.push('all=true'); + } + + if (options.participating) { + params.push('participating=true'); + } + + if (options.since) { + var since = options.since; + + if (since.constructor === Date) { + since = since.toISOString(); + } + + params.push('since=' + encodeURIComponent(since)); + } + + if (options.before) { + var before = options.before; + + if (before.constructor === Date) { + before = before.toISOString(); + } + + params.push('before=' + encodeURIComponent(before)); + } + + if (options.page) { + params.push('page=' + encodeURIComponent(options.page)); + } + + if (params.length > 0) { + url += '?' + params.join('&'); + } + + _request('GET', url, null, cb); + }; + + // Show user information + // ------- + + this.show = function (username, cb) { + var command = username ? '/users/' + username : '/user'; + + _request('GET', command, null, cb); + }; + + // List user repositories + // ------- + + this.userRepos = function (username, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + var url = '/users/' + username + '/repos'; + var params = []; + + params.push('type=' + encodeURIComponent(options.type || 'all')); + params.push('sort=' + encodeURIComponent(options.sort || 'updated')); + params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore + + if (options.page) { + params.push('page=' + encodeURIComponent(options.page)); + } + + url += '?' + params.join('&'); + + _requestAllPages(url, !!options.page, cb); + }; + + // List user starred repositories + // ------- + + this.userStarred = function (username, cb) { + // Github does not always honor the 1000 limit so we want to iterate over the data set. + var request = '/users/' + username + '/starred?type=all&per_page=100'; + _requestAllPages(request, false, cb); + }; + + // List a user's gists + // ------- + + this.userGists = function (username, cb) { + _request('GET', '/users/' + username + '/gists', null, cb); + }; + + // List organization repositories + // ------- + + this.orgRepos = function (orgname, cb) { + // Github does not always honor the 1000 limit so we want to iterate over the data set. + var request = '/orgs/' + orgname + '/repos?type=all&&page_num=100&sort=updated&direction=desc'; + _requestAllPages(request, false, cb); + }; + + // Follow user + // ------- + + this.follow = function (username, cb) { + _request('PUT', '/user/following/' + username, null, cb); + }; + + // Unfollow user + // ------- + + this.unfollow = function (username, cb) { + _request('DELETE', '/user/following/' + username, null, cb); + }; + + // Create a repo + // ------- + this.createRepo = function (options, cb) { + _request('POST', '/user/repos', options, cb); + }; + }; + + // Repository API + // ======= + + Github.Repository = function (options) { + var repo = options.name; + var user = options.user; + var fullname = options.fullname; + + var that = this; + var repoPath; + + if (fullname) { + repoPath = '/repos/' + fullname; + } else { + repoPath = '/repos/' + user + '/' + repo; + } + + var currentTree = { + branch: null, + sha: null + }; + + // Uses the cache if branch has not been changed + // ------- + + function updateTree(branch, cb) { + if (branch === currentTree.branch && currentTree.sha) { + return cb(null, currentTree.sha); + } + + that.getRef('heads/' + branch, function (err, sha) { + currentTree.branch = branch; + currentTree.sha = sha; + cb(err, sha); + }); + } + + // Get a particular reference + // ------- + + this.getRef = function (ref, cb) { + _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) { + if (err) { + return cb(err); + } + + cb(null, res.object.sha, xhr); + }); + }; + + // Create a new reference + // -------- + // + // { + // "ref": "refs/heads/my-new-branch-name", + // "sha": "827efc6d56897b048c772eb4087f854f46256132" + // } + + this.createRef = function (options, cb) { + _request('POST', repoPath + '/git/refs', options, cb); + }; + + // Delete a reference + // -------- + // + // Repo.deleteRef('heads/gh-pages') + // repo.deleteRef('tags/v1.0') + + this.deleteRef = function (ref, cb) { + _request('DELETE', repoPath + '/git/refs/' + ref, options, cb); + }; + + // Delete a repo + // -------- + + this.deleteRepo = function (cb) { + _request('DELETE', repoPath, options, cb); + }; + + // List all tags of a repository + // ------- + + this.listTags = function (cb) { + _request('GET', repoPath + '/tags', null, cb); + }; + + // List all pull requests of a respository + // ------- + + this.listPulls = function (options, cb) { + options = options || {}; + var url = repoPath + '/pulls'; + var params = []; + + if (typeof options === 'string') { + // Backward compatibility + params.push('state=' + options); + } else { + if (options.state) { + params.push('state=' + encodeURIComponent(options.state)); + } + + if (options.head) { + params.push('head=' + encodeURIComponent(options.head)); + } + + if (options.base) { + params.push('base=' + encodeURIComponent(options.base)); + } + + if (options.sort) { + params.push('sort=' + encodeURIComponent(options.sort)); + } + + if (options.direction) { + params.push('direction=' + encodeURIComponent(options.direction)); + } + + if (options.page) { + params.push('page=' + options.page); + } + + if (options.per_page) { + params.push('per_page=' + options.per_page); + } + } + + if (params.length > 0) { + url += '?' + params.join('&'); + } + + _request('GET', url, null, cb); + }; + + // Gets details for a specific pull request + // ------- + + this.getPull = function (number, cb) { + _request('GET', repoPath + '/pulls/' + number, null, cb); + }; + + // Retrieve the changes made between base and head + // ------- + + this.compare = function (base, head, cb) { + _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb); + }; + + // List all branches of a repository + // ------- + + this.listBranches = function (cb) { + _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) { + if (err) { + return cb(err); + } + + heads = heads.map(function (head) { + return head.ref.replace(/^refs\/heads\//, ''); + }); + + cb(null, heads, xhr); + }); + }; + + // Retrieve the contents of a blob + // ------- + + this.getBlob = function (sha, cb) { + _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw'); + }; + + // For a given file path, get the corresponding sha (blob for files, tree for dirs) + // ------- + + this.getCommit = function (branch, sha, cb) { + _request('GET', repoPath + '/git/commits/' + sha, null, cb); + }; + + // For a given file path, get the corresponding sha (blob for files, tree for dirs) + // ------- + + this.getSha = function (branch, path, cb) { + if (!path || path === '') { + return that.getRef('heads/' + branch, cb); + } + + _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''), null, function (err, pathContent, xhr) { + if (err) { + return cb(err); + } + + cb(null, pathContent.sha, xhr); + }); + }; + + // Get the statuses for a particular SHA + // ------- + + this.getStatuses = function (sha, cb) { + _request('GET', repoPath + '/statuses/' + sha, null, cb); + }; + + // Retrieve the tree a commit points to + // ------- + + this.getTree = function (tree, cb) { + _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) { + if (err) { + return cb(err); + } + + cb(null, res.tree, xhr); + }); + }; + + // Post a new blob object, getting a blob SHA back + // ------- + + this.postBlob = function (content, cb) { + if (typeof content === 'string') { + content = { + content: Utf8.encode(content), + encoding: 'utf-8' + }; + } else { + if (typeof Buffer !== 'undefined' && content instanceof Buffer) { + // in NodeJS + content = { + content: content.toString('base64'), + encoding: 'base64' + }; + } else if (typeof Blob !== 'undefined' && content instanceof Blob) { + content = { + content: b64encode(content), + encoding: 'base64' + }; + } else { + throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)'); + } + } + + _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) { + if (err) { + return cb(err); + } + + cb(null, res.sha, xhr); + }); + }; + + // Update an existing tree adding a new blob object getting a tree SHA back + // ------- + + this.updateTree = function (baseTree, path, blob, cb) { + var data = { + base_tree: baseTree, + tree: [{ + path: path, + mode: '100644', + type: 'blob', + sha: blob + }] + }; + + _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) { + if (err) { + return cb(err); + } + + cb(null, res.sha, xhr); + }); + }; + + // Post a new tree object having a file path pointer replaced + // with a new blob SHA getting a tree SHA back + // ------- + + this.postTree = function (tree, cb) { + _request('POST', repoPath + '/git/trees', { + tree: tree + }, function (err, res, xhr) { + if (err) { + return cb(err); + } + + cb(null, res.sha, xhr); + }); + }; + + // Create a new commit object with the current commit SHA as the parent + // and the new tree SHA, getting a commit SHA back + // ------- + + this.commit = function (parent, tree, message, cb) { + var user = new Github.User(); + + user.show(null, function (err, userData) { + if (err) { + return cb(err); + } + + var data = { + message: message, + author: { + name: options.user, + email: userData.email + }, + parents: [parent], + tree: tree + }; + + _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) { + if (err) { + return cb(err); + } + + currentTree.sha = res.sha; // Update latest commit + + cb(null, res.sha, xhr); + }); + }); + }; + + // Update the reference of your head to point to the new commit SHA + // ------- + + this.updateHead = function (head, commit, cb) { + _request('PATCH', repoPath + '/git/refs/heads/' + head, { + sha: commit + }, cb); + }; + + // Show repository information + // ------- + + this.show = function (cb) { + _request('GET', repoPath, null, cb); + }; + + // Show repository contributors + // ------- + + this.contributors = function (cb, retry) { + retry = retry || 1000; + var that = this; + + _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) { + if (err) { + return cb(err); + } + + if (xhr.status === 202) { + setTimeout(function () { + that.contributors(cb, retry); + }, retry); + } else { + cb(err, data, xhr); + } + }); + }; + + // Get contents + // -------- + + this.contents = function (ref, path, cb) { + path = encodeURI(path); + _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), { + ref: ref + }, cb); + }; + + // Fork repository + // ------- + + this.fork = function (cb) { + _request('POST', repoPath + '/forks', null, cb); + }; + + // List forks + // -------- + + this.listForks = function (cb) { + _request('GET', repoPath + '/forks', null, cb); + }; + + // Branch repository + // -------- + + this.branch = function (oldBranch, newBranch, cb) { + if (arguments.length === 2 && typeof arguments[1] === 'function') { + cb = newBranch; + newBranch = oldBranch; + oldBranch = 'master'; + } + + this.getRef('heads/' + oldBranch, function (err, ref) { + if (err && cb) { + return cb(err); + } + + that.createRef({ + ref: 'refs/heads/' + newBranch, + sha: ref + }, cb); + }); + }; + + // Create pull request + // -------- + + this.createPullRequest = function (options, cb) { + _request('POST', repoPath + '/pulls', options, cb); + }; + + // List hooks + // -------- + + this.listHooks = function (cb) { + _request('GET', repoPath + '/hooks', null, cb); + }; + + // Get a hook + // -------- + + this.getHook = function (id, cb) { + _request('GET', repoPath + '/hooks/' + id, null, cb); + }; + + // Create a hook + // -------- + + this.createHook = function (options, cb) { + _request('POST', repoPath + '/hooks', options, cb); + }; + + // Edit a hook + // -------- + + this.editHook = function (id, options, cb) { + _request('PATCH', repoPath + '/hooks/' + id, options, cb); + }; + + // Delete a hook + // -------- + + this.deleteHook = function (id, cb) { + _request('DELETE', repoPath + '/hooks/' + id, null, cb); + }; + + // Read file at given path + // ------- + + this.read = function (branch, path, cb) { + _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''), null, cb, true); + }; + + // Remove a file + // ------- + + this.remove = function (branch, path, cb) { + that.getSha(branch, path, function (err, sha) { + if (err) { + return cb(err); + } + + _request('DELETE', repoPath + '/contents/' + path, { + message: path + ' is removed', + sha: sha, + branch: branch + }, cb); + }); + }; + + // Alias for repo.remove for backwards comapt. + // ------- + this.delete = this.remove; + + // Move a file to a new location + // ------- + + this.move = function (branch, path, newPath, cb) { + updateTree(branch, function (err, latestCommit) { + that.getTree(latestCommit + '?recursive=true', function (err, tree) { + // Update Tree + tree.forEach(function (ref) { + if (ref.path === path) { + ref.path = newPath; + } + + if (ref.type === 'tree') { + delete ref.sha; + } + }); + + that.postTree(tree, function (err, rootTree) { + that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) { + that.updateHead(branch, commit, cb); + }); + }); + }); + }); + }; + + // Write file contents to a given branch and path + // ------- + + this.write = function (branch, path, content, message, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + that.getSha(branch, encodeURI(path), function (err, sha) { + var writeOptions = { + message: message, + content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content, + branch: branch, + committer: options && options.committer ? options.committer : undefined, + author: options && options.author ? options.author : undefined + }; + + // If no error, we set the sha to overwrite an existing file + if (!(err && err.error !== 404)) { + writeOptions.sha = sha; + } + + _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb); + }); + }; + + // List commits on a repository. Takes an object of optional parameters: + // sha: SHA or branch to start listing commits from + // path: Only commits containing this file path will be returned + // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address + // since: ISO 8601 date - only commits after this date will be returned + // until: ISO 8601 date - only commits before this date will be returned + // ------- + + this.getCommits = function (options, cb) { + options = options || {}; + var url = repoPath + '/commits'; + var params = []; + + if (options.sha) { + params.push('sha=' + encodeURIComponent(options.sha)); + } + + if (options.path) { + params.push('path=' + encodeURIComponent(options.path)); + } + + if (options.author) { + params.push('author=' + encodeURIComponent(options.author)); + } + + if (options.since) { + var since = options.since; + + if (since.constructor === Date) { + since = since.toISOString(); + } + + params.push('since=' + encodeURIComponent(since)); + } + + if (options.until) { + var until = options.until; + + if (until.constructor === Date) { + until = until.toISOString(); + } + + params.push('until=' + encodeURIComponent(until)); + } + + if (options.page) { + params.push('page=' + options.page); + } + + if (options.perpage) { + params.push('per_page=' + options.perpage); + } + + if (params.length > 0) { + url += '?' + params.join('&'); + } + + _request('GET', url, null, cb); + }; + + // Check if a repository is starred. + // -------- + + this.isStarred = function (owner, repository, cb) { + _request('GET', '/user/starred/' + owner + '/' + repository, null, cb); + }; + + // Star a repository. + // -------- + + this.star = function (owner, repository, cb) { + _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb); + }; + + // Unstar a repository. + // -------- + + this.unstar = function (owner, repository, cb) { + _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb); + }; + + // Create a new release + // -------- + + this.createRelease = function (options, cb) { + _request('POST', repoPath + '/releases', options, cb); + }; + + // Edit a release + // -------- + + this.editRelease = function (id, options, cb) { + _request('PATCH', repoPath + '/releases/' + id, options, cb); + }; + + // Get a single release + // -------- + + this.getRelease = function (id, cb) { + _request('GET', repoPath + '/releases/' + id, null, cb); + }; + + // Remove a release + // -------- + + this.deleteRelease = function (id, cb) { + _request('DELETE', repoPath + '/releases/' + id, null, cb); + }; + }; + + // Gists API + // ======= + + Github.Gist = function (options) { + var id = options.id; + var gistPath = '/gists/' + id; + + // Read the gist + // -------- + + this.read = function (cb) { + _request('GET', gistPath, null, cb); + }; + + // Create the gist + // -------- + // { + // "description": "the description for this gist", + // "public": true, + // "files": { + // "file1.txt": { + // "content": "String file contents" + // } + // } + // } + + this.create = function (options, cb) { + _request('POST', '/gists', options, cb); + }; + + // Delete the gist + // -------- + + this.delete = function (cb) { + _request('DELETE', gistPath, null, cb); + }; + + // Fork a gist + // -------- + + this.fork = function (cb) { + _request('POST', gistPath + '/fork', null, cb); + }; + + // Update a gist with the new stuff + // -------- + + this.update = function (options, cb) { + _request('PATCH', gistPath, options, cb); + }; + + // Star a gist + // -------- + + this.star = function (cb) { + _request('PUT', gistPath + '/star', null, cb); + }; + + // Untar a gist + // -------- + + this.unstar = function (cb) { + _request('DELETE', gistPath + '/star', null, cb); + }; + + // Check if a gist is starred + // -------- + + this.isStarred = function (cb) { + _request('GET', gistPath + '/star', null, cb); + }; + }; + + // Issues API + // ========== + + Github.Issue = function (options) { + var path = '/repos/' + options.user + '/' + options.repo + '/issues'; + + this.create = function (options, cb) { + _request('POST', path, options, cb); + }; + + this.list = function (options, cb) { + var query = []; + + Object.keys(options).forEach(function (option) { + query.push(encodeURIComponent(option) + '=' + encodeURIComponent(options[option])); + }); + + _requestAllPages(path + '?' + query.join('&'), !!options.page, cb); + }; + + this.comment = function (issue, comment, cb) { + _request('POST', issue.comments_url, { + body: comment + }, cb); + }; + + this.edit = function (issue, options, cb) { + _request('PATCH', path + '/' + issue, options, cb); + }; + + this.get = function (issue, cb) { + _request('GET', path + '/' + issue, null, cb); + }; + }; + + // Search API + // ========== + + Github.Search = function (options) { + var path = '/search/'; + var query = '?q=' + options.query; + + this.repositories = function (options, cb) { + _request('GET', path + 'repositories' + query, options, cb); + }; + + this.code = function (options, cb) { + _request('GET', path + 'code' + query, options, cb); + }; + + this.issues = function (options, cb) { + _request('GET', path + 'issues' + query, options, cb); + }; + + this.users = function (options, cb) { + _request('GET', path + 'users' + query, options, cb); + }; + }; + + // Rate Limit API + // ========== + + Github.RateLimit = function () { + this.getRateLimit = function (cb) { + _request('GET', '/rate_limit', null, cb); + }; + }; + + return Github; + }; + + // Top Level API + // ------- + + Github.getIssues = function (user, repo) { + return new Github.Issue({ + user: user, + repo: repo + }); + }; + + Github.getRepo = function (user, repo) { + if (!repo) { + return new Github.Repository({ + fullname: user + }); + } else { + return new Github.Repository({ + user: user, + name: repo + }); + } + }; + + Github.getUser = function () { + return new Github.User(); + }; + + Github.getGist = function (id) { + return new Github.Gist({ + id: id + }); + }; + + Github.getSearch = function (query) { + return new Github.Search({ + query: query + }); + }; + + Github.getRateLimit = function () { + return new Github.RateLimit(); + }; + + module.exports = Github; +}); +//# sourceMappingURL=github.js.map diff --git a/dist/github.js.map b/dist/github.js.map new file mode 100644 index 00000000..eb15fe9e --- /dev/null +++ b/dist/github.js.map @@ -0,0 +1 @@ +{"version":3,"names":[],"mappings":"","sources":["github.js"],"sourcesContent":["(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(['module', 'utf8', 'axios', 'base-64', 'es6-promise'], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(module, require('utf8'), require('axios'), require('base-64'), require('es6-promise'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, global.utf8, global.axios, global.base64, global.Promise);\n global.github = mod.exports;\n }\n})(this, function (module, Utf8, axios, Base64, Promise) {\n /*!\n * @overview Github.js\n *\n * @copyright (c) 2013 Michael Aufreiter, Development Seed\n * Github.js is freely distributable.\n *\n * @license Licensed under BSD-3-Clause-Clear\n *\n * For all details and documentation:\n * http://substance.io/michael/github\n */\n 'use strict';\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n };\n\n function b64encode(string) {\n return Base64.encode(Utf8.encode(string));\n }\n\n if (Promise.polyfill) {\n Promise.polyfill();\n }\n\n // Initial Setup\n // -------------\n\n function Github(options) {\n options = options || {};\n\n var API_URL = options.apiUrl || 'https://api.github.com';\n\n // HTTP Request Abstraction\n // =======\n //\n // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec.\n\n var _request = Github._request = function _request(method, path, data, cb, raw) {\n function getURL() {\n var url = path.indexOf('//') >= 0 ? path : API_URL + path;\n\n url += /\\?/.test(url) ? '&' : '?';\n\n if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) {\n for (var param in data) {\n if (data.hasOwnProperty(param)) {\n url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]);\n }\n }\n }\n\n return url.replace(/(×tamp=\\d+)/, '') + (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : '');\n }\n\n var config = {\n headers: {\n Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json',\n 'Content-Type': 'application/json;charset=UTF-8'\n },\n method: method,\n data: data ? data : {},\n url: getURL()\n };\n\n if (options.token || options.username && options.password) {\n config.headers.Authorization = options.token ? 'token ' + options.token : 'Basic ' + b64encode(options.username + ':' + options.password);\n }\n\n return axios(config).then(function (response) {\n cb(null, response.data || true, response);\n }, function (response) {\n if (response.status === 304) {\n cb(null, response.data || true, response);\n } else {\n cb({\n path: path,\n request: response,\n error: response.status\n });\n }\n });\n };\n\n var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, singlePage, cb) {\n var results = [];\n\n (function iterate() {\n _request('GET', path, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n if (!(res instanceof Array)) {\n res = [res];\n }\n\n results.push.apply(results, res);\n\n var next = (xhr.headers.link || '').split(',').filter(function (link) {\n return (/rel=\"next\"/.test(link)\n );\n }).map(function (link) {\n return (/<(.*)>/.exec(link) || [])[1];\n }).pop();\n\n if (!next || singlePage) {\n cb(err, results, xhr);\n } else {\n path = next;\n iterate();\n }\n });\n })();\n };\n\n // User API\n // =======\n\n Github.User = function () {\n this.repos = function (options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = options || {};\n\n var url = '/user/repos';\n var params = [];\n\n params.push('type=' + encodeURIComponent(options.type || 'all'));\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n url += '?' + params.join('&');\n\n _requestAllPages(url, !!options.page, cb);\n };\n\n // List user organizations\n // -------\n\n this.orgs = function (cb) {\n _request('GET', '/user/orgs', null, cb);\n };\n\n // List authenticated user's gists\n // -------\n\n this.gists = function (cb) {\n _request('GET', '/gists', null, cb);\n };\n\n // List authenticated user's unread notifications\n // -------\n\n this.notifications = function (options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = options || {};\n var url = '/notifications';\n var params = [];\n\n if (options.all) {\n params.push('all=true');\n }\n\n if (options.participating) {\n params.push('participating=true');\n }\n\n if (options.since) {\n var since = options.since;\n\n if (since.constructor === Date) {\n since = since.toISOString();\n }\n\n params.push('since=' + encodeURIComponent(since));\n }\n\n if (options.before) {\n var before = options.before;\n\n if (before.constructor === Date) {\n before = before.toISOString();\n }\n\n params.push('before=' + encodeURIComponent(before));\n }\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Show user information\n // -------\n\n this.show = function (username, cb) {\n var command = username ? '/users/' + username : '/user';\n\n _request('GET', command, null, cb);\n };\n\n // List user repositories\n // -------\n\n this.userRepos = function (username, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n var url = '/users/' + username + '/repos';\n var params = [];\n\n params.push('type=' + encodeURIComponent(options.type || 'all'));\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n url += '?' + params.join('&');\n\n _requestAllPages(url, !!options.page, cb);\n };\n\n // List user starred repositories\n // -------\n\n this.userStarred = function (username, cb) {\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\n var request = '/users/' + username + '/starred?type=all&per_page=100';\n _requestAllPages(request, false, cb);\n };\n\n // List a user's gists\n // -------\n\n this.userGists = function (username, cb) {\n _request('GET', '/users/' + username + '/gists', null, cb);\n };\n\n // List organization repositories\n // -------\n\n this.orgRepos = function (orgname, cb) {\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\n var request = '/orgs/' + orgname + '/repos?type=all&&page_num=100&sort=updated&direction=desc';\n _requestAllPages(request, false, cb);\n };\n\n // Follow user\n // -------\n\n this.follow = function (username, cb) {\n _request('PUT', '/user/following/' + username, null, cb);\n };\n\n // Unfollow user\n // -------\n\n this.unfollow = function (username, cb) {\n _request('DELETE', '/user/following/' + username, null, cb);\n };\n\n // Create a repo\n // -------\n this.createRepo = function (options, cb) {\n _request('POST', '/user/repos', options, cb);\n };\n };\n\n // Repository API\n // =======\n\n Github.Repository = function (options) {\n var repo = options.name;\n var user = options.user;\n var fullname = options.fullname;\n\n var that = this;\n var repoPath;\n\n if (fullname) {\n repoPath = '/repos/' + fullname;\n } else {\n repoPath = '/repos/' + user + '/' + repo;\n }\n\n var currentTree = {\n branch: null,\n sha: null\n };\n\n // Uses the cache if branch has not been changed\n // -------\n\n function updateTree(branch, cb) {\n if (branch === currentTree.branch && currentTree.sha) {\n return cb(null, currentTree.sha);\n }\n\n that.getRef('heads/' + branch, function (err, sha) {\n currentTree.branch = branch;\n currentTree.sha = sha;\n cb(err, sha);\n });\n }\n\n // Get a particular reference\n // -------\n\n this.getRef = function (ref, cb) {\n _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.object.sha, xhr);\n });\n };\n\n // Create a new reference\n // --------\n //\n // {\n // \"ref\": \"refs/heads/my-new-branch-name\",\n // \"sha\": \"827efc6d56897b048c772eb4087f854f46256132\"\n // }\n\n this.createRef = function (options, cb) {\n _request('POST', repoPath + '/git/refs', options, cb);\n };\n\n // Delete a reference\n // --------\n //\n // Repo.deleteRef('heads/gh-pages')\n // repo.deleteRef('tags/v1.0')\n\n this.deleteRef = function (ref, cb) {\n _request('DELETE', repoPath + '/git/refs/' + ref, options, cb);\n };\n\n // Delete a repo\n // --------\n\n this.deleteRepo = function (cb) {\n _request('DELETE', repoPath, options, cb);\n };\n\n // List all tags of a repository\n // -------\n\n this.listTags = function (cb) {\n _request('GET', repoPath + '/tags', null, cb);\n };\n\n // List all pull requests of a respository\n // -------\n\n this.listPulls = function (options, cb) {\n options = options || {};\n var url = repoPath + '/pulls';\n var params = [];\n\n if (typeof options === 'string') {\n // Backward compatibility\n params.push('state=' + options);\n } else {\n if (options.state) {\n params.push('state=' + encodeURIComponent(options.state));\n }\n\n if (options.head) {\n params.push('head=' + encodeURIComponent(options.head));\n }\n\n if (options.base) {\n params.push('base=' + encodeURIComponent(options.base));\n }\n\n if (options.sort) {\n params.push('sort=' + encodeURIComponent(options.sort));\n }\n\n if (options.direction) {\n params.push('direction=' + encodeURIComponent(options.direction));\n }\n\n if (options.page) {\n params.push('page=' + options.page);\n }\n\n if (options.per_page) {\n params.push('per_page=' + options.per_page);\n }\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Gets details for a specific pull request\n // -------\n\n this.getPull = function (number, cb) {\n _request('GET', repoPath + '/pulls/' + number, null, cb);\n };\n\n // Retrieve the changes made between base and head\n // -------\n\n this.compare = function (base, head, cb) {\n _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb);\n };\n\n // List all branches of a repository\n // -------\n\n this.listBranches = function (cb) {\n _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) {\n if (err) {\n return cb(err);\n }\n\n heads = heads.map(function (head) {\n return head.ref.replace(/^refs\\/heads\\//, '');\n });\n\n cb(null, heads, xhr);\n });\n };\n\n // Retrieve the contents of a blob\n // -------\n\n this.getBlob = function (sha, cb) {\n _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw');\n };\n\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\n // -------\n\n this.getCommit = function (branch, sha, cb) {\n _request('GET', repoPath + '/git/commits/' + sha, null, cb);\n };\n\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\n // -------\n\n this.getSha = function (branch, path, cb) {\n if (!path || path === '') {\n return that.getRef('heads/' + branch, cb);\n }\n\n _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''), null, function (err, pathContent, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, pathContent.sha, xhr);\n });\n };\n\n // Get the statuses for a particular SHA\n // -------\n\n this.getStatuses = function (sha, cb) {\n _request('GET', repoPath + '/statuses/' + sha, null, cb);\n };\n\n // Retrieve the tree a commit points to\n // -------\n\n this.getTree = function (tree, cb) {\n _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.tree, xhr);\n });\n };\n\n // Post a new blob object, getting a blob SHA back\n // -------\n\n this.postBlob = function (content, cb) {\n if (typeof content === 'string') {\n content = {\n content: Utf8.encode(content),\n encoding: 'utf-8'\n };\n } else {\n if (typeof Buffer !== 'undefined' && content instanceof Buffer) {\n // in NodeJS\n content = {\n content: content.toString('base64'),\n encoding: 'base64'\n };\n } else if (typeof Blob !== 'undefined' && content instanceof Blob) {\n content = {\n content: b64encode(content),\n encoding: 'base64'\n };\n } else {\n throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)');\n }\n }\n\n _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Update an existing tree adding a new blob object getting a tree SHA back\n // -------\n\n this.updateTree = function (baseTree, path, blob, cb) {\n var data = {\n base_tree: baseTree,\n tree: [{\n path: path,\n mode: '100644',\n type: 'blob',\n sha: blob\n }]\n };\n\n _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Post a new tree object having a file path pointer replaced\n // with a new blob SHA getting a tree SHA back\n // -------\n\n this.postTree = function (tree, cb) {\n _request('POST', repoPath + '/git/trees', {\n tree: tree\n }, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Create a new commit object with the current commit SHA as the parent\n // and the new tree SHA, getting a commit SHA back\n // -------\n\n this.commit = function (parent, tree, message, cb) {\n var user = new Github.User();\n\n user.show(null, function (err, userData) {\n if (err) {\n return cb(err);\n }\n\n var data = {\n message: message,\n author: {\n name: options.user,\n email: userData.email\n },\n parents: [parent],\n tree: tree\n };\n\n _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n currentTree.sha = res.sha; // Update latest commit\n\n cb(null, res.sha, xhr);\n });\n });\n };\n\n // Update the reference of your head to point to the new commit SHA\n // -------\n\n this.updateHead = function (head, commit, cb) {\n _request('PATCH', repoPath + '/git/refs/heads/' + head, {\n sha: commit\n }, cb);\n };\n\n // Show repository information\n // -------\n\n this.show = function (cb) {\n _request('GET', repoPath, null, cb);\n };\n\n // Show repository contributors\n // -------\n\n this.contributors = function (cb, retry) {\n retry = retry || 1000;\n var that = this;\n\n _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) {\n if (err) {\n return cb(err);\n }\n\n if (xhr.status === 202) {\n setTimeout(function () {\n that.contributors(cb, retry);\n }, retry);\n } else {\n cb(err, data, xhr);\n }\n });\n };\n\n // Get contents\n // --------\n\n this.contents = function (ref, path, cb) {\n path = encodeURI(path);\n _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), {\n ref: ref\n }, cb);\n };\n\n // Fork repository\n // -------\n\n this.fork = function (cb) {\n _request('POST', repoPath + '/forks', null, cb);\n };\n\n // List forks\n // --------\n\n this.listForks = function (cb) {\n _request('GET', repoPath + '/forks', null, cb);\n };\n\n // Branch repository\n // --------\n\n this.branch = function (oldBranch, newBranch, cb) {\n if (arguments.length === 2 && typeof arguments[1] === 'function') {\n cb = newBranch;\n newBranch = oldBranch;\n oldBranch = 'master';\n }\n\n this.getRef('heads/' + oldBranch, function (err, ref) {\n if (err && cb) {\n return cb(err);\n }\n\n that.createRef({\n ref: 'refs/heads/' + newBranch,\n sha: ref\n }, cb);\n });\n };\n\n // Create pull request\n // --------\n\n this.createPullRequest = function (options, cb) {\n _request('POST', repoPath + '/pulls', options, cb);\n };\n\n // List hooks\n // --------\n\n this.listHooks = function (cb) {\n _request('GET', repoPath + '/hooks', null, cb);\n };\n\n // Get a hook\n // --------\n\n this.getHook = function (id, cb) {\n _request('GET', repoPath + '/hooks/' + id, null, cb);\n };\n\n // Create a hook\n // --------\n\n this.createHook = function (options, cb) {\n _request('POST', repoPath + '/hooks', options, cb);\n };\n\n // Edit a hook\n // --------\n\n this.editHook = function (id, options, cb) {\n _request('PATCH', repoPath + '/hooks/' + id, options, cb);\n };\n\n // Delete a hook\n // --------\n\n this.deleteHook = function (id, cb) {\n _request('DELETE', repoPath + '/hooks/' + id, null, cb);\n };\n\n // Read file at given path\n // -------\n\n this.read = function (branch, path, cb) {\n _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''), null, cb, true);\n };\n\n // Remove a file\n // -------\n\n this.remove = function (branch, path, cb) {\n that.getSha(branch, path, function (err, sha) {\n if (err) {\n return cb(err);\n }\n\n _request('DELETE', repoPath + '/contents/' + path, {\n message: path + ' is removed',\n sha: sha,\n branch: branch\n }, cb);\n });\n };\n\n // Alias for repo.remove for backwards comapt.\n // -------\n this.delete = this.remove;\n\n // Move a file to a new location\n // -------\n\n this.move = function (branch, path, newPath, cb) {\n updateTree(branch, function (err, latestCommit) {\n that.getTree(latestCommit + '?recursive=true', function (err, tree) {\n // Update Tree\n tree.forEach(function (ref) {\n if (ref.path === path) {\n ref.path = newPath;\n }\n\n if (ref.type === 'tree') {\n delete ref.sha;\n }\n });\n\n that.postTree(tree, function (err, rootTree) {\n that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) {\n that.updateHead(branch, commit, cb);\n });\n });\n });\n });\n };\n\n // Write file contents to a given branch and path\n // -------\n\n this.write = function (branch, path, content, message, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n that.getSha(branch, encodeURI(path), function (err, sha) {\n var writeOptions = {\n message: message,\n content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content,\n branch: branch,\n committer: options && options.committer ? options.committer : undefined,\n author: options && options.author ? options.author : undefined\n };\n\n // If no error, we set the sha to overwrite an existing file\n if (!(err && err.error !== 404)) {\n writeOptions.sha = sha;\n }\n\n _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb);\n });\n };\n\n // List commits on a repository. Takes an object of optional parameters:\n // sha: SHA or branch to start listing commits from\n // path: Only commits containing this file path will be returned\n // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address\n // since: ISO 8601 date - only commits after this date will be returned\n // until: ISO 8601 date - only commits before this date will be returned\n // -------\n\n this.getCommits = function (options, cb) {\n options = options || {};\n var url = repoPath + '/commits';\n var params = [];\n\n if (options.sha) {\n params.push('sha=' + encodeURIComponent(options.sha));\n }\n\n if (options.path) {\n params.push('path=' + encodeURIComponent(options.path));\n }\n\n if (options.author) {\n params.push('author=' + encodeURIComponent(options.author));\n }\n\n if (options.since) {\n var since = options.since;\n\n if (since.constructor === Date) {\n since = since.toISOString();\n }\n\n params.push('since=' + encodeURIComponent(since));\n }\n\n if (options.until) {\n var until = options.until;\n\n if (until.constructor === Date) {\n until = until.toISOString();\n }\n\n params.push('until=' + encodeURIComponent(until));\n }\n\n if (options.page) {\n params.push('page=' + options.page);\n }\n\n if (options.perpage) {\n params.push('per_page=' + options.perpage);\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Check if a repository is starred.\n // --------\n\n this.isStarred = function (owner, repository, cb) {\n _request('GET', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Star a repository.\n // --------\n\n this.star = function (owner, repository, cb) {\n _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Unstar a repository.\n // --------\n\n this.unstar = function (owner, repository, cb) {\n _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Create a new release\n // --------\n\n this.createRelease = function (options, cb) {\n _request('POST', repoPath + '/releases', options, cb);\n };\n\n // Edit a release\n // --------\n\n this.editRelease = function (id, options, cb) {\n _request('PATCH', repoPath + '/releases/' + id, options, cb);\n };\n\n // Get a single release\n // --------\n\n this.getRelease = function (id, cb) {\n _request('GET', repoPath + '/releases/' + id, null, cb);\n };\n\n // Remove a release\n // --------\n\n this.deleteRelease = function (id, cb) {\n _request('DELETE', repoPath + '/releases/' + id, null, cb);\n };\n };\n\n // Gists API\n // =======\n\n Github.Gist = function (options) {\n var id = options.id;\n var gistPath = '/gists/' + id;\n\n // Read the gist\n // --------\n\n this.read = function (cb) {\n _request('GET', gistPath, null, cb);\n };\n\n // Create the gist\n // --------\n // {\n // \"description\": \"the description for this gist\",\n // \"public\": true,\n // \"files\": {\n // \"file1.txt\": {\n // \"content\": \"String file contents\"\n // }\n // }\n // }\n\n this.create = function (options, cb) {\n _request('POST', '/gists', options, cb);\n };\n\n // Delete the gist\n // --------\n\n this.delete = function (cb) {\n _request('DELETE', gistPath, null, cb);\n };\n\n // Fork a gist\n // --------\n\n this.fork = function (cb) {\n _request('POST', gistPath + '/fork', null, cb);\n };\n\n // Update a gist with the new stuff\n // --------\n\n this.update = function (options, cb) {\n _request('PATCH', gistPath, options, cb);\n };\n\n // Star a gist\n // --------\n\n this.star = function (cb) {\n _request('PUT', gistPath + '/star', null, cb);\n };\n\n // Untar a gist\n // --------\n\n this.unstar = function (cb) {\n _request('DELETE', gistPath + '/star', null, cb);\n };\n\n // Check if a gist is starred\n // --------\n\n this.isStarred = function (cb) {\n _request('GET', gistPath + '/star', null, cb);\n };\n };\n\n // Issues API\n // ==========\n\n Github.Issue = function (options) {\n var path = '/repos/' + options.user + '/' + options.repo + '/issues';\n\n this.create = function (options, cb) {\n _request('POST', path, options, cb);\n };\n\n this.list = function (options, cb) {\n var query = [];\n\n Object.keys(options).forEach(function (option) {\n query.push(encodeURIComponent(option) + '=' + encodeURIComponent(options[option]));\n });\n\n _requestAllPages(path + '?' + query.join('&'), !!options.page, cb);\n };\n\n this.comment = function (issue, comment, cb) {\n _request('POST', issue.comments_url, {\n body: comment\n }, cb);\n };\n\n this.edit = function (issue, options, cb) {\n _request('PATCH', path + '/' + issue, options, cb);\n };\n\n this.get = function (issue, cb) {\n _request('GET', path + '/' + issue, null, cb);\n };\n };\n\n // Search API\n // ==========\n\n Github.Search = function (options) {\n var path = '/search/';\n var query = '?q=' + options.query;\n\n this.repositories = function (options, cb) {\n _request('GET', path + 'repositories' + query, options, cb);\n };\n\n this.code = function (options, cb) {\n _request('GET', path + 'code' + query, options, cb);\n };\n\n this.issues = function (options, cb) {\n _request('GET', path + 'issues' + query, options, cb);\n };\n\n this.users = function (options, cb) {\n _request('GET', path + 'users' + query, options, cb);\n };\n };\n\n // Rate Limit API\n // ==========\n\n Github.RateLimit = function () {\n this.getRateLimit = function (cb) {\n _request('GET', '/rate_limit', null, cb);\n };\n };\n\n return Github;\n };\n\n // Top Level API\n // -------\n\n Github.getIssues = function (user, repo) {\n return new Github.Issue({\n user: user,\n repo: repo\n });\n };\n\n Github.getRepo = function (user, repo) {\n if (!repo) {\n return new Github.Repository({\n fullname: user\n });\n } else {\n return new Github.Repository({\n user: user,\n name: repo\n });\n }\n };\n\n Github.getUser = function () {\n return new Github.User();\n };\n\n Github.getGist = function (id) {\n return new Github.Gist({\n id: id\n });\n };\n\n Github.getSearch = function (query) {\n return new Github.Search({\n query: query\n });\n };\n\n Github.getRateLimit = function () {\n return new Github.RateLimit();\n };\n\n module.exports = Github;\n});"],"file":"github.js","sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/github.min.js b/dist/github.min.js new file mode 100644 index 00000000..da59303e --- /dev/null +++ b/dist/github.min.js @@ -0,0 +1,2 @@ +!function(e,t){if("function"==typeof define&&define.amd)define(["module","utf8","axios","base-64","es6-promise"],t);else if("undefined"!=typeof exports)t(module,require("utf8"),require("axios"),require("base-64"),require("es6-promise"));else{var n={exports:{}};t(n,e.utf8,e.axios,e.base64,e.Promise),e.github=n.exports}}(this,function(e,t,n,o,s){"use strict";function i(e){return o.encode(t.encode(e))}function u(e){e=e||{};var o=e.apiUrl||"https://api.github.com",s=u._request=function(t,s,u,a,c){function f(){var e=s.indexOf("//")>=0?s:o+s;if(e+=/\?/.test(e)?"&":"?",u&&"object"===("undefined"==typeof u?"undefined":r(u))&&["GET","HEAD","DELETE"].indexOf(t)>-1)for(var n in u)u.hasOwnProperty(n)&&(e+="&"+encodeURIComponent(n)+"="+encodeURIComponent(u[n]));return e.replace(/(×tamp=\d+)/,"")+("undefined"!=typeof window?"×tamp="+(new Date).getTime():"")}var l={headers:{Accept:c?"application/vnd.github.v3.raw+json":"application/vnd.github.v3+json","Content-Type":"application/json;charset=UTF-8"},method:t,data:u?u:{},url:f()};return(e.token||e.username&&e.password)&&(l.headers.Authorization=e.token?"token "+e.token:"Basic "+i(e.username+":"+e.password)),n(l).then(function(e){a(null,e.data||!0,e)},function(e){304===e.status?a(null,e.data||!0,e):a({path:s,request:e,error:e.status})})},a=u._requestAllPages=function(e,t,n){var o=[];!function i(){s("GET",e,null,function(s,u,r){if(s)return n(s);u instanceof Array||(u=[u]),o.push.apply(o,u);var a=(r.headers.link||"").split(",").filter(function(e){return/rel="next"/.test(e)}).map(function(e){return(/<(.*)>/.exec(e)||[])[1]}).pop();!a||t?n(s,o,r):(e=a,i())})}()};return u.User=function(){this.repos=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};var n="/user/repos",o=[];o.push("type="+encodeURIComponent(e.type||"all")),o.push("sort="+encodeURIComponent(e.sort||"updated")),o.push("per_page="+encodeURIComponent(e.per_page||"100")),e.page&&o.push("page="+encodeURIComponent(e.page)),n+="?"+o.join("&"),a(n,!!e.page,t)},this.orgs=function(e){s("GET","/user/orgs",null,e)},this.gists=function(e){s("GET","/gists",null,e)},this.notifications=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};var n="/notifications",o=[];if(e.all&&o.push("all=true"),e.participating&&o.push("participating=true"),e.since){var i=e.since;i.constructor===Date&&(i=i.toISOString()),o.push("since="+encodeURIComponent(i))}if(e.before){var u=e.before;u.constructor===Date&&(u=u.toISOString()),o.push("before="+encodeURIComponent(u))}e.page&&o.push("page="+encodeURIComponent(e.page)),o.length>0&&(n+="?"+o.join("&")),s("GET",n,null,t)},this.show=function(e,t){var n=e?"/users/"+e:"/user";s("GET",n,null,t)},this.userRepos=function(e,t,n){"function"==typeof t&&(n=t,t={});var o="/users/"+e+"/repos",s=[];s.push("type="+encodeURIComponent(t.type||"all")),s.push("sort="+encodeURIComponent(t.sort||"updated")),s.push("per_page="+encodeURIComponent(t.per_page||"100")),t.page&&s.push("page="+encodeURIComponent(t.page)),o+="?"+s.join("&"),a(o,!!t.page,n)},this.userStarred=function(e,t){var n="/users/"+e+"/starred?type=all&per_page=100";a(n,!1,t)},this.userGists=function(e,t){s("GET","/users/"+e+"/gists",null,t)},this.orgRepos=function(e,t){var n="/orgs/"+e+"/repos?type=all&&page_num=100&sort=updated&direction=desc";a(n,!1,t)},this.follow=function(e,t){s("PUT","/user/following/"+e,null,t)},this.unfollow=function(e,t){s("DELETE","/user/following/"+e,null,t)},this.createRepo=function(e,t){s("POST","/user/repos",e,t)}},u.Repository=function(e){function n(e,t){return e===l.branch&&l.sha?t(null,l.sha):void f.getRef("heads/"+e,function(n,o){l.branch=e,l.sha=o,t(n,o)})}var o,r=e.name,a=e.user,c=e.fullname,f=this;o=c?"/repos/"+c:"/repos/"+a+"/"+r;var l={branch:null,sha:null};this.getRef=function(e,t){s("GET",o+"/git/refs/"+e,null,function(e,n,o){return e?t(e):void t(null,n.object.sha,o)})},this.createRef=function(e,t){s("POST",o+"/git/refs",e,t)},this.deleteRef=function(t,n){s("DELETE",o+"/git/refs/"+t,e,n)},this.deleteRepo=function(t){s("DELETE",o,e,t)},this.listTags=function(e){s("GET",o+"/tags",null,e)},this.listPulls=function(e,t){e=e||{};var n=o+"/pulls",i=[];"string"==typeof e?i.push("state="+e):(e.state&&i.push("state="+encodeURIComponent(e.state)),e.head&&i.push("head="+encodeURIComponent(e.head)),e.base&&i.push("base="+encodeURIComponent(e.base)),e.sort&&i.push("sort="+encodeURIComponent(e.sort)),e.direction&&i.push("direction="+encodeURIComponent(e.direction)),e.page&&i.push("page="+e.page),e.per_page&&i.push("per_page="+e.per_page)),i.length>0&&(n+="?"+i.join("&")),s("GET",n,null,t)},this.getPull=function(e,t){s("GET",o+"/pulls/"+e,null,t)},this.compare=function(e,t,n){s("GET",o+"/compare/"+e+"..."+t,null,n)},this.listBranches=function(e){s("GET",o+"/git/refs/heads",null,function(t,n,o){return t?e(t):(n=n.map(function(e){return e.ref.replace(/^refs\/heads\//,"")}),void e(null,n,o))})},this.getBlob=function(e,t){s("GET",o+"/git/blobs/"+e,null,t,"raw")},this.getCommit=function(e,t,n){s("GET",o+"/git/commits/"+t,null,n)},this.getSha=function(e,t,n){return t&&""!==t?void s("GET",o+"/contents/"+t+(e?"?ref="+e:""),null,function(e,t,o){return e?n(e):void n(null,t.sha,o)}):f.getRef("heads/"+e,n)},this.getStatuses=function(e,t){s("GET",o+"/statuses/"+e,null,t)},this.getTree=function(e,t){s("GET",o+"/git/trees/"+e,null,function(e,n,o){return e?t(e):void t(null,n.tree,o)})},this.postBlob=function(e,n){if("string"==typeof e)e={content:t.encode(e),encoding:"utf-8"};else if("undefined"!=typeof Buffer&&e instanceof Buffer)e={content:e.toString("base64"),encoding:"base64"};else{if(!("undefined"!=typeof Blob&&e instanceof Blob))throw new Error("Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)");e={content:i(e),encoding:"base64"}}s("POST",o+"/git/blobs",e,function(e,t,o){return e?n(e):void n(null,t.sha,o)})},this.updateTree=function(e,t,n,i){var u={base_tree:e,tree:[{path:t,mode:"100644",type:"blob",sha:n}]};s("POST",o+"/git/trees",u,function(e,t,n){return e?i(e):void i(null,t.sha,n)})},this.postTree=function(e,t){s("POST",o+"/git/trees",{tree:e},function(e,n,o){return e?t(e):void t(null,n.sha,o)})},this.commit=function(t,n,i,r){var a=new u.User;a.show(null,function(u,a){if(u)return r(u);var c={message:i,author:{name:e.user,email:a.email},parents:[t],tree:n};s("POST",o+"/git/commits",c,function(e,t,n){return e?r(e):(l.sha=t.sha,void r(null,t.sha,n))})})},this.updateHead=function(e,t,n){s("PATCH",o+"/git/refs/heads/"+e,{sha:t},n)},this.show=function(e){s("GET",o,null,e)},this.contributors=function(e,t){t=t||1e3;var n=this;s("GET",o+"/stats/contributors",null,function(o,s,i){return o?e(o):void(202===i.status?setTimeout(function(){n.contributors(e,t)},t):e(o,s,i))})},this.contents=function(e,t,n){t=encodeURI(t),s("GET",o+"/contents"+(t?"/"+t:""),{ref:e},n)},this.fork=function(e){s("POST",o+"/forks",null,e)},this.listForks=function(e){s("GET",o+"/forks",null,e)},this.branch=function(e,t,n){2===arguments.length&&"function"==typeof arguments[1]&&(n=t,t=e,e="master"),this.getRef("heads/"+e,function(e,o){return e&&n?n(e):void f.createRef({ref:"refs/heads/"+t,sha:o},n)})},this.createPullRequest=function(e,t){s("POST",o+"/pulls",e,t)},this.listHooks=function(e){s("GET",o+"/hooks",null,e)},this.getHook=function(e,t){s("GET",o+"/hooks/"+e,null,t)},this.createHook=function(e,t){s("POST",o+"/hooks",e,t)},this.editHook=function(e,t,n){s("PATCH",o+"/hooks/"+e,t,n)},this.deleteHook=function(e,t){s("DELETE",o+"/hooks/"+e,null,t)},this.read=function(e,t,n){s("GET",o+"/contents/"+encodeURI(t)+(e?"?ref="+e:""),null,n,!0)},this.remove=function(e,t,n){f.getSha(e,t,function(i,u){return i?n(i):void s("DELETE",o+"/contents/"+t,{message:t+" is removed",sha:u,branch:e},n)})},this["delete"]=this.remove,this.move=function(e,t,o,s){n(e,function(n,i){f.getTree(i+"?recursive=true",function(n,u){u.forEach(function(e){e.path===t&&(e.path=o),"tree"===e.type&&delete e.sha}),f.postTree(u,function(n,o){f.commit(i,o,"Deleted "+t,function(t,n){f.updateHead(e,n,s)})})})})},this.write=function(e,t,n,u,r,a){"function"==typeof r&&(a=r,r={}),f.getSha(e,encodeURI(t),function(c,f){var l={message:u,content:"undefined"==typeof r.encode||r.encode?i(n):n,branch:e,committer:r&&r.committer?r.committer:void 0,author:r&&r.author?r.author:void 0};c&&404!==c.error||(l.sha=f),s("PUT",o+"/contents/"+encodeURI(t),l,a)})},this.getCommits=function(e,t){e=e||{};var n=o+"/commits",i=[];if(e.sha&&i.push("sha="+encodeURIComponent(e.sha)),e.path&&i.push("path="+encodeURIComponent(e.path)),e.author&&i.push("author="+encodeURIComponent(e.author)),e.since){var u=e.since;u.constructor===Date&&(u=u.toISOString()),i.push("since="+encodeURIComponent(u))}if(e.until){var r=e.until;r.constructor===Date&&(r=r.toISOString()),i.push("until="+encodeURIComponent(r))}e.page&&i.push("page="+e.page),e.perpage&&i.push("per_page="+e.perpage),i.length>0&&(n+="?"+i.join("&")),s("GET",n,null,t)},this.isStarred=function(e,t,n){s("GET","/user/starred/"+e+"/"+t,null,n)},this.star=function(e,t,n){s("PUT","/user/starred/"+e+"/"+t,null,n)},this.unstar=function(e,t,n){s("DELETE","/user/starred/"+e+"/"+t,null,n)},this.createRelease=function(e,t){s("POST",o+"/releases",e,t)},this.editRelease=function(e,t,n){s("PATCH",o+"/releases/"+e,t,n)},this.getRelease=function(e,t){s("GET",o+"/releases/"+e,null,t)},this.deleteRelease=function(e,t){s("DELETE",o+"/releases/"+e,null,t)}},u.Gist=function(e){var t=e.id,n="/gists/"+t;this.read=function(e){s("GET",n,null,e)},this.create=function(e,t){s("POST","/gists",e,t)},this["delete"]=function(e){s("DELETE",n,null,e)},this.fork=function(e){s("POST",n+"/fork",null,e)},this.update=function(e,t){s("PATCH",n,e,t)},this.star=function(e){s("PUT",n+"/star",null,e)},this.unstar=function(e){s("DELETE",n+"/star",null,e)},this.isStarred=function(e){s("GET",n+"/star",null,e)}},u.Issue=function(e){var t="/repos/"+e.user+"/"+e.repo+"/issues";this.create=function(e,n){s("POST",t,e,n)},this.list=function(e,n){var o=[];Object.keys(e).forEach(function(t){o.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]))}),a(t+"?"+o.join("&"),!!e.page,n)},this.comment=function(e,t,n){s("POST",e.comments_url,{body:t},n)},this.edit=function(e,n,o){s("PATCH",t+"/"+e,n,o)},this.get=function(e,n){s("GET",t+"/"+e,null,n)}},u.Search=function(e){var t="/search/",n="?q="+e.query;this.repositories=function(e,o){s("GET",t+"repositories"+n,e,o)},this.code=function(e,o){s("GET",t+"code"+n,e,o)},this.issues=function(e,o){s("GET",t+"issues"+n,e,o)},this.users=function(e,o){s("GET",t+"users"+n,e,o)}},u.RateLimit=function(){this.getRateLimit=function(e){s("GET","/rate_limit",null,e)}},u}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};s.polyfill&&s.polyfill(),u.getIssues=function(e,t){return new u.Issue({user:e,repo:t})},u.getRepo=function(e,t){return t?new u.Repository({user:e,name:t}):new u.Repository({fullname:e})},u.getUser=function(){return new u.User},u.getGist=function(e){return new u.Gist({id:e})},u.getSearch=function(e){return new u.Search({query:e})},u.getRateLimit=function(){return new u.RateLimit},e.exports=u}); +//# sourceMappingURL=github.min.js.map diff --git a/dist/github.min.js.map b/dist/github.min.js.map new file mode 100644 index 00000000..5d426aa9 --- /dev/null +++ b/dist/github.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["github.min.js"],"names":["global","factory","define","amd","exports","module","require","mod","utf8","axios","base64","Promise","github","this","Utf8","Base64","b64encode","string","encode","Github","options","API_URL","apiUrl","_request","method","path","data","cb","raw","getURL","url","indexOf","test","_typeof","param","hasOwnProperty","encodeURIComponent","replace","window","Date","getTime","config","headers","Accept","Content-Type","token","username","password","Authorization","then","response","status","request","error","_requestAllPages","singlePage","results","iterate","err","res","xhr","Array","push","apply","next","link","split","filter","map","exec","pop","User","repos","params","type","sort","per_page","page","join","orgs","gists","notifications","all","participating","since","constructor","toISOString","before","length","show","command","userRepos","userStarred","userGists","orgRepos","orgname","follow","unfollow","createRepo","Repository","updateTree","branch","currentTree","sha","that","getRef","repoPath","repo","name","user","fullname","ref","object","createRef","deleteRef","deleteRepo","listTags","listPulls","state","head","base","direction","getPull","number","compare","listBranches","heads","getBlob","getCommit","getSha","pathContent","getStatuses","getTree","tree","postBlob","content","encoding","Buffer","toString","Blob","Error","baseTree","blob","base_tree","mode","postTree","commit","parent","message","userData","author","email","parents","updateHead","contributors","retry","setTimeout","contents","encodeURI","fork","listForks","oldBranch","newBranch","arguments","createPullRequest","listHooks","getHook","id","createHook","editHook","deleteHook","read","remove","move","newPath","latestCommit","forEach","rootTree","write","writeOptions","committer","undefined","getCommits","until","perpage","isStarred","owner","repository","star","unstar","createRelease","editRelease","getRelease","deleteRelease","Gist","gistPath","create","update","Issue","list","query","Object","keys","option","comment","issue","comments_url","body","edit","get","Search","repositories","code","issues","users","RateLimit","getRateLimit","Symbol","iterator","obj","polyfill","getIssues","getRepo","getUser","getGist","getSearch"],"mappings":"CAAA,SAAWA,EAAQC,GAChB,GAAsB,kBAAXC,SAAyBA,OAAOC,IACxCD,QA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c,GAA4B,kBAAXwL,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUC,GAC3F,aAAcA,IACb,SAAUA,GACX,MAAOA,IAAyB,kBAAXF,SAAyBE,EAAItI,cAAgBoI,OAAS,eAAkBE,GAO5FhN,GAAQiN,UACTjN,EAAQiN,WAgiCXzM,EAAO0M,UAAY,SAAUhH,EAAMF,GAChC,MAAO,IAAIxF,GAAOmL,OACfzF,KAAMA,EACNF,KAAMA,KAIZxF,EAAO2M,QAAU,SAAUjH,EAAMF,GAC9B,MAAKA,GAKK,GAAIxF,GAAOgF,YACfU,KAAMA,EACND,KAAMD,IANF,GAAIxF,GAAOgF,YACfW,SAAUD,KAUnB1F,EAAO4M,QAAU,WACd,MAAO,IAAI5M,GAAOoD,MAGrBpD,EAAO6M,QAAU,SAAUzD,GACxB,MAAO,IAAIpJ,GAAO+K,MACf3B,GAAIA,KAIVpJ,EAAO8M,UAAY,SAAUzB,GAC1B,MAAO,IAAIrL,GAAO+L,QACfV,MAAOA,KAIbrL,EAAOqM,aAAe,WACnB,MAAO,IAAIrM,GAAOoM,WAGrBlN,EAAOD,QAAUe","file":"github.min.js","sourcesContent":["(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(['module', 'utf8', 'axios', 'base-64', 'es6-promise'], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(module, require('utf8'), require('axios'), require('base-64'), require('es6-promise'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, global.utf8, global.axios, global.base64, global.Promise);\n global.github = mod.exports;\n }\n})(this, function (module, Utf8, axios, Base64, Promise) {\n /*!\n * @overview Github.js\n *\n * @copyright (c) 2013 Michael Aufreiter, Development Seed\n * Github.js is freely distributable.\n *\n * @license Licensed under BSD-3-Clause-Clear\n *\n * For all details and documentation:\n * http://substance.io/michael/github\n */\n 'use strict';\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n };\n\n function b64encode(string) {\n return Base64.encode(Utf8.encode(string));\n }\n\n if (Promise.polyfill) {\n Promise.polyfill();\n }\n\n // Initial Setup\n // -------------\n\n function Github(options) {\n options = options || {};\n\n var API_URL = options.apiUrl || 'https://api.github.com';\n\n // HTTP Request Abstraction\n // =======\n //\n // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec.\n\n var _request = Github._request = function _request(method, path, data, cb, raw) {\n function getURL() {\n var url = path.indexOf('//') >= 0 ? path : API_URL + path;\n\n url += /\\?/.test(url) ? '&' : '?';\n\n if (data && (typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) {\n for (var param in data) {\n if (data.hasOwnProperty(param)) {\n url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]);\n }\n }\n }\n\n return url.replace(/(×tamp=\\d+)/, '') + (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : '');\n }\n\n var config = {\n headers: {\n Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json',\n 'Content-Type': 'application/json;charset=UTF-8'\n },\n method: method,\n data: data ? data : {},\n url: getURL()\n };\n\n if (options.token || options.username && options.password) {\n config.headers.Authorization = options.token ? 'token ' + options.token : 'Basic ' + b64encode(options.username + ':' + options.password);\n }\n\n return axios(config).then(function (response) {\n cb(null, response.data || true, response);\n }, function (response) {\n if (response.status === 304) {\n cb(null, response.data || true, response);\n } else {\n cb({\n path: path,\n request: response,\n error: response.status\n });\n }\n });\n };\n\n var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, singlePage, cb) {\n var results = [];\n\n (function iterate() {\n _request('GET', path, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n if (!(res instanceof Array)) {\n res = [res];\n }\n\n results.push.apply(results, res);\n\n var next = (xhr.headers.link || '').split(',').filter(function (link) {\n return (/rel=\"next\"/.test(link)\n );\n }).map(function (link) {\n return (/<(.*)>/.exec(link) || [])[1];\n }).pop();\n\n if (!next || singlePage) {\n cb(err, results, xhr);\n } else {\n path = next;\n iterate();\n }\n });\n })();\n };\n\n // User API\n // =======\n\n Github.User = function () {\n this.repos = function (options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = options || {};\n\n var url = '/user/repos';\n var params = [];\n\n params.push('type=' + encodeURIComponent(options.type || 'all'));\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n url += '?' + params.join('&');\n\n _requestAllPages(url, !!options.page, cb);\n };\n\n // List user organizations\n // -------\n\n this.orgs = function (cb) {\n _request('GET', '/user/orgs', null, cb);\n };\n\n // List authenticated user's gists\n // -------\n\n this.gists = function (cb) {\n _request('GET', '/gists', null, cb);\n };\n\n // List authenticated user's unread notifications\n // -------\n\n this.notifications = function (options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = options || {};\n var url = '/notifications';\n var params = [];\n\n if (options.all) {\n params.push('all=true');\n }\n\n if (options.participating) {\n params.push('participating=true');\n }\n\n if (options.since) {\n var since = options.since;\n\n if (since.constructor === Date) {\n since = since.toISOString();\n }\n\n params.push('since=' + encodeURIComponent(since));\n }\n\n if (options.before) {\n var before = options.before;\n\n if (before.constructor === Date) {\n before = before.toISOString();\n }\n\n params.push('before=' + encodeURIComponent(before));\n }\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Show user information\n // -------\n\n this.show = function (username, cb) {\n var command = username ? '/users/' + username : '/user';\n\n _request('GET', command, null, cb);\n };\n\n // List user repositories\n // -------\n\n this.userRepos = function (username, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n var url = '/users/' + username + '/repos';\n var params = [];\n\n params.push('type=' + encodeURIComponent(options.type || 'all'));\n params.push('sort=' + encodeURIComponent(options.sort || 'updated'));\n params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore\n\n if (options.page) {\n params.push('page=' + encodeURIComponent(options.page));\n }\n\n url += '?' + params.join('&');\n\n _requestAllPages(url, !!options.page, cb);\n };\n\n // List user starred repositories\n // -------\n\n this.userStarred = function (username, cb) {\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\n var request = '/users/' + username + '/starred?type=all&per_page=100';\n _requestAllPages(request, false, cb);\n };\n\n // List a user's gists\n // -------\n\n this.userGists = function (username, cb) {\n _request('GET', '/users/' + username + '/gists', null, cb);\n };\n\n // List organization repositories\n // -------\n\n this.orgRepos = function (orgname, cb) {\n // Github does not always honor the 1000 limit so we want to iterate over the data set.\n var request = '/orgs/' + orgname + '/repos?type=all&&page_num=100&sort=updated&direction=desc';\n _requestAllPages(request, false, cb);\n };\n\n // Follow user\n // -------\n\n this.follow = function (username, cb) {\n _request('PUT', '/user/following/' + username, null, cb);\n };\n\n // Unfollow user\n // -------\n\n this.unfollow = function (username, cb) {\n _request('DELETE', '/user/following/' + username, null, cb);\n };\n\n // Create a repo\n // -------\n this.createRepo = function (options, cb) {\n _request('POST', '/user/repos', options, cb);\n };\n };\n\n // Repository API\n // =======\n\n Github.Repository = function (options) {\n var repo = options.name;\n var user = options.user;\n var fullname = options.fullname;\n\n var that = this;\n var repoPath;\n\n if (fullname) {\n repoPath = '/repos/' + fullname;\n } else {\n repoPath = '/repos/' + user + '/' + repo;\n }\n\n var currentTree = {\n branch: null,\n sha: null\n };\n\n // Uses the cache if branch has not been changed\n // -------\n\n function updateTree(branch, cb) {\n if (branch === currentTree.branch && currentTree.sha) {\n return cb(null, currentTree.sha);\n }\n\n that.getRef('heads/' + branch, function (err, sha) {\n currentTree.branch = branch;\n currentTree.sha = sha;\n cb(err, sha);\n });\n }\n\n // Get a particular reference\n // -------\n\n this.getRef = function (ref, cb) {\n _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.object.sha, xhr);\n });\n };\n\n // Create a new reference\n // --------\n //\n // {\n // \"ref\": \"refs/heads/my-new-branch-name\",\n // \"sha\": \"827efc6d56897b048c772eb4087f854f46256132\"\n // }\n\n this.createRef = function (options, cb) {\n _request('POST', repoPath + '/git/refs', options, cb);\n };\n\n // Delete a reference\n // --------\n //\n // Repo.deleteRef('heads/gh-pages')\n // repo.deleteRef('tags/v1.0')\n\n this.deleteRef = function (ref, cb) {\n _request('DELETE', repoPath + '/git/refs/' + ref, options, cb);\n };\n\n // Delete a repo\n // --------\n\n this.deleteRepo = function (cb) {\n _request('DELETE', repoPath, options, cb);\n };\n\n // List all tags of a repository\n // -------\n\n this.listTags = function (cb) {\n _request('GET', repoPath + '/tags', null, cb);\n };\n\n // List all pull requests of a respository\n // -------\n\n this.listPulls = function (options, cb) {\n options = options || {};\n var url = repoPath + '/pulls';\n var params = [];\n\n if (typeof options === 'string') {\n // Backward compatibility\n params.push('state=' + options);\n } else {\n if (options.state) {\n params.push('state=' + encodeURIComponent(options.state));\n }\n\n if (options.head) {\n params.push('head=' + encodeURIComponent(options.head));\n }\n\n if (options.base) {\n params.push('base=' + encodeURIComponent(options.base));\n }\n\n if (options.sort) {\n params.push('sort=' + encodeURIComponent(options.sort));\n }\n\n if (options.direction) {\n params.push('direction=' + encodeURIComponent(options.direction));\n }\n\n if (options.page) {\n params.push('page=' + options.page);\n }\n\n if (options.per_page) {\n params.push('per_page=' + options.per_page);\n }\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Gets details for a specific pull request\n // -------\n\n this.getPull = function (number, cb) {\n _request('GET', repoPath + '/pulls/' + number, null, cb);\n };\n\n // Retrieve the changes made between base and head\n // -------\n\n this.compare = function (base, head, cb) {\n _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb);\n };\n\n // List all branches of a repository\n // -------\n\n this.listBranches = function (cb) {\n _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) {\n if (err) {\n return cb(err);\n }\n\n heads = heads.map(function (head) {\n return head.ref.replace(/^refs\\/heads\\//, '');\n });\n\n cb(null, heads, xhr);\n });\n };\n\n // Retrieve the contents of a blob\n // -------\n\n this.getBlob = function (sha, cb) {\n _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw');\n };\n\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\n // -------\n\n this.getCommit = function (branch, sha, cb) {\n _request('GET', repoPath + '/git/commits/' + sha, null, cb);\n };\n\n // For a given file path, get the corresponding sha (blob for files, tree for dirs)\n // -------\n\n this.getSha = function (branch, path, cb) {\n if (!path || path === '') {\n return that.getRef('heads/' + branch, cb);\n }\n\n _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''), null, function (err, pathContent, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, pathContent.sha, xhr);\n });\n };\n\n // Get the statuses for a particular SHA\n // -------\n\n this.getStatuses = function (sha, cb) {\n _request('GET', repoPath + '/statuses/' + sha, null, cb);\n };\n\n // Retrieve the tree a commit points to\n // -------\n\n this.getTree = function (tree, cb) {\n _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.tree, xhr);\n });\n };\n\n // Post a new blob object, getting a blob SHA back\n // -------\n\n this.postBlob = function (content, cb) {\n if (typeof content === 'string') {\n content = {\n content: Utf8.encode(content),\n encoding: 'utf-8'\n };\n } else {\n if (typeof Buffer !== 'undefined' && content instanceof Buffer) {\n // in NodeJS\n content = {\n content: content.toString('base64'),\n encoding: 'base64'\n };\n } else if (typeof Blob !== 'undefined' && content instanceof Blob) {\n content = {\n content: b64encode(content),\n encoding: 'base64'\n };\n } else {\n throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)');\n }\n }\n\n _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Update an existing tree adding a new blob object getting a tree SHA back\n // -------\n\n this.updateTree = function (baseTree, path, blob, cb) {\n var data = {\n base_tree: baseTree,\n tree: [{\n path: path,\n mode: '100644',\n type: 'blob',\n sha: blob\n }]\n };\n\n _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Post a new tree object having a file path pointer replaced\n // with a new blob SHA getting a tree SHA back\n // -------\n\n this.postTree = function (tree, cb) {\n _request('POST', repoPath + '/git/trees', {\n tree: tree\n }, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n cb(null, res.sha, xhr);\n });\n };\n\n // Create a new commit object with the current commit SHA as the parent\n // and the new tree SHA, getting a commit SHA back\n // -------\n\n this.commit = function (parent, tree, message, cb) {\n var user = new Github.User();\n\n user.show(null, function (err, userData) {\n if (err) {\n return cb(err);\n }\n\n var data = {\n message: message,\n author: {\n name: options.user,\n email: userData.email\n },\n parents: [parent],\n tree: tree\n };\n\n _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) {\n if (err) {\n return cb(err);\n }\n\n currentTree.sha = res.sha; // Update latest commit\n\n cb(null, res.sha, xhr);\n });\n });\n };\n\n // Update the reference of your head to point to the new commit SHA\n // -------\n\n this.updateHead = function (head, commit, cb) {\n _request('PATCH', repoPath + '/git/refs/heads/' + head, {\n sha: commit\n }, cb);\n };\n\n // Show repository information\n // -------\n\n this.show = function (cb) {\n _request('GET', repoPath, null, cb);\n };\n\n // Show repository contributors\n // -------\n\n this.contributors = function (cb, retry) {\n retry = retry || 1000;\n var that = this;\n\n _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) {\n if (err) {\n return cb(err);\n }\n\n if (xhr.status === 202) {\n setTimeout(function () {\n that.contributors(cb, retry);\n }, retry);\n } else {\n cb(err, data, xhr);\n }\n });\n };\n\n // Get contents\n // --------\n\n this.contents = function (ref, path, cb) {\n path = encodeURI(path);\n _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), {\n ref: ref\n }, cb);\n };\n\n // Fork repository\n // -------\n\n this.fork = function (cb) {\n _request('POST', repoPath + '/forks', null, cb);\n };\n\n // List forks\n // --------\n\n this.listForks = function (cb) {\n _request('GET', repoPath + '/forks', null, cb);\n };\n\n // Branch repository\n // --------\n\n this.branch = function (oldBranch, newBranch, cb) {\n if (arguments.length === 2 && typeof arguments[1] === 'function') {\n cb = newBranch;\n newBranch = oldBranch;\n oldBranch = 'master';\n }\n\n this.getRef('heads/' + oldBranch, function (err, ref) {\n if (err && cb) {\n return cb(err);\n }\n\n that.createRef({\n ref: 'refs/heads/' + newBranch,\n sha: ref\n }, cb);\n });\n };\n\n // Create pull request\n // --------\n\n this.createPullRequest = function (options, cb) {\n _request('POST', repoPath + '/pulls', options, cb);\n };\n\n // List hooks\n // --------\n\n this.listHooks = function (cb) {\n _request('GET', repoPath + '/hooks', null, cb);\n };\n\n // Get a hook\n // --------\n\n this.getHook = function (id, cb) {\n _request('GET', repoPath + '/hooks/' + id, null, cb);\n };\n\n // Create a hook\n // --------\n\n this.createHook = function (options, cb) {\n _request('POST', repoPath + '/hooks', options, cb);\n };\n\n // Edit a hook\n // --------\n\n this.editHook = function (id, options, cb) {\n _request('PATCH', repoPath + '/hooks/' + id, options, cb);\n };\n\n // Delete a hook\n // --------\n\n this.deleteHook = function (id, cb) {\n _request('DELETE', repoPath + '/hooks/' + id, null, cb);\n };\n\n // Read file at given path\n // -------\n\n this.read = function (branch, path, cb) {\n _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''), null, cb, true);\n };\n\n // Remove a file\n // -------\n\n this.remove = function (branch, path, cb) {\n that.getSha(branch, path, function (err, sha) {\n if (err) {\n return cb(err);\n }\n\n _request('DELETE', repoPath + '/contents/' + path, {\n message: path + ' is removed',\n sha: sha,\n branch: branch\n }, cb);\n });\n };\n\n // Alias for repo.remove for backwards comapt.\n // -------\n this.delete = this.remove;\n\n // Move a file to a new location\n // -------\n\n this.move = function (branch, path, newPath, cb) {\n updateTree(branch, function (err, latestCommit) {\n that.getTree(latestCommit + '?recursive=true', function (err, tree) {\n // Update Tree\n tree.forEach(function (ref) {\n if (ref.path === path) {\n ref.path = newPath;\n }\n\n if (ref.type === 'tree') {\n delete ref.sha;\n }\n });\n\n that.postTree(tree, function (err, rootTree) {\n that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) {\n that.updateHead(branch, commit, cb);\n });\n });\n });\n });\n };\n\n // Write file contents to a given branch and path\n // -------\n\n this.write = function (branch, path, content, message, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n that.getSha(branch, encodeURI(path), function (err, sha) {\n var writeOptions = {\n message: message,\n content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content,\n branch: branch,\n committer: options && options.committer ? options.committer : undefined,\n author: options && options.author ? options.author : undefined\n };\n\n // If no error, we set the sha to overwrite an existing file\n if (!(err && err.error !== 404)) {\n writeOptions.sha = sha;\n }\n\n _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb);\n });\n };\n\n // List commits on a repository. Takes an object of optional parameters:\n // sha: SHA or branch to start listing commits from\n // path: Only commits containing this file path will be returned\n // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address\n // since: ISO 8601 date - only commits after this date will be returned\n // until: ISO 8601 date - only commits before this date will be returned\n // -------\n\n this.getCommits = function (options, cb) {\n options = options || {};\n var url = repoPath + '/commits';\n var params = [];\n\n if (options.sha) {\n params.push('sha=' + encodeURIComponent(options.sha));\n }\n\n if (options.path) {\n params.push('path=' + encodeURIComponent(options.path));\n }\n\n if (options.author) {\n params.push('author=' + encodeURIComponent(options.author));\n }\n\n if (options.since) {\n var since = options.since;\n\n if (since.constructor === Date) {\n since = since.toISOString();\n }\n\n params.push('since=' + encodeURIComponent(since));\n }\n\n if (options.until) {\n var until = options.until;\n\n if (until.constructor === Date) {\n until = until.toISOString();\n }\n\n params.push('until=' + encodeURIComponent(until));\n }\n\n if (options.page) {\n params.push('page=' + options.page);\n }\n\n if (options.perpage) {\n params.push('per_page=' + options.perpage);\n }\n\n if (params.length > 0) {\n url += '?' + params.join('&');\n }\n\n _request('GET', url, null, cb);\n };\n\n // Check if a repository is starred.\n // --------\n\n this.isStarred = function (owner, repository, cb) {\n _request('GET', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Star a repository.\n // --------\n\n this.star = function (owner, repository, cb) {\n _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Unstar a repository.\n // --------\n\n this.unstar = function (owner, repository, cb) {\n _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb);\n };\n\n // Create a new release\n // --------\n\n this.createRelease = function (options, cb) {\n _request('POST', repoPath + '/releases', options, cb);\n };\n\n // Edit a release\n // --------\n\n this.editRelease = function (id, options, cb) {\n _request('PATCH', repoPath + '/releases/' + id, options, cb);\n };\n\n // Get a single release\n // --------\n\n this.getRelease = function (id, cb) {\n _request('GET', repoPath + '/releases/' + id, null, cb);\n };\n\n // Remove a release\n // --------\n\n this.deleteRelease = function (id, cb) {\n _request('DELETE', repoPath + '/releases/' + id, null, cb);\n };\n };\n\n // Gists API\n // =======\n\n Github.Gist = function (options) {\n var id = options.id;\n var gistPath = '/gists/' + id;\n\n // Read the gist\n // --------\n\n this.read = function (cb) {\n _request('GET', gistPath, null, cb);\n };\n\n // Create the gist\n // --------\n // {\n // \"description\": \"the description for this gist\",\n // \"public\": true,\n // \"files\": {\n // \"file1.txt\": {\n // \"content\": \"String file contents\"\n // }\n // }\n // }\n\n this.create = function (options, cb) {\n _request('POST', '/gists', options, cb);\n };\n\n // Delete the gist\n // --------\n\n this.delete = function (cb) {\n _request('DELETE', gistPath, null, cb);\n };\n\n // Fork a gist\n // --------\n\n this.fork = function (cb) {\n _request('POST', gistPath + '/fork', null, cb);\n };\n\n // Update a gist with the new stuff\n // --------\n\n this.update = function (options, cb) {\n _request('PATCH', gistPath, options, cb);\n };\n\n // Star a gist\n // --------\n\n this.star = function (cb) {\n _request('PUT', gistPath + '/star', null, cb);\n };\n\n // Untar a gist\n // --------\n\n this.unstar = function (cb) {\n _request('DELETE', gistPath + '/star', null, cb);\n };\n\n // Check if a gist is starred\n // --------\n\n this.isStarred = function (cb) {\n _request('GET', gistPath + '/star', null, cb);\n };\n };\n\n // Issues API\n // ==========\n\n Github.Issue = function (options) {\n var path = '/repos/' + options.user + '/' + options.repo + '/issues';\n\n this.create = function (options, cb) {\n _request('POST', path, options, cb);\n };\n\n this.list = function (options, cb) {\n var query = [];\n\n Object.keys(options).forEach(function (option) {\n query.push(encodeURIComponent(option) + '=' + encodeURIComponent(options[option]));\n });\n\n _requestAllPages(path + '?' + query.join('&'), !!options.page, cb);\n };\n\n this.comment = function (issue, comment, cb) {\n _request('POST', issue.comments_url, {\n body: comment\n }, cb);\n };\n\n this.edit = function (issue, options, cb) {\n _request('PATCH', path + '/' + issue, options, cb);\n };\n\n this.get = function (issue, cb) {\n _request('GET', path + '/' + issue, null, cb);\n };\n };\n\n // Search API\n // ==========\n\n Github.Search = function (options) {\n var path = '/search/';\n var query = '?q=' + options.query;\n\n this.repositories = function (options, cb) {\n _request('GET', path + 'repositories' + query, options, cb);\n };\n\n this.code = function (options, cb) {\n _request('GET', path + 'code' + query, options, cb);\n };\n\n this.issues = function (options, cb) {\n _request('GET', path + 'issues' + query, options, cb);\n };\n\n this.users = function (options, cb) {\n _request('GET', path + 'users' + query, options, cb);\n };\n };\n\n // Rate Limit API\n // ==========\n\n Github.RateLimit = function () {\n this.getRateLimit = function (cb) {\n _request('GET', '/rate_limit', null, cb);\n };\n };\n\n return Github;\n };\n\n // Top Level API\n // -------\n\n Github.getIssues = function (user, repo) {\n return new Github.Issue({\n user: user,\n repo: repo\n });\n };\n\n Github.getRepo = function (user, repo) {\n if (!repo) {\n return new Github.Repository({\n fullname: user\n });\n } else {\n return new Github.Repository({\n user: user,\n name: repo\n });\n }\n };\n\n Github.getUser = function () {\n return new Github.User();\n };\n\n Github.getGist = function (id) {\n return new Github.Gist({\n id: id\n });\n };\n\n Github.getSearch = function (query) {\n return new Github.Search({\n query: query\n });\n };\n\n Github.getRateLimit = function () {\n return new Github.RateLimit();\n };\n\n module.exports = Github;\n});"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 5680bb3f..801abddc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,8 +3,10 @@ var gulp = require('gulp'); var babel = require('gulp-babel'); +var istanbul = require('gulp-istanbul'); var jscs = require('gulp-jscs'); var jshint = require('gulp-jshint'); + var mocha = require('gulp-mocha'); var rename = require('gulp-rename'); var stylish = require('gulp-jscs-stylish'); @@ -13,89 +15,39 @@ var browserify = require('browserify'); var buffer = require('vinyl-buffer'); var del = require('del'); var path = require('path'); -var karma = require('karma'); +var Promise = require('es6-promise').Promise; var source = require('vinyl-source-stream'); var sourcemaps = require('gulp-sourcemaps'); var uglify = require('gulp-uglify'); -function runTests(singleRun, isCI, done) { - var reporters = ['mocha']; - var preprocessors = {}; - - var files = [ - path.join(__dirname, 'test/vendor/*.js'), // PhantomJS 1.x polyfills - path.join(__dirname, 'test/test.*.js') - ]; - - if (singleRun) { - preprocessors['test/test.*.js'] = ['browserify']; - reporters.push('coverage'); - } - - files.push({ - pattern: path.join(__dirname, 'test/gh.png'), - watched: false, - included: false - }); - - var localConfig = { - files: files, - configFile: path.join(__dirname, './karma.conf.js'), - singleRun: singleRun, - autoWatch: !singleRun, - reporters: reporters, - preprocessors: preprocessors - }; - - if (isCI) { - localConfig.sauceLabs = { - testName: 'GitHub.js UAT tests', - idleTimeout: 120000, - recordVideo: false - }; - - // Increase timeouts massively so Karma doesn't timeout in Sauce tunnel. - localConfig.browserNoActivityTimeout = 400000; - localConfig.captureTimeout = 120000; - localConfig.customLaunchers = sauceLaunchers; - localConfig.browsers = Object.keys(sauceLaunchers); - reporters.push('saucelabs'); - - // Set Mocha timeouts to longer. - localConfig.client = { - mocha: { - timeout: 20000 - } - }; - } - - var server = new karma.Server(localConfig, function(failCount) { - done(failCount ? new Error('Failed ' + failCount + ' tests.') : null); - }); - - server.start(); -} // End runTests() - gulp.task('lint', function() { - return gulp.src([ + var sources = [ path.join(__dirname, '/*.js'), path.join(__dirname, '/src/*.js'), path.join(__dirname, '/test/*.js') - ], - { + ]; + var opts = { base: './' - }) - .pipe(jshint()) - .pipe(jscs({ - fix: true - })) - .pipe(stylish.combineWithHintResults()) - .pipe(jscs.reporter()) - .pipe(jshint.reporter('jshint-stylish')) - .pipe(gulp.dest('.')); + }; + + return gulp.src(sources, opts) + .pipe(jshint()) + .pipe(jscs()) + .pipe(stylish.combineWithHintResults()) + .pipe(jscs.reporter()) + .pipe(jshint.reporter('jshint-stylish')) + .pipe(gulp.dest('.')) + ; +}); + +gulp.task('coverage', function() { + return gulp.src('src/**/*.js') + .pipe(istanbul()) + .pipe(istanbul.hookRequire()) + ; }); -gulp.task('test:mocha', function() { +gulp.task('test:mocha', ['coverage'], function() { var srcOpts = { read: false }; @@ -106,15 +58,12 @@ gulp.task('test:mocha', function() { return gulp.src('test/test.*.js', srcOpts) .pipe(mocha(mochaOpts)) + .pipe(istanbul.writeReports()) ; }); -gulp.task('test:browser', function(done) { - runTests(true, true, done); -}); - -gulp.task('clean', function () { - return del('dist/*'); +gulp.task('clean', function() { + return Promise.all([del('dist/*'), del('coverage/*')]); }); gulp.task('build', function() { @@ -140,17 +89,15 @@ gulp.task('build', function() { .pipe(gulp.dest('dist')) ; - var babeled = gulp.src('src/github.js') + gulp.src('src/github.js') .pipe(babel()) - ; - - babeled .pipe(sourcemaps.init()) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('dist')) ; - return babeled + return gulp.src('src/github.js') + .pipe(babel()) .pipe(sourcemaps.init()) .pipe(rename({ extname: '.min.js' @@ -162,48 +109,5 @@ gulp.task('build', function() { }); gulp.task('default', ['clean'], function() { - gulp.start('lint', 'test', 'build'); + gulp.start('lint', 'test:mocha', 'build'); }); - -var sauceLaunchers = { - SL_Chrome: { - base: 'SauceLabs', - browserName: 'chrome', - version: '45' - }, - SL_Firefox: { - base: 'SauceLabs', - browserName: 'firefox', - version: '39' - }, - SL_Safari: { - base: 'SauceLabs', - browserName: 'safari', - platform: 'OS X 10.10', - version: '8' - }, - SL_IE_9: { - base: 'SauceLabs', - browserName: 'internet explorer', - platform: 'Windows 7', - version: '9' - }, - SL_IE_10: { - base: 'SauceLabs', - browserName: 'internet explorer', - platform: 'Windows 2012', - version: '10' - }, - SL_IE_11: { - base: 'SauceLabs', - browserName: 'internet explorer', - platform: 'Windows 8.1', - version: '11' - }, - SL_iOS: { - base: 'SauceLabs', - browserName: 'iphone', - platform: 'OS X 10.10', - version: '8.1' - } -}; diff --git a/package.json b/package.json index a9fa2e47..30c2abfc 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "del": "^2.2.0", "gulp": "^3.9.0", "gulp-babel": "^6.1.2", + "gulp-istanbul": "^0.10.3", "gulp-jscs": "^3.0.2", "gulp-jscs-stylish": "^1.3.0", "gulp-jshint": "^2.0.0", @@ -29,24 +30,16 @@ "istanbul": "^0.4.2", "jshint": "^2.9.1", "jshint-stylish": "^2.1.0", - "karma": "^0.13.19", - "karma-browserify": "^4.4.2", - "karma-coverage": "^0.5.3", - "karma-json-fixtures-preprocessor": "0.0.6", - "karma-mocha": "^0.2.1", - "karma-mocha-reporter": "^1.1.5", - "karma-phantomjs-launcher": "^0.2.3", - "karma-sauce-launcher": "^0.3.0", "mocha": "^2.3.4", "must": "^0.13.1", - "phantomjs": "^2.1.3", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0" }, "scripts": { "test": "gulp test && gulp lint", "lint": "gulp lint", - "codecov": "cat coverage/*/lcov.info | codecov" + "codecov": "node_modules/.bin/codecov", + "show-coverage-html": "open coverage/lcov-report/index.html" }, "repository": { "type": "git", diff --git a/test/.jshintrc b/test/.jshintrc new file mode 100644 index 00000000..910bdea2 --- /dev/null +++ b/test/.jshintrc @@ -0,0 +1,9 @@ +{ + "browser": true, + "mocha": true, + "node": true, + "globals": { + "require": false, + "define": false + } +} From a7587fde9502742580149811d087b36edaf39e56 Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Wed, 9 Mar 2016 16:49:02 -0600 Subject: [PATCH 8/8] Whitespace changes!!! --- karma.conf.js | 75 --- package.json | 122 ++-- src/github.js | 1697 ++++++++++++++++++++++++------------------------- 3 files changed, 908 insertions(+), 986 deletions(-) delete mode 100644 karma.conf.js diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index 17cec5a6..00000000 --- a/karma.conf.js +++ /dev/null @@ -1,75 +0,0 @@ -module.exports = function (config) { - 'use strict'; - - var configuration = { - browserNoActivityTimeout: 30000, - - client: { - captureConsole: true, - mocha: { - timeout: 30000, - ui: 'bdd' - } - }, - - concurrency: 2, - - singleRun: true, - - autoWatch: false, - - frameworks: [ - 'browserify', - 'mocha', - 'chai' - ], - - browsers: ['PhantomJS'], - - browserify: { - debug: true, - transform: ['browserify-istanbul'] - }, - - phantomjsLauncher: { - debug: true, - options: { - settings: { - webSecurityEnabled: false - } - } - }, - - coverageReporter: { - reporters: [ - { - type: 'lcov' - }, - { - type: 'text-summary' - } - ], - instrumenterOptions: { - istanbul: { - noCompact: true - } - } - } - }; - - // This block is needed to execute Chrome on Travis - // If you ever plan to use Chrome and Travis, you can keep it - // If not, you can safely remove it - // https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076 - if (configuration.browsers[0] === 'Chrome' && process.env.TRAVIS) { - configuration.customLaunchers = { - 'chrome-travis-ci': { - base: 'Chrome', - flags: ['--no-sandbox'] - } - }; - configuration.browsers = ['chrome-travis-ci']; - } - - config.set(configuration); -}; diff --git a/package.json b/package.json index 30c2abfc..6bddf02b 100644 --- a/package.json +++ b/package.json @@ -1,63 +1,63 @@ { - "name": "github-api", - "version": "0.11.2", - "description": "A higher-level wrapper around the Github API.", - "main": "src/github.js", - "dependencies": { - "axios": "https://github.com/github-tools/axios.git", - "base-64": "^0.1.0", - "es6-promise": "^3.0.2", - "utf8": "^2.1.1" - }, - "devDependencies": { - "babel-plugin-transform-es2015-modules-umd": "^6.5.0", - "babel-preset-es2015": "^6.5.0", - "babelify": "^7.2.0", - "browserify": "^13.0.0", - "browserify-istanbul": "^0.2.1", - "codecov": "^1.0.1", - "del": "^2.2.0", - "gulp": "^3.9.0", - "gulp-babel": "^6.1.2", - "gulp-istanbul": "^0.10.3", - "gulp-jscs": "^3.0.2", - "gulp-jscs-stylish": "^1.3.0", - "gulp-jshint": "^2.0.0", - "gulp-mocha": "^2.2.0", - "gulp-rename": "^1.2.2", - "gulp-sourcemaps": "^1.6.0", - "gulp-uglify": "^1.5.1", - "istanbul": "^0.4.2", - "jshint": "^2.9.1", - "jshint-stylish": "^2.1.0", - "mocha": "^2.3.4", - "must": "^0.13.1", - "vinyl-buffer": "^1.0.0", - "vinyl-source-stream": "^1.1.0" - }, - "scripts": { - "test": "gulp test && gulp lint", - "lint": "gulp lint", - "codecov": "node_modules/.bin/codecov", - "show-coverage-html": "open coverage/lcov-report/index.html" - }, - "repository": { - "type": "git", - "url": "git://github.com/michael/github.git" - }, - "keywords": [ - "github", - "api" - ], - "contributors": [ - "Ændrew Rininsland (http://www.aendrew.com)", - "Aurelio De Rosa (http://www.audero.it/)", - "Michael Aufreiter (http://substance.io)" - ], - "license": "BSD-3-Clause-Clear", - "readmeFilename": "README.md", - "gitHead": "aa8aa3c8cd5ce5240373d4fd1d06a7ab4af41a36", - "bugs": { - "url": "https://github.com/michael/github/issues" - } + "name": "github-api", + "version": "0.11.2", + "description": "A higher-level wrapper around the Github API.", + "main": "src/github.js", + "dependencies": { + "axios": "https://github.com/github-tools/axios.git", + "base-64": "^0.1.0", + "es6-promise": "^3.0.2", + "utf8": "^2.1.1" + }, + "devDependencies": { + "babel-plugin-transform-es2015-modules-umd": "^6.5.0", + "babel-preset-es2015": "^6.5.0", + "babelify": "^7.2.0", + "browserify": "^13.0.0", + "browserify-istanbul": "^0.2.1", + "codecov": "^1.0.1", + "del": "^2.2.0", + "gulp": "^3.9.0", + "gulp-babel": "^6.1.2", + "gulp-istanbul": "^0.10.3", + "gulp-jscs": "^3.0.2", + "gulp-jscs-stylish": "^1.3.0", + "gulp-jshint": "^2.0.0", + "gulp-mocha": "^2.2.0", + "gulp-rename": "^1.2.2", + "gulp-sourcemaps": "^1.6.0", + "gulp-uglify": "^1.5.1", + "istanbul": "^0.4.2", + "jshint": "^2.9.1", + "jshint-stylish": "^2.1.0", + "mocha": "^2.3.4", + "must": "^0.13.1", + "vinyl-buffer": "^1.0.0", + "vinyl-source-stream": "^1.1.0" + }, + "scripts": { + "test": "gulp test:mocha", + "lint": "gulp lint", + "codecov": "node_modules/.bin/codecov", + "show-coverage-html": "open coverage/lcov-report/index.html" + }, + "repository": { + "type": "git", + "url": "git://github.com/michael/github.git" + }, + "keywords": [ + "github", + "api" + ], + "contributors": [ + "Ændrew Rininsland (http://www.aendrew.com)", + "Aurelio De Rosa (http://www.audero.it/)", + "Michael Aufreiter (http://substance.io)" + ], + "license": "BSD-3-Clause-Clear", + "readmeFilename": "README.md", + "gitHead": "aa8aa3c8cd5ce5240373d4fd1d06a7ab4af41a36", + "bugs": { + "url": "https://github.com/michael/github/issues" + } } diff --git a/src/github.js b/src/github.js index 0fe7678c..5d92f948 100644 --- a/src/github.js +++ b/src/github.js @@ -16,1129 +16,1126 @@ var axios = require('axios'); var Base64 = require('base-64'); var Promise = require('es6-promise'); - function b64encode(string) { - return Base64.encode(Utf8.encode(string)); - } - - if (Promise.polyfill) { - Promise.polyfill(); - } +function b64encode(string) { + return Base64.encode(Utf8.encode(string)); +} - // Initial Setup - // ------------- +if (Promise.polyfill) { + Promise.polyfill(); +} - function Github(options) { - options = options || {}; +// Initial Setup +// ------------- - var API_URL = options.apiUrl || 'https://api.github.com'; +function Github(options) { + options = options || {}; - // HTTP Request Abstraction - // ======= - // - // I'm not proud of this and neither should you be if you were responsible for the XMLHttpRequest spec. + var API_URL = options.apiUrl || 'https://api.github.com'; - var _request = Github._request = function _request(method, path, data, cb, raw) { - function getURL() { - var url = path.indexOf('//') >= 0 ? path : API_URL + path; + var _request = Github._request = function _request(method, path, data, cb, raw) { + function getURL() { + var url = path.indexOf('//') >= 0 ? path : API_URL + path; - url += ((/\?/).test(url) ? '&' : '?'); + url += ((/\?/).test(url) ? '&' : '?'); - if (data && typeof data === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) { - for(var param in data) { - if (data.hasOwnProperty(param)) { - url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]); - } + if (data && typeof data === 'object' && ['GET', 'HEAD', 'DELETE'].indexOf(method) > -1) { + for(var param in data) { + if (data.hasOwnProperty(param)) { + url += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(data[param]); } } - - return url.replace(/(×tamp=\d+)/, '') + - (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : ''); } - var config = { - headers: { - Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json', - 'Content-Type': 'application/json;charset=UTF-8' - }, - method: method, - data: data ? data : {}, - url: getURL() - }; + return url.replace(/(×tamp=\d+)/, '') + + (typeof window !== 'undefined' ? '×tamp=' + new Date().getTime() : ''); + } - if ((options.token) || (options.username && options.password)) { - config.headers.Authorization = options.token ? - 'token ' + options.token : - 'Basic ' + b64encode(options.username + ':' + options.password); - } + var config = { + headers: { + Accept: raw ? 'application/vnd.github.v3.raw+json' : 'application/vnd.github.v3+json', + 'Content-Type': 'application/json;charset=UTF-8' + }, + method: method, + data: data ? data : {}, + url: getURL() + }; - return axios(config) - .then(function (response) { + if ((options.token) || (options.username && options.password)) { + config.headers.Authorization = options.token ? + 'token ' + options.token : + 'Basic ' + b64encode(options.username + ':' + options.password); + } + + return axios(config) + .then(function(response) { + cb( + null, + response.data || true, + response + ); + }, function(response) { + if (response.status === 304) { cb( null, response.data || true, response ); - }, function (response) { - if (response.status === 304) { - cb( - null, - response.data || true, - response - ); - } else { - cb({ - path: path, - request: response, - error: response.status - }); - } - }); - }; + } else { + cb({ + path: path, + request: response, + error: response.status + }); + } + }); + }; - var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, singlePage, cb) { - var results = []; + var _requestAllPages = Github._requestAllPages = function _requestAllPages(path, singlePage, cb) { + var results = []; - (function iterate() { - _request('GET', path, null, function (err, res, xhr) { - if (err) { - return cb(err); - } + (function iterate() { + _request('GET', path, null, function(err, res, xhr) { + if (err) { + return cb(err); + } - if (!(res instanceof Array)) { - res = [res]; - } + if (!(res instanceof Array)) { + res = [res]; + } - results.push.apply(results, res); - - var next = (xhr.headers.link || '') - .split(',') - .filter(function(link) { - return /rel="next"/.test(link); - }) - .map(function(link) { - return (/<(.*)>/.exec(link) || [])[1]; - }) - .pop(); - - if (!next || singlePage) { - cb(err, results, xhr); - } else { - path = next; - iterate(); - } - }); - })(); - }; + results.push.apply(results, res); - // User API - // ======= + var next = (xhr.headers.link || '') + .split(',') + .filter(function(link) { + return /rel="next"/.test(link); + }) + .map(function(link) { + return (/<(.*)>/.exec(link) || [])[1]; + }) + .pop(); - Github.User = function () { - this.repos = function (options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; + if (!next || singlePage) { + cb(err, results, xhr); + } else { + path = next; + iterate(); } + }); + })(); + }; - options = options || {}; + // User API + // ======= - var url = '/user/repos'; - var params = []; + Github.User = function() { + this.repos = function(options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } - params.push('type=' + encodeURIComponent(options.type || 'all')); - params.push('sort=' + encodeURIComponent(options.sort || 'updated')); - params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore + options = options || {}; - if (options.page) { - params.push('page=' + encodeURIComponent(options.page)); - } + var url = '/user/repos'; + var params = []; - url += '?' + params.join('&'); + params.push('type=' + encodeURIComponent(options.type || 'all')); + params.push('sort=' + encodeURIComponent(options.sort || 'updated')); + params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore - _requestAllPages(url, !!options.page, cb); - }; - - // List user organizations - // ------- + if (options.page) { + params.push('page=' + encodeURIComponent(options.page)); + } - this.orgs = function (cb) { - _request('GET', '/user/orgs', null, cb); - }; + url += '?' + params.join('&'); - // List authenticated user's gists - // ------- + _requestAllPages(url, !!options.page, cb); + }; - this.gists = function (cb) { - _request('GET', '/gists', null, cb); - }; + // List user organizations + // ------- - // List authenticated user's unread notifications - // ------- + this.orgs = function(cb) { + _request('GET', '/user/orgs', null, cb); + }; - this.notifications = function (options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } + // List authenticated user's gists + // ------- - options = options || {}; - var url = '/notifications'; - var params = []; + this.gists = function(cb) { + _request('GET', '/gists', null, cb); + }; - if (options.all) { - params.push('all=true'); - } + // List authenticated user's unread notifications + // ------- - if (options.participating) { - params.push('participating=true'); - } + this.notifications = function(options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } - if (options.since) { - var since = options.since; + options = options || {}; + var url = '/notifications'; + var params = []; - if (since.constructor === Date) { - since = since.toISOString(); - } + if (options.all) { + params.push('all=true'); + } - params.push('since=' + encodeURIComponent(since)); - } + if (options.participating) { + params.push('participating=true'); + } - if (options.before) { - var before = options.before; + if (options.since) { + var since = options.since; - if (before.constructor === Date) { - before = before.toISOString(); - } - - params.push('before=' + encodeURIComponent(before)); + if (since.constructor === Date) { + since = since.toISOString(); } - if (options.page) { - params.push('page=' + encodeURIComponent(options.page)); - } + params.push('since=' + encodeURIComponent(since)); + } + + if (options.before) { + var before = options.before; - if (params.length > 0) { - url += '?' + params.join('&'); + if (before.constructor === Date) { + before = before.toISOString(); } - _request('GET', url, null, cb); - }; + params.push('before=' + encodeURIComponent(before)); + } - // Show user information - // ------- + if (options.page) { + params.push('page=' + encodeURIComponent(options.page)); + } - this.show = function (username, cb) { - var command = username ? '/users/' + username : '/user'; + if (params.length > 0) { + url += '?' + params.join('&'); + } - _request('GET', command, null, cb); - }; + _request('GET', url, null, cb); + }; - // List user repositories - // ------- + // Show user information + // ------- - this.userRepos = function (username, options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } + this.show = function(username, cb) { + var command = username ? '/users/' + username : '/user'; - var url = '/users/' + username + '/repos'; - var params = []; + _request('GET', command, null, cb); + }; - params.push('type=' + encodeURIComponent(options.type || 'all')); - params.push('sort=' + encodeURIComponent(options.sort || 'updated')); - params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore + // List user repositories + // ------- - if (options.page) { - params.push('page=' + encodeURIComponent(options.page)); - } + this.userRepos = function(username, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } - url += '?' + params.join('&'); + var url = '/users/' + username + '/repos'; + var params = []; - _requestAllPages(url, !!options.page, cb); - }; + params.push('type=' + encodeURIComponent(options.type || 'all')); + params.push('sort=' + encodeURIComponent(options.sort || 'updated')); + params.push('per_page=' + encodeURIComponent(options.per_page || '100')); // jscs:ignore - // List user starred repositories - // ------- + if (options.page) { + params.push('page=' + encodeURIComponent(options.page)); + } - this.userStarred = function (username, cb) { - // Github does not always honor the 1000 limit so we want to iterate over the data set. - var request = '/users/' + username + '/starred?type=all&per_page=100'; - _requestAllPages(request, false, cb); - }; + url += '?' + params.join('&'); - // List a user's gists - // ------- + _requestAllPages(url, !!options.page, cb); + }; - this.userGists = function (username, cb) { - _request('GET', '/users/' + username + '/gists', null, cb); - }; + // List user starred repositories + // ------- - // List organization repositories - // ------- + this.userStarred = function(username, cb) { + // Github does not always honor the 1000 limit so we want to iterate over the data set. + var request = '/users/' + username + '/starred?type=all&per_page=100'; - this.orgRepos = function (orgname, cb) { - // Github does not always honor the 1000 limit so we want to iterate over the data set. - var request = '/orgs/' + orgname + '/repos?type=all&&page_num=100&sort=updated&direction=desc'; - _requestAllPages(request, false, cb); - }; + _requestAllPages(request, false, cb); + }; - // Follow user - // ------- + // List a user's gists + // ------- - this.follow = function (username, cb) { - _request('PUT', '/user/following/' + username, null, cb); - }; + this.userGists = function(username, cb) { + _request('GET', '/users/' + username + '/gists', null, cb); + }; - // Unfollow user - // ------- + // List organization repositories + // ------- - this.unfollow = function (username, cb) { - _request('DELETE', '/user/following/' + username, null, cb); - }; + this.orgRepos = function(orgname, cb) { + // Github does not always honor the 1000 limit so we want to iterate over the data set. + var request = '/orgs/' + orgname + '/repos?type=all&&page_num=100&sort=updated&direction=desc'; - // Create a repo - // ------- - this.createRepo = function (options, cb) { - _request('POST', '/user/repos', options, cb); - }; + _requestAllPages(request, false, cb); }; - // Repository API - // ======= + // Follow user + // ------- - Github.Repository = function (options) { - var repo = options.name; - var user = options.user; - var fullname = options.fullname; + this.follow = function(username, cb) { + _request('PUT', '/user/following/' + username, null, cb); + }; - var that = this; - var repoPath; + // Unfollow user + // ------- - if (fullname) { - repoPath = '/repos/' + fullname; - } else { - repoPath = '/repos/' + user + '/' + repo; - } + this.unfollow = function(username, cb) { + _request('DELETE', '/user/following/' + username, null, cb); + }; - var currentTree = { - branch: null, - sha: null - }; + // Create a repo + // ------- + this.createRepo = function(options, cb) { + _request('POST', '/user/repos', options, cb); + }; + }; - // Uses the cache if branch has not been changed - // ------- + // Repository API + // ======= - function updateTree(branch, cb) { - if (branch === currentTree.branch && currentTree.sha) { - return cb(null, currentTree.sha); - } + Github.Repository = function(options) { + var repo = options.name; + var user = options.user; + var fullname = options.fullname; - that.getRef('heads/' + branch, function (err, sha) { - currentTree.branch = branch; - currentTree.sha = sha; - cb(err, sha); - }); - } + var that = this; + var repoPath; - // Get a particular reference - // ------- + if (fullname) { + repoPath = '/repos/' + fullname; + } else { + repoPath = '/repos/' + user + '/' + repo; + } - this.getRef = function (ref, cb) { - _request('GET', repoPath + '/git/refs/' + ref, null, function (err, res, xhr) { - if (err) { - return cb(err); - } + var currentTree = { + branch: null, + sha: null + }; - cb(null, res.object.sha, xhr); - }); - }; + // Uses the cache if branch has not been changed + // ------- - // Create a new reference - // -------- - // - // { - // "ref": "refs/heads/my-new-branch-name", - // "sha": "827efc6d56897b048c772eb4087f854f46256132" - // } + function updateTree(branch, cb) { + if (branch === currentTree.branch && currentTree.sha) { + return cb(null, currentTree.sha); + } - this.createRef = function (options, cb) { - _request('POST', repoPath + '/git/refs', options, cb); - }; + that.getRef('heads/' + branch, function(err, sha) { + currentTree.branch = branch; + currentTree.sha = sha; + cb(err, sha); + }); + } - // Delete a reference - // -------- - // - // Repo.deleteRef('heads/gh-pages') - // repo.deleteRef('tags/v1.0') + // Get a particular reference + // ------- - this.deleteRef = function (ref, cb) { - _request('DELETE', repoPath + '/git/refs/' + ref, options, cb); - }; + this.getRef = function(ref, cb) { + _request('GET', repoPath + '/git/refs/' + ref, null, function(err, res, xhr) { + if (err) { + return cb(err); + } - // Delete a repo - // -------- + cb(null, res.object.sha, xhr); + }); + }; - this.deleteRepo = function (cb) { - _request('DELETE', repoPath, options, cb); - }; + // Create a new reference + // -------- + // + // { + // "ref": "refs/heads/my-new-branch-name", + // "sha": "827efc6d56897b048c772eb4087f854f46256132" + // } - // List all tags of a repository - // ------- + this.createRef = function(options, cb) { + _request('POST', repoPath + '/git/refs', options, cb); + }; - this.listTags = function (cb) { - _request('GET', repoPath + '/tags', null, cb); - }; + // Delete a reference + // -------- + // + // Repo.deleteRef('heads/gh-pages') + // repo.deleteRef('tags/v1.0') - // List all pull requests of a respository - // ------- + this.deleteRef = function(ref, cb) { + _request('DELETE', repoPath + '/git/refs/' + ref, options, cb); + }; - this.listPulls = function (options, cb) { - options = options || {}; - var url = repoPath + '/pulls'; - var params = []; + // Delete a repo + // -------- - if (typeof options === 'string') { - // Backward compatibility - params.push('state=' + options); - } else { - if (options.state) { - params.push('state=' + encodeURIComponent(options.state)); - } + this.deleteRepo = function(cb) { + _request('DELETE', repoPath, options, cb); + }; - if (options.head) { - params.push('head=' + encodeURIComponent(options.head)); - } + // List all tags of a repository + // ------- - if (options.base) { - params.push('base=' + encodeURIComponent(options.base)); - } + this.listTags = function(cb) { + _request('GET', repoPath + '/tags', null, cb); + }; - if (options.sort) { - params.push('sort=' + encodeURIComponent(options.sort)); - } + // List all pull requests of a respository + // ------- - if (options.direction) { - params.push('direction=' + encodeURIComponent(options.direction)); - } + this.listPulls = function(options, cb) { + options = options || {}; + var url = repoPath + '/pulls'; + var params = []; - if (options.page) { - params.push('page=' + options.page); - } + if (typeof options === 'string') { + // Backward compatibility + params.push('state=' + options); + } else { + if (options.state) { + params.push('state=' + encodeURIComponent(options.state)); + } - if (options.per_page) { - params.push('per_page=' + options.per_page); - } + if (options.head) { + params.push('head=' + encodeURIComponent(options.head)); } - if (params.length > 0) { - url += '?' + params.join('&'); + if (options.base) { + params.push('base=' + encodeURIComponent(options.base)); } - _request('GET', url, null, cb); - }; + if (options.sort) { + params.push('sort=' + encodeURIComponent(options.sort)); + } - // Gets details for a specific pull request - // ------- + if (options.direction) { + params.push('direction=' + encodeURIComponent(options.direction)); + } - this.getPull = function (number, cb) { - _request('GET', repoPath + '/pulls/' + number, null, cb); - }; + if (options.page) { + params.push('page=' + options.page); + } - // Retrieve the changes made between base and head - // ------- + if (options.per_page) { + params.push('per_page=' + options.per_page); + } + } - this.compare = function (base, head, cb) { - _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb); - }; + if (params.length > 0) { + url += '?' + params.join('&'); + } - // List all branches of a repository - // ------- + _request('GET', url, null, cb); + }; - this.listBranches = function (cb) { - _request('GET', repoPath + '/git/refs/heads', null, function (err, heads, xhr) { - if (err) { - return cb(err); - } + // Gets details for a specific pull request + // ------- - heads = heads.map(function (head) { - return head.ref.replace(/^refs\/heads\//, ''); - }); + this.getPull = function(number, cb) { + _request('GET', repoPath + '/pulls/' + number, null, cb); + }; - cb(null, heads, xhr); - }); - }; + // Retrieve the changes made between base and head + // ------- - // Retrieve the contents of a blob - // ------- + this.compare = function(base, head, cb) { + _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb); + }; - this.getBlob = function (sha, cb) { - _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw'); - }; + // List all branches of a repository + // ------- - // For a given file path, get the corresponding sha (blob for files, tree for dirs) - // ------- + this.listBranches = function(cb) { + _request('GET', repoPath + '/git/refs/heads', null, function(err, heads, xhr) { + if (err) { + return cb(err); + } - this.getCommit = function (branch, sha, cb) { - _request('GET', repoPath + '/git/commits/' + sha, null, cb); - }; + heads = heads.map(function(head) { + return head.ref.replace(/^refs\/heads\//, ''); + }); - // For a given file path, get the corresponding sha (blob for files, tree for dirs) - // ------- + cb(null, heads, xhr); + }); + }; - this.getSha = function (branch, path, cb) { - if (!path || path === '') { - return that.getRef('heads/' + branch, cb); - } + // Retrieve the contents of a blob + // ------- - _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''), - null, function (err, pathContent, xhr) { - if (err) { - return cb(err); - } + this.getBlob = function(sha, cb) { + _request('GET', repoPath + '/git/blobs/' + sha, null, cb, 'raw'); + }; - cb(null, pathContent.sha, xhr); - }); - }; + // For a given file path, get the corresponding sha (blob for files, tree for dirs) + // ------- - // Get the statuses for a particular SHA - // ------- + this.getCommit = function(branch, sha, cb) { + _request('GET', repoPath + '/git/commits/' + sha, null, cb); + }; - this.getStatuses = function (sha, cb) { - _request('GET', repoPath + '/statuses/' + sha, null, cb); - }; + // For a given file path, get the corresponding sha (blob for files, tree for dirs) + // ------- - // Retrieve the tree a commit points to - // ------- + this.getSha = function(branch, path, cb) { + if (!path || path === '') { + return that.getRef('heads/' + branch, cb); + } - this.getTree = function (tree, cb) { - _request('GET', repoPath + '/git/trees/' + tree, null, function (err, res, xhr) { + _request('GET', repoPath + '/contents/' + path + (branch ? '?ref=' + branch : ''), + null, function(err, pathContent, xhr) { if (err) { return cb(err); } - cb(null, res.tree, xhr); + cb(null, pathContent.sha, xhr); }); - }; + }; + + // Get the statuses for a particular SHA + // ------- + + this.getStatuses = function(sha, cb) { + _request('GET', repoPath + '/statuses/' + sha, null, cb); + }; + + // Retrieve the tree a commit points to + // ------- + + this.getTree = function(tree, cb) { + _request('GET', repoPath + '/git/trees/' + tree, null, function(err, res, xhr) { + if (err) { + return cb(err); + } - // Post a new blob object, getting a blob SHA back - // ------- + cb(null, res.tree, xhr); + }); + }; - this.postBlob = function (content, cb) { - if (typeof content === 'string') { + // Post a new blob object, getting a blob SHA back + // ------- + + this.postBlob = function(content, cb) { + if (typeof content === 'string') { + content = { + content: Utf8.encode(content), + encoding: 'utf-8' + }; + } else { + if (typeof Buffer !== 'undefined' && content instanceof Buffer) { + // When we're in Node content = { - content: Utf8.encode(content), - encoding: 'utf-8' + content: content.toString('base64'), + encoding: 'base64' + }; + } else if (typeof Blob !== 'undefined' && content instanceof Blob) { + content = { + content: b64encode(content), + encoding: 'base64' }; } else { - if (typeof Buffer !== 'undefined' && content instanceof Buffer) { - // in NodeJS - content = { - content: content.toString('base64'), - encoding: 'base64' - }; - } else if (typeof Blob !== 'undefined' && content instanceof Blob) { - content = { - content: b64encode(content), - encoding: 'base64' - }; - } else { - throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)'); - } + throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)'); } + } - _request('POST', repoPath + '/git/blobs', content, function (err, res, xhr) { - if (err) { - return cb(err); - } + _request('POST', repoPath + '/git/blobs', content, function(err, res, xhr) { + if (err) { + return cb(err); + } - cb(null, res.sha, xhr); - }); + cb(null, res.sha, xhr); + }); + }; + + // Update an existing tree adding a new blob object getting a tree SHA back + // ------- + + this.updateTree = function(baseTree, path, blob, cb) { + var data = { + base_tree: baseTree, + tree: [ + { + path: path, + mode: '100644', + type: 'blob', + sha: blob + } + ] }; - // Update an existing tree adding a new blob object getting a tree SHA back - // ------- + _request('POST', repoPath + '/git/trees', data, function(err, res, xhr) { + if (err) { + return cb(err); + } - this.updateTree = function (baseTree, path, blob, cb) { - var data = { - base_tree: baseTree, - tree: [ - { - path: path, - mode: '100644', - type: 'blob', - sha: blob - } - ] - }; + cb(null, res.sha, xhr); + }); + }; - _request('POST', repoPath + '/git/trees', data, function (err, res, xhr) { - if (err) { - return cb(err); - } + // Post a new tree object having a file path pointer replaced + // with a new blob SHA getting a tree SHA back + // ------- - cb(null, res.sha, xhr); - }); - }; + this.postTree = function(tree, cb) { + _request('POST', repoPath + '/git/trees', { + tree: tree + }, function(err, res, xhr) { + if (err) { + return cb(err); + } - // Post a new tree object having a file path pointer replaced - // with a new blob SHA getting a tree SHA back - // ------- + cb(null, res.sha, xhr); + }); + }; - this.postTree = function (tree, cb) { - _request('POST', repoPath + '/git/trees', { - tree: tree - }, function (err, res, xhr) { - if (err) { - return cb(err); - } + // Create a new commit object with the current commit SHA as the parent + // and the new tree SHA, getting a commit SHA back + // ------- - cb(null, res.sha, xhr); - }); - }; + this.commit = function(parent, tree, message, cb) { + var user = new Github.User(); - // Create a new commit object with the current commit SHA as the parent - // and the new tree SHA, getting a commit SHA back - // ------- + user.show(null, function(err, userData) { + if (err) { + return cb(err); + } - this.commit = function (parent, tree, message, cb) { - var user = new Github.User(); + var data = { + message: message, + author: { + name: options.user, + email: userData.email + }, + parents: [ + parent + ], + tree: tree + }; - user.show(null, function (err, userData) { + _request('POST', repoPath + '/git/commits', data, function(err, res, xhr) { if (err) { return cb(err); } - var data = { - message: message, - author: { - name: options.user, - email: userData.email - }, - parents: [ - parent - ], - tree: tree - }; - - _request('POST', repoPath + '/git/commits', data, function (err, res, xhr) { - if (err) { - return cb(err); - } - - currentTree.sha = res.sha; // Update latest commit + currentTree.sha = res.sha; // Update latest commit - cb(null, res.sha, xhr); - }); + cb(null, res.sha, xhr); }); - }; + }); + }; - // Update the reference of your head to point to the new commit SHA - // ------- + // Update the reference of your head to point to the new commit SHA + // ------- - this.updateHead = function (head, commit, cb) { - _request('PATCH', repoPath + '/git/refs/heads/' + head, { - sha: commit - }, cb); - }; + this.updateHead = function(head, commit, cb) { + _request('PATCH', repoPath + '/git/refs/heads/' + head, { + sha: commit + }, cb); + }; - // Show repository information - // ------- + // Show repository information + // ------- - this.show = function (cb) { - _request('GET', repoPath, null, cb); - }; + this.show = function(cb) { + _request('GET', repoPath, null, cb); + }; - // Show repository contributors - // ------- + // Show repository contributors + // ------- - this.contributors = function (cb, retry) { - retry = retry || 1000; - var that = this; + this.contributors = function(cb, retry) { + retry = retry || 1000; + var that = this; - _request('GET', repoPath + '/stats/contributors', null, function (err, data, xhr) { - if (err) { - return cb(err); - } + _request('GET', repoPath + '/stats/contributors', null, function(err, data, xhr) { + if (err) { + return cb(err); + } - if (xhr.status === 202) { - setTimeout( - function () { - that.contributors(cb, retry); - }, - retry - ); - } else { - cb(err, data, xhr); - } - }); - }; + if (xhr.status === 202) { + setTimeout( + function() { + that.contributors(cb, retry); + }, + retry + ); + } else { + cb(err, data, xhr); + } + }); + }; - // Get contents - // -------- + // Get contents + // -------- - this.contents = function (ref, path, cb) { - path = encodeURI(path); - _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), { - ref: ref - }, cb); - }; + this.contents = function(ref, path, cb) { + path = encodeURI(path); + _request('GET', repoPath + '/contents' + (path ? '/' + path : ''), { + ref: ref + }, cb); + }; - // Fork repository - // ------- + // Fork repository + // ------- - this.fork = function (cb) { - _request('POST', repoPath + '/forks', null, cb); - }; + this.fork = function(cb) { + _request('POST', repoPath + '/forks', null, cb); + }; - // List forks - // -------- + // List forks + // -------- - this.listForks = function (cb) { - _request('GET', repoPath + '/forks', null, cb); - }; + this.listForks = function(cb) { + _request('GET', repoPath + '/forks', null, cb); + }; + + // Branch repository + // -------- - // Branch repository - // -------- + this.branch = function(oldBranch, newBranch, cb) { + if (arguments.length === 2 && typeof arguments[1] === 'function') { + cb = newBranch; + newBranch = oldBranch; + oldBranch = 'master'; + } - this.branch = function (oldBranch, newBranch, cb) { - if (arguments.length === 2 && typeof arguments[1] === 'function') { - cb = newBranch; - newBranch = oldBranch; - oldBranch = 'master'; + this.getRef('heads/' + oldBranch, function(err, ref) { + if (err && cb) { + return cb(err); } - this.getRef('heads/' + oldBranch, function (err, ref) { - if (err && cb) { - return cb(err); - } + that.createRef({ + ref: 'refs/heads/' + newBranch, + sha: ref + }, cb); + }); + }; - that.createRef({ - ref: 'refs/heads/' + newBranch, - sha: ref - }, cb); - }); - }; + // Create pull request + // -------- - // Create pull request - // -------- + this.createPullRequest = function(options, cb) { + _request('POST', repoPath + '/pulls', options, cb); + }; - this.createPullRequest = function (options, cb) { - _request('POST', repoPath + '/pulls', options, cb); - }; + // List hooks + // -------- - // List hooks - // -------- + this.listHooks = function(cb) { + _request('GET', repoPath + '/hooks', null, cb); + }; - this.listHooks = function (cb) { - _request('GET', repoPath + '/hooks', null, cb); - }; + // Get a hook + // -------- - // Get a hook - // -------- + this.getHook = function(id, cb) { + _request('GET', repoPath + '/hooks/' + id, null, cb); + }; - this.getHook = function (id, cb) { - _request('GET', repoPath + '/hooks/' + id, null, cb); - }; + // Create a hook + // -------- - // Create a hook - // -------- + this.createHook = function(options, cb) { + _request('POST', repoPath + '/hooks', options, cb); + }; - this.createHook = function (options, cb) { - _request('POST', repoPath + '/hooks', options, cb); - }; + // Edit a hook + // -------- - // Edit a hook - // -------- + this.editHook = function(id, options, cb) { + _request('PATCH', repoPath + '/hooks/' + id, options, cb); + }; - this.editHook = function (id, options, cb) { - _request('PATCH', repoPath + '/hooks/' + id, options, cb); - }; + // Delete a hook + // -------- - // Delete a hook - // -------- + this.deleteHook = function(id, cb) { + _request('DELETE', repoPath + '/hooks/' + id, null, cb); + }; - this.deleteHook = function (id, cb) { - _request('DELETE', repoPath + '/hooks/' + id, null, cb); - }; + // Read file at given path + // ------- - // Read file at given path - // ------- + this.read = function(branch, path, cb) { + _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''), + null, cb, true); + }; - this.read = function (branch, path, cb) { - _request('GET', repoPath + '/contents/' + encodeURI(path) + (branch ? '?ref=' + branch : ''), - null, cb, true); - }; + // Remove a file + // ------- - // Remove a file - // ------- + this.remove = function(branch, path, cb) { + that.getSha(branch, path, function(err, sha) { + if (err) { + return cb(err); + } - this.remove = function (branch, path, cb) { - that.getSha(branch, path, function (err, sha) { - if (err) { - return cb(err); - } + _request('DELETE', repoPath + '/contents/' + path, { + message: path + ' is removed', + sha: sha, + branch: branch + }, cb); + }); + }; - _request('DELETE', repoPath + '/contents/' + path, { - message: path + ' is removed', - sha: sha, - branch: branch - }, cb); - }); - }; + // Alias for repo.remove for backwards comapt. + // ------- + this.delete = this.remove; - // Alias for repo.remove for backwards comapt. - // ------- - this.delete = this.remove; - - // Move a file to a new location - // ------- - - this.move = function (branch, path, newPath, cb) { - updateTree(branch, function (err, latestCommit) { - that.getTree(latestCommit + '?recursive=true', function (err, tree) { - // Update Tree - tree.forEach(function (ref) { - if (ref.path === path) { - ref.path = newPath; - } - - if (ref.type === 'tree') { - delete ref.sha; - } - }); + // Move a file to a new location + // ------- + + this.move = function(branch, path, newPath, cb) { + updateTree(branch, function(err, latestCommit) { + that.getTree(latestCommit + '?recursive=true', function(err, tree) { + // Update Tree + tree.forEach(function(ref) { + if (ref.path === path) { + ref.path = newPath; + } + + if (ref.type === 'tree') { + delete ref.sha; + } + }); - that.postTree(tree, function (err, rootTree) { - that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) { - that.updateHead(branch, commit, cb); - }); + that.postTree(tree, function(err, rootTree) { + that.commit(latestCommit, rootTree, 'Deleted ' + path, function(err, commit) { + that.updateHead(branch, commit, cb); }); }); }); - }; - - // Write file contents to a given branch and path - // ------- - - this.write = function (branch, path, content, message, options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - that.getSha(branch, encodeURI(path), function (err, sha) { - var writeOptions = { - message: message, - content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content, - branch: branch, - committer: options && options.committer ? options.committer : undefined, - author: options && options.author ? options.author : undefined - }; + }); + }; - // If no error, we set the sha to overwrite an existing file - if (!(err && err.error !== 404)) { - writeOptions.sha = sha; - } + // Write file contents to a given branch and path + // ------- - _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb); - }); - }; - - // List commits on a repository. Takes an object of optional parameters: - // sha: SHA or branch to start listing commits from - // path: Only commits containing this file path will be returned - // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address - // since: ISO 8601 date - only commits after this date will be returned - // until: ISO 8601 date - only commits before this date will be returned - // ------- - - this.getCommits = function (options, cb) { - options = options || {}; - var url = repoPath + '/commits'; - var params = []; - - if (options.sha) { - params.push('sha=' + encodeURIComponent(options.sha)); - } + this.write = function(branch, path, content, message, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } - if (options.path) { - params.push('path=' + encodeURIComponent(options.path)); - } + that.getSha(branch, encodeURI(path), function(err, sha) { + var writeOptions = { + message: message, + content: typeof options.encode === 'undefined' || options.encode ? b64encode(content) : content, + branch: branch, + committer: options && options.committer ? options.committer : undefined, + author: options && options.author ? options.author : undefined + }; - if (options.author) { - params.push('author=' + encodeURIComponent(options.author)); + // If no error, we set the sha to overwrite an existing file + if (!(err && err.error !== 404)) { + writeOptions.sha = sha; } - if (options.since) { - var since = options.since; + _request('PUT', repoPath + '/contents/' + encodeURI(path), writeOptions, cb); + }); + }; - if (since.constructor === Date) { - since = since.toISOString(); - } + // List commits on a repository. Takes an object of optional parameters: + // sha: SHA or branch to start listing commits from + // path: Only commits containing this file path will be returned + // author: Only commits by this author will be returned. Its value can be the GitHub login or the email address + // since: ISO 8601 date - only commits after this date will be returned + // until: ISO 8601 date - only commits before this date will be returned + // ------- + + this.getCommits = function(options, cb) { + options = options || {}; + var url = repoPath + '/commits'; + var params = []; + + if (options.sha) { + params.push('sha=' + encodeURIComponent(options.sha)); + } - params.push('since=' + encodeURIComponent(since)); - } + if (options.path) { + params.push('path=' + encodeURIComponent(options.path)); + } - if (options.until) { - var until = options.until; + if (options.author) { + params.push('author=' + encodeURIComponent(options.author)); + } - if (until.constructor === Date) { - until = until.toISOString(); - } + if (options.since) { + var since = options.since; - params.push('until=' + encodeURIComponent(until)); + if (since.constructor === Date) { + since = since.toISOString(); } - if (options.page) { - params.push('page=' + options.page); - } + params.push('since=' + encodeURIComponent(since)); + } - if (options.perpage) { - params.push('per_page=' + options.perpage); - } + if (options.until) { + var until = options.until; - if (params.length > 0) { - url += '?' + params.join('&'); + if (until.constructor === Date) { + until = until.toISOString(); } - _request('GET', url, null, cb); - }; + params.push('until=' + encodeURIComponent(until)); + } - // Check if a repository is starred. - // -------- + if (options.page) { + params.push('page=' + options.page); + } - this.isStarred = function(owner, repository, cb) { - _request('GET', '/user/starred/' + owner + '/' + repository, null, cb); - }; + if (options.perpage) { + params.push('per_page=' + options.perpage); + } - // Star a repository. - // -------- + if (params.length > 0) { + url += '?' + params.join('&'); + } - this.star = function(owner, repository, cb) { - _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb); - }; + _request('GET', url, null, cb); + }; - // Unstar a repository. - // -------- + // Check if a repository is starred. + // -------- - this.unstar = function(owner, repository, cb) { - _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb); - }; + this.isStarred = function(owner, repository, cb) { + _request('GET', '/user/starred/' + owner + '/' + repository, null, cb); + }; - // Create a new release - // -------- + // Star a repository. + // -------- - this.createRelease = function(options, cb) { - _request('POST', repoPath + '/releases', options, cb); - }; + this.star = function(owner, repository, cb) { + _request('PUT', '/user/starred/' + owner + '/' + repository, null, cb); + }; - // Edit a release - // -------- + // Unstar a repository. + // -------- - this.editRelease = function(id, options, cb) { - _request('PATCH', repoPath + '/releases/' + id, options, cb); - }; + this.unstar = function(owner, repository, cb) { + _request('DELETE', '/user/starred/' + owner + '/' + repository, null, cb); + }; - // Get a single release - // -------- + // Create a new release + // -------- - this.getRelease = function(id, cb) { - _request('GET', repoPath + '/releases/' + id, null, cb); - }; + this.createRelease = function(options, cb) { + _request('POST', repoPath + '/releases', options, cb); + }; - // Remove a release - // -------- + // Edit a release + // -------- - this.deleteRelease = function(id, cb) { - _request('DELETE', repoPath + '/releases/' + id, null, cb); - }; + this.editRelease = function(id, options, cb) { + _request('PATCH', repoPath + '/releases/' + id, options, cb); }; - // Gists API - // ======= + // Get a single release + // -------- - Github.Gist = function (options) { - var id = options.id; - var gistPath = '/gists/' + id; + this.getRelease = function(id, cb) { + _request('GET', repoPath + '/releases/' + id, null, cb); + }; - // Read the gist - // -------- + // Remove a release + // -------- - this.read = function (cb) { - _request('GET', gistPath, null, cb); - }; + this.deleteRelease = function(id, cb) { + _request('DELETE', repoPath + '/releases/' + id, null, cb); + }; + }; - // Create the gist - // -------- - // { - // "description": "the description for this gist", - // "public": true, - // "files": { - // "file1.txt": { - // "content": "String file contents" - // } - // } - // } - - this.create = function (options, cb) { - _request('POST', '/gists', options, cb); - }; + // Gists API + // ======= - // Delete the gist - // -------- + Github.Gist = function(options) { + var id = options.id; + var gistPath = '/gists/' + id; - this.delete = function (cb) { - _request('DELETE', gistPath, null, cb); - }; + // Read the gist + // -------- - // Fork a gist - // -------- + this.read = function(cb) { + _request('GET', gistPath, null, cb); + }; - this.fork = function (cb) { - _request('POST', gistPath + '/fork', null, cb); - }; + // Create the gist + // -------- + // { + // "description": "the description for this gist", + // "public": true, + // "files": { + // "file1.txt": { + // "content": "String file contents" + // } + // } + // } + + this.create = function(options, cb) { + _request('POST', '/gists', options, cb); + }; - // Update a gist with the new stuff - // -------- + // Delete the gist + // -------- - this.update = function (options, cb) { - _request('PATCH', gistPath, options, cb); - }; + this.delete = function(cb) { + _request('DELETE', gistPath, null, cb); + }; - // Star a gist - // -------- + // Fork a gist + // -------- - this.star = function (cb) { - _request('PUT', gistPath + '/star', null, cb); - }; + this.fork = function(cb) { + _request('POST', gistPath + '/fork', null, cb); + }; - // Untar a gist - // -------- + // Update a gist with the new stuff + // -------- - this.unstar = function (cb) { - _request('DELETE', gistPath + '/star', null, cb); - }; + this.update = function(options, cb) { + _request('PATCH', gistPath, options, cb); + }; - // Check if a gist is starred - // -------- + // Star a gist + // -------- - this.isStarred = function (cb) { - _request('GET', gistPath + '/star', null, cb); - }; + this.star = function(cb) { + _request('PUT', gistPath + '/star', null, cb); }; - // Issues API - // ========== + // Untar a gist + // -------- - Github.Issue = function (options) { - var path = '/repos/' + options.user + '/' + options.repo + '/issues'; + this.unstar = function(cb) { + _request('DELETE', gistPath + '/star', null, cb); + }; - this.create = function(options, cb) { - _request('POST', path, options, cb); - }; + // Check if a gist is starred + // -------- - this.list = function (options, cb) { - var query = []; + this.isStarred = function(cb) { + _request('GET', gistPath + '/star', null, cb); + }; + }; - Object.keys(options).forEach(function(option) { - query.push(encodeURIComponent(option) + '=' + encodeURIComponent(options[option])); - }); + // Issues API + // ========== - _requestAllPages(path + '?' + query.join('&'), !!options.page, cb); - }; + Github.Issue = function(options) { + var path = '/repos/' + options.user + '/' + options.repo + '/issues'; - this.comment = function (issue, comment, cb) { - _request('POST', issue.comments_url, { - body: comment - }, cb); - }; + this.create = function(options, cb) { + _request('POST', path, options, cb); + }; - this.edit = function (issue, options, cb) { - _request('PATCH', path + '/' + issue, options, cb); - }; + this.list = function(options, cb) { + var query = []; - this.get = function (issue, cb) { - _request('GET', path + '/' + issue, null, cb); - }; + Object.keys(options).forEach(function(option) { + query.push(encodeURIComponent(option) + '=' + encodeURIComponent(options[option])); + }); + + _requestAllPages(path + '?' + query.join('&'), !!options.page, cb); }; - // Search API - // ========== + this.comment = function(issue, comment, cb) { + _request('POST', issue.comments_url, { + body: comment + }, cb); + }; - Github.Search = function (options) { - var path = '/search/'; - var query = '?q=' + options.query; + this.edit = function(issue, options, cb) { + _request('PATCH', path + '/' + issue, options, cb); + }; - this.repositories = function (options, cb) { - _request('GET', path + 'repositories' + query, options, cb); - }; + this.get = function(issue, cb) { + _request('GET', path + '/' + issue, null, cb); + }; + }; - this.code = function (options, cb) { - _request('GET', path + 'code' + query, options, cb); - }; + // Search API + // ========== - this.issues = function (options, cb) { - _request('GET', path + 'issues' + query, options, cb); - }; + Github.Search = function(options) { + var path = '/search/'; + var query = '?q=' + options.query; - this.users = function (options, cb) { - _request('GET', path + 'users' + query, options, cb); - }; + this.repositories = function(options, cb) { + _request('GET', path + 'repositories' + query, options, cb); }; - // Rate Limit API - // ========== + this.code = function(options, cb) { + _request('GET', path + 'code' + query, options, cb); + }; - Github.RateLimit = function() { - this.getRateLimit = function(cb) { - _request('GET', '/rate_limit', null, cb); - }; + this.issues = function(options, cb) { + _request('GET', path + 'issues' + query, options, cb); }; - return Github; + this.users = function(options, cb) { + _request('GET', path + 'users' + query, options, cb); + }; }; - // Top Level API - // ------- + // Rate Limit API + // ========== - Github.getIssues = function (user, repo) { - return new Github.Issue({ - user: user, - repo: repo - }); + Github.RateLimit = function() { + this.getRateLimit = function(cb) { + _request('GET', '/rate_limit', null, cb); + }; }; - Github.getRepo = function (user, repo) { - if (!repo) { - return new Github.Repository({ - fullname: user - }); - } else { - return new Github.Repository({ - user: user, - name: repo - }); - } - }; + return Github; +} - Github.getUser = function () { - return new Github.User(); - }; +// Top Level API +// ------- - Github.getGist = function (id) { - return new Github.Gist({ - id: id - }); - }; +Github.getIssues = function(user, repo) { + return new Github.Issue({ + user: user, + repo: repo + }); +}; - Github.getSearch = function (query) { - return new Github.Search({ - query: query +Github.getRepo = function(user, repo) { + if (!repo) { + return new Github.Repository({ + fullname: user }); - }; - - Github.getRateLimit = function() { - return new Github.RateLimit(); - }; + } else { + return new Github.Repository({ + user: user, + name: repo + }); + } +}; + +Github.getUser = function() { + return new Github.User(); +}; + +Github.getGist = function(id) { + return new Github.Gist({ + id: id + }); +}; + +Github.getSearch = function(query) { + return new Github.Search({ + query: query + }); +}; + +Github.getRateLimit = function() { + return new Github.RateLimit(); +}; module.exports = Github;