@mongoosejs/studio 0.0.1 → 0.0.3

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 (46) hide show
  1. package/backend/actions/Model/deleteDocument.js +31 -0
  2. package/backend/actions/Model/getDocument.js +11 -1
  3. package/backend/actions/Model/getDocuments.js +25 -4
  4. package/backend/actions/Model/index.js +1 -0
  5. package/backend/helpers/removeSpecifiedPaths.js +9 -0
  6. package/frontend/public/images/delete.svg +25 -0
  7. package/frontend/public/images/edit.svg +5 -0
  8. package/frontend/public/images/logo.svg +160 -0
  9. package/frontend/public/images/save.svg +21 -0
  10. package/frontend/public/images/success.png +0 -0
  11. package/frontend/public/index.html +1 -0
  12. package/frontend/public/style.css +38 -1
  13. package/frontend/public/vanillatoasts/vanillatoasts.css +125 -0
  14. package/frontend/src/api.js +6 -2
  15. package/frontend/src/document/document.css +4 -0
  16. package/frontend/src/document/document.html +6 -3
  17. package/frontend/src/document/document.js +25 -1
  18. package/frontend/src/edit-date/edit-date.html +3 -0
  19. package/frontend/src/edit-date/edit-date.js +9 -0
  20. package/frontend/src/edit-number/edit-number.html +3 -0
  21. package/frontend/src/edit-number/edit-number.js +20 -0
  22. package/frontend/src/export-query-results/export-query-results.js +6 -3
  23. package/frontend/src/index.js +3 -0
  24. package/frontend/src/list-default/list-default.css +0 -0
  25. package/frontend/src/list-default/list-default.html +6 -2
  26. package/frontend/src/list-default/list-default.js +30 -1
  27. package/frontend/src/list-string/list-string.css +4 -0
  28. package/frontend/src/list-string/list-string.html +4 -0
  29. package/frontend/src/list-string/list-string.js +43 -0
  30. package/frontend/src/list-subdocument/list-subdocument.html +1 -1
  31. package/frontend/src/list-subdocument/list-subdocument.js +4 -1
  32. package/frontend/src/modal/modal.css +8 -0
  33. package/frontend/src/models/models.css +8 -2
  34. package/frontend/src/models/models.html +11 -2
  35. package/frontend/src/models/models.js +40 -21
  36. package/frontend/src/navbar/navbar.css +3 -3
  37. package/frontend/src/navbar/navbar.html +2 -2
  38. package/mongoose.js +20 -0
  39. package/package.json +9 -7
  40. package/scripts/stratos.js +22 -0
  41. package/stargate.js +26 -0
  42. package/stratos.js +20 -0
  43. package/tv.js +20 -0
  44. package/zevo.js +20 -0
  45. package/frontend/public/app.js +0 -4012
  46. package/test.js +0 -264
@@ -1,4012 +0,0 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ var __webpack_modules__ = ({
4
-
5
- /***/ "./frontend/src/api.js":
6
- /*!*****************************!*\
7
- !*** ./frontend/src/api.js ***!
8
- \*****************************/
9
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
10
-
11
-
12
-
13
- const axios = __webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs");
14
-
15
- const client = axios.create({
16
- baseURL: '/admin/api'
17
- });
18
-
19
- if (false) {} else {
20
- exports.Model = {
21
- exportQueryResults(params) {
22
- const anchor = document.createElement('a');
23
- console.log('K', '/admin/api')
24
- console.log('G', '/admin/api' + '/Model/exportQueryResults?' + (new URLSearchParams(params)).toString());
25
- anchor.href = '/admin/api' + '/Model/exportQueryResults?' + (new URLSearchParams(params)).toString();
26
- anchor.target = '_blank';
27
- anchor.download = 'export.csv';
28
- anchor.click();
29
- return;
30
- },
31
- getDocument: function getDocument(params) {
32
- return client.post('/Model/getDocument', params).then(res => res.data);
33
- },
34
- getDocuments: function getDocuments(params) {
35
- return client.post('/Model/getDocuments', params).then(res => res.data);
36
- },
37
- listModels: function listModels() {
38
- return client.post('/Model/listModels', {}).then(res => res.data);
39
- },
40
- updateDocument: function updateDocument(params) {
41
- return client.post('/Model/updateDocument', params).then(res => res.data);
42
- }
43
- };
44
- }
45
-
46
-
47
- /***/ }),
48
-
49
- /***/ "./frontend/src/appendCSS.js":
50
- /*!***********************************!*\
51
- !*** ./frontend/src/appendCSS.js ***!
52
- \***********************************/
53
- /***/ ((module) => {
54
-
55
-
56
-
57
- module.exports = function appendCSS(css) {
58
- if (typeof document === 'undefined') {
59
- return;
60
- }
61
- const head = document.head || document.getElementsByTagName('head')[0];
62
- const style = document.createElement('style');
63
- head.appendChild(style);
64
- style.appendChild(document.createTextNode(css));
65
- };
66
-
67
- /***/ }),
68
-
69
- /***/ "./frontend/src/async-button/async-button.js":
70
- /*!***************************************************!*\
71
- !*** ./frontend/src/async-button/async-button.js ***!
72
- \***************************************************/
73
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
74
-
75
-
76
-
77
- const template = __webpack_require__(/*! ./async-button.html */ "./frontend/src/async-button/async-button.html");
78
-
79
- module.exports = app => app.component('async-button', {
80
- data: () => ({
81
- status: 'init'
82
- }),
83
- inheritAttrs: false,
84
- methods: {
85
- async handleClick(ev) {
86
- if (this.status === 'in_progress') {
87
- return;
88
- }
89
- this.status = 'in_progress';
90
-
91
- try {
92
- await this.$attrs.onClick(ev);
93
- } catch (err) {
94
- this.status = 'error';
95
- throw err;
96
- }
97
-
98
- this.status = 'success';
99
- }
100
- },
101
- computed: {
102
- attrsToBind() {
103
- const attrs = { ...this.$attrs };
104
- delete attrs.onClick;
105
- delete attrs.disabled;
106
- return attrs;
107
- },
108
- isDisabled() {
109
- return this.status === 'in_progress' || this.$attrs.disabled;
110
- }
111
- },
112
- template: template
113
- });
114
-
115
- /***/ }),
116
-
117
- /***/ "./frontend/src/detail-array/detail-array.js":
118
- /*!***************************************************!*\
119
- !*** ./frontend/src/detail-array/detail-array.js ***!
120
- \***************************************************/
121
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
122
-
123
-
124
-
125
- const template = __webpack_require__(/*! ./detail-array.html */ "./frontend/src/detail-array/detail-array.html");
126
-
127
- module.exports = app => app.component('detail-array', {
128
- template: template,
129
- props: ['value'],
130
- computed: {
131
- displayValue() {
132
- return JSON.stringify(this.value, null, ' ').trim();
133
- }
134
- },
135
- mounted() {
136
- Prism.highlightElement(this.$refs.code);
137
- }
138
- });
139
-
140
- /***/ }),
141
-
142
- /***/ "./frontend/src/detail-default/detail-default.js":
143
- /*!*******************************************************!*\
144
- !*** ./frontend/src/detail-default/detail-default.js ***!
145
- \*******************************************************/
146
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
147
-
148
-
149
-
150
- const template = __webpack_require__(/*! ./detail-default.html */ "./frontend/src/detail-default/detail-default.html");
151
-
152
- module.exports = app => app.component('detail-default', {
153
- template: template,
154
- props: ['value'],
155
- computed: {
156
- displayValue() {
157
- if (this.value === null) {
158
- return 'null';
159
- }
160
- if (this.value === undefined) {
161
- return 'undefined';
162
- }
163
- return this.value;
164
- }
165
- }
166
- });
167
-
168
- /***/ }),
169
-
170
- /***/ "./frontend/src/document/document.js":
171
- /*!*******************************************!*\
172
- !*** ./frontend/src/document/document.js ***!
173
- \*******************************************/
174
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
175
-
176
-
177
-
178
- const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
179
- const template = __webpack_require__(/*! ./document.html */ "./frontend/src/document/document.html");
180
-
181
- const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
182
-
183
- appendCSS(__webpack_require__(/*! ./document.css */ "./frontend/src/document/document.css"));
184
-
185
- module.exports = app => app.component('document', {
186
- template: template,
187
- props: ['model', 'documentId'],
188
- data: () => ({
189
- schemaPaths: [],
190
- status: 'init',
191
- document: null,
192
- changes: {},
193
- editting: false
194
- }),
195
- async mounted() {
196
- const { doc, schemaPaths } = await api.Model.getDocument({ model: this.model, documentId: this.documentId });
197
- this.document = doc;
198
- this.schemaPaths = Object.keys(schemaPaths).sort((k1, k2) => {
199
- if (k1 === '_id' && k2 !== '_id') {
200
- return -1;
201
- }
202
- if (k1 !== '_id' && k2 === '_id') {
203
- return 1;
204
- }
205
- return 0;
206
- }).map(key => schemaPaths[key]);
207
-
208
- this.status = 'loaded';
209
- },
210
- methods: {
211
- getComponentForPath(schemaPath) {
212
- if (schemaPath.instance === 'Array') {
213
- return 'detail-array';
214
- }
215
- return 'detail-default';
216
- },
217
- getEditComponentForPath() {
218
- return 'edit-default';
219
- },
220
- getEditValueForPath({ path }) {
221
- return path in this.changes ? this.changes[path] : this.document[path];
222
- },
223
- cancelEdit() {
224
- this.changes = {};
225
- this.editting = false;
226
- },
227
- async save() {
228
- const { doc } = await api.Model.updateDocument({
229
- model: this.model,
230
- _id: this.document._id,
231
- update: this.changes
232
- });
233
- this.document = doc;
234
- this.changes = {};
235
- this.editting = false;
236
- }
237
- }
238
- });
239
-
240
- /***/ }),
241
-
242
- /***/ "./frontend/src/edit-default/edit-default.js":
243
- /*!***************************************************!*\
244
- !*** ./frontend/src/edit-default/edit-default.js ***!
245
- \***************************************************/
246
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
247
-
248
-
249
-
250
- const template = __webpack_require__(/*! ./edit-default.html */ "./frontend/src/edit-default/edit-default.html");
251
-
252
- module.exports = app => app.component('edit-default', {
253
- template: template,
254
- props: ['value'],
255
- emits: ['input'],
256
- computed: {
257
- displayValue() {
258
- if (this.value === null) {
259
- return 'null';
260
- }
261
- if (this.value === undefined) {
262
- return 'undefined';
263
- }
264
- return this.value;
265
- }
266
- }
267
- });
268
-
269
- /***/ }),
270
-
271
- /***/ "./frontend/src/export-query-results/export-query-results.js":
272
- /*!*******************************************************************!*\
273
- !*** ./frontend/src/export-query-results/export-query-results.js ***!
274
- \*******************************************************************/
275
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
276
-
277
-
278
-
279
- const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
280
- const template = __webpack_require__(/*! ./export-query-results.html */ "./frontend/src/export-query-results/export-query-results.html");
281
-
282
- const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
283
-
284
- appendCSS(__webpack_require__(/*! ./export-query-results.css */ "./frontend/src/export-query-results/export-query-results.css"));
285
-
286
- module.exports = app => app.component('export-query-results', {
287
- template: template,
288
- props: ['schemaPaths', 'filter', 'currentModel'],
289
- emits: ['done'],
290
- data: () => ({
291
- shouldExport: {}
292
- }),
293
- mounted() {
294
- this.shouldExport = {};
295
- for (const { path } of this.schemaPaths) {
296
- this.shouldExport[path] = true;
297
- }
298
- },
299
- methods: {
300
- async exportQueryResults() {
301
- await api.Model.exportQueryResults({
302
- model: this.currentModel,
303
- filter: this.filter,
304
- propertiesToInclude: Object.keys(this.shouldExport).filter(key => this.shouldExport[key])
305
- });
306
-
307
- this.$emit('done');
308
- }
309
- }
310
- });
311
-
312
- /***/ }),
313
-
314
- /***/ "./frontend/src/list-array/list-array.js":
315
- /*!***********************************************!*\
316
- !*** ./frontend/src/list-array/list-array.js ***!
317
- \***********************************************/
318
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
319
-
320
-
321
-
322
- const template = __webpack_require__(/*! ./list-array.html */ "./frontend/src/list-array/list-array.html");
323
-
324
- __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js")(__webpack_require__(/*! ./list-array.css */ "./frontend/src/list-array/list-array.css"));
325
-
326
- module.exports = app => app.component('list-array', {
327
- template: template,
328
- props: ['value'],
329
- computed: {
330
- displayValue() {
331
- return JSON.stringify(this.value, (key, value) => {
332
- if (typeof value === 'string' && value.length > 30) {
333
- return value.slice(0, 27) + '...';
334
- }
335
- return value;
336
- }, ' ').trim();
337
- }
338
- },
339
- mounted() {
340
- Prism.highlightElement(this.$refs.code);
341
- }
342
- });
343
-
344
- /***/ }),
345
-
346
- /***/ "./frontend/src/list-default/list-default.js":
347
- /*!***************************************************!*\
348
- !*** ./frontend/src/list-default/list-default.js ***!
349
- \***************************************************/
350
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
351
-
352
-
353
-
354
- const template = __webpack_require__(/*! ./list-default.html */ "./frontend/src/list-default/list-default.html");
355
-
356
- module.exports = app => app.component('list-default', {
357
- template: template,
358
- props: ['value'],
359
- computed: {
360
- displayValue() {
361
- if (this.value === null) {
362
- return 'null';
363
- }
364
- if (this.value === undefined) {
365
- return 'undefined';
366
- }
367
- return this.value;
368
- }
369
- }
370
- });
371
-
372
- /***/ }),
373
-
374
- /***/ "./frontend/src/list-subdocument/list-subdocument.js":
375
- /*!***********************************************************!*\
376
- !*** ./frontend/src/list-subdocument/list-subdocument.js ***!
377
- \***********************************************************/
378
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
379
-
380
-
381
-
382
- const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
383
- const template = __webpack_require__(/*! ./list-subdocument.html */ "./frontend/src/list-subdocument/list-subdocument.html");
384
-
385
- module.exports = app => app.component('list-subdocument', {
386
- template: template,
387
- props: ['value']
388
- });
389
-
390
- /***/ }),
391
-
392
- /***/ "./frontend/src/modal/modal.js":
393
- /*!*************************************!*\
394
- !*** ./frontend/src/modal/modal.js ***!
395
- \*************************************/
396
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
397
-
398
-
399
-
400
- const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
401
- const template = __webpack_require__(/*! ./modal.html */ "./frontend/src/modal/modal.html");
402
-
403
- appendCSS(__webpack_require__(/*! ./modal.css */ "./frontend/src/modal/modal.css"));
404
-
405
- module.exports = app => app.component('modal', {
406
- template
407
- });
408
-
409
- /***/ }),
410
-
411
- /***/ "./frontend/src/models/models.js":
412
- /*!***************************************!*\
413
- !*** ./frontend/src/models/models.js ***!
414
- \***************************************/
415
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
416
-
417
-
418
-
419
- const api = __webpack_require__(/*! ../api */ "./frontend/src/api.js");
420
- const template = __webpack_require__(/*! ./models.html */ "./frontend/src/models/models.html");
421
-
422
- const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
423
-
424
- appendCSS(__webpack_require__(/*! ./models.css */ "./frontend/src/models/models.css"));
425
-
426
- module.exports = app => app.component('models', {
427
- template: template,
428
- props: ['model'],
429
- data: () => ({
430
- models: [],
431
- currentModel: null,
432
- documents: [],
433
- schemaPaths: [],
434
- status: 'init',
435
- edittingDoc: null,
436
- docEdits: null,
437
- filter: null,
438
- searchText: '',
439
- shouldShowExportModal: false,
440
- shouldExport: {}
441
- }),
442
- created() {
443
- this.currentModel = this.model;
444
- },
445
- async mounted() {
446
- this.models = await api.Model.listModels().then(res => res.models);
447
- if (this.currentModel == null && this.models.length > 0) {
448
- this.currentModel = this.models[0];
449
- }
450
-
451
- if (this.currentModel != null) {
452
- const { docs, schemaPaths } = await api.Model.getDocuments({ model: this.currentModel });
453
- this.documents = docs;
454
- this.schemaPaths = Object.keys(schemaPaths).sort((k1, k2) => {
455
- if (k1 === '_id' && k2 !== '_id') {
456
- return -1;
457
- }
458
- if (k1 !== '_id' && k2 === '_id') {
459
- return 1;
460
- }
461
- return 0;
462
- }).map(key => schemaPaths[key]);
463
-
464
- this.shouldExport = {};
465
- for (const { path } of this.schemaPaths) {
466
- this.shouldExport[path] = true;
467
- }
468
- }
469
-
470
- this.status = 'loaded';
471
- },
472
- methods: {
473
- async search() {
474
- if (this.searchText) {
475
- this.filter = eval(`(${this.searchText})`);
476
- } else {
477
- this.filter = {};
478
- }
479
-
480
- await this.getDocuments();
481
- },
482
- async getDocuments() {
483
- const { docs, schemaPaths } = await api.Model.getDocuments({
484
- model: this.currentModel,
485
- filter: this.filter
486
- });
487
- this.documents = docs;
488
- this.schemaPaths = Object.keys(schemaPaths).sort((k1, k2) => {
489
- if (k1 === '_id' && k2 !== '_id') {
490
- return -1;
491
- }
492
- if (k1 !== '_id' && k2 === '_id') {
493
- return 1;
494
- }
495
- return 0;
496
- }).map(key => schemaPaths[key]);
497
-
498
- this.shouldExport = {};
499
- for (const { path } of this.schemaPaths) {
500
- this.shouldExport[path] = true;
501
- }
502
- },
503
- getComponentForPath(schemaPath) {
504
- if (schemaPath.instance === 'Array') {
505
- return 'list-array';
506
- }
507
- return 'list-default';
508
- },
509
- async saveDocEdits() {
510
- const res = await api.Model.updateDocument({
511
- model: this.currentModel,
512
- _id: this.edittingDoc._id,
513
- update: JSON.parse(this.docEdits)
514
- });
515
-
516
- const index = this.documents.findIndex(doc => doc === this.edittingDoc);
517
- if (index !== -1) {
518
- this.documents[index] = res.doc;
519
- }
520
- this.edittingDoc = null;
521
- }
522
- }
523
- });
524
-
525
- /***/ }),
526
-
527
- /***/ "./frontend/src/navbar/navbar.js":
528
- /*!***************************************!*\
529
- !*** ./frontend/src/navbar/navbar.js ***!
530
- \***************************************/
531
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
532
-
533
-
534
-
535
- const template = __webpack_require__(/*! ./navbar.html */ "./frontend/src/navbar/navbar.html");
536
-
537
- const appendCSS = __webpack_require__(/*! ../appendCSS */ "./frontend/src/appendCSS.js");
538
-
539
- appendCSS(__webpack_require__(/*! ./navbar.css */ "./frontend/src/navbar/navbar.css"));
540
-
541
- module.exports = app => app.component('navbar', {
542
- template: template
543
- });
544
-
545
- /***/ }),
546
-
547
- /***/ "./frontend/src/routes.js":
548
- /*!********************************!*\
549
- !*** ./frontend/src/routes.js ***!
550
- \********************************/
551
- /***/ ((module) => {
552
-
553
-
554
-
555
- module.exports = [
556
- {
557
- path: '/',
558
- name: 'root',
559
- component: 'models'
560
- },
561
- {
562
- path: '/model/:model',
563
- name: 'model',
564
- component: 'models'
565
- },
566
- {
567
- path: '/model/:model/document/:documentId',
568
- name: 'document',
569
- component: 'document'
570
- }
571
- ];
572
-
573
- /***/ }),
574
-
575
- /***/ "./frontend/src/async-button/async-button.html":
576
- /*!*****************************************************!*\
577
- !*** ./frontend/src/async-button/async-button.html ***!
578
- \*****************************************************/
579
- /***/ ((module) => {
580
-
581
- module.exports = "<button v-bind=\"attrsToBind\" :disabled=\"isDisabled\" @click=\"handleClick\">\n <slot></slot>\n</button>";
582
-
583
- /***/ }),
584
-
585
- /***/ "./frontend/src/detail-array/detail-array.html":
586
- /*!*****************************************************!*\
587
- !*** ./frontend/src/detail-array/detail-array.html ***!
588
- \*****************************************************/
589
- /***/ ((module) => {
590
-
591
- module.exports = "<div class=\"detail-array\">\n <pre><code ref=\"code\" class=\"language-javascript\" v-text=\"displayValue\"></code></pre>\n</div>";
592
-
593
- /***/ }),
594
-
595
- /***/ "./frontend/src/detail-default/detail-default.html":
596
- /*!*********************************************************!*\
597
- !*** ./frontend/src/detail-default/detail-default.html ***!
598
- \*********************************************************/
599
- /***/ ((module) => {
600
-
601
- module.exports = "<div>\n {{value}}\n</div>";
602
-
603
- /***/ }),
604
-
605
- /***/ "./frontend/src/document/document.css":
606
- /*!********************************************!*\
607
- !*** ./frontend/src/document/document.css ***!
608
- \********************************************/
609
- /***/ ((module) => {
610
-
611
- module.exports = ".document {\n max-width: 1200px;\n margin-left: auto;\n margin-right: auto;\n padding-top: 25px;\n}\n\n.document .value {\n padding-top: 10px;\n padding-bottom: 10px;\n}\n\n.document .path-key {\n background-color: #f0f0f0;\n padding: 0.25em;\n margin-bottom: 0.5em;\n}\n\n.document .path-type {\n color: rgba(0,0,0,.36);\n font-size: 0.8em;\n}\n\n.document .document-menu {\n display: flex;\n}\n\n.document .document-menu .left {\n flex-grow: 1;\n}\n\n.document .document-menu .right {\n flex-grow: 1;\n text-align: right;\n}\n\n.document .document-menu .right button:not(:last-child) {\n margin-right: 0.5em;\n}";
612
-
613
- /***/ }),
614
-
615
- /***/ "./frontend/src/document/document.html":
616
- /*!*********************************************!*\
617
- !*** ./frontend/src/document/document.html ***!
618
- \*********************************************/
619
- /***/ ((module) => {
620
-
621
- module.exports = "<div class=\"document\">\n <div class=\"document-menu\">\n <div class=\"left\">\n <button @click=\"$router.push('/model/' + this.model)\">\n &lsaquo; Back\n </button>\n </div>\n\n <div class=\"right\">\n <button v-if=\"!editting\" @click=\"editting = true\">\n &#x270E; Edit\n </button>\n <button v-if=\"editting\" class=\"grey\" @click=\"editting = false\">\n &times; Cancel\n </button>\n <button v-if=\"editting\" class=\"green\" @click=\"save\">\n &check; Save\n </button>\n </div>\n </div>\n <div v-if=\"status === 'loaded'\">\n <div v-for=\"path in schemaPaths\" class=\"value\">\n <div class=\"path-key\">\n {{path.path}}\n <span class=\"path-type\">\n ({{path.instance.toLowerCase()}})\n </span>\n </div>\n <div v-if=\"editting && path.path !== '_id'\">\n <component\n :is=\"getEditComponentForPath(path)\"\n :value=\"getEditValueForPath(path)\"\n @input=\"changes[path.path] = $event;\"\n >\n </component>\n </div>\n <div v-else>\n <component :is=\"getComponentForPath(path)\" :value=\"document[path.path]\"></component>\n </div>\n </div>\n </div>\n</div>";
622
-
623
- /***/ }),
624
-
625
- /***/ "./frontend/src/edit-default/edit-default.html":
626
- /*!*****************************************************!*\
627
- !*** ./frontend/src/edit-default/edit-default.html ***!
628
- \*****************************************************/
629
- /***/ ((module) => {
630
-
631
- module.exports = "<div>\n <input type=\"text\" :value=\"value\" @input=\"$emit('input', $event.target.value)\">\n</div>";
632
-
633
- /***/ }),
634
-
635
- /***/ "./frontend/src/export-query-results/export-query-results.css":
636
- /*!********************************************************************!*\
637
- !*** ./frontend/src/export-query-results/export-query-results.css ***!
638
- \********************************************************************/
639
- /***/ ((module) => {
640
-
641
- module.exports = "";
642
-
643
- /***/ }),
644
-
645
- /***/ "./frontend/src/export-query-results/export-query-results.html":
646
- /*!*********************************************************************!*\
647
- !*** ./frontend/src/export-query-results/export-query-results.html ***!
648
- \*********************************************************************/
649
- /***/ ((module) => {
650
-
651
- module.exports = "<div class=\"export-query-results\">\n <h2>Export as CSV</h2>\n <div>\n Choose fields to export\n </div>\n <div v-for=\"schemaPath in schemaPaths\">\n <input type=\"checkbox\" v-model=\"shouldExport[schemaPath.path]\">\n <span>{{schemaPath.path}}</span>\n </div>\n <async-button @click=\"exportQueryResults\">Export</async-button>\n</div>";
652
-
653
- /***/ }),
654
-
655
- /***/ "./frontend/src/list-array/list-array.css":
656
- /*!************************************************!*\
657
- !*** ./frontend/src/list-array/list-array.css ***!
658
- \************************************************/
659
- /***/ ((module) => {
660
-
661
- module.exports = ".list-array pre {\n max-height: 6.5em;\n max-width: 60em;\n}\n\n.list-array pre.maximized {\n max-height: auto;\n}";
662
-
663
- /***/ }),
664
-
665
- /***/ "./frontend/src/list-array/list-array.html":
666
- /*!*************************************************!*\
667
- !*** ./frontend/src/list-array/list-array.html ***!
668
- \*************************************************/
669
- /***/ ((module) => {
670
-
671
- module.exports = "<div class=\"list-array\">\n <pre><code ref=\"code\" class=\"language-javascript\" v-text=\"displayValue\"></code></pre>\n</div>";
672
-
673
- /***/ }),
674
-
675
- /***/ "./frontend/src/list-default/list-default.html":
676
- /*!*****************************************************!*\
677
- !*** ./frontend/src/list-default/list-default.html ***!
678
- \*****************************************************/
679
- /***/ ((module) => {
680
-
681
- module.exports = "<div>\n {{value}}\n</div>";
682
-
683
- /***/ }),
684
-
685
- /***/ "./frontend/src/list-subdocument/list-subdocument.html":
686
- /*!*************************************************************!*\
687
- !*** ./frontend/src/list-subdocument/list-subdocument.html ***!
688
- \*************************************************************/
689
- /***/ ((module) => {
690
-
691
- module.exports = "<div>\n {{JSON.stringify(value, null, ' ')}}\n</div>";
692
-
693
- /***/ }),
694
-
695
- /***/ "./frontend/src/modal/modal.css":
696
- /*!**************************************!*\
697
- !*** ./frontend/src/modal/modal.css ***!
698
- \**************************************/
699
- /***/ ((module) => {
700
-
701
- module.exports = "/** Vue modal */\n\n.modal-mask {\n position: fixed;\n z-index: 9998;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: table;\n transition: opacity 0.3s ease;\n}\n\n.modal-wrapper {\n display: table-cell;\n vertical-align: middle;\n}\n\n.modal-container {\n width: 600px;\n margin: 0px auto;\n padding: 20px 30px;\n padding-bottom: 40px;\n background-color: #fff;\n border-radius: 2px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);\n transition: all 0.3s ease;\n font-family: Helvetica, Arial, sans-serif;\n}\n\n.modal-header {\n margin-top: 0;\n font-size: 18px;\n font-weight: bold\n}\n\n.modal-header-success {\n color: #42b983;\n}\n\n.modal-header-error {\n color: #ff0000;\n}\n\n.modal-body {\n margin: 20px 0;\n}\n\n.modal__button--default {\n float: right;\n}\n\n/*\n * The following styles are auto-applied to elements with\n * transition=\"modal\" when their visibility is toggled\n * by Vue.js.\n *\n * You can easily play with the modal transition by editing\n * these styles.\n */\n\n.modal-enter {\n opacity: 0;\n}\n\n.modal-leave-active {\n opacity: 0;\n}\n\n.modal-enter .modal-container,\n.modal-leave-active .modal-container {\n -webkit-transform: scale(1.1);\n transform: scale(1.1);\n}";
702
-
703
- /***/ }),
704
-
705
- /***/ "./frontend/src/modal/modal.html":
706
- /*!***************************************!*\
707
- !*** ./frontend/src/modal/modal.html ***!
708
- \***************************************/
709
- /***/ ((module) => {
710
-
711
- module.exports = "<transition name=\"modal\">\n <div class=\"modal-mask\">\n <div class=\"modal-wrapper\">\n <div class=\"modal-container\">\n <div class=\"modal-body\">\n <slot name=\"body\">\n </slot>\n </div>\n </div>\n </div>\n </div>\n</transition>";
712
-
713
- /***/ }),
714
-
715
- /***/ "./frontend/src/models/models.css":
716
- /*!****************************************!*\
717
- !*** ./frontend/src/models/models.css ***!
718
- \****************************************/
719
- /***/ ((module) => {
720
-
721
- module.exports = ".models {\n position: relative;\n display: flex;\n flex-direction: row;\n min-height: calc(100% - 56px);\n}\n\n.models .model-selector {\n background-color: #eee;\n flex-grow: 0; \n padding: 15px;\n padding-top: 0px;\n}\n\n.models h1 {\n margin-top: 0px;\n}\n\n.models .documents {\n flex-grow: 1;\n overflow: scroll;\n max-height: calc(100vh - 56px);\n}\n\n.models .documents .documents-container {\n margin-top: 40px;\n}\n\n.models .documents table {\n /* max-width: -moz-fit-content;\n max-width: fit-content; */\n width: 100%;\n table-layout: auto;\n font-size: small;\n padding: 0;\n margin-right: 1em;\n white-space: nowrap;\n z-index: -1;\n border-collapse: collapse;\n line-height: 1.5em;\n}\n\n.models .documents table th {\n position: sticky;\n top: 0px;\n background-color: white;\n}\n\n.models .documents table th:after {\n content: '';\n position: absolute;\n left: 0;\n width: 100%;\n bottom: -1px;\n border-bottom: thin solid rgba(0,0,0,.12);\n}\n\n.models .documents table tr {\n color: black;\n border-spacing: 0px 0px;\n background-color: white;\n cursor: pointer;\n}\n\n.models .documents table tr:nth-child(even) {\n background-color: #f5f5f5;\n}\n\n.models .documents table tr:hover {\n background-color: #55A3D4;\n}\n\n.models .documents table th, td {\n border-bottom: thin solid rgba(0,0,0,.12);\n text-align: left;\n padding: 0 16px;\n height: 48px;\n}\n\n.models textarea {\n width: 100%;\n height: 600px;\n font-size: 1.2em;\n}\n\n.models .path-type {\n color: rgba(0,0,0,.36);\n font-size: 0.8em;\n}\n\n.models .documents-menu {\n display: flex;\n margin: 0.25em;\n position: fixed;\n width: calc(100vw - 200px);\n}\n\n.models .documents-menu .search-input {\n flex-grow: 1;\n}\n\n.models .search-input input {\n padding: 0.25em 0.5em;\n font-size: 1.1em;\n border: 1px solid #ddd;\n border-radius: 3px;\n width: calc(100% - 1em);\n}";
722
-
723
- /***/ }),
724
-
725
- /***/ "./frontend/src/models/models.html":
726
- /*!*****************************************!*\
727
- !*** ./frontend/src/models/models.html ***!
728
- \*****************************************/
729
- /***/ ((module) => {
730
-
731
- module.exports = "<div class=\"models\">\n <div class=\"model-selector\">\n <h1>Models</h1>\n <div v-for=\"model in models\">\n <router-link :to=\"'/model/' + model\" :class=\"model === currentModel ? 'bold' : ''\">\n {{model}}\n </router-link>\n </div>\n </div>\n <div class=\"documents\">\n <div>\n <div class=\"documents-menu\">\n <div class=\"search-input\">\n <form @submit.prevent=\"search\">\n <input class=\"search-text\" type=\"text\" placeholder=\"Filter or text\" v-model=\"searchText\" />\n </form>\n </div>\n <div class=\"buttons\">\n <button @click=\"shouldShowExportModal = true\">Export</button>\n </div>\n </div>\n </div>\n <div class=\"documents-container\">\n <table>\n <thead>\n <th v-for=\"path in schemaPaths\">\n {{path.path}}\n <span class=\"path-type\">\n ({{path.instance.toLowerCase()}})\n </span>\n </th>\n </thead>\n <tbody>\n <tr v-for=\"document in documents\" @click=\"$router.push('/model/' + currentModel + '/document/' + document._id)\" :key=\"document._id\">\n <td v-for=\"schemaPath in schemaPaths\">\n <component :is=\"getComponentForPath(schemaPath)\" :value=\"document[schemaPath.path]\"></component>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <modal v-if=\"shouldShowExportModal\">\n <template v-slot:body>\n <export-query-results\n :schemaPaths=\"schemaPaths\"\n :filter=\"filter\"\n :currentModel=\"currentModel\"\n @done=\"shouldShowExportModal = false\">\n </export-query-results>\n </template>\n </modal>\n </div>\n</div>";
732
-
733
- /***/ }),
734
-
735
- /***/ "./frontend/src/navbar/navbar.css":
736
- /*!****************************************!*\
737
- !*** ./frontend/src/navbar/navbar.css ***!
738
- \****************************************/
739
- /***/ ((module) => {
740
-
741
- module.exports = ".navbar {\n width: 100%;\n background-color: #eee;\n}\n\n.navbar .nav-left {\n float: left;\n line-height: 54px;\n font-size: 20px;\n padding-left: 20px;\n}\n\n.navbar .nav-left a {\n color: #232323;\n}\n\n.navbar {\n border-bottom: 1px solid #ddd;\n height: 55px;\n}\n\n.navbar .nav-left img {\n height: 24px;\n vertical-align: middle;\n margin-right: 0.5em;\n margin-top: 16px;\n}\n\n.navbar .nav-right {\n float: right;\n display: flex;\n flex-direction: row;\n font-size: 16px;\n line-height: 54px;\n padding-right: 20px;\n}\n\n.navbar .nav-right .nav-item {\n flex-grow: 1;\n padding: 0px 12px;\n position: relative;\n z-index: 21000;\n}\n\n.navbar .nav-right .nav-item:hover {\n flex-grow: 1;\n padding: 0px 12px;\n border-bottom: 1px solid #E1B9A0;\n}\n\n.navbar .nav-right .nav-item.active {\n border-bottom: 1px solid #E1B9A0;\n}\n\n.navbar .nav-action {\n cursor: pointer;\n color: #E1B9A0;\n}\n\n.navbar .nav-action svg {\n height: 1em;\n vertical-align: middle;\n}\n\n.navbar .nav-right .nav-item .flyout {\n position: absolute;\n top: 55px;\n right: 0px;\n visibility: hidden;\n opacity: 0;\n transition: opacity .25s,visibility .25s,transform .25s;\n width: auto;\n box-shadow: 0 12px 32px rgba(0, 0, 0, .1), 0 2px 6px rgba(0, 0, 0, .08);\n background-color: #393944;\n padding-left: 0.5em;\n padding-right: 0.5em;\n z-index: 1000;\n min-width: 192px;\n font-size: 0.9em;\n}\n\n.navbar .nav-right .nav-item:hover .flyout a {\n color: #E1B9A0;\n margin-top: 0.25em;\n margin-bottom: 0.25em;\n}\n\n.navbar .nav-right .nav-item:hover .flyout a:hover {\n color: #E1B9A0;\n}\n\n.navbar .nav-right .nav-item:hover .flyout .nav-action {\n color: #E1B9A0;\n margin-top: 0.25em;\n margin-bottom: 0.25em;\n}\n\n.navbar .nav-right .nav-item:hover .flyout .nav-action:hover {\n color: #E1B9A0;\n}\n\n.navbar .nav-right .nav-item:hover .flyout {\n visibility: visible;\n opacity: 1;\n}\n\n#bar-1 {\n\ttransform: translateY(-4px);\n}\n#bar-3 {\n\ttransform: translateY(4px);\n}\n.menu {\n display: none;\n}\n.menu {\n\twidth: 35px;\n\theight: 30px;\n\tmargin: 18px 2px 0px 0px;\n\tcursor: pointer;\n float: right;\n}\n.bar {\n\theight: 5px;\n\twidth: 100%;\n\tbackground-color: #fff;\n\tdisplay: block;\n\tborder-radius: 5px;\n\ttransition: 0.4s ease;\n}\n.change-icon #bar-1 {\n transform: translateY(4px) rotateZ(-405deg);\n}\n.change-icon #bar-2 {\n opacity: 0;\n}\n.change-icon #bar-3 {\n transform: translateY(-6px) rotateZ(405deg);\n}\n\n@media (max-width: 767px) {\n .menu {\n display: block;\n }\n\n .change-icon ~ div.nav-right {\n left: 0;\n }\n\n .navbar .nav-right {\n\t\tposition: fixed;\n\t\ttop: 55px;\n\t\tleft: -130%;\n\t\tbackground: #111;\n\t\theight: 100vh;\n\t\twidth: 100%;\n\t\ttext-align: center;\n\t\tdisplay: block;\n\t\ttransition: all 0.3s ease;\n z-index: 10000;\n\t}\n}";
742
-
743
- /***/ }),
744
-
745
- /***/ "./frontend/src/navbar/navbar.html":
746
- /*!*****************************************!*\
747
- !*** ./frontend/src/navbar/navbar.html ***!
748
- \*****************************************/
749
- /***/ ((module) => {
750
-
751
- module.exports = "<div class=\"navbar\">\n <div class=\"nav-left\">\n <router-link to=\"/\">\n <img src=\"images/mongoose.svg\" alt=\"Mongoose Logo\" />\n </router-link>\n </div>\n <div class=\"nav-right\">\n </div>\n <div style=\"clear: both\"></div>\n</div>";
752
-
753
- /***/ }),
754
-
755
- /***/ "./node_modules/axios/dist/browser/axios.cjs":
756
- /*!***************************************************!*\
757
- !*** ./node_modules/axios/dist/browser/axios.cjs ***!
758
- \***************************************************/
759
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
760
-
761
- // Axios v1.2.2 Copyright (c) 2022 Matt Zabriskie and contributors
762
-
763
-
764
- function bind(fn, thisArg) {
765
- return function wrap() {
766
- return fn.apply(thisArg, arguments);
767
- };
768
- }
769
-
770
- // utils is a library of generic helper functions non-specific to axios
771
-
772
- const {toString} = Object.prototype;
773
- const {getPrototypeOf} = Object;
774
-
775
- const kindOf = (cache => thing => {
776
- const str = toString.call(thing);
777
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
778
- })(Object.create(null));
779
-
780
- const kindOfTest = (type) => {
781
- type = type.toLowerCase();
782
- return (thing) => kindOf(thing) === type
783
- };
784
-
785
- const typeOfTest = type => thing => typeof thing === type;
786
-
787
- /**
788
- * Determine if a value is an Array
789
- *
790
- * @param {Object} val The value to test
791
- *
792
- * @returns {boolean} True if value is an Array, otherwise false
793
- */
794
- const {isArray} = Array;
795
-
796
- /**
797
- * Determine if a value is undefined
798
- *
799
- * @param {*} val The value to test
800
- *
801
- * @returns {boolean} True if the value is undefined, otherwise false
802
- */
803
- const isUndefined = typeOfTest('undefined');
804
-
805
- /**
806
- * Determine if a value is a Buffer
807
- *
808
- * @param {*} val The value to test
809
- *
810
- * @returns {boolean} True if value is a Buffer, otherwise false
811
- */
812
- function isBuffer(val) {
813
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
814
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
815
- }
816
-
817
- /**
818
- * Determine if a value is an ArrayBuffer
819
- *
820
- * @param {*} val The value to test
821
- *
822
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
823
- */
824
- const isArrayBuffer = kindOfTest('ArrayBuffer');
825
-
826
-
827
- /**
828
- * Determine if a value is a view on an ArrayBuffer
829
- *
830
- * @param {*} val The value to test
831
- *
832
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
833
- */
834
- function isArrayBufferView(val) {
835
- let result;
836
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
837
- result = ArrayBuffer.isView(val);
838
- } else {
839
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
840
- }
841
- return result;
842
- }
843
-
844
- /**
845
- * Determine if a value is a String
846
- *
847
- * @param {*} val The value to test
848
- *
849
- * @returns {boolean} True if value is a String, otherwise false
850
- */
851
- const isString = typeOfTest('string');
852
-
853
- /**
854
- * Determine if a value is a Function
855
- *
856
- * @param {*} val The value to test
857
- * @returns {boolean} True if value is a Function, otherwise false
858
- */
859
- const isFunction = typeOfTest('function');
860
-
861
- /**
862
- * Determine if a value is a Number
863
- *
864
- * @param {*} val The value to test
865
- *
866
- * @returns {boolean} True if value is a Number, otherwise false
867
- */
868
- const isNumber = typeOfTest('number');
869
-
870
- /**
871
- * Determine if a value is an Object
872
- *
873
- * @param {*} thing The value to test
874
- *
875
- * @returns {boolean} True if value is an Object, otherwise false
876
- */
877
- const isObject = (thing) => thing !== null && typeof thing === 'object';
878
-
879
- /**
880
- * Determine if a value is a Boolean
881
- *
882
- * @param {*} thing The value to test
883
- * @returns {boolean} True if value is a Boolean, otherwise false
884
- */
885
- const isBoolean = thing => thing === true || thing === false;
886
-
887
- /**
888
- * Determine if a value is a plain Object
889
- *
890
- * @param {*} val The value to test
891
- *
892
- * @returns {boolean} True if value is a plain Object, otherwise false
893
- */
894
- const isPlainObject = (val) => {
895
- if (kindOf(val) !== 'object') {
896
- return false;
897
- }
898
-
899
- const prototype = getPrototypeOf(val);
900
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
901
- };
902
-
903
- /**
904
- * Determine if a value is a Date
905
- *
906
- * @param {*} val The value to test
907
- *
908
- * @returns {boolean} True if value is a Date, otherwise false
909
- */
910
- const isDate = kindOfTest('Date');
911
-
912
- /**
913
- * Determine if a value is a File
914
- *
915
- * @param {*} val The value to test
916
- *
917
- * @returns {boolean} True if value is a File, otherwise false
918
- */
919
- const isFile = kindOfTest('File');
920
-
921
- /**
922
- * Determine if a value is a Blob
923
- *
924
- * @param {*} val The value to test
925
- *
926
- * @returns {boolean} True if value is a Blob, otherwise false
927
- */
928
- const isBlob = kindOfTest('Blob');
929
-
930
- /**
931
- * Determine if a value is a FileList
932
- *
933
- * @param {*} val The value to test
934
- *
935
- * @returns {boolean} True if value is a File, otherwise false
936
- */
937
- const isFileList = kindOfTest('FileList');
938
-
939
- /**
940
- * Determine if a value is a Stream
941
- *
942
- * @param {*} val The value to test
943
- *
944
- * @returns {boolean} True if value is a Stream, otherwise false
945
- */
946
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
947
-
948
- /**
949
- * Determine if a value is a FormData
950
- *
951
- * @param {*} thing The value to test
952
- *
953
- * @returns {boolean} True if value is an FormData, otherwise false
954
- */
955
- const isFormData = (thing) => {
956
- const pattern = '[object FormData]';
957
- return thing && (
958
- (typeof FormData === 'function' && thing instanceof FormData) ||
959
- toString.call(thing) === pattern ||
960
- (isFunction(thing.toString) && thing.toString() === pattern)
961
- );
962
- };
963
-
964
- /**
965
- * Determine if a value is a URLSearchParams object
966
- *
967
- * @param {*} val The value to test
968
- *
969
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
970
- */
971
- const isURLSearchParams = kindOfTest('URLSearchParams');
972
-
973
- /**
974
- * Trim excess whitespace off the beginning and end of a string
975
- *
976
- * @param {String} str The String to trim
977
- *
978
- * @returns {String} The String freed of excess whitespace
979
- */
980
- const trim = (str) => str.trim ?
981
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
982
-
983
- /**
984
- * Iterate over an Array or an Object invoking a function for each item.
985
- *
986
- * If `obj` is an Array callback will be called passing
987
- * the value, index, and complete array for each item.
988
- *
989
- * If 'obj' is an Object callback will be called passing
990
- * the value, key, and complete object for each property.
991
- *
992
- * @param {Object|Array} obj The object to iterate
993
- * @param {Function} fn The callback to invoke for each item
994
- *
995
- * @param {Boolean} [allOwnKeys = false]
996
- * @returns {any}
997
- */
998
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
999
- // Don't bother if no value provided
1000
- if (obj === null || typeof obj === 'undefined') {
1001
- return;
1002
- }
1003
-
1004
- let i;
1005
- let l;
1006
-
1007
- // Force an array if not already something iterable
1008
- if (typeof obj !== 'object') {
1009
- /*eslint no-param-reassign:0*/
1010
- obj = [obj];
1011
- }
1012
-
1013
- if (isArray(obj)) {
1014
- // Iterate over array values
1015
- for (i = 0, l = obj.length; i < l; i++) {
1016
- fn.call(null, obj[i], i, obj);
1017
- }
1018
- } else {
1019
- // Iterate over object keys
1020
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
1021
- const len = keys.length;
1022
- let key;
1023
-
1024
- for (i = 0; i < len; i++) {
1025
- key = keys[i];
1026
- fn.call(null, obj[key], key, obj);
1027
- }
1028
- }
1029
- }
1030
-
1031
- function findKey(obj, key) {
1032
- key = key.toLowerCase();
1033
- const keys = Object.keys(obj);
1034
- let i = keys.length;
1035
- let _key;
1036
- while (i-- > 0) {
1037
- _key = keys[i];
1038
- if (key === _key.toLowerCase()) {
1039
- return _key;
1040
- }
1041
- }
1042
- return null;
1043
- }
1044
-
1045
- const _global = (() => {
1046
- /*eslint no-undef:0*/
1047
- if (typeof globalThis !== "undefined") return globalThis;
1048
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : __webpack_require__.g)
1049
- })();
1050
-
1051
- const isContextDefined = (context) => !isUndefined(context) && context !== _global;
1052
-
1053
- /**
1054
- * Accepts varargs expecting each argument to be an object, then
1055
- * immutably merges the properties of each object and returns result.
1056
- *
1057
- * When multiple objects contain the same key the later object in
1058
- * the arguments list will take precedence.
1059
- *
1060
- * Example:
1061
- *
1062
- * ```js
1063
- * var result = merge({foo: 123}, {foo: 456});
1064
- * console.log(result.foo); // outputs 456
1065
- * ```
1066
- *
1067
- * @param {Object} obj1 Object to merge
1068
- *
1069
- * @returns {Object} Result of all merge properties
1070
- */
1071
- function merge(/* obj1, obj2, obj3, ... */) {
1072
- const {caseless} = isContextDefined(this) && this || {};
1073
- const result = {};
1074
- const assignValue = (val, key) => {
1075
- const targetKey = caseless && findKey(result, key) || key;
1076
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
1077
- result[targetKey] = merge(result[targetKey], val);
1078
- } else if (isPlainObject(val)) {
1079
- result[targetKey] = merge({}, val);
1080
- } else if (isArray(val)) {
1081
- result[targetKey] = val.slice();
1082
- } else {
1083
- result[targetKey] = val;
1084
- }
1085
- };
1086
-
1087
- for (let i = 0, l = arguments.length; i < l; i++) {
1088
- arguments[i] && forEach(arguments[i], assignValue);
1089
- }
1090
- return result;
1091
- }
1092
-
1093
- /**
1094
- * Extends object a by mutably adding to it the properties of object b.
1095
- *
1096
- * @param {Object} a The object to be extended
1097
- * @param {Object} b The object to copy properties from
1098
- * @param {Object} thisArg The object to bind function to
1099
- *
1100
- * @param {Boolean} [allOwnKeys]
1101
- * @returns {Object} The resulting value of object a
1102
- */
1103
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
1104
- forEach(b, (val, key) => {
1105
- if (thisArg && isFunction(val)) {
1106
- a[key] = bind(val, thisArg);
1107
- } else {
1108
- a[key] = val;
1109
- }
1110
- }, {allOwnKeys});
1111
- return a;
1112
- };
1113
-
1114
- /**
1115
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
1116
- *
1117
- * @param {string} content with BOM
1118
- *
1119
- * @returns {string} content value without BOM
1120
- */
1121
- const stripBOM = (content) => {
1122
- if (content.charCodeAt(0) === 0xFEFF) {
1123
- content = content.slice(1);
1124
- }
1125
- return content;
1126
- };
1127
-
1128
- /**
1129
- * Inherit the prototype methods from one constructor into another
1130
- * @param {function} constructor
1131
- * @param {function} superConstructor
1132
- * @param {object} [props]
1133
- * @param {object} [descriptors]
1134
- *
1135
- * @returns {void}
1136
- */
1137
- const inherits = (constructor, superConstructor, props, descriptors) => {
1138
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
1139
- constructor.prototype.constructor = constructor;
1140
- Object.defineProperty(constructor, 'super', {
1141
- value: superConstructor.prototype
1142
- });
1143
- props && Object.assign(constructor.prototype, props);
1144
- };
1145
-
1146
- /**
1147
- * Resolve object with deep prototype chain to a flat object
1148
- * @param {Object} sourceObj source object
1149
- * @param {Object} [destObj]
1150
- * @param {Function|Boolean} [filter]
1151
- * @param {Function} [propFilter]
1152
- *
1153
- * @returns {Object}
1154
- */
1155
- const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
1156
- let props;
1157
- let i;
1158
- let prop;
1159
- const merged = {};
1160
-
1161
- destObj = destObj || {};
1162
- // eslint-disable-next-line no-eq-null,eqeqeq
1163
- if (sourceObj == null) return destObj;
1164
-
1165
- do {
1166
- props = Object.getOwnPropertyNames(sourceObj);
1167
- i = props.length;
1168
- while (i-- > 0) {
1169
- prop = props[i];
1170
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
1171
- destObj[prop] = sourceObj[prop];
1172
- merged[prop] = true;
1173
- }
1174
- }
1175
- sourceObj = filter !== false && getPrototypeOf(sourceObj);
1176
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
1177
-
1178
- return destObj;
1179
- };
1180
-
1181
- /**
1182
- * Determines whether a string ends with the characters of a specified string
1183
- *
1184
- * @param {String} str
1185
- * @param {String} searchString
1186
- * @param {Number} [position= 0]
1187
- *
1188
- * @returns {boolean}
1189
- */
1190
- const endsWith = (str, searchString, position) => {
1191
- str = String(str);
1192
- if (position === undefined || position > str.length) {
1193
- position = str.length;
1194
- }
1195
- position -= searchString.length;
1196
- const lastIndex = str.indexOf(searchString, position);
1197
- return lastIndex !== -1 && lastIndex === position;
1198
- };
1199
-
1200
-
1201
- /**
1202
- * Returns new array from array like object or null if failed
1203
- *
1204
- * @param {*} [thing]
1205
- *
1206
- * @returns {?Array}
1207
- */
1208
- const toArray = (thing) => {
1209
- if (!thing) return null;
1210
- if (isArray(thing)) return thing;
1211
- let i = thing.length;
1212
- if (!isNumber(i)) return null;
1213
- const arr = new Array(i);
1214
- while (i-- > 0) {
1215
- arr[i] = thing[i];
1216
- }
1217
- return arr;
1218
- };
1219
-
1220
- /**
1221
- * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
1222
- * thing passed in is an instance of Uint8Array
1223
- *
1224
- * @param {TypedArray}
1225
- *
1226
- * @returns {Array}
1227
- */
1228
- // eslint-disable-next-line func-names
1229
- const isTypedArray = (TypedArray => {
1230
- // eslint-disable-next-line func-names
1231
- return thing => {
1232
- return TypedArray && thing instanceof TypedArray;
1233
- };
1234
- })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
1235
-
1236
- /**
1237
- * For each entry in the object, call the function with the key and value.
1238
- *
1239
- * @param {Object<any, any>} obj - The object to iterate over.
1240
- * @param {Function} fn - The function to call for each entry.
1241
- *
1242
- * @returns {void}
1243
- */
1244
- const forEachEntry = (obj, fn) => {
1245
- const generator = obj && obj[Symbol.iterator];
1246
-
1247
- const iterator = generator.call(obj);
1248
-
1249
- let result;
1250
-
1251
- while ((result = iterator.next()) && !result.done) {
1252
- const pair = result.value;
1253
- fn.call(obj, pair[0], pair[1]);
1254
- }
1255
- };
1256
-
1257
- /**
1258
- * It takes a regular expression and a string, and returns an array of all the matches
1259
- *
1260
- * @param {string} regExp - The regular expression to match against.
1261
- * @param {string} str - The string to search.
1262
- *
1263
- * @returns {Array<boolean>}
1264
- */
1265
- const matchAll = (regExp, str) => {
1266
- let matches;
1267
- const arr = [];
1268
-
1269
- while ((matches = regExp.exec(str)) !== null) {
1270
- arr.push(matches);
1271
- }
1272
-
1273
- return arr;
1274
- };
1275
-
1276
- /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
1277
- const isHTMLForm = kindOfTest('HTMLFormElement');
1278
-
1279
- const toCamelCase = str => {
1280
- return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
1281
- function replacer(m, p1, p2) {
1282
- return p1.toUpperCase() + p2;
1283
- }
1284
- );
1285
- };
1286
-
1287
- /* Creating a function that will check if an object has a property. */
1288
- const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
1289
-
1290
- /**
1291
- * Determine if a value is a RegExp object
1292
- *
1293
- * @param {*} val The value to test
1294
- *
1295
- * @returns {boolean} True if value is a RegExp object, otherwise false
1296
- */
1297
- const isRegExp = kindOfTest('RegExp');
1298
-
1299
- const reduceDescriptors = (obj, reducer) => {
1300
- const descriptors = Object.getOwnPropertyDescriptors(obj);
1301
- const reducedDescriptors = {};
1302
-
1303
- forEach(descriptors, (descriptor, name) => {
1304
- if (reducer(descriptor, name, obj) !== false) {
1305
- reducedDescriptors[name] = descriptor;
1306
- }
1307
- });
1308
-
1309
- Object.defineProperties(obj, reducedDescriptors);
1310
- };
1311
-
1312
- /**
1313
- * Makes all methods read-only
1314
- * @param {Object} obj
1315
- */
1316
-
1317
- const freezeMethods = (obj) => {
1318
- reduceDescriptors(obj, (descriptor, name) => {
1319
- // skip restricted props in strict mode
1320
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1321
- return false;
1322
- }
1323
-
1324
- const value = obj[name];
1325
-
1326
- if (!isFunction(value)) return;
1327
-
1328
- descriptor.enumerable = false;
1329
-
1330
- if ('writable' in descriptor) {
1331
- descriptor.writable = false;
1332
- return;
1333
- }
1334
-
1335
- if (!descriptor.set) {
1336
- descriptor.set = () => {
1337
- throw Error('Can not rewrite read-only method \'' + name + '\'');
1338
- };
1339
- }
1340
- });
1341
- };
1342
-
1343
- const toObjectSet = (arrayOrString, delimiter) => {
1344
- const obj = {};
1345
-
1346
- const define = (arr) => {
1347
- arr.forEach(value => {
1348
- obj[value] = true;
1349
- });
1350
- };
1351
-
1352
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
1353
-
1354
- return obj;
1355
- };
1356
-
1357
- const noop = () => {};
1358
-
1359
- const toFiniteNumber = (value, defaultValue) => {
1360
- value = +value;
1361
- return Number.isFinite(value) ? value : defaultValue;
1362
- };
1363
-
1364
- const toJSONObject = (obj) => {
1365
- const stack = new Array(10);
1366
-
1367
- const visit = (source, i) => {
1368
-
1369
- if (isObject(source)) {
1370
- if (stack.indexOf(source) >= 0) {
1371
- return;
1372
- }
1373
-
1374
- if(!('toJSON' in source)) {
1375
- stack[i] = source;
1376
- const target = isArray(source) ? [] : {};
1377
-
1378
- forEach(source, (value, key) => {
1379
- const reducedValue = visit(value, i + 1);
1380
- !isUndefined(reducedValue) && (target[key] = reducedValue);
1381
- });
1382
-
1383
- stack[i] = undefined;
1384
-
1385
- return target;
1386
- }
1387
- }
1388
-
1389
- return source;
1390
- };
1391
-
1392
- return visit(obj, 0);
1393
- };
1394
-
1395
- var utils = {
1396
- isArray,
1397
- isArrayBuffer,
1398
- isBuffer,
1399
- isFormData,
1400
- isArrayBufferView,
1401
- isString,
1402
- isNumber,
1403
- isBoolean,
1404
- isObject,
1405
- isPlainObject,
1406
- isUndefined,
1407
- isDate,
1408
- isFile,
1409
- isBlob,
1410
- isRegExp,
1411
- isFunction,
1412
- isStream,
1413
- isURLSearchParams,
1414
- isTypedArray,
1415
- isFileList,
1416
- forEach,
1417
- merge,
1418
- extend,
1419
- trim,
1420
- stripBOM,
1421
- inherits,
1422
- toFlatObject,
1423
- kindOf,
1424
- kindOfTest,
1425
- endsWith,
1426
- toArray,
1427
- forEachEntry,
1428
- matchAll,
1429
- isHTMLForm,
1430
- hasOwnProperty,
1431
- hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
1432
- reduceDescriptors,
1433
- freezeMethods,
1434
- toObjectSet,
1435
- toCamelCase,
1436
- noop,
1437
- toFiniteNumber,
1438
- findKey,
1439
- global: _global,
1440
- isContextDefined,
1441
- toJSONObject
1442
- };
1443
-
1444
- /**
1445
- * Create an Error with the specified message, config, error code, request and response.
1446
- *
1447
- * @param {string} message The error message.
1448
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
1449
- * @param {Object} [config] The config.
1450
- * @param {Object} [request] The request.
1451
- * @param {Object} [response] The response.
1452
- *
1453
- * @returns {Error} The created error.
1454
- */
1455
- function AxiosError(message, code, config, request, response) {
1456
- Error.call(this);
1457
-
1458
- if (Error.captureStackTrace) {
1459
- Error.captureStackTrace(this, this.constructor);
1460
- } else {
1461
- this.stack = (new Error()).stack;
1462
- }
1463
-
1464
- this.message = message;
1465
- this.name = 'AxiosError';
1466
- code && (this.code = code);
1467
- config && (this.config = config);
1468
- request && (this.request = request);
1469
- response && (this.response = response);
1470
- }
1471
-
1472
- utils.inherits(AxiosError, Error, {
1473
- toJSON: function toJSON() {
1474
- return {
1475
- // Standard
1476
- message: this.message,
1477
- name: this.name,
1478
- // Microsoft
1479
- description: this.description,
1480
- number: this.number,
1481
- // Mozilla
1482
- fileName: this.fileName,
1483
- lineNumber: this.lineNumber,
1484
- columnNumber: this.columnNumber,
1485
- stack: this.stack,
1486
- // Axios
1487
- config: utils.toJSONObject(this.config),
1488
- code: this.code,
1489
- status: this.response && this.response.status ? this.response.status : null
1490
- };
1491
- }
1492
- });
1493
-
1494
- const prototype$1 = AxiosError.prototype;
1495
- const descriptors = {};
1496
-
1497
- [
1498
- 'ERR_BAD_OPTION_VALUE',
1499
- 'ERR_BAD_OPTION',
1500
- 'ECONNABORTED',
1501
- 'ETIMEDOUT',
1502
- 'ERR_NETWORK',
1503
- 'ERR_FR_TOO_MANY_REDIRECTS',
1504
- 'ERR_DEPRECATED',
1505
- 'ERR_BAD_RESPONSE',
1506
- 'ERR_BAD_REQUEST',
1507
- 'ERR_CANCELED',
1508
- 'ERR_NOT_SUPPORT',
1509
- 'ERR_INVALID_URL'
1510
- // eslint-disable-next-line func-names
1511
- ].forEach(code => {
1512
- descriptors[code] = {value: code};
1513
- });
1514
-
1515
- Object.defineProperties(AxiosError, descriptors);
1516
- Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
1517
-
1518
- // eslint-disable-next-line func-names
1519
- AxiosError.from = (error, code, config, request, response, customProps) => {
1520
- const axiosError = Object.create(prototype$1);
1521
-
1522
- utils.toFlatObject(error, axiosError, function filter(obj) {
1523
- return obj !== Error.prototype;
1524
- }, prop => {
1525
- return prop !== 'isAxiosError';
1526
- });
1527
-
1528
- AxiosError.call(axiosError, error.message, code, config, request, response);
1529
-
1530
- axiosError.cause = error;
1531
-
1532
- axiosError.name = error.name;
1533
-
1534
- customProps && Object.assign(axiosError, customProps);
1535
-
1536
- return axiosError;
1537
- };
1538
-
1539
- /* eslint-env browser */
1540
- var browser = typeof self == 'object' ? self.FormData : window.FormData;
1541
-
1542
- var FormData$2 = browser;
1543
-
1544
- /**
1545
- * Determines if the given thing is a array or js object.
1546
- *
1547
- * @param {string} thing - The object or array to be visited.
1548
- *
1549
- * @returns {boolean}
1550
- */
1551
- function isVisitable(thing) {
1552
- return utils.isPlainObject(thing) || utils.isArray(thing);
1553
- }
1554
-
1555
- /**
1556
- * It removes the brackets from the end of a string
1557
- *
1558
- * @param {string} key - The key of the parameter.
1559
- *
1560
- * @returns {string} the key without the brackets.
1561
- */
1562
- function removeBrackets(key) {
1563
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
1564
- }
1565
-
1566
- /**
1567
- * It takes a path, a key, and a boolean, and returns a string
1568
- *
1569
- * @param {string} path - The path to the current key.
1570
- * @param {string} key - The key of the current object being iterated over.
1571
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1572
- *
1573
- * @returns {string} The path to the current key.
1574
- */
1575
- function renderKey(path, key, dots) {
1576
- if (!path) return key;
1577
- return path.concat(key).map(function each(token, i) {
1578
- // eslint-disable-next-line no-param-reassign
1579
- token = removeBrackets(token);
1580
- return !dots && i ? '[' + token + ']' : token;
1581
- }).join(dots ? '.' : '');
1582
- }
1583
-
1584
- /**
1585
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1586
- *
1587
- * @param {Array<any>} arr - The array to check
1588
- *
1589
- * @returns {boolean}
1590
- */
1591
- function isFlatArray(arr) {
1592
- return utils.isArray(arr) && !arr.some(isVisitable);
1593
- }
1594
-
1595
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
1596
- return /^is[A-Z]/.test(prop);
1597
- });
1598
-
1599
- /**
1600
- * If the thing is a FormData object, return true, otherwise return false.
1601
- *
1602
- * @param {unknown} thing - The thing to check.
1603
- *
1604
- * @returns {boolean}
1605
- */
1606
- function isSpecCompliant(thing) {
1607
- return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
1608
- }
1609
-
1610
- /**
1611
- * Convert a data object to FormData
1612
- *
1613
- * @param {Object} obj
1614
- * @param {?Object} [formData]
1615
- * @param {?Object} [options]
1616
- * @param {Function} [options.visitor]
1617
- * @param {Boolean} [options.metaTokens = true]
1618
- * @param {Boolean} [options.dots = false]
1619
- * @param {?Boolean} [options.indexes = false]
1620
- *
1621
- * @returns {Object}
1622
- **/
1623
-
1624
- /**
1625
- * It converts an object into a FormData object
1626
- *
1627
- * @param {Object<any, any>} obj - The object to convert to form data.
1628
- * @param {string} formData - The FormData object to append to.
1629
- * @param {Object<string, any>} options
1630
- *
1631
- * @returns
1632
- */
1633
- function toFormData(obj, formData, options) {
1634
- if (!utils.isObject(obj)) {
1635
- throw new TypeError('target must be an object');
1636
- }
1637
-
1638
- // eslint-disable-next-line no-param-reassign
1639
- formData = formData || new (FormData$2 || FormData)();
1640
-
1641
- // eslint-disable-next-line no-param-reassign
1642
- options = utils.toFlatObject(options, {
1643
- metaTokens: true,
1644
- dots: false,
1645
- indexes: false
1646
- }, false, function defined(option, source) {
1647
- // eslint-disable-next-line no-eq-null,eqeqeq
1648
- return !utils.isUndefined(source[option]);
1649
- });
1650
-
1651
- const metaTokens = options.metaTokens;
1652
- // eslint-disable-next-line no-use-before-define
1653
- const visitor = options.visitor || defaultVisitor;
1654
- const dots = options.dots;
1655
- const indexes = options.indexes;
1656
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1657
- const useBlob = _Blob && isSpecCompliant(formData);
1658
-
1659
- if (!utils.isFunction(visitor)) {
1660
- throw new TypeError('visitor must be a function');
1661
- }
1662
-
1663
- function convertValue(value) {
1664
- if (value === null) return '';
1665
-
1666
- if (utils.isDate(value)) {
1667
- return value.toISOString();
1668
- }
1669
-
1670
- if (!useBlob && utils.isBlob(value)) {
1671
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1672
- }
1673
-
1674
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
1675
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1676
- }
1677
-
1678
- return value;
1679
- }
1680
-
1681
- /**
1682
- * Default visitor.
1683
- *
1684
- * @param {*} value
1685
- * @param {String|Number} key
1686
- * @param {Array<String|Number>} path
1687
- * @this {FormData}
1688
- *
1689
- * @returns {boolean} return true to visit the each prop of the value recursively
1690
- */
1691
- function defaultVisitor(value, key, path) {
1692
- let arr = value;
1693
-
1694
- if (value && !path && typeof value === 'object') {
1695
- if (utils.endsWith(key, '{}')) {
1696
- // eslint-disable-next-line no-param-reassign
1697
- key = metaTokens ? key : key.slice(0, -2);
1698
- // eslint-disable-next-line no-param-reassign
1699
- value = JSON.stringify(value);
1700
- } else if (
1701
- (utils.isArray(value) && isFlatArray(value)) ||
1702
- (utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
1703
- )) {
1704
- // eslint-disable-next-line no-param-reassign
1705
- key = removeBrackets(key);
1706
-
1707
- arr.forEach(function each(el, index) {
1708
- !(utils.isUndefined(el) || el === null) && formData.append(
1709
- // eslint-disable-next-line no-nested-ternary
1710
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1711
- convertValue(el)
1712
- );
1713
- });
1714
- return false;
1715
- }
1716
- }
1717
-
1718
- if (isVisitable(value)) {
1719
- return true;
1720
- }
1721
-
1722
- formData.append(renderKey(path, key, dots), convertValue(value));
1723
-
1724
- return false;
1725
- }
1726
-
1727
- const stack = [];
1728
-
1729
- const exposedHelpers = Object.assign(predicates, {
1730
- defaultVisitor,
1731
- convertValue,
1732
- isVisitable
1733
- });
1734
-
1735
- function build(value, path) {
1736
- if (utils.isUndefined(value)) return;
1737
-
1738
- if (stack.indexOf(value) !== -1) {
1739
- throw Error('Circular reference detected in ' + path.join('.'));
1740
- }
1741
-
1742
- stack.push(value);
1743
-
1744
- utils.forEach(value, function each(el, key) {
1745
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
1746
- formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
1747
- );
1748
-
1749
- if (result === true) {
1750
- build(el, path ? path.concat(key) : [key]);
1751
- }
1752
- });
1753
-
1754
- stack.pop();
1755
- }
1756
-
1757
- if (!utils.isObject(obj)) {
1758
- throw new TypeError('data must be an object');
1759
- }
1760
-
1761
- build(obj);
1762
-
1763
- return formData;
1764
- }
1765
-
1766
- /**
1767
- * It encodes a string by replacing all characters that are not in the unreserved set with
1768
- * their percent-encoded equivalents
1769
- *
1770
- * @param {string} str - The string to encode.
1771
- *
1772
- * @returns {string} The encoded string.
1773
- */
1774
- function encode$1(str) {
1775
- const charMap = {
1776
- '!': '%21',
1777
- "'": '%27',
1778
- '(': '%28',
1779
- ')': '%29',
1780
- '~': '%7E',
1781
- '%20': '+',
1782
- '%00': '\x00'
1783
- };
1784
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1785
- return charMap[match];
1786
- });
1787
- }
1788
-
1789
- /**
1790
- * It takes a params object and converts it to a FormData object
1791
- *
1792
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1793
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1794
- *
1795
- * @returns {void}
1796
- */
1797
- function AxiosURLSearchParams(params, options) {
1798
- this._pairs = [];
1799
-
1800
- params && toFormData(params, this, options);
1801
- }
1802
-
1803
- const prototype = AxiosURLSearchParams.prototype;
1804
-
1805
- prototype.append = function append(name, value) {
1806
- this._pairs.push([name, value]);
1807
- };
1808
-
1809
- prototype.toString = function toString(encoder) {
1810
- const _encode = encoder ? function(value) {
1811
- return encoder.call(this, value, encode$1);
1812
- } : encode$1;
1813
-
1814
- return this._pairs.map(function each(pair) {
1815
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1816
- }, '').join('&');
1817
- };
1818
-
1819
- /**
1820
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1821
- * URI encoded counterparts
1822
- *
1823
- * @param {string} val The value to be encoded.
1824
- *
1825
- * @returns {string} The encoded value.
1826
- */
1827
- function encode(val) {
1828
- return encodeURIComponent(val).
1829
- replace(/%3A/gi, ':').
1830
- replace(/%24/g, '$').
1831
- replace(/%2C/gi, ',').
1832
- replace(/%20/g, '+').
1833
- replace(/%5B/gi, '[').
1834
- replace(/%5D/gi, ']');
1835
- }
1836
-
1837
- /**
1838
- * Build a URL by appending params to the end
1839
- *
1840
- * @param {string} url The base of the url (e.g., http://www.google.com)
1841
- * @param {object} [params] The params to be appended
1842
- * @param {?object} options
1843
- *
1844
- * @returns {string} The formatted url
1845
- */
1846
- function buildURL(url, params, options) {
1847
- /*eslint no-param-reassign:0*/
1848
- if (!params) {
1849
- return url;
1850
- }
1851
-
1852
- const _encode = options && options.encode || encode;
1853
-
1854
- const serializeFn = options && options.serialize;
1855
-
1856
- let serializedParams;
1857
-
1858
- if (serializeFn) {
1859
- serializedParams = serializeFn(params, options);
1860
- } else {
1861
- serializedParams = utils.isURLSearchParams(params) ?
1862
- params.toString() :
1863
- new AxiosURLSearchParams(params, options).toString(_encode);
1864
- }
1865
-
1866
- if (serializedParams) {
1867
- const hashmarkIndex = url.indexOf("#");
1868
-
1869
- if (hashmarkIndex !== -1) {
1870
- url = url.slice(0, hashmarkIndex);
1871
- }
1872
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1873
- }
1874
-
1875
- return url;
1876
- }
1877
-
1878
- class InterceptorManager {
1879
- constructor() {
1880
- this.handlers = [];
1881
- }
1882
-
1883
- /**
1884
- * Add a new interceptor to the stack
1885
- *
1886
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1887
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1888
- *
1889
- * @return {Number} An ID used to remove interceptor later
1890
- */
1891
- use(fulfilled, rejected, options) {
1892
- this.handlers.push({
1893
- fulfilled,
1894
- rejected,
1895
- synchronous: options ? options.synchronous : false,
1896
- runWhen: options ? options.runWhen : null
1897
- });
1898
- return this.handlers.length - 1;
1899
- }
1900
-
1901
- /**
1902
- * Remove an interceptor from the stack
1903
- *
1904
- * @param {Number} id The ID that was returned by `use`
1905
- *
1906
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1907
- */
1908
- eject(id) {
1909
- if (this.handlers[id]) {
1910
- this.handlers[id] = null;
1911
- }
1912
- }
1913
-
1914
- /**
1915
- * Clear all interceptors from the stack
1916
- *
1917
- * @returns {void}
1918
- */
1919
- clear() {
1920
- if (this.handlers) {
1921
- this.handlers = [];
1922
- }
1923
- }
1924
-
1925
- /**
1926
- * Iterate over all the registered interceptors
1927
- *
1928
- * This method is particularly useful for skipping over any
1929
- * interceptors that may have become `null` calling `eject`.
1930
- *
1931
- * @param {Function} fn The function to call for each interceptor
1932
- *
1933
- * @returns {void}
1934
- */
1935
- forEach(fn) {
1936
- utils.forEach(this.handlers, function forEachHandler(h) {
1937
- if (h !== null) {
1938
- fn(h);
1939
- }
1940
- });
1941
- }
1942
- }
1943
-
1944
- var InterceptorManager$1 = InterceptorManager;
1945
-
1946
- var transitionalDefaults = {
1947
- silentJSONParsing: true,
1948
- forcedJSONParsing: true,
1949
- clarifyTimeoutError: false
1950
- };
1951
-
1952
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1953
-
1954
- var FormData$1 = FormData;
1955
-
1956
- /**
1957
- * Determine if we're running in a standard browser environment
1958
- *
1959
- * This allows axios to run in a web worker, and react-native.
1960
- * Both environments support XMLHttpRequest, but not fully standard globals.
1961
- *
1962
- * web workers:
1963
- * typeof window -> undefined
1964
- * typeof document -> undefined
1965
- *
1966
- * react-native:
1967
- * navigator.product -> 'ReactNative'
1968
- * nativescript
1969
- * navigator.product -> 'NativeScript' or 'NS'
1970
- *
1971
- * @returns {boolean}
1972
- */
1973
- const isStandardBrowserEnv = (() => {
1974
- let product;
1975
- if (typeof navigator !== 'undefined' && (
1976
- (product = navigator.product) === 'ReactNative' ||
1977
- product === 'NativeScript' ||
1978
- product === 'NS')
1979
- ) {
1980
- return false;
1981
- }
1982
-
1983
- return typeof window !== 'undefined' && typeof document !== 'undefined';
1984
- })();
1985
-
1986
- /**
1987
- * Determine if we're running in a standard browser webWorker environment
1988
- *
1989
- * Although the `isStandardBrowserEnv` method indicates that
1990
- * `allows axios to run in a web worker`, the WebWorker will still be
1991
- * filtered out due to its judgment standard
1992
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1993
- * This leads to a problem when axios post `FormData` in webWorker
1994
- */
1995
- const isStandardBrowserWebWorkerEnv = (() => {
1996
- return (
1997
- typeof WorkerGlobalScope !== 'undefined' &&
1998
- // eslint-disable-next-line no-undef
1999
- self instanceof WorkerGlobalScope &&
2000
- typeof self.importScripts === 'function'
2001
- );
2002
- })();
2003
-
2004
-
2005
- var platform = {
2006
- isBrowser: true,
2007
- classes: {
2008
- URLSearchParams: URLSearchParams$1,
2009
- FormData: FormData$1,
2010
- Blob
2011
- },
2012
- isStandardBrowserEnv,
2013
- isStandardBrowserWebWorkerEnv,
2014
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
2015
- };
2016
-
2017
- function toURLEncodedForm(data, options) {
2018
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
2019
- visitor: function(value, key, path, helpers) {
2020
- if (platform.isNode && utils.isBuffer(value)) {
2021
- this.append(key, value.toString('base64'));
2022
- return false;
2023
- }
2024
-
2025
- return helpers.defaultVisitor.apply(this, arguments);
2026
- }
2027
- }, options));
2028
- }
2029
-
2030
- /**
2031
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2032
- *
2033
- * @param {string} name - The name of the property to get.
2034
- *
2035
- * @returns An array of strings.
2036
- */
2037
- function parsePropPath(name) {
2038
- // foo[x][y][z]
2039
- // foo.x.y.z
2040
- // foo-x-y-z
2041
- // foo x y z
2042
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
2043
- return match[0] === '[]' ? '' : match[1] || match[0];
2044
- });
2045
- }
2046
-
2047
- /**
2048
- * Convert an array to an object.
2049
- *
2050
- * @param {Array<any>} arr - The array to convert to an object.
2051
- *
2052
- * @returns An object with the same keys and values as the array.
2053
- */
2054
- function arrayToObject(arr) {
2055
- const obj = {};
2056
- const keys = Object.keys(arr);
2057
- let i;
2058
- const len = keys.length;
2059
- let key;
2060
- for (i = 0; i < len; i++) {
2061
- key = keys[i];
2062
- obj[key] = arr[key];
2063
- }
2064
- return obj;
2065
- }
2066
-
2067
- /**
2068
- * It takes a FormData object and returns a JavaScript object
2069
- *
2070
- * @param {string} formData The FormData object to convert to JSON.
2071
- *
2072
- * @returns {Object<string, any> | null} The converted object.
2073
- */
2074
- function formDataToJSON(formData) {
2075
- function buildPath(path, value, target, index) {
2076
- let name = path[index++];
2077
- const isNumericKey = Number.isFinite(+name);
2078
- const isLast = index >= path.length;
2079
- name = !name && utils.isArray(target) ? target.length : name;
2080
-
2081
- if (isLast) {
2082
- if (utils.hasOwnProp(target, name)) {
2083
- target[name] = [target[name], value];
2084
- } else {
2085
- target[name] = value;
2086
- }
2087
-
2088
- return !isNumericKey;
2089
- }
2090
-
2091
- if (!target[name] || !utils.isObject(target[name])) {
2092
- target[name] = [];
2093
- }
2094
-
2095
- const result = buildPath(path, value, target[name], index);
2096
-
2097
- if (result && utils.isArray(target[name])) {
2098
- target[name] = arrayToObject(target[name]);
2099
- }
2100
-
2101
- return !isNumericKey;
2102
- }
2103
-
2104
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
2105
- const obj = {};
2106
-
2107
- utils.forEachEntry(formData, (name, value) => {
2108
- buildPath(parsePropPath(name), value, obj, 0);
2109
- });
2110
-
2111
- return obj;
2112
- }
2113
-
2114
- return null;
2115
- }
2116
-
2117
- const DEFAULT_CONTENT_TYPE = {
2118
- 'Content-Type': undefined
2119
- };
2120
-
2121
- /**
2122
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2123
- * of the input
2124
- *
2125
- * @param {any} rawValue - The value to be stringified.
2126
- * @param {Function} parser - A function that parses a string into a JavaScript object.
2127
- * @param {Function} encoder - A function that takes a value and returns a string.
2128
- *
2129
- * @returns {string} A stringified version of the rawValue.
2130
- */
2131
- function stringifySafely(rawValue, parser, encoder) {
2132
- if (utils.isString(rawValue)) {
2133
- try {
2134
- (parser || JSON.parse)(rawValue);
2135
- return utils.trim(rawValue);
2136
- } catch (e) {
2137
- if (e.name !== 'SyntaxError') {
2138
- throw e;
2139
- }
2140
- }
2141
- }
2142
-
2143
- return (encoder || JSON.stringify)(rawValue);
2144
- }
2145
-
2146
- const defaults = {
2147
-
2148
- transitional: transitionalDefaults,
2149
-
2150
- adapter: ['xhr', 'http'],
2151
-
2152
- transformRequest: [function transformRequest(data, headers) {
2153
- const contentType = headers.getContentType() || '';
2154
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
2155
- const isObjectPayload = utils.isObject(data);
2156
-
2157
- if (isObjectPayload && utils.isHTMLForm(data)) {
2158
- data = new FormData(data);
2159
- }
2160
-
2161
- const isFormData = utils.isFormData(data);
2162
-
2163
- if (isFormData) {
2164
- if (!hasJSONContentType) {
2165
- return data;
2166
- }
2167
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2168
- }
2169
-
2170
- if (utils.isArrayBuffer(data) ||
2171
- utils.isBuffer(data) ||
2172
- utils.isStream(data) ||
2173
- utils.isFile(data) ||
2174
- utils.isBlob(data)
2175
- ) {
2176
- return data;
2177
- }
2178
- if (utils.isArrayBufferView(data)) {
2179
- return data.buffer;
2180
- }
2181
- if (utils.isURLSearchParams(data)) {
2182
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2183
- return data.toString();
2184
- }
2185
-
2186
- let isFileList;
2187
-
2188
- if (isObjectPayload) {
2189
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2190
- return toURLEncodedForm(data, this.formSerializer).toString();
2191
- }
2192
-
2193
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2194
- const _FormData = this.env && this.env.FormData;
2195
-
2196
- return toFormData(
2197
- isFileList ? {'files[]': data} : data,
2198
- _FormData && new _FormData(),
2199
- this.formSerializer
2200
- );
2201
- }
2202
- }
2203
-
2204
- if (isObjectPayload || hasJSONContentType ) {
2205
- headers.setContentType('application/json', false);
2206
- return stringifySafely(data);
2207
- }
2208
-
2209
- return data;
2210
- }],
2211
-
2212
- transformResponse: [function transformResponse(data) {
2213
- const transitional = this.transitional || defaults.transitional;
2214
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2215
- const JSONRequested = this.responseType === 'json';
2216
-
2217
- if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
2218
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
2219
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
2220
-
2221
- try {
2222
- return JSON.parse(data);
2223
- } catch (e) {
2224
- if (strictJSONParsing) {
2225
- if (e.name === 'SyntaxError') {
2226
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
2227
- }
2228
- throw e;
2229
- }
2230
- }
2231
- }
2232
-
2233
- return data;
2234
- }],
2235
-
2236
- /**
2237
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
2238
- * timeout is not created.
2239
- */
2240
- timeout: 0,
2241
-
2242
- xsrfCookieName: 'XSRF-TOKEN',
2243
- xsrfHeaderName: 'X-XSRF-TOKEN',
2244
-
2245
- maxContentLength: -1,
2246
- maxBodyLength: -1,
2247
-
2248
- env: {
2249
- FormData: platform.classes.FormData,
2250
- Blob: platform.classes.Blob
2251
- },
2252
-
2253
- validateStatus: function validateStatus(status) {
2254
- return status >= 200 && status < 300;
2255
- },
2256
-
2257
- headers: {
2258
- common: {
2259
- 'Accept': 'application/json, text/plain, */*'
2260
- }
2261
- }
2262
- };
2263
-
2264
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
2265
- defaults.headers[method] = {};
2266
- });
2267
-
2268
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2269
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
2270
- });
2271
-
2272
- var defaults$1 = defaults;
2273
-
2274
- // RawAxiosHeaders whose duplicates are ignored by node
2275
- // c.f. https://nodejs.org/api/http.html#http_message_headers
2276
- const ignoreDuplicateOf = utils.toObjectSet([
2277
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
2278
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
2279
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
2280
- 'referer', 'retry-after', 'user-agent'
2281
- ]);
2282
-
2283
- /**
2284
- * Parse headers into an object
2285
- *
2286
- * ```
2287
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
2288
- * Content-Type: application/json
2289
- * Connection: keep-alive
2290
- * Transfer-Encoding: chunked
2291
- * ```
2292
- *
2293
- * @param {String} rawHeaders Headers needing to be parsed
2294
- *
2295
- * @returns {Object} Headers parsed into an object
2296
- */
2297
- var parseHeaders = rawHeaders => {
2298
- const parsed = {};
2299
- let key;
2300
- let val;
2301
- let i;
2302
-
2303
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2304
- i = line.indexOf(':');
2305
- key = line.substring(0, i).trim().toLowerCase();
2306
- val = line.substring(i + 1).trim();
2307
-
2308
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
2309
- return;
2310
- }
2311
-
2312
- if (key === 'set-cookie') {
2313
- if (parsed[key]) {
2314
- parsed[key].push(val);
2315
- } else {
2316
- parsed[key] = [val];
2317
- }
2318
- } else {
2319
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2320
- }
2321
- });
2322
-
2323
- return parsed;
2324
- };
2325
-
2326
- const $internals = Symbol('internals');
2327
-
2328
- function normalizeHeader(header) {
2329
- return header && String(header).trim().toLowerCase();
2330
- }
2331
-
2332
- function normalizeValue(value) {
2333
- if (value === false || value == null) {
2334
- return value;
2335
- }
2336
-
2337
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
2338
- }
2339
-
2340
- function parseTokens(str) {
2341
- const tokens = Object.create(null);
2342
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2343
- let match;
2344
-
2345
- while ((match = tokensRE.exec(str))) {
2346
- tokens[match[1]] = match[2];
2347
- }
2348
-
2349
- return tokens;
2350
- }
2351
-
2352
- function isValidHeaderName(str) {
2353
- return /^[-_a-zA-Z]+$/.test(str.trim());
2354
- }
2355
-
2356
- function matchHeaderValue(context, value, header, filter) {
2357
- if (utils.isFunction(filter)) {
2358
- return filter.call(this, value, header);
2359
- }
2360
-
2361
- if (!utils.isString(value)) return;
2362
-
2363
- if (utils.isString(filter)) {
2364
- return value.indexOf(filter) !== -1;
2365
- }
2366
-
2367
- if (utils.isRegExp(filter)) {
2368
- return filter.test(value);
2369
- }
2370
- }
2371
-
2372
- function formatHeader(header) {
2373
- return header.trim()
2374
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
2375
- return char.toUpperCase() + str;
2376
- });
2377
- }
2378
-
2379
- function buildAccessors(obj, header) {
2380
- const accessorName = utils.toCamelCase(' ' + header);
2381
-
2382
- ['get', 'set', 'has'].forEach(methodName => {
2383
- Object.defineProperty(obj, methodName + accessorName, {
2384
- value: function(arg1, arg2, arg3) {
2385
- return this[methodName].call(this, header, arg1, arg2, arg3);
2386
- },
2387
- configurable: true
2388
- });
2389
- });
2390
- }
2391
-
2392
- class AxiosHeaders {
2393
- constructor(headers) {
2394
- headers && this.set(headers);
2395
- }
2396
-
2397
- set(header, valueOrRewrite, rewrite) {
2398
- const self = this;
2399
-
2400
- function setHeader(_value, _header, _rewrite) {
2401
- const lHeader = normalizeHeader(_header);
2402
-
2403
- if (!lHeader) {
2404
- throw new Error('header name must be a non-empty string');
2405
- }
2406
-
2407
- const key = utils.findKey(self, lHeader);
2408
-
2409
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
2410
- self[key || _header] = normalizeValue(_value);
2411
- }
2412
- }
2413
-
2414
- const setHeaders = (headers, _rewrite) =>
2415
- utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
2416
-
2417
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
2418
- setHeaders(header, valueOrRewrite);
2419
- } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2420
- setHeaders(parseHeaders(header), valueOrRewrite);
2421
- } else {
2422
- header != null && setHeader(valueOrRewrite, header, rewrite);
2423
- }
2424
-
2425
- return this;
2426
- }
2427
-
2428
- get(header, parser) {
2429
- header = normalizeHeader(header);
2430
-
2431
- if (header) {
2432
- const key = utils.findKey(this, header);
2433
-
2434
- if (key) {
2435
- const value = this[key];
2436
-
2437
- if (!parser) {
2438
- return value;
2439
- }
2440
-
2441
- if (parser === true) {
2442
- return parseTokens(value);
2443
- }
2444
-
2445
- if (utils.isFunction(parser)) {
2446
- return parser.call(this, value, key);
2447
- }
2448
-
2449
- if (utils.isRegExp(parser)) {
2450
- return parser.exec(value);
2451
- }
2452
-
2453
- throw new TypeError('parser must be boolean|regexp|function');
2454
- }
2455
- }
2456
- }
2457
-
2458
- has(header, matcher) {
2459
- header = normalizeHeader(header);
2460
-
2461
- if (header) {
2462
- const key = utils.findKey(this, header);
2463
-
2464
- return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2465
- }
2466
-
2467
- return false;
2468
- }
2469
-
2470
- delete(header, matcher) {
2471
- const self = this;
2472
- let deleted = false;
2473
-
2474
- function deleteHeader(_header) {
2475
- _header = normalizeHeader(_header);
2476
-
2477
- if (_header) {
2478
- const key = utils.findKey(self, _header);
2479
-
2480
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2481
- delete self[key];
2482
-
2483
- deleted = true;
2484
- }
2485
- }
2486
- }
2487
-
2488
- if (utils.isArray(header)) {
2489
- header.forEach(deleteHeader);
2490
- } else {
2491
- deleteHeader(header);
2492
- }
2493
-
2494
- return deleted;
2495
- }
2496
-
2497
- clear() {
2498
- return Object.keys(this).forEach(this.delete.bind(this));
2499
- }
2500
-
2501
- normalize(format) {
2502
- const self = this;
2503
- const headers = {};
2504
-
2505
- utils.forEach(this, (value, header) => {
2506
- const key = utils.findKey(headers, header);
2507
-
2508
- if (key) {
2509
- self[key] = normalizeValue(value);
2510
- delete self[header];
2511
- return;
2512
- }
2513
-
2514
- const normalized = format ? formatHeader(header) : String(header).trim();
2515
-
2516
- if (normalized !== header) {
2517
- delete self[header];
2518
- }
2519
-
2520
- self[normalized] = normalizeValue(value);
2521
-
2522
- headers[normalized] = true;
2523
- });
2524
-
2525
- return this;
2526
- }
2527
-
2528
- concat(...targets) {
2529
- return this.constructor.concat(this, ...targets);
2530
- }
2531
-
2532
- toJSON(asStrings) {
2533
- const obj = Object.create(null);
2534
-
2535
- utils.forEach(this, (value, header) => {
2536
- value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
2537
- });
2538
-
2539
- return obj;
2540
- }
2541
-
2542
- [Symbol.iterator]() {
2543
- return Object.entries(this.toJSON())[Symbol.iterator]();
2544
- }
2545
-
2546
- toString() {
2547
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
2548
- }
2549
-
2550
- get [Symbol.toStringTag]() {
2551
- return 'AxiosHeaders';
2552
- }
2553
-
2554
- static from(thing) {
2555
- return thing instanceof this ? thing : new this(thing);
2556
- }
2557
-
2558
- static concat(first, ...targets) {
2559
- const computed = new this(first);
2560
-
2561
- targets.forEach((target) => computed.set(target));
2562
-
2563
- return computed;
2564
- }
2565
-
2566
- static accessor(header) {
2567
- const internals = this[$internals] = (this[$internals] = {
2568
- accessors: {}
2569
- });
2570
-
2571
- const accessors = internals.accessors;
2572
- const prototype = this.prototype;
2573
-
2574
- function defineAccessor(_header) {
2575
- const lHeader = normalizeHeader(_header);
2576
-
2577
- if (!accessors[lHeader]) {
2578
- buildAccessors(prototype, _header);
2579
- accessors[lHeader] = true;
2580
- }
2581
- }
2582
-
2583
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2584
-
2585
- return this;
2586
- }
2587
- }
2588
-
2589
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
2590
-
2591
- utils.freezeMethods(AxiosHeaders.prototype);
2592
- utils.freezeMethods(AxiosHeaders);
2593
-
2594
- var AxiosHeaders$1 = AxiosHeaders;
2595
-
2596
- /**
2597
- * Transform the data for a request or a response
2598
- *
2599
- * @param {Array|Function} fns A single function or Array of functions
2600
- * @param {?Object} response The response object
2601
- *
2602
- * @returns {*} The resulting transformed data
2603
- */
2604
- function transformData(fns, response) {
2605
- const config = this || defaults$1;
2606
- const context = response || config;
2607
- const headers = AxiosHeaders$1.from(context.headers);
2608
- let data = context.data;
2609
-
2610
- utils.forEach(fns, function transform(fn) {
2611
- data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
2612
- });
2613
-
2614
- headers.normalize();
2615
-
2616
- return data;
2617
- }
2618
-
2619
- function isCancel(value) {
2620
- return !!(value && value.__CANCEL__);
2621
- }
2622
-
2623
- /**
2624
- * A `CanceledError` is an object that is thrown when an operation is canceled.
2625
- *
2626
- * @param {string=} message The message.
2627
- * @param {Object=} config The config.
2628
- * @param {Object=} request The request.
2629
- *
2630
- * @returns {CanceledError} The created error.
2631
- */
2632
- function CanceledError(message, config, request) {
2633
- // eslint-disable-next-line no-eq-null,eqeqeq
2634
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
2635
- this.name = 'CanceledError';
2636
- }
2637
-
2638
- utils.inherits(CanceledError, AxiosError, {
2639
- __CANCEL__: true
2640
- });
2641
-
2642
- // eslint-disable-next-line strict
2643
- var httpAdapter = null;
2644
-
2645
- /**
2646
- * Resolve or reject a Promise based on response status.
2647
- *
2648
- * @param {Function} resolve A function that resolves the promise.
2649
- * @param {Function} reject A function that rejects the promise.
2650
- * @param {object} response The response.
2651
- *
2652
- * @returns {object} The response.
2653
- */
2654
- function settle(resolve, reject, response) {
2655
- const validateStatus = response.config.validateStatus;
2656
- if (!response.status || !validateStatus || validateStatus(response.status)) {
2657
- resolve(response);
2658
- } else {
2659
- reject(new AxiosError(
2660
- 'Request failed with status code ' + response.status,
2661
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
2662
- response.config,
2663
- response.request,
2664
- response
2665
- ));
2666
- }
2667
- }
2668
-
2669
- var cookies = platform.isStandardBrowserEnv ?
2670
-
2671
- // Standard browser envs support document.cookie
2672
- (function standardBrowserEnv() {
2673
- return {
2674
- write: function write(name, value, expires, path, domain, secure) {
2675
- const cookie = [];
2676
- cookie.push(name + '=' + encodeURIComponent(value));
2677
-
2678
- if (utils.isNumber(expires)) {
2679
- cookie.push('expires=' + new Date(expires).toGMTString());
2680
- }
2681
-
2682
- if (utils.isString(path)) {
2683
- cookie.push('path=' + path);
2684
- }
2685
-
2686
- if (utils.isString(domain)) {
2687
- cookie.push('domain=' + domain);
2688
- }
2689
-
2690
- if (secure === true) {
2691
- cookie.push('secure');
2692
- }
2693
-
2694
- document.cookie = cookie.join('; ');
2695
- },
2696
-
2697
- read: function read(name) {
2698
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
2699
- return (match ? decodeURIComponent(match[3]) : null);
2700
- },
2701
-
2702
- remove: function remove(name) {
2703
- this.write(name, '', Date.now() - 86400000);
2704
- }
2705
- };
2706
- })() :
2707
-
2708
- // Non standard browser env (web workers, react-native) lack needed support.
2709
- (function nonStandardBrowserEnv() {
2710
- return {
2711
- write: function write() {},
2712
- read: function read() { return null; },
2713
- remove: function remove() {}
2714
- };
2715
- })();
2716
-
2717
- /**
2718
- * Determines whether the specified URL is absolute
2719
- *
2720
- * @param {string} url The URL to test
2721
- *
2722
- * @returns {boolean} True if the specified URL is absolute, otherwise false
2723
- */
2724
- function isAbsoluteURL(url) {
2725
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2726
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2727
- // by any combination of letters, digits, plus, period, or hyphen.
2728
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2729
- }
2730
-
2731
- /**
2732
- * Creates a new URL by combining the specified URLs
2733
- *
2734
- * @param {string} baseURL The base URL
2735
- * @param {string} relativeURL The relative URL
2736
- *
2737
- * @returns {string} The combined URL
2738
- */
2739
- function combineURLs(baseURL, relativeURL) {
2740
- return relativeURL
2741
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2742
- : baseURL;
2743
- }
2744
-
2745
- /**
2746
- * Creates a new URL by combining the baseURL with the requestedURL,
2747
- * only when the requestedURL is not already an absolute URL.
2748
- * If the requestURL is absolute, this function returns the requestedURL untouched.
2749
- *
2750
- * @param {string} baseURL The base URL
2751
- * @param {string} requestedURL Absolute or relative URL to combine
2752
- *
2753
- * @returns {string} The combined full path
2754
- */
2755
- function buildFullPath(baseURL, requestedURL) {
2756
- if (baseURL && !isAbsoluteURL(requestedURL)) {
2757
- return combineURLs(baseURL, requestedURL);
2758
- }
2759
- return requestedURL;
2760
- }
2761
-
2762
- var isURLSameOrigin = platform.isStandardBrowserEnv ?
2763
-
2764
- // Standard browser envs have full support of the APIs needed to test
2765
- // whether the request URL is of the same origin as current location.
2766
- (function standardBrowserEnv() {
2767
- const msie = /(msie|trident)/i.test(navigator.userAgent);
2768
- const urlParsingNode = document.createElement('a');
2769
- let originURL;
2770
-
2771
- /**
2772
- * Parse a URL to discover it's components
2773
- *
2774
- * @param {String} url The URL to be parsed
2775
- * @returns {Object}
2776
- */
2777
- function resolveURL(url) {
2778
- let href = url;
2779
-
2780
- if (msie) {
2781
- // IE needs attribute set twice to normalize properties
2782
- urlParsingNode.setAttribute('href', href);
2783
- href = urlParsingNode.href;
2784
- }
2785
-
2786
- urlParsingNode.setAttribute('href', href);
2787
-
2788
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2789
- return {
2790
- href: urlParsingNode.href,
2791
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2792
- host: urlParsingNode.host,
2793
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2794
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2795
- hostname: urlParsingNode.hostname,
2796
- port: urlParsingNode.port,
2797
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2798
- urlParsingNode.pathname :
2799
- '/' + urlParsingNode.pathname
2800
- };
2801
- }
2802
-
2803
- originURL = resolveURL(window.location.href);
2804
-
2805
- /**
2806
- * Determine if a URL shares the same origin as the current location
2807
- *
2808
- * @param {String} requestURL The URL to test
2809
- * @returns {boolean} True if URL shares the same origin, otherwise false
2810
- */
2811
- return function isURLSameOrigin(requestURL) {
2812
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2813
- return (parsed.protocol === originURL.protocol &&
2814
- parsed.host === originURL.host);
2815
- };
2816
- })() :
2817
-
2818
- // Non standard browser envs (web workers, react-native) lack needed support.
2819
- (function nonStandardBrowserEnv() {
2820
- return function isURLSameOrigin() {
2821
- return true;
2822
- };
2823
- })();
2824
-
2825
- function parseProtocol(url) {
2826
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2827
- return match && match[1] || '';
2828
- }
2829
-
2830
- /**
2831
- * Calculate data maxRate
2832
- * @param {Number} [samplesCount= 10]
2833
- * @param {Number} [min= 1000]
2834
- * @returns {Function}
2835
- */
2836
- function speedometer(samplesCount, min) {
2837
- samplesCount = samplesCount || 10;
2838
- const bytes = new Array(samplesCount);
2839
- const timestamps = new Array(samplesCount);
2840
- let head = 0;
2841
- let tail = 0;
2842
- let firstSampleTS;
2843
-
2844
- min = min !== undefined ? min : 1000;
2845
-
2846
- return function push(chunkLength) {
2847
- const now = Date.now();
2848
-
2849
- const startedAt = timestamps[tail];
2850
-
2851
- if (!firstSampleTS) {
2852
- firstSampleTS = now;
2853
- }
2854
-
2855
- bytes[head] = chunkLength;
2856
- timestamps[head] = now;
2857
-
2858
- let i = tail;
2859
- let bytesCount = 0;
2860
-
2861
- while (i !== head) {
2862
- bytesCount += bytes[i++];
2863
- i = i % samplesCount;
2864
- }
2865
-
2866
- head = (head + 1) % samplesCount;
2867
-
2868
- if (head === tail) {
2869
- tail = (tail + 1) % samplesCount;
2870
- }
2871
-
2872
- if (now - firstSampleTS < min) {
2873
- return;
2874
- }
2875
-
2876
- const passed = startedAt && now - startedAt;
2877
-
2878
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2879
- };
2880
- }
2881
-
2882
- function progressEventReducer(listener, isDownloadStream) {
2883
- let bytesNotified = 0;
2884
- const _speedometer = speedometer(50, 250);
2885
-
2886
- return e => {
2887
- const loaded = e.loaded;
2888
- const total = e.lengthComputable ? e.total : undefined;
2889
- const progressBytes = loaded - bytesNotified;
2890
- const rate = _speedometer(progressBytes);
2891
- const inRange = loaded <= total;
2892
-
2893
- bytesNotified = loaded;
2894
-
2895
- const data = {
2896
- loaded,
2897
- total,
2898
- progress: total ? (loaded / total) : undefined,
2899
- bytes: progressBytes,
2900
- rate: rate ? rate : undefined,
2901
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2902
- event: e
2903
- };
2904
-
2905
- data[isDownloadStream ? 'download' : 'upload'] = true;
2906
-
2907
- listener(data);
2908
- };
2909
- }
2910
-
2911
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2912
-
2913
- var xhrAdapter = isXHRAdapterSupported && function (config) {
2914
- return new Promise(function dispatchXhrRequest(resolve, reject) {
2915
- let requestData = config.data;
2916
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
2917
- const responseType = config.responseType;
2918
- let onCanceled;
2919
- function done() {
2920
- if (config.cancelToken) {
2921
- config.cancelToken.unsubscribe(onCanceled);
2922
- }
2923
-
2924
- if (config.signal) {
2925
- config.signal.removeEventListener('abort', onCanceled);
2926
- }
2927
- }
2928
-
2929
- if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
2930
- requestHeaders.setContentType(false); // Let the browser set it
2931
- }
2932
-
2933
- let request = new XMLHttpRequest();
2934
-
2935
- // HTTP basic authentication
2936
- if (config.auth) {
2937
- const username = config.auth.username || '';
2938
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2939
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2940
- }
2941
-
2942
- const fullPath = buildFullPath(config.baseURL, config.url);
2943
-
2944
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2945
-
2946
- // Set the request timeout in MS
2947
- request.timeout = config.timeout;
2948
-
2949
- function onloadend() {
2950
- if (!request) {
2951
- return;
2952
- }
2953
- // Prepare the response
2954
- const responseHeaders = AxiosHeaders$1.from(
2955
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2956
- );
2957
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2958
- request.responseText : request.response;
2959
- const response = {
2960
- data: responseData,
2961
- status: request.status,
2962
- statusText: request.statusText,
2963
- headers: responseHeaders,
2964
- config,
2965
- request
2966
- };
2967
-
2968
- settle(function _resolve(value) {
2969
- resolve(value);
2970
- done();
2971
- }, function _reject(err) {
2972
- reject(err);
2973
- done();
2974
- }, response);
2975
-
2976
- // Clean up request
2977
- request = null;
2978
- }
2979
-
2980
- if ('onloadend' in request) {
2981
- // Use onloadend if available
2982
- request.onloadend = onloadend;
2983
- } else {
2984
- // Listen for ready state to emulate onloadend
2985
- request.onreadystatechange = function handleLoad() {
2986
- if (!request || request.readyState !== 4) {
2987
- return;
2988
- }
2989
-
2990
- // The request errored out and we didn't get a response, this will be
2991
- // handled by onerror instead
2992
- // With one exception: request that using file: protocol, most browsers
2993
- // will return status as 0 even though it's a successful request
2994
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2995
- return;
2996
- }
2997
- // readystate handler is calling before onerror or ontimeout handlers,
2998
- // so we should call onloadend on the next 'tick'
2999
- setTimeout(onloadend);
3000
- };
3001
- }
3002
-
3003
- // Handle browser request cancellation (as opposed to a manual cancellation)
3004
- request.onabort = function handleAbort() {
3005
- if (!request) {
3006
- return;
3007
- }
3008
-
3009
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
3010
-
3011
- // Clean up request
3012
- request = null;
3013
- };
3014
-
3015
- // Handle low level network errors
3016
- request.onerror = function handleError() {
3017
- // Real errors are hidden from us by the browser
3018
- // onerror should only fire if it's a network error
3019
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
3020
-
3021
- // Clean up request
3022
- request = null;
3023
- };
3024
-
3025
- // Handle timeout
3026
- request.ontimeout = function handleTimeout() {
3027
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3028
- const transitional = config.transitional || transitionalDefaults;
3029
- if (config.timeoutErrorMessage) {
3030
- timeoutErrorMessage = config.timeoutErrorMessage;
3031
- }
3032
- reject(new AxiosError(
3033
- timeoutErrorMessage,
3034
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
3035
- config,
3036
- request));
3037
-
3038
- // Clean up request
3039
- request = null;
3040
- };
3041
-
3042
- // Add xsrf header
3043
- // This is only done if running in a standard browser environment.
3044
- // Specifically not if we're in a web worker, or react-native.
3045
- if (platform.isStandardBrowserEnv) {
3046
- // Add xsrf header
3047
- const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
3048
- && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
3049
-
3050
- if (xsrfValue) {
3051
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
3052
- }
3053
- }
3054
-
3055
- // Remove Content-Type if data is undefined
3056
- requestData === undefined && requestHeaders.setContentType(null);
3057
-
3058
- // Add headers to the request
3059
- if ('setRequestHeader' in request) {
3060
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3061
- request.setRequestHeader(key, val);
3062
- });
3063
- }
3064
-
3065
- // Add withCredentials to request if needed
3066
- if (!utils.isUndefined(config.withCredentials)) {
3067
- request.withCredentials = !!config.withCredentials;
3068
- }
3069
-
3070
- // Add responseType to request if needed
3071
- if (responseType && responseType !== 'json') {
3072
- request.responseType = config.responseType;
3073
- }
3074
-
3075
- // Handle progress if needed
3076
- if (typeof config.onDownloadProgress === 'function') {
3077
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
3078
- }
3079
-
3080
- // Not all browsers support upload events
3081
- if (typeof config.onUploadProgress === 'function' && request.upload) {
3082
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
3083
- }
3084
-
3085
- if (config.cancelToken || config.signal) {
3086
- // Handle cancellation
3087
- // eslint-disable-next-line func-names
3088
- onCanceled = cancel => {
3089
- if (!request) {
3090
- return;
3091
- }
3092
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3093
- request.abort();
3094
- request = null;
3095
- };
3096
-
3097
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
3098
- if (config.signal) {
3099
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
3100
- }
3101
- }
3102
-
3103
- const protocol = parseProtocol(fullPath);
3104
-
3105
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3106
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3107
- return;
3108
- }
3109
-
3110
-
3111
- // Send the request
3112
- request.send(requestData || null);
3113
- });
3114
- };
3115
-
3116
- const knownAdapters = {
3117
- http: httpAdapter,
3118
- xhr: xhrAdapter
3119
- };
3120
-
3121
- utils.forEach(knownAdapters, (fn, value) => {
3122
- if(fn) {
3123
- try {
3124
- Object.defineProperty(fn, 'name', {value});
3125
- } catch (e) {
3126
- // eslint-disable-next-line no-empty
3127
- }
3128
- Object.defineProperty(fn, 'adapterName', {value});
3129
- }
3130
- });
3131
-
3132
- var adapters = {
3133
- getAdapter: (adapters) => {
3134
- adapters = utils.isArray(adapters) ? adapters : [adapters];
3135
-
3136
- const {length} = adapters;
3137
- let nameOrAdapter;
3138
- let adapter;
3139
-
3140
- for (let i = 0; i < length; i++) {
3141
- nameOrAdapter = adapters[i];
3142
- if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
3143
- break;
3144
- }
3145
- }
3146
-
3147
- if (!adapter) {
3148
- if (adapter === false) {
3149
- throw new AxiosError(
3150
- `Adapter ${nameOrAdapter} is not supported by the environment`,
3151
- 'ERR_NOT_SUPPORT'
3152
- );
3153
- }
3154
-
3155
- throw new Error(
3156
- utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
3157
- `Adapter '${nameOrAdapter}' is not available in the build` :
3158
- `Unknown adapter '${nameOrAdapter}'`
3159
- );
3160
- }
3161
-
3162
- if (!utils.isFunction(adapter)) {
3163
- throw new TypeError('adapter is not a function');
3164
- }
3165
-
3166
- return adapter;
3167
- },
3168
- adapters: knownAdapters
3169
- };
3170
-
3171
- /**
3172
- * Throws a `CanceledError` if cancellation has been requested.
3173
- *
3174
- * @param {Object} config The config that is to be used for the request
3175
- *
3176
- * @returns {void}
3177
- */
3178
- function throwIfCancellationRequested(config) {
3179
- if (config.cancelToken) {
3180
- config.cancelToken.throwIfRequested();
3181
- }
3182
-
3183
- if (config.signal && config.signal.aborted) {
3184
- throw new CanceledError(null, config);
3185
- }
3186
- }
3187
-
3188
- /**
3189
- * Dispatch a request to the server using the configured adapter.
3190
- *
3191
- * @param {object} config The config that is to be used for the request
3192
- *
3193
- * @returns {Promise} The Promise to be fulfilled
3194
- */
3195
- function dispatchRequest(config) {
3196
- throwIfCancellationRequested(config);
3197
-
3198
- config.headers = AxiosHeaders$1.from(config.headers);
3199
-
3200
- // Transform request data
3201
- config.data = transformData.call(
3202
- config,
3203
- config.transformRequest
3204
- );
3205
-
3206
- if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3207
- config.headers.setContentType('application/x-www-form-urlencoded', false);
3208
- }
3209
-
3210
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
3211
-
3212
- return adapter(config).then(function onAdapterResolution(response) {
3213
- throwIfCancellationRequested(config);
3214
-
3215
- // Transform response data
3216
- response.data = transformData.call(
3217
- config,
3218
- config.transformResponse,
3219
- response
3220
- );
3221
-
3222
- response.headers = AxiosHeaders$1.from(response.headers);
3223
-
3224
- return response;
3225
- }, function onAdapterRejection(reason) {
3226
- if (!isCancel(reason)) {
3227
- throwIfCancellationRequested(config);
3228
-
3229
- // Transform response data
3230
- if (reason && reason.response) {
3231
- reason.response.data = transformData.call(
3232
- config,
3233
- config.transformResponse,
3234
- reason.response
3235
- );
3236
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3237
- }
3238
- }
3239
-
3240
- return Promise.reject(reason);
3241
- });
3242
- }
3243
-
3244
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
3245
-
3246
- /**
3247
- * Config-specific merge-function which creates a new config-object
3248
- * by merging two configuration objects together.
3249
- *
3250
- * @param {Object} config1
3251
- * @param {Object} config2
3252
- *
3253
- * @returns {Object} New object resulting from merging config2 to config1
3254
- */
3255
- function mergeConfig(config1, config2) {
3256
- // eslint-disable-next-line no-param-reassign
3257
- config2 = config2 || {};
3258
- const config = {};
3259
-
3260
- function getMergedValue(target, source, caseless) {
3261
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
3262
- return utils.merge.call({caseless}, target, source);
3263
- } else if (utils.isPlainObject(source)) {
3264
- return utils.merge({}, source);
3265
- } else if (utils.isArray(source)) {
3266
- return source.slice();
3267
- }
3268
- return source;
3269
- }
3270
-
3271
- // eslint-disable-next-line consistent-return
3272
- function mergeDeepProperties(a, b, caseless) {
3273
- if (!utils.isUndefined(b)) {
3274
- return getMergedValue(a, b, caseless);
3275
- } else if (!utils.isUndefined(a)) {
3276
- return getMergedValue(undefined, a, caseless);
3277
- }
3278
- }
3279
-
3280
- // eslint-disable-next-line consistent-return
3281
- function valueFromConfig2(a, b) {
3282
- if (!utils.isUndefined(b)) {
3283
- return getMergedValue(undefined, b);
3284
- }
3285
- }
3286
-
3287
- // eslint-disable-next-line consistent-return
3288
- function defaultToConfig2(a, b) {
3289
- if (!utils.isUndefined(b)) {
3290
- return getMergedValue(undefined, b);
3291
- } else if (!utils.isUndefined(a)) {
3292
- return getMergedValue(undefined, a);
3293
- }
3294
- }
3295
-
3296
- // eslint-disable-next-line consistent-return
3297
- function mergeDirectKeys(a, b, prop) {
3298
- if (prop in config2) {
3299
- return getMergedValue(a, b);
3300
- } else if (prop in config1) {
3301
- return getMergedValue(undefined, a);
3302
- }
3303
- }
3304
-
3305
- const mergeMap = {
3306
- url: valueFromConfig2,
3307
- method: valueFromConfig2,
3308
- data: valueFromConfig2,
3309
- baseURL: defaultToConfig2,
3310
- transformRequest: defaultToConfig2,
3311
- transformResponse: defaultToConfig2,
3312
- paramsSerializer: defaultToConfig2,
3313
- timeout: defaultToConfig2,
3314
- timeoutMessage: defaultToConfig2,
3315
- withCredentials: defaultToConfig2,
3316
- adapter: defaultToConfig2,
3317
- responseType: defaultToConfig2,
3318
- xsrfCookieName: defaultToConfig2,
3319
- xsrfHeaderName: defaultToConfig2,
3320
- onUploadProgress: defaultToConfig2,
3321
- onDownloadProgress: defaultToConfig2,
3322
- decompress: defaultToConfig2,
3323
- maxContentLength: defaultToConfig2,
3324
- maxBodyLength: defaultToConfig2,
3325
- beforeRedirect: defaultToConfig2,
3326
- transport: defaultToConfig2,
3327
- httpAgent: defaultToConfig2,
3328
- httpsAgent: defaultToConfig2,
3329
- cancelToken: defaultToConfig2,
3330
- socketPath: defaultToConfig2,
3331
- responseEncoding: defaultToConfig2,
3332
- validateStatus: mergeDirectKeys,
3333
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
3334
- };
3335
-
3336
- utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
3337
- const merge = mergeMap[prop] || mergeDeepProperties;
3338
- const configValue = merge(config1[prop], config2[prop], prop);
3339
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
3340
- });
3341
-
3342
- return config;
3343
- }
3344
-
3345
- const VERSION = "1.2.2";
3346
-
3347
- const validators$1 = {};
3348
-
3349
- // eslint-disable-next-line func-names
3350
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
3351
- validators$1[type] = function validator(thing) {
3352
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
3353
- };
3354
- });
3355
-
3356
- const deprecatedWarnings = {};
3357
-
3358
- /**
3359
- * Transitional option validator
3360
- *
3361
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
3362
- * @param {string?} version - deprecated version / removed since version
3363
- * @param {string?} message - some message with additional info
3364
- *
3365
- * @returns {function}
3366
- */
3367
- validators$1.transitional = function transitional(validator, version, message) {
3368
- function formatMessage(opt, desc) {
3369
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3370
- }
3371
-
3372
- // eslint-disable-next-line func-names
3373
- return (value, opt, opts) => {
3374
- if (validator === false) {
3375
- throw new AxiosError(
3376
- formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
3377
- AxiosError.ERR_DEPRECATED
3378
- );
3379
- }
3380
-
3381
- if (version && !deprecatedWarnings[opt]) {
3382
- deprecatedWarnings[opt] = true;
3383
- // eslint-disable-next-line no-console
3384
- console.warn(
3385
- formatMessage(
3386
- opt,
3387
- ' has been deprecated since v' + version + ' and will be removed in the near future'
3388
- )
3389
- );
3390
- }
3391
-
3392
- return validator ? validator(value, opt, opts) : true;
3393
- };
3394
- };
3395
-
3396
- /**
3397
- * Assert object's properties type
3398
- *
3399
- * @param {object} options
3400
- * @param {object} schema
3401
- * @param {boolean?} allowUnknown
3402
- *
3403
- * @returns {object}
3404
- */
3405
-
3406
- function assertOptions(options, schema, allowUnknown) {
3407
- if (typeof options !== 'object') {
3408
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
3409
- }
3410
- const keys = Object.keys(options);
3411
- let i = keys.length;
3412
- while (i-- > 0) {
3413
- const opt = keys[i];
3414
- const validator = schema[opt];
3415
- if (validator) {
3416
- const value = options[opt];
3417
- const result = value === undefined || validator(value, opt, options);
3418
- if (result !== true) {
3419
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
3420
- }
3421
- continue;
3422
- }
3423
- if (allowUnknown !== true) {
3424
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
3425
- }
3426
- }
3427
- }
3428
-
3429
- var validator = {
3430
- assertOptions,
3431
- validators: validators$1
3432
- };
3433
-
3434
- const validators = validator.validators;
3435
-
3436
- /**
3437
- * Create a new instance of Axios
3438
- *
3439
- * @param {Object} instanceConfig The default config for the instance
3440
- *
3441
- * @return {Axios} A new instance of Axios
3442
- */
3443
- class Axios {
3444
- constructor(instanceConfig) {
3445
- this.defaults = instanceConfig;
3446
- this.interceptors = {
3447
- request: new InterceptorManager$1(),
3448
- response: new InterceptorManager$1()
3449
- };
3450
- }
3451
-
3452
- /**
3453
- * Dispatch a request
3454
- *
3455
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3456
- * @param {?Object} config
3457
- *
3458
- * @returns {Promise} The Promise to be fulfilled
3459
- */
3460
- request(configOrUrl, config) {
3461
- /*eslint no-param-reassign:0*/
3462
- // Allow for axios('example/url'[, config]) a la fetch API
3463
- if (typeof configOrUrl === 'string') {
3464
- config = config || {};
3465
- config.url = configOrUrl;
3466
- } else {
3467
- config = configOrUrl || {};
3468
- }
3469
-
3470
- config = mergeConfig(this.defaults, config);
3471
-
3472
- const {transitional, paramsSerializer, headers} = config;
3473
-
3474
- if (transitional !== undefined) {
3475
- validator.assertOptions(transitional, {
3476
- silentJSONParsing: validators.transitional(validators.boolean),
3477
- forcedJSONParsing: validators.transitional(validators.boolean),
3478
- clarifyTimeoutError: validators.transitional(validators.boolean)
3479
- }, false);
3480
- }
3481
-
3482
- if (paramsSerializer !== undefined) {
3483
- validator.assertOptions(paramsSerializer, {
3484
- encode: validators.function,
3485
- serialize: validators.function
3486
- }, true);
3487
- }
3488
-
3489
- // Set config.method
3490
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3491
-
3492
- let contextHeaders;
3493
-
3494
- // Flatten headers
3495
- contextHeaders = headers && utils.merge(
3496
- headers.common,
3497
- headers[config.method]
3498
- );
3499
-
3500
- contextHeaders && utils.forEach(
3501
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
3502
- (method) => {
3503
- delete headers[method];
3504
- }
3505
- );
3506
-
3507
- config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3508
-
3509
- // filter out skipped interceptors
3510
- const requestInterceptorChain = [];
3511
- let synchronousRequestInterceptors = true;
3512
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3513
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3514
- return;
3515
- }
3516
-
3517
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3518
-
3519
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3520
- });
3521
-
3522
- const responseInterceptorChain = [];
3523
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3524
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3525
- });
3526
-
3527
- let promise;
3528
- let i = 0;
3529
- let len;
3530
-
3531
- if (!synchronousRequestInterceptors) {
3532
- const chain = [dispatchRequest.bind(this), undefined];
3533
- chain.unshift.apply(chain, requestInterceptorChain);
3534
- chain.push.apply(chain, responseInterceptorChain);
3535
- len = chain.length;
3536
-
3537
- promise = Promise.resolve(config);
3538
-
3539
- while (i < len) {
3540
- promise = promise.then(chain[i++], chain[i++]);
3541
- }
3542
-
3543
- return promise;
3544
- }
3545
-
3546
- len = requestInterceptorChain.length;
3547
-
3548
- let newConfig = config;
3549
-
3550
- i = 0;
3551
-
3552
- while (i < len) {
3553
- const onFulfilled = requestInterceptorChain[i++];
3554
- const onRejected = requestInterceptorChain[i++];
3555
- try {
3556
- newConfig = onFulfilled(newConfig);
3557
- } catch (error) {
3558
- onRejected.call(this, error);
3559
- break;
3560
- }
3561
- }
3562
-
3563
- try {
3564
- promise = dispatchRequest.call(this, newConfig);
3565
- } catch (error) {
3566
- return Promise.reject(error);
3567
- }
3568
-
3569
- i = 0;
3570
- len = responseInterceptorChain.length;
3571
-
3572
- while (i < len) {
3573
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3574
- }
3575
-
3576
- return promise;
3577
- }
3578
-
3579
- getUri(config) {
3580
- config = mergeConfig(this.defaults, config);
3581
- const fullPath = buildFullPath(config.baseURL, config.url);
3582
- return buildURL(fullPath, config.params, config.paramsSerializer);
3583
- }
3584
- }
3585
-
3586
- // Provide aliases for supported request methods
3587
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3588
- /*eslint func-names:0*/
3589
- Axios.prototype[method] = function(url, config) {
3590
- return this.request(mergeConfig(config || {}, {
3591
- method,
3592
- url,
3593
- data: (config || {}).data
3594
- }));
3595
- };
3596
- });
3597
-
3598
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3599
- /*eslint func-names:0*/
3600
-
3601
- function generateHTTPMethod(isForm) {
3602
- return function httpMethod(url, data, config) {
3603
- return this.request(mergeConfig(config || {}, {
3604
- method,
3605
- headers: isForm ? {
3606
- 'Content-Type': 'multipart/form-data'
3607
- } : {},
3608
- url,
3609
- data
3610
- }));
3611
- };
3612
- }
3613
-
3614
- Axios.prototype[method] = generateHTTPMethod();
3615
-
3616
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
3617
- });
3618
-
3619
- var Axios$1 = Axios;
3620
-
3621
- /**
3622
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
3623
- *
3624
- * @param {Function} executor The executor function.
3625
- *
3626
- * @returns {CancelToken}
3627
- */
3628
- class CancelToken {
3629
- constructor(executor) {
3630
- if (typeof executor !== 'function') {
3631
- throw new TypeError('executor must be a function.');
3632
- }
3633
-
3634
- let resolvePromise;
3635
-
3636
- this.promise = new Promise(function promiseExecutor(resolve) {
3637
- resolvePromise = resolve;
3638
- });
3639
-
3640
- const token = this;
3641
-
3642
- // eslint-disable-next-line func-names
3643
- this.promise.then(cancel => {
3644
- if (!token._listeners) return;
3645
-
3646
- let i = token._listeners.length;
3647
-
3648
- while (i-- > 0) {
3649
- token._listeners[i](cancel);
3650
- }
3651
- token._listeners = null;
3652
- });
3653
-
3654
- // eslint-disable-next-line func-names
3655
- this.promise.then = onfulfilled => {
3656
- let _resolve;
3657
- // eslint-disable-next-line func-names
3658
- const promise = new Promise(resolve => {
3659
- token.subscribe(resolve);
3660
- _resolve = resolve;
3661
- }).then(onfulfilled);
3662
-
3663
- promise.cancel = function reject() {
3664
- token.unsubscribe(_resolve);
3665
- };
3666
-
3667
- return promise;
3668
- };
3669
-
3670
- executor(function cancel(message, config, request) {
3671
- if (token.reason) {
3672
- // Cancellation has already been requested
3673
- return;
3674
- }
3675
-
3676
- token.reason = new CanceledError(message, config, request);
3677
- resolvePromise(token.reason);
3678
- });
3679
- }
3680
-
3681
- /**
3682
- * Throws a `CanceledError` if cancellation has been requested.
3683
- */
3684
- throwIfRequested() {
3685
- if (this.reason) {
3686
- throw this.reason;
3687
- }
3688
- }
3689
-
3690
- /**
3691
- * Subscribe to the cancel signal
3692
- */
3693
-
3694
- subscribe(listener) {
3695
- if (this.reason) {
3696
- listener(this.reason);
3697
- return;
3698
- }
3699
-
3700
- if (this._listeners) {
3701
- this._listeners.push(listener);
3702
- } else {
3703
- this._listeners = [listener];
3704
- }
3705
- }
3706
-
3707
- /**
3708
- * Unsubscribe from the cancel signal
3709
- */
3710
-
3711
- unsubscribe(listener) {
3712
- if (!this._listeners) {
3713
- return;
3714
- }
3715
- const index = this._listeners.indexOf(listener);
3716
- if (index !== -1) {
3717
- this._listeners.splice(index, 1);
3718
- }
3719
- }
3720
-
3721
- /**
3722
- * Returns an object that contains a new `CancelToken` and a function that, when called,
3723
- * cancels the `CancelToken`.
3724
- */
3725
- static source() {
3726
- let cancel;
3727
- const token = new CancelToken(function executor(c) {
3728
- cancel = c;
3729
- });
3730
- return {
3731
- token,
3732
- cancel
3733
- };
3734
- }
3735
- }
3736
-
3737
- var CancelToken$1 = CancelToken;
3738
-
3739
- /**
3740
- * Syntactic sugar for invoking a function and expanding an array for arguments.
3741
- *
3742
- * Common use case would be to use `Function.prototype.apply`.
3743
- *
3744
- * ```js
3745
- * function f(x, y, z) {}
3746
- * var args = [1, 2, 3];
3747
- * f.apply(null, args);
3748
- * ```
3749
- *
3750
- * With `spread` this example can be re-written.
3751
- *
3752
- * ```js
3753
- * spread(function(x, y, z) {})([1, 2, 3]);
3754
- * ```
3755
- *
3756
- * @param {Function} callback
3757
- *
3758
- * @returns {Function}
3759
- */
3760
- function spread(callback) {
3761
- return function wrap(arr) {
3762
- return callback.apply(null, arr);
3763
- };
3764
- }
3765
-
3766
- /**
3767
- * Determines whether the payload is an error thrown by Axios
3768
- *
3769
- * @param {*} payload The value to test
3770
- *
3771
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3772
- */
3773
- function isAxiosError(payload) {
3774
- return utils.isObject(payload) && (payload.isAxiosError === true);
3775
- }
3776
-
3777
- const HttpStatusCode = {
3778
- Continue: 100,
3779
- SwitchingProtocols: 101,
3780
- Processing: 102,
3781
- EarlyHints: 103,
3782
- Ok: 200,
3783
- Created: 201,
3784
- Accepted: 202,
3785
- NonAuthoritativeInformation: 203,
3786
- NoContent: 204,
3787
- ResetContent: 205,
3788
- PartialContent: 206,
3789
- MultiStatus: 207,
3790
- AlreadyReported: 208,
3791
- ImUsed: 226,
3792
- MultipleChoices: 300,
3793
- MovedPermanently: 301,
3794
- Found: 302,
3795
- SeeOther: 303,
3796
- NotModified: 304,
3797
- UseProxy: 305,
3798
- Unused: 306,
3799
- TemporaryRedirect: 307,
3800
- PermanentRedirect: 308,
3801
- BadRequest: 400,
3802
- Unauthorized: 401,
3803
- PaymentRequired: 402,
3804
- Forbidden: 403,
3805
- NotFound: 404,
3806
- MethodNotAllowed: 405,
3807
- NotAcceptable: 406,
3808
- ProxyAuthenticationRequired: 407,
3809
- RequestTimeout: 408,
3810
- Conflict: 409,
3811
- Gone: 410,
3812
- LengthRequired: 411,
3813
- PreconditionFailed: 412,
3814
- PayloadTooLarge: 413,
3815
- UriTooLong: 414,
3816
- UnsupportedMediaType: 415,
3817
- RangeNotSatisfiable: 416,
3818
- ExpectationFailed: 417,
3819
- ImATeapot: 418,
3820
- MisdirectedRequest: 421,
3821
- UnprocessableEntity: 422,
3822
- Locked: 423,
3823
- FailedDependency: 424,
3824
- TooEarly: 425,
3825
- UpgradeRequired: 426,
3826
- PreconditionRequired: 428,
3827
- TooManyRequests: 429,
3828
- RequestHeaderFieldsTooLarge: 431,
3829
- UnavailableForLegalReasons: 451,
3830
- InternalServerError: 500,
3831
- NotImplemented: 501,
3832
- BadGateway: 502,
3833
- ServiceUnavailable: 503,
3834
- GatewayTimeout: 504,
3835
- HttpVersionNotSupported: 505,
3836
- VariantAlsoNegotiates: 506,
3837
- InsufficientStorage: 507,
3838
- LoopDetected: 508,
3839
- NotExtended: 510,
3840
- NetworkAuthenticationRequired: 511,
3841
- };
3842
-
3843
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
3844
- HttpStatusCode[value] = key;
3845
- });
3846
-
3847
- var HttpStatusCode$1 = HttpStatusCode;
3848
-
3849
- /**
3850
- * Create an instance of Axios
3851
- *
3852
- * @param {Object} defaultConfig The default config for the instance
3853
- *
3854
- * @returns {Axios} A new instance of Axios
3855
- */
3856
- function createInstance(defaultConfig) {
3857
- const context = new Axios$1(defaultConfig);
3858
- const instance = bind(Axios$1.prototype.request, context);
3859
-
3860
- // Copy axios.prototype to instance
3861
- utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
3862
-
3863
- // Copy context to instance
3864
- utils.extend(instance, context, null, {allOwnKeys: true});
3865
-
3866
- // Factory for creating new instances
3867
- instance.create = function create(instanceConfig) {
3868
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
3869
- };
3870
-
3871
- return instance;
3872
- }
3873
-
3874
- // Create the default instance to be exported
3875
- const axios = createInstance(defaults$1);
3876
-
3877
- // Expose Axios class to allow class inheritance
3878
- axios.Axios = Axios$1;
3879
-
3880
- // Expose Cancel & CancelToken
3881
- axios.CanceledError = CanceledError;
3882
- axios.CancelToken = CancelToken$1;
3883
- axios.isCancel = isCancel;
3884
- axios.VERSION = VERSION;
3885
- axios.toFormData = toFormData;
3886
-
3887
- // Expose AxiosError class
3888
- axios.AxiosError = AxiosError;
3889
-
3890
- // alias for CanceledError for backward compatibility
3891
- axios.Cancel = axios.CanceledError;
3892
-
3893
- // Expose all/spread
3894
- axios.all = function all(promises) {
3895
- return Promise.all(promises);
3896
- };
3897
-
3898
- axios.spread = spread;
3899
-
3900
- // Expose isAxiosError
3901
- axios.isAxiosError = isAxiosError;
3902
-
3903
- // Expose mergeConfig
3904
- axios.mergeConfig = mergeConfig;
3905
-
3906
- axios.AxiosHeaders = AxiosHeaders$1;
3907
-
3908
- axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
3909
-
3910
- axios.HttpStatusCode = HttpStatusCode$1;
3911
-
3912
- axios.default = axios;
3913
-
3914
- module.exports = axios;
3915
- //# sourceMappingURL=axios.cjs.map
3916
-
3917
-
3918
- /***/ })
3919
-
3920
- /******/ });
3921
- /************************************************************************/
3922
- /******/ // The module cache
3923
- /******/ var __webpack_module_cache__ = {};
3924
- /******/
3925
- /******/ // The require function
3926
- /******/ function __webpack_require__(moduleId) {
3927
- /******/ // Check if module is in cache
3928
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
3929
- /******/ if (cachedModule !== undefined) {
3930
- /******/ return cachedModule.exports;
3931
- /******/ }
3932
- /******/ // Create a new module (and put it into the cache)
3933
- /******/ var module = __webpack_module_cache__[moduleId] = {
3934
- /******/ // no module.id needed
3935
- /******/ // no module.loaded needed
3936
- /******/ exports: {}
3937
- /******/ };
3938
- /******/
3939
- /******/ // Execute the module function
3940
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
3941
- /******/
3942
- /******/ // Return the exports of the module
3943
- /******/ return module.exports;
3944
- /******/ }
3945
- /******/
3946
- /************************************************************************/
3947
- /******/ /* webpack/runtime/global */
3948
- /******/ (() => {
3949
- /******/ __webpack_require__.g = (function() {
3950
- /******/ if (typeof globalThis === 'object') return globalThis;
3951
- /******/ try {
3952
- /******/ return this || new Function('return this')();
3953
- /******/ } catch (e) {
3954
- /******/ if (typeof window === 'object') return window;
3955
- /******/ }
3956
- /******/ })();
3957
- /******/ })();
3958
- /******/
3959
- /************************************************************************/
3960
- var __webpack_exports__ = {};
3961
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
3962
- (() => {
3963
- /*!*******************************!*\
3964
- !*** ./frontend/src/index.js ***!
3965
- \*******************************/
3966
-
3967
-
3968
- const app = Vue.createApp({
3969
- template: '<app-component />'
3970
- });
3971
-
3972
- __webpack_require__(/*! ./async-button/async-button */ "./frontend/src/async-button/async-button.js")(app);
3973
- __webpack_require__(/*! ./detail-array/detail-array */ "./frontend/src/detail-array/detail-array.js")(app);
3974
- __webpack_require__(/*! ./detail-default/detail-default */ "./frontend/src/detail-default/detail-default.js")(app);
3975
- __webpack_require__(/*! ./document/document */ "./frontend/src/document/document.js")(app);
3976
- __webpack_require__(/*! ./edit-default/edit-default */ "./frontend/src/edit-default/edit-default.js")(app);
3977
- __webpack_require__(/*! ./export-query-results/export-query-results */ "./frontend/src/export-query-results/export-query-results.js")(app);
3978
- __webpack_require__(/*! ./list-array/list-array */ "./frontend/src/list-array/list-array.js")(app);
3979
- __webpack_require__(/*! ./list-default/list-default */ "./frontend/src/list-default/list-default.js")(app);
3980
- __webpack_require__(/*! ./list-subdocument/list-subdocument */ "./frontend/src/list-subdocument/list-subdocument.js")(app);
3981
- __webpack_require__(/*! ./modal/modal */ "./frontend/src/modal/modal.js")(app);
3982
- __webpack_require__(/*! ./models/models */ "./frontend/src/models/models.js")(app);
3983
- __webpack_require__(/*! ./navbar/navbar */ "./frontend/src/navbar/navbar.js")(app);
3984
-
3985
- app.component('app-component', {
3986
- template: `
3987
- <div>
3988
- <navbar />
3989
- <div class="view">
3990
- <router-view :key="$route.fullPath" />
3991
- </div>
3992
- </div>
3993
- `
3994
- });
3995
-
3996
- const routes = __webpack_require__(/*! ./routes */ "./frontend/src/routes.js");
3997
- const router = VueRouter.createRouter({
3998
- history: VueRouter.createWebHashHistory(),
3999
- routes: routes.map(route => ({
4000
- ...route,
4001
- component: app.component(route.component),
4002
- props: (route) => route.params
4003
- }))
4004
- });
4005
-
4006
- app.use(router);
4007
-
4008
- app.mount('#content');
4009
- })();
4010
-
4011
- /******/ })()
4012
- ;