@das-fed/utils 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/api-services/index.d.ts +1 -0
  2. package/api-services/index.js +3 -19845
  3. package/api-services/modules/app-manage.d.ts +2 -0
  4. package/api-services/modules/app-manage.js +5 -6
  5. package/api-services/modules/authentication.d.ts +2 -0
  6. package/api-services/modules/authentication.js +5 -6
  7. package/api-services/modules/bems.d.ts +6 -0
  8. package/api-services/modules/bems.js +8 -10
  9. package/api-services/modules/contract.d.ts +2 -0
  10. package/api-services/modules/contract.js +5 -6
  11. package/api-services/modules/duty-manage.d.ts +7 -0
  12. package/api-services/modules/duty-manage.js +9 -10
  13. package/api-services/modules/enterpriseright.d.ts +2 -0
  14. package/api-services/modules/enterpriseright.js +5 -6
  15. package/api-services/modules/file.d.ts +36 -0
  16. package/api-services/modules/file.js +449 -354
  17. package/api-services/modules/gateway-edge.d.ts +2 -0
  18. package/api-services/modules/gateway-edge.js +5 -6
  19. package/api-services/modules/index.d.ts +21 -0
  20. package/api-services/modules/index.js +501 -435
  21. package/api-services/modules/iot.d.ts +15 -0
  22. package/api-services/modules/iot.js +17 -18
  23. package/api-services/modules/justauth.d.ts +3 -0
  24. package/api-services/modules/justauth.js +6 -7
  25. package/api-services/modules/knowledge.d.ts +2 -0
  26. package/api-services/modules/knowledge.js +5 -6
  27. package/api-services/modules/link.d.ts +2 -0
  28. package/api-services/modules/link.js +5 -6
  29. package/api-services/modules/permission.d.ts +2 -0
  30. package/api-services/modules/permission.js +5 -6
  31. package/api-services/modules/platformManage.d.ts +14 -0
  32. package/api-services/modules/platformManage.js +12 -13
  33. package/api-services/modules/portal.d.ts +2 -0
  34. package/api-services/modules/portal.js +5 -6
  35. package/api-services/modules/space-manage.d.ts +2 -0
  36. package/api-services/modules/space-manage.js +5 -6
  37. package/api-services/modules/super-admin.d.ts +8 -0
  38. package/api-services/modules/super-admin.js +8 -9
  39. package/api-services/modules/supplier.d.ts +6 -0
  40. package/api-services/modules/supplier.js +7 -8
  41. package/api-services/modules/supplychain-manage.d.ts +2 -0
  42. package/api-services/modules/supplychain-manage.js +5 -6
  43. package/api-services/modules/systemConfiguration.d.ts +2 -0
  44. package/api-services/modules/systemConfiguration.js +5 -6
  45. package/api-services/modules/tool.d.ts +2 -0
  46. package/api-services/modules/tool.js +5 -6
  47. package/api-services/src/create-service.d.ts +2 -0
  48. package/api-services/src/create-service.js +3119 -19726
  49. package/api-services/src/sso.d.ts +29 -0
  50. package/api-services/src/sso.js +1547 -156
  51. package/api-services/src/util.d.ts +1 -0
  52. package/api-services/src/util.js +1462 -19
  53. package/atob/index.d.ts +2 -0
  54. package/atob/index.js +9 -10
  55. package/common-info/getIframeUrl.d.ts +9 -0
  56. package/common-info/getIframeUrl.js +9 -11
  57. package/common-info/index.d.ts +42 -0
  58. package/common-info/index.js +138 -272
  59. package/common-info/setInfoFromUrl.d.ts +8 -0
  60. package/common-info/setInfoFromUrl.js +60 -128
  61. package/common-tools/arr-tools.d.ts +15 -0
  62. package/common-tools/arr-tools.js +6 -13
  63. package/common-tools/date-format.d.ts +7 -0
  64. package/common-tools/date-format.js +18 -21
  65. package/common-tools/get-url-params.d.ts +33 -0
  66. package/common-tools/get-url-params.js +48 -88
  67. package/common-tools/handle-data.d.ts +6 -0
  68. package/common-tools/handle-data.js +3 -4
  69. package/common-tools/index.d.ts +7 -0
  70. package/common-tools/index.js +7 -213
  71. package/common-tools/nest-tree-format.d.ts +30 -0
  72. package/common-tools/nest-tree-format.js +22 -49
  73. package/common-tools/obj-tools.d.ts +7 -0
  74. package/common-tools/obj-tools.js +17 -18
  75. package/common-tools/setHtmlMinWH.d.ts +5 -0
  76. package/common-tools/setHtmlMinWH.js +6 -10
  77. package/common-tools/throttled.d.ts +7 -0
  78. package/common-tools/throttled.js +7 -16
  79. package/config/index.d.ts +2 -0
  80. package/config/index.js +8 -25
  81. package/curring-http/index.d.ts +11 -0
  82. package/curring-http/index.js +5150 -17289
  83. package/directive/auth.d.ts +8 -0
  84. package/directive/auth.js +54 -104
  85. package/directive/clickOutside.d.ts +5 -0
  86. package/directive/clickOutside.js +23 -49
  87. package/directive/hoverInside.d.ts +5 -0
  88. package/directive/hoverInside.js +16 -35
  89. package/directive/index.d.ts +3 -0
  90. package/directive/index.js +7 -182
  91. package/directive/utils.d.ts +7 -0
  92. package/directive/utils.js +6 -11
  93. package/dom-check-in/index.d.ts +6 -0
  94. package/dom-check-in/index.js +7 -15
  95. package/dom-watcher/index.d.ts +25 -0
  96. package/dom-watcher/index.js +7 -8
  97. package/hooks/popup-manager/use-zindex.d.ts +5 -0
  98. package/hooks/popup-manager/use-zindex.js +17 -36
  99. package/index.d.ts +2 -0
  100. package/index.js +2 -215
  101. package/load-js/index.d.ts +3 -0
  102. package/load-js/index.js +10 -20
  103. package/oss/index.d.ts +2 -0
  104. package/oss/index.js +11 -15
  105. package/package.json +8 -13
  106. package/pinyin-first-character/index.d.ts +2 -0
  107. package/pinyin-first-character/index.js +25011 -12217
  108. package/process-engine-info/index.d.ts +10 -0
  109. package/process-engine-info/index.js +8 -10
  110. package/pure-image-src/index.d.ts +2 -0
  111. package/pure-image-src/index.js +3 -29
  112. package/set-personal-info/index.d.ts +5 -0
  113. package/set-personal-info/index.js +1460 -16
  114. package/size-watcher/index.d.ts +6 -0
  115. package/size-watcher/index.js +17 -24
  116. package/style/index.d.ts +2 -0
  117. package/style/index.js +62 -103
  118. package/style/math.d.ts +9 -0
  119. package/style/math.js +16 -31
  120. package/style/style.d.ts +30 -0
  121. package/style/style.js +49 -72
  122. package/token-tools/index.d.ts +18 -0
  123. package/token-tools/index.js +72 -149
  124. package/vue/hooks/use-model-value.d.ts +3 -0
  125. package/vue/hooks/use-model-value.js +9 -10
  126. package/vue/index.d.ts +1 -0
  127. package/vue/index.js +3 -10
  128. package/webSocket-service/index.d.ts +40 -0
  129. package/webSocket-service/index.js +62 -138
  130. package/with-install/index.d.ts +10 -0
  131. package/with-install/index.js +5 -7
@@ -1,200 +1,1591 @@
1
- import axios from 'axios';
2
- import { ref, watch } from 'vue';
3
- import { encryption } from '@das-fed/utils/atob';
4
- import { getConfig } from '@das-fed/utils/config';
5
- import { getUrlParams, funcUrlDel } from '@das-fed/utils/common-tools';
6
- import { setAccessToken, getAccessToken, removeAccessToken } from '@das-fed/utils/token-tools';
7
- import { setProcessEngineToken } from '@das-fed/utils/process-engine-info';
8
- import { setPersonalInfo } from '@das-fed/utils/set-personal-info';
9
-
10
- const getQuery = (name) => new URL(location.href).searchParams.get(name);
11
- const apis = {
1
+ import { ref as We, watch as Ge } from "vue";
2
+ import { encryption as Xe } from "@das-fed/utils/atob";
3
+ import { getConfig as ne } from "@das-fed/utils/config";
4
+ import { getUrlParams as Qe, funcUrlDel as Ze } from "@das-fed/utils/common-tools";
5
+ import { setAccessToken as Oe, getAccessToken as fe, removeAccessToken as Ye } from "@das-fed/utils/token-tools";
6
+ import { setProcessEngineToken as et } from "@das-fed/utils/process-engine-info";
7
+ import { setPersonalInfo as Ae } from "@das-fed/utils/set-personal-info";
8
+ function ke(e, t) {
9
+ return function() {
10
+ return e.apply(t, arguments);
11
+ };
12
+ }
13
+ const { toString: tt } = Object.prototype, { getPrototypeOf: re } = Object, M = /* @__PURE__ */ ((e) => (t) => {
14
+ const n = tt.call(t);
15
+ return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
16
+ })(/* @__PURE__ */ Object.create(null)), T = (e) => (e = e.toLowerCase(), (t) => M(t) === e), z = (e) => (t) => typeof t === e, { isArray: P } = Array, U = z("undefined");
17
+ function nt(e) {
18
+ return e !== null && !U(e) && e.constructor !== null && !U(e.constructor) && g(e.constructor.isBuffer) && e.constructor.isBuffer(e);
19
+ }
20
+ const _e = T("ArrayBuffer");
21
+ function rt(e) {
22
+ let t;
23
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && _e(e.buffer), t;
24
+ }
25
+ const st = z("string"), g = z("function"), xe = z("number"), J = (e) => e !== null && typeof e == "object", ot = (e) => e === !0 || e === !1, B = (e) => {
26
+ if (M(e) !== "object")
27
+ return !1;
28
+ const t = re(e);
29
+ return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
30
+ }, it = T("Date"), at = T("File"), ct = T("Blob"), ut = T("FileList"), lt = (e) => J(e) && g(e.pipe), ft = (e) => {
31
+ let t;
32
+ return e && (typeof FormData == "function" && e instanceof FormData || g(e.append) && ((t = M(e)) === "formdata" || // detect form-data instance
33
+ t === "object" && g(e.toString) && e.toString() === "[object FormData]"));
34
+ }, dt = T("URLSearchParams"), pt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
35
+ function L(e, t, { allOwnKeys: n = !1 } = {}) {
36
+ if (e === null || typeof e > "u")
37
+ return;
38
+ let r, s;
39
+ if (typeof e != "object" && (e = [e]), P(e))
40
+ for (r = 0, s = e.length; r < s; r++)
41
+ t.call(null, e[r], r, e);
42
+ else {
43
+ const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = o.length;
44
+ let c;
45
+ for (r = 0; r < i; r++)
46
+ c = o[r], t.call(null, e[c], c, e);
47
+ }
48
+ }
49
+ function Ne(e, t) {
50
+ t = t.toLowerCase();
51
+ const n = Object.keys(e);
52
+ let r = n.length, s;
53
+ for (; r-- > 0; )
54
+ if (s = n[r], t === s.toLowerCase())
55
+ return s;
56
+ return null;
57
+ }
58
+ const Pe = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Ce = (e) => !U(e) && e !== Pe;
59
+ function X() {
60
+ const { caseless: e } = Ce(this) && this || {}, t = {}, n = (r, s) => {
61
+ const o = e && Ne(t, s) || s;
62
+ B(t[o]) && B(r) ? t[o] = X(t[o], r) : B(r) ? t[o] = X({}, r) : P(r) ? t[o] = r.slice() : t[o] = r;
63
+ };
64
+ for (let r = 0, s = arguments.length; r < s; r++)
65
+ arguments[r] && L(arguments[r], n);
66
+ return t;
67
+ }
68
+ const ht = (e, t, n, { allOwnKeys: r } = {}) => (L(t, (s, o) => {
69
+ n && g(s) ? e[o] = ke(s, n) : e[o] = s;
70
+ }, { allOwnKeys: r }), e), mt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), yt = (e, t, n, r) => {
71
+ e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
72
+ value: t.prototype
73
+ }), n && Object.assign(e.prototype, n);
74
+ }, wt = (e, t, n, r) => {
75
+ let s, o, i;
76
+ const c = {};
77
+ if (t = t || {}, e == null)
78
+ return t;
79
+ do {
80
+ for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
81
+ i = s[o], (!r || r(i, e, t)) && !c[i] && (t[i] = e[i], c[i] = !0);
82
+ e = n !== !1 && re(e);
83
+ } while (e && (!n || n(e, t)) && e !== Object.prototype);
84
+ return t;
85
+ }, Et = (e, t, n) => {
86
+ e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
87
+ const r = e.indexOf(t, n);
88
+ return r !== -1 && r === n;
89
+ }, St = (e) => {
90
+ if (!e)
91
+ return null;
92
+ if (P(e))
93
+ return e;
94
+ let t = e.length;
95
+ if (!xe(t))
96
+ return null;
97
+ const n = new Array(t);
98
+ for (; t-- > 0; )
99
+ n[t] = e[t];
100
+ return n;
101
+ }, bt = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && re(Uint8Array)), gt = (e, t) => {
102
+ const r = (e && e[Symbol.iterator]).call(e);
103
+ let s;
104
+ for (; (s = r.next()) && !s.done; ) {
105
+ const o = s.value;
106
+ t.call(e, o[0], o[1]);
107
+ }
108
+ }, Rt = (e, t) => {
109
+ let n;
110
+ const r = [];
111
+ for (; (n = e.exec(t)) !== null; )
112
+ r.push(n);
113
+ return r;
114
+ }, Tt = T("HTMLFormElement"), Ot = (e) => e.toLowerCase().replace(
115
+ /[-_\s]([a-z\d])(\w*)/g,
116
+ function(n, r, s) {
117
+ return r.toUpperCase() + s;
118
+ }
119
+ ), de = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), At = T("RegExp"), Ue = (e, t) => {
120
+ const n = Object.getOwnPropertyDescriptors(e), r = {};
121
+ L(n, (s, o) => {
122
+ let i;
123
+ (i = t(s, o, e)) !== !1 && (r[o] = i || s);
124
+ }), Object.defineProperties(e, r);
125
+ }, kt = (e) => {
126
+ Ue(e, (t, n) => {
127
+ if (g(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
128
+ return !1;
129
+ const r = e[n];
130
+ if (g(r)) {
131
+ if (t.enumerable = !1, "writable" in t) {
132
+ t.writable = !1;
133
+ return;
134
+ }
135
+ t.set || (t.set = () => {
136
+ throw Error("Can not rewrite read-only method '" + n + "'");
137
+ });
138
+ }
139
+ });
140
+ }, _t = (e, t) => {
141
+ const n = {}, r = (s) => {
142
+ s.forEach((o) => {
143
+ n[o] = !0;
144
+ });
145
+ };
146
+ return P(e) ? r(e) : r(String(e).split(t)), n;
147
+ }, xt = () => {
148
+ }, Nt = (e, t) => (e = +e, Number.isFinite(e) ? e : t), V = "abcdefghijklmnopqrstuvwxyz", pe = "0123456789", Fe = {
149
+ DIGIT: pe,
150
+ ALPHA: V,
151
+ ALPHA_DIGIT: V + V.toUpperCase() + pe
152
+ }, Pt = (e = 16, t = Fe.ALPHA_DIGIT) => {
153
+ let n = "";
154
+ const { length: r } = t;
155
+ for (; e--; )
156
+ n += t[Math.random() * r | 0];
157
+ return n;
158
+ };
159
+ function Ct(e) {
160
+ return !!(e && g(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
161
+ }
162
+ const Ut = (e) => {
163
+ const t = new Array(10), n = (r, s) => {
164
+ if (J(r)) {
165
+ if (t.indexOf(r) >= 0)
166
+ return;
167
+ if (!("toJSON" in r)) {
168
+ t[s] = r;
169
+ const o = P(r) ? [] : {};
170
+ return L(r, (i, c) => {
171
+ const f = n(i, s + 1);
172
+ !U(f) && (o[c] = f);
173
+ }), t[s] = void 0, o;
174
+ }
175
+ }
176
+ return r;
177
+ };
178
+ return n(e, 0);
179
+ }, Ft = T("AsyncFunction"), Lt = (e) => e && (J(e) || g(e)) && g(e.then) && g(e.catch), a = {
180
+ isArray: P,
181
+ isArrayBuffer: _e,
182
+ isBuffer: nt,
183
+ isFormData: ft,
184
+ isArrayBufferView: rt,
185
+ isString: st,
186
+ isNumber: xe,
187
+ isBoolean: ot,
188
+ isObject: J,
189
+ isPlainObject: B,
190
+ isUndefined: U,
191
+ isDate: it,
192
+ isFile: at,
193
+ isBlob: ct,
194
+ isRegExp: At,
195
+ isFunction: g,
196
+ isStream: lt,
197
+ isURLSearchParams: dt,
198
+ isTypedArray: bt,
199
+ isFileList: ut,
200
+ forEach: L,
201
+ merge: X,
202
+ extend: ht,
203
+ trim: pt,
204
+ stripBOM: mt,
205
+ inherits: yt,
206
+ toFlatObject: wt,
207
+ kindOf: M,
208
+ kindOfTest: T,
209
+ endsWith: Et,
210
+ toArray: St,
211
+ forEachEntry: gt,
212
+ matchAll: Rt,
213
+ isHTMLForm: Tt,
214
+ hasOwnProperty: de,
215
+ hasOwnProp: de,
216
+ // an alias to avoid ESLint no-prototype-builtins detection
217
+ reduceDescriptors: Ue,
218
+ freezeMethods: kt,
219
+ toObjectSet: _t,
220
+ toCamelCase: Ot,
221
+ noop: xt,
222
+ toFiniteNumber: Nt,
223
+ findKey: Ne,
224
+ global: Pe,
225
+ isContextDefined: Ce,
226
+ ALPHABET: Fe,
227
+ generateString: Pt,
228
+ isSpecCompliantForm: Ct,
229
+ toJSONObject: Ut,
230
+ isAsyncFn: Ft,
231
+ isThenable: Lt
232
+ };
233
+ function m(e, t, n, r, s) {
234
+ 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), n && (this.config = n), r && (this.request = r), s && (this.response = s);
235
+ }
236
+ a.inherits(m, Error, {
237
+ toJSON: function() {
238
+ return {
239
+ // Standard
240
+ message: this.message,
241
+ name: this.name,
242
+ // Microsoft
243
+ description: this.description,
244
+ number: this.number,
245
+ // Mozilla
246
+ fileName: this.fileName,
247
+ lineNumber: this.lineNumber,
248
+ columnNumber: this.columnNumber,
249
+ stack: this.stack,
250
+ // Axios
251
+ config: a.toJSONObject(this.config),
252
+ code: this.code,
253
+ status: this.response && this.response.status ? this.response.status : null
254
+ };
255
+ }
256
+ });
257
+ const Le = m.prototype, De = {};
258
+ [
259
+ "ERR_BAD_OPTION_VALUE",
260
+ "ERR_BAD_OPTION",
261
+ "ECONNABORTED",
262
+ "ETIMEDOUT",
263
+ "ERR_NETWORK",
264
+ "ERR_FR_TOO_MANY_REDIRECTS",
265
+ "ERR_DEPRECATED",
266
+ "ERR_BAD_RESPONSE",
267
+ "ERR_BAD_REQUEST",
268
+ "ERR_CANCELED",
269
+ "ERR_NOT_SUPPORT",
270
+ "ERR_INVALID_URL"
271
+ // eslint-disable-next-line func-names
272
+ ].forEach((e) => {
273
+ De[e] = { value: e };
274
+ });
275
+ Object.defineProperties(m, De);
276
+ Object.defineProperty(Le, "isAxiosError", { value: !0 });
277
+ m.from = (e, t, n, r, s, o) => {
278
+ const i = Object.create(Le);
279
+ return a.toFlatObject(e, i, function(f) {
280
+ return f !== Error.prototype;
281
+ }, (c) => c !== "isAxiosError"), m.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
282
+ };
283
+ const Dt = null;
284
+ function Q(e) {
285
+ return a.isPlainObject(e) || a.isArray(e);
286
+ }
287
+ function Be(e) {
288
+ return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
289
+ }
290
+ function he(e, t, n) {
291
+ return e ? e.concat(t).map(function(s, o) {
292
+ return s = Be(s), !n && o ? "[" + s + "]" : s;
293
+ }).join(n ? "." : "") : t;
294
+ }
295
+ function Bt(e) {
296
+ return a.isArray(e) && !e.some(Q);
297
+ }
298
+ const jt = a.toFlatObject(a, {}, null, function(t) {
299
+ return /^is[A-Z]/.test(t);
300
+ });
301
+ function $(e, t, n) {
302
+ if (!a.isObject(e))
303
+ throw new TypeError("target must be an object");
304
+ t = t || new FormData(), n = a.toFlatObject(n, {
305
+ metaTokens: !0,
306
+ dots: !1,
307
+ indexes: !1
308
+ }, !1, function(p, E) {
309
+ return !a.isUndefined(E[p]);
310
+ });
311
+ const r = n.metaTokens, s = n.visitor || l, o = n.dots, i = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
312
+ if (!a.isFunction(s))
313
+ throw new TypeError("visitor must be a function");
314
+ function h(d) {
315
+ if (d === null)
316
+ return "";
317
+ if (a.isDate(d))
318
+ return d.toISOString();
319
+ if (!f && a.isBlob(d))
320
+ throw new m("Blob is not supported. Use a Buffer instead.");
321
+ return a.isArrayBuffer(d) || a.isTypedArray(d) ? f && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
322
+ }
323
+ function l(d, p, E) {
324
+ let S = d;
325
+ if (d && !E && typeof d == "object") {
326
+ if (a.endsWith(p, "{}"))
327
+ p = r ? p : p.slice(0, -2), d = JSON.stringify(d);
328
+ else if (a.isArray(d) && Bt(d) || (a.isFileList(d) || a.endsWith(p, "[]")) && (S = a.toArray(d)))
329
+ return p = Be(p), S.forEach(function(k, Ke) {
330
+ !(a.isUndefined(k) || k === null) && t.append(
331
+ // eslint-disable-next-line no-nested-ternary
332
+ i === !0 ? he([p], Ke, o) : i === null ? p : p + "[]",
333
+ h(k)
334
+ );
335
+ }), !1;
336
+ }
337
+ return Q(d) ? !0 : (t.append(he(E, p, o), h(d)), !1);
338
+ }
339
+ const u = [], w = Object.assign(jt, {
340
+ defaultVisitor: l,
341
+ convertValue: h,
342
+ isVisitable: Q
343
+ });
344
+ function b(d, p) {
345
+ if (!a.isUndefined(d)) {
346
+ if (u.indexOf(d) !== -1)
347
+ throw Error("Circular reference detected in " + p.join("."));
348
+ u.push(d), a.forEach(d, function(S, A) {
349
+ (!(a.isUndefined(S) || S === null) && s.call(
350
+ t,
351
+ S,
352
+ a.isString(A) ? A.trim() : A,
353
+ p,
354
+ w
355
+ )) === !0 && b(S, p ? p.concat(A) : [A]);
356
+ }), u.pop();
357
+ }
358
+ }
359
+ if (!a.isObject(e))
360
+ throw new TypeError("data must be an object");
361
+ return b(e), t;
362
+ }
363
+ function me(e) {
364
+ const t = {
365
+ "!": "%21",
366
+ "'": "%27",
367
+ "(": "%28",
368
+ ")": "%29",
369
+ "~": "%7E",
370
+ "%20": "+",
371
+ "%00": "\0"
372
+ };
373
+ return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
374
+ return t[r];
375
+ });
376
+ }
377
+ function se(e, t) {
378
+ this._pairs = [], e && $(e, this, t);
379
+ }
380
+ const je = se.prototype;
381
+ je.append = function(t, n) {
382
+ this._pairs.push([t, n]);
383
+ };
384
+ je.toString = function(t) {
385
+ const n = t ? function(r) {
386
+ return t.call(this, r, me);
387
+ } : me;
388
+ return this._pairs.map(function(s) {
389
+ return n(s[0]) + "=" + n(s[1]);
390
+ }, "").join("&");
391
+ };
392
+ function It(e) {
393
+ return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
394
+ }
395
+ function Ie(e, t, n) {
396
+ if (!t)
397
+ return e;
398
+ const r = n && n.encode || It, s = n && n.serialize;
399
+ let o;
400
+ if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new se(t, n).toString(r), o) {
401
+ const i = e.indexOf("#");
402
+ i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
403
+ }
404
+ return e;
405
+ }
406
+ class ye {
407
+ constructor() {
408
+ this.handlers = [];
409
+ }
410
+ /**
411
+ * Add a new interceptor to the stack
412
+ *
413
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
414
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
415
+ *
416
+ * @return {Number} An ID used to remove interceptor later
417
+ */
418
+ use(t, n, r) {
419
+ return this.handlers.push({
420
+ fulfilled: t,
421
+ rejected: n,
422
+ synchronous: r ? r.synchronous : !1,
423
+ runWhen: r ? r.runWhen : null
424
+ }), this.handlers.length - 1;
425
+ }
426
+ /**
427
+ * Remove an interceptor from the stack
428
+ *
429
+ * @param {Number} id The ID that was returned by `use`
430
+ *
431
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
432
+ */
433
+ eject(t) {
434
+ this.handlers[t] && (this.handlers[t] = null);
435
+ }
436
+ /**
437
+ * Clear all interceptors from the stack
438
+ *
439
+ * @returns {void}
440
+ */
441
+ clear() {
442
+ this.handlers && (this.handlers = []);
443
+ }
444
+ /**
445
+ * Iterate over all the registered interceptors
446
+ *
447
+ * This method is particularly useful for skipping over any
448
+ * interceptors that may have become `null` calling `eject`.
449
+ *
450
+ * @param {Function} fn The function to call for each interceptor
451
+ *
452
+ * @returns {void}
453
+ */
454
+ forEach(t) {
455
+ a.forEach(this.handlers, function(r) {
456
+ r !== null && t(r);
457
+ });
458
+ }
459
+ }
460
+ const He = {
461
+ silentJSONParsing: !0,
462
+ forcedJSONParsing: !0,
463
+ clarifyTimeoutError: !1
464
+ }, Ht = typeof URLSearchParams < "u" ? URLSearchParams : se, qt = typeof FormData < "u" ? FormData : null, Mt = typeof Blob < "u" ? Blob : null, zt = {
465
+ isBrowser: !0,
466
+ classes: {
467
+ URLSearchParams: Ht,
468
+ FormData: qt,
469
+ Blob: Mt
470
+ },
471
+ protocols: ["http", "https", "file", "blob", "url", "data"]
472
+ }, qe = typeof window < "u" && typeof document < "u", Jt = ((e) => qe && ["ReactNative", "NativeScript", "NS"].indexOf(e) < 0)(typeof navigator < "u" && navigator.product), $t = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
473
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
474
+ __proto__: null,
475
+ hasBrowserEnv: qe,
476
+ hasStandardBrowserEnv: Jt,
477
+ hasStandardBrowserWebWorkerEnv: $t
478
+ }, Symbol.toStringTag, { value: "Module" })), R = {
479
+ ...vt,
480
+ ...zt
481
+ };
482
+ function Vt(e, t) {
483
+ return $(e, new R.classes.URLSearchParams(), Object.assign({
484
+ visitor: function(n, r, s, o) {
485
+ return R.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
486
+ }
487
+ }, t));
488
+ }
489
+ function Kt(e) {
490
+ return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
491
+ }
492
+ function Wt(e) {
493
+ const t = {}, n = Object.keys(e);
494
+ let r;
495
+ const s = n.length;
496
+ let o;
497
+ for (r = 0; r < s; r++)
498
+ o = n[r], t[o] = e[o];
499
+ return t;
500
+ }
501
+ function Me(e) {
502
+ function t(n, r, s, o) {
503
+ let i = n[o++];
504
+ if (i === "__proto__")
505
+ return !0;
506
+ const c = Number.isFinite(+i), f = o >= n.length;
507
+ return i = !i && a.isArray(s) ? s.length : i, f ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !c) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = Wt(s[i])), !c);
508
+ }
509
+ if (a.isFormData(e) && a.isFunction(e.entries)) {
510
+ const n = {};
511
+ return a.forEachEntry(e, (r, s) => {
512
+ t(Kt(r), s, n, 0);
513
+ }), n;
514
+ }
515
+ return null;
516
+ }
517
+ function Gt(e, t, n) {
518
+ if (a.isString(e))
519
+ try {
520
+ return (t || JSON.parse)(e), a.trim(e);
521
+ } catch (r) {
522
+ if (r.name !== "SyntaxError")
523
+ throw r;
524
+ }
525
+ return (n || JSON.stringify)(e);
526
+ }
527
+ const oe = {
528
+ transitional: He,
529
+ adapter: ["xhr", "http"],
530
+ transformRequest: [function(t, n) {
531
+ const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, o = a.isObject(t);
532
+ if (o && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
533
+ return s ? JSON.stringify(Me(t)) : t;
534
+ if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t))
535
+ return t;
536
+ if (a.isArrayBufferView(t))
537
+ return t.buffer;
538
+ if (a.isURLSearchParams(t))
539
+ return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
540
+ let c;
541
+ if (o) {
542
+ if (r.indexOf("application/x-www-form-urlencoded") > -1)
543
+ return Vt(t, this.formSerializer).toString();
544
+ if ((c = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
545
+ const f = this.env && this.env.FormData;
546
+ return $(
547
+ c ? { "files[]": t } : t,
548
+ f && new f(),
549
+ this.formSerializer
550
+ );
551
+ }
552
+ }
553
+ return o || s ? (n.setContentType("application/json", !1), Gt(t)) : t;
554
+ }],
555
+ transformResponse: [function(t) {
556
+ const n = this.transitional || oe.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
557
+ if (t && a.isString(t) && (r && !this.responseType || s)) {
558
+ const i = !(n && n.silentJSONParsing) && s;
559
+ try {
560
+ return JSON.parse(t);
561
+ } catch (c) {
562
+ if (i)
563
+ throw c.name === "SyntaxError" ? m.from(c, m.ERR_BAD_RESPONSE, this, null, this.response) : c;
564
+ }
565
+ }
566
+ return t;
567
+ }],
568
+ /**
569
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
570
+ * timeout is not created.
571
+ */
572
+ timeout: 0,
573
+ xsrfCookieName: "XSRF-TOKEN",
574
+ xsrfHeaderName: "X-XSRF-TOKEN",
575
+ maxContentLength: -1,
576
+ maxBodyLength: -1,
577
+ env: {
578
+ FormData: R.classes.FormData,
579
+ Blob: R.classes.Blob
580
+ },
581
+ validateStatus: function(t) {
582
+ return t >= 200 && t < 300;
583
+ },
584
+ headers: {
585
+ common: {
586
+ Accept: "application/json, text/plain, */*",
587
+ "Content-Type": void 0
588
+ }
589
+ }
590
+ };
591
+ a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
592
+ oe.headers[e] = {};
593
+ });
594
+ const ie = oe, Xt = a.toObjectSet([
595
+ "age",
596
+ "authorization",
597
+ "content-length",
598
+ "content-type",
599
+ "etag",
600
+ "expires",
601
+ "from",
602
+ "host",
603
+ "if-modified-since",
604
+ "if-unmodified-since",
605
+ "last-modified",
606
+ "location",
607
+ "max-forwards",
608
+ "proxy-authorization",
609
+ "referer",
610
+ "retry-after",
611
+ "user-agent"
612
+ ]), Qt = (e) => {
613
+ const t = {};
614
+ let n, r, s;
615
+ return e && e.split(`
616
+ `).forEach(function(i) {
617
+ s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Xt[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
618
+ }), t;
619
+ }, we = Symbol("internals");
620
+ function C(e) {
621
+ return e && String(e).trim().toLowerCase();
622
+ }
623
+ function j(e) {
624
+ return e === !1 || e == null ? e : a.isArray(e) ? e.map(j) : String(e);
625
+ }
626
+ function Zt(e) {
627
+ const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
628
+ let r;
629
+ for (; r = n.exec(e); )
630
+ t[r[1]] = r[2];
631
+ return t;
632
+ }
633
+ const Yt = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
634
+ function K(e, t, n, r, s) {
635
+ if (a.isFunction(r))
636
+ return r.call(this, t, n);
637
+ if (s && (t = n), !!a.isString(t)) {
638
+ if (a.isString(r))
639
+ return t.indexOf(r) !== -1;
640
+ if (a.isRegExp(r))
641
+ return r.test(t);
642
+ }
643
+ }
644
+ function en(e) {
645
+ return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
646
+ }
647
+ function tn(e, t) {
648
+ const n = a.toCamelCase(" " + t);
649
+ ["get", "set", "has"].forEach((r) => {
650
+ Object.defineProperty(e, r + n, {
651
+ value: function(s, o, i) {
652
+ return this[r].call(this, t, s, o, i);
653
+ },
654
+ configurable: !0
655
+ });
656
+ });
657
+ }
658
+ class v {
659
+ constructor(t) {
660
+ t && this.set(t);
661
+ }
662
+ set(t, n, r) {
663
+ const s = this;
664
+ function o(c, f, h) {
665
+ const l = C(f);
666
+ if (!l)
667
+ throw new Error("header name must be a non-empty string");
668
+ const u = a.findKey(s, l);
669
+ (!u || s[u] === void 0 || h === !0 || h === void 0 && s[u] !== !1) && (s[u || f] = j(c));
670
+ }
671
+ const i = (c, f) => a.forEach(c, (h, l) => o(h, l, f));
672
+ return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !Yt(t) ? i(Qt(t), n) : t != null && o(n, t, r), this;
673
+ }
674
+ get(t, n) {
675
+ if (t = C(t), t) {
676
+ const r = a.findKey(this, t);
677
+ if (r) {
678
+ const s = this[r];
679
+ if (!n)
680
+ return s;
681
+ if (n === !0)
682
+ return Zt(s);
683
+ if (a.isFunction(n))
684
+ return n.call(this, s, r);
685
+ if (a.isRegExp(n))
686
+ return n.exec(s);
687
+ throw new TypeError("parser must be boolean|regexp|function");
688
+ }
689
+ }
690
+ }
691
+ has(t, n) {
692
+ if (t = C(t), t) {
693
+ const r = a.findKey(this, t);
694
+ return !!(r && this[r] !== void 0 && (!n || K(this, this[r], r, n)));
695
+ }
696
+ return !1;
697
+ }
698
+ delete(t, n) {
699
+ const r = this;
700
+ let s = !1;
701
+ function o(i) {
702
+ if (i = C(i), i) {
703
+ const c = a.findKey(r, i);
704
+ c && (!n || K(r, r[c], c, n)) && (delete r[c], s = !0);
705
+ }
706
+ }
707
+ return a.isArray(t) ? t.forEach(o) : o(t), s;
708
+ }
709
+ clear(t) {
710
+ const n = Object.keys(this);
711
+ let r = n.length, s = !1;
712
+ for (; r--; ) {
713
+ const o = n[r];
714
+ (!t || K(this, this[o], o, t, !0)) && (delete this[o], s = !0);
715
+ }
716
+ return s;
717
+ }
718
+ normalize(t) {
719
+ const n = this, r = {};
720
+ return a.forEach(this, (s, o) => {
721
+ const i = a.findKey(r, o);
722
+ if (i) {
723
+ n[i] = j(s), delete n[o];
724
+ return;
725
+ }
726
+ const c = t ? en(o) : String(o).trim();
727
+ c !== o && delete n[o], n[c] = j(s), r[c] = !0;
728
+ }), this;
729
+ }
730
+ concat(...t) {
731
+ return this.constructor.concat(this, ...t);
732
+ }
733
+ toJSON(t) {
734
+ const n = /* @__PURE__ */ Object.create(null);
735
+ return a.forEach(this, (r, s) => {
736
+ r != null && r !== !1 && (n[s] = t && a.isArray(r) ? r.join(", ") : r);
737
+ }), n;
738
+ }
739
+ [Symbol.iterator]() {
740
+ return Object.entries(this.toJSON())[Symbol.iterator]();
741
+ }
742
+ toString() {
743
+ return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
744
+ `);
745
+ }
746
+ get [Symbol.toStringTag]() {
747
+ return "AxiosHeaders";
748
+ }
749
+ static from(t) {
750
+ return t instanceof this ? t : new this(t);
751
+ }
752
+ static concat(t, ...n) {
753
+ const r = new this(t);
754
+ return n.forEach((s) => r.set(s)), r;
755
+ }
756
+ static accessor(t) {
757
+ const r = (this[we] = this[we] = {
758
+ accessors: {}
759
+ }).accessors, s = this.prototype;
760
+ function o(i) {
761
+ const c = C(i);
762
+ r[c] || (tn(s, i), r[c] = !0);
763
+ }
764
+ return a.isArray(t) ? t.forEach(o) : o(t), this;
765
+ }
766
+ }
767
+ v.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
768
+ a.reduceDescriptors(v.prototype, ({ value: e }, t) => {
769
+ let n = t[0].toUpperCase() + t.slice(1);
770
+ return {
771
+ get: () => e,
772
+ set(r) {
773
+ this[n] = r;
774
+ }
775
+ };
776
+ });
777
+ a.freezeMethods(v);
778
+ const O = v;
779
+ function W(e, t) {
780
+ const n = this || ie, r = t || n, s = O.from(r.headers);
781
+ let o = r.data;
782
+ return a.forEach(e, function(c) {
783
+ o = c.call(n, o, s.normalize(), t ? t.status : void 0);
784
+ }), s.normalize(), o;
785
+ }
786
+ function ze(e) {
787
+ return !!(e && e.__CANCEL__);
788
+ }
789
+ function D(e, t, n) {
790
+ m.call(this, e ?? "canceled", m.ERR_CANCELED, t, n), this.name = "CanceledError";
791
+ }
792
+ a.inherits(D, m, {
793
+ __CANCEL__: !0
794
+ });
795
+ function nn(e, t, n) {
796
+ const r = n.config.validateStatus;
797
+ !n.status || !r || r(n.status) ? e(n) : t(new m(
798
+ "Request failed with status code " + n.status,
799
+ [m.ERR_BAD_REQUEST, m.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
800
+ n.config,
801
+ n.request,
802
+ n
803
+ ));
804
+ }
805
+ const rn = R.hasStandardBrowserEnv ? (
806
+ // Standard browser envs support document.cookie
807
+ {
808
+ write(e, t, n, r, s, o) {
809
+ const i = [e + "=" + encodeURIComponent(t)];
810
+ a.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), a.isString(r) && i.push("path=" + r), a.isString(s) && i.push("domain=" + s), o === !0 && i.push("secure"), document.cookie = i.join("; ");
811
+ },
812
+ read(e) {
813
+ const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
814
+ return t ? decodeURIComponent(t[3]) : null;
815
+ },
816
+ remove(e) {
817
+ this.write(e, "", Date.now() - 864e5);
818
+ }
819
+ }
820
+ ) : (
821
+ // Non-standard browser env (web workers, react-native) lack needed support.
822
+ {
823
+ write() {
824
+ },
825
+ read() {
826
+ return null;
827
+ },
828
+ remove() {
829
+ }
830
+ }
831
+ );
832
+ function sn(e) {
833
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
834
+ }
835
+ function on(e, t) {
836
+ return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
837
+ }
838
+ function Je(e, t) {
839
+ return e && !sn(t) ? on(e, t) : t;
840
+ }
841
+ const an = R.hasStandardBrowserEnv ? (
842
+ // Standard browser envs have full support of the APIs needed to test
843
+ // whether the request URL is of the same origin as current location.
844
+ function() {
845
+ const t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");
846
+ let r;
847
+ function s(o) {
848
+ let i = o;
849
+ return t && (n.setAttribute("href", i), i = n.href), n.setAttribute("href", i), {
850
+ href: n.href,
851
+ protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
852
+ host: n.host,
853
+ search: n.search ? n.search.replace(/^\?/, "") : "",
854
+ hash: n.hash ? n.hash.replace(/^#/, "") : "",
855
+ hostname: n.hostname,
856
+ port: n.port,
857
+ pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname
858
+ };
859
+ }
860
+ return r = s(window.location.href), function(i) {
861
+ const c = a.isString(i) ? s(i) : i;
862
+ return c.protocol === r.protocol && c.host === r.host;
863
+ };
864
+ }()
865
+ ) : (
866
+ // Non standard browser envs (web workers, react-native) lack needed support.
867
+ /* @__PURE__ */ function() {
868
+ return function() {
869
+ return !0;
870
+ };
871
+ }()
872
+ );
873
+ function cn(e) {
874
+ const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
875
+ return t && t[1] || "";
876
+ }
877
+ function un(e, t) {
878
+ e = e || 10;
879
+ const n = new Array(e), r = new Array(e);
880
+ let s = 0, o = 0, i;
881
+ return t = t !== void 0 ? t : 1e3, function(f) {
882
+ const h = Date.now(), l = r[o];
883
+ i || (i = h), n[s] = f, r[s] = h;
884
+ let u = o, w = 0;
885
+ for (; u !== s; )
886
+ w += n[u++], u = u % e;
887
+ if (s = (s + 1) % e, s === o && (o = (o + 1) % e), h - i < t)
888
+ return;
889
+ const b = l && h - l;
890
+ return b ? Math.round(w * 1e3 / b) : void 0;
891
+ };
892
+ }
893
+ function Ee(e, t) {
894
+ let n = 0;
895
+ const r = un(50, 250);
896
+ return (s) => {
897
+ const o = s.loaded, i = s.lengthComputable ? s.total : void 0, c = o - n, f = r(c), h = o <= i;
898
+ n = o;
899
+ const l = {
900
+ loaded: o,
901
+ total: i,
902
+ progress: i ? o / i : void 0,
903
+ bytes: c,
904
+ rate: f || void 0,
905
+ estimated: f && i && h ? (i - o) / f : void 0,
906
+ event: s
907
+ };
908
+ l[t ? "download" : "upload"] = !0, e(l);
909
+ };
910
+ }
911
+ const ln = typeof XMLHttpRequest < "u", fn = ln && function(e) {
912
+ return new Promise(function(n, r) {
913
+ let s = e.data;
914
+ const o = O.from(e.headers).normalize();
915
+ let { responseType: i, withXSRFToken: c } = e, f;
916
+ function h() {
917
+ e.cancelToken && e.cancelToken.unsubscribe(f), e.signal && e.signal.removeEventListener("abort", f);
918
+ }
919
+ let l;
920
+ if (a.isFormData(s)) {
921
+ if (R.hasStandardBrowserEnv || R.hasStandardBrowserWebWorkerEnv)
922
+ o.setContentType(!1);
923
+ else if ((l = o.getContentType()) !== !1) {
924
+ const [p, ...E] = l ? l.split(";").map((S) => S.trim()).filter(Boolean) : [];
925
+ o.setContentType([p || "multipart/form-data", ...E].join("; "));
926
+ }
927
+ }
928
+ let u = new XMLHttpRequest();
929
+ if (e.auth) {
930
+ const p = e.auth.username || "", E = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
931
+ o.set("Authorization", "Basic " + btoa(p + ":" + E));
932
+ }
933
+ const w = Je(e.baseURL, e.url);
934
+ u.open(e.method.toUpperCase(), Ie(w, e.params, e.paramsSerializer), !0), u.timeout = e.timeout;
935
+ function b() {
936
+ if (!u)
937
+ return;
938
+ const p = O.from(
939
+ "getAllResponseHeaders" in u && u.getAllResponseHeaders()
940
+ ), S = {
941
+ data: !i || i === "text" || i === "json" ? u.responseText : u.response,
942
+ status: u.status,
943
+ statusText: u.statusText,
944
+ headers: p,
945
+ config: e,
946
+ request: u
947
+ };
948
+ nn(function(k) {
949
+ n(k), h();
950
+ }, function(k) {
951
+ r(k), h();
952
+ }, S), u = null;
953
+ }
954
+ if ("onloadend" in u ? u.onloadend = b : u.onreadystatechange = function() {
955
+ !u || u.readyState !== 4 || u.status === 0 && !(u.responseURL && u.responseURL.indexOf("file:") === 0) || setTimeout(b);
956
+ }, u.onabort = function() {
957
+ u && (r(new m("Request aborted", m.ECONNABORTED, e, u)), u = null);
958
+ }, u.onerror = function() {
959
+ r(new m("Network Error", m.ERR_NETWORK, e, u)), u = null;
960
+ }, u.ontimeout = function() {
961
+ let E = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
962
+ const S = e.transitional || He;
963
+ e.timeoutErrorMessage && (E = e.timeoutErrorMessage), r(new m(
964
+ E,
965
+ S.clarifyTimeoutError ? m.ETIMEDOUT : m.ECONNABORTED,
966
+ e,
967
+ u
968
+ )), u = null;
969
+ }, R.hasStandardBrowserEnv && (c && a.isFunction(c) && (c = c(e)), c || c !== !1 && an(w))) {
970
+ const p = e.xsrfHeaderName && e.xsrfCookieName && rn.read(e.xsrfCookieName);
971
+ p && o.set(e.xsrfHeaderName, p);
972
+ }
973
+ s === void 0 && o.setContentType(null), "setRequestHeader" in u && a.forEach(o.toJSON(), function(E, S) {
974
+ u.setRequestHeader(S, E);
975
+ }), a.isUndefined(e.withCredentials) || (u.withCredentials = !!e.withCredentials), i && i !== "json" && (u.responseType = e.responseType), typeof e.onDownloadProgress == "function" && u.addEventListener("progress", Ee(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && u.upload && u.upload.addEventListener("progress", Ee(e.onUploadProgress)), (e.cancelToken || e.signal) && (f = (p) => {
976
+ u && (r(!p || p.type ? new D(null, e, u) : p), u.abort(), u = null);
977
+ }, e.cancelToken && e.cancelToken.subscribe(f), e.signal && (e.signal.aborted ? f() : e.signal.addEventListener("abort", f)));
978
+ const d = cn(w);
979
+ if (d && R.protocols.indexOf(d) === -1) {
980
+ r(new m("Unsupported protocol " + d + ":", m.ERR_BAD_REQUEST, e));
981
+ return;
982
+ }
983
+ u.send(s || null);
984
+ });
985
+ }, Z = {
986
+ http: Dt,
987
+ xhr: fn
988
+ };
989
+ a.forEach(Z, (e, t) => {
990
+ if (e) {
991
+ try {
992
+ Object.defineProperty(e, "name", { value: t });
993
+ } catch {
994
+ }
995
+ Object.defineProperty(e, "adapterName", { value: t });
996
+ }
997
+ });
998
+ const Se = (e) => `- ${e}`, dn = (e) => a.isFunction(e) || e === null || e === !1, $e = {
999
+ getAdapter: (e) => {
1000
+ e = a.isArray(e) ? e : [e];
1001
+ const { length: t } = e;
1002
+ let n, r;
1003
+ const s = {};
1004
+ for (let o = 0; o < t; o++) {
1005
+ n = e[o];
1006
+ let i;
1007
+ if (r = n, !dn(n) && (r = Z[(i = String(n)).toLowerCase()], r === void 0))
1008
+ throw new m(`Unknown adapter '${i}'`);
1009
+ if (r)
1010
+ break;
1011
+ s[i || "#" + o] = r;
1012
+ }
1013
+ if (!r) {
1014
+ const o = Object.entries(s).map(
1015
+ ([c, f]) => `adapter ${c} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
1016
+ );
1017
+ let i = t ? o.length > 1 ? `since :
1018
+ ` + o.map(Se).join(`
1019
+ `) : " " + Se(o[0]) : "as no adapter specified";
1020
+ throw new m(
1021
+ "There is no suitable adapter to dispatch the request " + i,
1022
+ "ERR_NOT_SUPPORT"
1023
+ );
1024
+ }
1025
+ return r;
1026
+ },
1027
+ adapters: Z
1028
+ };
1029
+ function G(e) {
1030
+ if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1031
+ throw new D(null, e);
1032
+ }
1033
+ function be(e) {
1034
+ return G(e), e.headers = O.from(e.headers), e.data = W.call(
1035
+ e,
1036
+ e.transformRequest
1037
+ ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), $e.getAdapter(e.adapter || ie.adapter)(e).then(function(r) {
1038
+ return G(e), r.data = W.call(
1039
+ e,
1040
+ e.transformResponse,
1041
+ r
1042
+ ), r.headers = O.from(r.headers), r;
1043
+ }, function(r) {
1044
+ return ze(r) || (G(e), r && r.response && (r.response.data = W.call(
1045
+ e,
1046
+ e.transformResponse,
1047
+ r.response
1048
+ ), r.response.headers = O.from(r.response.headers))), Promise.reject(r);
1049
+ });
1050
+ }
1051
+ const ge = (e) => e instanceof O ? e.toJSON() : e;
1052
+ function N(e, t) {
1053
+ t = t || {};
1054
+ const n = {};
1055
+ function r(h, l, u) {
1056
+ return a.isPlainObject(h) && a.isPlainObject(l) ? a.merge.call({ caseless: u }, h, l) : a.isPlainObject(l) ? a.merge({}, l) : a.isArray(l) ? l.slice() : l;
1057
+ }
1058
+ function s(h, l, u) {
1059
+ if (a.isUndefined(l)) {
1060
+ if (!a.isUndefined(h))
1061
+ return r(void 0, h, u);
1062
+ } else
1063
+ return r(h, l, u);
1064
+ }
1065
+ function o(h, l) {
1066
+ if (!a.isUndefined(l))
1067
+ return r(void 0, l);
1068
+ }
1069
+ function i(h, l) {
1070
+ if (a.isUndefined(l)) {
1071
+ if (!a.isUndefined(h))
1072
+ return r(void 0, h);
1073
+ } else
1074
+ return r(void 0, l);
1075
+ }
1076
+ function c(h, l, u) {
1077
+ if (u in t)
1078
+ return r(h, l);
1079
+ if (u in e)
1080
+ return r(void 0, h);
1081
+ }
1082
+ const f = {
1083
+ url: o,
1084
+ method: o,
1085
+ data: o,
1086
+ baseURL: i,
1087
+ transformRequest: i,
1088
+ transformResponse: i,
1089
+ paramsSerializer: i,
1090
+ timeout: i,
1091
+ timeoutMessage: i,
1092
+ withCredentials: i,
1093
+ withXSRFToken: i,
1094
+ adapter: i,
1095
+ responseType: i,
1096
+ xsrfCookieName: i,
1097
+ xsrfHeaderName: i,
1098
+ onUploadProgress: i,
1099
+ onDownloadProgress: i,
1100
+ decompress: i,
1101
+ maxContentLength: i,
1102
+ maxBodyLength: i,
1103
+ beforeRedirect: i,
1104
+ transport: i,
1105
+ httpAgent: i,
1106
+ httpsAgent: i,
1107
+ cancelToken: i,
1108
+ socketPath: i,
1109
+ responseEncoding: i,
1110
+ validateStatus: c,
1111
+ headers: (h, l) => s(ge(h), ge(l), !0)
1112
+ };
1113
+ return a.forEach(Object.keys(Object.assign({}, e, t)), function(l) {
1114
+ const u = f[l] || s, w = u(e[l], t[l], l);
1115
+ a.isUndefined(w) && u !== c || (n[l] = w);
1116
+ }), n;
1117
+ }
1118
+ const ve = "1.6.7", ae = {};
1119
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1120
+ ae[e] = function(r) {
1121
+ return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1122
+ };
1123
+ });
1124
+ const Re = {};
1125
+ ae.transitional = function(t, n, r) {
1126
+ function s(o, i) {
1127
+ return "[Axios v" + ve + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
1128
+ }
1129
+ return (o, i, c) => {
1130
+ if (t === !1)
1131
+ throw new m(
1132
+ s(i, " has been removed" + (n ? " in " + n : "")),
1133
+ m.ERR_DEPRECATED
1134
+ );
1135
+ return n && !Re[i] && (Re[i] = !0, console.warn(
1136
+ s(
1137
+ i,
1138
+ " has been deprecated since v" + n + " and will be removed in the near future"
1139
+ )
1140
+ )), t ? t(o, i, c) : !0;
1141
+ };
1142
+ };
1143
+ function pn(e, t, n) {
1144
+ if (typeof e != "object")
1145
+ throw new m("options must be an object", m.ERR_BAD_OPTION_VALUE);
1146
+ const r = Object.keys(e);
1147
+ let s = r.length;
1148
+ for (; s-- > 0; ) {
1149
+ const o = r[s], i = t[o];
1150
+ if (i) {
1151
+ const c = e[o], f = c === void 0 || i(c, o, e);
1152
+ if (f !== !0)
1153
+ throw new m("option " + o + " must be " + f, m.ERR_BAD_OPTION_VALUE);
1154
+ continue;
1155
+ }
1156
+ if (n !== !0)
1157
+ throw new m("Unknown option " + o, m.ERR_BAD_OPTION);
1158
+ }
1159
+ }
1160
+ const Y = {
1161
+ assertOptions: pn,
1162
+ validators: ae
1163
+ }, _ = Y.validators;
1164
+ class q {
1165
+ constructor(t) {
1166
+ this.defaults = t, this.interceptors = {
1167
+ request: new ye(),
1168
+ response: new ye()
1169
+ };
1170
+ }
1171
+ /**
1172
+ * Dispatch a request
1173
+ *
1174
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1175
+ * @param {?Object} config
1176
+ *
1177
+ * @returns {Promise} The Promise to be fulfilled
1178
+ */
1179
+ async request(t, n) {
1180
+ try {
1181
+ return await this._request(t, n);
1182
+ } catch (r) {
1183
+ if (r instanceof Error) {
1184
+ let s;
1185
+ Error.captureStackTrace ? Error.captureStackTrace(s = {}) : s = new Error();
1186
+ const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
1187
+ r.stack ? o && !String(r.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (r.stack += `
1188
+ ` + o) : r.stack = o;
1189
+ }
1190
+ throw r;
1191
+ }
1192
+ }
1193
+ _request(t, n) {
1194
+ typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = N(this.defaults, n);
1195
+ const { transitional: r, paramsSerializer: s, headers: o } = n;
1196
+ r !== void 0 && Y.assertOptions(r, {
1197
+ silentJSONParsing: _.transitional(_.boolean),
1198
+ forcedJSONParsing: _.transitional(_.boolean),
1199
+ clarifyTimeoutError: _.transitional(_.boolean)
1200
+ }, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
1201
+ serialize: s
1202
+ } : Y.assertOptions(s, {
1203
+ encode: _.function,
1204
+ serialize: _.function
1205
+ }, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1206
+ let i = o && a.merge(
1207
+ o.common,
1208
+ o[n.method]
1209
+ );
1210
+ o && a.forEach(
1211
+ ["delete", "get", "head", "post", "put", "patch", "common"],
1212
+ (d) => {
1213
+ delete o[d];
1214
+ }
1215
+ ), n.headers = O.concat(i, o);
1216
+ const c = [];
1217
+ let f = !0;
1218
+ this.interceptors.request.forEach(function(p) {
1219
+ typeof p.runWhen == "function" && p.runWhen(n) === !1 || (f = f && p.synchronous, c.unshift(p.fulfilled, p.rejected));
1220
+ });
1221
+ const h = [];
1222
+ this.interceptors.response.forEach(function(p) {
1223
+ h.push(p.fulfilled, p.rejected);
1224
+ });
1225
+ let l, u = 0, w;
1226
+ if (!f) {
1227
+ const d = [be.bind(this), void 0];
1228
+ for (d.unshift.apply(d, c), d.push.apply(d, h), w = d.length, l = Promise.resolve(n); u < w; )
1229
+ l = l.then(d[u++], d[u++]);
1230
+ return l;
1231
+ }
1232
+ w = c.length;
1233
+ let b = n;
1234
+ for (u = 0; u < w; ) {
1235
+ const d = c[u++], p = c[u++];
1236
+ try {
1237
+ b = d(b);
1238
+ } catch (E) {
1239
+ p.call(this, E);
1240
+ break;
1241
+ }
1242
+ }
1243
+ try {
1244
+ l = be.call(this, b);
1245
+ } catch (d) {
1246
+ return Promise.reject(d);
1247
+ }
1248
+ for (u = 0, w = h.length; u < w; )
1249
+ l = l.then(h[u++], h[u++]);
1250
+ return l;
1251
+ }
1252
+ getUri(t) {
1253
+ t = N(this.defaults, t);
1254
+ const n = Je(t.baseURL, t.url);
1255
+ return Ie(n, t.params, t.paramsSerializer);
1256
+ }
1257
+ }
1258
+ a.forEach(["delete", "get", "head", "options"], function(t) {
1259
+ q.prototype[t] = function(n, r) {
1260
+ return this.request(N(r || {}, {
1261
+ method: t,
1262
+ url: n,
1263
+ data: (r || {}).data
1264
+ }));
1265
+ };
1266
+ });
1267
+ a.forEach(["post", "put", "patch"], function(t) {
1268
+ function n(r) {
1269
+ return function(o, i, c) {
1270
+ return this.request(N(c || {}, {
1271
+ method: t,
1272
+ headers: r ? {
1273
+ "Content-Type": "multipart/form-data"
1274
+ } : {},
1275
+ url: o,
1276
+ data: i
1277
+ }));
1278
+ };
1279
+ }
1280
+ q.prototype[t] = n(), q.prototype[t + "Form"] = n(!0);
1281
+ });
1282
+ const I = q;
1283
+ class ce {
1284
+ constructor(t) {
1285
+ if (typeof t != "function")
1286
+ throw new TypeError("executor must be a function.");
1287
+ let n;
1288
+ this.promise = new Promise(function(o) {
1289
+ n = o;
1290
+ });
1291
+ const r = this;
1292
+ this.promise.then((s) => {
1293
+ if (!r._listeners)
1294
+ return;
1295
+ let o = r._listeners.length;
1296
+ for (; o-- > 0; )
1297
+ r._listeners[o](s);
1298
+ r._listeners = null;
1299
+ }), this.promise.then = (s) => {
1300
+ let o;
1301
+ const i = new Promise((c) => {
1302
+ r.subscribe(c), o = c;
1303
+ }).then(s);
1304
+ return i.cancel = function() {
1305
+ r.unsubscribe(o);
1306
+ }, i;
1307
+ }, t(function(o, i, c) {
1308
+ r.reason || (r.reason = new D(o, i, c), n(r.reason));
1309
+ });
1310
+ }
1311
+ /**
1312
+ * Throws a `CanceledError` if cancellation has been requested.
1313
+ */
1314
+ throwIfRequested() {
1315
+ if (this.reason)
1316
+ throw this.reason;
1317
+ }
1318
+ /**
1319
+ * Subscribe to the cancel signal
1320
+ */
1321
+ subscribe(t) {
1322
+ if (this.reason) {
1323
+ t(this.reason);
1324
+ return;
1325
+ }
1326
+ this._listeners ? this._listeners.push(t) : this._listeners = [t];
1327
+ }
1328
+ /**
1329
+ * Unsubscribe from the cancel signal
1330
+ */
1331
+ unsubscribe(t) {
1332
+ if (!this._listeners)
1333
+ return;
1334
+ const n = this._listeners.indexOf(t);
1335
+ n !== -1 && this._listeners.splice(n, 1);
1336
+ }
1337
+ /**
1338
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
1339
+ * cancels the `CancelToken`.
1340
+ */
1341
+ static source() {
1342
+ let t;
1343
+ return {
1344
+ token: new ce(function(s) {
1345
+ t = s;
1346
+ }),
1347
+ cancel: t
1348
+ };
1349
+ }
1350
+ }
1351
+ const hn = ce;
1352
+ function mn(e) {
1353
+ return function(n) {
1354
+ return e.apply(null, n);
1355
+ };
1356
+ }
1357
+ function yn(e) {
1358
+ return a.isObject(e) && e.isAxiosError === !0;
1359
+ }
1360
+ const ee = {
1361
+ Continue: 100,
1362
+ SwitchingProtocols: 101,
1363
+ Processing: 102,
1364
+ EarlyHints: 103,
1365
+ Ok: 200,
1366
+ Created: 201,
1367
+ Accepted: 202,
1368
+ NonAuthoritativeInformation: 203,
1369
+ NoContent: 204,
1370
+ ResetContent: 205,
1371
+ PartialContent: 206,
1372
+ MultiStatus: 207,
1373
+ AlreadyReported: 208,
1374
+ ImUsed: 226,
1375
+ MultipleChoices: 300,
1376
+ MovedPermanently: 301,
1377
+ Found: 302,
1378
+ SeeOther: 303,
1379
+ NotModified: 304,
1380
+ UseProxy: 305,
1381
+ Unused: 306,
1382
+ TemporaryRedirect: 307,
1383
+ PermanentRedirect: 308,
1384
+ BadRequest: 400,
1385
+ Unauthorized: 401,
1386
+ PaymentRequired: 402,
1387
+ Forbidden: 403,
1388
+ NotFound: 404,
1389
+ MethodNotAllowed: 405,
1390
+ NotAcceptable: 406,
1391
+ ProxyAuthenticationRequired: 407,
1392
+ RequestTimeout: 408,
1393
+ Conflict: 409,
1394
+ Gone: 410,
1395
+ LengthRequired: 411,
1396
+ PreconditionFailed: 412,
1397
+ PayloadTooLarge: 413,
1398
+ UriTooLong: 414,
1399
+ UnsupportedMediaType: 415,
1400
+ RangeNotSatisfiable: 416,
1401
+ ExpectationFailed: 417,
1402
+ ImATeapot: 418,
1403
+ MisdirectedRequest: 421,
1404
+ UnprocessableEntity: 422,
1405
+ Locked: 423,
1406
+ FailedDependency: 424,
1407
+ TooEarly: 425,
1408
+ UpgradeRequired: 426,
1409
+ PreconditionRequired: 428,
1410
+ TooManyRequests: 429,
1411
+ RequestHeaderFieldsTooLarge: 431,
1412
+ UnavailableForLegalReasons: 451,
1413
+ InternalServerError: 500,
1414
+ NotImplemented: 501,
1415
+ BadGateway: 502,
1416
+ ServiceUnavailable: 503,
1417
+ GatewayTimeout: 504,
1418
+ HttpVersionNotSupported: 505,
1419
+ VariantAlsoNegotiates: 506,
1420
+ InsufficientStorage: 507,
1421
+ LoopDetected: 508,
1422
+ NotExtended: 510,
1423
+ NetworkAuthenticationRequired: 511
1424
+ };
1425
+ Object.entries(ee).forEach(([e, t]) => {
1426
+ ee[t] = e;
1427
+ });
1428
+ const wn = ee;
1429
+ function Ve(e) {
1430
+ const t = new I(e), n = ke(I.prototype.request, t);
1431
+ return a.extend(n, I.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1432
+ return Ve(N(e, s));
1433
+ }, n;
1434
+ }
1435
+ const y = Ve(ie);
1436
+ y.Axios = I;
1437
+ y.CanceledError = D;
1438
+ y.CancelToken = hn;
1439
+ y.isCancel = ze;
1440
+ y.VERSION = ve;
1441
+ y.toFormData = $;
1442
+ y.AxiosError = m;
1443
+ y.Cancel = y.CanceledError;
1444
+ y.all = function(t) {
1445
+ return Promise.all(t);
1446
+ };
1447
+ y.spread = mn;
1448
+ y.isAxiosError = yn;
1449
+ y.mergeConfig = N;
1450
+ y.AxiosHeaders = O;
1451
+ y.formToJSON = (e) => Me(a.isHTMLForm(e) ? new FormData(e) : e);
1452
+ y.getAdapter = $e.getAdapter;
1453
+ y.HttpStatusCode = wn;
1454
+ y.default = y;
1455
+ const Te = (e) => new URL(location.href).searchParams.get(e), ue = {
12
1456
  oauth: "/api/justauth/oauth-server/v1/visitor/oauth/authorize",
13
1457
  // 重定向到登录页
14
1458
  token: "/api/justauth/oauth-server/v1/visitor/oauth/token"
15
1459
  // 通过code获取token
16
- };
17
- const refreshing = ref(false);
18
- const { baseURL, mainAppName, microAppName } = getConfig();
19
- const real_uri = mainAppName || window.__IN_MICRO_APP__ ? `${location.origin}/` : location.origin + location.pathname;
20
- const getTokenParams = {
1460
+ }, x = We(!1), { baseURL: En, mainAppName: Sn, microAppName: bn } = ne(), te = Sn || window.__IN_MICRO_APP__ ? `${location.origin}/` : location.origin + location.pathname, H = {
21
1461
  response_type: "code",
22
1462
  scope: "sever",
23
1463
  client_id: "sys",
24
- client_secret: encryption("das123"),
1464
+ client_secret: Xe("das123"),
25
1465
  state: +/* @__PURE__ */ new Date()
26
- };
27
- const getTokenFromCode = async (code, data, redirectUri, keepLogin) => {
28
- const kingdee_token = getUrlParams(location.href, "kingdee_token") || "";
29
- let tokenRes = {};
30
- const tokenParams = {
1466
+ }, gn = async (e, t, n, r) => {
1467
+ const s = Qe(location.href, "kingdee_token") || "";
1468
+ let o = {};
1469
+ const i = {
31
1470
  grant_type: "authorization_code",
32
- code,
33
- client_id: data.client_id,
34
- client_secret: data.client_secret,
35
- redirect_uri: redirectUri || real_uri
1471
+ code: e,
1472
+ client_id: t.client_id,
1473
+ client_secret: t.client_secret,
1474
+ redirect_uri: n || te
36
1475
  };
37
1476
  try {
38
- if (keepLogin) {
39
- tokenParams.keep_login = true;
40
- tokenParams.redirect_uri = `${tokenParams.redirect_uri}?keep_login=true`;
41
- }
42
- if (kingdee_token) {
43
- sessionStorage.setItem("kingdee_token", kingdee_token);
44
- tokenParams.redirect_uri = `${tokenParams.redirect_uri}?kingdee_token=${kingdee_token}`;
45
- }
46
- tokenRes = await axios.create().post(
47
- apis.token,
1477
+ r && (i.keep_login = !0, i.redirect_uri = `${i.redirect_uri}?keep_login=true`), s && (sessionStorage.setItem("kingdee_token", s), i.redirect_uri = `${i.redirect_uri}?kingdee_token=${s}`), o = await y.create().post(
1478
+ ue.token,
48
1479
  {},
49
1480
  {
50
- baseURL,
51
- params: tokenParams,
1481
+ baseURL: En,
1482
+ params: i,
52
1483
  headers: {
53
1484
  "Content-Type": "application/x-www-form-urlencoded"
54
1485
  }
55
1486
  }
56
1487
  );
57
- const { access_token, refresh_token, expires_in } = tokenRes.data;
58
- const tokenData = {
59
- accessToken: access_token,
60
- accessTokenExpiredAt: +/* @__PURE__ */ new Date() + expires_in * 1e3,
61
- refreshToken: refresh_token,
62
- info: tokenRes.data
1488
+ const { access_token: c, refresh_token: f, expires_in: h } = o.data, l = {
1489
+ accessToken: c,
1490
+ accessTokenExpiredAt: +/* @__PURE__ */ new Date() + h * 1e3,
1491
+ refreshToken: f,
1492
+ info: o.data
63
1493
  };
64
- setAccessToken(access_token, tokenRes.data);
65
- tokenStorage().save(tokenData);
66
- setPersonalInfo(access_token);
67
- let filterParams = ["code", "state", "keep_login", "kingdee_token"];
68
- window.history.replaceState(null, "", funcUrlDel(filterParams));
69
- return access_token;
1494
+ Oe(c, o.data), F().save(l), Ae(c);
1495
+ let u = ["code", "state", "keep_login", "kingdee_token"];
1496
+ return window.history.replaceState(null, "", Ze(u)), c;
70
1497
  } catch {
71
- return login({ ...getTokenParams, redirect_uri: redirectUri || real_uri });
1498
+ return le({ ...H, redirect_uri: n || te });
72
1499
  }
73
- };
74
- const getToken = async (config) => {
75
- if (config.public)
1500
+ }, Pn = async (e) => {
1501
+ if (e.public)
76
1502
  return;
77
- if (refreshing.value) {
78
- return await new Promise(async (res) => {
79
- watch(
80
- () => refreshing.value,
81
- (value) => {
82
- if (!value) {
83
- const token = getAccessToken();
84
- res(token);
1503
+ if (x.value)
1504
+ return await new Promise(async (f) => {
1505
+ Ge(
1506
+ () => x.value,
1507
+ (h) => {
1508
+ if (!h) {
1509
+ const l = fe();
1510
+ f(l);
85
1511
  }
86
1512
  }
87
1513
  );
88
1514
  });
89
- }
90
- const accessToken = getAccessToken();
91
- const { accessTokenExpiredAt, redirectUri } = tokenStorage().getData();
92
- const oauthCode = getQuery("code") || "";
93
- const keepLogin = !!getQuery("keep_login");
94
- refreshing.value = true;
95
- const whiteList = JSON.parse(sessionStorage.getItem("noLogin-page")) || [];
96
- if ((!accessToken || accessTokenExpiredAt === 0) && microAppName !== "oauth" && !whiteList.includes(location.pathname)) {
97
- const needLogin = !oauthCode;
98
- if (needLogin) {
99
- return login({ ...getTokenParams, redirect_uri: real_uri });
100
- }
101
- }
102
- const tokenExpired = accessTokenExpiredAt > 0 && +/* @__PURE__ */ new Date() + 60 * 1e3 > accessTokenExpiredAt;
103
- if (tokenExpired)
104
- return refreshToken(getTokenParams);
105
- if (accessToken)
106
- return accessToken;
107
- if (!oauthCode) {
108
- refreshing.value = false;
1515
+ const t = fe(), { accessTokenExpiredAt: n, redirectUri: r } = F().getData(), s = Te("code") || "", o = !!Te("keep_login");
1516
+ x.value = !0;
1517
+ const i = JSON.parse(sessionStorage.getItem("noLogin-page")) || [];
1518
+ if ((!t || n === 0) && bn !== "oauth" && !i.includes(location.pathname) && !s)
1519
+ return le({ ...H, redirect_uri: te });
1520
+ if (n > 0 && +/* @__PURE__ */ new Date() + 60 * 1e3 > n)
1521
+ return Rn(H);
1522
+ if (t)
1523
+ return t;
1524
+ if (!s) {
1525
+ x.value = !1;
109
1526
  return;
110
1527
  }
111
1528
  try {
112
- const accessToken2 = await getTokenFromCode(oauthCode, getTokenParams, redirectUri, keepLogin);
113
- refreshing.value = false;
114
- return accessToken2;
1529
+ const f = await gn(s, H, r, o);
1530
+ return x.value = !1, f;
115
1531
  } catch {
116
- refreshing.value = false;
1532
+ x.value = !1;
117
1533
  }
118
- };
119
- const login = (params) => {
120
- const { baseURL: baseURL2, ssoLocale } = getConfig();
121
- params.logout = "true";
122
- if (ssoLocale)
123
- params.locale = "locale";
124
- const query = Object.keys(params).filter((key) => key !== "client_secret").map((key) => `${key}=${params[key]}`).join("&");
125
- const ssoUrl = `${baseURL2}${apis.oauth}?${query}`;
126
- removeAccessToken();
127
- sessionStorage.clear();
128
- tokenStorage().save({ redirectUri: params.redirect_uri });
129
- window.__isAutoCloseApp = false;
130
- location.replace(ssoUrl);
131
- };
132
- const refreshToken = async (params) => {
133
- const { baseURL: baseURL2 } = getConfig();
134
- const { refreshToken: refreshToken2, redirectUri } = tokenStorage().getData();
135
- params.redirect_uri = redirectUri;
1534
+ }, le = (e) => {
1535
+ const { baseURL: t, ssoLocale: n } = ne();
1536
+ e.logout = "true", n && (e.locale = "locale");
1537
+ const r = Object.keys(e).filter((o) => o !== "client_secret").map((o) => `${o}=${e[o]}`).join("&"), s = `${t}${ue.oauth}?${r}`;
1538
+ Ye(), sessionStorage.clear(), F().save({ redirectUri: e.redirect_uri }), window.__isAutoCloseApp = !1, location.replace(s);
1539
+ }, Rn = async (e) => {
1540
+ const { baseURL: t } = ne(), { refreshToken: n, redirectUri: r } = F().getData();
1541
+ e.redirect_uri = r;
136
1542
  try {
137
- const tokenRes = await axios.create().post(apis.token, {
138
- baseURL: baseURL2,
1543
+ const s = await y.create().post(ue.token, {
1544
+ baseURL: t,
139
1545
  params: {
140
- refresh_token: refreshToken2,
1546
+ refresh_token: n,
141
1547
  grant_type: "refresh_token",
142
- client_id: params.client_id,
143
- client_secret: params.client_secret,
144
- redirect_uri: redirectUri
1548
+ client_id: e.client_id,
1549
+ client_secret: e.client_secret,
1550
+ redirect_uri: r
145
1551
  }
146
- });
147
- const { access_token, refresh_token, expires_in } = tokenRes.data;
148
- const tokenData = {
149
- accessToken: access_token,
150
- accessTokenExpiredAt: +/* @__PURE__ */ new Date() + expires_in * 1e3,
151
- refreshToken: refresh_token,
152
- info: tokenRes.data
1552
+ }), { access_token: o, refresh_token: i, expires_in: c } = s.data, f = {
1553
+ accessToken: o,
1554
+ accessTokenExpiredAt: +/* @__PURE__ */ new Date() + c * 1e3,
1555
+ refreshToken: i,
1556
+ info: s.data
153
1557
  };
154
- setAccessToken(access_token, tokenRes.data);
155
- tokenStorage().save(tokenData);
156
- setPersonalInfo(access_token);
157
- return access_token;
1558
+ return Oe(o, s.data), F().save(f), Ae(o), o;
158
1559
  } catch {
159
- return login(params);
1560
+ return le(e);
160
1561
  }
161
- };
162
- const tokenStorage = () => {
163
- const accessTokenKey = "accessToken";
164
- const accessTokenExpiredAtKey = "accessTokenExpiredAt";
165
- const refreshTokenKey = "refreshToken";
166
- const tokenInfoKey = "tokenInfo";
167
- const redirectUriKey = "redirectUri";
1562
+ }, F = () => {
1563
+ const e = "accessToken", t = "accessTokenExpiredAt", n = "refreshToken", r = "tokenInfo", s = "redirectUri";
168
1564
  return {
169
- getData: () => {
170
- return {
171
- accessToken: sessionStorage.getItem(accessTokenKey) || "",
172
- accessTokenExpiredAt: Number(sessionStorage.getItem(accessTokenExpiredAtKey) || "0"),
173
- refreshToken: sessionStorage.getItem(refreshTokenKey) || "",
174
- info: JSON.parse(
175
- sessionStorage.getItem(tokenInfoKey) === "undefined" ? "{}" : sessionStorage.getItem(tokenInfoKey) || "{}"
176
- ),
177
- redirectUri: sessionStorage.getItem(redirectUriKey) || ""
178
- };
179
- },
180
- save: (data) => {
181
- const accessTokenExpiredAt = data.accessTokenExpiredAt || 0;
182
- sessionStorage.setItem(accessTokenKey, data.accessToken || "");
183
- sessionStorage.setItem(accessTokenExpiredAtKey, accessTokenExpiredAt.toString());
184
- sessionStorage.setItem(refreshTokenKey, data.refreshToken || "");
185
- sessionStorage.setItem(tokenInfoKey, JSON.stringify(data.info || {}));
186
- if (data.redirectUri)
187
- sessionStorage.setItem(redirectUriKey, data.redirectUri || "");
188
- setProcessEngineToken(data);
1565
+ getData: () => ({
1566
+ accessToken: sessionStorage.getItem(e) || "",
1567
+ accessTokenExpiredAt: Number(sessionStorage.getItem(t) || "0"),
1568
+ refreshToken: sessionStorage.getItem(n) || "",
1569
+ info: JSON.parse(
1570
+ sessionStorage.getItem(r) === "undefined" ? "{}" : sessionStorage.getItem(r) || "{}"
1571
+ ),
1572
+ redirectUri: sessionStorage.getItem(s) || ""
1573
+ }),
1574
+ save: (o) => {
1575
+ const i = o.accessTokenExpiredAt || 0;
1576
+ sessionStorage.setItem(e, o.accessToken || ""), sessionStorage.setItem(t, i.toString()), sessionStorage.setItem(n, o.refreshToken || ""), sessionStorage.setItem(r, JSON.stringify(o.info || {})), o.redirectUri && sessionStorage.setItem(s, o.redirectUri || ""), et(o);
189
1577
  },
190
1578
  remove: () => {
191
- sessionStorage.removeItem(accessTokenKey);
192
- sessionStorage.removeItem(accessTokenExpiredAtKey);
193
- sessionStorage.removeItem(refreshTokenKey);
194
- sessionStorage.removeItem(tokenInfoKey);
195
- sessionStorage.removeItem(redirectUriKey);
1579
+ sessionStorage.removeItem(e), sessionStorage.removeItem(t), sessionStorage.removeItem(n), sessionStorage.removeItem(r), sessionStorage.removeItem(s);
196
1580
  }
197
1581
  };
198
1582
  };
199
-
200
- export { getQuery, getToken, getTokenFromCode, getTokenParams, login, real_uri, tokenStorage };
1583
+ export {
1584
+ Te as getQuery,
1585
+ Pn as getToken,
1586
+ gn as getTokenFromCode,
1587
+ H as getTokenParams,
1588
+ le as login,
1589
+ te as real_uri,
1590
+ F as tokenStorage
1591
+ };