varsnap 1.6.7 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +1 -2
- package/dist/built/varsnap/core.d.ts +10 -2
- package/dist/built/varsnap/core.js +49 -9
- package/dist/varsnap.js +540 -359
- package/dist/varsnap.min.js +2 -2
- package/package.json +12 -11
package/dist/varsnap.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Varsnap.js v1.
|
|
2
|
+
* Varsnap.js v1.7.0
|
|
3
3
|
*/
|
|
4
4
|
(function(exports) {
|
|
5
5
|
!function(e) {
|
|
@@ -7,36 +7,166 @@
|
|
|
7
7
|
("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).varsnap = e();
|
|
8
8
|
}
|
|
9
9
|
}(function() {
|
|
10
|
-
var e = function(e
|
|
10
|
+
var e = function(e) {
|
|
11
|
+
var t;
|
|
12
|
+
return function(n) {
|
|
13
|
+
return t || e(t = {
|
|
14
|
+
exports: {},
|
|
15
|
+
parent: n
|
|
16
|
+
}, t.exports), t.exports;
|
|
17
|
+
};
|
|
18
|
+
}, t = e(function(e, t) {
|
|
19
|
+
(function(t) {
|
|
20
|
+
(function() {
|
|
21
|
+
"use strict";
|
|
22
|
+
var r = {
|
|
23
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
24
|
+
};
|
|
25
|
+
function o(e, t) {
|
|
26
|
+
!f.isUndefined(e) && f.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t);
|
|
27
|
+
}
|
|
28
|
+
var i, a = {
|
|
29
|
+
transitional: {
|
|
30
|
+
silentJSONParsing: !0,
|
|
31
|
+
forcedJSONParsing: !0,
|
|
32
|
+
clarifyTimeoutError: !1
|
|
33
|
+
},
|
|
34
|
+
adapter: (("undefined" != typeof XMLHttpRequest || void 0 !== t && "[object process]" === Object.prototype.toString.call(t)) && (i = n({})),
|
|
35
|
+
i),
|
|
36
|
+
transformRequest: [ function(e, t) {
|
|
37
|
+
return g(t, "Accept"), g(t, "Content-Type"), f.isFormData(e) || f.isArrayBuffer(e) || f.isBuffer(e) || f.isStream(e) || f.isFile(e) || f.isBlob(e) ? e : f.isArrayBufferView(e) ? e.buffer : f.isURLSearchParams(e) ? (o(t, "application/x-www-form-urlencoded;charset=utf-8"),
|
|
38
|
+
e.toString()) : f.isObject(e) || t && "application/json" === t["Content-Type"] ? (o(t, "application/json"),
|
|
39
|
+
function(e, t, n) {
|
|
40
|
+
if (f.isString(e)) try {
|
|
41
|
+
return (0, JSON.parse)(e), f.trim(e);
|
|
42
|
+
} catch (r) {
|
|
43
|
+
if ("SyntaxError" !== r.name) throw r;
|
|
44
|
+
}
|
|
45
|
+
return (0, JSON.stringify)(e);
|
|
46
|
+
}(e)) : e;
|
|
47
|
+
} ],
|
|
48
|
+
transformResponse: [ function(e) {
|
|
49
|
+
var t = this.transitional || a.transitional, n = t && t.silentJSONParsing, r = t && t.forcedJSONParsing, o = !n && "json" === this.responseType;
|
|
50
|
+
if (o || r && f.isString(e) && e.length) try {
|
|
51
|
+
return JSON.parse(e);
|
|
52
|
+
} catch (i) {
|
|
53
|
+
if (o) {
|
|
54
|
+
if ("SyntaxError" === i.name) throw m(i, this, "E_JSON_PARSE");
|
|
55
|
+
throw i;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return e;
|
|
59
|
+
} ],
|
|
60
|
+
timeout: 0,
|
|
61
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
62
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
63
|
+
maxContentLength: -1,
|
|
64
|
+
maxBodyLength: -1,
|
|
65
|
+
validateStatus: function(e) {
|
|
66
|
+
return e >= 200 && e < 300;
|
|
67
|
+
},
|
|
68
|
+
headers: {
|
|
69
|
+
common: {
|
|
70
|
+
Accept: "application/json, text/plain, */*"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
f.forEach([ "delete", "get", "head" ], function(e) {
|
|
75
|
+
a.headers[e] = {};
|
|
76
|
+
}), f.forEach([ "post", "put", "patch" ], function(e) {
|
|
77
|
+
a.headers[e] = f.merge(r);
|
|
78
|
+
}), e.exports = a;
|
|
79
|
+
}).call(this);
|
|
80
|
+
}).call(this, x);
|
|
81
|
+
}), n = e(function(e, n) {
|
|
82
|
+
"use strict";
|
|
83
|
+
var r = t({});
|
|
84
|
+
e.exports = function(e) {
|
|
85
|
+
return new Promise(function(t, n) {
|
|
86
|
+
var o, i = e.data, a = e.headers, s = e.responseType;
|
|
87
|
+
function u() {
|
|
88
|
+
e.cancelToken && e.cancelToken.unsubscribe(o), e.signal && e.signal.removeEventListener("abort", o);
|
|
89
|
+
}
|
|
90
|
+
f.isFormData(i) && delete a["Content-Type"];
|
|
91
|
+
var c = new XMLHttpRequest();
|
|
92
|
+
if (e.auth) {
|
|
93
|
+
var l = e.auth.username || "", d = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
|
|
94
|
+
a.Authorization = "Basic " + btoa(l + ":" + d);
|
|
95
|
+
}
|
|
96
|
+
var h = w(e.baseURL, e.url);
|
|
97
|
+
function g() {
|
|
98
|
+
if (c) {
|
|
99
|
+
var r = "getAllResponseHeaders" in c ? T(c.getAllResponseHeaders()) : null, o = {
|
|
100
|
+
data: s && "text" !== s && "json" !== s ? c.response : c.responseText,
|
|
101
|
+
status: c.status,
|
|
102
|
+
statusText: c.statusText,
|
|
103
|
+
headers: r,
|
|
104
|
+
config: e,
|
|
105
|
+
request: c
|
|
106
|
+
};
|
|
107
|
+
y(function(e) {
|
|
108
|
+
t(e), u();
|
|
109
|
+
}, function(e) {
|
|
110
|
+
n(e), u();
|
|
111
|
+
}, o), c = null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (c.open(e.method.toUpperCase(), p(h, e.params, e.paramsSerializer), !0), c.timeout = e.timeout,
|
|
115
|
+
"onloadend" in c ? c.onloadend = g : c.onreadystatechange = function() {
|
|
116
|
+
c && 4 === c.readyState && (0 !== c.status || c.responseURL && 0 === c.responseURL.indexOf("file:")) && setTimeout(g);
|
|
117
|
+
}, c.onabort = function() {
|
|
118
|
+
c && (n(v("Request aborted", e, "ECONNABORTED", c)), c = null);
|
|
119
|
+
}, c.onerror = function() {
|
|
120
|
+
n(v("Network Error", e, null, c)), c = null;
|
|
121
|
+
}, c.ontimeout = function() {
|
|
122
|
+
var t = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded", o = e.transitional || r.transitional;
|
|
123
|
+
e.timeoutErrorMessage && (t = e.timeoutErrorMessage), n(v(t, e, o.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED", c)),
|
|
124
|
+
c = null;
|
|
125
|
+
}, f.isStandardBrowserEnv()) {
|
|
126
|
+
var m = (e.withCredentials || k(h)) && e.xsrfCookieName ? b.read(e.xsrfCookieName) : void 0;
|
|
127
|
+
m && (a[e.xsrfHeaderName] = m);
|
|
128
|
+
}
|
|
129
|
+
"setRequestHeader" in c && f.forEach(a, function(e, t) {
|
|
130
|
+
void 0 === i && "content-type" === t.toLowerCase() ? delete a[t] : c.setRequestHeader(t, e);
|
|
131
|
+
}), f.isUndefined(e.withCredentials) || (c.withCredentials = !!e.withCredentials),
|
|
132
|
+
s && "json" !== s && (c.responseType = e.responseType), "function" == typeof e.onDownloadProgress && c.addEventListener("progress", e.onDownloadProgress),
|
|
133
|
+
"function" == typeof e.onUploadProgress && c.upload && c.upload.addEventListener("progress", e.onUploadProgress),
|
|
134
|
+
(e.cancelToken || e.signal) && (o = function(e) {
|
|
135
|
+
c && (n(!e || e && e.type ? new C("canceled") : e), c.abort(), c = null);
|
|
136
|
+
}, e.cancelToken && e.cancelToken.subscribe(o), e.signal && (e.signal.aborted ? o() : e.signal.addEventListener("abort", o))),
|
|
137
|
+
i || (i = null), c.send(i);
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
}), r = function(e, t) {
|
|
11
141
|
return function() {
|
|
12
142
|
for (var n = new Array(arguments.length), r = 0; r < n.length; r++) n[r] = arguments[r];
|
|
13
143
|
return e.apply(t, n);
|
|
14
144
|
};
|
|
15
|
-
},
|
|
16
|
-
function
|
|
17
|
-
return "[object Array]" ===
|
|
145
|
+
}, o = Object.prototype.toString;
|
|
146
|
+
function i(e) {
|
|
147
|
+
return "[object Array]" === o.call(e);
|
|
18
148
|
}
|
|
19
|
-
function
|
|
149
|
+
function a(e) {
|
|
20
150
|
return void 0 === e;
|
|
21
151
|
}
|
|
22
|
-
function
|
|
152
|
+
function s(e) {
|
|
23
153
|
return null !== e && "object" == typeof e;
|
|
24
154
|
}
|
|
25
|
-
function
|
|
26
|
-
if ("[object Object]" !==
|
|
27
|
-
var
|
|
28
|
-
return null ===
|
|
155
|
+
function u(e) {
|
|
156
|
+
if ("[object Object]" !== o.call(e)) return !1;
|
|
157
|
+
var t = Object.getPrototypeOf(e);
|
|
158
|
+
return null === t || t === Object.prototype;
|
|
29
159
|
}
|
|
30
|
-
function
|
|
31
|
-
if (null != e) if ("object" != typeof e && (e = [ e ]),
|
|
160
|
+
function c(e, t) {
|
|
161
|
+
if (null != e) if ("object" != typeof e && (e = [ e ]), i(e)) for (var n = 0, r = e.length; n < r; n++) t.call(null, e[n], n, e); else for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.call(null, e[o], o, e);
|
|
32
162
|
}
|
|
33
|
-
var
|
|
34
|
-
isArray:
|
|
163
|
+
var f = {
|
|
164
|
+
isArray: i,
|
|
35
165
|
isArrayBuffer: function(e) {
|
|
36
|
-
return "[object ArrayBuffer]" ===
|
|
166
|
+
return "[object ArrayBuffer]" === o.call(e);
|
|
37
167
|
},
|
|
38
168
|
isBuffer: function(e) {
|
|
39
|
-
return null !== e && !
|
|
169
|
+
return null !== e && !a(e) && null !== e.constructor && !a(e.constructor) && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e);
|
|
40
170
|
},
|
|
41
171
|
isFormData: function(e) {
|
|
42
172
|
return "undefined" != typeof FormData && e instanceof FormData;
|
|
@@ -50,21 +180,21 @@
|
|
|
50
180
|
isNumber: function(e) {
|
|
51
181
|
return "number" == typeof e;
|
|
52
182
|
},
|
|
53
|
-
isObject:
|
|
54
|
-
isPlainObject:
|
|
55
|
-
isUndefined:
|
|
183
|
+
isObject: s,
|
|
184
|
+
isPlainObject: u,
|
|
185
|
+
isUndefined: a,
|
|
56
186
|
isDate: function(e) {
|
|
57
|
-
return "[object Date]" ===
|
|
187
|
+
return "[object Date]" === o.call(e);
|
|
58
188
|
},
|
|
59
189
|
isFile: function(e) {
|
|
60
|
-
return "[object File]" ===
|
|
190
|
+
return "[object File]" === o.call(e);
|
|
61
191
|
},
|
|
62
192
|
isBlob: function(e) {
|
|
63
|
-
return "[object Blob]" ===
|
|
193
|
+
return "[object Blob]" === o.call(e);
|
|
64
194
|
},
|
|
65
195
|
isStream: function(e) {
|
|
66
|
-
return
|
|
67
|
-
return "[object Function]" ===
|
|
196
|
+
return s(e) && function(e) {
|
|
197
|
+
return "[object Function]" === o.call(e);
|
|
68
198
|
}(e.pipe);
|
|
69
199
|
},
|
|
70
200
|
isURLSearchParams: function(e) {
|
|
@@ -73,35 +203,35 @@
|
|
|
73
203
|
isStandardBrowserEnv: function() {
|
|
74
204
|
return ("undefined" == typeof navigator || "ReactNative" !== navigator.product && "NativeScript" !== navigator.product && "NS" !== navigator.product) && "undefined" != typeof window && "undefined" != typeof document;
|
|
75
205
|
},
|
|
76
|
-
forEach:
|
|
206
|
+
forEach: c,
|
|
77
207
|
merge: function e() {
|
|
78
208
|
var t = {};
|
|
79
|
-
function
|
|
80
|
-
|
|
209
|
+
function n(n, r) {
|
|
210
|
+
u(t[r]) && u(n) ? t[r] = e(t[r], n) : u(n) ? t[r] = e({}, n) : i(n) ? t[r] = n.slice() : t[r] = n;
|
|
81
211
|
}
|
|
82
|
-
for (var
|
|
212
|
+
for (var r = 0, o = arguments.length; r < o; r++) c(arguments[r], n);
|
|
83
213
|
return t;
|
|
84
214
|
},
|
|
85
|
-
extend: function(t, n
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
}),
|
|
215
|
+
extend: function(e, t, n) {
|
|
216
|
+
return c(t, function(t, o) {
|
|
217
|
+
e[o] = n && "function" == typeof t ? r(t, n) : t;
|
|
218
|
+
}), e;
|
|
89
219
|
},
|
|
90
220
|
trim: function(e) {
|
|
91
|
-
return e.
|
|
221
|
+
return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "");
|
|
92
222
|
}
|
|
93
223
|
};
|
|
94
|
-
function
|
|
224
|
+
function l(e) {
|
|
95
225
|
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
96
226
|
}
|
|
97
|
-
var
|
|
227
|
+
var p = function(e, t, n) {
|
|
98
228
|
if (!t) return e;
|
|
99
229
|
var r;
|
|
100
|
-
if (n) r = n(t); else if (
|
|
230
|
+
if (n) r = n(t); else if (f.isURLSearchParams(t)) r = t.toString(); else {
|
|
101
231
|
var o = [];
|
|
102
|
-
|
|
103
|
-
null != e && (
|
|
104
|
-
|
|
232
|
+
f.forEach(t, function(e, t) {
|
|
233
|
+
null != e && (f.isArray(e) ? t += "[]" : e = [ e ], f.forEach(e, function(e) {
|
|
234
|
+
f.isDate(e) ? e = e.toISOString() : f.isObject(e) && (e = JSON.stringify(e)), o.push(l(t) + "=" + l(e));
|
|
105
235
|
}));
|
|
106
236
|
}), r = o.join("&");
|
|
107
237
|
}
|
|
@@ -110,55 +240,56 @@
|
|
|
110
240
|
-1 !== i && (e = e.slice(0, i)), e += (-1 === e.indexOf("?") ? "?" : "&") + r;
|
|
111
241
|
}
|
|
112
242
|
return e;
|
|
113
|
-
},
|
|
114
|
-
function
|
|
243
|
+
}, d = {};
|
|
244
|
+
function h() {
|
|
115
245
|
this.handlers = [];
|
|
116
246
|
}
|
|
117
|
-
|
|
247
|
+
h.prototype.use = function(e, t, n) {
|
|
118
248
|
return this.handlers.push({
|
|
119
249
|
fulfilled: e,
|
|
120
|
-
rejected: t
|
|
250
|
+
rejected: t,
|
|
251
|
+
synchronous: !!n && n.synchronous,
|
|
252
|
+
runWhen: n ? n.runWhen : null
|
|
121
253
|
}), this.handlers.length - 1;
|
|
122
|
-
},
|
|
254
|
+
}, h.prototype.eject = function(e) {
|
|
123
255
|
this.handlers[e] && (this.handlers[e] = null);
|
|
124
|
-
},
|
|
125
|
-
|
|
256
|
+
}, h.prototype.forEach = function(e) {
|
|
257
|
+
f.forEach(this.handlers, function(t) {
|
|
126
258
|
null !== t && e(t);
|
|
127
259
|
});
|
|
128
|
-
},
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
e = n(e, t);
|
|
132
|
-
}), e;
|
|
133
|
-
}, m = function(e) {
|
|
134
|
-
return !(!e || !e.__CANCEL__);
|
|
135
|
-
}, y = function(e, t) {
|
|
136
|
-
u.forEach(e, function(n, r) {
|
|
260
|
+
}, d = h;
|
|
261
|
+
var g = function(e, t) {
|
|
262
|
+
f.forEach(e, function(n, r) {
|
|
137
263
|
r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r]);
|
|
138
264
|
});
|
|
265
|
+
}, m = function(e, t, n, r, o) {
|
|
266
|
+
return e.config = t, n && (e.code = n), e.request = r, e.response = o, e.isAxiosError = !0,
|
|
267
|
+
e.toJSON = function() {
|
|
268
|
+
return {
|
|
269
|
+
message: this.message,
|
|
270
|
+
name: this.name,
|
|
271
|
+
description: this.description,
|
|
272
|
+
number: this.number,
|
|
273
|
+
fileName: this.fileName,
|
|
274
|
+
lineNumber: this.lineNumber,
|
|
275
|
+
columnNumber: this.columnNumber,
|
|
276
|
+
stack: this.stack,
|
|
277
|
+
config: this.config,
|
|
278
|
+
code: this.code,
|
|
279
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
280
|
+
};
|
|
281
|
+
}, e;
|
|
139
282
|
}, v = function(e, t, n, r, o) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
description: this.description,
|
|
147
|
-
number: this.number,
|
|
148
|
-
fileName: this.fileName,
|
|
149
|
-
lineNumber: this.lineNumber,
|
|
150
|
-
columnNumber: this.columnNumber,
|
|
151
|
-
stack: this.stack,
|
|
152
|
-
config: this.config,
|
|
153
|
-
code: this.code
|
|
154
|
-
};
|
|
155
|
-
}, e;
|
|
156
|
-
}(new Error(e), t, n, r, o);
|
|
157
|
-
}, w = u.isStandardBrowserEnv() ? {
|
|
283
|
+
var i = new Error(e);
|
|
284
|
+
return m(i, t, n, r, o);
|
|
285
|
+
}, y = function(e, t, n) {
|
|
286
|
+
var r = n.config.validateStatus;
|
|
287
|
+
n.status && r && !r(n.status) ? t(v("Request failed with status code " + n.status, n.config, null, n.request, n)) : e(n);
|
|
288
|
+
}, b = f.isStandardBrowserEnv() ? {
|
|
158
289
|
write: function(e, t, n, r, o, i) {
|
|
159
290
|
var a = [];
|
|
160
|
-
a.push(e + "=" + encodeURIComponent(t)),
|
|
161
|
-
|
|
291
|
+
a.push(e + "=" + encodeURIComponent(t)), f.isNumber(n) && a.push("expires=" + new Date(n).toGMTString()),
|
|
292
|
+
f.isString(r) && a.push("path=" + r), f.isString(o) && a.push("domain=" + o), !0 === i && a.push("secure"),
|
|
162
293
|
document.cookie = a.join("; ");
|
|
163
294
|
},
|
|
164
295
|
read: function(e) {
|
|
@@ -174,7 +305,20 @@
|
|
|
174
305
|
return null;
|
|
175
306
|
},
|
|
176
307
|
remove: function() {}
|
|
177
|
-
},
|
|
308
|
+
}, w = function(e, t) {
|
|
309
|
+
return e && !/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t) ? function(e, t) {
|
|
310
|
+
return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
311
|
+
}(e, t) : t;
|
|
312
|
+
}, S = [ "age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent" ], T = function(e) {
|
|
313
|
+
var t, n, r, o = {};
|
|
314
|
+
return e ? (f.forEach(e.split("\n"), function(e) {
|
|
315
|
+
if (r = e.indexOf(":"), t = f.trim(e.substr(0, r)).toLowerCase(), n = f.trim(e.substr(r + 1)),
|
|
316
|
+
t) {
|
|
317
|
+
if (o[t] && S.indexOf(t) >= 0) return;
|
|
318
|
+
o[t] = "set-cookie" === t ? (o[t] ? o[t] : []).concat([ n ]) : o[t] ? o[t] + ", " + n : n;
|
|
319
|
+
}
|
|
320
|
+
}), o) : o;
|
|
321
|
+
}, k = f.isStandardBrowserEnv() ? function() {
|
|
178
322
|
var e, t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");
|
|
179
323
|
function r(e) {
|
|
180
324
|
var r = e;
|
|
@@ -191,319 +335,328 @@
|
|
|
191
335
|
};
|
|
192
336
|
}
|
|
193
337
|
return e = r(window.location.href), function(t) {
|
|
194
|
-
var n =
|
|
338
|
+
var n = f.isString(t) ? r(t) : t;
|
|
195
339
|
return n.protocol === e.protocol && n.host === e.host;
|
|
196
340
|
};
|
|
197
341
|
}() : function() {
|
|
198
342
|
return !0;
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
var f, l, p = (f = e.baseURL, l = e.url, f && !/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(l) ? function(e, t) {
|
|
209
|
-
return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
210
|
-
}(f, l) : l);
|
|
211
|
-
if (i.open(e.method.toUpperCase(), c(p, e.params, e.paramsSerializer), !0), i.timeout = e.timeout,
|
|
212
|
-
i.onreadystatechange = function() {
|
|
213
|
-
if (i && 4 === i.readyState && (0 !== i.status || i.responseURL && 0 === i.responseURL.indexOf("file:"))) {
|
|
214
|
-
var r = "getAllResponseHeaders" in i ? (a = i.getAllResponseHeaders(), l = {}, a ? (u.forEach(a.split("\n"), function(e) {
|
|
215
|
-
if (f = e.indexOf(":"), s = u.trim(e.substr(0, f)).toLowerCase(), c = u.trim(e.substr(f + 1)),
|
|
216
|
-
s) {
|
|
217
|
-
if (l[s] && b.indexOf(s) >= 0) return;
|
|
218
|
-
l[s] = "set-cookie" === s ? (l[s] ? l[s] : []).concat([ c ]) : l[s] ? l[s] + ", " + c : c;
|
|
219
|
-
}
|
|
220
|
-
}), l) : l) : null, o = {
|
|
221
|
-
data: e.responseType && "text" !== e.responseType ? i.response : i.responseText,
|
|
222
|
-
status: i.status,
|
|
223
|
-
statusText: i.statusText,
|
|
224
|
-
headers: r,
|
|
225
|
-
config: e,
|
|
226
|
-
request: i
|
|
227
|
-
};
|
|
228
|
-
(function(e, t, n) {
|
|
229
|
-
var r = n.config.validateStatus;
|
|
230
|
-
n.status && r && !r(n.status) ? t(v("Request failed with status code " + n.status, n.config, null, n.request, n)) : e(n);
|
|
231
|
-
})(t, n, o), i = null;
|
|
232
|
-
}
|
|
233
|
-
var a, s, c, f, l;
|
|
234
|
-
}, i.onabort = function() {
|
|
235
|
-
i && (n(v("Request aborted", e, "ECONNABORTED", i)), i = null);
|
|
236
|
-
}, i.onerror = function() {
|
|
237
|
-
n(v("Network Error", e, null, i)), i = null;
|
|
238
|
-
}, i.ontimeout = function() {
|
|
239
|
-
var t = "timeout of " + e.timeout + "ms exceeded";
|
|
240
|
-
e.timeoutErrorMessage && (t = e.timeoutErrorMessage), n(v(t, e, "ECONNABORTED", i)),
|
|
241
|
-
i = null;
|
|
242
|
-
}, u.isStandardBrowserEnv()) {
|
|
243
|
-
var d = (e.withCredentials || C(p)) && e.xsrfCookieName ? w.read(e.xsrfCookieName) : void 0;
|
|
244
|
-
d && (o[e.xsrfHeaderName] = d);
|
|
245
|
-
}
|
|
246
|
-
if ("setRequestHeader" in i && u.forEach(o, function(e, t) {
|
|
247
|
-
void 0 === r && "content-type" === t.toLowerCase() ? delete o[t] : i.setRequestHeader(t, e);
|
|
248
|
-
}), u.isUndefined(e.withCredentials) || (i.withCredentials = !!e.withCredentials),
|
|
249
|
-
e.responseType) try {
|
|
250
|
-
i.responseType = e.responseType;
|
|
251
|
-
} catch (h) {
|
|
252
|
-
if ("json" !== e.responseType) throw h;
|
|
253
|
-
}
|
|
254
|
-
"function" == typeof e.onDownloadProgress && i.addEventListener("progress", e.onDownloadProgress),
|
|
255
|
-
"function" == typeof e.onUploadProgress && i.upload && i.upload.addEventListener("progress", e.onUploadProgress),
|
|
256
|
-
e.cancelToken && e.cancelToken.promise.then(function(e) {
|
|
257
|
-
i && (i.abort(), n(e), i = null);
|
|
258
|
-
}), r || (r = null), i.send(r);
|
|
259
|
-
});
|
|
260
|
-
}, T = p = {};
|
|
261
|
-
function k() {
|
|
343
|
+
}, C = {};
|
|
344
|
+
function j(e) {
|
|
345
|
+
this.message = e;
|
|
346
|
+
}
|
|
347
|
+
j.prototype.toString = function() {
|
|
348
|
+
return "Cancel" + (this.message ? ": " + this.message : "");
|
|
349
|
+
}, j.prototype.__CANCEL__ = !0, C = j;
|
|
350
|
+
var E, O, x = {}, A = x = {};
|
|
351
|
+
function _() {
|
|
262
352
|
throw new Error("setTimeout has not been defined");
|
|
263
353
|
}
|
|
264
|
-
function
|
|
354
|
+
function P() {
|
|
265
355
|
throw new Error("clearTimeout has not been defined");
|
|
266
356
|
}
|
|
267
|
-
function
|
|
268
|
-
if (
|
|
269
|
-
if ((
|
|
357
|
+
function N(e) {
|
|
358
|
+
if (E === setTimeout) return setTimeout(e, 0);
|
|
359
|
+
if ((E === _ || !E) && setTimeout) return E = setTimeout, setTimeout(e, 0);
|
|
270
360
|
try {
|
|
271
|
-
return
|
|
361
|
+
return E(e, 0);
|
|
272
362
|
} catch (t) {
|
|
273
363
|
try {
|
|
274
|
-
return
|
|
364
|
+
return E.call(null, e, 0);
|
|
275
365
|
} catch (t) {
|
|
276
|
-
return
|
|
366
|
+
return E.call(this, e, 0);
|
|
277
367
|
}
|
|
278
368
|
}
|
|
279
369
|
}
|
|
280
370
|
!function() {
|
|
281
371
|
try {
|
|
282
|
-
|
|
372
|
+
E = "function" == typeof setTimeout ? setTimeout : _;
|
|
283
373
|
} catch (e) {
|
|
284
|
-
|
|
374
|
+
E = _;
|
|
285
375
|
}
|
|
286
376
|
try {
|
|
287
|
-
|
|
377
|
+
O = "function" == typeof clearTimeout ? clearTimeout : P;
|
|
288
378
|
} catch (e) {
|
|
289
|
-
|
|
379
|
+
O = P;
|
|
290
380
|
}
|
|
291
381
|
}();
|
|
292
|
-
var
|
|
293
|
-
function
|
|
294
|
-
|
|
382
|
+
var R, U = [], L = !1, B = -1;
|
|
383
|
+
function q() {
|
|
384
|
+
L && R && (L = !1, R.length ? U = R.concat(U) : B = -1, U.length && z());
|
|
295
385
|
}
|
|
296
|
-
function
|
|
297
|
-
if (!
|
|
298
|
-
var e =
|
|
299
|
-
|
|
300
|
-
for (var t =
|
|
301
|
-
for (
|
|
302
|
-
|
|
386
|
+
function z() {
|
|
387
|
+
if (!L) {
|
|
388
|
+
var e = N(q);
|
|
389
|
+
L = !0;
|
|
390
|
+
for (var t = U.length; t; ) {
|
|
391
|
+
for (R = U, U = []; ++B < t; ) R && R[B].run();
|
|
392
|
+
B = -1, t = U.length;
|
|
303
393
|
}
|
|
304
|
-
|
|
305
|
-
if (
|
|
306
|
-
if ((
|
|
394
|
+
R = null, L = !1, function(e) {
|
|
395
|
+
if (O === clearTimeout) return clearTimeout(e);
|
|
396
|
+
if ((O === P || !O) && clearTimeout) return O = clearTimeout, clearTimeout(e);
|
|
307
397
|
try {
|
|
308
|
-
|
|
398
|
+
O(e);
|
|
309
399
|
} catch (t) {
|
|
310
400
|
try {
|
|
311
|
-
return
|
|
401
|
+
return O.call(null, e);
|
|
312
402
|
} catch (t) {
|
|
313
|
-
return
|
|
403
|
+
return O.call(this, e);
|
|
314
404
|
}
|
|
315
405
|
}
|
|
316
406
|
}(e);
|
|
317
407
|
}
|
|
318
408
|
}
|
|
319
|
-
function
|
|
409
|
+
function I(e, t) {
|
|
320
410
|
this.fun = e, this.array = t;
|
|
321
411
|
}
|
|
322
|
-
function
|
|
323
|
-
|
|
412
|
+
function D() {}
|
|
413
|
+
A.nextTick = function(e) {
|
|
324
414
|
var t = new Array(arguments.length - 1);
|
|
325
415
|
if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
|
|
326
|
-
|
|
327
|
-
},
|
|
416
|
+
U.push(new I(e, t)), 1 !== U.length || L || N(z);
|
|
417
|
+
}, I.prototype.run = function() {
|
|
328
418
|
this.fun.apply(null, this.array);
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
419
|
+
}, A.title = "browser", A.browser = !0, A.env = {}, A.argv = [], A.version = "",
|
|
420
|
+
A.versions = {}, A.on = D, A.addListener = D, A.once = D, A.off = D, A.removeListener = D,
|
|
421
|
+
A.removeAllListeners = D, A.emit = D, A.prependListener = D, A.prependOnceListener = D,
|
|
422
|
+
A.listeners = function(e) {
|
|
333
423
|
return [];
|
|
334
|
-
},
|
|
424
|
+
}, A.binding = function(e) {
|
|
335
425
|
throw new Error("process.binding is not supported");
|
|
336
|
-
},
|
|
426
|
+
}, A.cwd = function() {
|
|
337
427
|
return "/";
|
|
338
|
-
},
|
|
428
|
+
}, A.chdir = function(e) {
|
|
339
429
|
throw new Error("process.chdir is not supported");
|
|
340
|
-
},
|
|
430
|
+
}, A.umask = function() {
|
|
341
431
|
return 0;
|
|
342
432
|
};
|
|
343
|
-
var
|
|
344
|
-
|
|
345
|
-
|
|
433
|
+
var F = t({}), J = function(e, t, n) {
|
|
434
|
+
var r = this || F;
|
|
435
|
+
return f.forEach(n, function(n) {
|
|
436
|
+
e = n.call(r, e, t);
|
|
437
|
+
}), e;
|
|
438
|
+
}, V = function(e) {
|
|
439
|
+
return !(!e || !e.__CANCEL__);
|
|
440
|
+
}, H = t({});
|
|
441
|
+
function M(e) {
|
|
442
|
+
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted) throw new C("canceled");
|
|
346
443
|
}
|
|
347
|
-
|
|
348
|
-
(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
352
|
-
};
|
|
353
|
-
function n(e, t) {
|
|
354
|
-
!u.isUndefined(e) && u.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t);
|
|
355
|
-
}
|
|
356
|
-
var r, o = {
|
|
357
|
-
adapter: (("undefined" != typeof XMLHttpRequest || void 0 !== e && "[object process]" === Object.prototype.toString.call(e)) && (r = S),
|
|
358
|
-
r),
|
|
359
|
-
transformRequest: [ function(e, t) {
|
|
360
|
-
return y(t, "Accept"), y(t, "Content-Type"), u.isFormData(e) || u.isArrayBuffer(e) || u.isBuffer(e) || u.isStream(e) || u.isFile(e) || u.isBlob(e) ? e : u.isArrayBufferView(e) ? e.buffer : u.isURLSearchParams(e) ? (n(t, "application/x-www-form-urlencoded;charset=utf-8"),
|
|
361
|
-
e.toString()) : u.isObject(e) ? (n(t, "application/json;charset=utf-8"), JSON.stringify(e)) : e;
|
|
362
|
-
} ],
|
|
363
|
-
transformResponse: [ function(e) {
|
|
364
|
-
if ("string" == typeof e) try {
|
|
365
|
-
e = JSON.parse(e);
|
|
366
|
-
} catch (t) {}
|
|
367
|
-
return e;
|
|
368
|
-
} ],
|
|
369
|
-
timeout: 0,
|
|
370
|
-
xsrfCookieName: "XSRF-TOKEN",
|
|
371
|
-
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
372
|
-
maxContentLength: -1,
|
|
373
|
-
maxBodyLength: -1,
|
|
374
|
-
validateStatus: function(e) {
|
|
375
|
-
return e >= 200 && e < 300;
|
|
376
|
-
},
|
|
377
|
-
headers: {
|
|
378
|
-
common: {
|
|
379
|
-
Accept: "application/json, text/plain, */*"
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
u.forEach([ "delete", "get", "head" ], function(e) {
|
|
384
|
-
o.headers[e] = {};
|
|
385
|
-
}), u.forEach([ "post", "put", "patch" ], function(e) {
|
|
386
|
-
o.headers[e] = u.merge(t);
|
|
387
|
-
}), L = o;
|
|
388
|
-
}).call(this);
|
|
389
|
-
}).call(this, p);
|
|
390
|
-
var q = function(e) {
|
|
391
|
-
return B(e), e.headers = e.headers || {}, e.data = g(e.data, e.headers, e.transformRequest),
|
|
392
|
-
e.headers = u.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers),
|
|
393
|
-
u.forEach([ "delete", "get", "head", "post", "put", "patch", "common" ], function(t) {
|
|
444
|
+
var $, G = function(e) {
|
|
445
|
+
return M(e), e.headers = e.headers || {}, e.data = J.call(e, e.data, e.headers, e.transformRequest),
|
|
446
|
+
e.headers = f.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers),
|
|
447
|
+
f.forEach([ "delete", "get", "head", "post", "put", "patch", "common" ], function(t) {
|
|
394
448
|
delete e.headers[t];
|
|
395
|
-
}), (e.adapter ||
|
|
396
|
-
return
|
|
449
|
+
}), (e.adapter || H.adapter)(e).then(function(t) {
|
|
450
|
+
return M(e), t.data = J.call(e, t.data, t.headers, e.transformResponse), t;
|
|
397
451
|
}, function(t) {
|
|
398
|
-
return
|
|
452
|
+
return V(t) || (M(e), t && t.response && (t.response.data = J.call(e, t.response.data, t.response.headers, e.transformResponse))),
|
|
399
453
|
Promise.reject(t);
|
|
400
454
|
});
|
|
401
|
-
},
|
|
455
|
+
}, X = function(e, t) {
|
|
402
456
|
t = t || {};
|
|
403
|
-
var n = {}
|
|
404
|
-
function
|
|
405
|
-
return
|
|
457
|
+
var n = {};
|
|
458
|
+
function r(e, t) {
|
|
459
|
+
return f.isPlainObject(e) && f.isPlainObject(t) ? f.merge(e, t) : f.isPlainObject(t) ? f.merge({}, t) : f.isArray(t) ? t.slice() : t;
|
|
406
460
|
}
|
|
407
|
-
function
|
|
408
|
-
|
|
461
|
+
function o(n) {
|
|
462
|
+
return f.isUndefined(t[n]) ? f.isUndefined(e[n]) ? void 0 : r(void 0, e[n]) : r(e[n], t[n]);
|
|
409
463
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
464
|
+
function i(e) {
|
|
465
|
+
if (!f.isUndefined(t[e])) return r(void 0, t[e]);
|
|
466
|
+
}
|
|
467
|
+
function a(n) {
|
|
468
|
+
return f.isUndefined(t[n]) ? f.isUndefined(e[n]) ? void 0 : r(void 0, e[n]) : r(void 0, t[n]);
|
|
469
|
+
}
|
|
470
|
+
function s(n) {
|
|
471
|
+
return n in t ? r(e[n], t[n]) : n in e ? r(void 0, e[n]) : void 0;
|
|
472
|
+
}
|
|
473
|
+
var u = {
|
|
474
|
+
url: i,
|
|
475
|
+
method: i,
|
|
476
|
+
data: i,
|
|
477
|
+
baseURL: a,
|
|
478
|
+
transformRequest: a,
|
|
479
|
+
transformResponse: a,
|
|
480
|
+
paramsSerializer: a,
|
|
481
|
+
timeout: a,
|
|
482
|
+
timeoutMessage: a,
|
|
483
|
+
withCredentials: a,
|
|
484
|
+
adapter: a,
|
|
485
|
+
responseType: a,
|
|
486
|
+
xsrfCookieName: a,
|
|
487
|
+
xsrfHeaderName: a,
|
|
488
|
+
onUploadProgress: a,
|
|
489
|
+
onDownloadProgress: a,
|
|
490
|
+
decompress: a,
|
|
491
|
+
maxContentLength: a,
|
|
492
|
+
maxBodyLength: a,
|
|
493
|
+
transport: a,
|
|
494
|
+
httpAgent: a,
|
|
495
|
+
httpsAgent: a,
|
|
496
|
+
cancelToken: a,
|
|
497
|
+
socketPath: a,
|
|
498
|
+
responseEncoding: a,
|
|
499
|
+
validateStatus: s
|
|
500
|
+
};
|
|
501
|
+
return f.forEach(Object.keys(e).concat(Object.keys(t)), function(e) {
|
|
502
|
+
var t = u[e] || o, r = t(e);
|
|
503
|
+
f.isUndefined(r) && t !== s || (n[e] = r);
|
|
504
|
+
}), n;
|
|
505
|
+
}, W = "0.24.0", K = W, Y = {};
|
|
506
|
+
[ "object", "boolean", "number", "function", "string", "symbol" ].forEach(function(e, t) {
|
|
507
|
+
Y[e] = function(n) {
|
|
508
|
+
return typeof n === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
509
|
+
};
|
|
510
|
+
});
|
|
511
|
+
var Q = {};
|
|
512
|
+
Y.transitional = function(e, t, n) {
|
|
513
|
+
function r(e, t) {
|
|
514
|
+
return "[Axios v" + K + "] Transitional option '" + e + "'" + t + (n ? ". " + n : "");
|
|
515
|
+
}
|
|
516
|
+
return function(n, o, i) {
|
|
517
|
+
if (!1 === e) throw new Error(r(o, " has been removed" + (t ? " in " + t : "")));
|
|
518
|
+
return t && !Q[o] && (Q[o] = !0, console.warn(r(o, " has been deprecated since v" + t + " and will be removed in the near future"))),
|
|
519
|
+
!e || e(n, o, i);
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
var Z = {}, ee = ($ = {
|
|
523
|
+
assertOptions: function(e, t, n) {
|
|
524
|
+
if ("object" != typeof e) throw new TypeError("options must be an object");
|
|
525
|
+
for (var r = Object.keys(e), o = r.length; o-- > 0; ) {
|
|
526
|
+
var i = r[o], a = t[i];
|
|
527
|
+
if (a) {
|
|
528
|
+
var s = e[i], u = void 0 === s || a(s, i, e);
|
|
529
|
+
if (!0 !== u) throw new TypeError("option " + i + " must be " + u);
|
|
530
|
+
} else if (!0 !== n) throw Error("Unknown option " + i);
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
validators: Y
|
|
534
|
+
}).validators;
|
|
535
|
+
function te(e) {
|
|
423
536
|
this.defaults = e, this.interceptors = {
|
|
424
|
-
request: new
|
|
425
|
-
response: new
|
|
537
|
+
request: new d(),
|
|
538
|
+
response: new d()
|
|
426
539
|
};
|
|
427
540
|
}
|
|
428
|
-
|
|
541
|
+
te.prototype.request = function(e) {
|
|
429
542
|
"string" == typeof e ? (e = arguments[1] || {}).url = arguments[0] : e = e || {},
|
|
430
|
-
(e =
|
|
431
|
-
var t =
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
543
|
+
(e = X(this.defaults, e)).method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = "get";
|
|
544
|
+
var t = e.transitional;
|
|
545
|
+
void 0 !== t && $.assertOptions(t, {
|
|
546
|
+
silentJSONParsing: ee.transitional(ee.boolean),
|
|
547
|
+
forcedJSONParsing: ee.transitional(ee.boolean),
|
|
548
|
+
clarifyTimeoutError: ee.transitional(ee.boolean)
|
|
549
|
+
}, !1);
|
|
550
|
+
var n = [], r = !0;
|
|
551
|
+
this.interceptors.request.forEach(function(t) {
|
|
552
|
+
"function" == typeof t.runWhen && !1 === t.runWhen(e) || (r = r && t.synchronous,
|
|
553
|
+
n.unshift(t.fulfilled, t.rejected));
|
|
554
|
+
});
|
|
555
|
+
var o, i = [];
|
|
556
|
+
if (this.interceptors.response.forEach(function(e) {
|
|
557
|
+
i.push(e.fulfilled, e.rejected);
|
|
558
|
+
}), !r) {
|
|
559
|
+
var a = [ G, void 0 ];
|
|
560
|
+
for (Array.prototype.unshift.apply(a, n), a = a.concat(i), o = Promise.resolve(e); a.length; ) o = o.then(a.shift(), a.shift());
|
|
561
|
+
return o;
|
|
562
|
+
}
|
|
563
|
+
for (var s = e; n.length; ) {
|
|
564
|
+
var u = n.shift(), c = n.shift();
|
|
565
|
+
try {
|
|
566
|
+
s = u(s);
|
|
567
|
+
} catch (f) {
|
|
568
|
+
c(f);
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
try {
|
|
573
|
+
o = G(s);
|
|
574
|
+
} catch (f) {
|
|
575
|
+
return Promise.reject(f);
|
|
576
|
+
}
|
|
577
|
+
for (;i.length; ) o = o.then(i.shift(), i.shift());
|
|
578
|
+
return o;
|
|
579
|
+
}, te.prototype.getUri = function(e) {
|
|
580
|
+
return e = X(this.defaults, e), p(e.url, e.params, e.paramsSerializer).replace(/^\?/, "");
|
|
581
|
+
}, f.forEach([ "delete", "get", "head", "options" ], function(e) {
|
|
582
|
+
te.prototype[e] = function(t, n) {
|
|
583
|
+
return this.request(X(n || {}, {
|
|
443
584
|
method: e,
|
|
444
585
|
url: t,
|
|
445
586
|
data: (n || {}).data
|
|
446
587
|
}));
|
|
447
588
|
};
|
|
448
|
-
}),
|
|
449
|
-
|
|
450
|
-
return this.request(
|
|
589
|
+
}), f.forEach([ "post", "put", "patch" ], function(e) {
|
|
590
|
+
te.prototype[e] = function(t, n, r) {
|
|
591
|
+
return this.request(X(r || {}, {
|
|
451
592
|
method: e,
|
|
452
593
|
url: t,
|
|
453
594
|
data: n
|
|
454
595
|
}));
|
|
455
596
|
};
|
|
456
|
-
}),
|
|
457
|
-
var
|
|
458
|
-
function
|
|
459
|
-
this.message = e;
|
|
460
|
-
}
|
|
461
|
-
V.prototype.toString = function() {
|
|
462
|
-
return "Cancel" + (this.message ? ": " + this.message : "");
|
|
463
|
-
}, V.prototype.__CANCEL__ = !0, F = V;
|
|
464
|
-
var H;
|
|
465
|
-
function M(e) {
|
|
597
|
+
}), Z = te;
|
|
598
|
+
var ne;
|
|
599
|
+
function re(e) {
|
|
466
600
|
if ("function" != typeof e) throw new TypeError("executor must be a function.");
|
|
467
601
|
var t;
|
|
468
602
|
this.promise = new Promise(function(e) {
|
|
469
603
|
t = e;
|
|
470
604
|
});
|
|
471
605
|
var n = this;
|
|
472
|
-
|
|
473
|
-
|
|
606
|
+
this.promise.then(function(e) {
|
|
607
|
+
if (n._listeners) {
|
|
608
|
+
var t, r = n._listeners.length;
|
|
609
|
+
for (t = 0; t < r; t++) n._listeners[t](e);
|
|
610
|
+
n._listeners = null;
|
|
611
|
+
}
|
|
612
|
+
}), this.promise.then = function(e) {
|
|
613
|
+
var t, r = new Promise(function(e) {
|
|
614
|
+
n.subscribe(e), t = e;
|
|
615
|
+
}).then(e);
|
|
616
|
+
return r.cancel = function() {
|
|
617
|
+
n.unsubscribe(t);
|
|
618
|
+
}, r;
|
|
619
|
+
}, e(function(e) {
|
|
620
|
+
n.reason || (n.reason = new C(e), t(n.reason));
|
|
474
621
|
});
|
|
475
622
|
}
|
|
476
|
-
|
|
623
|
+
re.prototype.throwIfRequested = function() {
|
|
477
624
|
if (this.reason) throw this.reason;
|
|
478
|
-
},
|
|
625
|
+
}, re.prototype.subscribe = function(e) {
|
|
626
|
+
this.reason ? e(this.reason) : this._listeners ? this._listeners.push(e) : this._listeners = [ e ];
|
|
627
|
+
}, re.prototype.unsubscribe = function(e) {
|
|
628
|
+
if (this._listeners) {
|
|
629
|
+
var t = this._listeners.indexOf(e);
|
|
630
|
+
-1 !== t && this._listeners.splice(t, 1);
|
|
631
|
+
}
|
|
632
|
+
}, re.source = function() {
|
|
479
633
|
var e;
|
|
480
634
|
return {
|
|
481
|
-
token: new
|
|
635
|
+
token: new re(function(t) {
|
|
482
636
|
e = t;
|
|
483
637
|
}),
|
|
484
638
|
cancel: e
|
|
485
639
|
};
|
|
486
|
-
},
|
|
487
|
-
var
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}, G.Cancel = F, G.CancelToken = H, G.isCancel = m, G.all = function(e) {
|
|
640
|
+
}, ne = re;
|
|
641
|
+
var oe = {}, ie = function e(t) {
|
|
642
|
+
var n = new Z(t), o = r(Z.prototype.request, n);
|
|
643
|
+
return f.extend(o, Z.prototype, n), f.extend(o, n), o.create = function(n) {
|
|
644
|
+
return e(X(t, n));
|
|
645
|
+
}, o;
|
|
646
|
+
}(t({}));
|
|
647
|
+
ie.Axios = Z, ie.Cancel = C, ie.CancelToken = ne, ie.isCancel = V, ie.VERSION = W,
|
|
648
|
+
ie.all = function(e) {
|
|
496
649
|
return Promise.all(e);
|
|
497
|
-
},
|
|
650
|
+
}, ie.spread = function(e) {
|
|
498
651
|
return function(t) {
|
|
499
652
|
return e.apply(null, t);
|
|
500
653
|
};
|
|
501
|
-
},
|
|
654
|
+
}, ie.isAxiosError = function(e) {
|
|
502
655
|
return "object" == typeof e && !0 === e.isAxiosError;
|
|
503
|
-
}, (
|
|
504
|
-
var
|
|
656
|
+
}, (oe = ie).default = ie;
|
|
657
|
+
var ae = oe;
|
|
505
658
|
Array.isArray;
|
|
506
|
-
var
|
|
659
|
+
var se = function(e) {
|
|
507
660
|
switch (typeof e) {
|
|
508
661
|
case "string":
|
|
509
662
|
return e;
|
|
@@ -517,28 +670,28 @@
|
|
|
517
670
|
default:
|
|
518
671
|
return "";
|
|
519
672
|
}
|
|
520
|
-
},
|
|
673
|
+
}, ue = Array.isArray || function(e) {
|
|
521
674
|
return "[object Array]" === Object.prototype.toString.call(e);
|
|
522
675
|
};
|
|
523
|
-
function
|
|
676
|
+
function ce(e, t) {
|
|
524
677
|
if (e.map) return e.map(t);
|
|
525
678
|
for (var n = [], r = 0; r < e.length; r++) n.push(t(e[r], r));
|
|
526
679
|
return n;
|
|
527
680
|
}
|
|
528
|
-
var
|
|
681
|
+
var fe = Object.keys || function(e) {
|
|
529
682
|
var t = [];
|
|
530
683
|
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.push(n);
|
|
531
684
|
return t;
|
|
532
|
-
},
|
|
685
|
+
}, le = {
|
|
533
686
|
stringify: function(e, t, n, r) {
|
|
534
|
-
return t = t || "&", n = n || "=", null === e && (e = void 0), "object" == typeof e ?
|
|
535
|
-
var o = encodeURIComponent(
|
|
536
|
-
return
|
|
537
|
-
return o + encodeURIComponent(
|
|
538
|
-
}).join(t) : o + encodeURIComponent(
|
|
539
|
-
}).join(t) : r ? encodeURIComponent(
|
|
687
|
+
return t = t || "&", n = n || "=", null === e && (e = void 0), "object" == typeof e ? ce(fe(e), function(r) {
|
|
688
|
+
var o = encodeURIComponent(se(r)) + n;
|
|
689
|
+
return ue(e[r]) ? ce(e[r], function(e) {
|
|
690
|
+
return o + encodeURIComponent(se(e));
|
|
691
|
+
}).join(t) : o + encodeURIComponent(se(e[r]));
|
|
692
|
+
}).join(t) : r ? encodeURIComponent(se(r)) + n + encodeURIComponent(se(e)) : "";
|
|
540
693
|
}
|
|
541
|
-
},
|
|
694
|
+
}, pe = {}, de = {};
|
|
542
695
|
return function(e) {
|
|
543
696
|
(function() {
|
|
544
697
|
"use strict";
|
|
@@ -566,23 +719,23 @@
|
|
|
566
719
|
}
|
|
567
720
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
568
721
|
}
|
|
569
|
-
var a,
|
|
722
|
+
var a, s = !0, u = !1;
|
|
570
723
|
return {
|
|
571
724
|
s: function() {
|
|
572
725
|
r = r.call(e);
|
|
573
726
|
},
|
|
574
727
|
n: function() {
|
|
575
728
|
var e = r.next();
|
|
576
|
-
return
|
|
729
|
+
return s = e.done, e;
|
|
577
730
|
},
|
|
578
731
|
e: function(e) {
|
|
579
|
-
|
|
732
|
+
u = !0, a = e;
|
|
580
733
|
},
|
|
581
734
|
f: function() {
|
|
582
735
|
try {
|
|
583
|
-
|
|
736
|
+
s || null == r.return || r.return();
|
|
584
737
|
} finally {
|
|
585
|
-
if (
|
|
738
|
+
if (u) throw a;
|
|
586
739
|
}
|
|
587
740
|
}
|
|
588
741
|
};
|
|
@@ -616,16 +769,19 @@
|
|
|
616
769
|
Object.defineProperty(e, r.key, r);
|
|
617
770
|
}
|
|
618
771
|
}
|
|
619
|
-
function
|
|
620
|
-
return t && a(e.prototype, t), n && a(e, n), e
|
|
772
|
+
function s(e, t, n) {
|
|
773
|
+
return t && a(e.prototype, t), n && a(e, n), Object.defineProperty(e, "prototype", {
|
|
774
|
+
writable: !1
|
|
775
|
+
}), e;
|
|
621
776
|
}
|
|
622
|
-
Object.defineProperty(
|
|
777
|
+
Object.defineProperty(de, "__esModule", {
|
|
623
778
|
value: !0
|
|
624
|
-
}),
|
|
625
|
-
|
|
626
|
-
var
|
|
779
|
+
}), de.varsnap = de.clientName = de.version = void 0;
|
|
780
|
+
de.version = "1.7.0", de.clientName = "javascript." + de.version;
|
|
781
|
+
var u = {
|
|
627
782
|
varsnap: !0,
|
|
628
783
|
env: "development",
|
|
784
|
+
branch: "",
|
|
629
785
|
producerToken: "",
|
|
630
786
|
consumerToken: "",
|
|
631
787
|
logger: console
|
|
@@ -633,7 +789,7 @@
|
|
|
633
789
|
function t() {
|
|
634
790
|
i(this, t);
|
|
635
791
|
}
|
|
636
|
-
return
|
|
792
|
+
return s(t, null, [ {
|
|
637
793
|
key: "getConfig",
|
|
638
794
|
value: function(e, t) {
|
|
639
795
|
if (!e) return "";
|
|
@@ -644,30 +800,30 @@
|
|
|
644
800
|
key: "setConfig",
|
|
645
801
|
value: function(e, t, n) {
|
|
646
802
|
return "varsnap" === t && ("string" == typeof n && (n = "true" === n), e[t] = n),
|
|
647
|
-
"env" !== t && "producerToken" !== t && "consumerToken" !== t
|
|
648
|
-
e;
|
|
803
|
+
"env" !== t && "producerToken" !== t && "consumerToken" !== t && "branch" !== t || (e[t] = n),
|
|
804
|
+
"logger" === t && (e[t] = n), e;
|
|
649
805
|
}
|
|
650
806
|
}, {
|
|
651
807
|
key: "getSignature",
|
|
652
808
|
value: function(e, t) {
|
|
653
809
|
var n = "";
|
|
654
810
|
return n = "" !== t && void 0 !== t ? t : (n = (n = e.toString().split("{")[0]).replace(/^\s+|\s+$/g, "")).replace(/,\s+/g, ","),
|
|
655
|
-
"javascript." +
|
|
811
|
+
"javascript." + de.version + "." + n;
|
|
656
812
|
}
|
|
657
813
|
}, {
|
|
658
814
|
key: "ajax",
|
|
659
|
-
value: function(
|
|
815
|
+
value: function(e, n) {
|
|
660
816
|
var r = {
|
|
661
817
|
method: "POST",
|
|
662
|
-
url:
|
|
818
|
+
url: e,
|
|
663
819
|
headers: {
|
|
664
820
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
665
821
|
},
|
|
666
|
-
data:
|
|
822
|
+
data: le.stringify(n),
|
|
667
823
|
responseType: "json"
|
|
668
824
|
};
|
|
669
|
-
return
|
|
670
|
-
|
|
825
|
+
return t.isNode() && r.headers && (r.headers["User-Agent"] = "varsnap.js"), (0,
|
|
826
|
+
ae.default)(r).then(function(e) {
|
|
671
827
|
return e.data;
|
|
672
828
|
});
|
|
673
829
|
}
|
|
@@ -712,12 +868,31 @@
|
|
|
712
868
|
var t = String(e);
|
|
713
869
|
return t.length <= 30 ? t : t.substring(0, 30 - "...".length) + "...";
|
|
714
870
|
}
|
|
871
|
+
}, {
|
|
872
|
+
key: "isNode",
|
|
873
|
+
value: function() {
|
|
874
|
+
return "object" === (void 0 === e ? "undefined" : o(e)) && "undefined" == typeof window;
|
|
875
|
+
}
|
|
876
|
+
}, {
|
|
877
|
+
key: "getBranch",
|
|
878
|
+
value: function(e) {
|
|
879
|
+
var n = t.getConfig(e, "branch");
|
|
880
|
+
return n ? new Promise(function(e) {
|
|
881
|
+
return e(n);
|
|
882
|
+
}) : t.isNode() ? new Promise(function(e) {
|
|
883
|
+
(0, pe.exec)("git rev-parse --abbrev-ref HEAD", function(t, n, r) {
|
|
884
|
+
return e(n);
|
|
885
|
+
});
|
|
886
|
+
}) : new Promise(function(e) {
|
|
887
|
+
return e("");
|
|
888
|
+
});
|
|
889
|
+
}
|
|
715
890
|
} ]), t;
|
|
716
891
|
}(), p = function() {
|
|
717
892
|
function e(t, n, r) {
|
|
718
893
|
i(this, e), this.targetFunc = t, this.signature = n, this.config = r;
|
|
719
894
|
}
|
|
720
|
-
return
|
|
895
|
+
return s(e, [ {
|
|
721
896
|
key: "isEnabled",
|
|
722
897
|
value: function() {
|
|
723
898
|
return !!this.config.varsnap && "production" === l.getConfig(this.config, "env") && !!l.getConfig(this.config, "producerToken");
|
|
@@ -762,7 +937,7 @@
|
|
|
762
937
|
function e(t, n, r) {
|
|
763
938
|
i(this, e), this.targetFunc = t, this.signature = n, this.config = r;
|
|
764
939
|
}
|
|
765
|
-
return
|
|
940
|
+
return s(e, [ {
|
|
766
941
|
key: "isEnabled",
|
|
767
942
|
value: function() {
|
|
768
943
|
return !!this.config.varsnap && "development" === l.getConfig(this.config, "env") && !!l.getConfig(this.config, "consumerToken");
|
|
@@ -778,20 +953,20 @@
|
|
|
778
953
|
consumer_token: l.getConfig(this.config, "consumerToken"),
|
|
779
954
|
signature: this.signature
|
|
780
955
|
};
|
|
781
|
-
return l.ajax("https://www.varsnap.com/api/snap/consume/", a).then(function(
|
|
782
|
-
var
|
|
783
|
-
if (!
|
|
784
|
-
return l.error(i.config, "Received error from Varsnap: " +
|
|
956
|
+
return l.ajax("https://www.varsnap.com/api/snap/consume/", a).then(function(s) {
|
|
957
|
+
var u = s;
|
|
958
|
+
if (!u || "ok" !== u.status) return [ new Promise(function(e) {
|
|
959
|
+
return l.error(i.config, "Received error from Varsnap: " + u.status), e(!1);
|
|
785
960
|
}) ];
|
|
786
|
-
0 ===
|
|
787
|
-
var c, f = [], d = t(
|
|
961
|
+
0 === u.results.length && l.log(i.config, "No snaps found for signature: " + a.signature);
|
|
962
|
+
var c, f = [], d = t(u.results);
|
|
788
963
|
try {
|
|
789
964
|
var h = function() {
|
|
790
|
-
var t, a = c.value,
|
|
965
|
+
var t, a = c.value, s = e.deserialize(a.inputs), u = e.deserialize(a.prod_outputs), l = void 0;
|
|
791
966
|
try {
|
|
792
967
|
l = i.targetFunc.apply(i, function(e) {
|
|
793
968
|
if (Array.isArray(e)) return r(e);
|
|
794
|
-
}(t =
|
|
969
|
+
}(t = s) || function(e) {
|
|
795
970
|
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
796
971
|
}(t) || n(t) || function() {
|
|
797
972
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
@@ -800,9 +975,9 @@
|
|
|
800
975
|
l = h;
|
|
801
976
|
}
|
|
802
977
|
var d = Promise.resolve(l).then(function(e) {
|
|
803
|
-
var t = p.serialize(
|
|
804
|
-
return i.reportCentral(o, a,
|
|
805
|
-
i.reportLog(a.id,
|
|
978
|
+
var t = p.serialize(u) === p.serialize(e);
|
|
979
|
+
return i.reportCentral(o, a, u, e, t).then(function(n) {
|
|
980
|
+
i.reportLog(a.id, s, u, e, t, n);
|
|
806
981
|
}), t;
|
|
807
982
|
});
|
|
808
983
|
f.push(d);
|
|
@@ -879,11 +1054,17 @@
|
|
|
879
1054
|
return i.producer = r, i.consumer = o, i.signature = n, c.push(r), f.push(o), i;
|
|
880
1055
|
}
|
|
881
1056
|
function g() {
|
|
882
|
-
var e, n
|
|
883
|
-
return 0 ===
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1057
|
+
var e, n = l.getConsumers();
|
|
1058
|
+
return 0 === n.length ? Promise.resolve(!0) : (e = n[0].config, l.getBranch(e).then(function(t) {
|
|
1059
|
+
return {
|
|
1060
|
+
branch: t,
|
|
1061
|
+
consumer_token: l.getConfig(e, "consumerToken"),
|
|
1062
|
+
client: de.clientName
|
|
1063
|
+
};
|
|
1064
|
+
}).then(function(e) {
|
|
1065
|
+
var t = e;
|
|
1066
|
+
return l.ajax("https://www.varsnap.com/api/trial_group/", t);
|
|
1067
|
+
}).then(function(e) {
|
|
887
1068
|
return e;
|
|
888
1069
|
}).catch(function(t) {
|
|
889
1070
|
var n;
|
|
@@ -895,14 +1076,14 @@
|
|
|
895
1076
|
trial_group_url: ""
|
|
896
1077
|
};
|
|
897
1078
|
})).then(function(e) {
|
|
898
|
-
var
|
|
1079
|
+
var r, o = [], i = t(n);
|
|
899
1080
|
try {
|
|
900
|
-
for (i.s(); !(
|
|
901
|
-
var a =
|
|
1081
|
+
for (i.s(); !(r = i.n()).done; ) {
|
|
1082
|
+
var a = r.value.consume(e);
|
|
902
1083
|
o.push(a);
|
|
903
1084
|
}
|
|
904
|
-
} catch (
|
|
905
|
-
i.e(
|
|
1085
|
+
} catch (s) {
|
|
1086
|
+
i.e(s);
|
|
906
1087
|
} finally {
|
|
907
1088
|
i.f();
|
|
908
1089
|
}
|
|
@@ -913,7 +1094,7 @@
|
|
|
913
1094
|
});
|
|
914
1095
|
});
|
|
915
1096
|
}
|
|
916
|
-
|
|
1097
|
+
de.varsnap = h, h._config = u, h.updateConfig = function(e) {
|
|
917
1098
|
for (var t = h._config, n = 0, r = Object.keys(h._config); n < r.length; n++) {
|
|
918
1099
|
var o = r[n];
|
|
919
1100
|
Object.prototype.hasOwnProperty.call(e, o) && (t = l.setConfig(t, o, e[o]));
|
|
@@ -921,8 +1102,8 @@
|
|
|
921
1102
|
h._config = t;
|
|
922
1103
|
}, h.reset = function() {
|
|
923
1104
|
l.resetConsumers(), l.resetProducers();
|
|
924
|
-
}, h.version =
|
|
1105
|
+
}, h.version = de.version, h.runTests = g;
|
|
925
1106
|
}).call(this);
|
|
926
|
-
}.call(this,
|
|
1107
|
+
}.call(this, x), de.varsnap;
|
|
927
1108
|
});
|
|
928
1109
|
})(typeof Varsnap == "undefined" ? Varsnap = {} : Varsnap);
|