@scaleflex/uploader 0.2.5 → 0.2.7

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.
@@ -1,8 +1,8 @@
1
- import { LitElement as U, css as S, svg as R, html as l, render as T, nothing as c } from "lit";
2
- import { property as b, state as g, query as je } from "lit/decorators.js";
3
- import { unsafeSVG as O } from "lit/directives/unsafe-svg.js";
1
+ import { LitElement as U, css as S, svg as O, html as l, render as T, nothing as c } from "lit";
2
+ import { property as b, state as g, query as Fe } from "lit/decorators.js";
3
+ import { unsafeSVG as F } from "lit/directives/unsafe-svg.js";
4
4
  import { unsafeHTML as M } from "lit/directives/unsafe-html.js";
5
- class Fe {
5
+ class Me {
6
6
  constructor(e) {
7
7
  this.listeners = /* @__PURE__ */ new Set(), this._notifying = !1, this._pendingState = null, this.state = e;
8
8
  }
@@ -17,13 +17,13 @@ class Fe {
17
17
  const t = this.state;
18
18
  this.state = { ...t, ...e }, this._notifying = !0;
19
19
  try {
20
- this.listeners.forEach((i) => i(this.state, t));
20
+ this.listeners.forEach((o) => o(this.state, t));
21
21
  } finally {
22
22
  this._notifying = !1;
23
23
  }
24
24
  if (this._pendingState) {
25
- const i = this._pendingState;
26
- this._pendingState = null, this.setState(i);
25
+ const o = this._pendingState;
26
+ this._pendingState = null, this.setState(o);
27
27
  }
28
28
  }
29
29
  subscribe(e) {
@@ -34,23 +34,23 @@ class Fe {
34
34
  }
35
35
  }
36
36
  function P(a, e, t) {
37
- const i = a.getState().files, r = i.get(e);
37
+ const o = a.getState().files, r = o.get(e);
38
38
  if (!r) return;
39
- const o = new Map(i);
40
- o.set(e, { ...r, ...t }), a.setState({ files: o });
39
+ const i = new Map(o);
40
+ i.set(e, { ...r, ...t }), a.setState({ files: i });
41
41
  }
42
42
  function H(a, e) {
43
43
  const t = new Map(a.getState().files);
44
44
  t.set(e.id, e), a.setState({ files: t });
45
45
  }
46
- function Ce(a, e) {
46
+ function Se(a, e) {
47
47
  const t = a.getState().files;
48
48
  if (!t.has(e)) return;
49
- const i = new Map(t);
50
- i.delete(e), a.setState({ files: i });
49
+ const o = new Map(t);
50
+ o.delete(e), a.setState({ files: o });
51
51
  }
52
- function Oe() {
53
- return new Fe({
52
+ function Te() {
53
+ return new Me({
54
54
  files: /* @__PURE__ */ new Map(),
55
55
  queueConfig: {
56
56
  concurrency: 3,
@@ -79,7 +79,7 @@ function Oe() {
79
79
  isUploading: !1
80
80
  });
81
81
  }
82
- class Re {
82
+ class Be {
83
83
  constructor(e, t) {
84
84
  this.host = e, this.store = t, e.addController(this);
85
85
  }
@@ -99,17 +99,17 @@ class Re {
99
99
  (e = this.unsubscribe) == null || e.call(this);
100
100
  }
101
101
  }
102
- function Me(a, e) {
102
+ function Le(a, e) {
103
103
  const t = new XMLHttpRequest();
104
- let i = !1;
105
- const o = `${e.apiBase.replace(/\/+$/, "")}/v4/files?folder=${encodeURIComponent(e.folder)}`;
106
- t.open("POST", o);
104
+ let o = !1;
105
+ const i = `${e.apiBase.replace(/\/+$/, "")}/v4/files?folder=${encodeURIComponent(e.folder)}`;
106
+ t.open("POST", i);
107
107
  for (const [n, d] of Object.entries(e.authHeaders))
108
108
  t.setRequestHeader(n, d);
109
109
  t.upload.addEventListener("progress", (n) => {
110
- n.lengthComputable && !i && e.onProgress(n.loaded, n.total);
110
+ n.lengthComputable && !o && e.onProgress(n.loaded, n.total);
111
111
  }), t.addEventListener("load", () => {
112
- if (i) return;
112
+ if (o) return;
113
113
  let n;
114
114
  try {
115
115
  n = JSON.parse(t.responseText);
@@ -119,9 +119,9 @@ function Me(a, e) {
119
119
  }
120
120
  t.status >= 200 && t.status < 300 && n.status === "success" ? e.onComplete(n) : e.onError(new Error(n.hint || n.msg || `Upload failed (HTTP ${t.status})`));
121
121
  }), t.addEventListener("error", () => {
122
- i || e.onError(new Error("Network error — check your connection"));
122
+ o || e.onError(new Error("Network error — check your connection"));
123
123
  }), t.addEventListener("timeout", () => {
124
- i || e.onError(new Error("Upload timed out"));
124
+ o || e.onError(new Error("Upload timed out"));
125
125
  });
126
126
  const s = new FormData();
127
127
  if (a.file) {
@@ -133,19 +133,19 @@ function Me(a, e) {
133
133
  }
134
134
  return t.timeout = 6e4, t.send(s), {
135
135
  abort() {
136
- i = !0, t.abort();
136
+ o = !0, t.abort();
137
137
  }
138
138
  };
139
139
  }
140
- function Te(a, e) {
140
+ function Ae(a, e) {
141
141
  const t = new XMLHttpRequest();
142
- let i = !1;
143
- const o = `${e.apiBase.replace(/\/+$/, "")}/v4/files/upload_url`;
144
- t.open("POST", o);
142
+ let o = !1;
143
+ const i = `${e.apiBase.replace(/\/+$/, "")}/v4/files/upload_url`;
144
+ t.open("POST", i);
145
145
  for (const [n, d] of Object.entries(e.authHeaders))
146
146
  t.setRequestHeader(n, d);
147
147
  if (t.setRequestHeader("Content-Type", "application/json"), t.addEventListener("load", () => {
148
- if (i) return;
148
+ if (o) return;
149
149
  let n;
150
150
  try {
151
151
  n = JSON.parse(t.responseText);
@@ -155,9 +155,9 @@ function Te(a, e) {
155
155
  }
156
156
  t.status >= 200 && t.status < 300 && n.status === "success" ? e.onComplete(n) : e.onError(new Error(n.hint || n.msg || `Upload failed (HTTP ${t.status})`));
157
157
  }), t.addEventListener("error", () => {
158
- i || e.onError(new Error("Network error — check your connection"));
158
+ o || e.onError(new Error("Network error — check your connection"));
159
159
  }), t.addEventListener("timeout", () => {
160
- i || e.onError(new Error("Upload timed out"));
160
+ o || e.onError(new Error("Upload timed out"));
161
161
  }), !a.remoteUrl)
162
162
  return e.onError(new Error("Remote URL is required for URL upload")), { abort() {
163
163
  } };
@@ -167,7 +167,7 @@ function Te(a, e) {
167
167
  };
168
168
  return t.timeout = 6e4, t.send(JSON.stringify(s)), {
169
169
  abort() {
170
- i = !0, t.abort();
170
+ o = !0, t.abort();
171
171
  }
172
172
  };
173
173
  }
@@ -181,7 +181,7 @@ function re(a) {
181
181
  function N(a) {
182
182
  return a.replace(/\/+$/, "");
183
183
  }
184
- const Be = {
184
+ const Ie = {
185
185
  "google-drive": "drive",
186
186
  dropbox: "dropbox",
187
187
  onedrive: "onedrive",
@@ -191,42 +191,42 @@ const Be = {
191
191
  unsplash: "unsplash"
192
192
  };
193
193
  function G(a) {
194
- return Be[a] ?? a;
194
+ return Ie[a] ?? a;
195
195
  }
196
- function mt(a, e) {
197
- const t = N(a), i = btoa(JSON.stringify({ origin: window.location.origin })), r = G(e);
198
- return `${t}/${r}/connect?state=${encodeURIComponent(i)}`;
196
+ function _t(a, e) {
197
+ const t = N(a), o = btoa(JSON.stringify({ origin: window.location.origin })), r = G(e);
198
+ return `${t}/${r}/connect?state=${encodeURIComponent(o)}`;
199
199
  }
200
- async function wt(a, e, t, i = "") {
201
- const r = N(a), o = i ? `/${i}` : "", s = G(e), n = await fetch(`${r}/${s}/list${o}`, {
200
+ async function kt(a, e, t, o = "") {
201
+ const r = N(a), i = o ? `/${o}` : "", s = G(e), n = await fetch(`${r}/${s}/list${i}`, {
202
202
  method: "GET",
203
203
  headers: re(t),
204
204
  credentials: "same-origin"
205
205
  });
206
206
  if (n.status === 401)
207
- throw new de();
207
+ throw new ce();
208
208
  if (!n.ok) {
209
209
  const d = await n.json().catch(() => null);
210
210
  throw new Error((d == null ? void 0 : d.message) || `Companion list failed (HTTP ${n.status})`);
211
211
  }
212
212
  return n.json();
213
213
  }
214
- async function yt(a, e, t) {
215
- const i = N(a), r = await fetch(`${i}/${t}`, {
214
+ async function Ct(a, e, t) {
215
+ const o = N(a), r = await fetch(`${o}/${t}`, {
216
216
  method: "GET",
217
217
  headers: re(e),
218
218
  credentials: "same-origin"
219
219
  });
220
220
  if (r.status === 401)
221
- throw new de();
221
+ throw new ce();
222
222
  if (!r.ok) {
223
- const o = await r.json().catch(() => null);
224
- throw new Error((o == null ? void 0 : o.message) || `Companion list failed (HTTP ${r.status})`);
223
+ const i = await r.json().catch(() => null);
224
+ throw new Error((i == null ? void 0 : i.message) || `Companion list failed (HTTP ${r.status})`);
225
225
  }
226
226
  return r.json();
227
227
  }
228
- async function _t(a, e, t, i) {
229
- const r = N(a), o = G(e), s = i ? `q=${encodeURIComponent(t)}&${i}` : `q=${encodeURIComponent(t)}`, n = await fetch(`${r}/search/${o}/list?${s}`, {
228
+ async function $t(a, e, t, o) {
229
+ const r = N(a), i = G(e), s = o ? `q=${encodeURIComponent(t)}&${o}` : `q=${encodeURIComponent(t)}`, n = await fetch(`${r}/search/${i}/list?${s}`, {
230
230
  method: "GET",
231
231
  headers: {
232
232
  Accept: "application/json",
@@ -240,8 +240,8 @@ async function _t(a, e, t, i) {
240
240
  }
241
241
  return n.json();
242
242
  }
243
- async function Le(a, e, t, i, r, o = !1) {
244
- const s = N(a), n = G(e), d = o ? `${s}/search/${n}/get/${i}` : `${s}/${n}/get/${i}`, p = o ? { Accept: "application/json", "Content-Type": "application/json" } : re(t), h = await fetch(d, {
243
+ async function He(a, e, t, o, r, i = !1) {
244
+ const s = N(a), n = G(e), d = i ? `${s}/search/${n}/get/${o}` : `${s}/${n}/get/${o}`, p = i ? { Accept: "application/json", "Content-Type": "application/json" } : re(t), h = await fetch(d, {
245
245
  method: "POST",
246
246
  headers: p,
247
247
  credentials: "same-origin",
@@ -253,49 +253,49 @@ async function Le(a, e, t, i, r, o = !1) {
253
253
  })
254
254
  });
255
255
  if (h.status === 401)
256
- throw new de();
256
+ throw new ce();
257
257
  if (!h.ok) {
258
258
  const u = await h.json().catch(() => null);
259
259
  throw new Error((u == null ? void 0 : u.message) || `Companion upload failed (HTTP ${h.status})`);
260
260
  }
261
261
  return h.json();
262
262
  }
263
- async function kt(a, e, t) {
264
- const i = N(a), r = G(e), o = await fetch(`${i}/${r}/logout`, {
263
+ async function St(a, e, t) {
264
+ const o = N(a), r = G(e), i = await fetch(`${o}/${r}/logout`, {
265
265
  method: "GET",
266
266
  headers: re(t),
267
267
  credentials: "same-origin"
268
268
  });
269
- return o.ok ? o.json() : { ok: !1, revoked: !1 };
269
+ return i.ok ? i.json() : { ok: !1, revoked: !1 };
270
270
  }
271
- function Ae(a) {
271
+ function qe(a) {
272
272
  var r;
273
273
  const t = ((r = /^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(a)) == null ? void 0 : r[1]) ?? a;
274
274
  return `${location.protocol === "https:" ? "wss" : "ws"}://${t}`;
275
275
  }
276
- class de extends Error {
276
+ class ce extends Error {
277
277
  constructor() {
278
278
  super("Authentication expired"), this.name = "AuthExpiredError";
279
279
  }
280
280
  }
281
- function Ie(a, e) {
281
+ function Ye(a, e) {
282
282
  const t = a.remoteInfo;
283
283
  if (!t)
284
284
  return e.onError(new Error("remoteInfo is required for companion upload")), { abort() {
285
285
  } };
286
- let i = !1, r = null;
286
+ let o = !1, r = null;
287
287
  const s = `${e.apiBase.replace(/\/+$/, "")}/v4/files?folder=${encodeURIComponent(e.folder)}`, n = {};
288
288
  a.meta && Object.keys(a.meta).length > 0 && Object.assign(n, a.meta), a.tags && a.tags.length > 0 && (n.tags = a.tags);
289
289
  const d = !t.token;
290
- return Le(t.companionUrl, t.provider, t.token, t.requestPath, {
290
+ return He(t.companionUrl, t.provider, t.token, t.requestPath, {
291
291
  fileId: t.fileId,
292
292
  endpoint: s,
293
293
  headers: e.authHeaders,
294
294
  size: t.size,
295
295
  metadata: Object.keys(n).length > 0 ? n : void 0
296
296
  }, d).then((p) => {
297
- if (i) return;
298
- const u = `${Ae(t.companionUrl)}/api/${p.token}`;
297
+ if (o) return;
298
+ const u = `${qe(t.companionUrl)}/api/${p.token}`;
299
299
  try {
300
300
  r = new WebSocket(u);
301
301
  } catch {
@@ -304,7 +304,7 @@ function Ie(a, e) {
304
304
  }
305
305
  r.onmessage = (x) => {
306
306
  var f, m, _;
307
- if (!i)
307
+ if (!o)
308
308
  try {
309
309
  const w = JSON.parse(x.data);
310
310
  switch (w.action) {
@@ -346,15 +346,15 @@ function Ie(a, e) {
346
346
  } catch {
347
347
  }
348
348
  }, r.onerror = () => {
349
- i || e.onError(new Error("Upload progress connection failed"));
349
+ o || e.onError(new Error("Upload progress connection failed"));
350
350
  }, r.onclose = () => {
351
351
  r = null;
352
352
  };
353
353
  }).catch((p) => {
354
- i || e.onError(p instanceof Error ? p : new Error(String(p)));
354
+ o || e.onError(p instanceof Error ? p : new Error(String(p)));
355
355
  }), {
356
356
  abort() {
357
- if (i = !0, r) {
357
+ if (o = !0, r) {
358
358
  try {
359
359
  r.send(JSON.stringify({ action: "cancel", payload: {} }));
360
360
  } catch {
@@ -364,7 +364,7 @@ function Ie(a, e) {
364
364
  }
365
365
  };
366
366
  }
367
- class He {
367
+ class Ve {
368
368
  constructor(e, t) {
369
369
  this.activeUploads = /* @__PURE__ */ new Map(), this.retryTimers = /* @__PURE__ */ new Map(), this.unsubscribe = null, this.store = e, this.config = t;
370
370
  }
@@ -381,8 +381,8 @@ class He {
381
381
  uploadAll() {
382
382
  const { files: e } = this.store.getState();
383
383
  let t = !1;
384
- for (const i of e.values())
385
- i.status === "idle" ? (P(this.store, i.id, { status: "queued" }), t = !0) : i.status === "queued" && (t = !0);
384
+ for (const o of e.values())
385
+ o.status === "idle" ? (P(this.store, o.id, { status: "queued" }), t = !0) : o.status === "queued" && (t = !0);
386
386
  t && (this.store.setState({ isUploading: !0 }), this.processQueue());
387
387
  }
388
388
  /**
@@ -418,7 +418,7 @@ class He {
418
418
  */
419
419
  cancelFile(e) {
420
420
  const t = this.store.getState().files.get(e);
421
- !t || !$e(t.status) || (this.abortUpload(e), P(this.store, e, { status: "cancelled" }));
421
+ !t || !Ee(t.status) || (this.abortUpload(e), P(this.store, e, { status: "cancelled" }));
422
422
  }
423
423
  /**
424
424
  * Cancel all active/queued uploads.
@@ -426,7 +426,7 @@ class He {
426
426
  cancelAll() {
427
427
  const { files: e } = this.store.getState();
428
428
  for (const t of e.values())
429
- $e(t.status) && (this.abortUpload(t.id), P(this.store, t.id, { status: "cancelled" }));
429
+ Ee(t.status) && (this.abortUpload(t.id), P(this.store, t.id, { status: "cancelled" }));
430
430
  this.store.setState({ isUploading: !1 });
431
431
  }
432
432
  /**
@@ -450,7 +450,7 @@ class He {
450
450
  processQueue() {
451
451
  const e = this.store.getState();
452
452
  if (e.isPaused) return;
453
- const { concurrency: t } = e.queueConfig, i = this.activeUploads.size, r = t - i;
453
+ const { concurrency: t } = e.queueConfig, o = this.activeUploads.size, r = t - o;
454
454
  if (r <= 0) return;
455
455
  const s = [...e.files.values()].filter((n) => n.status === "queued").sort((n, d) => n.retryCount !== d.retryCount ? d.retryCount - n.retryCount : n.addedAt - d.addedAt).slice(0, r);
456
456
  for (const n of s)
@@ -458,25 +458,25 @@ class He {
458
458
  }
459
459
  startUpload(e) {
460
460
  P(this.store, e.id, { status: "uploading", error: null });
461
- let t = 0, i = Date.now(), r = 0;
462
- const o = {
461
+ let t = 0, o = Date.now(), r = 0;
462
+ const i = {
463
463
  apiBase: this.config.apiBase,
464
464
  authHeaders: this.config.authHeaders,
465
465
  folder: this.store.getState().targetFolder,
466
466
  onComplete: (d) => this.handleComplete(e.id, d),
467
467
  onError: (d) => this.handleError(e.id, d)
468
468
  }, s = (d, p) => {
469
- const h = Date.now(), u = (h - i) / 1e3;
469
+ const h = Date.now(), u = (h - o) / 1e3;
470
470
  if (u > 0) {
471
471
  const f = (d - t) / u;
472
472
  r = r === 0 ? f : 0.3 * f + 0.7 * r;
473
473
  }
474
- t = d, i = h;
474
+ t = d, o = h;
475
475
  const x = p > 0 ? Math.min(d / p * 100, 100) : 0;
476
476
  P(this.store, e.id, { progress: x, bytesUploaded: d, speed: r }), this.updateTotalProgress();
477
477
  };
478
478
  let n;
479
- e.remoteInfo ? n = Ie(e, { ...o, onProgress: s }) : e.remoteUrl ? n = Te(e, o) : n = Me(e, { ...o, onProgress: s }), this.activeUploads.set(e.id, n);
479
+ e.remoteInfo ? n = Ye(e, { ...i, onProgress: s }) : e.remoteUrl ? n = Ae(e, i) : n = Le(e, { ...i, onProgress: s }), this.activeUploads.set(e.id, n);
480
480
  }
481
481
  handleComplete(e, t) {
482
482
  this.activeUploads.delete(e), P(this.store, e, {
@@ -487,18 +487,18 @@ class He {
487
487
  }
488
488
  handleError(e, t) {
489
489
  this.activeUploads.delete(e);
490
- const i = this.store.getState().files.get(e);
491
- if (!i) return;
492
- const { retryConfig: r } = this.store.getState().queueConfig, o = i.retryCount + 1;
493
- if (o <= r.maxRetries) {
490
+ const o = this.store.getState().files.get(e);
491
+ if (!o) return;
492
+ const { retryConfig: r } = this.store.getState().queueConfig, i = o.retryCount + 1;
493
+ if (i <= r.maxRetries) {
494
494
  const s = Math.min(
495
- r.baseDelay * Math.pow(r.backoffFactor, i.retryCount),
495
+ r.baseDelay * Math.pow(r.backoffFactor, o.retryCount),
496
496
  r.maxDelay
497
497
  );
498
498
  P(this.store, e, {
499
499
  status: "retrying",
500
500
  error: t.message,
501
- retryCount: o
501
+ retryCount: i
502
502
  });
503
503
  const n = setTimeout(() => {
504
504
  this.retryTimers.delete(e), P(this.store, e, { status: "queued" }), this.processQueue();
@@ -511,48 +511,48 @@ class He {
511
511
  }), this.checkAllComplete(), this.processQueue();
512
512
  }
513
513
  abortUpload(e) {
514
- var i;
515
- (i = this.activeUploads.get(e)) == null || i.abort(), this.activeUploads.delete(e);
514
+ var o;
515
+ (o = this.activeUploads.get(e)) == null || o.abort(), this.activeUploads.delete(e);
516
516
  const t = this.retryTimers.get(e);
517
517
  t && (clearTimeout(t), this.retryTimers.delete(e));
518
518
  }
519
519
  updateTotalProgress() {
520
520
  const { files: e } = this.store.getState();
521
- let t = 0, i = 0, r = 0;
522
- for (const o of e.values())
523
- (o.status === "queued" || o.status === "uploading" || o.status === "retrying" || o.status === "complete" || o.status === "failed") && (t += o.size, i += o.status === "complete" ? o.size : o.bytesUploaded), o.status === "uploading" && (r += o.speed);
521
+ let t = 0, o = 0, r = 0;
522
+ for (const i of e.values())
523
+ (i.status === "queued" || i.status === "uploading" || i.status === "retrying" || i.status === "complete" || i.status === "failed") && (t += i.size, o += i.status === "complete" ? i.size : i.bytesUploaded), i.status === "uploading" && (r += i.speed);
524
524
  this.store.setState({
525
525
  totalBytes: t,
526
- totalBytesUploaded: i,
526
+ totalBytesUploaded: o,
527
527
  totalSpeed: r,
528
- totalProgress: t > 0 ? Math.min(i / t * 100, 100) : 0
528
+ totalProgress: t > 0 ? Math.min(o / t * 100, 100) : 0
529
529
  });
530
530
  }
531
531
  checkAllComplete() {
532
532
  const { files: e } = this.store.getState();
533
533
  ![...e.values()].some(
534
- (i) => i.status === "queued" || i.status === "uploading" || i.status === "retrying"
534
+ (o) => o.status === "queued" || o.status === "uploading" || o.status === "retrying"
535
535
  ) && this.store.getState().isUploading && this.store.setState({ isUploading: !1 });
536
536
  }
537
537
  }
538
- function $e(a) {
538
+ function Ee(a) {
539
539
  return a === "queued" || a === "uploading" || a === "retrying";
540
540
  }
541
- function pe(a) {
541
+ function fe(a) {
542
542
  return `https://api.filerobot.com/${a}`;
543
543
  }
544
- async function qe(a, e) {
545
- const t = `${pe(a)}/key/${encodeURIComponent(e)}`, i = new AbortController(), r = setTimeout(() => i.abort(), 3e4);
544
+ async function Ne(a, e) {
545
+ const t = `${fe(a)}/key/${encodeURIComponent(e)}`, o = new AbortController(), r = setTimeout(() => o.abort(), 3e4);
546
546
  try {
547
- const o = await fetch(t, { signal: i.signal });
548
- if (clearTimeout(r), !o.ok)
549
- throw new Error(`SASS key exchange failed (HTTP ${o.status})`);
550
- const s = await o.json();
547
+ const i = await fetch(t, { signal: o.signal });
548
+ if (clearTimeout(r), !i.ok)
549
+ throw new Error(`SASS key exchange failed (HTTP ${i.status})`);
550
+ const s = await i.json();
551
551
  if (s.status === "error")
552
552
  throw new Error(`SASS key exchange failed: ${s.msg || "Unknown error"}`);
553
553
  return s.key;
554
- } catch (o) {
555
- throw clearTimeout(r), o instanceof DOMException && o.name === "AbortError" ? new Error("SASS key exchange timed out") : o;
554
+ } catch (i) {
555
+ throw clearTimeout(r), i instanceof DOMException && i.name === "AbortError" ? new Error("SASS key exchange timed out") : i;
556
556
  }
557
557
  }
558
558
  function se(a, e) {
@@ -571,10 +571,10 @@ function se(a, e) {
571
571
  }
572
572
  return a.airboxPuid && (t["X-Filerobot-Airbox-Puid"] = a.airboxPuid), t;
573
573
  }
574
- async function Ye(a) {
575
- const e = pe(a.container);
574
+ async function Xe(a) {
575
+ const e = fe(a.container);
576
576
  if (a.mode === "security-template") {
577
- const t = await qe(a.container, a.securityTemplateId);
577
+ const t = await Ne(a.container, a.securityTemplateId);
578
578
  return { apiBase: e, headers: se(a, t), sassKey: t };
579
579
  }
580
580
  return { apiBase: e, headers: se(a) };
@@ -598,32 +598,32 @@ const v = {
598
598
  FILE_PREVIEW: "sfx-file-preview",
599
599
  FILL_METADATA: "sfx-fill-metadata"
600
600
  };
601
- let Ve = 0;
601
+ let We = 0;
602
602
  function q() {
603
- return `file-${Date.now()}-${++Ve}`;
603
+ return `file-${Date.now()}-${++We}`;
604
604
  }
605
605
  function Y(a) {
606
606
  if (a <= 0) return "0 B";
607
- const e = ["B", "KB", "MB", "GB"], t = Math.min(Math.floor(Math.log(a) / Math.log(1024)), e.length - 1), i = a / Math.pow(1024, t);
608
- return `${t === 0 ? i : i.toFixed(1)} ${e[t]}`;
607
+ const e = ["B", "KB", "MB", "GB"], t = Math.min(Math.floor(Math.log(a) / Math.log(1024)), e.length - 1), o = a / Math.pow(1024, t);
608
+ return `${t === 0 ? o : o.toFixed(1)} ${e[t]}`;
609
609
  }
610
- function oe(a) {
610
+ function ie(a) {
611
611
  if (!isFinite(a) || a <= 0) return "0s";
612
612
  const e = Math.round(a);
613
613
  if (e < 60) return `${e}s`;
614
- const t = Math.floor(e / 60), i = e % 60;
615
- return i > 0 ? `${t}m ${i}s` : `${t}m`;
614
+ const t = Math.floor(e / 60), o = e % 60;
615
+ return o > 0 ? `${t}m ${o}s` : `${t}m`;
616
616
  }
617
617
  function X(a) {
618
618
  var t;
619
619
  const e = ((t = a.name.split(".").pop()) == null ? void 0 : t.toLowerCase()) ?? "";
620
620
  return a.type.startsWith("image/") ? "image" : a.type.startsWith("video/") || ["mp4", "mov", "avi", "webm", "mkv"].includes(e) ? "vid" : a.type === "application/pdf" || e === "pdf" ? "pdf" : ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "rtf", "odt"].includes(e) ? "doc" : ["zip", "rar", "7z", "tar", "gz", "bz2"].includes(e) ? "zip" : "gen";
621
621
  }
622
- function Ne(a) {
622
+ function Ke(a) {
623
623
  const e = a.lastIndexOf(".");
624
624
  return e >= 0 ? a.slice(e + 1).toUpperCase() : "";
625
625
  }
626
- const Xe = {
626
+ const Ge = {
627
627
  jpg: "image/jpeg",
628
628
  jpeg: "image/jpeg",
629
629
  png: "image/png",
@@ -641,19 +641,19 @@ const Xe = {
641
641
  doc: "application/msword",
642
642
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
643
643
  };
644
- function We(a) {
644
+ function Ze(a) {
645
645
  var t;
646
646
  const e = ((t = a.split(".").pop()) == null ? void 0 : t.toLowerCase()) ?? "";
647
- return Xe[e] || "";
647
+ return Ge[e] || "";
648
648
  }
649
- function Ke(a) {
649
+ function Je(a) {
650
650
  return new Promise((e) => {
651
651
  const t = document.createElement("video");
652
652
  t.preload = "metadata", t.muted = !0, t.playsInline = !0;
653
- const i = URL.createObjectURL(a);
653
+ const o = URL.createObjectURL(a);
654
654
  let r = !1;
655
- const o = () => {
656
- r || (r = !0, e(null)), t.removeAttribute("src"), t.load(), URL.revokeObjectURL(i);
655
+ const i = () => {
656
+ r || (r = !0, e(null)), t.removeAttribute("src"), t.load(), URL.revokeObjectURL(o);
657
657
  };
658
658
  t.addEventListener("seeked", () => {
659
659
  try {
@@ -662,53 +662,53 @@ function Ke(a) {
662
662
  const n = s.getContext("2d");
663
663
  if (n) {
664
664
  n.drawImage(t, 0, 0, s.width, s.height), s.toBlob((d) => {
665
- r || (r = !0, e(d ? URL.createObjectURL(d) : null), t.removeAttribute("src"), t.load(), URL.revokeObjectURL(i));
665
+ r || (r = !0, e(d ? URL.createObjectURL(d) : null), t.removeAttribute("src"), t.load(), URL.revokeObjectURL(o));
666
666
  }, "image/jpeg", 0.7);
667
667
  return;
668
668
  }
669
669
  } catch {
670
670
  }
671
- o();
672
- }, { once: !0 }), t.addEventListener("error", () => o(), { once: !0 }), setTimeout(() => o(), 5e3), t.src = i, t.addEventListener("loadeddata", () => {
671
+ i();
672
+ }, { once: !0 }), t.addEventListener("error", () => i(), { once: !0 }), setTimeout(() => i(), 5e3), t.src = o, t.addEventListener("loadeddata", () => {
673
673
  t.currentTime = 0.1;
674
674
  }, { once: !0 });
675
675
  });
676
676
  }
677
677
  function ae(a, e, t) {
678
- var i, r;
678
+ var o, r;
679
679
  if (e.maxFileSize != null && a.size > 0 && a.size > e.maxFileSize)
680
680
  return `File exceeds ${(e.maxFileSize / 1048576).toFixed(1)} MB limit`;
681
681
  if (e.maxTotalFilesSize != null && a.size > 0) {
682
- let o = a.size;
682
+ let i = a.size;
683
683
  for (const s of t.values())
684
- s.status !== "rejected" && s.status !== "cancelled" && (o += s.size);
685
- if (o > e.maxTotalFilesSize)
684
+ s.status !== "rejected" && s.status !== "cancelled" && (i += s.size);
685
+ if (i > e.maxTotalFilesSize)
686
686
  return "Total file size limit exceeded";
687
687
  }
688
688
  if (e.maxNumberOfFiles != null) {
689
- let o = 0;
689
+ let i = 0;
690
690
  for (const s of t.values())
691
- s.status !== "rejected" && s.status !== "cancelled" && o++;
692
- if (o >= e.maxNumberOfFiles)
691
+ s.status !== "rejected" && s.status !== "cancelled" && i++;
692
+ if (i >= e.maxNumberOfFiles)
693
693
  return `Maximum ${e.maxNumberOfFiles} files allowed`;
694
694
  }
695
695
  if (e.allowedFileTypes != null) {
696
- const o = e.allowedFileTypes, s = "." + (((i = a.name.split(".").pop()) == null ? void 0 : i.toLowerCase()) ?? "");
697
- if (!o.some((d) => d.startsWith(".") ? s === d.toLowerCase() : d.endsWith("/*") ? a.type.startsWith(d.slice(0, -1)) : a.type === d)) return "File type not allowed";
696
+ const i = e.allowedFileTypes, s = "." + (((o = a.name.split(".").pop()) == null ? void 0 : o.toLowerCase()) ?? "");
697
+ if (!i.some((d) => d.startsWith(".") ? s === d.toLowerCase() : d.endsWith("/*") ? a.type.startsWith(d.slice(0, -1)) : a.type === d)) return "File type not allowed";
698
698
  }
699
699
  if (e.blockedFileTypes != null) {
700
- const o = e.blockedFileTypes, s = "." + (((r = a.name.split(".").pop()) == null ? void 0 : r.toLowerCase()) ?? "");
701
- if (o.some((d) => d.startsWith(".") ? s === d.toLowerCase() : d.endsWith("/*") ? a.type.startsWith(d.slice(0, -1)) : a.type === d)) return "File type is blocked";
700
+ const i = e.blockedFileTypes, s = "." + (((r = a.name.split(".").pop()) == null ? void 0 : r.toLowerCase()) ?? "");
701
+ if (i.some((d) => d.startsWith(".") ? s === d.toLowerCase() : d.endsWith("/*") ? a.type.startsWith(d.slice(0, -1)) : a.type === d)) return "File type is blocked";
702
702
  }
703
703
  return null;
704
704
  }
705
- function Ge(a, e, t) {
705
+ function Qe(a, e, t) {
706
706
  return ae(a, e, t);
707
707
  }
708
- function Se(a) {
708
+ function ze(a) {
709
709
  return a.allowedFileTypes ? a.allowedFileTypes.join(",") : "";
710
710
  }
711
- const Ee = {
711
+ const Pe = {
712
712
  "google-drive": {
713
713
  id: "google-drive",
714
714
  label: "Google Drive",
@@ -759,20 +759,20 @@ const Ee = {
759
759
  brandHtml: '<span class="brand-ico" style="background:#111"><svg width="12" height="12" viewBox="0 0 24 24" fill="white"><path d="M8.5 11.5v5h7v-5h5.5V21h-18v-9.5h5.5zm7-8v5h-7v-5h7z"/></svg></span>'
760
760
  }
761
761
  };
762
- function Ze(a) {
763
- return a.filter((e) => e in Ee).map((e) => Ee[e]);
762
+ function et(a) {
763
+ return a.filter((e) => e in Pe).map((e) => Pe[e]);
764
764
  }
765
- var Je = Object.defineProperty, Qe = (a, e, t, i) => {
766
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
767
- (s = a[o]) && (r = s(e, t, r) || r);
768
- return r && Je(e, t, r), r;
765
+ var tt = Object.defineProperty, rt = (a, e, t, o) => {
766
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
767
+ (s = a[i]) && (r = s(e, t, r) || r);
768
+ return r && tt(e, t, r), r;
769
769
  };
770
- const et = '<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>', tt = '<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>', rt = '<path d="M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"/><circle cx="12" cy="13" r="4"/>', it = '<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>', W = [
771
- { id: "device", label: "My Device", icon: et, iconColor: "#2563eb" },
772
- { id: "url", label: "URL link", icon: tt, iconColor: "#16a34a" },
773
- { id: "camera", label: "Camera", icon: rt, iconColor: "#7c3aed" },
774
- { id: "screen-cast", label: "Screen capture", icon: it, iconColor: "#ea580c" }
775
- ], he = class he extends U {
770
+ const ot = '<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>', it = '<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>', st = '<path d="M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"/><circle cx="12" cy="13" r="4"/>', at = '<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>', W = [
771
+ { id: "device", label: "My Device", icon: ot, iconColor: "#2563eb" },
772
+ { id: "url", label: "URL link", icon: it, iconColor: "#16a34a" },
773
+ { id: "camera", label: "Camera", icon: st, iconColor: "#7c3aed" },
774
+ { id: "screen-cast", label: "Screen capture", icon: at, iconColor: "#ea580c" }
775
+ ], xe = class xe extends U {
776
776
  constructor() {
777
777
  super(...arguments), this.sources = W;
778
778
  }
@@ -790,7 +790,7 @@ const et = '<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21
790
790
  ${this.sources.map(
791
791
  (e) => l`
792
792
  <button @click=${() => this._handleClick(e)}>
793
- ${e.brandHtml ? M(e.brandHtml) : R`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${O(e.icon)}</svg>`}
793
+ ${e.brandHtml ? M(e.brandHtml) : O`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${F(e.icon)}</svg>`}
794
794
  ${e.label}
795
795
  </button>
796
796
  `
@@ -798,7 +798,7 @@ const et = '<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21
798
798
  `;
799
799
  }
800
800
  };
801
- he.styles = S`
801
+ xe.styles = S`
802
802
  :host {
803
803
  display: flex;
804
804
  flex-wrap: wrap;
@@ -871,52 +871,84 @@ he.styles = S`
871
871
  stroke-width: 0;
872
872
  }
873
873
  `;
874
- let ne = he;
875
- Qe([
874
+ let ne = xe;
875
+ rt([
876
876
  b({ type: Array })
877
877
  ], ne.prototype, "sources");
878
- var ot = Object.defineProperty, j = (a, e, t, i) => {
879
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
880
- (s = a[o]) && (r = s(e, t, r) || r);
881
- return r && ot(e, t, r), r;
878
+ function Oe(a) {
879
+ let e = a;
880
+ for (; e; ) {
881
+ if (e instanceof ShadowRoot) {
882
+ e = e.host;
883
+ continue;
884
+ }
885
+ if (e instanceof HTMLDialogElement && e.open)
886
+ return e;
887
+ if (e instanceof Element && e.shadowRoot) {
888
+ const t = e.shadowRoot.querySelector("dialog[open]");
889
+ if (t instanceof HTMLDialogElement)
890
+ return t;
891
+ }
892
+ e = e.parentNode;
893
+ }
894
+ return document.body;
895
+ }
896
+ var nt = Object.defineProperty, R = (a, e, t, o) => {
897
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
898
+ (s = a[i]) && (r = s(e, t, r) || r);
899
+ return r && nt(e, t, r), r;
882
900
  };
883
- const ze = 3, ue = class ue extends U {
901
+ const Ue = 3, le = new CSSStyleSheet();
902
+ le.replaceSync(`
903
+ [data-sfx-more-dropdown] { position:absolute; top:0; left:0; width:0; height:0; overflow:visible; pointer-events:none; }
904
+ [data-sfx-more-dropdown] .sfx-more-dropdown { position:fixed; background:#fff; border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,0.14),0 2px 8px rgba(0,0,0,0.06); border:1px solid #e8edf5; padding:6px; min-width:210px; max-height:340px; overflow-y:auto; z-index:99999; opacity:0; visibility:hidden; pointer-events:none; transition:opacity .18s ease,visibility .18s ease,transform .18s ease; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; }
905
+ [data-sfx-more-dropdown] .sfx-more-dropdown.open { opacity:1; visibility:visible; pointer-events:all; }
906
+ [data-sfx-more-dropdown] .sfx-more-item { display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:6px; border:none; background:none; width:100%; font-size:13px; font-weight:500; color:#1e293b; cursor:pointer; transition:background .15s; font-family:inherit; white-space:nowrap; }
907
+ [data-sfx-more-dropdown] .sfx-more-item:hover { background:#f5f7fa; }
908
+ [data-sfx-more-dropdown] .sfx-more-item-ico { width:32px; height:32px; border-radius:8px; background:#f8fafc; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
909
+ [data-sfx-more-dropdown] .sfx-more-item-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
910
+ [data-sfx-more-dropdown] .sfx-more-item .brand-ico { width:20px; height:20px; border-radius:5px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
911
+ [data-sfx-more-dropdown] .sfx-more-item .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
912
+ [data-sfx-more-dropdown] .sfx-more-item .canva-ico { width:22px; height:22px; }
913
+ [data-sfx-more-dropdown] .sfx-more-item .canva-ico svg { width:22px; height:22px; }
914
+ `);
915
+ const ge = class ge extends U {
884
916
  constructor() {
885
- super(...arguments), this.compact = !1, this.externalDragOver = !1, this.accept = "", this.sources = [], this.sourcesLayout = "pills", this._dragOver = !1, this._moreOpen = !1, this._visiblePills = ze, this._dragCounter = 0, this._onDragEnter = (e) => {
917
+ super(...arguments), this.compact = !1, this.externalDragOver = !1, this.accept = "", this.sources = [], this.sourcesLayout = "pills", this._dragOver = !1, this._moreOpen = !1, this._visiblePills = Ue, this._dragCounter = 0, this._onDragEnter = (e) => {
886
918
  e.preventDefault(), this._dragCounter++, this._dragCounter === 1 && (this._dragOver = !0);
887
919
  }, this._onDragOver = (e) => {
888
920
  e.preventDefault();
889
921
  }, this._onDragLeave = (e) => {
890
922
  e.preventDefault(), this._dragCounter--, this._dragCounter <= 0 && (this._dragCounter = 0, this._dragOver = !1);
891
923
  }, this._onDrop = (e) => {
892
- var i;
924
+ var o;
893
925
  e.preventDefault(), e.stopPropagation(), this._dragCounter = 0, this._dragOver = !1;
894
- const t = Array.from(((i = e.dataTransfer) == null ? void 0 : i.files) ?? []);
926
+ const t = Array.from(((o = e.dataTransfer) == null ? void 0 : o.files) ?? []);
895
927
  t.length > 0 && this._emitFiles(t);
896
928
  }, this._onClick = (e) => {
897
929
  const t = this.shadowRoot.querySelector(".drop-zone");
898
930
  if (t && this._rippleEl) {
899
- const i = t.getBoundingClientRect();
900
- this._rippleEl.style.left = `${e.clientX - i.left}px`, this._rippleEl.style.top = `${e.clientY - i.top}px`, this._rippleEl.classList.remove("go"), this._rippleEl.offsetWidth, this._rippleEl.classList.add("go");
931
+ const o = t.getBoundingClientRect();
932
+ this._rippleEl.style.left = `${e.clientX - o.left}px`, this._rippleEl.style.top = `${e.clientY - o.top}px`, this._rippleEl.classList.remove("go"), this._rippleEl.offsetWidth, this._rippleEl.classList.add("go");
901
933
  }
902
934
  this.browse();
903
935
  }, this._onKeyDown = (e) => {
904
936
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.browse());
905
937
  }, this._onFileChange = (e) => {
906
- const t = e.target, i = Array.from(t.files ?? []);
907
- i.length > 0 && this._emitFiles(i), t.value = "";
938
+ const t = e.target, o = Array.from(t.files ?? []);
939
+ o.length > 0 && this._emitFiles(o), t.value = "";
908
940
  }, this._onPaste = (e) => {
909
941
  var r;
910
942
  if (!this.isConnected || this.offsetWidth === 0) return;
911
943
  const t = (r = e.clipboardData) == null ? void 0 : r.items;
912
944
  if (!t) return;
913
- const i = [];
914
- for (const o of t)
915
- if (o.kind === "file") {
916
- const s = o.getAsFile();
917
- s && i.push(s);
945
+ const o = [];
946
+ for (const i of t)
947
+ if (i.kind === "file") {
948
+ const s = i.getAsFile();
949
+ s && o.push(s);
918
950
  }
919
- i.length > 0 && (e.preventDefault(), this._emitFiles(i));
951
+ o.length > 0 && (e.preventDefault(), this._emitFiles(o));
920
952
  }, this._portalContainer = null, this._onDocClick = (e) => {
921
953
  var t;
922
954
  this._moreOpen && ((t = this._portalContainer) != null && t.contains(e.target) || (this._moreOpen = !1, this._updateDropdownPortal()));
@@ -955,13 +987,13 @@ const ze = 3, ue = class ue extends U {
955
987
  _updateDropdownPortal() {
956
988
  if (this._moreOpen) {
957
989
  const e = this.sources.slice(this._visiblePills);
958
- this._portalContainer || (this._portalContainer = document.createElement("div"), this._portalContainer.setAttribute("data-sfx-more-dropdown", ""), this._injectDropdownStyles(), document.body.appendChild(this._portalContainer)), T(
990
+ this._portalContainer || (this._portalContainer = document.createElement("div"), this._portalContainer.setAttribute("data-sfx-more-dropdown", ""), Oe(this).appendChild(this._portalContainer), this._injectDropdownStyles()), T(
959
991
  l`<div class="sfx-more-dropdown open">
960
992
  ${e.map(
961
993
  (t) => l`
962
- <button class="sfx-more-item" @click=${(i) => this._onMoreItemClick(t, i)}>
994
+ <button class="sfx-more-item" @click=${(o) => this._onMoreItemClick(t, o)}>
963
995
  <div class="sfx-more-item-ico">
964
- ${t.brandHtml ? M(t.brandHtml) : t.iconColor ? l`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${O(t.icon)}</svg>` : R`<svg viewBox="0 0 24 24">${O(t.icon)}</svg>`}
996
+ ${t.brandHtml ? M(t.brandHtml) : t.iconColor ? l`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${F(t.icon)}</svg>` : O`<svg viewBox="0 0 24 24">${F(t.icon)}</svg>`}
965
997
  </div>
966
998
  ${t.label}
967
999
  </button>
@@ -973,29 +1005,18 @@ const ze = 3, ue = class ue extends U {
973
1005
  } else this._portalContainer && (T(c, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
974
1006
  }
975
1007
  _injectDropdownStyles() {
976
- if (document.querySelector("style[data-sfx-more-dropdown-styles]")) return;
977
- const e = document.createElement("style");
978
- e.setAttribute("data-sfx-more-dropdown-styles", ""), e.textContent = `
979
- [data-sfx-more-dropdown] .sfx-more-dropdown { position:fixed; background:#fff; border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,0.14),0 2px 8px rgba(0,0,0,0.06); border:1px solid #e8edf5; padding:6px; min-width:210px; max-height:340px; overflow-y:auto; z-index:99999; opacity:0; visibility:hidden; pointer-events:none; transition:opacity .18s ease,visibility .18s ease,transform .18s ease; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; }
980
- [data-sfx-more-dropdown] .sfx-more-dropdown.open { opacity:1; visibility:visible; pointer-events:all; }
981
- [data-sfx-more-dropdown] .sfx-more-item { display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:6px; border:none; background:none; width:100%; font-size:13px; font-weight:500; color:#1e293b; cursor:pointer; transition:background .15s; font-family:inherit; white-space:nowrap; }
982
- [data-sfx-more-dropdown] .sfx-more-item:hover { background:#f5f7fa; }
983
- [data-sfx-more-dropdown] .sfx-more-item-ico { width:32px; height:32px; border-radius:8px; background:#f8fafc; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
984
- [data-sfx-more-dropdown] .sfx-more-item-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
985
- [data-sfx-more-dropdown] .sfx-more-item .brand-ico { width:20px; height:20px; border-radius:5px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
986
- [data-sfx-more-dropdown] .sfx-more-item .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
987
- [data-sfx-more-dropdown] .sfx-more-item .canva-ico { width:22px; height:22px; }
988
- [data-sfx-more-dropdown] .sfx-more-item .canva-ico svg { width:22px; height:22px; }
989
- `, document.head.appendChild(e);
1008
+ var t;
1009
+ const e = (t = this._portalContainer) == null ? void 0 : t.getRootNode();
1010
+ e && (e.adoptedStyleSheets.includes(le) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, le]));
990
1011
  }
991
1012
  /** Position the fixed dropdown, choosing above or below based on available space. */
992
1013
  _positionDropdown() {
993
1014
  var u, x;
994
1015
  const e = (u = this.shadowRoot) == null ? void 0 : u.querySelector(".more-wrap > button"), t = (x = this._portalContainer) == null ? void 0 : x.querySelector(".sfx-more-dropdown");
995
1016
  if (!e || !t) return;
996
- const i = e.getBoundingClientRect(), r = 8, o = t.scrollHeight, s = t.offsetWidth, n = i.top, d = window.innerHeight - i.bottom;
997
- n >= o + r || n > d ? t.style.top = `${i.top - o - r}px` : t.style.top = `${i.bottom + r}px`;
998
- let h = i.right - s;
1017
+ const o = e.getBoundingClientRect(), r = 8, i = t.scrollHeight, s = t.offsetWidth, n = o.top, d = window.innerHeight - o.bottom;
1018
+ n >= i + r || n > d ? t.style.top = `${o.top - i - r}px` : t.style.top = `${o.bottom + r}px`;
1019
+ let h = o.right - s;
999
1020
  h = Math.max(8, Math.min(h, window.innerWidth - s - 8)), t.style.left = `${h}px`;
1000
1021
  }
1001
1022
  _onMoreItemClick(e, t) {
@@ -1003,7 +1024,7 @@ const ze = 3, ue = class ue extends U {
1003
1024
  }
1004
1025
  _updateVisiblePills() {
1005
1026
  const e = window.innerWidth;
1006
- this.sourcesLayout === "cards" ? e <= 480 ? this._visiblePills = 2 : e <= 768 ? this._visiblePills = 3 : this._visiblePills = 5 : e <= 480 ? this._visiblePills = 1 : e <= 768 ? this._visiblePills = 2 : this._visiblePills = ze;
1027
+ this.sourcesLayout === "cards" ? e <= 480 ? this._visiblePills = 2 : e <= 768 ? this._visiblePills = 3 : this._visiblePills = 5 : e <= 480 ? this._visiblePills = 1 : e <= 768 ? this._visiblePills = 2 : this._visiblePills = Ue;
1007
1028
  }
1008
1029
  connectedCallback() {
1009
1030
  super.connectedCallback(), document.addEventListener("paste", this._onPaste), document.addEventListener("click", this._onDocClick), document.addEventListener("keydown", this._onDocKeyDown), window.addEventListener("scroll", this._onScrollOrResize, !0), window.addEventListener("resize", this._onScrollOrResize), this._updateVisiblePills();
@@ -1023,7 +1044,7 @@ const ze = 3, ue = class ue extends U {
1023
1044
  }}
1024
1045
  >
1025
1046
  ${e.brandHtml ? M(e.brandHtml) : l`<span class="pill-ico" style=${e.iconColor ? `color:${e.iconColor}` : ""}>
1026
- ${R`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${O(e.icon)}</svg>`}
1047
+ ${O`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${F(e.icon)}</svg>`}
1027
1048
  </span>`}
1028
1049
  ${e.label}
1029
1050
  </button>
@@ -1039,7 +1060,7 @@ const ze = 3, ue = class ue extends U {
1039
1060
  }}
1040
1061
  >
1041
1062
  ${e.brandHtml ? l`<span class="card-ico">${M(e.brandHtml)}</span>` : l`<span class="card-ico" style=${e.iconColor ? `color:${e.iconColor}` : ""}>
1042
- ${R`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${O(e.icon)}</svg>`}
1063
+ ${O`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${F(e.icon)}</svg>`}
1043
1064
  </span>`}
1044
1065
  <span class="card-label">${e.label}</span>
1045
1066
  </button>
@@ -1076,7 +1097,7 @@ const ze = 3, ue = class ue extends U {
1076
1097
  "drop-zone",
1077
1098
  this._dragOver || this.externalDragOver ? "drag-over" : "",
1078
1099
  this.compact ? "compact" : ""
1079
- ].filter(Boolean).join(" "), t = this.sources.slice(0, this._visiblePills), i = this.sources.slice(this._visiblePills);
1100
+ ].filter(Boolean).join(" "), t = this.sources.slice(0, this._visiblePills), o = this.sources.slice(this._visiblePills);
1080
1101
  return l`
1081
1102
  <div
1082
1103
  class=${e}
@@ -1113,12 +1134,12 @@ const ze = 3, ue = class ue extends U {
1113
1134
  ${this.sourcesLayout === "cards" ? l`
1114
1135
  <div class="sources-cards">
1115
1136
  ${t.map((r) => this._renderCard(r))}
1116
- ${i.length > 0 ? this._renderMoreCard() : c}
1137
+ ${o.length > 0 ? this._renderMoreCard() : c}
1117
1138
  </div>
1118
1139
  ` : l`
1119
1140
  <div class="sources-grid">
1120
1141
  ${t.map((r) => this._renderPill(r))}
1121
- ${i.length > 0 ? this._renderMoreDropdown() : c}
1142
+ ${o.length > 0 ? this._renderMoreDropdown() : c}
1122
1143
  </div>
1123
1144
  `}
1124
1145
  ` : c}
@@ -1132,11 +1153,11 @@ const ze = 3, ue = class ue extends U {
1132
1153
  style=${r.iconColor && !r.brandHtml ? `color:${r.iconColor}` : ""}
1133
1154
  data-tip=${r.label}
1134
1155
  aria-label=${r.label}
1135
- @click=${(o) => {
1136
- o.stopPropagation(), this._onSourceIconClick(r);
1156
+ @click=${(i) => {
1157
+ i.stopPropagation(), this._onSourceIconClick(r);
1137
1158
  }}
1138
1159
  >
1139
- ${r.brandHtml ? M(r.brandHtml) : R`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${O(r.icon)}</svg>`}
1160
+ ${r.brandHtml ? M(r.brandHtml) : O`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${F(r.icon)}</svg>`}
1140
1161
  </button>
1141
1162
  `
1142
1163
  )}
@@ -1154,7 +1175,7 @@ const ze = 3, ue = class ue extends U {
1154
1175
  `;
1155
1176
  }
1156
1177
  };
1157
- ue.styles = S`
1178
+ ge.styles = S`
1158
1179
  :host {
1159
1180
  display: flex;
1160
1181
  flex-shrink: 0;
@@ -1937,38 +1958,38 @@ ue.styles = S`
1937
1958
  }
1938
1959
  }
1939
1960
  `;
1940
- let z = ue;
1941
- j([
1961
+ let z = ge;
1962
+ R([
1942
1963
  b({ type: Boolean, reflect: !0 })
1943
1964
  ], z.prototype, "compact");
1944
- j([
1965
+ R([
1945
1966
  b({ type: Boolean, attribute: "external-drag-over" })
1946
1967
  ], z.prototype, "externalDragOver");
1947
- j([
1968
+ R([
1948
1969
  b({ type: String })
1949
1970
  ], z.prototype, "accept");
1950
- j([
1971
+ R([
1951
1972
  b({ type: Array })
1952
1973
  ], z.prototype, "sources");
1953
- j([
1974
+ R([
1954
1975
  b({ type: String, attribute: "sources-layout" })
1955
1976
  ], z.prototype, "sourcesLayout");
1956
- j([
1977
+ R([
1957
1978
  g()
1958
1979
  ], z.prototype, "_dragOver");
1959
- j([
1980
+ R([
1960
1981
  g()
1961
1982
  ], z.prototype, "_moreOpen");
1962
- j([
1983
+ R([
1963
1984
  g()
1964
1985
  ], z.prototype, "_visiblePills");
1965
- j([
1966
- je(".ripple")
1986
+ R([
1987
+ Fe(".ripple")
1967
1988
  ], z.prototype, "_rippleEl");
1968
- j([
1969
- je('input[type="file"]')
1989
+ R([
1990
+ Fe('input[type="file"]')
1970
1991
  ], z.prototype, "fileInput");
1971
- const xe = class xe extends U {
1992
+ const ve = class ve extends U {
1972
1993
  render() {
1973
1994
  return l`
1974
1995
  <div class="line"></div>
@@ -1977,7 +1998,7 @@ const xe = class xe extends U {
1977
1998
  `;
1978
1999
  }
1979
2000
  };
1980
- xe.styles = S`
2001
+ ve.styles = S`
1981
2002
  :host {
1982
2003
  display: flex;
1983
2004
  align-items: center;
@@ -2000,19 +2021,34 @@ xe.styles = S`
2000
2021
  white-space: nowrap;
2001
2022
  }
2002
2023
  `;
2003
- let Pe = xe;
2004
- var st = Object.defineProperty, Z = (a, e, t, i) => {
2005
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
2006
- (s = a[o]) && (r = s(e, t, r) || r);
2007
- return r && st(e, t, r), r;
2024
+ let De = ve;
2025
+ var lt = Object.defineProperty, Z = (a, e, t, o) => {
2026
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
2027
+ (s = a[i]) && (r = s(e, t, r) || r);
2028
+ return r && lt(e, t, r), r;
2008
2029
  };
2009
- const ge = class ge extends U {
2030
+ const de = new CSSStyleSheet();
2031
+ de.replaceSync(`
2032
+ [data-sfx-tile-dropdown] { position:absolute; top:0; left:0; width:0; height:0; overflow:visible; pointer-events:none; }
2033
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown { position:fixed; background:#fff; border:1px solid #e2e8f0; border-radius:10px; box-shadow:0 4px 20px rgba(0,0,0,0.12); padding:6px; z-index:99999; min-width:180px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxTileDropIn .15s ease; }
2034
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-item { display:flex; align-items:center; gap:10px; width:100%; padding:8px 12px; border:none; background:none; border-radius:6px; cursor:pointer; font-size:13px; font-weight:500; color:#1e293b; white-space:nowrap; transition:background .15s; font-family:inherit; }
2035
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-item:hover { background:#f5f7fa; }
2036
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico { width:32px; height:32px; border-radius:8px; background:#f8fafc; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
2037
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
2038
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg.fill-icon { fill:currentColor; stroke:none; }
2039
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico { width:20px; height:20px; border-radius:5px; display:flex; align-items:center; justify-content:center; }
2040
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
2041
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico { width:22px; height:22px; }
2042
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico svg { width:22px; height:22px; }
2043
+ @keyframes sfxTileDropIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
2044
+ `);
2045
+ const be = class be extends U {
2010
2046
  constructor() {
2011
2047
  super(...arguments), this.files = [], this.showDropTile = !1, this.sources = [], this.accept = "", this._moreOpen = !1, this._portalContainer = null, this._outsideClickHandler = (e) => {
2012
2048
  var r;
2013
2049
  if ((r = this._portalContainer) != null && r.contains(e.target)) return;
2014
- const t = this.renderRoot.querySelector(".drop-tile-more-wrap"), i = e.composedPath();
2015
- t && i.includes(t) || (this._moreOpen = !1, this._closePortal(), document.removeEventListener("click", this._outsideClickHandler, !0));
2050
+ const t = this.renderRoot.querySelector(".drop-tile-more-wrap"), o = e.composedPath();
2051
+ t && o.includes(t) || (this._moreOpen = !1, this._closePortal(), document.removeEventListener("click", this._outsideClickHandler, !0));
2016
2052
  }, this._onScrollOrResize = () => {
2017
2053
  this._moreOpen && this._positionPortal();
2018
2054
  }, this._onKeyDown = (e) => {
@@ -2024,13 +2060,13 @@ const ge = class ge extends U {
2024
2060
  e == null || e.click();
2025
2061
  }
2026
2062
  _onFileInput(e) {
2027
- const t = e.target, i = Array.from(t.files ?? []);
2028
- i.length > 0 && this.dispatchEvent(new CustomEvent("files-selected", { detail: { files: i }, bubbles: !0, composed: !0 })), t.value = "";
2063
+ const t = e.target, o = Array.from(t.files ?? []);
2064
+ o.length > 0 && this.dispatchEvent(new CustomEvent("files-selected", { detail: { files: o }, bubbles: !0, composed: !0 })), t.value = "";
2029
2065
  }
2030
2066
  _onSourceClick(e, t) {
2031
2067
  if (e.stopPropagation(), t.id === "device") {
2032
- const i = this.renderRoot.querySelector('input[type="file"]');
2033
- i == null || i.click();
2068
+ const o = this.renderRoot.querySelector('input[type="file"]');
2069
+ o == null || o.click();
2034
2070
  return;
2035
2071
  }
2036
2072
  this.dispatchEvent(new CustomEvent("source-click", { detail: { source: t }, bubbles: !0, composed: !0 }));
@@ -2046,15 +2082,15 @@ const ge = class ge extends U {
2046
2082
  }
2047
2083
  _openPortal() {
2048
2084
  const e = this.sources.slice(3);
2049
- this._portalContainer || (this._portalContainer = document.createElement("div"), this._portalContainer.setAttribute("data-sfx-tile-dropdown", ""), this._injectTileDropdownStyles(), document.body.appendChild(this._portalContainer)), T(
2085
+ this._portalContainer || (this._portalContainer = document.createElement("div"), this._portalContainer.setAttribute("data-sfx-tile-dropdown", ""), Oe(this).appendChild(this._portalContainer), this._injectTileDropdownStyles()), T(
2050
2086
  l`<div class="sfx-tile-dropdown">
2051
2087
  ${e.map((t) => l`
2052
2088
  <button
2053
2089
  class="sfx-tile-dropdown-item"
2054
- @click=${(i) => this._onMoreSourceClick(i, t)}
2090
+ @click=${(o) => this._onMoreSourceClick(o, t)}
2055
2091
  >
2056
2092
  <span class="sfx-tile-dropdown-ico" style=${t.iconColor && !t.brandHtml ? `color:${t.iconColor}` : ""}>
2057
- ${t.brandHtml ? M(t.brandHtml) : R`<svg viewBox="0 0 24 24" class=${t.fillIcon ? "fill-icon" : ""}>${O(t.icon)}</svg>`}
2093
+ ${t.brandHtml ? M(t.brandHtml) : O`<svg viewBox="0 0 24 24" class=${t.fillIcon ? "fill-icon" : ""}>${F(t.icon)}</svg>`}
2058
2094
  </span>
2059
2095
  ${t.label}
2060
2096
  </button>
@@ -2067,30 +2103,18 @@ const ge = class ge extends U {
2067
2103
  var u;
2068
2104
  const e = this.renderRoot.querySelector(".drop-tile-more"), t = (u = this._portalContainer) == null ? void 0 : u.querySelector(".sfx-tile-dropdown");
2069
2105
  if (!e || !t) return;
2070
- const i = e.getBoundingClientRect(), r = 6, o = t.scrollHeight, s = t.offsetWidth, n = i.top, d = window.innerHeight - i.bottom;
2071
- n >= o + r || n > d ? t.style.top = `${i.top - o - r}px` : t.style.top = `${i.bottom + r}px`;
2072
- let h = i.right - s;
2106
+ const o = e.getBoundingClientRect(), r = 6, i = t.scrollHeight, s = t.offsetWidth, n = o.top, d = window.innerHeight - o.bottom;
2107
+ n >= i + r || n > d ? t.style.top = `${o.top - i - r}px` : t.style.top = `${o.bottom + r}px`;
2108
+ let h = o.right - s;
2073
2109
  h = Math.max(8, Math.min(h, window.innerWidth - s - 8)), t.style.left = `${h}px`;
2074
2110
  }
2075
2111
  _closePortal() {
2076
2112
  this._portalContainer && (T(c, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
2077
2113
  }
2078
2114
  _injectTileDropdownStyles() {
2079
- if (document.querySelector("style[data-sfx-tile-dropdown-styles]")) return;
2080
- const e = document.createElement("style");
2081
- e.setAttribute("data-sfx-tile-dropdown-styles", ""), e.textContent = `
2082
- [data-sfx-tile-dropdown] .sfx-tile-dropdown { position:fixed; background:#fff; border:1px solid #e2e8f0; border-radius:10px; box-shadow:0 4px 20px rgba(0,0,0,0.12); padding:6px; z-index:99999; min-width:180px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; animation:sfxTileDropIn .15s ease; }
2083
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-item { display:flex; align-items:center; gap:10px; width:100%; padding:8px 12px; border:none; background:none; border-radius:6px; cursor:pointer; font-size:13px; font-weight:500; color:#1e293b; white-space:nowrap; transition:background .15s; font-family:inherit; }
2084
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-item:hover { background:#f5f7fa; }
2085
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico { width:32px; height:32px; border-radius:8px; background:#f8fafc; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
2086
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
2087
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg.fill-icon { fill:currentColor; stroke:none; }
2088
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico { width:20px; height:20px; border-radius:5px; display:flex; align-items:center; justify-content:center; }
2089
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
2090
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico { width:22px; height:22px; }
2091
- [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico svg { width:22px; height:22px; }
2092
- @keyframes sfxTileDropIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
2093
- `, document.head.appendChild(e);
2115
+ var t;
2116
+ const e = (t = this._portalContainer) == null ? void 0 : t.getRootNode();
2117
+ e && (e.adoptedStyleSheets.includes(de) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, de]));
2094
2118
  }
2095
2119
  disconnectedCallback() {
2096
2120
  super.disconnectedCallback(), this._moreOpen = !1, this._closePortal(), this._removeGlobalListeners();
@@ -2099,7 +2123,7 @@ const ge = class ge extends U {
2099
2123
  this._moreOpen = !1, this._closePortal(), this._removeGlobalListeners(), this._onSourceClick(e, t);
2100
2124
  }
2101
2125
  _renderDropTile() {
2102
- const t = this.sources.slice(0, 3), i = this.sources.slice(3);
2126
+ const t = this.sources.slice(0, 3), o = this.sources.slice(3);
2103
2127
  return l`
2104
2128
  <div class="drop-tile" @click=${this._onDropTileClick}>
2105
2129
  <div class="drop-tile-rings">
@@ -2121,12 +2145,12 @@ const ge = class ge extends U {
2121
2145
  class="drop-tile-src"
2122
2146
  style=${r.iconColor && !r.brandHtml ? `color:${r.iconColor}` : ""}
2123
2147
  title=${r.label}
2124
- @click=${(o) => this._onSourceClick(o, r)}
2148
+ @click=${(i) => this._onSourceClick(i, r)}
2125
2149
  >
2126
- ${r.brandHtml ? M(r.brandHtml) : R`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${O(r.icon)}</svg>`}
2150
+ ${r.brandHtml ? M(r.brandHtml) : O`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${F(r.icon)}</svg>`}
2127
2151
  </button>
2128
2152
  `)}
2129
- ${i.length > 0 ? l`
2153
+ ${o.length > 0 ? l`
2130
2154
  <div class="drop-tile-more-wrap">
2131
2155
  <button class="drop-tile-more" title="More sources" @click=${(r) => this._toggleMore(r)}>···</button>
2132
2156
  </div>
@@ -2148,7 +2172,7 @@ const ge = class ge extends U {
2148
2172
  `;
2149
2173
  }
2150
2174
  };
2151
- ge.styles = S`
2175
+ be.styles = S`
2152
2176
  :host {
2153
2177
  display: block;
2154
2178
  flex: 1;
@@ -2450,7 +2474,7 @@ ge.styles = S`
2450
2474
  display: none;
2451
2475
  }
2452
2476
  `;
2453
- let B = ge;
2477
+ let B = be;
2454
2478
  Z([
2455
2479
  b({ attribute: !1 })
2456
2480
  ], B.prototype, "files");
@@ -2466,12 +2490,12 @@ Z([
2466
2490
  Z([
2467
2491
  g()
2468
2492
  ], B.prototype, "_moreOpen");
2469
- var at = Object.defineProperty, nt = (a, e, t, i) => {
2470
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
2471
- (s = a[o]) && (r = s(e, t, r) || r);
2472
- return r && at(e, t, r), r;
2493
+ var dt = Object.defineProperty, pt = (a, e, t, o) => {
2494
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
2495
+ (s = a[i]) && (r = s(e, t, r) || r);
2496
+ return r && dt(e, t, r), r;
2473
2497
  };
2474
- const ve = class ve extends U {
2498
+ const me = class me extends U {
2475
2499
  _remove() {
2476
2500
  this.dispatchEvent(
2477
2501
  new CustomEvent("file-remove", {
@@ -2502,9 +2526,9 @@ const ve = class ve extends U {
2502
2526
  render() {
2503
2527
  const e = this.file;
2504
2528
  if (!e) return c;
2505
- const t = X(e), i = e.status === "complete", r = e.status === "uploading", o = e.status === "error" || e.status === "failed", s = e.status === "rejected", n = Ne(e.name), d = [
2529
+ const t = X(e), o = e.status === "complete", r = e.status === "uploading", i = e.status === "error" || e.status === "failed", s = e.status === "rejected", n = Ke(e.name), d = [
2506
2530
  "tile",
2507
- i ? "done" : "",
2531
+ o ? "done" : "",
2508
2532
  r ? "uploading" : "",
2509
2533
  s ? "rejected" : ""
2510
2534
  ].filter(Boolean).join(" ");
@@ -2523,7 +2547,7 @@ const ve = class ve extends U {
2523
2547
  `}
2524
2548
 
2525
2549
  <!-- Preview button -->
2526
- ${!i && !r && !o && e.status !== "rejected" ? l`
2550
+ ${!o && !r && !i && e.status !== "rejected" ? l`
2527
2551
  <button class="preview-btn" @click=${this._preview} aria-label="Preview file">
2528
2552
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
2529
2553
  <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
@@ -2539,7 +2563,7 @@ const ve = class ve extends U {
2539
2563
  </div>
2540
2564
 
2541
2565
  <!-- Done badge -->
2542
- ${i ? l`<div class="done-badge">
2566
+ ${o ? l`<div class="done-badge">
2543
2567
  <svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="3" stroke-linecap="round">
2544
2568
  <polyline points="20 6 9 17 4 12" />
2545
2569
  </svg>
@@ -2553,15 +2577,15 @@ const ve = class ve extends U {
2553
2577
  ` : c}
2554
2578
 
2555
2579
  <!-- Error / rejected badge -->
2556
- ${(o || s) && e.error ? l`<div class="error-badge" title=${e.error}>${e.error}</div>` : c}
2580
+ ${(i || s) && e.error ? l`<div class="error-badge" title=${e.error}>${e.error}</div>` : c}
2557
2581
 
2558
2582
  <!-- Video duration badge (hidden when error badge is shown to avoid overlap) -->
2559
- ${!(o || s) && e.duration != null && e.duration > 0 ? l`<div class="duration-badge">${this._formatDuration(e.duration)}</div>` : c}
2583
+ ${!(i || s) && e.duration != null && e.duration > 0 ? l`<div class="duration-badge">${this._formatDuration(e.duration)}</div>` : c}
2560
2584
  </div>
2561
2585
 
2562
2586
  <!-- Action buttons -->
2563
2587
  <div class="actions">
2564
- ${o ? l`
2588
+ ${i ? l`
2565
2589
  <button class="act-btn retry" @click=${this._retry} title="Retry" aria-label="Retry upload">
2566
2590
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
2567
2591
  <polyline points="23 4 23 10 17 10" />
@@ -2589,8 +2613,8 @@ const ve = class ve extends U {
2589
2613
  `;
2590
2614
  }
2591
2615
  _formatDuration(e) {
2592
- const t = Math.floor(e / 60), i = Math.floor(e % 60);
2593
- return `${t}:${i.toString().padStart(2, "0")}`;
2616
+ const t = Math.floor(e / 60), o = Math.floor(e % 60);
2617
+ return `${t}:${o.toString().padStart(2, "0")}`;
2594
2618
  }
2595
2619
  _renderTypeIcon(e) {
2596
2620
  switch (e) {
@@ -2607,7 +2631,7 @@ const ve = class ve extends U {
2607
2631
  }
2608
2632
  }
2609
2633
  };
2610
- ve.styles = S`
2634
+ me.styles = S`
2611
2635
  :host {
2612
2636
  display: block;
2613
2637
  }
@@ -2989,10 +3013,10 @@ ve.styles = S`
2989
3013
  .spin-ring { animation: none; }
2990
3014
  }
2991
3015
  `;
2992
- let le = ve;
2993
- nt([
3016
+ let pe = me;
3017
+ pt([
2994
3018
  b({ attribute: !1 })
2995
- ], le.prototype, "file");
3019
+ ], pe.prototype, "file");
2996
3020
  const J = S`
2997
3021
  .btn,
2998
3022
  .btn-ghost,
@@ -3068,12 +3092,12 @@ const J = S`
3068
3092
  outline-offset: 2px;
3069
3093
  }
3070
3094
  `;
3071
- var lt = Object.defineProperty, ee = (a, e, t, i) => {
3072
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3073
- (s = a[o]) && (r = s(e, t, r) || r);
3074
- return r && lt(e, t, r), r;
3095
+ var ct = Object.defineProperty, ee = (a, e, t, o) => {
3096
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
3097
+ (s = a[i]) && (r = s(e, t, r) || r);
3098
+ return r && ct(e, t, r), r;
3075
3099
  };
3076
- const Ue = 7, be = class be extends U {
3100
+ const Re = 7, we = class we extends U {
3077
3101
  constructor() {
3078
3102
  super(...arguments), this.fileCount = 0, this.totalSize = 0, this.thumbnails = [], this.primaryLabel = "Done", this.failedFiles = [];
3079
3103
  }
@@ -3103,14 +3127,14 @@ const Ue = 7, be = class be extends U {
3103
3127
  );
3104
3128
  }
3105
3129
  render() {
3106
- const e = this.thumbnails.slice(0, Ue), t = this.thumbnails.length - Ue, i = this.fileCount > 0, r = this.failedFiles.length > 0, o = r && !i;
3130
+ const e = this.thumbnails.slice(0, Re), t = this.thumbnails.length - Re, o = this.fileCount > 0, r = this.failedFiles.length > 0, i = r && !o;
3107
3131
  return l`
3108
3132
  <button class="close-btn" title="Close" @click=${this._close}>
3109
3133
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
3110
3134
  </button>
3111
3135
  <div class="card" role="status" aria-live="polite">
3112
- <div class="icon ${o ? "error" : r ? "warning" : ""}">
3113
- ${o ? l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
3136
+ <div class="icon ${i ? "error" : r ? "warning" : ""}">
3137
+ ${i ? l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
3114
3138
  <circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>
3115
3139
  </svg>` : r ? l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
3116
3140
  <path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/>
@@ -3118,8 +3142,8 @@ const Ue = 7, be = class be extends U {
3118
3142
  <polyline points="20 6 9 17 4 12" />
3119
3143
  </svg>`}
3120
3144
  </div>
3121
- <div class="title">${o ? "Upload failed" : r ? "Partially uploaded" : "Uploaded successfully!"}</div>
3122
- <div class="subtitle">${o ? `${this.failedFiles.length === 1 ? "File" : "Files"} could not be uploaded` : r ? `${this.fileCount} ${this.fileCount === 1 ? "file" : "files"} uploaded, ${this.failedFiles.length} failed` : "All files are ready for use"}</div>
3145
+ <div class="title">${i ? "Upload failed" : r ? "Partially uploaded" : "Uploaded successfully!"}</div>
3146
+ <div class="subtitle">${i ? `${this.failedFiles.length === 1 ? "File" : "Files"} could not be uploaded` : r ? `${this.fileCount} ${this.fileCount === 1 ? "file" : "files"} uploaded, ${this.failedFiles.length} failed` : "All files are ready for use"}</div>
3123
3147
 
3124
3148
  ${e.length > 0 ? l`
3125
3149
  <div class="thumbs">
@@ -3130,7 +3154,7 @@ const Ue = 7, be = class be extends U {
3130
3154
  </div>
3131
3155
  ` : c}
3132
3156
 
3133
- ${i ? l`<div class="summary">${this.fileCount} ${this.fileCount === 1 ? "file" : "files"} · ${Y(this.totalSize)} uploaded</div>` : c}
3157
+ ${o ? l`<div class="summary">${this.fileCount} ${this.fileCount === 1 ? "file" : "files"} · ${Y(this.totalSize)} uploaded</div>` : c}
3134
3158
 
3135
3159
  ${r ? l`
3136
3160
  <div class="failed-list">
@@ -3158,7 +3182,7 @@ const Ue = 7, be = class be extends U {
3158
3182
  `;
3159
3183
  }
3160
3184
  };
3161
- be.styles = [J, Q, S`
3185
+ we.styles = [J, Q, S`
3162
3186
  :host {
3163
3187
  display: flex;
3164
3188
  flex: 1;
@@ -3438,7 +3462,7 @@ be.styles = [J, Q, S`
3438
3462
  .icon { animation: none; }
3439
3463
  }
3440
3464
  `];
3441
- let L = be;
3465
+ let L = we;
3442
3466
  ee([
3443
3467
  b({ type: Number })
3444
3468
  ], L.prototype, "fileCount");
@@ -3454,12 +3478,12 @@ ee([
3454
3478
  ee([
3455
3479
  b({ type: Array })
3456
3480
  ], L.prototype, "failedFiles");
3457
- var dt = Object.defineProperty, I = (a, e, t, i) => {
3458
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3459
- (s = a[o]) && (r = s(e, t, r) || r);
3460
- return r && dt(e, t, r), r;
3481
+ var ft = Object.defineProperty, I = (a, e, t, o) => {
3482
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
3483
+ (s = a[i]) && (r = s(e, t, r) || r);
3484
+ return r && ft(e, t, r), r;
3461
3485
  };
3462
- const me = class me extends U {
3486
+ const ye = class ye extends U {
3463
3487
  constructor() {
3464
3488
  super(...arguments), this.uploadState = "idle", this.fileCount = 0, this.totalSize = 0, this.failedCount = 0, this.showFillMetadata = !1, this.completedCount = 0, this.uploadProgress = 0;
3465
3489
  }
@@ -3537,10 +3561,10 @@ const me = class me extends U {
3537
3561
  `;
3538
3562
  }
3539
3563
  _renderUploadButton() {
3540
- const e = this.uploadState === "uploading", t = this.uploadState === "done", i = ["btn-primary", t ? "done-state" : ""].filter(Boolean).join(" ");
3564
+ const e = this.uploadState === "uploading", t = this.uploadState === "done", o = ["btn-primary", t ? "done-state" : ""].filter(Boolean).join(" ");
3541
3565
  return l`
3542
3566
  <button
3543
- class=${i}
3567
+ class=${o}
3544
3568
  @click=${this._upload}
3545
3569
  ?disabled=${e}
3546
3570
  >
@@ -3561,7 +3585,7 @@ const me = class me extends U {
3561
3585
  `;
3562
3586
  }
3563
3587
  };
3564
- me.styles = [J, Q, S`
3588
+ ye.styles = [J, Q, S`
3565
3589
  :host {
3566
3590
  display: flex;
3567
3591
  flex-direction: column;
@@ -3710,48 +3734,48 @@ me.styles = [J, Q, S`
3710
3734
  .btn-spin { animation: none; }
3711
3735
  }
3712
3736
  `];
3713
- let F = me;
3737
+ let j = ye;
3714
3738
  I([
3715
3739
  b({ type: String })
3716
- ], F.prototype, "uploadState");
3740
+ ], j.prototype, "uploadState");
3717
3741
  I([
3718
3742
  b({ type: Number })
3719
- ], F.prototype, "fileCount");
3743
+ ], j.prototype, "fileCount");
3720
3744
  I([
3721
3745
  b({ type: Number })
3722
- ], F.prototype, "totalSize");
3746
+ ], j.prototype, "totalSize");
3723
3747
  I([
3724
3748
  b({ type: Number })
3725
- ], F.prototype, "failedCount");
3749
+ ], j.prototype, "failedCount");
3726
3750
  I([
3727
3751
  b({ type: Boolean })
3728
- ], F.prototype, "showFillMetadata");
3752
+ ], j.prototype, "showFillMetadata");
3729
3753
  I([
3730
3754
  b({ type: Number })
3731
- ], F.prototype, "completedCount");
3755
+ ], j.prototype, "completedCount");
3732
3756
  I([
3733
3757
  b({ type: Number })
3734
- ], F.prototype, "uploadProgress");
3735
- const pt = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
3736
- function ce(a, e) {
3758
+ ], j.prototype, "uploadProgress");
3759
+ const ht = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
3760
+ function he(a, e) {
3737
3761
  return (t) => {
3738
3762
  if (t.key !== "Tab") return;
3739
- const i = a();
3740
- if (!i) return;
3741
- const r = i.querySelector(e);
3763
+ const o = a();
3764
+ if (!o) return;
3765
+ const r = o.querySelector(e);
3742
3766
  if (!r) return;
3743
- const o = Array.from(r.querySelectorAll(pt));
3744
- if (o.length === 0) return;
3745
- const s = o[0], n = o[o.length - 1], d = i.activeElement;
3767
+ const i = Array.from(r.querySelectorAll(ht));
3768
+ if (i.length === 0) return;
3769
+ const s = i[0], n = i[i.length - 1], d = o.activeElement;
3746
3770
  t.shiftKey ? (d === s || !r.contains(d)) && (t.preventDefault(), n.focus()) : (d === n || !r.contains(d)) && (t.preventDefault(), s.focus());
3747
3771
  };
3748
3772
  }
3749
- var ct = Object.defineProperty, fe = (a, e, t, i) => {
3750
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3751
- (s = a[o]) && (r = s(e, t, r) || r);
3752
- return r && ct(e, t, r), r;
3773
+ var ut = Object.defineProperty, ue = (a, e, t, o) => {
3774
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
3775
+ (s = a[i]) && (r = s(e, t, r) || r);
3776
+ return r && ut(e, t, r), r;
3753
3777
  };
3754
- const we = class we extends U {
3778
+ const _e = class _e extends U {
3755
3779
  constructor() {
3756
3780
  super(...arguments), this._url = "", this._name = "", this._error = "", this._onBackdropClick = (e) => {
3757
3781
  e.target === e.currentTarget && this._cancel();
@@ -3759,7 +3783,7 @@ const we = class we extends U {
3759
3783
  this._url = e.target.value, this._error = "", this._autoName();
3760
3784
  }, this._onNameInput = (e) => {
3761
3785
  this._name = e.target.value;
3762
- }, this._focusTrap = ce(() => this.shadowRoot, ".card"), this._onKeyDown = (e) => {
3786
+ }, this._focusTrap = he(() => this.shadowRoot, ".card"), this._onKeyDown = (e) => {
3763
3787
  var t;
3764
3788
  e.key === "Escape" && this._cancel(), e.key === "Enter" && ((t = e.target) == null ? void 0 : t.tagName) === "INPUT" && this._submit(), this._focusTrap(e);
3765
3789
  };
@@ -3768,10 +3792,10 @@ const we = class we extends U {
3768
3792
  var e;
3769
3793
  if (!this._name)
3770
3794
  try {
3771
- const t = new URL(this._url).pathname.split("/"), i = t[t.length - 1];
3772
- if (i) {
3795
+ const t = new URL(this._url).pathname.split("/"), o = t[t.length - 1];
3796
+ if (o) {
3773
3797
  const r = (e = this.shadowRoot) == null ? void 0 : e.querySelector("#nameInput");
3774
- r && (r.placeholder = i);
3798
+ r && (r.placeholder = o);
3775
3799
  }
3776
3800
  } catch {
3777
3801
  }
@@ -3795,8 +3819,8 @@ const we = class we extends U {
3795
3819
  let t = this._name.trim();
3796
3820
  if (!t)
3797
3821
  try {
3798
- const i = new URL(e).pathname.split("/");
3799
- t = i[i.length - 1] || "imported-file";
3822
+ const o = new URL(e).pathname.split("/");
3823
+ t = o[o.length - 1] || "imported-file";
3800
3824
  } catch {
3801
3825
  t = "imported-file";
3802
3826
  }
@@ -3862,7 +3886,7 @@ const we = class we extends U {
3862
3886
  `;
3863
3887
  }
3864
3888
  };
3865
- we.styles = [J, Q, S`
3889
+ _e.styles = [J, Q, S`
3866
3890
  :host {
3867
3891
  display: block;
3868
3892
  }
@@ -4036,30 +4060,30 @@ we.styles = [J, Q, S`
4036
4060
  }
4037
4061
 
4038
4062
  `];
4039
- let K = we;
4040
- fe([
4063
+ let K = _e;
4064
+ ue([
4041
4065
  g()
4042
4066
  ], K.prototype, "_url");
4043
- fe([
4067
+ ue([
4044
4068
  g()
4045
4069
  ], K.prototype, "_name");
4046
- fe([
4070
+ ue([
4047
4071
  g()
4048
4072
  ], K.prototype, "_error");
4049
- var ft = Object.defineProperty, ie = (a, e, t, i) => {
4050
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
4051
- (s = a[o]) && (r = s(e, t, r) || r);
4052
- return r && ft(e, t, r), r;
4073
+ var xt = Object.defineProperty, oe = (a, e, t, o) => {
4074
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
4075
+ (s = a[i]) && (r = s(e, t, r) || r);
4076
+ return r && xt(e, t, r), r;
4053
4077
  };
4054
- const ye = class ye extends U {
4078
+ const ke = class ke extends U {
4055
4079
  constructor() {
4056
4080
  super(...arguments), this._stream = null, this._error = "", this._captured = null, this._previewUrl = "", this._onBackdropClick = (e) => {
4057
4081
  e.target === e.currentTarget && this._cancel();
4058
- }, this._focusTrap = ce(() => this.shadowRoot, ".card"), this._onKeyDown = (e) => {
4082
+ }, this._focusTrap = he(() => this.shadowRoot, ".card"), this._onKeyDown = (e) => {
4059
4083
  e.key === "Escape" && this._cancel(), this._focusTrap(e);
4060
4084
  }, this._capture = () => {
4061
- var r, o;
4062
- const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("video"), t = (o = this.shadowRoot) == null ? void 0 : o.querySelector("canvas");
4085
+ var r, i;
4086
+ const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("video"), t = (i = this.shadowRoot) == null ? void 0 : i.querySelector("canvas");
4063
4087
  if (!e || !t) return;
4064
4088
  t.width = e.videoWidth, t.height = e.videoHeight, t.getContext("2d").drawImage(e, 0, 0), t.toBlob((s) => {
4065
4089
  s && (this._captured = s, this._previewUrl = URL.createObjectURL(s), this._stopStream());
@@ -4129,7 +4153,7 @@ const ye = class ye extends U {
4129
4153
  `;
4130
4154
  }
4131
4155
  };
4132
- ye.styles = [J, Q, S`
4156
+ ke.styles = [J, Q, S`
4133
4157
  :host { display: block; }
4134
4158
 
4135
4159
  .backdrop {
@@ -4210,29 +4234,29 @@ ye.styles = [J, Q, S`
4210
4234
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4211
4235
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
4212
4236
  `];
4213
- let V = ye;
4214
- ie([
4237
+ let V = ke;
4238
+ oe([
4215
4239
  g()
4216
4240
  ], V.prototype, "_stream");
4217
- ie([
4241
+ oe([
4218
4242
  g()
4219
4243
  ], V.prototype, "_error");
4220
- ie([
4244
+ oe([
4221
4245
  g()
4222
4246
  ], V.prototype, "_captured");
4223
- ie([
4247
+ oe([
4224
4248
  g()
4225
4249
  ], V.prototype, "_previewUrl");
4226
- var ht = Object.defineProperty, te = (a, e, t, i) => {
4227
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
4228
- (s = a[o]) && (r = s(e, t, r) || r);
4229
- return r && ht(e, t, r), r;
4250
+ var gt = Object.defineProperty, te = (a, e, t, o) => {
4251
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
4252
+ (s = a[i]) && (r = s(e, t, r) || r);
4253
+ return r && gt(e, t, r), r;
4230
4254
  };
4231
- const _e = class _e extends U {
4255
+ const Ce = class Ce extends U {
4232
4256
  constructor() {
4233
4257
  super(...arguments), this._stream = null, this._recording = !1, this._error = "", this._recordedBlob = null, this._previewUrl = "", this._recorder = null, this._chunks = [], this._onBackdropClick = (e) => {
4234
4258
  e.target === e.currentTarget && this._cancel();
4235
- }, this._focusTrap = ce(() => this.shadowRoot, ".card"), this._onKeyDown = (e) => {
4259
+ }, this._focusTrap = he(() => this.shadowRoot, ".card"), this._onKeyDown = (e) => {
4236
4260
  e.key === "Escape" && this._cancel(), this._focusTrap(e);
4237
4261
  }, this._startRecording = async () => {
4238
4262
  var e;
@@ -4245,13 +4269,13 @@ const _e = class _e extends U {
4245
4269
  }), this._recording = !0, await this.updateComplete;
4246
4270
  const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("video");
4247
4271
  t && (t.srcObject = this._stream), this._chunks = [];
4248
- const i = MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm";
4249
- this._recorder = new MediaRecorder(this._stream, { mimeType: i }), this._recorder.ondataavailable = (r) => {
4272
+ const o = MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm";
4273
+ this._recorder = new MediaRecorder(this._stream, { mimeType: o }), this._recorder.ondataavailable = (r) => {
4250
4274
  r.data.size > 0 && this._chunks.push(r.data);
4251
4275
  }, this._recorder.onstop = () => {
4252
- var o;
4276
+ var i;
4253
4277
  const r = new Blob(this._chunks, { type: "video/webm" });
4254
- this._recordedBlob = r, this._previewUrl = URL.createObjectURL(r), (o = this._stream) == null || o.getTracks().forEach((s) => s.stop()), this._stream = null;
4278
+ this._recordedBlob = r, this._previewUrl = URL.createObjectURL(r), (i = this._stream) == null || i.getTracks().forEach((s) => s.stop()), this._stream = null;
4255
4279
  }, this._recorder.start();
4256
4280
  } catch {
4257
4281
  this._error = "Could not start screen capture. Please check your permissions.";
@@ -4272,7 +4296,7 @@ const _e = class _e extends U {
4272
4296
  }
4273
4297
  _stopAll() {
4274
4298
  var e, t;
4275
- (e = this._recorder) == null || e.stop(), this._recorder = null, (t = this._stream) == null || t.getTracks().forEach((i) => i.stop()), this._stream = null;
4299
+ (e = this._recorder) == null || e.stop(), this._recorder = null, (t = this._stream) == null || t.getTracks().forEach((o) => o.stop()), this._stream = null;
4276
4300
  }
4277
4301
  _cancel() {
4278
4302
  this._stopAll(), this.dispatchEvent(new CustomEvent("screencast-cancel", { bubbles: !0, composed: !0 }));
@@ -4327,7 +4351,7 @@ const _e = class _e extends U {
4327
4351
  `;
4328
4352
  }
4329
4353
  };
4330
- _e.styles = [J, Q, S`
4354
+ Ce.styles = [J, Q, S`
4331
4355
  :host { display: block; }
4332
4356
 
4333
4357
  .backdrop {
@@ -4426,7 +4450,7 @@ _e.styles = [J, Q, S`
4426
4450
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
4427
4451
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
4428
4452
  `];
4429
- let A = _e;
4453
+ let A = Ce;
4430
4454
  te([
4431
4455
  g()
4432
4456
  ], A.prototype, "_stream");
@@ -4442,12 +4466,12 @@ te([
4442
4466
  te([
4443
4467
  g()
4444
4468
  ], A.prototype, "_previewUrl");
4445
- var ut = Object.defineProperty, $ = (a, e, t, i) => {
4446
- for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
4447
- (s = a[o]) && (r = s(e, t, r) || r);
4448
- return r && ut(e, t, r), r;
4469
+ var vt = Object.defineProperty, $ = (a, e, t, o) => {
4470
+ for (var r = void 0, i = a.length - 1, s; i >= 0; i--)
4471
+ (s = a[i]) && (r = s(e, t, r) || r);
4472
+ return r && vt(e, t, r), r;
4449
4473
  };
4450
- const De = /* @__PURE__ */ new Set(["unsplash"]);
4474
+ const je = /* @__PURE__ */ new Set(["unsplash"]);
4451
4475
  var E;
4452
4476
  const k = (E = class extends U {
4453
4477
  constructor() {
@@ -4458,7 +4482,7 @@ const k = (E = class extends U {
4458
4482
  }, this._onSourceClick = async (e) => {
4459
4483
  this._handleSourceActivation(e.detail.source);
4460
4484
  }, this._handleSourceActivation = async (e) => {
4461
- var r, o;
4485
+ var r, i;
4462
4486
  const t = this._mergedSources.find((s) => s.id === e);
4463
4487
  if (t != null && t.onActivate) {
4464
4488
  try {
@@ -4485,14 +4509,14 @@ const k = (E = class extends U {
4485
4509
  this._showScreenCastDialog = !0;
4486
4510
  return;
4487
4511
  }
4488
- if ((((o = (r = this.config) == null ? void 0 : r.connectors) == null ? void 0 : o.providers) ?? []).includes(e)) {
4489
- if (De.has(e)) {
4512
+ if ((((i = (r = this.config) == null ? void 0 : r.connectors) == null ? void 0 : i.providers) ?? []).includes(e)) {
4513
+ if (je.has(e)) {
4490
4514
  if (!customElements.get("sfx-search-provider-browser")) {
4491
- const { SfxSearchProviderBrowser: n } = await import("./search-provider-browser-BYkWbFar.js");
4515
+ const { SfxSearchProviderBrowser: n } = await import("./search-provider-browser-gtlEKi5h.js");
4492
4516
  customElements.define("sfx-search-provider-browser", n);
4493
4517
  }
4494
4518
  } else if (!customElements.get("sfx-provider-browser")) {
4495
- const { SfxProviderBrowser: n } = await import("./provider-browser-CWEFYWp6.js");
4519
+ const { SfxProviderBrowser: n } = await import("./provider-browser-B33dyOPN.js");
4496
4520
  customElements.define("sfx-provider-browser", n);
4497
4521
  }
4498
4522
  this._activeConnector = e;
@@ -4500,16 +4524,16 @@ const k = (E = class extends U {
4500
4524
  }, this._onUrlSubmit = (e) => {
4501
4525
  var h, u, x;
4502
4526
  this._showUrlDialog = !1;
4503
- const { url: t, name: i } = e.detail, r = (h = this.config) == null ? void 0 : h.callbacks, o = We(i), s = o.startsWith("image/"), n = this._store.getState(), d = ae({ name: i, size: 0, type: o }, n.restrictions, n.files);
4527
+ const { url: t, name: o } = e.detail, r = (h = this.config) == null ? void 0 : h.callbacks, i = Ze(o), s = i.startsWith("image/"), n = this._store.getState(), d = ae({ name: o, size: 0, type: i }, n.restrictions, n.files);
4504
4528
  if (d) {
4505
4529
  const f = {
4506
4530
  id: q(),
4507
4531
  status: "rejected",
4508
4532
  file: null,
4509
4533
  remoteUrl: t,
4510
- name: i,
4534
+ name: o,
4511
4535
  size: 0,
4512
- type: o,
4536
+ type: i,
4513
4537
  previewUrl: null,
4514
4538
  duration: null,
4515
4539
  progress: 0,
@@ -4531,9 +4555,9 @@ const k = (E = class extends U {
4531
4555
  status: "idle",
4532
4556
  file: null,
4533
4557
  remoteUrl: t,
4534
- name: i,
4558
+ name: o,
4535
4559
  size: 0,
4536
- type: o,
4560
+ type: i,
4537
4561
  previewUrl: s ? t : null,
4538
4562
  duration: null,
4539
4563
  progress: 0,
@@ -4561,15 +4585,15 @@ const k = (E = class extends U {
4561
4585
  }, this._onFileRemove = (e) => {
4562
4586
  this._removeFile(e.detail.fileId);
4563
4587
  }, this._onFilePreview = (e) => {
4564
- var i, r, o;
4588
+ var o, r, i;
4565
4589
  const t = this._store.getState().files.get(e.detail.fileId);
4566
- t && (this._previewFileId = t.id, this._dispatchPublic(v.FILE_PREVIEW, { file: t }), (o = (r = (i = this.config) == null ? void 0 : i.callbacks) == null ? void 0 : r.onFilePreview) == null || o.call(r, t));
4590
+ t && (this._previewFileId = t.id, this._dispatchPublic(v.FILE_PREVIEW, { file: t }), (i = (r = (o = this.config) == null ? void 0 : o.callbacks) == null ? void 0 : r.onFilePreview) == null || i.call(r, t));
4567
4591
  }, this._onFillMetadata = () => {
4568
- var t, i, r;
4592
+ var t, o, r;
4569
4593
  const e = [...this._store.getState().files.values()].filter(
4570
- (o) => E._MODIFIABLE_STATUSES.has(o.status)
4594
+ (i) => E._MODIFIABLE_STATUSES.has(i.status)
4571
4595
  );
4572
- this._dispatchPublic(v.FILL_METADATA, { files: e }), (r = (i = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : i.onFillMetadata) == null || r.call(i, e);
4596
+ this._dispatchPublic(v.FILL_METADATA, { files: e }), (r = (o = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : o.onFillMetadata) == null || r.call(o, e);
4573
4597
  }, this._onFileRetry = (e) => {
4574
4598
  var t;
4575
4599
  this._ensureEngine(), (t = this._engine) == null || t.retryFile(e.detail.fileId);
@@ -4577,12 +4601,12 @@ const k = (E = class extends U {
4577
4601
  var e;
4578
4602
  this._ensureEngine(), (e = this._engine) == null || e.retryAll();
4579
4603
  }, this._onClearAll = () => {
4580
- var i, r, o;
4581
- const e = (i = this.config) == null ? void 0 : i.callbacks;
4604
+ var o, r, i;
4605
+ const e = (o = this.config) == null ? void 0 : o.callbacks;
4582
4606
  this._closeOnCompleteTimer && (clearTimeout(this._closeOnCompleteTimer), this._closeOnCompleteTimer = null), (r = this._engine) == null || r.cancelAll();
4583
4607
  const t = [...this._store.getState().files.values()];
4584
4608
  for (const s of t)
4585
- s.previewUrl && URL.revokeObjectURL(s.previewUrl), this._dispatchPublic(v.FILE_REMOVED, { file: s }), (o = e == null ? void 0 : e.onFileRemoved) == null || o.call(e, s);
4609
+ s.previewUrl && URL.revokeObjectURL(s.previewUrl), this._dispatchPublic(v.FILE_REMOVED, { file: s }), (i = e == null ? void 0 : e.onFileRemoved) == null || i.call(e, s);
4586
4610
  this._revokeVideoBlobUrls();
4587
4611
  for (const s of this._rejectedTimers.values()) clearTimeout(s);
4588
4612
  this._rejectedTimers.clear(), this._dimCache.clear(), this._previewFileId = null, this._fullscreenPreviewUrl = null, this._fullscreenVideoFile = null, this._store.setState({
@@ -4600,8 +4624,8 @@ const k = (E = class extends U {
4600
4624
  e.browse();
4601
4625
  return;
4602
4626
  }
4603
- const t = this.shadowRoot.querySelector("sfx-file-list"), i = (r = t == null ? void 0 : t.shadowRoot) == null ? void 0 : r.querySelector('input[type="file"]');
4604
- i == null || i.click();
4627
+ const t = this.shadowRoot.querySelector("sfx-file-list"), o = (r = t == null ? void 0 : t.shadowRoot) == null ? void 0 : r.querySelector('input[type="file"]');
4628
+ o == null || o.click();
4605
4629
  }, this._onUploadStart = () => {
4606
4630
  var e;
4607
4631
  if (this._phase === "complete") {
@@ -4612,8 +4636,8 @@ const k = (E = class extends U {
4612
4636
  }, this._onUploadMore = () => {
4613
4637
  this._onClearAll();
4614
4638
  }, this._onConnectorFilesSelected = (e) => {
4615
- var i, r, o;
4616
- const t = (i = this.config) == null ? void 0 : i.callbacks;
4639
+ var o, r, i;
4640
+ const t = (o = this.config) == null ? void 0 : o.callbacks;
4617
4641
  for (const s of e.detail.files) {
4618
4642
  const n = this._store.getState(), d = ae(
4619
4643
  { name: s.name, size: s.size, type: s.mimeType },
@@ -4666,7 +4690,7 @@ const k = (E = class extends U {
4666
4690
  tags: [],
4667
4691
  remoteInfo: s
4668
4692
  };
4669
- H(this._store, p), this._dispatchPublic(v.FILE_ADDED, { file: p }), (o = t == null ? void 0 : t.onFileAdded) == null || o.call(t, p);
4693
+ H(this._store, p), this._dispatchPublic(v.FILE_ADDED, { file: p }), (i = t == null ? void 0 : t.onFileAdded) == null || i.call(t, p);
4670
4694
  }
4671
4695
  this._activeConnector = null, this._store.getState().queueConfig.autoProceed && this.upload();
4672
4696
  }, this._onConnectorClose = () => {
@@ -4674,17 +4698,17 @@ const k = (E = class extends U {
4674
4698
  }, this._onConnectorBackdropClick = (e) => {
4675
4699
  e.target === e.currentTarget && (this._activeConnector = null);
4676
4700
  }, this._onPrimaryAction = () => {
4677
- var e, t, i, r, o;
4678
- this._dispatchPublic(v.COMPLETE_ACTION, {}), (i = (t = (e = this.config) == null ? void 0 : e.callbacks) == null ? void 0 : t.onCompleteAction) == null || i.call(t), ((r = this.config) == null ? void 0 : r.mode) === "modal" ? this.close() : ((o = this.config) == null ? void 0 : o.clearOnComplete) !== !1 && this._onClearAll();
4701
+ var e, t, o, r, i;
4702
+ this._dispatchPublic(v.COMPLETE_ACTION, {}), (o = (t = (e = this.config) == null ? void 0 : e.callbacks) == null ? void 0 : t.onCompleteAction) == null || o.call(t), ((r = this.config) == null ? void 0 : r.mode) === "modal" ? this.close() : ((i = this.config) == null ? void 0 : i.clearOnComplete) !== !1 && this._onClearAll();
4679
4703
  }, this._onInlineDismiss = () => {
4680
- var e, t, i;
4681
- (i = (t = (e = this.config) == null ? void 0 : e.callbacks) == null ? void 0 : t.onCancel) == null || i.call(t), this._dispatchPublic(v.CANCEL, {});
4704
+ var e, t, o;
4705
+ (o = (t = (e = this.config) == null ? void 0 : e.callbacks) == null ? void 0 : t.onCancel) == null || o.call(t), this._dispatchPublic(v.CANCEL, {});
4682
4706
  }, this._onSuccessCardClose = () => {
4683
- var e, t, i, r;
4684
- ((e = this.config) == null ? void 0 : e.mode) === "inline" ? (this._dispatchPublic(v.COMPLETE_ACTION, {}), (r = (i = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : i.onCompleteAction) == null || r.call(i), this._onClearAll()) : this._onModalDismiss();
4707
+ var e, t, o, r;
4708
+ ((e = this.config) == null ? void 0 : e.mode) === "inline" ? (this._dispatchPublic(v.COMPLETE_ACTION, {}), (r = (o = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : o.onCompleteAction) == null || r.call(o), this._onClearAll()) : this._onModalDismiss();
4685
4709
  }, this._onModalDismiss = () => {
4686
- var e, t, i, r;
4687
- this._phase === "uploading" && ((e = this._engine) == null || e.cancelAll()), (r = (i = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : i.onCancel) == null || r.call(i), this._dispatchPublic(v.CANCEL, {}), this.close();
4710
+ var e, t, o, r;
4711
+ this._phase === "uploading" && ((e = this._engine) == null || e.cancelAll()), (r = (o = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : o.onCancel) == null || r.call(o), this._dispatchPublic(v.CANCEL, {}), this.close();
4688
4712
  }, this._onMinimize = () => {
4689
4713
  this._isMinimized = !0, this._isPillExpanded = !0, this.requestUpdate();
4690
4714
  }, this._onPillClick = () => {
@@ -4692,8 +4716,8 @@ const k = (E = class extends U {
4692
4716
  }, this._onPillExpand = () => {
4693
4717
  this._isMinimized = !1, this._isPillExpanded = !1, this._isOpen = !0, this.requestUpdate();
4694
4718
  }, this._onPillDismiss = () => {
4695
- var e, t, i, r;
4696
- this._isMinimized = !1, this._isPillExpanded = !1, this._phase === "uploading" && ((e = this._engine) == null || e.cancelAll()), (r = (i = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : i.onCancel) == null || r.call(i), this._dispatchPublic(v.CANCEL, {}), this.close();
4719
+ var e, t, o, r;
4720
+ this._isMinimized = !1, this._isPillExpanded = !1, this._phase === "uploading" && ((e = this._engine) == null || e.cancelAll()), (r = (o = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : o.onCancel) == null || r.call(o), this._dispatchPublic(v.CANCEL, {}), this.close();
4697
4721
  }, this._onModalBackdropClick = (e) => {
4698
4722
  e.target === e.currentTarget && this._onModalDismiss();
4699
4723
  }, this._onBodyDragEnter = (e) => {
@@ -4703,25 +4727,25 @@ const k = (E = class extends U {
4703
4727
  }, this._onBodyDragLeave = (e) => {
4704
4728
  e.preventDefault(), this._bodyDragCounter--, this._bodyDragCounter <= 0 && (this._bodyDragCounter = 0, this._bodyDragOver = !1);
4705
4729
  }, this._onBodyDrop = (e) => {
4706
- var i;
4730
+ var o;
4707
4731
  e.preventDefault(), this._bodyDragCounter = 0, this._bodyDragOver = !1;
4708
- const t = Array.from(((i = e.dataTransfer) == null ? void 0 : i.files) ?? []);
4732
+ const t = Array.from(((o = e.dataTransfer) == null ? void 0 : o.files) ?? []);
4709
4733
  t.length > 0 && this._onFilesSelected(
4710
4734
  new CustomEvent("files-selected", { detail: { files: t } })
4711
4735
  );
4712
4736
  }, this._onKeyDown = (e) => {
4713
- var t, i;
4737
+ var t, o;
4714
4738
  if (e.key === "Escape") {
4715
4739
  if (this._fullscreenPreviewUrl || this._fullscreenVideoFile) {
4716
4740
  this._onFsClose();
4717
4741
  return;
4718
4742
  }
4719
- this._isOpen && ((t = this.config) == null ? void 0 : t.mode) === "modal" && (((i = this.config) == null ? void 0 : i.headerButton) ?? "close") !== "none" && this._onModalDismiss();
4743
+ this._isOpen && ((t = this.config) == null ? void 0 : t.mode) === "modal" && (((o = this.config) == null ? void 0 : o.headerButton) ?? "close") !== "none" && this._onModalDismiss();
4720
4744
  }
4721
4745
  }, this._dimCache = /* @__PURE__ */ new Map(), this._onSplitPointerDown = (e) => {
4722
- var i;
4746
+ var o;
4723
4747
  e.preventDefault(), this._isResizing = !0;
4724
- const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".preview-layout");
4748
+ const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".preview-layout");
4725
4749
  t == null || t.classList.add("resizing"), e.target.setPointerCapture(e.pointerId);
4726
4750
  }, this._onSplitPointerMove = (e) => {
4727
4751
  if (!this._isResizing || this._splitRafId) return;
@@ -4729,10 +4753,10 @@ const k = (E = class extends U {
4729
4753
  this._splitRafId = requestAnimationFrame(() => {
4730
4754
  var s;
4731
4755
  this._splitRafId = 0;
4732
- const i = (s = this.shadowRoot) == null ? void 0 : s.querySelector(".preview-layout");
4733
- if (!i) return;
4734
- const r = i.getBoundingClientRect(), o = (t - r.left) / r.width * 100;
4735
- this._splitPct = Math.max(25, Math.min(75, o));
4756
+ const o = (s = this.shadowRoot) == null ? void 0 : s.querySelector(".preview-layout");
4757
+ if (!o) return;
4758
+ const r = o.getBoundingClientRect(), i = (t - r.left) / r.width * 100;
4759
+ this._splitPct = Math.max(25, Math.min(75, i));
4736
4760
  });
4737
4761
  }, this._onSplitPointerUp = () => {
4738
4762
  var t;
@@ -4747,8 +4771,8 @@ const k = (E = class extends U {
4747
4771
  this._fullscreenZoomed && (this._fsDragging = !0, this._fsDragDidMove = !1, this._fsDragStartX = e.clientX, this._fsDragStartY = e.clientY, this._fsPanStartX = this._fsPanX, this._fsPanStartY = this._fsPanY, e.preventDefault());
4748
4772
  }, this._onFsPanMove = (e) => {
4749
4773
  if (!this._fsDragging) return;
4750
- const t = e.clientX - this._fsDragStartX, i = e.clientY - this._fsDragStartY;
4751
- (Math.abs(t) > 3 || Math.abs(i) > 3) && (this._fsDragDidMove = !0), this._fsPanX = this._fsPanStartX + t, this._fsPanY = this._fsPanStartY + i, this.requestUpdate();
4774
+ const t = e.clientX - this._fsDragStartX, o = e.clientY - this._fsDragStartY;
4775
+ (Math.abs(t) > 3 || Math.abs(o) > 3) && (this._fsDragDidMove = !0), this._fsPanX = this._fsPanStartX + t, this._fsPanY = this._fsPanStartY + o, this.requestUpdate();
4752
4776
  }, this._onFsPanEnd = () => {
4753
4777
  this._fsDragging = !1, requestAnimationFrame(() => {
4754
4778
  this._fsDragDidMove = !1;
@@ -4759,26 +4783,26 @@ const k = (E = class extends U {
4759
4783
  this._fsDragging = !0, this._fsDragDidMove = !1, this._fsDragStartX = t.clientX, this._fsDragStartY = t.clientY, this._fsPanStartX = this._fsPanX, this._fsPanStartY = this._fsPanY;
4760
4784
  }, this._onFsTouchMove = (e) => {
4761
4785
  if (!this._fsDragging || e.touches.length !== 1) return;
4762
- const t = e.touches[0], i = t.clientX - this._fsDragStartX, r = t.clientY - this._fsDragStartY;
4763
- (Math.abs(i) > 3 || Math.abs(r) > 3) && (this._fsDragDidMove = !0), this._fsPanX = this._fsPanStartX + i, this._fsPanY = this._fsPanStartY + r, this.requestUpdate(), e.preventDefault();
4786
+ const t = e.touches[0], o = t.clientX - this._fsDragStartX, r = t.clientY - this._fsDragStartY;
4787
+ (Math.abs(o) > 3 || Math.abs(r) > 3) && (this._fsDragDidMove = !0), this._fsPanX = this._fsPanStartX + o, this._fsPanY = this._fsPanStartY + r, this.requestUpdate(), e.preventDefault();
4764
4788
  }, this._onFsClose = (e) => {
4765
4789
  e == null || e.stopPropagation(), this._fullscreenPreviewUrl = null, this._fullscreenVideoFile = null, this._fullscreenZoomed = !1, this._fsPanX = 0, this._fsPanY = 0;
4766
- }, this._store = Oe(), this._storeCtrl = new Re(this, this._store);
4790
+ }, this._store = Te(), this._storeCtrl = new Be(this, this._store);
4767
4791
  }
4768
4792
  // --- Public API ---
4769
4793
  /** Open the uploader (modal mode). */
4770
4794
  open() {
4771
- var e, t, i;
4772
- this._isMinimized && (this._isMinimized = !1, this._isPillExpanded = !1), !this._isOpen && (this._isOpen = !0, (i = (t = (e = this.config) == null ? void 0 : e.callbacks) == null ? void 0 : t.onOpen) == null || i.call(t), this._dispatchPublic(v.OPEN, {}), this.requestUpdate());
4795
+ var e, t, o;
4796
+ this._isMinimized && (this._isMinimized = !1, this._isPillExpanded = !1), !this._isOpen && (this._isOpen = !0, (o = (t = (e = this.config) == null ? void 0 : e.callbacks) == null ? void 0 : t.onOpen) == null || o.call(t), this._dispatchPublic(v.OPEN, {}), this.requestUpdate());
4773
4797
  }
4774
4798
  /** Close the uploader (modal mode). Optionally clears all files (controlled by clearOnClose config). */
4775
4799
  close() {
4776
- var e, t, i, r;
4777
- this._isOpen && (this._isOpen = !1, this._closeOnCompleteTimer && (clearTimeout(this._closeOnCompleteTimer), this._closeOnCompleteTimer = null), ((e = this.config) == null ? void 0 : e.clearOnClose) !== !1 && this._onClearAll(), this._previewFileId = null, (r = (i = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : i.onClose) == null || r.call(i), this._dispatchPublic(v.CLOSE, {}), this.requestUpdate());
4800
+ var e, t, o, r;
4801
+ this._isOpen && (this._isOpen = !1, this._closeOnCompleteTimer && (clearTimeout(this._closeOnCompleteTimer), this._closeOnCompleteTimer = null), ((e = this.config) == null ? void 0 : e.clearOnClose) !== !1 && this._onClearAll(), this._previewFileId = null, (r = (o = (t = this.config) == null ? void 0 : t.callbacks) == null ? void 0 : o.onClose) == null || r.call(o), this._dispatchPublic(v.CLOSE, {}), this.requestUpdate());
4778
4802
  }
4779
4803
  /** Start uploading all queued files. */
4780
4804
  upload() {
4781
- var r, o, s, n, d, p, h;
4805
+ var r, i, s, n, d, p, h;
4782
4806
  if (this._ensureEngine(), !this._engine) {
4783
4807
  console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");
4784
4808
  return;
@@ -4786,7 +4810,7 @@ const k = (E = class extends U {
4786
4810
  const e = [...this._store.getState().files.values()].filter(
4787
4811
  (u) => u.status === "idle" || u.status === "queued"
4788
4812
  );
4789
- if ((o = (r = this.config) == null ? void 0 : r.callbacks) != null && o.onBeforeUpload && this.config.callbacks.onBeforeUpload(e) === !1)
4813
+ if ((i = (r = this.config) == null ? void 0 : r.callbacks) != null && i.onBeforeUpload && this.config.callbacks.onBeforeUpload(e) === !1)
4790
4814
  return;
4791
4815
  const t = new CustomEvent(v.BEFORE_UPLOAD, {
4792
4816
  bubbles: !0,
@@ -4804,13 +4828,13 @@ const k = (E = class extends U {
4804
4828
  resumeUpload(e) {
4805
4829
  var t;
4806
4830
  if (e && e.length > 0) {
4807
- const i = this._store.getState().files, r = new Map(i);
4808
- let o = !1;
4831
+ const o = this._store.getState().files, r = new Map(o);
4832
+ let i = !1;
4809
4833
  for (const s of e) {
4810
- const n = i.get(s.id);
4811
- n && (r.set(s.id, { ...n, ...s }), o = !0);
4834
+ const n = o.get(s.id);
4835
+ n && (r.set(s.id, { ...n, ...s }), i = !0);
4812
4836
  }
4813
- o && this._store.setState({ files: r });
4837
+ i && this._store.setState({ files: r });
4814
4838
  }
4815
4839
  this._ensureEngine(), (t = this._engine) == null || t.uploadAll();
4816
4840
  }
@@ -4828,35 +4852,35 @@ const k = (E = class extends U {
4828
4852
  return this._store.getState().files.get(e);
4829
4853
  }
4830
4854
  /** Update metadata and/or tags for a single file. */
4831
- updateFileMeta(e, t, i) {
4832
- const r = this._store.getState().files, o = r.get(e);
4833
- if (!o || !E._MODIFIABLE_STATUSES.has(o.status)) return;
4855
+ updateFileMeta(e, t, o) {
4856
+ const r = this._store.getState().files, i = r.get(e);
4857
+ if (!i || !E._MODIFIABLE_STATUSES.has(i.status)) return;
4834
4858
  const s = new Map(r);
4835
4859
  s.set(e, {
4836
- ...o,
4837
- meta: t != null ? { ...o.meta, ...t } : o.meta,
4838
- tags: i ?? o.tags
4860
+ ...i,
4861
+ meta: t != null ? { ...i.meta, ...t } : i.meta,
4862
+ tags: o ?? i.tags
4839
4863
  }), this._store.setState({ files: s });
4840
4864
  }
4841
4865
  /** Batch-update metadata and/or tags for multiple files. */
4842
4866
  updateFilesMeta(e) {
4843
- const t = this._store.getState().files, i = new Map(t);
4867
+ const t = this._store.getState().files, o = new Map(t);
4844
4868
  let r = !1;
4845
- for (const { fileId: o, meta: s, tags: n } of e) {
4846
- const d = t.get(o);
4847
- !d || !E._MODIFIABLE_STATUSES.has(d.status) || (i.set(o, {
4869
+ for (const { fileId: i, meta: s, tags: n } of e) {
4870
+ const d = t.get(i);
4871
+ !d || !E._MODIFIABLE_STATUSES.has(d.status) || (o.set(i, {
4848
4872
  ...d,
4849
4873
  meta: s != null ? { ...d.meta, ...s } : d.meta,
4850
4874
  tags: n ?? d.tags
4851
4875
  }), r = !0);
4852
4876
  }
4853
- r && this._store.setState({ files: i });
4877
+ r && this._store.setState({ files: o });
4854
4878
  }
4855
4879
  // --- Lifecycle ---
4856
4880
  updated(e) {
4857
4881
  if (e.has("config") && this.config && this._applyConfig(this.config), e.has("_previewFileId") && this._previewFileId) {
4858
- const t = this._previewFileId, i = this._store.getState().files.get(t);
4859
- i ? this._getImageDimensions(i).then((r) => {
4882
+ const t = this._previewFileId, o = this._store.getState().files.get(t);
4883
+ o ? this._getImageDimensions(o).then((r) => {
4860
4884
  this._previewFileId === t && (this._previewDims = r ? `${r.w} × ${r.h}` : "—");
4861
4885
  }) : this._previewDims = "—";
4862
4886
  }
@@ -4937,12 +4961,12 @@ const k = (E = class extends U {
4937
4961
  super.connectedCallback(), document.addEventListener("keydown", this._onKeyDown), this._prevStoreState = this._store.getState(), this._unsubStoreEvents = this._store.subscribe(() => this._onStoreChange());
4938
4962
  }
4939
4963
  disconnectedCallback() {
4940
- var e, t, i, r;
4941
- super.disconnectedCallback(), document.removeEventListener("keydown", this._onKeyDown), (e = this._unsubStoreEvents) == null || e.call(this), this._unsubStoreEvents = null, this._prevStoreState = null, (t = this._portalContainer) == null || t.remove(), this._portalContainer = null, document.querySelector("[data-sfx-upload-float]") || (i = document.querySelector("style[data-sfx-upload-float-styles]")) == null || i.remove(), this._revokeVideoBlobUrls();
4942
- for (const o of this._rejectedTimers.values()) clearTimeout(o);
4964
+ var e, t, o, r;
4965
+ super.disconnectedCallback(), document.removeEventListener("keydown", this._onKeyDown), (e = this._unsubStoreEvents) == null || e.call(this), this._unsubStoreEvents = null, this._prevStoreState = null, (t = this._portalContainer) == null || t.remove(), this._portalContainer = null, document.querySelector("[data-sfx-upload-float]") || (o = document.querySelector("style[data-sfx-upload-float-styles]")) == null || o.remove(), this._revokeVideoBlobUrls();
4966
+ for (const i of this._rejectedTimers.values()) clearTimeout(i);
4943
4967
  this._rejectedTimers.clear(), this._closeOnCompleteTimer && (clearTimeout(this._closeOnCompleteTimer), this._closeOnCompleteTimer = null);
4944
- for (const o of this._store.getState().files.values())
4945
- o.previewUrl && URL.revokeObjectURL(o.previewUrl);
4968
+ for (const i of this._store.getState().files.values())
4969
+ i.previewUrl && URL.revokeObjectURL(i.previewUrl);
4946
4970
  (r = this._engine) == null || r.destroy(), this._engine = null;
4947
4971
  }
4948
4972
  // --- Config ---
@@ -4952,40 +4976,40 @@ const k = (E = class extends U {
4952
4976
  ...this._store.getState().restrictions,
4953
4977
  ...e.restrictions
4954
4978
  }), e.concurrency != null) {
4955
- const i = this._store.getState().queueConfig;
4956
- t.queueConfig = { ...i, concurrency: e.concurrency };
4979
+ const o = this._store.getState().queueConfig;
4980
+ t.queueConfig = { ...o, concurrency: e.concurrency };
4957
4981
  }
4958
4982
  if (e.autoProceed != null) {
4959
- const i = t.queueConfig ?? this._store.getState().queueConfig;
4960
- t.queueConfig = { ...i, autoProceed: e.autoProceed };
4983
+ const o = t.queueConfig ?? this._store.getState().queueConfig;
4984
+ t.queueConfig = { ...o, autoProceed: e.autoProceed };
4961
4985
  }
4962
4986
  Object.keys(t).length > 0 && this._store.setState(t), this._resolveAuthAndEngine(e), (e.mode === "inline" || !e.mode) && (this._isOpen = !0);
4963
4987
  }
4964
4988
  async _resolveAuthAndEngine(e) {
4965
- var r, o;
4989
+ var r, i;
4966
4990
  const t = e.auth;
4967
4991
  if (t.mode === "sass-key") {
4968
- this._apiBase = pe(t.container), this._authHeaders = se(t), this._ensureEngine(), (r = this._engine) == null || r.updateConfig({
4992
+ this._apiBase = fe(t.container), this._authHeaders = se(t), this._ensureEngine(), (r = this._engine) == null || r.updateConfig({
4969
4993
  apiBase: this._apiBase,
4970
4994
  authHeaders: this._authHeaders
4971
4995
  });
4972
4996
  return;
4973
4997
  }
4974
- const i = ++this._authResolveId;
4998
+ const o = ++this._authResolveId;
4975
4999
  try {
4976
- const s = await Ye(t);
4977
- if (i !== this._authResolveId) return;
4978
- this._apiBase = s.apiBase, this._authHeaders = s.headers, this._ensureEngine(), (o = this._engine) == null || o.updateConfig({
5000
+ const s = await Xe(t);
5001
+ if (o !== this._authResolveId) return;
5002
+ this._apiBase = s.apiBase, this._authHeaders = s.headers, this._ensureEngine(), (i = this._engine) == null || i.updateConfig({
4979
5003
  apiBase: this._apiBase,
4980
5004
  authHeaders: this._authHeaders
4981
5005
  });
4982
5006
  } catch (s) {
4983
- if (i !== this._authResolveId) return;
5007
+ if (o !== this._authResolveId) return;
4984
5008
  console.error("[sfx-uploader] Auth resolution failed:", s);
4985
5009
  }
4986
5010
  }
4987
5011
  _ensureEngine() {
4988
- !this._engine && this._apiBase && this._authHeaders && (this._engine = new He(this._store, {
5012
+ !this._engine && this._apiBase && this._authHeaders && (this._engine = new Ve(this._store, {
4989
5013
  apiBase: this._apiBase,
4990
5014
  authHeaders: this._authHeaders
4991
5015
  }), this._engine.start());
@@ -5001,10 +5025,10 @@ const k = (E = class extends U {
5001
5025
  * for file status transitions.
5002
5026
  */
5003
5027
  _onStoreChange() {
5004
- var r, o, s, n, d, p, h, u;
5028
+ var r, i, s, n, d, p, h, u;
5005
5029
  const e = this._store.getState(), t = this._prevStoreState;
5006
5030
  if (this._prevStoreState = e, !t) return;
5007
- const i = (r = this.config) == null ? void 0 : r.callbacks;
5031
+ const o = (r = this.config) == null ? void 0 : r.callbacks;
5008
5032
  for (const [x, f] of e.files) {
5009
5033
  const m = t.files.get(x);
5010
5034
  if (m) {
@@ -5013,19 +5037,19 @@ const k = (E = class extends U {
5013
5037
  case "uploading":
5014
5038
  break;
5015
5039
  case "complete":
5016
- f.response && (this._dispatchPublic(v.UPLOAD_COMPLETE, { file: f, response: f.response }), (o = i == null ? void 0 : i.onUploadComplete) == null || o.call(i, f, f.response));
5040
+ f.response && (this._dispatchPublic(v.UPLOAD_COMPLETE, { file: f, response: f.response }), (i = o == null ? void 0 : o.onUploadComplete) == null || i.call(o, f, f.response));
5017
5041
  break;
5018
5042
  case "error":
5019
5043
  case "failed": {
5020
5044
  const _ = new Error(f.error ?? "Upload failed");
5021
- this._dispatchPublic(v.UPLOAD_ERROR, { file: f, error: _ }), (s = i == null ? void 0 : i.onUploadError) == null || s.call(i, f, _);
5045
+ this._dispatchPublic(v.UPLOAD_ERROR, { file: f, error: _ }), (s = o == null ? void 0 : o.onUploadError) == null || s.call(o, f, _);
5022
5046
  break;
5023
5047
  }
5024
5048
  case "retrying":
5025
- this._dispatchPublic(v.UPLOAD_RETRY, { file: f, attempt: f.retryCount }), (n = i == null ? void 0 : i.onUploadRetry) == null || n.call(i, f, f.retryCount);
5049
+ this._dispatchPublic(v.UPLOAD_RETRY, { file: f, attempt: f.retryCount }), (n = o == null ? void 0 : o.onUploadRetry) == null || n.call(o, f, f.retryCount);
5026
5050
  break;
5027
5051
  }
5028
- f.status === "uploading" && m.progress !== f.progress && (this._dispatchPublic(v.UPLOAD_PROGRESS, { file: f, progress: f.progress, speed: f.speed }), (d = i == null ? void 0 : i.onUploadProgress) == null || d.call(i, f, f.progress, f.speed));
5052
+ f.status === "uploading" && m.progress !== f.progress && (this._dispatchPublic(v.UPLOAD_PROGRESS, { file: f, progress: f.progress, speed: f.speed }), (d = o == null ? void 0 : o.onUploadProgress) == null || d.call(o, f, f.progress, f.speed));
5029
5053
  }
5030
5054
  }
5031
5055
  if (e.totalProgress !== t.totalProgress || e.totalSpeed !== t.totalSpeed) {
@@ -5034,19 +5058,19 @@ const k = (E = class extends U {
5034
5058
  percentage: e.totalProgress,
5035
5059
  speed: e.totalSpeed,
5036
5060
  eta: x
5037
- }), (p = i == null ? void 0 : i.onTotalProgress) == null || p.call(i, e.totalProgress, e.totalSpeed, x);
5061
+ }), (p = o == null ? void 0 : o.onTotalProgress) == null || p.call(o, e.totalProgress, e.totalSpeed, x);
5038
5062
  }
5039
5063
  if (t.isUploading && !e.isUploading) {
5040
5064
  const x = [...e.files.values()];
5041
5065
  if (!x.some((m) => m.status === "cancelled")) {
5042
5066
  const m = x.filter((y) => y.status === "complete"), _ = x.filter((y) => y.status === "failed" || y.status === "error");
5043
- this._dispatchPublic(v.ALL_COMPLETE, { successful: m, failed: _ }), (h = i == null ? void 0 : i.onAllComplete) == null || h.call(i, m, _);
5067
+ this._dispatchPublic(v.ALL_COMPLETE, { successful: m, failed: _ }), (h = o == null ? void 0 : o.onAllComplete) == null || h.call(o, m, _);
5044
5068
  const w = (u = this.config) == null ? void 0 : u.closeOnComplete;
5045
5069
  if (w) {
5046
5070
  const y = typeof w == "number" ? w : 1500;
5047
5071
  this._closeOnCompleteTimer = setTimeout(() => {
5048
- var C, D, ke;
5049
- this._closeOnCompleteTimer = null, this._phase === "complete" && (this._dispatchPublic(v.COMPLETE_ACTION, {}), (ke = (D = (C = this.config) == null ? void 0 : C.callbacks) == null ? void 0 : D.onCompleteAction) == null || ke.call(D), this.close());
5072
+ var C, D, $e;
5073
+ this._closeOnCompleteTimer = null, this._phase === "complete" && (this._dispatchPublic(v.COMPLETE_ACTION, {}), ($e = (D = (C = this.config) == null ? void 0 : C.callbacks) == null ? void 0 : D.onCompleteAction) == null || $e.call(D), this.close());
5050
5074
  }, y);
5051
5075
  }
5052
5076
  }
@@ -5058,8 +5082,8 @@ const k = (E = class extends U {
5058
5082
  if (e === this._cachedSourcesConfig) return this._cachedSources;
5059
5083
  if (this._cachedSourcesConfig = e, !e)
5060
5084
  return this._cachedSources = W, this._cachedSources;
5061
- const t = e.providers.length > 0 ? Ze(e.providers) : [], i = e.customSources ?? [], r = W.filter((p) => p.id === "device" || p.id === "url"), o = W.filter((p) => p.id !== "device" && p.id !== "url"), s = /* @__PURE__ */ new Set(), n = [];
5062
- for (const p of [...r, ...t, ...o, ...i])
5085
+ const t = e.providers.length > 0 ? et(e.providers) : [], o = e.customSources ?? [], r = W.filter((p) => p.id === "device" || p.id === "url"), i = W.filter((p) => p.id !== "device" && p.id !== "url"), s = /* @__PURE__ */ new Set(), n = [];
5086
+ for (const p of [...r, ...t, ...i, ...o])
5063
5087
  if (!s.has(p.id)) {
5064
5088
  if (E._RESERVED_IDS.has(p.id) && p.onActivate) {
5065
5089
  console.warn(`[sfx-uploader] Custom source id "${p.id}" conflicts with a built-in source and was skipped.`);
@@ -5074,15 +5098,15 @@ const k = (E = class extends U {
5074
5098
  const e = this._storeCtrl.state, t = [...e.files.values()];
5075
5099
  if (t.length === 0) return "empty";
5076
5100
  if (e.isUploading) return "uploading";
5077
- const i = /* @__PURE__ */ new Set(["complete", "rejected", "cancelled", "failed"]);
5078
- return t.every((r) => i.has(r.status)) && t.some((r) => r.status === "complete" || r.status === "failed") ? "complete" : "ready";
5101
+ const o = /* @__PURE__ */ new Set(["complete", "rejected", "cancelled", "failed"]);
5102
+ return t.every((r) => o.has(r.status)) && t.some((r) => r.status === "complete" || r.status === "failed") ? "complete" : "ready";
5079
5103
  }
5080
5104
  // --- File handling ---
5081
5105
  _processIncomingFiles(e) {
5082
- var i, r, o, s;
5083
- const t = (i = this.config) == null ? void 0 : i.callbacks;
5106
+ var o, r, i, s;
5107
+ const t = (o = this.config) == null ? void 0 : o.callbacks;
5084
5108
  for (const n of e) {
5085
- const d = this._store.getState(), p = Ge(n, d.restrictions, d.files);
5109
+ const d = this._store.getState(), p = Qe(n, d.restrictions, d.files);
5086
5110
  if (p) {
5087
5111
  const x = n.type.startsWith("image/") ? URL.createObjectURL(n) : null, f = {
5088
5112
  id: q(),
@@ -5106,12 +5130,12 @@ const k = (E = class extends U {
5106
5130
  remoteInfo: null
5107
5131
  };
5108
5132
  H(this._store, f), this._dispatchPublic(v.FILE_REJECTED, { file: f, reason: p }), (r = t == null ? void 0 : t.onFileRejected) == null || r.call(t, f, p);
5109
- const m = (o = this.config) == null ? void 0 : o.rejectedFileAutoRemoveDelay, _ = m === !1 || m === 0 || m === void 0 ? 0 : m;
5133
+ const m = (i = this.config) == null ? void 0 : i.rejectedFileAutoRemoveDelay, _ = m === !1 || m === 0 || m === void 0 ? 0 : m;
5110
5134
  if (_ > 0) {
5111
5135
  const w = f.id, y = setTimeout(() => {
5112
5136
  this._rejectedTimers.delete(w);
5113
5137
  const C = this._store.getState().files.get(w);
5114
- C && C.status === "rejected" && Ce(this._store, w);
5138
+ C && C.status === "rejected" && Se(this._store, w);
5115
5139
  }, _);
5116
5140
  this._rejectedTimers.set(w, y);
5117
5141
  }
@@ -5141,7 +5165,7 @@ const k = (E = class extends U {
5141
5165
  remoteInfo: null
5142
5166
  };
5143
5167
  if (H(this._store, u), this._dispatchPublic(v.FILE_ADDED, { file: u }), (s = t == null ? void 0 : t.onFileAdded) == null || s.call(t, u), n.type.startsWith("video/")) {
5144
- Ke(n).then((f) => {
5168
+ Je(n).then((f) => {
5145
5169
  if (!f) return;
5146
5170
  const m = this._store.getState(), _ = m.files.get(u.id);
5147
5171
  if (_) {
@@ -5167,21 +5191,21 @@ const k = (E = class extends U {
5167
5191
  this._store.getState().queueConfig.autoProceed && this.upload();
5168
5192
  }
5169
5193
  _removeFile(e) {
5170
- var o, s, n, d;
5194
+ var i, s, n, d;
5171
5195
  const t = this._store.getState().files.get(e);
5172
5196
  if (!t) return;
5173
- const i = { ...t };
5197
+ const o = { ...t };
5174
5198
  if ((this._fullscreenPreviewUrl && this._fullscreenPreviewUrl === t.previewUrl || this._fullscreenVideoFile && this._fullscreenVideoFile === t.file) && (this._fullscreenPreviewUrl = null, this._fullscreenVideoFile = null), t.previewUrl && URL.revokeObjectURL(t.previewUrl), t.file) {
5175
5199
  const p = this._videoBlobUrls.get(t.file);
5176
5200
  p && (URL.revokeObjectURL(p), this._videoBlobUrls.delete(t.file));
5177
5201
  }
5178
- (t.status === "uploading" || t.status === "queued" || t.status === "retrying") && ((o = this._engine) == null || o.cancelFile(e)), Ce(this._store, e), this._dimCache.delete(e);
5202
+ (t.status === "uploading" || t.status === "queued" || t.status === "retrying") && ((i = this._engine) == null || i.cancelFile(e)), Se(this._store, e), this._dimCache.delete(e);
5179
5203
  const r = this._rejectedTimers.get(e);
5180
5204
  if (r && (clearTimeout(r), this._rejectedTimers.delete(e)), this._previewFileId === e) {
5181
5205
  const p = [...this._store.getState().files.values()];
5182
5206
  this._previewFileId = p.length > 0 ? p[0].id : null;
5183
5207
  }
5184
- this._dispatchPublic(v.FILE_REMOVED, { file: i }), (d = (n = (s = this.config) == null ? void 0 : s.callbacks) == null ? void 0 : n.onFileRemoved) == null || d.call(n, i);
5208
+ this._dispatchPublic(v.FILE_REMOVED, { file: o }), (d = (n = (s = this.config) == null ? void 0 : s.callbacks) == null ? void 0 : n.onFileRemoved) == null || d.call(n, o);
5185
5209
  }
5186
5210
  // --- Render ---
5187
5211
  render() {
@@ -5216,17 +5240,17 @@ const k = (E = class extends U {
5216
5240
  </div>
5217
5241
  <div>
5218
5242
  <div class="float-title">Uploading ${p.length} ${p.length === 1 ? "file" : "files"}</div>
5219
- <div class="float-subtitle">${h} of ${p.length}${u > 0 ? ` · ~${oe(u)} left` : ""}</div>
5243
+ <div class="float-subtitle">${h} of ${p.length}${u > 0 ? ` · ~${ie(u)} left` : ""}</div>
5220
5244
  </div>
5221
5245
  </div>
5222
5246
  </div>
5223
5247
  `;
5224
5248
  }
5225
- const e = ((s = this.config) == null ? void 0 : s.mode) ?? "modal", t = ((n = this.config) == null ? void 0 : n.headerButton) ?? (e === "modal" ? "close" : "none"), i = e === "modal" ? this._onModalDismiss : this._onInlineDismiss, r = t === "back" ? l`<button class="header-btn header-btn-back" aria-label="Back to Asset Picker" @click=${i}>
5249
+ const e = ((s = this.config) == null ? void 0 : s.mode) ?? "modal", t = ((n = this.config) == null ? void 0 : n.headerButton) ?? (e === "modal" ? "close" : "none"), o = e === "modal" ? this._onModalDismiss : this._onInlineDismiss, r = t === "back" ? l`<button class="header-btn header-btn-back" aria-label="Back to Asset Picker" @click=${o}>
5226
5250
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
5227
5251
  <polyline points="15 18 9 12 15 6"/>
5228
5252
  </svg>
5229
- </button>` : c, o = t === "close" ? l`<button class="header-btn header-btn-close" aria-label="Close" @click=${i}>
5253
+ </button>` : c, i = t === "close" ? l`<button class="header-btn header-btn-close" aria-label="Close" @click=${o}>
5230
5254
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
5231
5255
  <line x1="18" y1="6" x2="6" y2="18" />
5232
5256
  <line x1="6" y1="6" x2="18" y2="18" />
@@ -5244,45 +5268,45 @@ const k = (E = class extends U {
5244
5268
  </svg>
5245
5269
  </div>` : c}
5246
5270
  <div class="header-title">Upload Files</div>
5247
- ${o}
5271
+ ${i}
5248
5272
  </div>
5249
5273
  `;
5250
5274
  }
5251
5275
  _getImageDimensions(e) {
5252
5276
  return e.previewUrl ? this._dimCache.has(e.id) ? Promise.resolve(this._dimCache.get(e.id)) : new Promise((t) => {
5253
- const i = new Image();
5254
- i.onload = () => {
5255
- const r = { w: i.naturalWidth, h: i.naturalHeight };
5277
+ const o = new Image();
5278
+ o.onload = () => {
5279
+ const r = { w: o.naturalWidth, h: o.naturalHeight };
5256
5280
  this._dimCache.set(e.id, r), t(r);
5257
- }, i.onerror = () => {
5281
+ }, o.onerror = () => {
5258
5282
  this._dimCache.set(e.id, null), t(null);
5259
- }, i.src = e.previewUrl;
5283
+ }, o.src = e.previewUrl;
5260
5284
  }) : Promise.resolve(null);
5261
5285
  }
5262
5286
  _renderUploadOverlay(e) {
5263
5287
  var s;
5264
- const t = this._storeCtrl.state, i = Math.round(t.totalProgress ?? 0), r = e.filter((n) => n.status === "complete").length, o = t.totalSpeed > 0 ? (t.totalBytes - t.totalBytesUploaded) / t.totalSpeed : 0;
5288
+ const t = this._storeCtrl.state, o = Math.round(t.totalProgress ?? 0), r = e.filter((n) => n.status === "complete").length, i = t.totalSpeed > 0 ? (t.totalBytes - t.totalBytesUploaded) / t.totalSpeed : 0;
5265
5289
  return l`
5266
5290
  <div class="upload-overlay">
5267
5291
  <div class="upload-overlay-spinner"></div>
5268
- <div class="upload-overlay-percent">${i}%</div>
5292
+ <div class="upload-overlay-percent">${o}%</div>
5269
5293
  <div class="upload-overlay-title">Uploading ${e.length} ${e.length === 1 ? "file" : "files"}</div>
5270
- <div class="upload-overlay-subtitle">${r} of ${e.length} complete${o > 0 ? l` · ~${oe(o)} left` : c}</div>
5294
+ <div class="upload-overlay-subtitle">${r} of ${e.length} complete${i > 0 ? l` · ~${ie(i)} left` : c}</div>
5271
5295
  <div class="upload-overlay-bar">
5272
- <div class="upload-overlay-bar-fill" style="width:${i}%"></div>
5296
+ <div class="upload-overlay-bar-fill" style="width:${o}%"></div>
5273
5297
  </div>
5274
5298
  ${(s = this.config) != null && s.minimizeOnUpload ? l`<button class="upload-overlay-minimize" @click=${this._onMinimize}>Minimize & continue in background</button>` : c}
5275
5299
  </div>
5276
5300
  `;
5277
5301
  }
5278
5302
  _renderFloatingPill(e) {
5279
- const t = this._storeCtrl.state, i = Math.round(t.totalProgress ?? 0), r = this._phase === "complete", o = e.filter((d) => d.status === "complete").length, s = e.filter((d) => d.status === "failed").length, n = t.totalSpeed > 0 ? (t.totalBytes - t.totalBytesUploaded) / t.totalSpeed : 0;
5303
+ const t = this._storeCtrl.state, o = Math.round(t.totalProgress ?? 0), r = this._phase === "complete", i = e.filter((d) => d.status === "complete").length, s = e.filter((d) => d.status === "failed").length, n = t.totalSpeed > 0 ? (t.totalBytes - t.totalBytesUploaded) / t.totalSpeed : 0;
5280
5304
  return this._isPillExpanded === !1 ? l`
5281
5305
  <div class="upload-float float-collapsed">
5282
5306
  <div class="float-collapsed-left">
5283
- ${r ? s > 0 ? o > 0 ? l`<div class="float-collapsed-icon warn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></div>` : l`<div class="float-collapsed-icon error"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg></div>` : l`<div class="float-collapsed-icon done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>` : l`<div class="float-collapsed-spinner"></div>`}
5284
- <span class="float-collapsed-text">${r ? s > 0 ? o > 0 ? "Partially uploaded" : "Upload failed" : "Upload complete" : `Uploading ${e.length} ${e.length === 1 ? "file" : "files"}`}</span>
5285
- ${r ? c : l`<span class="float-collapsed-pct">${i}%</span>`}
5307
+ ${r ? s > 0 ? i > 0 ? l`<div class="float-collapsed-icon warn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></div>` : l`<div class="float-collapsed-icon error"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg></div>` : l`<div class="float-collapsed-icon done"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg></div>` : l`<div class="float-collapsed-spinner"></div>`}
5308
+ <span class="float-collapsed-text">${r ? s > 0 ? i > 0 ? "Partially uploaded" : "Upload failed" : "Upload complete" : `Uploading ${e.length} ${e.length === 1 ? "file" : "files"}`}</span>
5309
+ ${r ? c : l`<span class="float-collapsed-pct">${o}%</span>`}
5286
5310
  </div>
5287
5311
  <div class="float-collapsed-actions">
5288
5312
  <button title="Open uploader" @click=${this._onPillExpand}>
@@ -5300,12 +5324,12 @@ const k = (E = class extends U {
5300
5324
  <div class="upload-float">
5301
5325
  <div class="float-header">
5302
5326
  <div class="float-header-left">
5303
- <div class="float-icon ${r ? s > 0 ? o > 0 ? "warn" : "error" : "done" : ""}">
5304
- ${r ? s > 0 ? o > 0 ? l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>` : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>` : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>` : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3"/></svg>`}
5327
+ <div class="float-icon ${r ? s > 0 ? i > 0 ? "warn" : "error" : "done" : ""}">
5328
+ ${r ? s > 0 ? i > 0 ? l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>` : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>` : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>` : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3"/></svg>`}
5305
5329
  </div>
5306
5330
  <div>
5307
- <div class="float-title">${r ? s > 0 ? o > 0 ? "Partially uploaded" : "Upload failed" : "Upload complete" : `Uploading ${e.length} ${e.length === 1 ? "file" : "files"}`}</div>
5308
- <div class="float-subtitle">${r ? `${o} ${o === 1 ? "file" : "files"} uploaded${s > 0 ? `, ${s} failed` : ""}` : `${o} of ${e.length}${n > 0 ? ` · ~${oe(n)} left` : ""}`}</div>
5331
+ <div class="float-title">${r ? s > 0 ? i > 0 ? "Partially uploaded" : "Upload failed" : "Upload complete" : `Uploading ${e.length} ${e.length === 1 ? "file" : "files"}`}</div>
5332
+ <div class="float-subtitle">${r ? `${i} ${i === 1 ? "file" : "files"} uploaded${s > 0 ? `, ${s} failed` : ""}` : `${i} of ${e.length}${n > 0 ? ` · ~${ie(n)} left` : ""}`}</div>
5309
5333
  </div>
5310
5334
  </div>
5311
5335
  <div class="float-actions">
@@ -5323,9 +5347,9 @@ const k = (E = class extends U {
5323
5347
  <div class="float-progress">
5324
5348
  <div class="float-progress-top">
5325
5349
  <span class="float-progress-label">Overall progress</span>
5326
- <span class="float-progress-pct ${r ? s > 0 ? o > 0 ? "warn" : "error" : "done" : ""}">${r ? "Done" : `${i}%`}</span>
5350
+ <span class="float-progress-pct ${r ? s > 0 ? i > 0 ? "warn" : "error" : "done" : ""}">${r ? "Done" : `${o}%`}</span>
5327
5351
  </div>
5328
- <div class="float-bar"><div class="float-bar-fill ${r ? s > 0 ? o > 0 ? "warn" : "error" : "done" : ""}" style="width:${r ? 100 : i}%"></div></div>
5352
+ <div class="float-bar"><div class="float-bar-fill ${r ? s > 0 ? i > 0 ? "warn" : "error" : "done" : ""}" style="width:${r ? 100 : o}%"></div></div>
5329
5353
  </div>
5330
5354
  <div class="float-items">
5331
5355
  ${e.map((d) => {
@@ -5362,7 +5386,7 @@ const k = (E = class extends U {
5362
5386
  _renderPreviewLayout(e) {
5363
5387
  var n;
5364
5388
  if (e.length === 0) return c;
5365
- const t = e.find((d) => d.id === this._previewFileId) ?? e[0], i = ((n = t.name.split(".").pop()) == null ? void 0 : n.toUpperCase()) || "", r = new Date(t.addedAt).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }), o = this._store.getState().targetFolder, s = e.reduce((d, p) => d + (p.size || 0), 0);
5389
+ const t = e.find((d) => d.id === this._previewFileId) ?? e[0], o = ((n = t.name.split(".").pop()) == null ? void 0 : n.toUpperCase()) || "", r = new Date(t.addedAt).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }), i = this._store.getState().targetFolder, s = e.reduce((d, p) => d + (p.size || 0), 0);
5366
5390
  return l`
5367
5391
  <div class="preview-topbar"></div>
5368
5392
  <div class="preview-layout">
@@ -5374,7 +5398,7 @@ const k = (E = class extends U {
5374
5398
  .files=${e}
5375
5399
  .showDropTile=${!0}
5376
5400
  .sources=${this._mergedSources}
5377
- .accept=${Se(this._storeCtrl.state.restrictions)}
5401
+ .accept=${ze(this._storeCtrl.state.restrictions)}
5378
5402
  @source-click=${this._onDropTileSourceClick}
5379
5403
  ></sfx-file-list>
5380
5404
  </div>
@@ -5434,7 +5458,7 @@ const k = (E = class extends U {
5434
5458
  <div class="preview-doc-wrap ${X(t)}">
5435
5459
  <div class="preview-doc-icon ${X(t)}">
5436
5460
  ${this._renderDocTypeIcon(X(t))}
5437
- <span class="preview-doc-ext ${X(t)}">${i}</span>
5461
+ <span class="preview-doc-ext ${X(t)}">${o}</span>
5438
5462
  </div>
5439
5463
  <button class="preview-nav prev" ?disabled=${e.indexOf(t) === 0} @click=${() => this._navigatePreview(e, -1)}>
5440
5464
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="15 18 9 12 15 6"/></svg>
@@ -5447,7 +5471,7 @@ const k = (E = class extends U {
5447
5471
  <div class="preview-meta-list">
5448
5472
  <div class="preview-meta-row">
5449
5473
  <span class="preview-meta-label">Type</span>
5450
- <span class="preview-meta-value">${i}</span>
5474
+ <span class="preview-meta-value">${o}</span>
5451
5475
  </div>
5452
5476
  <div class="preview-meta-row">
5453
5477
  <span class="preview-meta-label">Size</span>
@@ -5461,10 +5485,10 @@ const k = (E = class extends U {
5461
5485
  <span class="preview-meta-label">Name</span>
5462
5486
  <span class="preview-meta-value truncate" title=${t.name}>${t.name}</span>
5463
5487
  </div>
5464
- ${o ? l`
5488
+ ${i ? l`
5465
5489
  <div class="preview-meta-row">
5466
5490
  <span class="preview-meta-label">Folder</span>
5467
- <span class="preview-meta-value">${o}</span>
5491
+ <span class="preview-meta-value">${i}</span>
5468
5492
  </div>` : l`
5469
5493
  <div class="preview-meta-row">
5470
5494
  <span class="preview-meta-label">Added</span>
@@ -5490,16 +5514,16 @@ const k = (E = class extends U {
5490
5514
  }
5491
5515
  }
5492
5516
  _navigatePreview(e, t) {
5493
- var o;
5517
+ var i;
5494
5518
  const r = e.findIndex((s) => s.id === this._previewFileId) + t;
5495
5519
  if (r >= 0 && r < e.length) {
5496
- const s = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".preview-image[controls]");
5520
+ const s = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".preview-image[controls]");
5497
5521
  s && (s.pause(), s.removeAttribute("src"), s.load()), this._previewFileId = e[r].id;
5498
5522
  }
5499
5523
  }
5500
5524
  _renderBody() {
5501
5525
  var s, n, d;
5502
- const e = this._storeCtrl.state, t = [...e.files.values()], i = this._phase, r = Se(e.restrictions), o = t.length > 0;
5526
+ const e = this._storeCtrl.state, t = [...e.files.values()], o = this._phase, r = ze(e.restrictions), i = t.length > 0;
5503
5527
  return l`
5504
5528
  <div class="content"
5505
5529
  @files-selected=${this._onFilesSelected}
@@ -5524,13 +5548,13 @@ const k = (E = class extends U {
5524
5548
  @screencast-cancel=${this._onScreenCastCancel}
5525
5549
  >
5526
5550
  <div
5527
- class="body ${o ? "has-files" : ""} ${this._bodyDragOver ? "body-drag-over" : ""}"
5528
- @dragenter=${o ? this._onBodyDragEnter : c}
5529
- @dragover=${o ? this._onBodyDragOver : c}
5530
- @dragleave=${o ? this._onBodyDragLeave : c}
5531
- @drop=${o ? this._onBodyDrop : c}
5551
+ class="body ${i ? "has-files" : ""} ${this._bodyDragOver ? "body-drag-over" : ""}"
5552
+ @dragenter=${i ? this._onBodyDragEnter : c}
5553
+ @dragover=${i ? this._onBodyDragOver : c}
5554
+ @dragleave=${i ? this._onBodyDragLeave : c}
5555
+ @drop=${i ? this._onBodyDrop : c}
5532
5556
  >
5533
- ${i === "complete" ? l`
5557
+ ${o === "complete" ? l`
5534
5558
  <sfx-success-card
5535
5559
  .fileCount=${t.filter((p) => p.status === "complete").length}
5536
5560
  .totalSize=${t.filter((p) => p.status === "complete").reduce((p, h) => p + (h.size || 0), 0)}
@@ -5540,16 +5564,16 @@ const k = (E = class extends U {
5540
5564
  @file-retry=${this._onFileRetry}
5541
5565
  @retry-all=${this._onRetryAll}
5542
5566
  ></sfx-success-card>
5543
- ` : i === "uploading" ? this._renderUploadOverlay(t) : l`
5544
- ${o ? c : l`<sfx-drop-zone
5545
- .compact=${o}
5567
+ ` : o === "uploading" ? this._renderUploadOverlay(t) : l`
5568
+ ${i ? c : l`<sfx-drop-zone
5569
+ .compact=${i}
5546
5570
  .externalDragOver=${this._bodyDragOver}
5547
5571
  .accept=${r}
5548
5572
  .sources=${this._mergedSources}
5549
5573
  .sourcesLayout=${((s = this.config) == null ? void 0 : s.sourcesLayout) ?? "pills"}
5550
5574
  ></sfx-drop-zone>`}
5551
5575
 
5552
- ${o ? this._previewFileId ? this._renderPreviewLayout(t) : l`
5576
+ ${i ? this._previewFileId ? this._renderPreviewLayout(t) : l`
5553
5577
  <div class="asset-count">${t.length} ${t.length === 1 ? "file" : "files"} · ${Y(t.reduce((p, h) => p + (h.size || 0), 0))}</div>
5554
5578
  <sfx-file-list
5555
5579
  .files=${t}
@@ -5562,7 +5586,7 @@ const k = (E = class extends U {
5562
5586
  `}
5563
5587
  </div>
5564
5588
 
5565
- ${o && i !== "complete" && i !== "uploading" ? l`
5589
+ ${i && o !== "complete" && o !== "uploading" ? l`
5566
5590
  <sfx-actions-bar
5567
5591
  .uploadState=${"idle"}
5568
5592
  .fileCount=${t.length}
@@ -5580,7 +5604,7 @@ const k = (E = class extends U {
5580
5604
  ${this._activeConnector && ((d = this.config) != null && d.connectors) ? l`
5581
5605
  <div class="connector-modal-backdrop" @click=${this._onConnectorBackdropClick}>
5582
5606
  <div class="connector-modal">
5583
- ${De.has(this._activeConnector) ? l`
5607
+ ${je.has(this._activeConnector) ? l`
5584
5608
  <sfx-search-provider-browser
5585
5609
  .provider=${this._activeConnector}
5586
5610
  .companionUrl=${this.config.connectors.companionUrl}
@@ -5647,13 +5671,13 @@ const k = (E = class extends U {
5647
5671
  }
5648
5672
  _navigateFs(e) {
5649
5673
  const t = [...this._store.getState().files.values()].filter(
5650
- (o) => o.previewUrl || o.type.startsWith("video/") && o.file
5651
- ), i = t.findIndex((o) => o.id === this._previewFileId);
5652
- if (i === -1) return;
5653
- const r = i + e;
5674
+ (i) => i.previewUrl || i.type.startsWith("video/") && i.file
5675
+ ), o = t.findIndex((i) => i.id === this._previewFileId);
5676
+ if (o === -1) return;
5677
+ const r = o + e;
5654
5678
  if (r >= 0 && r < t.length) {
5655
- const o = t[r];
5656
- this._fullscreenPreviewUrl = o.previewUrl, this._fullscreenVideoFile = o.type.startsWith("video/") && o.file ? o.file : null, this._previewFileId = o.id, this._fullscreenZoomed = !1, this._fsPanX = 0, this._fsPanY = 0;
5679
+ const i = t[r];
5680
+ this._fullscreenPreviewUrl = i.previewUrl, this._fullscreenVideoFile = i.type.startsWith("video/") && i.file ? i.file : null, this._previewFileId = i.id, this._fullscreenZoomed = !1, this._fsPanX = 0, this._fsPanY = 0;
5657
5681
  }
5658
5682
  }
5659
5683
  _getVideoBlobUrl(e) {
@@ -6982,33 +7006,33 @@ $([
6982
7006
  $([
6983
7007
  g()
6984
7008
  ], k.prototype, "_isPillExpanded");
6985
- let Ct = k;
7009
+ let Et = k;
6986
7010
  export {
6987
- de as A,
7011
+ ce as A,
6988
7012
  W as C,
6989
7013
  v as P,
6990
- F as S,
6991
- He as U,
7014
+ j as S,
7015
+ Ve as U,
6992
7016
  z as a,
6993
- le as b,
7017
+ pe as b,
6994
7018
  B as c,
6995
- Pe as d,
7019
+ De as d,
6996
7020
  ne as e,
6997
7021
  L as f,
6998
- Ct as g,
6999
- Fe as h,
7022
+ Et as g,
7023
+ Me as h,
7000
7024
  se as i,
7001
- Oe as j,
7002
- qe as k,
7003
- pe as l,
7004
- Ze as m,
7025
+ Te as j,
7026
+ Ne as k,
7027
+ fe as l,
7028
+ et as m,
7005
7029
  K as n,
7006
7030
  V as o,
7007
7031
  A as p,
7008
- mt as q,
7009
- Ye as r,
7010
- _t as s,
7011
- kt as t,
7012
- wt as u,
7013
- yt as v
7032
+ _t as q,
7033
+ Xe as r,
7034
+ $t as s,
7035
+ St as t,
7036
+ kt as u,
7037
+ Ct as v
7014
7038
  };