@creopse/react 0.0.27 → 0.0.28
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/LICENSE +21 -0
- package/dist/content-Bbus6Iny.cjs +4251 -0
- package/dist/content-t4DkUPsh.js +4253 -0
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +12 -12
- package/dist/content-CwSDJcNb.js +0 -8227
- package/dist/content-DYL5rH5_.cjs +0 -8225
|
@@ -0,0 +1,4251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const react = require("@inertiajs/react");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
5
|
+
function getDefaultExportFromCjs(x) {
|
|
6
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
7
|
+
}
|
|
8
|
+
const PropsContext = React.createContext(null);
|
|
9
|
+
const ConfigContext = React.createContext(null);
|
|
10
|
+
const RouterContext = React.createContext(null);
|
|
11
|
+
const ResolveSectionsContext = React.createContext(null);
|
|
12
|
+
function bind(fn, thisArg) {
|
|
13
|
+
return function wrap() {
|
|
14
|
+
return fn.apply(thisArg, arguments);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const { toString } = Object.prototype;
|
|
18
|
+
const { getPrototypeOf } = Object;
|
|
19
|
+
const { iterator, toStringTag } = Symbol;
|
|
20
|
+
const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
21
|
+
const str = toString.call(thing);
|
|
22
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
23
|
+
})(/* @__PURE__ */ Object.create(null));
|
|
24
|
+
const kindOfTest = (type) => {
|
|
25
|
+
type = type.toLowerCase();
|
|
26
|
+
return (thing) => kindOf(thing) === type;
|
|
27
|
+
};
|
|
28
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
29
|
+
const { isArray } = Array;
|
|
30
|
+
const isUndefined = typeOfTest("undefined");
|
|
31
|
+
function isBuffer(val) {
|
|
32
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
33
|
+
}
|
|
34
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
35
|
+
function isArrayBufferView(val) {
|
|
36
|
+
let result;
|
|
37
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
38
|
+
result = ArrayBuffer.isView(val);
|
|
39
|
+
} else {
|
|
40
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
const isString = typeOfTest("string");
|
|
45
|
+
const isFunction$1 = typeOfTest("function");
|
|
46
|
+
const isNumber = typeOfTest("number");
|
|
47
|
+
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
48
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
49
|
+
const isPlainObject = (val) => {
|
|
50
|
+
if (kindOf(val) !== "object") {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
const prototype2 = getPrototypeOf(val);
|
|
54
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
|
|
55
|
+
};
|
|
56
|
+
const isEmptyObject = (val) => {
|
|
57
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const isDate = kindOfTest("Date");
|
|
67
|
+
const isFile = kindOfTest("File");
|
|
68
|
+
const isBlob = kindOfTest("Blob");
|
|
69
|
+
const isFileList = kindOfTest("FileList");
|
|
70
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
71
|
+
const isFormData = (thing) => {
|
|
72
|
+
let kind;
|
|
73
|
+
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
74
|
+
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
|
|
75
|
+
};
|
|
76
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
77
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
|
|
78
|
+
const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
79
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
80
|
+
if (obj === null || typeof obj === "undefined") {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
let i;
|
|
84
|
+
let l;
|
|
85
|
+
if (typeof obj !== "object") {
|
|
86
|
+
obj = [obj];
|
|
87
|
+
}
|
|
88
|
+
if (isArray(obj)) {
|
|
89
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
90
|
+
fn.call(null, obj[i], i, obj);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
if (isBuffer(obj)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
97
|
+
const len = keys.length;
|
|
98
|
+
let key;
|
|
99
|
+
for (i = 0; i < len; i++) {
|
|
100
|
+
key = keys[i];
|
|
101
|
+
fn.call(null, obj[key], key, obj);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function findKey(obj, key) {
|
|
106
|
+
if (isBuffer(obj)) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
key = key.toLowerCase();
|
|
110
|
+
const keys = Object.keys(obj);
|
|
111
|
+
let i = keys.length;
|
|
112
|
+
let _key;
|
|
113
|
+
while (i-- > 0) {
|
|
114
|
+
_key = keys[i];
|
|
115
|
+
if (key === _key.toLowerCase()) {
|
|
116
|
+
return _key;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const _global = (() => {
|
|
122
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
123
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
124
|
+
})();
|
|
125
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
126
|
+
function merge() {
|
|
127
|
+
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
128
|
+
const result = {};
|
|
129
|
+
const assignValue = (val, key) => {
|
|
130
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
131
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
132
|
+
result[targetKey] = merge(result[targetKey], val);
|
|
133
|
+
} else if (isPlainObject(val)) {
|
|
134
|
+
result[targetKey] = merge({}, val);
|
|
135
|
+
} else if (isArray(val)) {
|
|
136
|
+
result[targetKey] = val.slice();
|
|
137
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
138
|
+
result[targetKey] = val;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
142
|
+
arguments[i] && forEach(arguments[i], assignValue);
|
|
143
|
+
}
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
147
|
+
forEach(b, (val, key) => {
|
|
148
|
+
if (thisArg && isFunction$1(val)) {
|
|
149
|
+
a[key] = bind(val, thisArg);
|
|
150
|
+
} else {
|
|
151
|
+
a[key] = val;
|
|
152
|
+
}
|
|
153
|
+
}, { allOwnKeys });
|
|
154
|
+
return a;
|
|
155
|
+
};
|
|
156
|
+
const stripBOM = (content) => {
|
|
157
|
+
if (content.charCodeAt(0) === 65279) {
|
|
158
|
+
content = content.slice(1);
|
|
159
|
+
}
|
|
160
|
+
return content;
|
|
161
|
+
};
|
|
162
|
+
const inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
163
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
|
164
|
+
constructor.prototype.constructor = constructor;
|
|
165
|
+
Object.defineProperty(constructor, "super", {
|
|
166
|
+
value: superConstructor.prototype
|
|
167
|
+
});
|
|
168
|
+
props && Object.assign(constructor.prototype, props);
|
|
169
|
+
};
|
|
170
|
+
const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
171
|
+
let props;
|
|
172
|
+
let i;
|
|
173
|
+
let prop;
|
|
174
|
+
const merged = {};
|
|
175
|
+
destObj = destObj || {};
|
|
176
|
+
if (sourceObj == null) return destObj;
|
|
177
|
+
do {
|
|
178
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
179
|
+
i = props.length;
|
|
180
|
+
while (i-- > 0) {
|
|
181
|
+
prop = props[i];
|
|
182
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
183
|
+
destObj[prop] = sourceObj[prop];
|
|
184
|
+
merged[prop] = true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
|
|
188
|
+
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
189
|
+
return destObj;
|
|
190
|
+
};
|
|
191
|
+
const endsWith = (str, searchString, position) => {
|
|
192
|
+
str = String(str);
|
|
193
|
+
if (position === void 0 || position > str.length) {
|
|
194
|
+
position = str.length;
|
|
195
|
+
}
|
|
196
|
+
position -= searchString.length;
|
|
197
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
198
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
199
|
+
};
|
|
200
|
+
const toArray = (thing) => {
|
|
201
|
+
if (!thing) return null;
|
|
202
|
+
if (isArray(thing)) return thing;
|
|
203
|
+
let i = thing.length;
|
|
204
|
+
if (!isNumber(i)) return null;
|
|
205
|
+
const arr = new Array(i);
|
|
206
|
+
while (i-- > 0) {
|
|
207
|
+
arr[i] = thing[i];
|
|
208
|
+
}
|
|
209
|
+
return arr;
|
|
210
|
+
};
|
|
211
|
+
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
|
|
212
|
+
return (thing) => {
|
|
213
|
+
return TypedArray && thing instanceof TypedArray;
|
|
214
|
+
};
|
|
215
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
216
|
+
const forEachEntry = (obj, fn) => {
|
|
217
|
+
const generator = obj && obj[iterator];
|
|
218
|
+
const _iterator = generator.call(obj);
|
|
219
|
+
let result;
|
|
220
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
221
|
+
const pair = result.value;
|
|
222
|
+
fn.call(obj, pair[0], pair[1]);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
const matchAll = (regExp, str) => {
|
|
226
|
+
let matches;
|
|
227
|
+
const arr = [];
|
|
228
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
229
|
+
arr.push(matches);
|
|
230
|
+
}
|
|
231
|
+
return arr;
|
|
232
|
+
};
|
|
233
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
234
|
+
const toCamelCase = (str) => {
|
|
235
|
+
return str.toLowerCase().replace(
|
|
236
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
237
|
+
function replacer(m, p1, p2) {
|
|
238
|
+
return p1.toUpperCase() + p2;
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
243
|
+
const isRegExp = kindOfTest("RegExp");
|
|
244
|
+
const reduceDescriptors = (obj, reducer) => {
|
|
245
|
+
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
|
|
246
|
+
const reducedDescriptors = {};
|
|
247
|
+
forEach(descriptors2, (descriptor, name) => {
|
|
248
|
+
let ret;
|
|
249
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
250
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
254
|
+
};
|
|
255
|
+
const freezeMethods = (obj) => {
|
|
256
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
257
|
+
if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
const value = obj[name];
|
|
261
|
+
if (!isFunction$1(value)) return;
|
|
262
|
+
descriptor.enumerable = false;
|
|
263
|
+
if ("writable" in descriptor) {
|
|
264
|
+
descriptor.writable = false;
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (!descriptor.set) {
|
|
268
|
+
descriptor.set = () => {
|
|
269
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
275
|
+
const obj = {};
|
|
276
|
+
const define = (arr) => {
|
|
277
|
+
arr.forEach((value) => {
|
|
278
|
+
obj[value] = true;
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
282
|
+
return obj;
|
|
283
|
+
};
|
|
284
|
+
const noop = () => {
|
|
285
|
+
};
|
|
286
|
+
const toFiniteNumber = (value, defaultValue) => {
|
|
287
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
288
|
+
};
|
|
289
|
+
function isSpecCompliantForm(thing) {
|
|
290
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
291
|
+
}
|
|
292
|
+
const toJSONObject = (obj) => {
|
|
293
|
+
const stack = new Array(10);
|
|
294
|
+
const visit = (source, i) => {
|
|
295
|
+
if (isObject(source)) {
|
|
296
|
+
if (stack.indexOf(source) >= 0) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (isBuffer(source)) {
|
|
300
|
+
return source;
|
|
301
|
+
}
|
|
302
|
+
if (!("toJSON" in source)) {
|
|
303
|
+
stack[i] = source;
|
|
304
|
+
const target = isArray(source) ? [] : {};
|
|
305
|
+
forEach(source, (value, key) => {
|
|
306
|
+
const reducedValue = visit(value, i + 1);
|
|
307
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
308
|
+
});
|
|
309
|
+
stack[i] = void 0;
|
|
310
|
+
return target;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return source;
|
|
314
|
+
};
|
|
315
|
+
return visit(obj, 0);
|
|
316
|
+
};
|
|
317
|
+
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
318
|
+
const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
319
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
320
|
+
if (setImmediateSupported) {
|
|
321
|
+
return setImmediate;
|
|
322
|
+
}
|
|
323
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
324
|
+
_global.addEventListener("message", ({ source, data }) => {
|
|
325
|
+
if (source === _global && data === token) {
|
|
326
|
+
callbacks.length && callbacks.shift()();
|
|
327
|
+
}
|
|
328
|
+
}, false);
|
|
329
|
+
return (cb) => {
|
|
330
|
+
callbacks.push(cb);
|
|
331
|
+
_global.postMessage(token, "*");
|
|
332
|
+
};
|
|
333
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
334
|
+
})(
|
|
335
|
+
typeof setImmediate === "function",
|
|
336
|
+
isFunction$1(_global.postMessage)
|
|
337
|
+
);
|
|
338
|
+
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
339
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
340
|
+
const utils$1 = {
|
|
341
|
+
isArray,
|
|
342
|
+
isArrayBuffer,
|
|
343
|
+
isBuffer,
|
|
344
|
+
isFormData,
|
|
345
|
+
isArrayBufferView,
|
|
346
|
+
isString,
|
|
347
|
+
isNumber,
|
|
348
|
+
isBoolean,
|
|
349
|
+
isObject,
|
|
350
|
+
isPlainObject,
|
|
351
|
+
isEmptyObject,
|
|
352
|
+
isReadableStream,
|
|
353
|
+
isRequest,
|
|
354
|
+
isResponse,
|
|
355
|
+
isHeaders,
|
|
356
|
+
isUndefined,
|
|
357
|
+
isDate,
|
|
358
|
+
isFile,
|
|
359
|
+
isBlob,
|
|
360
|
+
isRegExp,
|
|
361
|
+
isFunction: isFunction$1,
|
|
362
|
+
isStream,
|
|
363
|
+
isURLSearchParams,
|
|
364
|
+
isTypedArray,
|
|
365
|
+
isFileList,
|
|
366
|
+
forEach,
|
|
367
|
+
merge,
|
|
368
|
+
extend,
|
|
369
|
+
trim,
|
|
370
|
+
stripBOM,
|
|
371
|
+
inherits,
|
|
372
|
+
toFlatObject,
|
|
373
|
+
kindOf,
|
|
374
|
+
kindOfTest,
|
|
375
|
+
endsWith,
|
|
376
|
+
toArray,
|
|
377
|
+
forEachEntry,
|
|
378
|
+
matchAll,
|
|
379
|
+
isHTMLForm,
|
|
380
|
+
hasOwnProperty,
|
|
381
|
+
hasOwnProp: hasOwnProperty,
|
|
382
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
383
|
+
reduceDescriptors,
|
|
384
|
+
freezeMethods,
|
|
385
|
+
toObjectSet,
|
|
386
|
+
toCamelCase,
|
|
387
|
+
noop,
|
|
388
|
+
toFiniteNumber,
|
|
389
|
+
findKey,
|
|
390
|
+
global: _global,
|
|
391
|
+
isContextDefined,
|
|
392
|
+
isSpecCompliantForm,
|
|
393
|
+
toJSONObject,
|
|
394
|
+
isAsyncFn,
|
|
395
|
+
isThenable,
|
|
396
|
+
setImmediate: _setImmediate,
|
|
397
|
+
asap,
|
|
398
|
+
isIterable
|
|
399
|
+
};
|
|
400
|
+
function AxiosError$1(message, code, config, request, response) {
|
|
401
|
+
Error.call(this);
|
|
402
|
+
if (Error.captureStackTrace) {
|
|
403
|
+
Error.captureStackTrace(this, this.constructor);
|
|
404
|
+
} else {
|
|
405
|
+
this.stack = new Error().stack;
|
|
406
|
+
}
|
|
407
|
+
this.message = message;
|
|
408
|
+
this.name = "AxiosError";
|
|
409
|
+
code && (this.code = code);
|
|
410
|
+
config && (this.config = config);
|
|
411
|
+
request && (this.request = request);
|
|
412
|
+
if (response) {
|
|
413
|
+
this.response = response;
|
|
414
|
+
this.status = response.status ? response.status : null;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
utils$1.inherits(AxiosError$1, Error, {
|
|
418
|
+
toJSON: function toJSON() {
|
|
419
|
+
return {
|
|
420
|
+
// Standard
|
|
421
|
+
message: this.message,
|
|
422
|
+
name: this.name,
|
|
423
|
+
// Microsoft
|
|
424
|
+
description: this.description,
|
|
425
|
+
number: this.number,
|
|
426
|
+
// Mozilla
|
|
427
|
+
fileName: this.fileName,
|
|
428
|
+
lineNumber: this.lineNumber,
|
|
429
|
+
columnNumber: this.columnNumber,
|
|
430
|
+
stack: this.stack,
|
|
431
|
+
// Axios
|
|
432
|
+
config: utils$1.toJSONObject(this.config),
|
|
433
|
+
code: this.code,
|
|
434
|
+
status: this.status
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
const prototype$1 = AxiosError$1.prototype;
|
|
439
|
+
const descriptors = {};
|
|
440
|
+
[
|
|
441
|
+
"ERR_BAD_OPTION_VALUE",
|
|
442
|
+
"ERR_BAD_OPTION",
|
|
443
|
+
"ECONNABORTED",
|
|
444
|
+
"ETIMEDOUT",
|
|
445
|
+
"ERR_NETWORK",
|
|
446
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
447
|
+
"ERR_DEPRECATED",
|
|
448
|
+
"ERR_BAD_RESPONSE",
|
|
449
|
+
"ERR_BAD_REQUEST",
|
|
450
|
+
"ERR_CANCELED",
|
|
451
|
+
"ERR_NOT_SUPPORT",
|
|
452
|
+
"ERR_INVALID_URL"
|
|
453
|
+
// eslint-disable-next-line func-names
|
|
454
|
+
].forEach((code) => {
|
|
455
|
+
descriptors[code] = { value: code };
|
|
456
|
+
});
|
|
457
|
+
Object.defineProperties(AxiosError$1, descriptors);
|
|
458
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
|
|
459
|
+
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
460
|
+
const axiosError = Object.create(prototype$1);
|
|
461
|
+
utils$1.toFlatObject(error, axiosError, function filter2(obj) {
|
|
462
|
+
return obj !== Error.prototype;
|
|
463
|
+
}, (prop) => {
|
|
464
|
+
return prop !== "isAxiosError";
|
|
465
|
+
});
|
|
466
|
+
const msg = error && error.message ? error.message : "Error";
|
|
467
|
+
const errCode = code == null && error ? error.code : code;
|
|
468
|
+
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
469
|
+
if (error && axiosError.cause == null) {
|
|
470
|
+
Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
|
|
471
|
+
}
|
|
472
|
+
axiosError.name = error && error.name || "Error";
|
|
473
|
+
customProps && Object.assign(axiosError, customProps);
|
|
474
|
+
return axiosError;
|
|
475
|
+
};
|
|
476
|
+
const httpAdapter = null;
|
|
477
|
+
function isVisitable(thing) {
|
|
478
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
479
|
+
}
|
|
480
|
+
function removeBrackets(key) {
|
|
481
|
+
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
482
|
+
}
|
|
483
|
+
function renderKey(path, key, dots) {
|
|
484
|
+
if (!path) return key;
|
|
485
|
+
return path.concat(key).map(function each(token, i) {
|
|
486
|
+
token = removeBrackets(token);
|
|
487
|
+
return !dots && i ? "[" + token + "]" : token;
|
|
488
|
+
}).join(dots ? "." : "");
|
|
489
|
+
}
|
|
490
|
+
function isFlatArray(arr) {
|
|
491
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
492
|
+
}
|
|
493
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
494
|
+
return /^is[A-Z]/.test(prop);
|
|
495
|
+
});
|
|
496
|
+
function toFormData$1(obj, formData, options) {
|
|
497
|
+
if (!utils$1.isObject(obj)) {
|
|
498
|
+
throw new TypeError("target must be an object");
|
|
499
|
+
}
|
|
500
|
+
formData = formData || new FormData();
|
|
501
|
+
options = utils$1.toFlatObject(options, {
|
|
502
|
+
metaTokens: true,
|
|
503
|
+
dots: false,
|
|
504
|
+
indexes: false
|
|
505
|
+
}, false, function defined(option, source) {
|
|
506
|
+
return !utils$1.isUndefined(source[option]);
|
|
507
|
+
});
|
|
508
|
+
const metaTokens = options.metaTokens;
|
|
509
|
+
const visitor = options.visitor || defaultVisitor;
|
|
510
|
+
const dots = options.dots;
|
|
511
|
+
const indexes = options.indexes;
|
|
512
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
513
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
514
|
+
if (!utils$1.isFunction(visitor)) {
|
|
515
|
+
throw new TypeError("visitor must be a function");
|
|
516
|
+
}
|
|
517
|
+
function convertValue(value) {
|
|
518
|
+
if (value === null) return "";
|
|
519
|
+
if (utils$1.isDate(value)) {
|
|
520
|
+
return value.toISOString();
|
|
521
|
+
}
|
|
522
|
+
if (utils$1.isBoolean(value)) {
|
|
523
|
+
return value.toString();
|
|
524
|
+
}
|
|
525
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
526
|
+
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
527
|
+
}
|
|
528
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
529
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
530
|
+
}
|
|
531
|
+
return value;
|
|
532
|
+
}
|
|
533
|
+
function defaultVisitor(value, key, path) {
|
|
534
|
+
let arr = value;
|
|
535
|
+
if (value && !path && typeof value === "object") {
|
|
536
|
+
if (utils$1.endsWith(key, "{}")) {
|
|
537
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
538
|
+
value = JSON.stringify(value);
|
|
539
|
+
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
|
|
540
|
+
key = removeBrackets(key);
|
|
541
|
+
arr.forEach(function each(el, index) {
|
|
542
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
543
|
+
// eslint-disable-next-line no-nested-ternary
|
|
544
|
+
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
545
|
+
convertValue(el)
|
|
546
|
+
);
|
|
547
|
+
});
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (isVisitable(value)) {
|
|
552
|
+
return true;
|
|
553
|
+
}
|
|
554
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
555
|
+
return false;
|
|
556
|
+
}
|
|
557
|
+
const stack = [];
|
|
558
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
559
|
+
defaultVisitor,
|
|
560
|
+
convertValue,
|
|
561
|
+
isVisitable
|
|
562
|
+
});
|
|
563
|
+
function build(value, path) {
|
|
564
|
+
if (utils$1.isUndefined(value)) return;
|
|
565
|
+
if (stack.indexOf(value) !== -1) {
|
|
566
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
567
|
+
}
|
|
568
|
+
stack.push(value);
|
|
569
|
+
utils$1.forEach(value, function each(el, key) {
|
|
570
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
571
|
+
formData,
|
|
572
|
+
el,
|
|
573
|
+
utils$1.isString(key) ? key.trim() : key,
|
|
574
|
+
path,
|
|
575
|
+
exposedHelpers
|
|
576
|
+
);
|
|
577
|
+
if (result === true) {
|
|
578
|
+
build(el, path ? path.concat(key) : [key]);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
stack.pop();
|
|
582
|
+
}
|
|
583
|
+
if (!utils$1.isObject(obj)) {
|
|
584
|
+
throw new TypeError("data must be an object");
|
|
585
|
+
}
|
|
586
|
+
build(obj);
|
|
587
|
+
return formData;
|
|
588
|
+
}
|
|
589
|
+
function encode$1(str) {
|
|
590
|
+
const charMap = {
|
|
591
|
+
"!": "%21",
|
|
592
|
+
"'": "%27",
|
|
593
|
+
"(": "%28",
|
|
594
|
+
")": "%29",
|
|
595
|
+
"~": "%7E",
|
|
596
|
+
"%20": "+",
|
|
597
|
+
"%00": "\0"
|
|
598
|
+
};
|
|
599
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
600
|
+
return charMap[match];
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
function AxiosURLSearchParams(params, options) {
|
|
604
|
+
this._pairs = [];
|
|
605
|
+
params && toFormData$1(params, this, options);
|
|
606
|
+
}
|
|
607
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
608
|
+
prototype.append = function append(name, value) {
|
|
609
|
+
this._pairs.push([name, value]);
|
|
610
|
+
};
|
|
611
|
+
prototype.toString = function toString2(encoder) {
|
|
612
|
+
const _encode = encoder ? function(value) {
|
|
613
|
+
return encoder.call(this, value, encode$1);
|
|
614
|
+
} : encode$1;
|
|
615
|
+
return this._pairs.map(function each(pair) {
|
|
616
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
617
|
+
}, "").join("&");
|
|
618
|
+
};
|
|
619
|
+
function encode(val) {
|
|
620
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
621
|
+
}
|
|
622
|
+
function buildURL(url, params, options) {
|
|
623
|
+
if (!params) {
|
|
624
|
+
return url;
|
|
625
|
+
}
|
|
626
|
+
const _encode = options && options.encode || encode;
|
|
627
|
+
if (utils$1.isFunction(options)) {
|
|
628
|
+
options = {
|
|
629
|
+
serialize: options
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
const serializeFn = options && options.serialize;
|
|
633
|
+
let serializedParams;
|
|
634
|
+
if (serializeFn) {
|
|
635
|
+
serializedParams = serializeFn(params, options);
|
|
636
|
+
} else {
|
|
637
|
+
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
|
|
638
|
+
}
|
|
639
|
+
if (serializedParams) {
|
|
640
|
+
const hashmarkIndex = url.indexOf("#");
|
|
641
|
+
if (hashmarkIndex !== -1) {
|
|
642
|
+
url = url.slice(0, hashmarkIndex);
|
|
643
|
+
}
|
|
644
|
+
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
645
|
+
}
|
|
646
|
+
return url;
|
|
647
|
+
}
|
|
648
|
+
class InterceptorManager {
|
|
649
|
+
constructor() {
|
|
650
|
+
this.handlers = [];
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Add a new interceptor to the stack
|
|
654
|
+
*
|
|
655
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
656
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
657
|
+
*
|
|
658
|
+
* @return {Number} An ID used to remove interceptor later
|
|
659
|
+
*/
|
|
660
|
+
use(fulfilled, rejected, options) {
|
|
661
|
+
this.handlers.push({
|
|
662
|
+
fulfilled,
|
|
663
|
+
rejected,
|
|
664
|
+
synchronous: options ? options.synchronous : false,
|
|
665
|
+
runWhen: options ? options.runWhen : null
|
|
666
|
+
});
|
|
667
|
+
return this.handlers.length - 1;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Remove an interceptor from the stack
|
|
671
|
+
*
|
|
672
|
+
* @param {Number} id The ID that was returned by `use`
|
|
673
|
+
*
|
|
674
|
+
* @returns {void}
|
|
675
|
+
*/
|
|
676
|
+
eject(id) {
|
|
677
|
+
if (this.handlers[id]) {
|
|
678
|
+
this.handlers[id] = null;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Clear all interceptors from the stack
|
|
683
|
+
*
|
|
684
|
+
* @returns {void}
|
|
685
|
+
*/
|
|
686
|
+
clear() {
|
|
687
|
+
if (this.handlers) {
|
|
688
|
+
this.handlers = [];
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Iterate over all the registered interceptors
|
|
693
|
+
*
|
|
694
|
+
* This method is particularly useful for skipping over any
|
|
695
|
+
* interceptors that may have become `null` calling `eject`.
|
|
696
|
+
*
|
|
697
|
+
* @param {Function} fn The function to call for each interceptor
|
|
698
|
+
*
|
|
699
|
+
* @returns {void}
|
|
700
|
+
*/
|
|
701
|
+
forEach(fn) {
|
|
702
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
703
|
+
if (h !== null) {
|
|
704
|
+
fn(h);
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
const transitionalDefaults = {
|
|
710
|
+
silentJSONParsing: true,
|
|
711
|
+
forcedJSONParsing: true,
|
|
712
|
+
clarifyTimeoutError: false
|
|
713
|
+
};
|
|
714
|
+
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
715
|
+
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
|
716
|
+
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
|
|
717
|
+
const platform$1 = {
|
|
718
|
+
isBrowser: true,
|
|
719
|
+
classes: {
|
|
720
|
+
URLSearchParams: URLSearchParams$1,
|
|
721
|
+
FormData: FormData$1,
|
|
722
|
+
Blob: Blob$1
|
|
723
|
+
},
|
|
724
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
725
|
+
};
|
|
726
|
+
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
727
|
+
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
728
|
+
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
729
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
730
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
731
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
732
|
+
})();
|
|
733
|
+
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
734
|
+
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
735
|
+
__proto__: null,
|
|
736
|
+
hasBrowserEnv,
|
|
737
|
+
hasStandardBrowserEnv,
|
|
738
|
+
hasStandardBrowserWebWorkerEnv,
|
|
739
|
+
navigator: _navigator,
|
|
740
|
+
origin
|
|
741
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
742
|
+
const platform = {
|
|
743
|
+
...utils,
|
|
744
|
+
...platform$1
|
|
745
|
+
};
|
|
746
|
+
function toURLEncodedForm(data, options) {
|
|
747
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
748
|
+
visitor: function(value, key, path, helpers) {
|
|
749
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
750
|
+
this.append(key, value.toString("base64"));
|
|
751
|
+
return false;
|
|
752
|
+
}
|
|
753
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
754
|
+
},
|
|
755
|
+
...options
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
function parsePropPath(name) {
|
|
759
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
760
|
+
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
function arrayToObject(arr) {
|
|
764
|
+
const obj = {};
|
|
765
|
+
const keys = Object.keys(arr);
|
|
766
|
+
let i;
|
|
767
|
+
const len = keys.length;
|
|
768
|
+
let key;
|
|
769
|
+
for (i = 0; i < len; i++) {
|
|
770
|
+
key = keys[i];
|
|
771
|
+
obj[key] = arr[key];
|
|
772
|
+
}
|
|
773
|
+
return obj;
|
|
774
|
+
}
|
|
775
|
+
function formDataToJSON(formData) {
|
|
776
|
+
function buildPath(path, value, target, index) {
|
|
777
|
+
let name = path[index++];
|
|
778
|
+
if (name === "__proto__") return true;
|
|
779
|
+
const isNumericKey = Number.isFinite(+name);
|
|
780
|
+
const isLast = index >= path.length;
|
|
781
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
782
|
+
if (isLast) {
|
|
783
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
784
|
+
target[name] = [target[name], value];
|
|
785
|
+
} else {
|
|
786
|
+
target[name] = value;
|
|
787
|
+
}
|
|
788
|
+
return !isNumericKey;
|
|
789
|
+
}
|
|
790
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
791
|
+
target[name] = [];
|
|
792
|
+
}
|
|
793
|
+
const result = buildPath(path, value, target[name], index);
|
|
794
|
+
if (result && utils$1.isArray(target[name])) {
|
|
795
|
+
target[name] = arrayToObject(target[name]);
|
|
796
|
+
}
|
|
797
|
+
return !isNumericKey;
|
|
798
|
+
}
|
|
799
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
800
|
+
const obj = {};
|
|
801
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
802
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
803
|
+
});
|
|
804
|
+
return obj;
|
|
805
|
+
}
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
809
|
+
if (utils$1.isString(rawValue)) {
|
|
810
|
+
try {
|
|
811
|
+
(parser || JSON.parse)(rawValue);
|
|
812
|
+
return utils$1.trim(rawValue);
|
|
813
|
+
} catch (e) {
|
|
814
|
+
if (e.name !== "SyntaxError") {
|
|
815
|
+
throw e;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
820
|
+
}
|
|
821
|
+
const defaults = {
|
|
822
|
+
transitional: transitionalDefaults,
|
|
823
|
+
adapter: ["xhr", "http", "fetch"],
|
|
824
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
825
|
+
const contentType = headers.getContentType() || "";
|
|
826
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
827
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
828
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
829
|
+
data = new FormData(data);
|
|
830
|
+
}
|
|
831
|
+
const isFormData2 = utils$1.isFormData(data);
|
|
832
|
+
if (isFormData2) {
|
|
833
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
834
|
+
}
|
|
835
|
+
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)) {
|
|
836
|
+
return data;
|
|
837
|
+
}
|
|
838
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
839
|
+
return data.buffer;
|
|
840
|
+
}
|
|
841
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
842
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
843
|
+
return data.toString();
|
|
844
|
+
}
|
|
845
|
+
let isFileList2;
|
|
846
|
+
if (isObjectPayload) {
|
|
847
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
848
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
849
|
+
}
|
|
850
|
+
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
851
|
+
const _FormData = this.env && this.env.FormData;
|
|
852
|
+
return toFormData$1(
|
|
853
|
+
isFileList2 ? { "files[]": data } : data,
|
|
854
|
+
_FormData && new _FormData(),
|
|
855
|
+
this.formSerializer
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
860
|
+
headers.setContentType("application/json", false);
|
|
861
|
+
return stringifySafely(data);
|
|
862
|
+
}
|
|
863
|
+
return data;
|
|
864
|
+
}],
|
|
865
|
+
transformResponse: [function transformResponse(data) {
|
|
866
|
+
const transitional2 = this.transitional || defaults.transitional;
|
|
867
|
+
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
868
|
+
const JSONRequested = this.responseType === "json";
|
|
869
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
870
|
+
return data;
|
|
871
|
+
}
|
|
872
|
+
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
873
|
+
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
874
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
875
|
+
try {
|
|
876
|
+
return JSON.parse(data, this.parseReviver);
|
|
877
|
+
} catch (e) {
|
|
878
|
+
if (strictJSONParsing) {
|
|
879
|
+
if (e.name === "SyntaxError") {
|
|
880
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
881
|
+
}
|
|
882
|
+
throw e;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return data;
|
|
887
|
+
}],
|
|
888
|
+
/**
|
|
889
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
890
|
+
* timeout is not created.
|
|
891
|
+
*/
|
|
892
|
+
timeout: 0,
|
|
893
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
894
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
895
|
+
maxContentLength: -1,
|
|
896
|
+
maxBodyLength: -1,
|
|
897
|
+
env: {
|
|
898
|
+
FormData: platform.classes.FormData,
|
|
899
|
+
Blob: platform.classes.Blob
|
|
900
|
+
},
|
|
901
|
+
validateStatus: function validateStatus(status) {
|
|
902
|
+
return status >= 200 && status < 300;
|
|
903
|
+
},
|
|
904
|
+
headers: {
|
|
905
|
+
common: {
|
|
906
|
+
"Accept": "application/json, text/plain, */*",
|
|
907
|
+
"Content-Type": void 0
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
912
|
+
defaults.headers[method] = {};
|
|
913
|
+
});
|
|
914
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
915
|
+
"age",
|
|
916
|
+
"authorization",
|
|
917
|
+
"content-length",
|
|
918
|
+
"content-type",
|
|
919
|
+
"etag",
|
|
920
|
+
"expires",
|
|
921
|
+
"from",
|
|
922
|
+
"host",
|
|
923
|
+
"if-modified-since",
|
|
924
|
+
"if-unmodified-since",
|
|
925
|
+
"last-modified",
|
|
926
|
+
"location",
|
|
927
|
+
"max-forwards",
|
|
928
|
+
"proxy-authorization",
|
|
929
|
+
"referer",
|
|
930
|
+
"retry-after",
|
|
931
|
+
"user-agent"
|
|
932
|
+
]);
|
|
933
|
+
const parseHeaders = (rawHeaders) => {
|
|
934
|
+
const parsed = {};
|
|
935
|
+
let key;
|
|
936
|
+
let val;
|
|
937
|
+
let i;
|
|
938
|
+
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
939
|
+
i = line.indexOf(":");
|
|
940
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
941
|
+
val = line.substring(i + 1).trim();
|
|
942
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
if (key === "set-cookie") {
|
|
946
|
+
if (parsed[key]) {
|
|
947
|
+
parsed[key].push(val);
|
|
948
|
+
} else {
|
|
949
|
+
parsed[key] = [val];
|
|
950
|
+
}
|
|
951
|
+
} else {
|
|
952
|
+
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
return parsed;
|
|
956
|
+
};
|
|
957
|
+
const $internals = Symbol("internals");
|
|
958
|
+
function normalizeHeader(header) {
|
|
959
|
+
return header && String(header).trim().toLowerCase();
|
|
960
|
+
}
|
|
961
|
+
function normalizeValue(value) {
|
|
962
|
+
if (value === false || value == null) {
|
|
963
|
+
return value;
|
|
964
|
+
}
|
|
965
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
966
|
+
}
|
|
967
|
+
function parseTokens(str) {
|
|
968
|
+
const tokens = /* @__PURE__ */ Object.create(null);
|
|
969
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
970
|
+
let match;
|
|
971
|
+
while (match = tokensRE.exec(str)) {
|
|
972
|
+
tokens[match[1]] = match[2];
|
|
973
|
+
}
|
|
974
|
+
return tokens;
|
|
975
|
+
}
|
|
976
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
977
|
+
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
978
|
+
if (utils$1.isFunction(filter2)) {
|
|
979
|
+
return filter2.call(this, value, header);
|
|
980
|
+
}
|
|
981
|
+
if (isHeaderNameFilter) {
|
|
982
|
+
value = header;
|
|
983
|
+
}
|
|
984
|
+
if (!utils$1.isString(value)) return;
|
|
985
|
+
if (utils$1.isString(filter2)) {
|
|
986
|
+
return value.indexOf(filter2) !== -1;
|
|
987
|
+
}
|
|
988
|
+
if (utils$1.isRegExp(filter2)) {
|
|
989
|
+
return filter2.test(value);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
function formatHeader(header) {
|
|
993
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
994
|
+
return char.toUpperCase() + str;
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
function buildAccessors(obj, header) {
|
|
998
|
+
const accessorName = utils$1.toCamelCase(" " + header);
|
|
999
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
1000
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
1001
|
+
value: function(arg1, arg2, arg3) {
|
|
1002
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1003
|
+
},
|
|
1004
|
+
configurable: true
|
|
1005
|
+
});
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
let AxiosHeaders$1 = class AxiosHeaders {
|
|
1009
|
+
constructor(headers) {
|
|
1010
|
+
headers && this.set(headers);
|
|
1011
|
+
}
|
|
1012
|
+
set(header, valueOrRewrite, rewrite) {
|
|
1013
|
+
const self2 = this;
|
|
1014
|
+
function setHeader(_value, _header, _rewrite) {
|
|
1015
|
+
const lHeader = normalizeHeader(_header);
|
|
1016
|
+
if (!lHeader) {
|
|
1017
|
+
throw new Error("header name must be a non-empty string");
|
|
1018
|
+
}
|
|
1019
|
+
const key = utils$1.findKey(self2, lHeader);
|
|
1020
|
+
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
1021
|
+
self2[key || _header] = normalizeValue(_value);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1025
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1026
|
+
setHeaders(header, valueOrRewrite);
|
|
1027
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1028
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1029
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1030
|
+
let obj = {}, dest, key;
|
|
1031
|
+
for (const entry of header) {
|
|
1032
|
+
if (!utils$1.isArray(entry)) {
|
|
1033
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
1034
|
+
}
|
|
1035
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
1036
|
+
}
|
|
1037
|
+
setHeaders(obj, valueOrRewrite);
|
|
1038
|
+
} else {
|
|
1039
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1040
|
+
}
|
|
1041
|
+
return this;
|
|
1042
|
+
}
|
|
1043
|
+
get(header, parser) {
|
|
1044
|
+
header = normalizeHeader(header);
|
|
1045
|
+
if (header) {
|
|
1046
|
+
const key = utils$1.findKey(this, header);
|
|
1047
|
+
if (key) {
|
|
1048
|
+
const value = this[key];
|
|
1049
|
+
if (!parser) {
|
|
1050
|
+
return value;
|
|
1051
|
+
}
|
|
1052
|
+
if (parser === true) {
|
|
1053
|
+
return parseTokens(value);
|
|
1054
|
+
}
|
|
1055
|
+
if (utils$1.isFunction(parser)) {
|
|
1056
|
+
return parser.call(this, value, key);
|
|
1057
|
+
}
|
|
1058
|
+
if (utils$1.isRegExp(parser)) {
|
|
1059
|
+
return parser.exec(value);
|
|
1060
|
+
}
|
|
1061
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
has(header, matcher) {
|
|
1066
|
+
header = normalizeHeader(header);
|
|
1067
|
+
if (header) {
|
|
1068
|
+
const key = utils$1.findKey(this, header);
|
|
1069
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1070
|
+
}
|
|
1071
|
+
return false;
|
|
1072
|
+
}
|
|
1073
|
+
delete(header, matcher) {
|
|
1074
|
+
const self2 = this;
|
|
1075
|
+
let deleted = false;
|
|
1076
|
+
function deleteHeader(_header) {
|
|
1077
|
+
_header = normalizeHeader(_header);
|
|
1078
|
+
if (_header) {
|
|
1079
|
+
const key = utils$1.findKey(self2, _header);
|
|
1080
|
+
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
1081
|
+
delete self2[key];
|
|
1082
|
+
deleted = true;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
if (utils$1.isArray(header)) {
|
|
1087
|
+
header.forEach(deleteHeader);
|
|
1088
|
+
} else {
|
|
1089
|
+
deleteHeader(header);
|
|
1090
|
+
}
|
|
1091
|
+
return deleted;
|
|
1092
|
+
}
|
|
1093
|
+
clear(matcher) {
|
|
1094
|
+
const keys = Object.keys(this);
|
|
1095
|
+
let i = keys.length;
|
|
1096
|
+
let deleted = false;
|
|
1097
|
+
while (i--) {
|
|
1098
|
+
const key = keys[i];
|
|
1099
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1100
|
+
delete this[key];
|
|
1101
|
+
deleted = true;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
return deleted;
|
|
1105
|
+
}
|
|
1106
|
+
normalize(format) {
|
|
1107
|
+
const self2 = this;
|
|
1108
|
+
const headers = {};
|
|
1109
|
+
utils$1.forEach(this, (value, header) => {
|
|
1110
|
+
const key = utils$1.findKey(headers, header);
|
|
1111
|
+
if (key) {
|
|
1112
|
+
self2[key] = normalizeValue(value);
|
|
1113
|
+
delete self2[header];
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
1117
|
+
if (normalized !== header) {
|
|
1118
|
+
delete self2[header];
|
|
1119
|
+
}
|
|
1120
|
+
self2[normalized] = normalizeValue(value);
|
|
1121
|
+
headers[normalized] = true;
|
|
1122
|
+
});
|
|
1123
|
+
return this;
|
|
1124
|
+
}
|
|
1125
|
+
concat(...targets) {
|
|
1126
|
+
return this.constructor.concat(this, ...targets);
|
|
1127
|
+
}
|
|
1128
|
+
toJSON(asStrings) {
|
|
1129
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1130
|
+
utils$1.forEach(this, (value, header) => {
|
|
1131
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
|
|
1132
|
+
});
|
|
1133
|
+
return obj;
|
|
1134
|
+
}
|
|
1135
|
+
[Symbol.iterator]() {
|
|
1136
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1137
|
+
}
|
|
1138
|
+
toString() {
|
|
1139
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
1140
|
+
}
|
|
1141
|
+
getSetCookie() {
|
|
1142
|
+
return this.get("set-cookie") || [];
|
|
1143
|
+
}
|
|
1144
|
+
get [Symbol.toStringTag]() {
|
|
1145
|
+
return "AxiosHeaders";
|
|
1146
|
+
}
|
|
1147
|
+
static from(thing) {
|
|
1148
|
+
return thing instanceof this ? thing : new this(thing);
|
|
1149
|
+
}
|
|
1150
|
+
static concat(first, ...targets) {
|
|
1151
|
+
const computed = new this(first);
|
|
1152
|
+
targets.forEach((target) => computed.set(target));
|
|
1153
|
+
return computed;
|
|
1154
|
+
}
|
|
1155
|
+
static accessor(header) {
|
|
1156
|
+
const internals = this[$internals] = this[$internals] = {
|
|
1157
|
+
accessors: {}
|
|
1158
|
+
};
|
|
1159
|
+
const accessors = internals.accessors;
|
|
1160
|
+
const prototype2 = this.prototype;
|
|
1161
|
+
function defineAccessor(_header) {
|
|
1162
|
+
const lHeader = normalizeHeader(_header);
|
|
1163
|
+
if (!accessors[lHeader]) {
|
|
1164
|
+
buildAccessors(prototype2, _header);
|
|
1165
|
+
accessors[lHeader] = true;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1169
|
+
return this;
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1173
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
1174
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
1175
|
+
return {
|
|
1176
|
+
get: () => value,
|
|
1177
|
+
set(headerValue) {
|
|
1178
|
+
this[mapped] = headerValue;
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
});
|
|
1182
|
+
utils$1.freezeMethods(AxiosHeaders$1);
|
|
1183
|
+
function transformData(fns, response) {
|
|
1184
|
+
const config = this || defaults;
|
|
1185
|
+
const context = response || config;
|
|
1186
|
+
const headers = AxiosHeaders$1.from(context.headers);
|
|
1187
|
+
let data = context.data;
|
|
1188
|
+
utils$1.forEach(fns, function transform(fn) {
|
|
1189
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
1190
|
+
});
|
|
1191
|
+
headers.normalize();
|
|
1192
|
+
return data;
|
|
1193
|
+
}
|
|
1194
|
+
function isCancel$1(value) {
|
|
1195
|
+
return !!(value && value.__CANCEL__);
|
|
1196
|
+
}
|
|
1197
|
+
function CanceledError$1(message, config, request) {
|
|
1198
|
+
AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
1199
|
+
this.name = "CanceledError";
|
|
1200
|
+
}
|
|
1201
|
+
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
1202
|
+
__CANCEL__: true
|
|
1203
|
+
});
|
|
1204
|
+
function settle(resolve, reject, response) {
|
|
1205
|
+
const validateStatus2 = response.config.validateStatus;
|
|
1206
|
+
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
1207
|
+
resolve(response);
|
|
1208
|
+
} else {
|
|
1209
|
+
reject(new AxiosError$1(
|
|
1210
|
+
"Request failed with status code " + response.status,
|
|
1211
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
1212
|
+
response.config,
|
|
1213
|
+
response.request,
|
|
1214
|
+
response
|
|
1215
|
+
));
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
function parseProtocol(url) {
|
|
1219
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
1220
|
+
return match && match[1] || "";
|
|
1221
|
+
}
|
|
1222
|
+
function speedometer(samplesCount, min) {
|
|
1223
|
+
samplesCount = samplesCount || 10;
|
|
1224
|
+
const bytes = new Array(samplesCount);
|
|
1225
|
+
const timestamps = new Array(samplesCount);
|
|
1226
|
+
let head = 0;
|
|
1227
|
+
let tail = 0;
|
|
1228
|
+
let firstSampleTS;
|
|
1229
|
+
min = min !== void 0 ? min : 1e3;
|
|
1230
|
+
return function push(chunkLength) {
|
|
1231
|
+
const now = Date.now();
|
|
1232
|
+
const startedAt = timestamps[tail];
|
|
1233
|
+
if (!firstSampleTS) {
|
|
1234
|
+
firstSampleTS = now;
|
|
1235
|
+
}
|
|
1236
|
+
bytes[head] = chunkLength;
|
|
1237
|
+
timestamps[head] = now;
|
|
1238
|
+
let i = tail;
|
|
1239
|
+
let bytesCount = 0;
|
|
1240
|
+
while (i !== head) {
|
|
1241
|
+
bytesCount += bytes[i++];
|
|
1242
|
+
i = i % samplesCount;
|
|
1243
|
+
}
|
|
1244
|
+
head = (head + 1) % samplesCount;
|
|
1245
|
+
if (head === tail) {
|
|
1246
|
+
tail = (tail + 1) % samplesCount;
|
|
1247
|
+
}
|
|
1248
|
+
if (now - firstSampleTS < min) {
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1251
|
+
const passed = startedAt && now - startedAt;
|
|
1252
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function throttle(fn, freq) {
|
|
1256
|
+
let timestamp = 0;
|
|
1257
|
+
let threshold = 1e3 / freq;
|
|
1258
|
+
let lastArgs;
|
|
1259
|
+
let timer;
|
|
1260
|
+
const invoke = (args, now = Date.now()) => {
|
|
1261
|
+
timestamp = now;
|
|
1262
|
+
lastArgs = null;
|
|
1263
|
+
if (timer) {
|
|
1264
|
+
clearTimeout(timer);
|
|
1265
|
+
timer = null;
|
|
1266
|
+
}
|
|
1267
|
+
fn(...args);
|
|
1268
|
+
};
|
|
1269
|
+
const throttled = (...args) => {
|
|
1270
|
+
const now = Date.now();
|
|
1271
|
+
const passed = now - timestamp;
|
|
1272
|
+
if (passed >= threshold) {
|
|
1273
|
+
invoke(args, now);
|
|
1274
|
+
} else {
|
|
1275
|
+
lastArgs = args;
|
|
1276
|
+
if (!timer) {
|
|
1277
|
+
timer = setTimeout(() => {
|
|
1278
|
+
timer = null;
|
|
1279
|
+
invoke(lastArgs);
|
|
1280
|
+
}, threshold - passed);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
1285
|
+
return [throttled, flush];
|
|
1286
|
+
}
|
|
1287
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
1288
|
+
let bytesNotified = 0;
|
|
1289
|
+
const _speedometer = speedometer(50, 250);
|
|
1290
|
+
return throttle((e) => {
|
|
1291
|
+
const loaded = e.loaded;
|
|
1292
|
+
const total = e.lengthComputable ? e.total : void 0;
|
|
1293
|
+
const progressBytes = loaded - bytesNotified;
|
|
1294
|
+
const rate = _speedometer(progressBytes);
|
|
1295
|
+
const inRange = loaded <= total;
|
|
1296
|
+
bytesNotified = loaded;
|
|
1297
|
+
const data = {
|
|
1298
|
+
loaded,
|
|
1299
|
+
total,
|
|
1300
|
+
progress: total ? loaded / total : void 0,
|
|
1301
|
+
bytes: progressBytes,
|
|
1302
|
+
rate: rate ? rate : void 0,
|
|
1303
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
1304
|
+
event: e,
|
|
1305
|
+
lengthComputable: total != null,
|
|
1306
|
+
[isDownloadStream ? "download" : "upload"]: true
|
|
1307
|
+
};
|
|
1308
|
+
listener(data);
|
|
1309
|
+
}, freq);
|
|
1310
|
+
};
|
|
1311
|
+
const progressEventDecorator = (total, throttled) => {
|
|
1312
|
+
const lengthComputable = total != null;
|
|
1313
|
+
return [(loaded) => throttled[0]({
|
|
1314
|
+
lengthComputable,
|
|
1315
|
+
total,
|
|
1316
|
+
loaded
|
|
1317
|
+
}), throttled[1]];
|
|
1318
|
+
};
|
|
1319
|
+
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
1320
|
+
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
|
|
1321
|
+
url = new URL(url, platform.origin);
|
|
1322
|
+
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
|
|
1323
|
+
})(
|
|
1324
|
+
new URL(platform.origin),
|
|
1325
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
1326
|
+
) : () => true;
|
|
1327
|
+
const cookies = platform.hasStandardBrowserEnv ? (
|
|
1328
|
+
// Standard browser envs support document.cookie
|
|
1329
|
+
{
|
|
1330
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
1331
|
+
if (typeof document === "undefined") return;
|
|
1332
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
1333
|
+
if (utils$1.isNumber(expires)) {
|
|
1334
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
1335
|
+
}
|
|
1336
|
+
if (utils$1.isString(path)) {
|
|
1337
|
+
cookie.push(`path=${path}`);
|
|
1338
|
+
}
|
|
1339
|
+
if (utils$1.isString(domain)) {
|
|
1340
|
+
cookie.push(`domain=${domain}`);
|
|
1341
|
+
}
|
|
1342
|
+
if (secure === true) {
|
|
1343
|
+
cookie.push("secure");
|
|
1344
|
+
}
|
|
1345
|
+
if (utils$1.isString(sameSite)) {
|
|
1346
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
1347
|
+
}
|
|
1348
|
+
document.cookie = cookie.join("; ");
|
|
1349
|
+
},
|
|
1350
|
+
read(name) {
|
|
1351
|
+
if (typeof document === "undefined") return null;
|
|
1352
|
+
const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
|
|
1353
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
1354
|
+
},
|
|
1355
|
+
remove(name) {
|
|
1356
|
+
this.write(name, "", Date.now() - 864e5, "/");
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
) : (
|
|
1360
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1361
|
+
{
|
|
1362
|
+
write() {
|
|
1363
|
+
},
|
|
1364
|
+
read() {
|
|
1365
|
+
return null;
|
|
1366
|
+
},
|
|
1367
|
+
remove() {
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
);
|
|
1371
|
+
function isAbsoluteURL(url) {
|
|
1372
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
1373
|
+
}
|
|
1374
|
+
function combineURLs(baseURL, relativeURL) {
|
|
1375
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
1376
|
+
}
|
|
1377
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
1378
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
1379
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
1380
|
+
return combineURLs(baseURL, requestedURL);
|
|
1381
|
+
}
|
|
1382
|
+
return requestedURL;
|
|
1383
|
+
}
|
|
1384
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
1385
|
+
function mergeConfig$1(config1, config2) {
|
|
1386
|
+
config2 = config2 || {};
|
|
1387
|
+
const config = {};
|
|
1388
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
1389
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
1390
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
1391
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
1392
|
+
return utils$1.merge({}, source);
|
|
1393
|
+
} else if (utils$1.isArray(source)) {
|
|
1394
|
+
return source.slice();
|
|
1395
|
+
}
|
|
1396
|
+
return source;
|
|
1397
|
+
}
|
|
1398
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
1399
|
+
if (!utils$1.isUndefined(b)) {
|
|
1400
|
+
return getMergedValue(a, b, prop, caseless);
|
|
1401
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
1402
|
+
return getMergedValue(void 0, a, prop, caseless);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
function valueFromConfig2(a, b) {
|
|
1406
|
+
if (!utils$1.isUndefined(b)) {
|
|
1407
|
+
return getMergedValue(void 0, b);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
function defaultToConfig2(a, b) {
|
|
1411
|
+
if (!utils$1.isUndefined(b)) {
|
|
1412
|
+
return getMergedValue(void 0, b);
|
|
1413
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
1414
|
+
return getMergedValue(void 0, a);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
function mergeDirectKeys(a, b, prop) {
|
|
1418
|
+
if (prop in config2) {
|
|
1419
|
+
return getMergedValue(a, b);
|
|
1420
|
+
} else if (prop in config1) {
|
|
1421
|
+
return getMergedValue(void 0, a);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
const mergeMap = {
|
|
1425
|
+
url: valueFromConfig2,
|
|
1426
|
+
method: valueFromConfig2,
|
|
1427
|
+
data: valueFromConfig2,
|
|
1428
|
+
baseURL: defaultToConfig2,
|
|
1429
|
+
transformRequest: defaultToConfig2,
|
|
1430
|
+
transformResponse: defaultToConfig2,
|
|
1431
|
+
paramsSerializer: defaultToConfig2,
|
|
1432
|
+
timeout: defaultToConfig2,
|
|
1433
|
+
timeoutMessage: defaultToConfig2,
|
|
1434
|
+
withCredentials: defaultToConfig2,
|
|
1435
|
+
withXSRFToken: defaultToConfig2,
|
|
1436
|
+
adapter: defaultToConfig2,
|
|
1437
|
+
responseType: defaultToConfig2,
|
|
1438
|
+
xsrfCookieName: defaultToConfig2,
|
|
1439
|
+
xsrfHeaderName: defaultToConfig2,
|
|
1440
|
+
onUploadProgress: defaultToConfig2,
|
|
1441
|
+
onDownloadProgress: defaultToConfig2,
|
|
1442
|
+
decompress: defaultToConfig2,
|
|
1443
|
+
maxContentLength: defaultToConfig2,
|
|
1444
|
+
maxBodyLength: defaultToConfig2,
|
|
1445
|
+
beforeRedirect: defaultToConfig2,
|
|
1446
|
+
transport: defaultToConfig2,
|
|
1447
|
+
httpAgent: defaultToConfig2,
|
|
1448
|
+
httpsAgent: defaultToConfig2,
|
|
1449
|
+
cancelToken: defaultToConfig2,
|
|
1450
|
+
socketPath: defaultToConfig2,
|
|
1451
|
+
responseEncoding: defaultToConfig2,
|
|
1452
|
+
validateStatus: mergeDirectKeys,
|
|
1453
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
1454
|
+
};
|
|
1455
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
1456
|
+
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
1457
|
+
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
1458
|
+
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
1459
|
+
});
|
|
1460
|
+
return config;
|
|
1461
|
+
}
|
|
1462
|
+
const resolveConfig = (config) => {
|
|
1463
|
+
const newConfig = mergeConfig$1({}, config);
|
|
1464
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
1465
|
+
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
1466
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
1467
|
+
if (auth) {
|
|
1468
|
+
headers.set(
|
|
1469
|
+
"Authorization",
|
|
1470
|
+
"Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
|
|
1471
|
+
);
|
|
1472
|
+
}
|
|
1473
|
+
if (utils$1.isFormData(data)) {
|
|
1474
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
1475
|
+
headers.setContentType(void 0);
|
|
1476
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
1477
|
+
const formHeaders = data.getHeaders();
|
|
1478
|
+
const allowedHeaders = ["content-type", "content-length"];
|
|
1479
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
1480
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
1481
|
+
headers.set(key, val);
|
|
1482
|
+
}
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
if (platform.hasStandardBrowserEnv) {
|
|
1487
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
1488
|
+
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
1489
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
1490
|
+
if (xsrfValue) {
|
|
1491
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
return newConfig;
|
|
1496
|
+
};
|
|
1497
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
1498
|
+
const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
1499
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
1500
|
+
const _config = resolveConfig(config);
|
|
1501
|
+
let requestData = _config.data;
|
|
1502
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
1503
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
1504
|
+
let onCanceled;
|
|
1505
|
+
let uploadThrottled, downloadThrottled;
|
|
1506
|
+
let flushUpload, flushDownload;
|
|
1507
|
+
function done() {
|
|
1508
|
+
flushUpload && flushUpload();
|
|
1509
|
+
flushDownload && flushDownload();
|
|
1510
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
1511
|
+
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
1512
|
+
}
|
|
1513
|
+
let request = new XMLHttpRequest();
|
|
1514
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
1515
|
+
request.timeout = _config.timeout;
|
|
1516
|
+
function onloadend() {
|
|
1517
|
+
if (!request) {
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
1521
|
+
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
1522
|
+
);
|
|
1523
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
1524
|
+
const response = {
|
|
1525
|
+
data: responseData,
|
|
1526
|
+
status: request.status,
|
|
1527
|
+
statusText: request.statusText,
|
|
1528
|
+
headers: responseHeaders,
|
|
1529
|
+
config,
|
|
1530
|
+
request
|
|
1531
|
+
};
|
|
1532
|
+
settle(function _resolve(value) {
|
|
1533
|
+
resolve(value);
|
|
1534
|
+
done();
|
|
1535
|
+
}, function _reject(err) {
|
|
1536
|
+
reject(err);
|
|
1537
|
+
done();
|
|
1538
|
+
}, response);
|
|
1539
|
+
request = null;
|
|
1540
|
+
}
|
|
1541
|
+
if ("onloadend" in request) {
|
|
1542
|
+
request.onloadend = onloadend;
|
|
1543
|
+
} else {
|
|
1544
|
+
request.onreadystatechange = function handleLoad() {
|
|
1545
|
+
if (!request || request.readyState !== 4) {
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1548
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
setTimeout(onloadend);
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
request.onabort = function handleAbort() {
|
|
1555
|
+
if (!request) {
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
|
|
1559
|
+
request = null;
|
|
1560
|
+
};
|
|
1561
|
+
request.onerror = function handleError(event) {
|
|
1562
|
+
const msg = event && event.message ? event.message : "Network Error";
|
|
1563
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
1564
|
+
err.event = event || null;
|
|
1565
|
+
reject(err);
|
|
1566
|
+
request = null;
|
|
1567
|
+
};
|
|
1568
|
+
request.ontimeout = function handleTimeout() {
|
|
1569
|
+
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
1570
|
+
const transitional2 = _config.transitional || transitionalDefaults;
|
|
1571
|
+
if (_config.timeoutErrorMessage) {
|
|
1572
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
1573
|
+
}
|
|
1574
|
+
reject(new AxiosError$1(
|
|
1575
|
+
timeoutErrorMessage,
|
|
1576
|
+
transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
1577
|
+
config,
|
|
1578
|
+
request
|
|
1579
|
+
));
|
|
1580
|
+
request = null;
|
|
1581
|
+
};
|
|
1582
|
+
requestData === void 0 && requestHeaders.setContentType(null);
|
|
1583
|
+
if ("setRequestHeader" in request) {
|
|
1584
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
1585
|
+
request.setRequestHeader(key, val);
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
1589
|
+
request.withCredentials = !!_config.withCredentials;
|
|
1590
|
+
}
|
|
1591
|
+
if (responseType && responseType !== "json") {
|
|
1592
|
+
request.responseType = _config.responseType;
|
|
1593
|
+
}
|
|
1594
|
+
if (onDownloadProgress) {
|
|
1595
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
1596
|
+
request.addEventListener("progress", downloadThrottled);
|
|
1597
|
+
}
|
|
1598
|
+
if (onUploadProgress && request.upload) {
|
|
1599
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
1600
|
+
request.upload.addEventListener("progress", uploadThrottled);
|
|
1601
|
+
request.upload.addEventListener("loadend", flushUpload);
|
|
1602
|
+
}
|
|
1603
|
+
if (_config.cancelToken || _config.signal) {
|
|
1604
|
+
onCanceled = (cancel) => {
|
|
1605
|
+
if (!request) {
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
1609
|
+
request.abort();
|
|
1610
|
+
request = null;
|
|
1611
|
+
};
|
|
1612
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
1613
|
+
if (_config.signal) {
|
|
1614
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
const protocol = parseProtocol(_config.url);
|
|
1618
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
1619
|
+
reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
request.send(requestData || null);
|
|
1623
|
+
});
|
|
1624
|
+
};
|
|
1625
|
+
const composeSignals = (signals, timeout) => {
|
|
1626
|
+
const { length } = signals = signals ? signals.filter(Boolean) : [];
|
|
1627
|
+
if (timeout || length) {
|
|
1628
|
+
let controller = new AbortController();
|
|
1629
|
+
let aborted;
|
|
1630
|
+
const onabort = function(reason) {
|
|
1631
|
+
if (!aborted) {
|
|
1632
|
+
aborted = true;
|
|
1633
|
+
unsubscribe();
|
|
1634
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
1635
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
1636
|
+
}
|
|
1637
|
+
};
|
|
1638
|
+
let timer = timeout && setTimeout(() => {
|
|
1639
|
+
timer = null;
|
|
1640
|
+
onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
1641
|
+
}, timeout);
|
|
1642
|
+
const unsubscribe = () => {
|
|
1643
|
+
if (signals) {
|
|
1644
|
+
timer && clearTimeout(timer);
|
|
1645
|
+
timer = null;
|
|
1646
|
+
signals.forEach((signal2) => {
|
|
1647
|
+
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
1648
|
+
});
|
|
1649
|
+
signals = null;
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
1653
|
+
const { signal } = controller;
|
|
1654
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
1655
|
+
return signal;
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
1659
|
+
let len = chunk.byteLength;
|
|
1660
|
+
if (len < chunkSize) {
|
|
1661
|
+
yield chunk;
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
let pos = 0;
|
|
1665
|
+
let end;
|
|
1666
|
+
while (pos < len) {
|
|
1667
|
+
end = pos + chunkSize;
|
|
1668
|
+
yield chunk.slice(pos, end);
|
|
1669
|
+
pos = end;
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
1673
|
+
for await (const chunk of readStream(iterable)) {
|
|
1674
|
+
yield* streamChunk(chunk, chunkSize);
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
const readStream = async function* (stream) {
|
|
1678
|
+
if (stream[Symbol.asyncIterator]) {
|
|
1679
|
+
yield* stream;
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
const reader = stream.getReader();
|
|
1683
|
+
try {
|
|
1684
|
+
for (; ; ) {
|
|
1685
|
+
const { done, value } = await reader.read();
|
|
1686
|
+
if (done) {
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
yield value;
|
|
1690
|
+
}
|
|
1691
|
+
} finally {
|
|
1692
|
+
await reader.cancel();
|
|
1693
|
+
}
|
|
1694
|
+
};
|
|
1695
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
1696
|
+
const iterator2 = readBytes(stream, chunkSize);
|
|
1697
|
+
let bytes = 0;
|
|
1698
|
+
let done;
|
|
1699
|
+
let _onFinish = (e) => {
|
|
1700
|
+
if (!done) {
|
|
1701
|
+
done = true;
|
|
1702
|
+
onFinish && onFinish(e);
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
return new ReadableStream({
|
|
1706
|
+
async pull(controller) {
|
|
1707
|
+
try {
|
|
1708
|
+
const { done: done2, value } = await iterator2.next();
|
|
1709
|
+
if (done2) {
|
|
1710
|
+
_onFinish();
|
|
1711
|
+
controller.close();
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
let len = value.byteLength;
|
|
1715
|
+
if (onProgress) {
|
|
1716
|
+
let loadedBytes = bytes += len;
|
|
1717
|
+
onProgress(loadedBytes);
|
|
1718
|
+
}
|
|
1719
|
+
controller.enqueue(new Uint8Array(value));
|
|
1720
|
+
} catch (err) {
|
|
1721
|
+
_onFinish(err);
|
|
1722
|
+
throw err;
|
|
1723
|
+
}
|
|
1724
|
+
},
|
|
1725
|
+
cancel(reason) {
|
|
1726
|
+
_onFinish(reason);
|
|
1727
|
+
return iterator2.return();
|
|
1728
|
+
}
|
|
1729
|
+
}, {
|
|
1730
|
+
highWaterMark: 2
|
|
1731
|
+
});
|
|
1732
|
+
};
|
|
1733
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
1734
|
+
const { isFunction } = utils$1;
|
|
1735
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
1736
|
+
Request,
|
|
1737
|
+
Response
|
|
1738
|
+
}))(utils$1.global);
|
|
1739
|
+
const {
|
|
1740
|
+
ReadableStream: ReadableStream$1,
|
|
1741
|
+
TextEncoder
|
|
1742
|
+
} = utils$1.global;
|
|
1743
|
+
const test = (fn, ...args) => {
|
|
1744
|
+
try {
|
|
1745
|
+
return !!fn(...args);
|
|
1746
|
+
} catch (e) {
|
|
1747
|
+
return false;
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
const factory = (env) => {
|
|
1751
|
+
env = utils$1.merge.call({
|
|
1752
|
+
skipUndefined: true
|
|
1753
|
+
}, globalFetchAPI, env);
|
|
1754
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
1755
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
|
|
1756
|
+
const isRequestSupported = isFunction(Request);
|
|
1757
|
+
const isResponseSupported = isFunction(Response);
|
|
1758
|
+
if (!isFetchSupported) {
|
|
1759
|
+
return false;
|
|
1760
|
+
}
|
|
1761
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
1762
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
1763
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
1764
|
+
let duplexAccessed = false;
|
|
1765
|
+
const hasContentType = new Request(platform.origin, {
|
|
1766
|
+
body: new ReadableStream$1(),
|
|
1767
|
+
method: "POST",
|
|
1768
|
+
get duplex() {
|
|
1769
|
+
duplexAccessed = true;
|
|
1770
|
+
return "half";
|
|
1771
|
+
}
|
|
1772
|
+
}).headers.has("Content-Type");
|
|
1773
|
+
return duplexAccessed && !hasContentType;
|
|
1774
|
+
});
|
|
1775
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
1776
|
+
const resolvers = {
|
|
1777
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
1778
|
+
};
|
|
1779
|
+
isFetchSupported && (() => {
|
|
1780
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
1781
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
1782
|
+
let method = res && res[type];
|
|
1783
|
+
if (method) {
|
|
1784
|
+
return method.call(res);
|
|
1785
|
+
}
|
|
1786
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
1787
|
+
});
|
|
1788
|
+
});
|
|
1789
|
+
})();
|
|
1790
|
+
const getBodyLength = async (body) => {
|
|
1791
|
+
if (body == null) {
|
|
1792
|
+
return 0;
|
|
1793
|
+
}
|
|
1794
|
+
if (utils$1.isBlob(body)) {
|
|
1795
|
+
return body.size;
|
|
1796
|
+
}
|
|
1797
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
1798
|
+
const _request = new Request(platform.origin, {
|
|
1799
|
+
method: "POST",
|
|
1800
|
+
body
|
|
1801
|
+
});
|
|
1802
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
1803
|
+
}
|
|
1804
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
1805
|
+
return body.byteLength;
|
|
1806
|
+
}
|
|
1807
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
1808
|
+
body = body + "";
|
|
1809
|
+
}
|
|
1810
|
+
if (utils$1.isString(body)) {
|
|
1811
|
+
return (await encodeText(body)).byteLength;
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
const resolveBodyLength = async (headers, body) => {
|
|
1815
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
1816
|
+
return length == null ? getBodyLength(body) : length;
|
|
1817
|
+
};
|
|
1818
|
+
return async (config) => {
|
|
1819
|
+
let {
|
|
1820
|
+
url,
|
|
1821
|
+
method,
|
|
1822
|
+
data,
|
|
1823
|
+
signal,
|
|
1824
|
+
cancelToken,
|
|
1825
|
+
timeout,
|
|
1826
|
+
onDownloadProgress,
|
|
1827
|
+
onUploadProgress,
|
|
1828
|
+
responseType,
|
|
1829
|
+
headers,
|
|
1830
|
+
withCredentials = "same-origin",
|
|
1831
|
+
fetchOptions
|
|
1832
|
+
} = resolveConfig(config);
|
|
1833
|
+
let _fetch = envFetch || fetch;
|
|
1834
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
1835
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
1836
|
+
let request = null;
|
|
1837
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
1838
|
+
composedSignal.unsubscribe();
|
|
1839
|
+
});
|
|
1840
|
+
let requestContentLength;
|
|
1841
|
+
try {
|
|
1842
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
1843
|
+
let _request = new Request(url, {
|
|
1844
|
+
method: "POST",
|
|
1845
|
+
body: data,
|
|
1846
|
+
duplex: "half"
|
|
1847
|
+
});
|
|
1848
|
+
let contentTypeHeader;
|
|
1849
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
1850
|
+
headers.setContentType(contentTypeHeader);
|
|
1851
|
+
}
|
|
1852
|
+
if (_request.body) {
|
|
1853
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
1854
|
+
requestContentLength,
|
|
1855
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
1856
|
+
);
|
|
1857
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
if (!utils$1.isString(withCredentials)) {
|
|
1861
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
1862
|
+
}
|
|
1863
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
1864
|
+
const resolvedOptions = {
|
|
1865
|
+
...fetchOptions,
|
|
1866
|
+
signal: composedSignal,
|
|
1867
|
+
method: method.toUpperCase(),
|
|
1868
|
+
headers: headers.normalize().toJSON(),
|
|
1869
|
+
body: data,
|
|
1870
|
+
duplex: "half",
|
|
1871
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
1872
|
+
};
|
|
1873
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
1874
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
1875
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
1876
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
1877
|
+
const options = {};
|
|
1878
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
1879
|
+
options[prop] = response[prop];
|
|
1880
|
+
});
|
|
1881
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
|
|
1882
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
1883
|
+
responseContentLength,
|
|
1884
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
1885
|
+
) || [];
|
|
1886
|
+
response = new Response(
|
|
1887
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
1888
|
+
flush && flush();
|
|
1889
|
+
unsubscribe && unsubscribe();
|
|
1890
|
+
}),
|
|
1891
|
+
options
|
|
1892
|
+
);
|
|
1893
|
+
}
|
|
1894
|
+
responseType = responseType || "text";
|
|
1895
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
|
|
1896
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
1897
|
+
return await new Promise((resolve, reject) => {
|
|
1898
|
+
settle(resolve, reject, {
|
|
1899
|
+
data: responseData,
|
|
1900
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
1901
|
+
status: response.status,
|
|
1902
|
+
statusText: response.statusText,
|
|
1903
|
+
config,
|
|
1904
|
+
request
|
|
1905
|
+
});
|
|
1906
|
+
});
|
|
1907
|
+
} catch (err) {
|
|
1908
|
+
unsubscribe && unsubscribe();
|
|
1909
|
+
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
1910
|
+
throw Object.assign(
|
|
1911
|
+
new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
|
|
1912
|
+
{
|
|
1913
|
+
cause: err.cause || err
|
|
1914
|
+
}
|
|
1915
|
+
);
|
|
1916
|
+
}
|
|
1917
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1920
|
+
};
|
|
1921
|
+
const seedCache = /* @__PURE__ */ new Map();
|
|
1922
|
+
const getFetch = (config) => {
|
|
1923
|
+
let env = config && config.env || {};
|
|
1924
|
+
const { fetch: fetch2, Request, Response } = env;
|
|
1925
|
+
const seeds = [
|
|
1926
|
+
Request,
|
|
1927
|
+
Response,
|
|
1928
|
+
fetch2
|
|
1929
|
+
];
|
|
1930
|
+
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
1931
|
+
while (i--) {
|
|
1932
|
+
seed = seeds[i];
|
|
1933
|
+
target = map.get(seed);
|
|
1934
|
+
target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
|
|
1935
|
+
map = target;
|
|
1936
|
+
}
|
|
1937
|
+
return target;
|
|
1938
|
+
};
|
|
1939
|
+
getFetch();
|
|
1940
|
+
const knownAdapters = {
|
|
1941
|
+
http: httpAdapter,
|
|
1942
|
+
xhr: xhrAdapter,
|
|
1943
|
+
fetch: {
|
|
1944
|
+
get: getFetch
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
1948
|
+
if (fn) {
|
|
1949
|
+
try {
|
|
1950
|
+
Object.defineProperty(fn, "name", { value });
|
|
1951
|
+
} catch (e) {
|
|
1952
|
+
}
|
|
1953
|
+
Object.defineProperty(fn, "adapterName", { value });
|
|
1954
|
+
}
|
|
1955
|
+
});
|
|
1956
|
+
const renderReason = (reason) => `- ${reason}`;
|
|
1957
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
1958
|
+
function getAdapter$1(adapters2, config) {
|
|
1959
|
+
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
|
|
1960
|
+
const { length } = adapters2;
|
|
1961
|
+
let nameOrAdapter;
|
|
1962
|
+
let adapter;
|
|
1963
|
+
const rejectedReasons = {};
|
|
1964
|
+
for (let i = 0; i < length; i++) {
|
|
1965
|
+
nameOrAdapter = adapters2[i];
|
|
1966
|
+
let id;
|
|
1967
|
+
adapter = nameOrAdapter;
|
|
1968
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
1969
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
1970
|
+
if (adapter === void 0) {
|
|
1971
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
1975
|
+
break;
|
|
1976
|
+
}
|
|
1977
|
+
rejectedReasons[id || "#" + i] = adapter;
|
|
1978
|
+
}
|
|
1979
|
+
if (!adapter) {
|
|
1980
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
1981
|
+
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
1982
|
+
);
|
|
1983
|
+
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
1984
|
+
throw new AxiosError$1(
|
|
1985
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
1986
|
+
"ERR_NOT_SUPPORT"
|
|
1987
|
+
);
|
|
1988
|
+
}
|
|
1989
|
+
return adapter;
|
|
1990
|
+
}
|
|
1991
|
+
const adapters = {
|
|
1992
|
+
/**
|
|
1993
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
1994
|
+
* @type {Function}
|
|
1995
|
+
*/
|
|
1996
|
+
getAdapter: getAdapter$1,
|
|
1997
|
+
/**
|
|
1998
|
+
* Exposes all known adapters
|
|
1999
|
+
* @type {Object<string, Function|Object>}
|
|
2000
|
+
*/
|
|
2001
|
+
adapters: knownAdapters
|
|
2002
|
+
};
|
|
2003
|
+
function throwIfCancellationRequested(config) {
|
|
2004
|
+
if (config.cancelToken) {
|
|
2005
|
+
config.cancelToken.throwIfRequested();
|
|
2006
|
+
}
|
|
2007
|
+
if (config.signal && config.signal.aborted) {
|
|
2008
|
+
throw new CanceledError$1(null, config);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
function dispatchRequest(config) {
|
|
2012
|
+
throwIfCancellationRequested(config);
|
|
2013
|
+
config.headers = AxiosHeaders$1.from(config.headers);
|
|
2014
|
+
config.data = transformData.call(
|
|
2015
|
+
config,
|
|
2016
|
+
config.transformRequest
|
|
2017
|
+
);
|
|
2018
|
+
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
2019
|
+
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
2020
|
+
}
|
|
2021
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
2022
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
|
2023
|
+
throwIfCancellationRequested(config);
|
|
2024
|
+
response.data = transformData.call(
|
|
2025
|
+
config,
|
|
2026
|
+
config.transformResponse,
|
|
2027
|
+
response
|
|
2028
|
+
);
|
|
2029
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
2030
|
+
return response;
|
|
2031
|
+
}, function onAdapterRejection(reason) {
|
|
2032
|
+
if (!isCancel$1(reason)) {
|
|
2033
|
+
throwIfCancellationRequested(config);
|
|
2034
|
+
if (reason && reason.response) {
|
|
2035
|
+
reason.response.data = transformData.call(
|
|
2036
|
+
config,
|
|
2037
|
+
config.transformResponse,
|
|
2038
|
+
reason.response
|
|
2039
|
+
);
|
|
2040
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
return Promise.reject(reason);
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
const VERSION$1 = "1.13.2";
|
|
2047
|
+
const validators$1 = {};
|
|
2048
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
2049
|
+
validators$1[type] = function validator2(thing) {
|
|
2050
|
+
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
2051
|
+
};
|
|
2052
|
+
});
|
|
2053
|
+
const deprecatedWarnings = {};
|
|
2054
|
+
validators$1.transitional = function transitional(validator2, version, message) {
|
|
2055
|
+
function formatMessage(opt, desc) {
|
|
2056
|
+
return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
2057
|
+
}
|
|
2058
|
+
return (value, opt, opts) => {
|
|
2059
|
+
if (validator2 === false) {
|
|
2060
|
+
throw new AxiosError$1(
|
|
2061
|
+
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
2062
|
+
AxiosError$1.ERR_DEPRECATED
|
|
2063
|
+
);
|
|
2064
|
+
}
|
|
2065
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
2066
|
+
deprecatedWarnings[opt] = true;
|
|
2067
|
+
console.warn(
|
|
2068
|
+
formatMessage(
|
|
2069
|
+
opt,
|
|
2070
|
+
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
2071
|
+
)
|
|
2072
|
+
);
|
|
2073
|
+
}
|
|
2074
|
+
return validator2 ? validator2(value, opt, opts) : true;
|
|
2075
|
+
};
|
|
2076
|
+
};
|
|
2077
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
2078
|
+
return (value, opt) => {
|
|
2079
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
2080
|
+
return true;
|
|
2081
|
+
};
|
|
2082
|
+
};
|
|
2083
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
2084
|
+
if (typeof options !== "object") {
|
|
2085
|
+
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2086
|
+
}
|
|
2087
|
+
const keys = Object.keys(options);
|
|
2088
|
+
let i = keys.length;
|
|
2089
|
+
while (i-- > 0) {
|
|
2090
|
+
const opt = keys[i];
|
|
2091
|
+
const validator2 = schema[opt];
|
|
2092
|
+
if (validator2) {
|
|
2093
|
+
const value = options[opt];
|
|
2094
|
+
const result = value === void 0 || validator2(value, opt, options);
|
|
2095
|
+
if (result !== true) {
|
|
2096
|
+
throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2097
|
+
}
|
|
2098
|
+
continue;
|
|
2099
|
+
}
|
|
2100
|
+
if (allowUnknown !== true) {
|
|
2101
|
+
throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
const validator = {
|
|
2106
|
+
assertOptions,
|
|
2107
|
+
validators: validators$1
|
|
2108
|
+
};
|
|
2109
|
+
const validators = validator.validators;
|
|
2110
|
+
let Axios$1 = class Axios {
|
|
2111
|
+
constructor(instanceConfig) {
|
|
2112
|
+
this.defaults = instanceConfig || {};
|
|
2113
|
+
this.interceptors = {
|
|
2114
|
+
request: new InterceptorManager(),
|
|
2115
|
+
response: new InterceptorManager()
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
/**
|
|
2119
|
+
* Dispatch a request
|
|
2120
|
+
*
|
|
2121
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
2122
|
+
* @param {?Object} config
|
|
2123
|
+
*
|
|
2124
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
2125
|
+
*/
|
|
2126
|
+
async request(configOrUrl, config) {
|
|
2127
|
+
try {
|
|
2128
|
+
return await this._request(configOrUrl, config);
|
|
2129
|
+
} catch (err) {
|
|
2130
|
+
if (err instanceof Error) {
|
|
2131
|
+
let dummy = {};
|
|
2132
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
2133
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
2134
|
+
try {
|
|
2135
|
+
if (!err.stack) {
|
|
2136
|
+
err.stack = stack;
|
|
2137
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
2138
|
+
err.stack += "\n" + stack;
|
|
2139
|
+
}
|
|
2140
|
+
} catch (e) {
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
throw err;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
_request(configOrUrl, config) {
|
|
2147
|
+
if (typeof configOrUrl === "string") {
|
|
2148
|
+
config = config || {};
|
|
2149
|
+
config.url = configOrUrl;
|
|
2150
|
+
} else {
|
|
2151
|
+
config = configOrUrl || {};
|
|
2152
|
+
}
|
|
2153
|
+
config = mergeConfig$1(this.defaults, config);
|
|
2154
|
+
const { transitional: transitional2, paramsSerializer, headers } = config;
|
|
2155
|
+
if (transitional2 !== void 0) {
|
|
2156
|
+
validator.assertOptions(transitional2, {
|
|
2157
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
2158
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
2159
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
2160
|
+
}, false);
|
|
2161
|
+
}
|
|
2162
|
+
if (paramsSerializer != null) {
|
|
2163
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
2164
|
+
config.paramsSerializer = {
|
|
2165
|
+
serialize: paramsSerializer
|
|
2166
|
+
};
|
|
2167
|
+
} else {
|
|
2168
|
+
validator.assertOptions(paramsSerializer, {
|
|
2169
|
+
encode: validators.function,
|
|
2170
|
+
serialize: validators.function
|
|
2171
|
+
}, true);
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
if (config.allowAbsoluteUrls !== void 0) ;
|
|
2175
|
+
else if (this.defaults.allowAbsoluteUrls !== void 0) {
|
|
2176
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
2177
|
+
} else {
|
|
2178
|
+
config.allowAbsoluteUrls = true;
|
|
2179
|
+
}
|
|
2180
|
+
validator.assertOptions(config, {
|
|
2181
|
+
baseUrl: validators.spelling("baseURL"),
|
|
2182
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
2183
|
+
}, true);
|
|
2184
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
2185
|
+
let contextHeaders = headers && utils$1.merge(
|
|
2186
|
+
headers.common,
|
|
2187
|
+
headers[config.method]
|
|
2188
|
+
);
|
|
2189
|
+
headers && utils$1.forEach(
|
|
2190
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
2191
|
+
(method) => {
|
|
2192
|
+
delete headers[method];
|
|
2193
|
+
}
|
|
2194
|
+
);
|
|
2195
|
+
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
2196
|
+
const requestInterceptorChain = [];
|
|
2197
|
+
let synchronousRequestInterceptors = true;
|
|
2198
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
2199
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2202
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
2203
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
2204
|
+
});
|
|
2205
|
+
const responseInterceptorChain = [];
|
|
2206
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
2207
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2208
|
+
});
|
|
2209
|
+
let promise;
|
|
2210
|
+
let i = 0;
|
|
2211
|
+
let len;
|
|
2212
|
+
if (!synchronousRequestInterceptors) {
|
|
2213
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
2214
|
+
chain.unshift(...requestInterceptorChain);
|
|
2215
|
+
chain.push(...responseInterceptorChain);
|
|
2216
|
+
len = chain.length;
|
|
2217
|
+
promise = Promise.resolve(config);
|
|
2218
|
+
while (i < len) {
|
|
2219
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
2220
|
+
}
|
|
2221
|
+
return promise;
|
|
2222
|
+
}
|
|
2223
|
+
len = requestInterceptorChain.length;
|
|
2224
|
+
let newConfig = config;
|
|
2225
|
+
while (i < len) {
|
|
2226
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
2227
|
+
const onRejected = requestInterceptorChain[i++];
|
|
2228
|
+
try {
|
|
2229
|
+
newConfig = onFulfilled(newConfig);
|
|
2230
|
+
} catch (error) {
|
|
2231
|
+
onRejected.call(this, error);
|
|
2232
|
+
break;
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
try {
|
|
2236
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
2237
|
+
} catch (error) {
|
|
2238
|
+
return Promise.reject(error);
|
|
2239
|
+
}
|
|
2240
|
+
i = 0;
|
|
2241
|
+
len = responseInterceptorChain.length;
|
|
2242
|
+
while (i < len) {
|
|
2243
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
2244
|
+
}
|
|
2245
|
+
return promise;
|
|
2246
|
+
}
|
|
2247
|
+
getUri(config) {
|
|
2248
|
+
config = mergeConfig$1(this.defaults, config);
|
|
2249
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
2250
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
2251
|
+
}
|
|
2252
|
+
};
|
|
2253
|
+
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
2254
|
+
Axios$1.prototype[method] = function(url, config) {
|
|
2255
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
2256
|
+
method,
|
|
2257
|
+
url,
|
|
2258
|
+
data: (config || {}).data
|
|
2259
|
+
}));
|
|
2260
|
+
};
|
|
2261
|
+
});
|
|
2262
|
+
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
2263
|
+
function generateHTTPMethod(isForm) {
|
|
2264
|
+
return function httpMethod(url, data, config) {
|
|
2265
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
2266
|
+
method,
|
|
2267
|
+
headers: isForm ? {
|
|
2268
|
+
"Content-Type": "multipart/form-data"
|
|
2269
|
+
} : {},
|
|
2270
|
+
url,
|
|
2271
|
+
data
|
|
2272
|
+
}));
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
|
2276
|
+
Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
2277
|
+
});
|
|
2278
|
+
let CancelToken$1 = class CancelToken {
|
|
2279
|
+
constructor(executor) {
|
|
2280
|
+
if (typeof executor !== "function") {
|
|
2281
|
+
throw new TypeError("executor must be a function.");
|
|
2282
|
+
}
|
|
2283
|
+
let resolvePromise;
|
|
2284
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
2285
|
+
resolvePromise = resolve;
|
|
2286
|
+
});
|
|
2287
|
+
const token = this;
|
|
2288
|
+
this.promise.then((cancel) => {
|
|
2289
|
+
if (!token._listeners) return;
|
|
2290
|
+
let i = token._listeners.length;
|
|
2291
|
+
while (i-- > 0) {
|
|
2292
|
+
token._listeners[i](cancel);
|
|
2293
|
+
}
|
|
2294
|
+
token._listeners = null;
|
|
2295
|
+
});
|
|
2296
|
+
this.promise.then = (onfulfilled) => {
|
|
2297
|
+
let _resolve;
|
|
2298
|
+
const promise = new Promise((resolve) => {
|
|
2299
|
+
token.subscribe(resolve);
|
|
2300
|
+
_resolve = resolve;
|
|
2301
|
+
}).then(onfulfilled);
|
|
2302
|
+
promise.cancel = function reject() {
|
|
2303
|
+
token.unsubscribe(_resolve);
|
|
2304
|
+
};
|
|
2305
|
+
return promise;
|
|
2306
|
+
};
|
|
2307
|
+
executor(function cancel(message, config, request) {
|
|
2308
|
+
if (token.reason) {
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
2312
|
+
resolvePromise(token.reason);
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
2317
|
+
*/
|
|
2318
|
+
throwIfRequested() {
|
|
2319
|
+
if (this.reason) {
|
|
2320
|
+
throw this.reason;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
/**
|
|
2324
|
+
* Subscribe to the cancel signal
|
|
2325
|
+
*/
|
|
2326
|
+
subscribe(listener) {
|
|
2327
|
+
if (this.reason) {
|
|
2328
|
+
listener(this.reason);
|
|
2329
|
+
return;
|
|
2330
|
+
}
|
|
2331
|
+
if (this._listeners) {
|
|
2332
|
+
this._listeners.push(listener);
|
|
2333
|
+
} else {
|
|
2334
|
+
this._listeners = [listener];
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
/**
|
|
2338
|
+
* Unsubscribe from the cancel signal
|
|
2339
|
+
*/
|
|
2340
|
+
unsubscribe(listener) {
|
|
2341
|
+
if (!this._listeners) {
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
const index = this._listeners.indexOf(listener);
|
|
2345
|
+
if (index !== -1) {
|
|
2346
|
+
this._listeners.splice(index, 1);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
toAbortSignal() {
|
|
2350
|
+
const controller = new AbortController();
|
|
2351
|
+
const abort = (err) => {
|
|
2352
|
+
controller.abort(err);
|
|
2353
|
+
};
|
|
2354
|
+
this.subscribe(abort);
|
|
2355
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
2356
|
+
return controller.signal;
|
|
2357
|
+
}
|
|
2358
|
+
/**
|
|
2359
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
2360
|
+
* cancels the `CancelToken`.
|
|
2361
|
+
*/
|
|
2362
|
+
static source() {
|
|
2363
|
+
let cancel;
|
|
2364
|
+
const token = new CancelToken(function executor(c) {
|
|
2365
|
+
cancel = c;
|
|
2366
|
+
});
|
|
2367
|
+
return {
|
|
2368
|
+
token,
|
|
2369
|
+
cancel
|
|
2370
|
+
};
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
function spread$1(callback) {
|
|
2374
|
+
return function wrap(arr) {
|
|
2375
|
+
return callback.apply(null, arr);
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
function isAxiosError$1(payload) {
|
|
2379
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
2380
|
+
}
|
|
2381
|
+
const HttpStatusCode$1 = {
|
|
2382
|
+
Continue: 100,
|
|
2383
|
+
SwitchingProtocols: 101,
|
|
2384
|
+
Processing: 102,
|
|
2385
|
+
EarlyHints: 103,
|
|
2386
|
+
Ok: 200,
|
|
2387
|
+
Created: 201,
|
|
2388
|
+
Accepted: 202,
|
|
2389
|
+
NonAuthoritativeInformation: 203,
|
|
2390
|
+
NoContent: 204,
|
|
2391
|
+
ResetContent: 205,
|
|
2392
|
+
PartialContent: 206,
|
|
2393
|
+
MultiStatus: 207,
|
|
2394
|
+
AlreadyReported: 208,
|
|
2395
|
+
ImUsed: 226,
|
|
2396
|
+
MultipleChoices: 300,
|
|
2397
|
+
MovedPermanently: 301,
|
|
2398
|
+
Found: 302,
|
|
2399
|
+
SeeOther: 303,
|
|
2400
|
+
NotModified: 304,
|
|
2401
|
+
UseProxy: 305,
|
|
2402
|
+
Unused: 306,
|
|
2403
|
+
TemporaryRedirect: 307,
|
|
2404
|
+
PermanentRedirect: 308,
|
|
2405
|
+
BadRequest: 400,
|
|
2406
|
+
Unauthorized: 401,
|
|
2407
|
+
PaymentRequired: 402,
|
|
2408
|
+
Forbidden: 403,
|
|
2409
|
+
NotFound: 404,
|
|
2410
|
+
MethodNotAllowed: 405,
|
|
2411
|
+
NotAcceptable: 406,
|
|
2412
|
+
ProxyAuthenticationRequired: 407,
|
|
2413
|
+
RequestTimeout: 408,
|
|
2414
|
+
Conflict: 409,
|
|
2415
|
+
Gone: 410,
|
|
2416
|
+
LengthRequired: 411,
|
|
2417
|
+
PreconditionFailed: 412,
|
|
2418
|
+
PayloadTooLarge: 413,
|
|
2419
|
+
UriTooLong: 414,
|
|
2420
|
+
UnsupportedMediaType: 415,
|
|
2421
|
+
RangeNotSatisfiable: 416,
|
|
2422
|
+
ExpectationFailed: 417,
|
|
2423
|
+
ImATeapot: 418,
|
|
2424
|
+
MisdirectedRequest: 421,
|
|
2425
|
+
UnprocessableEntity: 422,
|
|
2426
|
+
Locked: 423,
|
|
2427
|
+
FailedDependency: 424,
|
|
2428
|
+
TooEarly: 425,
|
|
2429
|
+
UpgradeRequired: 426,
|
|
2430
|
+
PreconditionRequired: 428,
|
|
2431
|
+
TooManyRequests: 429,
|
|
2432
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
2433
|
+
UnavailableForLegalReasons: 451,
|
|
2434
|
+
InternalServerError: 500,
|
|
2435
|
+
NotImplemented: 501,
|
|
2436
|
+
BadGateway: 502,
|
|
2437
|
+
ServiceUnavailable: 503,
|
|
2438
|
+
GatewayTimeout: 504,
|
|
2439
|
+
HttpVersionNotSupported: 505,
|
|
2440
|
+
VariantAlsoNegotiates: 506,
|
|
2441
|
+
InsufficientStorage: 507,
|
|
2442
|
+
LoopDetected: 508,
|
|
2443
|
+
NotExtended: 510,
|
|
2444
|
+
NetworkAuthenticationRequired: 511,
|
|
2445
|
+
WebServerIsDown: 521,
|
|
2446
|
+
ConnectionTimedOut: 522,
|
|
2447
|
+
OriginIsUnreachable: 523,
|
|
2448
|
+
TimeoutOccurred: 524,
|
|
2449
|
+
SslHandshakeFailed: 525,
|
|
2450
|
+
InvalidSslCertificate: 526
|
|
2451
|
+
};
|
|
2452
|
+
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
2453
|
+
HttpStatusCode$1[value] = key;
|
|
2454
|
+
});
|
|
2455
|
+
function createInstance(defaultConfig) {
|
|
2456
|
+
const context = new Axios$1(defaultConfig);
|
|
2457
|
+
const instance = bind(Axios$1.prototype.request, context);
|
|
2458
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
2459
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
2460
|
+
instance.create = function create(instanceConfig) {
|
|
2461
|
+
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
2462
|
+
};
|
|
2463
|
+
return instance;
|
|
2464
|
+
}
|
|
2465
|
+
const axios = createInstance(defaults);
|
|
2466
|
+
axios.Axios = Axios$1;
|
|
2467
|
+
axios.CanceledError = CanceledError$1;
|
|
2468
|
+
axios.CancelToken = CancelToken$1;
|
|
2469
|
+
axios.isCancel = isCancel$1;
|
|
2470
|
+
axios.VERSION = VERSION$1;
|
|
2471
|
+
axios.toFormData = toFormData$1;
|
|
2472
|
+
axios.AxiosError = AxiosError$1;
|
|
2473
|
+
axios.Cancel = axios.CanceledError;
|
|
2474
|
+
axios.all = function all(promises) {
|
|
2475
|
+
return Promise.all(promises);
|
|
2476
|
+
};
|
|
2477
|
+
axios.spread = spread$1;
|
|
2478
|
+
axios.isAxiosError = isAxiosError$1;
|
|
2479
|
+
axios.mergeConfig = mergeConfig$1;
|
|
2480
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
2481
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
2482
|
+
axios.getAdapter = adapters.getAdapter;
|
|
2483
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
2484
|
+
axios.default = axios;
|
|
2485
|
+
const {
|
|
2486
|
+
Axios: Axios2,
|
|
2487
|
+
AxiosError,
|
|
2488
|
+
CanceledError,
|
|
2489
|
+
isCancel,
|
|
2490
|
+
CancelToken: CancelToken2,
|
|
2491
|
+
VERSION,
|
|
2492
|
+
all: all2,
|
|
2493
|
+
Cancel,
|
|
2494
|
+
isAxiosError,
|
|
2495
|
+
spread,
|
|
2496
|
+
toFormData,
|
|
2497
|
+
AxiosHeaders: AxiosHeaders2,
|
|
2498
|
+
HttpStatusCode,
|
|
2499
|
+
formToJSON,
|
|
2500
|
+
getAdapter,
|
|
2501
|
+
mergeConfig
|
|
2502
|
+
} = axios;
|
|
2503
|
+
const api = axios.create({
|
|
2504
|
+
withCredentials: true,
|
|
2505
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
2506
|
+
xsrfHeaderName: "X-XSRF-TOKEN"
|
|
2507
|
+
});
|
|
2508
|
+
api.interceptors.request.use((config) => {
|
|
2509
|
+
const token = document.cookie.split("; ").find((row) => row.startsWith("XSRF-TOKEN="))?.split("=")[1];
|
|
2510
|
+
if (token) {
|
|
2511
|
+
config.headers["X-XSRF-TOKEN"] = decodeURIComponent(token);
|
|
2512
|
+
}
|
|
2513
|
+
return config;
|
|
2514
|
+
});
|
|
2515
|
+
var MediaFileType;
|
|
2516
|
+
(function(MediaFileType2) {
|
|
2517
|
+
MediaFileType2[MediaFileType2["DOCUMENT"] = 1] = "DOCUMENT";
|
|
2518
|
+
MediaFileType2[MediaFileType2["IMAGE"] = 2] = "IMAGE";
|
|
2519
|
+
MediaFileType2[MediaFileType2["VIDEO"] = 3] = "VIDEO";
|
|
2520
|
+
MediaFileType2[MediaFileType2["AUDIO"] = 4] = "AUDIO";
|
|
2521
|
+
MediaFileType2[MediaFileType2["OTHER"] = 5] = "OTHER";
|
|
2522
|
+
})(MediaFileType || (MediaFileType = {}));
|
|
2523
|
+
var NewsArticleStatus;
|
|
2524
|
+
(function(NewsArticleStatus2) {
|
|
2525
|
+
NewsArticleStatus2[NewsArticleStatus2["DRAFT"] = 1] = "DRAFT";
|
|
2526
|
+
NewsArticleStatus2[NewsArticleStatus2["PENDING"] = 2] = "PENDING";
|
|
2527
|
+
NewsArticleStatus2[NewsArticleStatus2["PUBLISHED"] = 3] = "PUBLISHED";
|
|
2528
|
+
NewsArticleStatus2[NewsArticleStatus2["TRASH"] = 4] = "TRASH";
|
|
2529
|
+
})(NewsArticleStatus || (NewsArticleStatus = {}));
|
|
2530
|
+
var VideoDisplayType;
|
|
2531
|
+
(function(VideoDisplayType2) {
|
|
2532
|
+
VideoDisplayType2["VERTICAL"] = "vertical";
|
|
2533
|
+
VideoDisplayType2["HORIZONTAL"] = "horizontal";
|
|
2534
|
+
})(VideoDisplayType || (VideoDisplayType = {}));
|
|
2535
|
+
var VideoItemSource;
|
|
2536
|
+
(function(VideoItemSource2) {
|
|
2537
|
+
VideoItemSource2["SELF_HOSTED"] = "self-hosted";
|
|
2538
|
+
VideoItemSource2["YOUTUBE"] = "youtube";
|
|
2539
|
+
})(VideoItemSource || (VideoItemSource = {}));
|
|
2540
|
+
function removeTrailingSlash(path) {
|
|
2541
|
+
if (path.length > 1 && path.charAt(path.length - 1) === "/") {
|
|
2542
|
+
return path.substring(0, path.length - 1);
|
|
2543
|
+
}
|
|
2544
|
+
return path;
|
|
2545
|
+
}
|
|
2546
|
+
function removeLeadingSlash(path) {
|
|
2547
|
+
if (path.startsWith("/")) {
|
|
2548
|
+
return path.slice(1);
|
|
2549
|
+
}
|
|
2550
|
+
return path;
|
|
2551
|
+
}
|
|
2552
|
+
function getBaseUrl() {
|
|
2553
|
+
const { protocol, hostname, port } = window.location;
|
|
2554
|
+
return protocol + "//" + hostname + (port ? `:${port}` : "");
|
|
2555
|
+
}
|
|
2556
|
+
function slideToId(id) {
|
|
2557
|
+
const element = document.getElementById(id);
|
|
2558
|
+
if (element) {
|
|
2559
|
+
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
2560
|
+
} else {
|
|
2561
|
+
console.error(`Element with ID "${id}" not found.`);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
function isURL(str) {
|
|
2565
|
+
if (!str || typeof str !== "string") {
|
|
2566
|
+
return false;
|
|
2567
|
+
}
|
|
2568
|
+
let url = str.trim();
|
|
2569
|
+
if (!url.includes("://")) {
|
|
2570
|
+
url = "http://" + url;
|
|
2571
|
+
}
|
|
2572
|
+
let urlParts;
|
|
2573
|
+
try {
|
|
2574
|
+
urlParts = new URL(url);
|
|
2575
|
+
} catch {
|
|
2576
|
+
return false;
|
|
2577
|
+
}
|
|
2578
|
+
const protocol = urlParts.protocol.replace(":", "");
|
|
2579
|
+
if (!["http", "https", "ftp"].includes(protocol)) {
|
|
2580
|
+
return false;
|
|
2581
|
+
}
|
|
2582
|
+
if (!urlParts.hostname) {
|
|
2583
|
+
return false;
|
|
2584
|
+
}
|
|
2585
|
+
const hostname = urlParts.hostname.toLowerCase();
|
|
2586
|
+
if (hostname.includes("_")) {
|
|
2587
|
+
return false;
|
|
2588
|
+
}
|
|
2589
|
+
if (urlParts.port) {
|
|
2590
|
+
const port = parseInt(urlParts.port, 10);
|
|
2591
|
+
if (isNaN(port) || port < 1 || port > 65535) {
|
|
2592
|
+
return false;
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
const isLocalhost = hostname === "localhost";
|
|
2596
|
+
const isIPv4 = /^(?:(?:\d{1,3}\.){3}\d{1,3})$/i.test(hostname);
|
|
2597
|
+
const isIPv6 = /^\[([0-9a-f:]+)\]$/i.test(hostname) || /^([0-9a-f:]+)$/i.test(hostname);
|
|
2598
|
+
if (!isLocalhost && !isIPv4 && !isIPv6) {
|
|
2599
|
+
const parts = hostname.split(".");
|
|
2600
|
+
if (parts.length < 2 || parts.some((part) => !part)) {
|
|
2601
|
+
return false;
|
|
2602
|
+
}
|
|
2603
|
+
if (parts[parts.length - 1].length < 1) {
|
|
2604
|
+
return false;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
const hostnameRegex = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
2608
|
+
if (!hostnameRegex.test(hostname) && !isLocalhost && !isIPv4 && !isIPv6) {
|
|
2609
|
+
return false;
|
|
2610
|
+
}
|
|
2611
|
+
return true;
|
|
2612
|
+
}
|
|
2613
|
+
var ItemCreatorType;
|
|
2614
|
+
(function(ItemCreatorType2) {
|
|
2615
|
+
ItemCreatorType2["USER"] = "user";
|
|
2616
|
+
ItemCreatorType2["ADMIN"] = "admin";
|
|
2617
|
+
ItemCreatorType2["SYSTEM"] = "system";
|
|
2618
|
+
})(ItemCreatorType || (ItemCreatorType = {}));
|
|
2619
|
+
var AccessScope;
|
|
2620
|
+
(function(AccessScope2) {
|
|
2621
|
+
AccessScope2["INTERNAL"] = "internal";
|
|
2622
|
+
AccessScope2["USER_EDITABLE"] = "user-editable";
|
|
2623
|
+
})(AccessScope || (AccessScope = {}));
|
|
2624
|
+
var Intent;
|
|
2625
|
+
(function(Intent2) {
|
|
2626
|
+
Intent2["EDITORIAL_CONTENT"] = "editorial-content";
|
|
2627
|
+
Intent2["USER_DATA"] = "user-data";
|
|
2628
|
+
Intent2["SYSTEM_DATA"] = "system-data";
|
|
2629
|
+
})(Intent || (Intent = {}));
|
|
2630
|
+
var AccessGuard;
|
|
2631
|
+
(function(AccessGuard2) {
|
|
2632
|
+
AccessGuard2["API"] = "api";
|
|
2633
|
+
AccessGuard2["WEB"] = "web";
|
|
2634
|
+
AccessGuard2["ADMIN"] = "admin";
|
|
2635
|
+
AccessGuard2["MOBILE"] = "mobile";
|
|
2636
|
+
})(AccessGuard || (AccessGuard = {}));
|
|
2637
|
+
var AccountStatus;
|
|
2638
|
+
(function(AccountStatus2) {
|
|
2639
|
+
AccountStatus2[AccountStatus2["DISABLED"] = 0] = "DISABLED";
|
|
2640
|
+
AccountStatus2[AccountStatus2["ENABLED"] = 1] = "ENABLED";
|
|
2641
|
+
})(AccountStatus || (AccountStatus = {}));
|
|
2642
|
+
var AdContentType;
|
|
2643
|
+
(function(AdContentType2) {
|
|
2644
|
+
AdContentType2["IMAGE"] = "image";
|
|
2645
|
+
AdContentType2["VIDEO"] = "video";
|
|
2646
|
+
})(AdContentType || (AdContentType = {}));
|
|
2647
|
+
var AuthType;
|
|
2648
|
+
(function(AuthType2) {
|
|
2649
|
+
AuthType2[AuthType2["UNDEFINED"] = 0] = "UNDEFINED";
|
|
2650
|
+
AuthType2[AuthType2["EMAIL_PASSWORD"] = 1] = "EMAIL_PASSWORD";
|
|
2651
|
+
AuthType2[AuthType2["PHONE"] = 2] = "PHONE";
|
|
2652
|
+
AuthType2[AuthType2["GOOGLE"] = 3] = "GOOGLE";
|
|
2653
|
+
AuthType2[AuthType2["FACEBOOK"] = 4] = "FACEBOOK";
|
|
2654
|
+
AuthType2[AuthType2["TWITTER"] = 5] = "TWITTER";
|
|
2655
|
+
})(AuthType || (AuthType = {}));
|
|
2656
|
+
var Bool;
|
|
2657
|
+
(function(Bool2) {
|
|
2658
|
+
Bool2[Bool2["FALSE"] = 0] = "FALSE";
|
|
2659
|
+
Bool2[Bool2["TRUE"] = 1] = "TRUE";
|
|
2660
|
+
})(Bool || (Bool = {}));
|
|
2661
|
+
var ContentType;
|
|
2662
|
+
(function(ContentType2) {
|
|
2663
|
+
ContentType2["NEWS_TAG"] = "news-tag";
|
|
2664
|
+
ContentType2["NEWS_CATEGORY"] = "news-category";
|
|
2665
|
+
ContentType2["NEWS_ARTICLE"] = "news-article";
|
|
2666
|
+
ContentType2["CONTENT_MODEL"] = "content-model";
|
|
2667
|
+
})(ContentType || (ContentType = {}));
|
|
2668
|
+
exports.EditorMessageType = void 0;
|
|
2669
|
+
(function(EditorMessageType) {
|
|
2670
|
+
EditorMessageType["RELOAD"] = "reload";
|
|
2671
|
+
EditorMessageType["RELOAD_COMPLETE"] = "reload-complete";
|
|
2672
|
+
EditorMessageType["ENABLE_EDITION_MODE"] = "enable-edition-mode";
|
|
2673
|
+
EditorMessageType["DESELECT_ALL_SECTIONS"] = "deselect-all-sections";
|
|
2674
|
+
EditorMessageType["SELECT_PREVIEW_SECTION"] = "select-preview-section";
|
|
2675
|
+
EditorMessageType["SELECT_SIDEBAR_SECTION"] = "select-sidebar-section";
|
|
2676
|
+
EditorMessageType["SEND_BASE_SECTION_SETTINGS"] = "send-base-section-settings";
|
|
2677
|
+
EditorMessageType["SEND_BASE_SECTION_DATA"] = "send-base-section-data";
|
|
2678
|
+
EditorMessageType["SEND_SECTION_SETTINGS"] = "send-section-settings";
|
|
2679
|
+
EditorMessageType["SEND_SECTION_DATA"] = "send-section-data";
|
|
2680
|
+
EditorMessageType["SEND_PAGE_SECTIONS"] = "send-page-sections";
|
|
2681
|
+
})(exports.EditorMessageType || (exports.EditorMessageType = {}));
|
|
2682
|
+
var MenuItemTargetType;
|
|
2683
|
+
(function(MenuItemTargetType2) {
|
|
2684
|
+
MenuItemTargetType2["EXTERNAL_LINK"] = "external-link";
|
|
2685
|
+
MenuItemTargetType2["PAGE_LINK"] = "page-link";
|
|
2686
|
+
MenuItemTargetType2["CONTENT_LINK"] = "content-link";
|
|
2687
|
+
})(MenuItemTargetType || (MenuItemTargetType = {}));
|
|
2688
|
+
var NotificationSource;
|
|
2689
|
+
(function(NotificationSource2) {
|
|
2690
|
+
NotificationSource2[NotificationSource2["SYSTEM"] = 1] = "SYSTEM";
|
|
2691
|
+
NotificationSource2[NotificationSource2["USER"] = 2] = "USER";
|
|
2692
|
+
})(NotificationSource || (NotificationSource = {}));
|
|
2693
|
+
var NotificationType;
|
|
2694
|
+
(function(NotificationType2) {
|
|
2695
|
+
NotificationType2["WELCOME_USER"] = "Creopse\\Creopse\\Notifications\\WelcomeUser";
|
|
2696
|
+
})(NotificationType || (NotificationType = {}));
|
|
2697
|
+
var PermalinkContentType;
|
|
2698
|
+
(function(PermalinkContentType2) {
|
|
2699
|
+
PermalinkContentType2["NEWS_TAG"] = "news-tag";
|
|
2700
|
+
PermalinkContentType2["NEWS_CATEGORY"] = "news-category";
|
|
2701
|
+
PermalinkContentType2["NEWS_ARTICLE"] = "news-article";
|
|
2702
|
+
PermalinkContentType2["CONTENT_MODEL"] = "content-model";
|
|
2703
|
+
})(PermalinkContentType || (PermalinkContentType = {}));
|
|
2704
|
+
var ProfileType;
|
|
2705
|
+
(function(ProfileType2) {
|
|
2706
|
+
ProfileType2["ADMIN"] = "Creopse\\Creopse\\Models\\AdminProfile";
|
|
2707
|
+
ProfileType2["SUBSCRIBER"] = "App\\Models\\SubscriberProfile";
|
|
2708
|
+
})(ProfileType || (ProfileType = {}));
|
|
2709
|
+
var Permission;
|
|
2710
|
+
(function(Permission2) {
|
|
2711
|
+
Permission2["VIEW_DASHBOARD"] = "view-dashboard";
|
|
2712
|
+
Permission2["VIEW_ACCOUNT"] = "view-account";
|
|
2713
|
+
Permission2["EDIT_ACCOUNT"] = "edit-account";
|
|
2714
|
+
Permission2["VIEW_NOTIFICATIONS"] = "view-notifications";
|
|
2715
|
+
Permission2["MANAGE_NOTIFICATIONS"] = "manage-notifications";
|
|
2716
|
+
Permission2["VIEW_ABOUT"] = "view-about";
|
|
2717
|
+
Permission2["MANAGE_PLUGINS"] = "manage-plugins";
|
|
2718
|
+
Permission2["MANAGE_APP_SETTINGS"] = "manage-app-settings";
|
|
2719
|
+
Permission2["VIEW_USERS"] = "view-users";
|
|
2720
|
+
Permission2["CREATE_USER"] = "create-user";
|
|
2721
|
+
Permission2["EDIT_USER"] = "edit-user";
|
|
2722
|
+
Permission2["DELETE_USER"] = "delete-user";
|
|
2723
|
+
Permission2["VIEW_ROLES"] = "view-roles";
|
|
2724
|
+
Permission2["MANAGE_ROLES"] = "manage-roles";
|
|
2725
|
+
Permission2["VIEW_PERMISSIONS"] = "view-permissions";
|
|
2726
|
+
Permission2["MANAGE_PERMISSIONS"] = "manage-permissions";
|
|
2727
|
+
Permission2["CREATE_ARTICLE"] = "create-article";
|
|
2728
|
+
Permission2["EDIT_ARTICLE"] = "edit-article";
|
|
2729
|
+
Permission2["DELETE_ARTICLE"] = "delete-article";
|
|
2730
|
+
Permission2["MANAGE_NEWS"] = "manage-news";
|
|
2731
|
+
Permission2["VIEW_MEDIA"] = "view-media";
|
|
2732
|
+
Permission2["UPLOAD_MEDIA"] = "upload-media";
|
|
2733
|
+
Permission2["DELETE_MEDIA"] = "delete-media";
|
|
2734
|
+
Permission2["VIEW_CONTENT"] = "view-content";
|
|
2735
|
+
Permission2["MANAGE_CONTENT"] = "manage-content";
|
|
2736
|
+
Permission2["USE_VISUAL_EDITOR"] = "use-visual-editor";
|
|
2737
|
+
})(Permission || (Permission = {}));
|
|
2738
|
+
var ResponseErrorCode;
|
|
2739
|
+
(function(ResponseErrorCode2) {
|
|
2740
|
+
ResponseErrorCode2["FORM_INVALID_DATA"] = "form/invalid_data";
|
|
2741
|
+
ResponseErrorCode2["REQUEST_PARAMS_MISSING"] = "request/params_missing";
|
|
2742
|
+
ResponseErrorCode2["REQUEST_DATA_RETRIEVAL_FAILED"] = "request/data_retrieval_failed";
|
|
2743
|
+
ResponseErrorCode2["REQUEST_DATA_ALREADY_EXISTS"] = "request/data_already_exists";
|
|
2744
|
+
ResponseErrorCode2["AUTH_LOGIN_FAILED"] = "auth/login_failed";
|
|
2745
|
+
ResponseErrorCode2["AUTH_REGISTRATION_FAILED"] = "auth/registration_failed";
|
|
2746
|
+
ResponseErrorCode2["AUTH_MISSING_DATA"] = "auth/missing_data";
|
|
2747
|
+
ResponseErrorCode2["AUTH_WRONG_PASSWORD"] = "auth/wrong_password";
|
|
2748
|
+
ResponseErrorCode2["AUTH_USER_DISABLED"] = "auth/user_disabled";
|
|
2749
|
+
ResponseErrorCode2["AUTH_USER_NOT_FOUND"] = "auth/user_not_found";
|
|
2750
|
+
ResponseErrorCode2["AUTH_PROFILE_TYPE_NOT_FOUND"] = "auth/profile_type_not_found";
|
|
2751
|
+
ResponseErrorCode2["AUTH_EMAIL_ALREADY_USED"] = "auth/email_already_used";
|
|
2752
|
+
ResponseErrorCode2["AUTH_EMAIL_ALREADY_VERIFIED"] = "auth/email_already_verified";
|
|
2753
|
+
ResponseErrorCode2["AUTH_PROFILE_ALREADY_EXISTS"] = "auth/profile_already_exists";
|
|
2754
|
+
ResponseErrorCode2["AUTH_PROFILE_NOT_FOUND"] = "auth/profile_not_found";
|
|
2755
|
+
ResponseErrorCode2["AUTH_INVALID_TOKEN"] = "auth/invalid_token";
|
|
2756
|
+
ResponseErrorCode2["AUTH_CODE_SENDING_FAILED"] = "auth/code_sending_failed";
|
|
2757
|
+
ResponseErrorCode2["AUTH_CODE_VERIFICATION_FAILED"] = "auth/code_verification_failed";
|
|
2758
|
+
ResponseErrorCode2["AUTH_CODE_EXPIRED"] = "auth/code_expired";
|
|
2759
|
+
})(ResponseErrorCode || (ResponseErrorCode = {}));
|
|
2760
|
+
var ResponseStatusCode;
|
|
2761
|
+
(function(ResponseStatusCode2) {
|
|
2762
|
+
ResponseStatusCode2[ResponseStatusCode2["CONTINUE"] = 100] = "CONTINUE";
|
|
2763
|
+
ResponseStatusCode2[ResponseStatusCode2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
2764
|
+
ResponseStatusCode2[ResponseStatusCode2["PROCESSING"] = 102] = "PROCESSING";
|
|
2765
|
+
ResponseStatusCode2[ResponseStatusCode2["OK"] = 200] = "OK";
|
|
2766
|
+
ResponseStatusCode2[ResponseStatusCode2["CREATED"] = 201] = "CREATED";
|
|
2767
|
+
ResponseStatusCode2[ResponseStatusCode2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
2768
|
+
ResponseStatusCode2[ResponseStatusCode2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
2769
|
+
ResponseStatusCode2[ResponseStatusCode2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
2770
|
+
ResponseStatusCode2[ResponseStatusCode2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
2771
|
+
ResponseStatusCode2[ResponseStatusCode2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
2772
|
+
ResponseStatusCode2[ResponseStatusCode2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
|
|
2773
|
+
ResponseStatusCode2[ResponseStatusCode2["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
|
|
2774
|
+
ResponseStatusCode2[ResponseStatusCode2["IM_USED"] = 226] = "IM_USED";
|
|
2775
|
+
ResponseStatusCode2[ResponseStatusCode2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
|
|
2776
|
+
ResponseStatusCode2[ResponseStatusCode2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
2777
|
+
ResponseStatusCode2[ResponseStatusCode2["FOUND"] = 302] = "FOUND";
|
|
2778
|
+
ResponseStatusCode2[ResponseStatusCode2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
2779
|
+
ResponseStatusCode2[ResponseStatusCode2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
2780
|
+
ResponseStatusCode2[ResponseStatusCode2["USE_PROXY"] = 305] = "USE_PROXY";
|
|
2781
|
+
ResponseStatusCode2[ResponseStatusCode2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
2782
|
+
ResponseStatusCode2[ResponseStatusCode2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
2783
|
+
ResponseStatusCode2[ResponseStatusCode2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
2784
|
+
ResponseStatusCode2[ResponseStatusCode2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
2785
|
+
ResponseStatusCode2[ResponseStatusCode2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
2786
|
+
ResponseStatusCode2[ResponseStatusCode2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
2787
|
+
ResponseStatusCode2[ResponseStatusCode2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
2788
|
+
ResponseStatusCode2[ResponseStatusCode2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
2789
|
+
ResponseStatusCode2[ResponseStatusCode2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
2790
|
+
ResponseStatusCode2[ResponseStatusCode2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
2791
|
+
ResponseStatusCode2[ResponseStatusCode2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
2792
|
+
ResponseStatusCode2[ResponseStatusCode2["CONFLICT"] = 409] = "CONFLICT";
|
|
2793
|
+
ResponseStatusCode2[ResponseStatusCode2["GONE"] = 410] = "GONE";
|
|
2794
|
+
ResponseStatusCode2[ResponseStatusCode2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
2795
|
+
ResponseStatusCode2[ResponseStatusCode2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
2796
|
+
ResponseStatusCode2[ResponseStatusCode2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
2797
|
+
ResponseStatusCode2[ResponseStatusCode2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
2798
|
+
ResponseStatusCode2[ResponseStatusCode2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
2799
|
+
ResponseStatusCode2[ResponseStatusCode2["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
|
|
2800
|
+
ResponseStatusCode2[ResponseStatusCode2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
2801
|
+
ResponseStatusCode2[ResponseStatusCode2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
|
|
2802
|
+
ResponseStatusCode2[ResponseStatusCode2["SESSION_HAS_EXPIRED"] = 419] = "SESSION_HAS_EXPIRED";
|
|
2803
|
+
ResponseStatusCode2[ResponseStatusCode2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
2804
|
+
ResponseStatusCode2[ResponseStatusCode2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
2805
|
+
ResponseStatusCode2[ResponseStatusCode2["LOCKED"] = 423] = "LOCKED";
|
|
2806
|
+
ResponseStatusCode2[ResponseStatusCode2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
2807
|
+
ResponseStatusCode2[ResponseStatusCode2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
2808
|
+
ResponseStatusCode2[ResponseStatusCode2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
2809
|
+
ResponseStatusCode2[ResponseStatusCode2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
2810
|
+
ResponseStatusCode2[ResponseStatusCode2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
2811
|
+
ResponseStatusCode2[ResponseStatusCode2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
|
|
2812
|
+
ResponseStatusCode2[ResponseStatusCode2["CONNECTION_CLOSED_WITHOUT_RESPONSE"] = 444] = "CONNECTION_CLOSED_WITHOUT_RESPONSE";
|
|
2813
|
+
ResponseStatusCode2[ResponseStatusCode2["RETRY_WITH"] = 449] = "RETRY_WITH";
|
|
2814
|
+
ResponseStatusCode2[ResponseStatusCode2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
|
|
2815
|
+
ResponseStatusCode2[ResponseStatusCode2["CLIENT_CLOSED_REQUEST"] = 499] = "CLIENT_CLOSED_REQUEST";
|
|
2816
|
+
ResponseStatusCode2[ResponseStatusCode2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
2817
|
+
ResponseStatusCode2[ResponseStatusCode2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
2818
|
+
ResponseStatusCode2[ResponseStatusCode2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
2819
|
+
ResponseStatusCode2[ResponseStatusCode2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
2820
|
+
ResponseStatusCode2[ResponseStatusCode2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
2821
|
+
ResponseStatusCode2[ResponseStatusCode2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
2822
|
+
ResponseStatusCode2[ResponseStatusCode2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
2823
|
+
ResponseStatusCode2[ResponseStatusCode2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
2824
|
+
ResponseStatusCode2[ResponseStatusCode2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
2825
|
+
ResponseStatusCode2[ResponseStatusCode2["BANDWIDTH_LIMIT_EXCEEDED"] = 509] = "BANDWIDTH_LIMIT_EXCEEDED";
|
|
2826
|
+
ResponseStatusCode2[ResponseStatusCode2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
2827
|
+
ResponseStatusCode2[ResponseStatusCode2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
2828
|
+
ResponseStatusCode2[ResponseStatusCode2["UNKNOWN_ERROR"] = 520] = "UNKNOWN_ERROR";
|
|
2829
|
+
ResponseStatusCode2[ResponseStatusCode2["WEB_SERVER_IS_DOWN"] = 521] = "WEB_SERVER_IS_DOWN";
|
|
2830
|
+
ResponseStatusCode2[ResponseStatusCode2["CONNECTION_TIMED_OUT"] = 522] = "CONNECTION_TIMED_OUT";
|
|
2831
|
+
ResponseStatusCode2[ResponseStatusCode2["ORIGIN_IS_UNREACHABLE"] = 523] = "ORIGIN_IS_UNREACHABLE";
|
|
2832
|
+
ResponseStatusCode2[ResponseStatusCode2["A_TIMEOUT_OCCURRED"] = 524] = "A_TIMEOUT_OCCURRED";
|
|
2833
|
+
ResponseStatusCode2[ResponseStatusCode2["SSL_HANDSHAKE_FAILED"] = 525] = "SSL_HANDSHAKE_FAILED";
|
|
2834
|
+
ResponseStatusCode2[ResponseStatusCode2["INVALID_SSL_CERTIFICATE"] = 526] = "INVALID_SSL_CERTIFICATE";
|
|
2835
|
+
ResponseStatusCode2[ResponseStatusCode2["RAILGUN_ERROR"] = 527] = "RAILGUN_ERROR";
|
|
2836
|
+
ResponseStatusCode2[ResponseStatusCode2["NETWORK_READ_TIMEOUT_ERROR"] = 598] = "NETWORK_READ_TIMEOUT_ERROR";
|
|
2837
|
+
ResponseStatusCode2[ResponseStatusCode2["NETWORK_CONNECT_TIMEOUT_ERROR"] = 599] = "NETWORK_CONNECT_TIMEOUT_ERROR";
|
|
2838
|
+
})(ResponseStatusCode || (ResponseStatusCode = {}));
|
|
2839
|
+
var UserRole;
|
|
2840
|
+
(function(UserRole2) {
|
|
2841
|
+
UserRole2["SUPER_ADMIN"] = "super-admin";
|
|
2842
|
+
UserRole2["ADMIN"] = "admin";
|
|
2843
|
+
UserRole2["USER"] = "user";
|
|
2844
|
+
})(UserRole || (UserRole = {}));
|
|
2845
|
+
const useConfig = () => {
|
|
2846
|
+
const config = React.useContext(ConfigContext);
|
|
2847
|
+
if (!config) {
|
|
2848
|
+
throw new Error("[@creopse/react] CreopseProvider not found in tree");
|
|
2849
|
+
}
|
|
2850
|
+
return React.useMemo(() => {
|
|
2851
|
+
const apiBaseUrl = removeTrailingSlash(config.appUrl || getBaseUrl());
|
|
2852
|
+
return {
|
|
2853
|
+
...config,
|
|
2854
|
+
apiBaseUrl,
|
|
2855
|
+
apiUrl: `${apiBaseUrl}/api`
|
|
2856
|
+
};
|
|
2857
|
+
}, [config]);
|
|
2858
|
+
};
|
|
2859
|
+
const useApi = () => {
|
|
2860
|
+
const { apiUrl, apiBaseUrl, debug } = useConfig();
|
|
2861
|
+
const handleError = React.useCallback(
|
|
2862
|
+
(error) => {
|
|
2863
|
+
if (debug) {
|
|
2864
|
+
if (error.response) {
|
|
2865
|
+
console.log("data:", error.response.data);
|
|
2866
|
+
console.log("status:", error.response.status);
|
|
2867
|
+
console.log("headers:", error.response.headers);
|
|
2868
|
+
} else if (error.request) {
|
|
2869
|
+
console.log("request:", error.request);
|
|
2870
|
+
} else {
|
|
2871
|
+
console.log("error:", error.message);
|
|
2872
|
+
}
|
|
2873
|
+
console.log("config:", error.config);
|
|
2874
|
+
}
|
|
2875
|
+
},
|
|
2876
|
+
[debug]
|
|
2877
|
+
);
|
|
2878
|
+
const request = React.useCallback(
|
|
2879
|
+
async (payload, accessForbiddenCallback) => {
|
|
2880
|
+
let success = false;
|
|
2881
|
+
let response = null;
|
|
2882
|
+
let error = null;
|
|
2883
|
+
try {
|
|
2884
|
+
response = await api.request({
|
|
2885
|
+
method: payload.method || "get",
|
|
2886
|
+
params: payload.params || {},
|
|
2887
|
+
data: payload.data || {},
|
|
2888
|
+
url: payload.url || "/",
|
|
2889
|
+
baseURL: payload.useApiBaseUrl ? apiBaseUrl : apiUrl,
|
|
2890
|
+
headers: payload.headers,
|
|
2891
|
+
...payload.responseType && { responseType: payload.responseType }
|
|
2892
|
+
});
|
|
2893
|
+
success = true;
|
|
2894
|
+
} catch (err) {
|
|
2895
|
+
error = err;
|
|
2896
|
+
success = false;
|
|
2897
|
+
if (err.response?.status == 401) {
|
|
2898
|
+
accessForbiddenCallback?.();
|
|
2899
|
+
} else if (err.response?.status == 419) {
|
|
2900
|
+
console.error("CSRF token mismatch");
|
|
2901
|
+
} else handleError(err);
|
|
2902
|
+
}
|
|
2903
|
+
return {
|
|
2904
|
+
success,
|
|
2905
|
+
failure: !success,
|
|
2906
|
+
result: response ? response.data : null,
|
|
2907
|
+
error
|
|
2908
|
+
};
|
|
2909
|
+
},
|
|
2910
|
+
[apiBaseUrl, apiUrl, handleError]
|
|
2911
|
+
);
|
|
2912
|
+
const postItemRequest = React.useCallback(
|
|
2913
|
+
async (payload) => {
|
|
2914
|
+
const task = await request({
|
|
2915
|
+
url: `/${payload.routeBase}`,
|
|
2916
|
+
method: "post",
|
|
2917
|
+
data: payload.data
|
|
2918
|
+
});
|
|
2919
|
+
return task;
|
|
2920
|
+
},
|
|
2921
|
+
[request]
|
|
2922
|
+
);
|
|
2923
|
+
const deleteItemRequest = React.useCallback(
|
|
2924
|
+
async (payload) => {
|
|
2925
|
+
const task = await request({
|
|
2926
|
+
url: `/${payload.routeBase}/${payload.id}`,
|
|
2927
|
+
method: "delete"
|
|
2928
|
+
});
|
|
2929
|
+
return task;
|
|
2930
|
+
},
|
|
2931
|
+
[request]
|
|
2932
|
+
);
|
|
2933
|
+
const putItemRequest = React.useCallback(
|
|
2934
|
+
async (payload) => {
|
|
2935
|
+
const task = await request({
|
|
2936
|
+
url: `/${payload.routeBase}/${payload.id}`,
|
|
2937
|
+
method: "put",
|
|
2938
|
+
data: payload.data
|
|
2939
|
+
});
|
|
2940
|
+
return task;
|
|
2941
|
+
},
|
|
2942
|
+
[request]
|
|
2943
|
+
);
|
|
2944
|
+
const getAllItemsRequest = React.useCallback(
|
|
2945
|
+
async (payload) => {
|
|
2946
|
+
const task = await request({
|
|
2947
|
+
url: `/${payload.routeBase}`
|
|
2948
|
+
});
|
|
2949
|
+
return task;
|
|
2950
|
+
},
|
|
2951
|
+
[request]
|
|
2952
|
+
);
|
|
2953
|
+
const getItemRequest = React.useCallback(
|
|
2954
|
+
async (payload) => {
|
|
2955
|
+
const task = await request({
|
|
2956
|
+
url: `/${payload.routeBase}/${payload.id}`
|
|
2957
|
+
});
|
|
2958
|
+
return task;
|
|
2959
|
+
},
|
|
2960
|
+
[request]
|
|
2961
|
+
);
|
|
2962
|
+
return {
|
|
2963
|
+
request,
|
|
2964
|
+
getItemRequest,
|
|
2965
|
+
postItemRequest,
|
|
2966
|
+
putItemRequest,
|
|
2967
|
+
deleteItemRequest,
|
|
2968
|
+
getAllItemsRequest,
|
|
2969
|
+
handleError
|
|
2970
|
+
};
|
|
2971
|
+
};
|
|
2972
|
+
const useProps = () => {
|
|
2973
|
+
const manager = React.useContext(PropsContext);
|
|
2974
|
+
const page = react.usePage();
|
|
2975
|
+
const [props, setProps] = React.useState(
|
|
2976
|
+
manager ? manager.getState().props : {}
|
|
2977
|
+
);
|
|
2978
|
+
React.useEffect(() => {
|
|
2979
|
+
if (!manager) return;
|
|
2980
|
+
setProps(manager.getState().props);
|
|
2981
|
+
const unsubscribe = manager.subscribe((newProps) => {
|
|
2982
|
+
setProps(newProps);
|
|
2983
|
+
});
|
|
2984
|
+
return unsubscribe;
|
|
2985
|
+
}, [manager]);
|
|
2986
|
+
if (!manager) {
|
|
2987
|
+
console.warn(
|
|
2988
|
+
"[@creopse/react] Using native Inertia props - live preview disabled"
|
|
2989
|
+
);
|
|
2990
|
+
return page.props;
|
|
2991
|
+
}
|
|
2992
|
+
return props;
|
|
2993
|
+
};
|
|
2994
|
+
const useMediaQuery = (query) => {
|
|
2995
|
+
const [matches, setMatches] = React.useState(false);
|
|
2996
|
+
React.useEffect(() => {
|
|
2997
|
+
const media = window.matchMedia(query);
|
|
2998
|
+
if (media.matches !== matches) {
|
|
2999
|
+
setMatches(media.matches);
|
|
3000
|
+
}
|
|
3001
|
+
const listener = () => setMatches(media.matches);
|
|
3002
|
+
media.addEventListener("change", listener);
|
|
3003
|
+
return () => media.removeEventListener("change", listener);
|
|
3004
|
+
}, [matches, query]);
|
|
3005
|
+
return matches;
|
|
3006
|
+
};
|
|
3007
|
+
const useHelper = () => {
|
|
3008
|
+
const props = useProps();
|
|
3009
|
+
const page = react.usePage();
|
|
3010
|
+
const { request } = useApi();
|
|
3011
|
+
const { apiBaseUrl, langKey } = useConfig();
|
|
3012
|
+
const config = React.useContext(ConfigContext);
|
|
3013
|
+
const currentRoutePath = React.useMemo(() => page.url, [page.url]);
|
|
3014
|
+
const resolveUrl = React.useCallback(
|
|
3015
|
+
(path) => {
|
|
3016
|
+
if (isURL(path)) return path;
|
|
3017
|
+
else return `${apiBaseUrl}/${removeLeadingSlash(path)}`;
|
|
3018
|
+
},
|
|
3019
|
+
[apiBaseUrl]
|
|
3020
|
+
);
|
|
3021
|
+
const fileUrl = React.useCallback(
|
|
3022
|
+
(path) => {
|
|
3023
|
+
if (path) {
|
|
3024
|
+
if (isURL(path)) return path;
|
|
3025
|
+
else return `${apiBaseUrl}/storage/${path}`;
|
|
3026
|
+
}
|
|
3027
|
+
return "";
|
|
3028
|
+
},
|
|
3029
|
+
[apiBaseUrl]
|
|
3030
|
+
);
|
|
3031
|
+
const getImage = React.useCallback(
|
|
3032
|
+
async (path, size = "original") => {
|
|
3033
|
+
const checkableSizes = ["small", "medium", "large"];
|
|
3034
|
+
const imageName = path.split("/").pop();
|
|
3035
|
+
let canUseIt = false;
|
|
3036
|
+
for (let i = 0; i < checkableSizes.length; i++) {
|
|
3037
|
+
if (checkableSizes[i] === size) canUseIt = true;
|
|
3038
|
+
if (canUseIt) {
|
|
3039
|
+
try {
|
|
3040
|
+
const url = fileUrl(`thumbnails/${checkableSizes[i]}/${imageName}`);
|
|
3041
|
+
const response = await axios.head(url);
|
|
3042
|
+
if (response.status === 200) {
|
|
3043
|
+
return url;
|
|
3044
|
+
}
|
|
3045
|
+
} catch (error) {
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
return fileUrl(path);
|
|
3050
|
+
},
|
|
3051
|
+
[fileUrl]
|
|
3052
|
+
);
|
|
3053
|
+
const getTranslation = React.useCallback(
|
|
3054
|
+
(data, lang) => {
|
|
3055
|
+
let parsedData;
|
|
3056
|
+
let userLanguage = (
|
|
3057
|
+
// @ts-expect-error ignore
|
|
3058
|
+
(window.navigator.language || window.navigator.userLanguage)?.split(
|
|
3059
|
+
"-"
|
|
3060
|
+
)[0]
|
|
3061
|
+
);
|
|
3062
|
+
if (props.userData && props.userData.preferences && props.userData.preferences.locale) {
|
|
3063
|
+
userLanguage = props.userData.preferences.locale;
|
|
3064
|
+
}
|
|
3065
|
+
if (!lang) {
|
|
3066
|
+
lang = localStorage.getItem(langKey) || (config?.useUserLocaleAsFallback ? userLanguage : false) || props.appLocale || config?.locale || "en";
|
|
3067
|
+
}
|
|
3068
|
+
try {
|
|
3069
|
+
parsedData = JSON.parse(data);
|
|
3070
|
+
} catch (e) {
|
|
3071
|
+
parsedData = {};
|
|
3072
|
+
}
|
|
3073
|
+
return parsedData ? parsedData[lang.toUpperCase()] || parsedData[lang] || "" : "";
|
|
3074
|
+
},
|
|
3075
|
+
[
|
|
3076
|
+
config?.locale,
|
|
3077
|
+
config?.useUserLocaleAsFallback,
|
|
3078
|
+
langKey,
|
|
3079
|
+
props.appLocale,
|
|
3080
|
+
props.userData
|
|
3081
|
+
]
|
|
3082
|
+
);
|
|
3083
|
+
const tr = React.useCallback(
|
|
3084
|
+
(data, lang) => {
|
|
3085
|
+
return getTranslation(data, lang);
|
|
3086
|
+
},
|
|
3087
|
+
[getTranslation]
|
|
3088
|
+
);
|
|
3089
|
+
const resolveHtmlLinks = React.useCallback(
|
|
3090
|
+
(data, lang) => {
|
|
3091
|
+
if (!data) return "";
|
|
3092
|
+
let str = getTranslation(data, lang).replace(
|
|
3093
|
+
new RegExp("{{BASE_URL}}article", "g"),
|
|
3094
|
+
`${apiBaseUrl}/article`
|
|
3095
|
+
).replace(new RegExp("{{BASE_URL}}", "g"), `${apiBaseUrl}/storage`);
|
|
3096
|
+
const audioList = str.match(/\[audio\](.*?)\[\/?audio\]/g);
|
|
3097
|
+
const videoList = str.match(/\[video\](.*?)\[\/?video\]/g);
|
|
3098
|
+
audioList?.forEach((item) => {
|
|
3099
|
+
const url = item.replace(/\[\/?audio\]/g, "");
|
|
3100
|
+
str = str.replace(
|
|
3101
|
+
item,
|
|
3102
|
+
`<br><p><audio preload="all" controls style="width: 100%"><source src="${fileUrl(
|
|
3103
|
+
url
|
|
3104
|
+
)}"></audio></p><br>`
|
|
3105
|
+
);
|
|
3106
|
+
});
|
|
3107
|
+
videoList?.forEach((item) => {
|
|
3108
|
+
const url = item.replace(/\[\/?video\]/g, "");
|
|
3109
|
+
str = str.replace(
|
|
3110
|
+
item,
|
|
3111
|
+
`<br><p><video controls style="width: 100%"><source src="${fileUrl(
|
|
3112
|
+
url
|
|
3113
|
+
)}"></video></p><br>`
|
|
3114
|
+
);
|
|
3115
|
+
});
|
|
3116
|
+
return str;
|
|
3117
|
+
},
|
|
3118
|
+
[getTranslation, apiBaseUrl, fileUrl]
|
|
3119
|
+
);
|
|
3120
|
+
const rHtml = React.useCallback(
|
|
3121
|
+
(data, lang) => {
|
|
3122
|
+
return resolveHtmlLinks(data, lang);
|
|
3123
|
+
},
|
|
3124
|
+
[resolveHtmlLinks]
|
|
3125
|
+
);
|
|
3126
|
+
const is2XlScreen = useMediaQuery("(min-width: 1536px)");
|
|
3127
|
+
const isXlScreen = useMediaQuery(
|
|
3128
|
+
"(min-width: 1280px) and (max-width: 1535px)"
|
|
3129
|
+
);
|
|
3130
|
+
const isLgScreen = useMediaQuery(
|
|
3131
|
+
"(min-width: 1024px) and (max-width: 1279px)"
|
|
3132
|
+
);
|
|
3133
|
+
const isMdScreen = useMediaQuery("(min-width: 768px) and (max-width: 1023px)");
|
|
3134
|
+
const isSmScreen = useMediaQuery("(max-width: 767px)");
|
|
3135
|
+
const languages = React.useMemo(
|
|
3136
|
+
() => [
|
|
3137
|
+
{
|
|
3138
|
+
label: "Français",
|
|
3139
|
+
value: "fr",
|
|
3140
|
+
flag: "flag:fr-1x1"
|
|
3141
|
+
},
|
|
3142
|
+
{
|
|
3143
|
+
label: "English",
|
|
3144
|
+
value: "en",
|
|
3145
|
+
flag: "flag:gb-1x1"
|
|
3146
|
+
}
|
|
3147
|
+
],
|
|
3148
|
+
[]
|
|
3149
|
+
);
|
|
3150
|
+
const getLangageLabel = React.useCallback(
|
|
3151
|
+
(value) => languages.find((l) => l.value === value)?.label,
|
|
3152
|
+
[languages]
|
|
3153
|
+
);
|
|
3154
|
+
const getLanguageValue = React.useCallback(
|
|
3155
|
+
(label) => languages.find((l) => l.label === label)?.value,
|
|
3156
|
+
[languages]
|
|
3157
|
+
);
|
|
3158
|
+
const updateLang = React.useCallback(
|
|
3159
|
+
async (val, reload = true, updateUserPrefs = true) => {
|
|
3160
|
+
localStorage.setItem(langKey, val);
|
|
3161
|
+
if (props.isUserLoggedIn && updateUserPrefs) {
|
|
3162
|
+
const userPrefs = props.userData?.preferences || {
|
|
3163
|
+
inAppNotifEnabled: Bool.TRUE,
|
|
3164
|
+
emailNotifEnabled: Bool.TRUE,
|
|
3165
|
+
locale: val
|
|
3166
|
+
};
|
|
3167
|
+
userPrefs.locale = val;
|
|
3168
|
+
await request({
|
|
3169
|
+
url: `/users/self/${props.userData?.id}`,
|
|
3170
|
+
method: "put",
|
|
3171
|
+
data: {
|
|
3172
|
+
preferences: userPrefs
|
|
3173
|
+
}
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
if (reload) location.reload();
|
|
3177
|
+
},
|
|
3178
|
+
[langKey, props, request]
|
|
3179
|
+
);
|
|
3180
|
+
const displayFormErrors = React.useCallback(
|
|
3181
|
+
(errors, displayError) => {
|
|
3182
|
+
if (errors) {
|
|
3183
|
+
for (const [_key, value] of Object.entries(errors)) {
|
|
3184
|
+
for (const error of value) {
|
|
3185
|
+
displayError(error);
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
},
|
|
3190
|
+
[]
|
|
3191
|
+
);
|
|
3192
|
+
const openLink = React.useCallback((str) => {
|
|
3193
|
+
if (isURL(str)) {
|
|
3194
|
+
window.open(str, "_blank");
|
|
3195
|
+
} else {
|
|
3196
|
+
react.router.get(str);
|
|
3197
|
+
}
|
|
3198
|
+
}, []);
|
|
3199
|
+
const openMenu = React.useCallback((menu) => {
|
|
3200
|
+
switch (menu?.targetType) {
|
|
3201
|
+
case MenuItemTargetType.EXTERNAL_LINK:
|
|
3202
|
+
window.open(menu?.url ?? "#");
|
|
3203
|
+
break;
|
|
3204
|
+
case MenuItemTargetType.PAGE_LINK:
|
|
3205
|
+
react.router.get(menu?.path ?? "/");
|
|
3206
|
+
break;
|
|
3207
|
+
}
|
|
3208
|
+
}, []);
|
|
3209
|
+
const getMenuHref = React.useCallback((menu) => {
|
|
3210
|
+
if (menu?.targetType === "external-link") {
|
|
3211
|
+
return menu?.url || "";
|
|
3212
|
+
}
|
|
3213
|
+
return menu?.path || "";
|
|
3214
|
+
}, []);
|
|
3215
|
+
const ckEditorToolbarItems = React.useMemo(
|
|
3216
|
+
() => [
|
|
3217
|
+
"fullScreen",
|
|
3218
|
+
"|",
|
|
3219
|
+
"heading",
|
|
3220
|
+
"|",
|
|
3221
|
+
"uploadImage",
|
|
3222
|
+
"|",
|
|
3223
|
+
"bold",
|
|
3224
|
+
"italic",
|
|
3225
|
+
"underline",
|
|
3226
|
+
"strikethrough",
|
|
3227
|
+
"code",
|
|
3228
|
+
"subscript",
|
|
3229
|
+
"superscript",
|
|
3230
|
+
"selectAll",
|
|
3231
|
+
"|",
|
|
3232
|
+
"fontSize",
|
|
3233
|
+
"fontFamily",
|
|
3234
|
+
"fontColor",
|
|
3235
|
+
"fontBackgroundColor",
|
|
3236
|
+
"|",
|
|
3237
|
+
"horizontalLine",
|
|
3238
|
+
"blockQuote",
|
|
3239
|
+
"bulletedList",
|
|
3240
|
+
"numberedList",
|
|
3241
|
+
"alignment",
|
|
3242
|
+
"|",
|
|
3243
|
+
"outdent",
|
|
3244
|
+
"indent",
|
|
3245
|
+
"|",
|
|
3246
|
+
"link",
|
|
3247
|
+
"insertTable",
|
|
3248
|
+
"mediaEmbed",
|
|
3249
|
+
"|",
|
|
3250
|
+
"undo",
|
|
3251
|
+
"redo"
|
|
3252
|
+
],
|
|
3253
|
+
[]
|
|
3254
|
+
);
|
|
3255
|
+
return {
|
|
3256
|
+
is2XlScreen,
|
|
3257
|
+
isXlScreen,
|
|
3258
|
+
isLgScreen,
|
|
3259
|
+
isMdScreen,
|
|
3260
|
+
isSmScreen,
|
|
3261
|
+
getTranslation,
|
|
3262
|
+
getLangageLabel,
|
|
3263
|
+
getLanguageValue,
|
|
3264
|
+
ckEditorToolbarItems,
|
|
3265
|
+
displayFormErrors,
|
|
3266
|
+
resolveHtmlLinks,
|
|
3267
|
+
resolveUrl,
|
|
3268
|
+
updateLang,
|
|
3269
|
+
languages,
|
|
3270
|
+
getImage,
|
|
3271
|
+
fileUrl,
|
|
3272
|
+
currentRoutePath,
|
|
3273
|
+
openLink,
|
|
3274
|
+
openMenu,
|
|
3275
|
+
getMenuHref,
|
|
3276
|
+
rHtml,
|
|
3277
|
+
tr
|
|
3278
|
+
};
|
|
3279
|
+
};
|
|
3280
|
+
var lodash_clonedeep = { exports: {} };
|
|
3281
|
+
lodash_clonedeep.exports;
|
|
3282
|
+
var hasRequiredLodash_clonedeep;
|
|
3283
|
+
function requireLodash_clonedeep() {
|
|
3284
|
+
if (hasRequiredLodash_clonedeep) return lodash_clonedeep.exports;
|
|
3285
|
+
hasRequiredLodash_clonedeep = 1;
|
|
3286
|
+
(function(module2, exports2) {
|
|
3287
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
3288
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
3289
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
3290
|
+
var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", promiseTag = "[object Promise]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
|
|
3291
|
+
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
3292
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
3293
|
+
var reFlags = /\w*$/;
|
|
3294
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
3295
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
3296
|
+
var cloneableTags = {};
|
|
3297
|
+
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
3298
|
+
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
|
3299
|
+
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
3300
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
3301
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
3302
|
+
var freeExports = exports2 && !exports2.nodeType && exports2;
|
|
3303
|
+
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
|
3304
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
3305
|
+
function addMapEntry(map, pair) {
|
|
3306
|
+
map.set(pair[0], pair[1]);
|
|
3307
|
+
return map;
|
|
3308
|
+
}
|
|
3309
|
+
function addSetEntry(set, value) {
|
|
3310
|
+
set.add(value);
|
|
3311
|
+
return set;
|
|
3312
|
+
}
|
|
3313
|
+
function arrayEach(array, iteratee) {
|
|
3314
|
+
var index = -1, length = array ? array.length : 0;
|
|
3315
|
+
while (++index < length) {
|
|
3316
|
+
if (iteratee(array[index], index, array) === false) {
|
|
3317
|
+
break;
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
return array;
|
|
3321
|
+
}
|
|
3322
|
+
function arrayPush(array, values) {
|
|
3323
|
+
var index = -1, length = values.length, offset = array.length;
|
|
3324
|
+
while (++index < length) {
|
|
3325
|
+
array[offset + index] = values[index];
|
|
3326
|
+
}
|
|
3327
|
+
return array;
|
|
3328
|
+
}
|
|
3329
|
+
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
3330
|
+
var index = -1, length = array ? array.length : 0;
|
|
3331
|
+
while (++index < length) {
|
|
3332
|
+
accumulator = iteratee(accumulator, array[index], index, array);
|
|
3333
|
+
}
|
|
3334
|
+
return accumulator;
|
|
3335
|
+
}
|
|
3336
|
+
function baseTimes(n, iteratee) {
|
|
3337
|
+
var index = -1, result = Array(n);
|
|
3338
|
+
while (++index < n) {
|
|
3339
|
+
result[index] = iteratee(index);
|
|
3340
|
+
}
|
|
3341
|
+
return result;
|
|
3342
|
+
}
|
|
3343
|
+
function getValue(object, key) {
|
|
3344
|
+
return object == null ? void 0 : object[key];
|
|
3345
|
+
}
|
|
3346
|
+
function isHostObject(value) {
|
|
3347
|
+
var result = false;
|
|
3348
|
+
if (value != null && typeof value.toString != "function") {
|
|
3349
|
+
try {
|
|
3350
|
+
result = !!(value + "");
|
|
3351
|
+
} catch (e) {
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
return result;
|
|
3355
|
+
}
|
|
3356
|
+
function mapToArray(map) {
|
|
3357
|
+
var index = -1, result = Array(map.size);
|
|
3358
|
+
map.forEach(function(value, key) {
|
|
3359
|
+
result[++index] = [key, value];
|
|
3360
|
+
});
|
|
3361
|
+
return result;
|
|
3362
|
+
}
|
|
3363
|
+
function overArg(func, transform) {
|
|
3364
|
+
return function(arg) {
|
|
3365
|
+
return func(transform(arg));
|
|
3366
|
+
};
|
|
3367
|
+
}
|
|
3368
|
+
function setToArray(set) {
|
|
3369
|
+
var index = -1, result = Array(set.size);
|
|
3370
|
+
set.forEach(function(value) {
|
|
3371
|
+
result[++index] = value;
|
|
3372
|
+
});
|
|
3373
|
+
return result;
|
|
3374
|
+
}
|
|
3375
|
+
var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
|
|
3376
|
+
var coreJsData = root["__core-js_shared__"];
|
|
3377
|
+
var maskSrcKey = function() {
|
|
3378
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
3379
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
|
3380
|
+
}();
|
|
3381
|
+
var funcToString = funcProto.toString;
|
|
3382
|
+
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
3383
|
+
var objectToString = objectProto.toString;
|
|
3384
|
+
var reIsNative = RegExp(
|
|
3385
|
+
"^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
3386
|
+
);
|
|
3387
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0, Symbol2 = root.Symbol, Uint8Array2 = root.Uint8Array, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice;
|
|
3388
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0, nativeKeys = overArg(Object.keys, Object);
|
|
3389
|
+
var DataView = getNative(root, "DataView"), Map2 = getNative(root, "Map"), Promise2 = getNative(root, "Promise"), Set = getNative(root, "Set"), WeakMap = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create");
|
|
3390
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
|
|
3391
|
+
var symbolProto = Symbol2 ? Symbol2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
3392
|
+
function Hash(entries) {
|
|
3393
|
+
var index = -1, length = entries ? entries.length : 0;
|
|
3394
|
+
this.clear();
|
|
3395
|
+
while (++index < length) {
|
|
3396
|
+
var entry = entries[index];
|
|
3397
|
+
this.set(entry[0], entry[1]);
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
function hashClear() {
|
|
3401
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
3402
|
+
}
|
|
3403
|
+
function hashDelete(key) {
|
|
3404
|
+
return this.has(key) && delete this.__data__[key];
|
|
3405
|
+
}
|
|
3406
|
+
function hashGet(key) {
|
|
3407
|
+
var data = this.__data__;
|
|
3408
|
+
if (nativeCreate) {
|
|
3409
|
+
var result = data[key];
|
|
3410
|
+
return result === HASH_UNDEFINED ? void 0 : result;
|
|
3411
|
+
}
|
|
3412
|
+
return hasOwnProperty2.call(data, key) ? data[key] : void 0;
|
|
3413
|
+
}
|
|
3414
|
+
function hashHas(key) {
|
|
3415
|
+
var data = this.__data__;
|
|
3416
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty2.call(data, key);
|
|
3417
|
+
}
|
|
3418
|
+
function hashSet(key, value) {
|
|
3419
|
+
var data = this.__data__;
|
|
3420
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
3421
|
+
return this;
|
|
3422
|
+
}
|
|
3423
|
+
Hash.prototype.clear = hashClear;
|
|
3424
|
+
Hash.prototype["delete"] = hashDelete;
|
|
3425
|
+
Hash.prototype.get = hashGet;
|
|
3426
|
+
Hash.prototype.has = hashHas;
|
|
3427
|
+
Hash.prototype.set = hashSet;
|
|
3428
|
+
function ListCache(entries) {
|
|
3429
|
+
var index = -1, length = entries ? entries.length : 0;
|
|
3430
|
+
this.clear();
|
|
3431
|
+
while (++index < length) {
|
|
3432
|
+
var entry = entries[index];
|
|
3433
|
+
this.set(entry[0], entry[1]);
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
function listCacheClear() {
|
|
3437
|
+
this.__data__ = [];
|
|
3438
|
+
}
|
|
3439
|
+
function listCacheDelete(key) {
|
|
3440
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
3441
|
+
if (index < 0) {
|
|
3442
|
+
return false;
|
|
3443
|
+
}
|
|
3444
|
+
var lastIndex = data.length - 1;
|
|
3445
|
+
if (index == lastIndex) {
|
|
3446
|
+
data.pop();
|
|
3447
|
+
} else {
|
|
3448
|
+
splice.call(data, index, 1);
|
|
3449
|
+
}
|
|
3450
|
+
return true;
|
|
3451
|
+
}
|
|
3452
|
+
function listCacheGet(key) {
|
|
3453
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
3454
|
+
return index < 0 ? void 0 : data[index][1];
|
|
3455
|
+
}
|
|
3456
|
+
function listCacheHas(key) {
|
|
3457
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
3458
|
+
}
|
|
3459
|
+
function listCacheSet(key, value) {
|
|
3460
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
3461
|
+
if (index < 0) {
|
|
3462
|
+
data.push([key, value]);
|
|
3463
|
+
} else {
|
|
3464
|
+
data[index][1] = value;
|
|
3465
|
+
}
|
|
3466
|
+
return this;
|
|
3467
|
+
}
|
|
3468
|
+
ListCache.prototype.clear = listCacheClear;
|
|
3469
|
+
ListCache.prototype["delete"] = listCacheDelete;
|
|
3470
|
+
ListCache.prototype.get = listCacheGet;
|
|
3471
|
+
ListCache.prototype.has = listCacheHas;
|
|
3472
|
+
ListCache.prototype.set = listCacheSet;
|
|
3473
|
+
function MapCache(entries) {
|
|
3474
|
+
var index = -1, length = entries ? entries.length : 0;
|
|
3475
|
+
this.clear();
|
|
3476
|
+
while (++index < length) {
|
|
3477
|
+
var entry = entries[index];
|
|
3478
|
+
this.set(entry[0], entry[1]);
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
function mapCacheClear() {
|
|
3482
|
+
this.__data__ = {
|
|
3483
|
+
"hash": new Hash(),
|
|
3484
|
+
"map": new (Map2 || ListCache)(),
|
|
3485
|
+
"string": new Hash()
|
|
3486
|
+
};
|
|
3487
|
+
}
|
|
3488
|
+
function mapCacheDelete(key) {
|
|
3489
|
+
return getMapData(this, key)["delete"](key);
|
|
3490
|
+
}
|
|
3491
|
+
function mapCacheGet(key) {
|
|
3492
|
+
return getMapData(this, key).get(key);
|
|
3493
|
+
}
|
|
3494
|
+
function mapCacheHas(key) {
|
|
3495
|
+
return getMapData(this, key).has(key);
|
|
3496
|
+
}
|
|
3497
|
+
function mapCacheSet(key, value) {
|
|
3498
|
+
getMapData(this, key).set(key, value);
|
|
3499
|
+
return this;
|
|
3500
|
+
}
|
|
3501
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
3502
|
+
MapCache.prototype["delete"] = mapCacheDelete;
|
|
3503
|
+
MapCache.prototype.get = mapCacheGet;
|
|
3504
|
+
MapCache.prototype.has = mapCacheHas;
|
|
3505
|
+
MapCache.prototype.set = mapCacheSet;
|
|
3506
|
+
function Stack(entries) {
|
|
3507
|
+
this.__data__ = new ListCache(entries);
|
|
3508
|
+
}
|
|
3509
|
+
function stackClear() {
|
|
3510
|
+
this.__data__ = new ListCache();
|
|
3511
|
+
}
|
|
3512
|
+
function stackDelete(key) {
|
|
3513
|
+
return this.__data__["delete"](key);
|
|
3514
|
+
}
|
|
3515
|
+
function stackGet(key) {
|
|
3516
|
+
return this.__data__.get(key);
|
|
3517
|
+
}
|
|
3518
|
+
function stackHas(key) {
|
|
3519
|
+
return this.__data__.has(key);
|
|
3520
|
+
}
|
|
3521
|
+
function stackSet(key, value) {
|
|
3522
|
+
var cache = this.__data__;
|
|
3523
|
+
if (cache instanceof ListCache) {
|
|
3524
|
+
var pairs = cache.__data__;
|
|
3525
|
+
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
3526
|
+
pairs.push([key, value]);
|
|
3527
|
+
return this;
|
|
3528
|
+
}
|
|
3529
|
+
cache = this.__data__ = new MapCache(pairs);
|
|
3530
|
+
}
|
|
3531
|
+
cache.set(key, value);
|
|
3532
|
+
return this;
|
|
3533
|
+
}
|
|
3534
|
+
Stack.prototype.clear = stackClear;
|
|
3535
|
+
Stack.prototype["delete"] = stackDelete;
|
|
3536
|
+
Stack.prototype.get = stackGet;
|
|
3537
|
+
Stack.prototype.has = stackHas;
|
|
3538
|
+
Stack.prototype.set = stackSet;
|
|
3539
|
+
function arrayLikeKeys(value, inherited) {
|
|
3540
|
+
var result = isArray2(value) || isArguments(value) ? baseTimes(value.length, String) : [];
|
|
3541
|
+
var length = result.length, skipIndexes = !!length;
|
|
3542
|
+
for (var key in value) {
|
|
3543
|
+
if (hasOwnProperty2.call(value, key) && !(skipIndexes && (key == "length" || isIndex(key, length)))) {
|
|
3544
|
+
result.push(key);
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
return result;
|
|
3548
|
+
}
|
|
3549
|
+
function assignValue(object, key, value) {
|
|
3550
|
+
var objValue = object[key];
|
|
3551
|
+
if (!(hasOwnProperty2.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
3552
|
+
object[key] = value;
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
function assocIndexOf(array, key) {
|
|
3556
|
+
var length = array.length;
|
|
3557
|
+
while (length--) {
|
|
3558
|
+
if (eq(array[length][0], key)) {
|
|
3559
|
+
return length;
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
return -1;
|
|
3563
|
+
}
|
|
3564
|
+
function baseAssign(object, source) {
|
|
3565
|
+
return object && copyObject(source, keys(source), object);
|
|
3566
|
+
}
|
|
3567
|
+
function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
|
|
3568
|
+
var result;
|
|
3569
|
+
if (customizer) {
|
|
3570
|
+
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
3571
|
+
}
|
|
3572
|
+
if (result !== void 0) {
|
|
3573
|
+
return result;
|
|
3574
|
+
}
|
|
3575
|
+
if (!isObject2(value)) {
|
|
3576
|
+
return value;
|
|
3577
|
+
}
|
|
3578
|
+
var isArr = isArray2(value);
|
|
3579
|
+
if (isArr) {
|
|
3580
|
+
result = initCloneArray(value);
|
|
3581
|
+
if (!isDeep) {
|
|
3582
|
+
return copyArray(value, result);
|
|
3583
|
+
}
|
|
3584
|
+
} else {
|
|
3585
|
+
var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
|
|
3586
|
+
if (isBuffer2(value)) {
|
|
3587
|
+
return cloneBuffer(value, isDeep);
|
|
3588
|
+
}
|
|
3589
|
+
if (tag == objectTag || tag == argsTag || isFunc && !object) {
|
|
3590
|
+
if (isHostObject(value)) {
|
|
3591
|
+
return object ? value : {};
|
|
3592
|
+
}
|
|
3593
|
+
result = initCloneObject(isFunc ? {} : value);
|
|
3594
|
+
if (!isDeep) {
|
|
3595
|
+
return copySymbols(value, baseAssign(result, value));
|
|
3596
|
+
}
|
|
3597
|
+
} else {
|
|
3598
|
+
if (!cloneableTags[tag]) {
|
|
3599
|
+
return object ? value : {};
|
|
3600
|
+
}
|
|
3601
|
+
result = initCloneByTag(value, tag, baseClone, isDeep);
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
stack || (stack = new Stack());
|
|
3605
|
+
var stacked = stack.get(value);
|
|
3606
|
+
if (stacked) {
|
|
3607
|
+
return stacked;
|
|
3608
|
+
}
|
|
3609
|
+
stack.set(value, result);
|
|
3610
|
+
if (!isArr) {
|
|
3611
|
+
var props = isFull ? getAllKeys(value) : keys(value);
|
|
3612
|
+
}
|
|
3613
|
+
arrayEach(props || value, function(subValue, key2) {
|
|
3614
|
+
if (props) {
|
|
3615
|
+
key2 = subValue;
|
|
3616
|
+
subValue = value[key2];
|
|
3617
|
+
}
|
|
3618
|
+
assignValue(result, key2, baseClone(subValue, isDeep, isFull, customizer, key2, value, stack));
|
|
3619
|
+
});
|
|
3620
|
+
return result;
|
|
3621
|
+
}
|
|
3622
|
+
function baseCreate(proto) {
|
|
3623
|
+
return isObject2(proto) ? objectCreate(proto) : {};
|
|
3624
|
+
}
|
|
3625
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
3626
|
+
var result = keysFunc(object);
|
|
3627
|
+
return isArray2(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
3628
|
+
}
|
|
3629
|
+
function baseGetTag(value) {
|
|
3630
|
+
return objectToString.call(value);
|
|
3631
|
+
}
|
|
3632
|
+
function baseIsNative(value) {
|
|
3633
|
+
if (!isObject2(value) || isMasked(value)) {
|
|
3634
|
+
return false;
|
|
3635
|
+
}
|
|
3636
|
+
var pattern = isFunction2(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
|
|
3637
|
+
return pattern.test(toSource(value));
|
|
3638
|
+
}
|
|
3639
|
+
function baseKeys(object) {
|
|
3640
|
+
if (!isPrototype(object)) {
|
|
3641
|
+
return nativeKeys(object);
|
|
3642
|
+
}
|
|
3643
|
+
var result = [];
|
|
3644
|
+
for (var key in Object(object)) {
|
|
3645
|
+
if (hasOwnProperty2.call(object, key) && key != "constructor") {
|
|
3646
|
+
result.push(key);
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
return result;
|
|
3650
|
+
}
|
|
3651
|
+
function cloneBuffer(buffer, isDeep) {
|
|
3652
|
+
if (isDeep) {
|
|
3653
|
+
return buffer.slice();
|
|
3654
|
+
}
|
|
3655
|
+
var result = new buffer.constructor(buffer.length);
|
|
3656
|
+
buffer.copy(result);
|
|
3657
|
+
return result;
|
|
3658
|
+
}
|
|
3659
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
3660
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
3661
|
+
new Uint8Array2(result).set(new Uint8Array2(arrayBuffer));
|
|
3662
|
+
return result;
|
|
3663
|
+
}
|
|
3664
|
+
function cloneDataView(dataView, isDeep) {
|
|
3665
|
+
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
3666
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
3667
|
+
}
|
|
3668
|
+
function cloneMap(map, isDeep, cloneFunc) {
|
|
3669
|
+
var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
|
|
3670
|
+
return arrayReduce(array, addMapEntry, new map.constructor());
|
|
3671
|
+
}
|
|
3672
|
+
function cloneRegExp(regexp) {
|
|
3673
|
+
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
3674
|
+
result.lastIndex = regexp.lastIndex;
|
|
3675
|
+
return result;
|
|
3676
|
+
}
|
|
3677
|
+
function cloneSet(set, isDeep, cloneFunc) {
|
|
3678
|
+
var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
|
|
3679
|
+
return arrayReduce(array, addSetEntry, new set.constructor());
|
|
3680
|
+
}
|
|
3681
|
+
function cloneSymbol(symbol) {
|
|
3682
|
+
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
3683
|
+
}
|
|
3684
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
3685
|
+
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
3686
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
3687
|
+
}
|
|
3688
|
+
function copyArray(source, array) {
|
|
3689
|
+
var index = -1, length = source.length;
|
|
3690
|
+
array || (array = Array(length));
|
|
3691
|
+
while (++index < length) {
|
|
3692
|
+
array[index] = source[index];
|
|
3693
|
+
}
|
|
3694
|
+
return array;
|
|
3695
|
+
}
|
|
3696
|
+
function copyObject(source, props, object, customizer) {
|
|
3697
|
+
object || (object = {});
|
|
3698
|
+
var index = -1, length = props.length;
|
|
3699
|
+
while (++index < length) {
|
|
3700
|
+
var key = props[index];
|
|
3701
|
+
var newValue = void 0;
|
|
3702
|
+
assignValue(object, key, newValue === void 0 ? source[key] : newValue);
|
|
3703
|
+
}
|
|
3704
|
+
return object;
|
|
3705
|
+
}
|
|
3706
|
+
function copySymbols(source, object) {
|
|
3707
|
+
return copyObject(source, getSymbols(source), object);
|
|
3708
|
+
}
|
|
3709
|
+
function getAllKeys(object) {
|
|
3710
|
+
return baseGetAllKeys(object, keys, getSymbols);
|
|
3711
|
+
}
|
|
3712
|
+
function getMapData(map, key) {
|
|
3713
|
+
var data = map.__data__;
|
|
3714
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
3715
|
+
}
|
|
3716
|
+
function getNative(object, key) {
|
|
3717
|
+
var value = getValue(object, key);
|
|
3718
|
+
return baseIsNative(value) ? value : void 0;
|
|
3719
|
+
}
|
|
3720
|
+
var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
|
|
3721
|
+
var getTag = baseGetTag;
|
|
3722
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
3723
|
+
getTag = function(value) {
|
|
3724
|
+
var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : void 0;
|
|
3725
|
+
if (ctorString) {
|
|
3726
|
+
switch (ctorString) {
|
|
3727
|
+
case dataViewCtorString:
|
|
3728
|
+
return dataViewTag;
|
|
3729
|
+
case mapCtorString:
|
|
3730
|
+
return mapTag;
|
|
3731
|
+
case promiseCtorString:
|
|
3732
|
+
return promiseTag;
|
|
3733
|
+
case setCtorString:
|
|
3734
|
+
return setTag;
|
|
3735
|
+
case weakMapCtorString:
|
|
3736
|
+
return weakMapTag;
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
return result;
|
|
3740
|
+
};
|
|
3741
|
+
}
|
|
3742
|
+
function initCloneArray(array) {
|
|
3743
|
+
var length = array.length, result = array.constructor(length);
|
|
3744
|
+
if (length && typeof array[0] == "string" && hasOwnProperty2.call(array, "index")) {
|
|
3745
|
+
result.index = array.index;
|
|
3746
|
+
result.input = array.input;
|
|
3747
|
+
}
|
|
3748
|
+
return result;
|
|
3749
|
+
}
|
|
3750
|
+
function initCloneObject(object) {
|
|
3751
|
+
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
|
3752
|
+
}
|
|
3753
|
+
function initCloneByTag(object, tag, cloneFunc, isDeep) {
|
|
3754
|
+
var Ctor = object.constructor;
|
|
3755
|
+
switch (tag) {
|
|
3756
|
+
case arrayBufferTag:
|
|
3757
|
+
return cloneArrayBuffer(object);
|
|
3758
|
+
case boolTag:
|
|
3759
|
+
case dateTag:
|
|
3760
|
+
return new Ctor(+object);
|
|
3761
|
+
case dataViewTag:
|
|
3762
|
+
return cloneDataView(object, isDeep);
|
|
3763
|
+
case float32Tag:
|
|
3764
|
+
case float64Tag:
|
|
3765
|
+
case int8Tag:
|
|
3766
|
+
case int16Tag:
|
|
3767
|
+
case int32Tag:
|
|
3768
|
+
case uint8Tag:
|
|
3769
|
+
case uint8ClampedTag:
|
|
3770
|
+
case uint16Tag:
|
|
3771
|
+
case uint32Tag:
|
|
3772
|
+
return cloneTypedArray(object, isDeep);
|
|
3773
|
+
case mapTag:
|
|
3774
|
+
return cloneMap(object, isDeep, cloneFunc);
|
|
3775
|
+
case numberTag:
|
|
3776
|
+
case stringTag:
|
|
3777
|
+
return new Ctor(object);
|
|
3778
|
+
case regexpTag:
|
|
3779
|
+
return cloneRegExp(object);
|
|
3780
|
+
case setTag:
|
|
3781
|
+
return cloneSet(object, isDeep, cloneFunc);
|
|
3782
|
+
case symbolTag:
|
|
3783
|
+
return cloneSymbol(object);
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
function isIndex(value, length) {
|
|
3787
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
3788
|
+
return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
3789
|
+
}
|
|
3790
|
+
function isKeyable(value) {
|
|
3791
|
+
var type = typeof value;
|
|
3792
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
3793
|
+
}
|
|
3794
|
+
function isMasked(func) {
|
|
3795
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
3796
|
+
}
|
|
3797
|
+
function isPrototype(value) {
|
|
3798
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
3799
|
+
return value === proto;
|
|
3800
|
+
}
|
|
3801
|
+
function toSource(func) {
|
|
3802
|
+
if (func != null) {
|
|
3803
|
+
try {
|
|
3804
|
+
return funcToString.call(func);
|
|
3805
|
+
} catch (e) {
|
|
3806
|
+
}
|
|
3807
|
+
try {
|
|
3808
|
+
return func + "";
|
|
3809
|
+
} catch (e) {
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
return "";
|
|
3813
|
+
}
|
|
3814
|
+
function cloneDeep2(value) {
|
|
3815
|
+
return baseClone(value, true, true);
|
|
3816
|
+
}
|
|
3817
|
+
function eq(value, other) {
|
|
3818
|
+
return value === other || value !== value && other !== other;
|
|
3819
|
+
}
|
|
3820
|
+
function isArguments(value) {
|
|
3821
|
+
return isArrayLikeObject(value) && hasOwnProperty2.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
3822
|
+
}
|
|
3823
|
+
var isArray2 = Array.isArray;
|
|
3824
|
+
function isArrayLike(value) {
|
|
3825
|
+
return value != null && isLength(value.length) && !isFunction2(value);
|
|
3826
|
+
}
|
|
3827
|
+
function isArrayLikeObject(value) {
|
|
3828
|
+
return isObjectLike(value) && isArrayLike(value);
|
|
3829
|
+
}
|
|
3830
|
+
var isBuffer2 = nativeIsBuffer || stubFalse;
|
|
3831
|
+
function isFunction2(value) {
|
|
3832
|
+
var tag = isObject2(value) ? objectToString.call(value) : "";
|
|
3833
|
+
return tag == funcTag || tag == genTag;
|
|
3834
|
+
}
|
|
3835
|
+
function isLength(value) {
|
|
3836
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
3837
|
+
}
|
|
3838
|
+
function isObject2(value) {
|
|
3839
|
+
var type = typeof value;
|
|
3840
|
+
return !!value && (type == "object" || type == "function");
|
|
3841
|
+
}
|
|
3842
|
+
function isObjectLike(value) {
|
|
3843
|
+
return !!value && typeof value == "object";
|
|
3844
|
+
}
|
|
3845
|
+
function keys(object) {
|
|
3846
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
3847
|
+
}
|
|
3848
|
+
function stubArray() {
|
|
3849
|
+
return [];
|
|
3850
|
+
}
|
|
3851
|
+
function stubFalse() {
|
|
3852
|
+
return false;
|
|
3853
|
+
}
|
|
3854
|
+
module2.exports = cloneDeep2;
|
|
3855
|
+
})(lodash_clonedeep, lodash_clonedeep.exports);
|
|
3856
|
+
return lodash_clonedeep.exports;
|
|
3857
|
+
}
|
|
3858
|
+
var lodash_clonedeepExports = requireLodash_clonedeep();
|
|
3859
|
+
const cloneDeep = /* @__PURE__ */ getDefaultExportFromCjs(lodash_clonedeepExports);
|
|
3860
|
+
const useContent = () => {
|
|
3861
|
+
const { request } = useApi();
|
|
3862
|
+
const { fileUrl } = useHelper();
|
|
3863
|
+
const props = useProps();
|
|
3864
|
+
const page = react.usePage();
|
|
3865
|
+
const pageData = React.useMemo(
|
|
3866
|
+
() => props.pageData,
|
|
3867
|
+
[props.pageData]
|
|
3868
|
+
);
|
|
3869
|
+
const newsArticle = React.useMemo(
|
|
3870
|
+
() => props.article,
|
|
3871
|
+
[props.article]
|
|
3872
|
+
);
|
|
3873
|
+
const newsCategory = React.useMemo(
|
|
3874
|
+
() => props.category,
|
|
3875
|
+
[props.category]
|
|
3876
|
+
);
|
|
3877
|
+
const newsTag = React.useMemo(
|
|
3878
|
+
() => props.tag,
|
|
3879
|
+
[props.tag]
|
|
3880
|
+
);
|
|
3881
|
+
const contentModelItem = React.useMemo(
|
|
3882
|
+
() => props.contentModelItem,
|
|
3883
|
+
[props.contentModelItem]
|
|
3884
|
+
);
|
|
3885
|
+
const getSectionData = React.useCallback(
|
|
3886
|
+
(key) => {
|
|
3887
|
+
if (!key) return null;
|
|
3888
|
+
const keyParts = key.split("__");
|
|
3889
|
+
const slug = keyParts.length ? keyParts[0] : "";
|
|
3890
|
+
const linkId = keyParts.length > 1 ? keyParts[1] : "";
|
|
3891
|
+
return props.pageData?.sections?.find(
|
|
3892
|
+
(section) => section.slug === slug && section.pivot?.linkId === linkId
|
|
3893
|
+
)?.pivot?.data || null;
|
|
3894
|
+
},
|
|
3895
|
+
[props.pageData?.sections]
|
|
3896
|
+
);
|
|
3897
|
+
const getSectionRootData = React.useCallback(
|
|
3898
|
+
(key) => getSectionData(key)?.index,
|
|
3899
|
+
[getSectionData]
|
|
3900
|
+
);
|
|
3901
|
+
const getSectionSettings = React.useCallback(
|
|
3902
|
+
(key) => {
|
|
3903
|
+
if (!key) return null;
|
|
3904
|
+
const keyParts = key.split("__");
|
|
3905
|
+
const slug = keyParts.length ? keyParts[0] : "";
|
|
3906
|
+
const linkId = keyParts.length > 1 ? keyParts[1] : "";
|
|
3907
|
+
return props.pageData?.sections?.find(
|
|
3908
|
+
(section) => section.slug === slug && section.pivot?.linkId === linkId
|
|
3909
|
+
)?.pivot?.settings || null;
|
|
3910
|
+
},
|
|
3911
|
+
[props.pageData?.sections]
|
|
3912
|
+
);
|
|
3913
|
+
const getSectionSettingsGroup = React.useCallback(
|
|
3914
|
+
(key, group) => {
|
|
3915
|
+
const settings = getSectionSettings(key);
|
|
3916
|
+
return settings?.[group];
|
|
3917
|
+
},
|
|
3918
|
+
[getSectionSettings]
|
|
3919
|
+
);
|
|
3920
|
+
const getSectionSetting = React.useCallback(
|
|
3921
|
+
(key, group, name) => {
|
|
3922
|
+
const settings = getSectionSettingsGroup(key, group);
|
|
3923
|
+
return settings?.[name];
|
|
3924
|
+
},
|
|
3925
|
+
[getSectionSettingsGroup]
|
|
3926
|
+
);
|
|
3927
|
+
const getAnySectionData = React.useCallback(
|
|
3928
|
+
async (sectionSlug, pageSlug, linkId = "default") => {
|
|
3929
|
+
const task = await request({
|
|
3930
|
+
url: `section-data/${sectionSlug}/source/${pageSlug}/link/${linkId}`
|
|
3931
|
+
});
|
|
3932
|
+
if (task.success && task.result) {
|
|
3933
|
+
return task.result.data;
|
|
3934
|
+
}
|
|
3935
|
+
return null;
|
|
3936
|
+
},
|
|
3937
|
+
[request]
|
|
3938
|
+
);
|
|
3939
|
+
const getContentModel = React.useCallback(
|
|
3940
|
+
(name) => {
|
|
3941
|
+
return props?.contentModels?.find(
|
|
3942
|
+
(contentModel) => contentModel.name === name
|
|
3943
|
+
);
|
|
3944
|
+
},
|
|
3945
|
+
[props?.contentModels]
|
|
3946
|
+
);
|
|
3947
|
+
const formatContentModelItemData = React.useCallback(
|
|
3948
|
+
(item) => {
|
|
3949
|
+
const { index: _, ...rest } = item.contentModelData;
|
|
3950
|
+
return {
|
|
3951
|
+
...item,
|
|
3952
|
+
data: {
|
|
3953
|
+
...item.contentModelData?.index,
|
|
3954
|
+
...rest
|
|
3955
|
+
}
|
|
3956
|
+
};
|
|
3957
|
+
},
|
|
3958
|
+
[]
|
|
3959
|
+
);
|
|
3960
|
+
const getContentModelItems = React.useCallback(
|
|
3961
|
+
async (name, filterByIsActive = true) => {
|
|
3962
|
+
const task = await request({
|
|
3963
|
+
url: `content-model/items?contentModelName=${name}${filterByIsActive ? "&isActive=true" : ""}`
|
|
3964
|
+
});
|
|
3965
|
+
if (task.success && task.result) {
|
|
3966
|
+
return (task.result.data || []).map(
|
|
3967
|
+
(item) => formatContentModelItemData(item)
|
|
3968
|
+
);
|
|
3969
|
+
}
|
|
3970
|
+
return [];
|
|
3971
|
+
},
|
|
3972
|
+
[request, formatContentModelItemData]
|
|
3973
|
+
);
|
|
3974
|
+
const getPaginatedContentModelItems = React.useCallback(
|
|
3975
|
+
async (name, page2, pageSize, filterByIsActive = true, query, dataFilters) => {
|
|
3976
|
+
const params = new URLSearchParams({
|
|
3977
|
+
page: String(page2),
|
|
3978
|
+
pageSize: String(pageSize),
|
|
3979
|
+
contentModelName: name
|
|
3980
|
+
});
|
|
3981
|
+
if (filterByIsActive) params.append("isActive", "true");
|
|
3982
|
+
if (query) params.append("query", query);
|
|
3983
|
+
if (dataFilters?.length) {
|
|
3984
|
+
dataFilters.forEach((filter2, index) => {
|
|
3985
|
+
params.append(`dataFilters[${index}][key]`, filter2.key);
|
|
3986
|
+
params.append(`dataFilters[${index}][value]`, filter2.value);
|
|
3987
|
+
if (filter2.operator) {
|
|
3988
|
+
params.append(`dataFilters[${index}][operator]`, filter2.operator);
|
|
3989
|
+
}
|
|
3990
|
+
});
|
|
3991
|
+
}
|
|
3992
|
+
const task = await request({
|
|
3993
|
+
url: `content-model/items?${params.toString()}`
|
|
3994
|
+
});
|
|
3995
|
+
if (task.success && task.result) {
|
|
3996
|
+
const items = (task.result.data?.items || []).map(
|
|
3997
|
+
(item) => formatContentModelItemData(item)
|
|
3998
|
+
);
|
|
3999
|
+
const total = task.result.data?.meta?.total || 0;
|
|
4000
|
+
const currentPage = task.result.data?.meta?.currentPage || 1;
|
|
4001
|
+
return { items, total, currentPage };
|
|
4002
|
+
}
|
|
4003
|
+
return { items: [], total: 0, currentPage: 1 };
|
|
4004
|
+
},
|
|
4005
|
+
[request, formatContentModelItemData]
|
|
4006
|
+
);
|
|
4007
|
+
const submitUserContentModelItem = React.useCallback(
|
|
4008
|
+
async (title, contentModelId, singletonsData = {}, collectionsData = {}, successCallback, errorCallback) => {
|
|
4009
|
+
const task = await request({
|
|
4010
|
+
url: `/content-model/user-items`,
|
|
4011
|
+
method: "post",
|
|
4012
|
+
data: {
|
|
4013
|
+
title,
|
|
4014
|
+
contentModelId,
|
|
4015
|
+
contentModelData: {
|
|
4016
|
+
index: { ...singletonsData },
|
|
4017
|
+
...collectionsData
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
});
|
|
4021
|
+
if (task.failure && task.error) {
|
|
4022
|
+
if (errorCallback) errorCallback(task.error?.response?.data);
|
|
4023
|
+
} else {
|
|
4024
|
+
if (successCallback) successCallback();
|
|
4025
|
+
}
|
|
4026
|
+
return task;
|
|
4027
|
+
},
|
|
4028
|
+
[request]
|
|
4029
|
+
);
|
|
4030
|
+
const getContentPath = React.useCallback(
|
|
4031
|
+
(name, item) => {
|
|
4032
|
+
const permalinks = props?.permalinks || [];
|
|
4033
|
+
switch (name) {
|
|
4034
|
+
case "news-article":
|
|
4035
|
+
case "news-category":
|
|
4036
|
+
case "news-tag": {
|
|
4037
|
+
const permalink = permalinks?.find((p) => p.contentType === name);
|
|
4038
|
+
if (!permalink) {
|
|
4039
|
+
return "";
|
|
4040
|
+
}
|
|
4041
|
+
return `${permalink.pathPrefix}/${permalink.contentParam ? item[permalink.contentParam] : item.id}`;
|
|
4042
|
+
}
|
|
4043
|
+
default: {
|
|
4044
|
+
const permalink = permalinks?.find(
|
|
4045
|
+
(p) => p.content?.name === name
|
|
4046
|
+
);
|
|
4047
|
+
if (!permalink) {
|
|
4048
|
+
return "";
|
|
4049
|
+
}
|
|
4050
|
+
return `${permalink.pathPrefix}/${permalink.contentParam ? permalink.contentParam == "id" ? item.id : item?.data[permalink.contentParam] : item.id}`;
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
},
|
|
4054
|
+
[props?.permalinks]
|
|
4055
|
+
);
|
|
4056
|
+
const getMenu = React.useCallback(
|
|
4057
|
+
(name, filterByIsActive = true) => {
|
|
4058
|
+
const menu = cloneDeep(props?.menus?.find((menu2) => menu2.name === name));
|
|
4059
|
+
if (menu) {
|
|
4060
|
+
menu.items = cloneDeep(
|
|
4061
|
+
menu.items?.filter((item) => !filterByIsActive || item.isActive)?.sort((a, b) => a.position - b.position)
|
|
4062
|
+
);
|
|
4063
|
+
}
|
|
4064
|
+
return menu;
|
|
4065
|
+
},
|
|
4066
|
+
[props?.menus]
|
|
4067
|
+
);
|
|
4068
|
+
const getMenuByLocation = React.useCallback(
|
|
4069
|
+
(name, filterByIsActive = true) => {
|
|
4070
|
+
const menu = cloneDeep(
|
|
4071
|
+
props?.menus?.find((menu2) => menu2.location?.name === name)
|
|
4072
|
+
);
|
|
4073
|
+
if (menu) {
|
|
4074
|
+
menu.items = cloneDeep(
|
|
4075
|
+
menu.items?.filter((item) => !filterByIsActive || item.isActive)?.sort((a, b) => a.position - b.position)
|
|
4076
|
+
);
|
|
4077
|
+
}
|
|
4078
|
+
return menu;
|
|
4079
|
+
},
|
|
4080
|
+
[props?.menus]
|
|
4081
|
+
);
|
|
4082
|
+
const getMenuItems = React.useCallback(
|
|
4083
|
+
(name, filterByIsVisible = true) => {
|
|
4084
|
+
return getMenu(name)?.items?.filter((item) => !filterByIsVisible || item.isVisible)?.sort((a, b) => a.position - b.position);
|
|
4085
|
+
},
|
|
4086
|
+
[getMenu]
|
|
4087
|
+
);
|
|
4088
|
+
const getMenuItemById = React.useCallback(
|
|
4089
|
+
(id) => {
|
|
4090
|
+
const menuItems = [];
|
|
4091
|
+
const menus = props?.menus || [];
|
|
4092
|
+
menus.forEach((menu) => {
|
|
4093
|
+
if (Array.isArray(menu.items)) menuItems.push(...menu.items);
|
|
4094
|
+
});
|
|
4095
|
+
return menuItems.find((item) => item.id === id);
|
|
4096
|
+
},
|
|
4097
|
+
[props?.menus]
|
|
4098
|
+
);
|
|
4099
|
+
const getMenuItemsByLocation = React.useCallback(
|
|
4100
|
+
(name, filterByIsVisible = true) => {
|
|
4101
|
+
return getMenuByLocation(name)?.items?.filter((item) => !filterByIsVisible || item.isVisible)?.sort((a, b) => a.position - b.position);
|
|
4102
|
+
},
|
|
4103
|
+
[getMenuByLocation]
|
|
4104
|
+
);
|
|
4105
|
+
const getMenuGroups = React.useCallback(
|
|
4106
|
+
(name, byLocation = false, filterByIsVisible = true) => {
|
|
4107
|
+
const groups = [];
|
|
4108
|
+
const items = byLocation ? getMenuItemsByLocation(name, filterByIsVisible) : getMenuItems(name, filterByIsVisible);
|
|
4109
|
+
if (items) {
|
|
4110
|
+
for (const item of items) {
|
|
4111
|
+
const groupAlreadyExists = groups.find(
|
|
4112
|
+
(group) => group.id === item.menuItemGroupId
|
|
4113
|
+
);
|
|
4114
|
+
if (!groupAlreadyExists) {
|
|
4115
|
+
const group = props?.menuItemGroups?.find(
|
|
4116
|
+
(group2) => group2.id === item.menuItemGroupId
|
|
4117
|
+
);
|
|
4118
|
+
if (group) groups.push(group);
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
return groups;
|
|
4123
|
+
},
|
|
4124
|
+
[getMenuItems, getMenuItemsByLocation, props?.menuItemGroups]
|
|
4125
|
+
);
|
|
4126
|
+
const getMenuItemsByGroup = React.useCallback(
|
|
4127
|
+
(name, groupId, byLocation = false, filterByIsVisible = true) => {
|
|
4128
|
+
const items = byLocation ? getMenuItemsByLocation(name, filterByIsVisible) : getMenuItems(name, filterByIsVisible);
|
|
4129
|
+
return items?.filter((item) => item.menuItemGroupId === groupId);
|
|
4130
|
+
},
|
|
4131
|
+
[getMenuItems, getMenuItemsByLocation]
|
|
4132
|
+
);
|
|
4133
|
+
const getMenuGroupedItems = React.useCallback(
|
|
4134
|
+
(name, byLocation = false, filterByIsVisible = true) => {
|
|
4135
|
+
const groups = getMenuGroups(name, byLocation);
|
|
4136
|
+
return groups.map((group) => ({
|
|
4137
|
+
group,
|
|
4138
|
+
items: getMenuItemsByGroup(
|
|
4139
|
+
name,
|
|
4140
|
+
group.id || 0,
|
|
4141
|
+
byLocation,
|
|
4142
|
+
filterByIsVisible
|
|
4143
|
+
)
|
|
4144
|
+
}));
|
|
4145
|
+
},
|
|
4146
|
+
[getMenuGroups, getMenuItemsByGroup]
|
|
4147
|
+
);
|
|
4148
|
+
const getMenuUngroupedItems = React.useCallback(
|
|
4149
|
+
(name, byLocation = false, filterByIsVisible = true) => {
|
|
4150
|
+
const items = byLocation ? getMenuItemsByLocation(name, filterByIsVisible) : getMenuItems(name, filterByIsVisible);
|
|
4151
|
+
return items?.filter((item) => !item.menuItemGroupId);
|
|
4152
|
+
},
|
|
4153
|
+
[getMenuItems, getMenuItemsByLocation]
|
|
4154
|
+
);
|
|
4155
|
+
const getAppInformationValue = React.useCallback(
|
|
4156
|
+
(key, type = "string") => {
|
|
4157
|
+
const appInformation = props.appInformation;
|
|
4158
|
+
const setting = appInformation.find((s) => s.key === key);
|
|
4159
|
+
let value = "";
|
|
4160
|
+
switch (type) {
|
|
4161
|
+
case "number":
|
|
4162
|
+
value = setting && parseInt(setting.value) && !isNaN(parseInt(setting.value)) ? parseInt(setting.value) : 0;
|
|
4163
|
+
break;
|
|
4164
|
+
case "boolean":
|
|
4165
|
+
value = setting && !isNaN(parseInt(setting.value)) && parseInt(setting.value) > 0;
|
|
4166
|
+
break;
|
|
4167
|
+
case "object":
|
|
4168
|
+
value = setting && setting.value ? JSON.parse(setting.value) : {};
|
|
4169
|
+
break;
|
|
4170
|
+
case "array":
|
|
4171
|
+
value = setting && setting.value ? JSON.parse(setting.value) : [];
|
|
4172
|
+
break;
|
|
4173
|
+
default:
|
|
4174
|
+
value = setting && setting.value ? setting.value : "";
|
|
4175
|
+
break;
|
|
4176
|
+
}
|
|
4177
|
+
return value;
|
|
4178
|
+
},
|
|
4179
|
+
[props.appInformation]
|
|
4180
|
+
);
|
|
4181
|
+
const appPrimaryColor = React.useMemo(() => {
|
|
4182
|
+
const primaryColor = getAppInformationValue(
|
|
4183
|
+
"primaryColor"
|
|
4184
|
+
);
|
|
4185
|
+
return primaryColor || "#005B97";
|
|
4186
|
+
}, [getAppInformationValue]);
|
|
4187
|
+
const appSecondaryColor = React.useMemo(() => {
|
|
4188
|
+
const secondaryColor = getAppInformationValue(
|
|
4189
|
+
"secondaryColor"
|
|
4190
|
+
);
|
|
4191
|
+
return secondaryColor || "#1E9CD7";
|
|
4192
|
+
}, [getAppInformationValue]);
|
|
4193
|
+
const appAccentColor = React.useMemo(() => {
|
|
4194
|
+
const accentColor = getAppInformationValue("accentColor");
|
|
4195
|
+
return accentColor || "#FF6501";
|
|
4196
|
+
}, [getAppInformationValue]);
|
|
4197
|
+
const icon = React.useMemo(() => {
|
|
4198
|
+
const icon2 = getAppInformationValue("icon");
|
|
4199
|
+
return fileUrl(icon2) || "";
|
|
4200
|
+
}, [getAppInformationValue, fileUrl]);
|
|
4201
|
+
const logo = React.useMemo(() => {
|
|
4202
|
+
const logo2 = getAppInformationValue("logo");
|
|
4203
|
+
return fileUrl(logo2) || "";
|
|
4204
|
+
}, [getAppInformationValue, fileUrl]);
|
|
4205
|
+
return {
|
|
4206
|
+
logo,
|
|
4207
|
+
icon,
|
|
4208
|
+
page,
|
|
4209
|
+
pageData,
|
|
4210
|
+
newsArticle,
|
|
4211
|
+
newsCategory,
|
|
4212
|
+
newsTag,
|
|
4213
|
+
contentModelItem,
|
|
4214
|
+
getMenu,
|
|
4215
|
+
getMenuByLocation,
|
|
4216
|
+
getMenuItems,
|
|
4217
|
+
getMenuItemById,
|
|
4218
|
+
getMenuItemsByLocation,
|
|
4219
|
+
getMenuGroups,
|
|
4220
|
+
getMenuItemsByGroup,
|
|
4221
|
+
getMenuGroupedItems,
|
|
4222
|
+
getMenuUngroupedItems,
|
|
4223
|
+
getSectionData,
|
|
4224
|
+
getSectionSettings,
|
|
4225
|
+
getSectionSettingsGroup,
|
|
4226
|
+
getSectionSetting,
|
|
4227
|
+
getAnySectionData,
|
|
4228
|
+
getSectionRootData,
|
|
4229
|
+
getContentPath,
|
|
4230
|
+
getContentModel,
|
|
4231
|
+
getContentModelItems,
|
|
4232
|
+
getPaginatedContentModelItems,
|
|
4233
|
+
getAppInformationValue,
|
|
4234
|
+
submitUserContentModelItem,
|
|
4235
|
+
formatContentModelItemData,
|
|
4236
|
+
appAccentColor,
|
|
4237
|
+
appPrimaryColor,
|
|
4238
|
+
appSecondaryColor
|
|
4239
|
+
};
|
|
4240
|
+
};
|
|
4241
|
+
exports.ConfigContext = ConfigContext;
|
|
4242
|
+
exports.PropsContext = PropsContext;
|
|
4243
|
+
exports.ResolveSectionsContext = ResolveSectionsContext;
|
|
4244
|
+
exports.RouterContext = RouterContext;
|
|
4245
|
+
exports.cloneDeep = cloneDeep;
|
|
4246
|
+
exports.slideToId = slideToId;
|
|
4247
|
+
exports.useApi = useApi;
|
|
4248
|
+
exports.useConfig = useConfig;
|
|
4249
|
+
exports.useContent = useContent;
|
|
4250
|
+
exports.useHelper = useHelper;
|
|
4251
|
+
exports.useProps = useProps;
|