forked from arangodb/arangojs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharangojs.min.js
163 lines (133 loc) · 64.2 KB
/
arangojs.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.arangojs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
"use strict";!function(e){function o(e){throw new RangeError(T[e])}function n(e,o){for(var n=e.length,r=[];n--;)r[n]=o(e[n]);return r}function r(e,o){var r=e.split("@"),t="";r.length>1&&(t=r[0]+"@",e=r[1]),e=e.replace(S,".");var u=e.split("."),i=n(u,o).join(".");return t+i}function t(e){for(var o,n,r=[],t=0,u=e.length;u>t;)o=e.charCodeAt(t++),o>=55296&&56319>=o&&u>t?(n=e.charCodeAt(t++),56320==(64512&n)?r.push(((1023&o)<<10)+(1023&n)+65536):(r.push(o),t--)):r.push(o);return r}function u(e){return n(e,function(e){var o="";return e>65535&&(e-=65536,o+=P(e>>>10&1023|55296),e=56320|1023&e),o+=P(e)}).join("")}function i(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:b}function f(e,o){return e+22+75*(26>e)-((0!=o)<<5)}function c(e,o,n){var r=0;for(e=n?M(e/j):e>>1,e+=M(e/o);e>L*C>>1;r+=b)e=M(e/L);return M(r+(L+1)*e/(e+m))}function l(e){var n,r,t,f,l,s,d,a,p,h,v=[],g=e.length,w=0,m=I,j=A;for(r=e.lastIndexOf(E),0>r&&(r=0),t=0;r>t;++t)e.charCodeAt(t)>=128&&o("not-basic"),v.push(e.charCodeAt(t));for(f=r>0?r+1:0;g>f;){for(l=w,s=1,d=b;f>=g&&o("invalid-input"),a=i(e.charCodeAt(f++)),(a>=b||a>M((x-w)/s))&&o("overflow"),w+=a*s,p=j>=d?y:d>=j+C?C:d-j,!(p>a);d+=b)h=b-p,s>M(x/h)&&o("overflow"),s*=h;n=v.length+1,j=c(w-l,n,0==l),M(w/n)>x-m&&o("overflow"),m+=M(w/n),w%=n,v.splice(w++,0,m)}return u(v)}function s(e){var n,r,u,i,l,s,d,a,p,h,v,g,w,m,j,F=[];for(e=t(e),g=e.length,n=I,r=0,l=A,s=0;g>s;++s)v=e[s],128>v&&F.push(P(v));for(u=i=F.length,i&&F.push(E);g>u;){for(d=x,s=0;g>s;++s)v=e[s],v>=n&&d>v&&(d=v);for(w=u+1,d-n>M((x-r)/w)&&o("overflow"),r+=(d-n)*w,n=d,s=0;g>s;++s)if(v=e[s],n>v&&++r>x&&o("overflow"),v==n){for(a=r,p=b;h=l>=p?y:p>=l+C?C:p-l,!(h>a);p+=b)j=a-h,m=b-h,F.push(P(f(h+j%m,0))),a=M(j/m);F.push(P(f(a,0))),l=c(r,w,u==i),r=0,++u}++r,++n}return F.join("")}function d(e){return r(e,function(e){return F.test(e)?l(e.slice(4).toLowerCase()):e})}function a(e){return r(e,function(e){return O.test(e)?"xn--"+s(e):e})}var p="object"==typeof exports&&exports&&!exports.nodeType&&exports,h="object"==typeof module&&module&&!module.nodeType&&module,v="object"==typeof global&&global;(v.global===v||v.window===v||v.self===v)&&(e=v);var g,w,x=2147483647,b=36,y=1,C=26,m=38,j=700,A=72,I=128,E="-",F=/^xn--/,O=/[^\x20-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,T={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=b-y,M=Math.floor,P=String.fromCharCode;if(g={version:"1.3.2",ucs2:{decode:t,encode:u},decode:l,encode:s,toASCII:a,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return g});else if(p&&h)if(module.exports==p)h.exports=g;else for(w in g)g.hasOwnProperty(w)&&(p[w]=g[w]);else e.punycode=g}(void 0);
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],2:[function(require,module,exports){
"use strict";function hasOwnProperty(r,e){return Object.prototype.hasOwnProperty.call(r,e)}module.exports=function(r,e,t,n){e=e||"&",t=t||"=";var o={};if("string"!=typeof r||0===r.length)return o;var a=/\+/g;r=r.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var p=r.length;s>0&&p>s&&(p=s);for(var y=0;p>y;++y){var u,c,i,l,f=r[y].replace(a,"%20"),v=f.indexOf(t);v>=0?(u=f.substr(0,v),c=f.substr(v+1)):(u=f,c=""),i=decodeURIComponent(u),l=decodeURIComponent(c),hasOwnProperty(o,i)?isArray(o[i])?o[i].push(l):o[i]=[o[i],l]:o[i]=l}return o};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)};
},{}],3:[function(require,module,exports){
"use strict";function map(r,e){if(r.map)return r.map(e);for(var t=[],n=0;n<r.length;n++)t.push(e(r[n],n));return t}var stringifyPrimitive=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}};module.exports=function(r,e,t,n){return e=e||"&",t=t||"=",null===r&&(r=void 0),"object"==typeof r?map(objectKeys(r),function(n){var i=encodeURIComponent(stringifyPrimitive(n))+t;return isArray(r[n])?map(r[n],function(r){return i+encodeURIComponent(stringifyPrimitive(r))}).join(e):i+encodeURIComponent(stringifyPrimitive(r[n]))}).join(e):n?encodeURIComponent(stringifyPrimitive(n))+t+encodeURIComponent(stringifyPrimitive(r)):""};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)},objectKeys=Object.keys||function(r){var e=[];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.push(t);return e};
},{}],4:[function(require,module,exports){
"use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode");
},{"./decode":2,"./encode":3}],5:[function(require,module,exports){
"use strict";function Url(){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 urlParse(t,s,e){if(t&&util.isObject(t)&&t instanceof Url)return t;var h=new Url;return h.parse(t,s,e),h}function urlFormat(t){return util.isString(t)&&(t=urlParse(t)),t instanceof Url?t.format():Url.prototype.format.call(t)}function urlResolve(t,s){return urlParse(t,!1,!0).resolve(s)}function urlResolveObject(t,s){return t?urlParse(t,!1,!0).resolveObject(s):s}var punycode=require("punycode"),util=require("./util");exports.parse=urlParse,exports.resolve=urlResolve,exports.resolveObject=urlResolveObject,exports.format=urlFormat,exports.Url=Url;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n"," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");Url.prototype.parse=function(t,s,e){if(!util.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var h=t.indexOf("?"),r=-1!==h&&h<t.indexOf("#")?"?":"#",a=t.split(r),o=/\\/g;a[0]=a[0].replace(o,"/"),t=a.join(r);var n=t;if(n=n.trim(),!e&&1===t.split("#").length){var i=simplePathPattern.exec(n);if(i)return this.path=n,this.href=n,this.pathname=i[1],i[2]?(this.search=i[2],s?this.query=querystring.parse(this.search.substr(1)):this.query=this.search.substr(1)):s&&(this.search="",this.query={}),this}var l=protocolPattern.exec(n);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,n=n.substr(l.length)}if(e||l||n.match(/^\/\/[^@\/]+@[^@\/]+/)){var p="//"===n.substr(0,2);!p||l&&hostlessProtocol[l]||(n=n.substr(2),this.slashes=!0)}if(!hostlessProtocol[l]&&(p||l&&!slashedProtocol[l])){for(var c=-1,f=0;f<hostEndingChars.length;f++){var m=n.indexOf(hostEndingChars[f]);-1!==m&&(-1===c||c>m)&&(c=m)}var v,g;g=-1===c?n.lastIndexOf("@"):n.lastIndexOf("@",c),-1!==g&&(v=n.slice(0,g),n=n.slice(g+1),this.auth=decodeURIComponent(v)),c=-1;for(var f=0;f<nonHostChars.length;f++){var m=n.indexOf(nonHostChars[f]);-1!==m&&(-1===c||c>m)&&(c=m)}-1===c&&(c=n.length),this.host=n.slice(0,c),n=n.slice(c),this.parseHost(),this.hostname=this.hostname||"";var y="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!y)for(var P=this.hostname.split(/\./),f=0,d=P.length;d>f;f++){var q=P[f];if(q&&!q.match(hostnamePartPattern)){for(var b="",O=0,j=q.length;j>O;O++)b+=q.charCodeAt(O)>127?"x":q[O];if(!b.match(hostnamePartPattern)){var x=P.slice(0,f),U=P.slice(f+1),C=q.match(hostnamePartStart);C&&(x.push(C[1]),U.unshift(C[2])),U.length&&(n="/"+U.join(".")+n),this.hostname=x.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=punycode.toASCII(this.hostname));var A=this.port?":"+this.port:"",w=this.hostname||"";this.host=w+A,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==n[0]&&(n="/"+n))}if(!unsafeProtocol[u])for(var f=0,d=autoEscape.length;d>f;f++){var E=autoEscape[f];if(-1!==n.indexOf(E)){var I=encodeURIComponent(E);I===E&&(I=escape(E)),n=n.split(E).join(I)}}var R=n.indexOf("#");-1!==R&&(this.hash=n.substr(R),n=n.slice(0,R));var S=n.indexOf("?");if(-1!==S?(this.search=n.substr(S),this.query=n.substr(S+1),s&&(this.query=querystring.parse(this.query)),n=n.slice(0,S)):s&&(this.search="",this.query={}),n&&(this.pathname=n),slashedProtocol[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var A=this.pathname||"",k=this.search||"";this.path=A+k}return this.href=this.format(),this},Url.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var s=this.protocol||"",e=this.pathname||"",h=this.hash||"",r=!1,a="";this.host?r=t+this.host:this.hostname&&(r=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&util.isObject(this.query)&&Object.keys(this.query).length&&(a=querystring.stringify(this.query));var o=this.search||a&&"?"+a||"";return s&&":"!==s.substr(-1)&&(s+=":"),this.slashes||(!s||slashedProtocol[s])&&r!==!1?(r="//"+(r||""),e&&"/"!==e.charAt(0)&&(e="/"+e)):r||(r=""),h&&"#"!==h.charAt(0)&&(h="#"+h),o&&"?"!==o.charAt(0)&&(o="?"+o),e=e.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),o=o.replace("#","%23"),s+r+e+o+h},Url.prototype.resolve=function(t){return this.resolveObject(urlParse(t,!1,!0)).format()},Url.prototype.resolveObject=function(t){if(util.isString(t)){var s=new Url;s.parse(t,!1,!0),t=s}for(var e=new Url,h=Object.keys(this),r=0;r<h.length;r++){var a=h[r];e[a]=this[a]}if(e.hash=t.hash,""===t.href)return e.href=e.format(),e;if(t.slashes&&!t.protocol){for(var o=Object.keys(t),n=0;n<o.length;n++){var i=o[n];"protocol"!==i&&(e[i]=t[i])}return slashedProtocol[e.protocol]&&e.hostname&&!e.pathname&&(e.path=e.pathname="/"),e.href=e.format(),e}if(t.protocol&&t.protocol!==e.protocol){if(!slashedProtocol[t.protocol]){for(var l=Object.keys(t),u=0;u<l.length;u++){var p=l[u];e[p]=t[p]}return e.href=e.format(),e}if(e.protocol=t.protocol,t.host||hostlessProtocol[t.protocol])e.pathname=t.pathname;else{for(var c=(t.pathname||"").split("/");c.length&&!(t.host=c.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==c[0]&&c.unshift(""),c.length<2&&c.unshift(""),e.pathname=c.join("/")}if(e.search=t.search,e.query=t.query,e.host=t.host||"",e.auth=t.auth,e.hostname=t.hostname||t.host,e.port=t.port,e.pathname||e.search){var f=e.pathname||"",m=e.search||"";e.path=f+m}return e.slashes=e.slashes||t.slashes,e.href=e.format(),e}var v=e.pathname&&"/"===e.pathname.charAt(0),g=t.host||t.pathname&&"/"===t.pathname.charAt(0),y=g||v||e.host&&t.pathname,P=y,d=e.pathname&&e.pathname.split("/")||[],c=t.pathname&&t.pathname.split("/")||[],q=e.protocol&&!slashedProtocol[e.protocol];if(q&&(e.hostname="",e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===c[0]?c[0]=t.host:c.unshift(t.host)),t.host=null),y=y&&(""===c[0]||""===d[0])),g)e.host=t.host||""===t.host?t.host:e.host,e.hostname=t.hostname||""===t.hostname?t.hostname:e.hostname,e.search=t.search,e.query=t.query,d=c;else if(c.length)d||(d=[]),d.pop(),d=d.concat(c),e.search=t.search,e.query=t.query;else if(!util.isNullOrUndefined(t.search)){if(q){e.hostname=e.host=d.shift();var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.host=e.hostname=b.shift())}return e.search=t.search,e.query=t.query,util.isNull(e.pathname)&&util.isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!d.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var O=d.slice(-1)[0],j=(e.host||t.host||d.length>1)&&("."===O||".."===O)||""===O,x=0,U=d.length;U>=0;U--)O=d[U],"."===O?d.splice(U,1):".."===O?(d.splice(U,1),x++):x&&(d.splice(U,1),x--);if(!y&&!P)for(;x--;x)d.unshift("..");!y||""===d[0]||d[0]&&"/"===d[0].charAt(0)||d.unshift(""),j&&"/"!==d.join("/").substr(-1)&&d.push("");var C=""===d[0]||d[0]&&"/"===d[0].charAt(0);if(q){e.hostname=e.host=C?"":d.length?d.shift():"";var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.host=e.hostname=b.shift())}return y=y||e.host&&d.length,y&&!C&&d.unshift(""),d.length?e.pathname=d.join("/"):(e.pathname=null,e.path=null),util.isNull(e.pathname)&&util.isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=t.auth||e.auth,e.slashes=e.slashes||t.slashes,e.href=e.format(),e},Url.prototype.parseHost=function(){var t=this.host,s=portPattern.exec(t);s&&(s=s[0],":"!==s&&(this.port=s.substr(1)),t=t.substr(0,t.length-s.length)),t&&(this.hostname=t)};
},{"./util":6,"punycode":1,"querystring":4}],6:[function(require,module,exports){
"use strict";module.exports={isString:function(n){return"string"==typeof n},isObject:function(n){return"object"==typeof n&&null!==n},isNull:function(n){return null===n},isNullOrUndefined:function(n){return null==n}};
},{}],7:[function(require,module,exports){
"use strict";function toIdentifier(e){return e.split(" ").map(function(e){return e.slice(0,1).toUpperCase()+e.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}var statuses=require("statuses"),inherits=require("inherits");exports=module.exports=function e(){for(var r,t,s=500,o={},a=0;a<arguments.length;a++){var n=arguments[a];if(n instanceof Error)r=n,s=r.status||r.statusCode||s;else switch(typeof n){case"string":t=n;break;case"number":s=n;break;case"object":o=n}}"number"==typeof s&&statuses[s]||(s=500);var u=exports[s];r||(r=u?new u(t):new Error(t||statuses[s]),Error.captureStackTrace(r,e)),u&&r instanceof u||(r.expose=500>s,r.status=r.statusCode=s);for(var p in o)"status"!==p&&"statusCode"!==p&&(r[p]=o[p]);return r};var codes=statuses.codes.filter(function(e){return e>=400});codes.forEach(function(e){var r=toIdentifier(statuses[e]),t=r.match(/Error$/)?r:r+"Error";if(e>=500){var s=function a(r){var s=new Error(null!=r?r:statuses[e]);return Error.captureStackTrace(s,a),s.__proto__=a.prototype,Object.defineProperty(s,"name",{enumerable:!1,configurable:!0,value:t,writable:!0}),s};return inherits(s,Error),s.prototype.status=s.prototype.statusCode=e,s.prototype.expose=!1,void(exports[e]=exports[r]=s)}var o=function n(r){var s=new Error(null!=r?r:statuses[e]);return Error.captureStackTrace(s,n),s.__proto__=n.prototype,Object.defineProperty(s,"name",{enumerable:!1,configurable:!0,value:t,writable:!0}),s};inherits(o,Error),o.prototype.status=o.prototype.statusCode=e,o.prototype.expose=!0,exports[e]=exports[r]=o}),exports["I'mateapot"]=exports.ImATeapot;
},{"inherits":8,"statuses":10}],8:[function(require,module,exports){
"use strict";"function"==typeof Object.create?module.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t};
},{}],9:[function(require,module,exports){
module.exports={
"100": "Continue",
"101": "Switching Protocols",
"102": "Processing",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-Authoritative Information",
"204": "No Content",
"205": "Reset Content",
"206": "Partial Content",
"207": "Multi-Status",
"208": "Already Reported",
"226": "IM Used",
"300": "Multiple Choices",
"301": "Moved Permanently",
"302": "Found",
"303": "See Other",
"304": "Not Modified",
"305": "Use Proxy",
"306": "(Unused)",
"307": "Temporary Redirect",
"308": "Permanent Redirect",
"400": "Bad Request",
"401": "Unauthorized",
"402": "Payment Required",
"403": "Forbidden",
"404": "Not Found",
"405": "Method Not Allowed",
"406": "Not Acceptable",
"407": "Proxy Authentication Required",
"408": "Request Timeout",
"409": "Conflict",
"410": "Gone",
"411": "Length Required",
"412": "Precondition Failed",
"413": "Payload Too Large",
"414": "URI Too Long",
"415": "Unsupported Media Type",
"416": "Range Not Satisfiable",
"417": "Expectation Failed",
"418": "I'm a teapot",
"422": "Unprocessable Entity",
"423": "Locked",
"424": "Failed Dependency",
"425": "Unordered Collection",
"426": "Upgrade Required",
"428": "Precondition Required",
"429": "Too Many Requests",
"431": "Request Header Fields Too Large",
"451": "Unavailable For Legal Reasons",
"500": "Internal Server Error",
"501": "Not Implemented",
"502": "Bad Gateway",
"503": "Service Unavailable",
"504": "Gateway Timeout",
"505": "HTTP Version Not Supported",
"506": "Variant Also Negotiates",
"507": "Insufficient Storage",
"508": "Loop Detected",
"509": "Bandwidth Limit Exceeded",
"510": "Not Extended",
"511": "Network Authentication Required"
}
},{}],10:[function(require,module,exports){
"use strict";function status(t){if("number"==typeof t){if(!status[t])throw new Error("invalid status code: "+t);return t}if("string"!=typeof t)throw new TypeError("code must be a number or string");var s=parseInt(t,10);if(!isNaN(s)){if(!status[s])throw new Error("invalid status code: "+s);return s}if(s=status[t.toLowerCase()],!s)throw new Error('invalid status message: "'+t+'"');return s}var codes=require("./codes.json");module.exports=status,status.codes=Object.keys(codes).map(function(t){t=~~t;var s=codes[t];return status[t]=s,status[s]=status[s.toLowerCase()]=t,t}),status.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},status.empty={204:!0,205:!0,304:!0},status.retry={502:!0,503:!0,504:!0};
},{"./codes.json":9}],11:[function(require,module,exports){
"use strict";module.exports=function(e){return~-encodeURI(e).split(/%..|./).length};
},{}],12:[function(require,module,exports){
"use strict";function forEachArray(e,t){for(var r=0;r<e.length;r++)t(e[r])}function isEmpty(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function initParams(e,t,r){var n=e;return isFunction(t)?(r=t,"string"==typeof e&&(n={uri:e})):n=xtend(t,{uri:e}),n.callback=r,n}function createXHR(e,t,r){return t=initParams(e,t,r),_createXHR(t)}function _createXHR(e){function t(){4===i.readyState&&o()}function r(){var e=void 0;if(i.response?e=i.response:"text"!==i.responseType&&i.responseType||(e=i.responseText||i.responseXML),H)try{e=JSON.parse(e)}catch(t){}return e}function n(e){clearTimeout(d),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,s(e,a)}function o(){if(!c){var t;clearTimeout(d),t=e.useXDR&&void 0===i.status?200:1223===i.status?204:i.status;var n=a,o=null;0!==t?(n={body:r(),statusCode:t,method:l,headers:{},url:p,rawRequest:i},i.getAllResponseHeaders&&(n.headers=parseHeaders(i.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),s(o,n,n.body)}}var s=e.callback;if("undefined"==typeof s)throw new Error("callback argument missing");s=once(s);var a={body:void 0,headers:{},statusCode:0,method:l,url:p,rawRequest:i},i=e.xhr||null;i||(i=e.cors||e.useXDR?new createXHR.XDomainRequest:new createXHR.XMLHttpRequest);var u,c,d,p=i.url=e.uri||e.url,l=i.method=e.method||"GET",f=e.body||e.data||null,R=i.headers=e.headers||{},h=!!e.sync,H=!1;if("json"in e&&(H=!0,R.accept||R.Accept||(R.Accept="application/json"),"GET"!==l&&"HEAD"!==l&&(R["content-type"]||R["Content-Type"]||(R["Content-Type"]="application/json"),f=JSON.stringify(e.json))),i.onreadystatechange=t,i.onload=o,i.onerror=n,i.onprogress=function(){},i.ontimeout=n,i.open(l,p,!h,e.username,e.password),h||(i.withCredentials=!!e.withCredentials),!h&&e.timeout>0&&(d=setTimeout(function(){c=!0,i.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)},e.timeout)),i.setRequestHeader)for(u in R)R.hasOwnProperty(u)&&i.setRequestHeader(u,R[u]);else if(e.headers&&!isEmpty(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(i.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(i),i.send(f),i}function noop(){}var window=require("global/window"),once=require("once"),isFunction=require("is-function"),parseHeaders=require("parse-headers"),xtend=require("xtend");module.exports=createXHR,createXHR.XMLHttpRequest=window.XMLHttpRequest||noop,createXHR.XDomainRequest="withCredentials"in new createXHR.XMLHttpRequest?createXHR.XMLHttpRequest:window.XDomainRequest,forEachArray(["get","put","post","patch","head","delete"],function(e){createXHR["delete"===e?"del":e]=function(t,r,n){return r=initParams(t,r,n),r.method=e.toUpperCase(),_createXHR(r)}});
},{"global/window":13,"is-function":14,"once":15,"parse-headers":18,"xtend":19}],13:[function(require,module,exports){
(function (global){
"use strict";"undefined"!=typeof window?module.exports=window:"undefined"!=typeof global?module.exports=global:"undefined"!=typeof self?module.exports=self:module.exports={};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],14:[function(require,module,exports){
"use strict";function isFunction(t){var o=toString.call(t);return"[object Function]"===o||"function"==typeof t&&"[object RegExp]"!==o||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}module.exports=isFunction;var toString=Object.prototype.toString;
},{}],15:[function(require,module,exports){
"use strict";function once(n){var e=!1;return function(){return e?void 0:(e=!0,n.apply(this,arguments))}}module.exports=once,once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0})});
},{}],16:[function(require,module,exports){
"use strict";function forEach(r,t,o){if(!isFunction(t))throw new TypeError("iterator must be a function");arguments.length<3&&(o=this),"[object Array]"===toString.call(r)?forEachArray(r,t,o):"string"==typeof r?forEachString(r,t,o):forEachObject(r,t,o)}function forEachArray(r,t,o){for(var n=0,a=r.length;a>n;n++)hasOwnProperty.call(r,n)&&t.call(o,r[n],n,r)}function forEachString(r,t,o){for(var n=0,a=r.length;a>n;n++)t.call(o,r.charAt(n),n,r)}function forEachObject(r,t,o){for(var n in r)hasOwnProperty.call(r,n)&&t.call(o,r[n],n,r)}var isFunction=require("is-function");module.exports=forEach;var toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty;
},{"is-function":14}],17:[function(require,module,exports){
"use strict";function trim(r){return r.replace(/^\s*|\s*$/g,"")}exports=module.exports=trim,exports.left=function(r){return r.replace(/^\s*/,"")},exports.right=function(r){return r.replace(/\s*$/,"")};
},{}],18:[function(require,module,exports){
"use strict";var trim=require("trim"),forEach=require("for-each"),isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)};module.exports=function(r){if(!r)return{};var t={};return forEach(trim(r).split("\n"),function(r){var e=r.indexOf(":"),i=trim(r.slice(0,e)).toLowerCase(),o=trim(r.slice(e+1));"undefined"==typeof t[i]?t[i]=o:isArray(t[i])?t[i].push(o):t[i]=[t[i],o]}),t};
},{"for-each":16,"trim":17}],19:[function(require,module,exports){
"use strict";function extend(){for(var r={},e=0;e<arguments.length;e++){var t=arguments[e];for(var n in t)hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r}module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;
},{}],20:[function(require,module,exports){
"use strict";function aqlQuery(e){for(var r={},o=e[0],t=arguments.length,n=Array(t>1?t-1:0),a=1;t>a;a++)n[a-1]=arguments[a];for(var l=0;l<n.length;l++){var u=n[l],c="value"+l;(u instanceof _collection._BaseCollection||u&&u.constructor&&"ArangoCollection"===u.constructor.name)&&(c="@"+c,u="function"==typeof u.name?u.name():u.name),r[c]=u,o+="@"+c+e[l+1]}return{query:o,bindVars:r}}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=aqlQuery;var _collection=require("./collection");module.exports=exports["default"];
},{"./collection":21}],21:[function(require,module,exports){
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function construct(e,t){var n=t.type===types.EDGE_COLLECTION?EdgeCollection:DocumentCollection;return new n(e,t.name)}Object.defineProperty(exports,"__esModule",{value:!0});var _get2=function(e,t,n){for(var i=!0;i;){var o=e,r=t,c=n;i=!1,null===o&&(o=Function.prototype);var u=Object.getOwnPropertyDescriptor(o,r);if(void 0!==u){if("value"in u)return u.value;var l=u.get;if(void 0===l)return;return l.call(c)}var a=Object.getPrototypeOf(o);if(null===a)return;e=a,t=r,n=c,i=!0,u=a=void 0}},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();exports["default"]=construct;var _cursor=require("./cursor"),_cursor2=_interopRequireDefault(_cursor),types={DOCUMENT_COLLECTION:2,EDGE_COLLECTION:3};exports.types=types;var BaseCollection=function(){function e(t,n){_classCallCheck(this,e),this.name=n,this._connection=t,this._api=this._connection.route("_api")}return _createClass(e,[{key:"_documentHandle",value:function(e){return e._id?e=e._id:e._key&&(e=e._key),-1===e.indexOf("/")&&(e=this.name+"/"+e),e}},{key:"_indexHandle",value:function(e){return e.id&&(e=e.id),-1===e.indexOf("/")&&(e=this.name+"/"+e),e}},{key:"_get",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.get("collection/"+this.name+"/"+e,t,function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"_put",value:function(e,t,n){var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.put("collection/"+this.name+"/"+e,t,function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"get",value:function(e){var t=this._connection.promisify(e),n=t.promise,i=t.callback;return this._api.get("collection/"+this.name,function(e,t){return e?i(e):i(null,t.body)}),n}},{key:"create",value:function(e,t){"function"==typeof e&&(t=e,e=void 0);var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.post("collection",_extends({},e,{name:this.name,type:this.type}),function(e,t){return e?o(e):o(null,t.body)}),i}},{key:"properties",value:function(e){return this._get("properties",e)}},{key:"count",value:function(e){return this._get("count",e)}},{key:"figures",value:function(e){return this._get("figures",e)}},{key:"revision",value:function(e){return this._get("revision",e)}},{key:"checksum",value:function(e,t){return this._get("checksum",e,t)}},{key:"load",value:function(e,t){return"function"==typeof e&&(t=e,e=void 0),this._put("load","boolean"==typeof e?{count:e}:void 0,t)}},{key:"unload",value:function(e){return this._put("unload",void 0,e)}},{key:"setProperties",value:function(e,t){return this._put("properties",e,t)}},{key:"rename",value:function(e,t){var n=this,i=this._connection.promisify(t),o=i.promise,r=i.callback;return this._api.put("collection/"+this.name+"/rename",{name:e},function(t,i){t?r(t):(n.name=e,r(null,i.body))}),o}},{key:"rotate",value:function(e){return this._put("rotate",void 0,e)}},{key:"truncate",value:function(e){return this._put("truncate",void 0,e)}},{key:"drop",value:function(e){var t=this._connection.promisify(e),n=t.promise,i=t.callback;return this._api["delete"]("collection/"+this.name,function(e,t){return e?i(e):i(null,t.body)}),n}},{key:"replace",value:function(e,t,n,i){"function"==typeof n&&(i=n,n=void 0);var o=this._connection.promisify(i),r=o.promise,c=o.callback;return this._api.put(this._documentPath(e),t,_extends({},n,{collection:this.name}),function(e,t){return e?c(e):c(null,t.body)}),r}},{key:"update",value:function(e,t,n,i){"function"==typeof n&&(i=n,n=void 0);var o=this._connection.promisify(i),r=o.promise,c=o.callback;return this._api.patch(this._documentPath(e),t,_extends({},n,{collection:this.name}),function(e,t){return e?c(e):c(null,t.body)}),r}},{key:"remove",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api["delete"](this._documentPath(e),_extends({},t,{collection:this.name}),function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"list",value:function(e,t){"function"==typeof e&&(t=e,e=void 0),e||(e="id");var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.get("document",{type:e,collection:this.name},function(e,t){return e?o(e):o(null,t.body.documents)}),i}},{key:"all",value:function(e,t){var n=this;"function"==typeof e&&(t=e,e=void 0);var i=this._connection.promisify(t),o=i.promise,r=i.callback;return this._api.put("simple/all",_extends({},e,{collection:this.name}),function(e,t){return e?r(e):r(null,new _cursor2["default"](n._connection,t.body))}),o}},{key:"any",value:function(e){var t=this._connection.promisify(e),n=t.promise,i=t.callback;return this._api.put("simple/any",{collection:this.name},function(e,t){return e?i(e):i(null,t.body.document)}),n}},{key:"first",value:function(e,t){"function"==typeof e&&(t=e,e=void 0),"number"==typeof e&&(e={count:e});var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.put("simple/first",_extends({},e,{collection:this.name}),function(e,t){return e?o(e):o(null,t.body.result)}),i}},{key:"last",value:function(e,t){"function"==typeof e&&(t=e,e=void 0),"number"==typeof e&&(e={count:e});var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.put("simple/last",_extends({},e,{collection:this.name}),function(e,t){return e?o(e):o(null,t.body.result)}),i}},{key:"byExample",value:function(e,t,n){var i=this;"function"==typeof t&&(n=t,t=void 0);var o=this._connection.promisify(n),r=o.promise,c=o.callback;return this._api.put("simple/by-example",_extends({},t,{example:e,collection:this.name}),function(e,t){return e?c(e):c(null,new _cursor2["default"](i._connection,t.body))}),r}},{key:"firstExample",value:function(e,t){var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.put("simple/first-example",{example:e,collection:this.name},function(e,t){return e?o(e):o(null,t.body.document)}),i}},{key:"removeByExample",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.put("simple/remove-by-example",_extends({},t,{example:e,collection:this.name}),function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"replaceByExample",value:function(e,t,n,i){"function"==typeof n&&(i=n,n=void 0);var o=this._connection.promisify(i),r=o.promise,c=o.callback;return this._api.put("simple/replace-by-example",_extends({},n,{example:e,newValue:t,collection:this.name}),function(e,t){return e?c(e):c(null,t.body)}),r}},{key:"updateByExample",value:function(e,t,n,i){"function"==typeof n&&(i=n,n=void 0);var o=this._connection.promisify(i),r=o.promise,c=o.callback;return this._api.put("simple/update-by-example",_extends({},n,{example:e,newValue:t,collection:this.name}),function(e,t){return e?c(e):c(null,t.body)}),r}},{key:"lookupByKeys",value:function(e,t){var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.put("simple/lookup-by-keys",{keys:e,collection:this.name},function(e,t){return e?o(e):o(null,t.body.documents)}),i}},{key:"removeByKeys",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.put("simple/remove-by-keys",_extends({},t,{keys:e,collection:this.name}),function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"import",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.request({method:"POST",path:"import",body:e,ld:Boolean(!t||"array"!==t.type),qs:_extends({type:"auto"},t,{collection:this.name})},function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"indexes",value:function(e){var t=this._connection.promisify(e),n=t.promise,i=t.callback;return this._api.get("index",{collection:this.name},function(e,t){return e?i(e):i(null,t.body.indexes)}),n}},{key:"index",value:function(e,t){var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.get("index/"+this._indexHandle(e),function(e,t){return e?o(e):o(null,t.body)}),i}},{key:"createIndex",value:function(e,t){var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.post("index",e,{collection:this.name},function(e,t){return e?o(e):o(null,t.body)}),i}},{key:"dropIndex",value:function(e,t){var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api["delete"]("index/"+this._indexHandle(e),function(e,t){return e?o(e):o(null,t.body)}),i}},{key:"createCapConstraint",value:function(e,t){"number"==typeof e&&(e={size:e});var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.post("index",_extends({},e,{type:"cap"}),{collection:this.name},function(e,t){return e?o(e):o(null,t.body)}),i}},{key:"createHashIndex",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0),"string"==typeof e&&(e=[e]),"boolean"==typeof t&&(t={unique:t});var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.post("index",_extends({unique:!1},t,{type:"hash",fields:e}),{collection:this.name},function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"createSkipList",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0),"string"==typeof e&&(e=[e]),"boolean"==typeof t&&(t={unique:t});var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.post("index",_extends({unique:!1},t,{type:"skiplist",fields:e}),{collection:this.name},function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"createGeoIndex",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0),"string"==typeof e&&(e=[e]);var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.post("index",_extends({},t,{fields:e,type:"geo"}),{collection:this.name},function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"createFulltextIndex",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0),"string"==typeof e&&(e=[e]),t&&(t=Number(t));var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.post("index",{fields:e,minLength:t,type:"fulltext"},{collection:this.name},function(e,t){return e?r(e):r(null,t.body)}),o}},{key:"fulltext",value:function(e,t,n,i){var o=this;"function"==typeof n&&(i=n,n=void 0),n||(n={}),n.index&&(n.index=this._indexHandle(n.index));var r=this._connection.promisify(i),c=r.promise,u=r.callback;return this._api.put("simple/fulltext",_extends({},n,{attribute:e,query:t,collection:this.name}),function(e,t){return e?u(e):u(null,new _cursor2["default"](o._connection,t.body))}),c}}]),e}(),DocumentCollection=function(e){function t(){_classCallCheck(this,t);for(var e=arguments.length,n=Array(e),i=0;e>i;i++)n[i]=arguments[i];_get2(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,n),this.type=types.DOCUMENT_COLLECTION}return _inherits(t,e),_createClass(t,[{key:"_documentPath",value:function(e){return"document/"+this._documentHandle(e)}},{key:"document",value:function(e,t){var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.get("document/"+this._documentHandle(e),function(e,t){return e?o(e):o(null,t.body)}),i}},{key:"save",value:function(e,t){var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.post("document",e,{collection:this.name},function(e,t){return e?o(e):o(null,t.body)}),i}}]),t}(BaseCollection),EdgeCollection=function(e){function t(){_classCallCheck(this,t);for(var e=arguments.length,n=Array(e),i=0;e>i;i++)n[i]=arguments[i];_get2(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,n),this.type=types.EDGE_COLLECTION}return _inherits(t,e),_createClass(t,[{key:"_documentPath",value:function(e){return"edge/"+this._documentHandle(e)}},{key:"edge",value:function(e,t){var n=this._connection.promisify(t),i=n.promise,o=n.callback;return this._api.get("edge/"+this._documentHandle(e),function(e,t){return e?o(e):o(null,t.body)}),i}},{key:"save",value:function(e,t,n,i){"function"==typeof t?(i=t,t=void 0):t&&(e._from=this._documentHandle(t),e._to=this._documentHandle(n));var o=this._connection.promisify(i),r=o.promise,c=o.callback;return this._api.post("edge",e,{collection:this.name,from:e._from,to:e._to},function(e,t){return e?c(e):c(null,t.body)}),r}},{key:"_edges",value:function(e,t,n){var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.get("edges/"+this.name,{direction:t,vertex:this._documentHandle(e)},function(e,t){return e?r(e):r(null,t.body.edges)}),o}},{key:"edges",value:function(e,t){return this._edges(e,void 0,t)}},{key:"inEdges",value:function(e,t){return this._edges(e,"in",t)}},{key:"outEdges",value:function(e,t){return this._edges(e,"out",t)}},{key:"traversal",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var i=this._connection.promisify(n),o=i.promise,r=i.callback;return this._api.post("traversal",_extends({},t,{startVertex:e,edgeCollection:this.name}),function(e,t){return e?r(e):r(null,t.body.result)}),o}}]),t}(BaseCollection);exports.EdgeCollection=EdgeCollection,exports.DocumentCollection=DocumentCollection,exports._BaseCollection=BaseCollection,exports._types=types;
},{"./cursor":23}],22:[function(require,module,exports){
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_utilPromisify=require("./util/promisify"),_utilPromisify2=_interopRequireDefault(_utilPromisify),_httpErrors=require("http-errors"),_httpErrors2=_interopRequireDefault(_httpErrors),_querystring=require("querystring"),_querystring2=_interopRequireDefault(_querystring),_utilRequest=require("./util/request"),_utilRequest2=_interopRequireDefault(_utilRequest),_utilByteLength=require("./util/byte-length"),_utilByteLength2=_interopRequireDefault(_utilByteLength),_error=require("./error"),_error2=_interopRequireDefault(_error),_route=require("./route"),_route2=_interopRequireDefault(_route),MIME_JSON=/\/(json|javascript)(\W|$)/,Connection=function(){function e(t){_classCallCheck(this,e),"string"==typeof t&&(t={url:t}),this.config=_extends({},e.defaults,t),this.config.agentOptions=_extends({},e.agentDefaults,this.config.agentOptions),this.config.headers||(this.config.headers={}),this.config.headers["x-arango-version"]||(this.config.headers["x-arango-version"]=this.config.arangoVersion),this._request=(0,_utilRequest2["default"])(this.config.url,this.config.agentOptions,this.config.agent),this.promisify=(0,_utilPromisify2["default"])(this.config.promise)}return _createClass(e,[{key:"_resolveUrl",value:function(e){var t={pathname:""};return e.absolutePath||(t.pathname=t.pathname+"/_db/"+this.config.databaseName,e.basePath&&(t.pathname=t.pathname+"/"+e.basePath)),t.pathname+=e.path?("/"===e.path.charAt(0)?"":"/")+e.path:"",e.qs&&(t.search="?"+("string"==typeof e.qs?e.qs:_querystring2["default"].stringify(e.qs))),t}},{key:"route",value:function(e,t){return new _route2["default"](this,e,t)}},{key:"request",value:function(e,t){var r=this.promisify(t),n=r.promise,o=r.callback,i={"content-type":"text/plain"};e||(e={});var s=e.body;return s&&("object"==typeof s?e.ld?(s=s.map(function(e){return JSON.stringify(e)}).join("\r\n")+"\r\n",i["content-type"]="application/x-ldjson"):(s=JSON.stringify(s),i["content-type"]="application/json"):s=String(s)),i["content-length"]=s?(0,_utilByteLength2["default"])(s,"utf-8"):0,this._request({url:this._resolveUrl(e),headers:_extends({},i,this.config.headers,e.headers),method:(e.method||"get").toUpperCase(),body:s},function(e,t){if(e)o(e);else{if(t.rawBody=t.body,t.headers["content-type"].match(MIME_JSON))try{t.body=JSON.parse(t.rawBody)}catch(r){return r.response=t,o(r)}t.body&&t.body.error&&t.body.hasOwnProperty("code")&&t.body.hasOwnProperty("errorMessage")&&t.body.hasOwnProperty("errorNum")?(e=new _error2["default"](t.body),e.response=t,o(e)):t.statusCode>=400?(e=(0,_httpErrors2["default"])(t.statusCode),e.response=t,o(e)):o(null,t)}}),n}}]),e}();exports["default"]=Connection,Connection.defaults={url:"http://localhost:8529",databaseName:"_system",arangoVersion:20300},Connection.agentDefaults={maxSockets:3,keepAlive:!0,keepAliveMsecs:1e3},module.exports=exports["default"];
},{"./error":25,"./route":28,"./util/byte-length":11,"./util/promisify":30,"./util/request":31,"http-errors":7,"querystring":4}],23:[function(require,module,exports){
"use strict";function _toConsumableArray(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function t(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(r,e,n){return e&&t(r.prototype,e),n&&t(r,n),r}}(),ArrayCursor=function(){function t(r,e){_classCallCheck(this,t),this.extra=e.extra,this._connection=r,this._api=this._connection.route("_api"),this._result=e.result,this._hasMore=Boolean(e.hasMore),this._id=e.id,this.count=e.count}return _createClass(t,[{key:"_drain",value:function(t){var r=this,e=this._connection.promisify(t),n=e.promise,i=e.callback;return this._more(function(e){return e?i(e):r._hasMore?r._drain(t):i(null,r)}),n}},{key:"_more",value:function(t){var r=this;this._hasMore?this._api.put("cursor/"+this._id,function(e,n){if(e)t(e);else{var i;(i=r._result).push.apply(i,_toConsumableArray(n.body.result)),r._hasMore=n.body.hasMore,t(null,r)}}):t(null,this)}},{key:"all",value:function(t){var r=this,e=this._connection.promisify(t),n=e.promise,i=e.callback;return this._drain(function(t){if(t)i(t);else{for(var e=[];r._result.length;)e.push(r._result.shift());i(null,e)}}),n}},{key:"next",value:function r(t){var e=this,n=this._connection.promisify(t),i=n.promise,o=n.callback,r=function(){var t=e._result.shift();o(null,t)};return this._result.length?r():this._hasMore?this._more(function(t){return t?o(t):r()}):o(null),i}},{key:"hasNext",value:function(){return Boolean(this._hasMore||this._result.length)}},{key:"each",value:function(t,r){var e=this,n=this._connection.promisify(r),i=n.promise,o=n.callback,s=0,u=function a(){try{for(var r=void 0;e._result.length&&(r=t(e._result.shift(),s,e),s++,r!==!1););e._hasMore&&r!==!1?e._more(function(t){return t?o(t):a()}):o(null,r)}catch(n){o(n)}};return u(),i}},{key:"every",value:function(t,r){var e=this,n=this._connection.promisify(r),i=n.promise,o=n.callback,s=0,u=function a(){try{for(var r=!0;e._result.length&&(r=t(e._result.shift(),s,e),s++,r););e._hasMore&&r?e._more(function(t){return t?o(t):a()}):o(null,Boolean(r))}catch(n){o(n)}};return u(),i}},{key:"some",value:function(t,r){var e=this,n=this._connection.promisify(r),i=n.promise,o=n.callback,s=0,u=function a(){try{for(var r=!1;e._result.length&&(r=t(e._result.shift(),s,e),s++,!r););!e._hasMore||r?o(null,Boolean(r)):e._more(function(t){return t?o(t):a()})}catch(n){o(n)}};return u(),i}},{key:"map",value:function(t,r){var e=this,n=this._connection.promisify(r),i=n.promise,o=n.callback,s=0,u=[],a=function l(){try{for(;e._result.length;)u.push(t(e._result.shift(),s,e)),s++;e._hasMore?e._more(function(t){return t?o(t):l()}):o(null,u)}catch(r){o(r)}};return a(),i}},{key:"reduce",value:function(t,r,e){var n=this;"function"==typeof r&&(e=r,r=void 0);var i=0,o=this._connection.promisify(e),s=o.promise,u=o.callback,a=function l(){try{for(;n._result.length;)r=t(r,n._result.shift(),i,n),i++;n._hasMore?n._more(function(t){return t?u(t):l()}):u(null,r)}catch(e){u(e)}};return void 0!==r?a():this._result.length>1?(r=this._result.shift(),i=1,a()):this._more(function(t){t?u(t):(r=n._result.shift(),i=1,a())}),s}}]),t}();exports["default"]=ArrayCursor,module.exports=exports["default"];
},{}],24:[function(require,module,exports){
"use strict";function _interopRequireDefault(n){return n&&n.__esModule?n:{"default":n}}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},_createClass=function(){function n(n,t){for(var e=0;e<t.length;e++){var o=t[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),t}}(),_utilAll=require("./util/all"),_utilAll2=_interopRequireDefault(_utilAll),_connection=require("./connection"),_connection2=_interopRequireDefault(_connection),_cursor=require("./cursor"),_cursor2=_interopRequireDefault(_cursor),_graph=require("./graph"),_graph2=_interopRequireDefault(_graph),_collection=require("./collection"),_collection2=_interopRequireDefault(_collection),Database=function(){function n(t){_classCallCheck(this,n),this._connection=new _connection2["default"](t),this._api=this._connection.route("_api"),this.name=this._connection.config.databaseName}return _createClass(n,[{key:"route",value:function(n,t){return this._connection.route(n,t)}},{key:"useDatabase",value:function(n){return this._connection.config.databaseName=n,this.name=n,this}},{key:"get",value:function(n){var t=this._connection.promisify(n),e=t.promise,o=t.callback;return this._api.get("database/current",function(n,t){return n?o(n):o(null,t.body.result)}),e}},{key:"createDatabase",value:function(n,t,e){"function"==typeof t&&(e=t,t=void 0);var o=this._connection.promisify(e),i=o.promise,r=o.callback;return this._api.post("database",{users:t,name:n},function(n,t){return n?r(n):r(null,t.body)}),i}},{key:"listDatabases",value:function(n){var t=this._connection.promisify(n),e=t.promise,o=t.callback;return this._api.get("database",function(n,t){return n?o(n):o(null,t.body.result)}),e}},{key:"listUserDatabases",value:function(n){var t=this._connection.promisify(n),e=t.promise,o=t.callback;return this._api.get("database/user",function(n,t){return n?o(n):o(null,t.body.result)}),e}},{key:"dropDatabase",value:function(n,t){var e=this._connection.promisify(t),o=e.promise,i=e.callback;return this._api["delete"]("database/"+n,function(n,t){return n?i(n):i(null,t.body)}),o}},{key:"collection",value:function(n){return new _collection.DocumentCollection(this._connection,n)}},{key:"edgeCollection",value:function(n){return new _collection.EdgeCollection(this._connection,n)}},{key:"listCollections",value:function(n,t){"function"==typeof n&&(t=n,n=void 0);var e=this._connection.promisify(t),o=e.promise,i=e.callback;return"boolean"!=typeof n&&(n=!0),this._api.get("collection",{excludeSystem:n},function(n,t){return n?i(n):i(null,t.body.collections)}),o}},{key:"collections",value:function(n,t){var e=this,o=this._connection.promisify(t),i=o.promise,r=o.callback;return this.listCollections(n,function(n,t){return n?r(n):r(null,t.map(function(n){return(0,_collection2["default"])(e._connection,n)}))}),i}},{key:"truncate",value:function(n,t){var e=this;"function"==typeof n&&(t=n,n=void 0);var o=this._connection.promisify(t),i=o.promise,r=o.callback;return this.listCollections(n,function(n,t){return n?r(n):(0,_utilAll2["default"])(t.map(function(n){return function(t){return e._api.put("collection/"+n.name+"/truncate",function(n,e){return n?t(n):t(null,e.body)})}}),r)}),i}},{key:"graph",value:function(n){return new _graph2["default"](this._connection,n)}},{key:"listGraphs",value:function(n){var t=this._connection.promisify(n),e=t.promise,o=t.callback;return this._api.get("gharial",function(n,t){return n?o(n):o(null,t.body.graphs)}),e}},{key:"graphs",value:function(n){var t=this,e=this._connection.promisify(n),o=e.promise,i=e.callback;return this.listGraphs(function(n,e){return n?i(n):i(null,e.map(function(n){return t.graph(n._key)}))}),o}},{key:"transaction",value:function(n,t,e,o,i){"function"==typeof o&&(i=o,o=void 0),"function"==typeof e&&(i=e,e=void 0),"number"==typeof e&&(o=e,e=void 0),("string"==typeof n||Array.isArray(n))&&(n={write:n});var r=this._connection.promisify(i),c=r.promise,a=r.callback;return this._api.post("transaction",{collections:n,action:t,params:e,lockTimeout:o},function(n,t){return n?a(n):a(null,t.body.result)}),c}},{key:"query",value:function(n,t,e,o){var i=this;"function"==typeof e&&(o=e,e=void 0),"function"==typeof t&&(o=t,t=void 0);var r=this._connection.promisify(o),c=r.promise,a=r.callback;return n&&n.query&&(e||(e=t),t=n.bindVars,n=n.query),n&&"function"==typeof n.toAQL&&(n=n.toAQL()),this._api.post("cursor",_extends({},e,{query:n,bindVars:t}),function(n,t){return n?a(n):a(null,new _cursor2["default"](i._connection,t.body))}),c}},{key:"listFunctions",value:function(n){var t=this._connection.promisify(n),e=t.promise,o=t.callback;return this._api.get("aqlfunction",function(n,t){return n?o(n):o(null,t.body)}),e}},{key:"createFunction",value:function(n,t,e){var o=this._connection.promisify(e),i=o.promise,r=o.callback;return this._api.post("aqlfunction",{name:n,code:t},function(n,t){return n?r(n):r(null,t.body)}),i}},{key:"dropFunction",value:function(n,t,e){"function"==typeof t&&(e=t,t=void 0);var o=this._connection.promisify(e),i=o.promise,r=o.callback;return this._api["delete"]("aqlfunction/"+n,{group:Boolean(t)},function(n,t){return n?r(n):r(null,t.body)}),i}}]),n}();exports["default"]=Database,module.exports=exports["default"];
},{"./collection":21,"./connection":22,"./cursor":23,"./graph":26,"./util/all":29}],25:[function(require,module,exports){
"use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(exports,"__esModule",{value:!0});var _get=function(e,r,t){for(var o=!0;o;){var n=e,i=r,s=t;o=!1,null===n&&(n=Function.prototype);var u=Object.getOwnPropertyDescriptor(n,i);if(void 0!==u){if("value"in u)return u.value;var a=u.get;if(void 0===a)return;return a.call(s)}var c=Object.getPrototypeOf(n);if(null===c)return;e=c,r=i,t=s,o=!0,u=c=void 0}},ArangoError=function(e){function r(e){_classCallCheck(this,r),_get(Object.getPrototypeOf(r.prototype),"constructor",this).call(this),this.name="ArangoError",this.message=e.errorMessage,this.errorNum=e.errorNum,this.code=e.code;var t=new Error(this.message);t.name=this.name,t.fileName&&(this.fileName=t.fileName),t.lineNumber&&(this.lineNumber=t.lineNumber),t.columnNumber&&(this.columnNumber=t.columnNumber),t.stack&&(this.stack=t.stack),t.description&&(this.description=t.description),t.number&&(this.number=t.number)}return _inherits(r,e),r}(Error);exports["default"]=ArangoError,module.exports=exports["default"];
},{}],26:[function(require,module,exports){
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),_get=function(e,t,n){for(var o=!0;o;){var i=e,r=t,a=n;o=!1,null===i&&(i=Function.prototype);var l=Object.getOwnPropertyDescriptor(i,r);if(void 0!==l){if("value"in l)return l.value;var c=l.get;if(void 0===c)return;return c.call(a)}var u=Object.getPrototypeOf(i);if(null===u)return;e=u,t=r,n=a,o=!0,l=u=void 0}},_collection=require("./collection"),GraphVertexCollection=function(e){function t(e,n,o){_classCallCheck(this,t),_get(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,n),this.type=_collection._types.DOCUMENT_COLLECTION,this.graph=o,this._gharial=this._api.route("gharial/"+this.graph.name+"/vertex")}return _inherits(t,e),_createClass(t,[{key:"_documentPath",value:function(e){return"document/"+this._documentHandle(e)}},{key:"remove",value:function(e,t){var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._gharial["delete"](this._documentHandle(e),function(e,t){return e?i(e):i(null,t.body)}),o}},{key:"vertex",value:function(e,t){var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._gharial.get(this._documentHandle(e),function(e,t){return e?i(e):i(null,t.body)}),o}},{key:"save",value:function(e,t){var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._gharial.post(this.name,e,function(e,t){return e?i(e):i(null,t.body)}),o}}]),t}(_collection._BaseCollection),GraphEdgeCollection=function(e){function t(e,n,o){_classCallCheck(this,t),_get(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,n),this.type=_collection._types.EDGE_COLLECTION,this.graph=o,this._gharial=this._api.route("gharial/"+this.graph.name+"/edge")}return _inherits(t,e),_createClass(t,[{key:"remove",value:function(e,t){var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._gharial["delete"](this._documentHandle(e),function(e,t){return e?i(e):i(null,t.body)}),o}},{key:"edge",value:function(e,t){var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._gharial.get(this._documentHandle(e),function(e,t){return e?i(e):i(null,t.body)}),o}},{key:"save",value:function(e,t,n,o){"function"==typeof t?(o=t,t=void 0):t&&(e._from=this._documentHandle(t),e._to=this._documentHandle(n));var i=this._connection.promisify(o),r=i.promise,a=i.callback;return this._gharial.post(this.name,e,function(e,t){return e?a(e):a(null,t.body)}),r}}]),t}(_collection.EdgeCollection),Graph=function(){function e(t,n){_classCallCheck(this,e),this.name=n,this._connection=t,this._api=this._connection.route("_api"),this._gharial=this._api.route("gharial/"+this.name)}return _createClass(e,[{key:"get",value:function(e){var t=this._connection.promisify(e),n=t.promise,o=t.callback;return this._gharial.get(function(e,t){return e?o(e):o(null,t.body.graph)}),n}},{key:"create",value:function(e,t){"function"==typeof e&&(t=e,e=void 0);var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._api.post("gharial",_extends({},e,{name:this.name}),function(e,t){return e?i(e):i(null,t.body.graph)}),o}},{key:"drop",value:function(e,t){"function"==typeof e&&(t=e,e=void 0),"boolean"!=typeof e&&(e=!1);var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._gharial["delete"]({dropCollections:e},function(e,t){return e?i(e):i(null,t.body)}),o}},{key:"vertexCollection",value:function(e){return new GraphVertexCollection(this._connection,e,this)}},{key:"addVertexCollection",value:function(e,t){var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._gharial.post("vertex",{collection:e},function(e,t){return e?i(e):i(null,t.body.graph)}),o}},{key:"removeVertexCollection",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var o=this._connection.promisify(n),i=o.promise,r=o.callback;return"boolean"!=typeof t&&(t=!1),this._gharial["delete"]("vertex/"+e,{dropCollection:t},function(e,t){return e?r(e):r(null,t.body.graph)}),i}},{key:"edgeCollection",value:function(e){return new GraphEdgeCollection(this._connection,e,this)}},{key:"addEdgeDefinition",value:function(e,t){var n=this._connection.promisify(t),o=n.promise,i=n.callback;return this._gharial.post("edge",e,function(e,t){return e?i(e):i(null,t.body.graph)}),o}},{key:"replaceEdgeDefinition",value:function(e,t,n){var o=this._connection.promisify(n),i=o.promise,r=o.callback;return this._api.put("gharial/"+this.name+"/edge/"+e,t,function(e,t){return e?r(e):r(null,t.body.graph)}),i}},{key:"removeEdgeDefinition",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var o=this._connection.promisify(n),i=o.promise,r=o.callback;return"boolean"!=typeof t&&(t=!1),this._gharial["delete"]("edge/"+e,{dropCollection:t},function(e,t){return e?r(e):r(null,t.body.graph)}),i}},{key:"traversal",value:function(e,t,n){"function"==typeof t&&(n=t,t=void 0);var o=this._connection.promisify(n),i=o.promise,r=o.callback;return this._api.post("traversal",_extends({},t,{startVertex:e,graphName:this.name}),function(e,t){return e?r(e):r(null,t.body.result)}),i}}]),e}();exports["default"]=Graph,exports.VertexCollection=GraphVertexCollection,exports.EdgeCollection=GraphEdgeCollection;
},{"./collection":21}],27:[function(require,module,exports){
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}var _bind=Function.prototype.bind,_database=require("./database"),_database2=_interopRequireDefault(_database),_aqlQuery=require("./aql-query"),_aqlQuery2=_interopRequireDefault(_aqlQuery);module.exports=function(){for(var e=arguments.length,a=Array(e),t=0;e>t;t++)a[t]=arguments[t];return new(_bind.apply(_database2["default"],[null].concat(a)))},module.exports.Database=_database2["default"],module.exports.aqlQuery=_aqlQuery2["default"];
},{"./aql-query":20,"./database":24}],28:[function(require,module,exports){
"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),Route=function(){function t(e,n,o){_classCallCheck(this,t),this._connection=e,this._path=n||"",this._headers=o}return _createClass(t,[{key:"route",value:function(e,n){return e?"/"!==e.charAt(0)&&(e="/"+e):e="",new t(this._connection,this._path+e,_extends({},this._headers,n))}},{key:"request",value:function(t,e){return t=_extends({},t),t.basePath=this._path,t.headers=_extends({},this._headers,t.headers),this._connection.request(t,e)}},{key:"get",value:function(t,e,n){return"string"!=typeof t&&(n=e,e=t,t=void 0),"function"==typeof e&&(n=e,e=void 0),t?this._path&&"/"!==t.charAt(0)&&(t="/"+t):t="",this.request({path:t,qs:e,method:"get"},n)}},{key:"post",value:function(t,e,n,o){return"string"!=typeof t&&(o=n,n=e,e=t,t=void 0),"function"==typeof n&&(o=n,n=void 0),"function"==typeof e&&(o=e,e=void 0),t?this._path&&"/"!==t.charAt(0)&&(t="/"+t):t="",this.request({path:t,body:e,qs:n,method:"post"},o)}},{key:"put",value:function(t,e,n,o){return"string"!=typeof t&&(o=e,e=n,n=t,t=void 0),"function"==typeof n&&(o=n,n=void 0),"function"==typeof e&&(o=e,e=void 0),t?this._path&&"/"!==t.charAt(0)&&(t="/"+t):t="",this.request({path:t,body:e,qs:n,method:"put"},o)}},{key:"patch",value:function(t,e,n,o){return"string"!=typeof t&&(o=e,e=n,n=t,t=void 0),"function"==typeof n&&(o=n,n=void 0),"function"==typeof e&&(o=e,e=void 0),t?this._path&&"/"!==t.charAt(0)&&(t="/"+t):t="",this.request({path:t,body:e,qs:n,method:"patch"},o)}},{key:"delete",value:function(t,e,n){return"string"!=typeof t&&(n=e,e=t,t=void 0),"function"==typeof e&&(n=e,e=void 0),t?this._path&&"/"!==t.charAt(0)&&(t="/"+t):t="",this.request({path:t,qs:e,method:"delete"},n)}},{key:"head",value:function(t,e,n){return"string"!=typeof t&&(n=e,e=t,t=void 0),"function"==typeof e&&(n=e,e=void 0),t?this._path&&"/"!==t.charAt(0)&&(t="/"+t):t="",this.request({path:t,qs:e,method:"head"},n)}}]),t}();exports["default"]=Route,module.exports=exports["default"];
},{}],29:[function(require,module,exports){
"use strict";function all(e,t){var n=[],r=e.length,u=!1;if(0===e.length)return t(null,n);var l=function(e){return function(l,o){if(r-=1,l||(n[e]=o),!u){if(l)t(l);else{if(0!==r)return;n.every(function(e){return void 0===e})?t(null):t(null,n)}u=!0}}};e.forEach(function(e,t){return e(l(t))})}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=all,module.exports=exports["default"];
},{}],30:[function(require,module,exports){
(function (global){
"use strict";function promisify(o){return o===!1?function(o){return{callback:o||noop}}:function(e){function n(o,n){e=function(e,r){e?n(e):o(r)}}if(e||!o&&!global.Promise)return{callback:e||noop};var r=o?new o(n):new global.Promise(n);return{callback:e,promise:r}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=promisify;var noop=function(){};module.exports=exports["default"];
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],31:[function(require,module,exports){
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function joinPath(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0],t=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(!e&&!t)return"";for(var r="/"===e.charAt(0),a="/"===t.charAt(t.length-1),n=(e+"/"+t).split("/").filter(Boolean),u=0;u<n.length;u++){var s=n[u];".."===s?(n.splice(u-1,2),u--):"."===s&&(n.splice(u,1),u--)}var o=n.join("/");return r&&(o="/"+o),a&&(o+="/"),o}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},_xhr=require("xhr"),_xhr2=_interopRequireDefault(_xhr),_url=require("url");exports["default"]=function(e,t){function r(){if(o.length&&!(i>=h)){var e=o.shift();i+=1,e(function(){i-=1,r()})}}t||(t={});var a=(0,_url.parse)(e),n=a.auth?a.auth.indexOf(":"):-1,u=-1!==n?a.auth.slice(0,n):a.auth||void 0,s=-1!==n?a.auth.slice(n+1):a.auth?"":void 0;delete a.auth;var o=[],h="number"==typeof t.maxSockets?2*t.maxSockets:1/0,i=0;return function(e,n){var h=e.method,i=e.url,l=e.headers,c=e.body,f="string"==typeof u?{username:u,password:s}:{},p=_extends({},a,{pathname:i.pathname?a.pathname?joinPath(a.pathname,i.pathname):i.pathname:a.pathname,search:i.search?a.search?a.search+"&"+i.search.slice(1):i.search:a.search});o.push(function(e){var r=function(){r=function(){},e(),n.apply(void 0,arguments)},a=(0,_xhr2["default"])(_extends({responseType:"text"},t,f,{url:(0,_url.format)(p),body:c,method:h,headers:l}),function(e,t){e?(e.request=a,r(e)):r(null,t)})}),r()}},module.exports=exports["default"];
},{"url":5,"xhr":12}]},{},[27])(27)
});