nhanh-pure-function 2.0.4 → 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 +43 -1
- package/dist/User/index.d.ts +12 -3
- package/dist/Utility/index.d.ts +12 -6
- package/dist/index.cjs.js +2 -1
- package/dist/index.es.js +525 -448
- 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
|
|
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
|
-
return n.replace(o, function(r, i,
|
|
299
|
-
return i ===
|
|
298
|
+
return n.replace(o, function(r, 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
|
|
316
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
317
|
-
const a =
|
|
318
|
-
n[
|
|
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
|
|
343
|
-
const
|
|
344
|
-
return
|
|
342
|
+
return e.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (i) => {
|
|
343
|
+
const s = r[i](o);
|
|
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
|
-
|
|
363
|
-
const i = URL.createObjectURL(r),
|
|
364
|
-
|
|
362
|
+
e = e || X(n, "downloaded_file"), fetch(n).then((r) => (r.ok || o(`文件下载失败,状态码: ${r.status}`), r.blob())).then((r) => {
|
|
363
|
+
const i = URL.createObjectURL(r), s = document.createElement("a");
|
|
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
|
|
378
|
-
n(Number(a.toFixed(2)), Number(
|
|
377
|
+
const s = (+/* @__PURE__ */ new Date() - t) / e, a = 1e3 / s;
|
|
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
|
|
391
|
-
|
|
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
|
-
|
|
435
|
+
const l = document.createRange();
|
|
436
|
+
l.selectNodeContents(a);
|
|
437
437
|
const u = window.getSelection();
|
|
438
|
-
let
|
|
439
|
-
return u && (u.removeAllRanges(), u.addRange(
|
|
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
|
-
function
|
|
448
|
-
return r().then(
|
|
449
|
-
i().then(
|
|
447
|
+
function s() {
|
|
448
|
+
return r().then(e).catch(() => {
|
|
449
|
+
i().then(e).catch(() => t("复制方式尽皆失效"));
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
|
-
return navigator.clipboard ? o().catch(
|
|
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,
|
|
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 Re(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
|
|
632
|
-
if (
|
|
633
|
-
return this.keys.set(
|
|
634
|
-
console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(
|
|
630
|
+
const s = window.open(t, o, r);
|
|
631
|
+
if (s)
|
|
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,107 +638,130 @@ 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") {
|
|
678
676
|
let i = n;
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
681
|
-
if (!
|
|
677
|
+
const s = i.match(/^data:([^;]*)(;base64)?,(.*)$/i);
|
|
678
|
+
if (s) {
|
|
679
|
+
if (!s[2])
|
|
682
680
|
throw new Error("无效的数据 URL:缺少 base64 编码声明");
|
|
683
|
-
if (o =
|
|
681
|
+
if (o = s[1] || o, i = s[3], !i)
|
|
684
682
|
throw new Error("数据 URL 包含空有效负载");
|
|
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
|
|
710
|
-
|
|
711
|
-
|
|
707
|
+
function It(n, e, t = 30) {
|
|
708
|
+
if (typeof n != "function")
|
|
709
|
+
throw new Error("The first argument must be a function.");
|
|
710
|
+
if (!Array.isArray(e))
|
|
711
|
+
throw new Error("The second argument must be an array.");
|
|
712
|
+
let o = [], r = 0;
|
|
713
|
+
const i = (s, a) => {
|
|
714
|
+
for (const [l, u] of a)
|
|
715
|
+
if (s >= l)
|
|
716
|
+
return u;
|
|
717
|
+
return "black";
|
|
718
|
+
};
|
|
719
|
+
return function(...s) {
|
|
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);
|
|
723
|
+
return console.log(
|
|
724
|
+
`%c单次耗时:${u.toFixed(2)}ms
|
|
725
|
+
%c平均耗时(${o.length}次):${r.toFixed(2)}ms`,
|
|
726
|
+
`color: ${d}; padding: 2px 0;`,
|
|
727
|
+
`color: ${p}; padding: 2px 0;`
|
|
728
|
+
), l;
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
function St(n) {
|
|
732
|
+
const e = nt(n, 100);
|
|
733
|
+
let t = 0, o = 0;
|
|
712
734
|
return function(r) {
|
|
713
735
|
const i = r.target;
|
|
714
|
-
if (!i || !(i instanceof
|
|
736
|
+
if (!i || !(i instanceof Element)) return;
|
|
715
737
|
const {
|
|
716
|
-
scrollTop:
|
|
738
|
+
scrollTop: s,
|
|
717
739
|
scrollHeight: a,
|
|
718
|
-
clientHeight:
|
|
740
|
+
clientHeight: l,
|
|
719
741
|
scrollLeft: u,
|
|
720
|
-
scrollWidth:
|
|
721
|
-
clientWidth:
|
|
742
|
+
scrollWidth: d,
|
|
743
|
+
clientWidth: p
|
|
722
744
|
} = i;
|
|
723
|
-
function
|
|
724
|
-
if (
|
|
725
|
-
const
|
|
726
|
-
if (
|
|
727
|
-
a -
|
|
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");
|
|
728
750
|
}
|
|
729
|
-
function
|
|
751
|
+
function $() {
|
|
730
752
|
if (o == u) return;
|
|
731
|
-
const
|
|
732
|
-
if (o = u,
|
|
733
|
-
|
|
753
|
+
const Y = o > u;
|
|
754
|
+
if (o = u, Y) return;
|
|
755
|
+
d - u - p <= 1 && e("horizontal");
|
|
734
756
|
}
|
|
735
|
-
|
|
757
|
+
L(), $();
|
|
736
758
|
};
|
|
737
759
|
}
|
|
738
|
-
function
|
|
739
|
-
const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } =
|
|
760
|
+
function Ot(n, e, t) {
|
|
761
|
+
const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } = t || {}, i = function(l) {
|
|
740
762
|
const u = [];
|
|
741
|
-
for (const
|
|
742
|
-
Object.hasOwnProperty.call(
|
|
763
|
+
for (const d in l)
|
|
764
|
+
Object.hasOwnProperty.call(l, d) && r.includes(d) && u.push(...l[d]);
|
|
743
765
|
return u;
|
|
744
766
|
}({
|
|
745
767
|
naiveUI: [
|
|
@@ -750,38 +772,38 @@ function ze(n, t, e) {
|
|
|
750
772
|
ElementPlus: [".el-popper"],
|
|
751
773
|
Element: [".el-popper"]
|
|
752
774
|
});
|
|
753
|
-
function
|
|
754
|
-
|
|
775
|
+
function s() {
|
|
776
|
+
e(), document.removeEventListener("mousedown", a);
|
|
755
777
|
}
|
|
756
|
-
function a(
|
|
778
|
+
function a(l) {
|
|
757
779
|
if (o) {
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
if (
|
|
780
|
+
const p = o(l);
|
|
781
|
+
if (p) return;
|
|
782
|
+
if (p === !1) return s();
|
|
761
783
|
}
|
|
762
|
-
const u =
|
|
763
|
-
if (!(u instanceof
|
|
764
|
-
n.concat(i).some((
|
|
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();
|
|
765
787
|
}
|
|
766
788
|
requestAnimationFrame(
|
|
767
789
|
() => document.addEventListener("mousedown", a)
|
|
768
790
|
);
|
|
769
791
|
}
|
|
770
|
-
var w,
|
|
771
|
-
class
|
|
792
|
+
var w, T, R, k, A, E, M, F, U;
|
|
793
|
+
class zt {
|
|
772
794
|
constructor() {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
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);
|
|
782
804
|
}
|
|
783
|
-
init(
|
|
784
|
-
|
|
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, {
|
|
785
807
|
mousedown: this.mousedown.bind(this),
|
|
786
808
|
mousemove: this.mousemove.bind(this),
|
|
787
809
|
mouseup: this.mouseup.bind(this)
|
|
@@ -790,47 +812,47 @@ class De {
|
|
|
790
812
|
finish() {
|
|
791
813
|
this.bindOrUnbindEvent("unbind");
|
|
792
814
|
}
|
|
793
|
-
bindOrUnbindEvent(
|
|
794
|
-
const
|
|
795
|
-
if (!
|
|
796
|
-
|
|
815
|
+
bindOrUnbindEvent(e) {
|
|
816
|
+
const t = e === "bind" ? "addEventListener" : "removeEventListener";
|
|
817
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
818
|
+
c(this, w)[t]("mousedown", c(this, R).mousedown), document[t]("mousemove", c(this, R).mousemove), document[t]("mouseup", c(this, R).mouseup);
|
|
797
819
|
}
|
|
798
820
|
alterLocation() {
|
|
799
|
-
if (!
|
|
800
|
-
|
|
821
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
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");
|
|
801
823
|
}
|
|
802
|
-
mousedown(
|
|
803
|
-
if (!
|
|
804
|
-
if (
|
|
805
|
-
document.body.classList.add("no-select"),
|
|
806
|
-
const
|
|
807
|
-
|
|
824
|
+
mousedown(e) {
|
|
825
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
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);
|
|
808
830
|
}
|
|
809
|
-
mousemove(
|
|
810
|
-
const { pageX:
|
|
811
|
-
|
|
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());
|
|
812
834
|
}
|
|
813
835
|
mouseup() {
|
|
814
|
-
|
|
836
|
+
c(this, T) && (m(this, T, !1), document.body.classList.remove("no-select"));
|
|
815
837
|
}
|
|
816
838
|
}
|
|
817
|
-
w = new WeakMap(),
|
|
818
|
-
var x,
|
|
819
|
-
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 {
|
|
820
842
|
constructor() {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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);
|
|
831
853
|
}
|
|
832
|
-
init(
|
|
833
|
-
|
|
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, {
|
|
834
856
|
mousedown: this.mousedown.bind(this),
|
|
835
857
|
mousemove: this.mousemove.bind(this),
|
|
836
858
|
mouseup: this.mouseup.bind(this)
|
|
@@ -839,215 +861,261 @@ class Ie {
|
|
|
839
861
|
finish() {
|
|
840
862
|
this.bindOrUnbindEvent("unbind");
|
|
841
863
|
}
|
|
842
|
-
bindOrUnbindEvent(
|
|
843
|
-
const
|
|
844
|
-
if (!
|
|
845
|
-
|
|
864
|
+
bindOrUnbindEvent(e) {
|
|
865
|
+
const t = e === "bind" ? "addEventListener" : "removeEventListener";
|
|
866
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
867
|
+
c(this, x)[t]("mousedown", c(this, P).mousedown), document[t]("mousemove", c(this, P).mousemove), document[t]("mouseup", c(this, P).mouseup);
|
|
846
868
|
}
|
|
847
869
|
updateValue() {
|
|
848
|
-
const
|
|
849
|
-
top:
|
|
850
|
-
left:
|
|
870
|
+
const e = {
|
|
871
|
+
top: c(this, v),
|
|
872
|
+
left: c(this, b),
|
|
851
873
|
percentage: { top: 0, left: 0 }
|
|
852
874
|
};
|
|
853
|
-
if (
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
top:
|
|
857
|
-
left:
|
|
875
|
+
if (c(this, g)) {
|
|
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
|
|
858
880
|
};
|
|
859
881
|
}
|
|
860
|
-
return
|
|
882
|
+
return e;
|
|
861
883
|
}
|
|
862
884
|
alterLocation() {
|
|
863
|
-
if (!
|
|
864
|
-
|
|
885
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
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");
|
|
865
887
|
}
|
|
866
|
-
mousedown(
|
|
867
|
-
if (!
|
|
868
|
-
document.body.classList.add("no-select"),
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
const { pageX: o, pageY: r } =
|
|
872
|
-
|
|
888
|
+
mousedown(e) {
|
|
889
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
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();
|
|
873
895
|
}
|
|
874
|
-
mousemove(
|
|
875
|
-
const { pageX:
|
|
876
|
-
|
|
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());
|
|
877
899
|
}
|
|
878
900
|
mouseup() {
|
|
879
|
-
|
|
901
|
+
c(this, j) && (m(this, j, !1), document.body.classList.remove("no-select"), c(this, O) && c(this, O).call(this, this.updateValue()));
|
|
880
902
|
}
|
|
881
903
|
}
|
|
882
|
-
x = new WeakMap(),
|
|
883
|
-
function
|
|
884
|
-
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;
|
|
885
907
|
if (n) {
|
|
886
908
|
if (n.requestFullscreen)
|
|
887
909
|
return n.requestFullscreen();
|
|
888
|
-
if (
|
|
889
|
-
return
|
|
890
|
-
if (
|
|
891
|
-
return
|
|
892
|
-
if (
|
|
893
|
-
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();
|
|
894
916
|
} else return Promise.reject("No DOM");
|
|
895
917
|
return Promise.reject("No Fullscreen API");
|
|
896
918
|
}
|
|
897
|
-
function
|
|
919
|
+
function it() {
|
|
898
920
|
const n = document;
|
|
899
921
|
return document.exitFullscreen ? document.exitFullscreen() : n.mozCancelFullScreen ? n.mozCancelFullScreen() : n.webkitExitFullscreen ? n.webkitExitFullscreen() : n.msExitFullscreen ? n.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
|
|
900
922
|
}
|
|
901
|
-
function
|
|
902
|
-
|
|
903
|
-
|
|
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;
|
|
904
927
|
}
|
|
905
|
-
function
|
|
928
|
+
function qt(n) {
|
|
906
929
|
return function() {
|
|
907
|
-
|
|
930
|
+
st(n) ? it() : rt(n);
|
|
908
931
|
};
|
|
909
932
|
}
|
|
910
|
-
function
|
|
933
|
+
function $t(n, e) {
|
|
911
934
|
if (typeof n == "number") return n;
|
|
912
935
|
if (/px/.test(n)) return Number(n.replace(/px/, "")) || 0;
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
const o =
|
|
916
|
-
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;
|
|
917
940
|
}
|
|
918
|
-
function
|
|
941
|
+
function Yt(n, e) {
|
|
919
942
|
if (!n) return;
|
|
920
|
-
let
|
|
921
|
-
if (typeof
|
|
922
|
-
const i = document.querySelector(
|
|
943
|
+
let t, o;
|
|
944
|
+
if (typeof e == "string") {
|
|
945
|
+
const i = document.querySelector(e);
|
|
923
946
|
if (!i) return;
|
|
924
|
-
const
|
|
925
|
-
|
|
926
|
-
} else if (Array.isArray(
|
|
927
|
-
|
|
947
|
+
const s = i.getBoundingClientRect();
|
|
948
|
+
t = s.width, o = s.height;
|
|
949
|
+
} else if (Array.isArray(e))
|
|
950
|
+
t = e[0], o = e[1];
|
|
928
951
|
else {
|
|
929
|
-
const i =
|
|
930
|
-
|
|
952
|
+
const i = e.getBoundingClientRect();
|
|
953
|
+
t = i.width, o = i.height;
|
|
931
954
|
}
|
|
932
|
-
const r =
|
|
933
|
-
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];
|
|
934
957
|
}
|
|
935
|
-
function
|
|
936
|
-
return new Promise((
|
|
958
|
+
function Bt(n, e = 5e3) {
|
|
959
|
+
return new Promise((t, o) => {
|
|
937
960
|
const r = new Image();
|
|
938
961
|
r.src = n;
|
|
939
962
|
const i = setTimeout(() => {
|
|
940
963
|
o(new Error("图片加载超时")), r.onload = null, r.onerror = null;
|
|
941
|
-
},
|
|
964
|
+
}, e);
|
|
942
965
|
r.onload = () => {
|
|
943
966
|
clearTimeout(i);
|
|
944
|
-
const
|
|
945
|
-
|
|
967
|
+
const s = r.naturalWidth, a = r.naturalHeight, l = s / a;
|
|
968
|
+
t([r, l]);
|
|
946
969
|
}, r.onerror = () => {
|
|
947
970
|
clearTimeout(i), o(new Error("图片加载失败"));
|
|
948
971
|
}, r.crossOrigin = "Anonymous";
|
|
949
972
|
});
|
|
950
973
|
}
|
|
951
|
-
function
|
|
952
|
-
|
|
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));
|
|
953
1009
|
}
|
|
954
|
-
function
|
|
955
|
-
return
|
|
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) + "%";
|
|
956
1012
|
}
|
|
957
|
-
function
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1013
|
+
function Kt(n, e, t) {
|
|
1014
|
+
return Math.abs(n - e) <= t;
|
|
1015
|
+
}
|
|
1016
|
+
function Jt(n, e = 500) {
|
|
1017
|
+
let t, o = !0;
|
|
1018
|
+
function r(i) {
|
|
1019
|
+
if (!o) return;
|
|
1020
|
+
t || (t = i);
|
|
1021
|
+
let s = Math.min((i - t) / e, 1);
|
|
1022
|
+
n(s), i - t < e && requestAnimationFrame(r);
|
|
963
1023
|
}
|
|
964
|
-
requestAnimationFrame(o
|
|
1024
|
+
return requestAnimationFrame(r), () => o = !1;
|
|
965
1025
|
}
|
|
966
|
-
function
|
|
967
|
-
|
|
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;
|
|
968
1029
|
}
|
|
969
|
-
function
|
|
970
|
-
const
|
|
1030
|
+
function te(n, e) {
|
|
1031
|
+
const t = {
|
|
971
1032
|
join: !0,
|
|
972
1033
|
suffix: "",
|
|
973
1034
|
decimalPlaces: 2
|
|
974
1035
|
}, { join: o, suffix: r, decimalPlaces: i } = {
|
|
975
|
-
...
|
|
976
|
-
...
|
|
977
|
-
},
|
|
978
|
-
if (isNaN(
|
|
979
|
-
const a = Math.abs(
|
|
980
|
-
return o ? `${
|
|
1036
|
+
...t,
|
|
1037
|
+
...e || {}
|
|
1038
|
+
}, s = Number(n);
|
|
1039
|
+
if (isNaN(s)) return o ? `0${r}` : [0, r];
|
|
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];
|
|
981
1042
|
}
|
|
982
|
-
function
|
|
983
|
-
let
|
|
984
|
-
const { x: o, y: r } = n, i =
|
|
985
|
-
for (let
|
|
986
|
-
const
|
|
987
|
-
u > r !=
|
|
1043
|
+
function ee(n, e) {
|
|
1044
|
+
let t = !1;
|
|
1045
|
+
const { x: o, y: r } = n, i = e.length;
|
|
1046
|
+
for (let s = 0, a = i - 1; s < i; a = s++) {
|
|
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);
|
|
988
1049
|
}
|
|
989
|
-
return
|
|
1050
|
+
return t;
|
|
990
1051
|
}
|
|
991
|
-
function
|
|
992
|
-
const
|
|
993
|
-
let
|
|
1052
|
+
function ne(n) {
|
|
1053
|
+
const e = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
1054
|
+
let t = 0;
|
|
994
1055
|
for (; n > 1024; )
|
|
995
|
-
n /= 1024,
|
|
996
|
-
return `${Math.round(n * 100) / 100} ${t
|
|
1056
|
+
n /= 1024, t++;
|
|
1057
|
+
return `${Math.round(n * 100) / 100} ${e[t]}`;
|
|
1058
|
+
}
|
|
1059
|
+
function oe(n, e, t, o) {
|
|
1060
|
+
return Math.sqrt(Math.pow(t - n, 2) + Math.pow(o - e, 2));
|
|
1061
|
+
}
|
|
1062
|
+
function re(n, e, t, o) {
|
|
1063
|
+
const r = (n + t) / 2, i = (e + o) / 2;
|
|
1064
|
+
return { x: r, y: i };
|
|
997
1065
|
}
|
|
998
|
-
class
|
|
999
|
-
constructor(
|
|
1066
|
+
class _ {
|
|
1067
|
+
constructor(e, t) {
|
|
1000
1068
|
y(this, "resolve");
|
|
1001
1069
|
y(this, "reject");
|
|
1002
|
-
this.resolve =
|
|
1070
|
+
this.resolve = e, this.reject = t;
|
|
1003
1071
|
}
|
|
1004
|
-
run(
|
|
1005
|
-
var
|
|
1006
|
-
return
|
|
1072
|
+
run(e) {
|
|
1073
|
+
var t, o;
|
|
1074
|
+
return e instanceof Promise ? e.then((r) => {
|
|
1007
1075
|
var i;
|
|
1008
1076
|
return (i = this.resolve) == null || i.call(this), r;
|
|
1009
1077
|
}).catch((r) => {
|
|
1010
1078
|
var i;
|
|
1011
1079
|
return (i = this.reject) == null || i.call(this), Promise.reject(r);
|
|
1012
|
-
}) :
|
|
1080
|
+
}) : e ? (t = this.resolve) == null || t.call(this) : (o = this.reject) == null || o.call(this), e;
|
|
1013
1081
|
}
|
|
1014
1082
|
}
|
|
1015
|
-
class
|
|
1016
|
-
constructor(
|
|
1017
|
-
super(), this.resolve =
|
|
1083
|
+
class ut extends _ {
|
|
1084
|
+
constructor(e) {
|
|
1085
|
+
super(), this.resolve = e;
|
|
1018
1086
|
}
|
|
1019
|
-
warning(...
|
|
1020
|
-
const
|
|
1087
|
+
warning(...e) {
|
|
1088
|
+
const t = () => {
|
|
1021
1089
|
var o, r;
|
|
1022
|
-
return (r = (o =
|
|
1090
|
+
return (r = (o = z.tips).warning) == null ? void 0 : r.call(o, ...e);
|
|
1023
1091
|
};
|
|
1024
|
-
return new
|
|
1092
|
+
return new _(this.resolve, t);
|
|
1025
1093
|
}
|
|
1026
|
-
error(...
|
|
1027
|
-
const
|
|
1094
|
+
error(...e) {
|
|
1095
|
+
const t = () => {
|
|
1028
1096
|
var o, r;
|
|
1029
|
-
return (r = (o =
|
|
1097
|
+
return (r = (o = z.tips).error) == null ? void 0 : r.call(o, ...e);
|
|
1030
1098
|
};
|
|
1031
|
-
return new
|
|
1099
|
+
return new _(this.resolve, t);
|
|
1032
1100
|
}
|
|
1033
1101
|
}
|
|
1034
|
-
class
|
|
1035
|
-
constructor(
|
|
1036
|
-
super(), this.reject =
|
|
1102
|
+
class mt extends _ {
|
|
1103
|
+
constructor(e) {
|
|
1104
|
+
super(), this.reject = e;
|
|
1037
1105
|
}
|
|
1038
|
-
info(...
|
|
1039
|
-
const
|
|
1106
|
+
info(...e) {
|
|
1107
|
+
const t = () => {
|
|
1040
1108
|
var o, r;
|
|
1041
|
-
return (r = (o =
|
|
1109
|
+
return (r = (o = z.tips).info) == null ? void 0 : r.call(o, ...e);
|
|
1042
1110
|
};
|
|
1043
|
-
return new
|
|
1111
|
+
return new _(t, this.reject);
|
|
1044
1112
|
}
|
|
1045
|
-
success(...
|
|
1046
|
-
const
|
|
1113
|
+
success(...e) {
|
|
1114
|
+
const t = () => {
|
|
1047
1115
|
var o, r;
|
|
1048
|
-
return (r = (o =
|
|
1116
|
+
return (r = (o = z.tips).success) == null ? void 0 : r.call(o, ...e);
|
|
1049
1117
|
};
|
|
1050
|
-
return new
|
|
1118
|
+
return new _(t, this.reject);
|
|
1051
1119
|
}
|
|
1052
1120
|
}
|
|
1053
1121
|
const h = class h {
|
|
@@ -1059,27 +1127,27 @@ const h = class h {
|
|
|
1059
1127
|
if (new.target === h)
|
|
1060
1128
|
throw new Error("请直接使用静态方法,而不是实例化此类");
|
|
1061
1129
|
}
|
|
1062
|
-
static register(
|
|
1063
|
-
if (typeof
|
|
1130
|
+
static register(e, t) {
|
|
1131
|
+
if (typeof t != "function")
|
|
1064
1132
|
return console.error("TipHandler must be a function");
|
|
1065
|
-
h.tips[
|
|
1133
|
+
h.tips[e] = t;
|
|
1066
1134
|
}
|
|
1067
|
-
static resolveTip(
|
|
1068
|
-
return function(...
|
|
1135
|
+
static resolveTip(e) {
|
|
1136
|
+
return function(...t) {
|
|
1069
1137
|
const o = () => {
|
|
1070
1138
|
var r, i;
|
|
1071
|
-
return (i = (r = h.tips)[
|
|
1139
|
+
return (i = (r = h.tips)[e]) == null ? void 0 : i.call(r, ...t);
|
|
1072
1140
|
};
|
|
1073
|
-
return new
|
|
1141
|
+
return new ut(o);
|
|
1074
1142
|
};
|
|
1075
1143
|
}
|
|
1076
|
-
static rejectTip(
|
|
1077
|
-
return function(...
|
|
1144
|
+
static rejectTip(e) {
|
|
1145
|
+
return function(...t) {
|
|
1078
1146
|
const o = () => {
|
|
1079
1147
|
var r, i;
|
|
1080
|
-
return (i = (r = h.tips)[
|
|
1148
|
+
return (i = (r = h.tips)[e]) == null ? void 0 : i.call(r, ...t);
|
|
1081
1149
|
};
|
|
1082
|
-
return new
|
|
1150
|
+
return new mt(o);
|
|
1083
1151
|
};
|
|
1084
1152
|
}
|
|
1085
1153
|
};
|
|
@@ -1089,54 +1157,63 @@ y(h, "tips", {
|
|
|
1089
1157
|
warning: void 0,
|
|
1090
1158
|
error: void 0
|
|
1091
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"));
|
|
1092
|
-
let
|
|
1160
|
+
let z = h;
|
|
1093
1161
|
export {
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
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
|
|
1142
1219
|
};
|