nhanh-pure-function 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Math/index.d.ts +34 -0
- package/dist/User/index.d.ts +12 -3
- package/dist/Utility/index.d.ts +11 -7
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +484 -442
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".nhanh-pure-function{--nhanh: 2233}.no-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}")),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
var
|
|
3
|
-
var
|
|
2
|
+
var Q = Object.defineProperty;
|
|
3
|
+
var W = (n) => {
|
|
4
4
|
throw TypeError(n);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
7
|
-
var y = (n,
|
|
8
|
-
var c = (n,
|
|
9
|
-
const
|
|
6
|
+
var tt = (n, e, t) => e in n ? Q(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
7
|
+
var y = (n, e, t) => tt(n, typeof e != "symbol" ? e + "" : e, t), G = (n, e, t) => e.has(n) || W("Cannot " + t);
|
|
8
|
+
var c = (n, e, t) => (G(n, e, "read from private field"), t ? t.call(n) : e.get(n)), f = (n, e, t) => e.has(n) ? W("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), m = (n, e, t, o) => (G(n, e, "write to private field"), o ? o.call(n, t) : e.set(n, t), t);
|
|
9
|
+
const et = {
|
|
10
10
|
/* 常见扩展名映射 */
|
|
11
11
|
".mp3": "audio/mpeg",
|
|
12
12
|
".mp4": "video/mp4",
|
|
@@ -70,7 +70,7 @@ const te = {
|
|
|
70
70
|
".eot": "application/vnd.ms-fontobject",
|
|
71
71
|
".map": "application/json"
|
|
72
72
|
// 可根据需要继续扩展
|
|
73
|
-
},
|
|
73
|
+
}, B = {
|
|
74
74
|
image: [
|
|
75
75
|
".jpg",
|
|
76
76
|
".jpeg",
|
|
@@ -250,7 +250,7 @@ const te = {
|
|
|
250
250
|
".awk",
|
|
251
251
|
".php"
|
|
252
252
|
]
|
|
253
|
-
},
|
|
253
|
+
}, V = [
|
|
254
254
|
"",
|
|
255
255
|
"万",
|
|
256
256
|
"亿",
|
|
@@ -265,67 +265,67 @@ const te = {
|
|
|
265
265
|
"载",
|
|
266
266
|
"极"
|
|
267
267
|
];
|
|
268
|
-
function
|
|
268
|
+
function ft(n) {
|
|
269
269
|
return n != null;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function ht(n) {
|
|
272
272
|
return !(n === null || typeof n != "object" || Array.isArray(n));
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function pt(n) {
|
|
275
275
|
if (typeof n != "function")
|
|
276
276
|
return console.error("非函数:", n);
|
|
277
|
-
const
|
|
278
|
-
|
|
277
|
+
const e = function(t) {
|
|
278
|
+
t.didTimeout || t.timeRemaining() <= 0 ? requestIdleCallback(e) : n();
|
|
279
279
|
};
|
|
280
|
-
requestIdleCallback(
|
|
280
|
+
requestIdleCallback(e);
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
const
|
|
282
|
+
function gt(n, e) {
|
|
283
|
+
const t = +/* @__PURE__ */ new Date();
|
|
284
284
|
return new Promise((o, r) => {
|
|
285
285
|
const i = () => {
|
|
286
|
-
if (+/* @__PURE__ */ new Date() -
|
|
286
|
+
if (+/* @__PURE__ */ new Date() - t >= e) return r("超时");
|
|
287
287
|
if (n()) return o("完成");
|
|
288
288
|
requestIdleCallback(i);
|
|
289
289
|
};
|
|
290
290
|
i();
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function wt(n, e, t = ",") {
|
|
294
294
|
const o = new RegExp(
|
|
295
|
-
`(^|${
|
|
295
|
+
`(^|${t})${e}(${t}|$)`,
|
|
296
296
|
"g"
|
|
297
297
|
);
|
|
298
298
|
return n.replace(o, function(r, i, s) {
|
|
299
|
-
return i === s ?
|
|
299
|
+
return i === s ? t : "";
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function xt(n) {
|
|
303
303
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function H(n, e, t = [], o = +/* @__PURE__ */ new Date()) {
|
|
306
306
|
if (o < +/* @__PURE__ */ new Date() - 50) {
|
|
307
307
|
console.error("_MergeObjects 合并异常:疑似死循环");
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
const r =
|
|
311
|
-
if (r != i) return
|
|
310
|
+
const r = Z(n), i = Z(e);
|
|
311
|
+
if (r != i) return e;
|
|
312
312
|
if (r == "object" || r == "array") {
|
|
313
|
-
if (
|
|
314
|
-
if (
|
|
315
|
-
for (const s in
|
|
316
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
317
|
-
const a =
|
|
318
|
-
n[s] =
|
|
313
|
+
if (t.some(([s, a]) => s == n && a == e)) return n;
|
|
314
|
+
if (t.push([n, e]), r == "object") {
|
|
315
|
+
for (const s in e)
|
|
316
|
+
if (Object.prototype.hasOwnProperty.call(e, s)) {
|
|
317
|
+
const a = e[s], l = n[s], u = H(l, a, t, o);
|
|
318
|
+
n[s] = u;
|
|
319
319
|
}
|
|
320
320
|
return n;
|
|
321
321
|
} else if (r == "array")
|
|
322
|
-
return
|
|
323
|
-
const
|
|
324
|
-
n[a] =
|
|
322
|
+
return e.forEach((s, a) => {
|
|
323
|
+
const l = s, u = n[a], d = H(u, l, t, o);
|
|
324
|
+
n[a] = d;
|
|
325
325
|
}), n;
|
|
326
|
-
} else return
|
|
326
|
+
} else return e;
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function vt(n, e = "YYYY-MM-DD hh:mm:ss", t = !0) {
|
|
329
329
|
const o = new Date(n);
|
|
330
330
|
if (isNaN(o.getTime()))
|
|
331
331
|
return console.error("Invalid date"), "";
|
|
@@ -339,80 +339,80 @@ function pe(n, t = "YYYY-MM-DD hh:mm:ss", e = !0) {
|
|
|
339
339
|
ss: (i) => i.getSeconds(),
|
|
340
340
|
ms: (i) => i.getMilliseconds()
|
|
341
341
|
};
|
|
342
|
-
return
|
|
342
|
+
return e.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (i) => {
|
|
343
343
|
const s = r[i](o);
|
|
344
|
-
return
|
|
344
|
+
return t ? String(s).padStart(2, "0") : String(s);
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
return new Promise((
|
|
349
|
-
fetch(n).then((o) =>
|
|
350
|
-
console.error("Error fetching :", o),
|
|
347
|
+
function bt(n) {
|
|
348
|
+
return new Promise((e, t) => {
|
|
349
|
+
fetch(n).then((o) => e(o.text())).catch((o) => {
|
|
350
|
+
console.error("Error fetching :", o), t(o);
|
|
351
351
|
});
|
|
352
352
|
});
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
if (!n || (n = String(n).trim(), n === "")) return
|
|
356
|
-
const
|
|
357
|
-
return
|
|
354
|
+
function X(n, e = "file") {
|
|
355
|
+
if (!n || (n = String(n).trim(), n === "")) return e;
|
|
356
|
+
const t = n.split("/");
|
|
357
|
+
return t[t.length - 1].split("?")[0];
|
|
358
358
|
}
|
|
359
|
-
function
|
|
360
|
-
return new Promise((
|
|
359
|
+
function yt(n, e) {
|
|
360
|
+
return new Promise((t, o) => {
|
|
361
361
|
try {
|
|
362
|
-
|
|
362
|
+
e = e || X(n, "downloaded_file"), fetch(n).then((r) => (r.ok || o(`文件下载失败,状态码: ${r.status}`), r.blob())).then((r) => {
|
|
363
363
|
const i = URL.createObjectURL(r), s = document.createElement("a");
|
|
364
|
-
s.href = i, s.download = decodeURIComponent(
|
|
364
|
+
s.href = i, s.download = decodeURIComponent(e), document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(i), t(r);
|
|
365
365
|
}).catch(o);
|
|
366
366
|
} catch (r) {
|
|
367
367
|
o(r);
|
|
368
368
|
}
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
|
-
function
|
|
372
|
-
let
|
|
371
|
+
function Et(n, e = 10) {
|
|
372
|
+
let t = 0, o = e;
|
|
373
373
|
function r() {
|
|
374
374
|
if (o > 0)
|
|
375
375
|
o--, requestAnimationFrame(r);
|
|
376
376
|
else {
|
|
377
|
-
const s = (+/* @__PURE__ */ new Date() -
|
|
377
|
+
const s = (+/* @__PURE__ */ new Date() - t) / e, a = 1e3 / s;
|
|
378
378
|
n(Number(a.toFixed(2)), Number(s.toFixed(2)));
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
requestAnimationFrame(() => {
|
|
382
|
-
|
|
382
|
+
t = +/* @__PURE__ */ new Date(), r();
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
|
-
function
|
|
386
|
-
return n = n.replace(/([^a-zA-Z][a-z])/g, (
|
|
385
|
+
function Mt(n, e) {
|
|
386
|
+
return n = n.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()), e ? n.replace(/[^a-zA-Z]+/g, "") : n;
|
|
387
387
|
}
|
|
388
|
-
function
|
|
389
|
-
if (!
|
|
390
|
-
let s =
|
|
391
|
-
s = s ==
|
|
388
|
+
function Ct(n, e, t) {
|
|
389
|
+
if (!t) {
|
|
390
|
+
let s = e.replace(/^[^.]+./, "");
|
|
391
|
+
s = s == e ? "text/plain" : "application/" + s, t = { type: s };
|
|
392
392
|
}
|
|
393
|
-
const o = new Blob(n,
|
|
394
|
-
i.href = r, i.download =
|
|
393
|
+
const o = new Blob(n, t), r = URL.createObjectURL(o), i = document.createElement("a");
|
|
394
|
+
i.href = r, i.download = e, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
|
|
395
395
|
}
|
|
396
|
-
function
|
|
397
|
-
return n + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
|
|
398
|
-
const
|
|
399
|
-
return (
|
|
396
|
+
function Ft(n = "") {
|
|
397
|
+
return n + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
398
|
+
const t = Math.random() * 16 | 0;
|
|
399
|
+
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
let
|
|
402
|
+
function nt(n, e) {
|
|
403
|
+
let t;
|
|
404
404
|
return function(...o) {
|
|
405
|
-
clearTimeout(
|
|
406
|
-
n(...o),
|
|
407
|
-
},
|
|
405
|
+
clearTimeout(t), t = setTimeout(() => {
|
|
406
|
+
n(...o), t = void 0;
|
|
407
|
+
}, e);
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
|
-
function
|
|
411
|
-
let
|
|
410
|
+
function Lt(n, e) {
|
|
411
|
+
let t = -1 / 0;
|
|
412
412
|
return function(...o) {
|
|
413
413
|
const r = performance.now();
|
|
414
|
-
if (r -
|
|
415
|
-
|
|
414
|
+
if (r - t > e) {
|
|
415
|
+
t = r;
|
|
416
416
|
try {
|
|
417
417
|
n(...o);
|
|
418
418
|
} catch (i) {
|
|
@@ -421,76 +421,76 @@ function Ee(n, t) {
|
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function Z(n) {
|
|
425
425
|
return Array.isArray(n) ? "array" : n === null ? "null" : typeof n;
|
|
426
426
|
}
|
|
427
|
-
function
|
|
428
|
-
const
|
|
427
|
+
function Tt(n) {
|
|
428
|
+
const e = () => Promise.resolve(), t = (a) => (console.error(a), Promise.reject(a));
|
|
429
429
|
function o() {
|
|
430
|
-
return navigator.clipboard.writeText(n).then(
|
|
430
|
+
return navigator.clipboard.writeText(n).then(e).catch(t);
|
|
431
431
|
}
|
|
432
432
|
function r() {
|
|
433
433
|
const a = document.createElement("div");
|
|
434
434
|
a.innerText = n, document.body.appendChild(a);
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
const
|
|
438
|
-
let
|
|
439
|
-
return
|
|
435
|
+
const l = document.createRange();
|
|
436
|
+
l.selectNodeContents(a);
|
|
437
|
+
const u = window.getSelection();
|
|
438
|
+
let d = !1;
|
|
439
|
+
return u && (u.removeAllRanges(), u.addRange(l), d = document.execCommand("copy")), document.body.removeChild(a), d ? Promise.resolve() : Promise.reject();
|
|
440
440
|
}
|
|
441
441
|
function i() {
|
|
442
442
|
const a = document.createElement("textarea");
|
|
443
443
|
a.value = n, document.body.appendChild(a), a.select(), a.setSelectionRange(0, n.length);
|
|
444
|
-
let
|
|
445
|
-
return document.activeElement === a && (
|
|
444
|
+
let l = !1;
|
|
445
|
+
return document.activeElement === a && (l = document.execCommand("Copy", !0)), document.body.removeChild(a), l ? Promise.resolve() : Promise.reject();
|
|
446
446
|
}
|
|
447
447
|
function s() {
|
|
448
|
-
return r().then(
|
|
449
|
-
i().then(
|
|
448
|
+
return r().then(e).catch(() => {
|
|
449
|
+
i().then(e).catch(() => t("复制方式尽皆失效"));
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
452
|
return navigator.clipboard ? o().catch(s) : s();
|
|
453
453
|
}
|
|
454
|
-
function
|
|
455
|
-
const
|
|
456
|
-
return
|
|
454
|
+
function Rt(n, e) {
|
|
455
|
+
const t = e.split(".");
|
|
456
|
+
return t.reduce((o, r, i) => (r in o || (i === t.length - 1 ? o[r] = void 0 : o[r] = {}), o[r]), n);
|
|
457
457
|
}
|
|
458
|
-
function
|
|
459
|
-
const
|
|
460
|
-
return
|
|
458
|
+
function jt(n, e) {
|
|
459
|
+
const t = e.split(".");
|
|
460
|
+
return t.reduce((o, r, i) => o.hasOwnProperty(r) ? o[r] : o[r] = i == t.length - 1 ? void 0 : {}, n);
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
const o =
|
|
464
|
-
return o.reduce((r, i, s) => (s === o.length - 1 && (r[i] =
|
|
462
|
+
function Pt(n, e, t) {
|
|
463
|
+
const o = e.split(".");
|
|
464
|
+
return o.reduce((r, i, s) => (s === o.length - 1 && (r[i] = t), r[i]), n);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
return new Promise((
|
|
466
|
+
function _t(n) {
|
|
467
|
+
return new Promise((e, t) => {
|
|
468
468
|
if (typeof n != "string" || n.trim() === "" || !n.includes("://")) {
|
|
469
|
-
|
|
469
|
+
t(new Error("Invalid URL: Must be a non-empty string"));
|
|
470
470
|
return;
|
|
471
471
|
}
|
|
472
472
|
try {
|
|
473
473
|
new XMLHttpRequest().open("HEAD", n, !0);
|
|
474
474
|
} catch (i) {
|
|
475
|
-
|
|
475
|
+
t(new Error(`Invalid URL format: ${i.message}`));
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
478
|
const o = new XMLHttpRequest();
|
|
479
479
|
o.open("HEAD", n, !0);
|
|
480
480
|
const r = (i) => {
|
|
481
|
-
|
|
481
|
+
t(new Error(`Request failed: ${i.type}`));
|
|
482
482
|
};
|
|
483
483
|
o.onreadystatechange = function() {
|
|
484
|
-
o.readyState === XMLHttpRequest.DONE && (o.status === 0 ?
|
|
484
|
+
o.readyState === XMLHttpRequest.DONE && (o.status === 0 ? t(new Error("Network error or CORS blocked")) : o.status >= 200 && o.status < 300 ? e(!0) : t(new Error(`HTTP Error: ${o.status}`)));
|
|
485
485
|
}, o.onerror = r, o.onabort = r, o.ontimeout = r;
|
|
486
486
|
try {
|
|
487
487
|
o.send();
|
|
488
488
|
} catch (i) {
|
|
489
|
-
|
|
489
|
+
t(new Error(`Request send failed: ${i.message}`));
|
|
490
490
|
}
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function kt(n) {
|
|
494
494
|
return [
|
|
495
495
|
"https:",
|
|
496
496
|
// HTTPS协议,用于安全地浏览网页
|
|
@@ -512,24 +512,24 @@ function je(n) {
|
|
|
512
512
|
// Remote Desktop Protocol,用于安全的远程桌面连接
|
|
513
513
|
"vpn:"
|
|
514
514
|
// VPN协议,用于创建安全的网络连接
|
|
515
|
-
].some((
|
|
515
|
+
].some((t) => n.startsWith(t));
|
|
516
516
|
}
|
|
517
|
-
const
|
|
517
|
+
const C = class C {
|
|
518
518
|
constructor() {
|
|
519
|
-
if (new.target ===
|
|
519
|
+
if (new.target === C)
|
|
520
520
|
throw new Error("请直接使用静态方法,而不是实例化此类");
|
|
521
521
|
}
|
|
522
|
-
static check(
|
|
523
|
-
if (!
|
|
524
|
-
return console.error("Invalid URL provided"),
|
|
525
|
-
const o =
|
|
526
|
-
if (
|
|
527
|
-
if (!
|
|
528
|
-
return console.error(`Unknown file type: ${
|
|
529
|
-
const r =
|
|
530
|
-
return
|
|
522
|
+
static check(e, t) {
|
|
523
|
+
if (!e || typeof e != "string")
|
|
524
|
+
return console.error("Invalid URL provided"), t ? !1 : "unknown";
|
|
525
|
+
const o = X(e).toLowerCase();
|
|
526
|
+
if (t) {
|
|
527
|
+
if (!B.hasOwnProperty(t))
|
|
528
|
+
return console.error(`Unknown file type: ${t}`), "unknown";
|
|
529
|
+
const r = B[t];
|
|
530
|
+
return C._checkExtension(o, r);
|
|
531
531
|
}
|
|
532
|
-
return
|
|
532
|
+
return C._detectFileType(o);
|
|
533
533
|
}
|
|
534
534
|
/**
|
|
535
535
|
* 静态方法,用于解析地址信息
|
|
@@ -539,10 +539,10 @@ const F = class F {
|
|
|
539
539
|
* @param {string} url - 以逗号分隔的URL字符串,每个URL代表一个资源的位置
|
|
540
540
|
* @returns {Array} - 包含每个URL及其相关信息(名称和类型)的对象数组
|
|
541
541
|
*/
|
|
542
|
-
static parseAddresses(
|
|
543
|
-
return !
|
|
544
|
-
const o =
|
|
545
|
-
return { url:
|
|
542
|
+
static parseAddresses(e) {
|
|
543
|
+
return !e || typeof e != "string" ? (console.error("Invalid URL provided"), []) : e.split(",").map((t) => {
|
|
544
|
+
const o = X(t), r = this.check(t);
|
|
545
|
+
return { url: t, name: o, type: r };
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
/**
|
|
@@ -551,13 +551,13 @@ const F = class F {
|
|
|
551
551
|
* @param {string} [accept] - 可接受的 MIME 类型模式(如 "image/*, text/plain")
|
|
552
552
|
* @returns {boolean} - 如果类型匹配,则返回 true,否则返回 false
|
|
553
553
|
*/
|
|
554
|
-
static matchesMimeType(
|
|
555
|
-
if (!
|
|
556
|
-
if (typeof
|
|
557
|
-
const o =
|
|
554
|
+
static matchesMimeType(e, t) {
|
|
555
|
+
if (!t) return !0;
|
|
556
|
+
if (typeof e != "string" || typeof t != "string") return !1;
|
|
557
|
+
const o = C._normalizeType(e), r = t.split(",").map((a) => C._normalizeType(a.trim())), [i, s = "*"] = o.split("/");
|
|
558
558
|
return r.some((a) => {
|
|
559
|
-
const [
|
|
560
|
-
return (
|
|
559
|
+
const [l, u = "*"] = a.split("/");
|
|
560
|
+
return (l === "*" || i === "*" || l === i) && (u === "*" || s === "*" || u === s);
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
/**
|
|
@@ -568,8 +568,8 @@ const F = class F {
|
|
|
568
568
|
* @param {string} type - 文件类型或MIME类型字符串
|
|
569
569
|
* @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
|
|
570
570
|
*/
|
|
571
|
-
static _normalizeType(
|
|
572
|
-
return
|
|
571
|
+
static _normalizeType(e) {
|
|
572
|
+
return e.startsWith(".") && !e.includes("/") ? et[e.toLowerCase()] || e : e.includes("/") ? e : `${e}/*`;
|
|
573
573
|
}
|
|
574
574
|
/**
|
|
575
575
|
* 检查URL是否具有任何指定的文件扩展名
|
|
@@ -577,43 +577,42 @@ const F = class F {
|
|
|
577
577
|
* @param {string[]} validExtensions - 有效文件扩展名的数组
|
|
578
578
|
* @returns {boolean} - 如果URL具有任何指定的文件扩展名,则返回true,否则返回false
|
|
579
579
|
*/
|
|
580
|
-
static _checkExtension(
|
|
581
|
-
return
|
|
580
|
+
static _checkExtension(e, t) {
|
|
581
|
+
return t.some((o) => e.endsWith(o));
|
|
582
582
|
}
|
|
583
583
|
/**
|
|
584
584
|
* 检测文件URL的类型
|
|
585
585
|
* @param {string} url - 文件的URL
|
|
586
586
|
* @returns {string} - 如果URL与任何已知类型匹配,则返回文件类型,否则返回"unknown"
|
|
587
587
|
*/
|
|
588
|
-
static _detectFileType(
|
|
589
|
-
for (const [
|
|
590
|
-
if (o.some((r) =>
|
|
591
|
-
return
|
|
588
|
+
static _detectFileType(e) {
|
|
589
|
+
for (const [t, o] of C.cachedEntries)
|
|
590
|
+
if (o.some((r) => e.endsWith(r)))
|
|
591
|
+
return t;
|
|
592
592
|
return "unknown";
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
595
|
// 缓存文件扩展名的条目,以提高性能
|
|
596
|
-
y(
|
|
597
|
-
let
|
|
598
|
-
function
|
|
599
|
-
return n.map((
|
|
596
|
+
y(C, "cachedEntries", Object.entries(B));
|
|
597
|
+
let K = C;
|
|
598
|
+
function At(n) {
|
|
599
|
+
return n.map((e, t) => n.slice(t).concat(n.slice(0, t)));
|
|
600
600
|
}
|
|
601
|
-
function
|
|
602
|
-
const
|
|
601
|
+
function Ut(n) {
|
|
602
|
+
const e = window.structuredClone, t = (o) => o === null || typeof o != "object" ? o : H(Array.isArray(o) ? [] : {}, o);
|
|
603
603
|
try {
|
|
604
|
-
return
|
|
604
|
+
return e ? e(n) : t(n);
|
|
605
605
|
} catch (o) {
|
|
606
|
-
return console.error("structuredClone error:", o),
|
|
606
|
+
return console.error("structuredClone error:", o), e && t(n);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* 构造函数
|
|
612
|
-
* @throws 如果尝试实例化该类,则抛出错误,因为应该使用静态方法
|
|
613
|
-
*/
|
|
609
|
+
class ot {
|
|
610
|
+
/** 请使用静态方法 */
|
|
614
611
|
constructor() {
|
|
615
|
-
|
|
616
|
-
|
|
612
|
+
}
|
|
613
|
+
/** 添加已有窗口 */
|
|
614
|
+
static add(e, t) {
|
|
615
|
+
this.keys.set(e, t);
|
|
617
616
|
}
|
|
618
617
|
/**
|
|
619
618
|
* 根据键打开或聚焦窗口
|
|
@@ -623,15 +622,15 @@ const N = class N {
|
|
|
623
622
|
* @param windowFeatures 新窗口的特性
|
|
624
623
|
* @returns 返回已打开或新打开的窗口
|
|
625
624
|
*/
|
|
626
|
-
static open(
|
|
627
|
-
const i = this.keys.get(
|
|
625
|
+
static open(e, t, o, r) {
|
|
626
|
+
const i = this.keys.get(e);
|
|
628
627
|
if (i && !i.closed)
|
|
629
628
|
return i.focus(), i;
|
|
630
629
|
{
|
|
631
|
-
const s = window.open(
|
|
630
|
+
const s = window.open(t, o, r);
|
|
632
631
|
if (s)
|
|
633
|
-
return this.keys.set(
|
|
634
|
-
console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(
|
|
632
|
+
return this.keys.set(e, s), s;
|
|
633
|
+
console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(e);
|
|
635
634
|
}
|
|
636
635
|
}
|
|
637
636
|
/**
|
|
@@ -639,39 +638,38 @@ const N = class N {
|
|
|
639
638
|
* @param key 窗口的唯一键
|
|
640
639
|
* @returns 如果窗口打开则返回true,否则返回false
|
|
641
640
|
*/
|
|
642
|
-
static isOpen(
|
|
643
|
-
const
|
|
644
|
-
return
|
|
641
|
+
static isOpen(e) {
|
|
642
|
+
const t = this.keys.get(e);
|
|
643
|
+
return t != null && t.closed && this.keys.delete(e), this.keys.has(e);
|
|
645
644
|
}
|
|
646
645
|
/**
|
|
647
646
|
* 获取与指定键关联的窗口
|
|
648
647
|
* @param key 窗口的唯一键
|
|
649
648
|
* @returns 返回对应的窗口,如果窗口已关闭则返回undefined
|
|
650
649
|
*/
|
|
651
|
-
static getWindow(
|
|
652
|
-
if (this.isOpen(
|
|
650
|
+
static getWindow(e) {
|
|
651
|
+
if (this.isOpen(e)) return this.keys.get(e);
|
|
653
652
|
}
|
|
654
653
|
/**
|
|
655
654
|
* 关闭与指定键关联的窗口
|
|
656
655
|
* @param key 窗口的唯一键
|
|
657
656
|
*/
|
|
658
|
-
static close(
|
|
659
|
-
const
|
|
660
|
-
|
|
657
|
+
static close(e) {
|
|
658
|
+
const t = this.keys.get(e);
|
|
659
|
+
t && (t.close(), this.keys.delete(e));
|
|
661
660
|
}
|
|
662
661
|
/**
|
|
663
662
|
* 关闭所有打开的窗口并清空Map
|
|
664
663
|
*/
|
|
665
664
|
static closeAll() {
|
|
666
|
-
this.keys.forEach((
|
|
665
|
+
this.keys.forEach((e, t) => e.close()), this.keys.clear();
|
|
667
666
|
}
|
|
668
|
-
}
|
|
667
|
+
}
|
|
669
668
|
// 存储键与对应窗口的Map
|
|
670
|
-
y(
|
|
671
|
-
|
|
672
|
-
function Ue(n, t = "image/png") {
|
|
669
|
+
y(ot, "keys", /* @__PURE__ */ new Map());
|
|
670
|
+
function Dt(n, e = "image/png") {
|
|
673
671
|
try {
|
|
674
|
-
let
|
|
672
|
+
let t, o = e;
|
|
675
673
|
if (n instanceof File)
|
|
676
674
|
return URL.createObjectURL(n);
|
|
677
675
|
if (typeof n == "string") {
|
|
@@ -685,86 +683,86 @@ function Ue(n, t = "image/png") {
|
|
|
685
683
|
}
|
|
686
684
|
i = i.replace(/[^A-Za-z0-9+/=]/g, "");
|
|
687
685
|
const a = atob(i);
|
|
688
|
-
|
|
689
|
-
for (let
|
|
690
|
-
|
|
686
|
+
t = new Uint8Array(a.length);
|
|
687
|
+
for (let l = 0; l < a.length; l++)
|
|
688
|
+
t[l] = a.charCodeAt(l);
|
|
691
689
|
} else if (n instanceof ArrayBuffer)
|
|
692
|
-
|
|
690
|
+
t = new Uint8Array(n);
|
|
693
691
|
else if (n instanceof Uint8Array)
|
|
694
|
-
|
|
692
|
+
t = n;
|
|
695
693
|
else
|
|
696
694
|
throw new Error(
|
|
697
695
|
"不支持的数据类型。应为 Base64 字符串、ArrayBuffer 或 Uint8Array"
|
|
698
696
|
);
|
|
699
|
-
const r = new Blob([
|
|
697
|
+
const r = new Blob([t], { type: o });
|
|
700
698
|
return URL.createObjectURL(r);
|
|
701
|
-
} catch (
|
|
699
|
+
} catch (t) {
|
|
702
700
|
return console.error(
|
|
703
701
|
"数据到 ImageURL 的转换失败:",
|
|
704
|
-
|
|
705
|
-
|
|
702
|
+
t.message,
|
|
703
|
+
t.stack || "没有可用的堆栈跟踪"
|
|
706
704
|
), null;
|
|
707
705
|
}
|
|
708
706
|
}
|
|
709
|
-
function
|
|
707
|
+
function It(n, e, t = 30) {
|
|
710
708
|
if (typeof n != "function")
|
|
711
709
|
throw new Error("The first argument must be a function.");
|
|
712
|
-
if (!Array.isArray(
|
|
710
|
+
if (!Array.isArray(e))
|
|
713
711
|
throw new Error("The second argument must be an array.");
|
|
714
|
-
let
|
|
712
|
+
let o = [], r = 0;
|
|
715
713
|
const i = (s, a) => {
|
|
716
|
-
for (const [
|
|
717
|
-
if (s >=
|
|
718
|
-
return
|
|
714
|
+
for (const [l, u] of a)
|
|
715
|
+
if (s >= l)
|
|
716
|
+
return u;
|
|
719
717
|
return "black";
|
|
720
718
|
};
|
|
721
719
|
return function(...s) {
|
|
722
|
-
const a = performance.now(),
|
|
723
|
-
|
|
724
|
-
const
|
|
720
|
+
const a = performance.now(), l = n(...s), u = performance.now() - a;
|
|
721
|
+
o.push(u), o.length > t && o.shift(), r = o.reduce((L, $) => L + $, 0) / o.length || 0;
|
|
722
|
+
const d = i(u, e), p = i(r, e);
|
|
725
723
|
return console.log(
|
|
726
|
-
`%c单次耗时:${
|
|
727
|
-
%c平均耗时(${
|
|
728
|
-
`color: ${
|
|
724
|
+
`%c单次耗时:${u.toFixed(2)}ms
|
|
725
|
+
%c平均耗时(${o.length}次):${r.toFixed(2)}ms`,
|
|
726
|
+
`color: ${d}; padding: 2px 0;`,
|
|
729
727
|
`color: ${p}; padding: 2px 0;`
|
|
730
|
-
),
|
|
728
|
+
), l;
|
|
731
729
|
};
|
|
732
730
|
}
|
|
733
|
-
function
|
|
734
|
-
const
|
|
735
|
-
let
|
|
731
|
+
function St(n) {
|
|
732
|
+
const e = nt(n, 100);
|
|
733
|
+
let t = 0, o = 0;
|
|
736
734
|
return function(r) {
|
|
737
735
|
const i = r.target;
|
|
738
|
-
if (!i || !(i instanceof
|
|
736
|
+
if (!i || !(i instanceof Element)) return;
|
|
739
737
|
const {
|
|
740
738
|
scrollTop: s,
|
|
741
739
|
scrollHeight: a,
|
|
742
|
-
clientHeight:
|
|
743
|
-
scrollLeft:
|
|
744
|
-
scrollWidth:
|
|
740
|
+
clientHeight: l,
|
|
741
|
+
scrollLeft: u,
|
|
742
|
+
scrollWidth: d,
|
|
745
743
|
clientWidth: p
|
|
746
744
|
} = i;
|
|
747
|
-
function
|
|
748
|
-
if (
|
|
749
|
-
const
|
|
750
|
-
if (
|
|
751
|
-
a - s -
|
|
745
|
+
function L() {
|
|
746
|
+
if (t == s) return;
|
|
747
|
+
const Y = t > s;
|
|
748
|
+
if (t = s, Y) return;
|
|
749
|
+
a - s - l <= 1 && e("vertical");
|
|
752
750
|
}
|
|
753
|
-
function
|
|
754
|
-
if (o ==
|
|
755
|
-
const
|
|
756
|
-
if (o =
|
|
757
|
-
|
|
751
|
+
function $() {
|
|
752
|
+
if (o == u) return;
|
|
753
|
+
const Y = o > u;
|
|
754
|
+
if (o = u, Y) return;
|
|
755
|
+
d - u - p <= 1 && e("horizontal");
|
|
758
756
|
}
|
|
759
|
-
|
|
757
|
+
L(), $();
|
|
760
758
|
};
|
|
761
759
|
}
|
|
762
|
-
function
|
|
763
|
-
const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } =
|
|
764
|
-
const
|
|
765
|
-
for (const
|
|
766
|
-
Object.hasOwnProperty.call(
|
|
767
|
-
return
|
|
760
|
+
function Ot(n, e, t) {
|
|
761
|
+
const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } = t || {}, i = function(l) {
|
|
762
|
+
const u = [];
|
|
763
|
+
for (const d in l)
|
|
764
|
+
Object.hasOwnProperty.call(l, d) && r.includes(d) && u.push(...l[d]);
|
|
765
|
+
return u;
|
|
768
766
|
}({
|
|
769
767
|
naiveUI: [
|
|
770
768
|
".v-binder-follower-container",
|
|
@@ -775,37 +773,37 @@ function _e(n, t, e) {
|
|
|
775
773
|
Element: [".el-popper"]
|
|
776
774
|
});
|
|
777
775
|
function s() {
|
|
778
|
-
|
|
776
|
+
e(), document.removeEventListener("mousedown", a);
|
|
779
777
|
}
|
|
780
|
-
function a(
|
|
778
|
+
function a(l) {
|
|
781
779
|
if (o) {
|
|
782
|
-
const p = o(
|
|
780
|
+
const p = o(l);
|
|
783
781
|
if (p) return;
|
|
784
782
|
if (p === !1) return s();
|
|
785
783
|
}
|
|
786
|
-
const
|
|
787
|
-
if (!(
|
|
788
|
-
n.concat(i).some((p) => !!(
|
|
784
|
+
const u = l.target;
|
|
785
|
+
if (!(u instanceof Element) || !u.isConnected) return;
|
|
786
|
+
n.concat(i).some((p) => !!(u != null && u.closest(p))) || s();
|
|
789
787
|
}
|
|
790
788
|
requestAnimationFrame(
|
|
791
789
|
() => document.addEventListener("mousedown", a)
|
|
792
790
|
);
|
|
793
791
|
}
|
|
794
|
-
var w,
|
|
795
|
-
class
|
|
792
|
+
var w, T, R, k, A, E, M, F, U;
|
|
793
|
+
class zt {
|
|
796
794
|
constructor() {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
795
|
+
f(this, w);
|
|
796
|
+
f(this, T, !1);
|
|
797
|
+
f(this, R, {});
|
|
798
|
+
f(this, k, 0);
|
|
799
|
+
f(this, A, 0);
|
|
800
|
+
f(this, E, 0);
|
|
801
|
+
f(this, M, 0);
|
|
802
|
+
f(this, F);
|
|
803
|
+
f(this, U);
|
|
806
804
|
}
|
|
807
|
-
init(
|
|
808
|
-
m(this, w,
|
|
805
|
+
init(e, t) {
|
|
806
|
+
m(this, w, e), m(this, F, t == null ? void 0 : t.limit), m(this, U, t == null ? void 0 : t.dragDom), m(this, R, {
|
|
809
807
|
mousedown: this.mousedown.bind(this),
|
|
810
808
|
mousemove: this.mousemove.bind(this),
|
|
811
809
|
mouseup: this.mouseup.bind(this)
|
|
@@ -814,47 +812,47 @@ class ze {
|
|
|
814
812
|
finish() {
|
|
815
813
|
this.bindOrUnbindEvent("unbind");
|
|
816
814
|
}
|
|
817
|
-
bindOrUnbindEvent(
|
|
818
|
-
const
|
|
815
|
+
bindOrUnbindEvent(e) {
|
|
816
|
+
const t = e === "bind" ? "addEventListener" : "removeEventListener";
|
|
819
817
|
if (!c(this, w)) return console.error("No DOM");
|
|
820
|
-
c(this, w)[
|
|
818
|
+
c(this, w)[t]("mousedown", c(this, R).mousedown), document[t]("mousemove", c(this, R).mousemove), document[t]("mouseup", c(this, R).mouseup);
|
|
821
819
|
}
|
|
822
820
|
alterLocation() {
|
|
823
821
|
if (!c(this, w)) return console.error("No DOM");
|
|
824
|
-
c(this,
|
|
822
|
+
c(this, F) && (m(this, E, Math.min(c(this, E), c(this, F).max.top)), m(this, E, Math.max(c(this, E), c(this, F).min.top)), m(this, M, Math.min(c(this, M), c(this, F).max.left)), m(this, M, Math.max(c(this, M), c(this, F).min.left))), c(this, w).style.setProperty("--top", c(this, E) + "px"), c(this, w).style.setProperty("--left", c(this, M) + "px");
|
|
825
823
|
}
|
|
826
|
-
mousedown(
|
|
824
|
+
mousedown(e) {
|
|
827
825
|
if (!c(this, w)) return console.error("No DOM");
|
|
828
|
-
if (c(this,
|
|
829
|
-
document.body.classList.add("no-select"), m(this,
|
|
830
|
-
const
|
|
831
|
-
m(this,
|
|
826
|
+
if (c(this, U) && e.target != c(this, U)) return;
|
|
827
|
+
document.body.classList.add("no-select"), m(this, T, !0);
|
|
828
|
+
const t = c(this, w).getBoundingClientRect(), { pageX: o, pageY: r } = e;
|
|
829
|
+
m(this, k, o), m(this, A, r), m(this, E, t.y), m(this, M, t.x);
|
|
832
830
|
}
|
|
833
|
-
mousemove(
|
|
834
|
-
const { pageX:
|
|
835
|
-
c(this,
|
|
831
|
+
mousemove(e) {
|
|
832
|
+
const { pageX: t, pageY: o } = e;
|
|
833
|
+
c(this, T) && (m(this, E, c(this, E) + (o - c(this, A))), m(this, M, c(this, M) + (t - c(this, k))), m(this, k, t), m(this, A, o), this.alterLocation());
|
|
836
834
|
}
|
|
837
835
|
mouseup() {
|
|
838
|
-
c(this,
|
|
836
|
+
c(this, T) && (m(this, T, !1), document.body.classList.remove("no-select"));
|
|
839
837
|
}
|
|
840
838
|
}
|
|
841
|
-
w = new WeakMap(),
|
|
842
|
-
var x,
|
|
843
|
-
class
|
|
839
|
+
w = new WeakMap(), T = new WeakMap(), R = new WeakMap(), k = new WeakMap(), A = new WeakMap(), E = new WeakMap(), M = new WeakMap(), F = new WeakMap(), U = new WeakMap();
|
|
840
|
+
var x, j, P, D, I, v, b, g, S, O;
|
|
841
|
+
class Nt {
|
|
844
842
|
constructor() {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
843
|
+
f(this, x);
|
|
844
|
+
f(this, j, !1);
|
|
845
|
+
f(this, P, {});
|
|
846
|
+
f(this, D, 0);
|
|
847
|
+
f(this, I, 0);
|
|
848
|
+
f(this, v, 0);
|
|
849
|
+
f(this, b, 0);
|
|
850
|
+
f(this, g);
|
|
851
|
+
f(this, S);
|
|
852
|
+
f(this, O);
|
|
855
853
|
}
|
|
856
|
-
init(
|
|
857
|
-
m(this, x,
|
|
854
|
+
init(e, t = {}) {
|
|
855
|
+
m(this, x, e), m(this, g, t.limit), m(this, S, t.update_move), m(this, O, t.update_up), m(this, P, {
|
|
858
856
|
mousedown: this.mousedown.bind(this),
|
|
859
857
|
mousemove: this.mousemove.bind(this),
|
|
860
858
|
mouseup: this.mouseup.bind(this)
|
|
@@ -863,223 +861,261 @@ class Ie {
|
|
|
863
861
|
finish() {
|
|
864
862
|
this.bindOrUnbindEvent("unbind");
|
|
865
863
|
}
|
|
866
|
-
bindOrUnbindEvent(
|
|
867
|
-
const
|
|
864
|
+
bindOrUnbindEvent(e) {
|
|
865
|
+
const t = e === "bind" ? "addEventListener" : "removeEventListener";
|
|
868
866
|
if (!c(this, x)) return console.error("No DOM");
|
|
869
|
-
c(this, x)[
|
|
867
|
+
c(this, x)[t]("mousedown", c(this, P).mousedown), document[t]("mousemove", c(this, P).mousemove), document[t]("mouseup", c(this, P).mouseup);
|
|
870
868
|
}
|
|
871
869
|
updateValue() {
|
|
872
|
-
const
|
|
870
|
+
const e = {
|
|
873
871
|
top: c(this, v),
|
|
874
872
|
left: c(this, b),
|
|
875
873
|
percentage: { top: 0, left: 0 }
|
|
876
874
|
};
|
|
877
875
|
if (c(this, g)) {
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
top:
|
|
881
|
-
left:
|
|
876
|
+
const t = (o) => c(this, g) ? (e[o] - c(this, g).min[o]) / (c(this, g).max[o] - c(this, g).min[o]) : 0;
|
|
877
|
+
e.percentage = {
|
|
878
|
+
top: t("top") || 0,
|
|
879
|
+
left: t("left") || 0
|
|
882
880
|
};
|
|
883
881
|
}
|
|
884
|
-
return
|
|
882
|
+
return e;
|
|
885
883
|
}
|
|
886
884
|
alterLocation() {
|
|
887
885
|
if (!c(this, x)) return console.error("No DOM");
|
|
888
|
-
c(this, g) && (m(this, v, Math.min(c(this, v), c(this, g).max.top)), m(this, v, Math.max(c(this, v), c(this, g).min.top)), m(this, b, Math.min(c(this, b), c(this, g).max.left)), m(this, b, Math.max(c(this, b), c(this, g).min.left))), c(this,
|
|
886
|
+
c(this, g) && (m(this, v, Math.min(c(this, v), c(this, g).max.top)), m(this, v, Math.max(c(this, v), c(this, g).min.top)), m(this, b, Math.min(c(this, b), c(this, g).max.left)), m(this, b, Math.max(c(this, b), c(this, g).min.left))), c(this, S) && c(this, S).call(this, this.updateValue()), c(this, x).style.setProperty("--top", c(this, v) + "px"), c(this, x).style.setProperty("--left", c(this, b) + "px");
|
|
889
887
|
}
|
|
890
|
-
mousedown(
|
|
888
|
+
mousedown(e) {
|
|
891
889
|
if (!c(this, x)) return console.error("No DOM");
|
|
892
|
-
document.body.classList.add("no-select"), m(this,
|
|
893
|
-
const
|
|
894
|
-
m(this, I,
|
|
895
|
-
const { pageX: o, pageY: r } =
|
|
896
|
-
m(this, v, r - c(this, I)), m(this, b, o - c(this,
|
|
890
|
+
document.body.classList.add("no-select"), m(this, j, !0);
|
|
891
|
+
const t = c(this, x).getBoundingClientRect();
|
|
892
|
+
m(this, I, t.y), m(this, D, t.x);
|
|
893
|
+
const { pageX: o, pageY: r } = e;
|
|
894
|
+
m(this, v, r - c(this, I)), m(this, b, o - c(this, D)), this.alterLocation();
|
|
897
895
|
}
|
|
898
|
-
mousemove(
|
|
899
|
-
const { pageX:
|
|
900
|
-
c(this,
|
|
896
|
+
mousemove(e) {
|
|
897
|
+
const { pageX: t, pageY: o } = e;
|
|
898
|
+
c(this, j) && (m(this, v, o - c(this, I)), m(this, b, t - c(this, D)), this.alterLocation());
|
|
901
899
|
}
|
|
902
900
|
mouseup() {
|
|
903
|
-
c(this,
|
|
901
|
+
c(this, j) && (m(this, j, !1), document.body.classList.remove("no-select"), c(this, O) && c(this, O).call(this, this.updateValue()));
|
|
904
902
|
}
|
|
905
903
|
}
|
|
906
|
-
x = new WeakMap(),
|
|
907
|
-
function
|
|
908
|
-
const
|
|
904
|
+
x = new WeakMap(), j = new WeakMap(), P = new WeakMap(), D = new WeakMap(), I = new WeakMap(), v = new WeakMap(), b = new WeakMap(), g = new WeakMap(), S = new WeakMap(), O = new WeakMap();
|
|
905
|
+
function rt(n) {
|
|
906
|
+
const e = n || document.documentElement;
|
|
909
907
|
if (n) {
|
|
910
908
|
if (n.requestFullscreen)
|
|
911
909
|
return n.requestFullscreen();
|
|
912
|
-
if (
|
|
913
|
-
return
|
|
914
|
-
if (
|
|
915
|
-
return
|
|
916
|
-
if (
|
|
917
|
-
return
|
|
910
|
+
if (e.mozRequestFullScreen)
|
|
911
|
+
return e.mozRequestFullScreen();
|
|
912
|
+
if (e.webkitRequestFullscreen)
|
|
913
|
+
return e.webkitRequestFullscreen();
|
|
914
|
+
if (e.msRequestFullscreen)
|
|
915
|
+
return e.msRequestFullscreen();
|
|
918
916
|
} else return Promise.reject("No DOM");
|
|
919
917
|
return Promise.reject("No Fullscreen API");
|
|
920
918
|
}
|
|
921
|
-
function
|
|
919
|
+
function it() {
|
|
922
920
|
const n = document;
|
|
923
921
|
return document.exitFullscreen ? document.exitFullscreen() : n.mozCancelFullScreen ? n.mozCancelFullScreen() : n.webkitExitFullscreen ? n.webkitExitFullscreen() : n.msExitFullscreen ? n.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
|
|
924
922
|
}
|
|
925
|
-
function
|
|
926
|
-
|
|
927
|
-
|
|
923
|
+
function st(n) {
|
|
924
|
+
n = n || document.documentElement;
|
|
925
|
+
const e = document, t = document.fullscreenElement || e.webkitFullscreenElement || e.mozFullScreenElement || e.msFullscreenElement;
|
|
926
|
+
return n == t;
|
|
928
927
|
}
|
|
929
|
-
function
|
|
928
|
+
function qt(n) {
|
|
930
929
|
return function() {
|
|
931
|
-
|
|
930
|
+
st(n) ? it() : rt(n);
|
|
932
931
|
};
|
|
933
932
|
}
|
|
934
|
-
function
|
|
933
|
+
function $t(n, e) {
|
|
935
934
|
if (typeof n == "number") return n;
|
|
936
935
|
if (/px/.test(n)) return Number(n.replace(/px/, "")) || 0;
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
const o =
|
|
940
|
-
return
|
|
936
|
+
const t = document.createElement("div");
|
|
937
|
+
t.style.width = n, e = e || document.body, e.appendChild(t);
|
|
938
|
+
const o = t.getBoundingClientRect().width;
|
|
939
|
+
return e.removeChild(t), o;
|
|
941
940
|
}
|
|
942
|
-
function
|
|
941
|
+
function Yt(n, e) {
|
|
943
942
|
if (!n) return;
|
|
944
|
-
let
|
|
945
|
-
if (typeof
|
|
946
|
-
const i = document.querySelector(
|
|
943
|
+
let t, o;
|
|
944
|
+
if (typeof e == "string") {
|
|
945
|
+
const i = document.querySelector(e);
|
|
947
946
|
if (!i) return;
|
|
948
947
|
const s = i.getBoundingClientRect();
|
|
949
|
-
|
|
950
|
-
} else if (Array.isArray(
|
|
951
|
-
|
|
948
|
+
t = s.width, o = s.height;
|
|
949
|
+
} else if (Array.isArray(e))
|
|
950
|
+
t = e[0], o = e[1];
|
|
952
951
|
else {
|
|
953
|
-
const i =
|
|
954
|
-
|
|
952
|
+
const i = e.getBoundingClientRect();
|
|
953
|
+
t = i.width, o = i.height;
|
|
955
954
|
}
|
|
956
|
-
const r =
|
|
957
|
-
return r > n ? [n * o, o] : r < n ? [
|
|
955
|
+
const r = t / o;
|
|
956
|
+
return r > n ? [n * o, o] : r < n ? [t, t / n] : [t, o];
|
|
958
957
|
}
|
|
959
|
-
function
|
|
960
|
-
return new Promise((
|
|
958
|
+
function Bt(n, e = 5e3) {
|
|
959
|
+
return new Promise((t, o) => {
|
|
961
960
|
const r = new Image();
|
|
962
961
|
r.src = n;
|
|
963
962
|
const i = setTimeout(() => {
|
|
964
963
|
o(new Error("图片加载超时")), r.onload = null, r.onerror = null;
|
|
965
|
-
},
|
|
964
|
+
}, e);
|
|
966
965
|
r.onload = () => {
|
|
967
966
|
clearTimeout(i);
|
|
968
|
-
const s = r.naturalWidth, a = r.naturalHeight,
|
|
969
|
-
|
|
967
|
+
const s = r.naturalWidth, a = r.naturalHeight, l = s / a;
|
|
968
|
+
t([r, l]);
|
|
970
969
|
}, r.onerror = () => {
|
|
971
970
|
clearTimeout(i), o(new Error("图片加载失败"));
|
|
972
971
|
}, r.crossOrigin = "Anonymous";
|
|
973
972
|
});
|
|
974
973
|
}
|
|
975
|
-
function
|
|
976
|
-
|
|
974
|
+
function Ht(n) {
|
|
975
|
+
const e = Date.now();
|
|
976
|
+
let t = performance.now();
|
|
977
|
+
for (; Date.now() - e < n; ) {
|
|
978
|
+
t = Math.sin(t) * 1e6, (t > 1e6 || t < -1e6) && (t = 0);
|
|
979
|
+
try {
|
|
980
|
+
const o = t.toString().substring(0, 8);
|
|
981
|
+
history.replaceState(null, "", `#${o}`);
|
|
982
|
+
} catch {
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
return Date.now() - e;
|
|
986
|
+
}
|
|
987
|
+
const ct = Math.PI / 2, N = Math.PI / 180, q = 6378137, at = 85.05112878;
|
|
988
|
+
function Xt(n, e) {
|
|
989
|
+
const t = Math.max(Math.min(n, 180), -180), o = Math.max(Math.min(e, at), -85.05112878), r = t * N * q, i = o * N, s = Math.log(Math.tan(Math.PI / 4 + i / 2)) * q;
|
|
990
|
+
return [r, s];
|
|
991
|
+
}
|
|
992
|
+
function Wt(n, e) {
|
|
993
|
+
const t = n / q / N, o = (2 * Math.atan(Math.exp(e / q)) - ct) / N;
|
|
994
|
+
return [t, o];
|
|
995
|
+
}
|
|
996
|
+
function Gt(n, e, t) {
|
|
997
|
+
const [o, r] = n, [i, s] = e, [a, l] = t, u = (a - i) ** 2 + (l - s) ** 2;
|
|
998
|
+
if (u === 0) return Math.sqrt((o - i) ** 2 + (r - s) ** 2);
|
|
999
|
+
let d = ((o - i) * (a - i) + (r - s) * (l - s)) / u;
|
|
1000
|
+
return d = Math.max(0, Math.min(1, d)), Math.sqrt(
|
|
1001
|
+
(o - (i + d * (a - i))) ** 2 + (r - (s + d * (l - s))) ** 2
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
1004
|
+
function lt(n) {
|
|
1005
|
+
return Array.isArray(n) && typeof n[0] == "number" && typeof n[1] == "number" && isFinite(n[0]) && isFinite(n[1]);
|
|
1006
|
+
}
|
|
1007
|
+
function Vt(n) {
|
|
1008
|
+
return Array.isArray(n) && n.every((e) => lt(e));
|
|
1009
|
+
}
|
|
1010
|
+
function Zt(n, e, t = 2) {
|
|
1011
|
+
return !Number.isFinite(n) || !Number.isFinite(e) || !Number.isFinite(t) ? (console.error("所有参数必须是有限的数字"), "") : e === 0 ? (console.error("分母不能为零"), "") : t < 0 ? (console.error("小数位数不能为负数"), "") : (n / e * 100).toFixed(t) + "%";
|
|
977
1012
|
}
|
|
978
|
-
function
|
|
979
|
-
return Math.abs(n -
|
|
1013
|
+
function Kt(n, e, t) {
|
|
1014
|
+
return Math.abs(n - e) <= t;
|
|
980
1015
|
}
|
|
981
|
-
function
|
|
982
|
-
let
|
|
1016
|
+
function Jt(n, e = 500) {
|
|
1017
|
+
let t, o = !0;
|
|
983
1018
|
function r(i) {
|
|
984
1019
|
if (!o) return;
|
|
985
|
-
|
|
986
|
-
let s = Math.min((i -
|
|
987
|
-
n(s), i -
|
|
1020
|
+
t || (t = i);
|
|
1021
|
+
let s = Math.min((i - t) / e, 1);
|
|
1022
|
+
n(s), i - t < e && requestAnimationFrame(r);
|
|
988
1023
|
}
|
|
989
1024
|
return requestAnimationFrame(r), () => o = !1;
|
|
990
1025
|
}
|
|
991
|
-
function
|
|
992
|
-
|
|
1026
|
+
function Qt(n) {
|
|
1027
|
+
const t = n.toString().split("."), o = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1028
|
+
return t.length > 1 ? o + "." + t[1] : o;
|
|
993
1029
|
}
|
|
994
|
-
function
|
|
995
|
-
const
|
|
1030
|
+
function te(n, e) {
|
|
1031
|
+
const t = {
|
|
996
1032
|
join: !0,
|
|
997
1033
|
suffix: "",
|
|
998
1034
|
decimalPlaces: 2
|
|
999
1035
|
}, { join: o, suffix: r, decimalPlaces: i } = {
|
|
1000
|
-
...
|
|
1001
|
-
...
|
|
1036
|
+
...t,
|
|
1037
|
+
...e || {}
|
|
1002
1038
|
}, s = Number(n);
|
|
1003
1039
|
if (isNaN(s)) return o ? `0${r}` : [0, r];
|
|
1004
|
-
const a = Math.abs(s),
|
|
1005
|
-
return o ? `${
|
|
1040
|
+
const a = Math.abs(s), l = s >= 0, u = Math.max(0, Math.floor(Math.log10(a) / 4)), d = Math.pow(1e4, u), p = a / d, L = (l ? 1 : -1) * parseFloat(p.toFixed(Math.max(0, i)));
|
|
1041
|
+
return o ? `${L}${V[u]}${r}` : [L, V[u] + r];
|
|
1006
1042
|
}
|
|
1007
|
-
function
|
|
1008
|
-
let
|
|
1009
|
-
const { x: o, y: r } = n, i =
|
|
1043
|
+
function ee(n, e) {
|
|
1044
|
+
let t = !1;
|
|
1045
|
+
const { x: o, y: r } = n, i = e.length;
|
|
1010
1046
|
for (let s = 0, a = i - 1; s < i; a = s++) {
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1047
|
+
const l = e[s].x, u = e[s].y, d = e[a].x, p = e[a].y;
|
|
1048
|
+
u > r != p > r && o < (d - l) * (r - u) / (p - u) + l && (t = !t);
|
|
1013
1049
|
}
|
|
1014
|
-
return
|
|
1050
|
+
return t;
|
|
1015
1051
|
}
|
|
1016
|
-
function
|
|
1017
|
-
const
|
|
1018
|
-
let
|
|
1052
|
+
function ne(n) {
|
|
1053
|
+
const e = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
1054
|
+
let t = 0;
|
|
1019
1055
|
for (; n > 1024; )
|
|
1020
|
-
n /= 1024,
|
|
1021
|
-
return `${Math.round(n * 100) / 100} ${t
|
|
1056
|
+
n /= 1024, t++;
|
|
1057
|
+
return `${Math.round(n * 100) / 100} ${e[t]}`;
|
|
1022
1058
|
}
|
|
1023
|
-
function
|
|
1024
|
-
return Math.sqrt(Math.pow(
|
|
1059
|
+
function oe(n, e, t, o) {
|
|
1060
|
+
return Math.sqrt(Math.pow(t - n, 2) + Math.pow(o - e, 2));
|
|
1025
1061
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const r = (n +
|
|
1062
|
+
function re(n, e, t, o) {
|
|
1063
|
+
const r = (n + t) / 2, i = (e + o) / 2;
|
|
1028
1064
|
return { x: r, y: i };
|
|
1029
1065
|
}
|
|
1030
|
-
class
|
|
1031
|
-
constructor(
|
|
1066
|
+
class _ {
|
|
1067
|
+
constructor(e, t) {
|
|
1032
1068
|
y(this, "resolve");
|
|
1033
1069
|
y(this, "reject");
|
|
1034
|
-
this.resolve =
|
|
1070
|
+
this.resolve = e, this.reject = t;
|
|
1035
1071
|
}
|
|
1036
|
-
run(
|
|
1037
|
-
var
|
|
1038
|
-
return
|
|
1072
|
+
run(e) {
|
|
1073
|
+
var t, o;
|
|
1074
|
+
return e instanceof Promise ? e.then((r) => {
|
|
1039
1075
|
var i;
|
|
1040
1076
|
return (i = this.resolve) == null || i.call(this), r;
|
|
1041
1077
|
}).catch((r) => {
|
|
1042
1078
|
var i;
|
|
1043
1079
|
return (i = this.reject) == null || i.call(this), Promise.reject(r);
|
|
1044
|
-
}) :
|
|
1080
|
+
}) : e ? (t = this.resolve) == null || t.call(this) : (o = this.reject) == null || o.call(this), e;
|
|
1045
1081
|
}
|
|
1046
1082
|
}
|
|
1047
|
-
class
|
|
1048
|
-
constructor(
|
|
1049
|
-
super(), this.resolve =
|
|
1083
|
+
class ut extends _ {
|
|
1084
|
+
constructor(e) {
|
|
1085
|
+
super(), this.resolve = e;
|
|
1050
1086
|
}
|
|
1051
|
-
warning(...
|
|
1052
|
-
const
|
|
1087
|
+
warning(...e) {
|
|
1088
|
+
const t = () => {
|
|
1053
1089
|
var o, r;
|
|
1054
|
-
return (r = (o =
|
|
1090
|
+
return (r = (o = z.tips).warning) == null ? void 0 : r.call(o, ...e);
|
|
1055
1091
|
};
|
|
1056
|
-
return new
|
|
1092
|
+
return new _(this.resolve, t);
|
|
1057
1093
|
}
|
|
1058
|
-
error(...
|
|
1059
|
-
const
|
|
1094
|
+
error(...e) {
|
|
1095
|
+
const t = () => {
|
|
1060
1096
|
var o, r;
|
|
1061
|
-
return (r = (o =
|
|
1097
|
+
return (r = (o = z.tips).error) == null ? void 0 : r.call(o, ...e);
|
|
1062
1098
|
};
|
|
1063
|
-
return new
|
|
1099
|
+
return new _(this.resolve, t);
|
|
1064
1100
|
}
|
|
1065
1101
|
}
|
|
1066
|
-
class
|
|
1067
|
-
constructor(
|
|
1068
|
-
super(), this.reject =
|
|
1102
|
+
class mt extends _ {
|
|
1103
|
+
constructor(e) {
|
|
1104
|
+
super(), this.reject = e;
|
|
1069
1105
|
}
|
|
1070
|
-
info(...
|
|
1071
|
-
const
|
|
1106
|
+
info(...e) {
|
|
1107
|
+
const t = () => {
|
|
1072
1108
|
var o, r;
|
|
1073
|
-
return (r = (o =
|
|
1109
|
+
return (r = (o = z.tips).info) == null ? void 0 : r.call(o, ...e);
|
|
1074
1110
|
};
|
|
1075
|
-
return new
|
|
1111
|
+
return new _(t, this.reject);
|
|
1076
1112
|
}
|
|
1077
|
-
success(...
|
|
1078
|
-
const
|
|
1113
|
+
success(...e) {
|
|
1114
|
+
const t = () => {
|
|
1079
1115
|
var o, r;
|
|
1080
|
-
return (r = (o =
|
|
1116
|
+
return (r = (o = z.tips).success) == null ? void 0 : r.call(o, ...e);
|
|
1081
1117
|
};
|
|
1082
|
-
return new
|
|
1118
|
+
return new _(t, this.reject);
|
|
1083
1119
|
}
|
|
1084
1120
|
}
|
|
1085
1121
|
const h = class h {
|
|
@@ -1091,27 +1127,27 @@ const h = class h {
|
|
|
1091
1127
|
if (new.target === h)
|
|
1092
1128
|
throw new Error("请直接使用静态方法,而不是实例化此类");
|
|
1093
1129
|
}
|
|
1094
|
-
static register(
|
|
1095
|
-
if (typeof
|
|
1130
|
+
static register(e, t) {
|
|
1131
|
+
if (typeof t != "function")
|
|
1096
1132
|
return console.error("TipHandler must be a function");
|
|
1097
|
-
h.tips[
|
|
1133
|
+
h.tips[e] = t;
|
|
1098
1134
|
}
|
|
1099
|
-
static resolveTip(
|
|
1100
|
-
return function(...
|
|
1135
|
+
static resolveTip(e) {
|
|
1136
|
+
return function(...t) {
|
|
1101
1137
|
const o = () => {
|
|
1102
1138
|
var r, i;
|
|
1103
|
-
return (i = (r = h.tips)[
|
|
1139
|
+
return (i = (r = h.tips)[e]) == null ? void 0 : i.call(r, ...t);
|
|
1104
1140
|
};
|
|
1105
|
-
return new
|
|
1141
|
+
return new ut(o);
|
|
1106
1142
|
};
|
|
1107
1143
|
}
|
|
1108
|
-
static rejectTip(
|
|
1109
|
-
return function(...
|
|
1144
|
+
static rejectTip(e) {
|
|
1145
|
+
return function(...t) {
|
|
1110
1146
|
const o = () => {
|
|
1111
1147
|
var r, i;
|
|
1112
|
-
return (i = (r = h.tips)[
|
|
1148
|
+
return (i = (r = h.tips)[e]) == null ? void 0 : i.call(r, ...t);
|
|
1113
1149
|
};
|
|
1114
|
-
return new
|
|
1150
|
+
return new mt(o);
|
|
1115
1151
|
};
|
|
1116
1152
|
}
|
|
1117
1153
|
};
|
|
@@ -1121,57 +1157,63 @@ y(h, "tips", {
|
|
|
1121
1157
|
warning: void 0,
|
|
1122
1158
|
error: void 0
|
|
1123
1159
|
}), y(h, "info", h.resolveTip("info")), y(h, "success", h.resolveTip("success")), y(h, "warning", h.rejectTip("warning")), y(h, "error", h.rejectTip("error"));
|
|
1124
|
-
let
|
|
1160
|
+
let z = h;
|
|
1125
1161
|
export {
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1162
|
+
Vt as _AreAllArraysValid,
|
|
1163
|
+
Yt as _CalculateCanvasSize,
|
|
1164
|
+
oe as _CalculateDistance2D,
|
|
1165
|
+
xt as _CapitalizeFirstLetter,
|
|
1166
|
+
_t as _CheckConnectionWithXHR,
|
|
1167
|
+
Ut as _Clone,
|
|
1168
|
+
Ot as _CloseOnOutsideClick,
|
|
1169
|
+
Mt as _ConvertToCamelCase,
|
|
1170
|
+
Zt as _ConvertToPercentage,
|
|
1171
|
+
Tt as _CopyToClipboard,
|
|
1172
|
+
Ct as _CreateAndDownloadFile,
|
|
1173
|
+
Dt as _Danger_ConvertDataToImageUrl,
|
|
1174
|
+
Z as _DataType,
|
|
1175
|
+
nt as _Debounce,
|
|
1176
|
+
yt as _DownloadFile,
|
|
1177
|
+
zt as _Drag,
|
|
1178
|
+
rt as _EnterFullscreen,
|
|
1179
|
+
wt as _ExcludeSubstring,
|
|
1180
|
+
pt as _ExecuteWhenIdle,
|
|
1181
|
+
it as _ExitFullscreen,
|
|
1182
|
+
K as _FileTypeChecker,
|
|
1183
|
+
ne as _FormatFileSize,
|
|
1184
|
+
Qt as _FormatNumber,
|
|
1185
|
+
te as _FormatNumberWithUnit,
|
|
1186
|
+
qt as _Fullscreen,
|
|
1187
|
+
Ft as _GenerateUUID,
|
|
1188
|
+
Et as _GetFrameRate,
|
|
1189
|
+
X as _GetHrefName,
|
|
1190
|
+
re as _GetMidpoint,
|
|
1191
|
+
$t as _GetOtherSizeInPixels,
|
|
1192
|
+
jt as _GetTargetByPath,
|
|
1193
|
+
Rt as _InitTargetByPath,
|
|
1194
|
+
st as _IsFullscreen,
|
|
1195
|
+
ht as _IsObject,
|
|
1196
|
+
ee as _IsPointInPolygon,
|
|
1197
|
+
kt as _IsSecureContext,
|
|
1198
|
+
lt as _IsSingleArrayValid,
|
|
1199
|
+
Kt as _IsWithinErrorMargin,
|
|
1200
|
+
ot as _KeyedWindowManager,
|
|
1201
|
+
Xt as _LngLatToPlane,
|
|
1202
|
+
Bt as _LoadImage,
|
|
1203
|
+
Nt as _LocalDrag,
|
|
1204
|
+
H as _MergeObjects,
|
|
1205
|
+
ft as _NotNull,
|
|
1206
|
+
Wt as _PlaneToLngLat,
|
|
1207
|
+
Gt as _PointToLineDistance,
|
|
1208
|
+
bt as _ReadFile,
|
|
1209
|
+
At as _RotateList,
|
|
1210
|
+
Jt as _Schedule,
|
|
1211
|
+
St as _ScrollEndListener,
|
|
1212
|
+
Ht as _Sleep,
|
|
1213
|
+
Lt as _Throttle,
|
|
1214
|
+
It as _TimeConsumption,
|
|
1215
|
+
vt as _TimeTransition,
|
|
1216
|
+
z as _Tip,
|
|
1217
|
+
Pt as _UpdateTargetByPath,
|
|
1218
|
+
gt as _WaitForCondition
|
|
1177
1219
|
};
|