@kookaat/strapi-plugin-tinymce 2.0.1 → 2.0.2

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