@singlebase/elements 0.3.0 → 0.6.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.
- package/README.md +2 -0
- package/dist/{display-8HEcKYR4.js → authui-display-CKfGK5va.js} +519 -502
- package/dist/authui-display-CKfGK5va.js.map +1 -0
- package/dist/{display-CLDNNZQy.cjs → authui-display-aWNht0cW.cjs} +38 -58
- package/dist/authui-display-aWNht0cW.cjs.map +1 -0
- package/dist/authui.cjs +1 -1
- package/dist/authui.d.ts +9 -9
- package/dist/authui.js +2 -2
- package/dist/chat-C-gsskho.cjs +3258 -0
- package/dist/chat-C-gsskho.cjs.map +1 -0
- package/dist/chat-CEh6RygY.js +5746 -0
- package/dist/chat-CEh6RygY.js.map +1 -0
- package/dist/chat-messages.d.ts +115 -0
- package/dist/chat.cjs +2 -0
- package/dist/chat.cjs.map +1 -0
- package/dist/chat.d.ts +11 -0
- package/dist/chat.js +15 -0
- package/dist/chat.js.map +1 -0
- package/dist/elements/{account-screen.d.ts → authui-account.d.ts} +1 -1
- package/dist/elements/{base.d.ts → authui-base.d.ts} +2 -0
- package/dist/elements/{buttons.d.ts → authui-buttons.d.ts} +2 -2
- package/dist/elements/{display.d.ts → authui-display.d.ts} +2 -2
- package/dist/elements/{form-base.d.ts → authui-form-base.d.ts} +1 -1
- package/dist/elements/{guard.d.ts → authui-guard.d.ts} +1 -1
- package/dist/elements/{auth-screen.d.ts → authui.d.ts} +8 -4
- package/dist/elements/chat.d.ts +455 -0
- package/dist/elements/uploader.d.ts +14 -0
- package/dist/files-DDJWPzZW.js +215 -0
- package/dist/files-DDJWPzZW.js.map +1 -0
- package/dist/files-DyxcjZsx.cjs +75 -0
- package/dist/files-DyxcjZsx.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +34 -21
- package/dist/index.js.map +1 -1
- package/dist/singlebase-elements.min.js +8044 -2120
- package/dist/singlebase-elements.min.js.map +1 -1
- package/dist/styles/branding.d.ts +5 -0
- package/dist/styles/chat.d.ts +6 -0
- package/dist/styles/tokens.d.ts +3 -1
- package/dist/{uploader-eFYKpk8b.cjs → uploader-660JIgIN.cjs} +55 -114
- package/dist/uploader-660JIgIN.cjs.map +1 -0
- package/dist/{uploader-D-Da1trc.js → uploader-vfczkX51.js} +376 -507
- package/dist/uploader-vfczkX51.js.map +1 -0
- package/dist/uploader.cjs +1 -1
- package/dist/uploader.js +5 -4
- package/dist/uploader.js.map +1 -1
- package/dist/utils/branding.d.ts +8 -0
- package/dist/utils/markdown.d.ts +165 -0
- package/dist/utils/svg.d.ts +10 -0
- package/package.json +13 -5
- package/dist/display-8HEcKYR4.js.map +0 -1
- package/dist/display-CLDNNZQy.cjs.map +0 -1
- package/dist/uploader-D-Da1trc.js.map +0 -1
- package/dist/uploader-eFYKpk8b.cjs.map +0 -1
|
@@ -1,72 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ge = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var d = (r, e, t) => (
|
|
6
|
-
import {
|
|
7
|
-
import { property as
|
|
8
|
-
import { getDefaultClient as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
mono: '"Geist Mono", ui-monospace, monospace',
|
|
12
|
-
accent: "#111111",
|
|
13
|
-
onAccent: "#ffffff",
|
|
14
|
-
radius: "4px",
|
|
15
|
-
surface: "#ffffff",
|
|
16
|
-
surfaceAlt: "#fafafa",
|
|
17
|
-
ink: "#16181a",
|
|
18
|
-
mutedInk: "#61666c",
|
|
19
|
-
border: "#e4e6e9",
|
|
20
|
-
borderStrong: "#cdd1d6",
|
|
21
|
-
danger: "#b4231a",
|
|
22
|
-
dangerBg: "#fdf1f0",
|
|
23
|
-
dangerBorder: "#f3d6d3",
|
|
24
|
-
dangerOutline: "#e8c4c0",
|
|
25
|
-
dangerPanelBorder: "#efd9d6",
|
|
26
|
-
dangerPanelBg: "#fdf7f6",
|
|
27
|
-
ok: "#0f6b4a",
|
|
28
|
-
okBg: "#f0f7f3",
|
|
29
|
-
okBorder: "#cfe5da",
|
|
30
|
-
gap: "16px",
|
|
31
|
-
pad: "20px",
|
|
32
|
-
fieldPad: "11px 13px"
|
|
33
|
-
}, Te = se`
|
|
34
|
-
:host {
|
|
35
|
-
display: block;
|
|
36
|
-
box-sizing: border-box;
|
|
37
|
-
font-family: var(--sb-font, ${ge(he.font)});
|
|
38
|
-
color: var(--sb-ink, ${ge(he.ink)});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
:host([theme="dark"]) {
|
|
42
|
-
/* The light default accent is near-black, which disappears on a dark
|
|
43
|
-
surface — primary buttons and links both use it. A host that sets its
|
|
44
|
-
own --sb-accent still wins: outer-page declarations beat :host rules. */
|
|
45
|
-
--sb-accent: #f3f4f5;
|
|
46
|
-
--sb-on-accent: #17181b;
|
|
47
|
-
--sb-surface: #17181b;
|
|
48
|
-
--sb-surface-alt: #202226;
|
|
49
|
-
--sb-ink: #f3f4f5;
|
|
50
|
-
--sb-muted-ink: #a2a8ae;
|
|
51
|
-
--sb-border: #2c2f34;
|
|
52
|
-
--sb-border-strong: #3a3e44;
|
|
53
|
-
--sb-danger: #f08379;
|
|
54
|
-
--sb-danger-bg: rgba(240, 131, 121, 0.1);
|
|
55
|
-
--sb-danger-border: rgba(240, 131, 121, 0.3);
|
|
56
|
-
--sb-danger-outline: rgba(240, 131, 121, 0.4);
|
|
57
|
-
--sb-danger-panel-border: rgba(240, 131, 121, 0.3);
|
|
58
|
-
--sb-danger-panel-bg: rgba(240, 131, 121, 0.06);
|
|
59
|
-
--sb-ok: #6fd1a6;
|
|
60
|
-
--sb-ok-bg: rgba(111, 209, 166, 0.1);
|
|
61
|
-
--sb-ok-border: rgba(111, 209, 166, 0.28);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
:host([density="compact"]) {
|
|
65
|
-
--sb-gap: 12px;
|
|
66
|
-
--sb-pad: 16px;
|
|
67
|
-
--sb-field-pad: 9px 11px;
|
|
68
|
-
}
|
|
69
|
-
`, Fe = se`
|
|
4
|
+
var he = (r, e, t) => e.has(r) || ge("Cannot " + t);
|
|
5
|
+
var d = (r, e, t) => (he(r, e, "read from private field"), t ? t.call(r) : e.get(r)), l = (r, e, t) => e.has(r) ? ge("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), c = (r, e, t, i) => (he(r, e, "write to private field"), i ? i.call(r, t) : e.set(r, t), t);
|
|
6
|
+
import { css as ye, LitElement as Me, nothing as x, html as u } from "lit";
|
|
7
|
+
import { property as b, state as te, customElement as Ce } from "lit/decorators.js";
|
|
8
|
+
import { getDefaultClient as Te } from "@singlebase/core";
|
|
9
|
+
import { t as je, b as Fe, r as Oe, f as de, a as v, c as De, p as le, e as ie, g as Ee, h as Le, i as Ae, j as Ne, k as Pe } from "./files-DDJWPzZW.js";
|
|
10
|
+
const Re = ye`
|
|
70
11
|
/* ── layout primitives ───────────────────────────────────── */
|
|
71
12
|
.stack {
|
|
72
13
|
display: flex;
|
|
@@ -190,7 +131,7 @@ const he = {
|
|
|
190
131
|
color: var(--sb-ink, #16181a);
|
|
191
132
|
background: var(--sb-surface-alt, #fafafa);
|
|
192
133
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
193
|
-
border-radius: var(--sb-radius, 4px);
|
|
134
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
194
135
|
padding: var(--sb-field-pad, 11px 13px);
|
|
195
136
|
outline: none;
|
|
196
137
|
}
|
|
@@ -260,7 +201,7 @@ const he = {
|
|
|
260
201
|
font: inherit;
|
|
261
202
|
font-size: 13.5px;
|
|
262
203
|
font-weight: 500;
|
|
263
|
-
border-radius: var(--sb-radius, 4px);
|
|
204
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
264
205
|
cursor: pointer;
|
|
265
206
|
padding: 9px 14px;
|
|
266
207
|
border: 1px solid transparent;
|
|
@@ -436,7 +377,7 @@ const he = {
|
|
|
436
377
|
.notice {
|
|
437
378
|
font-size: 13px;
|
|
438
379
|
line-height: 1.45;
|
|
439
|
-
border-radius: var(--sb-radius, 4px);
|
|
380
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
440
381
|
padding: 10px 12px;
|
|
441
382
|
}
|
|
442
383
|
|
|
@@ -554,7 +495,7 @@ const he = {
|
|
|
554
495
|
|
|
555
496
|
.acc-item {
|
|
556
497
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
557
|
-
border-radius: var(--sb-radius, 4px);
|
|
498
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
558
499
|
overflow: hidden;
|
|
559
500
|
background: transparent;
|
|
560
501
|
transition:
|
|
@@ -669,7 +610,7 @@ const he = {
|
|
|
669
610
|
padding: 10px 12px;
|
|
670
611
|
background: var(--sb-surface-alt, #fafafa);
|
|
671
612
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
672
|
-
border-radius: var(--sb-radius, 4px);
|
|
613
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
673
614
|
}
|
|
674
615
|
|
|
675
616
|
.invite-label {
|
|
@@ -836,7 +777,7 @@ const he = {
|
|
|
836
777
|
padding: 14px;
|
|
837
778
|
background: var(--sb-surface-alt, #fafafa);
|
|
838
779
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
839
|
-
border-radius: var(--sb-radius, 4px);
|
|
780
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
840
781
|
}
|
|
841
782
|
|
|
842
783
|
/* 2FA switch */
|
|
@@ -885,7 +826,7 @@ const he = {
|
|
|
885
826
|
flex: 0 0 auto;
|
|
886
827
|
width: 74px;
|
|
887
828
|
height: 74px;
|
|
888
|
-
border-radius: var(--sb-radius, 4px);
|
|
829
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
889
830
|
background: var(--sb-surface-alt, #fafafa);
|
|
890
831
|
border: 1px dashed var(--sb-border-strong, #cdd1d6);
|
|
891
832
|
display: flex;
|
|
@@ -917,7 +858,7 @@ const he = {
|
|
|
917
858
|
gap: 12px;
|
|
918
859
|
padding: 10px 12px;
|
|
919
860
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
920
|
-
border-radius: var(--sb-radius, 4px);
|
|
861
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
921
862
|
background: var(--sb-surface-alt, #fafafa);
|
|
922
863
|
}
|
|
923
864
|
|
|
@@ -981,7 +922,7 @@ const he = {
|
|
|
981
922
|
font: inherit;
|
|
982
923
|
text-align: left;
|
|
983
924
|
padding: 10px 11px;
|
|
984
|
-
border-radius: var(--sb-radius, 4px);
|
|
925
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
985
926
|
border: 1px dashed var(--sb-border-strong, #cdd1d6);
|
|
986
927
|
background: transparent;
|
|
987
928
|
cursor: pointer;
|
|
@@ -1033,7 +974,7 @@ const he = {
|
|
|
1033
974
|
gap: 12px;
|
|
1034
975
|
padding: 14px;
|
|
1035
976
|
border: 1px solid var(--sb-danger-panel-border, #efd9d6);
|
|
1036
|
-
border-radius: var(--sb-radius, 4px);
|
|
977
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
1037
978
|
background: var(--sb-danger-panel-bg, #fdf7f6);
|
|
1038
979
|
}
|
|
1039
980
|
|
|
@@ -1043,135 +984,44 @@ const he = {
|
|
|
1043
984
|
font-style: italic;
|
|
1044
985
|
}
|
|
1045
986
|
`;
|
|
1046
|
-
function
|
|
987
|
+
function Be(r, e, t) {
|
|
1047
988
|
if (!r || !e) return null;
|
|
1048
|
-
let
|
|
989
|
+
let i;
|
|
1049
990
|
try {
|
|
1050
|
-
|
|
991
|
+
i = new URL(e);
|
|
1051
992
|
} catch {
|
|
1052
993
|
return null;
|
|
1053
994
|
}
|
|
1054
995
|
let n;
|
|
1055
996
|
try {
|
|
1056
|
-
n = new URL(r,
|
|
997
|
+
n = new URL(r, i.href);
|
|
1057
998
|
} catch {
|
|
1058
999
|
return t == null || t(`"${r}" is not a valid URL`), null;
|
|
1059
1000
|
}
|
|
1060
|
-
return n.protocol !== "http:" && n.protocol !== "https:" ? (t == null || t(`refusing redirect to unsupported scheme "${n.protocol}"`), null) : n.origin !==
|
|
1061
|
-
}
|
|
1062
|
-
const me = {
|
|
1063
|
-
heading: "Upload files",
|
|
1064
|
-
description: "Add one or more files. You can review the list before uploading.",
|
|
1065
|
-
dropTitle: "Drag and drop files here",
|
|
1066
|
-
dropSub: "or browse from your device",
|
|
1067
|
-
hintUpTo: "up to {size} each",
|
|
1068
|
-
chooseFiles: "Choose files",
|
|
1069
|
-
chooseFile: "Choose file",
|
|
1070
|
-
addMore: "+ Add more files",
|
|
1071
|
-
remove: "Remove",
|
|
1072
|
-
rename: "Rename",
|
|
1073
|
-
retry: "Retry",
|
|
1074
|
-
uploadCtaOne: "Upload {n} file",
|
|
1075
|
-
uploadCtaMany: "Upload {n} files",
|
|
1076
|
-
attachments: "Attachments",
|
|
1077
|
-
dropOrChoose: "Drop files or choose",
|
|
1078
|
-
checking: "Checking…",
|
|
1079
|
-
pagesLabel: "{n} pages",
|
|
1080
|
-
countOne: "{n} file of {max}",
|
|
1081
|
-
countMany: "{n} files of {max}",
|
|
1082
|
-
uploading: "Uploading…",
|
|
1083
|
-
uploaded: "Uploaded",
|
|
1084
|
-
failedLabel: "Failed",
|
|
1085
|
-
errTooMany: "You can upload up to {max} files.",
|
|
1086
|
-
errTooLarge: "{name} is larger than {size}.",
|
|
1087
|
-
errTooSmall: "{name} is smaller than {size}.",
|
|
1088
|
-
errDuplicate: "{name} is already in the list.",
|
|
1089
|
-
errType: "{name} isn't an accepted file type.",
|
|
1090
|
-
errNoClient: "No Singlebase client found on this page.",
|
|
1091
|
-
errUpload: "Upload failed.",
|
|
1092
|
-
errProtected: "{name} is password protected.",
|
|
1093
|
-
errTooManyPages: "{name} has {pages} pages; the limit is {max}.",
|
|
1094
|
-
brandingLabel: "Files by Singlebase"
|
|
1095
|
-
};
|
|
1096
|
-
function De(r) {
|
|
1097
|
-
return r ? { ...me, ...r } : me;
|
|
1098
|
-
}
|
|
1099
|
-
function v(r, e) {
|
|
1100
|
-
return r.replace(
|
|
1101
|
-
/\{(\w+)\}/g,
|
|
1102
|
-
(t, o) => o in e ? String(e[o]) : t
|
|
1103
|
-
);
|
|
1104
|
-
}
|
|
1105
|
-
const je = {
|
|
1106
|
-
b: 1,
|
|
1107
|
-
kb: 1024,
|
|
1108
|
-
mb: 1024 * 1024,
|
|
1109
|
-
gb: 1024 * 1024 * 1024
|
|
1110
|
-
};
|
|
1111
|
-
function ne(r) {
|
|
1112
|
-
if (typeof r == "number") return r > 0 ? r : 0;
|
|
1113
|
-
if (!r) return 0;
|
|
1114
|
-
const e = String(r).trim().toLowerCase().match(/^([\d.]+)\s*(b|kb|mb|gb)?$/);
|
|
1115
|
-
if (!e) return 0;
|
|
1116
|
-
const t = Number.parseFloat(e[1]);
|
|
1117
|
-
return !Number.isFinite(t) || t <= 0 ? 0 : Math.round(t * (je[e[2] ?? "b"] ?? 1));
|
|
1118
|
-
}
|
|
1119
|
-
function ee(r) {
|
|
1120
|
-
return r < 1024 ? `${r} B` : r < 1024 * 1024 ? `${Math.round(r / 1024)} KB` : r < 1024 * 1024 * 1024 ? `${(r / (1024 * 1024)).toFixed(1)} MB` : `${(r / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
1121
|
-
}
|
|
1122
|
-
function te(r) {
|
|
1123
|
-
const e = r.lastIndexOf(".");
|
|
1124
|
-
return e <= 0 || e === r.length - 1 ? "" : r.slice(e + 1).toLowerCase();
|
|
1001
|
+
return n.protocol !== "http:" && n.protocol !== "https:" ? (t == null || t(`refusing redirect to unsupported scheme "${n.protocol}"`), null) : n.origin !== i.origin ? (t == null || t(`refusing cross-origin redirect to ${n.origin}; same-origin only`), null) : n.href === i.href ? null : n.href;
|
|
1125
1002
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1129
|
-
function Ee(r, e, t) {
|
|
1130
|
-
const o = r.split(",").map((i) => i.trim().toLowerCase()).filter(Boolean);
|
|
1131
|
-
if (!o.length) return !0;
|
|
1132
|
-
const n = e.toLowerCase(), u = (t || "").toLowerCase();
|
|
1133
|
-
return o.some((i) => i.startsWith(".") ? n.endsWith(i) : i.endsWith("/*") ? u.startsWith(i.slice(0, -1)) : u === i);
|
|
1134
|
-
}
|
|
1135
|
-
function Ne(r) {
|
|
1136
|
-
const e = r.split(",").map((t) => t.trim()).filter(Boolean).map((t) => {
|
|
1137
|
-
if (t.startsWith(".")) return t.slice(1).toUpperCase();
|
|
1138
|
-
if (t.endsWith("/*")) return t.slice(0, -2).toUpperCase();
|
|
1139
|
-
const o = t.indexOf("/");
|
|
1140
|
-
return (o >= 0 ? t.slice(o + 1) : t).toUpperCase();
|
|
1141
|
-
});
|
|
1142
|
-
return [...new Set(e)].join(", ");
|
|
1143
|
-
}
|
|
1144
|
-
function Be(r) {
|
|
1145
|
-
return `${r.name}:${r.size}:${r.lastModified ?? 0}`;
|
|
1146
|
-
}
|
|
1147
|
-
function Pe(r, e) {
|
|
1148
|
-
const t = e.trim().replace(/[/\\]/g, "");
|
|
1149
|
-
if (!t) return r;
|
|
1150
|
-
const o = r.lastIndexOf("."), n = o > 0 ? r.slice(o) : "";
|
|
1151
|
-
return n ? t.toLowerCase().endsWith(n.toLowerCase()) ? t : t + n : t;
|
|
1152
|
-
}
|
|
1153
|
-
const we = { pages: null, encrypted: null }, xe = 16 * 1024 * 1024, Re = 2 * 1024 * 1024, Ie = 40, Ge = 4 * 1024 * 1024, ke = /* @__PURE__ */ new Set(["docx", "pptx", "xlsx"]);
|
|
1154
|
-
async function _e(r, e) {
|
|
1003
|
+
const we = { pages: null, encrypted: null }, me = 16 * 1024 * 1024, Ge = 2 * 1024 * 1024, Ie = 40, _e = 4 * 1024 * 1024, ke = /* @__PURE__ */ new Set(["docx", "pptx", "xlsx"]);
|
|
1004
|
+
async function Ke(r, e) {
|
|
1155
1005
|
try {
|
|
1156
|
-
if (e === "pdf") return await
|
|
1157
|
-
if (ke.has(e)) return await
|
|
1006
|
+
if (e === "pdf") return await Ve(r);
|
|
1007
|
+
if (ke.has(e)) return await He(r, e);
|
|
1158
1008
|
} catch {
|
|
1159
1009
|
}
|
|
1160
1010
|
return we;
|
|
1161
1011
|
}
|
|
1162
|
-
function
|
|
1012
|
+
function qe(r) {
|
|
1163
1013
|
return r === "pdf" || ke.has(r);
|
|
1164
1014
|
}
|
|
1165
|
-
async function
|
|
1166
|
-
const e = await
|
|
1167
|
-
let
|
|
1168
|
-
return
|
|
1015
|
+
async function Ve(r) {
|
|
1016
|
+
const e = await ae(r.slice(0, me)), t = r.size > me ? await ae(r.slice(Math.max(0, r.size - Ge))) : null, i = se(e) + (t ? se(t) : ""), n = /\/Encrypt[\s/<>\]]/.test(i);
|
|
1017
|
+
let g = ze(i);
|
|
1018
|
+
return g === null && (g = await Ye(e)), { pages: g, encrypted: n };
|
|
1169
1019
|
}
|
|
1170
1020
|
function ze(r) {
|
|
1171
1021
|
if (/\/Type\s*\/Pages/.test(r)) {
|
|
1172
1022
|
let t = 0;
|
|
1173
|
-
for (const
|
|
1174
|
-
t = Math.max(t, Number(
|
|
1023
|
+
for (const i of r.matchAll(/\/Count\s+(\d+)/g))
|
|
1024
|
+
t = Math.max(t, Number(i[1]));
|
|
1175
1025
|
if (t > 0) return t;
|
|
1176
1026
|
}
|
|
1177
1027
|
const e = r.match(/\/Type\s*\/Page[^s]/g);
|
|
@@ -1179,78 +1029,78 @@ function ze(r) {
|
|
|
1179
1029
|
}
|
|
1180
1030
|
async function Ye(r) {
|
|
1181
1031
|
if (typeof DecompressionStream > "u") return null;
|
|
1182
|
-
const e =
|
|
1183
|
-
let t = "",
|
|
1032
|
+
const e = se(r);
|
|
1033
|
+
let t = "", i = 0;
|
|
1184
1034
|
for (const n of e.matchAll(/stream\r?\n/g)) {
|
|
1185
|
-
if (
|
|
1186
|
-
const
|
|
1187
|
-
let
|
|
1188
|
-
if (
|
|
1189
|
-
for (;
|
|
1190
|
-
` || e[
|
|
1191
|
-
|
|
1035
|
+
if (i >= Ie || t.length >= _e) break;
|
|
1036
|
+
const g = n.index + n[0].length;
|
|
1037
|
+
let s = e.indexOf("endstream", g);
|
|
1038
|
+
if (s < 0) break;
|
|
1039
|
+
for (; s > g && (e[s - 1] === `
|
|
1040
|
+
` || e[s - 1] === "\r"); ) s -= 1;
|
|
1041
|
+
i += 1;
|
|
1192
1042
|
try {
|
|
1193
|
-
const a = await $e(r.subarray(
|
|
1194
|
-
t +=
|
|
1043
|
+
const a = await $e(r.subarray(g, s), "deflate");
|
|
1044
|
+
t += se(a);
|
|
1195
1045
|
} catch {
|
|
1196
1046
|
}
|
|
1197
1047
|
}
|
|
1198
1048
|
return t ? ze(t) : null;
|
|
1199
1049
|
}
|
|
1200
|
-
async function
|
|
1201
|
-
const t = await
|
|
1202
|
-
if (
|
|
1050
|
+
async function He(r, e) {
|
|
1051
|
+
const t = await ae(r.slice(0, 8));
|
|
1052
|
+
if (Je(t)) return { pages: null, encrypted: !0 };
|
|
1203
1053
|
if (t[0] !== 80 || t[1] !== 75) return we;
|
|
1204
|
-
const
|
|
1205
|
-
if (!
|
|
1206
|
-
const n = e === "pptx" ? "Slides" : "Pages",
|
|
1207
|
-
return { pages:
|
|
1054
|
+
const i = await Xe(r, "docProps/app.xml");
|
|
1055
|
+
if (!i) return { pages: null, encrypted: !1 };
|
|
1056
|
+
const n = e === "pptx" ? "Slides" : "Pages", g = new TextDecoder().decode(i).match(new RegExp(`<${n}>(\\d+)</${n}>`));
|
|
1057
|
+
return { pages: g ? Number(g[1]) : null, encrypted: !1 };
|
|
1208
1058
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return [208, 207, 17, 224, 161, 177, 26, 225].every((t,
|
|
1059
|
+
function Je(r) {
|
|
1060
|
+
return [208, 207, 17, 224, 161, 177, 26, 225].every((t, i) => r[i] === t);
|
|
1211
1061
|
}
|
|
1212
|
-
async function
|
|
1213
|
-
const t = Math.min(r.size, 66e3),
|
|
1062
|
+
async function Xe(r, e) {
|
|
1063
|
+
const t = Math.min(r.size, 66e3), i = new DataView(await r.slice(r.size - t).arrayBuffer());
|
|
1214
1064
|
let n = -1;
|
|
1215
|
-
for (let h =
|
|
1216
|
-
if (
|
|
1065
|
+
for (let h = i.byteLength - 22; h >= 0; h--)
|
|
1066
|
+
if (i.getUint32(h, !0) === 101010256) {
|
|
1217
1067
|
n = h;
|
|
1218
1068
|
break;
|
|
1219
1069
|
}
|
|
1220
1070
|
if (n < 0) return null;
|
|
1221
|
-
const
|
|
1222
|
-
if (!
|
|
1223
|
-
const a = new DataView(await r.slice(
|
|
1224
|
-
let
|
|
1225
|
-
for (;
|
|
1226
|
-
const h = a.getUint16(
|
|
1227
|
-
if (m.decode(new Uint8Array(a.buffer, a.byteOffset +
|
|
1228
|
-
const
|
|
1229
|
-
return h === 0 ?
|
|
1071
|
+
const g = i.getUint32(n + 12, !0), s = i.getUint32(n + 16, !0);
|
|
1072
|
+
if (!g || s === 4294967295) return null;
|
|
1073
|
+
const a = new DataView(await r.slice(s, s + g).arrayBuffer()), m = new TextDecoder();
|
|
1074
|
+
let f = 0;
|
|
1075
|
+
for (; f + 46 <= a.byteLength && a.getUint32(f, !0) === 33639248; ) {
|
|
1076
|
+
const h = a.getUint16(f + 10, !0), re = a.getUint32(f + 20, !0), y = a.getUint16(f + 28, !0), ne = a.getUint16(f + 30, !0), Se = a.getUint16(f + 32, !0), oe = a.getUint32(f + 42, !0);
|
|
1077
|
+
if (m.decode(new Uint8Array(a.buffer, a.byteOffset + f + 46, y)) === e) {
|
|
1078
|
+
const ue = new DataView(await r.slice(oe, oe + 30).arrayBuffer()), fe = oe + 30 + ue.getUint16(26, !0) + ue.getUint16(28, !0), be = await ae(r.slice(fe, fe + re));
|
|
1079
|
+
return h === 0 ? be : h === 8 && typeof DecompressionStream < "u" ? await $e(be, "deflate-raw") : null;
|
|
1230
1080
|
}
|
|
1231
|
-
|
|
1081
|
+
f += 46 + y + ne + Se;
|
|
1232
1082
|
}
|
|
1233
1083
|
return null;
|
|
1234
1084
|
}
|
|
1235
|
-
async function
|
|
1085
|
+
async function ae(r) {
|
|
1236
1086
|
return new Uint8Array(await r.arrayBuffer());
|
|
1237
1087
|
}
|
|
1238
1088
|
async function $e(r, e) {
|
|
1239
1089
|
const t = new Blob([r]).stream().pipeThrough(new DecompressionStream(e));
|
|
1240
1090
|
return new Uint8Array(await new Response(t).arrayBuffer());
|
|
1241
1091
|
}
|
|
1242
|
-
function
|
|
1092
|
+
function se(r) {
|
|
1243
1093
|
let e = "";
|
|
1244
|
-
for (let
|
|
1245
|
-
e += String.fromCharCode(...r.subarray(
|
|
1094
|
+
for (let i = 0; i < r.length; i += 32768)
|
|
1095
|
+
e += String.fromCharCode(...r.subarray(i, i + 32768));
|
|
1246
1096
|
return e;
|
|
1247
1097
|
}
|
|
1248
|
-
var Ue = Object.defineProperty,
|
|
1249
|
-
for (var n =
|
|
1250
|
-
(
|
|
1251
|
-
return
|
|
1252
|
-
},
|
|
1253
|
-
const
|
|
1098
|
+
var Ue = Object.defineProperty, We = Object.getOwnPropertyDescriptor, Ze = (r, e, t) => e in r ? Ue(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, p = (r, e, t, i) => {
|
|
1099
|
+
for (var n = i > 1 ? void 0 : i ? We(e, t) : e, g = r.length - 1, s; g >= 0; g--)
|
|
1100
|
+
(s = r[g]) && (n = (i ? s(e, t, n) : s(n)) || n);
|
|
1101
|
+
return i && n && Ue(e, t, n), n;
|
|
1102
|
+
}, Qe = (r, e, t) => Ze(r, e + "", t);
|
|
1103
|
+
const ce = {
|
|
1254
1104
|
fromAttribute: (r) => {
|
|
1255
1105
|
if (!r) return {};
|
|
1256
1106
|
try {
|
|
@@ -1261,15 +1111,17 @@ const de = {
|
|
|
1261
1111
|
}
|
|
1262
1112
|
},
|
|
1263
1113
|
toAttribute: (r) => JSON.stringify(r ?? {})
|
|
1264
|
-
},
|
|
1114
|
+
}, pe = {
|
|
1265
1115
|
fromAttribute: (r) => r === null ? !0 : r !== "false",
|
|
1266
1116
|
toAttribute: (r) => r ? null : "false"
|
|
1267
|
-
},
|
|
1117
|
+
}, xe = [
|
|
1268
1118
|
"view",
|
|
1269
1119
|
"dropzone",
|
|
1270
1120
|
"allowRename",
|
|
1271
1121
|
"autoUpload",
|
|
1272
1122
|
"branding",
|
|
1123
|
+
"brandingText",
|
|
1124
|
+
"brandingUrl",
|
|
1273
1125
|
"logoUrl",
|
|
1274
1126
|
"logoText",
|
|
1275
1127
|
"heading",
|
|
@@ -1287,43 +1139,47 @@ const de = {
|
|
|
1287
1139
|
"messages",
|
|
1288
1140
|
"theme",
|
|
1289
1141
|
"density",
|
|
1142
|
+
"radius",
|
|
1290
1143
|
"onComplete",
|
|
1291
1144
|
"onError"
|
|
1292
1145
|
];
|
|
1293
|
-
var k, z, $, U, S,
|
|
1294
|
-
let
|
|
1146
|
+
var k, z, $, U, S, M, C, T, j, F, O, D, E, L, A, N, P, R, B, G, I, _, K, q, V, Y, H, J, X, W, Z, Q, ee, ve;
|
|
1147
|
+
let o = (ve = class extends Me {
|
|
1295
1148
|
constructor() {
|
|
1296
1149
|
super(...arguments);
|
|
1297
1150
|
l(this, k, null);
|
|
1298
1151
|
l(this, z, {});
|
|
1299
1152
|
l(this, $);
|
|
1300
1153
|
l(this, U);
|
|
1301
|
-
l(this, S
|
|
1154
|
+
l(this, S);
|
|
1155
|
+
l(this, M, "full");
|
|
1302
1156
|
l(this, C, !0);
|
|
1303
|
-
l(this, M, !0);
|
|
1304
|
-
l(this, L, !1);
|
|
1305
1157
|
l(this, T, !0);
|
|
1306
|
-
l(this,
|
|
1158
|
+
l(this, j, !1);
|
|
1159
|
+
l(this, F, !0);
|
|
1307
1160
|
l(this, O, "");
|
|
1308
1161
|
l(this, D, "");
|
|
1309
|
-
l(this,
|
|
1310
|
-
l(this,
|
|
1311
|
-
l(this,
|
|
1312
|
-
l(this, N,
|
|
1313
|
-
l(this,
|
|
1314
|
-
l(this,
|
|
1315
|
-
l(this,
|
|
1162
|
+
l(this, E, "");
|
|
1163
|
+
l(this, L, "");
|
|
1164
|
+
l(this, A, "");
|
|
1165
|
+
l(this, N, "");
|
|
1166
|
+
l(this, P, 10);
|
|
1167
|
+
l(this, R, "25MB");
|
|
1168
|
+
l(this, B, 0);
|
|
1169
|
+
l(this, G, "");
|
|
1316
1170
|
l(this, I, {});
|
|
1317
|
-
l(this,
|
|
1318
|
-
l(this,
|
|
1319
|
-
l(this,
|
|
1320
|
-
l(this, W, null);
|
|
1321
|
-
l(this, Y, null);
|
|
1322
|
-
l(this, q, []);
|
|
1323
|
-
l(this, H, "");
|
|
1171
|
+
l(this, _, "default");
|
|
1172
|
+
l(this, K, {});
|
|
1173
|
+
l(this, q, {});
|
|
1324
1174
|
l(this, V, !1);
|
|
1325
|
-
l(this,
|
|
1326
|
-
l(this,
|
|
1175
|
+
l(this, Y, "");
|
|
1176
|
+
l(this, H, null);
|
|
1177
|
+
l(this, J, null);
|
|
1178
|
+
l(this, X, []);
|
|
1179
|
+
l(this, W, "");
|
|
1180
|
+
l(this, Z, !1);
|
|
1181
|
+
l(this, Q, !1);
|
|
1182
|
+
l(this, ee, "");
|
|
1327
1183
|
}
|
|
1328
1184
|
get client() {
|
|
1329
1185
|
return d(this, k);
|
|
@@ -1349,12 +1205,18 @@ let s = (ye = class extends Ce {
|
|
|
1349
1205
|
set density(e) {
|
|
1350
1206
|
c(this, U, e);
|
|
1351
1207
|
}
|
|
1352
|
-
get
|
|
1208
|
+
get radius() {
|
|
1353
1209
|
return d(this, S);
|
|
1354
1210
|
}
|
|
1355
|
-
set
|
|
1211
|
+
set radius(e) {
|
|
1356
1212
|
c(this, S, e);
|
|
1357
1213
|
}
|
|
1214
|
+
get view() {
|
|
1215
|
+
return d(this, M);
|
|
1216
|
+
}
|
|
1217
|
+
set view(e) {
|
|
1218
|
+
c(this, M, e);
|
|
1219
|
+
}
|
|
1358
1220
|
get dropzone() {
|
|
1359
1221
|
return d(this, C);
|
|
1360
1222
|
}
|
|
@@ -1362,155 +1224,167 @@ let s = (ye = class extends Ce {
|
|
|
1362
1224
|
c(this, C, e);
|
|
1363
1225
|
}
|
|
1364
1226
|
get allowRename() {
|
|
1365
|
-
return d(this,
|
|
1227
|
+
return d(this, T);
|
|
1366
1228
|
}
|
|
1367
1229
|
set allowRename(e) {
|
|
1368
|
-
c(this,
|
|
1230
|
+
c(this, T, e);
|
|
1369
1231
|
}
|
|
1370
1232
|
get autoUpload() {
|
|
1371
|
-
return d(this,
|
|
1233
|
+
return d(this, j);
|
|
1372
1234
|
}
|
|
1373
1235
|
set autoUpload(e) {
|
|
1374
|
-
c(this,
|
|
1236
|
+
c(this, j, e);
|
|
1375
1237
|
}
|
|
1376
1238
|
get branding() {
|
|
1377
|
-
return d(this,
|
|
1239
|
+
return d(this, F);
|
|
1378
1240
|
}
|
|
1379
1241
|
set branding(e) {
|
|
1380
|
-
c(this,
|
|
1242
|
+
c(this, F, e);
|
|
1243
|
+
}
|
|
1244
|
+
get brandingText() {
|
|
1245
|
+
return d(this, O);
|
|
1246
|
+
}
|
|
1247
|
+
set brandingText(e) {
|
|
1248
|
+
c(this, O, e);
|
|
1249
|
+
}
|
|
1250
|
+
get brandingUrl() {
|
|
1251
|
+
return d(this, D);
|
|
1252
|
+
}
|
|
1253
|
+
set brandingUrl(e) {
|
|
1254
|
+
c(this, D, e);
|
|
1381
1255
|
}
|
|
1382
1256
|
get logoUrl() {
|
|
1383
|
-
return d(this,
|
|
1257
|
+
return d(this, E);
|
|
1384
1258
|
}
|
|
1385
1259
|
set logoUrl(e) {
|
|
1386
|
-
c(this,
|
|
1260
|
+
c(this, E, e);
|
|
1387
1261
|
}
|
|
1388
1262
|
get logoText() {
|
|
1389
|
-
return d(this,
|
|
1263
|
+
return d(this, L);
|
|
1390
1264
|
}
|
|
1391
1265
|
set logoText(e) {
|
|
1392
|
-
c(this,
|
|
1266
|
+
c(this, L, e);
|
|
1393
1267
|
}
|
|
1394
1268
|
get heading() {
|
|
1395
|
-
return d(this,
|
|
1269
|
+
return d(this, A);
|
|
1396
1270
|
}
|
|
1397
1271
|
set heading(e) {
|
|
1398
|
-
c(this,
|
|
1272
|
+
c(this, A, e);
|
|
1399
1273
|
}
|
|
1400
1274
|
get description() {
|
|
1401
|
-
return d(this,
|
|
1275
|
+
return d(this, N);
|
|
1402
1276
|
}
|
|
1403
1277
|
set description(e) {
|
|
1404
|
-
c(this,
|
|
1278
|
+
c(this, N, e);
|
|
1405
1279
|
}
|
|
1406
1280
|
get maxFiles() {
|
|
1407
|
-
return d(this,
|
|
1281
|
+
return d(this, P);
|
|
1408
1282
|
}
|
|
1409
1283
|
set maxFiles(e) {
|
|
1410
|
-
c(this,
|
|
1284
|
+
c(this, P, e);
|
|
1411
1285
|
}
|
|
1412
1286
|
get maxSize() {
|
|
1413
|
-
return d(this,
|
|
1287
|
+
return d(this, R);
|
|
1414
1288
|
}
|
|
1415
1289
|
set maxSize(e) {
|
|
1416
|
-
c(this,
|
|
1290
|
+
c(this, R, e);
|
|
1417
1291
|
}
|
|
1418
1292
|
get minSize() {
|
|
1419
|
-
return d(this,
|
|
1293
|
+
return d(this, B);
|
|
1420
1294
|
}
|
|
1421
1295
|
set minSize(e) {
|
|
1422
|
-
c(this,
|
|
1296
|
+
c(this, B, e);
|
|
1423
1297
|
}
|
|
1424
1298
|
get accept() {
|
|
1425
|
-
return d(this,
|
|
1299
|
+
return d(this, G);
|
|
1426
1300
|
}
|
|
1427
1301
|
set accept(e) {
|
|
1428
|
-
c(this,
|
|
1302
|
+
c(this, G, e);
|
|
1429
1303
|
}
|
|
1430
1304
|
get rules() {
|
|
1431
|
-
return d(this,
|
|
1305
|
+
return d(this, I);
|
|
1432
1306
|
}
|
|
1433
1307
|
set rules(e) {
|
|
1434
|
-
c(this,
|
|
1308
|
+
c(this, I, e);
|
|
1435
1309
|
}
|
|
1436
1310
|
get bucket() {
|
|
1437
|
-
return d(this,
|
|
1311
|
+
return d(this, _);
|
|
1438
1312
|
}
|
|
1439
1313
|
set bucket(e) {
|
|
1440
|
-
c(this,
|
|
1314
|
+
c(this, _, e);
|
|
1441
1315
|
}
|
|
1442
1316
|
get metadata() {
|
|
1443
|
-
return d(this,
|
|
1317
|
+
return d(this, K);
|
|
1444
1318
|
}
|
|
1445
1319
|
set metadata(e) {
|
|
1446
|
-
c(this,
|
|
1320
|
+
c(this, K, e);
|
|
1447
1321
|
}
|
|
1448
1322
|
get options() {
|
|
1449
|
-
return d(this,
|
|
1323
|
+
return d(this, q);
|
|
1450
1324
|
}
|
|
1451
1325
|
set options(e) {
|
|
1452
|
-
c(this,
|
|
1326
|
+
c(this, q, e);
|
|
1453
1327
|
}
|
|
1454
1328
|
get publicRead() {
|
|
1455
|
-
return d(this,
|
|
1329
|
+
return d(this, V);
|
|
1456
1330
|
}
|
|
1457
1331
|
set publicRead(e) {
|
|
1458
|
-
c(this,
|
|
1332
|
+
c(this, V, e);
|
|
1459
1333
|
}
|
|
1460
1334
|
get redirectUrl() {
|
|
1461
|
-
return d(this,
|
|
1335
|
+
return d(this, Y);
|
|
1462
1336
|
}
|
|
1463
1337
|
set redirectUrl(e) {
|
|
1464
|
-
c(this,
|
|
1338
|
+
c(this, Y, e);
|
|
1465
1339
|
}
|
|
1466
1340
|
get onComplete() {
|
|
1467
|
-
return d(this,
|
|
1341
|
+
return d(this, H);
|
|
1468
1342
|
}
|
|
1469
1343
|
set onComplete(e) {
|
|
1470
|
-
c(this,
|
|
1344
|
+
c(this, H, e);
|
|
1471
1345
|
}
|
|
1472
1346
|
get onError() {
|
|
1473
|
-
return d(this,
|
|
1347
|
+
return d(this, J);
|
|
1474
1348
|
}
|
|
1475
1349
|
set onError(e) {
|
|
1476
|
-
c(this,
|
|
1350
|
+
c(this, J, e);
|
|
1477
1351
|
}
|
|
1478
1352
|
get items() {
|
|
1479
|
-
return d(this,
|
|
1353
|
+
return d(this, X);
|
|
1480
1354
|
}
|
|
1481
1355
|
set items(e) {
|
|
1482
|
-
c(this,
|
|
1356
|
+
c(this, X, e);
|
|
1483
1357
|
}
|
|
1484
1358
|
get notice() {
|
|
1485
|
-
return d(this,
|
|
1359
|
+
return d(this, W);
|
|
1486
1360
|
}
|
|
1487
1361
|
set notice(e) {
|
|
1488
|
-
c(this,
|
|
1362
|
+
c(this, W, e);
|
|
1489
1363
|
}
|
|
1490
1364
|
get busy() {
|
|
1491
|
-
return d(this,
|
|
1365
|
+
return d(this, Z);
|
|
1492
1366
|
}
|
|
1493
1367
|
set busy(e) {
|
|
1494
|
-
c(this,
|
|
1368
|
+
c(this, Z, e);
|
|
1495
1369
|
}
|
|
1496
1370
|
get dragging() {
|
|
1497
|
-
return d(this,
|
|
1371
|
+
return d(this, Q);
|
|
1498
1372
|
}
|
|
1499
1373
|
set dragging(e) {
|
|
1500
|
-
c(this,
|
|
1374
|
+
c(this, Q, e);
|
|
1501
1375
|
}
|
|
1502
1376
|
get editing() {
|
|
1503
|
-
return d(this,
|
|
1377
|
+
return d(this, ee);
|
|
1504
1378
|
}
|
|
1505
1379
|
set editing(e) {
|
|
1506
|
-
c(this,
|
|
1380
|
+
c(this, ee, e);
|
|
1507
1381
|
}
|
|
1508
1382
|
get msg() {
|
|
1509
|
-
return
|
|
1383
|
+
return Oe(this.messages);
|
|
1510
1384
|
}
|
|
1511
1385
|
/** An explicit `.client`, else the page default. */
|
|
1512
1386
|
get resolvedClient() {
|
|
1513
|
-
return this.client ??
|
|
1387
|
+
return this.client ?? Te() ?? null;
|
|
1514
1388
|
}
|
|
1515
1389
|
/** The staging list, for host code that wants to inspect or persist it. */
|
|
1516
1390
|
get files() {
|
|
@@ -1519,7 +1393,7 @@ let s = (ye = class extends Ce {
|
|
|
1519
1393
|
/** Overall progress across the current batch, 0–100. */
|
|
1520
1394
|
get percent() {
|
|
1521
1395
|
const e = this.items.filter((t) => t.status !== "ready");
|
|
1522
|
-
return e.length ? Math.round(e.reduce((t,
|
|
1396
|
+
return e.length ? Math.round(e.reduce((t, i) => t + i.percent, 0) / e.length) : 0;
|
|
1523
1397
|
}
|
|
1524
1398
|
// ── public API ────────────────────────────────────────────
|
|
1525
1399
|
/** Opens the file picker. */
|
|
@@ -1536,12 +1410,19 @@ let s = (ye = class extends Ce {
|
|
|
1536
1410
|
*/
|
|
1537
1411
|
set config(e) {
|
|
1538
1412
|
const t = this;
|
|
1539
|
-
for (const
|
|
1540
|
-
e &&
|
|
1413
|
+
for (const i of xe)
|
|
1414
|
+
e && i in e && (t[i] = e[i]);
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Changes settings on the fly. Only the keys you pass change; staged files
|
|
1418
|
+
* stay. Returns the element, so calls chain.
|
|
1419
|
+
*/
|
|
1420
|
+
configure(e) {
|
|
1421
|
+
return this.config = e, this;
|
|
1541
1422
|
}
|
|
1542
1423
|
get config() {
|
|
1543
1424
|
const e = this;
|
|
1544
|
-
return Object.fromEntries(
|
|
1425
|
+
return Object.fromEntries(xe.map((t) => [t, e[t]]));
|
|
1545
1426
|
}
|
|
1546
1427
|
/** Drops every staged file and any notice. */
|
|
1547
1428
|
clear() {
|
|
@@ -1552,9 +1433,9 @@ let s = (ye = class extends Ce {
|
|
|
1552
1433
|
}
|
|
1553
1434
|
/** Uploads everything staged. Rows that already succeeded are left alone. */
|
|
1554
1435
|
async upload() {
|
|
1555
|
-
var
|
|
1436
|
+
var g;
|
|
1556
1437
|
if (this.busy) return;
|
|
1557
|
-
const e = this.items.filter((
|
|
1438
|
+
const e = this.items.filter((s) => s.status === "ready" || s.status === "error");
|
|
1558
1439
|
if (!e.length) return;
|
|
1559
1440
|
const t = this.resolvedClient;
|
|
1560
1441
|
if (!t) {
|
|
@@ -1562,35 +1443,35 @@ let s = (ye = class extends Ce {
|
|
|
1562
1443
|
return;
|
|
1563
1444
|
}
|
|
1564
1445
|
this.busy = !0, this.notice = "";
|
|
1565
|
-
for (const
|
|
1566
|
-
|
|
1446
|
+
for (const s of e)
|
|
1447
|
+
s.status = "uploading", s.percent = 0, s.error = "";
|
|
1567
1448
|
this.items = [...this.items];
|
|
1568
|
-
const
|
|
1569
|
-
const a = { file:
|
|
1570
|
-
return this.bucket && (a.bucket = this.bucket), this.publicRead && (a.publicRead = !0),
|
|
1449
|
+
const i = /* @__PURE__ */ new Map(), n = e.map((s) => {
|
|
1450
|
+
const a = { file: s.file, filename: s.file.name };
|
|
1451
|
+
return this.bucket && (a.bucket = this.bucket), this.publicRead && (a.publicRead = !0), s.name !== s.file.name && (a.newName = s.name), Object.keys(this.metadata ?? {}).length && (a.metadata = { ...this.metadata }), Object.keys(this.options ?? {}).length && (a.options = { ...this.options }), i.set(a, s), a;
|
|
1571
1452
|
});
|
|
1572
1453
|
try {
|
|
1573
|
-
const
|
|
1574
|
-
onProgress: (
|
|
1575
|
-
const h =
|
|
1576
|
-
h && (h.percent =
|
|
1454
|
+
const s = await t.files.upload(n, {
|
|
1455
|
+
onProgress: (f) => {
|
|
1456
|
+
const h = i.get(f.input);
|
|
1457
|
+
h && (h.percent = f.percent, this.items = [...this.items], this.emit("singlebase-upload-progress", { file: h, percent: this.percent }));
|
|
1577
1458
|
}
|
|
1578
1459
|
});
|
|
1579
|
-
for (const
|
|
1580
|
-
const h =
|
|
1581
|
-
h && (h.status = "done", h.percent = 100, h.record =
|
|
1460
|
+
for (const f of s.completed) {
|
|
1461
|
+
const h = i.get(f.input);
|
|
1462
|
+
h && (h.status = "done", h.percent = 100, h.record = f.file);
|
|
1582
1463
|
}
|
|
1583
|
-
for (const
|
|
1584
|
-
const h =
|
|
1585
|
-
h && (h.status = "error", h.error =
|
|
1464
|
+
for (const f of s.failed) {
|
|
1465
|
+
const h = i.get(f.input);
|
|
1466
|
+
h && (h.status = "error", h.error = f.error.message || f.error.code);
|
|
1586
1467
|
}
|
|
1587
1468
|
this.items = [...this.items];
|
|
1588
|
-
const a =
|
|
1589
|
-
this.emit("singlebase-upload-complete", { completed: a, failed: m }), (
|
|
1590
|
-
} catch (
|
|
1469
|
+
const a = s.completed.map((f) => i.get(f.input)).filter(Boolean), m = s.failed.map((f) => i.get(f.input)).filter(Boolean);
|
|
1470
|
+
this.emit("singlebase-upload-complete", { completed: a, failed: m }), (g = this.onComplete) == null || g.call(this, { completed: a, failed: m }), m.length ? this.notice = this.msg.errUpload : this.redirect();
|
|
1471
|
+
} catch (s) {
|
|
1591
1472
|
for (const a of e)
|
|
1592
1473
|
a.status = "error", a.error = "";
|
|
1593
|
-
this.items = [...this.items], this.fail(
|
|
1474
|
+
this.items = [...this.items], this.fail(tt(s) || this.msg.errUpload);
|
|
1594
1475
|
} finally {
|
|
1595
1476
|
this.busy = !1;
|
|
1596
1477
|
}
|
|
@@ -1598,10 +1479,10 @@ let s = (ye = class extends Ce {
|
|
|
1598
1479
|
// ── staging ───────────────────────────────────────────────
|
|
1599
1480
|
/** The rule for this filename's extension, if the host set one. */
|
|
1600
1481
|
ruleFor(e) {
|
|
1601
|
-
const t =
|
|
1482
|
+
const t = de(e);
|
|
1602
1483
|
if (!t) return null;
|
|
1603
|
-
for (const [
|
|
1604
|
-
if (
|
|
1484
|
+
for (const [i, n] of Object.entries(this.rules ?? {}))
|
|
1485
|
+
if (i.toLowerCase().replace(/^\./, "") === t) return n;
|
|
1605
1486
|
return null;
|
|
1606
1487
|
}
|
|
1607
1488
|
async add(e) {
|
|
@@ -1609,33 +1490,33 @@ let s = (ye = class extends Ce {
|
|
|
1609
1490
|
const a = this.items.filter((m) => m.status === "done" || m.status === "error");
|
|
1610
1491
|
a.forEach(w), this.items = this.items.filter((m) => !a.includes(m));
|
|
1611
1492
|
}
|
|
1612
|
-
const t = this.maxFiles > 0 ? this.maxFiles : Number.POSITIVE_INFINITY,
|
|
1613
|
-
let
|
|
1493
|
+
const t = this.maxFiles > 0 ? this.maxFiles : Number.POSITIVE_INFINITY, i = [...this.items], n = i.length, g = [];
|
|
1494
|
+
let s = "";
|
|
1614
1495
|
for (const a of Array.from(e)) {
|
|
1615
|
-
if (
|
|
1616
|
-
|
|
1496
|
+
if (i.length >= t) {
|
|
1497
|
+
s = v(this.msg.errTooMany, { max: t });
|
|
1617
1498
|
break;
|
|
1618
1499
|
}
|
|
1619
|
-
if (this.accept && !
|
|
1620
|
-
|
|
1500
|
+
if (this.accept && !De(this.accept, a.name, a.type)) {
|
|
1501
|
+
s = v(this.msg.errType, { name: a.name });
|
|
1621
1502
|
continue;
|
|
1622
1503
|
}
|
|
1623
|
-
const m = this.ruleFor(a.name),
|
|
1624
|
-
if (
|
|
1625
|
-
|
|
1504
|
+
const m = this.ruleFor(a.name), f = le((m == null ? void 0 : m.maxSize) ?? this.maxSize), h = le((m == null ? void 0 : m.minSize) ?? this.minSize);
|
|
1505
|
+
if (f && a.size > f) {
|
|
1506
|
+
s = v(this.msg.errTooLarge, { name: a.name, size: ie(f) });
|
|
1626
1507
|
continue;
|
|
1627
1508
|
}
|
|
1628
1509
|
if (h && a.size < h) {
|
|
1629
|
-
|
|
1510
|
+
s = v(this.msg.errTooSmall, { name: a.name, size: ie(h) });
|
|
1630
1511
|
continue;
|
|
1631
1512
|
}
|
|
1632
|
-
const
|
|
1633
|
-
if (
|
|
1634
|
-
|
|
1513
|
+
const re = Ee(a);
|
|
1514
|
+
if (i.some((ne) => ne.key === re)) {
|
|
1515
|
+
s = v(this.msg.errDuplicate, { name: a.name });
|
|
1635
1516
|
continue;
|
|
1636
1517
|
}
|
|
1637
1518
|
const y = {
|
|
1638
|
-
key:
|
|
1519
|
+
key: re,
|
|
1639
1520
|
file: a,
|
|
1640
1521
|
name: a.name,
|
|
1641
1522
|
// Reading bytes takes a moment, so the row appears immediately as
|
|
@@ -1646,16 +1527,16 @@ let s = (ye = class extends Ce {
|
|
|
1646
1527
|
record: null,
|
|
1647
1528
|
pages: null,
|
|
1648
1529
|
encrypted: null,
|
|
1649
|
-
preview:
|
|
1530
|
+
preview: et(a)
|
|
1650
1531
|
};
|
|
1651
|
-
|
|
1532
|
+
i.push(y), g.push(y);
|
|
1652
1533
|
}
|
|
1653
|
-
this.notice =
|
|
1654
|
-
|
|
1534
|
+
this.notice = s, s && this.emit("singlebase-upload-rejected", { message: s }), i.length !== n && (this.items = i, this.emit("singlebase-upload-selected", { files: this.items }), await Promise.all(
|
|
1535
|
+
g.filter((a) => a.status === "checking").map((a) => this.inspect(a, this.ruleFor(a.file.name)))
|
|
1655
1536
|
), (this.autoUpload || this.view === "button") && this.upload());
|
|
1656
1537
|
}
|
|
1657
1538
|
needsInspection(e, t) {
|
|
1658
|
-
return !e || !
|
|
1539
|
+
return !e || !qe(de(t)) ? !1 : e.maxPages !== void 0 || e.allowProtected === !1;
|
|
1659
1540
|
}
|
|
1660
1541
|
/**
|
|
1661
1542
|
* Reads the file and applies the rule. A fact the reader could not
|
|
@@ -1663,21 +1544,21 @@ let s = (ye = class extends Ce {
|
|
|
1663
1544
|
* the page rule simply doesn't apply to that file.
|
|
1664
1545
|
*/
|
|
1665
1546
|
async inspect(e, t) {
|
|
1666
|
-
const
|
|
1667
|
-
e.pages =
|
|
1547
|
+
const i = await Ke(e.file, de(e.file.name));
|
|
1548
|
+
e.pages = i.pages, e.encrypted = i.encrypted;
|
|
1668
1549
|
let n = "";
|
|
1669
|
-
t.allowProtected === !1 &&
|
|
1550
|
+
t.allowProtected === !1 && i.encrypted === !0 ? n = v(this.msg.errProtected, { name: e.name }) : t.maxPages && i.pages !== null && i.pages > t.maxPages && (n = v(this.msg.errTooManyPages, {
|
|
1670
1551
|
name: e.name,
|
|
1671
|
-
pages:
|
|
1552
|
+
pages: i.pages,
|
|
1672
1553
|
max: t.maxPages
|
|
1673
|
-
})), n ? (w(e), this.items = this.items.filter((
|
|
1554
|
+
})), n ? (w(e), this.items = this.items.filter((g) => g !== e), this.notice = n, this.emit("singlebase-upload-rejected", { message: n })) : (e.status = "ready", this.items = [...this.items]);
|
|
1674
1555
|
}
|
|
1675
1556
|
/** Drops one staged file. Named for the row action, not Element.remove(). */
|
|
1676
1557
|
removeItem(e) {
|
|
1677
1558
|
this.items.filter((t) => t.key === e).forEach(w), this.items = this.items.filter((t) => t.key !== e), this.notice = "";
|
|
1678
1559
|
}
|
|
1679
1560
|
commitRename(e, t) {
|
|
1680
|
-
e.name =
|
|
1561
|
+
e.name = Le(e.file.name, t), this.editing = "", this.items = [...this.items];
|
|
1681
1562
|
}
|
|
1682
1563
|
fail(e) {
|
|
1683
1564
|
var t;
|
|
@@ -1688,7 +1569,7 @@ let s = (ye = class extends Ce {
|
|
|
1688
1569
|
}
|
|
1689
1570
|
redirect() {
|
|
1690
1571
|
if (!this.redirectUrl || typeof location > "u") return;
|
|
1691
|
-
const e =
|
|
1572
|
+
const e = Be(
|
|
1692
1573
|
this.redirectUrl,
|
|
1693
1574
|
location.href,
|
|
1694
1575
|
(t) => console.warn(`[singlebase-uploader] ${t}`)
|
|
@@ -1697,14 +1578,14 @@ let s = (ye = class extends Ce {
|
|
|
1697
1578
|
}
|
|
1698
1579
|
// ── events ────────────────────────────────────────────────
|
|
1699
1580
|
onPick(e) {
|
|
1700
|
-
var
|
|
1581
|
+
var i;
|
|
1701
1582
|
const t = e.target;
|
|
1702
|
-
(
|
|
1583
|
+
(i = t.files) != null && i.length && this.add(t.files), t.value = "";
|
|
1703
1584
|
}
|
|
1704
1585
|
onDrop(e) {
|
|
1705
|
-
var
|
|
1586
|
+
var i;
|
|
1706
1587
|
e.preventDefault(), this.dragging = !1;
|
|
1707
|
-
const t = (
|
|
1588
|
+
const t = (i = e.dataTransfer) == null ? void 0 : i.files;
|
|
1708
1589
|
t != null && t.length && this.add(t);
|
|
1709
1590
|
}
|
|
1710
1591
|
onDragOver(e) {
|
|
@@ -1725,11 +1606,11 @@ let s = (ye = class extends Ce {
|
|
|
1725
1606
|
return this.items.filter((e) => e.status === "ready" || e.status === "error").length;
|
|
1726
1607
|
}
|
|
1727
1608
|
get hint() {
|
|
1728
|
-
const e =
|
|
1729
|
-
return [e,
|
|
1609
|
+
const e = Ae(this.accept), t = le(this.maxSize), i = t ? v(this.msg.hintUpTo, { size: ie(t) }) : "";
|
|
1610
|
+
return [e, i].filter(Boolean).join(" · ");
|
|
1730
1611
|
}
|
|
1731
1612
|
renderInput() {
|
|
1732
|
-
return
|
|
1613
|
+
return u`<input
|
|
1733
1614
|
class="sr-only"
|
|
1734
1615
|
type="file"
|
|
1735
1616
|
?multiple=${this.maxFiles !== 1}
|
|
@@ -1738,56 +1619,57 @@ let s = (ye = class extends Ce {
|
|
|
1738
1619
|
/>`;
|
|
1739
1620
|
}
|
|
1740
1621
|
renderLogo() {
|
|
1741
|
-
return this.logoUrl ?
|
|
1622
|
+
return this.logoUrl ? u`<img
|
|
1742
1623
|
class="logo-img"
|
|
1743
1624
|
src=${this.logoUrl}
|
|
1744
1625
|
alt=${this.logoText || "Logo"}
|
|
1745
1626
|
part="logo"
|
|
1746
|
-
/>` : this.logoText ?
|
|
1627
|
+
/>` : this.logoText ? u`<div class="brand-mark" part="logo">${this.logoText}</div>` : x;
|
|
1747
1628
|
}
|
|
1748
1629
|
renderBranding() {
|
|
1749
|
-
return
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1630
|
+
return Ne(
|
|
1631
|
+
this.branding,
|
|
1632
|
+
this.brandingText,
|
|
1633
|
+
this.msg.brandingLabel,
|
|
1634
|
+
this.brandingUrl
|
|
1635
|
+
);
|
|
1754
1636
|
}
|
|
1755
1637
|
renderNotice() {
|
|
1756
|
-
return this.notice ?
|
|
1638
|
+
return this.notice ? u`<div class="banner" role="alert" part="error">${this.notice}</div>` : x;
|
|
1757
1639
|
}
|
|
1758
1640
|
renderCount() {
|
|
1759
1641
|
if (!this.items.length) return x;
|
|
1760
1642
|
const e = this.items.length === 1 ? this.msg.countOne : this.msg.countMany;
|
|
1761
|
-
return
|
|
1643
|
+
return u`<div class="count" part="count">
|
|
1762
1644
|
${v(e, { n: this.items.length, max: this.maxFiles })}
|
|
1763
1645
|
</div>`;
|
|
1764
1646
|
}
|
|
1765
1647
|
renderStatus(e) {
|
|
1766
|
-
const t =
|
|
1648
|
+
const t = ie(e.file.size);
|
|
1767
1649
|
if (e.status === "checking") return `${t} · ${this.msg.checking}`;
|
|
1768
1650
|
if (e.status === "uploading") return `${t} · ${this.msg.uploading}`;
|
|
1769
1651
|
if (e.status === "done") return `${t} · ${this.msg.uploaded}`;
|
|
1770
1652
|
if (e.status === "error")
|
|
1771
1653
|
return `${t} · ${e.error || this.msg.failedLabel}`;
|
|
1772
|
-
const
|
|
1773
|
-
return t +
|
|
1654
|
+
const i = e.pages ? ` · ${v(this.msg.pagesLabel, { n: e.pages })}` : "";
|
|
1655
|
+
return t + i;
|
|
1774
1656
|
}
|
|
1775
1657
|
renderRow(e) {
|
|
1776
1658
|
const t = this.allowRename && e.status === "ready";
|
|
1777
|
-
return e.status === "uploading" || e.status,
|
|
1659
|
+
return e.status === "uploading" || e.status, u`<div class="row" part="file">
|
|
1778
1660
|
<div class="chip" part="file-type">
|
|
1779
|
-
${e.preview ?
|
|
1661
|
+
${e.preview ? u`<img class="thumb" src=${e.preview} alt="" part="preview" />` : Pe(e.name) || "FILE"}
|
|
1780
1662
|
</div>
|
|
1781
1663
|
<div class="meta">
|
|
1782
|
-
${this.editing === e.key ?
|
|
1664
|
+
${this.editing === e.key ? u`<input
|
|
1783
1665
|
class="name-input"
|
|
1784
1666
|
.value=${e.name}
|
|
1785
1667
|
autofocus
|
|
1786
|
-
@keydown=${(
|
|
1787
|
-
|
|
1668
|
+
@keydown=${(i) => {
|
|
1669
|
+
i.key === "Enter" ? this.commitRename(e, i.target.value) : i.key === "Escape" && (this.editing = "");
|
|
1788
1670
|
}}
|
|
1789
|
-
@blur=${(
|
|
1790
|
-
/>` : t ?
|
|
1671
|
+
@blur=${(i) => this.commitRename(e, i.target.value)}
|
|
1672
|
+
/>` : t ? u`<button
|
|
1791
1673
|
class="name"
|
|
1792
1674
|
title=${this.msg.rename}
|
|
1793
1675
|
@click=${() => {
|
|
@@ -1795,40 +1677,40 @@ let s = (ye = class extends Ce {
|
|
|
1795
1677
|
}}
|
|
1796
1678
|
>
|
|
1797
1679
|
${e.name}
|
|
1798
|
-
</button>` :
|
|
1680
|
+
</button>` : u`<div class="name">${e.name}</div>`}
|
|
1799
1681
|
<div class="sz" data-state=${e.status}>${this.renderStatus(e)}</div>
|
|
1800
|
-
${e.status === "uploading" ?
|
|
1682
|
+
${e.status === "uploading" ? u`<div class="bar" part="progress">
|
|
1801
1683
|
<div class="bar-fill" style="width:${e.percent}%"></div>
|
|
1802
1684
|
</div>` : x}
|
|
1803
1685
|
</div>
|
|
1804
1686
|
<div class="row-act">
|
|
1805
|
-
${e.status === "error" ?
|
|
1687
|
+
${e.status === "error" ? u`<button class="link-sm" @click=${() => void this.upload()}>
|
|
1806
1688
|
${this.msg.retry}
|
|
1807
1689
|
</button>` : x}
|
|
1808
|
-
${e.status === "uploading" || e.status === "done" ? x :
|
|
1690
|
+
${e.status === "uploading" || e.status === "done" ? x : u`<button class="link-sm" @click=${() => this.removeItem(e.key)}>
|
|
1809
1691
|
${this.msg.remove}
|
|
1810
1692
|
</button>`}
|
|
1811
1693
|
</div>
|
|
1812
1694
|
</div>`;
|
|
1813
1695
|
}
|
|
1814
1696
|
renderRows() {
|
|
1815
|
-
return this.items.length ?
|
|
1697
|
+
return this.items.length ? u`<div class="rows" part="files">
|
|
1816
1698
|
${this.items.map((e) => this.renderRow(e))}
|
|
1817
1699
|
</div>` : x;
|
|
1818
1700
|
}
|
|
1819
1701
|
renderDropzone() {
|
|
1820
|
-
return
|
|
1702
|
+
return u`<div class="drop" part="dropzone" data-drag=${String(this.dragging)}>
|
|
1821
1703
|
<div class="arrow" aria-hidden="true">↑</div>
|
|
1822
1704
|
<div class="drop-title">${this.msg.dropTitle}</div>
|
|
1823
1705
|
<button class="link" @click=${this.open}>${this.msg.dropSub}</button>
|
|
1824
|
-
${this.hint ?
|
|
1706
|
+
${this.hint ? u`<div class="hint">${this.hint}</div>` : x}
|
|
1825
1707
|
</div>`;
|
|
1826
1708
|
}
|
|
1827
1709
|
renderUploadCta() {
|
|
1828
1710
|
const e = this.pendingCount;
|
|
1829
1711
|
if (this.autoUpload || !e && !this.busy) return x;
|
|
1830
1712
|
const t = e === 1 ? this.msg.uploadCtaOne : this.msg.uploadCtaMany;
|
|
1831
|
-
return
|
|
1713
|
+
return u`<button
|
|
1832
1714
|
class="primary wide"
|
|
1833
1715
|
part="submit"
|
|
1834
1716
|
?disabled=${this.busy || this.checking}
|
|
@@ -1843,26 +1725,26 @@ let s = (ye = class extends Ce {
|
|
|
1843
1725
|
*/
|
|
1844
1726
|
renderFull() {
|
|
1845
1727
|
const e = this.dropzone && !this.items.length && this.canAddMore;
|
|
1846
|
-
return
|
|
1728
|
+
return u`<div
|
|
1847
1729
|
class="card"
|
|
1848
1730
|
part="card"
|
|
1849
1731
|
@dragover=${this.onDragOver}
|
|
1850
1732
|
@dragleave=${this.onDragLeave}
|
|
1851
1733
|
@drop=${this.onDrop}
|
|
1852
1734
|
>
|
|
1853
|
-
${this.logoUrl || this.logoText || this.heading || this.description ?
|
|
1735
|
+
${this.logoUrl || this.logoText || this.heading || this.description ? u`<div class="head-block">
|
|
1854
1736
|
${this.renderLogo()}
|
|
1855
|
-
${this.heading ?
|
|
1856
|
-
${this.description ?
|
|
1737
|
+
${this.heading ? u`<div class="title">${this.heading}</div>` : x}
|
|
1738
|
+
${this.description ? u`<div class="sub">${this.description}</div>` : x}
|
|
1857
1739
|
</div>` : x}
|
|
1858
1740
|
${this.renderCount()} ${this.renderNotice()} ${this.renderRows()}
|
|
1859
1741
|
${e ? this.renderDropzone() : x}
|
|
1860
|
-
${!e && this.canAddMore ?
|
|
1742
|
+
${!e && this.canAddMore ? u`<button class="add-more" @click=${this.open}>${this.msg.addMore}</button>` : x}
|
|
1861
1743
|
${this.renderUploadCta()} ${this.renderBranding()}
|
|
1862
1744
|
</div>`;
|
|
1863
1745
|
}
|
|
1864
1746
|
renderCompact() {
|
|
1865
|
-
return
|
|
1747
|
+
return u`<div
|
|
1866
1748
|
class="card"
|
|
1867
1749
|
part="card"
|
|
1868
1750
|
@dragover=${this.onDragOver}
|
|
@@ -1873,36 +1755,37 @@ let s = (ye = class extends Ce {
|
|
|
1873
1755
|
<span class="sec-title">${this.heading || this.msg.attachments}</span>
|
|
1874
1756
|
<span class="count">${this.items.length} / ${this.maxFiles}</span>
|
|
1875
1757
|
</div>
|
|
1876
|
-
${this.dropzone ?
|
|
1758
|
+
${this.dropzone ? u`<div class="strip" part="dropzone" data-drag=${String(this.dragging)}>
|
|
1877
1759
|
<span class="strip-label">${this.msg.dropOrChoose}</span>
|
|
1878
1760
|
<button class="secondary" ?disabled=${!this.canAddMore} @click=${this.open}>
|
|
1879
1761
|
${this.msg.chooseFiles}
|
|
1880
1762
|
</button>
|
|
1881
|
-
</div>` :
|
|
1763
|
+
</div>` : u`<button class="secondary" ?disabled=${!this.canAddMore} @click=${this.open}>
|
|
1882
1764
|
${this.msg.chooseFiles}
|
|
1883
1765
|
</button>`}
|
|
1884
|
-
${this.hint ?
|
|
1766
|
+
${this.hint ? u`<div class="hint">${this.hint}</div>` : x} ${this.renderNotice()}
|
|
1885
1767
|
${this.renderRows()} ${this.renderUploadCta()} ${this.renderBranding()}
|
|
1886
1768
|
</div>`;
|
|
1887
1769
|
}
|
|
1888
1770
|
renderButton() {
|
|
1889
1771
|
const e = this.items[this.items.length - 1];
|
|
1890
|
-
return
|
|
1772
|
+
return u`<div class="button-view">
|
|
1891
1773
|
<button class="primary" ?disabled=${this.busy || !this.canAddMore} @click=${this.open}>
|
|
1892
1774
|
${this.busy ? this.msg.uploading : this.msg.chooseFile}
|
|
1893
1775
|
</button>
|
|
1894
|
-
${e && e.status !== "ready" ?
|
|
1776
|
+
${e && e.status !== "ready" ? u`<div class="sz" data-state=${e.status}>${this.renderStatus(e)}</div>` : x}
|
|
1895
1777
|
${this.renderNotice()}
|
|
1896
1778
|
</div>`;
|
|
1897
1779
|
}
|
|
1898
1780
|
render() {
|
|
1899
|
-
return
|
|
1781
|
+
return u`${this.renderInput()}${this.view === "button" ? this.renderButton() : this.view === "compact" ? this.renderCompact() : this.renderFull()}`;
|
|
1900
1782
|
}
|
|
1901
|
-
}, k = new WeakMap(), z = new WeakMap(), $ = new WeakMap(), U = new WeakMap(), S = new WeakMap(),
|
|
1902
|
-
|
|
1903
|
-
|
|
1783
|
+
}, k = new WeakMap(), z = new WeakMap(), $ = new WeakMap(), U = new WeakMap(), S = new WeakMap(), M = new WeakMap(), C = new WeakMap(), T = new WeakMap(), j = new WeakMap(), F = new WeakMap(), O = new WeakMap(), D = new WeakMap(), E = new WeakMap(), L = new WeakMap(), A = new WeakMap(), N = new WeakMap(), P = new WeakMap(), R = new WeakMap(), B = new WeakMap(), G = new WeakMap(), I = new WeakMap(), _ = new WeakMap(), K = new WeakMap(), q = new WeakMap(), V = new WeakMap(), Y = new WeakMap(), H = new WeakMap(), J = new WeakMap(), X = new WeakMap(), W = new WeakMap(), Z = new WeakMap(), Q = new WeakMap(), ee = new WeakMap(), ve);
|
|
1784
|
+
Qe(o, "styles", [
|
|
1785
|
+
je,
|
|
1786
|
+
Re,
|
|
1904
1787
|
Fe,
|
|
1905
|
-
|
|
1788
|
+
ye`
|
|
1906
1789
|
.card {
|
|
1907
1790
|
display: flex;
|
|
1908
1791
|
flex-direction: column;
|
|
@@ -1912,7 +1795,7 @@ Ze(s, "styles", [
|
|
|
1912
1795
|
background: var(--sb-surface, #ffffff);
|
|
1913
1796
|
color: var(--sb-ink, #16181a);
|
|
1914
1797
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
1915
|
-
border-radius: calc(var(--sb-radius, 4px) + 4px);
|
|
1798
|
+
border-radius: calc((var(--sb-radius, 4px) + 4px) * var(--sb-radius-scale, 1));
|
|
1916
1799
|
}
|
|
1917
1800
|
|
|
1918
1801
|
.logo-img {
|
|
@@ -1954,7 +1837,7 @@ Ze(s, "styles", [
|
|
|
1954
1837
|
padding: 30px 20px;
|
|
1955
1838
|
text-align: center;
|
|
1956
1839
|
border: 1px dashed var(--sb-border-strong, #cdd1d6);
|
|
1957
|
-
border-radius: calc(var(--sb-radius, 4px) + 2px);
|
|
1840
|
+
border-radius: calc((var(--sb-radius, 4px) + 2px) * var(--sb-radius-scale, 1));
|
|
1958
1841
|
background: var(--sb-surface, #ffffff);
|
|
1959
1842
|
transition:
|
|
1960
1843
|
border-color 0.15s,
|
|
@@ -1994,7 +1877,7 @@ Ze(s, "styles", [
|
|
|
1994
1877
|
gap: 12px;
|
|
1995
1878
|
padding: 10px 12px;
|
|
1996
1879
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
1997
|
-
border-radius: calc(var(--sb-radius, 4px) + 2px);
|
|
1880
|
+
border-radius: calc((var(--sb-radius, 4px) + 2px) * var(--sb-radius-scale, 1));
|
|
1998
1881
|
background: var(--sb-surface-alt, #fafafa);
|
|
1999
1882
|
transition:
|
|
2000
1883
|
border-color 0.15s,
|
|
@@ -2041,7 +1924,7 @@ Ze(s, "styles", [
|
|
|
2041
1924
|
color: var(--sb-muted-ink, #61666c);
|
|
2042
1925
|
background: var(--sb-surface-alt, #fafafa);
|
|
2043
1926
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
2044
|
-
border-radius: var(--sb-radius, 4px);
|
|
1927
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
2045
1928
|
overflow: hidden;
|
|
2046
1929
|
}
|
|
2047
1930
|
|
|
@@ -2130,7 +2013,7 @@ Ze(s, "styles", [
|
|
|
2130
2013
|
color: var(--sb-ink, #16181a);
|
|
2131
2014
|
background: none;
|
|
2132
2015
|
border: 1px dashed var(--sb-border-strong, #cdd1d6);
|
|
2133
|
-
border-radius: calc(var(--sb-radius, 4px) + 2px);
|
|
2016
|
+
border-radius: calc((var(--sb-radius, 4px) + 2px) * var(--sb-radius-scale, 1));
|
|
2134
2017
|
}
|
|
2135
2018
|
|
|
2136
2019
|
button.add-more:hover:not(:disabled) {
|
|
@@ -2143,25 +2026,6 @@ Ze(s, "styles", [
|
|
|
2143
2026
|
font-size: 14px;
|
|
2144
2027
|
}
|
|
2145
2028
|
|
|
2146
|
-
.branding {
|
|
2147
|
-
text-align: center;
|
|
2148
|
-
font-family: var(--sb-mono, "Geist Mono", ui-monospace, monospace);
|
|
2149
|
-
font-size: 10.5px;
|
|
2150
|
-
letter-spacing: 0.06em;
|
|
2151
|
-
color: var(--sb-muted-ink, #61666c);
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
.branding a {
|
|
2155
|
-
color: inherit;
|
|
2156
|
-
text-decoration: none;
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2159
|
-
.branding a:hover {
|
|
2160
|
-
color: var(--sb-ink, #16181a);
|
|
2161
|
-
text-decoration: underline;
|
|
2162
|
-
text-underline-offset: 3px;
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2165
2029
|
/* the button view is just a control, not a card */
|
|
2166
2030
|
:host([view="button"]) {
|
|
2167
2031
|
display: inline-block;
|
|
@@ -2175,116 +2039,121 @@ Ze(s, "styles", [
|
|
|
2175
2039
|
`
|
|
2176
2040
|
]);
|
|
2177
2041
|
p([
|
|
2178
|
-
|
|
2179
|
-
],
|
|
2042
|
+
b({ attribute: !1 })
|
|
2043
|
+
], o.prototype, "client", 1);
|
|
2044
|
+
p([
|
|
2045
|
+
b({ attribute: !1 })
|
|
2046
|
+
], o.prototype, "messages", 1);
|
|
2180
2047
|
p([
|
|
2181
|
-
|
|
2182
|
-
],
|
|
2048
|
+
b({ reflect: !0 })
|
|
2049
|
+
], o.prototype, "theme", 1);
|
|
2183
2050
|
p([
|
|
2184
|
-
|
|
2185
|
-
],
|
|
2051
|
+
b({ reflect: !0 })
|
|
2052
|
+
], o.prototype, "density", 1);
|
|
2186
2053
|
p([
|
|
2187
|
-
|
|
2188
|
-
],
|
|
2054
|
+
b({ reflect: !0 })
|
|
2055
|
+
], o.prototype, "radius", 1);
|
|
2189
2056
|
p([
|
|
2190
|
-
|
|
2191
|
-
],
|
|
2057
|
+
b({ reflect: !0 })
|
|
2058
|
+
], o.prototype, "view", 1);
|
|
2192
2059
|
p([
|
|
2193
|
-
|
|
2194
|
-
],
|
|
2060
|
+
b({ converter: pe })
|
|
2061
|
+
], o.prototype, "dropzone", 1);
|
|
2195
2062
|
p([
|
|
2196
|
-
|
|
2197
|
-
],
|
|
2063
|
+
b({ converter: pe, attribute: "allow-rename" })
|
|
2064
|
+
], o.prototype, "allowRename", 1);
|
|
2198
2065
|
p([
|
|
2199
|
-
|
|
2200
|
-
],
|
|
2066
|
+
b({ type: Boolean, attribute: "auto-upload" })
|
|
2067
|
+
], o.prototype, "autoUpload", 1);
|
|
2201
2068
|
p([
|
|
2202
|
-
|
|
2203
|
-
],
|
|
2069
|
+
b({ converter: pe })
|
|
2070
|
+
], o.prototype, "branding", 1);
|
|
2204
2071
|
p([
|
|
2205
|
-
|
|
2206
|
-
],
|
|
2072
|
+
b({ attribute: "branding-text" })
|
|
2073
|
+
], o.prototype, "brandingText", 1);
|
|
2207
2074
|
p([
|
|
2208
|
-
|
|
2209
|
-
],
|
|
2075
|
+
b({ attribute: "branding-url" })
|
|
2076
|
+
], o.prototype, "brandingUrl", 1);
|
|
2210
2077
|
p([
|
|
2211
|
-
|
|
2212
|
-
],
|
|
2078
|
+
b({ attribute: "logo-url" })
|
|
2079
|
+
], o.prototype, "logoUrl", 1);
|
|
2213
2080
|
p([
|
|
2214
|
-
|
|
2215
|
-
],
|
|
2081
|
+
b({ attribute: "logo-text" })
|
|
2082
|
+
], o.prototype, "logoText", 1);
|
|
2216
2083
|
p([
|
|
2217
|
-
|
|
2218
|
-
],
|
|
2084
|
+
b()
|
|
2085
|
+
], o.prototype, "heading", 1);
|
|
2219
2086
|
p([
|
|
2220
|
-
|
|
2221
|
-
],
|
|
2087
|
+
b()
|
|
2088
|
+
], o.prototype, "description", 1);
|
|
2222
2089
|
p([
|
|
2223
|
-
|
|
2224
|
-
],
|
|
2090
|
+
b({ type: Number, attribute: "max-files" })
|
|
2091
|
+
], o.prototype, "maxFiles", 1);
|
|
2225
2092
|
p([
|
|
2226
|
-
|
|
2227
|
-
],
|
|
2093
|
+
b({ attribute: "max-size" })
|
|
2094
|
+
], o.prototype, "maxSize", 1);
|
|
2228
2095
|
p([
|
|
2229
|
-
|
|
2230
|
-
],
|
|
2096
|
+
b({ attribute: "min-size" })
|
|
2097
|
+
], o.prototype, "minSize", 1);
|
|
2231
2098
|
p([
|
|
2232
|
-
|
|
2233
|
-
],
|
|
2099
|
+
b()
|
|
2100
|
+
], o.prototype, "accept", 1);
|
|
2234
2101
|
p([
|
|
2235
|
-
|
|
2236
|
-
],
|
|
2102
|
+
b({ converter: ce })
|
|
2103
|
+
], o.prototype, "rules", 1);
|
|
2237
2104
|
p([
|
|
2238
|
-
|
|
2239
|
-
],
|
|
2105
|
+
b()
|
|
2106
|
+
], o.prototype, "bucket", 1);
|
|
2240
2107
|
p([
|
|
2241
|
-
|
|
2242
|
-
],
|
|
2108
|
+
b({ converter: ce })
|
|
2109
|
+
], o.prototype, "metadata", 1);
|
|
2243
2110
|
p([
|
|
2244
|
-
|
|
2245
|
-
],
|
|
2111
|
+
b({ converter: ce })
|
|
2112
|
+
], o.prototype, "options", 1);
|
|
2246
2113
|
p([
|
|
2247
|
-
|
|
2248
|
-
],
|
|
2114
|
+
b({ type: Boolean, attribute: "public-read" })
|
|
2115
|
+
], o.prototype, "publicRead", 1);
|
|
2249
2116
|
p([
|
|
2250
|
-
|
|
2251
|
-
],
|
|
2117
|
+
b({ attribute: "redirect-url" })
|
|
2118
|
+
], o.prototype, "redirectUrl", 1);
|
|
2252
2119
|
p([
|
|
2253
|
-
|
|
2254
|
-
],
|
|
2120
|
+
b({ attribute: !1 })
|
|
2121
|
+
], o.prototype, "onComplete", 1);
|
|
2255
2122
|
p([
|
|
2256
|
-
|
|
2257
|
-
],
|
|
2123
|
+
b({ attribute: !1 })
|
|
2124
|
+
], o.prototype, "onError", 1);
|
|
2258
2125
|
p([
|
|
2259
|
-
|
|
2260
|
-
],
|
|
2126
|
+
te()
|
|
2127
|
+
], o.prototype, "items", 1);
|
|
2261
2128
|
p([
|
|
2262
|
-
|
|
2263
|
-
],
|
|
2129
|
+
te()
|
|
2130
|
+
], o.prototype, "notice", 1);
|
|
2264
2131
|
p([
|
|
2265
|
-
|
|
2266
|
-
],
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
],
|
|
2270
|
-
|
|
2132
|
+
te()
|
|
2133
|
+
], o.prototype, "busy", 1);
|
|
2134
|
+
p([
|
|
2135
|
+
te()
|
|
2136
|
+
], o.prototype, "dragging", 1);
|
|
2137
|
+
p([
|
|
2138
|
+
te()
|
|
2139
|
+
], o.prototype, "editing", 1);
|
|
2140
|
+
o = p([
|
|
2141
|
+
Ce("singlebase-uploader")
|
|
2142
|
+
], o);
|
|
2143
|
+
function et(r) {
|
|
2271
2144
|
return !r.type.startsWith("image/") || typeof URL.createObjectURL != "function" ? "" : URL.createObjectURL(r);
|
|
2272
2145
|
}
|
|
2273
2146
|
function w(r) {
|
|
2274
2147
|
r.preview && URL.revokeObjectURL(r.preview);
|
|
2275
2148
|
}
|
|
2276
|
-
function
|
|
2149
|
+
function tt(r) {
|
|
2277
2150
|
return r instanceof Error ? r.message : "";
|
|
2278
2151
|
}
|
|
2279
2152
|
export {
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
Ke as
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
_e as i,
|
|
2286
|
-
Oe as r,
|
|
2287
|
-
Fe as s,
|
|
2288
|
-
Te as t
|
|
2153
|
+
o as S,
|
|
2154
|
+
qe as a,
|
|
2155
|
+
Ke as i,
|
|
2156
|
+
Be as r,
|
|
2157
|
+
Re as s
|
|
2289
2158
|
};
|
|
2290
|
-
//# sourceMappingURL=uploader-
|
|
2159
|
+
//# sourceMappingURL=uploader-vfczkX51.js.map
|