vite-plugin-i18n-extract
Version:
1,584 lines • 78.1 kB
JavaScript
import * as N from "path";
import * as k from "fs";
import * as We from "crypto";
import St from "fast-glob";
import { parse as Rt } from "@vue/compiler-sfc";
import * as Tt from "@babel/parser";
import xt from "@babel/traverse";
function B(e) {
return /[\u4e00-\u9fa5]/.test(e);
}
function W(e, t, r = "md5") {
const n = `${t}:${e}`;
return We.createHash(r).update(n).digest("hex").substring(0, 8);
}
function Ot(e, t = ["**/node_modules/**", "**/dist/**", "**/public/**", "**/.git/**"]) {
return St.sync(e, {
ignore: t,
onlyFiles: !0,
absolute: !0
});
}
function Xe(e) {
const t = N.dirname(e);
k.existsSync(t) || (Xe(t), k.mkdirSync(t));
}
function te(e, t) {
Xe(e), k.writeFileSync(e, JSON.stringify(t, null, 2), "utf8");
}
function _t(e, t) {
try {
if (k.existsSync(e)) {
const r = k.readFileSync(e, "utf8");
return JSON.parse(r);
}
} catch (r) {
console.error(`Error reading JSON file ${e}:`, r);
}
return t;
}
function At(e, t) {
const r = [];
for (let n = 0; n < e.length; n += t)
r.push(e.slice(n, n + t));
return r;
}
function Ct(e) {
return new Promise((t) => setTimeout(t, e));
}
function Lt(e) {
const t = {};
return e.forEach((r) => {
t[r.hash] = r.text;
}), t;
}
async function Ee(e, t, r) {
const n = [];
if (t.includes(r)) {
const o = t.split(`
`).map((a, i) => a.includes(r) ? i : -1).filter((a) => a !== -1);
if (o.length > 0)
return vt(e, t, o);
}
try {
const s = Tt.parse(t, {
sourceType: "module",
plugins: ["jsx", "typescript", "decorators-legacy"]
});
xt(s, {
// 处理字符串字面量
StringLiteral(o) {
const { value: a, loc: i } = o.node;
if (B(a)) {
const c = W(a, e);
n.push({
text: a,
hash: c,
filePath: e,
lineNumber: (i == null ? void 0 : i.start.line) || 0,
columnNumber: (i == null ? void 0 : i.start.column) || 0
});
}
},
// 处理模板字符串
TemplateLiteral(o) {
var c, l;
const { quasis: a, loc: i } = o.node;
for (const f of a) {
const h = f.value.raw;
if (B(h)) {
const d = W(h, e);
n.push({
text: h,
hash: d,
filePath: e,
lineNumber: ((c = f.loc) == null ? void 0 : c.start.line) || (i == null ? void 0 : i.start.line) || 0,
columnNumber: ((l = f.loc) == null ? void 0 : l.start.column) || (i == null ? void 0 : i.start.column) || 0
});
}
}
},
// 处理 JSX 文本
JSXText(o) {
const { value: a, loc: i } = o.node;
if (B(a)) {
const c = a.trim();
if (c) {
const l = W(c, e);
n.push({
text: c,
hash: l,
filePath: e,
lineNumber: (i == null ? void 0 : i.start.line) || 0,
columnNumber: (i == null ? void 0 : i.start.column) || 0
});
}
}
}
});
} catch (s) {
console.error(`Error parsing ${e}:`, s);
}
return n;
}
async function vt(e, t, r) {
const n = t.split(`
`), s = [];
for (let o = 0; o < n.length; o++) {
if (r.includes(o))
continue;
const a = n[o], i = /[\u4e00-\u9fa5,。?!:;""''【】「」『』()、—…·]+/g;
let c;
for (; (c = i.exec(a)) !== null; ) {
const l = c[0], f = W(l, e);
s.push({
text: l,
hash: f,
filePath: e,
lineNumber: o + 1,
columnNumber: c.index
});
}
}
return s;
}
async function jt(e, t, r) {
const n = [], { descriptor: s, errors: o } = Rt(t);
if (o && o.length > 0)
return console.error(`Vue SFC parsing error in ${e}:`, o), n;
if (s.template && s.template.content) {
const a = s.template.content;
if (B(a)) {
const i = await Ft(e, a, r);
n.push(...i);
}
}
if (s.script && s.script.content) {
const a = s.script.content;
if (B(a)) {
const i = await Ee(e, a, r);
n.push(...i);
}
}
if (s.scriptSetup && s.scriptSetup.content) {
const a = s.scriptSetup.content;
if (B(a)) {
const i = await Ee(e, a, r);
n.push(...i);
}
}
return n;
}
async function Ft(e, t, r) {
const n = [];
let s = !1;
const o = t.split(`
`);
for (let a = 0; a < o.length; a++) {
const i = o[a], c = a + 1;
if (i.includes(r))
continue;
if (i.includes("<!--") && (s = !0), s && i.includes("-->")) {
s = !1;
continue;
}
if (s)
continue;
const l = Pt(i);
for (const f of l) {
const h = f.text, d = f.index, g = W(h, e);
n.push({
text: h,
hash: g,
filePath: e,
lineNumber: c,
columnNumber: d
});
}
}
return n;
}
function Pt(e) {
const t = [], r = /[\u4e00-\u9fa5,。?!:;""''【】「」『』()、—…·]+/g;
let n;
for (; (n = r.exec(e)) !== null; )
t.push({
text: n[0],
index: n.index
});
return t;
}
class kt {
constructor(t) {
this.results = [], this.options = t, this.ignoreMark = t.ignoreMark || "// i18n-ignore";
}
/**
* 扫描项目中的所有文件并提取中文
*/
async extract() {
this.results = [];
const t = this.options.extensions || [".js", ".jsx", ".vue"], r = this.options.include || ["src/**/*{.js,.jsx,.vue}"], n = this.options.exclude || ["**/node_modules/**", "**/dist/**", "**/public/**", "**/.git/**"], s = Ot(r, n);
for (const a of s) {
const i = N.extname(a);
if (t.includes(i))
try {
const c = k.readFileSync(a, "utf-8");
if (!B(c)) continue;
if (i === ".vue") {
const l = await jt(a, c, this.ignoreMark);
this.results.push(...l);
} else if ([".js", ".jsx"].includes(i)) {
const l = await Ee(a, c, this.ignoreMark);
this.results.push(...l);
}
} catch (c) {
console.error(`Error processing file ${a}:`, c);
}
}
return this.deduplicateResults();
}
/**
* 去重结果
*/
deduplicateResults() {
const t = /* @__PURE__ */ new Map();
for (const r of this.results) {
const n = r.hash;
t.has(n) || t.set(n, r);
}
return Array.from(t.values());
}
}
function Nt(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function Dt(e) {
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
var t = e.default;
if (typeof t == "function") {
var r = function n() {
return this instanceof n ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
};
r.prototype = t.prototype;
} else r = {};
return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(n) {
var s = Object.getOwnPropertyDescriptor(e, n);
Object.defineProperty(r, n, s.get ? s : {
enumerable: !0,
get: function() {
return e[n];
}
});
}), r;
}
var ne = { exports: {} }, re = { exports: {} }, ge = { exports: {} }, Fe;
function Bt() {
return Fe || (Fe = 1, function(e) {
var t = function() {
function r(d, g) {
return g != null && d instanceof g;
}
var n;
try {
n = Map;
} catch {
n = function() {
};
}
var s;
try {
s = Set;
} catch {
s = function() {
};
}
var o;
try {
o = Promise;
} catch {
o = function() {
};
}
function a(d, g, p, b, m) {
typeof g == "object" && (p = g.depth, b = g.prototype, m = g.includeNonEnumerable, g = g.circular);
var E = [], T = [], x = typeof Buffer < "u";
typeof g > "u" && (g = !0), typeof p > "u" && (p = 1 / 0);
function S(y, _) {
if (y === null)
return null;
if (_ === 0)
return y;
var R, F;
if (typeof y != "object")
return y;
if (r(y, n))
R = new n();
else if (r(y, s))
R = new s();
else if (r(y, o))
R = new o(function(H, K) {
y.then(function(J) {
H(S(J, _ - 1));
}, function(J) {
K(S(J, _ - 1));
});
});
else if (a.__isArray(y))
R = [];
else if (a.__isRegExp(y))
R = new RegExp(y.source, h(y)), y.lastIndex && (R.lastIndex = y.lastIndex);
else if (a.__isDate(y))
R = new Date(y.getTime());
else {
if (x && Buffer.isBuffer(y))
return Buffer.allocUnsafe ? R = Buffer.allocUnsafe(y.length) : R = new Buffer(y.length), y.copy(R), R;
r(y, Error) ? R = Object.create(y) : typeof b > "u" ? (F = Object.getPrototypeOf(y), R = Object.create(F)) : (R = Object.create(b), F = b);
}
if (g) {
var z = E.indexOf(y);
if (z != -1)
return T[z];
E.push(y), T.push(R);
}
r(y, n) && y.forEach(function(H, K) {
var J = S(K, _ - 1), Et = S(H, _ - 1);
R.set(J, Et);
}), r(y, s) && y.forEach(function(H) {
var K = S(H, _ - 1);
R.add(K);
});
for (var v in y) {
var me;
F && (me = Object.getOwnPropertyDescriptor(F, v)), !(me && me.set == null) && (R[v] = S(y[v], _ - 1));
}
if (Object.getOwnPropertySymbols)
for (var ve = Object.getOwnPropertySymbols(y), v = 0; v < ve.length; v++) {
var Q = ve[v], $ = Object.getOwnPropertyDescriptor(y, Q);
$ && !$.enumerable && !m || (R[Q] = S(y[Q], _ - 1), $.enumerable || Object.defineProperty(R, Q, {
enumerable: !1
}));
}
if (m)
for (var je = Object.getOwnPropertyNames(y), v = 0; v < je.length; v++) {
var Z = je[v], $ = Object.getOwnPropertyDescriptor(y, Z);
$ && $.enumerable || (R[Z] = S(y[Z], _ - 1), Object.defineProperty(R, Z, {
enumerable: !1
}));
}
return R;
}
return S(d, p);
}
a.clonePrototype = function(g) {
if (g === null)
return null;
var p = function() {
};
return p.prototype = g, new p();
};
function i(d) {
return Object.prototype.toString.call(d);
}
a.__objToStr = i;
function c(d) {
return typeof d == "object" && i(d) === "[object Date]";
}
a.__isDate = c;
function l(d) {
return typeof d == "object" && i(d) === "[object Array]";
}
a.__isArray = l;
function f(d) {
return typeof d == "object" && i(d) === "[object RegExp]";
}
a.__isRegExp = f;
function h(d) {
var g = "";
return d.global && (g += "g"), d.ignoreCase && (g += "i"), d.multiline && (g += "m"), g;
}
return a.__getRegExpFlags = h, a;
}();
e.exports && (e.exports = t);
}(ge)), ge.exports;
}
const Ut = {}, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Ut
}, Symbol.toStringTag, { value: "Module" })), $t = /* @__PURE__ */ Dt(qt);
var Mt = re.exports, Pe;
function It() {
return Pe || (Pe = 1, (function() {
var e, t, r = [].splice, n = function(o, a) {
if (!(o instanceof a))
throw new Error("Bound instance method accessed before binding");
}, s = [].indexOf;
t = Bt(), e = $t.EventEmitter, re.exports = (function() {
class o extends e {
constructor(i = {}) {
super(), this.get = this.get.bind(this), this.mget = this.mget.bind(this), this.set = this.set.bind(this), this.mset = this.mset.bind(this), this.del = this.del.bind(this), this.take = this.take.bind(this), this.ttl = this.ttl.bind(this), this.getTtl = this.getTtl.bind(this), this.keys = this.keys.bind(this), this.has = this.has.bind(this), this.getStats = this.getStats.bind(this), this.flushAll = this.flushAll.bind(this), this.flushStats = this.flushStats.bind(this), this.close = this.close.bind(this), this._checkData = this._checkData.bind(this), this._check = this._check.bind(this), this._isInvalidKey = this._isInvalidKey.bind(this), this._wrap = this._wrap.bind(this), this._getValLength = this._getValLength.bind(this), this._error = this._error.bind(this), this._initErrors = this._initErrors.bind(this), this.options = i, this._initErrors(), this.data = {}, this.options = Object.assign({
// convert all elements to string
forceString: !1,
// used standard size for calculating value size
objectValueSize: 80,
promiseValueSize: 80,
arrayValueSize: 40,
// standard time to live in seconds. 0 = infinity;
stdTTL: 0,
// time in seconds to check all data and delete expired keys
checkperiod: 600,
// en/disable cloning of variables. If `true` you'll get a copy of the cached variable. If `false` you'll save and get just the reference
useClones: !0,
// whether values should be deleted automatically at expiration
deleteOnExpire: !0,
// enable legacy callbacks
enableLegacyCallbacks: !1,
// max amount of keys that are being stored
maxKeys: -1
}, this.options), this.options.enableLegacyCallbacks && (console.warn("WARNING! node-cache legacy callback support will drop in v6.x"), ["get", "mget", "set", "del", "ttl", "getTtl", "keys", "has"].forEach((c) => {
var l;
l = this[c], this[c] = function(...f) {
var h, d, g, p;
if (g = f, [...f] = g, [h] = r.call(f, -1), typeof h == "function")
try {
p = l(...f), h(null, p);
} catch (b) {
d = b, h(d);
}
else
return l(...f, h);
};
})), this.stats = {
hits: 0,
misses: 0,
keys: 0,
ksize: 0,
vsize: 0
}, this.validKeyTypes = ["string", "number"], this._checkData();
}
get(i) {
var c, l;
if (n(this, o), (l = this._isInvalidKey(i)) != null)
throw l;
if (this.data[i] != null && this._check(i, this.data[i]))
return this.stats.hits++, c = this._unwrap(this.data[i]), c;
this.stats.misses++;
}
mget(i) {
var c, l, f, h, d, g;
if (n(this, o), !Array.isArray(i))
throw c = this._error("EKEYSTYPE"), c;
for (g = {}, f = 0, d = i.length; f < d; f++) {
if (h = i[f], (l = this._isInvalidKey(h)) != null)
throw l;
this.data[h] != null && this._check(h, this.data[h]) ? (this.stats.hits++, g[h] = this._unwrap(this.data[h])) : this.stats.misses++;
}
return g;
}
set(i, c, l) {
var f, h, d;
if (n(this, o), this.options.maxKeys > -1 && this.stats.keys >= this.options.maxKeys)
throw f = this._error("ECACHEFULL"), f;
if (this.options.forceString, l == null && (l = this.options.stdTTL), (h = this._isInvalidKey(i)) != null)
throw h;
return d = !1, this.data[i] && (d = !0, this.stats.vsize -= this._getValLength(this._unwrap(this.data[i], !1))), this.data[i] = this._wrap(c, l), this.stats.vsize += this._getValLength(c), d || (this.stats.ksize += this._getKeyLength(i), this.stats.keys++), this.emit("set", i, c), !0;
}
mset(i) {
var c, l, f, h, d, g, p, b, m, E;
if (n(this, o), this.options.maxKeys > -1 && this.stats.keys + i.length >= this.options.maxKeys)
throw c = this._error("ECACHEFULL"), c;
for (f = 0, p = i.length; f < p; f++) {
if (g = i[f], { key: d, val: E, ttl: m } = g, m && typeof m != "number")
throw c = this._error("ETTLTYPE"), c;
if ((l = this._isInvalidKey(d)) != null)
throw l;
}
for (h = 0, b = i.length; h < b; h++)
g = i[h], { key: d, val: E, ttl: m } = g, this.set(d, E, m);
return !0;
}
del(i) {
var c, l, f, h, d, g;
for (n(this, o), Array.isArray(i) || (i = [i]), c = 0, f = 0, d = i.length; f < d; f++) {
if (h = i[f], (l = this._isInvalidKey(h)) != null)
throw l;
this.data[h] != null && (this.stats.vsize -= this._getValLength(this._unwrap(this.data[h], !1)), this.stats.ksize -= this._getKeyLength(h), this.stats.keys--, c++, g = this.data[h], delete this.data[h], this.emit("del", h, g.v));
}
return c;
}
take(i) {
var c;
return n(this, o), c = this.get(i), c != null && this.del(i), c;
}
ttl(i, c) {
var l;
if (n(this, o), c || (c = this.options.stdTTL), !i)
return !1;
if ((l = this._isInvalidKey(i)) != null)
throw l;
return this.data[i] != null && this._check(i, this.data[i]) ? (c >= 0 ? this.data[i] = this._wrap(this.data[i].v, c, !1) : this.del(i), !0) : !1;
}
getTtl(i) {
var c, l;
if (n(this, o), !!i) {
if ((l = this._isInvalidKey(i)) != null)
throw l;
if (this.data[i] != null && this._check(i, this.data[i]))
return c = this.data[i].t, c;
}
}
keys() {
var i;
return n(this, o), i = Object.keys(this.data), i;
}
has(i) {
var c;
return n(this, o), c = this.data[i] != null && this._check(i, this.data[i]), c;
}
getStats() {
return n(this, o), this.stats;
}
flushAll(i = !0) {
n(this, o), this.data = {}, this.stats = {
hits: 0,
misses: 0,
keys: 0,
ksize: 0,
vsize: 0
}, this._killCheckPeriod(), this._checkData(i), this.emit("flush");
}
flushStats() {
n(this, o), this.stats = {
hits: 0,
misses: 0,
keys: 0,
ksize: 0,
vsize: 0
}, this.emit("flush_stats");
}
close() {
n(this, o), this._killCheckPeriod();
}
_checkData(i = !0) {
var c, l, f;
n(this, o), l = this.data;
for (c in l)
f = l[c], this._check(c, f);
i && this.options.checkperiod > 0 && (this.checkTimeout = setTimeout(this._checkData, this.options.checkperiod * 1e3, i), this.checkTimeout != null && this.checkTimeout.unref != null && this.checkTimeout.unref());
}
// ## _killCheckPeriod
// stop the checkdata period. Only needed to abort the script in testing mode.
_killCheckPeriod() {
if (this.checkTimeout != null)
return clearTimeout(this.checkTimeout);
}
_check(i, c) {
var l;
return n(this, o), l = !0, c.t !== 0 && c.t < Date.now() && (this.options.deleteOnExpire && (l = !1, this.del(i)), this.emit("expired", i, this._unwrap(c))), l;
}
_isInvalidKey(i) {
var c;
if (n(this, o), c = typeof i, s.call(this.validKeyTypes, c) < 0)
return this._error("EKEYTYPE", {
type: typeof i
});
}
_wrap(i, c, l = !0) {
var f, h, d;
return n(this, o), this.options.useClones || (l = !1), h = Date.now(), f = 0, d = 1e3, c === 0 ? f = 0 : c ? f = h + c * d : this.options.stdTTL === 0 ? f = this.options.stdTTL : f = h + this.options.stdTTL * d, {
t: f,
v: l ? t(i) : i
};
}
// ## _unwrap
// internal method to extract get the value out of the wrapped value
_unwrap(i, c = !0) {
return this.options.useClones || (c = !1), i.v != null ? c ? t(i.v) : i.v : null;
}
// ## _getKeyLength
// internal method the calculate the key length
_getKeyLength(i) {
return i.toString().length;
}
_getValLength(i) {
return n(this, o), typeof i == "string" ? i.length : this.options.forceString ? JSON.stringify(i).length : Array.isArray(i) ? this.options.arrayValueSize * i.length : typeof i == "number" ? 8 : typeof (i != null ? i.then : void 0) == "function" ? this.options.promiseValueSize : typeof Buffer < "u" && Buffer !== null && Buffer.isBuffer(i) ? i.length : i != null && typeof i == "object" ? this.options.objectValueSize * Object.keys(i).length : typeof i == "boolean" ? 8 : 0;
}
_error(i, c = {}) {
var l;
return n(this, o), l = new Error(), l.name = i, l.errorcode = i, l.message = this.ERRORS[i] != null ? this.ERRORS[i](c) : "-", l.data = c, l;
}
_initErrors() {
var i, c, l;
n(this, o), this.ERRORS = {}, l = this._ERRORS;
for (c in l)
i = l[c], this.ERRORS[c] = this.createErrorMessage(i);
}
createErrorMessage(i) {
return function(c) {
return i.replace("__key", c.type);
};
}
}
return o.prototype._ERRORS = {
ENOTFOUND: "Key `__key` not found",
ECACHEFULL: "Cache max keys amount exceeded",
EKEYTYPE: "The key argument has to be of type `string` or `number`. Found: `__key`",
EKEYSTYPE: "The keys argument has to be an array.",
ETTLTYPE: "The ttl argument has to be a number."
}, o;
}).call(this);
}).call(Mt)), re.exports;
}
var zt = ne.exports, ke;
function Ht() {
return ke || (ke = 1, (function() {
var e;
e = ne.exports = It(), e.version = "5.1.2";
}).call(zt)), ne.exports;
}
var Kt = Ht();
const Jt = /* @__PURE__ */ Nt(Kt);
class Vt {
constructor(t, r = !0) {
this.cache = new Jt({ stdTTL: 0, checkperiod: 0 }), this.cacheFile = N.join(t, ".i18n-cache"), this.enabled = r, this.init();
}
/**
* 初始化缓存
*/
init() {
if (!this.enabled) return;
const t = {}, r = _t(this.cacheFile, t);
Object.entries(r).forEach(([n, s]) => {
Object.entries(s).forEach(([o, a]) => {
const i = `${n}:${o}`;
this.cache.set(i, a);
});
});
}
/**
* 获取翻译缓存
*/
get(t, r) {
if (!this.enabled) return;
const n = `${t}:${r}`;
return this.cache.get(n);
}
/**
* 批量获取翻译缓存
*/
getMany(t, r) {
if (!this.enabled) return {};
const n = {};
return r.forEach((s) => {
const o = this.get(t, s);
o && (n[s] = o);
}), n;
}
/**
* 设置翻译缓存
*/
set(t, r, n) {
if (!this.enabled) return;
const s = `${t}:${r}`;
this.cache.set(s, n);
}
/**
* 批量设置翻译缓存
*/
setMany(t, r) {
this.enabled && Object.entries(r).forEach(([n, s]) => {
this.set(t, n, s);
});
}
/**
* 持久化缓存到文件
*/
persist() {
if (!this.enabled) return;
const t = {};
this.cache.keys().forEach((n) => {
const [s, o] = n.split(":"), a = this.cache.get(n);
a && (t[s] || (t[s] = {}), t[s][o] = a);
}), te(this.cacheFile, t);
}
/**
* 清除缓存
*/
clear() {
this.cache.flushAll(), this.enabled && k.existsSync(this.cacheFile) && k.unlinkSync(this.cacheFile);
}
}
function Ye(e, t) {
return function() {
return e.apply(t, arguments);
};
}
const { toString: Wt } = Object.prototype, { getPrototypeOf: Ae } = Object, le = /* @__PURE__ */ ((e) => (t) => {
const r = Wt.call(t);
return e[r] || (e[r] = r.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null)), j = (e) => (e = e.toLowerCase(), (t) => le(t) === e), ue = (e) => (t) => typeof t === e, { isArray: M } = Array, X = ue("undefined");
function Xt(e) {
return e !== null && !X(e) && e.constructor !== null && !X(e.constructor) && L(e.constructor.isBuffer) && e.constructor.isBuffer(e);
}
const Ge = j("ArrayBuffer");
function Yt(e) {
let t;
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Ge(e.buffer), t;
}
const Gt = ue("string"), L = ue("function"), Qe = ue("number"), fe = (e) => e !== null && typeof e == "object", Qt = (e) => e === !0 || e === !1, se = (e) => {
if (le(e) !== "object")
return !1;
const t = Ae(e);
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
}, Zt = j("Date"), en = j("File"), tn = j("Blob"), nn = j("FileList"), rn = (e) => fe(e) && L(e.pipe), sn = (e) => {
let t;
return e && (typeof FormData == "function" && e instanceof FormData || L(e.append) && ((t = le(e)) === "formdata" || // detect form-data instance
t === "object" && L(e.toString) && e.toString() === "[object FormData]"));
}, on = j("URLSearchParams"), [an, cn, ln, un] = ["ReadableStream", "Request", "Response", "Headers"].map(j), fn = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function Y(e, t, { allOwnKeys: r = !1 } = {}) {
if (e === null || typeof e > "u")
return;
let n, s;
if (typeof e != "object" && (e = [e]), M(e))
for (n = 0, s = e.length; n < s; n++)
t.call(null, e[n], n, e);
else {
const o = r ? Object.getOwnPropertyNames(e) : Object.keys(e), a = o.length;
let i;
for (n = 0; n < a; n++)
i = o[n], t.call(null, e[i], i, e);
}
}
function Ze(e, t) {
t = t.toLowerCase();
const r = Object.keys(e);
let n = r.length, s;
for (; n-- > 0; )
if (s = r[n], t === s.toLowerCase())
return s;
return null;
}
const D = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, et = (e) => !X(e) && e !== D;
function Se() {
const { caseless: e } = et(this) && this || {}, t = {}, r = (n, s) => {
const o = e && Ze(t, s) || s;
se(t[o]) && se(n) ? t[o] = Se(t[o], n) : se(n) ? t[o] = Se({}, n) : M(n) ? t[o] = n.slice() : t[o] = n;
};
for (let n = 0, s = arguments.length; n < s; n++)
arguments[n] && Y(arguments[n], r);
return t;
}
const hn = (e, t, r, { allOwnKeys: n } = {}) => (Y(t, (s, o) => {
r && L(s) ? e[o] = Ye(s, r) : e[o] = s;
}, { allOwnKeys: n }), e), dn = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), pn = (e, t, r, n) => {
e.prototype = Object.create(t.prototype, n), e.prototype.constructor = e, Object.defineProperty(e, "super", {
value: t.prototype
}), r && Object.assign(e.prototype, r);
}, mn = (e, t, r, n) => {
let s, o, a;
const i = {};
if (t = t || {}, e == null) return t;
do {
for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
a = s[o], (!n || n(a, e, t)) && !i[a] && (t[a] = e[a], i[a] = !0);
e = r !== !1 && Ae(e);
} while (e && (!r || r(e, t)) && e !== Object.prototype);
return t;
}, gn = (e, t, r) => {
e = String(e), (r === void 0 || r > e.length) && (r = e.length), r -= t.length;
const n = e.indexOf(t, r);
return n !== -1 && n === r;
}, yn = (e) => {
if (!e) return null;
if (M(e)) return e;
let t = e.length;
if (!Qe(t)) return null;
const r = new Array(t);
for (; t-- > 0; )
r[t] = e[t];
return r;
}, bn = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Ae(Uint8Array)), wn = (e, t) => {
const n = (e && e[Symbol.iterator]).call(e);
let s;
for (; (s = n.next()) && !s.done; ) {
const o = s.value;
t.call(e, o[0], o[1]);
}
}, En = (e, t) => {
let r;
const n = [];
for (; (r = e.exec(t)) !== null; )
n.push(r);
return n;
}, Sn = j("HTMLFormElement"), Rn = (e) => e.toLowerCase().replace(
/[-_\s]([a-z\d])(\w*)/g,
function(r, n, s) {
return n.toUpperCase() + s;
}
), Ne = (({ hasOwnProperty: e }) => (t, r) => e.call(t, r))(Object.prototype), Tn = j("RegExp"), tt = (e, t) => {
const r = Object.getOwnPropertyDescriptors(e), n = {};
Y(r, (s, o) => {
let a;
(a = t(s, o, e)) !== !1 && (n[o] = a || s);
}), Object.defineProperties(e, n);
}, xn = (e) => {
tt(e, (t, r) => {
if (L(e) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
return !1;
const n = e[r];
if (L(n)) {
if (t.enumerable = !1, "writable" in t) {
t.writable = !1;
return;
}
t.set || (t.set = () => {
throw Error("Can not rewrite read-only method '" + r + "'");
});
}
});
}, On = (e, t) => {
const r = {}, n = (s) => {
s.forEach((o) => {
r[o] = !0;
});
};
return M(e) ? n(e) : n(String(e).split(t)), r;
}, _n = () => {
}, An = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
function Cn(e) {
return !!(e && L(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
}
const Ln = (e) => {
const t = new Array(10), r = (n, s) => {
if (fe(n)) {
if (t.indexOf(n) >= 0)
return;
if (!("toJSON" in n)) {
t[s] = n;
const o = M(n) ? [] : {};
return Y(n, (a, i) => {
const c = r(a, s + 1);
!X(c) && (o[i] = c);
}), t[s] = void 0, o;
}
}
return n;
};
return r(e, 0);
}, vn = j("AsyncFunction"), jn = (e) => e && (fe(e) || L(e)) && L(e.then) && L(e.catch), nt = ((e, t) => e ? setImmediate : t ? ((r, n) => (D.addEventListener("message", ({ source: s, data: o }) => {
s === D && o === r && n.length && n.shift()();
}, !1), (s) => {
n.push(s), D.postMessage(r, "*");
}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
typeof setImmediate == "function",
L(D.postMessage)
), Fn = typeof queueMicrotask < "u" ? queueMicrotask.bind(D) : typeof process < "u" && process.nextTick || nt, u = {
isArray: M,
isArrayBuffer: Ge,
isBuffer: Xt,
isFormData: sn,
isArrayBufferView: Yt,
isString: Gt,
isNumber: Qe,
isBoolean: Qt,
isObject: fe,
isPlainObject: se,
isReadableStream: an,
isRequest: cn,
isResponse: ln,
isHeaders: un,
isUndefined: X,
isDate: Zt,
isFile: en,
isBlob: tn,
isRegExp: Tn,
isFunction: L,
isStream: rn,
isURLSearchParams: on,
isTypedArray: bn,
isFileList: nn,
forEach: Y,
merge: Se,
extend: hn,
trim: fn,
stripBOM: dn,
inherits: pn,
toFlatObject: mn,
kindOf: le,
kindOfTest: j,
endsWith: gn,
toArray: yn,
forEachEntry: wn,
matchAll: En,
isHTMLForm: Sn,
hasOwnProperty: Ne,
hasOwnProp: Ne,
// an alias to avoid ESLint no-prototype-builtins detection
reduceDescriptors: tt,
freezeMethods: xn,
toObjectSet: On,
toCamelCase: Rn,
noop: _n,
toFiniteNumber: An,
findKey: Ze,
global: D,
isContextDefined: et,
isSpecCompliantForm: Cn,
toJSONObject: Ln,
isAsyncFn: vn,
isThenable: jn,
setImmediate: nt,
asap: Fn
};
function w(e, t, r, n, s) {
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), r && (this.config = r), n && (this.request = n), s && (this.response = s, this.status = s.status ? s.status : null);
}
u.inherits(w, Error, {
toJSON: function() {
return {
// Standard
message: this.message,
name: this.name,
// Microsoft
description: this.description,
number: this.number,
// Mozilla
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: u.toJSONObject(this.config),
code: this.code,
status: this.status
};
}
});
const rt = w.prototype, st = {};
[
"ERR_BAD_OPTION_VALUE",
"ERR_BAD_OPTION",
"ECONNABORTED",
"ETIMEDOUT",
"ERR_NETWORK",
"ERR_FR_TOO_MANY_REDIRECTS",
"ERR_DEPRECATED",
"ERR_BAD_RESPONSE",
"ERR_BAD_REQUEST",
"ERR_CANCELED",
"ERR_NOT_SUPPORT",
"ERR_INVALID_URL"
// eslint-disable-next-line func-names
].forEach((e) => {
st[e] = { value: e };
});
Object.defineProperties(w, st);
Object.defineProperty(rt, "isAxiosError", { value: !0 });
w.from = (e, t, r, n, s, o) => {
const a = Object.create(rt);
return u.toFlatObject(e, a, function(c) {
return c !== Error.prototype;
}, (i) => i !== "isAxiosError"), w.call(a, e.message, t, r, n, s), a.cause = e, a.name = e.name, o && Object.assign(a, o), a;
};
const Pn = null;
function Re(e) {
return u.isPlainObject(e) || u.isArray(e);
}
function it(e) {
return u.endsWith(e, "[]") ? e.slice(0, -2) : e;
}
function De(e, t, r) {
return e ? e.concat(t).map(function(s, o) {
return s = it(s), !r && o ? "[" + s + "]" : s;
}).join(r ? "." : "") : t;
}
function kn(e) {
return u.isArray(e) && !e.some(Re);
}
const Nn = u.toFlatObject(u, {}, null, function(t) {
return /^is[A-Z]/.test(t);
});
function he(e, t, r) {
if (!u.isObject(e))
throw new TypeError("target must be an object");
t = t || new FormData(), r = u.toFlatObject(r, {
metaTokens: !0,
dots: !1,
indexes: !1
}, !1, function(b, m) {
return !u.isUndefined(m[b]);
});
const n = r.metaTokens, s = r.visitor || f, o = r.dots, a = r.indexes, c = (r.Blob || typeof Blob < "u" && Blob) && u.isSpecCompliantForm(t);
if (!u.isFunction(s))
throw new TypeError("visitor must be a function");
function l(p) {
if (p === null) return "";
if (u.isDate(p))
return p.toISOString();
if (!c && u.isBlob(p))
throw new w("Blob is not supported. Use a Buffer instead.");
return u.isArrayBuffer(p) || u.isTypedArray(p) ? c && typeof Blob == "function" ? new Blob([p]) : Buffer.from(p) : p;
}
function f(p, b, m) {
let E = p;
if (p && !m && typeof p == "object") {
if (u.endsWith(b, "{}"))
b = n ? b : b.slice(0, -2), p = JSON.stringify(p);
else if (u.isArray(p) && kn(p) || (u.isFileList(p) || u.endsWith(b, "[]")) && (E = u.toArray(p)))
return b = it(b), E.forEach(function(x, S) {
!(u.isUndefined(x) || x === null) && t.append(
// eslint-disable-next-line no-nested-ternary
a === !0 ? De([b], S, o) : a === null ? b : b + "[]",
l(x)
);
}), !1;
}
return Re(p) ? !0 : (t.append(De(m, b, o), l(p)), !1);
}
const h = [], d = Object.assign(Nn, {
defaultVisitor: f,
convertValue: l,
isVisitable: Re
});
function g(p, b) {
if (!u.isUndefined(p)) {
if (h.indexOf(p) !== -1)
throw Error("Circular reference detected in " + b.join("."));
h.push(p), u.forEach(p, function(E, T) {
(!(u.isUndefined(E) || E === null) && s.call(
t,
E,
u.isString(T) ? T.trim() : T,
b,
d
)) === !0 && g(E, b ? b.concat(T) : [T]);
}), h.pop();
}
}
if (!u.isObject(e))
throw new TypeError("data must be an object");
return g(e), t;
}
function Be(e) {
const t = {
"!": "%21",
"'": "%27",
"(": "%28",
")": "%29",
"~": "%7E",
"%20": "+",
"%00": "\0"
};
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(n) {
return t[n];
});
}
function Ce(e, t) {
this._pairs = [], e && he(e, this, t);
}
const ot = Ce.prototype;
ot.append = function(t, r) {
this._pairs.push([t, r]);
};
ot.toString = function(t) {
const r = t ? function(n) {
return t.call(this, n, Be);
} : Be;
return this._pairs.map(function(s) {
return r(s[0]) + "=" + r(s[1]);
}, "").join("&");
};
function Dn(e) {
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function at(e, t, r) {
if (!t)
return e;
const n = r && r.encode || Dn;
u.isFunction(r) && (r = {
serialize: r
});
const s = r && r.serialize;
let o;
if (s ? o = s(t, r) : o = u.isURLSearchParams(t) ? t.toString() : new Ce(t, r).toString(n), o) {
const a = e.indexOf("#");
a !== -1 && (e = e.slice(0, a)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
}
return e;
}
class Ue {
constructor() {
this.handlers = [];
}
/**
* Add a new interceptor to the stack
*
* @param {Function} fulfilled The function to handle `then` for a `Promise`
* @param {Function} rejected The function to handle `reject` for a `Promise`
*
* @return {Number} An ID used to remove interceptor later
*/
use(t, r, n) {
return this.handlers.push({
fulfilled: t,
rejected: r,
synchronous: n ? n.synchronous : !1,
runWhen: n ? n.runWhen : null
}), this.handlers.length - 1;
}
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
*/
eject(t) {
this.handlers[t] && (this.handlers[t] = null);
}
/**
* Clear all interceptors from the stack
*
* @returns {void}
*/
clear() {
this.handlers && (this.handlers = []);
}
/**
* Iterate over all the registered interceptors
*
* This method is particularly useful for skipping over any
* interceptors that may have become `null` calling `eject`.
*
* @param {Function} fn The function to call for each interceptor
*
* @returns {void}
*/
forEach(t) {
u.forEach(this.handlers, function(n) {
n !== null && t(n);
});
}
}
const ct = {
silentJSONParsing: !0,
forcedJSONParsing: !0,
clarifyTimeoutError: !1
}, Bn = typeof URLSearchParams < "u" ? URLSearchParams : Ce, Un = typeof FormData < "u" ? FormData : null, qn = typeof Blob < "u" ? Blob : null, $n = {
isBrowser: !0,
classes: {
URLSearchParams: Bn,
FormData: Un,
Blob: qn
},
protocols: ["http", "https", "file", "blob", "url", "data"]
}, Le = typeof window < "u" && typeof document < "u", Te = typeof navigator == "object" && navigator || void 0, Mn = Le && (!Te || ["ReactNative", "NativeScript", "NS"].indexOf(Te.product) < 0), In = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", zn = Le && window.location.href || "http://localhost", Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
hasBrowserEnv: Le,
hasStandardBrowserEnv: Mn,
hasStandardBrowserWebWorkerEnv: In,
navigator: Te,
origin: zn
}, Symbol.toStringTag, { value: "Module" })), A = {
...Hn,
...$n
};
function Kn(e, t) {
return he(e, new A.classes.URLSearchParams(), Object.assign({
visitor: function(r, n, s, o) {
return A.isNode && u.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
}
}, t));
}
function Jn(e) {
return u.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
}
function Vn(e) {
const t = {}, r = Object.keys(e);
let n;
const s = r.length;
let o;
for (n = 0; n < s; n++)
o = r[n], t[o] = e[o];
return t;
}
function lt(e) {
function t(r, n, s, o) {
let a = r[o++];
if (a === "__proto__") return !0;
const i = Number.isFinite(+a), c = o >= r.length;
return a = !a && u.isArray(s) ? s.length : a, c ? (u.hasOwnProp(s, a) ? s[a] = [s[a], n] : s[a] = n, !i) : ((!s[a] || !u.isObject(s[a])) && (s[a] = []), t(r, n, s[a], o) && u.isArray(s[a]) && (s[a] = Vn(s[a])), !i);
}
if (u.isFormData(e) && u.isFunction(e.entries)) {
const r = {};
return u.forEachEntry(e, (n, s) => {
t(Jn(n), s, r, 0);
}), r;
}
return null;
}
function Wn(e, t, r) {
if (u.isString(e))
try {
return (t || JSON.parse)(e), u.trim(e);
} catch (n) {
if (n.name !== "SyntaxError")
throw n;
}
return (r || JSON.stringify)(e);
}
const G = {
transitional: ct,
adapter: ["xhr", "http", "fetch"],
transformRequest: [function(t, r) {
const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, o = u.isObject(t);
if (o && u.isHTMLForm(t) && (t = new FormData(t)), u.isFormData(t))
return s ? JSON.stringify(lt(t)) : t;
if (u.isArrayBuffer(t) || u.isBuffer(t) || u.isStream(t) || u.isFile(t) || u.isBlob(t) || u.isReadableStream(t))
return t;
if (u.isArrayBufferView(t))
return t.buffer;
if (u.isURLSearchParams(t))
return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
let i;
if (o) {
if (n.indexOf("application/x-www-form-urlencoded") > -1)
return Kn(t, this.formSerializer).toString();
if ((i = u.isFileList(t)) || n.indexOf("multipart/form-data") > -1) {
const c = this.env && this.env.FormData;
return he(
i ? { "files[]": t } : t,
c && new c(),
this.formSerializer
);
}
}
return o || s ? (r.setContentType("application/json", !1), Wn(t)) : t;
}],
transformResponse: [function(t) {
const r = this.transitional || G.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
if (u.isResponse(t) || u.isReadableStream(t))
return t;
if (t && u.isString(t) && (n && !this.responseType || s)) {
const a = !(r && r.silentJSONParsing) && s;
try {
return JSON.parse(t);
} catch (i) {
if (a)
throw i.name === "SyntaxError" ? w.from(i, w.ERR_BAD_RESPONSE, this, null, this.response) : i;
}
}
return t;
}],
/**
* A timeout in milliseconds to abort a request. If set to 0 (default) a
* timeout is not created.
*/
timeout: 0,
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN",
maxContentLength: -1,
maxBodyLength: -1,
env: {
FormData: A.classes.FormData,
Blob: A.classes.Blob
},
validateStatus: function(t) {
return t >= 200 && t < 300;
},
headers: {
common: {
Accept: "application/json, text/plain, */*",
"Content-Type": void 0
}
}
};
u.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
G.headers[e] = {};
});
const Xn = u.toObjectSet([
"age",
"authorization",
"content-length",
"content-type",
"etag",
"expires",
"from",
"host",
"if-modified-since",
"if-unmodified-since",
"last-modified",
"location",
"max-forwards",
"proxy-authorization",
"referer",
"retry-after",
"user-agent"
]), Yn = (e) => {
const t = {};
let r, n, s;
return e && e.split(`
`).forEach(function(a) {
s = a.indexOf(":"), r = a.substring(0, s).trim().toLowerCase(), n = a.substring(s + 1).trim(), !(!r || t[r] && Xn[r]) && (r === "set-cookie" ? t[r] ? t[r].push(n) : t[r] = [n] : t[r] = t[r] ? t[r] + ", " + n : n);
}), t;
}, qe = Symbol("internals");
function V(e) {
return e && String(e).trim().toLowerCase();
}
function ie(e) {
return e === !1 || e == null ? e : u.isArray(e) ? e.map(ie) : String(e);
}
function Gn(e) {
const t = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
let n;
for (; n = r.exec(e); )
t[n[1]] = n[2];
return t;
}
const Qn = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
function ye(e, t, r, n, s) {
if (u.isFunction(n))
return n.call(this, t, r);
if (s && (t = r), !!u.isString(t)) {
if (u.isString(n))
return t.indexOf(n) !== -1;
if (u.isRegExp(n))
return n.test(t);
}
}
function Zn(e) {
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, r, n) => r.toUpperCase() + n);
}
function er(e, t) {
const r = u.toCamelCase(" " + t);
["get", "set", "has"].forEach((n) => {
Object.defineProperty(e, n + r, {
value: function(s, o, a) {
return this[n].call(this, t, s, o, a);
},
configurable: !0
});
});
}
let C = class {
constructor(t) {
t && this.set(t);
}
set(t, r, n) {
const s = this;
function o(i, c, l) {
const f = V(c);
if (!f)
throw new Error("header name must be a non-empty string");
const h = u.findKey(s, f);
(!h || s[h] === void 0 || l === !0 || l === void 0 && s[h] !== !1) && (s[h || c] = ie(i));
}
const a = (i, c) => u.forEach(i, (l, f) => o(l, f, c));
if (u.isPlainObject(t) || t instanceof this.constructor)
a(t, r);
else if (u.isString(t) && (t = t.trim()) && !Qn(t))
a(Yn(t), r);
else if (u.isHeaders(t))
for (const [i, c] of t.entries())
o(c, i, n);
else
t != null && o(r, t, n);
return this;
}
get(t, r) {
if (t = V(t), t) {
const n = u.findKey(this, t);
if (n) {
const s = this[n];
if (!r)
return s;
if (r === !0)
return Gn(s);
if (u.isFunction(r))
return r.call(this, s, n);
if (u.isRegExp(r))
return r.exec(s);
throw new TypeError("parser must be boolean|regexp|function");
}
}
}
has(t, r) {
if (t = V(t), t) {
const n = u.findKey(this, t);
return !!(n && this[n] !== void 0 && (!r || ye(this, this[n], n, r)));
}
return !1;
}
delete(t, r) {
const n = this;
let s = !1;
function o(a) {
if (a = V(a), a) {
const i = u.findKey(n, a);
i && (!r || ye(n, n[i], i, r)) && (delete n[i], s = !0);
}
}
return u.isArray(t) ? t.forEach(o) : o(t), s;
}
clear(t) {
const r = Object.keys(this);
let n = r.length, s = !1;
for (; n--; ) {
const o = r[n];
(!t || ye(this, this[o], o, t, !0)) && (delete this[o], s = !0);
}
return s;
}
normalize(t) {
const r = this, n = {};
return u.forEach(this, (s, o) => {
const a = u.findKey(n, o);
if (a) {
r[a] = ie(s), delete r[o];
return;
}
const i = t ? Zn(o) : String(o).trim();
i !== o && delete r[o], r[i] = ie(s), n[i] = !0;
}), this;
}
concat(...t) {
return this.constructor.concat(this, ...t);
}
toJSON(t) {
const r = /* @__PURE__ */ Object.create(null);
return u.forEach(this, (n, s) => {
n != null && n !== !1 && (r[s] = t && u.isArray(n) ? n.join(", ") : n);
}), r;
}
[Symbol.iterator]() {
return Object.entries(this.toJSON())[Symbol.iterator]();
}
toString() {
return Object.entries(this.toJSON()).map(([t, r]) => t + ": " + r).join(`
`);
}
get [Symbol.toStringTag]() {
return "AxiosHeaders";
}
static from(t) {
return t instanceof this ? t : new this(t);
}
static concat(t, ...r) {
const n = new this(t);
return r.forEach((s) => n.set(s)), n;
}
static accessor(t) {
const n = (this[qe] = this[qe] = {
accessors: {}
}).accessors, s = this.prototype;
function o(a) {
const i = V(a);
n[i] || (er(s, a), n[i] = !0);
}
return u.isArray(t) ? t.forEach(o) : o(t), this;
}
};
C.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
u.reduceDescriptors(C.prototype, ({ value: e }, t) => {
let r = t[0].toUpperCase() + t.slice(1);
return {
get: () => e,
set(n) {
this[r] = n;
}
};
});
u.freezeMethods(C);
function be(e, t) {
const r = this || G, n = t || r, s = C.from(n.headers);
let o = n.data;
return u.forEach(e, function(i) {
o = i.call(r, o, s.normalize(), t ? t.status : void 0);
}), s.normalize(), o;
}
function ut(e) {
return !!(e && e.__CANCEL__);
}
function I(e, t, r) {
w.call(this, e ?? "canceled", w.ERR_CANCELED, t, r), this.name = "CanceledError";
}
u.inherits(I, w, {
__CANCEL__: !0
});
function ft(e, t, r) {
const n = r.config.validateStatus;
!r.status || !n || n(r.status) ? e(r) : t(new w(
"Request failed with status code " + r.status,
[w.ERR_BAD_REQUEST, w.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
r.config,
r.request,
r
));
}
function tr(e) {
const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
return t && t[1] || "";
}
function nr(e, t) {
e = e || 10;
const r = new Array(e), n = new Array(e);
let s = 0, o = 0, a;
return t = t !== void 0 ? t : 1e3, function(c) {
const l = Date.now(), f = n[o];
a || (a = l), r[s] = c, n[s] = l;
let h = o, d = 0;
for (; h !== s; )
d += r[h++], h = h % e;
if (s = (s + 1) % e, s === o && (o = (o + 1) % e), l - a < t)
return;
const g = f && l - f;
return g ? Math.round(d * 1e3 / g) : void 0;
};
}
function rr(e, t) {
let r = 0, n = 1e3 / t, s, o;
const a = (l, f = Date.now()) => {
r = f, s = null, o && (clearTimeout(o), o = null), e.apply(null, l);
};
return [(...l) => {
const f = Date.now(), h = f - r;
h >= n ? a(l, f) : (s = l, o || (o = setTimeout(() => {
o = null, a(s);
}, n - h)));
}, () => s && a(s)];
}
const ae = (e, t, r = 3) => {
let n = 0;
const s = nr(50, 250);
return rr((o) => {
const a = o.loaded, i = o.lengthComputable ? o.total : void 0, c = a - n, l = s(c), f = a <= i;
n = a;
const h = {
loaded: a,
total: i,
progress: i ? a / i : void 0,
bytes: c,
rate: l || void 0,
estimated: l && i && f ? (i - a) / l : void 0,
event: o,
lengthComputable: i != null,
[t ? "download" : "upload"]: !0
};
e(h);
}, r);
}, $e = (e, t) => {
const r = e != null;
return [(n) => t[0]({
lengthComputable: r,
total: e,
loaded: n
}), t[1]];
}, Me = (e) => (...t) => u.asap(() => e(...t)), sr = A.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (r) => (r = new URL(r, A.origin), e.protocol === r.protocol && e.host === r.host && (t || e.port === r.port)))(
new URL(A.origin),
A.navigator && /(msie|trident)/i.test(A.navigator.userAgent)
) : () => !0, ir = A.hasStandardBrowserEnv ? (
// Standard browser envs support document.cookie
{
write(e, t, r, n, s, o) {
const a = [e + "=" + encodeURIComponent(t)];
u.isNumber(r) && a.push("expires=" + new Date(r).toGMTString()), u.isString(n) &