@das-fed/utils 7.0.4 → 7.0.5-alias.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/api-services/i18n/index.js.gz +0 -0
  2. package/api-services/index.js +560 -541
  3. package/api-services/index.js.gz +0 -0
  4. package/api-services/modules/app-manage/index.js +834 -833
  5. package/api-services/modules/app-manage/index.js.gz +0 -0
  6. package/api-services/modules/authentication/index.js +880 -843
  7. package/api-services/modules/authentication/index.js.gz +0 -0
  8. package/api-services/modules/bems/index.js +867 -830
  9. package/api-services/modules/bems/index.js.gz +0 -0
  10. package/api-services/modules/contract/index.js +350 -331
  11. package/api-services/modules/contract/index.js.gz +0 -0
  12. package/api-services/modules/duty-manage/index.js +356 -337
  13. package/api-services/modules/duty-manage/index.js.gz +0 -0
  14. package/api-services/modules/enterpriseright/index.js +793 -770
  15. package/api-services/modules/enterpriseright/index.js.gz +0 -0
  16. package/api-services/modules/file/index.d.ts +2 -2
  17. package/api-services/modules/file/index.js +346 -3430
  18. package/api-services/modules/file/index.js.gz +0 -0
  19. package/api-services/modules/gateway-edge/index.js +350 -331
  20. package/api-services/modules/gateway-edge/index.js.gz +0 -0
  21. package/api-services/modules/index.js +1022 -985
  22. package/api-services/modules/index.js.gz +0 -0
  23. package/api-services/modules/iot/index.js +865 -846
  24. package/api-services/modules/iot/index.js.gz +0 -0
  25. package/api-services/modules/justauth/index.js +889 -888
  26. package/api-services/modules/justauth/index.js.gz +0 -0
  27. package/api-services/modules/knowledge/index.js +834 -833
  28. package/api-services/modules/knowledge/index.js.gz +0 -0
  29. package/api-services/modules/link/index.js +350 -331
  30. package/api-services/modules/link/index.js.gz +0 -0
  31. package/api-services/modules/permission/index.js +350 -331
  32. package/api-services/modules/permission/index.js.gz +0 -0
  33. package/api-services/modules/platformManage/index.js +350 -331
  34. package/api-services/modules/platformManage/index.js.gz +0 -0
  35. package/api-services/modules/portal/index.js +350 -331
  36. package/api-services/modules/portal/index.js.gz +0 -0
  37. package/api-services/modules/space-manage/index.js +834 -833
  38. package/api-services/modules/space-manage/index.js.gz +0 -0
  39. package/api-services/modules/super-admin/index.js +867 -830
  40. package/api-services/modules/super-admin/index.js.gz +0 -0
  41. package/api-services/modules/supplier/index.js +866 -829
  42. package/api-services/modules/supplier/index.js.gz +0 -0
  43. package/api-services/modules/supplychain-manage/index.js +350 -331
  44. package/api-services/modules/supplychain-manage/index.js.gz +0 -0
  45. package/api-services/modules/systemConfiguration/index.js +880 -843
  46. package/api-services/modules/systemConfiguration/index.js.gz +0 -0
  47. package/api-services/modules/tool/index.js +350 -331
  48. package/api-services/modules/tool/index.js.gz +0 -0
  49. package/api-services/src/create-service/index.js +712 -697
  50. package/api-services/src/create-service/index.js.gz +0 -0
  51. package/common-info/getInfoFromUrl/index.js.gz +0 -0
  52. package/common-info/index.d.ts +1 -1
  53. package/common-info/index.js +13 -12
  54. package/common-info/index.js.gz +0 -0
  55. package/common-info/set-personal-info/index.d.ts +1 -1
  56. package/common-info/set-personal-info/index.js +253 -237
  57. package/common-info/set-personal-info/index.js.gz +0 -0
  58. package/common-info/type.d.ts +2 -0
  59. package/common-tools/extract-file-name/index.js +566 -550
  60. package/common-tools/extract-file-name/index.js.gz +0 -0
  61. package/common-tools/get-url-params/index.d.ts +7 -0
  62. package/common-tools/get-url-params/index.js +45 -38
  63. package/common-tools/get-url-params/index.js.gz +0 -0
  64. package/common-tools/obj-tools/index.js +1 -1
  65. package/common-tools/platform-tools/index.d.ts +8 -3
  66. package/common-tools/platform-tools/index.js +35 -16
  67. package/common-tools/platform-tools/index.js.gz +0 -0
  68. package/create-api-service/index.js +849 -848
  69. package/create-api-service/index.js.gz +0 -0
  70. package/create-api-service/sso/authorizer.d.ts +1 -0
  71. package/create-api-service/sso/index.d.ts +9 -7
  72. package/create-api-service/sso/index.js +848 -757
  73. package/create-api-service/sso/index.js.gz +0 -0
  74. package/create-api-service/sso/utils.d.ts +2 -0
  75. package/curring-http/index.js +582 -566
  76. package/curring-http/index.js.gz +0 -0
  77. package/directive/auth/index.js.gz +0 -0
  78. package/esm-map.json +3 -1
  79. package/hooks/use-get-auth/index.js.gz +0 -0
  80. package/nextTiken/index.js.gz +0 -0
  81. package/package.json +54 -49
  82. package/pinyin-first-character/index.js.gz +0 -0
  83. package/process-engine-info/index.js +8 -7
  84. package/style/index.js +1 -1
  85. package/style/index.js.gz +0 -0
  86. package/token-tools/index.d.ts +2 -1
  87. package/token-tools/index.js +80 -8
  88. package/token-tools/index.js.gz +0 -0
  89. package/use-low-code/index.js.gz +0 -0
  90. package/vue/hooks/use-model-value/index.d.ts +5 -1
  91. package/webSocket-service/index.js.gz +0 -0
@@ -1,3450 +1,322 @@
1
- import { setI18nRule as oo, currentLang as ao, t as C } from "@das-fed/web/packages/i18n/index";
2
- import { curringHttp as io } from "@das-fed/utils/curring-http";
3
- import { getToken as so, getQuery as lo, login as co, real_uri as uo, getTokenParams as fo } from "@das-fed/utils/create-api-service/sso";
4
- import et from "dayjs";
5
- import po from "dayjs/plugin/utc";
6
- import yo from "dayjs/plugin/timezone";
7
- import { getProjectInfo as ho, getInstanceInfo as mo } from "@das-fed/utils/common-info";
8
- import { getAccessToken as go } from "@das-fed/utils/token-tools";
9
- import { getConfig as Ke } from "@das-fed/utils/config";
10
- import { extractFilename as ur } from "@das-fed/utils/common-tools";
11
- import { ref as G } from "vue";
12
- function tn(t, e) {
13
- return function() {
14
- return t.apply(e, arguments);
15
- };
16
- }
17
- const { toString: vo } = Object.prototype, { getPrototypeOf: Xt } = Object, tt = /* @__PURE__ */ ((t) => (e) => {
18
- const n = vo.call(e);
19
- return t[n] || (t[n] = n.slice(8, -1).toLowerCase());
20
- })(/* @__PURE__ */ Object.create(null)), Q = (t) => (t = t.toLowerCase(), (e) => tt(e) === t), rt = (t) => (e) => typeof e === t, { isArray: be } = Array, Ce = rt("undefined");
21
- function wo(t) {
22
- return t !== null && !Ce(t) && t.constructor !== null && !Ce(t.constructor) && H(t.constructor.isBuffer) && t.constructor.isBuffer(t);
23
- }
24
- const rn = Q("ArrayBuffer");
25
- function bo(t) {
26
- let e;
27
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && rn(t.buffer), e;
28
- }
29
- const So = rt("string"), H = rt("function"), nn = rt("number"), nt = (t) => t !== null && typeof t == "object", Eo = (t) => t === !0 || t === !1, qe = (t) => {
30
- if (tt(t) !== "object")
31
- return !1;
32
- const e = Xt(t);
33
- return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t);
34
- }, Ao = Q("Date"), Oo = Q("File"), Ro = Q("Blob"), Po = Q("FileList"), xo = (t) => nt(t) && H(t.pipe), To = (t) => {
35
- let e;
36
- return t && (typeof FormData == "function" && t instanceof FormData || H(t.append) && ((e = tt(t)) === "formdata" || // detect form-data instance
37
- e === "object" && H(t.toString) && t.toString() === "[object FormData]"));
38
- }, Co = Q("URLSearchParams"), [_o, $o, No, Fo] = ["ReadableStream", "Request", "Response", "Headers"].map(Q), Do = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
39
- function $e(t, e, { allOwnKeys: n = !1 } = {}) {
40
- if (t === null || typeof t > "u")
41
- return;
42
- let r, o;
43
- if (typeof t != "object" && (t = [t]), be(t))
44
- for (r = 0, o = t.length; r < o; r++)
45
- e.call(null, t[r], r, t);
46
- else {
47
- const a = n ? Object.getOwnPropertyNames(t) : Object.keys(t), i = a.length;
48
- let s;
49
- for (r = 0; r < i; r++)
50
- s = a[r], e.call(null, t[s], s, t);
51
- }
52
- }
53
- function on(t, e) {
54
- e = e.toLowerCase();
55
- const n = Object.keys(t);
56
- let r = n.length, o;
57
- for (; r-- > 0; )
58
- if (o = n[r], e === o.toLowerCase())
59
- return o;
60
- return null;
61
- }
62
- const le = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, an = (t) => !Ce(t) && t !== le;
63
- function Bt() {
64
- const { caseless: t } = an(this) && this || {}, e = {}, n = (r, o) => {
65
- const a = t && on(e, o) || o;
66
- qe(e[a]) && qe(r) ? e[a] = Bt(e[a], r) : qe(r) ? e[a] = Bt({}, r) : be(r) ? e[a] = r.slice() : e[a] = r;
67
- };
68
- for (let r = 0, o = arguments.length; r < o; r++)
69
- arguments[r] && $e(arguments[r], n);
70
- return e;
71
- }
72
- const Io = (t, e, n, { allOwnKeys: r } = {}) => ($e(e, (o, a) => {
73
- n && H(o) ? t[a] = tn(o, n) : t[a] = o;
74
- }, { allOwnKeys: r }), t), Lo = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), Mo = (t, e, n, r) => {
75
- t.prototype = Object.create(e.prototype, r), t.prototype.constructor = t, Object.defineProperty(t, "super", {
76
- value: e.prototype
77
- }), n && Object.assign(t.prototype, n);
78
- }, Bo = (t, e, n, r) => {
79
- let o, a, i;
80
- const s = {};
81
- if (e = e || {}, t == null) return e;
82
- do {
83
- for (o = Object.getOwnPropertyNames(t), a = o.length; a-- > 0; )
84
- i = o[a], (!r || r(i, t, e)) && !s[i] && (e[i] = t[i], s[i] = !0);
85
- t = n !== !1 && Xt(t);
86
- } while (t && (!n || n(t, e)) && t !== Object.prototype);
87
- return e;
88
- }, Uo = (t, e, n) => {
89
- t = String(t), (n === void 0 || n > t.length) && (n = t.length), n -= e.length;
90
- const r = t.indexOf(e, n);
91
- return r !== -1 && r === n;
92
- }, ko = (t) => {
93
- if (!t) return null;
94
- if (be(t)) return t;
95
- let e = t.length;
96
- if (!nn(e)) return null;
97
- const n = new Array(e);
98
- for (; e-- > 0; )
99
- n[e] = t[e];
100
- return n;
101
- }, qo = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Xt(Uint8Array)), jo = (t, e) => {
102
- const r = (t && t[Symbol.iterator]).call(t);
103
- let o;
104
- for (; (o = r.next()) && !o.done; ) {
105
- const a = o.value;
106
- e.call(t, a[0], a[1]);
107
- }
108
- }, Ho = (t, e) => {
109
- let n;
110
- const r = [];
111
- for (; (n = t.exec(e)) !== null; )
112
- r.push(n);
113
- return r;
114
- }, zo = Q("HTMLFormElement"), Wo = (t) => t.toLowerCase().replace(
115
- /[-_\s]([a-z\d])(\w*)/g,
116
- function(n, r, o) {
117
- return r.toUpperCase() + o;
118
- }
119
- ), fr = (({ hasOwnProperty: t }) => (e, n) => t.call(e, n))(Object.prototype), Go = Q("RegExp"), sn = (t, e) => {
120
- const n = Object.getOwnPropertyDescriptors(t), r = {};
121
- $e(n, (o, a) => {
122
- let i;
123
- (i = e(o, a, t)) !== !1 && (r[a] = i || o);
124
- }), Object.defineProperties(t, r);
125
- }, Ko = (t) => {
126
- sn(t, (e, n) => {
127
- if (H(t) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
128
- return !1;
129
- const r = t[n];
130
- if (H(r)) {
131
- if (e.enumerable = !1, "writable" in e) {
132
- e.writable = !1;
133
- return;
134
- }
135
- e.set || (e.set = () => {
136
- throw Error("Can not rewrite read-only method '" + n + "'");
137
- });
138
- }
139
- });
140
- }, Jo = (t, e) => {
141
- const n = {}, r = (o) => {
142
- o.forEach((a) => {
143
- n[a] = !0;
144
- });
145
- };
146
- return be(t) ? r(t) : r(String(t).split(e)), n;
147
- }, Vo = () => {
148
- }, Qo = (t, e) => t != null && Number.isFinite(t = +t) ? t : e, dt = "abcdefghijklmnopqrstuvwxyz", pr = "0123456789", ln = {
149
- DIGIT: pr,
150
- ALPHA: dt,
151
- ALPHA_DIGIT: dt + dt.toUpperCase() + pr
152
- }, Xo = (t = 16, e = ln.ALPHA_DIGIT) => {
153
- let n = "";
154
- const { length: r } = e;
155
- for (; t--; )
156
- n += e[Math.random() * r | 0];
157
- return n;
158
- };
159
- function Yo(t) {
160
- return !!(t && H(t.append) && t[Symbol.toStringTag] === "FormData" && t[Symbol.iterator]);
161
- }
162
- const Zo = (t) => {
163
- const e = new Array(10), n = (r, o) => {
164
- if (nt(r)) {
165
- if (e.indexOf(r) >= 0)
166
- return;
167
- if (!("toJSON" in r)) {
168
- e[o] = r;
169
- const a = be(r) ? [] : {};
170
- return $e(r, (i, s) => {
171
- const u = n(i, o + 1);
172
- !Ce(u) && (a[s] = u);
173
- }), e[o] = void 0, a;
174
- }
175
- }
176
- return r;
177
- };
178
- return n(t, 0);
179
- }, ea = Q("AsyncFunction"), ta = (t) => t && (nt(t) || H(t)) && H(t.then) && H(t.catch), cn = ((t, e) => t ? setImmediate : e ? ((n, r) => (le.addEventListener("message", ({ source: o, data: a }) => {
180
- o === le && a === n && r.length && r.shift()();
181
- }, !1), (o) => {
182
- r.push(o), le.postMessage(n, "*");
183
- }))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
184
- typeof setImmediate == "function",
185
- H(le.postMessage)
186
- ), ra = typeof queueMicrotask < "u" ? queueMicrotask.bind(le) : typeof process < "u" && process.nextTick || cn, f = {
187
- isArray: be,
188
- isArrayBuffer: rn,
189
- isBuffer: wo,
190
- isFormData: To,
191
- isArrayBufferView: bo,
192
- isString: So,
193
- isNumber: nn,
194
- isBoolean: Eo,
195
- isObject: nt,
196
- isPlainObject: qe,
197
- isReadableStream: _o,
198
- isRequest: $o,
199
- isResponse: No,
200
- isHeaders: Fo,
201
- isUndefined: Ce,
202
- isDate: Ao,
203
- isFile: Oo,
204
- isBlob: Ro,
205
- isRegExp: Go,
206
- isFunction: H,
207
- isStream: xo,
208
- isURLSearchParams: Co,
209
- isTypedArray: qo,
210
- isFileList: Po,
211
- forEach: $e,
212
- merge: Bt,
213
- extend: Io,
214
- trim: Do,
215
- stripBOM: Lo,
216
- inherits: Mo,
217
- toFlatObject: Bo,
218
- kindOf: tt,
219
- kindOfTest: Q,
220
- endsWith: Uo,
221
- toArray: ko,
222
- forEachEntry: jo,
223
- matchAll: Ho,
224
- isHTMLForm: zo,
225
- hasOwnProperty: fr,
226
- hasOwnProp: fr,
227
- // an alias to avoid ESLint no-prototype-builtins detection
228
- reduceDescriptors: sn,
229
- freezeMethods: Ko,
230
- toObjectSet: Jo,
231
- toCamelCase: Wo,
232
- noop: Vo,
233
- toFiniteNumber: Qo,
234
- findKey: on,
235
- global: le,
236
- isContextDefined: an,
237
- ALPHABET: ln,
238
- generateString: Xo,
239
- isSpecCompliantForm: Yo,
240
- toJSONObject: Zo,
241
- isAsyncFn: ea,
242
- isThenable: ta,
243
- setImmediate: cn,
244
- asap: ra
245
- };
246
- function b(t, e, n, r, o) {
247
- Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
248
- }
249
- f.inherits(b, Error, {
250
- toJSON: function() {
251
- return {
252
- // Standard
253
- message: this.message,
254
- name: this.name,
255
- // Microsoft
256
- description: this.description,
257
- number: this.number,
258
- // Mozilla
259
- fileName: this.fileName,
260
- lineNumber: this.lineNumber,
261
- columnNumber: this.columnNumber,
262
- stack: this.stack,
263
- // Axios
264
- config: f.toJSONObject(this.config),
265
- code: this.code,
266
- status: this.status
267
- };
268
- }
269
- });
270
- const un = b.prototype, fn = {};
271
- [
272
- "ERR_BAD_OPTION_VALUE",
273
- "ERR_BAD_OPTION",
274
- "ECONNABORTED",
275
- "ETIMEDOUT",
276
- "ERR_NETWORK",
277
- "ERR_FR_TOO_MANY_REDIRECTS",
278
- "ERR_DEPRECATED",
279
- "ERR_BAD_RESPONSE",
280
- "ERR_BAD_REQUEST",
281
- "ERR_CANCELED",
282
- "ERR_NOT_SUPPORT",
283
- "ERR_INVALID_URL"
284
- // eslint-disable-next-line func-names
285
- ].forEach((t) => {
286
- fn[t] = { value: t };
287
- });
288
- Object.defineProperties(b, fn);
289
- Object.defineProperty(un, "isAxiosError", { value: !0 });
290
- b.from = (t, e, n, r, o, a) => {
291
- const i = Object.create(un);
292
- return f.toFlatObject(t, i, function(u) {
293
- return u !== Error.prototype;
294
- }, (s) => s !== "isAxiosError"), b.call(i, t.message, e, n, r, o), i.cause = t, i.name = t.name, a && Object.assign(i, a), i;
295
- };
296
- const na = null;
297
- function Ut(t) {
298
- return f.isPlainObject(t) || f.isArray(t);
299
- }
300
- function pn(t) {
301
- return f.endsWith(t, "[]") ? t.slice(0, -2) : t;
302
- }
303
- function dr(t, e, n) {
304
- return t ? t.concat(e).map(function(o, a) {
305
- return o = pn(o), !n && a ? "[" + o + "]" : o;
306
- }).join(n ? "." : "") : e;
307
- }
308
- function oa(t) {
309
- return f.isArray(t) && !t.some(Ut);
310
- }
311
- const aa = f.toFlatObject(f, {}, null, function(e) {
312
- return /^is[A-Z]/.test(e);
313
- });
314
- function ot(t, e, n) {
315
- if (!f.isObject(t))
316
- throw new TypeError("target must be an object");
317
- e = e || new FormData(), n = f.toFlatObject(n, {
318
- metaTokens: !0,
319
- dots: !1,
320
- indexes: !1
321
- }, !1, function(m, h) {
322
- return !f.isUndefined(h[m]);
323
- });
324
- const r = n.metaTokens, o = n.visitor || c, a = n.dots, i = n.indexes, u = (n.Blob || typeof Blob < "u" && Blob) && f.isSpecCompliantForm(e);
325
- if (!f.isFunction(o))
326
- throw new TypeError("visitor must be a function");
327
- function l(y) {
328
- if (y === null) return "";
329
- if (f.isDate(y))
330
- return y.toISOString();
331
- if (!u && f.isBlob(y))
332
- throw new b("Blob is not supported. Use a Buffer instead.");
333
- return f.isArrayBuffer(y) || f.isTypedArray(y) ? u && typeof Blob == "function" ? new Blob([y]) : Buffer.from(y) : y;
334
- }
335
- function c(y, m, h) {
336
- let E = y;
337
- if (y && !h && typeof y == "object") {
338
- if (f.endsWith(m, "{}"))
339
- m = r ? m : m.slice(0, -2), y = JSON.stringify(y);
340
- else if (f.isArray(y) && oa(y) || (f.isFileList(y) || f.endsWith(m, "[]")) && (E = f.toArray(y)))
341
- return m = pn(m), E.forEach(function(v, F) {
342
- !(f.isUndefined(v) || v === null) && e.append(
343
- // eslint-disable-next-line no-nested-ternary
344
- i === !0 ? dr([m], F, a) : i === null ? m : m + "[]",
345
- l(v)
346
- );
347
- }), !1;
348
- }
349
- return Ut(y) ? !0 : (e.append(dr(h, m, a), l(y)), !1);
350
- }
351
- const p = [], d = Object.assign(aa, {
352
- defaultVisitor: c,
353
- convertValue: l,
354
- isVisitable: Ut
355
- });
356
- function g(y, m) {
357
- if (!f.isUndefined(y)) {
358
- if (p.indexOf(y) !== -1)
359
- throw Error("Circular reference detected in " + m.join("."));
360
- p.push(y), f.forEach(y, function(E, R) {
361
- (!(f.isUndefined(E) || E === null) && o.call(
362
- e,
363
- E,
364
- f.isString(R) ? R.trim() : R,
365
- m,
366
- d
367
- )) === !0 && g(E, m ? m.concat(R) : [R]);
368
- }), p.pop();
369
- }
370
- }
371
- if (!f.isObject(t))
372
- throw new TypeError("data must be an object");
373
- return g(t), e;
374
- }
375
- function yr(t) {
376
- const e = {
377
- "!": "%21",
378
- "'": "%27",
379
- "(": "%28",
380
- ")": "%29",
381
- "~": "%7E",
382
- "%20": "+",
383
- "%00": "\0"
384
- };
385
- return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(r) {
386
- return e[r];
387
- });
388
- }
389
- function Yt(t, e) {
390
- this._pairs = [], t && ot(t, this, e);
391
- }
392
- const dn = Yt.prototype;
393
- dn.append = function(e, n) {
394
- this._pairs.push([e, n]);
395
- };
396
- dn.toString = function(e) {
397
- const n = e ? function(r) {
398
- return e.call(this, r, yr);
399
- } : yr;
400
- return this._pairs.map(function(o) {
401
- return n(o[0]) + "=" + n(o[1]);
402
- }, "").join("&");
403
- };
404
- function ia(t) {
405
- return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
406
- }
407
- function yn(t, e, n) {
408
- if (!e)
409
- return t;
410
- const r = n && n.encode || ia;
411
- f.isFunction(n) && (n = {
412
- serialize: n
413
- });
414
- const o = n && n.serialize;
415
- let a;
416
- if (o ? a = o(e, n) : a = f.isURLSearchParams(e) ? e.toString() : new Yt(e, n).toString(r), a) {
417
- const i = t.indexOf("#");
418
- i !== -1 && (t = t.slice(0, i)), t += (t.indexOf("?") === -1 ? "?" : "&") + a;
419
- }
420
- return t;
421
- }
422
- class hr {
423
- constructor() {
424
- this.handlers = [];
425
- }
426
- /**
427
- * Add a new interceptor to the stack
428
- *
429
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
430
- * @param {Function} rejected The function to handle `reject` for a `Promise`
431
- *
432
- * @return {Number} An ID used to remove interceptor later
433
- */
434
- use(e, n, r) {
435
- return this.handlers.push({
436
- fulfilled: e,
437
- rejected: n,
438
- synchronous: r ? r.synchronous : !1,
439
- runWhen: r ? r.runWhen : null
440
- }), this.handlers.length - 1;
441
- }
442
- /**
443
- * Remove an interceptor from the stack
444
- *
445
- * @param {Number} id The ID that was returned by `use`
446
- *
447
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
448
- */
449
- eject(e) {
450
- this.handlers[e] && (this.handlers[e] = null);
451
- }
452
- /**
453
- * Clear all interceptors from the stack
454
- *
455
- * @returns {void}
456
- */
457
- clear() {
458
- this.handlers && (this.handlers = []);
459
- }
460
- /**
461
- * Iterate over all the registered interceptors
462
- *
463
- * This method is particularly useful for skipping over any
464
- * interceptors that may have become `null` calling `eject`.
465
- *
466
- * @param {Function} fn The function to call for each interceptor
467
- *
468
- * @returns {void}
469
- */
470
- forEach(e) {
471
- f.forEach(this.handlers, function(r) {
472
- r !== null && e(r);
473
- });
474
- }
475
- }
476
- const hn = {
477
- silentJSONParsing: !0,
478
- forcedJSONParsing: !0,
479
- clarifyTimeoutError: !1
480
- }, sa = typeof URLSearchParams < "u" ? URLSearchParams : Yt, la = typeof FormData < "u" ? FormData : null, ca = typeof Blob < "u" ? Blob : null, ua = {
481
- isBrowser: !0,
482
- classes: {
483
- URLSearchParams: sa,
484
- FormData: la,
485
- Blob: ca
486
- },
487
- protocols: ["http", "https", "file", "blob", "url", "data"]
488
- }, Zt = typeof window < "u" && typeof document < "u", kt = typeof navigator == "object" && navigator || void 0, fa = Zt && (!kt || ["ReactNative", "NativeScript", "NS"].indexOf(kt.product) < 0), pa = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
489
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", da = Zt && window.location.href || "http://localhost", ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
490
- __proto__: null,
491
- hasBrowserEnv: Zt,
492
- hasStandardBrowserEnv: fa,
493
- hasStandardBrowserWebWorkerEnv: pa,
494
- navigator: kt,
495
- origin: da
496
- }, Symbol.toStringTag, { value: "Module" })), B = {
497
- ...ya,
498
- ...ua
499
- };
500
- function ha(t, e) {
501
- return ot(t, new B.classes.URLSearchParams(), Object.assign({
502
- visitor: function(n, r, o, a) {
503
- return B.isNode && f.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : a.defaultVisitor.apply(this, arguments);
504
- }
505
- }, e));
506
- }
507
- function ma(t) {
508
- return f.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
509
- }
510
- function ga(t) {
511
- const e = {}, n = Object.keys(t);
512
- let r;
513
- const o = n.length;
514
- let a;
515
- for (r = 0; r < o; r++)
516
- a = n[r], e[a] = t[a];
517
- return e;
518
- }
519
- function mn(t) {
520
- function e(n, r, o, a) {
521
- let i = n[a++];
522
- if (i === "__proto__") return !0;
523
- const s = Number.isFinite(+i), u = a >= n.length;
524
- return i = !i && f.isArray(o) ? o.length : i, u ? (f.hasOwnProp(o, i) ? o[i] = [o[i], r] : o[i] = r, !s) : ((!o[i] || !f.isObject(o[i])) && (o[i] = []), e(n, r, o[i], a) && f.isArray(o[i]) && (o[i] = ga(o[i])), !s);
525
- }
526
- if (f.isFormData(t) && f.isFunction(t.entries)) {
527
- const n = {};
528
- return f.forEachEntry(t, (r, o) => {
529
- e(ma(r), o, n, 0);
530
- }), n;
531
- }
532
- return null;
533
- }
534
- function va(t, e, n) {
535
- if (f.isString(t))
536
- try {
537
- return (e || JSON.parse)(t), f.trim(t);
538
- } catch (r) {
539
- if (r.name !== "SyntaxError")
540
- throw r;
541
- }
542
- return (n || JSON.stringify)(t);
543
- }
544
- const Ne = {
545
- transitional: hn,
546
- adapter: ["xhr", "http", "fetch"],
547
- transformRequest: [function(e, n) {
548
- const r = n.getContentType() || "", o = r.indexOf("application/json") > -1, a = f.isObject(e);
549
- if (a && f.isHTMLForm(e) && (e = new FormData(e)), f.isFormData(e))
550
- return o ? JSON.stringify(mn(e)) : e;
551
- if (f.isArrayBuffer(e) || f.isBuffer(e) || f.isStream(e) || f.isFile(e) || f.isBlob(e) || f.isReadableStream(e))
552
- return e;
553
- if (f.isArrayBufferView(e))
554
- return e.buffer;
555
- if (f.isURLSearchParams(e))
556
- return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
557
- let s;
558
- if (a) {
559
- if (r.indexOf("application/x-www-form-urlencoded") > -1)
560
- return ha(e, this.formSerializer).toString();
561
- if ((s = f.isFileList(e)) || r.indexOf("multipart/form-data") > -1) {
562
- const u = this.env && this.env.FormData;
563
- return ot(
564
- s ? { "files[]": e } : e,
565
- u && new u(),
566
- this.formSerializer
567
- );
568
- }
569
- }
570
- return a || o ? (n.setContentType("application/json", !1), va(e)) : e;
571
- }],
572
- transformResponse: [function(e) {
573
- const n = this.transitional || Ne.transitional, r = n && n.forcedJSONParsing, o = this.responseType === "json";
574
- if (f.isResponse(e) || f.isReadableStream(e))
575
- return e;
576
- if (e && f.isString(e) && (r && !this.responseType || o)) {
577
- const i = !(n && n.silentJSONParsing) && o;
578
- try {
579
- return JSON.parse(e);
580
- } catch (s) {
581
- if (i)
582
- throw s.name === "SyntaxError" ? b.from(s, b.ERR_BAD_RESPONSE, this, null, this.response) : s;
583
- }
584
- }
585
- return e;
586
- }],
587
- /**
588
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
589
- * timeout is not created.
590
- */
591
- timeout: 0,
592
- xsrfCookieName: "XSRF-TOKEN",
593
- xsrfHeaderName: "X-XSRF-TOKEN",
594
- maxContentLength: -1,
595
- maxBodyLength: -1,
596
- env: {
597
- FormData: B.classes.FormData,
598
- Blob: B.classes.Blob
599
- },
600
- validateStatus: function(e) {
601
- return e >= 200 && e < 300;
602
- },
603
- headers: {
604
- common: {
605
- Accept: "application/json, text/plain, */*",
606
- "Content-Type": void 0
607
- }
608
- }
609
- };
610
- f.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
611
- Ne.headers[t] = {};
612
- });
613
- const wa = f.toObjectSet([
614
- "age",
615
- "authorization",
616
- "content-length",
617
- "content-type",
618
- "etag",
619
- "expires",
620
- "from",
621
- "host",
622
- "if-modified-since",
623
- "if-unmodified-since",
624
- "last-modified",
625
- "location",
626
- "max-forwards",
627
- "proxy-authorization",
628
- "referer",
629
- "retry-after",
630
- "user-agent"
631
- ]), ba = (t) => {
632
- const e = {};
633
- let n, r, o;
634
- return t && t.split(`
635
- `).forEach(function(i) {
636
- o = i.indexOf(":"), n = i.substring(0, o).trim().toLowerCase(), r = i.substring(o + 1).trim(), !(!n || e[n] && wa[n]) && (n === "set-cookie" ? e[n] ? e[n].push(r) : e[n] = [r] : e[n] = e[n] ? e[n] + ", " + r : r);
637
- }), e;
638
- }, mr = Symbol("internals");
639
- function Ae(t) {
640
- return t && String(t).trim().toLowerCase();
641
- }
642
- function je(t) {
643
- return t === !1 || t == null ? t : f.isArray(t) ? t.map(je) : String(t);
644
- }
645
- function Sa(t) {
646
- const e = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
647
- let r;
648
- for (; r = n.exec(t); )
649
- e[r[1]] = r[2];
650
- return e;
651
- }
652
- const Ea = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
653
- function yt(t, e, n, r, o) {
654
- if (f.isFunction(r))
655
- return r.call(this, e, n);
656
- if (o && (e = n), !!f.isString(e)) {
657
- if (f.isString(r))
658
- return e.indexOf(r) !== -1;
659
- if (f.isRegExp(r))
660
- return r.test(e);
661
- }
662
- }
663
- function Aa(t) {
664
- return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, n, r) => n.toUpperCase() + r);
665
- }
666
- function Oa(t, e) {
667
- const n = f.toCamelCase(" " + e);
668
- ["get", "set", "has"].forEach((r) => {
669
- Object.defineProperty(t, r + n, {
670
- value: function(o, a, i) {
671
- return this[r].call(this, e, o, a, i);
672
- },
673
- configurable: !0
674
- });
675
- });
676
- }
677
- let q = class {
678
- constructor(e) {
679
- e && this.set(e);
680
- }
681
- set(e, n, r) {
682
- const o = this;
683
- function a(s, u, l) {
684
- const c = Ae(u);
685
- if (!c)
686
- throw new Error("header name must be a non-empty string");
687
- const p = f.findKey(o, c);
688
- (!p || o[p] === void 0 || l === !0 || l === void 0 && o[p] !== !1) && (o[p || u] = je(s));
689
- }
690
- const i = (s, u) => f.forEach(s, (l, c) => a(l, c, u));
691
- if (f.isPlainObject(e) || e instanceof this.constructor)
692
- i(e, n);
693
- else if (f.isString(e) && (e = e.trim()) && !Ea(e))
694
- i(ba(e), n);
695
- else if (f.isHeaders(e))
696
- for (const [s, u] of e.entries())
697
- a(u, s, r);
698
- else
699
- e != null && a(n, e, r);
700
- return this;
701
- }
702
- get(e, n) {
703
- if (e = Ae(e), e) {
704
- const r = f.findKey(this, e);
705
- if (r) {
706
- const o = this[r];
707
- if (!n)
708
- return o;
709
- if (n === !0)
710
- return Sa(o);
711
- if (f.isFunction(n))
712
- return n.call(this, o, r);
713
- if (f.isRegExp(n))
714
- return n.exec(o);
715
- throw new TypeError("parser must be boolean|regexp|function");
716
- }
717
- }
718
- }
719
- has(e, n) {
720
- if (e = Ae(e), e) {
721
- const r = f.findKey(this, e);
722
- return !!(r && this[r] !== void 0 && (!n || yt(this, this[r], r, n)));
723
- }
724
- return !1;
725
- }
726
- delete(e, n) {
727
- const r = this;
728
- let o = !1;
729
- function a(i) {
730
- if (i = Ae(i), i) {
731
- const s = f.findKey(r, i);
732
- s && (!n || yt(r, r[s], s, n)) && (delete r[s], o = !0);
733
- }
734
- }
735
- return f.isArray(e) ? e.forEach(a) : a(e), o;
736
- }
737
- clear(e) {
738
- const n = Object.keys(this);
739
- let r = n.length, o = !1;
740
- for (; r--; ) {
741
- const a = n[r];
742
- (!e || yt(this, this[a], a, e, !0)) && (delete this[a], o = !0);
743
- }
744
- return o;
745
- }
746
- normalize(e) {
747
- const n = this, r = {};
748
- return f.forEach(this, (o, a) => {
749
- const i = f.findKey(r, a);
750
- if (i) {
751
- n[i] = je(o), delete n[a];
752
- return;
753
- }
754
- const s = e ? Aa(a) : String(a).trim();
755
- s !== a && delete n[a], n[s] = je(o), r[s] = !0;
756
- }), this;
757
- }
758
- concat(...e) {
759
- return this.constructor.concat(this, ...e);
760
- }
761
- toJSON(e) {
762
- const n = /* @__PURE__ */ Object.create(null);
763
- return f.forEach(this, (r, o) => {
764
- r != null && r !== !1 && (n[o] = e && f.isArray(r) ? r.join(", ") : r);
765
- }), n;
766
- }
767
- [Symbol.iterator]() {
768
- return Object.entries(this.toJSON())[Symbol.iterator]();
769
- }
770
- toString() {
771
- return Object.entries(this.toJSON()).map(([e, n]) => e + ": " + n).join(`
772
- `);
773
- }
774
- get [Symbol.toStringTag]() {
775
- return "AxiosHeaders";
776
- }
777
- static from(e) {
778
- return e instanceof this ? e : new this(e);
779
- }
780
- static concat(e, ...n) {
781
- const r = new this(e);
782
- return n.forEach((o) => r.set(o)), r;
783
- }
784
- static accessor(e) {
785
- const r = (this[mr] = this[mr] = {
786
- accessors: {}
787
- }).accessors, o = this.prototype;
788
- function a(i) {
789
- const s = Ae(i);
790
- r[s] || (Oa(o, i), r[s] = !0);
1
+ import { createService } from "@das-fed/utils/create-api-service/index.js";
2
+ import { iotMinio, iotProgress } from "@das-fed/utils/api-services/modules/iot/index.js";
3
+ import { extractFilename } from "@das-fed/utils/common-tools/index.js";
4
+ import { getConfig } from "@das-fed/utils/config/index.js";
5
+ import { ref } from "vue";
6
+ import dayjs from "dayjs";
7
+ import { t } from "@das-fed/web/packages/i18n/index.js";
8
+ let nanoid = (size = 21) => {
9
+ let id = "";
10
+ let bytes = crypto.getRandomValues(new Uint8Array(size));
11
+ while (size--) {
12
+ let byte = bytes[size] & 63;
13
+ if (byte < 36) {
14
+ id += byte.toString(36);
15
+ } else if (byte < 62) {
16
+ id += (byte - 26).toString(36).toUpperCase();
17
+ } else if (byte < 63) {
18
+ id += "_";
19
+ } else {
20
+ id += "-";
791
21
  }
792
- return f.isArray(e) ? e.forEach(a) : a(e), this;
793
22
  }
23
+ return id;
794
24
  };
795
- q.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
796
- f.reduceDescriptors(q.prototype, ({ value: t }, e) => {
797
- let n = e[0].toUpperCase() + e.slice(1);
798
- return {
799
- get: () => t,
800
- set(r) {
801
- this[n] = r;
802
- }
803
- };
25
+ const getMinioToken = iotMinio.get(`token`);
26
+ const importMinio = iotMinio.post(`put-object`, (config) => {
27
+ if (!config.headers) config.headers = {};
28
+ config.headers["Content-Type"] = "multipart/form-data";
29
+ config.responseType = "blob";
30
+ return config;
804
31
  });
805
- f.freezeMethods(q);
806
- function ht(t, e) {
807
- const n = this || Ne, r = e || n, o = q.from(r.headers);
808
- let a = r.data;
809
- return f.forEach(t, function(s) {
810
- a = s.call(n, a, o.normalize(), e ? e.status : void 0);
811
- }), o.normalize(), a;
812
- }
813
- function gn(t) {
814
- return !!(t && t.__CANCEL__);
815
- }
816
- function Se(t, e, n) {
817
- b.call(this, t ?? "canceled", b.ERR_CANCELED, e, n), this.name = "CanceledError";
818
- }
819
- f.inherits(Se, b, {
820
- __CANCEL__: !0
32
+ const importMultiMinio = iotMinio.post(`upload-objects`, (config) => {
33
+ if (!config.headers) config.headers = {};
34
+ config.headers["Content-Type"] = "multipart/form-data";
35
+ config.responseType = "blob";
36
+ return config;
821
37
  });
822
- function vn(t, e, n) {
823
- const r = n.config.validateStatus;
824
- !n.status || !r || r(n.status) ? t(n) : e(new b(
825
- "Request failed with status code " + n.status,
826
- [b.ERR_BAD_REQUEST, b.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
827
- n.config,
828
- n.request,
829
- n
830
- ));
831
- }
832
- function Ra(t) {
833
- const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
834
- return e && e[1] || "";
835
- }
836
- function Pa(t, e) {
837
- t = t || 10;
838
- const n = new Array(t), r = new Array(t);
839
- let o = 0, a = 0, i;
840
- return e = e !== void 0 ? e : 1e3, function(u) {
841
- const l = Date.now(), c = r[a];
842
- i || (i = l), n[o] = u, r[o] = l;
843
- let p = a, d = 0;
844
- for (; p !== o; )
845
- d += n[p++], p = p % t;
846
- if (o = (o + 1) % t, o === a && (a = (a + 1) % t), l - i < e)
847
- return;
848
- const g = c && l - c;
849
- return g ? Math.round(d * 1e3 / g) : void 0;
850
- };
851
- }
852
- function xa(t, e) {
853
- let n = 0, r = 1e3 / e, o, a;
854
- const i = (l, c = Date.now()) => {
855
- n = c, o = null, a && (clearTimeout(a), a = null), t.apply(null, l);
856
- };
857
- return [(...l) => {
858
- const c = Date.now(), p = c - n;
859
- p >= r ? i(l, c) : (o = l, a || (a = setTimeout(() => {
860
- a = null, i(o);
861
- }, r - p)));
862
- }, () => o && i(o)];
863
- }
864
- const Je = (t, e, n = 3) => {
865
- let r = 0;
866
- const o = Pa(50, 250);
867
- return xa((a) => {
868
- const i = a.loaded, s = a.lengthComputable ? a.total : void 0, u = i - r, l = o(u), c = i <= s;
869
- r = i;
870
- const p = {
871
- loaded: i,
872
- total: s,
873
- progress: s ? i / s : void 0,
874
- bytes: u,
875
- rate: l || void 0,
876
- estimated: l && s && c ? (s - i) / l : void 0,
877
- event: a,
878
- lengthComputable: s != null,
879
- [e ? "download" : "upload"]: !0
880
- };
881
- t(p);
882
- }, n);
883
- }, gr = (t, e) => {
884
- const n = t != null;
885
- return [(r) => e[0]({
886
- lengthComputable: n,
887
- total: t,
888
- loaded: r
889
- }), e[1]];
890
- }, vr = (t) => (...e) => f.asap(() => t(...e)), Ta = B.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (n) => (n = new URL(n, B.origin), t.protocol === n.protocol && t.host === n.host && (e || t.port === n.port)))(
891
- new URL(B.origin),
892
- B.navigator && /(msie|trident)/i.test(B.navigator.userAgent)
893
- ) : () => !0, Ca = B.hasStandardBrowserEnv ? (
894
- // Standard browser envs support document.cookie
895
- {
896
- write(t, e, n, r, o, a) {
897
- const i = [t + "=" + encodeURIComponent(e)];
898
- f.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), f.isString(r) && i.push("path=" + r), f.isString(o) && i.push("domain=" + o), a === !0 && i.push("secure"), document.cookie = i.join("; ");
899
- },
900
- read(t) {
901
- const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
902
- return e ? decodeURIComponent(e[3]) : null;
903
- },
904
- remove(t) {
905
- this.write(t, "", Date.now() - 864e5);
906
- }
907
- }
908
- ) : (
909
- // Non-standard browser env (web workers, react-native) lack needed support.
910
- {
911
- write() {
912
- },
913
- read() {
914
- return null;
915
- },
916
- remove() {
917
- }
918
- }
919
- );
920
- function _a(t) {
921
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
922
- }
923
- function $a(t, e) {
924
- return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
925
- }
926
- function wn(t, e) {
927
- return t && !_a(e) ? $a(t, e) : e;
928
- }
929
- const wr = (t) => t instanceof q ? { ...t } : t;
930
- function fe(t, e) {
931
- e = e || {};
932
- const n = {};
933
- function r(l, c, p, d) {
934
- return f.isPlainObject(l) && f.isPlainObject(c) ? f.merge.call({ caseless: d }, l, c) : f.isPlainObject(c) ? f.merge({}, c) : f.isArray(c) ? c.slice() : c;
935
- }
936
- function o(l, c, p, d) {
937
- if (f.isUndefined(c)) {
938
- if (!f.isUndefined(l))
939
- return r(void 0, l, p, d);
940
- } else return r(l, c, p, d);
941
- }
942
- function a(l, c) {
943
- if (!f.isUndefined(c))
944
- return r(void 0, c);
945
- }
946
- function i(l, c) {
947
- if (f.isUndefined(c)) {
948
- if (!f.isUndefined(l))
949
- return r(void 0, l);
950
- } else return r(void 0, c);
951
- }
952
- function s(l, c, p) {
953
- if (p in e)
954
- return r(l, c);
955
- if (p in t)
956
- return r(void 0, l);
957
- }
958
- const u = {
959
- url: a,
960
- method: a,
961
- data: a,
962
- baseURL: i,
963
- transformRequest: i,
964
- transformResponse: i,
965
- paramsSerializer: i,
966
- timeout: i,
967
- timeoutMessage: i,
968
- withCredentials: i,
969
- withXSRFToken: i,
970
- adapter: i,
971
- responseType: i,
972
- xsrfCookieName: i,
973
- xsrfHeaderName: i,
974
- onUploadProgress: i,
975
- onDownloadProgress: i,
976
- decompress: i,
977
- maxContentLength: i,
978
- maxBodyLength: i,
979
- beforeRedirect: i,
980
- transport: i,
981
- httpAgent: i,
982
- httpsAgent: i,
983
- cancelToken: i,
984
- socketPath: i,
985
- responseEncoding: i,
986
- validateStatus: s,
987
- headers: (l, c, p) => o(wr(l), wr(c), p, !0)
38
+ const getTaskProgress = iotProgress.get(`progress`);
39
+ const useFile = () => {
40
+ let showProgressDialog = ref(false);
41
+ let progressTitle = ref("");
42
+ let percent = ref(0);
43
+ let progressStatus = ref("normal");
44
+ let progressLoading = ref(false);
45
+ let progressTimer;
46
+ let progressResult = ref("");
47
+ let errorFileName = ref("");
48
+ let errorFileSize = ref("");
49
+ let errorMessage = ref("");
50
+ let errorImport = ref(false);
51
+ let errorFilePath = ref("");
52
+ let tempErrPathName = "";
53
+ let fileHandleType = ref("");
54
+ let fileInfo;
55
+ const resetStataus = () => {
56
+ errorFileName.value = "";
57
+ errorFileSize.value = "";
58
+ errorMessage.value = "";
59
+ errorImport.value = false;
60
+ errorFilePath.value = "";
988
61
  };
989
- return f.forEach(Object.keys(Object.assign({}, t, e)), function(c) {
990
- const p = u[c] || o, d = p(t[c], e[c], c);
991
- f.isUndefined(d) && p !== s || (n[c] = d);
992
- }), n;
993
- }
994
- const bn = (t) => {
995
- const e = fe({}, t);
996
- let { data: n, withXSRFToken: r, xsrfHeaderName: o, xsrfCookieName: a, headers: i, auth: s } = e;
997
- e.headers = i = q.from(i), e.url = yn(wn(e.baseURL, e.url), t.params, t.paramsSerializer), s && i.set(
998
- "Authorization",
999
- "Basic " + btoa((s.username || "") + ":" + (s.password ? unescape(encodeURIComponent(s.password)) : ""))
1000
- );
1001
- let u;
1002
- if (f.isFormData(n)) {
1003
- if (B.hasStandardBrowserEnv || B.hasStandardBrowserWebWorkerEnv)
1004
- i.setContentType(void 0);
1005
- else if ((u = i.getContentType()) !== !1) {
1006
- const [l, ...c] = u ? u.split(";").map((p) => p.trim()).filter(Boolean) : [];
1007
- i.setContentType([l || "multipart/form-data", ...c].join("; "));
1008
- }
1009
- }
1010
- if (B.hasStandardBrowserEnv && (r && f.isFunction(r) && (r = r(e)), r || r !== !1 && Ta(e.url))) {
1011
- const l = o && a && Ca.read(a);
1012
- l && i.set(o, l);
1013
- }
1014
- return e;
1015
- }, Na = typeof XMLHttpRequest < "u", Fa = Na && function(t) {
1016
- return new Promise(function(n, r) {
1017
- const o = bn(t);
1018
- let a = o.data;
1019
- const i = q.from(o.headers).normalize();
1020
- let { responseType: s, onUploadProgress: u, onDownloadProgress: l } = o, c, p, d, g, y;
1021
- function m() {
1022
- g && g(), y && y(), o.cancelToken && o.cancelToken.unsubscribe(c), o.signal && o.signal.removeEventListener("abort", c);
1023
- }
1024
- let h = new XMLHttpRequest();
1025
- h.open(o.method.toUpperCase(), o.url, !0), h.timeout = o.timeout;
1026
- function E() {
1027
- if (!h)
1028
- return;
1029
- const v = q.from(
1030
- "getAllResponseHeaders" in h && h.getAllResponseHeaders()
1031
- ), x = {
1032
- data: !s || s === "text" || s === "json" ? h.responseText : h.response,
1033
- status: h.status,
1034
- statusText: h.statusText,
1035
- headers: v,
1036
- config: t,
1037
- request: h
1038
- };
1039
- vn(function(M) {
1040
- n(M), m();
1041
- }, function(M) {
1042
- r(M), m();
1043
- }, x), h = null;
1044
- }
1045
- "onloadend" in h ? h.onloadend = E : h.onreadystatechange = function() {
1046
- !h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(E);
1047
- }, h.onabort = function() {
1048
- h && (r(new b("Request aborted", b.ECONNABORTED, t, h)), h = null);
1049
- }, h.onerror = function() {
1050
- r(new b("Network Error", b.ERR_NETWORK, t, h)), h = null;
1051
- }, h.ontimeout = function() {
1052
- let F = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1053
- const x = o.transitional || hn;
1054
- o.timeoutErrorMessage && (F = o.timeoutErrorMessage), r(new b(
1055
- F,
1056
- x.clarifyTimeoutError ? b.ETIMEDOUT : b.ECONNABORTED,
1057
- t,
1058
- h
1059
- )), h = null;
1060
- }, a === void 0 && i.setContentType(null), "setRequestHeader" in h && f.forEach(i.toJSON(), function(F, x) {
1061
- h.setRequestHeader(x, F);
1062
- }), f.isUndefined(o.withCredentials) || (h.withCredentials = !!o.withCredentials), s && s !== "json" && (h.responseType = o.responseType), l && ([d, y] = Je(l, !0), h.addEventListener("progress", d)), u && h.upload && ([p, g] = Je(u), h.upload.addEventListener("progress", p), h.upload.addEventListener("loadend", g)), (o.cancelToken || o.signal) && (c = (v) => {
1063
- h && (r(!v || v.type ? new Se(null, t, h) : v), h.abort(), h = null);
1064
- }, o.cancelToken && o.cancelToken.subscribe(c), o.signal && (o.signal.aborted ? c() : o.signal.addEventListener("abort", c)));
1065
- const R = Ra(o.url);
1066
- if (R && B.protocols.indexOf(R) === -1) {
1067
- r(new b("Unsupported protocol " + R + ":", b.ERR_BAD_REQUEST, t));
1068
- return;
62
+ const getMinioConfig = async () => {
63
+ const [error, data] = await getMinioToken().run();
64
+ if (error) {
65
+ return { stauts: false };
1069
66
  }
1070
- h.send(a || null);
1071
- });
1072
- }, Da = (t, e) => {
1073
- const { length: n } = t = t ? t.filter(Boolean) : [];
1074
- if (e || n) {
1075
- let r = new AbortController(), o;
1076
- const a = function(l) {
1077
- if (!o) {
1078
- o = !0, s();
1079
- const c = l instanceof Error ? l : this.reason;
1080
- r.abort(c instanceof b ? c : new Se(c instanceof Error ? c.message : c));
1081
- }
1082
- };
1083
- let i = e && setTimeout(() => {
1084
- i = null, a(new b(`timeout ${e} of ms exceeded`, b.ETIMEDOUT));
1085
- }, e);
1086
- const s = () => {
1087
- t && (i && clearTimeout(i), i = null, t.forEach((l) => {
1088
- l.unsubscribe ? l.unsubscribe(a) : l.removeEventListener("abort", a);
1089
- }), t = null);
1090
- };
1091
- t.forEach((l) => l.addEventListener("abort", a));
1092
- const { signal: u } = r;
1093
- return u.unsubscribe = () => f.asap(s), u;
1094
- }
1095
- }, Ia = function* (t, e) {
1096
- let n = t.byteLength;
1097
- if (n < e) {
1098
- yield t;
1099
- return;
1100
- }
1101
- let r = 0, o;
1102
- for (; r < n; )
1103
- o = r + e, yield t.slice(r, o), r = o;
1104
- }, La = async function* (t, e) {
1105
- for await (const n of Ma(t))
1106
- yield* Ia(n, e);
1107
- }, Ma = async function* (t) {
1108
- if (t[Symbol.asyncIterator]) {
1109
- yield* t;
1110
- return;
1111
- }
1112
- const e = t.getReader();
1113
- try {
1114
- for (; ; ) {
1115
- const { done: n, value: r } = await e.read();
1116
- if (n)
1117
- break;
1118
- yield r;
1119
- }
1120
- } finally {
1121
- await e.cancel();
1122
- }
1123
- }, br = (t, e, n, r) => {
1124
- const o = La(t, e);
1125
- let a = 0, i, s = (u) => {
1126
- i || (i = !0, r && r(u));
67
+ return { status: true, data };
1127
68
  };
1128
- return new ReadableStream({
1129
- async pull(u) {
1130
- try {
1131
- const { done: l, value: c } = await o.next();
1132
- if (l) {
1133
- s(), u.close();
1134
- return;
1135
- }
1136
- let p = c.byteLength;
1137
- if (n) {
1138
- let d = a += p;
1139
- n(d);
1140
- }
1141
- u.enqueue(new Uint8Array(c));
1142
- } catch (l) {
1143
- throw s(l), l;
69
+ const readFileAndAddToMap = (file) => {
70
+ return new Promise((resolve, reject) => {
71
+ const chunkSize = 1024 * 1024;
72
+ const chunks = [];
73
+ let offset = 0;
74
+ while (offset < file.size) {
75
+ const chunk = file.slice(offset, offset + chunkSize);
76
+ chunks.push(chunk);
77
+ offset += chunkSize;
1144
78
  }
1145
- },
1146
- cancel(u) {
1147
- return s(u), o.return();
1148
- }
1149
- }, {
1150
- highWaterMark: 2
1151
- });
1152
- }, at = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", Sn = at && typeof ReadableStream == "function", Ba = at && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), En = (t, ...e) => {
1153
- try {
1154
- return !!t(...e);
1155
- } catch {
1156
- return !1;
1157
- }
1158
- }, Ua = Sn && En(() => {
1159
- let t = !1;
1160
- const e = new Request(B.origin, {
1161
- body: new ReadableStream(),
1162
- method: "POST",
1163
- get duplex() {
1164
- return t = !0, "half";
1165
- }
1166
- }).headers.has("Content-Type");
1167
- return t && !e;
1168
- }), Sr = 64 * 1024, qt = Sn && En(() => f.isReadableStream(new Response("").body)), Ve = {
1169
- stream: qt && ((t) => t.body)
1170
- };
1171
- at && ((t) => {
1172
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
1173
- !Ve[e] && (Ve[e] = f.isFunction(t[e]) ? (n) => n[e]() : (n, r) => {
1174
- throw new b(`Response type '${e}' is not supported`, b.ERR_NOT_SUPPORT, r);
79
+ const mergedBlob = new Blob(chunks, { type: file.type });
80
+ resolve(mergedBlob);
1175
81
  });
1176
- });
1177
- })(new Response());
1178
- const ka = async (t) => {
1179
- if (t == null)
1180
- return 0;
1181
- if (f.isBlob(t))
1182
- return t.size;
1183
- if (f.isSpecCompliantForm(t))
1184
- return (await new Request(B.origin, {
1185
- method: "POST",
1186
- body: t
1187
- }).arrayBuffer()).byteLength;
1188
- if (f.isArrayBufferView(t) || f.isArrayBuffer(t))
1189
- return t.byteLength;
1190
- if (f.isURLSearchParams(t) && (t = t + ""), f.isString(t))
1191
- return (await Ba(t)).byteLength;
1192
- }, qa = async (t, e) => {
1193
- const n = f.toFiniteNumber(t.getContentLength());
1194
- return n ?? ka(e);
1195
- }, ja = at && (async (t) => {
1196
- let {
1197
- url: e,
1198
- method: n,
1199
- data: r,
1200
- signal: o,
1201
- cancelToken: a,
1202
- timeout: i,
1203
- onDownloadProgress: s,
1204
- onUploadProgress: u,
1205
- responseType: l,
1206
- headers: c,
1207
- withCredentials: p = "same-origin",
1208
- fetchOptions: d
1209
- } = bn(t);
1210
- l = l ? (l + "").toLowerCase() : "text";
1211
- let g = Da([o, a && a.toAbortSignal()], i), y;
1212
- const m = g && g.unsubscribe && (() => {
1213
- g.unsubscribe();
1214
- });
1215
- let h;
1216
- try {
1217
- if (u && Ua && n !== "get" && n !== "head" && (h = await qa(c, r)) !== 0) {
1218
- let x = new Request(e, {
1219
- method: "POST",
1220
- body: r,
1221
- duplex: "half"
1222
- }), L;
1223
- if (f.isFormData(r) && (L = x.headers.get("content-type")) && c.setContentType(L), x.body) {
1224
- const [M, z] = gr(
1225
- h,
1226
- Je(vr(u))
1227
- );
1228
- r = br(x.body, Sr, M, z);
1229
- }
1230
- }
1231
- f.isString(p) || (p = p ? "include" : "omit");
1232
- const E = "credentials" in Request.prototype;
1233
- y = new Request(e, {
1234
- ...d,
1235
- signal: g,
1236
- method: n.toUpperCase(),
1237
- headers: c.normalize().toJSON(),
1238
- body: r,
1239
- duplex: "half",
1240
- credentials: E ? p : void 0
1241
- });
1242
- let R = await fetch(y);
1243
- const v = qt && (l === "stream" || l === "response");
1244
- if (qt && (s || v && m)) {
1245
- const x = {};
1246
- ["status", "statusText", "headers"].forEach((K) => {
1247
- x[K] = R[K];
82
+ };
83
+ const fileImport = async (importFunc, file, options, needProgress = true, errPathName = "", isBatch = false) => {
84
+ tempErrPathName = errPathName;
85
+ fileHandleType.value = "import";
86
+ if (needProgress) {
87
+ progressStatus.value = "normal";
88
+ percent.value = 0;
89
+ progressTitle.value = t("导入进度");
90
+ showProgressDialog.value = true;
91
+ progressResult.value = "";
92
+ }
93
+ fileInfo = file;
94
+ const tokenResult = await getMinioConfig();
95
+ if (!tokenResult.status) return;
96
+ let minioConfig = tokenResult.data;
97
+ let params = null;
98
+ let { autoContentType, bucketName, importFileName } = options;
99
+ const fn = isBatch ? importMultiMinio : importMinio;
100
+ if (isBatch) {
101
+ let blobList = [];
102
+ await file.forEach(async (ele) => {
103
+ let blob = await readFileAndAddToMap(ele);
104
+ blobList.push(blob);
1248
105
  });
1249
- const L = f.toFiniteNumber(R.headers.get("content-length")), [M, z] = s && gr(
1250
- L,
1251
- Je(vr(s), !0)
1252
- ) || [];
1253
- R = new Response(
1254
- br(R.body, Sr, M, () => {
1255
- z && z(), m && m();
1256
- }),
1257
- x
1258
- );
1259
- }
1260
- l = l || "text";
1261
- let F = await Ve[f.findKey(Ve, l) || "text"](R, t);
1262
- return !v && m && m(), await new Promise((x, L) => {
1263
- vn(x, L, {
1264
- data: F,
1265
- headers: q.from(R.headers),
1266
- status: R.status,
1267
- statusText: R.statusText,
1268
- config: t,
1269
- request: y
106
+ params = new FormData();
107
+ params.append("accessKeyId", minioConfig.accessKeyId);
108
+ params.append("secretAccessKey", minioConfig.secretAccessKey);
109
+ params.append("sessionToken", minioConfig.sessionToken);
110
+ params.append("bucketName", bucketName);
111
+ file.forEach((v, i) => {
112
+ params.append("file", blobList[i]);
1270
113
  });
1271
- });
1272
- } catch (E) {
1273
- throw m && m(), E && E.name === "TypeError" && /fetch/i.test(E.message) ? Object.assign(
1274
- new b("Network Error", b.ERR_NETWORK, t, y),
1275
- {
1276
- cause: E.cause || E
1277
- }
1278
- ) : b.from(E, E && E.code, t, y);
1279
- }
1280
- }), jt = {
1281
- http: na,
1282
- xhr: Fa,
1283
- fetch: ja
1284
- };
1285
- f.forEach(jt, (t, e) => {
1286
- if (t) {
1287
- try {
1288
- Object.defineProperty(t, "name", { value: e });
1289
- } catch {
1290
- }
1291
- Object.defineProperty(t, "adapterName", { value: e });
1292
- }
1293
- });
1294
- const Er = (t) => `- ${t}`, Ha = (t) => f.isFunction(t) || t === null || t === !1, An = {
1295
- getAdapter: (t) => {
1296
- t = f.isArray(t) ? t : [t];
1297
- const { length: e } = t;
1298
- let n, r;
1299
- const o = {};
1300
- for (let a = 0; a < e; a++) {
1301
- n = t[a];
1302
- let i;
1303
- if (r = n, !Ha(n) && (r = jt[(i = String(n)).toLowerCase()], r === void 0))
1304
- throw new b(`Unknown adapter '${i}'`);
1305
- if (r)
1306
- break;
1307
- o[i || "#" + a] = r;
1308
- }
1309
- if (!r) {
1310
- const a = Object.entries(o).map(
1311
- ([s, u]) => `adapter ${s} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build")
1312
- );
1313
- let i = e ? a.length > 1 ? `since :
1314
- ` + a.map(Er).join(`
1315
- `) : " " + Er(a[0]) : "as no adapter specified";
1316
- throw new b(
1317
- "There is no suitable adapter to dispatch the request " + i,
1318
- "ERR_NOT_SUPPORT"
1319
- );
1320
- }
1321
- return r;
1322
- },
1323
- adapters: jt
1324
- };
1325
- function mt(t) {
1326
- if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
1327
- throw new Se(null, t);
1328
- }
1329
- function Ar(t) {
1330
- return mt(t), t.headers = q.from(t.headers), t.data = ht.call(
1331
- t,
1332
- t.transformRequest
1333
- ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), An.getAdapter(t.adapter || Ne.adapter)(t).then(function(r) {
1334
- return mt(t), r.data = ht.call(
1335
- t,
1336
- t.transformResponse,
1337
- r
1338
- ), r.headers = q.from(r.headers), r;
1339
- }, function(r) {
1340
- return gn(r) || (mt(t), r && r.response && (r.response.data = ht.call(
1341
- t,
1342
- t.transformResponse,
1343
- r.response
1344
- ), r.response.headers = q.from(r.response.headers))), Promise.reject(r);
1345
- });
1346
- }
1347
- const On = "1.7.9", it = {};
1348
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
1349
- it[t] = function(r) {
1350
- return typeof r === t || "a" + (e < 1 ? "n " : " ") + t;
1351
- };
1352
- });
1353
- const Or = {};
1354
- it.transitional = function(e, n, r) {
1355
- function o(a, i) {
1356
- return "[Axios v" + On + "] Transitional option '" + a + "'" + i + (r ? ". " + r : "");
1357
- }
1358
- return (a, i, s) => {
1359
- if (e === !1)
1360
- throw new b(
1361
- o(i, " has been removed" + (n ? " in " + n : "")),
1362
- b.ERR_DEPRECATED
1363
- );
1364
- return n && !Or[i] && (Or[i] = !0), e ? e(a, i, s) : !0;
1365
- };
1366
- };
1367
- it.spelling = function(e) {
1368
- return (n, r) => !0;
1369
- };
1370
- function za(t, e, n) {
1371
- if (typeof t != "object")
1372
- throw new b("options must be an object", b.ERR_BAD_OPTION_VALUE);
1373
- const r = Object.keys(t);
1374
- let o = r.length;
1375
- for (; o-- > 0; ) {
1376
- const a = r[o], i = e[a];
1377
- if (i) {
1378
- const s = t[a], u = s === void 0 || i(s, a, t);
1379
- if (u !== !0)
1380
- throw new b("option " + a + " must be " + u, b.ERR_BAD_OPTION_VALUE);
1381
- continue;
1382
- }
1383
- if (n !== !0)
1384
- throw new b("Unknown option " + a, b.ERR_BAD_OPTION);
1385
- }
1386
- }
1387
- const He = {
1388
- assertOptions: za,
1389
- validators: it
1390
- }, Z = He.validators;
1391
- let ce = class {
1392
- constructor(e) {
1393
- this.defaults = e, this.interceptors = {
1394
- request: new hr(),
1395
- response: new hr()
1396
- };
1397
- }
1398
- /**
1399
- * Dispatch a request
1400
- *
1401
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1402
- * @param {?Object} config
1403
- *
1404
- * @returns {Promise} The Promise to be fulfilled
1405
- */
1406
- async request(e, n) {
1407
- try {
1408
- return await this._request(e, n);
1409
- } catch (r) {
1410
- if (r instanceof Error) {
1411
- let o = {};
1412
- Error.captureStackTrace ? Error.captureStackTrace(o) : o = new Error();
1413
- const a = o.stack ? o.stack.replace(/^.+\n/, "") : "";
1414
- try {
1415
- r.stack ? a && !String(r.stack).endsWith(a.replace(/^.+\n.+\n/, "")) && (r.stack += `
1416
- ` + a) : r.stack = a;
1417
- } catch {
1418
- }
1419
- }
1420
- throw r;
1421
- }
1422
- }
1423
- _request(e, n) {
1424
- typeof e == "string" ? (n = n || {}, n.url = e) : n = e || {}, n = fe(this.defaults, n);
1425
- const { transitional: r, paramsSerializer: o, headers: a } = n;
1426
- r !== void 0 && He.assertOptions(r, {
1427
- silentJSONParsing: Z.transitional(Z.boolean),
1428
- forcedJSONParsing: Z.transitional(Z.boolean),
1429
- clarifyTimeoutError: Z.transitional(Z.boolean)
1430
- }, !1), o != null && (f.isFunction(o) ? n.paramsSerializer = {
1431
- serialize: o
1432
- } : He.assertOptions(o, {
1433
- encode: Z.function,
1434
- serialize: Z.function
1435
- }, !0)), He.assertOptions(n, {
1436
- baseUrl: Z.spelling("baseURL"),
1437
- withXsrfToken: Z.spelling("withXSRFToken")
1438
- }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1439
- let i = a && f.merge(
1440
- a.common,
1441
- a[n.method]
1442
- );
1443
- a && f.forEach(
1444
- ["delete", "get", "head", "post", "put", "patch", "common"],
1445
- (y) => {
1446
- delete a[y];
1447
- }
1448
- ), n.headers = q.concat(i, a);
1449
- const s = [];
1450
- let u = !0;
1451
- this.interceptors.request.forEach(function(m) {
1452
- typeof m.runWhen == "function" && m.runWhen(n) === !1 || (u = u && m.synchronous, s.unshift(m.fulfilled, m.rejected));
1453
- });
1454
- const l = [];
1455
- this.interceptors.response.forEach(function(m) {
1456
- l.push(m.fulfilled, m.rejected);
1457
- });
1458
- let c, p = 0, d;
1459
- if (!u) {
1460
- const y = [Ar.bind(this), void 0];
1461
- for (y.unshift.apply(y, s), y.push.apply(y, l), d = y.length, c = Promise.resolve(n); p < d; )
1462
- c = c.then(y[p++], y[p++]);
1463
- return c;
1464
- }
1465
- d = s.length;
1466
- let g = n;
1467
- for (p = 0; p < d; ) {
1468
- const y = s[p++], m = s[p++];
1469
- try {
1470
- g = y(g);
1471
- } catch (h) {
1472
- m.call(this, h);
1473
- break;
1474
- }
1475
- }
1476
- try {
1477
- c = Ar.call(this, g);
1478
- } catch (y) {
1479
- return Promise.reject(y);
114
+ importFileName.forEach((v) => {
115
+ params.append("filePaths", v);
116
+ });
117
+ } else {
118
+ const blob = await readFileAndAddToMap(file);
119
+ params = {
120
+ accessKeyId: minioConfig.accessKeyId,
121
+ secretAccessKey: minioConfig.secretAccessKey,
122
+ sessionToken: minioConfig.sessionToken,
123
+ file: blob,
124
+ bucketName,
125
+ filePath: importFileName,
126
+ autoContentType
127
+ };
1480
128
  }
1481
- for (p = 0, d = l.length; p < d; )
1482
- c = c.then(l[p++], l[p++]);
1483
- return c;
1484
- }
1485
- getUri(e) {
1486
- e = fe(this.defaults, e);
1487
- const n = wn(e.baseURL, e.url);
1488
- return yn(n, e.params, e.paramsSerializer);
1489
- }
1490
- };
1491
- f.forEach(["delete", "get", "head", "options"], function(e) {
1492
- ce.prototype[e] = function(n, r) {
1493
- return this.request(fe(r || {}, {
1494
- method: e,
1495
- url: n,
1496
- data: (r || {}).data
1497
- }));
1498
- };
1499
- });
1500
- f.forEach(["post", "put", "patch"], function(e) {
1501
- function n(r) {
1502
- return function(a, i, s) {
1503
- return this.request(fe(s || {}, {
1504
- method: e,
1505
- headers: r ? {
1506
- "Content-Type": "multipart/form-data"
1507
- } : {},
1508
- url: a,
1509
- data: i
1510
- }));
1511
- };
1512
- }
1513
- ce.prototype[e] = n(), ce.prototype[e + "Form"] = n(!0);
1514
- });
1515
- let Wa = class Rn {
1516
- constructor(e) {
1517
- if (typeof e != "function")
1518
- throw new TypeError("executor must be a function.");
1519
- let n;
1520
- this.promise = new Promise(function(a) {
1521
- n = a;
1522
- });
1523
- const r = this;
1524
- this.promise.then((o) => {
1525
- if (!r._listeners) return;
1526
- let a = r._listeners.length;
1527
- for (; a-- > 0; )
1528
- r._listeners[a](o);
1529
- r._listeners = null;
1530
- }), this.promise.then = (o) => {
1531
- let a;
1532
- const i = new Promise((s) => {
1533
- r.subscribe(s), a = s;
1534
- }).then(o);
1535
- return i.cancel = function() {
1536
- r.unsubscribe(a);
1537
- }, i;
1538
- }, e(function(a, i, s) {
1539
- r.reason || (r.reason = new Se(a, i, s), n(r.reason));
1540
- });
1541
- }
1542
- /**
1543
- * Throws a `CanceledError` if cancellation has been requested.
1544
- */
1545
- throwIfRequested() {
1546
- if (this.reason)
1547
- throw this.reason;
1548
- }
1549
- /**
1550
- * Subscribe to the cancel signal
1551
- */
1552
- subscribe(e) {
1553
- if (this.reason) {
1554
- e(this.reason);
129
+ const [error, data] = await fn(params).run();
130
+ if (error) return showProgressDialog.value = false;
131
+ const toStringData = await toStringObject(data.data);
132
+ if (!isBatch && toStringData?.statusCode != 200 || isBatch && toStringData?.some((v) => v?.statusCode != 200)) {
133
+ showProgressDialog.value = false;
134
+ window.DasMessage?.error({
135
+ message: toStringData?.errorMsg || t("上传失败"),
136
+ grouping: true,
137
+ repeatNum: 1
138
+ });
1555
139
  return;
1556
140
  }
1557
- this._listeners ? this._listeners.push(e) : this._listeners = [e];
1558
- }
1559
- /**
1560
- * Unsubscribe from the cancel signal
1561
- */
1562
- unsubscribe(e) {
1563
- if (!this._listeners)
1564
- return;
1565
- const n = this._listeners.indexOf(e);
1566
- n !== -1 && this._listeners.splice(n, 1);
1567
- }
1568
- toAbortSignal() {
1569
- const e = new AbortController(), n = (r) => {
1570
- e.abort(r);
1571
- };
1572
- return this.subscribe(n), e.signal.unsubscribe = () => this.unsubscribe(n), e.signal;
1573
- }
1574
- /**
1575
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1576
- * cancels the `CancelToken`.
1577
- */
1578
- static source() {
1579
- let e;
1580
- return {
1581
- token: new Rn(function(o) {
1582
- e = o;
1583
- }),
1584
- cancel: e
1585
- };
1586
- }
1587
- };
1588
- function Ga(t) {
1589
- return function(n) {
1590
- return t.apply(null, n);
1591
- };
1592
- }
1593
- function Ka(t) {
1594
- return f.isObject(t) && t.isAxiosError === !0;
1595
- }
1596
- const Ht = {
1597
- Continue: 100,
1598
- SwitchingProtocols: 101,
1599
- Processing: 102,
1600
- EarlyHints: 103,
1601
- Ok: 200,
1602
- Created: 201,
1603
- Accepted: 202,
1604
- NonAuthoritativeInformation: 203,
1605
- NoContent: 204,
1606
- ResetContent: 205,
1607
- PartialContent: 206,
1608
- MultiStatus: 207,
1609
- AlreadyReported: 208,
1610
- ImUsed: 226,
1611
- MultipleChoices: 300,
1612
- MovedPermanently: 301,
1613
- Found: 302,
1614
- SeeOther: 303,
1615
- NotModified: 304,
1616
- UseProxy: 305,
1617
- Unused: 306,
1618
- TemporaryRedirect: 307,
1619
- PermanentRedirect: 308,
1620
- BadRequest: 400,
1621
- Unauthorized: 401,
1622
- PaymentRequired: 402,
1623
- Forbidden: 403,
1624
- NotFound: 404,
1625
- MethodNotAllowed: 405,
1626
- NotAcceptable: 406,
1627
- ProxyAuthenticationRequired: 407,
1628
- RequestTimeout: 408,
1629
- Conflict: 409,
1630
- Gone: 410,
1631
- LengthRequired: 411,
1632
- PreconditionFailed: 412,
1633
- PayloadTooLarge: 413,
1634
- UriTooLong: 414,
1635
- UnsupportedMediaType: 415,
1636
- RangeNotSatisfiable: 416,
1637
- ExpectationFailed: 417,
1638
- ImATeapot: 418,
1639
- MisdirectedRequest: 421,
1640
- UnprocessableEntity: 422,
1641
- Locked: 423,
1642
- FailedDependency: 424,
1643
- TooEarly: 425,
1644
- UpgradeRequired: 426,
1645
- PreconditionRequired: 428,
1646
- TooManyRequests: 429,
1647
- RequestHeaderFieldsTooLarge: 431,
1648
- UnavailableForLegalReasons: 451,
1649
- InternalServerError: 500,
1650
- NotImplemented: 501,
1651
- BadGateway: 502,
1652
- ServiceUnavailable: 503,
1653
- GatewayTimeout: 504,
1654
- HttpVersionNotSupported: 505,
1655
- VariantAlsoNegotiates: 506,
1656
- InsufficientStorage: 507,
1657
- LoopDetected: 508,
1658
- NotExtended: 510,
1659
- NetworkAuthenticationRequired: 511
1660
- };
1661
- Object.entries(Ht).forEach(([t, e]) => {
1662
- Ht[e] = t;
1663
- });
1664
- function Pn(t) {
1665
- const e = new ce(t), n = tn(ce.prototype.request, e);
1666
- return f.extend(n, ce.prototype, e, { allOwnKeys: !0 }), f.extend(n, e, null, { allOwnKeys: !0 }), n.create = function(o) {
1667
- return Pn(fe(t, o));
1668
- }, n;
1669
- }
1670
- const N = Pn(Ne);
1671
- N.Axios = ce;
1672
- N.CanceledError = Se;
1673
- N.CancelToken = Wa;
1674
- N.isCancel = gn;
1675
- N.VERSION = On;
1676
- N.toFormData = ot;
1677
- N.AxiosError = b;
1678
- N.Cancel = N.CanceledError;
1679
- N.all = function(e) {
1680
- return Promise.all(e);
1681
- };
1682
- N.spread = Ga;
1683
- N.isAxiosError = Ka;
1684
- N.mergeConfig = fe;
1685
- N.AxiosHeaders = q;
1686
- N.formToJSON = (t) => mn(f.isHTMLForm(t) ? new FormData(t) : t);
1687
- N.getAdapter = An.getAdapter;
1688
- N.HttpStatusCode = Ht;
1689
- N.default = N;
1690
- const {
1691
- Axios: mc,
1692
- AxiosError: gc,
1693
- CanceledError: vc,
1694
- isCancel: wc,
1695
- CancelToken: bc,
1696
- VERSION: Sc,
1697
- all: Ec,
1698
- Cancel: Ac,
1699
- isAxiosError: Oc,
1700
- spread: Rc,
1701
- toFormData: Pc,
1702
- AxiosHeaders: xc,
1703
- HttpStatusCode: Tc,
1704
- formToJSON: Cc,
1705
- getAdapter: _c,
1706
- mergeConfig: $c
1707
- } = N;
1708
- var Rr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1709
- function Ja(t) {
1710
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1711
- }
1712
- function Va(t) {
1713
- if (t.__esModule) return t;
1714
- var e = t.default;
1715
- if (typeof e == "function") {
1716
- var n = function r() {
1717
- return this instanceof r ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
1718
- };
1719
- n.prototype = e.prototype;
1720
- } else n = {};
1721
- return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(t).forEach(function(r) {
1722
- var o = Object.getOwnPropertyDescriptor(t, r);
1723
- Object.defineProperty(n, r, o.get ? o : {
1724
- enumerable: !0,
1725
- get: function() {
1726
- return t[r];
141
+ const importResult = await importFunc?.(toStringData);
142
+ if (needProgress) {
143
+ if (!importResult.status) {
144
+ showProgressDialog.value = false;
145
+ progressStatus.value = "error";
146
+ return;
1727
147
  }
1728
- });
1729
- }), n;
1730
- }
1731
- var Ee = TypeError;
1732
- const Qa = {}, Xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1733
- __proto__: null,
1734
- default: Qa
1735
- }, Symbol.toStringTag, { value: "Module" })), Ya = /* @__PURE__ */ Va(Xa);
1736
- var er = typeof Map == "function" && Map.prototype, gt = Object.getOwnPropertyDescriptor && er ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, Qe = er && gt && typeof gt.get == "function" ? gt.get : null, Pr = er && Map.prototype.forEach, tr = typeof Set == "function" && Set.prototype, vt = Object.getOwnPropertyDescriptor && tr ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, Xe = tr && vt && typeof vt.get == "function" ? vt.get : null, xr = tr && Set.prototype.forEach, Za = typeof WeakMap == "function" && WeakMap.prototype, Re = Za ? WeakMap.prototype.has : null, ei = typeof WeakSet == "function" && WeakSet.prototype, Pe = ei ? WeakSet.prototype.has : null, ti = typeof WeakRef == "function" && WeakRef.prototype, Tr = ti ? WeakRef.prototype.deref : null, ri = Boolean.prototype.valueOf, ni = Object.prototype.toString, oi = Function.prototype.toString, ai = String.prototype.match, rr = String.prototype.slice, ae = String.prototype.replace, ii = String.prototype.toUpperCase, Cr = String.prototype.toLowerCase, xn = RegExp.prototype.test, _r = Array.prototype.concat, re = Array.prototype.join, si = Array.prototype.slice, $r = Math.floor, zt = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, wt = Object.getOwnPropertySymbols, Wt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, ve = typeof Symbol == "function" && typeof Symbol.iterator == "object", xe = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === ve || !0) ? Symbol.toStringTag : null, Tn = Object.prototype.propertyIsEnumerable, Nr = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t) {
1737
- return t.__proto__;
1738
- } : null);
1739
- function Fr(t, e) {
1740
- if (t === 1 / 0 || t === -1 / 0 || t !== t || t && t > -1e3 && t < 1e3 || xn.call(/e/, e))
1741
- return e;
1742
- var n = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
1743
- if (typeof t == "number") {
1744
- var r = t < 0 ? -$r(-t) : $r(t);
1745
- if (r !== t) {
1746
- var o = String(r), a = rr.call(e, o.length + 1);
1747
- return ae.call(o, n, "$&_") + "." + ae.call(ae.call(a, /([0-9]{3})/g, "$&_"), /_$/, "");
1748
- }
1749
- }
1750
- return ae.call(e, n, "$&_");
1751
- }
1752
- var Gt = Ya, Dr = Gt.custom, Ir = $n(Dr) ? Dr : null, Cn = {
1753
- __proto__: null,
1754
- double: '"',
1755
- single: "'"
1756
- }, li = {
1757
- __proto__: null,
1758
- double: /(["\\])/g,
1759
- single: /(['\\])/g
1760
- }, st = function t(e, n, r, o) {
1761
- var a = n || {};
1762
- if (ne(a, "quoteStyle") && !ne(Cn, a.quoteStyle))
1763
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
1764
- if (ne(a, "maxStringLength") && (typeof a.maxStringLength == "number" ? a.maxStringLength < 0 && a.maxStringLength !== 1 / 0 : a.maxStringLength !== null))
1765
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
1766
- var i = ne(a, "customInspect") ? a.customInspect : !0;
1767
- if (typeof i != "boolean" && i !== "symbol")
1768
- throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
1769
- if (ne(a, "indent") && a.indent !== null && a.indent !== " " && !(parseInt(a.indent, 10) === a.indent && a.indent > 0))
1770
- throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
1771
- if (ne(a, "numericSeparator") && typeof a.numericSeparator != "boolean")
1772
- throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
1773
- var s = a.numericSeparator;
1774
- if (typeof e > "u")
1775
- return "undefined";
1776
- if (e === null)
1777
- return "null";
1778
- if (typeof e == "boolean")
1779
- return e ? "true" : "false";
1780
- if (typeof e == "string")
1781
- return Fn(e, a);
1782
- if (typeof e == "number") {
1783
- if (e === 0)
1784
- return 1 / 0 / e > 0 ? "0" : "-0";
1785
- var u = String(e);
1786
- return s ? Fr(e, u) : u;
1787
- }
1788
- if (typeof e == "bigint") {
1789
- var l = String(e) + "n";
1790
- return s ? Fr(e, l) : l;
1791
- }
1792
- var c = typeof a.depth > "u" ? 5 : a.depth;
1793
- if (typeof r > "u" && (r = 0), r >= c && c > 0 && typeof e == "object")
1794
- return Kt(e) ? "[Array]" : "[Object]";
1795
- var p = Pi(a, r);
1796
- if (typeof o > "u")
1797
- o = [];
1798
- else if (Nn(o, e) >= 0)
1799
- return "[Circular]";
1800
- function d(P, $, w) {
1801
- if ($ && (o = si.call(o), o.push($)), w) {
1802
- var j = {
1803
- depth: a.depth
1804
- };
1805
- return ne(a, "quoteStyle") && (j.quoteStyle = a.quoteStyle), t(P, j, r + 1, o);
1806
- }
1807
- return t(P, a, r + 1, o);
1808
- }
1809
- if (typeof e == "function" && !Lr(e)) {
1810
- var g = gi(e), y = Be(e, d);
1811
- return "[Function" + (g ? ": " + g : " (anonymous)") + "]" + (y.length > 0 ? " { " + re.call(y, ", ") + " }" : "");
1812
- }
1813
- if ($n(e)) {
1814
- var m = ve ? ae.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Wt.call(e);
1815
- return typeof e == "object" && !ve ? Oe(m) : m;
1816
- }
1817
- if (Ai(e)) {
1818
- for (var h = "<" + Cr.call(String(e.nodeName)), E = e.attributes || [], R = 0; R < E.length; R++)
1819
- h += " " + E[R].name + "=" + _n(ci(E[R].value), "double", a);
1820
- return h += ">", e.childNodes && e.childNodes.length && (h += "..."), h += "</" + Cr.call(String(e.nodeName)) + ">", h;
1821
- }
1822
- if (Kt(e)) {
1823
- if (e.length === 0)
1824
- return "[]";
1825
- var v = Be(e, d);
1826
- return p && !Ri(v) ? "[" + Jt(v, p) + "]" : "[ " + re.call(v, ", ") + " ]";
1827
- }
1828
- if (fi(e)) {
1829
- var F = Be(e, d);
1830
- return !("cause" in Error.prototype) && "cause" in e && !Tn.call(e, "cause") ? "{ [" + String(e) + "] " + re.call(_r.call("[cause]: " + d(e.cause), F), ", ") + " }" : F.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + re.call(F, ", ") + " }";
1831
- }
1832
- if (typeof e == "object" && i) {
1833
- if (Ir && typeof e[Ir] == "function" && Gt)
1834
- return Gt(e, { depth: c - r });
1835
- if (i !== "symbol" && typeof e.inspect == "function")
1836
- return e.inspect();
1837
- }
1838
- if (vi(e)) {
1839
- var x = [];
1840
- return Pr && Pr.call(e, function(P, $) {
1841
- x.push(d($, e, !0) + " => " + d(P, e));
1842
- }), Mr("Map", Qe.call(e), x, p);
1843
- }
1844
- if (Si(e)) {
1845
- var L = [];
1846
- return xr && xr.call(e, function(P) {
1847
- L.push(d(P, e));
1848
- }), Mr("Set", Xe.call(e), L, p);
1849
- }
1850
- if (wi(e))
1851
- return bt("WeakMap");
1852
- if (Ei(e))
1853
- return bt("WeakSet");
1854
- if (bi(e))
1855
- return bt("WeakRef");
1856
- if (di(e))
1857
- return Oe(d(Number(e)));
1858
- if (hi(e))
1859
- return Oe(d(zt.call(e)));
1860
- if (yi(e))
1861
- return Oe(ri.call(e));
1862
- if (pi(e))
1863
- return Oe(d(String(e)));
1864
- if (typeof window < "u" && e === window)
1865
- return "{ [object Window] }";
1866
- if (typeof globalThis < "u" && e === globalThis || typeof Rr < "u" && e === Rr)
1867
- return "{ [object globalThis] }";
1868
- if (!ui(e) && !Lr(e)) {
1869
- var M = Be(e, d), z = Nr ? Nr(e) === Object.prototype : e instanceof Object || e.constructor === Object, K = e instanceof Object ? "" : "null prototype", S = !z && xe && Object(e) === e && xe in e ? rr.call(ie(e), 8, -1) : K ? "Object" : "", A = z || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", T = A + (S || K ? "[" + re.call(_r.call([], S || [], K || []), ": ") + "] " : "");
1870
- return M.length === 0 ? T + "{}" : p ? T + "{" + Jt(M, p) + "}" : T + "{ " + re.call(M, ", ") + " }";
1871
- }
1872
- return String(e);
1873
- };
1874
- function _n(t, e, n) {
1875
- var r = n.quoteStyle || e, o = Cn[r];
1876
- return o + t + o;
1877
- }
1878
- function ci(t) {
1879
- return ae.call(String(t), /"/g, "&quot;");
1880
- }
1881
- function de(t) {
1882
- return !xe || !(typeof t == "object" && (xe in t || typeof t[xe] < "u"));
1883
- }
1884
- function Kt(t) {
1885
- return ie(t) === "[object Array]" && de(t);
1886
- }
1887
- function ui(t) {
1888
- return ie(t) === "[object Date]" && de(t);
1889
- }
1890
- function Lr(t) {
1891
- return ie(t) === "[object RegExp]" && de(t);
1892
- }
1893
- function fi(t) {
1894
- return ie(t) === "[object Error]" && de(t);
1895
- }
1896
- function pi(t) {
1897
- return ie(t) === "[object String]" && de(t);
1898
- }
1899
- function di(t) {
1900
- return ie(t) === "[object Number]" && de(t);
1901
- }
1902
- function yi(t) {
1903
- return ie(t) === "[object Boolean]" && de(t);
1904
- }
1905
- function $n(t) {
1906
- if (ve)
1907
- return t && typeof t == "object" && t instanceof Symbol;
1908
- if (typeof t == "symbol")
1909
- return !0;
1910
- if (!t || typeof t != "object" || !Wt)
1911
- return !1;
1912
- try {
1913
- return Wt.call(t), !0;
1914
- } catch {
1915
- }
1916
- return !1;
1917
- }
1918
- function hi(t) {
1919
- if (!t || typeof t != "object" || !zt)
1920
- return !1;
1921
- try {
1922
- return zt.call(t), !0;
1923
- } catch {
1924
- }
1925
- return !1;
1926
- }
1927
- var mi = Object.prototype.hasOwnProperty || function(t) {
1928
- return t in this;
1929
- };
1930
- function ne(t, e) {
1931
- return mi.call(t, e);
1932
- }
1933
- function ie(t) {
1934
- return ni.call(t);
1935
- }
1936
- function gi(t) {
1937
- if (t.name)
1938
- return t.name;
1939
- var e = ai.call(oi.call(t), /^function\s*([\w$]+)/);
1940
- return e ? e[1] : null;
1941
- }
1942
- function Nn(t, e) {
1943
- if (t.indexOf)
1944
- return t.indexOf(e);
1945
- for (var n = 0, r = t.length; n < r; n++)
1946
- if (t[n] === e)
1947
- return n;
1948
- return -1;
1949
- }
1950
- function vi(t) {
1951
- if (!Qe || !t || typeof t != "object")
1952
- return !1;
1953
- try {
1954
- Qe.call(t);
1955
- try {
1956
- Xe.call(t);
1957
- } catch {
1958
- return !0;
1959
- }
1960
- return t instanceof Map;
1961
- } catch {
1962
- }
1963
- return !1;
1964
- }
1965
- function wi(t) {
1966
- if (!Re || !t || typeof t != "object")
1967
- return !1;
1968
- try {
1969
- Re.call(t, Re);
1970
- try {
1971
- Pe.call(t, Pe);
1972
- } catch {
1973
- return !0;
1974
- }
1975
- return t instanceof WeakMap;
1976
- } catch {
1977
- }
1978
- return !1;
1979
- }
1980
- function bi(t) {
1981
- if (!Tr || !t || typeof t != "object")
1982
- return !1;
1983
- try {
1984
- return Tr.call(t), !0;
1985
- } catch {
1986
- }
1987
- return !1;
1988
- }
1989
- function Si(t) {
1990
- if (!Xe || !t || typeof t != "object")
1991
- return !1;
1992
- try {
1993
- Xe.call(t);
1994
- try {
1995
- Qe.call(t);
1996
- } catch {
1997
- return !0;
1998
- }
1999
- return t instanceof Set;
2000
- } catch {
2001
- }
2002
- return !1;
2003
- }
2004
- function Ei(t) {
2005
- if (!Pe || !t || typeof t != "object")
2006
- return !1;
2007
- try {
2008
- Pe.call(t, Pe);
2009
- try {
2010
- Re.call(t, Re);
2011
- } catch {
2012
- return !0;
148
+ progressTitle.value = t("导入进度");
149
+ showProgressDialog.value = true;
150
+ checkProgress(importResult.taskId, "import", "");
151
+ } else {
152
+ if (!importResult.status) return;
153
+ progressStatus.value = "success";
154
+ window.DasMessage?.success({
155
+ message: t("导入成功"),
156
+ grouping: true,
157
+ repeatNum: 1
158
+ });
2013
159
  }
2014
- return t instanceof WeakSet;
2015
- } catch {
2016
- }
2017
- return !1;
2018
- }
2019
- function Ai(t) {
2020
- return !t || typeof t != "object" ? !1 : typeof HTMLElement < "u" && t instanceof HTMLElement ? !0 : typeof t.nodeName == "string" && typeof t.getAttribute == "function";
2021
- }
2022
- function Fn(t, e) {
2023
- if (t.length > e.maxStringLength) {
2024
- var n = t.length - e.maxStringLength, r = "... " + n + " more character" + (n > 1 ? "s" : "");
2025
- return Fn(rr.call(t, 0, e.maxStringLength), e) + r;
2026
- }
2027
- var o = li[e.quoteStyle || "single"];
2028
- o.lastIndex = 0;
2029
- var a = ae.call(ae.call(t, o, "\\$1"), /[\x00-\x1f]/g, Oi);
2030
- return _n(a, "single", e);
2031
- }
2032
- function Oi(t) {
2033
- var e = t.charCodeAt(0), n = {
2034
- 8: "b",
2035
- 9: "t",
2036
- 10: "n",
2037
- 12: "f",
2038
- 13: "r"
2039
- }[e];
2040
- return n ? "\\" + n : "\\x" + (e < 16 ? "0" : "") + ii.call(e.toString(16));
2041
- }
2042
- function Oe(t) {
2043
- return "Object(" + t + ")";
2044
- }
2045
- function bt(t) {
2046
- return t + " { ? }";
2047
- }
2048
- function Mr(t, e, n, r) {
2049
- var o = r ? Jt(n, r) : re.call(n, ", ");
2050
- return t + " (" + e + ") {" + o + "}";
2051
- }
2052
- function Ri(t) {
2053
- for (var e = 0; e < t.length; e++)
2054
- if (Nn(t[e], `
2055
- `) >= 0)
2056
- return !1;
2057
- return !0;
2058
- }
2059
- function Pi(t, e) {
2060
- var n;
2061
- if (t.indent === " ")
2062
- n = " ";
2063
- else if (typeof t.indent == "number" && t.indent > 0)
2064
- n = re.call(Array(t.indent + 1), " ");
2065
- else
2066
- return null;
2067
- return {
2068
- base: n,
2069
- prev: re.call(Array(e + 1), n)
2070
160
  };
2071
- }
2072
- function Jt(t, e) {
2073
- if (t.length === 0)
2074
- return "";
2075
- var n = `
2076
- ` + e.prev + e.base;
2077
- return n + re.call(t, "," + n) + `
2078
- ` + e.prev;
2079
- }
2080
- function Be(t, e) {
2081
- var n = Kt(t), r = [];
2082
- if (n) {
2083
- r.length = t.length;
2084
- for (var o = 0; o < t.length; o++)
2085
- r[o] = ne(t, o) ? e(t[o], t) : "";
2086
- }
2087
- var a = typeof wt == "function" ? wt(t) : [], i;
2088
- if (ve) {
2089
- i = {};
2090
- for (var s = 0; s < a.length; s++)
2091
- i["$" + a[s]] = a[s];
2092
- }
2093
- for (var u in t)
2094
- ne(t, u) && (n && String(Number(u)) === u && u < t.length || ve && i["$" + u] instanceof Symbol || (xn.call(/[^\w$]/, u) ? r.push(e(u, t) + ": " + e(t[u], t)) : r.push(u + ": " + e(t[u], t))));
2095
- if (typeof wt == "function")
2096
- for (var l = 0; l < a.length; l++)
2097
- Tn.call(t, a[l]) && r.push("[" + e(a[l]) + "]: " + e(t[a[l]], t));
2098
- return r;
2099
- }
2100
- var xi = st, Ti = Ee, lt = function(t, e, n) {
2101
- for (var r = t, o; (o = r.next) != null; r = o)
2102
- if (o.key === e)
2103
- return r.next = o.next, n || (o.next = /** @type {NonNullable<typeof list.next>} */
2104
- t.next, t.next = o), o;
2105
- }, Ci = function(t, e) {
2106
- if (t) {
2107
- var n = lt(t, e);
2108
- return n && n.value;
2109
- }
2110
- }, _i = function(t, e, n) {
2111
- var r = lt(t, e);
2112
- r ? r.value = n : t.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */
2113
- {
2114
- // eslint-disable-line no-param-reassign, no-extra-parens
2115
- key: e,
2116
- next: t.next,
2117
- value: n
2118
- };
2119
- }, $i = function(t, e) {
2120
- return t ? !!lt(t, e) : !1;
2121
- }, Ni = function(t, e) {
2122
- if (t)
2123
- return lt(t, e, !0);
2124
- }, Fi = function() {
2125
- var e, n = {
2126
- assert: function(r) {
2127
- if (!n.has(r))
2128
- throw new Ti("Side channel does not contain " + xi(r));
2129
- },
2130
- delete: function(r) {
2131
- var o = e && e.next, a = Ni(e, r);
2132
- return a && o && o === a && (e = void 0), !!a;
2133
- },
2134
- get: function(r) {
2135
- return Ci(e, r);
2136
- },
2137
- has: function(r) {
2138
- return $i(e, r);
2139
- },
2140
- set: function(r, o) {
2141
- e || (e = {
2142
- next: void 0
2143
- }), _i(
2144
- /** @type {NonNullable<typeof $o>} */
2145
- e,
2146
- r,
2147
- o
2148
- );
161
+ const fileAction = async (exportFunc, fileName = "", actionTitle = "") => {
162
+ progressStatus.value = "normal";
163
+ percent.value = 0;
164
+ progressTitle.value = actionTitle || t("导出进度");
165
+ showProgressDialog.value = true;
166
+ const importResult = await exportFunc?.();
167
+ if (!importResult.status) {
168
+ showProgressDialog.value = false;
169
+ progressStatus.value = "error";
170
+ return;
2149
171
  }
172
+ checkProgress(importResult.taskId, "action", "");
2150
173
  };
2151
- return n;
2152
- }, Dn = Object, Di = Error, Ii = EvalError, Li = RangeError, Mi = ReferenceError, Bi = SyntaxError, Ui = URIError, ki = Math.abs, qi = Math.floor, ji = Math.max, Hi = Math.min, zi = Math.pow, Wi = Math.round, Gi = Number.isNaN || function(e) {
2153
- return e !== e;
2154
- }, Ki = Gi, Ji = function(e) {
2155
- return Ki(e) || e === 0 ? e : e < 0 ? -1 : 1;
2156
- }, Vi = Object.getOwnPropertyDescriptor, ze = Vi;
2157
- if (ze)
2158
- try {
2159
- ze([], "length");
2160
- } catch {
2161
- ze = null;
2162
- }
2163
- var In = ze, We = Object.defineProperty || !1;
2164
- if (We)
2165
- try {
2166
- We({}, "a", { value: 1 });
2167
- } catch {
2168
- We = !1;
2169
- }
2170
- var Qi = We, St, Br;
2171
- function Xi() {
2172
- return Br || (Br = 1, St = function() {
2173
- if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
2174
- return !1;
2175
- if (typeof Symbol.iterator == "symbol")
2176
- return !0;
2177
- var e = {}, n = Symbol("test"), r = Object(n);
2178
- if (typeof n == "string" || Object.prototype.toString.call(n) !== "[object Symbol]" || Object.prototype.toString.call(r) !== "[object Symbol]")
2179
- return !1;
2180
- var o = 42;
2181
- e[n] = o;
2182
- for (var a in e)
2183
- return !1;
2184
- if (typeof Object.keys == "function" && Object.keys(e).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(e).length !== 0)
2185
- return !1;
2186
- var i = Object.getOwnPropertySymbols(e);
2187
- if (i.length !== 1 || i[0] !== n || !Object.prototype.propertyIsEnumerable.call(e, n))
2188
- return !1;
2189
- if (typeof Object.getOwnPropertyDescriptor == "function") {
2190
- var s = (
2191
- /** @type {PropertyDescriptor} */
2192
- Object.getOwnPropertyDescriptor(e, n)
2193
- );
2194
- if (s.value !== o || s.enumerable !== !0)
2195
- return !1;
174
+ const fileExport = async (exportFunc, fileName = "", fileSuffix = "", needProgress = true) => {
175
+ fileHandleType.value = "export";
176
+ if (needProgress) {
177
+ progressStatus.value = "normal";
178
+ percent.value = 0;
179
+ progressTitle.value = t("导出进度");
180
+ showProgressDialog.value = true;
181
+ }
182
+ const importResult = await exportFunc?.();
183
+ if (!importResult.status) {
184
+ showProgressDialog.value = false;
185
+ progressStatus.value = "error";
186
+ return;
2196
187
  }
2197
- return !0;
2198
- }), St;
2199
- }
2200
- var Et, Ur;
2201
- function Yi() {
2202
- if (Ur) return Et;
2203
- Ur = 1;
2204
- var t = typeof Symbol < "u" && Symbol, e = Xi();
2205
- return Et = function() {
2206
- return typeof t != "function" || typeof Symbol != "function" || typeof t("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : e();
2207
- }, Et;
2208
- }
2209
- var At, kr;
2210
- function Ln() {
2211
- return kr || (kr = 1, At = typeof Reflect < "u" && Reflect.getPrototypeOf || null), At;
2212
- }
2213
- var Ot, qr;
2214
- function Mn() {
2215
- if (qr) return Ot;
2216
- qr = 1;
2217
- var t = Dn;
2218
- return Ot = t.getPrototypeOf || null, Ot;
2219
- }
2220
- var Rt, jr;
2221
- function Zi() {
2222
- if (jr) return Rt;
2223
- jr = 1;
2224
- var t = "Function.prototype.bind called on incompatible ", e = Object.prototype.toString, n = Math.max, r = "[object Function]", o = function(u, l) {
2225
- for (var c = [], p = 0; p < u.length; p += 1)
2226
- c[p] = u[p];
2227
- for (var d = 0; d < l.length; d += 1)
2228
- c[d + u.length] = l[d];
2229
- return c;
2230
- }, a = function(u, l) {
2231
- for (var c = [], p = l, d = 0; p < u.length; p += 1, d += 1)
2232
- c[d] = u[p];
2233
- return c;
2234
- }, i = function(s, u) {
2235
- for (var l = "", c = 0; c < s.length; c += 1)
2236
- l += s[c], c + 1 < s.length && (l += u);
2237
- return l;
188
+ dayjs().format("YYYYMMDDHHmmss") + ".xlsx";
189
+ checkProgress(importResult.taskId, "export", fileName ? fileName : "", fileSuffix);
2238
190
  };
2239
- return Rt = function(u) {
2240
- var l = this;
2241
- if (typeof l != "function" || e.apply(l) !== r)
2242
- throw new TypeError(t + l);
2243
- for (var c = a(arguments, 1), p, d = function() {
2244
- if (this instanceof p) {
2245
- var E = l.apply(
2246
- this,
2247
- o(c, arguments)
2248
- );
2249
- return Object(E) === E ? E : this;
2250
- }
2251
- return l.apply(
2252
- u,
2253
- o(c, arguments)
2254
- );
2255
- }, g = n(0, l.length - c.length), y = [], m = 0; m < g; m++)
2256
- y[m] = "$" + m;
2257
- if (p = Function("binder", "return function (" + i(y, ",") + "){ return binder.apply(this,arguments); }")(d), l.prototype) {
2258
- var h = function() {
2259
- };
2260
- h.prototype = l.prototype, p.prototype = new h(), h.prototype = null;
2261
- }
2262
- return p;
2263
- }, Rt;
2264
- }
2265
- var Pt, Hr;
2266
- function ct() {
2267
- if (Hr) return Pt;
2268
- Hr = 1;
2269
- var t = Zi();
2270
- return Pt = Function.prototype.bind || t, Pt;
2271
- }
2272
- var xt, zr;
2273
- function nr() {
2274
- return zr || (zr = 1, xt = Function.prototype.call), xt;
2275
- }
2276
- var Tt, Wr;
2277
- function Bn() {
2278
- return Wr || (Wr = 1, Tt = Function.prototype.apply), Tt;
2279
- }
2280
- var es = typeof Reflect < "u" && Reflect && Reflect.apply, ts = ct(), rs = Bn(), ns = nr(), os = es, as = os || ts.call(ns, rs), is = ct(), ss = Ee, ls = nr(), cs = as, Un = function(e) {
2281
- if (e.length < 1 || typeof e[0] != "function")
2282
- throw new ss("a function is required");
2283
- return cs(is, ls, e);
2284
- }, Ct, Gr;
2285
- function us() {
2286
- if (Gr) return Ct;
2287
- Gr = 1;
2288
- var t = Un, e = In, n;
2289
- try {
2290
- n = /** @type {{ __proto__?: typeof Array.prototype }} */
2291
- [].__proto__ === Array.prototype;
2292
- } catch (i) {
2293
- if (!i || typeof i != "object" || !("code" in i) || i.code !== "ERR_PROTO_ACCESS")
2294
- throw i;
2295
- }
2296
- var r = !!n && e && e(
2297
- Object.prototype,
2298
- /** @type {keyof typeof Object.prototype} */
2299
- "__proto__"
2300
- ), o = Object, a = o.getPrototypeOf;
2301
- return Ct = r && typeof r.get == "function" ? t([r.get]) : typeof a == "function" ? (
2302
- /** @type {import('./get')} */
2303
- function(s) {
2304
- return a(s == null ? s : o(s));
2305
- }
2306
- ) : !1, Ct;
2307
- }
2308
- var _t, Kr;
2309
- function fs() {
2310
- if (Kr) return _t;
2311
- Kr = 1;
2312
- var t = Ln(), e = Mn(), n = us();
2313
- return _t = t ? function(o) {
2314
- return t(o);
2315
- } : e ? function(o) {
2316
- if (!o || typeof o != "object" && typeof o != "function")
2317
- throw new TypeError("getProto: not an object");
2318
- return e(o);
2319
- } : n ? function(o) {
2320
- return n(o);
2321
- } : null, _t;
2322
- }
2323
- var $t, Jr;
2324
- function ps() {
2325
- if (Jr) return $t;
2326
- Jr = 1;
2327
- var t = Function.prototype.call, e = Object.prototype.hasOwnProperty, n = ct();
2328
- return $t = n.call(t, e), $t;
2329
- }
2330
- var O, ds = Dn, ys = Di, hs = Ii, ms = Li, gs = Mi, we = Bi, ge = Ee, vs = Ui, ws = ki, bs = qi, Ss = ji, Es = Hi, As = zi, Os = Wi, Rs = Ji, kn = Function, Nt = function(t) {
2331
- try {
2332
- return kn('"use strict"; return (' + t + ").constructor;")();
2333
- } catch {
2334
- }
2335
- }, _e = In, Ps = Qi, Ft = function() {
2336
- throw new ge();
2337
- }, xs = _e ? function() {
2338
- try {
2339
- return arguments.callee, Ft;
2340
- } catch {
2341
- try {
2342
- return _e(arguments, "callee").get;
2343
- } catch {
2344
- return Ft;
2345
- }
2346
- }
2347
- }() : Ft, ye = Yi()(), I = fs(), Ts = Mn(), Cs = Ln(), qn = Bn(), Fe = nr(), me = {}, _s = typeof Uint8Array > "u" || !I ? O : I(Uint8Array), ue = {
2348
- __proto__: null,
2349
- "%AggregateError%": typeof AggregateError > "u" ? O : AggregateError,
2350
- "%Array%": Array,
2351
- "%ArrayBuffer%": typeof ArrayBuffer > "u" ? O : ArrayBuffer,
2352
- "%ArrayIteratorPrototype%": ye && I ? I([][Symbol.iterator]()) : O,
2353
- "%AsyncFromSyncIteratorPrototype%": O,
2354
- "%AsyncFunction%": me,
2355
- "%AsyncGenerator%": me,
2356
- "%AsyncGeneratorFunction%": me,
2357
- "%AsyncIteratorPrototype%": me,
2358
- "%Atomics%": typeof Atomics > "u" ? O : Atomics,
2359
- "%BigInt%": typeof BigInt > "u" ? O : BigInt,
2360
- "%BigInt64Array%": typeof BigInt64Array > "u" ? O : BigInt64Array,
2361
- "%BigUint64Array%": typeof BigUint64Array > "u" ? O : BigUint64Array,
2362
- "%Boolean%": Boolean,
2363
- "%DataView%": typeof DataView > "u" ? O : DataView,
2364
- "%Date%": Date,
2365
- "%decodeURI%": decodeURI,
2366
- "%decodeURIComponent%": decodeURIComponent,
2367
- "%encodeURI%": encodeURI,
2368
- "%encodeURIComponent%": encodeURIComponent,
2369
- "%Error%": ys,
2370
- "%eval%": eval,
2371
- // eslint-disable-line no-eval
2372
- "%EvalError%": hs,
2373
- "%Float16Array%": typeof Float16Array > "u" ? O : Float16Array,
2374
- "%Float32Array%": typeof Float32Array > "u" ? O : Float32Array,
2375
- "%Float64Array%": typeof Float64Array > "u" ? O : Float64Array,
2376
- "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? O : FinalizationRegistry,
2377
- "%Function%": kn,
2378
- "%GeneratorFunction%": me,
2379
- "%Int8Array%": typeof Int8Array > "u" ? O : Int8Array,
2380
- "%Int16Array%": typeof Int16Array > "u" ? O : Int16Array,
2381
- "%Int32Array%": typeof Int32Array > "u" ? O : Int32Array,
2382
- "%isFinite%": isFinite,
2383
- "%isNaN%": isNaN,
2384
- "%IteratorPrototype%": ye && I ? I(I([][Symbol.iterator]())) : O,
2385
- "%JSON%": typeof JSON == "object" ? JSON : O,
2386
- "%Map%": typeof Map > "u" ? O : Map,
2387
- "%MapIteratorPrototype%": typeof Map > "u" || !ye || !I ? O : I((/* @__PURE__ */ new Map())[Symbol.iterator]()),
2388
- "%Math%": Math,
2389
- "%Number%": Number,
2390
- "%Object%": ds,
2391
- "%Object.getOwnPropertyDescriptor%": _e,
2392
- "%parseFloat%": parseFloat,
2393
- "%parseInt%": parseInt,
2394
- "%Promise%": typeof Promise > "u" ? O : Promise,
2395
- "%Proxy%": typeof Proxy > "u" ? O : Proxy,
2396
- "%RangeError%": ms,
2397
- "%ReferenceError%": gs,
2398
- "%Reflect%": typeof Reflect > "u" ? O : Reflect,
2399
- "%RegExp%": RegExp,
2400
- "%Set%": typeof Set > "u" ? O : Set,
2401
- "%SetIteratorPrototype%": typeof Set > "u" || !ye || !I ? O : I((/* @__PURE__ */ new Set())[Symbol.iterator]()),
2402
- "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? O : SharedArrayBuffer,
2403
- "%String%": String,
2404
- "%StringIteratorPrototype%": ye && I ? I(""[Symbol.iterator]()) : O,
2405
- "%Symbol%": ye ? Symbol : O,
2406
- "%SyntaxError%": we,
2407
- "%ThrowTypeError%": xs,
2408
- "%TypedArray%": _s,
2409
- "%TypeError%": ge,
2410
- "%Uint8Array%": typeof Uint8Array > "u" ? O : Uint8Array,
2411
- "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? O : Uint8ClampedArray,
2412
- "%Uint16Array%": typeof Uint16Array > "u" ? O : Uint16Array,
2413
- "%Uint32Array%": typeof Uint32Array > "u" ? O : Uint32Array,
2414
- "%URIError%": vs,
2415
- "%WeakMap%": typeof WeakMap > "u" ? O : WeakMap,
2416
- "%WeakRef%": typeof WeakRef > "u" ? O : WeakRef,
2417
- "%WeakSet%": typeof WeakSet > "u" ? O : WeakSet,
2418
- "%Function.prototype.call%": Fe,
2419
- "%Function.prototype.apply%": qn,
2420
- "%Object.defineProperty%": Ps,
2421
- "%Object.getPrototypeOf%": Ts,
2422
- "%Math.abs%": ws,
2423
- "%Math.floor%": bs,
2424
- "%Math.max%": Ss,
2425
- "%Math.min%": Es,
2426
- "%Math.pow%": As,
2427
- "%Math.round%": Os,
2428
- "%Math.sign%": Rs,
2429
- "%Reflect.getPrototypeOf%": Cs
2430
- };
2431
- if (I)
2432
- try {
2433
- null.error;
2434
- } catch (t) {
2435
- var $s = I(I(t));
2436
- ue["%Error.prototype%"] = $s;
2437
- }
2438
- var Ns = function t(e) {
2439
- var n;
2440
- if (e === "%AsyncFunction%")
2441
- n = Nt("async function () {}");
2442
- else if (e === "%GeneratorFunction%")
2443
- n = Nt("function* () {}");
2444
- else if (e === "%AsyncGeneratorFunction%")
2445
- n = Nt("async function* () {}");
2446
- else if (e === "%AsyncGenerator%") {
2447
- var r = t("%AsyncGeneratorFunction%");
2448
- r && (n = r.prototype);
2449
- } else if (e === "%AsyncIteratorPrototype%") {
2450
- var o = t("%AsyncGenerator%");
2451
- o && I && (n = I(o.prototype));
2452
- }
2453
- return ue[e] = n, n;
2454
- }, Vr = {
2455
- __proto__: null,
2456
- "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
2457
- "%ArrayPrototype%": ["Array", "prototype"],
2458
- "%ArrayProto_entries%": ["Array", "prototype", "entries"],
2459
- "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
2460
- "%ArrayProto_keys%": ["Array", "prototype", "keys"],
2461
- "%ArrayProto_values%": ["Array", "prototype", "values"],
2462
- "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
2463
- "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
2464
- "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
2465
- "%BooleanPrototype%": ["Boolean", "prototype"],
2466
- "%DataViewPrototype%": ["DataView", "prototype"],
2467
- "%DatePrototype%": ["Date", "prototype"],
2468
- "%ErrorPrototype%": ["Error", "prototype"],
2469
- "%EvalErrorPrototype%": ["EvalError", "prototype"],
2470
- "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
2471
- "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
2472
- "%FunctionPrototype%": ["Function", "prototype"],
2473
- "%Generator%": ["GeneratorFunction", "prototype"],
2474
- "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
2475
- "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
2476
- "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
2477
- "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
2478
- "%JSONParse%": ["JSON", "parse"],
2479
- "%JSONStringify%": ["JSON", "stringify"],
2480
- "%MapPrototype%": ["Map", "prototype"],
2481
- "%NumberPrototype%": ["Number", "prototype"],
2482
- "%ObjectPrototype%": ["Object", "prototype"],
2483
- "%ObjProto_toString%": ["Object", "prototype", "toString"],
2484
- "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
2485
- "%PromisePrototype%": ["Promise", "prototype"],
2486
- "%PromiseProto_then%": ["Promise", "prototype", "then"],
2487
- "%Promise_all%": ["Promise", "all"],
2488
- "%Promise_reject%": ["Promise", "reject"],
2489
- "%Promise_resolve%": ["Promise", "resolve"],
2490
- "%RangeErrorPrototype%": ["RangeError", "prototype"],
2491
- "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
2492
- "%RegExpPrototype%": ["RegExp", "prototype"],
2493
- "%SetPrototype%": ["Set", "prototype"],
2494
- "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
2495
- "%StringPrototype%": ["String", "prototype"],
2496
- "%SymbolPrototype%": ["Symbol", "prototype"],
2497
- "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
2498
- "%TypedArrayPrototype%": ["TypedArray", "prototype"],
2499
- "%TypeErrorPrototype%": ["TypeError", "prototype"],
2500
- "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
2501
- "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
2502
- "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
2503
- "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
2504
- "%URIErrorPrototype%": ["URIError", "prototype"],
2505
- "%WeakMapPrototype%": ["WeakMap", "prototype"],
2506
- "%WeakSetPrototype%": ["WeakSet", "prototype"]
2507
- }, De = ct(), Ye = ps(), Fs = De.call(Fe, Array.prototype.concat), Ds = De.call(qn, Array.prototype.splice), Qr = De.call(Fe, String.prototype.replace), Ze = De.call(Fe, String.prototype.slice), Is = De.call(Fe, RegExp.prototype.exec), Ls = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Ms = /\\(\\)?/g, Bs = function(e) {
2508
- var n = Ze(e, 0, 1), r = Ze(e, -1);
2509
- if (n === "%" && r !== "%")
2510
- throw new we("invalid intrinsic syntax, expected closing `%`");
2511
- if (r === "%" && n !== "%")
2512
- throw new we("invalid intrinsic syntax, expected opening `%`");
2513
- var o = [];
2514
- return Qr(e, Ls, function(a, i, s, u) {
2515
- o[o.length] = s ? Qr(u, Ms, "$1") : i || a;
2516
- }), o;
2517
- }, Us = function(e, n) {
2518
- var r = e, o;
2519
- if (Ye(Vr, r) && (o = Vr[r], r = "%" + o[0] + "%"), Ye(ue, r)) {
2520
- var a = ue[r];
2521
- if (a === me && (a = Ns(r)), typeof a > "u" && !n)
2522
- throw new ge("intrinsic " + e + " exists, but is not available. Please file an issue!");
2523
- return {
2524
- alias: o,
2525
- name: r,
2526
- value: a
2527
- };
2528
- }
2529
- throw new we("intrinsic " + e + " does not exist!");
2530
- }, or = function(e, n) {
2531
- if (typeof e != "string" || e.length === 0)
2532
- throw new ge("intrinsic name must be a non-empty string");
2533
- if (arguments.length > 1 && typeof n != "boolean")
2534
- throw new ge('"allowMissing" argument must be a boolean');
2535
- if (Is(/^%?[^%]*%?$/, e) === null)
2536
- throw new we("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
2537
- var r = Bs(e), o = r.length > 0 ? r[0] : "", a = Us("%" + o + "%", n), i = a.name, s = a.value, u = !1, l = a.alias;
2538
- l && (o = l[0], Ds(r, Fs([0, 1], l)));
2539
- for (var c = 1, p = !0; c < r.length; c += 1) {
2540
- var d = r[c], g = Ze(d, 0, 1), y = Ze(d, -1);
2541
- if ((g === '"' || g === "'" || g === "`" || y === '"' || y === "'" || y === "`") && g !== y)
2542
- throw new we("property names with quotes must have matching quotes");
2543
- if ((d === "constructor" || !p) && (u = !0), o += "." + d, i = "%" + o + "%", Ye(ue, i))
2544
- s = ue[i];
2545
- else if (s != null) {
2546
- if (!(d in s)) {
2547
- if (!n)
2548
- throw new ge("base intrinsic for " + e + " exists, but the property is not available.");
2549
- return;
2550
- }
2551
- if (_e && c + 1 >= r.length) {
2552
- var m = _e(s, d);
2553
- p = !!m, p && "get" in m && !("originalValue" in m.get) ? s = m.get : s = s[d];
2554
- } else
2555
- p = Ye(s, d), s = s[d];
2556
- p && !u && (ue[i] = s);
2557
- }
2558
- }
2559
- return s;
2560
- }, jn = or, Hn = Un, ks = Hn([jn("%String.prototype.indexOf%")]), zn = function(e, n) {
2561
- var r = (
2562
- /** @type {Parameters<typeof callBindBasic>[0][0]} */
2563
- jn(e, !!n)
2564
- );
2565
- return typeof r == "function" && ks(e, ".prototype.") > -1 ? Hn([r]) : r;
2566
- }, qs = or, Ie = zn, js = st, Hs = Ee, Xr = qs("%Map%", !0), zs = Ie("Map.prototype.get", !0), Ws = Ie("Map.prototype.set", !0), Gs = Ie("Map.prototype.has", !0), Ks = Ie("Map.prototype.delete", !0), Js = Ie("Map.prototype.size", !0), Wn = !!Xr && /** @type {Exclude<import('.'), false>} */
2567
- function() {
2568
- var e, n = {
2569
- assert: function(r) {
2570
- if (!n.has(r))
2571
- throw new Hs("Side channel does not contain " + js(r));
2572
- },
2573
- delete: function(r) {
2574
- if (e) {
2575
- var o = Ks(e, r);
2576
- return Js(e) === 0 && (e = void 0), o;
2577
- }
2578
- return !1;
2579
- },
2580
- get: function(r) {
2581
- if (e)
2582
- return zs(e, r);
2583
- },
2584
- has: function(r) {
2585
- return e ? Gs(e, r) : !1;
2586
- },
2587
- set: function(r, o) {
2588
- e || (e = new Xr()), Ws(e, r, o);
2589
- }
191
+ const checkProgress = async (taskId, type, fileName, fileSuffix = "") => {
192
+ progressLoading.value = true;
193
+ getProgress(taskId, type, fileName, fileSuffix);
194
+ progressTimer = setTimeout(() => {
195
+ }, 50);
2590
196
  };
2591
- return n;
2592
- }, Vs = or, ut = zn, Qs = st, Ue = Wn, Xs = Ee, he = Vs("%WeakMap%", !0), Ys = ut("WeakMap.prototype.get", !0), Zs = ut("WeakMap.prototype.set", !0), el = ut("WeakMap.prototype.has", !0), tl = ut("WeakMap.prototype.delete", !0), rl = he ? (
2593
- /** @type {Exclude<import('.'), false>} */
2594
- function() {
2595
- var e, n, r = {
2596
- assert: function(o) {
2597
- if (!r.has(o))
2598
- throw new Xs("Side channel does not contain " + Qs(o));
2599
- },
2600
- delete: function(o) {
2601
- if (he && o && (typeof o == "object" || typeof o == "function")) {
2602
- if (e)
2603
- return tl(e, o);
2604
- } else if (Ue && n)
2605
- return n.delete(o);
2606
- return !1;
2607
- },
2608
- get: function(o) {
2609
- return he && o && (typeof o == "object" || typeof o == "function") && e ? Ys(e, o) : n && n.get(o);
2610
- },
2611
- has: function(o) {
2612
- return he && o && (typeof o == "object" || typeof o == "function") && e ? el(e, o) : !!n && n.has(o);
2613
- },
2614
- set: function(o, a) {
2615
- he && o && (typeof o == "object" || typeof o == "function") ? (e || (e = new he()), Zs(e, o, a)) : Ue && (n || (n = Ue()), n.set(o, a));
2616
- }
2617
- };
2618
- return r;
2619
- }
2620
- ) : Ue, nl = Ee, ol = st, al = Fi, il = Wn, sl = rl, ll = sl || il || al, cl = function() {
2621
- var e, n = {
2622
- assert: function(r) {
2623
- if (!n.has(r))
2624
- throw new nl("Side channel does not contain " + ol(r));
2625
- },
2626
- delete: function(r) {
2627
- return !!e && e.delete(r);
2628
- },
2629
- get: function(r) {
2630
- return e && e.get(r);
2631
- },
2632
- has: function(r) {
2633
- return !!e && e.has(r);
2634
- },
2635
- set: function(r, o) {
2636
- e || (e = ll()), e.set(r, o);
2637
- }
197
+ const clearTimer = () => {
198
+ clearTimeout(progressTimer);
199
+ progressTimer = null;
200
+ showProgressDialog.value = false;
2638
201
  };
2639
- return n;
2640
- }, ul = String.prototype.replace, fl = /%20/g, Dt = {
2641
- RFC1738: "RFC1738",
2642
- RFC3986: "RFC3986"
2643
- }, ar = {
2644
- default: Dt.RFC3986,
2645
- formatters: {
2646
- RFC1738: function(t) {
2647
- return ul.call(t, fl, "+");
2648
- },
2649
- RFC3986: function(t) {
2650
- return String(t);
2651
- }
2652
- },
2653
- RFC1738: Dt.RFC1738,
2654
- RFC3986: Dt.RFC3986
2655
- }, pl = ar, It = Object.prototype.hasOwnProperty, se = Array.isArray, ee = function() {
2656
- for (var t = [], e = 0; e < 256; ++e)
2657
- t.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase());
2658
- return t;
2659
- }(), dl = function(e) {
2660
- for (; e.length > 1; ) {
2661
- var n = e.pop(), r = n.obj[n.prop];
2662
- if (se(r)) {
2663
- for (var o = [], a = 0; a < r.length; ++a)
2664
- typeof r[a] < "u" && o.push(r[a]);
2665
- n.obj[n.prop] = o;
2666
- }
2667
- }
2668
- }, Gn = function(e, n) {
2669
- for (var r = n && n.plainObjects ? { __proto__: null } : {}, o = 0; o < e.length; ++o)
2670
- typeof e[o] < "u" && (r[o] = e[o]);
2671
- return r;
2672
- }, yl = function t(e, n, r) {
2673
- if (!n)
2674
- return e;
2675
- if (typeof n != "object" && typeof n != "function") {
2676
- if (se(e))
2677
- e.push(n);
2678
- else if (e && typeof e == "object")
2679
- (r && (r.plainObjects || r.allowPrototypes) || !It.call(Object.prototype, n)) && (e[n] = !0);
2680
- else
2681
- return [e, n];
2682
- return e;
2683
- }
2684
- if (!e || typeof e != "object")
2685
- return [e].concat(n);
2686
- var o = e;
2687
- return se(e) && !se(n) && (o = Gn(e, r)), se(e) && se(n) ? (n.forEach(function(a, i) {
2688
- if (It.call(e, i)) {
2689
- var s = e[i];
2690
- s && typeof s == "object" && a && typeof a == "object" ? e[i] = t(s, a, r) : e.push(a);
2691
- } else
2692
- e[i] = a;
2693
- }), e) : Object.keys(n).reduce(function(a, i) {
2694
- var s = n[i];
2695
- return It.call(a, i) ? a[i] = t(a[i], s, r) : a[i] = s, a;
2696
- }, o);
2697
- }, hl = function(e, n) {
2698
- return Object.keys(n).reduce(function(r, o) {
2699
- return r[o] = n[o], r;
2700
- }, e);
2701
- }, ml = function(t, e, n) {
2702
- var r = t.replace(/\+/g, " ");
2703
- if (n === "iso-8859-1")
2704
- return r.replace(/%[0-9a-f]{2}/gi, unescape);
2705
- try {
2706
- return decodeURIComponent(r);
2707
- } catch {
2708
- return r;
2709
- }
2710
- }, Lt = 1024, gl = function(e, n, r, o, a) {
2711
- if (e.length === 0)
2712
- return e;
2713
- var i = e;
2714
- if (typeof e == "symbol" ? i = Symbol.prototype.toString.call(e) : typeof e != "string" && (i = String(e)), r === "iso-8859-1")
2715
- return escape(i).replace(/%u[0-9a-f]{4}/gi, function(g) {
2716
- return "%26%23" + parseInt(g.slice(2), 16) + "%3B";
2717
- });
2718
- for (var s = "", u = 0; u < i.length; u += Lt) {
2719
- for (var l = i.length >= Lt ? i.slice(u, u + Lt) : i, c = [], p = 0; p < l.length; ++p) {
2720
- var d = l.charCodeAt(p);
2721
- if (d === 45 || d === 46 || d === 95 || d === 126 || d >= 48 && d <= 57 || d >= 65 && d <= 90 || d >= 97 && d <= 122 || a === pl.RFC1738 && (d === 40 || d === 41)) {
2722
- c[c.length] = l.charAt(p);
2723
- continue;
2724
- }
2725
- if (d < 128) {
2726
- c[c.length] = ee[d];
2727
- continue;
2728
- }
2729
- if (d < 2048) {
2730
- c[c.length] = ee[192 | d >> 6] + ee[128 | d & 63];
2731
- continue;
2732
- }
2733
- if (d < 55296 || d >= 57344) {
2734
- c[c.length] = ee[224 | d >> 12] + ee[128 | d >> 6 & 63] + ee[128 | d & 63];
2735
- continue;
2736
- }
2737
- p += 1, d = 65536 + ((d & 1023) << 10 | l.charCodeAt(p) & 1023), c[c.length] = ee[240 | d >> 18] + ee[128 | d >> 12 & 63] + ee[128 | d >> 6 & 63] + ee[128 | d & 63];
2738
- }
2739
- s += c.join("");
2740
- }
2741
- return s;
2742
- }, vl = function(e) {
2743
- for (var n = [{ obj: { o: e }, prop: "o" }], r = [], o = 0; o < n.length; ++o)
2744
- for (var a = n[o], i = a.obj[a.prop], s = Object.keys(i), u = 0; u < s.length; ++u) {
2745
- var l = s[u], c = i[l];
2746
- typeof c == "object" && c !== null && r.indexOf(c) === -1 && (n.push({ obj: i, prop: l }), r.push(c));
2747
- }
2748
- return dl(n), e;
2749
- }, wl = function(e) {
2750
- return Object.prototype.toString.call(e) === "[object RegExp]";
2751
- }, bl = function(e) {
2752
- return !e || typeof e != "object" ? !1 : !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e));
2753
- }, Sl = function(e, n) {
2754
- return [].concat(e, n);
2755
- }, El = function(e, n) {
2756
- if (se(e)) {
2757
- for (var r = [], o = 0; o < e.length; o += 1)
2758
- r.push(n(e[o]));
2759
- return r;
2760
- }
2761
- return n(e);
2762
- }, Kn = {
2763
- arrayToObject: Gn,
2764
- assign: hl,
2765
- combine: Sl,
2766
- compact: vl,
2767
- decode: ml,
2768
- encode: gl,
2769
- isBuffer: bl,
2770
- isRegExp: wl,
2771
- maybeMap: El,
2772
- merge: yl
2773
- }, Jn = cl, Ge = Kn, Te = ar, Al = Object.prototype.hasOwnProperty, Vn = {
2774
- brackets: function(e) {
2775
- return e + "[]";
2776
- },
2777
- comma: "comma",
2778
- indices: function(e, n) {
2779
- return e + "[" + n + "]";
2780
- },
2781
- repeat: function(e) {
2782
- return e;
2783
- }
2784
- }, te = Array.isArray, Ol = Array.prototype.push, Qn = function(t, e) {
2785
- Ol.apply(t, te(e) ? e : [e]);
2786
- }, Rl = Date.prototype.toISOString, Yr = Te.default, D = {
2787
- addQueryPrefix: !1,
2788
- allowDots: !1,
2789
- allowEmptyArrays: !1,
2790
- arrayFormat: "indices",
2791
- charset: "utf-8",
2792
- charsetSentinel: !1,
2793
- commaRoundTrip: !1,
2794
- delimiter: "&",
2795
- encode: !0,
2796
- encodeDotInKeys: !1,
2797
- encoder: Ge.encode,
2798
- encodeValuesOnly: !1,
2799
- filter: void 0,
2800
- format: Yr,
2801
- formatter: Te.formatters[Yr],
2802
- // deprecated
2803
- indices: !1,
2804
- serializeDate: function(e) {
2805
- return Rl.call(e);
2806
- },
2807
- skipNulls: !1,
2808
- strictNullHandling: !1
2809
- }, Pl = function(e) {
2810
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint";
2811
- }, Mt = {}, xl = function t(e, n, r, o, a, i, s, u, l, c, p, d, g, y, m, h, E, R) {
2812
- for (var v = e, F = R, x = 0, L = !1; (F = F.get(Mt)) !== void 0 && !L; ) {
2813
- var M = F.get(e);
2814
- if (x += 1, typeof M < "u") {
2815
- if (M === x)
2816
- throw new RangeError("Cyclic object value");
2817
- L = !0;
2818
- }
2819
- typeof F.get(Mt) > "u" && (x = 0);
2820
- }
2821
- if (typeof c == "function" ? v = c(n, v) : v instanceof Date ? v = g(v) : r === "comma" && te(v) && (v = Ge.maybeMap(v, function(X) {
2822
- return X instanceof Date ? g(X) : X;
2823
- })), v === null) {
2824
- if (i)
2825
- return l && !h ? l(n, D.encoder, E, "key", y) : n;
2826
- v = "";
2827
- }
2828
- if (Pl(v) || Ge.isBuffer(v)) {
2829
- if (l) {
2830
- var z = h ? n : l(n, D.encoder, E, "key", y);
2831
- return [m(z) + "=" + m(l(v, D.encoder, E, "value", y))];
2832
- }
2833
- return [m(n) + "=" + m(String(v))];
2834
- }
2835
- var K = [];
2836
- if (typeof v > "u")
2837
- return K;
2838
- var S;
2839
- if (r === "comma" && te(v))
2840
- h && l && (v = Ge.maybeMap(v, l)), S = [{ value: v.length > 0 ? v.join(",") || null : void 0 }];
2841
- else if (te(c))
2842
- S = c;
2843
- else {
2844
- var A = Object.keys(v);
2845
- S = p ? A.sort(p) : A;
2846
- }
2847
- var T = u ? String(n).replace(/\./g, "%2E") : String(n), P = o && te(v) && v.length === 1 ? T + "[]" : T;
2848
- if (a && te(v) && v.length === 0)
2849
- return P + "[]";
2850
- for (var $ = 0; $ < S.length; ++$) {
2851
- var w = S[$], j = typeof w == "object" && w && typeof w.value < "u" ? w.value : v[w];
2852
- if (!(s && j === null)) {
2853
- var U = d && u ? String(w).replace(/\./g, "%2E") : String(w), k = te(v) ? typeof r == "function" ? r(P, U) : P : P + (d ? "." + U : "[" + U + "]");
2854
- R.set(e, x);
2855
- var W = Jn();
2856
- W.set(Mt, R), Qn(K, t(
2857
- j,
2858
- k,
2859
- r,
2860
- o,
2861
- a,
2862
- i,
2863
- s,
2864
- u,
2865
- r === "comma" && h && te(v) ? null : l,
2866
- c,
2867
- p,
2868
- d,
2869
- g,
2870
- y,
2871
- m,
2872
- h,
2873
- E,
2874
- W
2875
- ));
202
+ const getProgress = async (taskId, type = "export", fileName, fileSuffix = "") => {
203
+ const [error, data] = await getTaskProgress("", {
204
+ url: `progress/${taskId}`
205
+ }).run();
206
+ if (error) {
207
+ progressLoading.value = false;
208
+ return;
2876
209
  }
2877
- }
2878
- return K;
2879
- }, Tl = function(e) {
2880
- if (!e)
2881
- return D;
2882
- if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
2883
- throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
2884
- if (typeof e.encodeDotInKeys < "u" && typeof e.encodeDotInKeys != "boolean")
2885
- throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
2886
- if (e.encoder !== null && typeof e.encoder < "u" && typeof e.encoder != "function")
2887
- throw new TypeError("Encoder has to be a function.");
2888
- var n = e.charset || D.charset;
2889
- if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
2890
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
2891
- var r = Te.default;
2892
- if (typeof e.format < "u") {
2893
- if (!Al.call(Te.formatters, e.format))
2894
- throw new TypeError("Unknown format option provided.");
2895
- r = e.format;
2896
- }
2897
- var o = Te.formatters[r], a = D.filter;
2898
- (typeof e.filter == "function" || te(e.filter)) && (a = e.filter);
2899
- var i;
2900
- if (e.arrayFormat in Vn ? i = e.arrayFormat : "indices" in e ? i = e.indices ? "indices" : "repeat" : i = D.arrayFormat, "commaRoundTrip" in e && typeof e.commaRoundTrip != "boolean")
2901
- throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
2902
- var s = typeof e.allowDots > "u" ? e.encodeDotInKeys === !0 ? !0 : D.allowDots : !!e.allowDots;
2903
- return {
2904
- addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix : D.addQueryPrefix,
2905
- allowDots: s,
2906
- allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : D.allowEmptyArrays,
2907
- arrayFormat: i,
2908
- charset: n,
2909
- charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : D.charsetSentinel,
2910
- commaRoundTrip: !!e.commaRoundTrip,
2911
- delimiter: typeof e.delimiter > "u" ? D.delimiter : e.delimiter,
2912
- encode: typeof e.encode == "boolean" ? e.encode : D.encode,
2913
- encodeDotInKeys: typeof e.encodeDotInKeys == "boolean" ? e.encodeDotInKeys : D.encodeDotInKeys,
2914
- encoder: typeof e.encoder == "function" ? e.encoder : D.encoder,
2915
- encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly : D.encodeValuesOnly,
2916
- filter: a,
2917
- format: r,
2918
- formatter: o,
2919
- serializeDate: typeof e.serializeDate == "function" ? e.serializeDate : D.serializeDate,
2920
- skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls : D.skipNulls,
2921
- sort: typeof e.sort == "function" ? e.sort : null,
2922
- strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : D.strictNullHandling
2923
- };
2924
- }, Cl = function(t, e) {
2925
- var n = t, r = Tl(e), o, a;
2926
- typeof r.filter == "function" ? (a = r.filter, n = a("", n)) : te(r.filter) && (a = r.filter, o = a);
2927
- var i = [];
2928
- if (typeof n != "object" || n === null)
2929
- return "";
2930
- var s = Vn[r.arrayFormat], u = s === "comma" && r.commaRoundTrip;
2931
- o || (o = Object.keys(n)), r.sort && o.sort(r.sort);
2932
- for (var l = Jn(), c = 0; c < o.length; ++c) {
2933
- var p = o[c], d = n[p];
2934
- r.skipNulls && d === null || Qn(i, xl(
2935
- d,
2936
- p,
2937
- s,
2938
- u,
2939
- r.allowEmptyArrays,
2940
- r.strictNullHandling,
2941
- r.skipNulls,
2942
- r.encodeDotInKeys,
2943
- r.encode ? r.encoder : null,
2944
- r.filter,
2945
- r.sort,
2946
- r.allowDots,
2947
- r.serializeDate,
2948
- r.format,
2949
- r.formatter,
2950
- r.encodeValuesOnly,
2951
- r.charset,
2952
- l
2953
- ));
2954
- }
2955
- var g = i.join(r.delimiter), y = r.addQueryPrefix === !0 ? "?" : "";
2956
- return r.charsetSentinel && (r.charset === "iso-8859-1" ? y += "utf8=%26%2310003%3B&" : y += "utf8=%E2%9C%93&"), g.length > 0 ? y + g : "";
2957
- }, pe = Kn, Vt = Object.prototype.hasOwnProperty, Zr = Array.isArray, _ = {
2958
- allowDots: !1,
2959
- allowEmptyArrays: !1,
2960
- allowPrototypes: !1,
2961
- allowSparse: !1,
2962
- arrayLimit: 20,
2963
- charset: "utf-8",
2964
- charsetSentinel: !1,
2965
- comma: !1,
2966
- decodeDotInKeys: !1,
2967
- decoder: pe.decode,
2968
- delimiter: "&",
2969
- depth: 5,
2970
- duplicates: "combine",
2971
- ignoreQueryPrefix: !1,
2972
- interpretNumericEntities: !1,
2973
- parameterLimit: 1e3,
2974
- parseArrays: !0,
2975
- plainObjects: !1,
2976
- strictDepth: !1,
2977
- strictNullHandling: !1,
2978
- throwOnLimitExceeded: !1
2979
- }, _l = function(t) {
2980
- return t.replace(/&#(\d+);/g, function(e, n) {
2981
- return String.fromCharCode(parseInt(n, 10));
2982
- });
2983
- }, Xn = function(t, e, n) {
2984
- if (t && typeof t == "string" && e.comma && t.indexOf(",") > -1)
2985
- return t.split(",");
2986
- if (e.throwOnLimitExceeded && n >= e.arrayLimit)
2987
- throw new RangeError("Array limit exceeded. Only " + e.arrayLimit + " element" + (e.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
2988
- return t;
2989
- }, $l = "utf8=%26%2310003%3B", Nl = "utf8=%E2%9C%93", Fl = function(e, n) {
2990
- var r = { __proto__: null }, o = n.ignoreQueryPrefix ? e.replace(/^\?/, "") : e;
2991
- o = o.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
2992
- var a = n.parameterLimit === 1 / 0 ? void 0 : n.parameterLimit, i = o.split(
2993
- n.delimiter,
2994
- n.throwOnLimitExceeded ? a + 1 : a
2995
- );
2996
- if (n.throwOnLimitExceeded && i.length > a)
2997
- throw new RangeError("Parameter limit exceeded. Only " + a + " parameter" + (a === 1 ? "" : "s") + " allowed.");
2998
- var s = -1, u, l = n.charset;
2999
- if (n.charsetSentinel)
3000
- for (u = 0; u < i.length; ++u)
3001
- i[u].indexOf("utf8=") === 0 && (i[u] === Nl ? l = "utf-8" : i[u] === $l && (l = "iso-8859-1"), s = u, u = i.length);
3002
- for (u = 0; u < i.length; ++u)
3003
- if (u !== s) {
3004
- var c = i[u], p = c.indexOf("]="), d = p === -1 ? c.indexOf("=") : p + 1, g, y;
3005
- d === -1 ? (g = n.decoder(c, _.decoder, l, "key"), y = n.strictNullHandling ? null : "") : (g = n.decoder(c.slice(0, d), _.decoder, l, "key"), y = pe.maybeMap(
3006
- Xn(
3007
- c.slice(d + 1),
3008
- n,
3009
- Zr(r[g]) ? r[g].length : 0
3010
- ),
3011
- function(h) {
3012
- return n.decoder(h, _.decoder, l, "value");
210
+ percent.value = data.percentage;
211
+ if (percent.value == 100) {
212
+ progressResult.value = data;
213
+ progressLoading.value = false;
214
+ clearTimer();
215
+ if (type == "export") {
216
+ if (data.status == 1) {
217
+ progressStatus.value = "success";
218
+ let analysisFIlePath = await extractFilename(`/oss/${data?.filePath}`);
219
+ const pathName = analysisFIlePath?.split("/")?.pop() || "";
220
+ let exportName = fileName || pathName;
221
+ downloadFile(`${getConfig().baseURL}/oss${data.filePath}`, exportName, fileSuffix);
222
+ progressLoading.value = false;
223
+ } else if (data.status == 2) {
224
+ errorMessage.value = data.message || (type == "export" ? t("导出失败") : t("导入失败"));
225
+ window.DasMessage?.error({
226
+ message: errorMessage.value,
227
+ grouping: true,
228
+ repeatNum: 1
229
+ });
3013
230
  }
3014
- )), y && n.interpretNumericEntities && l === "iso-8859-1" && (y = _l(String(y))), c.indexOf("[]=") > -1 && (y = Zr(y) ? [y] : y);
3015
- var m = Vt.call(r, g);
3016
- m && n.duplicates === "combine" ? r[g] = pe.combine(r[g], y) : (!m || n.duplicates === "last") && (r[g] = y);
3017
- }
3018
- return r;
3019
- }, Dl = function(t, e, n, r) {
3020
- var o = 0;
3021
- if (t.length > 0 && t[t.length - 1] === "[]") {
3022
- var a = t.slice(0, -1).join("");
3023
- o = Array.isArray(e) && e[a] ? e[a].length : 0;
3024
- }
3025
- for (var i = r ? e : Xn(e, n, o), s = t.length - 1; s >= 0; --s) {
3026
- var u, l = t[s];
3027
- if (l === "[]" && n.parseArrays)
3028
- u = n.allowEmptyArrays && (i === "" || n.strictNullHandling && i === null) ? [] : pe.combine([], i);
3029
- else {
3030
- u = n.plainObjects ? { __proto__: null } : {};
3031
- var c = l.charAt(0) === "[" && l.charAt(l.length - 1) === "]" ? l.slice(1, -1) : l, p = n.decodeDotInKeys ? c.replace(/%2E/g, ".") : c, d = parseInt(p, 10);
3032
- !n.parseArrays && p === "" ? u = { 0: i } : !isNaN(d) && l !== p && String(d) === p && d >= 0 && n.parseArrays && d <= n.arrayLimit ? (u = [], u[d] = i) : p !== "__proto__" && (u[p] = i);
3033
- }
3034
- i = u;
3035
- }
3036
- return i;
3037
- }, Il = function(e, n, r, o) {
3038
- if (e) {
3039
- var a = r.allowDots ? e.replace(/\.([^.[]+)/g, "[$1]") : e, i = /(\[[^[\]]*])/, s = /(\[[^[\]]*])/g, u = r.depth > 0 && i.exec(a), l = u ? a.slice(0, u.index) : a, c = [];
3040
- if (l) {
3041
- if (!r.plainObjects && Vt.call(Object.prototype, l) && !r.allowPrototypes)
3042
- return;
3043
- c.push(l);
3044
- }
3045
- for (var p = 0; r.depth > 0 && (u = s.exec(a)) !== null && p < r.depth; ) {
3046
- if (p += 1, !r.plainObjects && Vt.call(Object.prototype, u[1].slice(1, -1)) && !r.allowPrototypes)
3047
- return;
3048
- c.push(u[1]);
3049
- }
3050
- if (u) {
3051
- if (r.strictDepth === !0)
3052
- throw new RangeError("Input depth exceeded depth option of " + r.depth + " and strictDepth is true");
3053
- c.push("[" + a.slice(u.index) + "]");
3054
- }
3055
- return Dl(c, n, r, o);
3056
- }
3057
- }, Ll = function(e) {
3058
- if (!e)
3059
- return _;
3060
- if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
3061
- throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
3062
- if (typeof e.decodeDotInKeys < "u" && typeof e.decodeDotInKeys != "boolean")
3063
- throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
3064
- if (e.decoder !== null && typeof e.decoder < "u" && typeof e.decoder != "function")
3065
- throw new TypeError("Decoder has to be a function.");
3066
- if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
3067
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
3068
- if (typeof e.throwOnLimitExceeded < "u" && typeof e.throwOnLimitExceeded != "boolean")
3069
- throw new TypeError("`throwOnLimitExceeded` option must be a boolean");
3070
- var n = typeof e.charset > "u" ? _.charset : e.charset, r = typeof e.duplicates > "u" ? _.duplicates : e.duplicates;
3071
- if (r !== "combine" && r !== "first" && r !== "last")
3072
- throw new TypeError("The duplicates option must be either combine, first, or last");
3073
- var o = typeof e.allowDots > "u" ? e.decodeDotInKeys === !0 ? !0 : _.allowDots : !!e.allowDots;
3074
- return {
3075
- allowDots: o,
3076
- allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : _.allowEmptyArrays,
3077
- allowPrototypes: typeof e.allowPrototypes == "boolean" ? e.allowPrototypes : _.allowPrototypes,
3078
- allowSparse: typeof e.allowSparse == "boolean" ? e.allowSparse : _.allowSparse,
3079
- arrayLimit: typeof e.arrayLimit == "number" ? e.arrayLimit : _.arrayLimit,
3080
- charset: n,
3081
- charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : _.charsetSentinel,
3082
- comma: typeof e.comma == "boolean" ? e.comma : _.comma,
3083
- decodeDotInKeys: typeof e.decodeDotInKeys == "boolean" ? e.decodeDotInKeys : _.decodeDotInKeys,
3084
- decoder: typeof e.decoder == "function" ? e.decoder : _.decoder,
3085
- delimiter: typeof e.delimiter == "string" || pe.isRegExp(e.delimiter) ? e.delimiter : _.delimiter,
3086
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
3087
- depth: typeof e.depth == "number" || e.depth === !1 ? +e.depth : _.depth,
3088
- duplicates: r,
3089
- ignoreQueryPrefix: e.ignoreQueryPrefix === !0,
3090
- interpretNumericEntities: typeof e.interpretNumericEntities == "boolean" ? e.interpretNumericEntities : _.interpretNumericEntities,
3091
- parameterLimit: typeof e.parameterLimit == "number" ? e.parameterLimit : _.parameterLimit,
3092
- parseArrays: e.parseArrays !== !1,
3093
- plainObjects: typeof e.plainObjects == "boolean" ? e.plainObjects : _.plainObjects,
3094
- strictDepth: typeof e.strictDepth == "boolean" ? !!e.strictDepth : _.strictDepth,
3095
- strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : _.strictNullHandling,
3096
- throwOnLimitExceeded: typeof e.throwOnLimitExceeded == "boolean" ? e.throwOnLimitExceeded : !1
3097
- };
3098
- }, Ml = function(t, e) {
3099
- var n = Ll(e);
3100
- if (t === "" || t === null || typeof t > "u")
3101
- return n.plainObjects ? { __proto__: null } : {};
3102
- for (var r = typeof t == "string" ? Fl(t, n) : t, o = n.plainObjects ? { __proto__: null } : {}, a = Object.keys(r), i = 0; i < a.length; ++i) {
3103
- var s = a[i], u = Il(s, r[s], n, typeof t == "string");
3104
- o = pe.merge(o, u, n);
3105
- }
3106
- return n.allowSparse === !0 ? o : pe.compact(o);
3107
- }, Bl = Cl, Ul = Ml, kl = ar, ql = {
3108
- formats: kl,
3109
- parse: Ul,
3110
- stringify: Bl
3111
- };
3112
- const jl = /* @__PURE__ */ Ja(ql);
3113
- /*! js-cookie v3.0.5 | MIT */
3114
- function ke(t) {
3115
- for (var e = 1; e < arguments.length; e++) {
3116
- var n = arguments[e];
3117
- for (var r in n)
3118
- t[r] = n[r];
3119
- }
3120
- return t;
3121
- }
3122
- var Hl = {
3123
- read: function(t) {
3124
- return t[0] === '"' && (t = t.slice(1, -1)), t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
3125
- },
3126
- write: function(t) {
3127
- return encodeURIComponent(t).replace(
3128
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
3129
- decodeURIComponent
3130
- );
3131
- }
3132
- };
3133
- function Qt(t, e) {
3134
- function n(o, a, i) {
3135
- if (!(typeof document > "u")) {
3136
- i = ke({}, e, i), typeof i.expires == "number" && (i.expires = new Date(Date.now() + i.expires * 864e5)), i.expires && (i.expires = i.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
3137
- var s = "";
3138
- for (var u in i)
3139
- i[u] && (s += "; " + u, i[u] !== !0 && (s += "=" + i[u].split(";")[0]));
3140
- return document.cookie = o + "=" + t.write(a, o) + s;
3141
- }
3142
- }
3143
- function r(o) {
3144
- if (!(typeof document > "u" || arguments.length && !o)) {
3145
- for (var a = document.cookie ? document.cookie.split("; ") : [], i = {}, s = 0; s < a.length; s++) {
3146
- var u = a[s].split("="), l = u.slice(1).join("=");
3147
- try {
3148
- var c = decodeURIComponent(u[0]);
3149
- if (i[c] = t.read(l, c), o === c)
3150
- break;
3151
- } catch {
231
+ } else if (type == "import") {
232
+ if (!!data.filePath) {
233
+ progressStatus.value = "error";
234
+ errorImport.value = true;
235
+ let analysisFIlePath = await extractFilename(`/oss/${data?.filePath}`);
236
+ const pathName = analysisFIlePath?.split("/")?.pop() || data.filePath.split("/").pop() || "";
237
+ errorFileName.value = tempErrPathName ? tempErrPathName : pathName;
238
+ errorFileSize.value = fileInfo.sizeText;
239
+ errorMessage.value = t("部分数据校验不通过,请下载附件并修改,重新导入!");
240
+ errorFilePath.value = `${getConfig().baseURL}/oss/${data?.filePath}`;
3152
241
  }
242
+ tipHandle(data.status, type, data.message);
243
+ } else if (type == "action") {
244
+ progressStatus.value = "success";
3153
245
  }
3154
- return o ? i[o] : i;
3155
- }
3156
- }
3157
- return Object.create(
3158
- {
3159
- set: n,
3160
- get: r,
3161
- remove: function(o, a) {
3162
- n(
3163
- o,
3164
- "",
3165
- ke({}, a, {
3166
- expires: -1
3167
- })
3168
- );
3169
- },
3170
- withAttributes: function(o) {
3171
- return Qt(this.converter, ke({}, this.attributes, o));
3172
- },
3173
- withConverter: function(o) {
3174
- return Qt(ke({}, this.converter, o), this.attributes);
3175
- }
3176
- },
3177
- {
3178
- attributes: { value: Object.freeze(e) },
3179
- converter: { value: Object.freeze(t) }
3180
- }
3181
- );
3182
- }
3183
- var zl = Qt(Hl, { path: "/" });
3184
- const Wl = {
3185
- 参数校验错误: { "zh-CN": "参数校验错误", en: "Parameter Validation Error", _appCode: "framework" },
3186
- 接口地址未找到: { "zh-CN": "接口地址未找到", en: "Api endpoint not found", _appCode: "framework" },
3187
- 服务器内部错误: { "zh-CN": "服务器内部错误", en: "Internal Server Error", _appCode: "framework" },
3188
- 解析错误: { "zh-CN": "解析错误", en: "Parsing Error", _appCode: "framework" },
3189
- 请求配置异常: { "zh-CN": "请求配置异常", en: "Request Configuration Error", _appCode: "framework" },
3190
- "网络异常,请检查您的网络情况": {
3191
- "zh-CN": "网络异常,请检查您的网络情况",
3192
- en: "Network error, please check your network status",
3193
- _appCode: "framework"
3194
- }
3195
- };
3196
- oo(Wl);
3197
- et.extend(po);
3198
- et.extend(yo);
3199
- const ir = Ke(), Yn = ir.sso ?? !0, Gl = ir.i18n ?? !0, Zn = ir.noRedireLogin ?? !1, eo = () => {
3200
- if (Zn) return;
3201
- const t = "/login";
3202
- location.pathname !== t && (sessionStorage.clear(), window.__isAutoCloseApp = !1, location.replace(t));
3203
- }, Kl = async (t) => {
3204
- var n;
3205
- return ((n = t.config) == null ? void 0 : n.responseType) === "blob" ? t : t.data ?? t;
3206
- }, Jl = async (t, e) => {
3207
- var u, l, c, p, d;
3208
- let n = ((u = t.response) == null ? void 0 : u.status) || 500, r = (l = t.response) == null ? void 0 : l.message, o = {};
3209
- const a = { 400: C("参数校验错误"), 404: C("接口地址未找到"), 500: C("服务器内部错误") };
3210
- let i = ((c = t == null ? void 0 : t.response) == null ? void 0 : c.data) || {};
3211
- if (!(lo("code") || "") && !Zn && (n === 401 || (i == null ? void 0 : i.code) === 401))
3212
- Yn ? co({ ...fo, redirect_uri: uo }) : eo(), o = i;
3213
- else {
3214
- if (t.response) {
3215
- if (i instanceof Blob && (i = await new Promise((g) => {
3216
- const y = new FileReader();
3217
- y.readAsText(i, "utf-8"), y.onload = () => {
3218
- try {
3219
- g(JSON.parse(y.result || "{}"));
3220
- } catch {
3221
- g({ code: 400, msg: C("blob解析错误") });
3222
- }
3223
- };
3224
- })), i.code) {
3225
- n = i.code;
3226
- const g = (e == null ? void 0 : e.i18n) ?? !0;
3227
- if (Gl && g) {
3228
- const y = (i == null ? void 0 : i.status) ?? "";
3229
- r = !(i != null && i.data) || !i.data.length ? C(y) : C(y, ...i.data);
3230
- } else
3231
- r = (i == null ? void 0 : i.msg) ?? "";
3232
- o = i;
3233
- }
3234
- r || (r = a[t.response.status] || t.message);
3235
- } else t.request ? t.code === "ERR_CANCELED" ? t.abortReason && (r = t.abortReason) : r = C("网络异常,请检查您的网络情况") : t.code === "ERR_CANCELED" ? t.abortReason && (r = t.abortReason) : r = C("请求配置异常");
3236
- e != null && e.customErrorMessage && (r = e == null ? void 0 : e.customErrorMessage(r, t)), !(e != null && e.ignoreErrorMessage) && r && ((d = (p = window.DasMessage) == null ? void 0 : p.error) == null || d.call(p, { message: r, showClose: !0 }));
3237
- }
3238
- return { ...o, code: n, msg: r, error: t };
3239
- }, J = (t, e) => {
3240
- const n = N.create();
3241
- return io(n, async (r) => {
3242
- const o = Ke();
3243
- if (r.headers || (r.headers = {}), !(r != null && r.public)) {
3244
- let l = "";
3245
- if (o.token && (l = o.token), !l) {
3246
- const c = new URL(location.href).searchParams;
3247
- l = c.get("token") || c.get("accessToken") || c.get("accesstoken") || "";
246
+ } else {
247
+ if (progressTimer && data.status != 2) {
248
+ progressTimer = setTimeout(() => {
249
+ getProgress(taskId, type, fileName, fileSuffix);
250
+ }, 50);
251
+ } else {
252
+ progressResult.value = data;
253
+ progressLoading.value = false;
254
+ tipHandle(data.status, type, data.message);
255
+ clearTimer();
256
+ errorImport.value = true;
257
+ errorMessage.value = data?.message || "";
3248
258
  }
3249
- Yn ? l || (l = await so(r)) : (l || (l = go()), l || eo()), l && !r.headers.Authorization && (r.headers.Authorization = `Bearer ${l}`);
3250
- }
3251
- r.baseURL || (r.baseURL = o.baseURL || ""), r.urlPrefix || (r.urlPrefix = t), r.paramsSerializer || (r.paramsSerializer = { serialize: (l) => jl.stringify(l, { indices: !1 }) }), r.onSuccess || (r.onSuccess = Kl), r.onError || (r.onError = Jl), (r.csrf ?? !1) && (r.headers["csrf-token"] = zl.get("csrf-token"));
3252
- const s = r.params || {};
3253
- if (s.project === void 0) {
3254
- let l = 0;
3255
- const c = new URL(location.href).searchParams;
3256
- l = c.get("project") || c.get("projectId") || 0, l || (l = ho().id ?? 0), (l || l === 0) && (s.project = l);
3257
- }
3258
- if (new URL(location.href).pathname.startsWith("/iot/iot") || new URL(location.href).searchParams.get("app") === "iot") {
3259
- const { instanceInfo: l } = mo();
3260
- l != null && l.instanceId && (s.instance = l.instanceId);
3261
- }
3262
- return r.params = s, r.headers.Timezone = et.tz.guess(), r.headers["X-Origin"] = location.origin, r.headers["Accept-Language"] = ao.value, r;
3263
- });
3264
- }, V = "v1";
3265
- J(`/api/iot/${V}`);
3266
- J(`/api/iot-device/thingmodel/${V}`), J(`/api/iot-device/devicemanage/${V}`), J(`/api/iot-device/product/${V}`), J(`/api/iot-device/product-storage/${V}`);
3267
- J(`/api/device-relation/deviceproject/${V}`), J(`/api/device-relation/devicerule/${V}`), J(`/api/device-relation/project/${V}`);
3268
- const sr = J(`/api/oss/minio/${V}`), Vl = J(`/api/progress/accessor/${V}`);
3269
- J(`/api/dms/analysis/${V}`);
3270
- let Ql = (t = 21) => {
3271
- let e = "", n = crypto.getRandomValues(new Uint8Array(t));
3272
- for (; t--; ) {
3273
- let r = n[t] & 63;
3274
- r < 36 ? e += r.toString(36) : r < 62 ? e += (r - 26).toString(36).toUpperCase() : r < 63 ? e += "_" : e += "-";
3275
- }
3276
- return e;
3277
- };
3278
- const Xl = sr.get("token"), Yl = sr.post("put-object", (t) => (t.headers || (t.headers = {}), t.headers["Content-Type"] = "multipart/form-data", t.responseType = "blob", t)), Zl = sr.post("upload-objects", (t) => (t.headers || (t.headers = {}), t.headers["Content-Type"] = "multipart/form-data", t.responseType = "blob", t)), ec = Vl.get("progress"), Nc = () => {
3279
- let t = G(!1), e = G(""), n = G(0), r = G("normal"), o = G(!1), a, i = G(""), s = G(""), u = G(""), l = G(""), c = G(!1), p = G(""), d = "", g = G(""), y;
3280
- const m = () => {
3281
- s.value = "", u.value = "", l.value = "", c.value = !1, p.value = "";
3282
- }, h = async () => {
3283
- const [S, A] = await Xl().run();
3284
- return S ? { stauts: !1 } : { status: !0, data: A };
3285
- }, E = (S) => new Promise((A, T) => {
3286
- const $ = [];
3287
- let w = 0;
3288
- for (; w < S.size; ) {
3289
- const U = S.slice(w, w + 1048576);
3290
- $.push(U), w += 1048576;
3291
259
  }
3292
- const j = new Blob($, { type: S.type });
3293
- A(j);
3294
- }), R = async (S, A, T, P = !0, $ = "", w = !1) => {
3295
- var lr, cr;
3296
- d = $, g.value = "import", P && (r.value = "normal", n.value = 0, e.value = C("导入进度"), t.value = !0, i.value = ""), y = A;
3297
- const j = await h();
3298
- if (!j.status) return;
3299
- let U = j.data, k = null, { autoContentType: W, bucketName: X, importFileName: Le } = T;
3300
- const to = w ? Zl : Yl;
3301
- if (w) {
3302
- let oe = [];
3303
- await A.forEach(async (Me) => {
3304
- let pt = await E(Me);
3305
- oe.push(pt);
3306
- }), k = new FormData(), k.append("accessKeyId", U.accessKeyId), k.append("secretAccessKey", U.secretAccessKey), k.append("sessionToken", U.sessionToken), k.append("bucketName", X), A.forEach((Me, pt) => {
3307
- k.append("file", oe[pt]);
3308
- }), Le.forEach((Me) => {
3309
- k.append("filePaths", Me);
260
+ };
261
+ const tipHandle = (status, type = "export", message) => {
262
+ if (status == 1) {
263
+ progressStatus.value = "success";
264
+ window.DasMessage?.success({
265
+ message: type == "export" ? t("导出成功") : t("导入成功"),
266
+ grouping: true,
267
+ repeatNum: 1
3310
268
  });
3311
- } else {
3312
- const oe = await E(A);
3313
- k = {
3314
- accessKeyId: U.accessKeyId,
3315
- secretAccessKey: U.secretAccessKey,
3316
- sessionToken: U.sessionToken,
3317
- file: oe,
3318
- bucketName: X,
3319
- filePath: Le,
3320
- autoContentType: W
3321
- };
3322
- }
3323
- const [ro, no] = await to(k).run();
3324
- if (ro) return t.value = !1;
3325
- const Y = await rc(no.data);
3326
- if (!w && (Y == null ? void 0 : Y.statusCode) != 200 || w && (Y != null && Y.some((oe) => (oe == null ? void 0 : oe.statusCode) != 200))) {
3327
- t.value = !1, (lr = window.DasMessage) == null || lr.error({
3328
- message: (Y == null ? void 0 : Y.errorMsg) || C("上传失败"),
3329
- grouping: !0,
269
+ errorFileName.value = "";
270
+ errorFileSize.value = "";
271
+ errorMessage.value = "";
272
+ } else if (status == 2) {
273
+ progressStatus.value = "error";
274
+ window.DasMessage?.error({
275
+ message: message || (type == "export" ? t("导出失败") : t("导入失败")),
276
+ grouping: true,
3330
277
  repeatNum: 1
3331
278
  });
3332
- return;
3333
- }
3334
- const ft = await (S == null ? void 0 : S(Y));
3335
- if (P) {
3336
- if (!ft.status) {
3337
- t.value = !1, r.value = "error";
3338
- return;
3339
- }
3340
- e.value = C("导入进度"), t.value = !0, x(ft.taskId, "import", "");
3341
- } else {
3342
- if (!ft.status) return;
3343
- r.value = "success", (cr = window.DasMessage) == null || cr.success({
3344
- message: C("导入成功"),
3345
- grouping: !0,
279
+ errorMessage.value = message ? message : t("部分数据校验不通过,请下载附件并修改,重新导入!");
280
+ } else if (status == 3) {
281
+ progressStatus.value = "error";
282
+ window.DasMessage?.error({
283
+ message: type == "export" ? t("部分导出失败") : t("部分导入失败"),
284
+ grouping: true,
3346
285
  repeatNum: 1
3347
286
  });
3348
287
  }
3349
- }, v = async (S, A = "", T = "") => {
3350
- r.value = "normal", n.value = 0, e.value = T || C("导出进度"), t.value = !0;
3351
- const P = await (S == null ? void 0 : S());
3352
- if (!P.status) {
3353
- t.value = !1, r.value = "error";
3354
- return;
3355
- }
3356
- x(P.taskId, "action", "");
3357
- }, F = async (S, A = "", T = "", P = !0) => {
3358
- g.value = "export", P && (r.value = "normal", n.value = 0, e.value = C("导出进度"), t.value = !0);
3359
- const $ = await (S == null ? void 0 : S());
3360
- if (!$.status) {
3361
- t.value = !1, r.value = "error";
3362
- return;
3363
- }
3364
- et().format("YYYYMMDDHHmmss") + "", x($.taskId, "export", A || "", T);
3365
- }, x = async (S, A, T, P = "") => {
3366
- o.value = !0, M(S, A, T, P), a = setTimeout(() => {
3367
- }, 50);
3368
- }, L = () => {
3369
- clearTimeout(a), a = null, t.value = !1;
3370
- }, M = async (S, A = "export", T, P = "") => {
3371
- var j, U, k;
3372
- const [$, w] = await ec("", {
3373
- url: `progress/${S}`
3374
- }).run();
3375
- if ($) {
3376
- o.value = !1;
3377
- return;
3378
- }
3379
- if (n.value = w.percentage, n.value == 100)
3380
- if (i.value = w, o.value = !1, L(), A == "export")
3381
- if (w.status == 1) {
3382
- r.value = "success";
3383
- let W = await ur(`/oss/${w == null ? void 0 : w.filePath}`);
3384
- const X = ((j = W == null ? void 0 : W.split("/")) == null ? void 0 : j.pop()) || "";
3385
- let Le = T || X;
3386
- en(`${Ke().baseURL}/oss${w.filePath}`, Le, P), o.value = !1;
3387
- } else w.status == 2 && (l.value = w.message || (A == "export" ? C("导出失败") : C("导入失败")), (U = window.DasMessage) == null || U.error({
3388
- message: l.value,
3389
- grouping: !0,
3390
- repeatNum: 1
3391
- }));
3392
- else if (A == "import") {
3393
- if (w.filePath) {
3394
- r.value = "error", c.value = !0;
3395
- let W = await ur(`/oss/${w == null ? void 0 : w.filePath}`);
3396
- const X = ((k = W == null ? void 0 : W.split("/")) == null ? void 0 : k.pop()) || "";
3397
- s.value = d || X, u.value = y.sizeText, l.value = C("部分数据校验不通过,请下载附件并修改,重新导入!"), p.value = `${Ke().baseURL}/oss/${w == null ? void 0 : w.filePath}`;
3398
- }
3399
- z(w.status, A, w.message);
3400
- } else A == "action" && (r.value = "success");
3401
- else
3402
- a && w.status != 2 ? a = setTimeout(() => {
3403
- M(S, A, T, P);
3404
- }, 50) : (i.value = w, o.value = !1, z(w.status, A, w.message), L(), c.value = !0, l.value = (w == null ? void 0 : w.message) || "");
3405
- }, z = (S, A = "export", T) => {
3406
- var P, $, w;
3407
- S == 1 ? (r.value = "success", (P = window.DasMessage) == null || P.success({
3408
- message: A == "export" ? C("导出成功") : C("导入成功"),
3409
- grouping: !0,
3410
- repeatNum: 1
3411
- }), s.value = "", u.value = "", l.value = "") : S == 2 ? (r.value = "error", ($ = window.DasMessage) == null || $.error({
3412
- message: T || (A == "export" ? C("导出失败") : C("导入失败")),
3413
- grouping: !0,
3414
- repeatNum: 1
3415
- }), l.value = T || C("部分数据校验不通过,请下载附件并修改,重新导入!")) : S == 3 && (r.value = "error", (w = window.DasMessage) == null || w.error({
3416
- message: A == "export" ? C("部分导出失败") : C("部分导入失败"),
3417
- grouping: !0,
3418
- repeatNum: 1
3419
- }));
3420
288
  };
3421
- return {
3422
- showProgressDialog: t,
3423
- progressTitle: e,
3424
- percent: n,
3425
- progressStatus: r,
3426
- progressLoading: o,
3427
- progressResult: i,
3428
- errorFileName: s,
3429
- errorFileSize: u,
3430
- errorMessage: l,
3431
- errorImport: c,
3432
- errorFilePath: p,
3433
- fileImport: R,
3434
- fileExport: F,
3435
- fileAction: v,
3436
- generateUniqueName: (S) => {
3437
- const A = S == null ? void 0 : S.match(/(.*?)(\.[^.]*$|$)/), T = A.length ? A[2] : "";
3438
- return `${A.length ? A[1] : S}${Ql()}${T}`;
3439
- },
3440
- downloadFile: en,
3441
- resetStataus: m,
3442
- checkProgress: x,
3443
- fileHandleType: g
289
+ const generateUniqueName = (fileName) => {
290
+ const matchName = fileName?.match(/(.*?)(\.[^.]*$|$)/);
291
+ const suffix = matchName.length ? matchName[2] : "";
292
+ const name = matchName.length ? matchName[1] : fileName;
293
+ return `${name}${nanoid()}${suffix}`;
3444
294
  };
3445
- }, tc = (t) => {
3446
- let e = t == null ? void 0 : t.toLocaleLowerCase();
3447
295
  return {
296
+ showProgressDialog,
297
+ progressTitle,
298
+ percent,
299
+ progressStatus,
300
+ progressLoading,
301
+ progressResult,
302
+ errorFileName,
303
+ errorFileSize,
304
+ errorMessage,
305
+ errorImport,
306
+ errorFilePath,
307
+ fileImport,
308
+ fileExport,
309
+ fileAction,
310
+ generateUniqueName,
311
+ downloadFile,
312
+ resetStataus,
313
+ checkProgress,
314
+ fileHandleType
315
+ };
316
+ };
317
+ const fileBobType = (type) => {
318
+ let tempType = type?.toLocaleLowerCase();
319
+ let typeList = {
3448
320
  excel: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
3449
321
  pdf: "application/pdf",
3450
322
  doc: "application/msword",
@@ -3470,28 +342,72 @@ const Xl = sr.get("token"), Yl = sr.post("put-object", (t) => (t.headers || (t.h
3470
342
  crt: "application/x-x509-ca-cert",
3471
343
  der: "application/x-x509-ca-cert",
3472
344
  cer: "application/pkix-cert"
3473
- }[e];
3474
- }, en = (t, e, n = "excel") => {
3475
- const r = new XMLHttpRequest();
3476
- r.open("get", t), r.setRequestHeader("Content-Type", "application/json; charset=UTF-8"), r.responseType = "blob", r.onload = function(o) {
3477
- const a = new Blob([this.response], {
3478
- type: tc(n)
3479
- }), i = URL.createObjectURL(a);
3480
- if (window.navigator.msSaveOrOpenBlob)
3481
- navigator.msSaveBlob(a, e);
3482
- else {
3483
- const s = document.createElement("a");
3484
- s.href = i, s.download = e, s.click(), window.URL.revokeObjectURL(i);
345
+ };
346
+ return typeList[tempType];
347
+ };
348
+ const downloadFile = async (path, filename, fileSuffix = "excel") => {
349
+ const fail = (message) => {
350
+ window.DasMessage?.error?.({ message: message || t("导出失败"), showClose: true });
351
+ };
352
+ const save = async (data) => {
353
+ if (data.type.includes("json")) {
354
+ try {
355
+ const error = JSON.parse(await data.text());
356
+ if (Number(error.code) >= 400) {
357
+ fail(error.msg || error.message);
358
+ return;
359
+ }
360
+ } catch {
361
+ }
3485
362
  }
3486
- }, r.send();
3487
- }, rc = (t) => new Promise((e, n) => {
3488
- var r = new FileReader();
3489
- r.onload = function(o) {
3490
- let a = "";
3491
- typeof r.result == "string" && (a = JSON.parse(r.result)), e(a);
3492
- }, r.readAsText(t);
3493
- });
363
+ const blob = new Blob([data], { type: fileBobType(fileSuffix) });
364
+ const objectUrl = URL.createObjectURL(blob);
365
+ if (window.navigator.msSaveOrOpenBlob) {
366
+ navigator.msSaveBlob(blob, filename);
367
+ } else {
368
+ const element = document.createElement("a");
369
+ element.href = objectUrl;
370
+ element.download = filename;
371
+ element.click();
372
+ window.URL.revokeObjectURL(objectUrl);
373
+ }
374
+ };
375
+ const target = new URL(path, location.href);
376
+ const platform = new URL(getConfig().baseURL || location.origin, location.href);
377
+ const platformFile = target.origin === platform.origin && target.pathname.startsWith("/oss/");
378
+ if (platformFile) {
379
+ const [error, response] = await createService("").get(target.href)(void 0, { responseType: "blob" }).run();
380
+ if (!error) await save(response.data);
381
+ return;
382
+ }
383
+ const xhr = new XMLHttpRequest();
384
+ xhr.open("get", path);
385
+ xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
386
+ xhr.responseType = "blob";
387
+ xhr.onload = async function() {
388
+ if (this.status < 200 || this.status >= 300) {
389
+ fail();
390
+ return;
391
+ }
392
+ await save(this.response);
393
+ };
394
+ xhr.onerror = () => fail();
395
+ xhr.send();
396
+ };
397
+ const toStringObject = (blob) => {
398
+ return new Promise((resolve, reject) => {
399
+ var reader = new FileReader();
400
+ reader.onload = function(event) {
401
+ let data = "";
402
+ if (typeof reader.result == "string") {
403
+ data = JSON.parse(reader.result);
404
+ }
405
+ resolve(data);
406
+ };
407
+ reader.readAsText(blob);
408
+ });
409
+ };
3494
410
  export {
3495
- en as downloadFile,
3496
- Nc as useFile
411
+ downloadFile,
412
+ useFile
3497
413
  };