druware-components 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +9 -0
- package/animated-count/animated-count.vue +102 -0
- package/animated-count/index.js +5 -0
- package/api/base.js +133 -0
- package/api/index.js +5 -0
- package/article-view/article-view.vue +146 -0
- package/article-view/index.js +4 -0
- package/content/content.js +10 -0
- package/content/index.js +4 -0
- package/dist/druware-components.css +26 -0
- package/dist/druware-components.js +4164 -0
- package/dist/druware-components.mjs +4164 -0
- package/dist/druware-components.umd.js +4167 -0
- package/index.js +5 -0
- package/package.json +24 -0
- package/vite.config.js +25 -0
|
@@ -0,0 +1,4167 @@
|
|
|
1
|
+
(function(global2, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["druware-components"] = {}, global2.Vue));
|
|
3
|
+
})(this, (function(exports2, vue) {
|
|
4
|
+
"use strict";
|
|
5
|
+
const _export_sfc = (sfc, props) => {
|
|
6
|
+
const target = sfc.__vccOpts || sfc;
|
|
7
|
+
for (const [key, val] of props) {
|
|
8
|
+
target[key] = val;
|
|
9
|
+
}
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
const _sfc_main$1 = {
|
|
13
|
+
data: function() {
|
|
14
|
+
return {
|
|
15
|
+
currentCount: 0
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
icon: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: null
|
|
22
|
+
},
|
|
23
|
+
iconFamily: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "fa"
|
|
26
|
+
},
|
|
27
|
+
count: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 0
|
|
30
|
+
},
|
|
31
|
+
label: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: null
|
|
34
|
+
},
|
|
35
|
+
iconStyle: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "has-text-info"
|
|
38
|
+
},
|
|
39
|
+
card: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
computed: {
|
|
45
|
+
cardClass() {
|
|
46
|
+
return (this.card ? "card " : "") + "animated-count";
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
async setCount(value) {
|
|
51
|
+
var increment = Math.round(value / 10);
|
|
52
|
+
while (this.currentCount < value) {
|
|
53
|
+
this.currentCount += increment;
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
55
|
+
}
|
|
56
|
+
this.currentCount = value;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
watch: {
|
|
60
|
+
count(to, from) {
|
|
61
|
+
if (to === from) return;
|
|
62
|
+
this.setCount(to);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
mounted() {
|
|
67
|
+
this.setCount(this.count);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const _hoisted_1$1 = {
|
|
71
|
+
key: 0,
|
|
72
|
+
class: "icon-badge"
|
|
73
|
+
};
|
|
74
|
+
const _hoisted_2$1 = { class: "count" };
|
|
75
|
+
const _hoisted_3$1 = { class: "label" };
|
|
76
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
77
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
78
|
+
class: vue.normalizeClass($options.cardClass)
|
|
79
|
+
}, [
|
|
80
|
+
$props.icon != null ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
|
|
81
|
+
vue.createElementVNode("span", {
|
|
82
|
+
class: vue.normalizeClass("icon is-large " + $props.iconStyle)
|
|
83
|
+
}, [
|
|
84
|
+
vue.createElementVNode("i", {
|
|
85
|
+
class: vue.normalizeClass($props.iconFamily + " " + $props.icon),
|
|
86
|
+
"aria-hidden": "true"
|
|
87
|
+
}, null, 2)
|
|
88
|
+
], 2)
|
|
89
|
+
])) : vue.createCommentVNode("", true),
|
|
90
|
+
vue.createElementVNode("div", _hoisted_2$1, vue.toDisplayString(_ctx.currentCount), 1),
|
|
91
|
+
vue.createElementVNode("div", _hoisted_3$1, vue.toDisplayString($props.label), 1)
|
|
92
|
+
], 2);
|
|
93
|
+
}
|
|
94
|
+
const AnimatedCount = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-0827a913"]]);
|
|
95
|
+
const isBrowser = typeof document !== "undefined";
|
|
96
|
+
const noop$1 = () => {
|
|
97
|
+
};
|
|
98
|
+
const isArray$1 = Array.isArray;
|
|
99
|
+
function warn$1(msg) {
|
|
100
|
+
const args = Array.from(arguments).slice(1);
|
|
101
|
+
console.warn.apply(console, ["[Vue Router warn]: " + msg].concat(args));
|
|
102
|
+
}
|
|
103
|
+
function isSameRouteRecord(a, b2) {
|
|
104
|
+
return (a.aliasOf || a) === (b2.aliasOf || b2);
|
|
105
|
+
}
|
|
106
|
+
function isSameRouteLocationParams(a, b2) {
|
|
107
|
+
if (Object.keys(a).length !== Object.keys(b2).length) return false;
|
|
108
|
+
for (var key in a) if (!isSameRouteLocationParamsValue(a[key], b2[key])) return false;
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
function isSameRouteLocationParamsValue(a, b2) {
|
|
112
|
+
return isArray$1(a) ? isEquivalentArray(a, b2) : isArray$1(b2) ? isEquivalentArray(b2, a) : a?.valueOf() === b2?.valueOf();
|
|
113
|
+
}
|
|
114
|
+
function isEquivalentArray(a, b2) {
|
|
115
|
+
return isArray$1(b2) ? a.length === b2.length && a.every((value, i) => value === b2[i]) : a.length === 1 && a[0] === b2;
|
|
116
|
+
}
|
|
117
|
+
function isRouteLocation(route) {
|
|
118
|
+
return typeof route === "string" || route && typeof route === "object";
|
|
119
|
+
}
|
|
120
|
+
/* @__PURE__ */ Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
|
|
121
|
+
/* @__PURE__ */ Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
|
|
122
|
+
/* @__PURE__ */ Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
|
|
123
|
+
const routerKey = /* @__PURE__ */ Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
|
|
124
|
+
const routeLocationKey = /* @__PURE__ */ Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
|
|
125
|
+
/* @__PURE__ */ Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
|
|
126
|
+
function useLink(props) {
|
|
127
|
+
const router = vue.inject(routerKey);
|
|
128
|
+
const currentRoute = vue.inject(routeLocationKey);
|
|
129
|
+
let hasPrevious = false;
|
|
130
|
+
let previousTo = null;
|
|
131
|
+
const route = vue.computed(() => {
|
|
132
|
+
const to = vue.unref(props.to);
|
|
133
|
+
if (process.env.NODE_ENV !== "production" && (!hasPrevious || to !== previousTo)) {
|
|
134
|
+
if (!isRouteLocation(to)) if (hasPrevious) warn$1(`Invalid value for prop "to" in useLink()
|
|
135
|
+
- to:`, to, `
|
|
136
|
+
- previous to:`, previousTo, `
|
|
137
|
+
- props:`, props);
|
|
138
|
+
else warn$1(`Invalid value for prop "to" in useLink()
|
|
139
|
+
- to:`, to, `
|
|
140
|
+
- props:`, props);
|
|
141
|
+
previousTo = to;
|
|
142
|
+
hasPrevious = true;
|
|
143
|
+
}
|
|
144
|
+
return router.resolve(to);
|
|
145
|
+
});
|
|
146
|
+
const activeRecordIndex = vue.computed(() => {
|
|
147
|
+
const { matched } = route.value;
|
|
148
|
+
const { length } = matched;
|
|
149
|
+
const routeMatched = matched[length - 1];
|
|
150
|
+
const currentMatched = currentRoute.matched;
|
|
151
|
+
if (!routeMatched || !currentMatched.length) return -1;
|
|
152
|
+
const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
|
|
153
|
+
if (index > -1) return index;
|
|
154
|
+
const parentRecordPath = getOriginalPath(matched[length - 2]);
|
|
155
|
+
return length > 1 && getOriginalPath(routeMatched) === parentRecordPath && currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index;
|
|
156
|
+
});
|
|
157
|
+
const isActive = vue.computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
|
|
158
|
+
const isExactActive = vue.computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
|
|
159
|
+
function navigate(e = {}) {
|
|
160
|
+
if (guardEvent(e)) {
|
|
161
|
+
const p = router[vue.unref(props.replace) ? "replace" : "push"](vue.unref(props.to)).catch(noop$1);
|
|
162
|
+
if (props.viewTransition && typeof document !== "undefined" && "startViewTransition" in document) document.startViewTransition(() => p);
|
|
163
|
+
return p;
|
|
164
|
+
}
|
|
165
|
+
return Promise.resolve();
|
|
166
|
+
}
|
|
167
|
+
if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
|
|
168
|
+
const instance = vue.getCurrentInstance();
|
|
169
|
+
if (instance) {
|
|
170
|
+
const linkContextDevtools = {
|
|
171
|
+
route: route.value,
|
|
172
|
+
isActive: isActive.value,
|
|
173
|
+
isExactActive: isExactActive.value,
|
|
174
|
+
error: null
|
|
175
|
+
};
|
|
176
|
+
instance.__vrl_devtools = instance.__vrl_devtools || [];
|
|
177
|
+
instance.__vrl_devtools.push(linkContextDevtools);
|
|
178
|
+
vue.watchEffect(() => {
|
|
179
|
+
linkContextDevtools.route = route.value;
|
|
180
|
+
linkContextDevtools.isActive = isActive.value;
|
|
181
|
+
linkContextDevtools.isExactActive = isExactActive.value;
|
|
182
|
+
linkContextDevtools.error = isRouteLocation(vue.unref(props.to)) ? null : 'Invalid "to" value';
|
|
183
|
+
}, { flush: "post" });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
route,
|
|
188
|
+
href: vue.computed(() => route.value.href),
|
|
189
|
+
isActive,
|
|
190
|
+
isExactActive,
|
|
191
|
+
navigate
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function preferSingleVNode(vnodes) {
|
|
195
|
+
return vnodes.length === 1 ? vnodes[0] : vnodes;
|
|
196
|
+
}
|
|
197
|
+
const RouterLinkImpl = /* @__PURE__ */ vue.defineComponent({
|
|
198
|
+
name: "RouterLink",
|
|
199
|
+
compatConfig: { MODE: 3 },
|
|
200
|
+
props: {
|
|
201
|
+
to: {
|
|
202
|
+
type: [String, Object],
|
|
203
|
+
required: true
|
|
204
|
+
},
|
|
205
|
+
replace: Boolean,
|
|
206
|
+
activeClass: String,
|
|
207
|
+
exactActiveClass: String,
|
|
208
|
+
custom: Boolean,
|
|
209
|
+
ariaCurrentValue: {
|
|
210
|
+
type: String,
|
|
211
|
+
default: "page"
|
|
212
|
+
},
|
|
213
|
+
viewTransition: Boolean
|
|
214
|
+
},
|
|
215
|
+
useLink,
|
|
216
|
+
setup(props, { slots }) {
|
|
217
|
+
const link = vue.reactive(useLink(props));
|
|
218
|
+
const { options } = vue.inject(routerKey);
|
|
219
|
+
const elClass = vue.computed(() => ({
|
|
220
|
+
[getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
|
|
221
|
+
[getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
|
|
222
|
+
}));
|
|
223
|
+
return () => {
|
|
224
|
+
const children = slots.default && preferSingleVNode(slots.default(link));
|
|
225
|
+
return props.custom ? children : vue.h("a", {
|
|
226
|
+
"aria-current": link.isExactActive ? props.ariaCurrentValue : null,
|
|
227
|
+
href: link.href,
|
|
228
|
+
onClick: link.navigate,
|
|
229
|
+
class: elClass.value
|
|
230
|
+
}, children);
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const RouterLink = RouterLinkImpl;
|
|
235
|
+
function guardEvent(e) {
|
|
236
|
+
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return;
|
|
237
|
+
if (e.defaultPrevented) return;
|
|
238
|
+
if (e.button !== void 0 && e.button !== 0) return;
|
|
239
|
+
if (e.currentTarget && e.currentTarget.getAttribute) {
|
|
240
|
+
const target = e.currentTarget.getAttribute("target");
|
|
241
|
+
if (/\b_blank\b/i.test(target)) return;
|
|
242
|
+
}
|
|
243
|
+
if (e.preventDefault) e.preventDefault();
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
function includesParams(outer, inner) {
|
|
247
|
+
for (const key in inner) {
|
|
248
|
+
const innerValue = inner[key];
|
|
249
|
+
const outerValue = outer[key];
|
|
250
|
+
if (typeof innerValue === "string") {
|
|
251
|
+
if (innerValue !== outerValue) return false;
|
|
252
|
+
} else if (!isArray$1(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value.valueOf() !== outerValue[i].valueOf())) return false;
|
|
253
|
+
}
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
function getOriginalPath(record) {
|
|
257
|
+
return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
|
|
258
|
+
}
|
|
259
|
+
const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
|
|
260
|
+
function L() {
|
|
261
|
+
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
262
|
+
}
|
|
263
|
+
var T = L();
|
|
264
|
+
function Z(u) {
|
|
265
|
+
T = u;
|
|
266
|
+
}
|
|
267
|
+
var C = { exec: () => null };
|
|
268
|
+
function k(u, e = "") {
|
|
269
|
+
let t = typeof u == "string" ? u : u.source, n = { replace: (r, i) => {
|
|
270
|
+
let s = typeof i == "string" ? i : i.source;
|
|
271
|
+
return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
|
|
272
|
+
}, getRegex: () => new RegExp(t, e) };
|
|
273
|
+
return n;
|
|
274
|
+
}
|
|
275
|
+
var me = (() => {
|
|
276
|
+
try {
|
|
277
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
278
|
+
} catch {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
})(), m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (u) => new RegExp(`^( {0,3}${u})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}#`), htmlBeginRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}<(?:[a-z].*>|!--)`, "i") }, xe = /^(?:[ \t]*(?:\n|$))+/, be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Te = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, N = /(?:[*+-]|\d{1,9}[.)])/, re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, se = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Oe = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, we = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ye = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Pe = k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", j = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Se = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", j).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ie = k(Q).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), $e = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex(), U = { blockquote: $e, code: be, def: ye, fences: Re, heading: Te, hr: I, html: Se, lheading: se, list: Pe, newline: xe, paragraph: ie, table: C, text: we }, te = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), _e = { ...U, lheading: Oe, table: te, paragraph: k(Q).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }, Le = { ...U, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", j).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: C, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(Q).replace("hr", I).replace("heading", ` *#{1,6} *[^
|
|
282
|
+
]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, oe = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, K = /[\s\p{P}\p{S}]/u, ae = /[^\s\p{P}\p{S}]/u, Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, Ie = /(?!~)[\s\p{P}\p{S}]/u, Ee = /(?:[^\s\p{P}\p{S}]|~)/u, Be = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", me ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qe = k(ue, "u").replace(/punct/g, D).getRegex(), ve = k(ue, "u").replace(/punct/g, le).getRegex(), pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = k(pe, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(), He = k(pe, "gu").replace(/notPunctSpace/g, Ee).replace(/punctSpace/g, Ie).replace(/punct/g, le).getRegex(), Ze = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(), Ge = k(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), Ne = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Qe = k(j).replace("(?:-->|$)", "-->").getRegex(), Fe = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Qe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ue = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, W = { _backpedal: C, anyPunctuation: Ge, autolink: Ne, blockSkip: Be, br: oe, code: ze, del: C, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ze, escape: Me, link: je, nolink: he, punctuation: Ce, reflink: ce, reflinkSearch: Ue, tag: Fe, text: Ae, url: C }, Ke = { ...W, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, G = { ...W, emStrongRDelimAst: He, emStrongLDelim: ve, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() }, We = { ...G, br: k(oe).replace("{2,}", "*").getRegex(), text: k(G.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, E = { normal: U, gfm: _e, pedantic: Le }, M = { normal: W, gfm: G, breaks: We, pedantic: Ke };
|
|
283
|
+
var Xe = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, ke = (u) => Xe[u];
|
|
284
|
+
function w(u, e) {
|
|
285
|
+
if (e) {
|
|
286
|
+
if (m.escapeTest.test(u)) return u.replace(m.escapeReplace, ke);
|
|
287
|
+
} else if (m.escapeTestNoEncode.test(u)) return u.replace(m.escapeReplaceNoEncode, ke);
|
|
288
|
+
return u;
|
|
289
|
+
}
|
|
290
|
+
function X(u) {
|
|
291
|
+
try {
|
|
292
|
+
u = encodeURI(u).replace(m.percentDecode, "%");
|
|
293
|
+
} catch {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
return u;
|
|
297
|
+
}
|
|
298
|
+
function J(u, e) {
|
|
299
|
+
let t = u.replace(m.findPipe, (i, s, a) => {
|
|
300
|
+
let o = false, l = s;
|
|
301
|
+
for (; --l >= 0 && a[l] === "\\"; ) o = !o;
|
|
302
|
+
return o ? "|" : " |";
|
|
303
|
+
}), n = t.split(m.splitPipe), r = 0;
|
|
304
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
305
|
+
else for (; n.length < e; ) n.push("");
|
|
306
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
|
|
307
|
+
return n;
|
|
308
|
+
}
|
|
309
|
+
function z(u, e, t) {
|
|
310
|
+
let n = u.length;
|
|
311
|
+
if (n === 0) return "";
|
|
312
|
+
let r = 0;
|
|
313
|
+
for (; r < n; ) {
|
|
314
|
+
let i = u.charAt(n - r - 1);
|
|
315
|
+
if (i === e && true) r++;
|
|
316
|
+
else break;
|
|
317
|
+
}
|
|
318
|
+
return u.slice(0, n - r);
|
|
319
|
+
}
|
|
320
|
+
function de(u, e) {
|
|
321
|
+
if (u.indexOf(e[1]) === -1) return -1;
|
|
322
|
+
let t = 0;
|
|
323
|
+
for (let n = 0; n < u.length; n++) if (u[n] === "\\") n++;
|
|
324
|
+
else if (u[n] === e[0]) t++;
|
|
325
|
+
else if (u[n] === e[1] && (t--, t < 0)) return n;
|
|
326
|
+
return t > 0 ? -2 : -1;
|
|
327
|
+
}
|
|
328
|
+
function ge(u, e, t, n, r) {
|
|
329
|
+
let i = e.href, s = e.title || null, a = u[1].replace(r.other.outputLinkReplace, "$1");
|
|
330
|
+
n.state.inLink = true;
|
|
331
|
+
let o = { type: u[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
|
|
332
|
+
return n.state.inLink = false, o;
|
|
333
|
+
}
|
|
334
|
+
function Je(u, e, t) {
|
|
335
|
+
let n = u.match(t.other.indentCodeCompensation);
|
|
336
|
+
if (n === null) return e;
|
|
337
|
+
let r = n[1];
|
|
338
|
+
return e.split(`
|
|
339
|
+
`).map((i) => {
|
|
340
|
+
let s = i.match(t.other.beginningSpace);
|
|
341
|
+
if (s === null) return i;
|
|
342
|
+
let [a] = s;
|
|
343
|
+
return a.length >= r.length ? i.slice(r.length) : i;
|
|
344
|
+
}).join(`
|
|
345
|
+
`);
|
|
346
|
+
}
|
|
347
|
+
var y = class {
|
|
348
|
+
options;
|
|
349
|
+
rules;
|
|
350
|
+
lexer;
|
|
351
|
+
constructor(e) {
|
|
352
|
+
this.options = e || T;
|
|
353
|
+
}
|
|
354
|
+
space(e) {
|
|
355
|
+
let t = this.rules.block.newline.exec(e);
|
|
356
|
+
if (t && t[0].length > 0) return { type: "space", raw: t[0] };
|
|
357
|
+
}
|
|
358
|
+
code(e) {
|
|
359
|
+
let t = this.rules.block.code.exec(e);
|
|
360
|
+
if (t) {
|
|
361
|
+
let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
362
|
+
return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : z(n, `
|
|
363
|
+
`) };
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
fences(e) {
|
|
367
|
+
let t = this.rules.block.fences.exec(e);
|
|
368
|
+
if (t) {
|
|
369
|
+
let n = t[0], r = Je(n, t[3] || "", this.rules);
|
|
370
|
+
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
heading(e) {
|
|
374
|
+
let t = this.rules.block.heading.exec(e);
|
|
375
|
+
if (t) {
|
|
376
|
+
let n = t[2].trim();
|
|
377
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
378
|
+
let r = z(n, "#");
|
|
379
|
+
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
380
|
+
}
|
|
381
|
+
return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
hr(e) {
|
|
385
|
+
let t = this.rules.block.hr.exec(e);
|
|
386
|
+
if (t) return { type: "hr", raw: z(t[0], `
|
|
387
|
+
`) };
|
|
388
|
+
}
|
|
389
|
+
blockquote(e) {
|
|
390
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
391
|
+
if (t) {
|
|
392
|
+
let n = z(t[0], `
|
|
393
|
+
`).split(`
|
|
394
|
+
`), r = "", i = "", s = [];
|
|
395
|
+
for (; n.length > 0; ) {
|
|
396
|
+
let a = false, o = [], l;
|
|
397
|
+
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;
|
|
398
|
+
else if (!a) o.push(n[l]);
|
|
399
|
+
else break;
|
|
400
|
+
n = n.slice(l);
|
|
401
|
+
let p = o.join(`
|
|
402
|
+
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
403
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
404
|
+
r = r ? `${r}
|
|
405
|
+
${p}` : p, i = i ? `${i}
|
|
406
|
+
${c}` : c;
|
|
407
|
+
let g = this.lexer.state.top;
|
|
408
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = g, n.length === 0) break;
|
|
409
|
+
let h = s.at(-1);
|
|
410
|
+
if (h?.type === "code") break;
|
|
411
|
+
if (h?.type === "blockquote") {
|
|
412
|
+
let R = h, f = R.raw + `
|
|
413
|
+
` + n.join(`
|
|
414
|
+
`), O = this.blockquote(f);
|
|
415
|
+
s[s.length - 1] = O, r = r.substring(0, r.length - R.raw.length) + O.raw, i = i.substring(0, i.length - R.text.length) + O.text;
|
|
416
|
+
break;
|
|
417
|
+
} else if (h?.type === "list") {
|
|
418
|
+
let R = h, f = R.raw + `
|
|
419
|
+
` + n.join(`
|
|
420
|
+
`), O = this.list(f);
|
|
421
|
+
s[s.length - 1] = O, r = r.substring(0, r.length - h.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw, n = f.substring(s.at(-1).raw.length).split(`
|
|
422
|
+
`);
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return { type: "blockquote", raw: r, tokens: s, text: i };
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
list(e) {
|
|
430
|
+
let t = this.rules.block.list.exec(e);
|
|
431
|
+
if (t) {
|
|
432
|
+
let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
433
|
+
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
434
|
+
let s = this.rules.other.listItemRegex(n), a = false;
|
|
435
|
+
for (; e; ) {
|
|
436
|
+
let l = false, p = "", c = "";
|
|
437
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
438
|
+
p = t[0], e = e.substring(p.length);
|
|
439
|
+
let g = t[2].split(`
|
|
440
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (O) => " ".repeat(3 * O.length)), h = e.split(`
|
|
441
|
+
`, 1)[0], R = !g.trim(), f = 0;
|
|
442
|
+
if (this.options.pedantic ? (f = 2, c = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
|
|
443
|
+
`, e = e.substring(h.length + 1), l = true), !l) {
|
|
444
|
+
let O = this.rules.other.nextBulletRegex(f), V = this.rules.other.hrRegex(f), Y = this.rules.other.fencesBeginRegex(f), ee = this.rules.other.headingBeginRegex(f), fe = this.rules.other.htmlBeginRegex(f);
|
|
445
|
+
for (; e; ) {
|
|
446
|
+
let H = e.split(`
|
|
447
|
+
`, 1)[0], A;
|
|
448
|
+
if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || fe.test(h) || O.test(h) || V.test(h)) break;
|
|
449
|
+
if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
|
|
450
|
+
` + A.slice(f);
|
|
451
|
+
else {
|
|
452
|
+
if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(g) || ee.test(g) || V.test(g)) break;
|
|
453
|
+
c += `
|
|
454
|
+
` + h;
|
|
455
|
+
}
|
|
456
|
+
!R && !h.trim() && (R = true), p += H + `
|
|
457
|
+
`, e = e.substring(H.length + 1), g = A.slice(f);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), i.raw += p;
|
|
461
|
+
}
|
|
462
|
+
let o = i.items.at(-1);
|
|
463
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
464
|
+
else return;
|
|
465
|
+
i.raw = i.raw.trimEnd();
|
|
466
|
+
for (let l of i.items) {
|
|
467
|
+
if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
|
|
468
|
+
if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), l.tokens[0]?.type === "text" || l.tokens[0]?.type === "paragraph") {
|
|
469
|
+
l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
470
|
+
for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
|
|
471
|
+
this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
let p = this.rules.other.listTaskCheckbox.exec(l.raw);
|
|
476
|
+
if (p) {
|
|
477
|
+
let c = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
478
|
+
l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({ type: "paragraph", raw: c.raw, text: c.raw, tokens: [c] }) : l.tokens.unshift(c);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (!i.loose) {
|
|
482
|
+
let p = l.tokens.filter((g) => g.type === "space"), c = p.length > 0 && p.some((g) => this.rules.other.anyLine.test(g.raw));
|
|
483
|
+
i.loose = c;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if (i.loose) for (let l of i.items) {
|
|
487
|
+
l.loose = true;
|
|
488
|
+
for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
|
|
489
|
+
}
|
|
490
|
+
return i;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
html(e) {
|
|
494
|
+
let t = this.rules.block.html.exec(e);
|
|
495
|
+
if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
|
|
496
|
+
}
|
|
497
|
+
def(e) {
|
|
498
|
+
let t = this.rules.block.def.exec(e);
|
|
499
|
+
if (t) {
|
|
500
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
501
|
+
return { type: "def", tag: n, raw: t[0], href: r, title: i };
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
table(e) {
|
|
505
|
+
let t = this.rules.block.table.exec(e);
|
|
506
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
507
|
+
let n = J(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
508
|
+
`) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
|
|
509
|
+
if (n.length === r.length) {
|
|
510
|
+
for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
|
|
511
|
+
for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
|
|
512
|
+
for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[l] })));
|
|
513
|
+
return s;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
lheading(e) {
|
|
517
|
+
let t = this.rules.block.lheading.exec(e);
|
|
518
|
+
if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
|
|
519
|
+
}
|
|
520
|
+
paragraph(e) {
|
|
521
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
522
|
+
if (t) {
|
|
523
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
524
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
525
|
+
return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
text(e) {
|
|
529
|
+
let t = this.rules.block.text.exec(e);
|
|
530
|
+
if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
|
|
531
|
+
}
|
|
532
|
+
escape(e) {
|
|
533
|
+
let t = this.rules.inline.escape.exec(e);
|
|
534
|
+
if (t) return { type: "escape", raw: t[0], text: t[1] };
|
|
535
|
+
}
|
|
536
|
+
tag(e) {
|
|
537
|
+
let t = this.rules.inline.tag.exec(e);
|
|
538
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
|
|
539
|
+
}
|
|
540
|
+
link(e) {
|
|
541
|
+
let t = this.rules.inline.link.exec(e);
|
|
542
|
+
if (t) {
|
|
543
|
+
let n = t[2].trim();
|
|
544
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
545
|
+
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
546
|
+
let s = z(n.slice(0, -1), "\\");
|
|
547
|
+
if ((n.length - s.length) % 2 === 0) return;
|
|
548
|
+
} else {
|
|
549
|
+
let s = de(t[2], "()");
|
|
550
|
+
if (s === -2) return;
|
|
551
|
+
if (s > -1) {
|
|
552
|
+
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
553
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
let r = t[2], i = "";
|
|
557
|
+
if (this.options.pedantic) {
|
|
558
|
+
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
559
|
+
s && (r = s[1], i = s[3]);
|
|
560
|
+
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
561
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), ge(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
reflink(e, t) {
|
|
565
|
+
let n;
|
|
566
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
567
|
+
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
|
|
568
|
+
if (!i) {
|
|
569
|
+
let s = n[0].charAt(0);
|
|
570
|
+
return { type: "text", raw: s, text: s };
|
|
571
|
+
}
|
|
572
|
+
return ge(n, i, n[0], this.lexer, this.rules);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
emStrong(e, t, n = "") {
|
|
576
|
+
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
577
|
+
if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
578
|
+
if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
579
|
+
let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
580
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
|
|
581
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
|
|
582
|
+
if (o = [...a].length, r[3] || r[4]) {
|
|
583
|
+
l += o;
|
|
584
|
+
continue;
|
|
585
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
586
|
+
p += o;
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
589
|
+
if (l -= o, l > 0) continue;
|
|
590
|
+
o = Math.min(o, o + l + p);
|
|
591
|
+
let g = [...r[0]][0].length, h = e.slice(0, s + r.index + g + o);
|
|
592
|
+
if (Math.min(s, o) % 2) {
|
|
593
|
+
let f = h.slice(1, -1);
|
|
594
|
+
return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
595
|
+
}
|
|
596
|
+
let R = h.slice(2, -2);
|
|
597
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
codespan(e) {
|
|
602
|
+
let t = this.rules.inline.code.exec(e);
|
|
603
|
+
if (t) {
|
|
604
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
605
|
+
return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
br(e) {
|
|
609
|
+
let t = this.rules.inline.br.exec(e);
|
|
610
|
+
if (t) return { type: "br", raw: t[0] };
|
|
611
|
+
}
|
|
612
|
+
del(e) {
|
|
613
|
+
let t = this.rules.inline.del.exec(e);
|
|
614
|
+
if (t) return { type: "del", raw: t[0], text: t[2], tokens: this.lexer.inlineTokens(t[2]) };
|
|
615
|
+
}
|
|
616
|
+
autolink(e) {
|
|
617
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
618
|
+
if (t) {
|
|
619
|
+
let n, r;
|
|
620
|
+
return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
url(e) {
|
|
624
|
+
let t;
|
|
625
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
626
|
+
let n, r;
|
|
627
|
+
if (t[2] === "@") n = t[0], r = "mailto:" + n;
|
|
628
|
+
else {
|
|
629
|
+
let i;
|
|
630
|
+
do
|
|
631
|
+
i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
632
|
+
while (i !== t[0]);
|
|
633
|
+
n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
|
|
634
|
+
}
|
|
635
|
+
return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
inlineText(e) {
|
|
639
|
+
let t = this.rules.inline.text.exec(e);
|
|
640
|
+
if (t) {
|
|
641
|
+
let n = this.lexer.state.inRawBlock;
|
|
642
|
+
return { type: "text", raw: t[0], text: t[0], escaped: n };
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
var x = class u {
|
|
647
|
+
tokens;
|
|
648
|
+
options;
|
|
649
|
+
state;
|
|
650
|
+
inlineQueue;
|
|
651
|
+
tokenizer;
|
|
652
|
+
constructor(e) {
|
|
653
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
|
|
654
|
+
let t = { other: m, block: E.normal, inline: M.normal };
|
|
655
|
+
this.options.pedantic ? (t.block = E.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = E.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
|
|
656
|
+
}
|
|
657
|
+
static get rules() {
|
|
658
|
+
return { block: E, inline: M };
|
|
659
|
+
}
|
|
660
|
+
static lex(e, t) {
|
|
661
|
+
return new u(t).lex(e);
|
|
662
|
+
}
|
|
663
|
+
static lexInline(e, t) {
|
|
664
|
+
return new u(t).inlineTokens(e);
|
|
665
|
+
}
|
|
666
|
+
lex(e) {
|
|
667
|
+
e = e.replace(m.carriageReturn, `
|
|
668
|
+
`), this.blockTokens(e, this.tokens);
|
|
669
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
670
|
+
let n = this.inlineQueue[t];
|
|
671
|
+
this.inlineTokens(n.src, n.tokens);
|
|
672
|
+
}
|
|
673
|
+
return this.inlineQueue = [], this.tokens;
|
|
674
|
+
}
|
|
675
|
+
blockTokens(e, t = [], n = false) {
|
|
676
|
+
for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
|
|
677
|
+
let r;
|
|
678
|
+
if (this.options.extensions?.block?.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
|
|
679
|
+
if (r = this.tokenizer.space(e)) {
|
|
680
|
+
e = e.substring(r.raw.length);
|
|
681
|
+
let s = t.at(-1);
|
|
682
|
+
r.raw.length === 1 && s !== void 0 ? s.raw += `
|
|
683
|
+
` : t.push(r);
|
|
684
|
+
continue;
|
|
685
|
+
}
|
|
686
|
+
if (r = this.tokenizer.code(e)) {
|
|
687
|
+
e = e.substring(r.raw.length);
|
|
688
|
+
let s = t.at(-1);
|
|
689
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
690
|
+
`) ? "" : `
|
|
691
|
+
`) + r.raw, s.text += `
|
|
692
|
+
` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
693
|
+
continue;
|
|
694
|
+
}
|
|
695
|
+
if (r = this.tokenizer.fences(e)) {
|
|
696
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
if (r = this.tokenizer.heading(e)) {
|
|
700
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
if (r = this.tokenizer.hr(e)) {
|
|
704
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
708
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
709
|
+
continue;
|
|
710
|
+
}
|
|
711
|
+
if (r = this.tokenizer.list(e)) {
|
|
712
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
if (r = this.tokenizer.html(e)) {
|
|
716
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
if (r = this.tokenizer.def(e)) {
|
|
720
|
+
e = e.substring(r.raw.length);
|
|
721
|
+
let s = t.at(-1);
|
|
722
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
723
|
+
`) ? "" : `
|
|
724
|
+
`) + r.raw, s.text += `
|
|
725
|
+
` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
728
|
+
if (r = this.tokenizer.table(e)) {
|
|
729
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
733
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
let i = e;
|
|
737
|
+
if (this.options.extensions?.startBlock) {
|
|
738
|
+
let s = 1 / 0, a = e.slice(1), o;
|
|
739
|
+
this.options.extensions.startBlock.forEach((l) => {
|
|
740
|
+
o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
|
|
741
|
+
}), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
|
|
742
|
+
}
|
|
743
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
744
|
+
let s = t.at(-1);
|
|
745
|
+
n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`
|
|
746
|
+
`) ? "" : `
|
|
747
|
+
`) + r.raw, s.text += `
|
|
748
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
749
|
+
continue;
|
|
750
|
+
}
|
|
751
|
+
if (r = this.tokenizer.text(e)) {
|
|
752
|
+
e = e.substring(r.raw.length);
|
|
753
|
+
let s = t.at(-1);
|
|
754
|
+
s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
755
|
+
`) ? "" : `
|
|
756
|
+
`) + r.raw, s.text += `
|
|
757
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
if (e) {
|
|
761
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
762
|
+
if (this.options.silent) {
|
|
763
|
+
console.error(s);
|
|
764
|
+
break;
|
|
765
|
+
} else throw new Error(s);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return this.state.top = true, t;
|
|
769
|
+
}
|
|
770
|
+
inline(e, t = []) {
|
|
771
|
+
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
772
|
+
}
|
|
773
|
+
inlineTokens(e, t = []) {
|
|
774
|
+
let n = e, r = null;
|
|
775
|
+
if (this.tokens.links) {
|
|
776
|
+
let o = Object.keys(this.tokens.links);
|
|
777
|
+
if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
778
|
+
}
|
|
779
|
+
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
780
|
+
let i;
|
|
781
|
+
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
782
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
783
|
+
let s = false, a = "";
|
|
784
|
+
for (; e; ) {
|
|
785
|
+
s || (a = ""), s = false;
|
|
786
|
+
let o;
|
|
787
|
+
if (this.options.extensions?.inline?.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
788
|
+
if (o = this.tokenizer.escape(e)) {
|
|
789
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
792
|
+
if (o = this.tokenizer.tag(e)) {
|
|
793
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
794
|
+
continue;
|
|
795
|
+
}
|
|
796
|
+
if (o = this.tokenizer.link(e)) {
|
|
797
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
798
|
+
continue;
|
|
799
|
+
}
|
|
800
|
+
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
801
|
+
e = e.substring(o.raw.length);
|
|
802
|
+
let p = t.at(-1);
|
|
803
|
+
o.type === "text" && p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
if (o = this.tokenizer.emStrong(e, n, a)) {
|
|
807
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
808
|
+
continue;
|
|
809
|
+
}
|
|
810
|
+
if (o = this.tokenizer.codespan(e)) {
|
|
811
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
812
|
+
continue;
|
|
813
|
+
}
|
|
814
|
+
if (o = this.tokenizer.br(e)) {
|
|
815
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
816
|
+
continue;
|
|
817
|
+
}
|
|
818
|
+
if (o = this.tokenizer.del(e)) {
|
|
819
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
820
|
+
continue;
|
|
821
|
+
}
|
|
822
|
+
if (o = this.tokenizer.autolink(e)) {
|
|
823
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
827
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
830
|
+
let l = e;
|
|
831
|
+
if (this.options.extensions?.startInline) {
|
|
832
|
+
let p = 1 / 0, c = e.slice(1), g;
|
|
833
|
+
this.options.extensions.startInline.forEach((h) => {
|
|
834
|
+
g = h.call({ lexer: this }, c), typeof g == "number" && g >= 0 && (p = Math.min(p, g));
|
|
835
|
+
}), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
|
|
836
|
+
}
|
|
837
|
+
if (o = this.tokenizer.inlineText(l)) {
|
|
838
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
|
|
839
|
+
let p = t.at(-1);
|
|
840
|
+
p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
if (e) {
|
|
844
|
+
let p = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
845
|
+
if (this.options.silent) {
|
|
846
|
+
console.error(p);
|
|
847
|
+
break;
|
|
848
|
+
} else throw new Error(p);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return t;
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
var P = class {
|
|
855
|
+
options;
|
|
856
|
+
parser;
|
|
857
|
+
constructor(e) {
|
|
858
|
+
this.options = e || T;
|
|
859
|
+
}
|
|
860
|
+
space(e) {
|
|
861
|
+
return "";
|
|
862
|
+
}
|
|
863
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
864
|
+
let r = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + `
|
|
865
|
+
`;
|
|
866
|
+
return r ? '<pre><code class="language-' + w(r) + '">' + (n ? i : w(i, true)) + `</code></pre>
|
|
867
|
+
` : "<pre><code>" + (n ? i : w(i, true)) + `</code></pre>
|
|
868
|
+
`;
|
|
869
|
+
}
|
|
870
|
+
blockquote({ tokens: e }) {
|
|
871
|
+
return `<blockquote>
|
|
872
|
+
${this.parser.parse(e)}</blockquote>
|
|
873
|
+
`;
|
|
874
|
+
}
|
|
875
|
+
html({ text: e }) {
|
|
876
|
+
return e;
|
|
877
|
+
}
|
|
878
|
+
def(e) {
|
|
879
|
+
return "";
|
|
880
|
+
}
|
|
881
|
+
heading({ tokens: e, depth: t }) {
|
|
882
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
883
|
+
`;
|
|
884
|
+
}
|
|
885
|
+
hr(e) {
|
|
886
|
+
return `<hr>
|
|
887
|
+
`;
|
|
888
|
+
}
|
|
889
|
+
list(e) {
|
|
890
|
+
let t = e.ordered, n = e.start, r = "";
|
|
891
|
+
for (let a = 0; a < e.items.length; a++) {
|
|
892
|
+
let o = e.items[a];
|
|
893
|
+
r += this.listitem(o);
|
|
894
|
+
}
|
|
895
|
+
let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
896
|
+
return "<" + i + s + `>
|
|
897
|
+
` + r + "</" + i + `>
|
|
898
|
+
`;
|
|
899
|
+
}
|
|
900
|
+
listitem(e) {
|
|
901
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
902
|
+
`;
|
|
903
|
+
}
|
|
904
|
+
checkbox({ checked: e }) {
|
|
905
|
+
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
906
|
+
}
|
|
907
|
+
paragraph({ tokens: e }) {
|
|
908
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
909
|
+
`;
|
|
910
|
+
}
|
|
911
|
+
table(e) {
|
|
912
|
+
let t = "", n = "";
|
|
913
|
+
for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
|
|
914
|
+
t += this.tablerow({ text: n });
|
|
915
|
+
let r = "";
|
|
916
|
+
for (let i = 0; i < e.rows.length; i++) {
|
|
917
|
+
let s = e.rows[i];
|
|
918
|
+
n = "";
|
|
919
|
+
for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
|
|
920
|
+
r += this.tablerow({ text: n });
|
|
921
|
+
}
|
|
922
|
+
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
923
|
+
<thead>
|
|
924
|
+
` + t + `</thead>
|
|
925
|
+
` + r + `</table>
|
|
926
|
+
`;
|
|
927
|
+
}
|
|
928
|
+
tablerow({ text: e }) {
|
|
929
|
+
return `<tr>
|
|
930
|
+
${e}</tr>
|
|
931
|
+
`;
|
|
932
|
+
}
|
|
933
|
+
tablecell(e) {
|
|
934
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
935
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
936
|
+
`;
|
|
937
|
+
}
|
|
938
|
+
strong({ tokens: e }) {
|
|
939
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
940
|
+
}
|
|
941
|
+
em({ tokens: e }) {
|
|
942
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
943
|
+
}
|
|
944
|
+
codespan({ text: e }) {
|
|
945
|
+
return `<code>${w(e, true)}</code>`;
|
|
946
|
+
}
|
|
947
|
+
br(e) {
|
|
948
|
+
return "<br>";
|
|
949
|
+
}
|
|
950
|
+
del({ tokens: e }) {
|
|
951
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
952
|
+
}
|
|
953
|
+
link({ href: e, title: t, tokens: n }) {
|
|
954
|
+
let r = this.parser.parseInline(n), i = X(e);
|
|
955
|
+
if (i === null) return r;
|
|
956
|
+
e = i;
|
|
957
|
+
let s = '<a href="' + e + '"';
|
|
958
|
+
return t && (s += ' title="' + w(t) + '"'), s += ">" + r + "</a>", s;
|
|
959
|
+
}
|
|
960
|
+
image({ href: e, title: t, text: n, tokens: r }) {
|
|
961
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
962
|
+
let i = X(e);
|
|
963
|
+
if (i === null) return w(n);
|
|
964
|
+
e = i;
|
|
965
|
+
let s = `<img src="${e}" alt="${n}"`;
|
|
966
|
+
return t && (s += ` title="${w(t)}"`), s += ">", s;
|
|
967
|
+
}
|
|
968
|
+
text(e) {
|
|
969
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
var $ = class {
|
|
973
|
+
strong({ text: e }) {
|
|
974
|
+
return e;
|
|
975
|
+
}
|
|
976
|
+
em({ text: e }) {
|
|
977
|
+
return e;
|
|
978
|
+
}
|
|
979
|
+
codespan({ text: e }) {
|
|
980
|
+
return e;
|
|
981
|
+
}
|
|
982
|
+
del({ text: e }) {
|
|
983
|
+
return e;
|
|
984
|
+
}
|
|
985
|
+
html({ text: e }) {
|
|
986
|
+
return e;
|
|
987
|
+
}
|
|
988
|
+
text({ text: e }) {
|
|
989
|
+
return e;
|
|
990
|
+
}
|
|
991
|
+
link({ text: e }) {
|
|
992
|
+
return "" + e;
|
|
993
|
+
}
|
|
994
|
+
image({ text: e }) {
|
|
995
|
+
return "" + e;
|
|
996
|
+
}
|
|
997
|
+
br() {
|
|
998
|
+
return "";
|
|
999
|
+
}
|
|
1000
|
+
checkbox({ raw: e }) {
|
|
1001
|
+
return e;
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
var b = class u {
|
|
1005
|
+
options;
|
|
1006
|
+
renderer;
|
|
1007
|
+
textRenderer;
|
|
1008
|
+
constructor(e) {
|
|
1009
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
|
|
1010
|
+
}
|
|
1011
|
+
static parse(e, t) {
|
|
1012
|
+
return new u(t).parse(e);
|
|
1013
|
+
}
|
|
1014
|
+
static parseInline(e, t) {
|
|
1015
|
+
return new u(t).parseInline(e);
|
|
1016
|
+
}
|
|
1017
|
+
parse(e) {
|
|
1018
|
+
let t = "";
|
|
1019
|
+
for (let n = 0; n < e.length; n++) {
|
|
1020
|
+
let r = e[n];
|
|
1021
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
1022
|
+
let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
|
|
1023
|
+
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
|
|
1024
|
+
t += a || "";
|
|
1025
|
+
continue;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
let i = r;
|
|
1029
|
+
switch (i.type) {
|
|
1030
|
+
case "space": {
|
|
1031
|
+
t += this.renderer.space(i);
|
|
1032
|
+
break;
|
|
1033
|
+
}
|
|
1034
|
+
case "hr": {
|
|
1035
|
+
t += this.renderer.hr(i);
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
case "heading": {
|
|
1039
|
+
t += this.renderer.heading(i);
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
case "code": {
|
|
1043
|
+
t += this.renderer.code(i);
|
|
1044
|
+
break;
|
|
1045
|
+
}
|
|
1046
|
+
case "table": {
|
|
1047
|
+
t += this.renderer.table(i);
|
|
1048
|
+
break;
|
|
1049
|
+
}
|
|
1050
|
+
case "blockquote": {
|
|
1051
|
+
t += this.renderer.blockquote(i);
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
case "list": {
|
|
1055
|
+
t += this.renderer.list(i);
|
|
1056
|
+
break;
|
|
1057
|
+
}
|
|
1058
|
+
case "checkbox": {
|
|
1059
|
+
t += this.renderer.checkbox(i);
|
|
1060
|
+
break;
|
|
1061
|
+
}
|
|
1062
|
+
case "html": {
|
|
1063
|
+
t += this.renderer.html(i);
|
|
1064
|
+
break;
|
|
1065
|
+
}
|
|
1066
|
+
case "def": {
|
|
1067
|
+
t += this.renderer.def(i);
|
|
1068
|
+
break;
|
|
1069
|
+
}
|
|
1070
|
+
case "paragraph": {
|
|
1071
|
+
t += this.renderer.paragraph(i);
|
|
1072
|
+
break;
|
|
1073
|
+
}
|
|
1074
|
+
case "text": {
|
|
1075
|
+
t += this.renderer.text(i);
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1078
|
+
default: {
|
|
1079
|
+
let s = 'Token with "' + i.type + '" type was not found.';
|
|
1080
|
+
if (this.options.silent) return console.error(s), "";
|
|
1081
|
+
throw new Error(s);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return t;
|
|
1086
|
+
}
|
|
1087
|
+
parseInline(e, t = this.renderer) {
|
|
1088
|
+
let n = "";
|
|
1089
|
+
for (let r = 0; r < e.length; r++) {
|
|
1090
|
+
let i = e[r];
|
|
1091
|
+
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1092
|
+
let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1093
|
+
if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
1094
|
+
n += a || "";
|
|
1095
|
+
continue;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
let s = i;
|
|
1099
|
+
switch (s.type) {
|
|
1100
|
+
case "escape": {
|
|
1101
|
+
n += t.text(s);
|
|
1102
|
+
break;
|
|
1103
|
+
}
|
|
1104
|
+
case "html": {
|
|
1105
|
+
n += t.html(s);
|
|
1106
|
+
break;
|
|
1107
|
+
}
|
|
1108
|
+
case "link": {
|
|
1109
|
+
n += t.link(s);
|
|
1110
|
+
break;
|
|
1111
|
+
}
|
|
1112
|
+
case "image": {
|
|
1113
|
+
n += t.image(s);
|
|
1114
|
+
break;
|
|
1115
|
+
}
|
|
1116
|
+
case "checkbox": {
|
|
1117
|
+
n += t.checkbox(s);
|
|
1118
|
+
break;
|
|
1119
|
+
}
|
|
1120
|
+
case "strong": {
|
|
1121
|
+
n += t.strong(s);
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
case "em": {
|
|
1125
|
+
n += t.em(s);
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1128
|
+
case "codespan": {
|
|
1129
|
+
n += t.codespan(s);
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
case "br": {
|
|
1133
|
+
n += t.br(s);
|
|
1134
|
+
break;
|
|
1135
|
+
}
|
|
1136
|
+
case "del": {
|
|
1137
|
+
n += t.del(s);
|
|
1138
|
+
break;
|
|
1139
|
+
}
|
|
1140
|
+
case "text": {
|
|
1141
|
+
n += t.text(s);
|
|
1142
|
+
break;
|
|
1143
|
+
}
|
|
1144
|
+
default: {
|
|
1145
|
+
let a = 'Token with "' + s.type + '" type was not found.';
|
|
1146
|
+
if (this.options.silent) return console.error(a), "";
|
|
1147
|
+
throw new Error(a);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
return n;
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
var S = class {
|
|
1155
|
+
options;
|
|
1156
|
+
block;
|
|
1157
|
+
constructor(e) {
|
|
1158
|
+
this.options = e || T;
|
|
1159
|
+
}
|
|
1160
|
+
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
1161
|
+
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
1162
|
+
preprocess(e) {
|
|
1163
|
+
return e;
|
|
1164
|
+
}
|
|
1165
|
+
postprocess(e) {
|
|
1166
|
+
return e;
|
|
1167
|
+
}
|
|
1168
|
+
processAllTokens(e) {
|
|
1169
|
+
return e;
|
|
1170
|
+
}
|
|
1171
|
+
emStrongMask(e) {
|
|
1172
|
+
return e;
|
|
1173
|
+
}
|
|
1174
|
+
provideLexer() {
|
|
1175
|
+
return this.block ? x.lex : x.lexInline;
|
|
1176
|
+
}
|
|
1177
|
+
provideParser() {
|
|
1178
|
+
return this.block ? b.parse : b.parseInline;
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
var B = class {
|
|
1182
|
+
defaults = L();
|
|
1183
|
+
options = this.setOptions;
|
|
1184
|
+
parse = this.parseMarkdown(true);
|
|
1185
|
+
parseInline = this.parseMarkdown(false);
|
|
1186
|
+
Parser = b;
|
|
1187
|
+
Renderer = P;
|
|
1188
|
+
TextRenderer = $;
|
|
1189
|
+
Lexer = x;
|
|
1190
|
+
Tokenizer = y;
|
|
1191
|
+
Hooks = S;
|
|
1192
|
+
constructor(...e) {
|
|
1193
|
+
this.use(...e);
|
|
1194
|
+
}
|
|
1195
|
+
walkTokens(e, t) {
|
|
1196
|
+
let n = [];
|
|
1197
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
1198
|
+
case "table": {
|
|
1199
|
+
let i = r;
|
|
1200
|
+
for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
|
|
1201
|
+
for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
|
|
1202
|
+
break;
|
|
1203
|
+
}
|
|
1204
|
+
case "list": {
|
|
1205
|
+
let i = r;
|
|
1206
|
+
n = n.concat(this.walkTokens(i.items, t));
|
|
1207
|
+
break;
|
|
1208
|
+
}
|
|
1209
|
+
default: {
|
|
1210
|
+
let i = r;
|
|
1211
|
+
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
|
|
1212
|
+
let a = i[s].flat(1 / 0);
|
|
1213
|
+
n = n.concat(this.walkTokens(a, t));
|
|
1214
|
+
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
return n;
|
|
1218
|
+
}
|
|
1219
|
+
use(...e) {
|
|
1220
|
+
let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1221
|
+
return e.forEach((n) => {
|
|
1222
|
+
let r = { ...n };
|
|
1223
|
+
if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
|
|
1224
|
+
if (!i.name) throw new Error("extension name required");
|
|
1225
|
+
if ("renderer" in i) {
|
|
1226
|
+
let s = t.renderers[i.name];
|
|
1227
|
+
s ? t.renderers[i.name] = function(...a) {
|
|
1228
|
+
let o = i.renderer.apply(this, a);
|
|
1229
|
+
return o === false && (o = s.apply(this, a)), o;
|
|
1230
|
+
} : t.renderers[i.name] = i.renderer;
|
|
1231
|
+
}
|
|
1232
|
+
if ("tokenizer" in i) {
|
|
1233
|
+
if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1234
|
+
let s = t[i.level];
|
|
1235
|
+
s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
|
|
1236
|
+
}
|
|
1237
|
+
"childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
|
|
1238
|
+
}), r.extensions = t), n.renderer) {
|
|
1239
|
+
let i = this.defaults.renderer || new P(this.defaults);
|
|
1240
|
+
for (let s in n.renderer) {
|
|
1241
|
+
if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
|
|
1242
|
+
if (["options", "parser"].includes(s)) continue;
|
|
1243
|
+
let a = s, o = n.renderer[a], l = i[a];
|
|
1244
|
+
i[a] = (...p) => {
|
|
1245
|
+
let c = o.apply(i, p);
|
|
1246
|
+
return c === false && (c = l.apply(i, p)), c || "";
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
r.renderer = i;
|
|
1250
|
+
}
|
|
1251
|
+
if (n.tokenizer) {
|
|
1252
|
+
let i = this.defaults.tokenizer || new y(this.defaults);
|
|
1253
|
+
for (let s in n.tokenizer) {
|
|
1254
|
+
if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
|
|
1255
|
+
if (["options", "rules", "lexer"].includes(s)) continue;
|
|
1256
|
+
let a = s, o = n.tokenizer[a], l = i[a];
|
|
1257
|
+
i[a] = (...p) => {
|
|
1258
|
+
let c = o.apply(i, p);
|
|
1259
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
r.tokenizer = i;
|
|
1263
|
+
}
|
|
1264
|
+
if (n.hooks) {
|
|
1265
|
+
let i = this.defaults.hooks || new S();
|
|
1266
|
+
for (let s in n.hooks) {
|
|
1267
|
+
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
1268
|
+
if (["options", "block"].includes(s)) continue;
|
|
1269
|
+
let a = s, o = n.hooks[a], l = i[a];
|
|
1270
|
+
S.passThroughHooks.has(s) ? i[a] = (p) => {
|
|
1271
|
+
if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
|
|
1272
|
+
let g = await o.call(i, p);
|
|
1273
|
+
return l.call(i, g);
|
|
1274
|
+
})();
|
|
1275
|
+
let c = o.call(i, p);
|
|
1276
|
+
return l.call(i, c);
|
|
1277
|
+
} : i[a] = (...p) => {
|
|
1278
|
+
if (this.defaults.async) return (async () => {
|
|
1279
|
+
let g = await o.apply(i, p);
|
|
1280
|
+
return g === false && (g = await l.apply(i, p)), g;
|
|
1281
|
+
})();
|
|
1282
|
+
let c = o.apply(i, p);
|
|
1283
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
r.hooks = i;
|
|
1287
|
+
}
|
|
1288
|
+
if (n.walkTokens) {
|
|
1289
|
+
let i = this.defaults.walkTokens, s = n.walkTokens;
|
|
1290
|
+
r.walkTokens = function(a) {
|
|
1291
|
+
let o = [];
|
|
1292
|
+
return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
this.defaults = { ...this.defaults, ...r };
|
|
1296
|
+
}), this;
|
|
1297
|
+
}
|
|
1298
|
+
setOptions(e) {
|
|
1299
|
+
return this.defaults = { ...this.defaults, ...e }, this;
|
|
1300
|
+
}
|
|
1301
|
+
lexer(e, t) {
|
|
1302
|
+
return x.lex(e, t ?? this.defaults);
|
|
1303
|
+
}
|
|
1304
|
+
parser(e, t) {
|
|
1305
|
+
return b.parse(e, t ?? this.defaults);
|
|
1306
|
+
}
|
|
1307
|
+
parseMarkdown(e) {
|
|
1308
|
+
return (n, r) => {
|
|
1309
|
+
let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
|
|
1310
|
+
if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1311
|
+
if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
1312
|
+
if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1313
|
+
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
1314
|
+
let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
|
|
1315
|
+
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
1316
|
+
let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
|
|
1317
|
+
return s.hooks ? await s.hooks.postprocess(h) : h;
|
|
1318
|
+
})().catch(a);
|
|
1319
|
+
try {
|
|
1320
|
+
s.hooks && (n = s.hooks.preprocess(n));
|
|
1321
|
+
let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
|
|
1322
|
+
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
1323
|
+
let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
|
|
1324
|
+
return s.hooks && (c = s.hooks.postprocess(c)), c;
|
|
1325
|
+
} catch (o) {
|
|
1326
|
+
return a(o);
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
onError(e, t) {
|
|
1331
|
+
return (n) => {
|
|
1332
|
+
if (n.message += `
|
|
1333
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1334
|
+
let r = "<p>An error occurred:</p><pre>" + w(n.message + "", true) + "</pre>";
|
|
1335
|
+
return t ? Promise.resolve(r) : r;
|
|
1336
|
+
}
|
|
1337
|
+
if (t) return Promise.reject(n);
|
|
1338
|
+
throw n;
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
var _ = new B();
|
|
1343
|
+
function d(u, e) {
|
|
1344
|
+
return _.parse(u, e);
|
|
1345
|
+
}
|
|
1346
|
+
d.options = d.setOptions = function(u) {
|
|
1347
|
+
return _.setOptions(u), d.defaults = _.defaults, Z(d.defaults), d;
|
|
1348
|
+
};
|
|
1349
|
+
d.getDefaults = L;
|
|
1350
|
+
d.defaults = T;
|
|
1351
|
+
d.use = function(...u) {
|
|
1352
|
+
return _.use(...u), d.defaults = _.defaults, Z(d.defaults), d;
|
|
1353
|
+
};
|
|
1354
|
+
d.walkTokens = function(u, e) {
|
|
1355
|
+
return _.walkTokens(u, e);
|
|
1356
|
+
};
|
|
1357
|
+
d.parseInline = _.parseInline;
|
|
1358
|
+
d.Parser = b;
|
|
1359
|
+
d.parser = b.parse;
|
|
1360
|
+
d.Renderer = P;
|
|
1361
|
+
d.TextRenderer = $;
|
|
1362
|
+
d.Lexer = x;
|
|
1363
|
+
d.lexer = x.lex;
|
|
1364
|
+
d.Tokenizer = y;
|
|
1365
|
+
d.Hooks = S;
|
|
1366
|
+
d.parse = d;
|
|
1367
|
+
d.options;
|
|
1368
|
+
d.setOptions;
|
|
1369
|
+
d.use;
|
|
1370
|
+
d.walkTokens;
|
|
1371
|
+
d.parseInline;
|
|
1372
|
+
b.parse;
|
|
1373
|
+
x.lex;
|
|
1374
|
+
const _sfc_main = {
|
|
1375
|
+
name: "NewsArticleView",
|
|
1376
|
+
props: {
|
|
1377
|
+
article: {
|
|
1378
|
+
type: Object,
|
|
1379
|
+
default: null
|
|
1380
|
+
},
|
|
1381
|
+
summary: {
|
|
1382
|
+
type: Boolean,
|
|
1383
|
+
default: false
|
|
1384
|
+
},
|
|
1385
|
+
route: {
|
|
1386
|
+
type: String,
|
|
1387
|
+
default: ""
|
|
1388
|
+
},
|
|
1389
|
+
enableComments: {
|
|
1390
|
+
type: Boolean,
|
|
1391
|
+
default: false
|
|
1392
|
+
},
|
|
1393
|
+
enableDisqus: {
|
|
1394
|
+
type: Boolean,
|
|
1395
|
+
default: false
|
|
1396
|
+
},
|
|
1397
|
+
enableLikes: {
|
|
1398
|
+
type: Boolean,
|
|
1399
|
+
default: false
|
|
1400
|
+
},
|
|
1401
|
+
disableTags: {
|
|
1402
|
+
type: Boolean,
|
|
1403
|
+
default: false
|
|
1404
|
+
},
|
|
1405
|
+
disableByLine: {
|
|
1406
|
+
type: Boolean,
|
|
1407
|
+
default: false
|
|
1408
|
+
},
|
|
1409
|
+
disableDates: {
|
|
1410
|
+
type: Boolean,
|
|
1411
|
+
default: false
|
|
1412
|
+
},
|
|
1413
|
+
showIcon: {
|
|
1414
|
+
type: Boolean,
|
|
1415
|
+
default: false
|
|
1416
|
+
},
|
|
1417
|
+
url: {
|
|
1418
|
+
type: String,
|
|
1419
|
+
default: ""
|
|
1420
|
+
},
|
|
1421
|
+
disqusShortname: {
|
|
1422
|
+
type: String,
|
|
1423
|
+
default: null
|
|
1424
|
+
}
|
|
1425
|
+
},
|
|
1426
|
+
components: {
|
|
1427
|
+
RouterLink
|
|
1428
|
+
},
|
|
1429
|
+
methods: {
|
|
1430
|
+
showDisqusThread() {
|
|
1431
|
+
let d2 = document, s = d2.createElement("script");
|
|
1432
|
+
s.src = "https://" + this.disqusShortname + ".disqus.com/embed.js";
|
|
1433
|
+
s.setAttribute("data-timestamp", +/* @__PURE__ */ new Date());
|
|
1434
|
+
(d2.head || d2.body).appendChild(s);
|
|
1435
|
+
},
|
|
1436
|
+
formatDate(str) {
|
|
1437
|
+
let d2 = new Date(str);
|
|
1438
|
+
return d2.toLocaleDateString("en-US") + " " + d2.toLocaleTimeString("en-US");
|
|
1439
|
+
},
|
|
1440
|
+
compileMarkdown(str) {
|
|
1441
|
+
return d(str);
|
|
1442
|
+
}
|
|
1443
|
+
},
|
|
1444
|
+
mounted() {
|
|
1445
|
+
if (this.enableDisqus && this.disqusShortname !== null) {
|
|
1446
|
+
this.showDisqusThread();
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
};
|
|
1450
|
+
const _hoisted_1 = { class: "new-article-view" };
|
|
1451
|
+
const _hoisted_2 = {
|
|
1452
|
+
key: 0,
|
|
1453
|
+
class: "media mt-1 mb-3"
|
|
1454
|
+
};
|
|
1455
|
+
const _hoisted_3 = {
|
|
1456
|
+
key: 0,
|
|
1457
|
+
class: "media-left"
|
|
1458
|
+
};
|
|
1459
|
+
const _hoisted_4 = { class: "image is-64x64" };
|
|
1460
|
+
const _hoisted_5 = ["src"];
|
|
1461
|
+
const _hoisted_6 = ["src"];
|
|
1462
|
+
const _hoisted_7 = {
|
|
1463
|
+
key: 2,
|
|
1464
|
+
src: "https://bulma.io/assets/images/placeholders/128x128.png"
|
|
1465
|
+
};
|
|
1466
|
+
const _hoisted_8 = { class: "media-content" };
|
|
1467
|
+
const _hoisted_9 = { class: "content" };
|
|
1468
|
+
const _hoisted_10 = ["innerHTML"];
|
|
1469
|
+
const _hoisted_11 = { class: "level is-mobile mt-2" };
|
|
1470
|
+
const _hoisted_12 = { class: "level-left" };
|
|
1471
|
+
const _hoisted_13 = { key: 0 };
|
|
1472
|
+
const _hoisted_14 = { key: 0 };
|
|
1473
|
+
const _hoisted_15 = { class: "level-right" };
|
|
1474
|
+
const _hoisted_16 = { key: 0 };
|
|
1475
|
+
const _hoisted_17 = { class: "tag m-1" };
|
|
1476
|
+
const _hoisted_18 = ["href"];
|
|
1477
|
+
const _hoisted_19 = {
|
|
1478
|
+
key: 0,
|
|
1479
|
+
id: "disqus_thread"
|
|
1480
|
+
};
|
|
1481
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1482
|
+
const _component_router_link = vue.resolveComponent("router-link");
|
|
1483
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
1484
|
+
$props.article != null ? (vue.openBlock(), vue.createElementBlock("article", _hoisted_2, [
|
|
1485
|
+
$props.showIcon ? (vue.openBlock(), vue.createElementBlock("figure", _hoisted_3, [
|
|
1486
|
+
vue.createElementVNode("p", _hoisted_4, [
|
|
1487
|
+
vue.createVNode(_component_router_link, { to: $props.route }, {
|
|
1488
|
+
default: vue.withCtx(() => [
|
|
1489
|
+
$props.article.iconImage != null ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1490
|
+
key: 0,
|
|
1491
|
+
src: $props.article.iconImage
|
|
1492
|
+
}, null, 8, _hoisted_5)) : $props.article.iconId != null ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1493
|
+
key: 1,
|
|
1494
|
+
src: "/api/asset/" + $props.article.iconId
|
|
1495
|
+
}, null, 8, _hoisted_6)) : (vue.openBlock(), vue.createElementBlock("img", _hoisted_7))
|
|
1496
|
+
]),
|
|
1497
|
+
_: 1
|
|
1498
|
+
}, 8, ["to"])
|
|
1499
|
+
])
|
|
1500
|
+
])) : vue.createCommentVNode("", true),
|
|
1501
|
+
vue.createElementVNode("div", _hoisted_8, [
|
|
1502
|
+
vue.createElementVNode("div", _hoisted_9, [
|
|
1503
|
+
vue.createVNode(_component_router_link, { to: $props.route }, {
|
|
1504
|
+
default: vue.withCtx(() => [
|
|
1505
|
+
vue.createElementVNode("h3", {
|
|
1506
|
+
class: vue.normalizeClass("title mb-2 " + (_ctx.small ? "is-5" : "is-4"))
|
|
1507
|
+
}, vue.toDisplayString($props.article.title), 3)
|
|
1508
|
+
]),
|
|
1509
|
+
_: 1
|
|
1510
|
+
}, 8, ["to"]),
|
|
1511
|
+
vue.createElementVNode("span", {
|
|
1512
|
+
innerHTML: $options.compileMarkdown($props.summary ? $props.article.summary : $props.article.body)
|
|
1513
|
+
}, null, 8, _hoisted_10),
|
|
1514
|
+
vue.createElementVNode("div", _hoisted_11, [
|
|
1515
|
+
vue.createElementVNode("div", _hoisted_12, [
|
|
1516
|
+
!$props.disableByLine ? (vue.openBlock(), vue.createElementBlock("strong", _hoisted_13, [
|
|
1517
|
+
vue.createTextVNode(vue.toDisplayString($props.article.byLine) + " @ ", 1),
|
|
1518
|
+
!$props.disableDates ? (vue.openBlock(), vue.createElementBlock("small", _hoisted_14, vue.toDisplayString($options.formatDate($props.article.posted)), 1)) : vue.createCommentVNode("", true)
|
|
1519
|
+
])) : vue.createCommentVNode("", true)
|
|
1520
|
+
]),
|
|
1521
|
+
vue.createElementVNode("div", _hoisted_15, [
|
|
1522
|
+
!$props.disableTags ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_16, [
|
|
1523
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.article.tags, (tag) => {
|
|
1524
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
1525
|
+
key: $props.article.tags.indexOf(tag)
|
|
1526
|
+
}, [
|
|
1527
|
+
vue.createElementVNode("span", _hoisted_17, vue.toDisplayString(tag), 1)
|
|
1528
|
+
]);
|
|
1529
|
+
}), 128))
|
|
1530
|
+
])) : vue.createCommentVNode("", true),
|
|
1531
|
+
$props.summary && $props.url !== "" ? (vue.openBlock(), vue.createElementBlock("a", {
|
|
1532
|
+
key: 1,
|
|
1533
|
+
href: $props.url,
|
|
1534
|
+
class: "level-item"
|
|
1535
|
+
}, [..._cache[0] || (_cache[0] = [
|
|
1536
|
+
vue.createElementVNode("span", { class: "icon is-medium" }, [
|
|
1537
|
+
vue.createElementVNode("i", { class: "fa fa-search" })
|
|
1538
|
+
], -1)
|
|
1539
|
+
])], 8, _hoisted_18)) : $props.summary && $props.route !== "" ? (vue.openBlock(), vue.createBlock(_component_router_link, {
|
|
1540
|
+
key: 2,
|
|
1541
|
+
to: $props.route,
|
|
1542
|
+
class: "level-item"
|
|
1543
|
+
}, {
|
|
1544
|
+
default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
1545
|
+
vue.createElementVNode("span", { class: "icon is-medium" }, [
|
|
1546
|
+
vue.createElementVNode("i", { class: "fa fa-search" })
|
|
1547
|
+
], -1)
|
|
1548
|
+
])]),
|
|
1549
|
+
_: 1
|
|
1550
|
+
}, 8, ["to"])) : vue.createCommentVNode("", true)
|
|
1551
|
+
])
|
|
1552
|
+
])
|
|
1553
|
+
]),
|
|
1554
|
+
$props.enableDisqus ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_19)) : vue.createCommentVNode("", true)
|
|
1555
|
+
])
|
|
1556
|
+
])) : vue.createCommentVNode("", true)
|
|
1557
|
+
]);
|
|
1558
|
+
}
|
|
1559
|
+
const ArticleView = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-b6905e0a"]]);
|
|
1560
|
+
function bind(fn, thisArg) {
|
|
1561
|
+
return function wrap() {
|
|
1562
|
+
return fn.apply(thisArg, arguments);
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
const { toString } = Object.prototype;
|
|
1566
|
+
const { getPrototypeOf } = Object;
|
|
1567
|
+
const { iterator, toStringTag } = Symbol;
|
|
1568
|
+
const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
1569
|
+
const str = toString.call(thing);
|
|
1570
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
1571
|
+
})(/* @__PURE__ */ Object.create(null));
|
|
1572
|
+
const kindOfTest = (type) => {
|
|
1573
|
+
type = type.toLowerCase();
|
|
1574
|
+
return (thing) => kindOf(thing) === type;
|
|
1575
|
+
};
|
|
1576
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
1577
|
+
const { isArray } = Array;
|
|
1578
|
+
const isUndefined = typeOfTest("undefined");
|
|
1579
|
+
function isBuffer(val) {
|
|
1580
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
1581
|
+
}
|
|
1582
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
1583
|
+
function isArrayBufferView(val) {
|
|
1584
|
+
let result;
|
|
1585
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
1586
|
+
result = ArrayBuffer.isView(val);
|
|
1587
|
+
} else {
|
|
1588
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
1589
|
+
}
|
|
1590
|
+
return result;
|
|
1591
|
+
}
|
|
1592
|
+
const isString = typeOfTest("string");
|
|
1593
|
+
const isFunction$1 = typeOfTest("function");
|
|
1594
|
+
const isNumber = typeOfTest("number");
|
|
1595
|
+
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
1596
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
1597
|
+
const isPlainObject = (val) => {
|
|
1598
|
+
if (kindOf(val) !== "object") {
|
|
1599
|
+
return false;
|
|
1600
|
+
}
|
|
1601
|
+
const prototype2 = getPrototypeOf(val);
|
|
1602
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
|
|
1603
|
+
};
|
|
1604
|
+
const isEmptyObject = (val) => {
|
|
1605
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
1606
|
+
return false;
|
|
1607
|
+
}
|
|
1608
|
+
try {
|
|
1609
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
1610
|
+
} catch (e) {
|
|
1611
|
+
return false;
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
const isDate = kindOfTest("Date");
|
|
1615
|
+
const isFile = kindOfTest("File");
|
|
1616
|
+
const isBlob = kindOfTest("Blob");
|
|
1617
|
+
const isFileList = kindOfTest("FileList");
|
|
1618
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
1619
|
+
const isFormData = (thing) => {
|
|
1620
|
+
let kind;
|
|
1621
|
+
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
1622
|
+
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
|
|
1623
|
+
};
|
|
1624
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
1625
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
|
|
1626
|
+
const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
1627
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
1628
|
+
if (obj === null || typeof obj === "undefined") {
|
|
1629
|
+
return;
|
|
1630
|
+
}
|
|
1631
|
+
let i;
|
|
1632
|
+
let l;
|
|
1633
|
+
if (typeof obj !== "object") {
|
|
1634
|
+
obj = [obj];
|
|
1635
|
+
}
|
|
1636
|
+
if (isArray(obj)) {
|
|
1637
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
1638
|
+
fn.call(null, obj[i], i, obj);
|
|
1639
|
+
}
|
|
1640
|
+
} else {
|
|
1641
|
+
if (isBuffer(obj)) {
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
1645
|
+
const len = keys.length;
|
|
1646
|
+
let key;
|
|
1647
|
+
for (i = 0; i < len; i++) {
|
|
1648
|
+
key = keys[i];
|
|
1649
|
+
fn.call(null, obj[key], key, obj);
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
function findKey(obj, key) {
|
|
1654
|
+
if (isBuffer(obj)) {
|
|
1655
|
+
return null;
|
|
1656
|
+
}
|
|
1657
|
+
key = key.toLowerCase();
|
|
1658
|
+
const keys = Object.keys(obj);
|
|
1659
|
+
let i = keys.length;
|
|
1660
|
+
let _key;
|
|
1661
|
+
while (i-- > 0) {
|
|
1662
|
+
_key = keys[i];
|
|
1663
|
+
if (key === _key.toLowerCase()) {
|
|
1664
|
+
return _key;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
return null;
|
|
1668
|
+
}
|
|
1669
|
+
const _global = (() => {
|
|
1670
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
1671
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
1672
|
+
})();
|
|
1673
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
1674
|
+
function merge() {
|
|
1675
|
+
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
1676
|
+
const result = {};
|
|
1677
|
+
const assignValue = (val, key) => {
|
|
1678
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
1679
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
1680
|
+
result[targetKey] = merge(result[targetKey], val);
|
|
1681
|
+
} else if (isPlainObject(val)) {
|
|
1682
|
+
result[targetKey] = merge({}, val);
|
|
1683
|
+
} else if (isArray(val)) {
|
|
1684
|
+
result[targetKey] = val.slice();
|
|
1685
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
1686
|
+
result[targetKey] = val;
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
1690
|
+
arguments[i] && forEach(arguments[i], assignValue);
|
|
1691
|
+
}
|
|
1692
|
+
return result;
|
|
1693
|
+
}
|
|
1694
|
+
const extend = (a, b2, thisArg, { allOwnKeys } = {}) => {
|
|
1695
|
+
forEach(b2, (val, key) => {
|
|
1696
|
+
if (thisArg && isFunction$1(val)) {
|
|
1697
|
+
a[key] = bind(val, thisArg);
|
|
1698
|
+
} else {
|
|
1699
|
+
a[key] = val;
|
|
1700
|
+
}
|
|
1701
|
+
}, { allOwnKeys });
|
|
1702
|
+
return a;
|
|
1703
|
+
};
|
|
1704
|
+
const stripBOM = (content2) => {
|
|
1705
|
+
if (content2.charCodeAt(0) === 65279) {
|
|
1706
|
+
content2 = content2.slice(1);
|
|
1707
|
+
}
|
|
1708
|
+
return content2;
|
|
1709
|
+
};
|
|
1710
|
+
const inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
1711
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
|
1712
|
+
constructor.prototype.constructor = constructor;
|
|
1713
|
+
Object.defineProperty(constructor, "super", {
|
|
1714
|
+
value: superConstructor.prototype
|
|
1715
|
+
});
|
|
1716
|
+
props && Object.assign(constructor.prototype, props);
|
|
1717
|
+
};
|
|
1718
|
+
const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
1719
|
+
let props;
|
|
1720
|
+
let i;
|
|
1721
|
+
let prop;
|
|
1722
|
+
const merged = {};
|
|
1723
|
+
destObj = destObj || {};
|
|
1724
|
+
if (sourceObj == null) return destObj;
|
|
1725
|
+
do {
|
|
1726
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
1727
|
+
i = props.length;
|
|
1728
|
+
while (i-- > 0) {
|
|
1729
|
+
prop = props[i];
|
|
1730
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
1731
|
+
destObj[prop] = sourceObj[prop];
|
|
1732
|
+
merged[prop] = true;
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
1736
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
1737
|
+
return destObj;
|
|
1738
|
+
};
|
|
1739
|
+
const endsWith = (str, searchString, position) => {
|
|
1740
|
+
str = String(str);
|
|
1741
|
+
if (position === void 0 || position > str.length) {
|
|
1742
|
+
position = str.length;
|
|
1743
|
+
}
|
|
1744
|
+
position -= searchString.length;
|
|
1745
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
1746
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
1747
|
+
};
|
|
1748
|
+
const toArray = (thing) => {
|
|
1749
|
+
if (!thing) return null;
|
|
1750
|
+
if (isArray(thing)) return thing;
|
|
1751
|
+
let i = thing.length;
|
|
1752
|
+
if (!isNumber(i)) return null;
|
|
1753
|
+
const arr = new Array(i);
|
|
1754
|
+
while (i-- > 0) {
|
|
1755
|
+
arr[i] = thing[i];
|
|
1756
|
+
}
|
|
1757
|
+
return arr;
|
|
1758
|
+
};
|
|
1759
|
+
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
|
|
1760
|
+
return (thing) => {
|
|
1761
|
+
return TypedArray && thing instanceof TypedArray;
|
|
1762
|
+
};
|
|
1763
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
1764
|
+
const forEachEntry = (obj, fn) => {
|
|
1765
|
+
const generator = obj && obj[iterator];
|
|
1766
|
+
const _iterator = generator.call(obj);
|
|
1767
|
+
let result;
|
|
1768
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
1769
|
+
const pair = result.value;
|
|
1770
|
+
fn.call(obj, pair[0], pair[1]);
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
const matchAll = (regExp, str) => {
|
|
1774
|
+
let matches;
|
|
1775
|
+
const arr = [];
|
|
1776
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
1777
|
+
arr.push(matches);
|
|
1778
|
+
}
|
|
1779
|
+
return arr;
|
|
1780
|
+
};
|
|
1781
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
1782
|
+
const toCamelCase = (str) => {
|
|
1783
|
+
return str.toLowerCase().replace(
|
|
1784
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
1785
|
+
function replacer(m2, p1, p2) {
|
|
1786
|
+
return p1.toUpperCase() + p2;
|
|
1787
|
+
}
|
|
1788
|
+
);
|
|
1789
|
+
};
|
|
1790
|
+
const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
1791
|
+
const isRegExp = kindOfTest("RegExp");
|
|
1792
|
+
const reduceDescriptors = (obj, reducer) => {
|
|
1793
|
+
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
|
|
1794
|
+
const reducedDescriptors = {};
|
|
1795
|
+
forEach(descriptors2, (descriptor, name) => {
|
|
1796
|
+
let ret;
|
|
1797
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
1798
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
1799
|
+
}
|
|
1800
|
+
});
|
|
1801
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
1802
|
+
};
|
|
1803
|
+
const freezeMethods = (obj) => {
|
|
1804
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
1805
|
+
if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
1806
|
+
return false;
|
|
1807
|
+
}
|
|
1808
|
+
const value = obj[name];
|
|
1809
|
+
if (!isFunction$1(value)) return;
|
|
1810
|
+
descriptor.enumerable = false;
|
|
1811
|
+
if ("writable" in descriptor) {
|
|
1812
|
+
descriptor.writable = false;
|
|
1813
|
+
return;
|
|
1814
|
+
}
|
|
1815
|
+
if (!descriptor.set) {
|
|
1816
|
+
descriptor.set = () => {
|
|
1817
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
1818
|
+
};
|
|
1819
|
+
}
|
|
1820
|
+
});
|
|
1821
|
+
};
|
|
1822
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
1823
|
+
const obj = {};
|
|
1824
|
+
const define2 = (arr) => {
|
|
1825
|
+
arr.forEach((value) => {
|
|
1826
|
+
obj[value] = true;
|
|
1827
|
+
});
|
|
1828
|
+
};
|
|
1829
|
+
isArray(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
|
|
1830
|
+
return obj;
|
|
1831
|
+
};
|
|
1832
|
+
const noop = () => {
|
|
1833
|
+
};
|
|
1834
|
+
const toFiniteNumber = (value, defaultValue) => {
|
|
1835
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
1836
|
+
};
|
|
1837
|
+
function isSpecCompliantForm(thing) {
|
|
1838
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
1839
|
+
}
|
|
1840
|
+
const toJSONObject = (obj) => {
|
|
1841
|
+
const stack = new Array(10);
|
|
1842
|
+
const visit = (source, i) => {
|
|
1843
|
+
if (isObject(source)) {
|
|
1844
|
+
if (stack.indexOf(source) >= 0) {
|
|
1845
|
+
return;
|
|
1846
|
+
}
|
|
1847
|
+
if (isBuffer(source)) {
|
|
1848
|
+
return source;
|
|
1849
|
+
}
|
|
1850
|
+
if (!("toJSON" in source)) {
|
|
1851
|
+
stack[i] = source;
|
|
1852
|
+
const target = isArray(source) ? [] : {};
|
|
1853
|
+
forEach(source, (value, key) => {
|
|
1854
|
+
const reducedValue = visit(value, i + 1);
|
|
1855
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
1856
|
+
});
|
|
1857
|
+
stack[i] = void 0;
|
|
1858
|
+
return target;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
return source;
|
|
1862
|
+
};
|
|
1863
|
+
return visit(obj, 0);
|
|
1864
|
+
};
|
|
1865
|
+
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
1866
|
+
const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
1867
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
1868
|
+
if (setImmediateSupported) {
|
|
1869
|
+
return setImmediate;
|
|
1870
|
+
}
|
|
1871
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
1872
|
+
_global.addEventListener("message", ({ source, data }) => {
|
|
1873
|
+
if (source === _global && data === token) {
|
|
1874
|
+
callbacks.length && callbacks.shift()();
|
|
1875
|
+
}
|
|
1876
|
+
}, false);
|
|
1877
|
+
return (cb) => {
|
|
1878
|
+
callbacks.push(cb);
|
|
1879
|
+
_global.postMessage(token, "*");
|
|
1880
|
+
};
|
|
1881
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
1882
|
+
})(
|
|
1883
|
+
typeof setImmediate === "function",
|
|
1884
|
+
isFunction$1(_global.postMessage)
|
|
1885
|
+
);
|
|
1886
|
+
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
1887
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
1888
|
+
const utils$1 = {
|
|
1889
|
+
isArray,
|
|
1890
|
+
isArrayBuffer,
|
|
1891
|
+
isBuffer,
|
|
1892
|
+
isFormData,
|
|
1893
|
+
isArrayBufferView,
|
|
1894
|
+
isString,
|
|
1895
|
+
isNumber,
|
|
1896
|
+
isBoolean,
|
|
1897
|
+
isObject,
|
|
1898
|
+
isPlainObject,
|
|
1899
|
+
isEmptyObject,
|
|
1900
|
+
isReadableStream,
|
|
1901
|
+
isRequest,
|
|
1902
|
+
isResponse,
|
|
1903
|
+
isHeaders,
|
|
1904
|
+
isUndefined,
|
|
1905
|
+
isDate,
|
|
1906
|
+
isFile,
|
|
1907
|
+
isBlob,
|
|
1908
|
+
isRegExp,
|
|
1909
|
+
isFunction: isFunction$1,
|
|
1910
|
+
isStream,
|
|
1911
|
+
isURLSearchParams,
|
|
1912
|
+
isTypedArray,
|
|
1913
|
+
isFileList,
|
|
1914
|
+
forEach,
|
|
1915
|
+
merge,
|
|
1916
|
+
extend,
|
|
1917
|
+
trim,
|
|
1918
|
+
stripBOM,
|
|
1919
|
+
inherits,
|
|
1920
|
+
toFlatObject,
|
|
1921
|
+
kindOf,
|
|
1922
|
+
kindOfTest,
|
|
1923
|
+
endsWith,
|
|
1924
|
+
toArray,
|
|
1925
|
+
forEachEntry,
|
|
1926
|
+
matchAll,
|
|
1927
|
+
isHTMLForm,
|
|
1928
|
+
hasOwnProperty,
|
|
1929
|
+
hasOwnProp: hasOwnProperty,
|
|
1930
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
1931
|
+
reduceDescriptors,
|
|
1932
|
+
freezeMethods,
|
|
1933
|
+
toObjectSet,
|
|
1934
|
+
toCamelCase,
|
|
1935
|
+
noop,
|
|
1936
|
+
toFiniteNumber,
|
|
1937
|
+
findKey,
|
|
1938
|
+
global: _global,
|
|
1939
|
+
isContextDefined,
|
|
1940
|
+
isSpecCompliantForm,
|
|
1941
|
+
toJSONObject,
|
|
1942
|
+
isAsyncFn,
|
|
1943
|
+
isThenable,
|
|
1944
|
+
setImmediate: _setImmediate,
|
|
1945
|
+
asap,
|
|
1946
|
+
isIterable
|
|
1947
|
+
};
|
|
1948
|
+
function AxiosError$1(message, code, config, request, response) {
|
|
1949
|
+
Error.call(this);
|
|
1950
|
+
if (Error.captureStackTrace) {
|
|
1951
|
+
Error.captureStackTrace(this, this.constructor);
|
|
1952
|
+
} else {
|
|
1953
|
+
this.stack = new Error().stack;
|
|
1954
|
+
}
|
|
1955
|
+
this.message = message;
|
|
1956
|
+
this.name = "AxiosError";
|
|
1957
|
+
code && (this.code = code);
|
|
1958
|
+
config && (this.config = config);
|
|
1959
|
+
request && (this.request = request);
|
|
1960
|
+
if (response) {
|
|
1961
|
+
this.response = response;
|
|
1962
|
+
this.status = response.status ? response.status : null;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
utils$1.inherits(AxiosError$1, Error, {
|
|
1966
|
+
toJSON: function toJSON() {
|
|
1967
|
+
return {
|
|
1968
|
+
// Standard
|
|
1969
|
+
message: this.message,
|
|
1970
|
+
name: this.name,
|
|
1971
|
+
// Microsoft
|
|
1972
|
+
description: this.description,
|
|
1973
|
+
number: this.number,
|
|
1974
|
+
// Mozilla
|
|
1975
|
+
fileName: this.fileName,
|
|
1976
|
+
lineNumber: this.lineNumber,
|
|
1977
|
+
columnNumber: this.columnNumber,
|
|
1978
|
+
stack: this.stack,
|
|
1979
|
+
// Axios
|
|
1980
|
+
config: utils$1.toJSONObject(this.config),
|
|
1981
|
+
code: this.code,
|
|
1982
|
+
status: this.status
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
});
|
|
1986
|
+
const prototype$1 = AxiosError$1.prototype;
|
|
1987
|
+
const descriptors = {};
|
|
1988
|
+
[
|
|
1989
|
+
"ERR_BAD_OPTION_VALUE",
|
|
1990
|
+
"ERR_BAD_OPTION",
|
|
1991
|
+
"ECONNABORTED",
|
|
1992
|
+
"ETIMEDOUT",
|
|
1993
|
+
"ERR_NETWORK",
|
|
1994
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
1995
|
+
"ERR_DEPRECATED",
|
|
1996
|
+
"ERR_BAD_RESPONSE",
|
|
1997
|
+
"ERR_BAD_REQUEST",
|
|
1998
|
+
"ERR_CANCELED",
|
|
1999
|
+
"ERR_NOT_SUPPORT",
|
|
2000
|
+
"ERR_INVALID_URL"
|
|
2001
|
+
// eslint-disable-next-line func-names
|
|
2002
|
+
].forEach((code) => {
|
|
2003
|
+
descriptors[code] = { value: code };
|
|
2004
|
+
});
|
|
2005
|
+
Object.defineProperties(AxiosError$1, descriptors);
|
|
2006
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
|
|
2007
|
+
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
2008
|
+
const axiosError = Object.create(prototype$1);
|
|
2009
|
+
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
2010
|
+
return obj !== Error.prototype;
|
|
2011
|
+
}, (prop) => {
|
|
2012
|
+
return prop !== "isAxiosError";
|
|
2013
|
+
});
|
|
2014
|
+
const msg = error && error.message ? error.message : "Error";
|
|
2015
|
+
const errCode = code == null && error ? error.code : code;
|
|
2016
|
+
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
2017
|
+
if (error && axiosError.cause == null) {
|
|
2018
|
+
Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
|
|
2019
|
+
}
|
|
2020
|
+
axiosError.name = error && error.name || "Error";
|
|
2021
|
+
customProps && Object.assign(axiosError, customProps);
|
|
2022
|
+
return axiosError;
|
|
2023
|
+
};
|
|
2024
|
+
const httpAdapter = null;
|
|
2025
|
+
function isVisitable(thing) {
|
|
2026
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
2027
|
+
}
|
|
2028
|
+
function removeBrackets(key) {
|
|
2029
|
+
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
2030
|
+
}
|
|
2031
|
+
function renderKey(path, key, dots) {
|
|
2032
|
+
if (!path) return key;
|
|
2033
|
+
return path.concat(key).map(function each(token, i) {
|
|
2034
|
+
token = removeBrackets(token);
|
|
2035
|
+
return !dots && i ? "[" + token + "]" : token;
|
|
2036
|
+
}).join(dots ? "." : "");
|
|
2037
|
+
}
|
|
2038
|
+
function isFlatArray(arr) {
|
|
2039
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
2040
|
+
}
|
|
2041
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
2042
|
+
return /^is[A-Z]/.test(prop);
|
|
2043
|
+
});
|
|
2044
|
+
function toFormData$1(obj, formData, options) {
|
|
2045
|
+
if (!utils$1.isObject(obj)) {
|
|
2046
|
+
throw new TypeError("target must be an object");
|
|
2047
|
+
}
|
|
2048
|
+
formData = formData || new FormData();
|
|
2049
|
+
options = utils$1.toFlatObject(options, {
|
|
2050
|
+
metaTokens: true,
|
|
2051
|
+
dots: false,
|
|
2052
|
+
indexes: false
|
|
2053
|
+
}, false, function defined(option, source) {
|
|
2054
|
+
return !utils$1.isUndefined(source[option]);
|
|
2055
|
+
});
|
|
2056
|
+
const metaTokens = options.metaTokens;
|
|
2057
|
+
const visitor = options.visitor || defaultVisitor;
|
|
2058
|
+
const dots = options.dots;
|
|
2059
|
+
const indexes = options.indexes;
|
|
2060
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
2061
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
2062
|
+
if (!utils$1.isFunction(visitor)) {
|
|
2063
|
+
throw new TypeError("visitor must be a function");
|
|
2064
|
+
}
|
|
2065
|
+
function convertValue(value) {
|
|
2066
|
+
if (value === null) return "";
|
|
2067
|
+
if (utils$1.isDate(value)) {
|
|
2068
|
+
return value.toISOString();
|
|
2069
|
+
}
|
|
2070
|
+
if (utils$1.isBoolean(value)) {
|
|
2071
|
+
return value.toString();
|
|
2072
|
+
}
|
|
2073
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
2074
|
+
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
2075
|
+
}
|
|
2076
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
2077
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
2078
|
+
}
|
|
2079
|
+
return value;
|
|
2080
|
+
}
|
|
2081
|
+
function defaultVisitor(value, key, path) {
|
|
2082
|
+
let arr = value;
|
|
2083
|
+
if (value && !path && typeof value === "object") {
|
|
2084
|
+
if (utils$1.endsWith(key, "{}")) {
|
|
2085
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
2086
|
+
value = JSON.stringify(value);
|
|
2087
|
+
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
|
|
2088
|
+
key = removeBrackets(key);
|
|
2089
|
+
arr.forEach(function each(el, index) {
|
|
2090
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
2091
|
+
// eslint-disable-next-line no-nested-ternary
|
|
2092
|
+
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
2093
|
+
convertValue(el)
|
|
2094
|
+
);
|
|
2095
|
+
});
|
|
2096
|
+
return false;
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
if (isVisitable(value)) {
|
|
2100
|
+
return true;
|
|
2101
|
+
}
|
|
2102
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
2103
|
+
return false;
|
|
2104
|
+
}
|
|
2105
|
+
const stack = [];
|
|
2106
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
2107
|
+
defaultVisitor,
|
|
2108
|
+
convertValue,
|
|
2109
|
+
isVisitable
|
|
2110
|
+
});
|
|
2111
|
+
function build(value, path) {
|
|
2112
|
+
if (utils$1.isUndefined(value)) return;
|
|
2113
|
+
if (stack.indexOf(value) !== -1) {
|
|
2114
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
2115
|
+
}
|
|
2116
|
+
stack.push(value);
|
|
2117
|
+
utils$1.forEach(value, function each(el, key) {
|
|
2118
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
2119
|
+
formData,
|
|
2120
|
+
el,
|
|
2121
|
+
utils$1.isString(key) ? key.trim() : key,
|
|
2122
|
+
path,
|
|
2123
|
+
exposedHelpers
|
|
2124
|
+
);
|
|
2125
|
+
if (result === true) {
|
|
2126
|
+
build(el, path ? path.concat(key) : [key]);
|
|
2127
|
+
}
|
|
2128
|
+
});
|
|
2129
|
+
stack.pop();
|
|
2130
|
+
}
|
|
2131
|
+
if (!utils$1.isObject(obj)) {
|
|
2132
|
+
throw new TypeError("data must be an object");
|
|
2133
|
+
}
|
|
2134
|
+
build(obj);
|
|
2135
|
+
return formData;
|
|
2136
|
+
}
|
|
2137
|
+
function encode$1(str) {
|
|
2138
|
+
const charMap = {
|
|
2139
|
+
"!": "%21",
|
|
2140
|
+
"'": "%27",
|
|
2141
|
+
"(": "%28",
|
|
2142
|
+
")": "%29",
|
|
2143
|
+
"~": "%7E",
|
|
2144
|
+
"%20": "+",
|
|
2145
|
+
"%00": "\0"
|
|
2146
|
+
};
|
|
2147
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
2148
|
+
return charMap[match];
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
function AxiosURLSearchParams(params, options) {
|
|
2152
|
+
this._pairs = [];
|
|
2153
|
+
params && toFormData$1(params, this, options);
|
|
2154
|
+
}
|
|
2155
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
2156
|
+
prototype.append = function append(name, value) {
|
|
2157
|
+
this._pairs.push([name, value]);
|
|
2158
|
+
};
|
|
2159
|
+
prototype.toString = function toString2(encoder) {
|
|
2160
|
+
const _encode = encoder ? function(value) {
|
|
2161
|
+
return encoder.call(this, value, encode$1);
|
|
2162
|
+
} : encode$1;
|
|
2163
|
+
return this._pairs.map(function each(pair) {
|
|
2164
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
2165
|
+
}, "").join("&");
|
|
2166
|
+
};
|
|
2167
|
+
function encode(val) {
|
|
2168
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
2169
|
+
}
|
|
2170
|
+
function buildURL(url, params, options) {
|
|
2171
|
+
if (!params) {
|
|
2172
|
+
return url;
|
|
2173
|
+
}
|
|
2174
|
+
const _encode = options && options.encode || encode;
|
|
2175
|
+
if (utils$1.isFunction(options)) {
|
|
2176
|
+
options = {
|
|
2177
|
+
serialize: options
|
|
2178
|
+
};
|
|
2179
|
+
}
|
|
2180
|
+
const serializeFn = options && options.serialize;
|
|
2181
|
+
let serializedParams;
|
|
2182
|
+
if (serializeFn) {
|
|
2183
|
+
serializedParams = serializeFn(params, options);
|
|
2184
|
+
} else {
|
|
2185
|
+
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
|
|
2186
|
+
}
|
|
2187
|
+
if (serializedParams) {
|
|
2188
|
+
const hashmarkIndex = url.indexOf("#");
|
|
2189
|
+
if (hashmarkIndex !== -1) {
|
|
2190
|
+
url = url.slice(0, hashmarkIndex);
|
|
2191
|
+
}
|
|
2192
|
+
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
2193
|
+
}
|
|
2194
|
+
return url;
|
|
2195
|
+
}
|
|
2196
|
+
class InterceptorManager {
|
|
2197
|
+
constructor() {
|
|
2198
|
+
this.handlers = [];
|
|
2199
|
+
}
|
|
2200
|
+
/**
|
|
2201
|
+
* Add a new interceptor to the stack
|
|
2202
|
+
*
|
|
2203
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
2204
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
2205
|
+
*
|
|
2206
|
+
* @return {Number} An ID used to remove interceptor later
|
|
2207
|
+
*/
|
|
2208
|
+
use(fulfilled, rejected, options) {
|
|
2209
|
+
this.handlers.push({
|
|
2210
|
+
fulfilled,
|
|
2211
|
+
rejected,
|
|
2212
|
+
synchronous: options ? options.synchronous : false,
|
|
2213
|
+
runWhen: options ? options.runWhen : null
|
|
2214
|
+
});
|
|
2215
|
+
return this.handlers.length - 1;
|
|
2216
|
+
}
|
|
2217
|
+
/**
|
|
2218
|
+
* Remove an interceptor from the stack
|
|
2219
|
+
*
|
|
2220
|
+
* @param {Number} id The ID that was returned by `use`
|
|
2221
|
+
*
|
|
2222
|
+
* @returns {void}
|
|
2223
|
+
*/
|
|
2224
|
+
eject(id) {
|
|
2225
|
+
if (this.handlers[id]) {
|
|
2226
|
+
this.handlers[id] = null;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
/**
|
|
2230
|
+
* Clear all interceptors from the stack
|
|
2231
|
+
*
|
|
2232
|
+
* @returns {void}
|
|
2233
|
+
*/
|
|
2234
|
+
clear() {
|
|
2235
|
+
if (this.handlers) {
|
|
2236
|
+
this.handlers = [];
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Iterate over all the registered interceptors
|
|
2241
|
+
*
|
|
2242
|
+
* This method is particularly useful for skipping over any
|
|
2243
|
+
* interceptors that may have become `null` calling `eject`.
|
|
2244
|
+
*
|
|
2245
|
+
* @param {Function} fn The function to call for each interceptor
|
|
2246
|
+
*
|
|
2247
|
+
* @returns {void}
|
|
2248
|
+
*/
|
|
2249
|
+
forEach(fn) {
|
|
2250
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
2251
|
+
if (h !== null) {
|
|
2252
|
+
fn(h);
|
|
2253
|
+
}
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
const transitionalDefaults = {
|
|
2258
|
+
silentJSONParsing: true,
|
|
2259
|
+
forcedJSONParsing: true,
|
|
2260
|
+
clarifyTimeoutError: false
|
|
2261
|
+
};
|
|
2262
|
+
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
2263
|
+
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
|
2264
|
+
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
|
|
2265
|
+
const platform$1 = {
|
|
2266
|
+
isBrowser: true,
|
|
2267
|
+
classes: {
|
|
2268
|
+
URLSearchParams: URLSearchParams$1,
|
|
2269
|
+
FormData: FormData$1,
|
|
2270
|
+
Blob: Blob$1
|
|
2271
|
+
},
|
|
2272
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
2273
|
+
};
|
|
2274
|
+
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
2275
|
+
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
2276
|
+
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
2277
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
2278
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
2279
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
2280
|
+
})();
|
|
2281
|
+
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
2282
|
+
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2283
|
+
__proto__: null,
|
|
2284
|
+
hasBrowserEnv,
|
|
2285
|
+
hasStandardBrowserEnv,
|
|
2286
|
+
hasStandardBrowserWebWorkerEnv,
|
|
2287
|
+
navigator: _navigator,
|
|
2288
|
+
origin
|
|
2289
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2290
|
+
const platform = {
|
|
2291
|
+
...utils,
|
|
2292
|
+
...platform$1
|
|
2293
|
+
};
|
|
2294
|
+
function toURLEncodedForm(data, options) {
|
|
2295
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
2296
|
+
visitor: function(value, key, path, helpers) {
|
|
2297
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
2298
|
+
this.append(key, value.toString("base64"));
|
|
2299
|
+
return false;
|
|
2300
|
+
}
|
|
2301
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
2302
|
+
},
|
|
2303
|
+
...options
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
function parsePropPath(name) {
|
|
2307
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
2308
|
+
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
function arrayToObject(arr) {
|
|
2312
|
+
const obj = {};
|
|
2313
|
+
const keys = Object.keys(arr);
|
|
2314
|
+
let i;
|
|
2315
|
+
const len = keys.length;
|
|
2316
|
+
let key;
|
|
2317
|
+
for (i = 0; i < len; i++) {
|
|
2318
|
+
key = keys[i];
|
|
2319
|
+
obj[key] = arr[key];
|
|
2320
|
+
}
|
|
2321
|
+
return obj;
|
|
2322
|
+
}
|
|
2323
|
+
function formDataToJSON(formData) {
|
|
2324
|
+
function buildPath(path, value, target, index) {
|
|
2325
|
+
let name = path[index++];
|
|
2326
|
+
if (name === "__proto__") return true;
|
|
2327
|
+
const isNumericKey = Number.isFinite(+name);
|
|
2328
|
+
const isLast = index >= path.length;
|
|
2329
|
+
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
2330
|
+
if (isLast) {
|
|
2331
|
+
if (utils$1.hasOwnProp(target, name)) {
|
|
2332
|
+
target[name] = [target[name], value];
|
|
2333
|
+
} else {
|
|
2334
|
+
target[name] = value;
|
|
2335
|
+
}
|
|
2336
|
+
return !isNumericKey;
|
|
2337
|
+
}
|
|
2338
|
+
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
2339
|
+
target[name] = [];
|
|
2340
|
+
}
|
|
2341
|
+
const result = buildPath(path, value, target[name], index);
|
|
2342
|
+
if (result && utils$1.isArray(target[name])) {
|
|
2343
|
+
target[name] = arrayToObject(target[name]);
|
|
2344
|
+
}
|
|
2345
|
+
return !isNumericKey;
|
|
2346
|
+
}
|
|
2347
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
2348
|
+
const obj = {};
|
|
2349
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
2350
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
2351
|
+
});
|
|
2352
|
+
return obj;
|
|
2353
|
+
}
|
|
2354
|
+
return null;
|
|
2355
|
+
}
|
|
2356
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
2357
|
+
if (utils$1.isString(rawValue)) {
|
|
2358
|
+
try {
|
|
2359
|
+
(parser || JSON.parse)(rawValue);
|
|
2360
|
+
return utils$1.trim(rawValue);
|
|
2361
|
+
} catch (e) {
|
|
2362
|
+
if (e.name !== "SyntaxError") {
|
|
2363
|
+
throw e;
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
2368
|
+
}
|
|
2369
|
+
const defaults = {
|
|
2370
|
+
transitional: transitionalDefaults,
|
|
2371
|
+
adapter: ["xhr", "http", "fetch"],
|
|
2372
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
2373
|
+
const contentType = headers.getContentType() || "";
|
|
2374
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
2375
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
2376
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
2377
|
+
data = new FormData(data);
|
|
2378
|
+
}
|
|
2379
|
+
const isFormData2 = utils$1.isFormData(data);
|
|
2380
|
+
if (isFormData2) {
|
|
2381
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2382
|
+
}
|
|
2383
|
+
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
|
|
2384
|
+
return data;
|
|
2385
|
+
}
|
|
2386
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
2387
|
+
return data.buffer;
|
|
2388
|
+
}
|
|
2389
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
2390
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
2391
|
+
return data.toString();
|
|
2392
|
+
}
|
|
2393
|
+
let isFileList2;
|
|
2394
|
+
if (isObjectPayload) {
|
|
2395
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
2396
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
2397
|
+
}
|
|
2398
|
+
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
2399
|
+
const _FormData = this.env && this.env.FormData;
|
|
2400
|
+
return toFormData$1(
|
|
2401
|
+
isFileList2 ? { "files[]": data } : data,
|
|
2402
|
+
_FormData && new _FormData(),
|
|
2403
|
+
this.formSerializer
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2408
|
+
headers.setContentType("application/json", false);
|
|
2409
|
+
return stringifySafely(data);
|
|
2410
|
+
}
|
|
2411
|
+
return data;
|
|
2412
|
+
}],
|
|
2413
|
+
transformResponse: [function transformResponse(data) {
|
|
2414
|
+
const transitional = this.transitional || defaults.transitional;
|
|
2415
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2416
|
+
const JSONRequested = this.responseType === "json";
|
|
2417
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
2418
|
+
return data;
|
|
2419
|
+
}
|
|
2420
|
+
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
2421
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2422
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2423
|
+
try {
|
|
2424
|
+
return JSON.parse(data, this.parseReviver);
|
|
2425
|
+
} catch (e) {
|
|
2426
|
+
if (strictJSONParsing) {
|
|
2427
|
+
if (e.name === "SyntaxError") {
|
|
2428
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2429
|
+
}
|
|
2430
|
+
throw e;
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
return data;
|
|
2435
|
+
}],
|
|
2436
|
+
/**
|
|
2437
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
2438
|
+
* timeout is not created.
|
|
2439
|
+
*/
|
|
2440
|
+
timeout: 0,
|
|
2441
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
2442
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
2443
|
+
maxContentLength: -1,
|
|
2444
|
+
maxBodyLength: -1,
|
|
2445
|
+
env: {
|
|
2446
|
+
FormData: platform.classes.FormData,
|
|
2447
|
+
Blob: platform.classes.Blob
|
|
2448
|
+
},
|
|
2449
|
+
validateStatus: function validateStatus(status) {
|
|
2450
|
+
return status >= 200 && status < 300;
|
|
2451
|
+
},
|
|
2452
|
+
headers: {
|
|
2453
|
+
common: {
|
|
2454
|
+
"Accept": "application/json, text/plain, */*",
|
|
2455
|
+
"Content-Type": void 0
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
};
|
|
2459
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
2460
|
+
defaults.headers[method] = {};
|
|
2461
|
+
});
|
|
2462
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
2463
|
+
"age",
|
|
2464
|
+
"authorization",
|
|
2465
|
+
"content-length",
|
|
2466
|
+
"content-type",
|
|
2467
|
+
"etag",
|
|
2468
|
+
"expires",
|
|
2469
|
+
"from",
|
|
2470
|
+
"host",
|
|
2471
|
+
"if-modified-since",
|
|
2472
|
+
"if-unmodified-since",
|
|
2473
|
+
"last-modified",
|
|
2474
|
+
"location",
|
|
2475
|
+
"max-forwards",
|
|
2476
|
+
"proxy-authorization",
|
|
2477
|
+
"referer",
|
|
2478
|
+
"retry-after",
|
|
2479
|
+
"user-agent"
|
|
2480
|
+
]);
|
|
2481
|
+
const parseHeaders = (rawHeaders) => {
|
|
2482
|
+
const parsed = {};
|
|
2483
|
+
let key;
|
|
2484
|
+
let val;
|
|
2485
|
+
let i;
|
|
2486
|
+
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
2487
|
+
i = line.indexOf(":");
|
|
2488
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
2489
|
+
val = line.substring(i + 1).trim();
|
|
2490
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
2491
|
+
return;
|
|
2492
|
+
}
|
|
2493
|
+
if (key === "set-cookie") {
|
|
2494
|
+
if (parsed[key]) {
|
|
2495
|
+
parsed[key].push(val);
|
|
2496
|
+
} else {
|
|
2497
|
+
parsed[key] = [val];
|
|
2498
|
+
}
|
|
2499
|
+
} else {
|
|
2500
|
+
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
return parsed;
|
|
2504
|
+
};
|
|
2505
|
+
const $internals = /* @__PURE__ */ Symbol("internals");
|
|
2506
|
+
function normalizeHeader(header) {
|
|
2507
|
+
return header && String(header).trim().toLowerCase();
|
|
2508
|
+
}
|
|
2509
|
+
function normalizeValue(value) {
|
|
2510
|
+
if (value === false || value == null) {
|
|
2511
|
+
return value;
|
|
2512
|
+
}
|
|
2513
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2514
|
+
}
|
|
2515
|
+
function parseTokens(str) {
|
|
2516
|
+
const tokens = /* @__PURE__ */ Object.create(null);
|
|
2517
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
2518
|
+
let match;
|
|
2519
|
+
while (match = tokensRE.exec(str)) {
|
|
2520
|
+
tokens[match[1]] = match[2];
|
|
2521
|
+
}
|
|
2522
|
+
return tokens;
|
|
2523
|
+
}
|
|
2524
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
2525
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
2526
|
+
if (utils$1.isFunction(filter)) {
|
|
2527
|
+
return filter.call(this, value, header);
|
|
2528
|
+
}
|
|
2529
|
+
if (isHeaderNameFilter) {
|
|
2530
|
+
value = header;
|
|
2531
|
+
}
|
|
2532
|
+
if (!utils$1.isString(value)) return;
|
|
2533
|
+
if (utils$1.isString(filter)) {
|
|
2534
|
+
return value.indexOf(filter) !== -1;
|
|
2535
|
+
}
|
|
2536
|
+
if (utils$1.isRegExp(filter)) {
|
|
2537
|
+
return filter.test(value);
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
function formatHeader(header) {
|
|
2541
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char, str) => {
|
|
2542
|
+
return char.toUpperCase() + str;
|
|
2543
|
+
});
|
|
2544
|
+
}
|
|
2545
|
+
function buildAccessors(obj, header) {
|
|
2546
|
+
const accessorName = utils$1.toCamelCase(" " + header);
|
|
2547
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
2548
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
2549
|
+
value: function(arg1, arg2, arg3) {
|
|
2550
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
2551
|
+
},
|
|
2552
|
+
configurable: true
|
|
2553
|
+
});
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
let AxiosHeaders$1 = class AxiosHeaders {
|
|
2557
|
+
constructor(headers) {
|
|
2558
|
+
headers && this.set(headers);
|
|
2559
|
+
}
|
|
2560
|
+
set(header, valueOrRewrite, rewrite) {
|
|
2561
|
+
const self2 = this;
|
|
2562
|
+
function setHeader(_value, _header, _rewrite) {
|
|
2563
|
+
const lHeader = normalizeHeader(_header);
|
|
2564
|
+
if (!lHeader) {
|
|
2565
|
+
throw new Error("header name must be a non-empty string");
|
|
2566
|
+
}
|
|
2567
|
+
const key = utils$1.findKey(self2, lHeader);
|
|
2568
|
+
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
2569
|
+
self2[key || _header] = normalizeValue(_value);
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
2573
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
2574
|
+
setHeaders(header, valueOrRewrite);
|
|
2575
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2576
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
2577
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
2578
|
+
let obj = {}, dest, key;
|
|
2579
|
+
for (const entry of header) {
|
|
2580
|
+
if (!utils$1.isArray(entry)) {
|
|
2581
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
2582
|
+
}
|
|
2583
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
2584
|
+
}
|
|
2585
|
+
setHeaders(obj, valueOrRewrite);
|
|
2586
|
+
} else {
|
|
2587
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
2588
|
+
}
|
|
2589
|
+
return this;
|
|
2590
|
+
}
|
|
2591
|
+
get(header, parser) {
|
|
2592
|
+
header = normalizeHeader(header);
|
|
2593
|
+
if (header) {
|
|
2594
|
+
const key = utils$1.findKey(this, header);
|
|
2595
|
+
if (key) {
|
|
2596
|
+
const value = this[key];
|
|
2597
|
+
if (!parser) {
|
|
2598
|
+
return value;
|
|
2599
|
+
}
|
|
2600
|
+
if (parser === true) {
|
|
2601
|
+
return parseTokens(value);
|
|
2602
|
+
}
|
|
2603
|
+
if (utils$1.isFunction(parser)) {
|
|
2604
|
+
return parser.call(this, value, key);
|
|
2605
|
+
}
|
|
2606
|
+
if (utils$1.isRegExp(parser)) {
|
|
2607
|
+
return parser.exec(value);
|
|
2608
|
+
}
|
|
2609
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
has(header, matcher) {
|
|
2614
|
+
header = normalizeHeader(header);
|
|
2615
|
+
if (header) {
|
|
2616
|
+
const key = utils$1.findKey(this, header);
|
|
2617
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
2618
|
+
}
|
|
2619
|
+
return false;
|
|
2620
|
+
}
|
|
2621
|
+
delete(header, matcher) {
|
|
2622
|
+
const self2 = this;
|
|
2623
|
+
let deleted = false;
|
|
2624
|
+
function deleteHeader(_header) {
|
|
2625
|
+
_header = normalizeHeader(_header);
|
|
2626
|
+
if (_header) {
|
|
2627
|
+
const key = utils$1.findKey(self2, _header);
|
|
2628
|
+
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
2629
|
+
delete self2[key];
|
|
2630
|
+
deleted = true;
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
if (utils$1.isArray(header)) {
|
|
2635
|
+
header.forEach(deleteHeader);
|
|
2636
|
+
} else {
|
|
2637
|
+
deleteHeader(header);
|
|
2638
|
+
}
|
|
2639
|
+
return deleted;
|
|
2640
|
+
}
|
|
2641
|
+
clear(matcher) {
|
|
2642
|
+
const keys = Object.keys(this);
|
|
2643
|
+
let i = keys.length;
|
|
2644
|
+
let deleted = false;
|
|
2645
|
+
while (i--) {
|
|
2646
|
+
const key = keys[i];
|
|
2647
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2648
|
+
delete this[key];
|
|
2649
|
+
deleted = true;
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
return deleted;
|
|
2653
|
+
}
|
|
2654
|
+
normalize(format) {
|
|
2655
|
+
const self2 = this;
|
|
2656
|
+
const headers = {};
|
|
2657
|
+
utils$1.forEach(this, (value, header) => {
|
|
2658
|
+
const key = utils$1.findKey(headers, header);
|
|
2659
|
+
if (key) {
|
|
2660
|
+
self2[key] = normalizeValue(value);
|
|
2661
|
+
delete self2[header];
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
2665
|
+
if (normalized !== header) {
|
|
2666
|
+
delete self2[header];
|
|
2667
|
+
}
|
|
2668
|
+
self2[normalized] = normalizeValue(value);
|
|
2669
|
+
headers[normalized] = true;
|
|
2670
|
+
});
|
|
2671
|
+
return this;
|
|
2672
|
+
}
|
|
2673
|
+
concat(...targets) {
|
|
2674
|
+
return this.constructor.concat(this, ...targets);
|
|
2675
|
+
}
|
|
2676
|
+
toJSON(asStrings) {
|
|
2677
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
2678
|
+
utils$1.forEach(this, (value, header) => {
|
|
2679
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
|
|
2680
|
+
});
|
|
2681
|
+
return obj;
|
|
2682
|
+
}
|
|
2683
|
+
[Symbol.iterator]() {
|
|
2684
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
2685
|
+
}
|
|
2686
|
+
toString() {
|
|
2687
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
2688
|
+
}
|
|
2689
|
+
getSetCookie() {
|
|
2690
|
+
return this.get("set-cookie") || [];
|
|
2691
|
+
}
|
|
2692
|
+
get [Symbol.toStringTag]() {
|
|
2693
|
+
return "AxiosHeaders";
|
|
2694
|
+
}
|
|
2695
|
+
static from(thing) {
|
|
2696
|
+
return thing instanceof this ? thing : new this(thing);
|
|
2697
|
+
}
|
|
2698
|
+
static concat(first, ...targets) {
|
|
2699
|
+
const computed = new this(first);
|
|
2700
|
+
targets.forEach((target) => computed.set(target));
|
|
2701
|
+
return computed;
|
|
2702
|
+
}
|
|
2703
|
+
static accessor(header) {
|
|
2704
|
+
const internals = this[$internals] = this[$internals] = {
|
|
2705
|
+
accessors: {}
|
|
2706
|
+
};
|
|
2707
|
+
const accessors = internals.accessors;
|
|
2708
|
+
const prototype2 = this.prototype;
|
|
2709
|
+
function defineAccessor(_header) {
|
|
2710
|
+
const lHeader = normalizeHeader(_header);
|
|
2711
|
+
if (!accessors[lHeader]) {
|
|
2712
|
+
buildAccessors(prototype2, _header);
|
|
2713
|
+
accessors[lHeader] = true;
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
2717
|
+
return this;
|
|
2718
|
+
}
|
|
2719
|
+
};
|
|
2720
|
+
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
2721
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
2722
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
2723
|
+
return {
|
|
2724
|
+
get: () => value,
|
|
2725
|
+
set(headerValue) {
|
|
2726
|
+
this[mapped] = headerValue;
|
|
2727
|
+
}
|
|
2728
|
+
};
|
|
2729
|
+
});
|
|
2730
|
+
utils$1.freezeMethods(AxiosHeaders$1);
|
|
2731
|
+
function transformData(fns, response) {
|
|
2732
|
+
const config = this || defaults;
|
|
2733
|
+
const context = response || config;
|
|
2734
|
+
const headers = AxiosHeaders$1.from(context.headers);
|
|
2735
|
+
let data = context.data;
|
|
2736
|
+
utils$1.forEach(fns, function transform(fn) {
|
|
2737
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
2738
|
+
});
|
|
2739
|
+
headers.normalize();
|
|
2740
|
+
return data;
|
|
2741
|
+
}
|
|
2742
|
+
function isCancel$1(value) {
|
|
2743
|
+
return !!(value && value.__CANCEL__);
|
|
2744
|
+
}
|
|
2745
|
+
function CanceledError$1(message, config, request) {
|
|
2746
|
+
AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
2747
|
+
this.name = "CanceledError";
|
|
2748
|
+
}
|
|
2749
|
+
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
2750
|
+
__CANCEL__: true
|
|
2751
|
+
});
|
|
2752
|
+
function settle(resolve, reject, response) {
|
|
2753
|
+
const validateStatus = response.config.validateStatus;
|
|
2754
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2755
|
+
resolve(response);
|
|
2756
|
+
} else {
|
|
2757
|
+
reject(new AxiosError$1(
|
|
2758
|
+
"Request failed with status code " + response.status,
|
|
2759
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
2760
|
+
response.config,
|
|
2761
|
+
response.request,
|
|
2762
|
+
response
|
|
2763
|
+
));
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
function parseProtocol(url) {
|
|
2767
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2768
|
+
return match && match[1] || "";
|
|
2769
|
+
}
|
|
2770
|
+
function speedometer(samplesCount, min) {
|
|
2771
|
+
samplesCount = samplesCount || 10;
|
|
2772
|
+
const bytes = new Array(samplesCount);
|
|
2773
|
+
const timestamps = new Array(samplesCount);
|
|
2774
|
+
let head = 0;
|
|
2775
|
+
let tail = 0;
|
|
2776
|
+
let firstSampleTS;
|
|
2777
|
+
min = min !== void 0 ? min : 1e3;
|
|
2778
|
+
return function push(chunkLength) {
|
|
2779
|
+
const now = Date.now();
|
|
2780
|
+
const startedAt = timestamps[tail];
|
|
2781
|
+
if (!firstSampleTS) {
|
|
2782
|
+
firstSampleTS = now;
|
|
2783
|
+
}
|
|
2784
|
+
bytes[head] = chunkLength;
|
|
2785
|
+
timestamps[head] = now;
|
|
2786
|
+
let i = tail;
|
|
2787
|
+
let bytesCount = 0;
|
|
2788
|
+
while (i !== head) {
|
|
2789
|
+
bytesCount += bytes[i++];
|
|
2790
|
+
i = i % samplesCount;
|
|
2791
|
+
}
|
|
2792
|
+
head = (head + 1) % samplesCount;
|
|
2793
|
+
if (head === tail) {
|
|
2794
|
+
tail = (tail + 1) % samplesCount;
|
|
2795
|
+
}
|
|
2796
|
+
if (now - firstSampleTS < min) {
|
|
2797
|
+
return;
|
|
2798
|
+
}
|
|
2799
|
+
const passed = startedAt && now - startedAt;
|
|
2800
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
2801
|
+
};
|
|
2802
|
+
}
|
|
2803
|
+
function throttle(fn, freq) {
|
|
2804
|
+
let timestamp = 0;
|
|
2805
|
+
let threshold = 1e3 / freq;
|
|
2806
|
+
let lastArgs;
|
|
2807
|
+
let timer;
|
|
2808
|
+
const invoke = (args, now = Date.now()) => {
|
|
2809
|
+
timestamp = now;
|
|
2810
|
+
lastArgs = null;
|
|
2811
|
+
if (timer) {
|
|
2812
|
+
clearTimeout(timer);
|
|
2813
|
+
timer = null;
|
|
2814
|
+
}
|
|
2815
|
+
fn(...args);
|
|
2816
|
+
};
|
|
2817
|
+
const throttled = (...args) => {
|
|
2818
|
+
const now = Date.now();
|
|
2819
|
+
const passed = now - timestamp;
|
|
2820
|
+
if (passed >= threshold) {
|
|
2821
|
+
invoke(args, now);
|
|
2822
|
+
} else {
|
|
2823
|
+
lastArgs = args;
|
|
2824
|
+
if (!timer) {
|
|
2825
|
+
timer = setTimeout(() => {
|
|
2826
|
+
timer = null;
|
|
2827
|
+
invoke(lastArgs);
|
|
2828
|
+
}, threshold - passed);
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
};
|
|
2832
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
2833
|
+
return [throttled, flush];
|
|
2834
|
+
}
|
|
2835
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
2836
|
+
let bytesNotified = 0;
|
|
2837
|
+
const _speedometer = speedometer(50, 250);
|
|
2838
|
+
return throttle((e) => {
|
|
2839
|
+
const loaded = e.loaded;
|
|
2840
|
+
const total = e.lengthComputable ? e.total : void 0;
|
|
2841
|
+
const progressBytes = loaded - bytesNotified;
|
|
2842
|
+
const rate = _speedometer(progressBytes);
|
|
2843
|
+
const inRange = loaded <= total;
|
|
2844
|
+
bytesNotified = loaded;
|
|
2845
|
+
const data = {
|
|
2846
|
+
loaded,
|
|
2847
|
+
total,
|
|
2848
|
+
progress: total ? loaded / total : void 0,
|
|
2849
|
+
bytes: progressBytes,
|
|
2850
|
+
rate: rate ? rate : void 0,
|
|
2851
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
2852
|
+
event: e,
|
|
2853
|
+
lengthComputable: total != null,
|
|
2854
|
+
[isDownloadStream ? "download" : "upload"]: true
|
|
2855
|
+
};
|
|
2856
|
+
listener(data);
|
|
2857
|
+
}, freq);
|
|
2858
|
+
};
|
|
2859
|
+
const progressEventDecorator = (total, throttled) => {
|
|
2860
|
+
const lengthComputable = total != null;
|
|
2861
|
+
return [(loaded) => throttled[0]({
|
|
2862
|
+
lengthComputable,
|
|
2863
|
+
total,
|
|
2864
|
+
loaded
|
|
2865
|
+
}), throttled[1]];
|
|
2866
|
+
};
|
|
2867
|
+
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
2868
|
+
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
|
|
2869
|
+
url = new URL(url, platform.origin);
|
|
2870
|
+
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
|
|
2871
|
+
})(
|
|
2872
|
+
new URL(platform.origin),
|
|
2873
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2874
|
+
) : () => true;
|
|
2875
|
+
const cookies = platform.hasStandardBrowserEnv ? (
|
|
2876
|
+
// Standard browser envs support document.cookie
|
|
2877
|
+
{
|
|
2878
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2879
|
+
if (typeof document === "undefined") return;
|
|
2880
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
2881
|
+
if (utils$1.isNumber(expires)) {
|
|
2882
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
2883
|
+
}
|
|
2884
|
+
if (utils$1.isString(path)) {
|
|
2885
|
+
cookie.push(`path=${path}`);
|
|
2886
|
+
}
|
|
2887
|
+
if (utils$1.isString(domain)) {
|
|
2888
|
+
cookie.push(`domain=${domain}`);
|
|
2889
|
+
}
|
|
2890
|
+
if (secure === true) {
|
|
2891
|
+
cookie.push("secure");
|
|
2892
|
+
}
|
|
2893
|
+
if (utils$1.isString(sameSite)) {
|
|
2894
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
2895
|
+
}
|
|
2896
|
+
document.cookie = cookie.join("; ");
|
|
2897
|
+
},
|
|
2898
|
+
read(name) {
|
|
2899
|
+
if (typeof document === "undefined") return null;
|
|
2900
|
+
const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
|
|
2901
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
2902
|
+
},
|
|
2903
|
+
remove(name) {
|
|
2904
|
+
this.write(name, "", Date.now() - 864e5, "/");
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
) : (
|
|
2908
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
2909
|
+
{
|
|
2910
|
+
write() {
|
|
2911
|
+
},
|
|
2912
|
+
read() {
|
|
2913
|
+
return null;
|
|
2914
|
+
},
|
|
2915
|
+
remove() {
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
);
|
|
2919
|
+
function isAbsoluteURL(url) {
|
|
2920
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
2921
|
+
}
|
|
2922
|
+
function combineURLs(baseURL, relativeURL) {
|
|
2923
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
2924
|
+
}
|
|
2925
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2926
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2927
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
2928
|
+
return combineURLs(baseURL, requestedURL);
|
|
2929
|
+
}
|
|
2930
|
+
return requestedURL;
|
|
2931
|
+
}
|
|
2932
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
2933
|
+
function mergeConfig$1(config1, config2) {
|
|
2934
|
+
config2 = config2 || {};
|
|
2935
|
+
const config = {};
|
|
2936
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
2937
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2938
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
2939
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
2940
|
+
return utils$1.merge({}, source);
|
|
2941
|
+
} else if (utils$1.isArray(source)) {
|
|
2942
|
+
return source.slice();
|
|
2943
|
+
}
|
|
2944
|
+
return source;
|
|
2945
|
+
}
|
|
2946
|
+
function mergeDeepProperties(a, b2, prop, caseless) {
|
|
2947
|
+
if (!utils$1.isUndefined(b2)) {
|
|
2948
|
+
return getMergedValue(a, b2, prop, caseless);
|
|
2949
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2950
|
+
return getMergedValue(void 0, a, prop, caseless);
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
function valueFromConfig2(a, b2) {
|
|
2954
|
+
if (!utils$1.isUndefined(b2)) {
|
|
2955
|
+
return getMergedValue(void 0, b2);
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
function defaultToConfig2(a, b2) {
|
|
2959
|
+
if (!utils$1.isUndefined(b2)) {
|
|
2960
|
+
return getMergedValue(void 0, b2);
|
|
2961
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2962
|
+
return getMergedValue(void 0, a);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
function mergeDirectKeys(a, b2, prop) {
|
|
2966
|
+
if (prop in config2) {
|
|
2967
|
+
return getMergedValue(a, b2);
|
|
2968
|
+
} else if (prop in config1) {
|
|
2969
|
+
return getMergedValue(void 0, a);
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
const mergeMap = {
|
|
2973
|
+
url: valueFromConfig2,
|
|
2974
|
+
method: valueFromConfig2,
|
|
2975
|
+
data: valueFromConfig2,
|
|
2976
|
+
baseURL: defaultToConfig2,
|
|
2977
|
+
transformRequest: defaultToConfig2,
|
|
2978
|
+
transformResponse: defaultToConfig2,
|
|
2979
|
+
paramsSerializer: defaultToConfig2,
|
|
2980
|
+
timeout: defaultToConfig2,
|
|
2981
|
+
timeoutMessage: defaultToConfig2,
|
|
2982
|
+
withCredentials: defaultToConfig2,
|
|
2983
|
+
withXSRFToken: defaultToConfig2,
|
|
2984
|
+
adapter: defaultToConfig2,
|
|
2985
|
+
responseType: defaultToConfig2,
|
|
2986
|
+
xsrfCookieName: defaultToConfig2,
|
|
2987
|
+
xsrfHeaderName: defaultToConfig2,
|
|
2988
|
+
onUploadProgress: defaultToConfig2,
|
|
2989
|
+
onDownloadProgress: defaultToConfig2,
|
|
2990
|
+
decompress: defaultToConfig2,
|
|
2991
|
+
maxContentLength: defaultToConfig2,
|
|
2992
|
+
maxBodyLength: defaultToConfig2,
|
|
2993
|
+
beforeRedirect: defaultToConfig2,
|
|
2994
|
+
transport: defaultToConfig2,
|
|
2995
|
+
httpAgent: defaultToConfig2,
|
|
2996
|
+
httpsAgent: defaultToConfig2,
|
|
2997
|
+
cancelToken: defaultToConfig2,
|
|
2998
|
+
socketPath: defaultToConfig2,
|
|
2999
|
+
responseEncoding: defaultToConfig2,
|
|
3000
|
+
validateStatus: mergeDirectKeys,
|
|
3001
|
+
headers: (a, b2, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b2), prop, true)
|
|
3002
|
+
};
|
|
3003
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
3004
|
+
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
3005
|
+
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
3006
|
+
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
3007
|
+
});
|
|
3008
|
+
return config;
|
|
3009
|
+
}
|
|
3010
|
+
const resolveConfig = (config) => {
|
|
3011
|
+
const newConfig = mergeConfig$1({}, config);
|
|
3012
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
3013
|
+
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
3014
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
3015
|
+
if (auth) {
|
|
3016
|
+
headers.set(
|
|
3017
|
+
"Authorization",
|
|
3018
|
+
"Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
|
|
3019
|
+
);
|
|
3020
|
+
}
|
|
3021
|
+
if (utils$1.isFormData(data)) {
|
|
3022
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
3023
|
+
headers.setContentType(void 0);
|
|
3024
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
3025
|
+
const formHeaders = data.getHeaders();
|
|
3026
|
+
const allowedHeaders = ["content-type", "content-length"];
|
|
3027
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
3028
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
3029
|
+
headers.set(key, val);
|
|
3030
|
+
}
|
|
3031
|
+
});
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
if (platform.hasStandardBrowserEnv) {
|
|
3035
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
3036
|
+
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
3037
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
3038
|
+
if (xsrfValue) {
|
|
3039
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
return newConfig;
|
|
3044
|
+
};
|
|
3045
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
3046
|
+
const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
3047
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3048
|
+
const _config = resolveConfig(config);
|
|
3049
|
+
let requestData = _config.data;
|
|
3050
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
3051
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
3052
|
+
let onCanceled;
|
|
3053
|
+
let uploadThrottled, downloadThrottled;
|
|
3054
|
+
let flushUpload, flushDownload;
|
|
3055
|
+
function done() {
|
|
3056
|
+
flushUpload && flushUpload();
|
|
3057
|
+
flushDownload && flushDownload();
|
|
3058
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
3059
|
+
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
3060
|
+
}
|
|
3061
|
+
let request = new XMLHttpRequest();
|
|
3062
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
3063
|
+
request.timeout = _config.timeout;
|
|
3064
|
+
function onloadend() {
|
|
3065
|
+
if (!request) {
|
|
3066
|
+
return;
|
|
3067
|
+
}
|
|
3068
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
3069
|
+
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
3070
|
+
);
|
|
3071
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
3072
|
+
const response = {
|
|
3073
|
+
data: responseData,
|
|
3074
|
+
status: request.status,
|
|
3075
|
+
statusText: request.statusText,
|
|
3076
|
+
headers: responseHeaders,
|
|
3077
|
+
config,
|
|
3078
|
+
request
|
|
3079
|
+
};
|
|
3080
|
+
settle(function _resolve(value) {
|
|
3081
|
+
resolve(value);
|
|
3082
|
+
done();
|
|
3083
|
+
}, function _reject(err) {
|
|
3084
|
+
reject(err);
|
|
3085
|
+
done();
|
|
3086
|
+
}, response);
|
|
3087
|
+
request = null;
|
|
3088
|
+
}
|
|
3089
|
+
if ("onloadend" in request) {
|
|
3090
|
+
request.onloadend = onloadend;
|
|
3091
|
+
} else {
|
|
3092
|
+
request.onreadystatechange = function handleLoad() {
|
|
3093
|
+
if (!request || request.readyState !== 4) {
|
|
3094
|
+
return;
|
|
3095
|
+
}
|
|
3096
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
3097
|
+
return;
|
|
3098
|
+
}
|
|
3099
|
+
setTimeout(onloadend);
|
|
3100
|
+
};
|
|
3101
|
+
}
|
|
3102
|
+
request.onabort = function handleAbort() {
|
|
3103
|
+
if (!request) {
|
|
3104
|
+
return;
|
|
3105
|
+
}
|
|
3106
|
+
reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
|
|
3107
|
+
request = null;
|
|
3108
|
+
};
|
|
3109
|
+
request.onerror = function handleError(event) {
|
|
3110
|
+
const msg = event && event.message ? event.message : "Network Error";
|
|
3111
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
3112
|
+
err.event = event || null;
|
|
3113
|
+
reject(err);
|
|
3114
|
+
request = null;
|
|
3115
|
+
};
|
|
3116
|
+
request.ontimeout = function handleTimeout() {
|
|
3117
|
+
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
3118
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
3119
|
+
if (_config.timeoutErrorMessage) {
|
|
3120
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3121
|
+
}
|
|
3122
|
+
reject(new AxiosError$1(
|
|
3123
|
+
timeoutErrorMessage,
|
|
3124
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
3125
|
+
config,
|
|
3126
|
+
request
|
|
3127
|
+
));
|
|
3128
|
+
request = null;
|
|
3129
|
+
};
|
|
3130
|
+
requestData === void 0 && requestHeaders.setContentType(null);
|
|
3131
|
+
if ("setRequestHeader" in request) {
|
|
3132
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
3133
|
+
request.setRequestHeader(key, val);
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3136
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
3137
|
+
request.withCredentials = !!_config.withCredentials;
|
|
3138
|
+
}
|
|
3139
|
+
if (responseType && responseType !== "json") {
|
|
3140
|
+
request.responseType = _config.responseType;
|
|
3141
|
+
}
|
|
3142
|
+
if (onDownloadProgress) {
|
|
3143
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
3144
|
+
request.addEventListener("progress", downloadThrottled);
|
|
3145
|
+
}
|
|
3146
|
+
if (onUploadProgress && request.upload) {
|
|
3147
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
3148
|
+
request.upload.addEventListener("progress", uploadThrottled);
|
|
3149
|
+
request.upload.addEventListener("loadend", flushUpload);
|
|
3150
|
+
}
|
|
3151
|
+
if (_config.cancelToken || _config.signal) {
|
|
3152
|
+
onCanceled = (cancel) => {
|
|
3153
|
+
if (!request) {
|
|
3154
|
+
return;
|
|
3155
|
+
}
|
|
3156
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
3157
|
+
request.abort();
|
|
3158
|
+
request = null;
|
|
3159
|
+
};
|
|
3160
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3161
|
+
if (_config.signal) {
|
|
3162
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
const protocol = parseProtocol(_config.url);
|
|
3166
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3167
|
+
reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
|
|
3168
|
+
return;
|
|
3169
|
+
}
|
|
3170
|
+
request.send(requestData || null);
|
|
3171
|
+
});
|
|
3172
|
+
};
|
|
3173
|
+
const composeSignals = (signals, timeout) => {
|
|
3174
|
+
const { length } = signals = signals ? signals.filter(Boolean) : [];
|
|
3175
|
+
if (timeout || length) {
|
|
3176
|
+
let controller = new AbortController();
|
|
3177
|
+
let aborted;
|
|
3178
|
+
const onabort = function(reason) {
|
|
3179
|
+
if (!aborted) {
|
|
3180
|
+
aborted = true;
|
|
3181
|
+
unsubscribe();
|
|
3182
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
3183
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
3184
|
+
}
|
|
3185
|
+
};
|
|
3186
|
+
let timer = timeout && setTimeout(() => {
|
|
3187
|
+
timer = null;
|
|
3188
|
+
onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
3189
|
+
}, timeout);
|
|
3190
|
+
const unsubscribe = () => {
|
|
3191
|
+
if (signals) {
|
|
3192
|
+
timer && clearTimeout(timer);
|
|
3193
|
+
timer = null;
|
|
3194
|
+
signals.forEach((signal2) => {
|
|
3195
|
+
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
3196
|
+
});
|
|
3197
|
+
signals = null;
|
|
3198
|
+
}
|
|
3199
|
+
};
|
|
3200
|
+
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
3201
|
+
const { signal } = controller;
|
|
3202
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
3203
|
+
return signal;
|
|
3204
|
+
}
|
|
3205
|
+
};
|
|
3206
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
3207
|
+
let len = chunk.byteLength;
|
|
3208
|
+
if (len < chunkSize) {
|
|
3209
|
+
yield chunk;
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
let pos = 0;
|
|
3213
|
+
let end;
|
|
3214
|
+
while (pos < len) {
|
|
3215
|
+
end = pos + chunkSize;
|
|
3216
|
+
yield chunk.slice(pos, end);
|
|
3217
|
+
pos = end;
|
|
3218
|
+
}
|
|
3219
|
+
};
|
|
3220
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
3221
|
+
for await (const chunk of readStream(iterable)) {
|
|
3222
|
+
yield* streamChunk(chunk, chunkSize);
|
|
3223
|
+
}
|
|
3224
|
+
};
|
|
3225
|
+
const readStream = async function* (stream) {
|
|
3226
|
+
if (stream[Symbol.asyncIterator]) {
|
|
3227
|
+
yield* stream;
|
|
3228
|
+
return;
|
|
3229
|
+
}
|
|
3230
|
+
const reader = stream.getReader();
|
|
3231
|
+
try {
|
|
3232
|
+
for (; ; ) {
|
|
3233
|
+
const { done, value } = await reader.read();
|
|
3234
|
+
if (done) {
|
|
3235
|
+
break;
|
|
3236
|
+
}
|
|
3237
|
+
yield value;
|
|
3238
|
+
}
|
|
3239
|
+
} finally {
|
|
3240
|
+
await reader.cancel();
|
|
3241
|
+
}
|
|
3242
|
+
};
|
|
3243
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
3244
|
+
const iterator2 = readBytes(stream, chunkSize);
|
|
3245
|
+
let bytes = 0;
|
|
3246
|
+
let done;
|
|
3247
|
+
let _onFinish = (e) => {
|
|
3248
|
+
if (!done) {
|
|
3249
|
+
done = true;
|
|
3250
|
+
onFinish && onFinish(e);
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
return new ReadableStream({
|
|
3254
|
+
async pull(controller) {
|
|
3255
|
+
try {
|
|
3256
|
+
const { done: done2, value } = await iterator2.next();
|
|
3257
|
+
if (done2) {
|
|
3258
|
+
_onFinish();
|
|
3259
|
+
controller.close();
|
|
3260
|
+
return;
|
|
3261
|
+
}
|
|
3262
|
+
let len = value.byteLength;
|
|
3263
|
+
if (onProgress) {
|
|
3264
|
+
let loadedBytes = bytes += len;
|
|
3265
|
+
onProgress(loadedBytes);
|
|
3266
|
+
}
|
|
3267
|
+
controller.enqueue(new Uint8Array(value));
|
|
3268
|
+
} catch (err) {
|
|
3269
|
+
_onFinish(err);
|
|
3270
|
+
throw err;
|
|
3271
|
+
}
|
|
3272
|
+
},
|
|
3273
|
+
cancel(reason) {
|
|
3274
|
+
_onFinish(reason);
|
|
3275
|
+
return iterator2.return();
|
|
3276
|
+
}
|
|
3277
|
+
}, {
|
|
3278
|
+
highWaterMark: 2
|
|
3279
|
+
});
|
|
3280
|
+
};
|
|
3281
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3282
|
+
const { isFunction } = utils$1;
|
|
3283
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
3284
|
+
Request,
|
|
3285
|
+
Response
|
|
3286
|
+
}))(utils$1.global);
|
|
3287
|
+
const {
|
|
3288
|
+
ReadableStream: ReadableStream$1,
|
|
3289
|
+
TextEncoder
|
|
3290
|
+
} = utils$1.global;
|
|
3291
|
+
const test = (fn, ...args) => {
|
|
3292
|
+
try {
|
|
3293
|
+
return !!fn(...args);
|
|
3294
|
+
} catch (e) {
|
|
3295
|
+
return false;
|
|
3296
|
+
}
|
|
3297
|
+
};
|
|
3298
|
+
const factory = (env) => {
|
|
3299
|
+
env = utils$1.merge.call({
|
|
3300
|
+
skipUndefined: true
|
|
3301
|
+
}, globalFetchAPI, env);
|
|
3302
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
3303
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
|
|
3304
|
+
const isRequestSupported = isFunction(Request);
|
|
3305
|
+
const isResponseSupported = isFunction(Response);
|
|
3306
|
+
if (!isFetchSupported) {
|
|
3307
|
+
return false;
|
|
3308
|
+
}
|
|
3309
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
3310
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
3311
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
3312
|
+
let duplexAccessed = false;
|
|
3313
|
+
const hasContentType = new Request(platform.origin, {
|
|
3314
|
+
body: new ReadableStream$1(),
|
|
3315
|
+
method: "POST",
|
|
3316
|
+
get duplex() {
|
|
3317
|
+
duplexAccessed = true;
|
|
3318
|
+
return "half";
|
|
3319
|
+
}
|
|
3320
|
+
}).headers.has("Content-Type");
|
|
3321
|
+
return duplexAccessed && !hasContentType;
|
|
3322
|
+
});
|
|
3323
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
3324
|
+
const resolvers = {
|
|
3325
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
3326
|
+
};
|
|
3327
|
+
isFetchSupported && (() => {
|
|
3328
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
3329
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
3330
|
+
let method = res && res[type];
|
|
3331
|
+
if (method) {
|
|
3332
|
+
return method.call(res);
|
|
3333
|
+
}
|
|
3334
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
3335
|
+
});
|
|
3336
|
+
});
|
|
3337
|
+
})();
|
|
3338
|
+
const getBodyLength = async (body) => {
|
|
3339
|
+
if (body == null) {
|
|
3340
|
+
return 0;
|
|
3341
|
+
}
|
|
3342
|
+
if (utils$1.isBlob(body)) {
|
|
3343
|
+
return body.size;
|
|
3344
|
+
}
|
|
3345
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
3346
|
+
const _request = new Request(platform.origin, {
|
|
3347
|
+
method: "POST",
|
|
3348
|
+
body
|
|
3349
|
+
});
|
|
3350
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
3351
|
+
}
|
|
3352
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
3353
|
+
return body.byteLength;
|
|
3354
|
+
}
|
|
3355
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
3356
|
+
body = body + "";
|
|
3357
|
+
}
|
|
3358
|
+
if (utils$1.isString(body)) {
|
|
3359
|
+
return (await encodeText(body)).byteLength;
|
|
3360
|
+
}
|
|
3361
|
+
};
|
|
3362
|
+
const resolveBodyLength = async (headers, body) => {
|
|
3363
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
3364
|
+
return length == null ? getBodyLength(body) : length;
|
|
3365
|
+
};
|
|
3366
|
+
return async (config) => {
|
|
3367
|
+
let {
|
|
3368
|
+
url,
|
|
3369
|
+
method,
|
|
3370
|
+
data,
|
|
3371
|
+
signal,
|
|
3372
|
+
cancelToken,
|
|
3373
|
+
timeout,
|
|
3374
|
+
onDownloadProgress,
|
|
3375
|
+
onUploadProgress,
|
|
3376
|
+
responseType,
|
|
3377
|
+
headers,
|
|
3378
|
+
withCredentials = "same-origin",
|
|
3379
|
+
fetchOptions
|
|
3380
|
+
} = resolveConfig(config);
|
|
3381
|
+
let _fetch = envFetch || fetch;
|
|
3382
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
3383
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
3384
|
+
let request = null;
|
|
3385
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
3386
|
+
composedSignal.unsubscribe();
|
|
3387
|
+
});
|
|
3388
|
+
let requestContentLength;
|
|
3389
|
+
try {
|
|
3390
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
3391
|
+
let _request = new Request(url, {
|
|
3392
|
+
method: "POST",
|
|
3393
|
+
body: data,
|
|
3394
|
+
duplex: "half"
|
|
3395
|
+
});
|
|
3396
|
+
let contentTypeHeader;
|
|
3397
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
3398
|
+
headers.setContentType(contentTypeHeader);
|
|
3399
|
+
}
|
|
3400
|
+
if (_request.body) {
|
|
3401
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
3402
|
+
requestContentLength,
|
|
3403
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
3404
|
+
);
|
|
3405
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
if (!utils$1.isString(withCredentials)) {
|
|
3409
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
3410
|
+
}
|
|
3411
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
3412
|
+
const resolvedOptions = {
|
|
3413
|
+
...fetchOptions,
|
|
3414
|
+
signal: composedSignal,
|
|
3415
|
+
method: method.toUpperCase(),
|
|
3416
|
+
headers: headers.normalize().toJSON(),
|
|
3417
|
+
body: data,
|
|
3418
|
+
duplex: "half",
|
|
3419
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
3420
|
+
};
|
|
3421
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3422
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
3423
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
3424
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
3425
|
+
const options = {};
|
|
3426
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
3427
|
+
options[prop] = response[prop];
|
|
3428
|
+
});
|
|
3429
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
|
|
3430
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
3431
|
+
responseContentLength,
|
|
3432
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
3433
|
+
) || [];
|
|
3434
|
+
response = new Response(
|
|
3435
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
3436
|
+
flush && flush();
|
|
3437
|
+
unsubscribe && unsubscribe();
|
|
3438
|
+
}),
|
|
3439
|
+
options
|
|
3440
|
+
);
|
|
3441
|
+
}
|
|
3442
|
+
responseType = responseType || "text";
|
|
3443
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
|
|
3444
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3445
|
+
return await new Promise((resolve, reject) => {
|
|
3446
|
+
settle(resolve, reject, {
|
|
3447
|
+
data: responseData,
|
|
3448
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
3449
|
+
status: response.status,
|
|
3450
|
+
statusText: response.statusText,
|
|
3451
|
+
config,
|
|
3452
|
+
request
|
|
3453
|
+
});
|
|
3454
|
+
});
|
|
3455
|
+
} catch (err) {
|
|
3456
|
+
unsubscribe && unsubscribe();
|
|
3457
|
+
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
3458
|
+
throw Object.assign(
|
|
3459
|
+
new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
|
|
3460
|
+
{
|
|
3461
|
+
cause: err.cause || err
|
|
3462
|
+
}
|
|
3463
|
+
);
|
|
3464
|
+
}
|
|
3465
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
3466
|
+
}
|
|
3467
|
+
};
|
|
3468
|
+
};
|
|
3469
|
+
const seedCache = /* @__PURE__ */ new Map();
|
|
3470
|
+
const getFetch = (config) => {
|
|
3471
|
+
let env = config && config.env || {};
|
|
3472
|
+
const { fetch: fetch2, Request, Response } = env;
|
|
3473
|
+
const seeds = [
|
|
3474
|
+
Request,
|
|
3475
|
+
Response,
|
|
3476
|
+
fetch2
|
|
3477
|
+
];
|
|
3478
|
+
let len = seeds.length, i = len, seed, target, map = seedCache;
|
|
3479
|
+
while (i--) {
|
|
3480
|
+
seed = seeds[i];
|
|
3481
|
+
target = map.get(seed);
|
|
3482
|
+
target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env));
|
|
3483
|
+
map = target;
|
|
3484
|
+
}
|
|
3485
|
+
return target;
|
|
3486
|
+
};
|
|
3487
|
+
getFetch();
|
|
3488
|
+
const knownAdapters = {
|
|
3489
|
+
http: httpAdapter,
|
|
3490
|
+
xhr: xhrAdapter,
|
|
3491
|
+
fetch: {
|
|
3492
|
+
get: getFetch
|
|
3493
|
+
}
|
|
3494
|
+
};
|
|
3495
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
3496
|
+
if (fn) {
|
|
3497
|
+
try {
|
|
3498
|
+
Object.defineProperty(fn, "name", { value });
|
|
3499
|
+
} catch (e) {
|
|
3500
|
+
}
|
|
3501
|
+
Object.defineProperty(fn, "adapterName", { value });
|
|
3502
|
+
}
|
|
3503
|
+
});
|
|
3504
|
+
const renderReason = (reason) => `- ${reason}`;
|
|
3505
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3506
|
+
function getAdapter$1(adapters2, config) {
|
|
3507
|
+
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
|
|
3508
|
+
const { length } = adapters2;
|
|
3509
|
+
let nameOrAdapter;
|
|
3510
|
+
let adapter;
|
|
3511
|
+
const rejectedReasons = {};
|
|
3512
|
+
for (let i = 0; i < length; i++) {
|
|
3513
|
+
nameOrAdapter = adapters2[i];
|
|
3514
|
+
let id;
|
|
3515
|
+
adapter = nameOrAdapter;
|
|
3516
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
3517
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3518
|
+
if (adapter === void 0) {
|
|
3519
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
3523
|
+
break;
|
|
3524
|
+
}
|
|
3525
|
+
rejectedReasons[id || "#" + i] = adapter;
|
|
3526
|
+
}
|
|
3527
|
+
if (!adapter) {
|
|
3528
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
3529
|
+
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
3530
|
+
);
|
|
3531
|
+
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
3532
|
+
throw new AxiosError$1(
|
|
3533
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
3534
|
+
"ERR_NOT_SUPPORT"
|
|
3535
|
+
);
|
|
3536
|
+
}
|
|
3537
|
+
return adapter;
|
|
3538
|
+
}
|
|
3539
|
+
const adapters = {
|
|
3540
|
+
/**
|
|
3541
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
3542
|
+
* @type {Function}
|
|
3543
|
+
*/
|
|
3544
|
+
getAdapter: getAdapter$1,
|
|
3545
|
+
/**
|
|
3546
|
+
* Exposes all known adapters
|
|
3547
|
+
* @type {Object<string, Function|Object>}
|
|
3548
|
+
*/
|
|
3549
|
+
adapters: knownAdapters
|
|
3550
|
+
};
|
|
3551
|
+
function throwIfCancellationRequested(config) {
|
|
3552
|
+
if (config.cancelToken) {
|
|
3553
|
+
config.cancelToken.throwIfRequested();
|
|
3554
|
+
}
|
|
3555
|
+
if (config.signal && config.signal.aborted) {
|
|
3556
|
+
throw new CanceledError$1(null, config);
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
function dispatchRequest(config) {
|
|
3560
|
+
throwIfCancellationRequested(config);
|
|
3561
|
+
config.headers = AxiosHeaders$1.from(config.headers);
|
|
3562
|
+
config.data = transformData.call(
|
|
3563
|
+
config,
|
|
3564
|
+
config.transformRequest
|
|
3565
|
+
);
|
|
3566
|
+
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
3567
|
+
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
3568
|
+
}
|
|
3569
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
3570
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
|
3571
|
+
throwIfCancellationRequested(config);
|
|
3572
|
+
response.data = transformData.call(
|
|
3573
|
+
config,
|
|
3574
|
+
config.transformResponse,
|
|
3575
|
+
response
|
|
3576
|
+
);
|
|
3577
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3578
|
+
return response;
|
|
3579
|
+
}, function onAdapterRejection(reason) {
|
|
3580
|
+
if (!isCancel$1(reason)) {
|
|
3581
|
+
throwIfCancellationRequested(config);
|
|
3582
|
+
if (reason && reason.response) {
|
|
3583
|
+
reason.response.data = transformData.call(
|
|
3584
|
+
config,
|
|
3585
|
+
config.transformResponse,
|
|
3586
|
+
reason.response
|
|
3587
|
+
);
|
|
3588
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
return Promise.reject(reason);
|
|
3592
|
+
});
|
|
3593
|
+
}
|
|
3594
|
+
const VERSION$1 = "1.13.2";
|
|
3595
|
+
const validators$1 = {};
|
|
3596
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
3597
|
+
validators$1[type] = function validator2(thing) {
|
|
3598
|
+
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
3599
|
+
};
|
|
3600
|
+
});
|
|
3601
|
+
const deprecatedWarnings = {};
|
|
3602
|
+
validators$1.transitional = function transitional(validator2, version, message) {
|
|
3603
|
+
function formatMessage(opt, desc) {
|
|
3604
|
+
return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
3605
|
+
}
|
|
3606
|
+
return (value, opt, opts) => {
|
|
3607
|
+
if (validator2 === false) {
|
|
3608
|
+
throw new AxiosError$1(
|
|
3609
|
+
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
3610
|
+
AxiosError$1.ERR_DEPRECATED
|
|
3611
|
+
);
|
|
3612
|
+
}
|
|
3613
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
3614
|
+
deprecatedWarnings[opt] = true;
|
|
3615
|
+
console.warn(
|
|
3616
|
+
formatMessage(
|
|
3617
|
+
opt,
|
|
3618
|
+
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
3619
|
+
)
|
|
3620
|
+
);
|
|
3621
|
+
}
|
|
3622
|
+
return validator2 ? validator2(value, opt, opts) : true;
|
|
3623
|
+
};
|
|
3624
|
+
};
|
|
3625
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
3626
|
+
return (value, opt) => {
|
|
3627
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
3628
|
+
return true;
|
|
3629
|
+
};
|
|
3630
|
+
};
|
|
3631
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
3632
|
+
if (typeof options !== "object") {
|
|
3633
|
+
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
3634
|
+
}
|
|
3635
|
+
const keys = Object.keys(options);
|
|
3636
|
+
let i = keys.length;
|
|
3637
|
+
while (i-- > 0) {
|
|
3638
|
+
const opt = keys[i];
|
|
3639
|
+
const validator2 = schema[opt];
|
|
3640
|
+
if (validator2) {
|
|
3641
|
+
const value = options[opt];
|
|
3642
|
+
const result = value === void 0 || validator2(value, opt, options);
|
|
3643
|
+
if (result !== true) {
|
|
3644
|
+
throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
3645
|
+
}
|
|
3646
|
+
continue;
|
|
3647
|
+
}
|
|
3648
|
+
if (allowUnknown !== true) {
|
|
3649
|
+
throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
const validator = {
|
|
3654
|
+
assertOptions,
|
|
3655
|
+
validators: validators$1
|
|
3656
|
+
};
|
|
3657
|
+
const validators = validator.validators;
|
|
3658
|
+
let Axios$1 = class Axios {
|
|
3659
|
+
constructor(instanceConfig) {
|
|
3660
|
+
this.defaults = instanceConfig || {};
|
|
3661
|
+
this.interceptors = {
|
|
3662
|
+
request: new InterceptorManager(),
|
|
3663
|
+
response: new InterceptorManager()
|
|
3664
|
+
};
|
|
3665
|
+
}
|
|
3666
|
+
/**
|
|
3667
|
+
* Dispatch a request
|
|
3668
|
+
*
|
|
3669
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
3670
|
+
* @param {?Object} config
|
|
3671
|
+
*
|
|
3672
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
3673
|
+
*/
|
|
3674
|
+
async request(configOrUrl, config) {
|
|
3675
|
+
try {
|
|
3676
|
+
return await this._request(configOrUrl, config);
|
|
3677
|
+
} catch (err) {
|
|
3678
|
+
if (err instanceof Error) {
|
|
3679
|
+
let dummy = {};
|
|
3680
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
3681
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
3682
|
+
try {
|
|
3683
|
+
if (!err.stack) {
|
|
3684
|
+
err.stack = stack;
|
|
3685
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
3686
|
+
err.stack += "\n" + stack;
|
|
3687
|
+
}
|
|
3688
|
+
} catch (e) {
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
throw err;
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3694
|
+
_request(configOrUrl, config) {
|
|
3695
|
+
if (typeof configOrUrl === "string") {
|
|
3696
|
+
config = config || {};
|
|
3697
|
+
config.url = configOrUrl;
|
|
3698
|
+
} else {
|
|
3699
|
+
config = configOrUrl || {};
|
|
3700
|
+
}
|
|
3701
|
+
config = mergeConfig$1(this.defaults, config);
|
|
3702
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
3703
|
+
if (transitional !== void 0) {
|
|
3704
|
+
validator.assertOptions(transitional, {
|
|
3705
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
3706
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
3707
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
3708
|
+
}, false);
|
|
3709
|
+
}
|
|
3710
|
+
if (paramsSerializer != null) {
|
|
3711
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
3712
|
+
config.paramsSerializer = {
|
|
3713
|
+
serialize: paramsSerializer
|
|
3714
|
+
};
|
|
3715
|
+
} else {
|
|
3716
|
+
validator.assertOptions(paramsSerializer, {
|
|
3717
|
+
encode: validators.function,
|
|
3718
|
+
serialize: validators.function
|
|
3719
|
+
}, true);
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
if (config.allowAbsoluteUrls !== void 0) ;
|
|
3723
|
+
else if (this.defaults.allowAbsoluteUrls !== void 0) {
|
|
3724
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
3725
|
+
} else {
|
|
3726
|
+
config.allowAbsoluteUrls = true;
|
|
3727
|
+
}
|
|
3728
|
+
validator.assertOptions(config, {
|
|
3729
|
+
baseUrl: validators.spelling("baseURL"),
|
|
3730
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
3731
|
+
}, true);
|
|
3732
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
3733
|
+
let contextHeaders = headers && utils$1.merge(
|
|
3734
|
+
headers.common,
|
|
3735
|
+
headers[config.method]
|
|
3736
|
+
);
|
|
3737
|
+
headers && utils$1.forEach(
|
|
3738
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
3739
|
+
(method) => {
|
|
3740
|
+
delete headers[method];
|
|
3741
|
+
}
|
|
3742
|
+
);
|
|
3743
|
+
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
3744
|
+
const requestInterceptorChain = [];
|
|
3745
|
+
let synchronousRequestInterceptors = true;
|
|
3746
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
3747
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
3748
|
+
return;
|
|
3749
|
+
}
|
|
3750
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3751
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
3752
|
+
});
|
|
3753
|
+
const responseInterceptorChain = [];
|
|
3754
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
3755
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
3756
|
+
});
|
|
3757
|
+
let promise;
|
|
3758
|
+
let i = 0;
|
|
3759
|
+
let len;
|
|
3760
|
+
if (!synchronousRequestInterceptors) {
|
|
3761
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
3762
|
+
chain.unshift(...requestInterceptorChain);
|
|
3763
|
+
chain.push(...responseInterceptorChain);
|
|
3764
|
+
len = chain.length;
|
|
3765
|
+
promise = Promise.resolve(config);
|
|
3766
|
+
while (i < len) {
|
|
3767
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
3768
|
+
}
|
|
3769
|
+
return promise;
|
|
3770
|
+
}
|
|
3771
|
+
len = requestInterceptorChain.length;
|
|
3772
|
+
let newConfig = config;
|
|
3773
|
+
while (i < len) {
|
|
3774
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
3775
|
+
const onRejected = requestInterceptorChain[i++];
|
|
3776
|
+
try {
|
|
3777
|
+
newConfig = onFulfilled(newConfig);
|
|
3778
|
+
} catch (error) {
|
|
3779
|
+
onRejected.call(this, error);
|
|
3780
|
+
break;
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
try {
|
|
3784
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
3785
|
+
} catch (error) {
|
|
3786
|
+
return Promise.reject(error);
|
|
3787
|
+
}
|
|
3788
|
+
i = 0;
|
|
3789
|
+
len = responseInterceptorChain.length;
|
|
3790
|
+
while (i < len) {
|
|
3791
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
3792
|
+
}
|
|
3793
|
+
return promise;
|
|
3794
|
+
}
|
|
3795
|
+
getUri(config) {
|
|
3796
|
+
config = mergeConfig$1(this.defaults, config);
|
|
3797
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
3798
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
3799
|
+
}
|
|
3800
|
+
};
|
|
3801
|
+
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
3802
|
+
Axios$1.prototype[method] = function(url, config) {
|
|
3803
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
3804
|
+
method,
|
|
3805
|
+
url,
|
|
3806
|
+
data: (config || {}).data
|
|
3807
|
+
}));
|
|
3808
|
+
};
|
|
3809
|
+
});
|
|
3810
|
+
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
3811
|
+
function generateHTTPMethod(isForm) {
|
|
3812
|
+
return function httpMethod(url, data, config) {
|
|
3813
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
3814
|
+
method,
|
|
3815
|
+
headers: isForm ? {
|
|
3816
|
+
"Content-Type": "multipart/form-data"
|
|
3817
|
+
} : {},
|
|
3818
|
+
url,
|
|
3819
|
+
data
|
|
3820
|
+
}));
|
|
3821
|
+
};
|
|
3822
|
+
}
|
|
3823
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
|
3824
|
+
Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
3825
|
+
});
|
|
3826
|
+
let CancelToken$1 = class CancelToken2 {
|
|
3827
|
+
constructor(executor) {
|
|
3828
|
+
if (typeof executor !== "function") {
|
|
3829
|
+
throw new TypeError("executor must be a function.");
|
|
3830
|
+
}
|
|
3831
|
+
let resolvePromise;
|
|
3832
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
3833
|
+
resolvePromise = resolve;
|
|
3834
|
+
});
|
|
3835
|
+
const token = this;
|
|
3836
|
+
this.promise.then((cancel) => {
|
|
3837
|
+
if (!token._listeners) return;
|
|
3838
|
+
let i = token._listeners.length;
|
|
3839
|
+
while (i-- > 0) {
|
|
3840
|
+
token._listeners[i](cancel);
|
|
3841
|
+
}
|
|
3842
|
+
token._listeners = null;
|
|
3843
|
+
});
|
|
3844
|
+
this.promise.then = (onfulfilled) => {
|
|
3845
|
+
let _resolve;
|
|
3846
|
+
const promise = new Promise((resolve) => {
|
|
3847
|
+
token.subscribe(resolve);
|
|
3848
|
+
_resolve = resolve;
|
|
3849
|
+
}).then(onfulfilled);
|
|
3850
|
+
promise.cancel = function reject() {
|
|
3851
|
+
token.unsubscribe(_resolve);
|
|
3852
|
+
};
|
|
3853
|
+
return promise;
|
|
3854
|
+
};
|
|
3855
|
+
executor(function cancel(message, config, request) {
|
|
3856
|
+
if (token.reason) {
|
|
3857
|
+
return;
|
|
3858
|
+
}
|
|
3859
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
3860
|
+
resolvePromise(token.reason);
|
|
3861
|
+
});
|
|
3862
|
+
}
|
|
3863
|
+
/**
|
|
3864
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
3865
|
+
*/
|
|
3866
|
+
throwIfRequested() {
|
|
3867
|
+
if (this.reason) {
|
|
3868
|
+
throw this.reason;
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3871
|
+
/**
|
|
3872
|
+
* Subscribe to the cancel signal
|
|
3873
|
+
*/
|
|
3874
|
+
subscribe(listener) {
|
|
3875
|
+
if (this.reason) {
|
|
3876
|
+
listener(this.reason);
|
|
3877
|
+
return;
|
|
3878
|
+
}
|
|
3879
|
+
if (this._listeners) {
|
|
3880
|
+
this._listeners.push(listener);
|
|
3881
|
+
} else {
|
|
3882
|
+
this._listeners = [listener];
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
/**
|
|
3886
|
+
* Unsubscribe from the cancel signal
|
|
3887
|
+
*/
|
|
3888
|
+
unsubscribe(listener) {
|
|
3889
|
+
if (!this._listeners) {
|
|
3890
|
+
return;
|
|
3891
|
+
}
|
|
3892
|
+
const index = this._listeners.indexOf(listener);
|
|
3893
|
+
if (index !== -1) {
|
|
3894
|
+
this._listeners.splice(index, 1);
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
toAbortSignal() {
|
|
3898
|
+
const controller = new AbortController();
|
|
3899
|
+
const abort = (err) => {
|
|
3900
|
+
controller.abort(err);
|
|
3901
|
+
};
|
|
3902
|
+
this.subscribe(abort);
|
|
3903
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
3904
|
+
return controller.signal;
|
|
3905
|
+
}
|
|
3906
|
+
/**
|
|
3907
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
3908
|
+
* cancels the `CancelToken`.
|
|
3909
|
+
*/
|
|
3910
|
+
static source() {
|
|
3911
|
+
let cancel;
|
|
3912
|
+
const token = new CancelToken2(function executor(c) {
|
|
3913
|
+
cancel = c;
|
|
3914
|
+
});
|
|
3915
|
+
return {
|
|
3916
|
+
token,
|
|
3917
|
+
cancel
|
|
3918
|
+
};
|
|
3919
|
+
}
|
|
3920
|
+
};
|
|
3921
|
+
function spread$1(callback) {
|
|
3922
|
+
return function wrap(arr) {
|
|
3923
|
+
return callback.apply(null, arr);
|
|
3924
|
+
};
|
|
3925
|
+
}
|
|
3926
|
+
function isAxiosError$1(payload) {
|
|
3927
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
3928
|
+
}
|
|
3929
|
+
const HttpStatusCode$1 = {
|
|
3930
|
+
Continue: 100,
|
|
3931
|
+
SwitchingProtocols: 101,
|
|
3932
|
+
Processing: 102,
|
|
3933
|
+
EarlyHints: 103,
|
|
3934
|
+
Ok: 200,
|
|
3935
|
+
Created: 201,
|
|
3936
|
+
Accepted: 202,
|
|
3937
|
+
NonAuthoritativeInformation: 203,
|
|
3938
|
+
NoContent: 204,
|
|
3939
|
+
ResetContent: 205,
|
|
3940
|
+
PartialContent: 206,
|
|
3941
|
+
MultiStatus: 207,
|
|
3942
|
+
AlreadyReported: 208,
|
|
3943
|
+
ImUsed: 226,
|
|
3944
|
+
MultipleChoices: 300,
|
|
3945
|
+
MovedPermanently: 301,
|
|
3946
|
+
Found: 302,
|
|
3947
|
+
SeeOther: 303,
|
|
3948
|
+
NotModified: 304,
|
|
3949
|
+
UseProxy: 305,
|
|
3950
|
+
Unused: 306,
|
|
3951
|
+
TemporaryRedirect: 307,
|
|
3952
|
+
PermanentRedirect: 308,
|
|
3953
|
+
BadRequest: 400,
|
|
3954
|
+
Unauthorized: 401,
|
|
3955
|
+
PaymentRequired: 402,
|
|
3956
|
+
Forbidden: 403,
|
|
3957
|
+
NotFound: 404,
|
|
3958
|
+
MethodNotAllowed: 405,
|
|
3959
|
+
NotAcceptable: 406,
|
|
3960
|
+
ProxyAuthenticationRequired: 407,
|
|
3961
|
+
RequestTimeout: 408,
|
|
3962
|
+
Conflict: 409,
|
|
3963
|
+
Gone: 410,
|
|
3964
|
+
LengthRequired: 411,
|
|
3965
|
+
PreconditionFailed: 412,
|
|
3966
|
+
PayloadTooLarge: 413,
|
|
3967
|
+
UriTooLong: 414,
|
|
3968
|
+
UnsupportedMediaType: 415,
|
|
3969
|
+
RangeNotSatisfiable: 416,
|
|
3970
|
+
ExpectationFailed: 417,
|
|
3971
|
+
ImATeapot: 418,
|
|
3972
|
+
MisdirectedRequest: 421,
|
|
3973
|
+
UnprocessableEntity: 422,
|
|
3974
|
+
Locked: 423,
|
|
3975
|
+
FailedDependency: 424,
|
|
3976
|
+
TooEarly: 425,
|
|
3977
|
+
UpgradeRequired: 426,
|
|
3978
|
+
PreconditionRequired: 428,
|
|
3979
|
+
TooManyRequests: 429,
|
|
3980
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
3981
|
+
UnavailableForLegalReasons: 451,
|
|
3982
|
+
InternalServerError: 500,
|
|
3983
|
+
NotImplemented: 501,
|
|
3984
|
+
BadGateway: 502,
|
|
3985
|
+
ServiceUnavailable: 503,
|
|
3986
|
+
GatewayTimeout: 504,
|
|
3987
|
+
HttpVersionNotSupported: 505,
|
|
3988
|
+
VariantAlsoNegotiates: 506,
|
|
3989
|
+
InsufficientStorage: 507,
|
|
3990
|
+
LoopDetected: 508,
|
|
3991
|
+
NotExtended: 510,
|
|
3992
|
+
NetworkAuthenticationRequired: 511,
|
|
3993
|
+
WebServerIsDown: 521,
|
|
3994
|
+
ConnectionTimedOut: 522,
|
|
3995
|
+
OriginIsUnreachable: 523,
|
|
3996
|
+
TimeoutOccurred: 524,
|
|
3997
|
+
SslHandshakeFailed: 525,
|
|
3998
|
+
InvalidSslCertificate: 526
|
|
3999
|
+
};
|
|
4000
|
+
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
4001
|
+
HttpStatusCode$1[value] = key;
|
|
4002
|
+
});
|
|
4003
|
+
function createInstance(defaultConfig) {
|
|
4004
|
+
const context = new Axios$1(defaultConfig);
|
|
4005
|
+
const instance = bind(Axios$1.prototype.request, context);
|
|
4006
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
4007
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
4008
|
+
instance.create = function create(instanceConfig) {
|
|
4009
|
+
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
4010
|
+
};
|
|
4011
|
+
return instance;
|
|
4012
|
+
}
|
|
4013
|
+
const axios = createInstance(defaults);
|
|
4014
|
+
axios.Axios = Axios$1;
|
|
4015
|
+
axios.CanceledError = CanceledError$1;
|
|
4016
|
+
axios.CancelToken = CancelToken$1;
|
|
4017
|
+
axios.isCancel = isCancel$1;
|
|
4018
|
+
axios.VERSION = VERSION$1;
|
|
4019
|
+
axios.toFormData = toFormData$1;
|
|
4020
|
+
axios.AxiosError = AxiosError$1;
|
|
4021
|
+
axios.Cancel = axios.CanceledError;
|
|
4022
|
+
axios.all = function all2(promises) {
|
|
4023
|
+
return Promise.all(promises);
|
|
4024
|
+
};
|
|
4025
|
+
axios.spread = spread$1;
|
|
4026
|
+
axios.isAxiosError = isAxiosError$1;
|
|
4027
|
+
axios.mergeConfig = mergeConfig$1;
|
|
4028
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
4029
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4030
|
+
axios.getAdapter = adapters.getAdapter;
|
|
4031
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
4032
|
+
axios.default = axios;
|
|
4033
|
+
const {
|
|
4034
|
+
Axios,
|
|
4035
|
+
AxiosError,
|
|
4036
|
+
CanceledError,
|
|
4037
|
+
isCancel,
|
|
4038
|
+
CancelToken,
|
|
4039
|
+
VERSION,
|
|
4040
|
+
all,
|
|
4041
|
+
Cancel,
|
|
4042
|
+
isAxiosError,
|
|
4043
|
+
spread,
|
|
4044
|
+
toFormData,
|
|
4045
|
+
AxiosHeaders,
|
|
4046
|
+
HttpStatusCode,
|
|
4047
|
+
formToJSON,
|
|
4048
|
+
getAdapter,
|
|
4049
|
+
mergeConfig
|
|
4050
|
+
} = axios;
|
|
4051
|
+
const trusteeStats = {
|
|
4052
|
+
activeCaseCount: 0,
|
|
4053
|
+
opendLast30: 0,
|
|
4054
|
+
closedLast30: 0,
|
|
4055
|
+
docketNext30: 0
|
|
4056
|
+
};
|
|
4057
|
+
const api = {
|
|
4058
|
+
name: "api",
|
|
4059
|
+
models: {
|
|
4060
|
+
trustee: {
|
|
4061
|
+
stats: trusteeStats
|
|
4062
|
+
}
|
|
4063
|
+
},
|
|
4064
|
+
url: {
|
|
4065
|
+
profile: "316F7A82-BC60-46A4-B584-019CD3608B87",
|
|
4066
|
+
base: {
|
|
4067
|
+
tag: "/api/tag/",
|
|
4068
|
+
trustee: "/api/trustee/",
|
|
4069
|
+
calendar: "/api/calendar/",
|
|
4070
|
+
case: "/api/case/",
|
|
4071
|
+
creditor: "/api/creditor/",
|
|
4072
|
+
employer: "/api/employer/"
|
|
4073
|
+
},
|
|
4074
|
+
authentication: {
|
|
4075
|
+
login: "/api/login/",
|
|
4076
|
+
user: "/api/user/",
|
|
4077
|
+
status: "/api/profile/",
|
|
4078
|
+
register: "/api/register/"
|
|
4079
|
+
}
|
|
4080
|
+
},
|
|
4081
|
+
list: function(url, obj, onComplete, onError, page = 0, count = 100) {
|
|
4082
|
+
axios.get(url + "?page=" + page + "&count=" + count).then((response) => {
|
|
4083
|
+
if (response.status == 200) {
|
|
4084
|
+
onComplete(obj, response.data);
|
|
4085
|
+
return;
|
|
4086
|
+
}
|
|
4087
|
+
onError(obj, response.message);
|
|
4088
|
+
}).catch((error) => onError(obj, error));
|
|
4089
|
+
},
|
|
4090
|
+
getUrl: function(url, obj, onComplete, onError) {
|
|
4091
|
+
axios.get(url).then((response) => {
|
|
4092
|
+
if (response.status == 200) {
|
|
4093
|
+
onComplete(obj, response.data);
|
|
4094
|
+
return;
|
|
4095
|
+
}
|
|
4096
|
+
onError(obj, response.statusText);
|
|
4097
|
+
}).catch((error) => onError(obj, error));
|
|
4098
|
+
},
|
|
4099
|
+
get: function(url, obj, id, onComplete, onError) {
|
|
4100
|
+
axios.get(url + id).then((response) => {
|
|
4101
|
+
if (response.status == 200) {
|
|
4102
|
+
onComplete(obj, response.data);
|
|
4103
|
+
return;
|
|
4104
|
+
}
|
|
4105
|
+
onError(obj, response.statusText);
|
|
4106
|
+
}).catch((error) => onError(obj, error));
|
|
4107
|
+
},
|
|
4108
|
+
post: function(url, obj, model, onComplete, onError) {
|
|
4109
|
+
axios.post(url, model).then((response) => {
|
|
4110
|
+
if (response.status == 200) {
|
|
4111
|
+
onComplete(obj, response.data);
|
|
4112
|
+
return;
|
|
4113
|
+
}
|
|
4114
|
+
if (response.status == 400) {
|
|
4115
|
+
onError(obj, response.response);
|
|
4116
|
+
return;
|
|
4117
|
+
}
|
|
4118
|
+
onError(obj, response.statusText);
|
|
4119
|
+
}).catch((error) => onError(obj, error));
|
|
4120
|
+
},
|
|
4121
|
+
put: function(url, obj, id, model, onComplete, onError) {
|
|
4122
|
+
axios.put(url + id, model).then((response) => {
|
|
4123
|
+
if (response.status == 200) {
|
|
4124
|
+
onComplete(obj, response.data);
|
|
4125
|
+
return;
|
|
4126
|
+
}
|
|
4127
|
+
if (response.status == 400) {
|
|
4128
|
+
onError(obj, response);
|
|
4129
|
+
return;
|
|
4130
|
+
}
|
|
4131
|
+
onError(obj, response.statusText);
|
|
4132
|
+
}).catch((error) => onError(obj, error));
|
|
4133
|
+
},
|
|
4134
|
+
delete: function(url, obj, id, onComplete, onError) {
|
|
4135
|
+
axios.delete(url + id).then((response) => {
|
|
4136
|
+
if (response.status == 200) {
|
|
4137
|
+
onComplete(obj, response.data);
|
|
4138
|
+
return;
|
|
4139
|
+
}
|
|
4140
|
+
onError(obj, response.statusText);
|
|
4141
|
+
}).catch((error) => onError(obj, error));
|
|
4142
|
+
},
|
|
4143
|
+
model: function(url, obj, onComplete, onError) {
|
|
4144
|
+
axios.get(url + "model").then((response) => {
|
|
4145
|
+
if (response.status == 200) {
|
|
4146
|
+
onComplete(obj, response.data);
|
|
4147
|
+
return;
|
|
4148
|
+
}
|
|
4149
|
+
onError(obj, response.statusText);
|
|
4150
|
+
}).catch((error) => onError(obj, error));
|
|
4151
|
+
}
|
|
4152
|
+
};
|
|
4153
|
+
const content = {
|
|
4154
|
+
name: "content",
|
|
4155
|
+
assets: "/api/assets/",
|
|
4156
|
+
assetTypes: "/api/assettype/",
|
|
4157
|
+
documents: "/api/document/",
|
|
4158
|
+
news: "/api/news/",
|
|
4159
|
+
products: "/api/product/",
|
|
4160
|
+
tags: "/api/tag/"
|
|
4161
|
+
};
|
|
4162
|
+
exports2.AnimatedCount = AnimatedCount;
|
|
4163
|
+
exports2.ArticleView = ArticleView;
|
|
4164
|
+
exports2.api = api;
|
|
4165
|
+
exports2.content = content;
|
|
4166
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
4167
|
+
}));
|