qlfy-ecological-login 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +39 -39
- package/lib/index.mjs.gz +0 -0
- package/lib/index.umd.js +5 -5
- package/lib/index.umd.js.gz +0 -0
- package/package.json +1 -1
- package/lib/components/qlfyEcologicalLogin copy/LocalStorageManager.d.ts +0 -30
- package/lib/components/qlfyEcologicalLogin copy/data.d.ts +0 -41
- package/lib/components/qlfyEcologicalLogin copy/tools.d.ts +0 -46
package/lib/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const qlfyEcologicalLogin: import('vue').DefineComponent<import('
|
|
|
33
33
|
/** 组件参数、事件接口 */
|
|
34
34
|
export type { Prop as qlfyEcologicalLoginProps, Emits } from './components/qlfyEcologicalLogin/data';
|
|
35
35
|
/** 导出工具 */
|
|
36
|
-
export { logout, goLogin, getToken, getRefreshToken, getUserPermission } from './components/qlfyEcologicalLogin/tools';
|
|
36
|
+
export { logout, goLogin, getToken, getLoginInfo, getRefreshToken, getUserPermission } from './components/qlfyEcologicalLogin/tools';
|
|
37
37
|
/** 默认导出install注册方法 */
|
|
38
38
|
declare const _default: {
|
|
39
39
|
install(app: any): void;
|
package/lib/index.mjs
CHANGED
|
@@ -75,11 +75,11 @@ const Pt = (e, t, r, { allOwnKeys: n } = {}) => (J(t, (o, s) => {
|
|
|
75
75
|
e = r !== !1 && pe(e);
|
|
76
76
|
} while (e && (!r || r(e, t)) && e !== Object.prototype);
|
|
77
77
|
return t;
|
|
78
|
-
},
|
|
78
|
+
}, Nt = (e, t, r) => {
|
|
79
79
|
e = String(e), (r === void 0 || r > e.length) && (r = e.length), r -= t.length;
|
|
80
80
|
const n = e.indexOf(t, r);
|
|
81
81
|
return n !== -1 && n === r;
|
|
82
|
-
},
|
|
82
|
+
}, Dt = (e) => {
|
|
83
83
|
if (!e) return null;
|
|
84
84
|
if ($(e)) return e;
|
|
85
85
|
let t = e.length;
|
|
@@ -197,8 +197,8 @@ const vt = (e) => {
|
|
|
197
197
|
toFlatObject: Ct,
|
|
198
198
|
kindOf: Y,
|
|
199
199
|
kindOfTest: C,
|
|
200
|
-
endsWith:
|
|
201
|
-
toArray:
|
|
200
|
+
endsWith: Nt,
|
|
201
|
+
toArray: Dt,
|
|
202
202
|
forEachEntry: _t,
|
|
203
203
|
matchAll: Ft,
|
|
204
204
|
isHTMLForm: Ut,
|
|
@@ -1139,13 +1139,13 @@ const Ze = (e) => {
|
|
|
1139
1139
|
}, {
|
|
1140
1140
|
highWaterMark: 2
|
|
1141
1141
|
});
|
|
1142
|
-
}, re = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", Ye = re && typeof ReadableStream == "function",
|
|
1142
|
+
}, re = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", Ye = re && typeof ReadableStream == "function", Nn = re && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new Response(e).arrayBuffer())), et = (e, ...t) => {
|
|
1143
1143
|
try {
|
|
1144
1144
|
return !!e(...t);
|
|
1145
1145
|
} catch {
|
|
1146
1146
|
return !1;
|
|
1147
1147
|
}
|
|
1148
|
-
},
|
|
1148
|
+
}, Dn = Ye && et(() => {
|
|
1149
1149
|
let e = !1;
|
|
1150
1150
|
const t = new Request(P.origin, {
|
|
1151
1151
|
body: new ReadableStream(),
|
|
@@ -1178,7 +1178,7 @@ const Bn = async (e) => {
|
|
|
1178
1178
|
if (a.isArrayBufferView(e) || a.isArrayBuffer(e))
|
|
1179
1179
|
return e.byteLength;
|
|
1180
1180
|
if (a.isURLSearchParams(e) && (e = e + ""), a.isString(e))
|
|
1181
|
-
return (await
|
|
1181
|
+
return (await Nn(e)).byteLength;
|
|
1182
1182
|
}, _n = async (e, t) => {
|
|
1183
1183
|
const r = a.toFiniteNumber(e.getContentLength());
|
|
1184
1184
|
return r ?? Bn(t);
|
|
@@ -1204,7 +1204,7 @@ const Bn = async (e) => {
|
|
|
1204
1204
|
});
|
|
1205
1205
|
let p;
|
|
1206
1206
|
try {
|
|
1207
|
-
if (f &&
|
|
1207
|
+
if (f && Dn && r !== "get" && r !== "head" && (p = await _n(u, n)) !== 0) {
|
|
1208
1208
|
let S = new Request(t, {
|
|
1209
1209
|
method: "POST",
|
|
1210
1210
|
body: n,
|
|
@@ -1281,7 +1281,7 @@ a.forEach(de, (e, t) => {
|
|
|
1281
1281
|
Object.defineProperty(e, "adapterName", { value: t });
|
|
1282
1282
|
}
|
|
1283
1283
|
});
|
|
1284
|
-
const
|
|
1284
|
+
const Ne = (e) => `- ${e}`, Un = (e) => a.isFunction(e) || e === null || e === !1, tt = {
|
|
1285
1285
|
getAdapter: (e) => {
|
|
1286
1286
|
e = a.isArray(e) ? e : [e];
|
|
1287
1287
|
const { length: t } = e;
|
|
@@ -1301,8 +1301,8 @@ const De = (e) => `- ${e}`, Un = (e) => a.isFunction(e) || e === null || e === !
|
|
|
1301
1301
|
([c, f]) => `adapter ${c} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1302
1302
|
);
|
|
1303
1303
|
let i = t ? s.length > 1 ? `since :
|
|
1304
|
-
` + s.map(
|
|
1305
|
-
`) : " " +
|
|
1304
|
+
` + s.map(Ne).join(`
|
|
1305
|
+
`) : " " + Ne(s[0]) : "as no adapter specified";
|
|
1306
1306
|
throw new g(
|
|
1307
1307
|
"There is no suitable adapter to dispatch the request " + i,
|
|
1308
1308
|
"ERR_NOT_SUPPORT"
|
|
@@ -1316,7 +1316,7 @@ function ae(e) {
|
|
|
1316
1316
|
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1317
1317
|
throw new j(null, e);
|
|
1318
1318
|
}
|
|
1319
|
-
function
|
|
1319
|
+
function De(e) {
|
|
1320
1320
|
return ae(e), e.headers = k.from(e.headers), e.data = ie.call(
|
|
1321
1321
|
e,
|
|
1322
1322
|
e.transformRequest
|
|
@@ -1382,7 +1382,7 @@ function qn(e, t, r) {
|
|
|
1382
1382
|
const X = {
|
|
1383
1383
|
assertOptions: qn,
|
|
1384
1384
|
validators: oe
|
|
1385
|
-
},
|
|
1385
|
+
}, N = X.validators;
|
|
1386
1386
|
let q = class {
|
|
1387
1387
|
constructor(t) {
|
|
1388
1388
|
this.defaults = t || {}, this.interceptors = {
|
|
@@ -1419,17 +1419,17 @@ let q = class {
|
|
|
1419
1419
|
typeof t == "string" ? (r = r || {}, r.url = t) : r = t || {}, r = M(this.defaults, r);
|
|
1420
1420
|
const { transitional: n, paramsSerializer: o, headers: s } = r;
|
|
1421
1421
|
n !== void 0 && X.assertOptions(n, {
|
|
1422
|
-
silentJSONParsing:
|
|
1423
|
-
forcedJSONParsing:
|
|
1424
|
-
clarifyTimeoutError:
|
|
1422
|
+
silentJSONParsing: N.transitional(N.boolean),
|
|
1423
|
+
forcedJSONParsing: N.transitional(N.boolean),
|
|
1424
|
+
clarifyTimeoutError: N.transitional(N.boolean)
|
|
1425
1425
|
}, !1), o != null && (a.isFunction(o) ? r.paramsSerializer = {
|
|
1426
1426
|
serialize: o
|
|
1427
1427
|
} : X.assertOptions(o, {
|
|
1428
|
-
encode:
|
|
1429
|
-
serialize:
|
|
1428
|
+
encode: N.function,
|
|
1429
|
+
serialize: N.function
|
|
1430
1430
|
}, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), X.assertOptions(r, {
|
|
1431
|
-
baseUrl:
|
|
1432
|
-
withXsrfToken:
|
|
1431
|
+
baseUrl: N.spelling("baseURL"),
|
|
1432
|
+
withXsrfToken: N.spelling("withXSRFToken")
|
|
1433
1433
|
}, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
|
|
1434
1434
|
let i = s && a.merge(
|
|
1435
1435
|
s.common,
|
|
@@ -1452,7 +1452,7 @@ let q = class {
|
|
|
1452
1452
|
});
|
|
1453
1453
|
let u, d = 0, y;
|
|
1454
1454
|
if (!f) {
|
|
1455
|
-
const h = [
|
|
1455
|
+
const h = [De.bind(this), void 0];
|
|
1456
1456
|
for (h.unshift.apply(h, c), h.push.apply(h, l), y = h.length, u = Promise.resolve(r); d < y; )
|
|
1457
1457
|
u = u.then(h[d++], h[d++]);
|
|
1458
1458
|
return u;
|
|
@@ -1469,7 +1469,7 @@ let q = class {
|
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
1471
|
try {
|
|
1472
|
-
u =
|
|
1472
|
+
u = De.call(this, b);
|
|
1473
1473
|
} catch (h) {
|
|
1474
1474
|
return Promise.reject(h);
|
|
1475
1475
|
}
|
|
@@ -1939,7 +1939,7 @@ function zn() {
|
|
|
1939
1939
|
}
|
|
1940
1940
|
class vn {
|
|
1941
1941
|
constructor() {
|
|
1942
|
-
this.isInitialized = !1, this.indexedDBManager = new jn("
|
|
1942
|
+
this.isInitialized = !1, this.indexedDBManager = new jn("qlfyEcologicalLogin", "loginData");
|
|
1943
1943
|
}
|
|
1944
1944
|
async ensureInitialized() {
|
|
1945
1945
|
this.isInitialized || (await this.indexedDBManager.open(), this.isInitialized = !0);
|
|
@@ -1984,7 +1984,7 @@ async function ye() {
|
|
|
1984
1984
|
const e = we.remove(I);
|
|
1985
1985
|
e instanceof Promise && await e;
|
|
1986
1986
|
}
|
|
1987
|
-
async function
|
|
1987
|
+
async function D(e) {
|
|
1988
1988
|
e && I.indexOf(e) == -1 && (I += e);
|
|
1989
1989
|
const t = we.get(I), r = t instanceof Promise ? await t : t;
|
|
1990
1990
|
return r || {
|
|
@@ -1999,7 +1999,7 @@ async function N(e) {
|
|
|
1999
1999
|
};
|
|
2000
2000
|
}
|
|
2001
2001
|
async function Wn(e = !0, t, r) {
|
|
2002
|
-
let n = await
|
|
2002
|
+
let n = await D();
|
|
2003
2003
|
const o = n.props;
|
|
2004
2004
|
if (o.openDebugger)
|
|
2005
2005
|
debugger;
|
|
@@ -2026,7 +2026,7 @@ async function Wn(e = !0, t, r) {
|
|
|
2026
2026
|
});
|
|
2027
2027
|
}
|
|
2028
2028
|
async function F() {
|
|
2029
|
-
const t = (await
|
|
2029
|
+
const t = (await D()).props;
|
|
2030
2030
|
if (!t || !t.isEnabled) {
|
|
2031
2031
|
console.error(new Error("统一登陆未开启,请检查配置"));
|
|
2032
2032
|
return;
|
|
@@ -2037,24 +2037,25 @@ async function F() {
|
|
|
2037
2037
|
}), await ye();
|
|
2038
2038
|
}
|
|
2039
2039
|
async function Kn() {
|
|
2040
|
-
const e = await
|
|
2040
|
+
const e = await D(), t = e.props;
|
|
2041
2041
|
return !t || !t.isEnabled ? (console.error(new Error("统一登陆未开启,请检查配置")), "") : e.token;
|
|
2042
2042
|
}
|
|
2043
2043
|
async function Xn() {
|
|
2044
|
-
|
|
2044
|
+
const e = await D(), t = e.props;
|
|
2045
|
+
return !t || !t.isEnabled ? (console.error(new Error("统一登陆未开启,请检查配置")), null) : e.loginInfo;
|
|
2045
2046
|
}
|
|
2046
2047
|
async function yr() {
|
|
2047
|
-
let e = await
|
|
2048
|
+
let e = await D();
|
|
2048
2049
|
const t = e.props;
|
|
2049
2050
|
return !t || !t.isEnabled ? (console.error(new Error("统一登陆未开启,请检查配置")), null) : e.userPermission;
|
|
2050
2051
|
}
|
|
2051
2052
|
async function br() {
|
|
2052
|
-
let e = await
|
|
2053
|
+
let e = await D();
|
|
2053
2054
|
const t = e.props;
|
|
2054
2055
|
return !t || !t.isEnabled ? (console.error(new Error("统一登陆未开启,请检查配置")), null) : e.refreshToken;
|
|
2055
2056
|
}
|
|
2056
2057
|
async function Gn() {
|
|
2057
|
-
const t = (await
|
|
2058
|
+
const t = (await D()).props;
|
|
2058
2059
|
if (!t || !t.isEnabled)
|
|
2059
2060
|
return console.error(new Error("统一登陆未开启,请检查配置")), null;
|
|
2060
2061
|
if (!t.clientId || !t.clientSecret)
|
|
@@ -2073,7 +2074,7 @@ function Qn() {
|
|
|
2073
2074
|
return "history";
|
|
2074
2075
|
}
|
|
2075
2076
|
async function st(e, t = !1, r = window.location.href, n) {
|
|
2076
|
-
if (n || (n = (await
|
|
2077
|
+
if (n || (n = (await D()).routerMode), !["hash", "history"].includes(n))
|
|
2077
2078
|
throw new Error('路由模式必须是 "hash" 或 "history"');
|
|
2078
2079
|
let o, s, i;
|
|
2079
2080
|
if (n === "hash") {
|
|
@@ -2088,13 +2089,11 @@ async function st(e, t = !1, r = window.location.href, n) {
|
|
|
2088
2089
|
const y = i.toString(), b = y ? `${u}?${y}` : u;
|
|
2089
2090
|
o = `${s}${b}`;
|
|
2090
2091
|
} else {
|
|
2091
|
-
o = new URL(r)
|
|
2092
|
-
|
|
2093
|
-
e.forEach((l) => {
|
|
2094
|
-
o.searchParams.delete(l);
|
|
2092
|
+
o = new URL(r), e.forEach((f) => {
|
|
2093
|
+
o.searchParams.delete(f);
|
|
2095
2094
|
});
|
|
2096
|
-
const
|
|
2097
|
-
o =
|
|
2095
|
+
const c = o.searchParams.toString();
|
|
2096
|
+
o = c ? `${o.href}?${c}` : o.href;
|
|
2098
2097
|
}
|
|
2099
2098
|
return t && history.replaceState({}, "", o), o;
|
|
2100
2099
|
}
|
|
@@ -2185,7 +2184,7 @@ const it = /* @__PURE__ */ at({
|
|
|
2185
2184
|
async function y() {
|
|
2186
2185
|
if (n.openDebugger)
|
|
2187
2186
|
debugger;
|
|
2188
|
-
n.isEnabled && (l = await
|
|
2187
|
+
n.isEnabled && (l = await D(n.clientId), await T(), b());
|
|
2189
2188
|
}
|
|
2190
2189
|
async function b() {
|
|
2191
2190
|
if (n.showLog && console.log("【qlfyEcologicalLogin】登陆流程执行..."), n.token) {
|
|
@@ -2277,6 +2276,7 @@ const it = /* @__PURE__ */ at({
|
|
|
2277
2276
|
};
|
|
2278
2277
|
export {
|
|
2279
2278
|
Sr as default,
|
|
2279
|
+
Xn as getLoginInfo,
|
|
2280
2280
|
br as getRefreshToken,
|
|
2281
2281
|
Kn as getToken,
|
|
2282
2282
|
yr as getUserPermission,
|
package/lib/index.mjs.gz
CHANGED
|
Binary file
|
package/lib/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(C,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],B):(C=typeof globalThis<"u"?globalThis:C||self,B(C["qlfy-ecological-login"]={},C.Vue))})(this,function(C,B){"use strict";function Se(e,t){return function(){return e.apply(t,arguments)}}const{toString:ut}=Object.prototype,{getPrototypeOf:ae}=Object,{iterator:X,toStringTag:Re}=Symbol,G=(e=>t=>{const r=ut.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=e=>(e=e.toLowerCase(),t=>G(t)===e),Q=e=>t=>typeof t===e,{isArray:H}=Array,v=Q("undefined");function ft(e){return e!==null&&!v(e)&&e.constructor!==null&&!v(e.constructor)&&L(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Te=D("ArrayBuffer");function dt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Te(e.buffer),t}const ht=Q("string"),L=Q("function"),Oe=Q("number"),Z=e=>e!==null&&typeof e=="object",pt=e=>e===!0||e===!1,Y=e=>{if(G(e)!=="object")return!1;const t=ae(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Re in e)&&!(X in e)},mt=D("Date"),gt=D("File"),wt=D("Blob"),yt=D("FileList"),bt=e=>Z(e)&&L(e.pipe),Et=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||L(e.append)&&((t=G(e))==="formdata"||t==="object"&&L(e.toString)&&e.toString()==="[object FormData]"))},St=D("URLSearchParams"),[Rt,Tt,Ot,At]=["ReadableStream","Request","Response","Headers"].map(D),xt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function J(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),H(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const s=r?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length;let c;for(n=0;n<i;n++)c=s[n],t.call(null,e[c],c,e)}}function Ae(e,t){t=t.toLowerCase();const r=Object.keys(e);let n=r.length,o;for(;n-- >0;)if(o=r[n],t===o.toLowerCase())return o;return null}const U=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xe=e=>!v(e)&&e!==U;function ce(){const{caseless:e}=xe(this)&&this||{},t={},r=(n,o)=>{const s=e&&Ae(t,o)||o;Y(t[s])&&Y(n)?t[s]=ce(t[s],n):Y(n)?t[s]=ce({},n):H(n)?t[s]=n.slice():t[s]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&J(arguments[n],r);return t}const Pt=(e,t,r,{allOwnKeys:n}={})=>(J(t,(o,s)=>{r&&L(o)?e[s]=Se(o,r):e[s]=o},{allOwnKeys:n}),e),Lt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),kt=(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)},Ct=(e,t,r,n)=>{let o,s,i;const c={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],(!n||n(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=r!==!1&&ae(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Dt=(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},Nt=e=>{if(!e)return null;if(H(e))return e;let t=e.length;if(!Oe(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Bt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ae(Uint8Array)),_t=(e,t)=>{const n=(e&&e[X]).call(e);let o;for(;(o=n.next())&&!o.done;){const s=o.value;t.call(e,s[0],s[1])}},Ft=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},qt=D("HTMLFormElement"),Ut=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),Pe=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),It=D("RegExp"),Le=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};J(r,(o,s)=>{let i;(i=t(o,s,e))!==!1&&(n[s]=i||o)}),Object.defineProperties(e,n)},Mt=e=>{Le(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+"'")})}})},$t=(e,t)=>{const r={},n=o=>{o.forEach(s=>{r[s]=!0})};return H(e)?n(e):n(String(e).split(t)),r},jt=()=>{},Ht=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function zt(e){return!!(e&&L(e.append)&&e[Re]==="FormData"&&e[X])}const vt=e=>{const t=new Array(10),r=(n,o)=>{if(Z(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;const s=H(n)?[]:{};return J(n,(i,c)=>{const f=r(i,o+1);!v(f)&&(s[c]=f)}),t[o]=void 0,s}}return n};return r(e,0)},Jt=D("AsyncFunction"),Vt=e=>e&&(Z(e)||L(e))&&L(e.then)&&L(e.catch),ke=((e,t)=>e?setImmediate:t?((r,n)=>(U.addEventListener("message",({source:o,data:s})=>{o===U&&s===r&&n.length&&n.shift()()},!1),o=>{n.push(o),U.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",L(U.postMessage)),Wt=typeof queueMicrotask<"u"?queueMicrotask.bind(U):typeof process<"u"&&process.nextTick||ke,a={isArray:H,isArrayBuffer:Te,isBuffer:ft,isFormData:Et,isArrayBufferView:dt,isString:ht,isNumber:Oe,isBoolean:pt,isObject:Z,isPlainObject:Y,isReadableStream:Rt,isRequest:Tt,isResponse:Ot,isHeaders:At,isUndefined:v,isDate:mt,isFile:gt,isBlob:wt,isRegExp:It,isFunction:L,isStream:bt,isURLSearchParams:St,isTypedArray:Bt,isFileList:yt,forEach:J,merge:ce,extend:Pt,trim:xt,stripBOM:Lt,inherits:kt,toFlatObject:Ct,kindOf:G,kindOfTest:D,endsWith:Dt,toArray:Nt,forEachEntry:_t,matchAll:Ft,isHTMLForm:qt,hasOwnProperty:Pe,hasOwnProp:Pe,reduceDescriptors:Le,freezeMethods:Mt,toObjectSet:$t,toCamelCase:Ut,noop:jt,toFiniteNumber:Ht,findKey:Ae,global:U,isContextDefined:xe,isSpecCompliantForm:zt,toJSONObject:vt,isAsyncFn:Jt,isThenable:Vt,setImmediate:ke,asap:Wt,isIterable:e=>e!=null&&L(e[X])};function g(e,t,r,n,o){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),o&&(this.response=o,this.status=o.status?o.status:null)}a.inherits(g,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const Ce=g.prototype,De={};["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"].forEach(e=>{De[e]={value:e}}),Object.defineProperties(g,De),Object.defineProperty(Ce,"isAxiosError",{value:!0}),g.from=(e,t,r,n,o,s)=>{const i=Object.create(Ce);return a.toFlatObject(e,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),g.call(i,e.message,t,r,n,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};const Kt=null;function le(e){return a.isPlainObject(e)||a.isArray(e)}function Ne(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Be(e,t,r){return e?e.concat(t).map(function(o,s){return o=Ne(o),!r&&s?"["+o+"]":o}).join(r?".":""):t}function Xt(e){return a.isArray(e)&&!e.some(le)}const Gt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ee(e,t,r){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,p){return!a.isUndefined(p[m])});const n=r.metaTokens,o=r.visitor||u,s=r.dots,i=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(o))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(a.isDate(h))return h.toISOString();if(a.isBoolean(h))return h.toString();if(!f&&a.isBlob(h))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(h)||a.isTypedArray(h)?f&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,m,p){let S=h;if(h&&!p&&typeof h=="object"){if(a.endsWith(m,"{}"))m=n?m:m.slice(0,-2),h=JSON.stringify(h);else if(a.isArray(h)&&Xt(h)||(a.isFileList(h)||a.endsWith(m,"[]"))&&(S=a.toArray(h)))return m=Ne(m),S.forEach(function(O,w){!(a.isUndefined(O)||O===null)&&t.append(i===!0?Be([m],w,s):i===null?m:m+"[]",l(O))}),!1}return le(h)?!0:(t.append(Be(p,m,s),l(h)),!1)}const d=[],y=Object.assign(Gt,{defaultVisitor:u,convertValue:l,isVisitable:le});function E(h,m){if(!a.isUndefined(h)){if(d.indexOf(h)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(h),a.forEach(h,function(S,T){(!(a.isUndefined(S)||S===null)&&o.call(t,S,a.isString(T)?T.trim():T,m,y))===!0&&E(S,m?m.concat(T):[T])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return E(e),t}function _e(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function ue(e,t){this._pairs=[],e&&ee(e,this,t)}const Fe=ue.prototype;Fe.append=function(t,r){this._pairs.push([t,r])},Fe.toString=function(t){const r=t?function(n){return t.call(this,n,_e)}:_e;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Qt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qe(e,t,r){if(!t)return e;const n=r&&r.encode||Qt;a.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let s;if(o?s=o(t,r):s=a.isURLSearchParams(t)?t.toString():new ue(t,r).toString(n),s){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Ue{constructor(){this.handlers=[]}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}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Ie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Zt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ue,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},fe=typeof window<"u"&&typeof document<"u",de=typeof navigator=="object"&&navigator||void 0,Yt=fe&&(!de||["ReactNative","NativeScript","NS"].indexOf(de.product)<0),en=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",tn=fe&&window.location.href||"http://localhost",x={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fe,hasStandardBrowserEnv:Yt,hasStandardBrowserWebWorkerEnv:en,navigator:de,origin:tn},Symbol.toStringTag,{value:"Module"})),...Zt};function nn(e,t){return ee(e,new x.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,s){return x.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function rn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function on(e){const t={},r=Object.keys(e);let n;const o=r.length;let s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}function Me(e){function t(r,n,o,s){let i=r[s++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),f=s>=r.length;return i=!i&&a.isArray(o)?o.length:i,f?(a.hasOwnProp(o,i)?o[i]=[o[i],n]:o[i]=n,!c):((!o[i]||!a.isObject(o[i]))&&(o[i]=[]),t(r,n,o[i],s)&&a.isArray(o[i])&&(o[i]=on(o[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const r={};return a.forEachEntry(e,(n,o)=>{t(rn(n),o,r,0)}),r}return null}function sn(e,t,r){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const V={transitional:Ie,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",o=n.indexOf("application/json")>-1,s=a.isObject(t);if(s&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return o?JSON.stringify(Me(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return nn(t,this.formSerializer).toString();if((c=a.isFileList(t))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return ee(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return s||o?(r.setContentType("application/json",!1),sn(t)):t}],transformResponse:[function(t){const r=this.transitional||V.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(n&&!this.responseType||o)){const i=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:x.classes.FormData,Blob:x.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{V.headers[e]={}});const an=a.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"]),cn=e=>{const t={};let r,n,o;return e&&e.split(`
|
|
2
|
-
`).forEach(function(i){o=i.indexOf(":"),r=i.substring(0,o).trim().toLowerCase(),n=i.substring(o+1).trim(),!(!r||t[r]&&
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}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(o=>n.set(o)),n}static accessor(t){const n=(this[$e]=this[$e]={accessors:{}}).accessors,o=this.prototype;function s(i){const c=W(i);n[c]||(dn(o,i),n[c]=!0)}return a.isArray(t)?t.forEach(s):s(t),this}};k.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(k.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),a.freezeMethods(k);function pe(e,t){const r=this||V,n=t||r,o=k.from(n.headers);let s=n.data;return a.forEach(e,function(c){s=c.call(r,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function je(e){return!!(e&&e.__CANCEL__)}function z(e,t,r){g.call(this,e??"canceled",g.ERR_CANCELED,t,r),this.name="CanceledError"}a.inherits(z,g,{__CANCEL__:!0});function He(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function hn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function pn(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o=0,s=0,i;return t=t!==void 0?t:1e3,function(f){const l=Date.now(),u=n[s];i||(i=l),r[o]=f,n[o]=l;let d=s,y=0;for(;d!==o;)y+=r[d++],d=d%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),l-i<t)return;const E=u&&l-u;return E?Math.round(y*1e3/E):void 0}}function mn(e,t){let r=0,n=1e3/t,o,s;const i=(l,u=Date.now())=>{r=u,o=null,s&&(clearTimeout(s),s=null),e.apply(null,l)};return[(...l)=>{const u=Date.now(),d=u-r;d>=n?i(l,u):(o=l,s||(s=setTimeout(()=>{s=null,i(o)},n-d)))},()=>o&&i(o)]}const ne=(e,t,r=3)=>{let n=0;const o=pn(50,250);return mn(s=>{const i=s.loaded,c=s.lengthComputable?s.total:void 0,f=i-n,l=o(f),u=i<=c;n=i;const d={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:l||void 0,estimated:l&&c&&u?(c-i)/l:void 0,event:s,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(d)},r)},ze=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ve=e=>(...t)=>a.asap(()=>e(...t)),gn=x.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,x.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(x.origin),x.navigator&&/(msie|trident)/i.test(x.navigator.userAgent)):()=>!0,wn=x.hasStandardBrowserEnv?{write(e,t,r,n,o,s){const i=[e+"="+encodeURIComponent(t)];a.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),a.isString(n)&&i.push("path="+n),a.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function yn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function bn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Je(e,t,r){let n=!yn(t);return e&&(n||r==!1)?bn(e,t):t}const Ve=e=>e instanceof k?{...e}:e;function I(e,t){t=t||{};const r={};function n(l,u,d,y){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:y},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function o(l,u,d,y){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l,d,y)}else return n(l,u,d,y)}function s(l,u){if(!a.isUndefined(u))return n(void 0,u)}function i(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function c(l,u,d){if(d in t)return n(l,u);if(d in e)return n(void 0,l)}const f={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(l,u,d)=>o(Ve(l),Ve(u),d,!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(u){const d=f[u]||o,y=d(e[u],t[u],u);a.isUndefined(y)&&d!==c||(r[u]=y)}),r}const We=e=>{const t=I({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:c}=t;t.headers=i=k.from(i),t.url=qe(Je(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let f;if(a.isFormData(r)){if(x.hasStandardBrowserEnv||x.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[l,...u]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([l||"multipart/form-data",...u].join("; "))}}if(x.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(t)),n||n!==!1&&gn(t.url))){const l=o&&s&&wn.read(s);l&&i.set(o,l)}return t},En=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const o=We(e);let s=o.data;const i=k.from(o.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:l}=o,u,d,y,E,h;function m(){E&&E(),h&&h(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(o.method.toUpperCase(),o.url,!0),p.timeout=o.timeout;function S(){if(!p)return;const O=k.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),R={data:!c||c==="text"||c==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:O,config:e,request:p};He(function(P){r(P),m()},function(P){n(P),m()},R),p=null}"onloadend"in p?p.onloadend=S:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(S)},p.onabort=function(){p&&(n(new g("Request aborted",g.ECONNABORTED,e,p)),p=null)},p.onerror=function(){n(new g("Network Error",g.ERR_NETWORK,e,p)),p=null},p.ontimeout=function(){let w=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const R=o.transitional||Ie;o.timeoutErrorMessage&&(w=o.timeoutErrorMessage),n(new g(w,R.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,p)),p=null},s===void 0&&i.setContentType(null),"setRequestHeader"in p&&a.forEach(i.toJSON(),function(w,R){p.setRequestHeader(R,w)}),a.isUndefined(o.withCredentials)||(p.withCredentials=!!o.withCredentials),c&&c!=="json"&&(p.responseType=o.responseType),l&&([y,h]=ne(l,!0),p.addEventListener("progress",y)),f&&p.upload&&([d,E]=ne(f),p.upload.addEventListener("progress",d),p.upload.addEventListener("loadend",E)),(o.cancelToken||o.signal)&&(u=O=>{p&&(n(!O||O.type?new z(null,e,p):O),p.abort(),p=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const T=hn(o.url);if(T&&x.protocols.indexOf(T)===-1){n(new g("Unsupported protocol "+T+":",g.ERR_BAD_REQUEST,e));return}p.send(s||null)})},Sn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,o;const s=function(l){if(!o){o=!0,c();const u=l instanceof Error?l:this.reason;n.abort(u instanceof g?u:new z(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new g(`timeout ${t} of ms exceeded`,g.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:f}=n;return f.unsubscribe=()=>a.asap(c),f}},Rn=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,o;for(;n<r;)o=n+t,yield e.slice(n,o),n=o},Tn=async function*(e,t){for await(const r of On(e))yield*Rn(r,t)},On=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Ke=(e,t,r,n)=>{const o=Tn(e,t);let s=0,i,c=f=>{i||(i=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:l,value:u}=await o.next();if(l){c(),f.close();return}let d=u.byteLength;if(r){let y=s+=d;r(y)}f.enqueue(new Uint8Array(u))}catch(l){throw c(l),l}},cancel(f){return c(f),o.return()}},{highWaterMark:2})},re=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Xe=re&&typeof ReadableStream=="function",An=re&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Ge=(e,...t)=>{try{return!!e(...t)}catch{return!1}},xn=Xe&&Ge(()=>{let e=!1;const t=new Request(x.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Qe=64*1024,me=Xe&&Ge(()=>a.isReadableStream(new Response("").body)),oe={stream:me&&(e=>e.body)};re&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!oe[t]&&(oe[t]=a.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new g(`Response type '${t}' is not supported`,g.ERR_NOT_SUPPORT,n)})})})(new Response);const Pn=async e=>{if(e==null)return 0;if(a.isBlob(e))return e.size;if(a.isSpecCompliantForm(e))return(await new Request(x.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(a.isArrayBufferView(e)||a.isArrayBuffer(e))return e.byteLength;if(a.isURLSearchParams(e)&&(e=e+""),a.isString(e))return(await An(e)).byteLength},Ln=async(e,t)=>{const r=a.toFiniteNumber(e.getContentLength());return r??Pn(t)},ge={http:Kt,xhr:En,fetch:re&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:s,timeout:i,onDownloadProgress:c,onUploadProgress:f,responseType:l,headers:u,withCredentials:d="same-origin",fetchOptions:y}=We(e);l=l?(l+"").toLowerCase():"text";let E=Sn([o,s&&s.toAbortSignal()],i),h;const m=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let p;try{if(f&&xn&&r!=="get"&&r!=="head"&&(p=await Ln(u,n))!==0){let R=new Request(t,{method:"POST",body:n,duplex:"half"}),A;if(a.isFormData(n)&&(A=R.headers.get("content-type"))&&u.setContentType(A),R.body){const[P,q]=ze(p,ne(ve(f)));n=Ke(R.body,Qe,P,q)}}a.isString(d)||(d=d?"include":"omit");const S="credentials"in Request.prototype;h=new Request(t,{...y,signal:E,method:r.toUpperCase(),headers:u.normalize().toJSON(),body:n,duplex:"half",credentials:S?d:void 0});let T=await fetch(h,y);const O=me&&(l==="stream"||l==="response");if(me&&(c||O&&m)){const R={};["status","statusText","headers"].forEach(ct=>{R[ct]=T[ct]});const A=a.toFiniteNumber(T.headers.get("content-length")),[P,q]=c&&ze(A,ne(ve(c),!0))||[];T=new Response(Ke(T.body,Qe,P,()=>{q&&q(),m&&m()}),R)}l=l||"text";let w=await oe[a.findKey(oe,l)||"text"](T,e);return!O&&m&&m(),await new Promise((R,A)=>{He(R,A,{data:w,headers:k.from(T.headers),status:T.status,statusText:T.statusText,config:e,request:h})})}catch(S){throw m&&m(),S&&S.name==="TypeError"&&/Load failed|fetch/i.test(S.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,e,h),{cause:S.cause||S}):g.from(S,S&&S.code,e,h)}})};a.forEach(ge,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ze=e=>`- ${e}`,kn=e=>a.isFunction(e)||e===null||e===!1,Ye={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let s=0;s<t;s++){r=e[s];let i;if(n=r,!kn(r)&&(n=ge[(i=String(r)).toLowerCase()],n===void 0))throw new g(`Unknown adapter '${i}'`);if(n)break;o[i||"#"+s]=n}if(!n){const s=Object.entries(o).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?s.length>1?`since :
|
|
1
|
+
(function(P,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],B):(P=typeof globalThis<"u"?globalThis:P||self,B(P["qlfy-ecological-login"]={},P.Vue))})(this,function(P,B){"use strict";function Se(e,t){return function(){return e.apply(t,arguments)}}const{toString:ft}=Object.prototype,{getPrototypeOf:ae}=Object,{iterator:X,toStringTag:Re}=Symbol,G=(e=>t=>{const r=ft.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=e=>(e=e.toLowerCase(),t=>G(t)===e),Q=e=>t=>typeof t===e,{isArray:H}=Array,v=Q("undefined");function dt(e){return e!==null&&!v(e)&&e.constructor!==null&&!v(e.constructor)&&k(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Te=D("ArrayBuffer");function ht(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Te(e.buffer),t}const pt=Q("string"),k=Q("function"),Oe=Q("number"),Z=e=>e!==null&&typeof e=="object",mt=e=>e===!0||e===!1,Y=e=>{if(G(e)!=="object")return!1;const t=ae(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Re in e)&&!(X in e)},gt=D("Date"),wt=D("File"),yt=D("Blob"),bt=D("FileList"),Et=e=>Z(e)&&k(e.pipe),St=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||k(e.append)&&((t=G(e))==="formdata"||t==="object"&&k(e.toString)&&e.toString()==="[object FormData]"))},Rt=D("URLSearchParams"),[Tt,Ot,At,xt]=["ReadableStream","Request","Response","Headers"].map(D),Lt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function J(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),H(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const s=r?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length;let c;for(n=0;n<i;n++)c=s[n],t.call(null,e[c],c,e)}}function Ae(e,t){t=t.toLowerCase();const r=Object.keys(e);let n=r.length,o;for(;n-- >0;)if(o=r[n],t===o.toLowerCase())return o;return null}const U=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xe=e=>!v(e)&&e!==U;function ce(){const{caseless:e}=xe(this)&&this||{},t={},r=(n,o)=>{const s=e&&Ae(t,o)||o;Y(t[s])&&Y(n)?t[s]=ce(t[s],n):Y(n)?t[s]=ce({},n):H(n)?t[s]=n.slice():t[s]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&J(arguments[n],r);return t}const Pt=(e,t,r,{allOwnKeys:n}={})=>(J(t,(o,s)=>{r&&k(o)?e[s]=Se(o,r):e[s]=o},{allOwnKeys:n}),e),kt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ct=(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)},Dt=(e,t,r,n)=>{let o,s,i;const c={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],(!n||n(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=r!==!1&&ae(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Nt=(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},Bt=e=>{if(!e)return null;if(H(e))return e;let t=e.length;if(!Oe(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},_t=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ae(Uint8Array)),Ft=(e,t)=>{const n=(e&&e[X]).call(e);let o;for(;(o=n.next())&&!o.done;){const s=o.value;t.call(e,s[0],s[1])}},qt=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Ut=D("HTMLFormElement"),It=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),Le=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Mt=D("RegExp"),Pe=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};J(r,(o,s)=>{let i;(i=t(o,s,e))!==!1&&(n[s]=i||o)}),Object.defineProperties(e,n)},$t=e=>{Pe(e,(t,r)=>{if(k(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(k(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+"'")})}})},jt=(e,t)=>{const r={},n=o=>{o.forEach(s=>{r[s]=!0})};return H(e)?n(e):n(String(e).split(t)),r},Ht=()=>{},zt=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function vt(e){return!!(e&&k(e.append)&&e[Re]==="FormData"&&e[X])}const Jt=e=>{const t=new Array(10),r=(n,o)=>{if(Z(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;const s=H(n)?[]:{};return J(n,(i,c)=>{const f=r(i,o+1);!v(f)&&(s[c]=f)}),t[o]=void 0,s}}return n};return r(e,0)},Vt=D("AsyncFunction"),Wt=e=>e&&(Z(e)||k(e))&&k(e.then)&&k(e.catch),ke=((e,t)=>e?setImmediate:t?((r,n)=>(U.addEventListener("message",({source:o,data:s})=>{o===U&&s===r&&n.length&&n.shift()()},!1),o=>{n.push(o),U.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",k(U.postMessage)),Kt=typeof queueMicrotask<"u"?queueMicrotask.bind(U):typeof process<"u"&&process.nextTick||ke,a={isArray:H,isArrayBuffer:Te,isBuffer:dt,isFormData:St,isArrayBufferView:ht,isString:pt,isNumber:Oe,isBoolean:mt,isObject:Z,isPlainObject:Y,isReadableStream:Tt,isRequest:Ot,isResponse:At,isHeaders:xt,isUndefined:v,isDate:gt,isFile:wt,isBlob:yt,isRegExp:Mt,isFunction:k,isStream:Et,isURLSearchParams:Rt,isTypedArray:_t,isFileList:bt,forEach:J,merge:ce,extend:Pt,trim:Lt,stripBOM:kt,inherits:Ct,toFlatObject:Dt,kindOf:G,kindOfTest:D,endsWith:Nt,toArray:Bt,forEachEntry:Ft,matchAll:qt,isHTMLForm:Ut,hasOwnProperty:Le,hasOwnProp:Le,reduceDescriptors:Pe,freezeMethods:$t,toObjectSet:jt,toCamelCase:It,noop:Ht,toFiniteNumber:zt,findKey:Ae,global:U,isContextDefined:xe,isSpecCompliantForm:vt,toJSONObject:Jt,isAsyncFn:Vt,isThenable:Wt,setImmediate:ke,asap:Kt,isIterable:e=>e!=null&&k(e[X])};function g(e,t,r,n,o){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),o&&(this.response=o,this.status=o.status?o.status:null)}a.inherits(g,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const Ce=g.prototype,De={};["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"].forEach(e=>{De[e]={value:e}}),Object.defineProperties(g,De),Object.defineProperty(Ce,"isAxiosError",{value:!0}),g.from=(e,t,r,n,o,s)=>{const i=Object.create(Ce);return a.toFlatObject(e,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),g.call(i,e.message,t,r,n,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};const Xt=null;function le(e){return a.isPlainObject(e)||a.isArray(e)}function Ne(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Be(e,t,r){return e?e.concat(t).map(function(o,s){return o=Ne(o),!r&&s?"["+o+"]":o}).join(r?".":""):t}function Gt(e){return a.isArray(e)&&!e.some(le)}const Qt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ee(e,t,r){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,p){return!a.isUndefined(p[m])});const n=r.metaTokens,o=r.visitor||u,s=r.dots,i=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(o))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(a.isDate(h))return h.toISOString();if(a.isBoolean(h))return h.toString();if(!f&&a.isBlob(h))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(h)||a.isTypedArray(h)?f&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,m,p){let S=h;if(h&&!p&&typeof h=="object"){if(a.endsWith(m,"{}"))m=n?m:m.slice(0,-2),h=JSON.stringify(h);else if(a.isArray(h)&&Gt(h)||(a.isFileList(h)||a.endsWith(m,"[]"))&&(S=a.toArray(h)))return m=Ne(m),S.forEach(function(O,w){!(a.isUndefined(O)||O===null)&&t.append(i===!0?Be([m],w,s):i===null?m:m+"[]",l(O))}),!1}return le(h)?!0:(t.append(Be(p,m,s),l(h)),!1)}const d=[],y=Object.assign(Qt,{defaultVisitor:u,convertValue:l,isVisitable:le});function E(h,m){if(!a.isUndefined(h)){if(d.indexOf(h)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(h),a.forEach(h,function(S,T){(!(a.isUndefined(S)||S===null)&&o.call(t,S,a.isString(T)?T.trim():T,m,y))===!0&&E(S,m?m.concat(T):[T])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return E(e),t}function _e(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function ue(e,t){this._pairs=[],e&&ee(e,this,t)}const Fe=ue.prototype;Fe.append=function(t,r){this._pairs.push([t,r])},Fe.toString=function(t){const r=t?function(n){return t.call(this,n,_e)}:_e;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Zt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qe(e,t,r){if(!t)return e;const n=r&&r.encode||Zt;a.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let s;if(o?s=o(t,r):s=a.isURLSearchParams(t)?t.toString():new ue(t,r).toString(n),s){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Ue{constructor(){this.handlers=[]}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}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Ie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Yt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ue,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},fe=typeof window<"u"&&typeof document<"u",de=typeof navigator=="object"&&navigator||void 0,en=fe&&(!de||["ReactNative","NativeScript","NS"].indexOf(de.product)<0),tn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",nn=fe&&window.location.href||"http://localhost",x={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fe,hasStandardBrowserEnv:en,hasStandardBrowserWebWorkerEnv:tn,navigator:de,origin:nn},Symbol.toStringTag,{value:"Module"})),...Yt};function rn(e,t){return ee(e,new x.classes.URLSearchParams,Object.assign({visitor:function(r,n,o,s){return x.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function on(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function sn(e){const t={},r=Object.keys(e);let n;const o=r.length;let s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}function Me(e){function t(r,n,o,s){let i=r[s++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),f=s>=r.length;return i=!i&&a.isArray(o)?o.length:i,f?(a.hasOwnProp(o,i)?o[i]=[o[i],n]:o[i]=n,!c):((!o[i]||!a.isObject(o[i]))&&(o[i]=[]),t(r,n,o[i],s)&&a.isArray(o[i])&&(o[i]=sn(o[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const r={};return a.forEachEntry(e,(n,o)=>{t(on(n),o,r,0)}),r}return null}function an(e,t,r){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const V={transitional:Ie,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",o=n.indexOf("application/json")>-1,s=a.isObject(t);if(s&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return o?JSON.stringify(Me(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return rn(t,this.formSerializer).toString();if((c=a.isFileList(t))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return ee(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return s||o?(r.setContentType("application/json",!1),an(t)):t}],transformResponse:[function(t){const r=this.transitional||V.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(n&&!this.responseType||o)){const i=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:x.classes.FormData,Blob:x.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{V.headers[e]={}});const cn=a.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"]),ln=e=>{const t={};let r,n,o;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){o=i.indexOf(":"),r=i.substring(0,o).trim().toLowerCase(),n=i.substring(o+1).trim(),!(!r||t[r]&&cn[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},$e=Symbol("internals");function W(e){return e&&String(e).trim().toLowerCase()}function te(e){return e===!1||e==null?e:a.isArray(e)?e.map(te):String(e)}function un(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const fn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function he(e,t,r,n,o){if(a.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!a.isString(t)){if(a.isString(n))return t.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(t)}}function dn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function hn(e,t){const r=a.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(o,s,i){return this[n].call(this,t,o,s,i)},configurable:!0})})}let C=class{constructor(t){t&&this.set(t)}set(t,r,n){const o=this;function s(c,f,l){const u=W(f);if(!u)throw new Error("header name must be a non-empty string");const d=a.findKey(o,u);(!d||o[d]===void 0||l===!0||l===void 0&&o[d]!==!1)&&(o[d||f]=te(c))}const i=(c,f)=>a.forEach(c,(l,u)=>s(l,u,f));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,r);else if(a.isString(t)&&(t=t.trim())&&!fn(t))i(ln(t),r);else if(a.isObject(t)&&a.isIterable(t)){let c={},f,l;for(const u of t){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[l=u[0]]=(f=c[l])?a.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}i(c,r)}else t!=null&&s(r,t,n);return this}get(t,r){if(t=W(t),t){const n=a.findKey(this,t);if(n){const o=this[n];if(!r)return o;if(r===!0)return un(o);if(a.isFunction(r))return r.call(this,o,n);if(a.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=W(t),t){const n=a.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||he(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let o=!1;function s(i){if(i=W(i),i){const c=a.findKey(n,i);c&&(!r||he(n,n[c],c,r))&&(delete n[c],o=!0)}}return a.isArray(t)?t.forEach(s):s(t),o}clear(t){const r=Object.keys(this);let n=r.length,o=!1;for(;n--;){const s=r[n];(!t||he(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){const r=this,n={};return a.forEach(this,(o,s)=>{const i=a.findKey(n,s);if(i){r[i]=te(o),delete r[s];return}const c=t?dn(s):String(s).trim();c!==s&&delete r[s],r[c]=te(o),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return a.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=t&&a.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(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}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(o=>n.set(o)),n}static accessor(t){const n=(this[$e]=this[$e]={accessors:{}}).accessors,o=this.prototype;function s(i){const c=W(i);n[c]||(hn(o,i),n[c]=!0)}return a.isArray(t)?t.forEach(s):s(t),this}};C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(C.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),a.freezeMethods(C);function pe(e,t){const r=this||V,n=t||r,o=C.from(n.headers);let s=n.data;return a.forEach(e,function(c){s=c.call(r,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function je(e){return!!(e&&e.__CANCEL__)}function z(e,t,r){g.call(this,e??"canceled",g.ERR_CANCELED,t,r),this.name="CanceledError"}a.inherits(z,g,{__CANCEL__:!0});function He(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function pn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function mn(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o=0,s=0,i;return t=t!==void 0?t:1e3,function(f){const l=Date.now(),u=n[s];i||(i=l),r[o]=f,n[o]=l;let d=s,y=0;for(;d!==o;)y+=r[d++],d=d%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),l-i<t)return;const E=u&&l-u;return E?Math.round(y*1e3/E):void 0}}function gn(e,t){let r=0,n=1e3/t,o,s;const i=(l,u=Date.now())=>{r=u,o=null,s&&(clearTimeout(s),s=null),e.apply(null,l)};return[(...l)=>{const u=Date.now(),d=u-r;d>=n?i(l,u):(o=l,s||(s=setTimeout(()=>{s=null,i(o)},n-d)))},()=>o&&i(o)]}const ne=(e,t,r=3)=>{let n=0;const o=mn(50,250);return gn(s=>{const i=s.loaded,c=s.lengthComputable?s.total:void 0,f=i-n,l=o(f),u=i<=c;n=i;const d={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:l||void 0,estimated:l&&c&&u?(c-i)/l:void 0,event:s,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(d)},r)},ze=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ve=e=>(...t)=>a.asap(()=>e(...t)),wn=x.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,x.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(x.origin),x.navigator&&/(msie|trident)/i.test(x.navigator.userAgent)):()=>!0,yn=x.hasStandardBrowserEnv?{write(e,t,r,n,o,s){const i=[e+"="+encodeURIComponent(t)];a.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),a.isString(n)&&i.push("path="+n),a.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function bn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function En(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Je(e,t,r){let n=!bn(t);return e&&(n||r==!1)?En(e,t):t}const Ve=e=>e instanceof C?{...e}:e;function I(e,t){t=t||{};const r={};function n(l,u,d,y){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:y},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function o(l,u,d,y){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l,d,y)}else return n(l,u,d,y)}function s(l,u){if(!a.isUndefined(u))return n(void 0,u)}function i(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function c(l,u,d){if(d in t)return n(l,u);if(d in e)return n(void 0,l)}const f={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(l,u,d)=>o(Ve(l),Ve(u),d,!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(u){const d=f[u]||o,y=d(e[u],t[u],u);a.isUndefined(y)&&d!==c||(r[u]=y)}),r}const We=e=>{const t=I({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:c}=t;t.headers=i=C.from(i),t.url=qe(Je(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let f;if(a.isFormData(r)){if(x.hasStandardBrowserEnv||x.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[l,...u]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([l||"multipart/form-data",...u].join("; "))}}if(x.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(t)),n||n!==!1&&wn(t.url))){const l=o&&s&&yn.read(s);l&&i.set(o,l)}return t},Sn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const o=We(e);let s=o.data;const i=C.from(o.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:l}=o,u,d,y,E,h;function m(){E&&E(),h&&h(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(o.method.toUpperCase(),o.url,!0),p.timeout=o.timeout;function S(){if(!p)return;const O=C.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),R={data:!c||c==="text"||c==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:O,config:e,request:p};He(function(L){r(L),m()},function(L){n(L),m()},R),p=null}"onloadend"in p?p.onloadend=S:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(S)},p.onabort=function(){p&&(n(new g("Request aborted",g.ECONNABORTED,e,p)),p=null)},p.onerror=function(){n(new g("Network Error",g.ERR_NETWORK,e,p)),p=null},p.ontimeout=function(){let w=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const R=o.transitional||Ie;o.timeoutErrorMessage&&(w=o.timeoutErrorMessage),n(new g(w,R.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,p)),p=null},s===void 0&&i.setContentType(null),"setRequestHeader"in p&&a.forEach(i.toJSON(),function(w,R){p.setRequestHeader(R,w)}),a.isUndefined(o.withCredentials)||(p.withCredentials=!!o.withCredentials),c&&c!=="json"&&(p.responseType=o.responseType),l&&([y,h]=ne(l,!0),p.addEventListener("progress",y)),f&&p.upload&&([d,E]=ne(f),p.upload.addEventListener("progress",d),p.upload.addEventListener("loadend",E)),(o.cancelToken||o.signal)&&(u=O=>{p&&(n(!O||O.type?new z(null,e,p):O),p.abort(),p=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const T=pn(o.url);if(T&&x.protocols.indexOf(T)===-1){n(new g("Unsupported protocol "+T+":",g.ERR_BAD_REQUEST,e));return}p.send(s||null)})},Rn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,o;const s=function(l){if(!o){o=!0,c();const u=l instanceof Error?l:this.reason;n.abort(u instanceof g?u:new z(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new g(`timeout ${t} of ms exceeded`,g.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:f}=n;return f.unsubscribe=()=>a.asap(c),f}},Tn=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,o;for(;n<r;)o=n+t,yield e.slice(n,o),n=o},On=async function*(e,t){for await(const r of An(e))yield*Tn(r,t)},An=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Ke=(e,t,r,n)=>{const o=On(e,t);let s=0,i,c=f=>{i||(i=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:l,value:u}=await o.next();if(l){c(),f.close();return}let d=u.byteLength;if(r){let y=s+=d;r(y)}f.enqueue(new Uint8Array(u))}catch(l){throw c(l),l}},cancel(f){return c(f),o.return()}},{highWaterMark:2})},re=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Xe=re&&typeof ReadableStream=="function",xn=re&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Ge=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ln=Xe&&Ge(()=>{let e=!1;const t=new Request(x.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Qe=64*1024,me=Xe&&Ge(()=>a.isReadableStream(new Response("").body)),oe={stream:me&&(e=>e.body)};re&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!oe[t]&&(oe[t]=a.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new g(`Response type '${t}' is not supported`,g.ERR_NOT_SUPPORT,n)})})})(new Response);const Pn=async e=>{if(e==null)return 0;if(a.isBlob(e))return e.size;if(a.isSpecCompliantForm(e))return(await new Request(x.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(a.isArrayBufferView(e)||a.isArrayBuffer(e))return e.byteLength;if(a.isURLSearchParams(e)&&(e=e+""),a.isString(e))return(await xn(e)).byteLength},kn=async(e,t)=>{const r=a.toFiniteNumber(e.getContentLength());return r??Pn(t)},ge={http:Xt,xhr:Sn,fetch:re&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:s,timeout:i,onDownloadProgress:c,onUploadProgress:f,responseType:l,headers:u,withCredentials:d="same-origin",fetchOptions:y}=We(e);l=l?(l+"").toLowerCase():"text";let E=Rn([o,s&&s.toAbortSignal()],i),h;const m=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let p;try{if(f&&Ln&&r!=="get"&&r!=="head"&&(p=await kn(u,n))!==0){let R=new Request(t,{method:"POST",body:n,duplex:"half"}),A;if(a.isFormData(n)&&(A=R.headers.get("content-type"))&&u.setContentType(A),R.body){const[L,q]=ze(p,ne(ve(f)));n=Ke(R.body,Qe,L,q)}}a.isString(d)||(d=d?"include":"omit");const S="credentials"in Request.prototype;h=new Request(t,{...y,signal:E,method:r.toUpperCase(),headers:u.normalize().toJSON(),body:n,duplex:"half",credentials:S?d:void 0});let T=await fetch(h,y);const O=me&&(l==="stream"||l==="response");if(me&&(c||O&&m)){const R={};["status","statusText","headers"].forEach(lt=>{R[lt]=T[lt]});const A=a.toFiniteNumber(T.headers.get("content-length")),[L,q]=c&&ze(A,ne(ve(c),!0))||[];T=new Response(Ke(T.body,Qe,L,()=>{q&&q(),m&&m()}),R)}l=l||"text";let w=await oe[a.findKey(oe,l)||"text"](T,e);return!O&&m&&m(),await new Promise((R,A)=>{He(R,A,{data:w,headers:C.from(T.headers),status:T.status,statusText:T.statusText,config:e,request:h})})}catch(S){throw m&&m(),S&&S.name==="TypeError"&&/Load failed|fetch/i.test(S.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,e,h),{cause:S.cause||S}):g.from(S,S&&S.code,e,h)}})};a.forEach(ge,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ze=e=>`- ${e}`,Cn=e=>a.isFunction(e)||e===null||e===!1,Ye={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let s=0;s<t;s++){r=e[s];let i;if(n=r,!Cn(r)&&(n=ge[(i=String(r)).toLowerCase()],n===void 0))throw new g(`Unknown adapter '${i}'`);if(n)break;o[i||"#"+s]=n}if(!n){const s=Object.entries(o).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?s.length>1?`since :
|
|
4
4
|
`+s.map(Ze).join(`
|
|
5
|
-
`):" "+Ze(s[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return n},adapters:ge};function we(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new z(null,e)}function et(e){return we(e),e.headers=
|
|
6
|
-
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=I(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&ie.assertOptions(n,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),o!=null&&(a.isFunction(o)?r.paramsSerializer={serialize:o}:ie.assertOptions(o,{encode:N.function,serialize:N.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),ie.assertOptions(r,{baseUrl:N.spelling("baseURL"),withXsrfToken:N.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&a.merge(s.common,s[r.method]);s&&a.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),r.headers=k.concat(i,s);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,d=0,y;if(!f){const h=[et.bind(this),void 0];for(h.unshift.apply(h,c),h.push.apply(h,l),y=h.length,u=Promise.resolve(r);d<y;)u=u.then(h[d++],h[d++]);return u}y=c.length;let E=r;for(d=0;d<y;){const h=c[d++],m=c[d++];try{E=h(E)}catch(p){m.call(this,p);break}}try{u=et.call(this,E)}catch(h){return Promise.reject(h)}for(d=0,y=l.length;d<y;)u=u.then(l[d++],l[d++]);return u}getUri(t){t=I(this.defaults,t);const r=Je(t.baseURL,t.url,t.allowAbsoluteUrls);return qe(r,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){M.prototype[t]=function(r,n){return this.request(I(n||{},{method:t,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function r(n){return function(s,i,c){return this.request(I(c||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}M.prototype[t]=r(),M.prototype[t+"Form"]=r(!0)});let Dn=class lt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(c=>{n.subscribe(c),s=c}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},t(function(s,i,c){n.reason||(n.reason=new z(s,i,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new lt(function(o){t=o}),cancel:t}}};function Nn(e){return function(r){return e.apply(null,r)}}function Bn(e){return a.isObject(e)&&e.isAxiosError===!0}const ye={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ye).forEach(([e,t])=>{ye[t]=e});function rt(e){const t=new M(e),r=Se(M.prototype.request,t);return a.extend(r,M.prototype,t,{allOwnKeys:!0}),a.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return rt(I(e,o))},r}const b=rt(V);b.Axios=M,b.CanceledError=z,b.CancelToken=Dn,b.isCancel=je,b.VERSION=tt,b.toFormData=ee,b.AxiosError=g,b.Cancel=b.CanceledError,b.all=function(t){return Promise.all(t)},b.spread=Nn,b.isAxiosError=Bn,b.mergeConfig=I,b.AxiosHeaders=k,b.formToJSON=e=>Me(a.isHTMLForm(e)?new FormData(e):e),b.getAdapter=Ye.getAdapter,b.HttpStatusCode=ye,b.default=b;const{Axios:tr,AxiosError:nr,CanceledError:rr,isCancel:or,CancelToken:sr,VERSION:ir,all:ar,Cancel:cr,isAxiosError:lr,spread:ur,toFormData:fr,AxiosHeaders:dr,HttpStatusCode:hr,formToJSON:pr,getAdapter:mr,mergeConfig:gr}=b;class _n{constructor(t,r,n=1){this.db=null,this.dbName=t,this.storeName=r,this.version=n}open(){return new Promise((t,r)=>{if(this.db){t(this.db);return}const n=indexedDB.open(this.dbName,this.version);n.onupgradeneeded=o=>{const s=o.target.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=o=>{this.db=o.target.result,t(this.db)},n.onerror=o=>{console.error("IndexedDB 打开失败:",o.target.error),r(o.target.error)},n.onblocked=()=>{console.warn("数据库操作被阻塞,请关闭其他连接"),r(new Error("数据库操作被阻塞"))}})}close(){this.db&&(this.db.close(),this.db=null)}put(t){return new Promise((r,n)=>{if(!this.db){n(new Error("数据库未打开,请先调用 open() 方法"));return}const o=this.db.transaction(this.storeName,"readwrite"),i=o.objectStore(this.storeName).put(t);i.onsuccess=()=>{r(t)},i.onerror=()=>{console.error("数据存储失败:",i.error),n(i.error)},o.onerror=()=>{console.error("事务错误:",o.error),n(o.error)}})}update(t){return new Promise(async(r,n)=>{try{if(!await this.get(t.id)){n(new Error(`ID为 ${t.id} 的数据不存在,无法更新`));return}const s=await this.put(t);r(s)}catch(o){console.error("数据更新失败:",o),n(o)}})}partialUpdate(t,r){return new Promise(async(n,o)=>{try{const s=await this.get(t);if(!s){o(new Error(`ID为 ${t} 的数据不存在,无法更新`));return}const i={...s,...r,id:t},c=await this.put(i);n(c)}catch(s){console.error("数据部分更新失败:",s),o(s)}})}get(t){return new Promise((r,n)=>{if(!this.db){n(new Error("数据库未打开,请先调用 open() 方法"));return}const i=this.db.transaction(this.storeName,"readonly").objectStore(this.storeName).get(t);i.onsuccess=()=>{r(i.result)},i.onerror=()=>{console.error("数据读取失败:",i.error),n(i.error)}})}delete(t){return new Promise((r,n)=>{if(!this.db){n(new Error("数据库未打开,请先调用 open() 方法"));return}const i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);i.onsuccess=()=>{r()},i.onerror=()=>{console.error("数据删除失败:",i.error),n(i.error)}})}getAll(){return new Promise((t,r)=>{if(!this.db){r(new Error("数据库未打开,请先调用 open() 方法"));return}const s=this.db.transaction(this.storeName,"readonly").objectStore(this.storeName).getAll();s.onsuccess=()=>{t(s.result)},s.onerror=()=>{console.error("获取所有数据失败:",s.error),r(s.error)}})}clear(){return new Promise((t,r)=>{if(!this.db){r(new Error("数据库未打开,请先调用 open() 方法"));return}const s=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).clear();s.onsuccess=()=>{t()},s.onerror=()=>{console.error("清空存储失败:",s.error),r(s.error)}})}}class Fn{constructor(){}set(t,r,n){let o=null;if(typeof n=="number"&&n>0)o=Date.now()+n*1e3;else if(typeof n>"u"){const i=this.getRaw(t);o=i?i.expire:null}const s={value:r,expire:o};localStorage.setItem(t,JSON.stringify(s))}get(t){const r=this.getRaw(t);return r?r.expire&&Date.now()>r.expire?(this.remove(t),null):r.value:null}getRaw(t){try{const r=localStorage.getItem(t);if(!r)return null;const n=JSON.parse(r);return n&&typeof n=="object"&&"value"in n&&"expire"in n?n:{value:r,expire:null}}catch{return{value:localStorage.getItem(t),expire:null}}}remove(t){localStorage.removeItem(t)}clear(){localStorage.clear()}}function qn(){return typeof window<"u"&&"indexedDB"in window&&indexedDB!==null&&indexedDB!==void 0}class Un{constructor(){this.isInitialized=!1,this.indexedDBManager=new _n("qlfyCaLogin","loginData")}async ensureInitialized(){this.isInitialized||(await this.indexedDBManager.open(),this.isInitialized=!0)}async set(t,r){await this.ensureInitialized(),await this.indexedDBManager.put({id:t,data:r})}async get(t){await this.ensureInitialized();const r=await this.indexedDBManager.get(t);return r?r.data:null}async remove(t){await this.ensureInitialized(),await this.indexedDBManager.delete(t)}}class In{constructor(){this.localStorageManager=new Fn}set(t,r){this.localStorageManager.set(t,r)}get(t){return this.localStorageManager.get(t)}remove(t){this.localStorageManager.remove(t)}}function Mn(){return qn()?new Un:new In}let $="qlfyEcologicalLogin_";const be=Mn();async function j(e){$.indexOf(e.props.clientId)==-1&&($+=e.props.clientId);const t=be.set($,e);t instanceof Promise&&await t}async function Ee(){const e=be.remove($);e instanceof Promise&&await e}async function _(e){e&&$.indexOf(e)==-1&&($+=e);const t=be.get($),r=t instanceof Promise?await t:t;return r||{props:null,loginInfo:null,routerMode:vn(),isOutLogin:!1,token:"",refreshToken:"",tenant_id:168,userPermission:{}}}async function ot(e=!0,t,r){let n=await _();const o=n.props;if(o.openDebugger)debugger;if(!o||!o.isEnabled){console.error(new Error("统一登陆未开启,请检查配置"));return}const s=n.token;if(!s){console.error(new Error("未登陆或token失效"));return}b({method:"post",url:o.loginServiceBaseAddress+"/admin-api/system/auth/logout",headers:{"tenant-id":n.loginInfo.tenant_id,Authorization:"Bearer "+s}}).then(async i=>{i.data.code?r&&r(i):(e&&await F(),t&&t(i),await Ee(),await j(n))}).catch(i=>{console.log(i),r&&r(i)})}async function F(){const t=(await _()).props;if(!t||!t.isEnabled){console.error(new Error("统一登陆未开启,请检查配置"));return}const r=await zn();r&&setTimeout(()=>{window.open(r,"_self")}),await Ee()}async function st(){const e=await _(),t=e.props;return!t||!t.isEnabled?(console.error(new Error("统一登陆未开启,请检查配置")),""):e.token}async function $n(){return(await _()).loginInfo}async function jn(){let e=await _();const t=e.props;return!t||!t.isEnabled?(console.error(new Error("统一登陆未开启,请检查配置")),null):e.userPermission}async function Hn(){let e=await _();const t=e.props;return!t||!t.isEnabled?(console.error(new Error("统一登陆未开启,请检查配置")),null):e.refreshToken}async function zn(){const t=(await _()).props;if(!t||!t.isEnabled)return console.error(new Error("统一登陆未开启,请检查配置")),null;if(!t.clientId||!t.clientSecret)return console.error("未配置应用id或应用密钥!"),"";if(!t.loginPageBaseAddress)return console.error("未配置登录页基础地址!"),"";let r=await it(["token","refreshToken"],!1),n=t.redirectUrl||encodeURIComponent(r);return`${t.loginPageBaseAddress}/#/login?clientId=${t.clientId}&clientSecret=${t.clientSecret}&redirectUrl=${n}`}function vn(){if(window.location.href.includes("#")){const t=window.location.href.indexOf("#"),r=window.location.href.substring(t+1);if(r.startsWith("/")||r.includes("?"))return"hash"}return"history"}async function it(e,t=!1,r=window.location.href,n){if(n||(n=(await _()).routerMode),!["hash","history"].includes(n))throw new Error('路由模式必须是 "hash" 或 "history"');let o,s,i;if(n==="hash"){const c=r.indexOf("#");if(c===-1)return r;s=r.substring(0,c+1);const l=r.substring(c+1).split("?"),u=l[0],d=l[1]||"";i=new URLSearchParams(d),e.forEach(h=>{i.delete(h)});const y=i.toString(),E=y?`${u}?${y}`:u;o=`${s}${E}`}else{o=new URL(r);const c=o.pathname;e.forEach(l=>{o.searchParams.delete(l)});const f=o.searchParams.toString();o=f?`${c}?${f}`:c}return t&&history.replaceState({},"",o),o}function K(e){if(e===null)return null;if(typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);let t=new e.constructor;for(let r in e)e.hasOwnProperty(r)&&(t[r]=K(e[r]));return t}function Jn(e){if(!e)throw new Error("请传入有效的Vue Router实例");return(()=>{var n,o,s,i;if((n=e.options)!=null&&n.history){const c=e.options.history;if((c==null?void 0:c.type)==="hash"||((o=c==null?void 0:c.constructor)==null?void 0:o.name)==="HashHistory")return"hash"}if(typeof e.mode=="string")return e.mode;const r=e.history;if(r){const c=(s=r.constructor)==null?void 0:s.name;if(c!=null&&c.includes("Hash")||c!=null&&c.includes("hash"))return"hash"}return typeof window<"u"&&((i=window.location)!=null&&i.hash)&&window.location.hash!=="#"?"hash":""})().toLowerCase()==="hash"}const at=B.defineComponent({__name:"index",props:{clientId:{},clientSecret:{},loginPageBaseAddress:{},loginServiceBaseAddress:{},useRouter:{},forceMode:{type:Boolean,default:!0},clientName:{},token:{},isEnabled:{type:Boolean,default:!0},redirectPath:{default:""},tenantId:{default:168},showLog:{type:Boolean,default:!1},openDebugger:{type:Boolean,default:!1}},emits:["loggingIn","loginSuccess","loginFail","tokenRefresh"],setup(e,{expose:t,emit:r}){const n=e,o=n.useRouter,s=n.useRouter.currentRoute,i=r;let c=!0,f=null,l=null,u=!1,d=null;t({logout:async()=>await ot(),getToken:async()=>await st(),getLoginInfo:async()=>await $n(),goLogin:async()=>await F()}),o.beforeEach(async(w,R,A)=>{n.forceMode&&!u?(n.showLog&&console.log("【qlfyEcologicalLogin】【路由拦截中】等待登陆放行..."),d=K(w.query),(u||await S())&&(n.showLog&&console.log("【qlfyEcologicalLogin】【路由拦截中】登陆成功路由放行"),d=null,delete w.query.token,delete w.query.refreshToken,A(w))):A()}),B.onBeforeUnmount(()=>{}),B.watch(()=>s.value.path,(w,R)=>{f&&clearTimeout(f),B.nextTick(()=>{f=setTimeout(()=>{n.isEnabled&&y()},300)})},{deep:!0,immediate:!0}),B.watch(()=>n.isEnabled,w=>{setTimeout(async()=>{w&&y(),w||(await Ee(),f&&clearTimeout(f))})},{deep:!0});async function y(){if(n.openDebugger)debugger;n.isEnabled&&(l=await _(n.clientId),await T(),E())}async function E(){if(n.showLog&&console.log("【qlfyEcologicalLogin】登陆流程执行..."),n.token){n.showLog&&console.log("【qlfyEcologicalLogin】读取参数中的token"),l.isOutLogin=!0,l.token=n.token,await j(l),c&&i("loggingIn",l.token),m(n.token,c),c=!1;return}if((s.value.query.token||d!=null&&d.token)&&c){n.showLog&&console.log("【qlfyEcologicalLogin】读取链接中的token"),l.token=s.value.query.token||(d==null?void 0:d.token),l.refreshToken=s.value.query.refreshToken,await j(l),await O(),c&&i("loggingIn",l.token),m(l.token,c),c=!1;return}const w=l.token;if(w){n.showLog&&console.log("【qlfyEcologicalLogin】读取上一次缓存的token"),c&&i("loggingIn",w),m(w,c),c=!1;return}h()}async function h(){n.forceMode?await F():(i("loginFail",{msg:"未登陆",data:null}),u=!1)}function m(w,R){n.showLog&&console.log("【qlfyEcologicalLogin】尝试效验token");let A={token:w};const P={"tenant-id":n.tenantId,Authorization:"Basic "+btoa(n.clientId+":"+n.clientSecret)};b.post(n.loginServiceBaseAddress+"/admin-api/system/oauth2/check-token","",{params:A,headers:P}).then(async q=>{if(q.data.code!==0){if(n.showLog&&console.log("【qlfyEcologicalLogin】token无效, 无refreshToken"),n.forceMode)return await F();i("loginFail",{message:"token失效"}),u=!1;return}n.showLog&&console.log("【qlfyEcologicalLogin】token校验通过"),l.loginInfo=q.data.data,await j(l),R&&p(w)}).catch(async q=>{l.token="",await j(l),n.forceMode&&await F(),!n.forceMode&&(i("loginFail",{message:"token失效"}),u=!1)})}function p(w){n.showLog&&console.log("【qlfyEcologicalLogin】获取用户配置数据");let R={clientId:n.clientId};const A={"tenant-id":l.loginInfo.tenant_id,Authorization:w};b.get(n.loginServiceBaseAddress+"/admin-api/system/auth/get-permission-info",{params:R,headers:A}).then(async P=>{if(P.data.code!==0){if(n.showLog&&console.log("【qlfyEcologicalLogin】获取用户权限数据失败"),n.forceMode)return F();i("loginFail",{message:"用户配置获取失败"}),u=!1;return}n.showLog&&console.log("【qlfyEcologicalLogin】用户配置获取成功"),l.userPermission=P.data,await j(l),await O(),i("loginSuccess",K(l.userPermission)),u=!0}).catch(P=>{if(n.showLog&&console.log("【qlfyEcologicalLogin】用户配置数据获取失败"),n.forceMode)return F();i("loginFail",{message:"用户配置获取失败",data:P}),u=!1})}function S(){return new Promise((w,R)=>{let A=null;u?w(!0):A=setInterval(P=>{u&&(A&&clearInterval(A),w(!0))},50),setTimeout(()=>{A&&clearInterval(A),R(!1)},1e4)})}async function T(){const w={...n};delete w.useRouter,l.props=K(w),l.routerMode=Jn(o)?"hash":"history",await j(l)}async function O(){await it(["token","refreshToken"],!0);let w=K(s.value.query);delete w.token,delete w.refreshToken,o.currentRoute.value.query=w}return(w,R)=>null}}),Vn=at,Wn={install(e){e.component("qlfyEcologicalLogin",at)}};C.default=Wn,C.getRefreshToken=Hn,C.getToken=st,C.getUserPermission=jn,C.goLogin=F,C.logout=ot,C.qlfyEcologicalLogin=Vn,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
5
|
+
`):" "+Ze(s[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return n},adapters:ge};function we(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new z(null,e)}function et(e){return we(e),e.headers=C.from(e.headers),e.data=pe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ye.getAdapter(e.adapter||V.adapter)(e).then(function(n){return we(e),n.data=pe.call(e,e.transformResponse,n),n.headers=C.from(n.headers),n},function(n){return je(n)||(we(e),n&&n.response&&(n.response.data=pe.call(e,e.transformResponse,n.response),n.response.headers=C.from(n.response.headers))),Promise.reject(n)})}const tt="1.10.0",se={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{se[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nt={};se.transitional=function(t,r,n){function o(s,i){return"[Axios v"+tt+"] Transitional option '"+s+"'"+i+(n?". "+n:"")}return(s,i,c)=>{if(t===!1)throw new g(o(i," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!nt[i]&&(nt[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,i,c):!0}},se.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Dn(e,t,r){if(typeof e!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const c=e[s],f=c===void 0||i(c,s,e);if(f!==!0)throw new g("option "+s+" must be "+f,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+s,g.ERR_BAD_OPTION)}}const ie={assertOptions:Dn,validators:se},N=ie.validators;let M=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ue,response:new Ue}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
6
|
+
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=I(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&ie.assertOptions(n,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),o!=null&&(a.isFunction(o)?r.paramsSerializer={serialize:o}:ie.assertOptions(o,{encode:N.function,serialize:N.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),ie.assertOptions(r,{baseUrl:N.spelling("baseURL"),withXsrfToken:N.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&a.merge(s.common,s[r.method]);s&&a.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),r.headers=C.concat(i,s);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,d=0,y;if(!f){const h=[et.bind(this),void 0];for(h.unshift.apply(h,c),h.push.apply(h,l),y=h.length,u=Promise.resolve(r);d<y;)u=u.then(h[d++],h[d++]);return u}y=c.length;let E=r;for(d=0;d<y;){const h=c[d++],m=c[d++];try{E=h(E)}catch(p){m.call(this,p);break}}try{u=et.call(this,E)}catch(h){return Promise.reject(h)}for(d=0,y=l.length;d<y;)u=u.then(l[d++],l[d++]);return u}getUri(t){t=I(this.defaults,t);const r=Je(t.baseURL,t.url,t.allowAbsoluteUrls);return qe(r,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){M.prototype[t]=function(r,n){return this.request(I(n||{},{method:t,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function r(n){return function(s,i,c){return this.request(I(c||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}M.prototype[t]=r(),M.prototype[t+"Form"]=r(!0)});let Nn=class ut{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(c=>{n.subscribe(c),s=c}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},t(function(s,i,c){n.reason||(n.reason=new z(s,i,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new ut(function(o){t=o}),cancel:t}}};function Bn(e){return function(r){return e.apply(null,r)}}function _n(e){return a.isObject(e)&&e.isAxiosError===!0}const ye={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ye).forEach(([e,t])=>{ye[t]=e});function rt(e){const t=new M(e),r=Se(M.prototype.request,t);return a.extend(r,M.prototype,t,{allOwnKeys:!0}),a.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return rt(I(e,o))},r}const b=rt(V);b.Axios=M,b.CanceledError=z,b.CancelToken=Nn,b.isCancel=je,b.VERSION=tt,b.toFormData=ee,b.AxiosError=g,b.Cancel=b.CanceledError,b.all=function(t){return Promise.all(t)},b.spread=Bn,b.isAxiosError=_n,b.mergeConfig=I,b.AxiosHeaders=C,b.formToJSON=e=>Me(a.isHTMLForm(e)?new FormData(e):e),b.getAdapter=Ye.getAdapter,b.HttpStatusCode=ye,b.default=b;const{Axios:tr,AxiosError:nr,CanceledError:rr,isCancel:or,CancelToken:sr,VERSION:ir,all:ar,Cancel:cr,isAxiosError:lr,spread:ur,toFormData:fr,AxiosHeaders:dr,HttpStatusCode:hr,formToJSON:pr,getAdapter:mr,mergeConfig:gr}=b;class Fn{constructor(t,r,n=1){this.db=null,this.dbName=t,this.storeName=r,this.version=n}open(){return new Promise((t,r)=>{if(this.db){t(this.db);return}const n=indexedDB.open(this.dbName,this.version);n.onupgradeneeded=o=>{const s=o.target.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=o=>{this.db=o.target.result,t(this.db)},n.onerror=o=>{console.error("IndexedDB 打开失败:",o.target.error),r(o.target.error)},n.onblocked=()=>{console.warn("数据库操作被阻塞,请关闭其他连接"),r(new Error("数据库操作被阻塞"))}})}close(){this.db&&(this.db.close(),this.db=null)}put(t){return new Promise((r,n)=>{if(!this.db){n(new Error("数据库未打开,请先调用 open() 方法"));return}const o=this.db.transaction(this.storeName,"readwrite"),i=o.objectStore(this.storeName).put(t);i.onsuccess=()=>{r(t)},i.onerror=()=>{console.error("数据存储失败:",i.error),n(i.error)},o.onerror=()=>{console.error("事务错误:",o.error),n(o.error)}})}update(t){return new Promise(async(r,n)=>{try{if(!await this.get(t.id)){n(new Error(`ID为 ${t.id} 的数据不存在,无法更新`));return}const s=await this.put(t);r(s)}catch(o){console.error("数据更新失败:",o),n(o)}})}partialUpdate(t,r){return new Promise(async(n,o)=>{try{const s=await this.get(t);if(!s){o(new Error(`ID为 ${t} 的数据不存在,无法更新`));return}const i={...s,...r,id:t},c=await this.put(i);n(c)}catch(s){console.error("数据部分更新失败:",s),o(s)}})}get(t){return new Promise((r,n)=>{if(!this.db){n(new Error("数据库未打开,请先调用 open() 方法"));return}const i=this.db.transaction(this.storeName,"readonly").objectStore(this.storeName).get(t);i.onsuccess=()=>{r(i.result)},i.onerror=()=>{console.error("数据读取失败:",i.error),n(i.error)}})}delete(t){return new Promise((r,n)=>{if(!this.db){n(new Error("数据库未打开,请先调用 open() 方法"));return}const i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);i.onsuccess=()=>{r()},i.onerror=()=>{console.error("数据删除失败:",i.error),n(i.error)}})}getAll(){return new Promise((t,r)=>{if(!this.db){r(new Error("数据库未打开,请先调用 open() 方法"));return}const s=this.db.transaction(this.storeName,"readonly").objectStore(this.storeName).getAll();s.onsuccess=()=>{t(s.result)},s.onerror=()=>{console.error("获取所有数据失败:",s.error),r(s.error)}})}clear(){return new Promise((t,r)=>{if(!this.db){r(new Error("数据库未打开,请先调用 open() 方法"));return}const s=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).clear();s.onsuccess=()=>{t()},s.onerror=()=>{console.error("清空存储失败:",s.error),r(s.error)}})}}class qn{constructor(){}set(t,r,n){let o=null;if(typeof n=="number"&&n>0)o=Date.now()+n*1e3;else if(typeof n>"u"){const i=this.getRaw(t);o=i?i.expire:null}const s={value:r,expire:o};localStorage.setItem(t,JSON.stringify(s))}get(t){const r=this.getRaw(t);return r?r.expire&&Date.now()>r.expire?(this.remove(t),null):r.value:null}getRaw(t){try{const r=localStorage.getItem(t);if(!r)return null;const n=JSON.parse(r);return n&&typeof n=="object"&&"value"in n&&"expire"in n?n:{value:r,expire:null}}catch{return{value:localStorage.getItem(t),expire:null}}}remove(t){localStorage.removeItem(t)}clear(){localStorage.clear()}}function Un(){return typeof window<"u"&&"indexedDB"in window&&indexedDB!==null&&indexedDB!==void 0}class In{constructor(){this.isInitialized=!1,this.indexedDBManager=new Fn("qlfyEcologicalLogin","loginData")}async ensureInitialized(){this.isInitialized||(await this.indexedDBManager.open(),this.isInitialized=!0)}async set(t,r){await this.ensureInitialized(),await this.indexedDBManager.put({id:t,data:r})}async get(t){await this.ensureInitialized();const r=await this.indexedDBManager.get(t);return r?r.data:null}async remove(t){await this.ensureInitialized(),await this.indexedDBManager.delete(t)}}class Mn{constructor(){this.localStorageManager=new qn}set(t,r){this.localStorageManager.set(t,r)}get(t){return this.localStorageManager.get(t)}remove(t){this.localStorageManager.remove(t)}}function $n(){return Un()?new In:new Mn}let $="qlfyEcologicalLogin_";const be=$n();async function j(e){$.indexOf(e.props.clientId)==-1&&($+=e.props.clientId);const t=be.set($,e);t instanceof Promise&&await t}async function Ee(){const e=be.remove($);e instanceof Promise&&await e}async function _(e){e&&$.indexOf(e)==-1&&($+=e);const t=be.get($),r=t instanceof Promise?await t:t;return r||{props:null,loginInfo:null,routerMode:vn(),isOutLogin:!1,token:"",refreshToken:"",tenant_id:168,userPermission:{}}}async function ot(e=!0,t,r){let n=await _();const o=n.props;if(o.openDebugger)debugger;if(!o||!o.isEnabled){console.error(new Error("统一登陆未开启,请检查配置"));return}const s=n.token;if(!s){console.error(new Error("未登陆或token失效"));return}b({method:"post",url:o.loginServiceBaseAddress+"/admin-api/system/auth/logout",headers:{"tenant-id":n.loginInfo.tenant_id,Authorization:"Bearer "+s}}).then(async i=>{i.data.code?r&&r(i):(e&&await F(),t&&t(i),await Ee(),await j(n))}).catch(i=>{console.log(i),r&&r(i)})}async function F(){const t=(await _()).props;if(!t||!t.isEnabled){console.error(new Error("统一登陆未开启,请检查配置"));return}const r=await zn();r&&setTimeout(()=>{window.open(r,"_self")}),await Ee()}async function st(){const e=await _(),t=e.props;return!t||!t.isEnabled?(console.error(new Error("统一登陆未开启,请检查配置")),""):e.token}async function it(){const e=await _(),t=e.props;return!t||!t.isEnabled?(console.error(new Error("统一登陆未开启,请检查配置")),null):e.loginInfo}async function jn(){let e=await _();const t=e.props;return!t||!t.isEnabled?(console.error(new Error("统一登陆未开启,请检查配置")),null):e.userPermission}async function Hn(){let e=await _();const t=e.props;return!t||!t.isEnabled?(console.error(new Error("统一登陆未开启,请检查配置")),null):e.refreshToken}async function zn(){const t=(await _()).props;if(!t||!t.isEnabled)return console.error(new Error("统一登陆未开启,请检查配置")),null;if(!t.clientId||!t.clientSecret)return console.error("未配置应用id或应用密钥!"),"";if(!t.loginPageBaseAddress)return console.error("未配置登录页基础地址!"),"";let r=await at(["token","refreshToken"],!1),n=t.redirectUrl||encodeURIComponent(r);return`${t.loginPageBaseAddress}/#/login?clientId=${t.clientId}&clientSecret=${t.clientSecret}&redirectUrl=${n}`}function vn(){if(window.location.href.includes("#")){const t=window.location.href.indexOf("#"),r=window.location.href.substring(t+1);if(r.startsWith("/")||r.includes("?"))return"hash"}return"history"}async function at(e,t=!1,r=window.location.href,n){if(n||(n=(await _()).routerMode),!["hash","history"].includes(n))throw new Error('路由模式必须是 "hash" 或 "history"');let o,s,i;if(n==="hash"){const c=r.indexOf("#");if(c===-1)return r;s=r.substring(0,c+1);const l=r.substring(c+1).split("?"),u=l[0],d=l[1]||"";i=new URLSearchParams(d),e.forEach(h=>{i.delete(h)});const y=i.toString(),E=y?`${u}?${y}`:u;o=`${s}${E}`}else{o=new URL(r),e.forEach(f=>{o.searchParams.delete(f)});const c=o.searchParams.toString();o=c?`${o.href}?${c}`:o.href}return t&&history.replaceState({},"",o),o}function K(e){if(e===null)return null;if(typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);let t=new e.constructor;for(let r in e)e.hasOwnProperty(r)&&(t[r]=K(e[r]));return t}function Jn(e){if(!e)throw new Error("请传入有效的Vue Router实例");return(()=>{var n,o,s,i;if((n=e.options)!=null&&n.history){const c=e.options.history;if((c==null?void 0:c.type)==="hash"||((o=c==null?void 0:c.constructor)==null?void 0:o.name)==="HashHistory")return"hash"}if(typeof e.mode=="string")return e.mode;const r=e.history;if(r){const c=(s=r.constructor)==null?void 0:s.name;if(c!=null&&c.includes("Hash")||c!=null&&c.includes("hash"))return"hash"}return typeof window<"u"&&((i=window.location)!=null&&i.hash)&&window.location.hash!=="#"?"hash":""})().toLowerCase()==="hash"}const ct=B.defineComponent({__name:"index",props:{clientId:{},clientSecret:{},loginPageBaseAddress:{},loginServiceBaseAddress:{},useRouter:{},forceMode:{type:Boolean,default:!0},clientName:{},token:{},isEnabled:{type:Boolean,default:!0},redirectPath:{default:""},tenantId:{default:168},showLog:{type:Boolean,default:!1},openDebugger:{type:Boolean,default:!1}},emits:["loggingIn","loginSuccess","loginFail","tokenRefresh"],setup(e,{expose:t,emit:r}){const n=e,o=n.useRouter,s=n.useRouter.currentRoute,i=r;let c=!0,f=null,l=null,u=!1,d=null;t({logout:async()=>await ot(),getToken:async()=>await st(),getLoginInfo:async()=>await it(),goLogin:async()=>await F()}),o.beforeEach(async(w,R,A)=>{n.forceMode&&!u?(n.showLog&&console.log("【qlfyEcologicalLogin】【路由拦截中】等待登陆放行..."),d=K(w.query),(u||await S())&&(n.showLog&&console.log("【qlfyEcologicalLogin】【路由拦截中】登陆成功路由放行"),d=null,delete w.query.token,delete w.query.refreshToken,A(w))):A()}),B.onBeforeUnmount(()=>{}),B.watch(()=>s.value.path,(w,R)=>{f&&clearTimeout(f),B.nextTick(()=>{f=setTimeout(()=>{n.isEnabled&&y()},300)})},{deep:!0,immediate:!0}),B.watch(()=>n.isEnabled,w=>{setTimeout(async()=>{w&&y(),w||(await Ee(),f&&clearTimeout(f))})},{deep:!0});async function y(){if(n.openDebugger)debugger;n.isEnabled&&(l=await _(n.clientId),await T(),E())}async function E(){if(n.showLog&&console.log("【qlfyEcologicalLogin】登陆流程执行..."),n.token){n.showLog&&console.log("【qlfyEcologicalLogin】读取参数中的token"),l.isOutLogin=!0,l.token=n.token,await j(l),c&&i("loggingIn",l.token),m(n.token,c),c=!1;return}if((s.value.query.token||d!=null&&d.token)&&c){n.showLog&&console.log("【qlfyEcologicalLogin】读取链接中的token"),l.token=s.value.query.token||(d==null?void 0:d.token),l.refreshToken=s.value.query.refreshToken,await j(l),await O(),c&&i("loggingIn",l.token),m(l.token,c),c=!1;return}const w=l.token;if(w){n.showLog&&console.log("【qlfyEcologicalLogin】读取上一次缓存的token"),c&&i("loggingIn",w),m(w,c),c=!1;return}h()}async function h(){n.forceMode?await F():(i("loginFail",{msg:"未登陆",data:null}),u=!1)}function m(w,R){n.showLog&&console.log("【qlfyEcologicalLogin】尝试效验token");let A={token:w};const L={"tenant-id":n.tenantId,Authorization:"Basic "+btoa(n.clientId+":"+n.clientSecret)};b.post(n.loginServiceBaseAddress+"/admin-api/system/oauth2/check-token","",{params:A,headers:L}).then(async q=>{if(q.data.code!==0){if(n.showLog&&console.log("【qlfyEcologicalLogin】token无效, 无refreshToken"),n.forceMode)return await F();i("loginFail",{message:"token失效"}),u=!1;return}n.showLog&&console.log("【qlfyEcologicalLogin】token校验通过"),l.loginInfo=q.data.data,await j(l),R&&p(w)}).catch(async q=>{l.token="",await j(l),n.forceMode&&await F(),!n.forceMode&&(i("loginFail",{message:"token失效"}),u=!1)})}function p(w){n.showLog&&console.log("【qlfyEcologicalLogin】获取用户配置数据");let R={clientId:n.clientId};const A={"tenant-id":l.loginInfo.tenant_id,Authorization:w};b.get(n.loginServiceBaseAddress+"/admin-api/system/auth/get-permission-info",{params:R,headers:A}).then(async L=>{if(L.data.code!==0){if(n.showLog&&console.log("【qlfyEcologicalLogin】获取用户权限数据失败"),n.forceMode)return F();i("loginFail",{message:"用户配置获取失败"}),u=!1;return}n.showLog&&console.log("【qlfyEcologicalLogin】用户配置获取成功"),l.userPermission=L.data,await j(l),await O(),i("loginSuccess",K(l.userPermission)),u=!0}).catch(L=>{if(n.showLog&&console.log("【qlfyEcologicalLogin】用户配置数据获取失败"),n.forceMode)return F();i("loginFail",{message:"用户配置获取失败",data:L}),u=!1})}function S(){return new Promise((w,R)=>{let A=null;u?w(!0):A=setInterval(L=>{u&&(A&&clearInterval(A),w(!0))},50),setTimeout(()=>{A&&clearInterval(A),R(!1)},1e4)})}async function T(){const w={...n};delete w.useRouter,l.props=K(w),l.routerMode=Jn(o)?"hash":"history",await j(l)}async function O(){await at(["token","refreshToken"],!0);let w=K(s.value.query);delete w.token,delete w.refreshToken,o.currentRoute.value.query=w}return(w,R)=>null}}),Vn=ct,Wn={install(e){e.component("qlfyEcologicalLogin",ct)}};P.default=Wn,P.getLoginInfo=it,P.getRefreshToken=Hn,P.getToken=st,P.getUserPermission=jn,P.goLogin=F,P.logout=ot,P.qlfyEcologicalLogin=Vn,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/lib/index.umd.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default class LocalStorageManager {
|
|
2
|
-
/**
|
|
3
|
-
* 设置存储项
|
|
4
|
-
* @param {string} key - 存储键名
|
|
5
|
-
* @param {*} value - 存储值
|
|
6
|
-
* @param {number} [seconds] - 有效期(秒)
|
|
7
|
-
*/
|
|
8
|
-
set(key: string, value: any, seconds?: number | undefined): void;
|
|
9
|
-
/**
|
|
10
|
-
* 获取存储项
|
|
11
|
-
* @param {string} key - 要获取的键名
|
|
12
|
-
* @returns {*|null} 存储值或null
|
|
13
|
-
*/
|
|
14
|
-
get(key: string): any;
|
|
15
|
-
/**
|
|
16
|
-
* 获取原始存储数据(内部方法)
|
|
17
|
-
* @param {string} key - 要获取的键名
|
|
18
|
-
* @returns {Object|null} 包含值和过期时间的对象或null
|
|
19
|
-
*/
|
|
20
|
-
getRaw(key: string): any;
|
|
21
|
-
/**
|
|
22
|
-
* 删除指定存储项
|
|
23
|
-
* @param {string} key - 要删除的键名
|
|
24
|
-
*/
|
|
25
|
-
remove(key: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* 清空所有存储项
|
|
28
|
-
*/
|
|
29
|
-
clear(): void;
|
|
30
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { DialogProps } from 'element-plus';
|
|
2
|
-
/** 响应式数据对象 */
|
|
3
|
-
export declare class Data {
|
|
4
|
-
}
|
|
5
|
-
export interface Prop {
|
|
6
|
-
/** 应用id,平台提供*/
|
|
7
|
-
clientId: string;
|
|
8
|
-
/** 应用秘钥,平台提供*/
|
|
9
|
-
clientSecret: string;
|
|
10
|
-
/** 统一登陆页面的ip地址 */
|
|
11
|
-
loginPageBaseAddress: string;
|
|
12
|
-
/** 登陆服务的ip地址 */
|
|
13
|
-
loginServiceBaseAddress: string;
|
|
14
|
-
/** 路由对象 */
|
|
15
|
-
useRouter: any;
|
|
16
|
-
/** 强制登陆模式 */
|
|
17
|
-
forceMode?: boolean;
|
|
18
|
-
/** 传入token则使用外部token */
|
|
19
|
-
token?: string;
|
|
20
|
-
/** 是否启用组件,支持动态控制,非必填*/
|
|
21
|
-
isEnabled?: boolean;
|
|
22
|
-
/** 是否实时监听token状态,非必填*/
|
|
23
|
-
listenToken?: boolean;
|
|
24
|
-
/** 认证成功后的,非必填*/
|
|
25
|
-
redirectPath?: string;
|
|
26
|
-
/** local中保存token值的键名称,非必填*/
|
|
27
|
-
tokenName?: string;
|
|
28
|
-
/** token有效期,单位秒,非必填*/
|
|
29
|
-
tokenValidity?: number;
|
|
30
|
-
/** 租户id */
|
|
31
|
-
tenantId?: number | string;
|
|
32
|
-
/** 修改密码弹窗自定义设置 */
|
|
33
|
-
dialogConfig?: Partial<DialogProps>;
|
|
34
|
-
}
|
|
35
|
-
export interface Emits {
|
|
36
|
-
(e: 'loggingIn', token: string): void;
|
|
37
|
-
(e: 'loginFail', failInfo: any): void;
|
|
38
|
-
(e: 'loginSuccess', loginInfo: {
|
|
39
|
-
[x: string]: any;
|
|
40
|
-
}): void;
|
|
41
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/** 退出登陆方法 */
|
|
2
|
-
export declare function logout(isGoLog?: boolean, success?: (res: any) => void, error?: (err: any) => void): void;
|
|
3
|
-
/** 获取统一登陆token */
|
|
4
|
-
export declare function getToken(): any;
|
|
5
|
-
/** 获取统一登陆token */
|
|
6
|
-
export declare function getRefreshToken(): string;
|
|
7
|
-
/** 方法 -- 跳转至登陆页 */
|
|
8
|
-
export declare function goLogin(): void;
|
|
9
|
-
/**
|
|
10
|
-
* @description 获取跳转至登录页的链接
|
|
11
|
-
* @param {string} loginPageBaseAddress 登录页ip地址
|
|
12
|
-
* @param {string} clientId 应用id
|
|
13
|
-
* @param {string} clientSecret 应用密钥
|
|
14
|
-
* @param {string} redirectUrl 重定向地址
|
|
15
|
-
* @returns {string}
|
|
16
|
-
*/
|
|
17
|
-
export declare function getLoginUrl(loginPageBaseAddress: string, clientId: string, clientSecret: string, redirectUrl?: string): string;
|
|
18
|
-
export declare function generateUUID(): string;
|
|
19
|
-
export declare function getUserPermission(): any;
|
|
20
|
-
/** ----------------------- 登陆数据操作 ---------------------- */
|
|
21
|
-
interface LoginInfo {
|
|
22
|
-
tenantId: string | number;
|
|
23
|
-
refreshToken?: string;
|
|
24
|
-
userPermission: any;
|
|
25
|
-
props: any;
|
|
26
|
-
routerMode: string;
|
|
27
|
-
}
|
|
28
|
-
/** 登陆数据存储 */
|
|
29
|
-
export declare function setLoginInfo(dataInfo: LoginInfo): void;
|
|
30
|
-
/** 登陆数据删除 */
|
|
31
|
-
export declare function removeLoginInfo(): void;
|
|
32
|
-
/** 登陆数据数据 */
|
|
33
|
-
export declare function getLoginInfo(): LoginInfo;
|
|
34
|
-
/** 清除本组件所有缓存数据 */
|
|
35
|
-
export declare function clearLoginData(): void;
|
|
36
|
-
/** ----------------------- 密码修改 ---------------------- */
|
|
37
|
-
export declare function changePassword(newPassword: string, oldPassword: string): Promise<any>;
|
|
38
|
-
/**
|
|
39
|
-
* 移除URL中指定的参数,不刷新页面
|
|
40
|
-
* @param {string} routerMode - 路由模式,'hash' 或 'history'
|
|
41
|
-
* @param {string[]} paramsToRemove - 需要移除的参数名称数组
|
|
42
|
-
*/
|
|
43
|
-
/** 检测当前路由模式 */
|
|
44
|
-
export declare function detectRouterMode(): 'hash' | 'history';
|
|
45
|
-
export declare function removeUrlParams(paramsToRemove: string[], routerMode?: string): void;
|
|
46
|
-
export {};
|