pcloud-sdk-js
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,3 +0,3 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pCloudSdk",[],e):"object"==typeof exports?exports.pCloudSdk=e():t.pCloudSdk=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";r(38),t.exports={createClient:r(21).default,oauth:r(39).default,ApiMethod:r(3).default,ApiRequest:r(3).default}},function(t,e,r){(function(e){"use strict";var r=function(t,r,n,o,i,a,u,s){if("production"!==e.env.NODE_ENV&&void 0===r)throw new Error("invariant requires an error message argument");if(!t){var l;if(void 0===r)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,i,a,u,s],h=0;l=new Error(r.replace(/%s/g,function(){return c[h++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}};t.exports=r}).call(e,r(11))},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(40);Object.keys(o).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var i=r(41);Object.defineProperty(e,"httpProgressMiddleware",{enumerable:!0,get:function(){return n(i).default}});var a=r(42);Object.keys(a).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})})},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.apiServer,n=void 0===r?p:r,i=e.apiProtocol,a=void 0===i?"https":i,s=e.params,h=void 0===s?{}:s,d=o(e,["apiServer","apiProtocol","params"]);(0,l.default)((0,c.isApiMethod)(t),"Method `"+t+"` is not pCloud API method."),(0,l.default)(!(0,c.isAuthMethod)(t)||"auth"in h||"access_token"in h||"username"in h,"`auth` must be present for methods that require authentication.");var y=u.default.format({protocol:a,host:n,pathname:t,query:h});return void 0===d.responseType&&(d.responseType="json"),(0,f.default)(y,d).then(function(t){return"json"===d.responseType&&0!==t.result?Promise.reject(t):t})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var a=r(5),u=n(a),s=r(1),l=n(s),c=r(2),h=r(6),f=n(h),p="api.pcloud.com"},function(t,e){"use strict";function r(t){return null!==t&&"object"===("undefined"==typeof t?"undefined":n(t))}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=r},function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,e,r){if(t&&c.isObject(t)&&t instanceof n)return t;var o=new n;return o.parse(t,e,r),o}function i(t){return c.isString(t)&&(t=o(t)),t instanceof n?t.format():n.prototype.format.call(t)}function a(t,e){return o(t,!1,!0).resolve(e)}function u(t,e){return t?o(t,!1,!0).resolveObject(e):e}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=r(18),c=r(19);e.parse=o,e.resolve=a,e.resolveObject=u,e.format=i,e.Url=n;var h=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],y=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(y),v=["%","/","?",";","#"].concat(m),b=["/","?","#"],_=255,g=/^[+a-z0-9A-Z_-]{0,63}$/,w=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,j={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},O={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=r(14);n.prototype.parse=function(t,e,r){if(!c.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+("undefined"==typeof t?"undefined":s(t)));var n=t.indexOf("?"),o=n!==-1&&n<t.indexOf("#")?"?":"#",i=t.split(o),a=/\\/g;i[0]=i[0].replace(a,"/"),t=i.join(o);var u=t;if(u=u.trim(),!r&&1===t.split("#").length){var f=p.exec(u);if(f)return this.path=u,this.href=u,this.pathname=f[1],f[2]?(this.search=f[2],e?this.query=k.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var d=h.exec(u);if(d){d=d[0];var y=d.toLowerCase();this.protocol=y,u=u.substr(d.length)}if(r||d||u.match(/^\/\/[^@\/]+@[^@\/]+/)){var P="//"===u.substr(0,2);!P||d&&x[d]||(u=u.substr(2),this.slashes=!0)}if(!x[d]&&(P||d&&!O[d])){for(var T=-1,q=0;q<b.length;q++){var S=u.indexOf(b[q]);S!==-1&&(T===-1||S<T)&&(T=S)}var M,A;A=T===-1?u.lastIndexOf("@"):u.lastIndexOf("@",T),A!==-1&&(M=u.slice(0,A),u=u.slice(A+1),this.auth=decodeURIComponent(M)),T=-1;for(var q=0;q<v.length;q++){var S=u.indexOf(v[q]);S!==-1&&(T===-1||S<T)&&(T=S)}T===-1&&(T=u.length),this.host=u.slice(0,T),u=u.slice(T),this.parseHost(),this.hostname=this.hostname||"";var E="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!E)for(var C=this.hostname.split(/\./),q=0,R=C.length;q<R;q++){var I=C[q];if(I&&!I.match(g)){for(var H="",U=0,L=I.length;U<L;U++)H+=I.charCodeAt(U)>127?"x":I[U];if(!H.match(g)){var z=C.slice(0,q),F=C.slice(q+1),N=I.match(w);N&&(z.push(N[1]),F.unshift(N[2])),F.length&&(u="/"+F.join(".")+u),this.hostname=z.join(".");break}}}this.hostname.length>_?this.hostname="":this.hostname=this.hostname.toLowerCase(),E||(this.hostname=l.toASCII(this.hostname));var D=this.port?":"+this.port:"",X=this.hostname||"";this.host=X+D,this.href+=this.host,E&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!j[y])for(var q=0,R=m.length;q<R;q++){var $=m[q];if(u.indexOf($)!==-1){var B=encodeURIComponent($);B===$&&(B=escape($)),u=u.split($).join(B)}}var G=u.indexOf("#");G!==-1&&(this.hash=u.substr(G),u=u.slice(0,G));var J=u.indexOf("?");if(J!==-1?(this.search=u.substr(J),this.query=u.substr(J+1),e&&(this.query=k.parse(this.query)),u=u.slice(0,J)):e&&(this.search="",this.query={}),u&&(this.pathname=u),O[y]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var D=this.pathname||"",Z=this.search||"";this.path=D+Z}return this.href=this.format(),this},n.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,i="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(i=k.stringify(this.query));var a=this.search||i&&"?"+i||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||O[e])&&o!==!1?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),e+o+r+a+n},n.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},n.prototype.resolveObject=function(t){if(c.isString(t)){var e=new n;e.parse(t,!1,!0),t=e}for(var r=new n,o=Object.keys(this),i=0;i<o.length;i++){var a=o[i];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),s=0;s<u.length;s++){var l=u[s];"protocol"!==l&&(r[l]=t[l])}return O[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!O[t.protocol]){for(var h=Object.keys(t),f=0;f<h.length;f++){var p=h[f];r[p]=t[p]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||x[t.protocol])r.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var y=r.pathname||"",m=r.search||"";r.path=y+m}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),b=t.host||t.pathname&&"/"===t.pathname.charAt(0),_=b||v||r.host&&t.pathname,g=_,w=r.pathname&&r.pathname.split("/")||[],d=t.pathname&&t.pathname.split("/")||[],j=r.protocol&&!O[r.protocol];if(j&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),_=_&&(""===d[0]||""===w[0])),b)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,w=d;else if(d.length)w||(w=[]),w.pop(),w=w.concat(d),r.search=t.search,r.query=t.query;else if(!c.isNullOrUndefined(t.search)){if(j){r.hostname=r.host=w.shift();var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return r.search=t.search,r.query=t.query,c.isNull(r.pathname)&&c.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var P=w.slice(-1)[0],T=(r.host||t.host||w.length>1)&&("."===P||".."===P)||""===P,q=0,S=w.length;S>=0;S--)P=w[S],"."===P?w.splice(S,1):".."===P?(w.splice(S,1),q++):q&&(w.splice(S,1),q--);if(!_&&!g)for(;q--;q)w.unshift("..");!_||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),T&&"/"!==w.join("/").substr(-1)&&w.push("");var M=""===w[0]||w[0]&&"/"===w[0].charAt(0);if(j){r.hostname=r.host=M?"":w.length?w.shift():"";var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return _=_||r.host&&w.length,_&&!M&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),c.isNull(r.pathname)&&c.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){function e(){t in c&&delete c[t]}function r(r){if(e(),t in h)for(;h[t].length;){var n=h[t].shift(),o=i(n,1),a=o[0];a(r)}}var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,l.default)(t.length,"`url` is required.");var o=n.method,a=void 0===o?"get":o,s=n.responseType,f=void 0===s?"json":s,p=n.onProgress,d=void 0===p?function(){}:p,y=n.xhr,m=void 0===y?function(){}:y,v=(n.pipe,n.files),b=void 0===v?[]:v;if("get"===a&&t in c)return void 0===h[t]&&(h[t]=[]),new Promise(function(e){h[t].push([function(t){e(t)},n])});c[t]=1;var _=u.default[a](t);return _.on("progress",d),b.length&&((0,l.default)(["put","post"].indexOf(a)!==-1,"When uploading, `method` must be either `post` or `put`."),b.forEach(function(t){var e=t.name,r=void 0===e?"file":e,n=t.file;(0,l.default)(n,"`file` is a required property of `files`."),_.attach(r,n)})),"responseType"in _&&"json"!==f&&_.responseType(f),m(_.xhr),_.then(function(t){if("json"===f){var e=t.body;return r(e),e}if("text"===f)return t.text}).catch(function(t){var r={result:t.status||500,error:"Network Error"};return e(),Promise.reject(r)})}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.default=o;var a=r(15),u=n(a),s=r(1),l=n(s),c=(r(2),{}),h={}},function(t,e){(function(e){t.exports=e}).call(e,{})},function(t,e,r){"use strict";function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}function o(t,e,r){var n=e[r];if(void 0!==n&&null!==n){if(u.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");u.call(t,r)&&a(n)?t[r]=i(Object(t[r]),e[r]):t[r]=n}}function i(t,e){if(t===e)return t;e=Object(e);for(var r in e)u.call(e,r)&&o(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)s.call(e,n[i])&&o(t,e,n[i]);return t}var a=r(10),u=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;t.exports=function(t){t=n(t);for(var e=1;e<arguments.length;e++)i(t,arguments[e]);return t}},function(t,e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var e="undefined"==typeof t?"undefined":r(t);return null!==t&&("object"===e||"function"===e)}},function(t,e){"use strict";function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(t){if(c===setTimeout)return setTimeout(t,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function i(t){if(h===clearTimeout)return clearTimeout(t);if((h===n||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function a(){y&&p&&(y=!1,p.length?d=p.concat(d):m=-1,d.length&&u())}function u(){if(!y){var t=o(a);y=!0;for(var e=d.length;e;){for(p=d,d=[];++m<e;)p&&p[m].run();m=-1,e=d.length}p=null,y=!1,i(t)}}function s(t,e){this.fun=t,this.array=e}function l(){}var c,h,f=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(t){c=r}try{h="function"==typeof clearTimeout?clearTimeout:n}catch(t){h=n}}();var p,d=[],y=!1,m=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];d.push(new s(t,e)),1!==d.length||y||o(u)},s.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=l,f.addListener=l,f.once=l,f.off=l,f.removeListener=l,f.removeAllListeners=l,f.emit=l,f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,o){e=e||"&",n=n||"=";var i={};if("string"!=typeof t||0===t.length)return i;var a=/\+/g;t=t.split(e);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var s=t.length;u>0&&s>u&&(s=u);for(var l=0;l<s;++l){var c,h,f,p,d=t[l].replace(a,"%20"),y=d.indexOf(n);y>=0?(c=d.substr(0,y),h=d.substr(y+1)):(c=d,h=""),f=decodeURIComponent(c),p=decodeURIComponent(h),r(i,f)?Array.isArray(i[f])?i[f].push(p):i[f]=[i[f],p]:i[f]=p}return i}},function(t,e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=function(t){switch("undefined"==typeof t?"undefined":r(t)){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,o,i){return e=e||"&",o=o||"=",null===t&&(t=void 0),"object"===("undefined"==typeof t?"undefined":r(t))?Object.keys(t).map(function(r){var i=encodeURIComponent(n(r))+o;return Array.isArray(t[r])?t[r].map(function(t){return i+encodeURIComponent(n(t))}).join(e):i+encodeURIComponent(n(t[r]))}).join(e):i?encodeURIComponent(n(i))+o+encodeURIComponent(n(t)):""}},function(t,e,r){"use strict";e.decode=e.parse=r(12),e.encode=e.stringify=r(13)},function(t,e,r){"use strict";function n(){}function o(t){if(!b(t))return t;var e=[];for(var r in t)i(e,r,t[r]);return e.join("&")}function i(t,e,r){if(null!=r)if(Array.isArray(r))r.forEach(function(r){i(t,e,r)});else if(b(r))for(var n in r)i(t,e+"["+n+"]",r[n]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(r));else null===r&&t.push(encodeURIComponent(e))}function a(t){for(var e,r,n={},o=t.split("&"),i=0,a=o.length;i<a;++i)e=o[i],r=e.indexOf("="),r==-1?n[decodeURIComponent(e)]="":n[decodeURIComponent(e.slice(0,r))]=decodeURIComponent(e.slice(r+1));return n}function u(t){var e,r,n,o,i=t.split(/\r?\n/),a={};i.pop();for(var u=0,s=i.length;u<s;++u)r=i[u],e=r.indexOf(":"),n=r.slice(0,e).toLowerCase(),o=w(r.slice(e+1)),a[n]=o;return a}function s(t){return/[\/+]json\b/.test(t)}function l(t){return t.split(/ *; */).shift()}function c(t){return t.split(/ *; */).reduce(function(t,e){var r=e.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(t[n]=o),t},{})}function h(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this._setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function f(t,e){var r=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new h(r)}catch(e){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=e,r.xhr?(t.rawResponse="undefined"==typeof r.xhr.responseType?r.xhr.responseText:r.xhr.response,t.statusCode=r.xhr.status?r.xhr.status:null):(t.rawResponse=null,t.statusCode=null),r.callback(t)}r.emit("response",e);var n;try{(e.status<200||e.status>=300)&&(n=new Error(e.statusText||"Unsuccessful HTTP response"),n.original=t,n.response=e,n.status=e.status)}catch(t){n=t}n?r.callback(n,e):r.callback(null,e)})}function p(t,e){var r=g("DELETE",t);return e&&r.end(e),r}var d,y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};"undefined"!=typeof window?d=window:"undefined"!=typeof self?d=self:(console.warn("Using browser-only version of superagent in non-browser environment"),d=void 0);var m=r(8),v=r(17),b=r(4),_=r(16),g=e=t.exports=function(t,r){return"function"==typeof r?new e.Request("GET",t).end(r):1==arguments.length?new e.Request("GET",t):new e.Request(t,r)};e.Request=f,g.getXHR=function(){if(!(!d.XMLHttpRequest||d.location&&"file:"==d.location.protocol&&d.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var w="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};g.serializeObject=o,g.parseString=a,g.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},g.serialize={"application/x-www-form-urlencoded":o,"application/json":JSON.stringify},g.parse={"application/x-www-form-urlencoded":a,"application/json":JSON.parse},h.prototype.get=function(t){return this.header[t.toLowerCase()]},h.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=l(e);var r=c(e);for(var n in r)this[n]=r[n]},h.prototype._parseBody=function(t){var e=g.parse[this.type];return!e&&s(this.type)&&(e=g.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},h.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},h.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,n="cannot "+e+" "+r+" ("+this.status+")",o=new Error(n);return o.status=this.status,o.method=e,o.url=r,o},g.Response=h,m(f.prototype),v(f.prototype),f.prototype.type=function(t){return this.set("Content-Type",g.types[t]||t),this},f.prototype.responseType=function(t){return this._responseType=t,this},f.prototype.accept=function(t){return this.set("Accept",g.types[t]||t),this},f.prototype.auth=function(t,e,r){switch(r||(r={type:"basic"}),r.type){case"basic":var n=btoa(t+":"+e);this.set("Authorization","Basic "+n);break;case"auto":this.username=t,this.password=e}return this},f.prototype.query=function(t){return"string"!=typeof t&&(t=o(t)),t&&this._query.push(t),this},f.prototype.attach=function(t,e,r){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,r||e.name),this},f.prototype._getFormData=function(){return this._formData||(this._formData=new d.FormData),this._formData},f.prototype.callback=function(t,e){var r=this._callback;this.clearTimeout(),t&&this.emit("error",t),r(t,e)},f.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},f.prototype.buffer=f.prototype.ca=f.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},f.prototype.pipe=f.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},f.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},f.prototype._isHost=function(t){return t&&"object"===("undefined"==typeof t?"undefined":y(t))&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},f.prototype.end=function(t){var e=this,r=this.xhr=g.getXHR(),o=this._timeout,i=this._formData||this._data;this._callback=t||n,r.onreadystatechange=function(){if(4==r.readyState){var t;try{t=r.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{r.onprogress=a.bind(null,"download"),r.upload&&(r.upload.onprogress=a.bind(null,"upload"))}catch(t){}if(o&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},o)),this._appendQueryString(),this._sort){var u=this.url.indexOf("?");if(~u){var l=this.url.substring(u+1).split("&");_(this._sort)?l.sort(this._sort):l.sort()}this.url=this.url.substring(0,u)+"?"+l.join("&")}if(this.username&&this.password?r.open(this.method,this.url,!0,this.username,this.password):r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof i&&!this._isHost(i)){var c=this._header["content-type"],h=this._serializer||g.serialize[c?c.split(";")[0]:""];!h&&s(c)&&(h=g.serialize["application/json"]),h&&(i=h(i))}for(var f in this.header)null!=this.header[f]&&r.setRequestHeader(f,this.header[f]);return this._responseType&&(r.responseType=this._responseType),this.emit("request",this),r.send("undefined"!=typeof i?i:null),this},g.get=function(t,e,r){var n=g("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},g.head=function(t,e,r){var n=g("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},g.options=function(t,e,r){var n=g("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},g.del=p,g.delete=p,g.patch=function(t,e,r){var n=g("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},g.post=function(t,e,r){var n=g("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},g.put=function(t,e,r){var n=g("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n}},function(t,e,r){"use strict";function n(t){var e=o(t)?Object.prototype.toString.call(t):"";return"[object Function]"===e}var o=r(4);t.exports=n},function(t,e,r){"use strict";function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}var i=r(4);t.exports=n,n.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},n.prototype.parse=function(t){return this._parser=t,this},n.prototype.serialize=function(t){return this._serializer=t,this},n.prototype.timeout=function(t){return this._timeout=t,this},n.prototype.then=function(t,e){if(!this._fullfilledPromise){var r=this;this._fullfilledPromise=new Promise(function(t,e){r.end(function(r,n){r?e(r):t(n)})})}return this._fullfilledPromise.then(t,e)},n.prototype.catch=function(t){return this.then(void 0,t)},n.prototype.use=function(t){return t(this),this},n.prototype.get=function(t){return this._header[t.toLowerCase()]},n.prototype.getHeader=n.prototype.get,n.prototype.set=function(t,e){if(i(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},n.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},n.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(i(t)){for(var r in t)this.field(r,t[r]);return this}if(Array.isArray(e)){for(var n in e)this.field(t,e[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},n.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},n.prototype.withCredentials=function(){return this._withCredentials=!0,this},n.prototype.redirects=function(t){return this._maxRedirects=t,this},n.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},n.prototype.send=function(t){var e=i(t),r=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&i(this._data))for(var n in t)this._data[n]=t[n];else"string"==typeof t?(r||this.type("form"),r=this._header["content-type"],"application/x-www-form-urlencoded"==r?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(r||this.type("json"),this)},n.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this}},function(t,e,r){var n;(function(t,o){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(a){function u(t){throw RangeError(H[t])}function s(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function l(t,e){var r=t.split("@"),n="";r.length>1&&(n=r[0]+"@",t=r[1]),t=t.replace(I,".");var o=t.split("."),i=s(o,e).join(".");return n+i}function c(t){for(var e,r,n=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function h(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=z(t>>>10&1023|55296),t=56320|1023&t),e+=z(t)}).join("")}function f(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:k}function p(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function d(t,e,r){var n=0;for(t=r?L(t/S):t>>1,t+=L(t/e);t>U*T>>1;n+=k)t=L(t/U);return L(n+(U+1)*t/(t+q))}function y(t){var e,r,n,o,i,a,s,l,c,p,y=[],m=t.length,v=0,b=A,_=M;for(r=t.lastIndexOf(E),r<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&u("not-basic"),y.push(t.charCodeAt(n));for(o=r>0?r+1:0;o<m;){for(i=v,a=1,s=k;o>=m&&u("invalid-input"),l=f(t.charCodeAt(o++)),(l>=k||l>L((O-v)/a))&&u("overflow"),v+=l*a,c=s<=_?P:s>=_+T?T:s-_,!(l<c);s+=k)p=k-c,a>L(O/p)&&u("overflow"),a*=p;e=y.length+1,_=d(v-i,e,0==i),L(v/e)>O-b&&u("overflow"),b+=L(v/e),v%=e,y.splice(v++,0,b)}return h(y)}function m(t){var e,r,n,o,i,a,s,l,h,f,y,m,v,b,_,g=[];for(t=c(t),m=t.length,e=A,r=0,i=M,a=0;a<m;++a)y=t[a],y<128&&g.push(z(y));for(n=o=g.length,o&&g.push(E);n<m;){for(s=O,a=0;a<m;++a)y=t[a],y>=e&&y<s&&(s=y);for(v=n+1,s-e>L((O-r)/v)&&u("overflow"),r+=(s-e)*v,e=s,a=0;a<m;++a)if(y=t[a],y<e&&++r>O&&u("overflow"),y==e){for(l=r,h=k;f=h<=i?P:h>=i+T?T:h-i,!(l<f);h+=k)_=l-f,b=k-f,g.push(z(p(f+_%b,0))),l=L(_/b);g.push(z(p(l,0))),i=d(r,v,n==o),r=0,++n}++r,++e}return g.join("")}function v(t){return l(t,function(t){return C.test(t)?y(t.slice(4).toLowerCase()):t})}function b(t){return l(t,function(t){return R.test(t)?"xn--"+m(t):t})}var _="object"==i(e)&&e&&!e.nodeType&&e,g="object"==i(t)&&t&&!t.nodeType&&t,w="object"==("undefined"==typeof o?"undefined":i(o))&&o;w.global!==w&&w.window!==w&&w.self!==w||(a=w);var j,x,O=2147483647,k=36,P=1,T=26,q=38,S=700,M=72,A=128,E="-",C=/^xn--/,R=/[^\x20-\x7E]/,I=/[\x2E\u3002\uFF0E\uFF61]/g,H={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input" | ||
},U=k-P,L=Math.floor,z=String.fromCharCode;if(j={version:"1.3.2",ucs2:{decode:c,encode:h},decode:y,encode:m,toASCII:b,toUnicode:v},"object"==i(r(7))&&r(7))n=function(){return j}.call(e,r,e,t),!(void 0!==n&&(t.exports=n));else if(_&&g)if(t.exports==_)g.exports=j;else for(x in j)j.hasOwnProperty(x)&&(_[x]=j[x]);else a.punycode=j}(void 0)}).call(e,r(20)(t),function(){return this}())},function(t,e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"===("undefined"==typeof t?"undefined":r(t))&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{default:t}}function i(t){function e(e){var r={apiServer:s,params:{}};return(0,d.isAuthMethod)(e)&&t&&(r.params["oauth"===i?"access_token":"auth"]=t),r}function r(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=(0,l.default)({},e(t),n);return(0,h.default)(t,o).catch(function(e){return 500===e.result&&s!==y?(s=y,r(t,n)):Promise.reject(e)})}function n(){return r("getapiserver",{}).then(function(t){return s=t.api[0]})}function o(e){t=e}var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"oauth",a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,u.default)(["oauth","pcloud"].indexOf(i)!==-1,"`type` must be either `oauth` or `pcloud`."),"oauth"===i&&((0,u.default)("string"==typeof t,"`token` is required."),(0,u.default)(t.length,"`token` is required."));var s=y,c={api:r,setupProxy:n},f=void 0;for(var m in p)if(p.hasOwnProperty(m)){var v=p[m];f=v({client:c,setToken:o,type:i},i),"function"==typeof f&&(c[m]=f)}return a&&n(),c}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var a=r(1),u=o(a),s=r(9),l=o(s),c=r(3),h=o(c),f=r(29),p=n(f),d=r(2),y="api.pcloud.com"},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(6),i=n(o);e.default=function(){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t){var r=e.onBegin,n=void 0===r?function(){}:r,o=e.onProgress,a=void 0===o?function(){}:o,u=e.onFinish,s=void 0===u?function(){}:u;return n(),(0,i.default)(t,{type:"arraybuffer",onProgress:a}).then(function(t){return s(t),t})}}}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.client;return function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=e.getfilelink,i=e.download;return o(t).then(i(r,n))}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1),a=n(i);e.default=function(t){var e=t.client;return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,a.default)(t,"`file` is required."),(0,a.default)("object"===("undefined"==typeof t?"undefined":o(t)),"`file` of type File must be supplied.");var i=n.onBegin,u=void 0===i?function(){}:i,s=n.onProgress,l=void 0===s?function(){}:s,c=n.onFinish,h=void 0===c?function(){}:c;return u(),e.api("uploadfile",{method:"post",params:{folderid:r,nopartial:1},files:[{file:t,name:t.name}],onProgress:function(t){return l(t)}}).then(function(t){var e=t.metadata,r=t.checksums,n={metadata:e[0],checksums:r[0]};return h(n),n})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,i.default)(t.length,"`name` for is required"),(0,i.default)("string"==typeof t,"`name` is required and be a string."),(0,i.default)("number"==typeof r,"`parentfolderid` is required."),e.api("createfolder",{params:{name:t,folderid:r}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t){return(0,i.default)("number"==typeof t,"`fileid` must be a number."),(0,i.default)(t,"`fileid` is required."),e.api("deletefile",{params:{fileid:t}}).then(function(){return!0})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t){return(0,i.default)("number"==typeof t,"`folderid must be a number.`"),(0,i.default)(t,"`folderid` is required and can't be `0`."),e.api("deletefolderrecursive",{params:{folderid:t}}).then(function(t){return!0})}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2);e.default=function(t){var e=t.client;return function(t){return e.api("getfilelink",{params:{fileid:t,forcedownload:1}}).then(function(t){return(0,n.pCloudUrl)(t)})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(25);Object.defineProperty(e,"createfolder",{enumerable:!0,get:function(){return n(o).default}});var i=r(26);Object.defineProperty(e,"deletefile",{enumerable:!0,get:function(){return n(i).default}});var a=r(22);Object.defineProperty(e,"download",{enumerable:!0,get:function(){return n(a).default}});var u=r(23);Object.defineProperty(e,"downloadfile",{enumerable:!0,get:function(){return n(u).default}});var s=r(27);Object.defineProperty(e,"deletefolder",{enumerable:!0,get:function(){return n(s).default}});var l=r(28);Object.defineProperty(e,"getfilelink",{enumerable:!0,get:function(){return n(l).default}});var c=r(30);Object.defineProperty(e,"listfolder",{enumerable:!0,get:function(){return n(c).default}});var h=r(31);Object.defineProperty(e,"login",{enumerable:!0,get:function(){return n(h).default}});var f=r(32);Object.defineProperty(e,"movefile",{enumerable:!0,get:function(){return n(f).default}});var p=r(33);Object.defineProperty(e,"movefolder",{enumerable:!0,get:function(){return n(p).default}});var d=r(34);Object.defineProperty(e,"register",{enumerable:!0,get:function(){return n(d).default}});var y=r(35);Object.defineProperty(e,"remoteupload",{enumerable:!0,get:function(){return n(y).default}});var m=r(36);Object.defineProperty(e,"renamefile",{enumerable:!0,get:function(){return n(m).default}});var v=r(37);Object.defineProperty(e,"renamefolder",{enumerable:!0,get:function(){return n(v).default}});var b=r(24);Object.defineProperty(e,"upload",{enumerable:!0,get:function(){return n(b).default}})},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return(0,i.default)("number"==typeof t,"`folderid must be a number.`"),e.api("listfolder",{params:{folderid:t}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o),a=r(2);e.default=function(t){var e=t.client,r=t.setToken;return function(t,n){return(0,i.default)("string"==typeof t&&(0,a.isEmail)(t),"`email` must be provided."),(0,i.default)(n,"`password` is required."),(0,i.default)(n.length,"`password` is required."),e.api("userinfo",{params:{username:t,password:n,getauth:1,logout:1}}).then(function(t){var e=t.auth;return r(e),e})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t,r){return(0,i.default)("number"==typeof t,"`fileid` must be number."),(0,i.default)(0!==t,"`fileid` cannot be 0."),(0,i.default)(r,"`tofolderid` is required."),e.api("renamefile",{params:{fileid:t,tofolderid:r}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t,r){return(0,i.default)("number"==typeof t,"`folderid` must be number."),(0,i.default)(0!==t,"`folderid` cannot be 0."),(0,i.default)(r,"`tofolderid` is required."),e.api("renamefolder",{params:{folderid:t,tofolderid:r}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o),a=r(2);e.default=function(t){var e=t.client;return function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,i.default)("string"==typeof t&&(0,a.isEmail)(t),"`email` must be provided."),(0,i.default)(r,"`password` is required."),(0,i.default)(r.length,"`password` is required.");var o={mail:t,password:r,getauth:1,logout:1,termsaccepted:"yes"};return n.invite&&(o.invite=n.invite),n.ref&&(o.ref=n.ref),o.os=4,o.device=navigator.userAgent,e.api("register",{params:o}).then(function(t){return t.userid})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return{all:{downloaded:t.reduce(function(t,e){return t+e.downloaded},0),size:t.reduce(function(t,e){return t+e.size},0)},files:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(1),a=n(i),u=r(2);e.default=function(t){var e=t.client;return function(t){function r(){i(),c=setTimeout(r,200)}function n(){c&&clearTimeout(c)}function i(){e.api("uploadprogress",{params:{progresshash:v}}).then(function(t){var e=t.files;return d(o(e))})}var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,a.default)(t,"`file` is required."),(0,a.default)("string"==typeof t,"`file` must be supplied");var c,h=l.onBegin,f=void 0===h?function(){}:h,p=l.onProgress,d=void 0===p?function(){}:p,y=l.onFinish,m=void 0===y?function(){}:y,v="pcloud-sdk-remote-"+(0,u.uniqueNumber)()+"-"+(0,u.randomNumber)();return f(),r(),e.api("downloadfile",{method:"post",params:{folderid:s,progresshash:v,nopartial:1,url:t}}).then(function(t){var e=t.metadata;return n(),m({metadata:e[0]}),{metadata:e[0]}})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t,r){return(0,i.default)("number"==typeof t,"`fileid` must be number."),(0,i.default)(0!==t,"`fileid` cannot be 0."),(0,i.default)(r,"`toname` is required."),(0,i.default)(r.length,"`toname` is required."),e.api("renamefile",{params:{fileid:t,toname:r}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t,r){return(0,i.default)("number"==typeof t,"`folderid` must be number."),(0,i.default)(0!==t,"`folderid` cannot be 0."),(0,i.default)(r,"`toname` is required."),(0,i.default)(r.length,"`toname` is required."),e.api("renamefolder",{params:{folderid:t,toname:r}}).then(function(t){return t.metadata})}}},function(t,e){(function(t){"use strict";t.ENV="web"}).call(e,function(){return this}())},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t.client_id,r=void 0!==e&&e,n=t.redirect_uri,o=void 0!==n&&n,i=t.receiveToken,a=void 0!==i&&i;(0,c.default)(r,"`client_id` is required."),(0,c.default)(o,"`redirect_uri` is required."),(0,c.default)(a,"`receiveToken` is required.");var u=s.default.format({protocol:p,hostname:d,pathname:y,query:{redirect_uri:o,client_id:r,response_type:"token"}});window.open(u,"oauth","width=680,height=535"),window.__setPcloudToken=function(t){a(t),delete window.__setPcloudToken}}function i(){var t=location.hash.match(/access_token=([^&]+)/)[1];window.opener.__setPcloudToken(t),window.close()}function a(t,e,r){return(0,f.default)("oauth2_token",{params:{client_id:e,client_secret:r,code:t}})}Object.defineProperty(e,"__esModule",{value:!0});var u=r(5),s=n(u),l=r(1),c=n(l),h=r(3),f=n(h),p="https",d="my.pcloud.com",y="/oauth2/authorize";e.default={initOauthToken:o,popup:i,getTokenFromCode:a}},function(t,e){"use strict";function r(t){var e=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(t)}function n(t){return t.split(".").pop()}function o(t,e){return void 0===e&&(e=1),t=parseInt(t,10),t>=1099511627776?(t/1099511627776).toFixed(e)+" Tb":t>=1073741824?(t/1073741824).toFixed(e)+" Gb":t>=1048576?(t/1048576).toFixed(e)+" Mb":t>=1024?(t/1024).toFixed(e)+" Kb":t.toFixed(e)+" B"}function i(){return++l}function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return Math.random()*(10<<t)}function u(t,e){return JSON.stringify({method:t,params:e})}function s(t){return"https://"+t.hosts[0]+t.path}Object.defineProperty(e,"__esModule",{value:!0}),e.isEmail=r,e.fileext=n,e.formatSize=o,e.uniqueNumber=i,e.randomNumber=a,e.methodStringify=u,e.pCloudUrl=s;var l=0},function(t,e){"use strict";function r(t){var e=0,r=0;t.on("response",function(n){0===r&&(r=n.headers["content-length"]),n.on("data",function(n){e+=n.length,t.emit("progress",{loaded:e,total:r})})})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e){"use strict";function r(t){return t in i}function n(t){return r(t)&&i[t].auth}function o(t){return n(t)&&"oauth"in i[t]}Object.defineProperty(e,"__esModule",{value:!0}),e.isApiMethod=r,e.isAuthMethod=n,e.isOAuthMethod=o;var i=e.pCloudApiMethods={oauth2_token:{auth:!1,type:"write"},register:{auth:!1,type:"write"},listfolder:{auth:!0,type:"read"},createfolder:{auth:!0,type:"write"},userinfo:{auth:!0,type:"read"},currentserver:{auth:!1,type:"read"},uploadfile:{auth:!0,type:"write"},getfilelink:{auth:!0,type:"read"},getapiserver:{auth:!1,type:"read"},renamefolder:{auth:!0,type:"write"},deletefile:{auth:!0,type:"write"},deletefolderrecursive:{auth:!0,type:"write"},logout:{auth:!0,type:"write"},createfolderifnotexists:{auth:!0,type:"write"},getthumblink:{auth:!0,type:"read"},getvideolink:{auth:!0,type:"read"},getaudiolink:{auth:!0,type:"read"},deletefolder:{auth:!0,type:"write"},diff:{auth:!0,type:"write"},subscribe:{auth:!0,type:"write"},listnotifications:{auth:!0,type:"write"},readnotifications:{auth:!0,type:"write"},listshares:{auth:!0,type:"read"},acceptshare:{auth:!0,type:"write"},declineshare:{auth:!0,type:"write"},removeshare:{auth:!0,type:"write"},cancelsharerequest:{auth:!0,type:"write"},changeshare:{auth:!0,type:"write"},sharefolder:{auth:!0,type:"write"},copyfile:{auth:!0,type:"write"},copyfolder:{auth:!0,type:"write"},listpublinks:{auth:!0,type:"read"},getfilepublink:{auth:!0,type:"write"},getfolderpublink:{auth:!0,type:"write"},gettreepublink:{auth:!0,type:"write"},deletepublink:{auth:!0,type:"write"},changepublink:{auth:!0,type:"write"},copypubfile:{auth:!0,type:"write"},renamefile:{auth:!0,type:"write"},showpublink:{auth:!1,type:"read"},getzip:{auth:!0,type:"write"},getziplink:{auth:!0,type:"write"},createuploadlink:{auth:!0,type:"write"},listuploadlinks:{auth:!0,type:"read"},deleteuploadlink:{auth:!0,type:"write"},changeuploadlink:{auth:!0,type:"write"},uploadlinkprogress:{auth:!0,type:"read"},downloadfile:{auth:!0,type:"write"},lostpassword:{auth:!1,type:"write"},resetpassword:{auth:!1,type:"write"},changepassword:{auth:!0,type:"write"},verifyemail:{auth:!1,type:"write"},sharerequestinfo:{auth:!1,type:"read"},sendverificationemail:{auth:!0,type:"write"},getthumbslinks:{auth:!0,type:"read"},getthumbs:{auth:!0,type:"read"},uploadprogress:{auth:!0,type:"write"},invite:{auth:!0,type:"write"},fb_assign:{auth:!0,type:"write"},userbonuses:{auth:!0,type:"write"},givebonus:{auth:!0,type:"write"},userinvites:{auth:!0,type:"write"},getvideolinks:{auth:!0,type:"read"},backup_modify:{auth:!0,type:"write"},backup_list:{auth:!0,type:"read"},social_assign:{auth:!0,type:"write"},extractarchive:{auth:!0,type:"write"},extractarchiveprogress:{auth:!0,type:"write"},listrevisions:{auth:!0,type:"read"},revertrevision:{auth:!0,type:"write"},supportedlanguages:{auth:!0,type:"read"},newsletter_check:{auth:!0,type:"read"},blockchain_address:{auth:!0,type:"read"},trash_list:{auth:!0,type:"read"},trash_clear:{auth:!0,type:"write"},trash_restore:{auth:!0,type:"write"},trash_getrestorepath:{auth:!0,type:"write"},collection_list:{auth:!0,type:"read"},collection_details:{auth:!0,type:"read"},collection_create:{auth:!0,type:"write"},collection_rename:{auth:!0,type:"write"},collection_delete:{auth:!0,type:"write"},collection_linkfiles:{auth:!0,type:"write"},collection_unlinkfiles:{auth:!0,type:"write"},collection_move:{auth:!0,type:"write"},app_userlist:{auth:!0,type:"read"},app_userdelete:{auth:!0,type:"write"},gettextfile:{auth:!0,type:"write"},getpubtextfile:{auth:!1,type:"write"},account_teams:{auth:!0,type:"read"},account_teamcreate:{auth:!0,type:"read"},account_info:{auth:!0,type:"read"},account_modify:{auth:!0,type:"write"},account_users:{auth:!0,type:"read"},account_invitemail:{auth:!0,type:"read"},account_usermodify:{auth:!0,type:"write"},account_teammodify:{auth:!0,type:"write"},account_teamlink:{auth:!0,type:"write"},account_billinginfo:{auth:!0,type:"read"},account_invoice_modify:{auth:!0,type:"write"},account_upload_avatar:{auth:!0,type:"write"},account_teamunlink:{auth:!0,type:"write"},account_teamlink_head:{auth:!0,type:"write"},account_teamlink_accept:{auth:!0,type:"write"},account_invitelist:{auth:!0,type:"read"},account_invalidate_password:{auth:!0,type:"write"},account_invitecancel:{auth:!0,type:"write"},commentlist:{auth:!0,type:"read"},commentpost:{auth:!0,type:"write"},commentdelete:{auth:!0,type:"write"},eventsubscribe:{auth:!0,type:"write"},account_teamshare:{auth:!0,type:"write"},account_modifyshare:{auth:!0,type:"write"},account_stopshare:{auth:!0,type:"write"},account_listshares:{auth:!0,type:"read"},account_log:{auth:!0,type:"read"},account_paystripe:{auth:!0,type:"read"},listtokens:{auth:!0,type:"read"},deletetoken:{auth:!0,type:"write"},savezip:{auth:!0,type:"write"},savezipprogress:{auth:!0,type:"write"},contactload:{auth:!0,type:"write"},sendpublink:{auth:!0,type:"write"},contactlist:{auth:!0,type:"read"},account_viewtoken:{auth:!0,type:"write"},eventslast:{auth:!0,type:"write"},search:{auth:!0,type:"read"},issueproforma:{auth:!0,type:"write"},listproforma:{auth:!0,type:"write"},getbreadcrumb:{auth:!0,type:"read"},getpreviewlink:{auth:!0,type:"read"},getpublinkpreviewdownload:{type:"read",auth:!1},setlanguage:{auth:!0,type:"write"},account_branding:{auth:!0,type:"read"},account_branding_set:{auth:!0,type:"write"},account_branding_logo_upload:{auth:!0,type:"write"},account_logintoken:{auth:!0,type:"write"},getpublinkstats:{auth:!0,type:"read"},getpublinkadpreference:{auth:!0,type:"read"},setpublinkadpreference:{auth:!0,type:"write"},account_ispublinktrafficlimited:{auth:!0,type:"read"},getreferrallink:{auth:!0,type:"read"},sendreferrallink:{auth:!0,type:"write"},listpaymentsubscriptions:{auth:!0,type:"read"},getip:{auth:!1,type:"read"},crypto_getuserkeys:{auth:!0,type:"read"},crypto_getfolderkey:{auth:!0,type:"read"},crypto_getfilekey:{auth:!0,type:"read"},crypto_reset:{auth:!0,type:"write"},crypto_setuserkeys:{auth:!0,type:"write"},crypto_getuserhint:{auth:!0,type:"write"},upload_create:{auth:!0,type:"write"},upload_write:{auth:!0,type:"write"},upload_save:{auth:!0,type:"write"},crypto_getroot:{auth:!0,type:"read"},crypto_getfolderskey:{auth:!0,type:"read"}}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pCloudSdk",[],e):"object"==typeof exports?exports.pCloudSdk=e():t.pCloudSdk=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";r(38),t.exports={createClient:r(21).default,oauth:r(39).default,ApiMethod:r(3).default,ApiRequest:r(3).default}},function(t,e,r){(function(e){"use strict";var r=function(t,r,n,o,i,a,u,s){if("production"!==e.env.NODE_ENV&&void 0===r)throw new Error("invariant requires an error message argument");if(!t){var l;if(void 0===r)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,i,a,u,s],h=0;l=new Error(r.replace(/%s/g,function(){return c[h++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}};t.exports=r}).call(e,r(11))},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(41);Object.keys(o).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var i=r(40);Object.defineProperty(e,"httpProgressMiddleware",{enumerable:!0,get:function(){return n(i).default}});var a=r(42);Object.keys(a).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})})},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.apiServer,n=void 0===r?p:r,i=e.apiProtocol,a=void 0===i?"https":i,s=e.params,h=void 0===s?{}:s,d=o(e,["apiServer","apiProtocol","params"]);(0,l.default)((0,c.isApiMethod)(t),"Method `"+t+"` is not pCloud API method."),(0,l.default)(!(0,c.isAuthMethod)(t)||"auth"in h||"access_token"in h||"username"in h,"`auth` must be present for methods that require authentication.");var y=u.default.format({protocol:a,host:n,pathname:t,query:h});return void 0===d.responseType&&(d.responseType="json"),(0,f.default)(y,d).then(function(t){return"json"===d.responseType&&0!==t.result?Promise.reject(t):t})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var a=r(5),u=n(a),s=r(1),l=n(s),c=r(2),h=r(6),f=n(h),p="api.pcloud.com"},function(t,e){"use strict";function r(t){return null!==t&&"object"===("undefined"==typeof t?"undefined":n(t))}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=r},function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,e,r){if(t&&c.isObject(t)&&t instanceof n)return t;var o=new n;return o.parse(t,e,r),o}function i(t){return c.isString(t)&&(t=o(t)),t instanceof n?t.format():n.prototype.format.call(t)}function a(t,e){return o(t,!1,!0).resolve(e)}function u(t,e){return t?o(t,!1,!0).resolveObject(e):e}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=r(18),c=r(19);e.parse=o,e.resolve=a,e.resolveObject=u,e.format=i,e.Url=n;var h=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],y=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(y),v=["%","/","?",";","#"].concat(m),b=["/","?","#"],_=255,w=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,j={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},O={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=r(14);n.prototype.parse=function(t,e,r){if(!c.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+("undefined"==typeof t?"undefined":s(t)));var n=t.indexOf("?"),o=n!==-1&&n<t.indexOf("#")?"?":"#",i=t.split(o),a=/\\/g;i[0]=i[0].replace(a,"/"),t=i.join(o);var u=t;if(u=u.trim(),!r&&1===t.split("#").length){var f=p.exec(u);if(f)return this.path=u,this.href=u,this.pathname=f[1],f[2]?(this.search=f[2],e?this.query=k.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var d=h.exec(u);if(d){d=d[0];var y=d.toLowerCase();this.protocol=y,u=u.substr(d.length)}if(r||d||u.match(/^\/\/[^@\/]+@[^@\/]+/)){var P="//"===u.substr(0,2);!P||d&&x[d]||(u=u.substr(2),this.slashes=!0)}if(!x[d]&&(P||d&&!O[d])){for(var T=-1,q=0;q<b.length;q++){var S=u.indexOf(b[q]);S!==-1&&(T===-1||S<T)&&(T=S)}var M,A;A=T===-1?u.lastIndexOf("@"):u.lastIndexOf("@",T),A!==-1&&(M=u.slice(0,A),u=u.slice(A+1),this.auth=decodeURIComponent(M)),T=-1;for(var q=0;q<v.length;q++){var S=u.indexOf(v[q]);S!==-1&&(T===-1||S<T)&&(T=S)}T===-1&&(T=u.length),this.host=u.slice(0,T),u=u.slice(T),this.parseHost(),this.hostname=this.hostname||"";var E="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!E)for(var C=this.hostname.split(/\./),q=0,R=C.length;q<R;q++){var I=C[q];if(I&&!I.match(w)){for(var H="",U=0,L=I.length;U<L;U++)H+=I.charCodeAt(U)>127?"x":I[U];if(!H.match(w)){var z=C.slice(0,q),F=C.slice(q+1),N=I.match(g);N&&(z.push(N[1]),F.unshift(N[2])),F.length&&(u="/"+F.join(".")+u),this.hostname=z.join(".");break}}}this.hostname.length>_?this.hostname="":this.hostname=this.hostname.toLowerCase(),E||(this.hostname=l.toASCII(this.hostname));var D=this.port?":"+this.port:"",X=this.hostname||"";this.host=X+D,this.href+=this.host,E&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!j[y])for(var q=0,R=m.length;q<R;q++){var $=m[q];if(u.indexOf($)!==-1){var B=encodeURIComponent($);B===$&&(B=escape($)),u=u.split($).join(B)}}var G=u.indexOf("#");G!==-1&&(this.hash=u.substr(G),u=u.slice(0,G));var J=u.indexOf("?");if(J!==-1?(this.search=u.substr(J),this.query=u.substr(J+1),e&&(this.query=k.parse(this.query)),u=u.slice(0,J)):e&&(this.search="",this.query={}),u&&(this.pathname=u),O[y]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var D=this.pathname||"",Z=this.search||"";this.path=D+Z}return this.href=this.format(),this},n.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,i="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(i=k.stringify(this.query));var a=this.search||i&&"?"+i||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||O[e])&&o!==!1?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),e+o+r+a+n},n.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},n.prototype.resolveObject=function(t){if(c.isString(t)){var e=new n;e.parse(t,!1,!0),t=e}for(var r=new n,o=Object.keys(this),i=0;i<o.length;i++){var a=o[i];r[a]=this[a]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),s=0;s<u.length;s++){var l=u[s];"protocol"!==l&&(r[l]=t[l])}return O[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!O[t.protocol]){for(var h=Object.keys(t),f=0;f<h.length;f++){var p=h[f];r[p]=t[p]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||x[t.protocol])r.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var y=r.pathname||"",m=r.search||"";r.path=y+m}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),b=t.host||t.pathname&&"/"===t.pathname.charAt(0),_=b||v||r.host&&t.pathname,w=_,g=r.pathname&&r.pathname.split("/")||[],d=t.pathname&&t.pathname.split("/")||[],j=r.protocol&&!O[r.protocol];if(j&&(r.hostname="",r.port=null,r.host&&(""===g[0]?g[0]=r.host:g.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),_=_&&(""===d[0]||""===g[0])),b)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,g=d;else if(d.length)g||(g=[]),g.pop(),g=g.concat(d),r.search=t.search,r.query=t.query;else if(!c.isNullOrUndefined(t.search)){if(j){r.hostname=r.host=g.shift();var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return r.search=t.search,r.query=t.query,c.isNull(r.pathname)&&c.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!g.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var P=g.slice(-1)[0],T=(r.host||t.host||g.length>1)&&("."===P||".."===P)||""===P,q=0,S=g.length;S>=0;S--)P=g[S],"."===P?g.splice(S,1):".."===P?(g.splice(S,1),q++):q&&(g.splice(S,1),q--);if(!_&&!w)for(;q--;q)g.unshift("..");!_||""===g[0]||g[0]&&"/"===g[0].charAt(0)||g.unshift(""),T&&"/"!==g.join("/").substr(-1)&&g.push("");var M=""===g[0]||g[0]&&"/"===g[0].charAt(0);if(j){r.hostname=r.host=M?"":g.length?g.shift():"";var k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");k&&(r.auth=k.shift(),r.host=r.hostname=k.shift())}return _=_||r.host&&g.length,_&&!M&&g.unshift(""),g.length?r.pathname=g.join("/"):(r.pathname=null,r.path=null),c.isNull(r.pathname)&&c.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){function e(){t in c&&delete c[t]}function r(r){if(e(),t in h)for(;h[t].length;){var n=h[t].shift(),o=i(n,1),a=o[0];a(r)}}var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,l.default)(t.length,"`url` is required.");var o=n.method,a=void 0===o?"get":o,s=n.responseType,f=void 0===s?"json":s,p=n.onProgress,d=void 0===p?function(){}:p,y=n.xhr,m=void 0===y?function(){}:y,v=(n.pipe,n.files),b=void 0===v?[]:v;if("get"===a&&t in c)return void 0===h[t]&&(h[t]=[]),new Promise(function(e){h[t].push([function(t){e(t)},n])});c[t]=1;var _=u.default[a](t);return _.on("progress",d),b.length&&((0,l.default)(["put","post"].indexOf(a)!==-1,"When uploading, `method` must be either `post` or `put`."),b.forEach(function(t){var e=t.name,r=void 0===e?"file":e,n=t.file;(0,l.default)(n,"`file` is a required property of `files`."),_.attach(r,n)})),"responseType"in _&&"json"!==f&&_.responseType(f),m(_.xhr),_.then(function(t){if("json"===f){var e=t.body;return r(e),e}if("text"===f)return t.text}).catch(function(t){var r={result:t.status||500,error:"Network Error"};return e(),Promise.reject(r)})}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.default=o;var a=r(15),u=n(a),s=r(1),l=n(s),c=(r(2),{}),h={}},function(t,e){(function(e){t.exports=e}).call(e,{})},function(t,e,r){"use strict";function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}function o(t,e,r){var n=e[r];if(void 0!==n&&null!==n){if(u.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");u.call(t,r)&&a(n)?t[r]=i(Object(t[r]),e[r]):t[r]=n}}function i(t,e){if(t===e)return t;e=Object(e);for(var r in e)u.call(e,r)&&o(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)s.call(e,n[i])&&o(t,e,n[i]);return t}var a=r(10),u=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;t.exports=function(t){t=n(t);for(var e=1;e<arguments.length;e++)i(t,arguments[e]);return t}},function(t,e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var e="undefined"==typeof t?"undefined":r(t);return null!==t&&("object"===e||"function"===e)}},function(t,e){"use strict";function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(t){if(c===setTimeout)return setTimeout(t,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function i(t){if(h===clearTimeout)return clearTimeout(t);if((h===n||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function a(){y&&p&&(y=!1,p.length?d=p.concat(d):m=-1,d.length&&u())}function u(){if(!y){var t=o(a);y=!0;for(var e=d.length;e;){for(p=d,d=[];++m<e;)p&&p[m].run();m=-1,e=d.length}p=null,y=!1,i(t)}}function s(t,e){this.fun=t,this.array=e}function l(){}var c,h,f=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(t){c=r}try{h="function"==typeof clearTimeout?clearTimeout:n}catch(t){h=n}}();var p,d=[],y=!1,m=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];d.push(new s(t,e)),1!==d.length||y||o(u)},s.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=l,f.addListener=l,f.once=l,f.off=l,f.removeListener=l,f.removeAllListeners=l,f.emit=l,f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,o){e=e||"&",n=n||"=";var i={};if("string"!=typeof t||0===t.length)return i;var a=/\+/g;t=t.split(e);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var s=t.length;u>0&&s>u&&(s=u);for(var l=0;l<s;++l){var c,h,f,p,d=t[l].replace(a,"%20"),y=d.indexOf(n);y>=0?(c=d.substr(0,y),h=d.substr(y+1)):(c=d,h=""),f=decodeURIComponent(c),p=decodeURIComponent(h),r(i,f)?Array.isArray(i[f])?i[f].push(p):i[f]=[i[f],p]:i[f]=p}return i}},function(t,e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=function(t){switch("undefined"==typeof t?"undefined":r(t)){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,o,i){return e=e||"&",o=o||"=",null===t&&(t=void 0),"object"===("undefined"==typeof t?"undefined":r(t))?Object.keys(t).map(function(r){var i=encodeURIComponent(n(r))+o;return Array.isArray(t[r])?t[r].map(function(t){return i+encodeURIComponent(n(t))}).join(e):i+encodeURIComponent(n(t[r]))}).join(e):i?encodeURIComponent(n(i))+o+encodeURIComponent(n(t)):""}},function(t,e,r){"use strict";e.decode=e.parse=r(12),e.encode=e.stringify=r(13)},function(t,e,r){"use strict";function n(){}function o(t){if(!b(t))return t;var e=[];for(var r in t)i(e,r,t[r]);return e.join("&")}function i(t,e,r){if(null!=r)if(Array.isArray(r))r.forEach(function(r){i(t,e,r)});else if(b(r))for(var n in r)i(t,e+"["+n+"]",r[n]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(r));else null===r&&t.push(encodeURIComponent(e))}function a(t){for(var e,r,n={},o=t.split("&"),i=0,a=o.length;i<a;++i)e=o[i],r=e.indexOf("="),r==-1?n[decodeURIComponent(e)]="":n[decodeURIComponent(e.slice(0,r))]=decodeURIComponent(e.slice(r+1));return n}function u(t){var e,r,n,o,i=t.split(/\r?\n/),a={};i.pop();for(var u=0,s=i.length;u<s;++u)r=i[u],e=r.indexOf(":"),n=r.slice(0,e).toLowerCase(),o=g(r.slice(e+1)),a[n]=o;return a}function s(t){return/[\/+]json\b/.test(t)}function l(t){return t.split(/ *; */).shift()}function c(t){return t.split(/ *; */).reduce(function(t,e){var r=e.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(t[n]=o),t},{})}function h(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this._setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function f(t,e){var r=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new h(r)}catch(e){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=e,r.xhr?(t.rawResponse="undefined"==typeof r.xhr.responseType?r.xhr.responseText:r.xhr.response,t.statusCode=r.xhr.status?r.xhr.status:null):(t.rawResponse=null,t.statusCode=null),r.callback(t)}r.emit("response",e);var n;try{(e.status<200||e.status>=300)&&(n=new Error(e.statusText||"Unsuccessful HTTP response"),n.original=t,n.response=e,n.status=e.status)}catch(t){n=t}n?r.callback(n,e):r.callback(null,e)})}function p(t,e){var r=w("DELETE",t);return e&&r.end(e),r}var d,y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};"undefined"!=typeof window?d=window:"undefined"!=typeof self?d=self:(console.warn("Using browser-only version of superagent in non-browser environment"),d=void 0);var m=r(8),v=r(17),b=r(4),_=r(16),w=e=t.exports=function(t,r){return"function"==typeof r?new e.Request("GET",t).end(r):1==arguments.length?new e.Request("GET",t):new e.Request(t,r)};e.Request=f,w.getXHR=function(){if(!(!d.XMLHttpRequest||d.location&&"file:"==d.location.protocol&&d.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};w.serializeObject=o,w.parseString=a,w.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},w.serialize={"application/x-www-form-urlencoded":o,"application/json":JSON.stringify},w.parse={"application/x-www-form-urlencoded":a,"application/json":JSON.parse},h.prototype.get=function(t){return this.header[t.toLowerCase()]},h.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=l(e);var r=c(e);for(var n in r)this[n]=r[n]},h.prototype._parseBody=function(t){var e=w.parse[this.type];return!e&&s(this.type)&&(e=w.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},h.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},h.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,n="cannot "+e+" "+r+" ("+this.status+")",o=new Error(n);return o.status=this.status,o.method=e,o.url=r,o},w.Response=h,m(f.prototype),v(f.prototype),f.prototype.type=function(t){return this.set("Content-Type",w.types[t]||t),this},f.prototype.responseType=function(t){return this._responseType=t,this},f.prototype.accept=function(t){return this.set("Accept",w.types[t]||t),this},f.prototype.auth=function(t,e,r){switch(r||(r={type:"basic"}),r.type){case"basic":var n=btoa(t+":"+e);this.set("Authorization","Basic "+n);break;case"auto":this.username=t,this.password=e}return this},f.prototype.query=function(t){return"string"!=typeof t&&(t=o(t)),t&&this._query.push(t),this},f.prototype.attach=function(t,e,r){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,r||e.name),this},f.prototype._getFormData=function(){return this._formData||(this._formData=new d.FormData),this._formData},f.prototype.callback=function(t,e){var r=this._callback;this.clearTimeout(),t&&this.emit("error",t),r(t,e)},f.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},f.prototype.buffer=f.prototype.ca=f.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},f.prototype.pipe=f.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},f.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},f.prototype._isHost=function(t){return t&&"object"===("undefined"==typeof t?"undefined":y(t))&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},f.prototype.end=function(t){var e=this,r=this.xhr=w.getXHR(),o=this._timeout,i=this._formData||this._data;this._callback=t||n,r.onreadystatechange=function(){if(4==r.readyState){var t;try{t=r.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{r.onprogress=a.bind(null,"download"),r.upload&&(r.upload.onprogress=a.bind(null,"upload"))}catch(t){}if(o&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},o)),this._appendQueryString(),this._sort){var u=this.url.indexOf("?");if(~u){var l=this.url.substring(u+1).split("&");_(this._sort)?l.sort(this._sort):l.sort()}this.url=this.url.substring(0,u)+"?"+l.join("&")}if(this.username&&this.password?r.open(this.method,this.url,!0,this.username,this.password):r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof i&&!this._isHost(i)){var c=this._header["content-type"],h=this._serializer||w.serialize[c?c.split(";")[0]:""];!h&&s(c)&&(h=w.serialize["application/json"]),h&&(i=h(i))}for(var f in this.header)null!=this.header[f]&&r.setRequestHeader(f,this.header[f]);return this._responseType&&(r.responseType=this._responseType),this.emit("request",this),r.send("undefined"!=typeof i?i:null),this},w.get=function(t,e,r){var n=w("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},w.head=function(t,e,r){var n=w("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},w.options=function(t,e,r){var n=w("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},w.del=p,w.delete=p,w.patch=function(t,e,r){var n=w("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},w.post=function(t,e,r){var n=w("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},w.put=function(t,e,r){var n=w("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n}},function(t,e,r){"use strict";function n(t){var e=o(t)?Object.prototype.toString.call(t):"";return"[object Function]"===e}var o=r(4);t.exports=n},function(t,e,r){"use strict";function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}var i=r(4);t.exports=n,n.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},n.prototype.parse=function(t){return this._parser=t,this},n.prototype.serialize=function(t){return this._serializer=t,this},n.prototype.timeout=function(t){return this._timeout=t,this},n.prototype.then=function(t,e){if(!this._fullfilledPromise){var r=this;this._fullfilledPromise=new Promise(function(t,e){r.end(function(r,n){r?e(r):t(n)})})}return this._fullfilledPromise.then(t,e)},n.prototype.catch=function(t){return this.then(void 0,t)},n.prototype.use=function(t){return t(this),this},n.prototype.get=function(t){return this._header[t.toLowerCase()]},n.prototype.getHeader=n.prototype.get,n.prototype.set=function(t,e){if(i(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},n.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},n.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(i(t)){for(var r in t)this.field(r,t[r]);return this}if(Array.isArray(e)){for(var n in e)this.field(t,e[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},n.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},n.prototype.withCredentials=function(){return this._withCredentials=!0,this},n.prototype.redirects=function(t){return this._maxRedirects=t,this},n.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},n.prototype.send=function(t){var e=i(t),r=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&i(this._data))for(var n in t)this._data[n]=t[n];else"string"==typeof t?(r||this.type("form"),r=this._header["content-type"],"application/x-www-form-urlencoded"==r?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(r||this.type("json"),this)},n.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this}},function(t,e,r){var n;(function(t,o){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(a){function u(t){throw RangeError(H[t])}function s(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function l(t,e){var r=t.split("@"),n="";r.length>1&&(n=r[0]+"@",t=r[1]),t=t.replace(I,".");var o=t.split("."),i=s(o,e).join(".");return n+i}function c(t){for(var e,r,n=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function h(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=z(t>>>10&1023|55296),t=56320|1023&t),e+=z(t)}).join("")}function f(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:k}function p(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function d(t,e,r){var n=0;for(t=r?L(t/S):t>>1,t+=L(t/e);t>U*T>>1;n+=k)t=L(t/U);return L(n+(U+1)*t/(t+q))}function y(t){var e,r,n,o,i,a,s,l,c,p,y=[],m=t.length,v=0,b=A,_=M;for(r=t.lastIndexOf(E),r<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&u("not-basic"),y.push(t.charCodeAt(n));for(o=r>0?r+1:0;o<m;){for(i=v,a=1,s=k;o>=m&&u("invalid-input"),l=f(t.charCodeAt(o++)),(l>=k||l>L((O-v)/a))&&u("overflow"),v+=l*a,c=s<=_?P:s>=_+T?T:s-_,!(l<c);s+=k)p=k-c,a>L(O/p)&&u("overflow"),a*=p;e=y.length+1,_=d(v-i,e,0==i),L(v/e)>O-b&&u("overflow"),b+=L(v/e),v%=e,y.splice(v++,0,b)}return h(y)}function m(t){var e,r,n,o,i,a,s,l,h,f,y,m,v,b,_,w=[];for(t=c(t),m=t.length,e=A,r=0,i=M,a=0;a<m;++a)y=t[a],y<128&&w.push(z(y));for(n=o=w.length,o&&w.push(E);n<m;){for(s=O,a=0;a<m;++a)y=t[a],y>=e&&y<s&&(s=y);for(v=n+1,s-e>L((O-r)/v)&&u("overflow"),r+=(s-e)*v,e=s,a=0;a<m;++a)if(y=t[a],y<e&&++r>O&&u("overflow"),y==e){for(l=r,h=k;f=h<=i?P:h>=i+T?T:h-i,!(l<f);h+=k)_=l-f,b=k-f,w.push(z(p(f+_%b,0))),l=L(_/b);w.push(z(p(l,0))),i=d(r,v,n==o),r=0,++n}++r,++e}return w.join("")}function v(t){return l(t,function(t){return C.test(t)?y(t.slice(4).toLowerCase()):t})}function b(t){return l(t,function(t){return R.test(t)?"xn--"+m(t):t})}var _="object"==i(e)&&e&&!e.nodeType&&e,w="object"==i(t)&&t&&!t.nodeType&&t,g="object"==("undefined"==typeof o?"undefined":i(o))&&o;g.global!==g&&g.window!==g&&g.self!==g||(a=g);var j,x,O=2147483647,k=36,P=1,T=26,q=38,S=700,M=72,A=128,E="-",C=/^xn--/,R=/[^\x20-\x7E]/,I=/[\x2E\u3002\uFF0E\uFF61]/g,H={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input" | ||
},U=k-P,L=Math.floor,z=String.fromCharCode;if(j={version:"1.3.2",ucs2:{decode:c,encode:h},decode:y,encode:m,toASCII:b,toUnicode:v},"object"==i(r(7))&&r(7))n=function(){return j}.call(e,r,e,t),!(void 0!==n&&(t.exports=n));else if(_&&w)if(t.exports==_)w.exports=j;else for(x in j)j.hasOwnProperty(x)&&(_[x]=j[x]);else a.punycode=j}(void 0)}).call(e,r(20)(t),function(){return this}())},function(t,e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"===("undefined"==typeof t?"undefined":r(t))&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{default:t}}function i(t){function e(e){var r={apiServer:s,params:{}};return(0,d.isAuthMethod)(e)&&t&&(r.params["oauth"===i?"access_token":"auth"]=t),r}function r(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=(0,l.default)({},e(t),n);return(0,h.default)(t,o).catch(function(e){return 500===e.result&&s!==y?(s=y,r(t,n)):Promise.reject(e)})}function n(){return r("getapiserver",{}).then(function(t){return s=t.api[0]})}function o(e){t=e}var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"oauth",a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,u.default)(["oauth","pcloud"].indexOf(i)!==-1,"`type` must be either `oauth` or `pcloud`."),"oauth"===i&&((0,u.default)("string"==typeof t,"`token` is required."),(0,u.default)(t.length,"`token` is required."));var s=y,c={api:r,setupProxy:n},f=void 0;for(var m in p)if(p.hasOwnProperty(m)){var v=p[m];f=v({client:c,setToken:o,type:i},i),"function"==typeof f&&(c[m]=f)}return a&&n(),c}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var a=r(1),u=o(a),s=r(9),l=o(s),c=r(3),h=o(c),f=r(29),p=n(f),d=r(2),y="api.pcloud.com"},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(6),i=n(o);e.default=function(){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t){var r=e.onBegin,n=void 0===r?function(){}:r,o=e.onProgress,a=void 0===o?function(){}:o,u=e.onFinish,s=void 0===u?function(){}:u;return n(),(0,i.default)(t,{type:"arraybuffer",onProgress:a}).then(function(t){return s(t),t})}}}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.client;return function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=e.getfilelink,i=e.download;return o(t).then(i(r,n))}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(1),a=n(i);e.default=function(t){var e=t.client;return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,a.default)(t,"`file` is required."),(0,a.default)("object"===("undefined"==typeof t?"undefined":o(t)),"`file` of type File must be supplied.");var i=n.onBegin,u=void 0===i?function(){}:i,s=n.onProgress,l=void 0===s?function(){}:s,c=n.onFinish,h=void 0===c?function(){}:c;return u(),e.api("uploadfile",{method:"post",params:{folderid:r,nopartial:1},files:[{file:t,name:t.name}],onProgress:function(t){return l(t)}}).then(function(t){var e=t.metadata,r=t.checksums,n={metadata:e[0],checksums:r[0]};return h(n),n})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,i.default)(t.length,"`name` for is required"),(0,i.default)("string"==typeof t,"`name` is required and be a string."),(0,i.default)("number"==typeof r,"`parentfolderid` is required."),e.api("createfolder",{params:{name:t,folderid:r}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t){return(0,i.default)("number"==typeof t,"`fileid` must be a number."),(0,i.default)(t,"`fileid` is required."),e.api("deletefile",{params:{fileid:t}}).then(function(){return!0})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t){return(0,i.default)("number"==typeof t,"`folderid must be a number.`"),(0,i.default)(t,"`folderid` is required and can't be `0`."),e.api("deletefolderrecursive",{params:{folderid:t}}).then(function(t){return!0})}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2);e.default=function(t){var e=t.client;return function(t){return e.api("getfilelink",{params:{fileid:t,forcedownload:1}}).then(function(t){return(0,n.pCloudUrl)(t)})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(25);Object.defineProperty(e,"createfolder",{enumerable:!0,get:function(){return n(o).default}});var i=r(26);Object.defineProperty(e,"deletefile",{enumerable:!0,get:function(){return n(i).default}});var a=r(22);Object.defineProperty(e,"download",{enumerable:!0,get:function(){return n(a).default}});var u=r(23);Object.defineProperty(e,"downloadfile",{enumerable:!0,get:function(){return n(u).default}});var s=r(27);Object.defineProperty(e,"deletefolder",{enumerable:!0,get:function(){return n(s).default}});var l=r(28);Object.defineProperty(e,"getfilelink",{enumerable:!0,get:function(){return n(l).default}});var c=r(30);Object.defineProperty(e,"listfolder",{enumerable:!0,get:function(){return n(c).default}});var h=r(31);Object.defineProperty(e,"login",{enumerable:!0,get:function(){return n(h).default}});var f=r(32);Object.defineProperty(e,"movefile",{enumerable:!0,get:function(){return n(f).default}});var p=r(33);Object.defineProperty(e,"movefolder",{enumerable:!0,get:function(){return n(p).default}});var d=r(34);Object.defineProperty(e,"register",{enumerable:!0,get:function(){return n(d).default}});var y=r(35);Object.defineProperty(e,"remoteupload",{enumerable:!0,get:function(){return n(y).default}});var m=r(36);Object.defineProperty(e,"renamefile",{enumerable:!0,get:function(){return n(m).default}});var v=r(37);Object.defineProperty(e,"renamefolder",{enumerable:!0,get:function(){return n(v).default}});var b=r(24);Object.defineProperty(e,"upload",{enumerable:!0,get:function(){return n(b).default}})},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return(0,i.default)("number"==typeof t,"`folderid must be a number.`"),e.api("listfolder",{params:{folderid:t}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o),a=r(2);e.default=function(t){var e=t.client,r=t.setToken;return function(t,n){return(0,i.default)("string"==typeof t&&(0,a.isEmail)(t),"`email` must be provided."),(0,i.default)(n,"`password` is required."),(0,i.default)(n.length,"`password` is required."),e.api("userinfo",{params:{username:t,password:n,getauth:1,logout:1}}).then(function(t){var e=t.auth;return r(e),e})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t,r){return(0,i.default)("number"==typeof t,"`fileid` must be number."),(0,i.default)(0!==t,"`fileid` cannot be 0."),(0,i.default)(r,"`tofolderid` is required."),e.api("renamefile",{params:{fileid:t,tofolderid:r}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t,r){return(0,i.default)("number"==typeof t,"`folderid` must be number."),(0,i.default)(0!==t,"`folderid` cannot be 0."),(0,i.default)(r,"`tofolderid` is required."),e.api("renamefolder",{params:{folderid:t,tofolderid:r}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o),a=r(2);e.default=function(t){var e=t.client;return function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,i.default)("string"==typeof t&&(0,a.isEmail)(t),"`email` must be provided."),(0,i.default)(r,"`password` is required."),(0,i.default)(r.length,"`password` is required.");var o={mail:t,password:r,getauth:1,logout:1,termsaccepted:"yes"};return n.invite&&(o.invite=n.invite),n.ref&&(o.ref=n.ref),o.os=4,o.device=navigator.userAgent,e.api("register",{params:o}).then(function(t){return t.userid})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return{all:{downloaded:t.reduce(function(t,e){return t+e.downloaded},0),size:t.reduce(function(t,e){return t+e.size},0)},files:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(1),a=n(i),u=r(2);e.default=function(t){var e=t.client;return function(t){function r(){i(),c=setTimeout(r,200)}function n(){c&&clearTimeout(c)}function i(){e.api("uploadprogress",{params:{progresshash:v}}).then(function(t){var e=t.files;return d(o(e))})}var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,a.default)(t,"`file` is required."),(0,a.default)("string"==typeof t,"`file` must be supplied");var c,h=l.onBegin,f=void 0===h?function(){}:h,p=l.onProgress,d=void 0===p?function(){}:p,y=l.onFinish,m=void 0===y?function(){}:y,v="pcloud-sdk-remote-"+(0,u.uniqueNumber)()+"-"+(0,u.randomNumber)();return f(),r(),e.api("downloadfile",{method:"post",params:{folderid:s,progresshash:v,nopartial:1,url:t}}).then(function(t){var e=t.metadata;return n(),m({metadata:e[0]}),{metadata:e[0]}})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t,r){return(0,i.default)("number"==typeof t,"`fileid` must be number."),(0,i.default)(0!==t,"`fileid` cannot be 0."),(0,i.default)(r,"`toname` is required."),(0,i.default)(r.length,"`toname` is required."),e.api("renamefile",{params:{fileid:t,toname:r}}).then(function(t){return t.metadata})}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o);e.default=function(t){var e=t.client;return function(t,r){return(0,i.default)("number"==typeof t,"`folderid` must be number."),(0,i.default)(0!==t,"`folderid` cannot be 0."),(0,i.default)(r,"`toname` is required."),(0,i.default)(r.length,"`toname` is required."),e.api("renamefolder",{params:{folderid:t,toname:r}}).then(function(t){return t.metadata})}}},function(t,e){(function(t){"use strict";t.ENV="web"}).call(e,function(){return this}())},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t.client_id,r=void 0!==e&&e,n=t.redirect_uri,o=void 0!==n&&n,i=t.receiveToken,a=void 0!==i&&i;(0,c.default)(r,"`client_id` is required."),(0,c.default)(o,"`redirect_uri` is required."),(0,c.default)(a,"`receiveToken` is required.");var u=s.default.format({protocol:p,hostname:d,pathname:y,query:{redirect_uri:o,client_id:r,response_type:"token"}});window.open(u,"oauth","width=680,height=535"),window.__setPcloudToken=function(t){a(t),delete window.__setPcloudToken}}function i(){var t=location.hash.match(/access_token=([^&]+)/)[1];window.opener.__setPcloudToken(t),window.close()}function a(t,e,r){return(0,f.default)("oauth2_token",{params:{client_id:e,client_secret:r,code:t}})}Object.defineProperty(e,"__esModule",{value:!0});var u=r(5),s=n(u),l=r(1),c=n(l),h=r(3),f=n(h),p="https",d="my.pcloud.com",y="/oauth2/authorize";e.default={initOauthToken:o,popup:i,getTokenFromCode:a}},function(t,e){"use strict";function r(){return!1}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e){"use strict";function r(t){var e=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(t)}function n(t){return t.split(".").pop()}function o(t,e){return void 0===e&&(e=1),t=parseInt(t,10),t>=1099511627776?(t/1099511627776).toFixed(e)+" Tb":t>=1073741824?(t/1073741824).toFixed(e)+" Gb":t>=1048576?(t/1048576).toFixed(e)+" Mb":t>=1024?(t/1024).toFixed(e)+" Kb":t.toFixed(e)+" B"}function i(){return++l}function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return Math.random()*(10<<t)}function u(t,e){return JSON.stringify({method:t,params:e})}function s(t){return"https://"+t.hosts[0]+t.path}Object.defineProperty(e,"__esModule",{value:!0}),e.isEmail=r,e.fileext=n,e.formatSize=o,e.uniqueNumber=i,e.randomNumber=a,e.methodStringify=u,e.pCloudUrl=s;var l=0},function(t,e){"use strict";function r(t){return t in i}function n(t){return r(t)&&i[t].auth}function o(t){return n(t)&&"oauth"in i[t]}Object.defineProperty(e,"__esModule",{value:!0}),e.isApiMethod=r,e.isAuthMethod=n,e.isOAuthMethod=o;var i=e.pCloudApiMethods={oauth2_token:{auth:!1,type:"write"},register:{auth:!1,type:"write"},listfolder:{auth:!0,type:"read"},createfolder:{auth:!0,type:"write"},userinfo:{auth:!0,type:"read"},currentserver:{auth:!1,type:"read"},uploadfile:{auth:!0,type:"write"},getfilelink:{auth:!0,type:"read"},getapiserver:{auth:!1,type:"read"},renamefolder:{auth:!0,type:"write"},deletefile:{auth:!0,type:"write"},deletefolderrecursive:{auth:!0,type:"write"},logout:{auth:!0,type:"write"},createfolderifnotexists:{auth:!0,type:"write"},getthumblink:{auth:!0,type:"read"},getvideolink:{auth:!0,type:"read"},getaudiolink:{auth:!0,type:"read"},deletefolder:{auth:!0,type:"write"},diff:{auth:!0,type:"write"},subscribe:{auth:!0,type:"write"},listnotifications:{auth:!0,type:"write"},readnotifications:{auth:!0,type:"write"},listshares:{auth:!0,type:"read"},acceptshare:{auth:!0,type:"write"},declineshare:{auth:!0,type:"write"},removeshare:{auth:!0,type:"write"},cancelsharerequest:{auth:!0,type:"write"},changeshare:{auth:!0,type:"write"},sharefolder:{auth:!0,type:"write"},copyfile:{auth:!0,type:"write"},copyfolder:{auth:!0,type:"write"},listpublinks:{auth:!0,type:"read"},getfilepublink:{auth:!0,type:"write"},getfolderpublink:{auth:!0,type:"write"},gettreepublink:{auth:!0,type:"write"},deletepublink:{auth:!0,type:"write"},changepublink:{auth:!0,type:"write"},copypubfile:{auth:!0,type:"write"},renamefile:{auth:!0,type:"write"},showpublink:{auth:!1,type:"read"},getzip:{auth:!0,type:"write"},getziplink:{auth:!0,type:"write"},createuploadlink:{auth:!0,type:"write"},listuploadlinks:{auth:!0,type:"read"},deleteuploadlink:{auth:!0,type:"write"},changeuploadlink:{auth:!0,type:"write"},uploadlinkprogress:{auth:!0,type:"read"},downloadfile:{auth:!0,type:"write"},lostpassword:{auth:!1,type:"write"},resetpassword:{auth:!1,type:"write"},changepassword:{auth:!0,type:"write"},verifyemail:{auth:!1,type:"write"},sharerequestinfo:{auth:!1,type:"read"},sendverificationemail:{auth:!0,type:"write"},getthumbslinks:{auth:!0,type:"read"},getthumbs:{auth:!0,type:"read"},uploadprogress:{auth:!0,type:"write"},invite:{auth:!0,type:"write"},fb_assign:{auth:!0,type:"write"},userbonuses:{auth:!0,type:"write"},givebonus:{auth:!0,type:"write"},userinvites:{auth:!0,type:"write"},getvideolinks:{auth:!0,type:"read"},backup_modify:{auth:!0,type:"write"},backup_list:{auth:!0,type:"read"},social_assign:{auth:!0,type:"write"},extractarchive:{auth:!0,type:"write"},extractarchiveprogress:{auth:!0,type:"write"},listrevisions:{auth:!0,type:"read"},revertrevision:{auth:!0,type:"write"},supportedlanguages:{auth:!0,type:"read"},newsletter_check:{auth:!0,type:"read"},blockchain_address:{auth:!0,type:"read"},trash_list:{auth:!0,type:"read"},trash_clear:{auth:!0,type:"write"},trash_restore:{auth:!0,type:"write"},trash_getrestorepath:{auth:!0,type:"write"},collection_list:{auth:!0,type:"read"},collection_details:{auth:!0,type:"read"},collection_create:{auth:!0,type:"write"},collection_rename:{auth:!0,type:"write"},collection_delete:{auth:!0,type:"write"},collection_linkfiles:{auth:!0,type:"write"},collection_unlinkfiles:{auth:!0,type:"write"},collection_move:{auth:!0,type:"write"},app_userlist:{auth:!0,type:"read"},app_userdelete:{auth:!0,type:"write"},gettextfile:{auth:!0,type:"write"},getpubtextfile:{auth:!1,type:"write"},account_teams:{auth:!0,type:"read"},account_teamcreate:{auth:!0,type:"read"},account_info:{auth:!0,type:"read"},account_modify:{auth:!0,type:"write"},account_users:{auth:!0,type:"read"},account_invitemail:{auth:!0,type:"read"},account_usermodify:{auth:!0,type:"write"},account_teammodify:{auth:!0,type:"write"},account_teamlink:{auth:!0,type:"write"},account_billinginfo:{auth:!0,type:"read"},account_invoice_modify:{auth:!0,type:"write"},account_upload_avatar:{auth:!0,type:"write"},account_teamunlink:{auth:!0,type:"write"},account_teamlink_head:{auth:!0,type:"write"},account_teamlink_accept:{auth:!0,type:"write"},account_invitelist:{auth:!0,type:"read"},account_invalidate_password:{auth:!0,type:"write"},account_invitecancel:{auth:!0,type:"write"},commentlist:{auth:!0,type:"read"},commentpost:{auth:!0,type:"write"},commentdelete:{auth:!0,type:"write"},eventsubscribe:{auth:!0,type:"write"},account_teamshare:{auth:!0,type:"write"},account_modifyshare:{auth:!0,type:"write"},account_stopshare:{auth:!0,type:"write"},account_listshares:{auth:!0,type:"read"},account_log:{auth:!0,type:"read"},account_paystripe:{auth:!0,type:"read"},listtokens:{auth:!0,type:"read"},deletetoken:{auth:!0,type:"write"},savezip:{auth:!0,type:"write"},savezipprogress:{auth:!0,type:"write"},contactload:{auth:!0,type:"write"},sendpublink:{auth:!0,type:"write"},contactlist:{auth:!0,type:"read"},account_viewtoken:{auth:!0,type:"write"},eventslast:{auth:!0,type:"write"},search:{auth:!0,type:"read"},issueproforma:{auth:!0,type:"write"},listproforma:{auth:!0,type:"write"},getbreadcrumb:{auth:!0,type:"read"},getpreviewlink:{auth:!0,type:"read"},getpublinkpreviewdownload:{type:"read",auth:!1},setlanguage:{auth:!0,type:"write"},account_branding:{auth:!0,type:"read"},account_branding_set:{auth:!0,type:"write"},account_branding_logo_upload:{auth:!0,type:"write"},account_logintoken:{auth:!0,type:"write"},getpublinkstats:{auth:!0,type:"read"},getpublinkadpreference:{auth:!0,type:"read"},setpublinkadpreference:{auth:!0,type:"write"},account_ispublinktrafficlimited:{auth:!0,type:"read"},getreferrallink:{auth:!0,type:"read"},sendreferrallink:{auth:!0,type:"write"},listpaymentsubscriptions:{auth:!0,type:"read"},getip:{auth:!1,type:"read"},crypto_getuserkeys:{auth:!0,type:"read"},crypto_getfolderkey:{auth:!0,type:"read"},crypto_getfilekey:{auth:!0,type:"read"},crypto_reset:{auth:!0,type:"write"},crypto_setuserkeys:{auth:!0,type:"write"},crypto_getuserhint:{auth:!0,type:"write"},upload_create:{auth:!0,type:"write"},upload_write:{auth:!0,type:"write"},upload_save:{auth:!0,type:"write"},crypto_getroot:{auth:!0,type:"read"},crypto_getfolderskey:{auth:!0,type:"read"}}}])}); | ||
//# sourceMappingURL=pcloudsdk.js.map |
@@ -1,4 +0,4 @@ | ||
## pCloudSdk.api | ||
## pCloudSdk Api Methods | ||
#### request(url, options) | ||
#### ApiRequest(url, options) | ||
@@ -18,13 +18,16 @@ Generic highly configurable method for accessing the pCloud api. Can be used to access the REST API and for upload/download. **Isomorphic**. | ||
responseType?: 'text' | 'json' | 'blob', | ||
// Progress Callback that can be used for upload/download/text process | ||
onProgress?: (T: ProgressEvent) => void, | ||
// browser only | ||
// browser only, passes the XHR object to you in case you want to work with it | ||
xhr?: (xhr: XMLHttpRequest) => void, | ||
// nodejs only | ||
// nodejs only, pipe the result to a WriteStream (ie: download file) | ||
pipe?: WriteStream, | ||
pipeFrom?: ReadStream, | ||
// get params | ||
params?: {}, | ||
// files to upload | ||
files?: Array<UploadFile>, | ||
@@ -38,5 +41,11 @@ | ||
} | ||
type UploadFile = { | ||
name: string, | ||
file: string | File | ||
}; | ||
``` | ||
#### method(method, options) | ||
#### ApiMethod(method, options) | ||
@@ -43,0 +52,0 @@ Wrapper over the request method. Has knowledge of the **API Method** called and whether the operation is successful or not. |
@@ -24,4 +24,4 @@ ## Install | ||
`<script src="https://www.jsdelivr.com/pcloud/sdk.js"></script>` | ||
@@ TODO | ||
``` | ||
<script type="text/javascript" src="https://unpkg.com/pcloud-sdk-js@1.0.0/dist/pcloudsdk.js"></script> | ||
``` |
# Table of contents | ||
- [NPM Package](https://www.npmjs.com/pcloud-sdk-js) | ||
- [NPM Package](https://www.npmjs.com/package/pcloud-sdk-js) | ||
- [About pCloud](aboutpcloud.md) | ||
@@ -10,11 +10,8 @@ - Getting Started | ||
- [`oauth`](api-oauth.md) | ||
- [`initOauthToken`](API-Oauth.md#initOauthToken) | ||
- [`popup`](API-Oauth.md#popup) | ||
- [`getTokenFromCode`](#API-Oauth.md#getTokenFromCode) | ||
- [`api`](api.md) | ||
- [`method`](api.md#method) | ||
- [`request`](api.md#request) | ||
- [`createClient`](createClient.md) | ||
- [Api](api.md) | ||
- `ApiRequest` | ||
- `ApiMethod` | ||
- [`createClient`](createclient.md) | ||
- [`client`](createClient.md#client) | ||
- [`api`](createClient.md#api) | ||
- [Higher order methods](createClient.md#higherordermethods) |
{ | ||
"name": "pcloud-sdk-js", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "pCloud's Javascript SDK", | ||
"main": "lib/index.js", | ||
"browser": { | ||
"./lib/index.js": "./lib/browser.js", | ||
"./lib/client/methods/download.js": "./lib/client/methods/browser/download.js", | ||
@@ -12,7 +11,8 @@ "./lib/client/methods/upload.js": "./lib/client/methods/browser/upload.js", | ||
"./lib/utils/node-utils.js": "./lib/utils/browser/node-utils.js", | ||
"./src/env/index.js": "./src/env/browser.js", | ||
"./lib/env/index.js": "./lib/env/browser.js", | ||
"./src/client/methods/download.js": "./src/client/methods/browser/download.js", | ||
"./src/client/methods/upload.js": "./src/client/methods/browser/upload.js", | ||
"./src/client/methods/downloadfile.js": "./src/client/methods/browser/downloadfile.js" | ||
"./src/client/methods/downloadfile.js": "./src/client/methods/browser/downloadfile.js", | ||
"./src/env/index.js": "./src/env/browser.js", | ||
"./src/utils/httpProgressMiddleware.js": "./src/utils/browser/httpProgressMiddleware.js" | ||
}, | ||
@@ -85,3 +85,3 @@ "scripts": { | ||
"type": "git", | ||
"url": "git@gitlab.pcloud.com:pcloud-web/pcloud-sdk-js.git" | ||
"url": "https://github.com/pCloud/pcloud-sdk-js.git" | ||
}, | ||
@@ -88,0 +88,0 @@ "keywords": [ |
# [pCloud](https://www.pcloud.com/) JavaScript SDK | ||
`pcloud-sdk-js` is a JavaScript library that let's you use the **pCloud**'s **API** in your projects. | ||
`pcloud-sdk-js` is a JavaScript library that let's you include **pCloud** functionality in your apps. It lets you use the full range of the [pCloud's API](https://docs.pcloud.com/) with some utility functions over the top. | ||
* **Universal**/Isomorphic. | ||
* **Promise** based API. | ||
* Easy to use and packed with examples for both **browser** and **node** to let you start using the API in minutes. | ||
* **Universal**/Isomorphic. | ||
* **Promise** based API. | ||
* Simplified OAuth process. Get started in minutes. | ||
## Examples | ||
Create reusable `client` object using and **oAuth 2** token: | ||
Create reusable `client` object using and **oAuth** token: | ||
```js | ||
@@ -31,3 +31,3 @@ const client = pcloudSdk.createClient('access_token'); | ||
onProgress: function(progress) { | ||
// .. | ||
console.log(progress.loaded, progress.total); | ||
}, | ||
@@ -43,13 +43,19 @@ onFinish: function(fileMetadata) { | ||
## Getting started | ||
## Install | ||
Install with npm: | ||
``` | ||
npm install pcloud-sdk-js | ||
npm install --save pcloud-sdk-js | ||
``` | ||
Or load the prebuilt file. | ||
``` | ||
<script type="text/javascript" src="https://www.jsdelivr.com/pcloudsdk.js"></script> | ||
<script type="text/javascript" src="https://unpkg.com/pcloud-sdk-js@1.0.0/dist/pcloudsdk.js"></script> | ||
``` | ||
## Documentation | ||
Full documentation, guides and examples are available at our [SDK site](https://www.pcloud.com) | ||
The SDK is exported as a `pCloudSdk` global. | ||
## Docs | ||
- For more information you can view [the documentation](/docs), [the examples](/examples) and the [API Reference](/docs/API.md). | ||
- For more information about the pCloud's API go to https://docs.pcloud.com. | ||
- SDKs for other platforms you can find at our [SDK site](https://pcloud.github.io). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23250154
108
2386
60