nhanh-pure-function 1.4.0 → 2.0.0

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.
@@ -0,0 +1,911 @@
1
+ var W = Object.defineProperty;
2
+ var q = (n) => {
3
+ throw TypeError(n);
4
+ };
5
+ var G = (n, e, t) => e in n ? W(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var A = (n, e, t) => G(n, typeof e != "symbol" ? e + "" : e, t), Y = (n, e, t) => e.has(n) || q("Cannot " + t);
7
+ var s = (n, e, t) => (Y(n, e, "read from private field"), t ? t.call(n) : e.get(n)), d = (n, e, t) => e.has(n) ? q("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), l = (n, e, t, o) => (Y(n, e, "write to private field"), o ? o.call(n, t) : e.set(n, t), t);
8
+ const V = {
9
+ /* 常见扩展名映射 */
10
+ ".mp3": "audio/mpeg",
11
+ ".mp4": "video/mp4",
12
+ ".m4a": "audio/mp4",
13
+ ".aac": "audio/aac",
14
+ ".ogg": "audio/ogg",
15
+ ".wav": "audio/wav",
16
+ ".flac": "audio/flac",
17
+ ".opus": "audio/opus",
18
+ ".webm": "video/webm",
19
+ ".avi": "video/x-msvideo",
20
+ ".mov": "video/quicktime",
21
+ ".wmv": "video/x-ms-wmv",
22
+ ".png": "image/png",
23
+ ".jpg": "image/jpeg",
24
+ ".jpeg": "image/jpeg",
25
+ ".gif": "image/gif",
26
+ ".bmp": "image/bmp",
27
+ ".tiff": "image/tiff",
28
+ ".ico": "image/vnd.microsoft.icon",
29
+ ".svg": "image/svg+xml",
30
+ ".webp": "image/webp",
31
+ ".heif": "image/heif",
32
+ ".heic": "image/heic",
33
+ ".json": "application/json",
34
+ ".xml": "application/xml",
35
+ ".html": "text/html",
36
+ ".htm": "text/html",
37
+ ".css": "text/css",
38
+ ".js": "application/javascript",
39
+ ".ts": "application/typescript",
40
+ ".csv": "text/csv",
41
+ ".tsv": "text/tab-separated-values",
42
+ ".txt": "text/plain",
43
+ ".md": "text/markdown",
44
+ ".rtf": "application/rtf",
45
+ ".pdf": "application/pdf",
46
+ ".zip": "application/zip",
47
+ ".rar": "application/x-rar-compressed",
48
+ ".tar": "application/x-tar",
49
+ ".gz": "application/gzip",
50
+ ".7z": "application/x-7z-compressed",
51
+ ".exe": "application/x-msdownload",
52
+ ".apk": "application/vnd.android.package-archive",
53
+ ".doc": "application/msword",
54
+ ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
55
+ ".xls": "application/vnd.ms-excel",
56
+ ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
57
+ ".ppt": "application/vnd.ms-powerpoint",
58
+ ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
59
+ ".odt": "application/vnd.oasis.opendocument.text",
60
+ ".ods": "application/vnd.oasis.opendocument.spreadsheet",
61
+ ".odp": "application/vnd.oasis.opendocument.presentation",
62
+ ".jsonld": "application/ld+json",
63
+ ".yaml": "application/x-yaml",
64
+ ".yml": "application/x-yaml",
65
+ ".woff": "font/woff",
66
+ ".woff2": "font/woff2",
67
+ ".ttf": "font/ttf",
68
+ ".otf": "font/otf",
69
+ ".eot": "application/vnd.ms-fontobject",
70
+ ".map": "application/json"
71
+ // 可根据需要继续扩展
72
+ }, I = {
73
+ image: [
74
+ ".jpg",
75
+ ".jpeg",
76
+ ".png",
77
+ ".gif",
78
+ ".bmp",
79
+ ".webp",
80
+ ".tiff",
81
+ ".svg",
82
+ ".heif",
83
+ ".heic",
84
+ ".ico",
85
+ ".raw",
86
+ ".jfif",
87
+ ".avif",
88
+ ".png8",
89
+ ".indd",
90
+ ".eps",
91
+ ".ai"
92
+ ],
93
+ ppt: [".ppt", ".pptx", ".odp"],
94
+ word: [".doc", ".docx", ".odt", ".rtf"],
95
+ excel: [".xls", ".xlsx", ".ods", ".csv", ".tsv"],
96
+ pdf: [".pdf"],
97
+ text: [
98
+ ".txt",
99
+ ".csv",
100
+ ".md",
101
+ ".json",
102
+ ".yaml",
103
+ ".yml",
104
+ ".log",
105
+ ".ini",
106
+ ".rtf"
107
+ ],
108
+ audio: [
109
+ ".mp3",
110
+ ".wav",
111
+ ".ogg",
112
+ ".flac",
113
+ ".aac",
114
+ ".wma",
115
+ ".m4a",
116
+ ".alac",
117
+ ".ape",
118
+ ".opus",
119
+ ".amr",
120
+ ".ra",
121
+ ".mid",
122
+ ".midi",
123
+ ".aiff",
124
+ ".pcm",
125
+ ".au",
126
+ ".wavpack",
127
+ ".spx"
128
+ ],
129
+ video: [
130
+ ".mp4",
131
+ ".avi",
132
+ ".mkv",
133
+ ".mov",
134
+ ".wmv",
135
+ ".flv",
136
+ ".webm",
137
+ ".mpg",
138
+ ".mpeg",
139
+ ".3gp",
140
+ ".vob",
141
+ ".ogv",
142
+ ".m4v",
143
+ ".ts",
144
+ ".rm",
145
+ ".rmvb",
146
+ ".m2ts",
147
+ ".divx",
148
+ ".xvid",
149
+ ".swf",
150
+ ".f4v"
151
+ ],
152
+ archive: [
153
+ ".zip",
154
+ ".rar",
155
+ ".tar",
156
+ ".gz",
157
+ ".bz2",
158
+ ".xz",
159
+ ".7z",
160
+ ".tar.gz",
161
+ ".tar.bz2",
162
+ ".tar.xz",
163
+ ".tar.lz",
164
+ ".tar.lzma",
165
+ ".cab",
166
+ ".iso",
167
+ ".dmg",
168
+ ".tgz",
169
+ ".apk",
170
+ ".gz2",
171
+ ".tar.zst"
172
+ ],
173
+ code: [
174
+ ".js",
175
+ ".ts",
176
+ ".py",
177
+ ".java",
178
+ ".cpp",
179
+ ".c",
180
+ ".html",
181
+ ".css",
182
+ ".scss",
183
+ ".less",
184
+ ".sass",
185
+ ".php",
186
+ ".rb",
187
+ ".go",
188
+ ".swift",
189
+ ".rs",
190
+ ".kt",
191
+ ".scala",
192
+ ".lua",
193
+ ".pl",
194
+ ".m",
195
+ ".h",
196
+ ".xml",
197
+ ".json",
198
+ ".yaml",
199
+ ".yml",
200
+ ".toml",
201
+ ".vue",
202
+ ".ejs",
203
+ ".handlebars",
204
+ ".jinja",
205
+ ".dart"
206
+ ],
207
+ font: [
208
+ ".woff",
209
+ ".woff2",
210
+ ".ttf",
211
+ ".otf",
212
+ ".eot",
213
+ ".svg",
214
+ ".ttc",
215
+ ".fnt",
216
+ ".fon",
217
+ ".otc"
218
+ ],
219
+ database: [
220
+ ".sql",
221
+ ".sqlite",
222
+ ".db",
223
+ ".mdb",
224
+ ".accdb",
225
+ ".jsonld",
226
+ ".xml",
227
+ ".csv"
228
+ ],
229
+ markup: [".html", ".htm", ".xhtml", ".xml", ".json", ".yaml", ".yml"],
230
+ configuration: [
231
+ ".ini",
232
+ ".conf",
233
+ ".cfg",
234
+ ".env",
235
+ ".properties",
236
+ ".json",
237
+ ".toml"
238
+ ],
239
+ logs: [".log", ".err", ".trace", ".out"],
240
+ script: [
241
+ ".bash",
242
+ ".sh",
243
+ ".zsh",
244
+ ".bat",
245
+ ".ps1",
246
+ ".vbs",
247
+ ".cmd",
248
+ ".sed",
249
+ ".awk",
250
+ ".php"
251
+ ]
252
+ }, $ = [
253
+ "",
254
+ "万",
255
+ "亿",
256
+ "兆",
257
+ "京",
258
+ "垓",
259
+ "秭",
260
+ "穰",
261
+ "沟",
262
+ "涧",
263
+ "正",
264
+ "载",
265
+ "极"
266
+ ];
267
+ function et(n) {
268
+ return n != null;
269
+ }
270
+ function nt(n) {
271
+ return !(n === null || typeof n != "object" || Array.isArray(n));
272
+ }
273
+ function ot(n) {
274
+ if (typeof n != "function")
275
+ return console.error("非函数:", n);
276
+ const e = function(t) {
277
+ t.didTimeout || t.timeRemaining() <= 0 ? requestIdleCallback(e) : n();
278
+ };
279
+ requestIdleCallback(e);
280
+ }
281
+ function it(n, e) {
282
+ const t = +/* @__PURE__ */ new Date();
283
+ return new Promise((o, i) => {
284
+ const r = () => {
285
+ if (+/* @__PURE__ */ new Date() - t >= e) return i("超时");
286
+ if (n()) return o("完成");
287
+ requestIdleCallback(r);
288
+ };
289
+ r();
290
+ });
291
+ }
292
+ function rt(n, e, t = ",") {
293
+ const o = new RegExp(
294
+ `(^|${t})${e}(${t}|$)`,
295
+ "g"
296
+ );
297
+ return n.replace(o, function(i, r, c) {
298
+ return r === c ? t : "";
299
+ });
300
+ }
301
+ function st(n) {
302
+ return n.charAt(0).toUpperCase() + n.slice(1);
303
+ }
304
+ function O(n, e, t = [], o = +/* @__PURE__ */ new Date()) {
305
+ if (o < +/* @__PURE__ */ new Date() - 300) {
306
+ console.error("_MergeObjects 合并异常:疑似死循环");
307
+ return;
308
+ }
309
+ const i = (a) => Array.isArray(a) ? "array" : typeof a, r = i(n), c = i(e);
310
+ if (r != c) return e;
311
+ if (r == "object" || r == "array") {
312
+ if (t.some(([a, m]) => a == n && m == e)) return n;
313
+ if (t.push([n, e]), r == "object") {
314
+ for (const a in e)
315
+ if (Object.prototype.hasOwnProperty.call(e, a)) {
316
+ const m = e[a], u = n[a], f = O(u, m, t, o);
317
+ n[a] = f;
318
+ }
319
+ return n;
320
+ } else if (r == "array")
321
+ return e.forEach((a, m) => {
322
+ const u = a, f = n[m], p = O(f, u, t, o);
323
+ n[m] = p;
324
+ }), n;
325
+ } else return e;
326
+ }
327
+ function ct(n, e = "YYYY-MM-DD hh:mm:ss", t = !0) {
328
+ const o = new Date(n);
329
+ if (isNaN(o.getTime()))
330
+ return console.error("Invalid date"), "";
331
+ const i = {
332
+ YYYY: (r) => r.getFullYear(),
333
+ MM: (r) => r.getMonth() + 1,
334
+ // Adjust for 0-based month
335
+ DD: (r) => r.getDate(),
336
+ hh: (r) => r.getHours(),
337
+ mm: (r) => r.getMinutes(),
338
+ ss: (r) => r.getSeconds(),
339
+ ms: (r) => r.getMilliseconds()
340
+ };
341
+ return e.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (r) => {
342
+ const c = i[r](o);
343
+ return t ? String(c).padStart(2, "0") : String(c);
344
+ });
345
+ }
346
+ function at(n) {
347
+ return new Promise((e, t) => {
348
+ fetch(n).then((o) => e(o.text())).catch((o) => {
349
+ console.error("Error fetching :", o), t(o);
350
+ });
351
+ });
352
+ }
353
+ function N(n, e = "file") {
354
+ if (!n || (n = String(n).trim(), n === "")) return e;
355
+ const t = n.split("/");
356
+ return t[t.length - 1].split("?")[0];
357
+ }
358
+ function lt(n, e) {
359
+ return new Promise((t, o) => {
360
+ try {
361
+ e = e || N(n, "downloaded_file"), fetch(n).then((i) => (i.ok || o(`文件下载失败,状态码: ${i.status}`), i.blob())).then((i) => {
362
+ const r = URL.createObjectURL(i), c = document.createElement("a");
363
+ c.href = r, c.download = decodeURIComponent(e), document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(r), t(i);
364
+ }).catch(o);
365
+ } catch (i) {
366
+ o(i);
367
+ }
368
+ });
369
+ }
370
+ function ut(n, e = 10) {
371
+ let t = 0, o = e;
372
+ function i() {
373
+ if (o > 0)
374
+ o--, requestAnimationFrame(i);
375
+ else {
376
+ const c = (+/* @__PURE__ */ new Date() - t) / e, a = 1e3 / c;
377
+ n(Number(a.toFixed(2)), Number(c.toFixed(2)));
378
+ }
379
+ }
380
+ requestAnimationFrame(() => {
381
+ t = +/* @__PURE__ */ new Date(), i();
382
+ });
383
+ }
384
+ function mt(n, e) {
385
+ return n = n.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()), e ? n.replace(/[^a-zA-Z]+/g, "") : n;
386
+ }
387
+ function dt(n, e, t) {
388
+ if (!t) {
389
+ let c = e.replace(/^[^.]+./, "");
390
+ c = c == e ? "text/plain" : "application/" + c, t = { type: c };
391
+ }
392
+ const o = new Blob(n, t), i = URL.createObjectURL(o), r = document.createElement("a");
393
+ r.href = i, r.download = e, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(i);
394
+ }
395
+ function ft(n) {
396
+ const e = n.split("?")[1] || "", t = new URLSearchParams(e), o = {};
397
+ return t.forEach((i, r) => {
398
+ o[r] = i;
399
+ }), o;
400
+ }
401
+ function pt(n = "") {
402
+ return n + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
403
+ const t = Math.random() * 16 | 0;
404
+ return (e === "x" ? t : t & 3 | 8).toString(16);
405
+ });
406
+ }
407
+ function Z(n, e) {
408
+ let t;
409
+ return function(...o) {
410
+ clearTimeout(t), t = setTimeout(() => {
411
+ n(...o), t = void 0;
412
+ }, e);
413
+ };
414
+ }
415
+ function ht(n, e) {
416
+ let t = -1 / 0;
417
+ return function(...o) {
418
+ const i = performance.now();
419
+ if (i - t > e) {
420
+ t = i;
421
+ try {
422
+ n(...o);
423
+ } catch (r) {
424
+ console.error("Throttled function execution failed:", r);
425
+ }
426
+ }
427
+ };
428
+ }
429
+ function gt(n) {
430
+ return Array.isArray(n) ? "array" : n === null ? "null" : typeof n;
431
+ }
432
+ function xt(n) {
433
+ const e = () => Promise.resolve(), t = (a) => (console.error(a), Promise.reject(a));
434
+ function o() {
435
+ return navigator.clipboard.writeText(n).then(e).catch(t);
436
+ }
437
+ function i() {
438
+ const a = document.createElement("div");
439
+ a.innerText = n, document.body.appendChild(a);
440
+ const m = document.createRange();
441
+ m.selectNodeContents(a);
442
+ const u = window.getSelection();
443
+ let f = !1;
444
+ return u && (u.removeAllRanges(), u.addRange(m), f = document.execCommand("copy")), document.body.removeChild(a), f ? Promise.resolve() : Promise.reject();
445
+ }
446
+ function r() {
447
+ const a = document.createElement("textarea");
448
+ a.value = n, document.body.appendChild(a), a.select(), a.setSelectionRange(0, n.length);
449
+ let m = !1;
450
+ return document.activeElement === a && (m = document.execCommand("Copy", !0)), document.body.removeChild(a), m ? Promise.resolve() : Promise.reject();
451
+ }
452
+ function c() {
453
+ return i().then(e).catch(() => {
454
+ r().then(e).catch(() => t("复制方式尽皆失效"));
455
+ });
456
+ }
457
+ return navigator.clipboard ? o().catch(c) : c();
458
+ }
459
+ function bt(n, e) {
460
+ const t = e.split(".");
461
+ return t.reduce((o, i, r) => (i in o || (r === t.length - 1 ? o[i] = void 0 : o[i] = {}), o[i]), n);
462
+ }
463
+ function vt(n, e) {
464
+ const t = e.split(".");
465
+ return t.reduce((o, i, r) => o.hasOwnProperty(i) ? o[i] : o[i] = r == t.length - 1 ? void 0 : {}, n);
466
+ }
467
+ function wt(n, e, t) {
468
+ const o = e.split(".");
469
+ return o.reduce((i, r, c) => (c === o.length - 1 && (i[r] = t), i[r]), n);
470
+ }
471
+ function yt(n) {
472
+ return new Promise((e, t) => {
473
+ if (typeof n != "string" || n.trim() === "" || !n.includes("://")) {
474
+ t(new Error("Invalid URL: Must be a non-empty string"));
475
+ return;
476
+ }
477
+ try {
478
+ new XMLHttpRequest().open("HEAD", n, !0);
479
+ } catch (r) {
480
+ t(new Error(`Invalid URL format: ${r.message}`));
481
+ return;
482
+ }
483
+ const o = new XMLHttpRequest();
484
+ o.open("HEAD", n, !0);
485
+ const i = (r) => {
486
+ t(new Error(`Request failed: ${r.type}`));
487
+ };
488
+ o.onreadystatechange = function() {
489
+ 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}`)));
490
+ }, o.onerror = i, o.onabort = i, o.ontimeout = i;
491
+ try {
492
+ o.send();
493
+ } catch (r) {
494
+ t(new Error(`Request send failed: ${r.message}`));
495
+ }
496
+ });
497
+ }
498
+ function Et(n) {
499
+ return [
500
+ "https:",
501
+ // HTTPS协议,用于安全地浏览网页
502
+ "wss:",
503
+ // WebSocket Secure协议,用于安全的WebSocket通信
504
+ "ftps:",
505
+ // FTP Secure协议,用于安全的文件传输
506
+ "sftp:",
507
+ // SSH File Transfer Protocol,通过SSH安全地传输文件
508
+ "smpts:",
509
+ // Secure SMTP协议,用于安全地发送邮件
510
+ "smtp+tls:",
511
+ // SMTP协议结合STARTTLS扩展,用于升级到安全连接
512
+ "imap+tls:",
513
+ // IMAP协议结合STARTTLS扩展,用于安全地访问邮件
514
+ "pop3+tls:",
515
+ // POP3协议结合STARTTLS扩展,用于安全地接收邮件
516
+ "rdp:",
517
+ // Remote Desktop Protocol,用于安全的远程桌面连接
518
+ "vpn:"
519
+ // VPN协议,用于创建安全的网络连接
520
+ ].some((t) => n.startsWith(t));
521
+ }
522
+ const C = class C {
523
+ static check(e, t) {
524
+ if (!e || typeof e != "string")
525
+ return console.error("Invalid URL provided"), t ? !1 : "unknown";
526
+ const o = N(e).toLowerCase();
527
+ if (t) {
528
+ if (!I.hasOwnProperty(t))
529
+ return console.error(`Unknown file type: ${t}`), "unknown";
530
+ const i = I[t];
531
+ return C._checkExtension(o, i);
532
+ }
533
+ return C._detectFileType(o);
534
+ }
535
+ /**
536
+ * 静态方法,用于解析地址信息
537
+ * 该方法接受一个URL字符串,将其解析为一个包含地址详情的对象数组
538
+ * 主要用于批量处理以逗号分隔的URL列表,为每个URL生成相应的名称和类型
539
+ *
540
+ * @param {string} url - 以逗号分隔的URL字符串,每个URL代表一个资源的位置
541
+ * @returns {Array} - 包含每个URL及其相关信息(名称和类型)的对象数组
542
+ */
543
+ static parseAddresses(e) {
544
+ return !e || typeof e != "string" ? (console.error("Invalid URL provided"), []) : e.split(",").map((t) => {
545
+ const o = N(t), i = this.check(t);
546
+ return { url: t, name: o, type: i };
547
+ });
548
+ }
549
+ /**
550
+ * 检查 MIME 类型是否与指定的模式匹配
551
+ * @param {string} type - 要检查的 MIME 类型(如 "image/png")
552
+ * @param {string} [accept] - 可接受的 MIME 类型模式(如 "image/*, text/plain")
553
+ * @returns {boolean} - 如果类型匹配,则返回 true,否则返回 false
554
+ */
555
+ static matchesMimeType(e, t) {
556
+ if (!t) return !0;
557
+ if (typeof e != "string" || typeof t != "string") return !1;
558
+ const o = C._normalizeType(e), i = t.split(",").map((a) => C._normalizeType(a.trim())), [r, c = "*"] = o.split("/");
559
+ return i.some((a) => {
560
+ const [m, u = "*"] = a.split("/");
561
+ return (m === "*" || r === "*" || m === r) && (u === "*" || c === "*" || u === c);
562
+ });
563
+ }
564
+ /**
565
+ * 类型标准化函数
566
+ * 该函数旨在将文件类型或MIME类型字符串转换为标准格式
567
+ * 主要处理三种情况:带扩展名的字符串、简写格式的类型以及已标准格式的类型
568
+ *
569
+ * @param {string} type - 文件类型或MIME类型字符串
570
+ * @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
571
+ */
572
+ static _normalizeType(e) {
573
+ return e.startsWith(".") && !e.includes("/") ? V[e.toLowerCase()] || e : e.includes("/") ? e : `${e}/*`;
574
+ }
575
+ /**
576
+ * 检查URL是否具有任何指定的文件扩展名
577
+ * @param {string} url - 文件的URL
578
+ * @param {string[]} validExtensions - 有效文件扩展名的数组
579
+ * @returns {boolean} - 如果URL具有任何指定的文件扩展名,则返回true,否则返回false
580
+ */
581
+ static _checkExtension(e, t) {
582
+ return t.some((o) => e.endsWith(o));
583
+ }
584
+ /**
585
+ * 检测文件URL的类型
586
+ * @param {string} url - 文件的URL
587
+ * @returns {string} - 如果URL与任何已知类型匹配,则返回文件类型,否则返回"unknown"
588
+ */
589
+ static _detectFileType(e) {
590
+ for (const [t, o] of C.cachedEntries)
591
+ if (o.some((i) => e.endsWith(i)))
592
+ return t;
593
+ return "unknown";
594
+ }
595
+ };
596
+ // 缓存文件扩展名的条目,以提高性能
597
+ A(C, "cachedEntries", Object.entries(I));
598
+ let H = C;
599
+ function Ct(n) {
600
+ return n.map((e, t) => n.slice(t).concat(n.slice(0, t)));
601
+ }
602
+ function _t(n) {
603
+ const e = window.structuredClone, t = (o) => o === null || typeof o != "object" ? o : O(Array.isArray(o) ? [] : {}, o);
604
+ try {
605
+ return e ? e(n) : t(n);
606
+ } catch (o) {
607
+ return console.error("structuredClone error:", o), e && t(n);
608
+ }
609
+ }
610
+ function Ft(n) {
611
+ const e = Z(n, 100);
612
+ let t = 0, o = 0;
613
+ return function(i) {
614
+ const r = i.target;
615
+ if (!r || !(r instanceof HTMLElement)) return;
616
+ const {
617
+ scrollTop: c,
618
+ scrollHeight: a,
619
+ clientHeight: m,
620
+ scrollLeft: u,
621
+ scrollWidth: f,
622
+ clientWidth: p
623
+ } = r;
624
+ function S() {
625
+ if (t == c) return;
626
+ const U = t > c;
627
+ if (t = c, U) return;
628
+ a - c - m <= 1 && e("vertical");
629
+ }
630
+ function X() {
631
+ if (o == u) return;
632
+ const U = o > u;
633
+ if (o = u, U) return;
634
+ f - u - p <= 1 && e("horizontal");
635
+ }
636
+ S(), X();
637
+ };
638
+ }
639
+ function Mt(n, e, t) {
640
+ const { isClickAllowed: o, uiLibrary: i = ["naiveUI", "ElementPlus", "Element"] } = t || {}, r = function(m) {
641
+ const u = [];
642
+ for (const f in m)
643
+ Object.hasOwnProperty.call(m, f) && i.includes(f) && u.push(...m[f]);
644
+ return u;
645
+ }({
646
+ naiveUI: [
647
+ ".v-binder-follower-container",
648
+ ".n-image-preview-container",
649
+ ".n-modal-container"
650
+ ],
651
+ ElementPlus: [".el-popper"],
652
+ Element: [".el-popper"]
653
+ });
654
+ function c() {
655
+ e(), document.removeEventListener("mousedown", a);
656
+ }
657
+ function a(m) {
658
+ if (o) {
659
+ const p = o(m);
660
+ if (p) return;
661
+ if (p === !1) return c();
662
+ }
663
+ const u = m.target;
664
+ if (!(u instanceof HTMLElement) || !(u != null && u.closest("body"))) return;
665
+ n.concat(r).some((p) => !!(u != null && u.closest(p))) || c();
666
+ }
667
+ requestAnimationFrame(
668
+ () => document.addEventListener("mousedown", a)
669
+ );
670
+ }
671
+ var g, _, F, R, P, w, y, E, T;
672
+ class Lt {
673
+ constructor() {
674
+ d(this, g);
675
+ d(this, _, !1);
676
+ d(this, F, {});
677
+ d(this, R, 0);
678
+ d(this, P, 0);
679
+ d(this, w, 0);
680
+ d(this, y, 0);
681
+ d(this, E);
682
+ d(this, T);
683
+ }
684
+ init(e, t) {
685
+ l(this, g, e), l(this, E, t == null ? void 0 : t.limit), l(this, T, t == null ? void 0 : t.dragDom), l(this, F, {
686
+ mousedown: this.mousedown.bind(this),
687
+ mousemove: this.mousemove.bind(this),
688
+ mouseup: this.mouseup.bind(this)
689
+ }), this.bindOrUnbindEvent("bind");
690
+ }
691
+ finish() {
692
+ this.bindOrUnbindEvent("unbind");
693
+ }
694
+ bindOrUnbindEvent(e) {
695
+ const t = e === "bind" ? "addEventListener" : "removeEventListener";
696
+ if (!s(this, g)) return console.error("No DOM");
697
+ s(this, g)[t]("mousedown", s(this, F).mousedown), document[t]("mousemove", s(this, F).mousemove), document[t]("mouseup", s(this, F).mouseup);
698
+ }
699
+ alterLocation() {
700
+ if (!s(this, g)) return console.error("No DOM");
701
+ s(this, E) && (l(this, w, Math.min(s(this, w), s(this, E).max.top)), l(this, w, Math.max(s(this, w), s(this, E).min.top)), l(this, y, Math.min(s(this, y), s(this, E).max.left)), l(this, y, Math.max(s(this, y), s(this, E).min.left))), s(this, g).style.setProperty("--top", s(this, w) + "px"), s(this, g).style.setProperty("--left", s(this, y) + "px");
702
+ }
703
+ mousedown(e) {
704
+ if (!s(this, g)) return console.error("No DOM");
705
+ if (s(this, T) && e.target != s(this, T)) return;
706
+ document.body.classList.add("no-select"), l(this, _, !0);
707
+ const t = s(this, g).getBoundingClientRect(), { pageX: o, pageY: i } = e;
708
+ l(this, R, o), l(this, P, i), l(this, w, t.y), l(this, y, t.x);
709
+ }
710
+ mousemove(e) {
711
+ const { pageX: t, pageY: o } = e;
712
+ s(this, _) && (l(this, w, s(this, w) + (o - s(this, P))), l(this, y, s(this, y) + (t - s(this, R))), l(this, R, t), l(this, P, o), this.alterLocation());
713
+ }
714
+ mouseup() {
715
+ s(this, _) && (l(this, _, !1), document.body.classList.remove("no-select"));
716
+ }
717
+ }
718
+ g = new WeakMap(), _ = new WeakMap(), F = new WeakMap(), R = new WeakMap(), P = new WeakMap(), w = new WeakMap(), y = new WeakMap(), E = new WeakMap(), T = new WeakMap();
719
+ var x, M, L, k, j, b, v, h, z, D;
720
+ class Rt {
721
+ constructor() {
722
+ d(this, x);
723
+ d(this, M, !1);
724
+ d(this, L, {});
725
+ d(this, k, 0);
726
+ d(this, j, 0);
727
+ d(this, b, 0);
728
+ d(this, v, 0);
729
+ d(this, h);
730
+ d(this, z);
731
+ d(this, D);
732
+ }
733
+ init(e, t = {}) {
734
+ l(this, x, e), l(this, h, t.limit), l(this, z, t.update_move), l(this, D, t.update_up), l(this, L, {
735
+ mousedown: this.mousedown.bind(this),
736
+ mousemove: this.mousemove.bind(this),
737
+ mouseup: this.mouseup.bind(this)
738
+ }), this.bindOrUnbindEvent("bind");
739
+ }
740
+ finish() {
741
+ this.bindOrUnbindEvent("unbind");
742
+ }
743
+ bindOrUnbindEvent(e) {
744
+ const t = e === "bind" ? "addEventListener" : "removeEventListener";
745
+ if (!s(this, x)) return console.error("No DOM");
746
+ s(this, x)[t]("mousedown", s(this, L).mousedown), document[t]("mousemove", s(this, L).mousemove), document[t]("mouseup", s(this, L).mouseup);
747
+ }
748
+ updateValue() {
749
+ const e = {
750
+ top: s(this, b),
751
+ left: s(this, v),
752
+ percentage: { top: 0, left: 0 }
753
+ };
754
+ if (s(this, h)) {
755
+ const t = (o) => s(this, h) ? (e[o] - s(this, h).min[o]) / (s(this, h).max[o] - s(this, h).min[o]) : 0;
756
+ e.percentage = {
757
+ top: t("top") || 0,
758
+ left: t("left") || 0
759
+ };
760
+ }
761
+ return e;
762
+ }
763
+ alterLocation() {
764
+ if (!s(this, x)) return console.error("No DOM");
765
+ s(this, h) && (l(this, b, Math.min(s(this, b), s(this, h).max.top)), l(this, b, Math.max(s(this, b), s(this, h).min.top)), l(this, v, Math.min(s(this, v), s(this, h).max.left)), l(this, v, Math.max(s(this, v), s(this, h).min.left))), s(this, z) && s(this, z).call(this, this.updateValue()), s(this, x).style.setProperty("--top", s(this, b) + "px"), s(this, x).style.setProperty("--left", s(this, v) + "px");
766
+ }
767
+ mousedown(e) {
768
+ if (!s(this, x)) return console.error("No DOM");
769
+ document.body.classList.add("no-select"), l(this, M, !0);
770
+ const t = s(this, x).getBoundingClientRect();
771
+ l(this, j, t.y), l(this, k, t.x);
772
+ const { pageX: o, pageY: i } = e;
773
+ l(this, b, i - s(this, j)), l(this, v, o - s(this, k)), this.alterLocation();
774
+ }
775
+ mousemove(e) {
776
+ const { pageX: t, pageY: o } = e;
777
+ s(this, M) && (l(this, b, o - s(this, j)), l(this, v, t - s(this, k)), this.alterLocation());
778
+ }
779
+ mouseup() {
780
+ s(this, M) && (l(this, M, !1), document.body.classList.remove("no-select"), s(this, D) && s(this, D).call(this, this.updateValue()));
781
+ }
782
+ }
783
+ x = new WeakMap(), M = new WeakMap(), L = new WeakMap(), k = new WeakMap(), j = new WeakMap(), b = new WeakMap(), v = new WeakMap(), h = new WeakMap(), z = new WeakMap(), D = new WeakMap();
784
+ function K(n) {
785
+ const e = n;
786
+ if (n) {
787
+ if (n.requestFullscreen)
788
+ return n.requestFullscreen();
789
+ if (e.mozRequestFullScreen)
790
+ return e.mozRequestFullScreen();
791
+ if (e.webkitRequestFullscreen)
792
+ return e.webkitRequestFullscreen();
793
+ if (e.msRequestFullscreen)
794
+ return e.msRequestFullscreen();
795
+ } else return Promise.reject("No DOM");
796
+ return Promise.reject("No Fullscreen API");
797
+ }
798
+ function Q() {
799
+ const n = document;
800
+ return document.exitFullscreen ? document.exitFullscreen() : n.mozCancelFullScreen ? n.mozCancelFullScreen() : n.webkitExitFullscreen ? n.webkitExitFullscreen() : n.msExitFullscreen ? n.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
801
+ }
802
+ function J() {
803
+ const n = document;
804
+ return document.fullscreenElement || n.webkitFullscreenElement || n.mozFullScreenElement || n.msFullscreenElement;
805
+ }
806
+ function Pt(n) {
807
+ return function() {
808
+ J() ? Q() : K(n);
809
+ };
810
+ }
811
+ function Tt(n, e) {
812
+ if (typeof n == "number") return n;
813
+ if (/px/.test(n)) return Number(n.replace(/px/, "")) || 0;
814
+ const t = document.createElement("div");
815
+ t.style.width = n, e = e || document.body, e.appendChild(t);
816
+ const o = t.getBoundingClientRect().width;
817
+ return e.removeChild(t), o;
818
+ }
819
+ function kt(n, e, t = 2) {
820
+ 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) + "%";
821
+ }
822
+ function jt(n, e, t) {
823
+ return Math.abs(n - e) <= t;
824
+ }
825
+ function zt(n, e = 500) {
826
+ let t;
827
+ function o(i) {
828
+ t || (t = i);
829
+ let r = Math.min((i - t) / e, 1);
830
+ n(r), i - t < e && requestAnimationFrame(o);
831
+ }
832
+ requestAnimationFrame(o);
833
+ }
834
+ function Dt(n) {
835
+ return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
836
+ }
837
+ function St(n, e) {
838
+ const t = {
839
+ join: !0,
840
+ suffix: "",
841
+ decimalPlaces: 2
842
+ }, { join: o, suffix: i, decimalPlaces: r } = {
843
+ ...t,
844
+ ...e || {}
845
+ }, c = Number(n);
846
+ if (isNaN(c)) return o ? `0${i}` : [0, i];
847
+ const a = Math.abs(c), m = c >= 0, u = Math.max(0, Math.floor(Math.log10(a) / 4)), f = Math.pow(1e4, u), p = a / f, S = (m ? 1 : -1) * parseFloat(p.toFixed(Math.max(0, r)));
848
+ return o ? `${S}${$[u]}${i}` : [S, $[u] + i];
849
+ }
850
+ function Ut(n, e) {
851
+ let t = !1;
852
+ const { x: o, y: i } = n, r = e.length;
853
+ for (let c = 0, a = r - 1; c < r; a = c++) {
854
+ const m = e[c].x, u = e[c].y, f = e[a].x, p = e[a].y;
855
+ u > i != p > i && o < (f - m) * (i - u) / (p - u) + m && (t = !t);
856
+ }
857
+ return t;
858
+ }
859
+ function It(n) {
860
+ const e = ["B", "KB", "MB", "GB", "TB", "PB"];
861
+ let t = 0;
862
+ for (; n > 1024; )
863
+ n /= 1024, t++;
864
+ return `${Math.round(n * 100) / 100} ${e[t]}`;
865
+ }
866
+ export {
867
+ st as _CapitalizeFirstLetter,
868
+ yt as _CheckConnectionWithXHR,
869
+ _t as _Clone,
870
+ Mt as _CloseOnOutsideClick,
871
+ mt as _ConvertToCamelCase,
872
+ kt as _ConvertToPercentage,
873
+ xt as _CopyToClipboard,
874
+ dt as _CreateAndDownloadFile,
875
+ gt as _DataType,
876
+ Z as _Debounce,
877
+ lt as _DownloadFile,
878
+ Lt as _Drag,
879
+ K as _EnterFullscreen,
880
+ rt as _ExcludeSubstring,
881
+ ot as _ExecuteWhenIdle,
882
+ Q as _ExitFullscreen,
883
+ H as _FileTypeChecker,
884
+ It as _FormatFileSize,
885
+ Dt as _FormatNumber,
886
+ St as _FormatNumberWithUnit,
887
+ Pt as _Fullscreen,
888
+ pt as _GenerateUUID,
889
+ ut as _GetFrameRate,
890
+ N as _GetHrefName,
891
+ Tt as _GetOtherSizeInPixels,
892
+ ft as _GetQueryParams,
893
+ vt as _GetTargetByPath,
894
+ bt as _InitTargetByPath,
895
+ J as _IsFullscreen,
896
+ nt as _IsObject,
897
+ Ut as _IsPointInPolygon,
898
+ Et as _IsSecureContext,
899
+ jt as _IsWithinErrorMargin,
900
+ Rt as _LocalDrag,
901
+ O as _MergeObjects,
902
+ et as _NotNull,
903
+ at as _ReadFile,
904
+ Ct as _RotateList,
905
+ zt as _Schedule,
906
+ Ft as _ScrollEndListener,
907
+ ht as _Throttle,
908
+ ct as _TimeTransition,
909
+ wt as _UpdateTargetByPath,
910
+ it as _WaitForCondition
911
+ };