@clownlee/cores 1.0.6 → 1.0.8
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/dist/index.js +2555 -33
- package/dist/ui/permission-btn/use-permission.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,10 +2,2500 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
import axios from "axios";
|
|
6
5
|
import { inject, computed, defineComponent, watch, createElementBlock, openBlock, renderSlot, Fragment, createCommentVNode, unref, createBlock, withCtx, createVNode, mergeProps, ref, createElementVNode, toDisplayString, getCurrentInstance, getCurrentScope, onScopeDispose, shallowRef, watchEffect, readonly, onMounted, isRef, warn, Teleport as Teleport$1, toRef, onUnmounted, nextTick, useAttrs as useAttrs$1, useSlots, normalizeStyle, normalizeClass, resolveDynamicComponent, withModifiers, provide, onBeforeUnmount, withDirectives, cloneVNode, Comment, Text, onBeforeMount, Transition, vShow, onDeactivated, reactive, vModelRadio, createTextVNode, toRefs, renderList } from "vue";
|
|
7
6
|
import { ElButton, ElTable, ElPagination, ClickOutside, ElDialog, ElUpload } from "element-plus";
|
|
8
7
|
import { CircleClose, CircleCheck, Loading, View, Hide, ArrowRight, ArrowDown, Search, RefreshLeft, RefreshRight } from "@element-plus/icons-vue";
|
|
8
|
+
function bind(fn2, thisArg) {
|
|
9
|
+
return function wrap() {
|
|
10
|
+
return fn2.apply(thisArg, arguments);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const { toString: toString$2 } = Object.prototype;
|
|
14
|
+
const { getPrototypeOf } = Object;
|
|
15
|
+
const { iterator, toStringTag } = Symbol;
|
|
16
|
+
const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
17
|
+
const str = toString$2.call(thing);
|
|
18
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
19
|
+
})(/* @__PURE__ */ Object.create(null));
|
|
20
|
+
const kindOfTest = (type) => {
|
|
21
|
+
type = type.toLowerCase();
|
|
22
|
+
return (thing) => kindOf(thing) === type;
|
|
23
|
+
};
|
|
24
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
25
|
+
const { isArray: isArray$2 } = Array;
|
|
26
|
+
const isUndefined$1 = typeOfTest("undefined");
|
|
27
|
+
function isBuffer$1(val) {
|
|
28
|
+
return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor) && isFunction$3(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
29
|
+
}
|
|
30
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
31
|
+
function isArrayBufferView(val) {
|
|
32
|
+
let result;
|
|
33
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
34
|
+
result = ArrayBuffer.isView(val);
|
|
35
|
+
} else {
|
|
36
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
const isString$1 = typeOfTest("string");
|
|
41
|
+
const isFunction$3 = typeOfTest("function");
|
|
42
|
+
const isNumber$1 = typeOfTest("number");
|
|
43
|
+
const isObject$3 = (thing) => thing !== null && typeof thing === "object";
|
|
44
|
+
const isBoolean$1 = (thing) => thing === true || thing === false;
|
|
45
|
+
const isPlainObject$1 = (val) => {
|
|
46
|
+
if (kindOf(val) !== "object") {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const prototype2 = getPrototypeOf(val);
|
|
50
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
|
|
51
|
+
};
|
|
52
|
+
const isEmptyObject = (val) => {
|
|
53
|
+
if (!isObject$3(val) || isBuffer$1(val)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
58
|
+
} catch (e) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const isDate = kindOfTest("Date");
|
|
63
|
+
const isFile = kindOfTest("File");
|
|
64
|
+
const isBlob = kindOfTest("Blob");
|
|
65
|
+
const isFileList = kindOfTest("FileList");
|
|
66
|
+
const isStream = (val) => isObject$3(val) && isFunction$3(val.pipe);
|
|
67
|
+
const isFormData = (thing) => {
|
|
68
|
+
let kind;
|
|
69
|
+
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$3(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
70
|
+
kind === "object" && isFunction$3(thing.toString) && thing.toString() === "[object FormData]"));
|
|
71
|
+
};
|
|
72
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
73
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
|
|
74
|
+
const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
75
|
+
function forEach(obj, fn2, { allOwnKeys = false } = {}) {
|
|
76
|
+
if (obj === null || typeof obj === "undefined") {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
let i;
|
|
80
|
+
let l;
|
|
81
|
+
if (typeof obj !== "object") {
|
|
82
|
+
obj = [obj];
|
|
83
|
+
}
|
|
84
|
+
if (isArray$2(obj)) {
|
|
85
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
86
|
+
fn2.call(null, obj[i], i, obj);
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
if (isBuffer$1(obj)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const keys2 = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
93
|
+
const len = keys2.length;
|
|
94
|
+
let key;
|
|
95
|
+
for (i = 0; i < len; i++) {
|
|
96
|
+
key = keys2[i];
|
|
97
|
+
fn2.call(null, obj[key], key, obj);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function findKey(obj, key) {
|
|
102
|
+
if (isBuffer$1(obj)) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
key = key.toLowerCase();
|
|
106
|
+
const keys2 = Object.keys(obj);
|
|
107
|
+
let i = keys2.length;
|
|
108
|
+
let _key;
|
|
109
|
+
while (i-- > 0) {
|
|
110
|
+
_key = keys2[i];
|
|
111
|
+
if (key === _key.toLowerCase()) {
|
|
112
|
+
return _key;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const _global = (() => {
|
|
118
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
119
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
120
|
+
})();
|
|
121
|
+
const isContextDefined = (context) => !isUndefined$1(context) && context !== _global;
|
|
122
|
+
function merge() {
|
|
123
|
+
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
124
|
+
const result = {};
|
|
125
|
+
const assignValue2 = (val, key) => {
|
|
126
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
127
|
+
if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
|
|
128
|
+
result[targetKey] = merge(result[targetKey], val);
|
|
129
|
+
} else if (isPlainObject$1(val)) {
|
|
130
|
+
result[targetKey] = merge({}, val);
|
|
131
|
+
} else if (isArray$2(val)) {
|
|
132
|
+
result[targetKey] = val.slice();
|
|
133
|
+
} else if (!skipUndefined || !isUndefined$1(val)) {
|
|
134
|
+
result[targetKey] = val;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
138
|
+
arguments[i] && forEach(arguments[i], assignValue2);
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
143
|
+
forEach(b, (val, key) => {
|
|
144
|
+
if (thisArg && isFunction$3(val)) {
|
|
145
|
+
a[key] = bind(val, thisArg);
|
|
146
|
+
} else {
|
|
147
|
+
a[key] = val;
|
|
148
|
+
}
|
|
149
|
+
}, { allOwnKeys });
|
|
150
|
+
return a;
|
|
151
|
+
};
|
|
152
|
+
const stripBOM = (content) => {
|
|
153
|
+
if (content.charCodeAt(0) === 65279) {
|
|
154
|
+
content = content.slice(1);
|
|
155
|
+
}
|
|
156
|
+
return content;
|
|
157
|
+
};
|
|
158
|
+
const inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
159
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
|
160
|
+
constructor.prototype.constructor = constructor;
|
|
161
|
+
Object.defineProperty(constructor, "super", {
|
|
162
|
+
value: superConstructor.prototype
|
|
163
|
+
});
|
|
164
|
+
props && Object.assign(constructor.prototype, props);
|
|
165
|
+
};
|
|
166
|
+
const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
167
|
+
let props;
|
|
168
|
+
let i;
|
|
169
|
+
let prop;
|
|
170
|
+
const merged = {};
|
|
171
|
+
destObj = destObj || {};
|
|
172
|
+
if (sourceObj == null) return destObj;
|
|
173
|
+
do {
|
|
174
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
175
|
+
i = props.length;
|
|
176
|
+
while (i-- > 0) {
|
|
177
|
+
prop = props[i];
|
|
178
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
179
|
+
destObj[prop] = sourceObj[prop];
|
|
180
|
+
merged[prop] = true;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
|
|
184
|
+
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
185
|
+
return destObj;
|
|
186
|
+
};
|
|
187
|
+
const endsWith = (str, searchString, position) => {
|
|
188
|
+
str = String(str);
|
|
189
|
+
if (position === void 0 || position > str.length) {
|
|
190
|
+
position = str.length;
|
|
191
|
+
}
|
|
192
|
+
position -= searchString.length;
|
|
193
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
194
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
195
|
+
};
|
|
196
|
+
const toArray = (thing) => {
|
|
197
|
+
if (!thing) return null;
|
|
198
|
+
if (isArray$2(thing)) return thing;
|
|
199
|
+
let i = thing.length;
|
|
200
|
+
if (!isNumber$1(i)) return null;
|
|
201
|
+
const arr = new Array(i);
|
|
202
|
+
while (i-- > 0) {
|
|
203
|
+
arr[i] = thing[i];
|
|
204
|
+
}
|
|
205
|
+
return arr;
|
|
206
|
+
};
|
|
207
|
+
const isTypedArray$1 = /* @__PURE__ */ ((TypedArray) => {
|
|
208
|
+
return (thing) => {
|
|
209
|
+
return TypedArray && thing instanceof TypedArray;
|
|
210
|
+
};
|
|
211
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
212
|
+
const forEachEntry = (obj, fn2) => {
|
|
213
|
+
const generator = obj && obj[iterator];
|
|
214
|
+
const _iterator = generator.call(obj);
|
|
215
|
+
let result;
|
|
216
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
217
|
+
const pair = result.value;
|
|
218
|
+
fn2.call(obj, pair[0], pair[1]);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const matchAll = (regExp, str) => {
|
|
222
|
+
let matches;
|
|
223
|
+
const arr = [];
|
|
224
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
225
|
+
arr.push(matches);
|
|
226
|
+
}
|
|
227
|
+
return arr;
|
|
228
|
+
};
|
|
229
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
230
|
+
const toCamelCase = (str) => {
|
|
231
|
+
return str.toLowerCase().replace(
|
|
232
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
233
|
+
function replacer(m, p1, p2) {
|
|
234
|
+
return p1.toUpperCase() + p2;
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
};
|
|
238
|
+
const hasOwnProperty$f = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
239
|
+
const isRegExp = kindOfTest("RegExp");
|
|
240
|
+
const reduceDescriptors = (obj, reducer) => {
|
|
241
|
+
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
|
|
242
|
+
const reducedDescriptors = {};
|
|
243
|
+
forEach(descriptors2, (descriptor, name) => {
|
|
244
|
+
let ret;
|
|
245
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
246
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
250
|
+
};
|
|
251
|
+
const freezeMethods = (obj) => {
|
|
252
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
253
|
+
if (isFunction$3(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
const value = obj[name];
|
|
257
|
+
if (!isFunction$3(value)) return;
|
|
258
|
+
descriptor.enumerable = false;
|
|
259
|
+
if ("writable" in descriptor) {
|
|
260
|
+
descriptor.writable = false;
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (!descriptor.set) {
|
|
264
|
+
descriptor.set = () => {
|
|
265
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
271
|
+
const obj = {};
|
|
272
|
+
const define = (arr) => {
|
|
273
|
+
arr.forEach((value) => {
|
|
274
|
+
obj[value] = true;
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
isArray$2(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
278
|
+
return obj;
|
|
279
|
+
};
|
|
280
|
+
const noop$1 = () => {
|
|
281
|
+
};
|
|
282
|
+
const toFiniteNumber = (value, defaultValue) => {
|
|
283
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
284
|
+
};
|
|
285
|
+
function isSpecCompliantForm(thing) {
|
|
286
|
+
return !!(thing && isFunction$3(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
287
|
+
}
|
|
288
|
+
const toJSONObject = (obj) => {
|
|
289
|
+
const stack = new Array(10);
|
|
290
|
+
const visit = (source, i) => {
|
|
291
|
+
if (isObject$3(source)) {
|
|
292
|
+
if (stack.indexOf(source) >= 0) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (isBuffer$1(source)) {
|
|
296
|
+
return source;
|
|
297
|
+
}
|
|
298
|
+
if (!("toJSON" in source)) {
|
|
299
|
+
stack[i] = source;
|
|
300
|
+
const target = isArray$2(source) ? [] : {};
|
|
301
|
+
forEach(source, (value, key) => {
|
|
302
|
+
const reducedValue = visit(value, i + 1);
|
|
303
|
+
!isUndefined$1(reducedValue) && (target[key] = reducedValue);
|
|
304
|
+
});
|
|
305
|
+
stack[i] = void 0;
|
|
306
|
+
return target;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return source;
|
|
310
|
+
};
|
|
311
|
+
return visit(obj, 0);
|
|
312
|
+
};
|
|
313
|
+
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
314
|
+
const isThenable = (thing) => thing && (isObject$3(thing) || isFunction$3(thing)) && isFunction$3(thing.then) && isFunction$3(thing.catch);
|
|
315
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
316
|
+
if (setImmediateSupported) {
|
|
317
|
+
return setImmediate;
|
|
318
|
+
}
|
|
319
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
320
|
+
_global.addEventListener("message", ({ source, data }) => {
|
|
321
|
+
if (source === _global && data === token) {
|
|
322
|
+
callbacks.length && callbacks.shift()();
|
|
323
|
+
}
|
|
324
|
+
}, false);
|
|
325
|
+
return (cb) => {
|
|
326
|
+
callbacks.push(cb);
|
|
327
|
+
_global.postMessage(token, "*");
|
|
328
|
+
};
|
|
329
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
330
|
+
})(
|
|
331
|
+
typeof setImmediate === "function",
|
|
332
|
+
isFunction$3(_global.postMessage)
|
|
333
|
+
);
|
|
334
|
+
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
335
|
+
const isIterable = (thing) => thing != null && isFunction$3(thing[iterator]);
|
|
336
|
+
const utils$1 = {
|
|
337
|
+
isArray: isArray$2,
|
|
338
|
+
isArrayBuffer,
|
|
339
|
+
isBuffer: isBuffer$1,
|
|
340
|
+
isFormData,
|
|
341
|
+
isArrayBufferView,
|
|
342
|
+
isString: isString$1,
|
|
343
|
+
isNumber: isNumber$1,
|
|
344
|
+
isBoolean: isBoolean$1,
|
|
345
|
+
isObject: isObject$3,
|
|
346
|
+
isPlainObject: isPlainObject$1,
|
|
347
|
+
isEmptyObject,
|
|
348
|
+
isReadableStream,
|
|
349
|
+
isRequest,
|
|
350
|
+
isResponse,
|
|
351
|
+
isHeaders,
|
|
352
|
+
isUndefined: isUndefined$1,
|
|
353
|
+
isDate,
|
|
354
|
+
isFile,
|
|
355
|
+
isBlob,
|
|
356
|
+
isRegExp,
|
|
357
|
+
isFunction: isFunction$3,
|
|
358
|
+
isStream,
|
|
359
|
+
isURLSearchParams,
|
|
360
|
+
isTypedArray: isTypedArray$1,
|
|
361
|
+
isFileList,
|
|
362
|
+
forEach,
|
|
363
|
+
merge,
|
|
364
|
+
extend,
|
|
365
|
+
trim,
|
|
366
|
+
stripBOM,
|
|
367
|
+
inherits,
|
|
368
|
+
toFlatObject,
|
|
369
|
+
kindOf,
|
|
370
|
+
kindOfTest,
|
|
371
|
+
endsWith,
|
|
372
|
+
toArray,
|
|
373
|
+
forEachEntry,
|
|
374
|
+
matchAll,
|
|
375
|
+
isHTMLForm,
|
|
376
|
+
hasOwnProperty: hasOwnProperty$f,
|
|
377
|
+
hasOwnProp: hasOwnProperty$f,
|
|
378
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
379
|
+
reduceDescriptors,
|
|
380
|
+
freezeMethods,
|
|
381
|
+
toObjectSet,
|
|
382
|
+
toCamelCase,
|
|
383
|
+
noop: noop$1,
|
|
384
|
+
toFiniteNumber,
|
|
385
|
+
findKey,
|
|
386
|
+
global: _global,
|
|
387
|
+
isContextDefined,
|
|
388
|
+
isSpecCompliantForm,
|
|
389
|
+
toJSONObject,
|
|
390
|
+
isAsyncFn,
|
|
391
|
+
isThenable,
|
|
392
|
+
setImmediate: _setImmediate,
|
|
393
|
+
asap,
|
|
394
|
+
isIterable
|
|
395
|
+
};
|
|
396
|
+
function AxiosError$1(message, code, config, request, response) {
|
|
397
|
+
Error.call(this);
|
|
398
|
+
if (Error.captureStackTrace) {
|
|
399
|
+
Error.captureStackTrace(this, this.constructor);
|
|
400
|
+
} else {
|
|
401
|
+
this.stack = new Error().stack;
|
|
402
|
+
}
|
|
403
|
+
this.message = message;
|
|
404
|
+
this.name = "AxiosError";
|
|
405
|
+
code && (this.code = code);
|
|
406
|
+
config && (this.config = config);
|
|
407
|
+
request && (this.request = request);
|
|
408
|
+
if (response) {
|
|
409
|
+
this.response = response;
|
|
410
|
+
this.status = response.status ? response.status : null;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
utils$1.inherits(AxiosError$1, Error, {
|
|
414
|
+
toJSON: function toJSON() {
|
|
415
|
+
return {
|
|
416
|
+
// Standard
|
|
417
|
+
message: this.message,
|
|
418
|
+
name: this.name,
|
|
419
|
+
// Microsoft
|
|
420
|
+
description: this.description,
|
|
421
|
+
number: this.number,
|
|
422
|
+
// Mozilla
|
|
423
|
+
fileName: this.fileName,
|
|
424
|
+
lineNumber: this.lineNumber,
|
|
425
|
+
columnNumber: this.columnNumber,
|
|
426
|
+
stack: this.stack,
|
|
427
|
+
// Axios
|
|
428
|
+
config: utils$1.toJSONObject(this.config),
|
|
429
|
+
code: this.code,
|
|
430
|
+
status: this.status
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
const prototype$1 = AxiosError$1.prototype;
|
|
435
|
+
const descriptors = {};
|
|
436
|
+
[
|
|
437
|
+
"ERR_BAD_OPTION_VALUE",
|
|
438
|
+
"ERR_BAD_OPTION",
|
|
439
|
+
"ECONNABORTED",
|
|
440
|
+
"ETIMEDOUT",
|
|
441
|
+
"ERR_NETWORK",
|
|
442
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
443
|
+
"ERR_DEPRECATED",
|
|
444
|
+
"ERR_BAD_RESPONSE",
|
|
445
|
+
"ERR_BAD_REQUEST",
|
|
446
|
+
"ERR_CANCELED",
|
|
447
|
+
"ERR_NOT_SUPPORT",
|
|
448
|
+
"ERR_INVALID_URL"
|
|
449
|
+
// eslint-disable-next-line func-names
|
|
450
|
+
].forEach((code) => {
|
|
451
|
+
descriptors[code] = { value: code };
|
|
452
|
+
});
|
|
453
|
+
Object.defineProperties(AxiosError$1, descriptors);
|
|
454
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
|
|
455
|
+
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
456
|
+
const axiosError = Object.create(prototype$1);
|
|
457
|
+
utils$1.toFlatObject(error, axiosError, function filter2(obj) {
|
|
458
|
+
return obj !== Error.prototype;
|
|
459
|
+
}, (prop) => {
|
|
460
|
+
return prop !== "isAxiosError";
|
|
461
|
+
});
|
|
462
|
+
const msg = error && error.message ? error.message : "Error";
|
|
463
|
+
const errCode = code == null && error ? error.code : code;
|
|
464
|
+
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
465
|
+
if (error && axiosError.cause == null) {
|
|
466
|
+
Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
|
|
467
|
+
}
|
|
468
|
+
axiosError.name = error && error.name || "Error";
|
|
469
|
+
customProps && Object.assign(axiosError, customProps);
|
|
470
|
+
return axiosError;
|
|
471
|
+
};
|
|
472
|
+
const httpAdapter = null;
|
|
473
|
+
function isVisitable(thing) {
|
|
474
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
475
|
+
}
|
|
476
|
+
function removeBrackets(key) {
|
|
477
|
+
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
478
|
+
}
|
|
479
|
+
function renderKey(path, key, dots) {
|
|
480
|
+
if (!path) return key;
|
|
481
|
+
return path.concat(key).map(function each(token, i) {
|
|
482
|
+
token = removeBrackets(token);
|
|
483
|
+
return !dots && i ? "[" + token + "]" : token;
|
|
484
|
+
}).join(dots ? "." : "");
|
|
485
|
+
}
|
|
486
|
+
function isFlatArray(arr) {
|
|
487
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
488
|
+
}
|
|
489
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
490
|
+
return /^is[A-Z]/.test(prop);
|
|
491
|
+
});
|
|
492
|
+
function toFormData$1(obj, formData, options) {
|
|
493
|
+
if (!utils$1.isObject(obj)) {
|
|
494
|
+
throw new TypeError("target must be an object");
|
|
495
|
+
}
|
|
496
|
+
formData = formData || new FormData();
|
|
497
|
+
options = utils$1.toFlatObject(options, {
|
|
498
|
+
metaTokens: true,
|
|
499
|
+
dots: false,
|
|
500
|
+
indexes: false
|
|
501
|
+
}, false, function defined(option, source) {
|
|
502
|
+
return !utils$1.isUndefined(source[option]);
|
|
503
|
+
});
|
|
504
|
+
const metaTokens = options.metaTokens;
|
|
505
|
+
const visitor = options.visitor || defaultVisitor;
|
|
506
|
+
const dots = options.dots;
|
|
507
|
+
const indexes = options.indexes;
|
|
508
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
509
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
510
|
+
if (!utils$1.isFunction(visitor)) {
|
|
511
|
+
throw new TypeError("visitor must be a function");
|
|
512
|
+
}
|
|
513
|
+
function convertValue(value) {
|
|
514
|
+
if (value === null) return "";
|
|
515
|
+
if (utils$1.isDate(value)) {
|
|
516
|
+
return value.toISOString();
|
|
517
|
+
}
|
|
518
|
+
if (utils$1.isBoolean(value)) {
|
|
519
|
+
return value.toString();
|
|
520
|
+
}
|
|
521
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
522
|
+
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
523
|
+
}
|
|
524
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
525
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
526
|
+
}
|
|
527
|
+
return value;
|
|
528
|
+
}
|
|
529
|
+
function defaultVisitor(value, key, path) {
|
|
530
|
+
let arr = value;
|
|
531
|
+
if (value && !path && typeof value === "object") {
|
|
532
|
+
if (utils$1.endsWith(key, "{}")) {
|
|
533
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
534
|
+
value = JSON.stringify(value);
|
|
535
|
+
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
|
|
536
|
+
key = removeBrackets(key);
|
|
537
|
+
arr.forEach(function each(el, index2) {
|
|
538
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
539
|
+
// eslint-disable-next-line no-nested-ternary
|
|
540
|
+
indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
|
|
541
|
+
convertValue(el)
|
|
542
|
+
);
|
|
543
|
+
});
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (isVisitable(value)) {
|
|
548
|
+
return true;
|
|
549
|
+
}
|
|
550
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
const stack = [];
|
|
554
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
555
|
+
defaultVisitor,
|
|
556
|
+
convertValue,
|
|
557
|
+
isVisitable
|
|
558
|
+
});
|
|
559
|
+
function build(value, path) {
|
|
560
|
+
if (utils$1.isUndefined(value)) return;
|
|
561
|
+
if (stack.indexOf(value) !== -1) {
|
|
562
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
563
|
+
}
|
|
564
|
+
stack.push(value);
|
|
565
|
+
utils$1.forEach(value, function each(el, key) {
|
|
566
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
567
|
+
formData,
|
|
568
|
+
el,
|
|
569
|
+
utils$1.isString(key) ? key.trim() : key,
|
|
570
|
+
path,
|
|
571
|
+
exposedHelpers
|
|
572
|
+
);
|
|
573
|
+
if (result === true) {
|
|
574
|
+
build(el, path ? path.concat(key) : [key]);
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
stack.pop();
|
|
578
|
+
}
|
|
579
|
+
if (!utils$1.isObject(obj)) {
|
|
580
|
+
throw new TypeError("data must be an object");
|
|
581
|
+
}
|
|
582
|
+
build(obj);
|
|
583
|
+
return formData;
|
|
584
|
+
}
|
|
585
|
+
function encode$1(str) {
|
|
586
|
+
const charMap = {
|
|
587
|
+
"!": "%21",
|
|
588
|
+
"'": "%27",
|
|
589
|
+
"(": "%28",
|
|
590
|
+
")": "%29",
|
|
591
|
+
"~": "%7E",
|
|
592
|
+
"%20": "+",
|
|
593
|
+
"%00": "\0"
|
|
594
|
+
};
|
|
595
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
596
|
+
return charMap[match];
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
function AxiosURLSearchParams(params, options) {
|
|
600
|
+
this._pairs = [];
|
|
601
|
+
params && toFormData$1(params, this, options);
|
|
602
|
+
}
|
|
603
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
604
|
+
prototype.append = function append(name, value) {
|
|
605
|
+
this._pairs.push([name, value]);
|
|
606
|
+
};
|
|
607
|
+
prototype.toString = function toString(encoder) {
|
|
608
|
+
const _encode = encoder ? function(value) {
|
|
609
|
+
return encoder.call(this, value, encode$1);
|
|
610
|
+
} : encode$1;
|
|
611
|
+
return this._pairs.map(function each(pair) {
|
|
612
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
613
|
+
}, "").join("&");
|
|
614
|
+
};
|
|
615
|
+
function encode(val) {
|
|
616
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
617
|
+
}
|
|
618
|
+
function buildURL(url, params, options) {
|
|
619
|
+
if (!params) {
|
|
620
|
+
return url;
|
|
621
|
+
}
|
|
622
|
+
const _encode = options && options.encode || encode;
|
|
623
|
+
if (utils$1.isFunction(options)) {
|
|
624
|
+
options = {
|
|
625
|
+
serialize: options
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
const serializeFn = options && options.serialize;
|
|
629
|
+
let serializedParams;
|
|
630
|
+
if (serializeFn) {
|
|
631
|
+
serializedParams = serializeFn(params, options);
|
|
632
|
+
} else {
|
|
633
|
+
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
|
|
634
|
+
}
|
|
635
|
+
if (serializedParams) {
|
|
636
|
+
const hashmarkIndex = url.indexOf("#");
|
|
637
|
+
if (hashmarkIndex !== -1) {
|
|
638
|
+
url = url.slice(0, hashmarkIndex);
|
|
639
|
+
}
|
|
640
|
+
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
641
|
+
}
|
|
642
|
+
return url;
|
|
643
|
+
}
|
|
644
|
+
class InterceptorManager {
|
|
645
|
+
constructor() {
|
|
646
|
+
this.handlers = [];
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Add a new interceptor to the stack
|
|
650
|
+
*
|
|
651
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
652
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
653
|
+
*
|
|
654
|
+
* @return {Number} An ID used to remove interceptor later
|
|
655
|
+
*/
|
|
656
|
+
use(fulfilled, rejected, options) {
|
|
657
|
+
this.handlers.push({
|
|
658
|
+
fulfilled,
|
|
659
|
+
rejected,
|
|
660
|
+
synchronous: options ? options.synchronous : false,
|
|
661
|
+
runWhen: options ? options.runWhen : null
|
|
662
|
+
});
|
|
663
|
+
return this.handlers.length - 1;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Remove an interceptor from the stack
|
|
667
|
+
*
|
|
668
|
+
* @param {Number} id The ID that was returned by `use`
|
|
669
|
+
*
|
|
670
|
+
* @returns {void}
|
|
671
|
+
*/
|
|
672
|
+
eject(id) {
|
|
673
|
+
if (this.handlers[id]) {
|
|
674
|
+
this.handlers[id] = null;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Clear all interceptors from the stack
|
|
679
|
+
*
|
|
680
|
+
* @returns {void}
|
|
681
|
+
*/
|
|
682
|
+
clear() {
|
|
683
|
+
if (this.handlers) {
|
|
684
|
+
this.handlers = [];
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Iterate over all the registered interceptors
|
|
689
|
+
*
|
|
690
|
+
* This method is particularly useful for skipping over any
|
|
691
|
+
* interceptors that may have become `null` calling `eject`.
|
|
692
|
+
*
|
|
693
|
+
* @param {Function} fn The function to call for each interceptor
|
|
694
|
+
*
|
|
695
|
+
* @returns {void}
|
|
696
|
+
*/
|
|
697
|
+
forEach(fn2) {
|
|
698
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
699
|
+
if (h !== null) {
|
|
700
|
+
fn2(h);
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
const transitionalDefaults = {
|
|
706
|
+
silentJSONParsing: true,
|
|
707
|
+
forcedJSONParsing: true,
|
|
708
|
+
clarifyTimeoutError: false
|
|
709
|
+
};
|
|
710
|
+
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
711
|
+
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
|
712
|
+
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
|
|
713
|
+
const platform$1 = {
|
|
714
|
+
isBrowser: true,
|
|
715
|
+
classes: {
|
|
716
|
+
URLSearchParams: URLSearchParams$1,
|
|
717
|
+
FormData: FormData$1,
|
|
718
|
+
Blob: Blob$1
|
|
719
|
+
},
|
|
720
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
721
|
+
};
|
|
722
|
+
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
723
|
+
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
724
|
+
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
725
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
726
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
727
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
728
|
+
})();
|
|
729
|
+
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
730
|
+
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
731
|
+
__proto__: null,
|
|
732
|
+
hasBrowserEnv,
|
|
733
|
+
hasStandardBrowserEnv,
|
|
734
|
+
hasStandardBrowserWebWorkerEnv,
|
|
735
|
+
navigator: _navigator,
|
|
736
|
+
origin
|
|
737
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
738
|
+
const platform = {
|
|
739
|
+
...utils,
|
|
740
|
+
...platform$1
|
|
741
|
+
};
|
|
742
|
+
function toURLEncodedForm(data, options) {
|
|
743
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
744
|
+
visitor: function(value, key, path, helpers) {
|
|
745
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
746
|
+
this.append(key, value.toString("base64"));
|
|
747
|
+
return false;
|
|
748
|
+
}
|
|
749
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
750
|
+
},
|
|
751
|
+
...options
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
function parsePropPath(name) {
|
|
755
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
756
|
+
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
function arrayToObject(arr) {
|
|
760
|
+
const obj = {};
|
|
761
|
+
const keys2 = Object.keys(arr);
|
|
762
|
+
let i;
|
|
763
|
+
const len = keys2.length;
|
|
764
|
+
let key;
|
|
765
|
+
for (i = 0; i < len; i++) {
|
|
766
|
+
key = keys2[i];
|
|
767
|
+
obj[key] = arr[key];
|
|
768
|
+
}
|
|
769
|
+
return obj;
|
|
770
|
+
}
|
|
771
|
+
function formDataToJSON(formData) {
|
|
772
|
+
function buildPath(path, value, target, index2) {
|
|
773
|
+
let name = path[index2++];
|
|
774
|
+
if (name === "__proto__") return true;
|
|
775
|
+
const isNumericKey = Number.isFinite(+name);
|
|
776
|
+
const isLast = index2 >= path.length;
|
|
777
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
778
|
+
if (isLast) {
|
|
779
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
780
|
+
target[name] = [target[name], value];
|
|
781
|
+
} else {
|
|
782
|
+
target[name] = value;
|
|
783
|
+
}
|
|
784
|
+
return !isNumericKey;
|
|
785
|
+
}
|
|
786
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
787
|
+
target[name] = [];
|
|
788
|
+
}
|
|
789
|
+
const result = buildPath(path, value, target[name], index2);
|
|
790
|
+
if (result && utils$1.isArray(target[name])) {
|
|
791
|
+
target[name] = arrayToObject(target[name]);
|
|
792
|
+
}
|
|
793
|
+
return !isNumericKey;
|
|
794
|
+
}
|
|
795
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
796
|
+
const obj = {};
|
|
797
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
798
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
799
|
+
});
|
|
800
|
+
return obj;
|
|
801
|
+
}
|
|
802
|
+
return null;
|
|
803
|
+
}
|
|
804
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
805
|
+
if (utils$1.isString(rawValue)) {
|
|
806
|
+
try {
|
|
807
|
+
(parser || JSON.parse)(rawValue);
|
|
808
|
+
return utils$1.trim(rawValue);
|
|
809
|
+
} catch (e) {
|
|
810
|
+
if (e.name !== "SyntaxError") {
|
|
811
|
+
throw e;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
816
|
+
}
|
|
817
|
+
const defaults = {
|
|
818
|
+
transitional: transitionalDefaults,
|
|
819
|
+
adapter: ["xhr", "http", "fetch"],
|
|
820
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
821
|
+
const contentType = headers.getContentType() || "";
|
|
822
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
823
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
824
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
825
|
+
data = new FormData(data);
|
|
826
|
+
}
|
|
827
|
+
const isFormData2 = utils$1.isFormData(data);
|
|
828
|
+
if (isFormData2) {
|
|
829
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
830
|
+
}
|
|
831
|
+
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
|
|
832
|
+
return data;
|
|
833
|
+
}
|
|
834
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
835
|
+
return data.buffer;
|
|
836
|
+
}
|
|
837
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
838
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
839
|
+
return data.toString();
|
|
840
|
+
}
|
|
841
|
+
let isFileList2;
|
|
842
|
+
if (isObjectPayload) {
|
|
843
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
844
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
845
|
+
}
|
|
846
|
+
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
847
|
+
const _FormData = this.env && this.env.FormData;
|
|
848
|
+
return toFormData$1(
|
|
849
|
+
isFileList2 ? { "files[]": data } : data,
|
|
850
|
+
_FormData && new _FormData(),
|
|
851
|
+
this.formSerializer
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
856
|
+
headers.setContentType("application/json", false);
|
|
857
|
+
return stringifySafely(data);
|
|
858
|
+
}
|
|
859
|
+
return data;
|
|
860
|
+
}],
|
|
861
|
+
transformResponse: [function transformResponse(data) {
|
|
862
|
+
const transitional2 = this.transitional || defaults.transitional;
|
|
863
|
+
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
864
|
+
const JSONRequested = this.responseType === "json";
|
|
865
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
866
|
+
return data;
|
|
867
|
+
}
|
|
868
|
+
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
869
|
+
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
870
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
871
|
+
try {
|
|
872
|
+
return JSON.parse(data, this.parseReviver);
|
|
873
|
+
} catch (e) {
|
|
874
|
+
if (strictJSONParsing) {
|
|
875
|
+
if (e.name === "SyntaxError") {
|
|
876
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
877
|
+
}
|
|
878
|
+
throw e;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return data;
|
|
883
|
+
}],
|
|
884
|
+
/**
|
|
885
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
886
|
+
* timeout is not created.
|
|
887
|
+
*/
|
|
888
|
+
timeout: 0,
|
|
889
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
890
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
891
|
+
maxContentLength: -1,
|
|
892
|
+
maxBodyLength: -1,
|
|
893
|
+
env: {
|
|
894
|
+
FormData: platform.classes.FormData,
|
|
895
|
+
Blob: platform.classes.Blob
|
|
896
|
+
},
|
|
897
|
+
validateStatus: function validateStatus(status) {
|
|
898
|
+
return status >= 200 && status < 300;
|
|
899
|
+
},
|
|
900
|
+
headers: {
|
|
901
|
+
common: {
|
|
902
|
+
"Accept": "application/json, text/plain, */*",
|
|
903
|
+
"Content-Type": void 0
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
908
|
+
defaults.headers[method] = {};
|
|
909
|
+
});
|
|
910
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
911
|
+
"age",
|
|
912
|
+
"authorization",
|
|
913
|
+
"content-length",
|
|
914
|
+
"content-type",
|
|
915
|
+
"etag",
|
|
916
|
+
"expires",
|
|
917
|
+
"from",
|
|
918
|
+
"host",
|
|
919
|
+
"if-modified-since",
|
|
920
|
+
"if-unmodified-since",
|
|
921
|
+
"last-modified",
|
|
922
|
+
"location",
|
|
923
|
+
"max-forwards",
|
|
924
|
+
"proxy-authorization",
|
|
925
|
+
"referer",
|
|
926
|
+
"retry-after",
|
|
927
|
+
"user-agent"
|
|
928
|
+
]);
|
|
929
|
+
const parseHeaders = (rawHeaders) => {
|
|
930
|
+
const parsed = {};
|
|
931
|
+
let key;
|
|
932
|
+
let val;
|
|
933
|
+
let i;
|
|
934
|
+
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
935
|
+
i = line.indexOf(":");
|
|
936
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
937
|
+
val = line.substring(i + 1).trim();
|
|
938
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
if (key === "set-cookie") {
|
|
942
|
+
if (parsed[key]) {
|
|
943
|
+
parsed[key].push(val);
|
|
944
|
+
} else {
|
|
945
|
+
parsed[key] = [val];
|
|
946
|
+
}
|
|
947
|
+
} else {
|
|
948
|
+
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
return parsed;
|
|
952
|
+
};
|
|
953
|
+
const $internals = Symbol("internals");
|
|
954
|
+
function normalizeHeader(header) {
|
|
955
|
+
return header && String(header).trim().toLowerCase();
|
|
956
|
+
}
|
|
957
|
+
function normalizeValue(value) {
|
|
958
|
+
if (value === false || value == null) {
|
|
959
|
+
return value;
|
|
960
|
+
}
|
|
961
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
962
|
+
}
|
|
963
|
+
function parseTokens(str) {
|
|
964
|
+
const tokens = /* @__PURE__ */ Object.create(null);
|
|
965
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
966
|
+
let match;
|
|
967
|
+
while (match = tokensRE.exec(str)) {
|
|
968
|
+
tokens[match[1]] = match[2];
|
|
969
|
+
}
|
|
970
|
+
return tokens;
|
|
971
|
+
}
|
|
972
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
973
|
+
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
974
|
+
if (utils$1.isFunction(filter2)) {
|
|
975
|
+
return filter2.call(this, value, header);
|
|
976
|
+
}
|
|
977
|
+
if (isHeaderNameFilter) {
|
|
978
|
+
value = header;
|
|
979
|
+
}
|
|
980
|
+
if (!utils$1.isString(value)) return;
|
|
981
|
+
if (utils$1.isString(filter2)) {
|
|
982
|
+
return value.indexOf(filter2) !== -1;
|
|
983
|
+
}
|
|
984
|
+
if (utils$1.isRegExp(filter2)) {
|
|
985
|
+
return filter2.test(value);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
function formatHeader(header) {
|
|
989
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
990
|
+
return char.toUpperCase() + str;
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
function buildAccessors(obj, header) {
|
|
994
|
+
const accessorName = utils$1.toCamelCase(" " + header);
|
|
995
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
996
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
997
|
+
value: function(arg1, arg2, arg3) {
|
|
998
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
999
|
+
},
|
|
1000
|
+
configurable: true
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
let AxiosHeaders$1 = class AxiosHeaders {
|
|
1005
|
+
constructor(headers) {
|
|
1006
|
+
headers && this.set(headers);
|
|
1007
|
+
}
|
|
1008
|
+
set(header, valueOrRewrite, rewrite) {
|
|
1009
|
+
const self2 = this;
|
|
1010
|
+
function setHeader(_value, _header, _rewrite) {
|
|
1011
|
+
const lHeader = normalizeHeader(_header);
|
|
1012
|
+
if (!lHeader) {
|
|
1013
|
+
throw new Error("header name must be a non-empty string");
|
|
1014
|
+
}
|
|
1015
|
+
const key = utils$1.findKey(self2, lHeader);
|
|
1016
|
+
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
1017
|
+
self2[key || _header] = normalizeValue(_value);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1021
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1022
|
+
setHeaders(header, valueOrRewrite);
|
|
1023
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1024
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1025
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1026
|
+
let obj = {}, dest, key;
|
|
1027
|
+
for (const entry of header) {
|
|
1028
|
+
if (!utils$1.isArray(entry)) {
|
|
1029
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
1030
|
+
}
|
|
1031
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
1032
|
+
}
|
|
1033
|
+
setHeaders(obj, valueOrRewrite);
|
|
1034
|
+
} else {
|
|
1035
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1036
|
+
}
|
|
1037
|
+
return this;
|
|
1038
|
+
}
|
|
1039
|
+
get(header, parser) {
|
|
1040
|
+
header = normalizeHeader(header);
|
|
1041
|
+
if (header) {
|
|
1042
|
+
const key = utils$1.findKey(this, header);
|
|
1043
|
+
if (key) {
|
|
1044
|
+
const value = this[key];
|
|
1045
|
+
if (!parser) {
|
|
1046
|
+
return value;
|
|
1047
|
+
}
|
|
1048
|
+
if (parser === true) {
|
|
1049
|
+
return parseTokens(value);
|
|
1050
|
+
}
|
|
1051
|
+
if (utils$1.isFunction(parser)) {
|
|
1052
|
+
return parser.call(this, value, key);
|
|
1053
|
+
}
|
|
1054
|
+
if (utils$1.isRegExp(parser)) {
|
|
1055
|
+
return parser.exec(value);
|
|
1056
|
+
}
|
|
1057
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
has(header, matcher) {
|
|
1062
|
+
header = normalizeHeader(header);
|
|
1063
|
+
if (header) {
|
|
1064
|
+
const key = utils$1.findKey(this, header);
|
|
1065
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1066
|
+
}
|
|
1067
|
+
return false;
|
|
1068
|
+
}
|
|
1069
|
+
delete(header, matcher) {
|
|
1070
|
+
const self2 = this;
|
|
1071
|
+
let deleted = false;
|
|
1072
|
+
function deleteHeader(_header) {
|
|
1073
|
+
_header = normalizeHeader(_header);
|
|
1074
|
+
if (_header) {
|
|
1075
|
+
const key = utils$1.findKey(self2, _header);
|
|
1076
|
+
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
1077
|
+
delete self2[key];
|
|
1078
|
+
deleted = true;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
if (utils$1.isArray(header)) {
|
|
1083
|
+
header.forEach(deleteHeader);
|
|
1084
|
+
} else {
|
|
1085
|
+
deleteHeader(header);
|
|
1086
|
+
}
|
|
1087
|
+
return deleted;
|
|
1088
|
+
}
|
|
1089
|
+
clear(matcher) {
|
|
1090
|
+
const keys2 = Object.keys(this);
|
|
1091
|
+
let i = keys2.length;
|
|
1092
|
+
let deleted = false;
|
|
1093
|
+
while (i--) {
|
|
1094
|
+
const key = keys2[i];
|
|
1095
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1096
|
+
delete this[key];
|
|
1097
|
+
deleted = true;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return deleted;
|
|
1101
|
+
}
|
|
1102
|
+
normalize(format) {
|
|
1103
|
+
const self2 = this;
|
|
1104
|
+
const headers = {};
|
|
1105
|
+
utils$1.forEach(this, (value, header) => {
|
|
1106
|
+
const key = utils$1.findKey(headers, header);
|
|
1107
|
+
if (key) {
|
|
1108
|
+
self2[key] = normalizeValue(value);
|
|
1109
|
+
delete self2[header];
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
1113
|
+
if (normalized !== header) {
|
|
1114
|
+
delete self2[header];
|
|
1115
|
+
}
|
|
1116
|
+
self2[normalized] = normalizeValue(value);
|
|
1117
|
+
headers[normalized] = true;
|
|
1118
|
+
});
|
|
1119
|
+
return this;
|
|
1120
|
+
}
|
|
1121
|
+
concat(...targets) {
|
|
1122
|
+
return this.constructor.concat(this, ...targets);
|
|
1123
|
+
}
|
|
1124
|
+
toJSON(asStrings) {
|
|
1125
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1126
|
+
utils$1.forEach(this, (value, header) => {
|
|
1127
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
|
|
1128
|
+
});
|
|
1129
|
+
return obj;
|
|
1130
|
+
}
|
|
1131
|
+
[Symbol.iterator]() {
|
|
1132
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1133
|
+
}
|
|
1134
|
+
toString() {
|
|
1135
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
1136
|
+
}
|
|
1137
|
+
getSetCookie() {
|
|
1138
|
+
return this.get("set-cookie") || [];
|
|
1139
|
+
}
|
|
1140
|
+
get [Symbol.toStringTag]() {
|
|
1141
|
+
return "AxiosHeaders";
|
|
1142
|
+
}
|
|
1143
|
+
static from(thing) {
|
|
1144
|
+
return thing instanceof this ? thing : new this(thing);
|
|
1145
|
+
}
|
|
1146
|
+
static concat(first, ...targets) {
|
|
1147
|
+
const computed2 = new this(first);
|
|
1148
|
+
targets.forEach((target) => computed2.set(target));
|
|
1149
|
+
return computed2;
|
|
1150
|
+
}
|
|
1151
|
+
static accessor(header) {
|
|
1152
|
+
const internals = this[$internals] = this[$internals] = {
|
|
1153
|
+
accessors: {}
|
|
1154
|
+
};
|
|
1155
|
+
const accessors = internals.accessors;
|
|
1156
|
+
const prototype2 = this.prototype;
|
|
1157
|
+
function defineAccessor(_header) {
|
|
1158
|
+
const lHeader = normalizeHeader(_header);
|
|
1159
|
+
if (!accessors[lHeader]) {
|
|
1160
|
+
buildAccessors(prototype2, _header);
|
|
1161
|
+
accessors[lHeader] = true;
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1165
|
+
return this;
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1169
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
1170
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
1171
|
+
return {
|
|
1172
|
+
get: () => value,
|
|
1173
|
+
set(headerValue) {
|
|
1174
|
+
this[mapped] = headerValue;
|
|
1175
|
+
}
|
|
1176
|
+
};
|
|
1177
|
+
});
|
|
1178
|
+
utils$1.freezeMethods(AxiosHeaders$1);
|
|
1179
|
+
function transformData(fns, response) {
|
|
1180
|
+
const config = this || defaults;
|
|
1181
|
+
const context = response || config;
|
|
1182
|
+
const headers = AxiosHeaders$1.from(context.headers);
|
|
1183
|
+
let data = context.data;
|
|
1184
|
+
utils$1.forEach(fns, function transform(fn2) {
|
|
1185
|
+
data = fn2.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
1186
|
+
});
|
|
1187
|
+
headers.normalize();
|
|
1188
|
+
return data;
|
|
1189
|
+
}
|
|
1190
|
+
function isCancel$1(value) {
|
|
1191
|
+
return !!(value && value.__CANCEL__);
|
|
1192
|
+
}
|
|
1193
|
+
function CanceledError$1(message, config, request) {
|
|
1194
|
+
AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
1195
|
+
this.name = "CanceledError";
|
|
1196
|
+
}
|
|
1197
|
+
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
1198
|
+
__CANCEL__: true
|
|
1199
|
+
});
|
|
1200
|
+
function settle(resolve, reject, response) {
|
|
1201
|
+
const validateStatus2 = response.config.validateStatus;
|
|
1202
|
+
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
1203
|
+
resolve(response);
|
|
1204
|
+
} else {
|
|
1205
|
+
reject(new AxiosError$1(
|
|
1206
|
+
"Request failed with status code " + response.status,
|
|
1207
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
1208
|
+
response.config,
|
|
1209
|
+
response.request,
|
|
1210
|
+
response
|
|
1211
|
+
));
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
function parseProtocol(url) {
|
|
1215
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
1216
|
+
return match && match[1] || "";
|
|
1217
|
+
}
|
|
1218
|
+
function speedometer(samplesCount, min) {
|
|
1219
|
+
samplesCount = samplesCount || 10;
|
|
1220
|
+
const bytes = new Array(samplesCount);
|
|
1221
|
+
const timestamps = new Array(samplesCount);
|
|
1222
|
+
let head = 0;
|
|
1223
|
+
let tail = 0;
|
|
1224
|
+
let firstSampleTS;
|
|
1225
|
+
min = min !== void 0 ? min : 1e3;
|
|
1226
|
+
return function push(chunkLength) {
|
|
1227
|
+
const now = Date.now();
|
|
1228
|
+
const startedAt = timestamps[tail];
|
|
1229
|
+
if (!firstSampleTS) {
|
|
1230
|
+
firstSampleTS = now;
|
|
1231
|
+
}
|
|
1232
|
+
bytes[head] = chunkLength;
|
|
1233
|
+
timestamps[head] = now;
|
|
1234
|
+
let i = tail;
|
|
1235
|
+
let bytesCount = 0;
|
|
1236
|
+
while (i !== head) {
|
|
1237
|
+
bytesCount += bytes[i++];
|
|
1238
|
+
i = i % samplesCount;
|
|
1239
|
+
}
|
|
1240
|
+
head = (head + 1) % samplesCount;
|
|
1241
|
+
if (head === tail) {
|
|
1242
|
+
tail = (tail + 1) % samplesCount;
|
|
1243
|
+
}
|
|
1244
|
+
if (now - firstSampleTS < min) {
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
const passed = startedAt && now - startedAt;
|
|
1248
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
function throttle(fn2, freq) {
|
|
1252
|
+
let timestamp = 0;
|
|
1253
|
+
let threshold = 1e3 / freq;
|
|
1254
|
+
let lastArgs;
|
|
1255
|
+
let timer;
|
|
1256
|
+
const invoke = (args, now = Date.now()) => {
|
|
1257
|
+
timestamp = now;
|
|
1258
|
+
lastArgs = null;
|
|
1259
|
+
if (timer) {
|
|
1260
|
+
clearTimeout(timer);
|
|
1261
|
+
timer = null;
|
|
1262
|
+
}
|
|
1263
|
+
fn2(...args);
|
|
1264
|
+
};
|
|
1265
|
+
const throttled = (...args) => {
|
|
1266
|
+
const now = Date.now();
|
|
1267
|
+
const passed = now - timestamp;
|
|
1268
|
+
if (passed >= threshold) {
|
|
1269
|
+
invoke(args, now);
|
|
1270
|
+
} else {
|
|
1271
|
+
lastArgs = args;
|
|
1272
|
+
if (!timer) {
|
|
1273
|
+
timer = setTimeout(() => {
|
|
1274
|
+
timer = null;
|
|
1275
|
+
invoke(lastArgs);
|
|
1276
|
+
}, threshold - passed);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
1281
|
+
return [throttled, flush];
|
|
1282
|
+
}
|
|
1283
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
1284
|
+
let bytesNotified = 0;
|
|
1285
|
+
const _speedometer = speedometer(50, 250);
|
|
1286
|
+
return throttle((e) => {
|
|
1287
|
+
const loaded = e.loaded;
|
|
1288
|
+
const total = e.lengthComputable ? e.total : void 0;
|
|
1289
|
+
const progressBytes = loaded - bytesNotified;
|
|
1290
|
+
const rate = _speedometer(progressBytes);
|
|
1291
|
+
const inRange = loaded <= total;
|
|
1292
|
+
bytesNotified = loaded;
|
|
1293
|
+
const data = {
|
|
1294
|
+
loaded,
|
|
1295
|
+
total,
|
|
1296
|
+
progress: total ? loaded / total : void 0,
|
|
1297
|
+
bytes: progressBytes,
|
|
1298
|
+
rate: rate ? rate : void 0,
|
|
1299
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
1300
|
+
event: e,
|
|
1301
|
+
lengthComputable: total != null,
|
|
1302
|
+
[isDownloadStream ? "download" : "upload"]: true
|
|
1303
|
+
};
|
|
1304
|
+
listener(data);
|
|
1305
|
+
}, freq);
|
|
1306
|
+
};
|
|
1307
|
+
const progressEventDecorator = (total, throttled) => {
|
|
1308
|
+
const lengthComputable = total != null;
|
|
1309
|
+
return [(loaded) => throttled[0]({
|
|
1310
|
+
lengthComputable,
|
|
1311
|
+
total,
|
|
1312
|
+
loaded
|
|
1313
|
+
}), throttled[1]];
|
|
1314
|
+
};
|
|
1315
|
+
const asyncDecorator = (fn2) => (...args) => utils$1.asap(() => fn2(...args));
|
|
1316
|
+
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
|
|
1317
|
+
url = new URL(url, platform.origin);
|
|
1318
|
+
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
|
|
1319
|
+
})(
|
|
1320
|
+
new URL(platform.origin),
|
|
1321
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
1322
|
+
) : () => true;
|
|
1323
|
+
const cookies = platform.hasStandardBrowserEnv ? (
|
|
1324
|
+
// Standard browser envs support document.cookie
|
|
1325
|
+
{
|
|
1326
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
1327
|
+
if (typeof document === "undefined") return;
|
|
1328
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
1329
|
+
if (utils$1.isNumber(expires)) {
|
|
1330
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
1331
|
+
}
|
|
1332
|
+
if (utils$1.isString(path)) {
|
|
1333
|
+
cookie.push(`path=${path}`);
|
|
1334
|
+
}
|
|
1335
|
+
if (utils$1.isString(domain)) {
|
|
1336
|
+
cookie.push(`domain=${domain}`);
|
|
1337
|
+
}
|
|
1338
|
+
if (secure === true) {
|
|
1339
|
+
cookie.push("secure");
|
|
1340
|
+
}
|
|
1341
|
+
if (utils$1.isString(sameSite)) {
|
|
1342
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
1343
|
+
}
|
|
1344
|
+
document.cookie = cookie.join("; ");
|
|
1345
|
+
},
|
|
1346
|
+
read(name) {
|
|
1347
|
+
if (typeof document === "undefined") return null;
|
|
1348
|
+
const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
|
|
1349
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
1350
|
+
},
|
|
1351
|
+
remove(name) {
|
|
1352
|
+
this.write(name, "", Date.now() - 864e5, "/");
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
) : (
|
|
1356
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1357
|
+
{
|
|
1358
|
+
write() {
|
|
1359
|
+
},
|
|
1360
|
+
read() {
|
|
1361
|
+
return null;
|
|
1362
|
+
},
|
|
1363
|
+
remove() {
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
);
|
|
1367
|
+
function isAbsoluteURL(url) {
|
|
1368
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
1369
|
+
}
|
|
1370
|
+
function combineURLs(baseURL, relativeURL) {
|
|
1371
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
1372
|
+
}
|
|
1373
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
1374
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
1375
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
1376
|
+
return combineURLs(baseURL, requestedURL);
|
|
1377
|
+
}
|
|
1378
|
+
return requestedURL;
|
|
1379
|
+
}
|
|
1380
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
1381
|
+
function mergeConfig$1(config1, config2) {
|
|
1382
|
+
config2 = config2 || {};
|
|
1383
|
+
const config = {};
|
|
1384
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
1385
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
1386
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
1387
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
1388
|
+
return utils$1.merge({}, source);
|
|
1389
|
+
} else if (utils$1.isArray(source)) {
|
|
1390
|
+
return source.slice();
|
|
1391
|
+
}
|
|
1392
|
+
return source;
|
|
1393
|
+
}
|
|
1394
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
1395
|
+
if (!utils$1.isUndefined(b)) {
|
|
1396
|
+
return getMergedValue(a, b, prop, caseless);
|
|
1397
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
1398
|
+
return getMergedValue(void 0, a, prop, caseless);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
function valueFromConfig2(a, b) {
|
|
1402
|
+
if (!utils$1.isUndefined(b)) {
|
|
1403
|
+
return getMergedValue(void 0, b);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
function defaultToConfig2(a, b) {
|
|
1407
|
+
if (!utils$1.isUndefined(b)) {
|
|
1408
|
+
return getMergedValue(void 0, b);
|
|
1409
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
1410
|
+
return getMergedValue(void 0, a);
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
function mergeDirectKeys(a, b, prop) {
|
|
1414
|
+
if (prop in config2) {
|
|
1415
|
+
return getMergedValue(a, b);
|
|
1416
|
+
} else if (prop in config1) {
|
|
1417
|
+
return getMergedValue(void 0, a);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
const mergeMap = {
|
|
1421
|
+
url: valueFromConfig2,
|
|
1422
|
+
method: valueFromConfig2,
|
|
1423
|
+
data: valueFromConfig2,
|
|
1424
|
+
baseURL: defaultToConfig2,
|
|
1425
|
+
transformRequest: defaultToConfig2,
|
|
1426
|
+
transformResponse: defaultToConfig2,
|
|
1427
|
+
paramsSerializer: defaultToConfig2,
|
|
1428
|
+
timeout: defaultToConfig2,
|
|
1429
|
+
timeoutMessage: defaultToConfig2,
|
|
1430
|
+
withCredentials: defaultToConfig2,
|
|
1431
|
+
withXSRFToken: defaultToConfig2,
|
|
1432
|
+
adapter: defaultToConfig2,
|
|
1433
|
+
responseType: defaultToConfig2,
|
|
1434
|
+
xsrfCookieName: defaultToConfig2,
|
|
1435
|
+
xsrfHeaderName: defaultToConfig2,
|
|
1436
|
+
onUploadProgress: defaultToConfig2,
|
|
1437
|
+
onDownloadProgress: defaultToConfig2,
|
|
1438
|
+
decompress: defaultToConfig2,
|
|
1439
|
+
maxContentLength: defaultToConfig2,
|
|
1440
|
+
maxBodyLength: defaultToConfig2,
|
|
1441
|
+
beforeRedirect: defaultToConfig2,
|
|
1442
|
+
transport: defaultToConfig2,
|
|
1443
|
+
httpAgent: defaultToConfig2,
|
|
1444
|
+
httpsAgent: defaultToConfig2,
|
|
1445
|
+
cancelToken: defaultToConfig2,
|
|
1446
|
+
socketPath: defaultToConfig2,
|
|
1447
|
+
responseEncoding: defaultToConfig2,
|
|
1448
|
+
validateStatus: mergeDirectKeys,
|
|
1449
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
1450
|
+
};
|
|
1451
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
1452
|
+
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
1453
|
+
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
1454
|
+
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
1455
|
+
});
|
|
1456
|
+
return config;
|
|
1457
|
+
}
|
|
1458
|
+
const resolveConfig = (config) => {
|
|
1459
|
+
const newConfig = mergeConfig$1({}, config);
|
|
1460
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
1461
|
+
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
1462
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
1463
|
+
if (auth) {
|
|
1464
|
+
headers.set(
|
|
1465
|
+
"Authorization",
|
|
1466
|
+
"Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
|
|
1467
|
+
);
|
|
1468
|
+
}
|
|
1469
|
+
if (utils$1.isFormData(data)) {
|
|
1470
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
1471
|
+
headers.setContentType(void 0);
|
|
1472
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
1473
|
+
const formHeaders = data.getHeaders();
|
|
1474
|
+
const allowedHeaders = ["content-type", "content-length"];
|
|
1475
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
1476
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
1477
|
+
headers.set(key, val);
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
if (platform.hasStandardBrowserEnv) {
|
|
1483
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
1484
|
+
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
1485
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
1486
|
+
if (xsrfValue) {
|
|
1487
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
return newConfig;
|
|
1492
|
+
};
|
|
1493
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
1494
|
+
const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
1495
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
1496
|
+
const _config = resolveConfig(config);
|
|
1497
|
+
let requestData = _config.data;
|
|
1498
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
1499
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
1500
|
+
let onCanceled;
|
|
1501
|
+
let uploadThrottled, downloadThrottled;
|
|
1502
|
+
let flushUpload, flushDownload;
|
|
1503
|
+
function done() {
|
|
1504
|
+
flushUpload && flushUpload();
|
|
1505
|
+
flushDownload && flushDownload();
|
|
1506
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
1507
|
+
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
1508
|
+
}
|
|
1509
|
+
let request = new XMLHttpRequest();
|
|
1510
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
1511
|
+
request.timeout = _config.timeout;
|
|
1512
|
+
function onloadend() {
|
|
1513
|
+
if (!request) {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
1517
|
+
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
1518
|
+
);
|
|
1519
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
1520
|
+
const response = {
|
|
1521
|
+
data: responseData,
|
|
1522
|
+
status: request.status,
|
|
1523
|
+
statusText: request.statusText,
|
|
1524
|
+
headers: responseHeaders,
|
|
1525
|
+
config,
|
|
1526
|
+
request
|
|
1527
|
+
};
|
|
1528
|
+
settle(function _resolve(value) {
|
|
1529
|
+
resolve(value);
|
|
1530
|
+
done();
|
|
1531
|
+
}, function _reject(err) {
|
|
1532
|
+
reject(err);
|
|
1533
|
+
done();
|
|
1534
|
+
}, response);
|
|
1535
|
+
request = null;
|
|
1536
|
+
}
|
|
1537
|
+
if ("onloadend" in request) {
|
|
1538
|
+
request.onloadend = onloadend;
|
|
1539
|
+
} else {
|
|
1540
|
+
request.onreadystatechange = function handleLoad() {
|
|
1541
|
+
if (!request || request.readyState !== 4) {
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
setTimeout(onloadend);
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
request.onabort = function handleAbort() {
|
|
1551
|
+
if (!request) {
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
|
|
1555
|
+
request = null;
|
|
1556
|
+
};
|
|
1557
|
+
request.onerror = function handleError(event) {
|
|
1558
|
+
const msg = event && event.message ? event.message : "Network Error";
|
|
1559
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
1560
|
+
err.event = event || null;
|
|
1561
|
+
reject(err);
|
|
1562
|
+
request = null;
|
|
1563
|
+
};
|
|
1564
|
+
request.ontimeout = function handleTimeout() {
|
|
1565
|
+
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
1566
|
+
const transitional2 = _config.transitional || transitionalDefaults;
|
|
1567
|
+
if (_config.timeoutErrorMessage) {
|
|
1568
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
1569
|
+
}
|
|
1570
|
+
reject(new AxiosError$1(
|
|
1571
|
+
timeoutErrorMessage,
|
|
1572
|
+
transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
1573
|
+
config,
|
|
1574
|
+
request
|
|
1575
|
+
));
|
|
1576
|
+
request = null;
|
|
1577
|
+
};
|
|
1578
|
+
requestData === void 0 && requestHeaders.setContentType(null);
|
|
1579
|
+
if ("setRequestHeader" in request) {
|
|
1580
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
1581
|
+
request.setRequestHeader(key, val);
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
1585
|
+
request.withCredentials = !!_config.withCredentials;
|
|
1586
|
+
}
|
|
1587
|
+
if (responseType && responseType !== "json") {
|
|
1588
|
+
request.responseType = _config.responseType;
|
|
1589
|
+
}
|
|
1590
|
+
if (onDownloadProgress) {
|
|
1591
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
1592
|
+
request.addEventListener("progress", downloadThrottled);
|
|
1593
|
+
}
|
|
1594
|
+
if (onUploadProgress && request.upload) {
|
|
1595
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
1596
|
+
request.upload.addEventListener("progress", uploadThrottled);
|
|
1597
|
+
request.upload.addEventListener("loadend", flushUpload);
|
|
1598
|
+
}
|
|
1599
|
+
if (_config.cancelToken || _config.signal) {
|
|
1600
|
+
onCanceled = (cancel) => {
|
|
1601
|
+
if (!request) {
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1604
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
1605
|
+
request.abort();
|
|
1606
|
+
request = null;
|
|
1607
|
+
};
|
|
1608
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
1609
|
+
if (_config.signal) {
|
|
1610
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
const protocol = parseProtocol(_config.url);
|
|
1614
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
1615
|
+
reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
request.send(requestData || null);
|
|
1619
|
+
});
|
|
1620
|
+
};
|
|
1621
|
+
const composeSignals = (signals, timeout) => {
|
|
1622
|
+
const { length } = signals = signals ? signals.filter(Boolean) : [];
|
|
1623
|
+
if (timeout || length) {
|
|
1624
|
+
let controller = new AbortController();
|
|
1625
|
+
let aborted;
|
|
1626
|
+
const onabort = function(reason) {
|
|
1627
|
+
if (!aborted) {
|
|
1628
|
+
aborted = true;
|
|
1629
|
+
unsubscribe();
|
|
1630
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
1631
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
let timer = timeout && setTimeout(() => {
|
|
1635
|
+
timer = null;
|
|
1636
|
+
onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
1637
|
+
}, timeout);
|
|
1638
|
+
const unsubscribe = () => {
|
|
1639
|
+
if (signals) {
|
|
1640
|
+
timer && clearTimeout(timer);
|
|
1641
|
+
timer = null;
|
|
1642
|
+
signals.forEach((signal2) => {
|
|
1643
|
+
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
1644
|
+
});
|
|
1645
|
+
signals = null;
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
1649
|
+
const { signal } = controller;
|
|
1650
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
1651
|
+
return signal;
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
1655
|
+
let len = chunk.byteLength;
|
|
1656
|
+
if (len < chunkSize) {
|
|
1657
|
+
yield chunk;
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
let pos = 0;
|
|
1661
|
+
let end;
|
|
1662
|
+
while (pos < len) {
|
|
1663
|
+
end = pos + chunkSize;
|
|
1664
|
+
yield chunk.slice(pos, end);
|
|
1665
|
+
pos = end;
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
1669
|
+
for await (const chunk of readStream(iterable)) {
|
|
1670
|
+
yield* streamChunk(chunk, chunkSize);
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
const readStream = async function* (stream) {
|
|
1674
|
+
if (stream[Symbol.asyncIterator]) {
|
|
1675
|
+
yield* stream;
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
const reader = stream.getReader();
|
|
1679
|
+
try {
|
|
1680
|
+
for (; ; ) {
|
|
1681
|
+
const { done, value } = await reader.read();
|
|
1682
|
+
if (done) {
|
|
1683
|
+
break;
|
|
1684
|
+
}
|
|
1685
|
+
yield value;
|
|
1686
|
+
}
|
|
1687
|
+
} finally {
|
|
1688
|
+
await reader.cancel();
|
|
1689
|
+
}
|
|
1690
|
+
};
|
|
1691
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
1692
|
+
const iterator2 = readBytes(stream, chunkSize);
|
|
1693
|
+
let bytes = 0;
|
|
1694
|
+
let done;
|
|
1695
|
+
let _onFinish = (e) => {
|
|
1696
|
+
if (!done) {
|
|
1697
|
+
done = true;
|
|
1698
|
+
onFinish && onFinish(e);
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
return new ReadableStream({
|
|
1702
|
+
async pull(controller) {
|
|
1703
|
+
try {
|
|
1704
|
+
const { done: done2, value } = await iterator2.next();
|
|
1705
|
+
if (done2) {
|
|
1706
|
+
_onFinish();
|
|
1707
|
+
controller.close();
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
let len = value.byteLength;
|
|
1711
|
+
if (onProgress) {
|
|
1712
|
+
let loadedBytes = bytes += len;
|
|
1713
|
+
onProgress(loadedBytes);
|
|
1714
|
+
}
|
|
1715
|
+
controller.enqueue(new Uint8Array(value));
|
|
1716
|
+
} catch (err) {
|
|
1717
|
+
_onFinish(err);
|
|
1718
|
+
throw err;
|
|
1719
|
+
}
|
|
1720
|
+
},
|
|
1721
|
+
cancel(reason) {
|
|
1722
|
+
_onFinish(reason);
|
|
1723
|
+
return iterator2.return();
|
|
1724
|
+
}
|
|
1725
|
+
}, {
|
|
1726
|
+
highWaterMark: 2
|
|
1727
|
+
});
|
|
1728
|
+
};
|
|
1729
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
1730
|
+
const { isFunction: isFunction$2 } = utils$1;
|
|
1731
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
1732
|
+
Request,
|
|
1733
|
+
Response
|
|
1734
|
+
}))(utils$1.global);
|
|
1735
|
+
const {
|
|
1736
|
+
ReadableStream: ReadableStream$1,
|
|
1737
|
+
TextEncoder
|
|
1738
|
+
} = utils$1.global;
|
|
1739
|
+
const test = (fn2, ...args) => {
|
|
1740
|
+
try {
|
|
1741
|
+
return !!fn2(...args);
|
|
1742
|
+
} catch (e) {
|
|
1743
|
+
return false;
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1746
|
+
const factory = (env) => {
|
|
1747
|
+
env = utils$1.merge.call({
|
|
1748
|
+
skipUndefined: true
|
|
1749
|
+
}, globalFetchAPI, env);
|
|
1750
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
1751
|
+
const isFetchSupported = envFetch ? isFunction$2(envFetch) : typeof fetch === "function";
|
|
1752
|
+
const isRequestSupported = isFunction$2(Request);
|
|
1753
|
+
const isResponseSupported = isFunction$2(Response);
|
|
1754
|
+
if (!isFetchSupported) {
|
|
1755
|
+
return false;
|
|
1756
|
+
}
|
|
1757
|
+
const isReadableStreamSupported = isFetchSupported && isFunction$2(ReadableStream$1);
|
|
1758
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
1759
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
1760
|
+
let duplexAccessed = false;
|
|
1761
|
+
const hasContentType = new Request(platform.origin, {
|
|
1762
|
+
body: new ReadableStream$1(),
|
|
1763
|
+
method: "POST",
|
|
1764
|
+
get duplex() {
|
|
1765
|
+
duplexAccessed = true;
|
|
1766
|
+
return "half";
|
|
1767
|
+
}
|
|
1768
|
+
}).headers.has("Content-Type");
|
|
1769
|
+
return duplexAccessed && !hasContentType;
|
|
1770
|
+
});
|
|
1771
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
1772
|
+
const resolvers = {
|
|
1773
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
1774
|
+
};
|
|
1775
|
+
isFetchSupported && (() => {
|
|
1776
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
1777
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
1778
|
+
let method = res && res[type];
|
|
1779
|
+
if (method) {
|
|
1780
|
+
return method.call(res);
|
|
1781
|
+
}
|
|
1782
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
1783
|
+
});
|
|
1784
|
+
});
|
|
1785
|
+
})();
|
|
1786
|
+
const getBodyLength = async (body) => {
|
|
1787
|
+
if (body == null) {
|
|
1788
|
+
return 0;
|
|
1789
|
+
}
|
|
1790
|
+
if (utils$1.isBlob(body)) {
|
|
1791
|
+
return body.size;
|
|
1792
|
+
}
|
|
1793
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
1794
|
+
const _request = new Request(platform.origin, {
|
|
1795
|
+
method: "POST",
|
|
1796
|
+
body
|
|
1797
|
+
});
|
|
1798
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
1799
|
+
}
|
|
1800
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
1801
|
+
return body.byteLength;
|
|
1802
|
+
}
|
|
1803
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
1804
|
+
body = body + "";
|
|
1805
|
+
}
|
|
1806
|
+
if (utils$1.isString(body)) {
|
|
1807
|
+
return (await encodeText(body)).byteLength;
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
const resolveBodyLength = async (headers, body) => {
|
|
1811
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
1812
|
+
return length == null ? getBodyLength(body) : length;
|
|
1813
|
+
};
|
|
1814
|
+
return async (config) => {
|
|
1815
|
+
let {
|
|
1816
|
+
url,
|
|
1817
|
+
method,
|
|
1818
|
+
data,
|
|
1819
|
+
signal,
|
|
1820
|
+
cancelToken,
|
|
1821
|
+
timeout,
|
|
1822
|
+
onDownloadProgress,
|
|
1823
|
+
onUploadProgress,
|
|
1824
|
+
responseType,
|
|
1825
|
+
headers,
|
|
1826
|
+
withCredentials = "same-origin",
|
|
1827
|
+
fetchOptions
|
|
1828
|
+
} = resolveConfig(config);
|
|
1829
|
+
let _fetch = envFetch || fetch;
|
|
1830
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
1831
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
1832
|
+
let request = null;
|
|
1833
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
1834
|
+
composedSignal.unsubscribe();
|
|
1835
|
+
});
|
|
1836
|
+
let requestContentLength;
|
|
1837
|
+
try {
|
|
1838
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
1839
|
+
let _request = new Request(url, {
|
|
1840
|
+
method: "POST",
|
|
1841
|
+
body: data,
|
|
1842
|
+
duplex: "half"
|
|
1843
|
+
});
|
|
1844
|
+
let contentTypeHeader;
|
|
1845
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
1846
|
+
headers.setContentType(contentTypeHeader);
|
|
1847
|
+
}
|
|
1848
|
+
if (_request.body) {
|
|
1849
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
1850
|
+
requestContentLength,
|
|
1851
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
1852
|
+
);
|
|
1853
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
if (!utils$1.isString(withCredentials)) {
|
|
1857
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
1858
|
+
}
|
|
1859
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
1860
|
+
const resolvedOptions = {
|
|
1861
|
+
...fetchOptions,
|
|
1862
|
+
signal: composedSignal,
|
|
1863
|
+
method: method.toUpperCase(),
|
|
1864
|
+
headers: headers.normalize().toJSON(),
|
|
1865
|
+
body: data,
|
|
1866
|
+
duplex: "half",
|
|
1867
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
1868
|
+
};
|
|
1869
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
1870
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
1871
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
1872
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
1873
|
+
const options = {};
|
|
1874
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
1875
|
+
options[prop] = response[prop];
|
|
1876
|
+
});
|
|
1877
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
|
|
1878
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
1879
|
+
responseContentLength,
|
|
1880
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
1881
|
+
) || [];
|
|
1882
|
+
response = new Response(
|
|
1883
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
1884
|
+
flush && flush();
|
|
1885
|
+
unsubscribe && unsubscribe();
|
|
1886
|
+
}),
|
|
1887
|
+
options
|
|
1888
|
+
);
|
|
1889
|
+
}
|
|
1890
|
+
responseType = responseType || "text";
|
|
1891
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
|
|
1892
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
1893
|
+
return await new Promise((resolve, reject) => {
|
|
1894
|
+
settle(resolve, reject, {
|
|
1895
|
+
data: responseData,
|
|
1896
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
1897
|
+
status: response.status,
|
|
1898
|
+
statusText: response.statusText,
|
|
1899
|
+
config,
|
|
1900
|
+
request
|
|
1901
|
+
});
|
|
1902
|
+
});
|
|
1903
|
+
} catch (err) {
|
|
1904
|
+
unsubscribe && unsubscribe();
|
|
1905
|
+
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
1906
|
+
throw Object.assign(
|
|
1907
|
+
new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
|
|
1908
|
+
{
|
|
1909
|
+
cause: err.cause || err
|
|
1910
|
+
}
|
|
1911
|
+
);
|
|
1912
|
+
}
|
|
1913
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1916
|
+
};
|
|
1917
|
+
const seedCache = /* @__PURE__ */ new Map();
|
|
1918
|
+
const getFetch = (config) => {
|
|
1919
|
+
let env = config && config.env || {};
|
|
1920
|
+
const { fetch: fetch2, Request, Response } = env;
|
|
1921
|
+
const seeds = [
|
|
1922
|
+
Request,
|
|
1923
|
+
Response,
|
|
1924
|
+
fetch2
|
|
1925
|
+
];
|
|
1926
|
+
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
1927
|
+
while (i--) {
|
|
1928
|
+
seed = seeds[i];
|
|
1929
|
+
target = map.get(seed);
|
|
1930
|
+
target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
|
|
1931
|
+
map = target;
|
|
1932
|
+
}
|
|
1933
|
+
return target;
|
|
1934
|
+
};
|
|
1935
|
+
getFetch();
|
|
1936
|
+
const knownAdapters = {
|
|
1937
|
+
http: httpAdapter,
|
|
1938
|
+
xhr: xhrAdapter,
|
|
1939
|
+
fetch: {
|
|
1940
|
+
get: getFetch
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
utils$1.forEach(knownAdapters, (fn2, value) => {
|
|
1944
|
+
if (fn2) {
|
|
1945
|
+
try {
|
|
1946
|
+
Object.defineProperty(fn2, "name", { value });
|
|
1947
|
+
} catch (e) {
|
|
1948
|
+
}
|
|
1949
|
+
Object.defineProperty(fn2, "adapterName", { value });
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
const renderReason = (reason) => `- ${reason}`;
|
|
1953
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
1954
|
+
function getAdapter$1(adapters2, config) {
|
|
1955
|
+
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
|
|
1956
|
+
const { length } = adapters2;
|
|
1957
|
+
let nameOrAdapter;
|
|
1958
|
+
let adapter;
|
|
1959
|
+
const rejectedReasons = {};
|
|
1960
|
+
for (let i = 0; i < length; i++) {
|
|
1961
|
+
nameOrAdapter = adapters2[i];
|
|
1962
|
+
let id;
|
|
1963
|
+
adapter = nameOrAdapter;
|
|
1964
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
1965
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
1966
|
+
if (adapter === void 0) {
|
|
1967
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
1971
|
+
break;
|
|
1972
|
+
}
|
|
1973
|
+
rejectedReasons[id || "#" + i] = adapter;
|
|
1974
|
+
}
|
|
1975
|
+
if (!adapter) {
|
|
1976
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
1977
|
+
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
1978
|
+
);
|
|
1979
|
+
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
1980
|
+
throw new AxiosError$1(
|
|
1981
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
1982
|
+
"ERR_NOT_SUPPORT"
|
|
1983
|
+
);
|
|
1984
|
+
}
|
|
1985
|
+
return adapter;
|
|
1986
|
+
}
|
|
1987
|
+
const adapters = {
|
|
1988
|
+
/**
|
|
1989
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
1990
|
+
* @type {Function}
|
|
1991
|
+
*/
|
|
1992
|
+
getAdapter: getAdapter$1,
|
|
1993
|
+
/**
|
|
1994
|
+
* Exposes all known adapters
|
|
1995
|
+
* @type {Object<string, Function|Object>}
|
|
1996
|
+
*/
|
|
1997
|
+
adapters: knownAdapters
|
|
1998
|
+
};
|
|
1999
|
+
function throwIfCancellationRequested(config) {
|
|
2000
|
+
if (config.cancelToken) {
|
|
2001
|
+
config.cancelToken.throwIfRequested();
|
|
2002
|
+
}
|
|
2003
|
+
if (config.signal && config.signal.aborted) {
|
|
2004
|
+
throw new CanceledError$1(null, config);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
function dispatchRequest(config) {
|
|
2008
|
+
throwIfCancellationRequested(config);
|
|
2009
|
+
config.headers = AxiosHeaders$1.from(config.headers);
|
|
2010
|
+
config.data = transformData.call(
|
|
2011
|
+
config,
|
|
2012
|
+
config.transformRequest
|
|
2013
|
+
);
|
|
2014
|
+
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
2015
|
+
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
2016
|
+
}
|
|
2017
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
2018
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
|
2019
|
+
throwIfCancellationRequested(config);
|
|
2020
|
+
response.data = transformData.call(
|
|
2021
|
+
config,
|
|
2022
|
+
config.transformResponse,
|
|
2023
|
+
response
|
|
2024
|
+
);
|
|
2025
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
2026
|
+
return response;
|
|
2027
|
+
}, function onAdapterRejection(reason) {
|
|
2028
|
+
if (!isCancel$1(reason)) {
|
|
2029
|
+
throwIfCancellationRequested(config);
|
|
2030
|
+
if (reason && reason.response) {
|
|
2031
|
+
reason.response.data = transformData.call(
|
|
2032
|
+
config,
|
|
2033
|
+
config.transformResponse,
|
|
2034
|
+
reason.response
|
|
2035
|
+
);
|
|
2036
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
return Promise.reject(reason);
|
|
2040
|
+
});
|
|
2041
|
+
}
|
|
2042
|
+
const VERSION$1 = "1.13.2";
|
|
2043
|
+
const validators$1 = {};
|
|
2044
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
2045
|
+
validators$1[type] = function validator2(thing) {
|
|
2046
|
+
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
2047
|
+
};
|
|
2048
|
+
});
|
|
2049
|
+
const deprecatedWarnings = {};
|
|
2050
|
+
validators$1.transitional = function transitional(validator2, version, message) {
|
|
2051
|
+
function formatMessage(opt, desc) {
|
|
2052
|
+
return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
2053
|
+
}
|
|
2054
|
+
return (value, opt, opts) => {
|
|
2055
|
+
if (validator2 === false) {
|
|
2056
|
+
throw new AxiosError$1(
|
|
2057
|
+
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
2058
|
+
AxiosError$1.ERR_DEPRECATED
|
|
2059
|
+
);
|
|
2060
|
+
}
|
|
2061
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
2062
|
+
deprecatedWarnings[opt] = true;
|
|
2063
|
+
console.warn(
|
|
2064
|
+
formatMessage(
|
|
2065
|
+
opt,
|
|
2066
|
+
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
2067
|
+
)
|
|
2068
|
+
);
|
|
2069
|
+
}
|
|
2070
|
+
return validator2 ? validator2(value, opt, opts) : true;
|
|
2071
|
+
};
|
|
2072
|
+
};
|
|
2073
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
2074
|
+
return (value, opt) => {
|
|
2075
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
2076
|
+
return true;
|
|
2077
|
+
};
|
|
2078
|
+
};
|
|
2079
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
2080
|
+
if (typeof options !== "object") {
|
|
2081
|
+
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2082
|
+
}
|
|
2083
|
+
const keys2 = Object.keys(options);
|
|
2084
|
+
let i = keys2.length;
|
|
2085
|
+
while (i-- > 0) {
|
|
2086
|
+
const opt = keys2[i];
|
|
2087
|
+
const validator2 = schema[opt];
|
|
2088
|
+
if (validator2) {
|
|
2089
|
+
const value = options[opt];
|
|
2090
|
+
const result = value === void 0 || validator2(value, opt, options);
|
|
2091
|
+
if (result !== true) {
|
|
2092
|
+
throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2093
|
+
}
|
|
2094
|
+
continue;
|
|
2095
|
+
}
|
|
2096
|
+
if (allowUnknown !== true) {
|
|
2097
|
+
throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
const validator = {
|
|
2102
|
+
assertOptions,
|
|
2103
|
+
validators: validators$1
|
|
2104
|
+
};
|
|
2105
|
+
const validators = validator.validators;
|
|
2106
|
+
let Axios$1 = class Axios {
|
|
2107
|
+
constructor(instanceConfig) {
|
|
2108
|
+
this.defaults = instanceConfig || {};
|
|
2109
|
+
this.interceptors = {
|
|
2110
|
+
request: new InterceptorManager(),
|
|
2111
|
+
response: new InterceptorManager()
|
|
2112
|
+
};
|
|
2113
|
+
}
|
|
2114
|
+
/**
|
|
2115
|
+
* Dispatch a request
|
|
2116
|
+
*
|
|
2117
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
2118
|
+
* @param {?Object} config
|
|
2119
|
+
*
|
|
2120
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
2121
|
+
*/
|
|
2122
|
+
async request(configOrUrl, config) {
|
|
2123
|
+
try {
|
|
2124
|
+
return await this._request(configOrUrl, config);
|
|
2125
|
+
} catch (err) {
|
|
2126
|
+
if (err instanceof Error) {
|
|
2127
|
+
let dummy = {};
|
|
2128
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
2129
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
2130
|
+
try {
|
|
2131
|
+
if (!err.stack) {
|
|
2132
|
+
err.stack = stack;
|
|
2133
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
2134
|
+
err.stack += "\n" + stack;
|
|
2135
|
+
}
|
|
2136
|
+
} catch (e) {
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
throw err;
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
_request(configOrUrl, config) {
|
|
2143
|
+
if (typeof configOrUrl === "string") {
|
|
2144
|
+
config = config || {};
|
|
2145
|
+
config.url = configOrUrl;
|
|
2146
|
+
} else {
|
|
2147
|
+
config = configOrUrl || {};
|
|
2148
|
+
}
|
|
2149
|
+
config = mergeConfig$1(this.defaults, config);
|
|
2150
|
+
const { transitional: transitional2, paramsSerializer, headers } = config;
|
|
2151
|
+
if (transitional2 !== void 0) {
|
|
2152
|
+
validator.assertOptions(transitional2, {
|
|
2153
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
2154
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
2155
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
2156
|
+
}, false);
|
|
2157
|
+
}
|
|
2158
|
+
if (paramsSerializer != null) {
|
|
2159
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
2160
|
+
config.paramsSerializer = {
|
|
2161
|
+
serialize: paramsSerializer
|
|
2162
|
+
};
|
|
2163
|
+
} else {
|
|
2164
|
+
validator.assertOptions(paramsSerializer, {
|
|
2165
|
+
encode: validators.function,
|
|
2166
|
+
serialize: validators.function
|
|
2167
|
+
}, true);
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
if (config.allowAbsoluteUrls !== void 0) ;
|
|
2171
|
+
else if (this.defaults.allowAbsoluteUrls !== void 0) {
|
|
2172
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
2173
|
+
} else {
|
|
2174
|
+
config.allowAbsoluteUrls = true;
|
|
2175
|
+
}
|
|
2176
|
+
validator.assertOptions(config, {
|
|
2177
|
+
baseUrl: validators.spelling("baseURL"),
|
|
2178
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
2179
|
+
}, true);
|
|
2180
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
2181
|
+
let contextHeaders = headers && utils$1.merge(
|
|
2182
|
+
headers.common,
|
|
2183
|
+
headers[config.method]
|
|
2184
|
+
);
|
|
2185
|
+
headers && utils$1.forEach(
|
|
2186
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
2187
|
+
(method) => {
|
|
2188
|
+
delete headers[method];
|
|
2189
|
+
}
|
|
2190
|
+
);
|
|
2191
|
+
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
2192
|
+
const requestInterceptorChain = [];
|
|
2193
|
+
let synchronousRequestInterceptors = true;
|
|
2194
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
2195
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
2196
|
+
return;
|
|
2197
|
+
}
|
|
2198
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
2199
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
2200
|
+
});
|
|
2201
|
+
const responseInterceptorChain = [];
|
|
2202
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
2203
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2204
|
+
});
|
|
2205
|
+
let promise;
|
|
2206
|
+
let i = 0;
|
|
2207
|
+
let len;
|
|
2208
|
+
if (!synchronousRequestInterceptors) {
|
|
2209
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
2210
|
+
chain.unshift(...requestInterceptorChain);
|
|
2211
|
+
chain.push(...responseInterceptorChain);
|
|
2212
|
+
len = chain.length;
|
|
2213
|
+
promise = Promise.resolve(config);
|
|
2214
|
+
while (i < len) {
|
|
2215
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
2216
|
+
}
|
|
2217
|
+
return promise;
|
|
2218
|
+
}
|
|
2219
|
+
len = requestInterceptorChain.length;
|
|
2220
|
+
let newConfig = config;
|
|
2221
|
+
while (i < len) {
|
|
2222
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
2223
|
+
const onRejected = requestInterceptorChain[i++];
|
|
2224
|
+
try {
|
|
2225
|
+
newConfig = onFulfilled(newConfig);
|
|
2226
|
+
} catch (error) {
|
|
2227
|
+
onRejected.call(this, error);
|
|
2228
|
+
break;
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
try {
|
|
2232
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
2233
|
+
} catch (error) {
|
|
2234
|
+
return Promise.reject(error);
|
|
2235
|
+
}
|
|
2236
|
+
i = 0;
|
|
2237
|
+
len = responseInterceptorChain.length;
|
|
2238
|
+
while (i < len) {
|
|
2239
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
2240
|
+
}
|
|
2241
|
+
return promise;
|
|
2242
|
+
}
|
|
2243
|
+
getUri(config) {
|
|
2244
|
+
config = mergeConfig$1(this.defaults, config);
|
|
2245
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
2246
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
2247
|
+
}
|
|
2248
|
+
};
|
|
2249
|
+
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
2250
|
+
Axios$1.prototype[method] = function(url, config) {
|
|
2251
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
2252
|
+
method,
|
|
2253
|
+
url,
|
|
2254
|
+
data: (config || {}).data
|
|
2255
|
+
}));
|
|
2256
|
+
};
|
|
2257
|
+
});
|
|
2258
|
+
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
2259
|
+
function generateHTTPMethod(isForm) {
|
|
2260
|
+
return function httpMethod(url, data, config) {
|
|
2261
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
2262
|
+
method,
|
|
2263
|
+
headers: isForm ? {
|
|
2264
|
+
"Content-Type": "multipart/form-data"
|
|
2265
|
+
} : {},
|
|
2266
|
+
url,
|
|
2267
|
+
data
|
|
2268
|
+
}));
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
|
2272
|
+
Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
2273
|
+
});
|
|
2274
|
+
let CancelToken$1 = class CancelToken {
|
|
2275
|
+
constructor(executor) {
|
|
2276
|
+
if (typeof executor !== "function") {
|
|
2277
|
+
throw new TypeError("executor must be a function.");
|
|
2278
|
+
}
|
|
2279
|
+
let resolvePromise;
|
|
2280
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
2281
|
+
resolvePromise = resolve;
|
|
2282
|
+
});
|
|
2283
|
+
const token = this;
|
|
2284
|
+
this.promise.then((cancel) => {
|
|
2285
|
+
if (!token._listeners) return;
|
|
2286
|
+
let i = token._listeners.length;
|
|
2287
|
+
while (i-- > 0) {
|
|
2288
|
+
token._listeners[i](cancel);
|
|
2289
|
+
}
|
|
2290
|
+
token._listeners = null;
|
|
2291
|
+
});
|
|
2292
|
+
this.promise.then = (onfulfilled) => {
|
|
2293
|
+
let _resolve;
|
|
2294
|
+
const promise = new Promise((resolve) => {
|
|
2295
|
+
token.subscribe(resolve);
|
|
2296
|
+
_resolve = resolve;
|
|
2297
|
+
}).then(onfulfilled);
|
|
2298
|
+
promise.cancel = function reject() {
|
|
2299
|
+
token.unsubscribe(_resolve);
|
|
2300
|
+
};
|
|
2301
|
+
return promise;
|
|
2302
|
+
};
|
|
2303
|
+
executor(function cancel(message, config, request) {
|
|
2304
|
+
if (token.reason) {
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
2308
|
+
resolvePromise(token.reason);
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
2313
|
+
*/
|
|
2314
|
+
throwIfRequested() {
|
|
2315
|
+
if (this.reason) {
|
|
2316
|
+
throw this.reason;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Subscribe to the cancel signal
|
|
2321
|
+
*/
|
|
2322
|
+
subscribe(listener) {
|
|
2323
|
+
if (this.reason) {
|
|
2324
|
+
listener(this.reason);
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
if (this._listeners) {
|
|
2328
|
+
this._listeners.push(listener);
|
|
2329
|
+
} else {
|
|
2330
|
+
this._listeners = [listener];
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
/**
|
|
2334
|
+
* Unsubscribe from the cancel signal
|
|
2335
|
+
*/
|
|
2336
|
+
unsubscribe(listener) {
|
|
2337
|
+
if (!this._listeners) {
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
const index2 = this._listeners.indexOf(listener);
|
|
2341
|
+
if (index2 !== -1) {
|
|
2342
|
+
this._listeners.splice(index2, 1);
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
toAbortSignal() {
|
|
2346
|
+
const controller = new AbortController();
|
|
2347
|
+
const abort = (err) => {
|
|
2348
|
+
controller.abort(err);
|
|
2349
|
+
};
|
|
2350
|
+
this.subscribe(abort);
|
|
2351
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
2352
|
+
return controller.signal;
|
|
2353
|
+
}
|
|
2354
|
+
/**
|
|
2355
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
2356
|
+
* cancels the `CancelToken`.
|
|
2357
|
+
*/
|
|
2358
|
+
static source() {
|
|
2359
|
+
let cancel;
|
|
2360
|
+
const token = new CancelToken(function executor(c) {
|
|
2361
|
+
cancel = c;
|
|
2362
|
+
});
|
|
2363
|
+
return {
|
|
2364
|
+
token,
|
|
2365
|
+
cancel
|
|
2366
|
+
};
|
|
2367
|
+
}
|
|
2368
|
+
};
|
|
2369
|
+
function spread$1(callback) {
|
|
2370
|
+
return function wrap(arr) {
|
|
2371
|
+
return callback.apply(null, arr);
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
2374
|
+
function isAxiosError$1(payload) {
|
|
2375
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
2376
|
+
}
|
|
2377
|
+
const HttpStatusCode$1 = {
|
|
2378
|
+
Continue: 100,
|
|
2379
|
+
SwitchingProtocols: 101,
|
|
2380
|
+
Processing: 102,
|
|
2381
|
+
EarlyHints: 103,
|
|
2382
|
+
Ok: 200,
|
|
2383
|
+
Created: 201,
|
|
2384
|
+
Accepted: 202,
|
|
2385
|
+
NonAuthoritativeInformation: 203,
|
|
2386
|
+
NoContent: 204,
|
|
2387
|
+
ResetContent: 205,
|
|
2388
|
+
PartialContent: 206,
|
|
2389
|
+
MultiStatus: 207,
|
|
2390
|
+
AlreadyReported: 208,
|
|
2391
|
+
ImUsed: 226,
|
|
2392
|
+
MultipleChoices: 300,
|
|
2393
|
+
MovedPermanently: 301,
|
|
2394
|
+
Found: 302,
|
|
2395
|
+
SeeOther: 303,
|
|
2396
|
+
NotModified: 304,
|
|
2397
|
+
UseProxy: 305,
|
|
2398
|
+
Unused: 306,
|
|
2399
|
+
TemporaryRedirect: 307,
|
|
2400
|
+
PermanentRedirect: 308,
|
|
2401
|
+
BadRequest: 400,
|
|
2402
|
+
Unauthorized: 401,
|
|
2403
|
+
PaymentRequired: 402,
|
|
2404
|
+
Forbidden: 403,
|
|
2405
|
+
NotFound: 404,
|
|
2406
|
+
MethodNotAllowed: 405,
|
|
2407
|
+
NotAcceptable: 406,
|
|
2408
|
+
ProxyAuthenticationRequired: 407,
|
|
2409
|
+
RequestTimeout: 408,
|
|
2410
|
+
Conflict: 409,
|
|
2411
|
+
Gone: 410,
|
|
2412
|
+
LengthRequired: 411,
|
|
2413
|
+
PreconditionFailed: 412,
|
|
2414
|
+
PayloadTooLarge: 413,
|
|
2415
|
+
UriTooLong: 414,
|
|
2416
|
+
UnsupportedMediaType: 415,
|
|
2417
|
+
RangeNotSatisfiable: 416,
|
|
2418
|
+
ExpectationFailed: 417,
|
|
2419
|
+
ImATeapot: 418,
|
|
2420
|
+
MisdirectedRequest: 421,
|
|
2421
|
+
UnprocessableEntity: 422,
|
|
2422
|
+
Locked: 423,
|
|
2423
|
+
FailedDependency: 424,
|
|
2424
|
+
TooEarly: 425,
|
|
2425
|
+
UpgradeRequired: 426,
|
|
2426
|
+
PreconditionRequired: 428,
|
|
2427
|
+
TooManyRequests: 429,
|
|
2428
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
2429
|
+
UnavailableForLegalReasons: 451,
|
|
2430
|
+
InternalServerError: 500,
|
|
2431
|
+
NotImplemented: 501,
|
|
2432
|
+
BadGateway: 502,
|
|
2433
|
+
ServiceUnavailable: 503,
|
|
2434
|
+
GatewayTimeout: 504,
|
|
2435
|
+
HttpVersionNotSupported: 505,
|
|
2436
|
+
VariantAlsoNegotiates: 506,
|
|
2437
|
+
InsufficientStorage: 507,
|
|
2438
|
+
LoopDetected: 508,
|
|
2439
|
+
NotExtended: 510,
|
|
2440
|
+
NetworkAuthenticationRequired: 511,
|
|
2441
|
+
WebServerIsDown: 521,
|
|
2442
|
+
ConnectionTimedOut: 522,
|
|
2443
|
+
OriginIsUnreachable: 523,
|
|
2444
|
+
TimeoutOccurred: 524,
|
|
2445
|
+
SslHandshakeFailed: 525,
|
|
2446
|
+
InvalidSslCertificate: 526
|
|
2447
|
+
};
|
|
2448
|
+
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
2449
|
+
HttpStatusCode$1[value] = key;
|
|
2450
|
+
});
|
|
2451
|
+
function createInstance(defaultConfig) {
|
|
2452
|
+
const context = new Axios$1(defaultConfig);
|
|
2453
|
+
const instance = bind(Axios$1.prototype.request, context);
|
|
2454
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
2455
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
2456
|
+
instance.create = function create(instanceConfig) {
|
|
2457
|
+
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
2458
|
+
};
|
|
2459
|
+
return instance;
|
|
2460
|
+
}
|
|
2461
|
+
const axios = createInstance(defaults);
|
|
2462
|
+
axios.Axios = Axios$1;
|
|
2463
|
+
axios.CanceledError = CanceledError$1;
|
|
2464
|
+
axios.CancelToken = CancelToken$1;
|
|
2465
|
+
axios.isCancel = isCancel$1;
|
|
2466
|
+
axios.VERSION = VERSION$1;
|
|
2467
|
+
axios.toFormData = toFormData$1;
|
|
2468
|
+
axios.AxiosError = AxiosError$1;
|
|
2469
|
+
axios.Cancel = axios.CanceledError;
|
|
2470
|
+
axios.all = function all(promises) {
|
|
2471
|
+
return Promise.all(promises);
|
|
2472
|
+
};
|
|
2473
|
+
axios.spread = spread$1;
|
|
2474
|
+
axios.isAxiosError = isAxiosError$1;
|
|
2475
|
+
axios.mergeConfig = mergeConfig$1;
|
|
2476
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
2477
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
2478
|
+
axios.getAdapter = adapters.getAdapter;
|
|
2479
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
2480
|
+
axios.default = axios;
|
|
2481
|
+
const {
|
|
2482
|
+
Axios: Axios2,
|
|
2483
|
+
AxiosError,
|
|
2484
|
+
CanceledError,
|
|
2485
|
+
isCancel,
|
|
2486
|
+
CancelToken: CancelToken2,
|
|
2487
|
+
VERSION,
|
|
2488
|
+
all: all2,
|
|
2489
|
+
Cancel,
|
|
2490
|
+
isAxiosError,
|
|
2491
|
+
spread,
|
|
2492
|
+
toFormData,
|
|
2493
|
+
AxiosHeaders: AxiosHeaders2,
|
|
2494
|
+
HttpStatusCode,
|
|
2495
|
+
formToJSON,
|
|
2496
|
+
getAdapter,
|
|
2497
|
+
mergeConfig
|
|
2498
|
+
} = axios;
|
|
9
2499
|
var __defProp2 = Object.defineProperty;
|
|
10
2500
|
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
2501
|
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -916,12 +3406,29 @@ function checkPermission(permission, permissions, logic = "OR", matchMode = "exa
|
|
|
916
3406
|
}
|
|
917
3407
|
return false;
|
|
918
3408
|
}
|
|
919
|
-
const PERMISSION_STORE_KEY = Symbol("permission-store");
|
|
920
|
-
const PERMISSION_CHECKER_KEY = Symbol("permission-checker");
|
|
3409
|
+
const PERMISSION_STORE_KEY = Symbol.for("@clownlee/cores:permission-store");
|
|
3410
|
+
const PERMISSION_CHECKER_KEY = Symbol.for("@clownlee/cores:permission-checker");
|
|
921
3411
|
function usePermissionCheck(permission, logic = "OR", matchMode = "exact", permissionKey = "permissions", fallback = false) {
|
|
3412
|
+
var _a, _b, _c, _d;
|
|
922
3413
|
const customChecker = inject(PERMISSION_CHECKER_KEY, null);
|
|
923
3414
|
const permissionStore = inject(PERMISSION_STORE_KEY, null);
|
|
3415
|
+
const isDev = ((_b = (_a = import.meta) == null ? void 0 : _a.env) == null ? void 0 : _b.DEV) || ((_d = (_c = import.meta) == null ? void 0 : _c.env) == null ? void 0 : _d.MODE) === "development";
|
|
3416
|
+
if (isDev) {
|
|
3417
|
+
if (!customChecker && !permissionStore) {
|
|
3418
|
+
console.warn(
|
|
3419
|
+
"[Permission] 未找到权限数据源。请确保:",
|
|
3420
|
+
"\n1. 在应用根组件中使用 provide 注入权限 Store",
|
|
3421
|
+
"\n2. 确保 @clownlee/cores 和 @clownlee/rbac 使用相同的 Vue 实例",
|
|
3422
|
+
"\n3. 检查 Symbol key 是否一致:",
|
|
3423
|
+
{
|
|
3424
|
+
storeKey: PERMISSION_STORE_KEY.toString(),
|
|
3425
|
+
checkerKey: PERMISSION_CHECKER_KEY.toString()
|
|
3426
|
+
}
|
|
3427
|
+
);
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
924
3430
|
return computed(() => {
|
|
3431
|
+
var _a2, _b2, _c2, _d2;
|
|
925
3432
|
if (typeof permission === "function") {
|
|
926
3433
|
try {
|
|
927
3434
|
return permission();
|
|
@@ -943,17 +3450,18 @@ function usePermissionCheck(permission, logic = "OR", matchMode = "exact", permi
|
|
|
943
3450
|
try {
|
|
944
3451
|
const store = permissionStore;
|
|
945
3452
|
let permissions = [];
|
|
946
|
-
|
|
947
|
-
|
|
3453
|
+
const storeValue = (store == null ? void 0 : store.value) !== void 0 ? store.value : store;
|
|
3454
|
+
if (storeValue[permissionKey]) {
|
|
3455
|
+
const value = storeValue[permissionKey];
|
|
948
3456
|
permissions = Array.isArray(value == null ? void 0 : value.value) ? value.value : Array.isArray(value) ? value : [];
|
|
949
|
-
} else if (
|
|
950
|
-
const value =
|
|
3457
|
+
} else if (storeValue.$state && storeValue.$state[permissionKey]) {
|
|
3458
|
+
const value = storeValue.$state[permissionKey];
|
|
951
3459
|
permissions = Array.isArray(value) ? value : [];
|
|
952
|
-
} else if (
|
|
953
|
-
const value =
|
|
3460
|
+
} else if (storeValue.state && storeValue.state[permissionKey]) {
|
|
3461
|
+
const value = storeValue.state[permissionKey];
|
|
954
3462
|
permissions = Array.isArray(value) ? value : [];
|
|
955
|
-
} else if (
|
|
956
|
-
const value =
|
|
3463
|
+
} else if (storeValue.permissions) {
|
|
3464
|
+
const value = storeValue.permissions;
|
|
957
3465
|
permissions = Array.isArray(value == null ? void 0 : value.value) ? value.value : Array.isArray(value) ? value : [];
|
|
958
3466
|
}
|
|
959
3467
|
permissions = flattenPermissions(permissions);
|
|
@@ -966,6 +3474,20 @@ function usePermissionCheck(permission, logic = "OR", matchMode = "exact", permi
|
|
|
966
3474
|
return fallback;
|
|
967
3475
|
}
|
|
968
3476
|
}
|
|
3477
|
+
const isDevMode = ((_b2 = (_a2 = import.meta) == null ? void 0 : _a2.env) == null ? void 0 : _b2.DEV) || ((_d2 = (_c2 = import.meta) == null ? void 0 : _c2.env) == null ? void 0 : _d2.MODE) === "development";
|
|
3478
|
+
if (isDevMode) {
|
|
3479
|
+
console.warn(
|
|
3480
|
+
`[Permission] 未找到权限数据源。请确保已通过 provide 注入权限 Store 或权限检查函数。`,
|
|
3481
|
+
{
|
|
3482
|
+
permission,
|
|
3483
|
+
permissionKey,
|
|
3484
|
+
hasCustomChecker: !!customChecker,
|
|
3485
|
+
hasPermissionStore: !!permissionStore,
|
|
3486
|
+
storeKey: PERMISSION_STORE_KEY.toString(),
|
|
3487
|
+
checkerKey: PERMISSION_CHECKER_KEY.toString()
|
|
3488
|
+
}
|
|
3489
|
+
);
|
|
3490
|
+
}
|
|
969
3491
|
return fallback;
|
|
970
3492
|
});
|
|
971
3493
|
}
|
|
@@ -1701,8 +4223,8 @@ function stubFalse() {
|
|
|
1701
4223
|
var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
1702
4224
|
var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
|
|
1703
4225
|
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
|
|
1704
|
-
var Buffer$
|
|
1705
|
-
var nativeIsBuffer = Buffer$
|
|
4226
|
+
var Buffer$2 = moduleExports$2 ? root.Buffer : void 0;
|
|
4227
|
+
var nativeIsBuffer = Buffer$2 ? Buffer$2.isBuffer : void 0;
|
|
1706
4228
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
1707
4229
|
var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
|
|
1708
4230
|
var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
|
|
@@ -2141,8 +4663,8 @@ Stack.prototype.set = stackSet;
|
|
|
2141
4663
|
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
2142
4664
|
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
2143
4665
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2144
|
-
var
|
|
2145
|
-
|
|
4666
|
+
var Buffer$1 = moduleExports ? root.Buffer : void 0;
|
|
4667
|
+
Buffer$1 ? Buffer$1.allocUnsafe : void 0;
|
|
2146
4668
|
function cloneBuffer(buffer, isDeep) {
|
|
2147
4669
|
{
|
|
2148
4670
|
return buffer.slice();
|
|
@@ -2761,8 +5283,8 @@ function toValue(r) {
|
|
|
2761
5283
|
}
|
|
2762
5284
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
2763
5285
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
2764
|
-
const
|
|
2765
|
-
const isObject = (val) =>
|
|
5286
|
+
const toString2 = Object.prototype.toString;
|
|
5287
|
+
const isObject = (val) => toString2.call(val) === "[object Object]";
|
|
2766
5288
|
const noop = () => {
|
|
2767
5289
|
};
|
|
2768
5290
|
const isIOS = /* @__PURE__ */ getIsIOS();
|
|
@@ -3193,8 +5715,8 @@ const isEpProp = (val) => isObject$2(val) && !!val[epPropKey];
|
|
|
3193
5715
|
const buildProp = (prop, key) => {
|
|
3194
5716
|
if (!isObject$2(prop) || isEpProp(prop))
|
|
3195
5717
|
return prop;
|
|
3196
|
-
const { values, required, default: defaultValue, type, validator } = prop;
|
|
3197
|
-
const _validator = values ||
|
|
5718
|
+
const { values, required, default: defaultValue, type, validator: validator2 } = prop;
|
|
5719
|
+
const _validator = values || validator2 ? (val) => {
|
|
3198
5720
|
let valid = false;
|
|
3199
5721
|
let allowedValues = [];
|
|
3200
5722
|
if (values) {
|
|
@@ -3204,8 +5726,8 @@ const buildProp = (prop, key) => {
|
|
|
3204
5726
|
}
|
|
3205
5727
|
valid || (valid = allowedValues.includes(val));
|
|
3206
5728
|
}
|
|
3207
|
-
if (
|
|
3208
|
-
valid || (valid =
|
|
5729
|
+
if (validator2)
|
|
5730
|
+
valid || (valid = validator2(val));
|
|
3209
5731
|
if (!valid && allowedValues.length > 0) {
|
|
3210
5732
|
const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
|
|
3211
5733
|
warn(
|
|
@@ -4079,8 +6601,8 @@ const _sfc_main$n = defineComponent({
|
|
|
4079
6601
|
input2.value = formatterValue;
|
|
4080
6602
|
};
|
|
4081
6603
|
const formatValue = (value) => {
|
|
4082
|
-
const { trim, number } = props.modelModifiers;
|
|
4083
|
-
if (
|
|
6604
|
+
const { trim: trim2, number } = props.modelModifiers;
|
|
6605
|
+
if (trim2) {
|
|
4084
6606
|
value = value.trim();
|
|
4085
6607
|
}
|
|
4086
6608
|
if (number) {
|
|
@@ -4178,14 +6700,14 @@ const _sfc_main$n = defineComponent({
|
|
|
4178
6700
|
if (!_ref.value) {
|
|
4179
6701
|
return;
|
|
4180
6702
|
}
|
|
4181
|
-
const { trim, number } = props.modelModifiers;
|
|
6703
|
+
const { trim: trim2, number } = props.modelModifiers;
|
|
4182
6704
|
const elValue = _ref.value.value;
|
|
4183
6705
|
const displayValue = (number || props.type === "number") && !/^0\d/.test(elValue) ? `${looseToNumber(elValue)}` : elValue;
|
|
4184
6706
|
if (displayValue === newValue) {
|
|
4185
6707
|
return;
|
|
4186
6708
|
}
|
|
4187
6709
|
if (document.activeElement === _ref.value && _ref.value.type !== "range") {
|
|
4188
|
-
if (
|
|
6710
|
+
if (trim2 && displayValue.trim() === newValue) {
|
|
4189
6711
|
return;
|
|
4190
6712
|
}
|
|
4191
6713
|
}
|
|
@@ -12019,13 +14541,13 @@ function requireJquery() {
|
|
|
12019
14541
|
if (hasRequiredJquery) return jquery.exports;
|
|
12020
14542
|
hasRequiredJquery = 1;
|
|
12021
14543
|
(function(module2) {
|
|
12022
|
-
(function(global2,
|
|
14544
|
+
(function(global2, factory2) {
|
|
12023
14545
|
{
|
|
12024
|
-
module2.exports = global2.document ?
|
|
14546
|
+
module2.exports = global2.document ? factory2(global2, true) : function(w) {
|
|
12025
14547
|
if (!w.document) {
|
|
12026
14548
|
throw new Error("jQuery requires a window with a document");
|
|
12027
14549
|
}
|
|
12028
|
-
return
|
|
14550
|
+
return factory2(w);
|
|
12029
14551
|
};
|
|
12030
14552
|
}
|
|
12031
14553
|
})(typeof window !== "undefined" ? window : commonjsGlobal, function(window2, noGlobal) {
|
|
@@ -12040,7 +14562,7 @@ function requireJquery() {
|
|
|
12040
14562
|
var push = arr.push;
|
|
12041
14563
|
var indexOf = arr.indexOf;
|
|
12042
14564
|
var class2type = {};
|
|
12043
|
-
var
|
|
14565
|
+
var toString3 = class2type.toString;
|
|
12044
14566
|
var hasOwn2 = class2type.hasOwnProperty;
|
|
12045
14567
|
var fnToString = hasOwn2.toString;
|
|
12046
14568
|
var ObjectFunctionString = fnToString.call(Object);
|
|
@@ -12076,7 +14598,7 @@ function requireJquery() {
|
|
|
12076
14598
|
if (obj == null) {
|
|
12077
14599
|
return obj + "";
|
|
12078
14600
|
}
|
|
12079
|
-
return typeof obj === "object" || typeof obj === "function" ? class2type[
|
|
14601
|
+
return typeof obj === "object" || typeof obj === "function" ? class2type[toString3.call(obj)] || "object" : typeof obj;
|
|
12080
14602
|
}
|
|
12081
14603
|
var version = "3.7.1", rhtmlSuffix = /HTML$/i, jQuery2 = function(selector, context) {
|
|
12082
14604
|
return new jQuery2.fn.init(selector, context);
|
|
@@ -12198,7 +14720,7 @@ function requireJquery() {
|
|
|
12198
14720
|
},
|
|
12199
14721
|
isPlainObject: function(obj) {
|
|
12200
14722
|
var proto, Ctor;
|
|
12201
|
-
if (!obj ||
|
|
14723
|
+
if (!obj || toString3.call(obj) !== "[object Object]") {
|
|
12202
14724
|
return false;
|
|
12203
14725
|
}
|
|
12204
14726
|
proto = getProto(obj);
|
|
@@ -13248,11 +15770,11 @@ function requireJquery() {
|
|
|
13248
15770
|
}
|
|
13249
15771
|
return results;
|
|
13250
15772
|
}
|
|
13251
|
-
function condense(unmatched, map,
|
|
15773
|
+
function condense(unmatched, map, filter2, context, xml) {
|
|
13252
15774
|
var elem, newUnmatched = [], i2 = 0, len = unmatched.length, mapped = map != null;
|
|
13253
15775
|
for (; i2 < len; i2++) {
|
|
13254
15776
|
if (elem = unmatched[i2]) {
|
|
13255
|
-
if (!
|
|
15777
|
+
if (!filter2 || filter2(elem, context, xml)) {
|
|
13256
15778
|
newUnmatched.push(elem);
|
|
13257
15779
|
if (mapped) {
|
|
13258
15780
|
map.push(i2);
|