@scaleflex/uploader 0.2.4 → 0.2.5

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 P, css as S, svg as M, html as l, nothing as p, render as ke } 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
- import { unsafeHTML as T } from "lit/directives/unsafe-html.js";
5
- class je {
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";
4
+ import { unsafeHTML as M } from "lit/directives/unsafe-html.js";
5
+ class Fe {
6
6
  constructor(e) {
7
7
  this.listeners = /* @__PURE__ */ new Set(), this._notifying = !1, this._pendingState = null, this.state = e;
8
8
  }
@@ -33,13 +33,13 @@ class je {
33
33
  this.listeners.clear();
34
34
  }
35
35
  }
36
- function z(a, e, t) {
36
+ function P(a, e, t) {
37
37
  const i = a.getState().files, r = i.get(e);
38
38
  if (!r) return;
39
39
  const o = new Map(i);
40
40
  o.set(e, { ...r, ...t }), a.setState({ files: o });
41
41
  }
42
- function I(a, e) {
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
  }
@@ -50,7 +50,7 @@ function Ce(a, e) {
50
50
  i.delete(e), a.setState({ files: i });
51
51
  }
52
52
  function Oe() {
53
- return new je({
53
+ return new Fe({
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 Me {
82
+ class Re {
83
83
  constructor(e, t) {
84
84
  this.host = e, this.store = t, e.addController(this);
85
85
  }
@@ -99,7 +99,7 @@ class Me {
99
99
  (e = this.unsubscribe) == null || e.call(this);
100
100
  }
101
101
  }
102
- function Te(a, e) {
102
+ function Me(a, e) {
103
103
  const t = new XMLHttpRequest();
104
104
  let i = !1;
105
105
  const o = `${e.apiBase.replace(/\/+$/, "")}/v4/files?folder=${encodeURIComponent(e.folder)}`;
@@ -137,7 +137,7 @@ function Te(a, e) {
137
137
  }
138
138
  };
139
139
  }
140
- function Be(a, e) {
140
+ function Te(a, e) {
141
141
  const t = new XMLHttpRequest();
142
142
  let i = !1;
143
143
  const o = `${e.apiBase.replace(/\/+$/, "")}/v4/files/upload_url`;
@@ -171,17 +171,17 @@ function Be(a, e) {
171
171
  }
172
172
  };
173
173
  }
174
- function te(a) {
174
+ function re(a) {
175
175
  return {
176
176
  Accept: "application/json",
177
177
  "Content-Type": "application/json",
178
178
  "uppy-auth-token": a
179
179
  };
180
180
  }
181
- function V(a) {
181
+ function N(a) {
182
182
  return a.replace(/\/+$/, "");
183
183
  }
184
- const Re = {
184
+ const Be = {
185
185
  "google-drive": "drive",
186
186
  dropbox: "dropbox",
187
187
  onedrive: "onedrive",
@@ -190,21 +190,21 @@ const Re = {
190
190
  facebook: "facebook",
191
191
  unsplash: "unsplash"
192
192
  };
193
- function K(a) {
194
- return Re[a] ?? a;
193
+ function G(a) {
194
+ return Be[a] ?? a;
195
195
  }
196
196
  function mt(a, e) {
197
- const t = V(a), i = btoa(JSON.stringify({ origin: window.location.origin })), r = K(e);
197
+ const t = N(a), i = btoa(JSON.stringify({ origin: window.location.origin })), r = G(e);
198
198
  return `${t}/${r}/connect?state=${encodeURIComponent(i)}`;
199
199
  }
200
200
  async function wt(a, e, t, i = "") {
201
- const r = V(a), o = i ? `/${i}` : "", s = K(e), n = await fetch(`${r}/${s}/list${o}`, {
201
+ const r = N(a), o = i ? `/${i}` : "", s = G(e), n = await fetch(`${r}/${s}/list${o}`, {
202
202
  method: "GET",
203
- headers: te(t),
203
+ headers: re(t),
204
204
  credentials: "same-origin"
205
205
  });
206
206
  if (n.status === 401)
207
- throw new le();
207
+ throw new de();
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})`);
@@ -212,13 +212,13 @@ async function wt(a, e, t, i = "") {
212
212
  return n.json();
213
213
  }
214
214
  async function yt(a, e, t) {
215
- const i = V(a), r = await fetch(`${i}/${t}`, {
215
+ const i = N(a), r = await fetch(`${i}/${t}`, {
216
216
  method: "GET",
217
- headers: te(e),
217
+ headers: re(e),
218
218
  credentials: "same-origin"
219
219
  });
220
220
  if (r.status === 401)
221
- throw new le();
221
+ throw new de();
222
222
  if (!r.ok) {
223
223
  const o = await r.json().catch(() => null);
224
224
  throw new Error((o == null ? void 0 : o.message) || `Companion list failed (HTTP ${r.status})`);
@@ -226,7 +226,7 @@ async function yt(a, e, t) {
226
226
  return r.json();
227
227
  }
228
228
  async function _t(a, e, t, i) {
229
- const r = V(a), o = K(e), s = i ? `q=${encodeURIComponent(t)}&${i}` : `q=${encodeURIComponent(t)}`, n = await fetch(`${r}/search/${o}/list?${s}`, {
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}`, {
230
230
  method: "GET",
231
231
  headers: {
232
232
  Accept: "application/json",
@@ -241,9 +241,9 @@ async function _t(a, e, t, i) {
241
241
  return n.json();
242
242
  }
243
243
  async function Le(a, e, t, i, r, o = !1) {
244
- const s = V(a), n = K(e), d = o ? `${s}/search/${n}/get/${i}` : `${s}/${n}/get/${i}`, c = o ? { Accept: "application/json", "Content-Type": "application/json" } : te(t), u = await fetch(d, {
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, {
245
245
  method: "POST",
246
- headers: c,
246
+ headers: p,
247
247
  credentials: "same-origin",
248
248
  body: JSON.stringify({
249
249
  ...r,
@@ -252,18 +252,18 @@ async function Le(a, e, t, i, r, o = !1) {
252
252
  fieldname: r.fieldname ?? "files[]"
253
253
  })
254
254
  });
255
- if (u.status === 401)
256
- throw new le();
257
- if (!u.ok) {
258
- const h = await u.json().catch(() => null);
259
- throw new Error((h == null ? void 0 : h.message) || `Companion upload failed (HTTP ${u.status})`);
255
+ if (h.status === 401)
256
+ throw new de();
257
+ if (!h.ok) {
258
+ const u = await h.json().catch(() => null);
259
+ throw new Error((u == null ? void 0 : u.message) || `Companion upload failed (HTTP ${h.status})`);
260
260
  }
261
- return u.json();
261
+ return h.json();
262
262
  }
263
263
  async function kt(a, e, t) {
264
- const i = V(a), r = K(e), o = await fetch(`${i}/${r}/logout`, {
264
+ const i = N(a), r = G(e), o = await fetch(`${i}/${r}/logout`, {
265
265
  method: "GET",
266
- headers: te(t),
266
+ headers: re(t),
267
267
  credentials: "same-origin"
268
268
  });
269
269
  return o.ok ? o.json() : { ok: !1, revoked: !1 };
@@ -273,7 +273,7 @@ function Ae(a) {
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 le extends Error {
276
+ class de extends Error {
277
277
  constructor() {
278
278
  super("Authentication expired"), this.name = "AuthExpiredError";
279
279
  }
@@ -293,11 +293,11 @@ function Ie(a, e) {
293
293
  headers: e.authHeaders,
294
294
  size: t.size,
295
295
  metadata: Object.keys(n).length > 0 ? n : void 0
296
- }, d).then((c) => {
296
+ }, d).then((p) => {
297
297
  if (i) return;
298
- const h = `${Ae(t.companionUrl)}/api/${c.token}`;
298
+ const u = `${Ae(t.companionUrl)}/api/${p.token}`;
299
299
  try {
300
- r = new WebSocket(h);
300
+ r = new WebSocket(u);
301
301
  } catch {
302
302
  e.onError(new Error("Failed to connect to upload progress channel"));
303
303
  return;
@@ -309,20 +309,20 @@ function Ie(a, e) {
309
309
  const w = JSON.parse(x.data);
310
310
  switch (w.action) {
311
311
  case "progress": {
312
- const y = w.payload, k = y.bytesUploaded ?? 0, D = y.bytesTotal ?? (t.size || 1);
313
- e.onProgress(k, D);
312
+ const y = w.payload, C = y.bytesUploaded ?? 0, D = y.bytesTotal ?? (t.size || 1);
313
+ e.onProgress(C, D);
314
314
  break;
315
315
  }
316
316
  case "success": {
317
317
  const y = w.payload;
318
318
  if (r == null || r.close(), (f = y.response) != null && f.responseText)
319
319
  try {
320
- const k = JSON.parse(y.response.responseText);
321
- if (k.status === "success") {
322
- e.onComplete(k);
320
+ const C = JSON.parse(y.response.responseText);
321
+ if (C.status === "success") {
322
+ e.onComplete(C);
323
323
  return;
324
324
  }
325
- e.onError(new Error(k.msg || "Upload failed"));
325
+ e.onError(new Error(C.msg || "Upload failed"));
326
326
  return;
327
327
  } catch {
328
328
  }
@@ -332,14 +332,14 @@ function Ie(a, e) {
332
332
  case "error": {
333
333
  r == null || r.close();
334
334
  const y = w.payload;
335
- let k = ((m = y.error) == null ? void 0 : m.message) || "Upload failed";
335
+ let C = ((m = y.error) == null ? void 0 : m.message) || "Upload failed";
336
336
  if ((_ = y.response) != null && _.responseText)
337
337
  try {
338
338
  const D = JSON.parse(y.response.responseText);
339
- k = D.hint || D.msg || D.message || k;
339
+ C = D.hint || D.msg || D.message || C;
340
340
  } catch {
341
341
  }
342
- e.onError(new Error(k));
342
+ e.onError(new Error(C));
343
343
  break;
344
344
  }
345
345
  }
@@ -350,8 +350,8 @@ function Ie(a, e) {
350
350
  }, r.onclose = () => {
351
351
  r = null;
352
352
  };
353
- }).catch((c) => {
354
- i || e.onError(c instanceof Error ? c : new Error(String(c)));
353
+ }).catch((p) => {
354
+ i || e.onError(p instanceof Error ? p : new Error(String(p)));
355
355
  }), {
356
356
  abort() {
357
357
  if (i = !0, r) {
@@ -382,7 +382,7 @@ class He {
382
382
  const { files: e } = this.store.getState();
383
383
  let t = !1;
384
384
  for (const i of e.values())
385
- i.status === "idle" ? (z(this.store, i.id, { status: "queued" }), t = !0) : i.status === "queued" && (t = !0);
385
+ i.status === "idle" ? (P(this.store, i.id, { status: "queued" }), t = !0) : i.status === "queued" && (t = !0);
386
386
  t && (this.store.setState({ isUploading: !0 }), this.processQueue());
387
387
  }
388
388
  /**
@@ -390,7 +390,7 @@ class He {
390
390
  */
391
391
  retryFile(e) {
392
392
  const t = this.store.getState().files.get(e);
393
- !t || t.status !== "error" && t.status !== "failed" || (z(this.store, e, {
393
+ !t || t.status !== "error" && t.status !== "failed" || (P(this.store, e, {
394
394
  status: "queued",
395
395
  error: null,
396
396
  progress: 0,
@@ -404,7 +404,7 @@ class He {
404
404
  retryAll() {
405
405
  const { files: e } = this.store.getState();
406
406
  for (const t of e.values())
407
- (t.status === "error" || t.status === "failed") && z(this.store, t.id, {
407
+ (t.status === "error" || t.status === "failed") && P(this.store, t.id, {
408
408
  status: "queued",
409
409
  error: null,
410
410
  progress: 0,
@@ -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), z(this.store, e, { status: "cancelled" }));
421
+ !t || !$e(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), z(this.store, t.id, { status: "cancelled" }));
429
+ $e(t.status) && (this.abortUpload(t.id), P(this.store, t.id, { status: "cancelled" }));
430
430
  this.store.setState({ isUploading: !1 });
431
431
  }
432
432
  /**
@@ -457,7 +457,7 @@ class He {
457
457
  this.startUpload(n);
458
458
  }
459
459
  startUpload(e) {
460
- z(this.store, e.id, { status: "uploading", error: null });
460
+ P(this.store, e.id, { status: "uploading", error: null });
461
461
  let t = 0, i = Date.now(), r = 0;
462
462
  const o = {
463
463
  apiBase: this.config.apiBase,
@@ -465,21 +465,21 @@ class He {
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
- }, s = (d, c) => {
469
- const u = Date.now(), h = (u - i) / 1e3;
470
- if (h > 0) {
471
- const f = (d - t) / h;
468
+ }, s = (d, p) => {
469
+ const h = Date.now(), u = (h - i) / 1e3;
470
+ if (u > 0) {
471
+ const f = (d - t) / u;
472
472
  r = r === 0 ? f : 0.3 * f + 0.7 * r;
473
473
  }
474
- t = d, i = u;
475
- const x = c > 0 ? Math.min(d / c * 100, 100) : 0;
476
- z(this.store, e.id, { progress: x, bytesUploaded: d, speed: r }), this.updateTotalProgress();
474
+ t = d, i = h;
475
+ const x = p > 0 ? Math.min(d / p * 100, 100) : 0;
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 = Be(e, o) : n = Te(e, { ...o, onProgress: s }), this.activeUploads.set(e.id, 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);
480
480
  }
481
481
  handleComplete(e, t) {
482
- this.activeUploads.delete(e), z(this.store, e, {
482
+ this.activeUploads.delete(e), P(this.store, e, {
483
483
  status: "complete",
484
484
  progress: 100,
485
485
  response: t
@@ -495,17 +495,17 @@ class He {
495
495
  r.baseDelay * Math.pow(r.backoffFactor, i.retryCount),
496
496
  r.maxDelay
497
497
  );
498
- z(this.store, e, {
498
+ P(this.store, e, {
499
499
  status: "retrying",
500
500
  error: t.message,
501
501
  retryCount: o
502
502
  });
503
503
  const n = setTimeout(() => {
504
- this.retryTimers.delete(e), z(this.store, e, { status: "queued" }), this.processQueue();
504
+ this.retryTimers.delete(e), P(this.store, e, { status: "queued" }), this.processQueue();
505
505
  }, s);
506
506
  this.retryTimers.set(e, n);
507
507
  } else
508
- z(this.store, e, {
508
+ P(this.store, e, {
509
509
  status: "failed",
510
510
  error: t.message
511
511
  }), this.checkAllComplete(), this.processQueue();
@@ -538,11 +538,11 @@ class He {
538
538
  function $e(a) {
539
539
  return a === "queued" || a === "uploading" || a === "retrying";
540
540
  }
541
- function de(a) {
541
+ function pe(a) {
542
542
  return `https://api.filerobot.com/${a}`;
543
543
  }
544
- async function Ye(a, e) {
545
- const t = `${de(a)}/key/${encodeURIComponent(e)}`, i = new AbortController(), r = setTimeout(() => i.abort(), 3e4);
544
+ async function qe(a, e) {
545
+ const t = `${pe(a)}/key/${encodeURIComponent(e)}`, i = new AbortController(), r = setTimeout(() => i.abort(), 3e4);
546
546
  try {
547
547
  const o = await fetch(t, { signal: i.signal });
548
548
  if (clearTimeout(r), !o.ok)
@@ -555,7 +555,7 @@ async function Ye(a, e) {
555
555
  throw clearTimeout(r), o instanceof DOMException && o.name === "AbortError" ? new Error("SASS key exchange timed out") : o;
556
556
  }
557
557
  }
558
- function oe(a, e) {
558
+ function se(a, e) {
559
559
  const t = {};
560
560
  switch (a.mode) {
561
561
  case "security-template":
@@ -571,13 +571,13 @@ function oe(a, e) {
571
571
  }
572
572
  return a.airboxPuid && (t["X-Filerobot-Airbox-Puid"] = a.airboxPuid), t;
573
573
  }
574
- async function qe(a) {
575
- const e = de(a.container);
574
+ async function Ye(a) {
575
+ const e = pe(a.container);
576
576
  if (a.mode === "security-template") {
577
- const t = await Ye(a.container, a.securityTemplateId);
578
- return { apiBase: e, headers: oe(a, t), sassKey: t };
577
+ const t = await qe(a.container, a.securityTemplateId);
578
+ return { apiBase: e, headers: se(a, t), sassKey: t };
579
579
  }
580
- return { apiBase: e, headers: oe(a) };
580
+ return { apiBase: e, headers: se(a) };
581
581
  }
582
582
  const v = {
583
583
  FILE_ADDED: "sfx-file-added",
@@ -599,7 +599,7 @@ const v = {
599
599
  FILL_METADATA: "sfx-fill-metadata"
600
600
  };
601
601
  let Ve = 0;
602
- function H() {
602
+ function q() {
603
603
  return `file-${Date.now()}-${++Ve}`;
604
604
  }
605
605
  function Y(a) {
@@ -607,14 +607,14 @@ function Y(a) {
607
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
608
  return `${t === 0 ? i : i.toFixed(1)} ${e[t]}`;
609
609
  }
610
- function ie(a) {
610
+ function oe(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
614
  const t = Math.floor(e / 60), i = e % 60;
615
615
  return i > 0 ? `${t}m ${i}s` : `${t}m`;
616
616
  }
617
- function N(a) {
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";
@@ -674,7 +674,7 @@ function Ke(a) {
674
674
  }, { once: !0 });
675
675
  });
676
676
  }
677
- function se(a, e, t) {
677
+ function ae(a, e, t) {
678
678
  var i, 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`;
@@ -702,8 +702,8 @@ function se(a, e, t) {
702
702
  }
703
703
  return null;
704
704
  }
705
- function Ze(a, e, t) {
706
- return se(a, e, t);
705
+ function Ge(a, e, t) {
706
+ return ae(a, e, t);
707
707
  }
708
708
  function Se(a) {
709
709
  return a.allowedFileTypes ? a.allowedFileTypes.join(",") : "";
@@ -759,22 +759,22 @@ 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 Je(a) {
762
+ function Ze(a) {
763
763
  return a.filter((e) => e in Ee).map((e) => Ee[e]);
764
764
  }
765
- var Ge = Object.defineProperty, Qe = (a, e, t, i) => {
765
+ var Je = Object.defineProperty, Qe = (a, e, t, i) => {
766
766
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
767
767
  (s = a[o]) && (r = s(e, t, r) || r);
768
- return r && Ge(e, t, r), r;
768
+ return r && Je(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"/>', X = [
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
771
  { id: "device", label: "My Device", icon: et, iconColor: "#2563eb" },
772
772
  { id: "url", label: "URL link", icon: tt, iconColor: "#16a34a" },
773
773
  { id: "camera", label: "Camera", icon: rt, iconColor: "#7c3aed" },
774
774
  { id: "screen-cast", label: "Screen capture", icon: it, iconColor: "#ea580c" }
775
- ], fe = class fe extends P {
775
+ ], he = class he extends U {
776
776
  constructor() {
777
- super(...arguments), this.sources = X;
777
+ super(...arguments), this.sources = W;
778
778
  }
779
779
  _handleClick(e) {
780
780
  this.dispatchEvent(
@@ -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 ? T(e.brandHtml) : M`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${F(e.icon)}</svg>`}
793
+ ${e.brandHtml ? M(e.brandHtml) : R`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${O(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
- fe.styles = S`
801
+ he.styles = S`
802
802
  :host {
803
803
  display: flex;
804
804
  flex-wrap: wrap;
@@ -871,18 +871,18 @@ fe.styles = S`
871
871
  stroke-width: 0;
872
872
  }
873
873
  `;
874
- let ae = fe;
874
+ let ne = he;
875
875
  Qe([
876
876
  b({ type: Array })
877
- ], ae.prototype, "sources");
877
+ ], ne.prototype, "sources");
878
878
  var ot = Object.defineProperty, j = (a, e, t, i) => {
879
879
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
880
880
  (s = a[o]) && (r = s(e, t, r) || r);
881
881
  return r && ot(e, t, r), r;
882
882
  };
883
- const Ue = 3, ue = class ue extends P {
883
+ const ze = 3, ue = class ue extends U {
884
884
  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 = Ue, this._dragCounter = 0, this._onDragEnter = (e) => {
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) => {
886
886
  e.preventDefault(), this._dragCounter++, this._dragCounter === 1 && (this._dragOver = !0);
887
887
  }, this._onDragOver = (e) => {
888
888
  e.preventDefault();
@@ -917,10 +917,11 @@ const Ue = 3, ue = class ue extends P {
917
917
  s && i.push(s);
918
918
  }
919
919
  i.length > 0 && (e.preventDefault(), this._emitFiles(i));
920
- }, this._onDocClick = () => {
921
- this._moreOpen && (this._moreOpen = !1);
920
+ }, this._portalContainer = null, this._onDocClick = (e) => {
921
+ var t;
922
+ this._moreOpen && ((t = this._portalContainer) != null && t.contains(e.target) || (this._moreOpen = !1, this._updateDropdownPortal()));
922
923
  }, this._onDocKeyDown = (e) => {
923
- e.key === "Escape" && this._moreOpen && (this._moreOpen = !1);
924
+ e.key === "Escape" && this._moreOpen && (this._moreOpen = !1, this._updateDropdownPortal());
924
925
  }, this._resizeTimer = null, this._onScrollOrResize = () => {
925
926
  this._moreOpen && this._positionDropdown(), this._resizeTimer && clearTimeout(this._resizeTimer), this._resizeTimer = setTimeout(() => this._updateVisiblePills(), 100);
926
927
  };
@@ -949,24 +950,60 @@ const Ue = 3, ue = class ue extends P {
949
950
  );
950
951
  }
951
952
  _toggleMore(e) {
952
- e.stopPropagation(), this._moreOpen = !this._moreOpen, this._moreOpen && requestAnimationFrame(() => this._positionDropdown());
953
+ e.stopPropagation(), this._moreOpen = !this._moreOpen, this._updateDropdownPortal();
954
+ }
955
+ _updateDropdownPortal() {
956
+ if (this._moreOpen) {
957
+ 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(
959
+ l`<div class="sfx-more-dropdown open">
960
+ ${e.map(
961
+ (t) => l`
962
+ <button class="sfx-more-item" @click=${(i) => this._onMoreItemClick(t, i)}>
963
+ <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>`}
965
+ </div>
966
+ ${t.label}
967
+ </button>
968
+ `
969
+ )}
970
+ </div>`,
971
+ this._portalContainer
972
+ ), requestAnimationFrame(() => this._positionDropdown());
973
+ } else this._portalContainer && (T(c, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
974
+ }
975
+ _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);
953
990
  }
954
991
  /** Position the fixed dropdown, choosing above or below based on available space. */
955
992
  _positionDropdown() {
956
- var h, x;
957
- const e = (h = this.shadowRoot) == null ? void 0 : h.querySelector(".more-wrap > button"), t = (x = this.shadowRoot) == null ? void 0 : x.querySelector(".more-dropdown");
993
+ var u, x;
994
+ 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");
958
995
  if (!e || !t) return;
959
996
  const i = e.getBoundingClientRect(), r = 8, o = t.scrollHeight, s = t.offsetWidth, n = i.top, d = window.innerHeight - i.bottom;
960
- n >= o + r || n > d ? (t.classList.add("above"), t.classList.remove("below"), t.style.top = `${i.top - o - r}px`) : (t.classList.add("below"), t.classList.remove("above"), t.style.top = `${i.bottom + r}px`);
961
- let u = i.right - s;
962
- u = Math.max(8, Math.min(u, window.innerWidth - s - 8)), t.style.left = `${u}px`;
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;
999
+ h = Math.max(8, Math.min(h, window.innerWidth - s - 8)), t.style.left = `${h}px`;
963
1000
  }
964
1001
  _onMoreItemClick(e, t) {
965
1002
  t.stopPropagation(), this._moreOpen = !1, this._onSourceIconClick(e);
966
1003
  }
967
1004
  _updateVisiblePills() {
968
1005
  const e = window.innerWidth;
969
- 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;
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;
970
1007
  }
971
1008
  connectedCallback() {
972
1009
  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();
@@ -975,7 +1012,7 @@ const Ue = 3, ue = class ue extends P {
975
1012
  e.has("sourcesLayout") && this._updateVisiblePills();
976
1013
  }
977
1014
  disconnectedCallback() {
978
- super.disconnectedCallback(), document.removeEventListener("paste", this._onPaste), document.removeEventListener("click", this._onDocClick), document.removeEventListener("keydown", this._onDocKeyDown), window.removeEventListener("scroll", this._onScrollOrResize, !0), window.removeEventListener("resize", this._onScrollOrResize), this._resizeTimer && clearTimeout(this._resizeTimer);
1015
+ super.disconnectedCallback(), document.removeEventListener("paste", this._onPaste), document.removeEventListener("click", this._onDocClick), document.removeEventListener("keydown", this._onDocKeyDown), window.removeEventListener("scroll", this._onScrollOrResize, !0), window.removeEventListener("resize", this._onScrollOrResize), this._resizeTimer && clearTimeout(this._resizeTimer), this._portalContainer && (T(c, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
979
1016
  }
980
1017
  _renderPill(e) {
981
1018
  return l`
@@ -985,8 +1022,8 @@ const Ue = 3, ue = class ue extends P {
985
1022
  t.stopPropagation(), this._onSourceIconClick(e);
986
1023
  }}
987
1024
  >
988
- ${e.brandHtml ? T(e.brandHtml) : l`<span class="pill-ico" style=${e.iconColor ? `color:${e.iconColor}` : ""}>
989
- ${M`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${F(e.icon)}</svg>`}
1025
+ ${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>`}
990
1027
  </span>`}
991
1028
  ${e.label}
992
1029
  </button>
@@ -1001,17 +1038,17 @@ const Ue = 3, ue = class ue extends P {
1001
1038
  t.stopPropagation(), this._onSourceIconClick(e);
1002
1039
  }}
1003
1040
  >
1004
- ${e.brandHtml ? l`<span class="card-ico">${T(e.brandHtml)}</span>` : l`<span class="card-ico" style=${e.iconColor ? `color:${e.iconColor}` : ""}>
1005
- ${M`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${F(e.icon)}</svg>`}
1041
+ ${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>`}
1006
1043
  </span>`}
1007
1044
  <span class="card-label">${e.label}</span>
1008
1045
  </button>
1009
1046
  `;
1010
1047
  }
1011
- _renderMoreCard(e) {
1048
+ _renderMoreCard() {
1012
1049
  return l`
1013
1050
  <div class="more-wrap ${this._moreOpen ? "open" : ""}">
1014
- <button class="src-card" @click=${(t) => this._toggleMore(t)}>
1051
+ <button class="src-card" @click=${(e) => this._toggleMore(e)}>
1015
1052
  <span class="card-ico" style="color: var(--sfx-up-text-muted, #94a3b8)">
1016
1053
  <svg viewBox="0 0 24 24" style="fill: currentColor; stroke: none">
1017
1054
  <circle cx="5" cy="12" r="2.5"/>
@@ -1021,40 +1058,16 @@ const Ue = 3, ue = class ue extends P {
1021
1058
  </span>
1022
1059
  <span class="card-label">More</span>
1023
1060
  </button>
1024
- <div class="more-dropdown">
1025
- ${e.map(
1026
- (t) => l`
1027
- <button class="more-item" @click=${(i) => this._onMoreItemClick(t, i)}>
1028
- <div class="more-item-ico">
1029
- ${t.brandHtml ? T(t.brandHtml) : t.iconColor ? l`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${F(t.icon)}</svg>` : M`<svg viewBox="0 0 24 24">${F(t.icon)}</svg>`}
1030
- </div>
1031
- ${t.label}
1032
- </button>
1033
- `
1034
- )}
1035
- </div>
1036
1061
  </div>
1037
1062
  `;
1038
1063
  }
1039
- _renderMoreDropdown(e) {
1064
+ _renderMoreDropdown() {
1040
1065
  return l`
1041
1066
  <div class="more-wrap ${this._moreOpen ? "open" : ""}">
1042
- <button class="more-pill" @click=${(t) => this._toggleMore(t)}>
1067
+ <button class="more-pill" @click=${(e) => this._toggleMore(e)}>
1043
1068
  More
1044
1069
  <svg class="more-chevron" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"/></svg>
1045
1070
  </button>
1046
- <div class="more-dropdown">
1047
- ${e.map(
1048
- (t) => l`
1049
- <button class="more-item" @click=${(i) => this._onMoreItemClick(t, i)}>
1050
- <div class="more-item-ico">
1051
- ${t.brandHtml ? T(t.brandHtml) : t.iconColor ? l`<svg viewBox="0 0 24 24" style="color:${t.iconColor}">${F(t.icon)}</svg>` : M`<svg viewBox="0 0 24 24">${F(t.icon)}</svg>`}
1052
- </div>
1053
- ${t.label}
1054
- </button>
1055
- `
1056
- )}
1057
- </div>
1058
1071
  </div>
1059
1072
  `;
1060
1073
  }
@@ -1093,22 +1106,22 @@ const Ue = 3, ue = class ue extends P {
1093
1106
  <div class="title">
1094
1107
  Drag & Drop or click to <span>browse</span>
1095
1108
  </div>
1096
- ${this.compact ? p : l`<div class="subtitle">Drop files anywhere on this page</div>`}
1109
+ ${this.compact ? c : l`<div class="subtitle">Drop files anywhere on this page</div>`}
1097
1110
 
1098
1111
  ${!this.compact && this.sources.length > 0 ? l`
1099
1112
  <div class="import-divider"><span>or import from</span></div>
1100
1113
  ${this.sourcesLayout === "cards" ? l`
1101
1114
  <div class="sources-cards">
1102
1115
  ${t.map((r) => this._renderCard(r))}
1103
- ${i.length > 0 ? this._renderMoreCard(i) : p}
1116
+ ${i.length > 0 ? this._renderMoreCard() : c}
1104
1117
  </div>
1105
1118
  ` : l`
1106
1119
  <div class="sources-grid">
1107
1120
  ${t.map((r) => this._renderPill(r))}
1108
- ${i.length > 0 ? this._renderMoreDropdown(i) : p}
1121
+ ${i.length > 0 ? this._renderMoreDropdown() : c}
1109
1122
  </div>
1110
1123
  `}
1111
- ` : p}
1124
+ ` : c}
1112
1125
 
1113
1126
  ${this.compact && this.sources.length > 0 ? l`
1114
1127
  <div class="sources-row">
@@ -1123,18 +1136,18 @@ const Ue = 3, ue = class ue extends P {
1123
1136
  o.stopPropagation(), this._onSourceIconClick(r);
1124
1137
  }}
1125
1138
  >
1126
- ${r.brandHtml ? T(r.brandHtml) : M`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${F(r.icon)}</svg>`}
1139
+ ${r.brandHtml ? M(r.brandHtml) : R`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${O(r.icon)}</svg>`}
1127
1140
  </button>
1128
1141
  `
1129
1142
  )}
1130
1143
  </div>
1131
- ` : p}
1144
+ ` : c}
1132
1145
 
1133
1146
  <div class="ripple"></div>
1134
1147
  <input
1135
1148
  type="file"
1136
1149
  multiple
1137
- accept=${this.accept || p}
1150
+ accept=${this.accept || c}
1138
1151
  @change=${this._onFileChange}
1139
1152
  />
1140
1153
  </div>
@@ -1924,38 +1937,38 @@ ue.styles = S`
1924
1937
  }
1925
1938
  }
1926
1939
  `;
1927
- let U = ue;
1940
+ let z = ue;
1928
1941
  j([
1929
1942
  b({ type: Boolean, reflect: !0 })
1930
- ], U.prototype, "compact");
1943
+ ], z.prototype, "compact");
1931
1944
  j([
1932
1945
  b({ type: Boolean, attribute: "external-drag-over" })
1933
- ], U.prototype, "externalDragOver");
1946
+ ], z.prototype, "externalDragOver");
1934
1947
  j([
1935
1948
  b({ type: String })
1936
- ], U.prototype, "accept");
1949
+ ], z.prototype, "accept");
1937
1950
  j([
1938
1951
  b({ type: Array })
1939
- ], U.prototype, "sources");
1952
+ ], z.prototype, "sources");
1940
1953
  j([
1941
1954
  b({ type: String, attribute: "sources-layout" })
1942
- ], U.prototype, "sourcesLayout");
1955
+ ], z.prototype, "sourcesLayout");
1943
1956
  j([
1944
1957
  g()
1945
- ], U.prototype, "_dragOver");
1958
+ ], z.prototype, "_dragOver");
1946
1959
  j([
1947
1960
  g()
1948
- ], U.prototype, "_moreOpen");
1961
+ ], z.prototype, "_moreOpen");
1949
1962
  j([
1950
1963
  g()
1951
- ], U.prototype, "_visiblePills");
1964
+ ], z.prototype, "_visiblePills");
1952
1965
  j([
1953
- Fe(".ripple")
1954
- ], U.prototype, "_rippleEl");
1966
+ je(".ripple")
1967
+ ], z.prototype, "_rippleEl");
1955
1968
  j([
1956
- Fe('input[type="file"]')
1957
- ], U.prototype, "fileInput");
1958
- const he = class he extends P {
1969
+ je('input[type="file"]')
1970
+ ], z.prototype, "fileInput");
1971
+ const xe = class xe extends U {
1959
1972
  render() {
1960
1973
  return l`
1961
1974
  <div class="line"></div>
@@ -1964,7 +1977,7 @@ const he = class he extends P {
1964
1977
  `;
1965
1978
  }
1966
1979
  };
1967
- he.styles = S`
1980
+ xe.styles = S`
1968
1981
  :host {
1969
1982
  display: flex;
1970
1983
  align-items: center;
@@ -1987,17 +2000,23 @@ he.styles = S`
1987
2000
  white-space: nowrap;
1988
2001
  }
1989
2002
  `;
1990
- let ze = he;
2003
+ let Pe = xe;
1991
2004
  var st = Object.defineProperty, Z = (a, e, t, i) => {
1992
2005
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
1993
2006
  (s = a[o]) && (r = s(e, t, r) || r);
1994
2007
  return r && st(e, t, r), r;
1995
2008
  };
1996
- const xe = class xe extends P {
2009
+ const ge = class ge extends U {
1997
2010
  constructor() {
1998
- super(...arguments), this.files = [], this.showDropTile = !1, this.sources = [], this.accept = "", this._moreOpen = !1, this._outsideClickHandler = (e) => {
1999
- const t = e.composedPath(), i = this.renderRoot.querySelector(".drop-tile-more-wrap");
2000
- i && !t.includes(i) && (this._moreOpen = !1, document.removeEventListener("click", this._outsideClickHandler, !0));
2011
+ super(...arguments), this.files = [], this.showDropTile = !1, this.sources = [], this.accept = "", this._moreOpen = !1, this._portalContainer = null, this._outsideClickHandler = (e) => {
2012
+ var r;
2013
+ 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));
2016
+ }, this._onScrollOrResize = () => {
2017
+ this._moreOpen && this._positionPortal();
2018
+ }, this._onKeyDown = (e) => {
2019
+ e.key === "Escape" && this._moreOpen && (this._moreOpen = !1, this._closePortal(), this._removeGlobalListeners());
2001
2020
  };
2002
2021
  }
2003
2022
  _onDropTileClick() {
@@ -2016,14 +2035,68 @@ const xe = class xe extends P {
2016
2035
  }
2017
2036
  this.dispatchEvent(new CustomEvent("source-click", { detail: { source: t }, bubbles: !0, composed: !0 }));
2018
2037
  }
2038
+ _addGlobalListeners() {
2039
+ requestAnimationFrame(() => document.addEventListener("click", this._outsideClickHandler, !0)), document.addEventListener("keydown", this._onKeyDown), window.addEventListener("scroll", this._onScrollOrResize, !0), window.addEventListener("resize", this._onScrollOrResize);
2040
+ }
2041
+ _removeGlobalListeners() {
2042
+ document.removeEventListener("click", this._outsideClickHandler, !0), document.removeEventListener("keydown", this._onKeyDown), window.removeEventListener("scroll", this._onScrollOrResize, !0), window.removeEventListener("resize", this._onScrollOrResize);
2043
+ }
2019
2044
  _toggleMore(e) {
2020
- e.stopPropagation(), this._moreOpen = !this._moreOpen, this._moreOpen ? requestAnimationFrame(() => document.addEventListener("click", this._outsideClickHandler, !0)) : document.removeEventListener("click", this._outsideClickHandler, !0);
2045
+ e.stopPropagation(), this._moreOpen = !this._moreOpen, this._moreOpen ? (this._openPortal(), this._addGlobalListeners()) : (this._closePortal(), this._removeGlobalListeners());
2046
+ }
2047
+ _openPortal() {
2048
+ 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(
2050
+ l`<div class="sfx-tile-dropdown">
2051
+ ${e.map((t) => l`
2052
+ <button
2053
+ class="sfx-tile-dropdown-item"
2054
+ @click=${(i) => this._onMoreSourceClick(i, t)}
2055
+ >
2056
+ <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>`}
2058
+ </span>
2059
+ ${t.label}
2060
+ </button>
2061
+ `)}
2062
+ </div>`,
2063
+ this._portalContainer
2064
+ ), requestAnimationFrame(() => this._positionPortal());
2065
+ }
2066
+ _positionPortal() {
2067
+ var u;
2068
+ const e = this.renderRoot.querySelector(".drop-tile-more"), t = (u = this._portalContainer) == null ? void 0 : u.querySelector(".sfx-tile-dropdown");
2069
+ 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;
2073
+ h = Math.max(8, Math.min(h, window.innerWidth - s - 8)), t.style.left = `${h}px`;
2074
+ }
2075
+ _closePortal() {
2076
+ this._portalContainer && (T(c, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
2077
+ }
2078
+ _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);
2021
2094
  }
2022
2095
  disconnectedCallback() {
2023
- super.disconnectedCallback(), this._moreOpen = !1, document.removeEventListener("click", this._outsideClickHandler, !0);
2096
+ super.disconnectedCallback(), this._moreOpen = !1, this._closePortal(), this._removeGlobalListeners();
2024
2097
  }
2025
2098
  _onMoreSourceClick(e, t) {
2026
- this._moreOpen = !1, document.removeEventListener("click", this._outsideClickHandler, !0), this._onSourceClick(e, t);
2099
+ this._moreOpen = !1, this._closePortal(), this._removeGlobalListeners(), this._onSourceClick(e, t);
2027
2100
  }
2028
2101
  _renderDropTile() {
2029
2102
  const t = this.sources.slice(0, 3), i = this.sources.slice(3);
@@ -2050,39 +2123,24 @@ const xe = class xe extends P {
2050
2123
  title=${r.label}
2051
2124
  @click=${(o) => this._onSourceClick(o, r)}
2052
2125
  >
2053
- ${r.brandHtml ? T(r.brandHtml) : M`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${F(r.icon)}</svg>`}
2126
+ ${r.brandHtml ? M(r.brandHtml) : R`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${O(r.icon)}</svg>`}
2054
2127
  </button>
2055
2128
  `)}
2056
2129
  ${i.length > 0 ? l`
2057
2130
  <div class="drop-tile-more-wrap">
2058
2131
  <button class="drop-tile-more" title="More sources" @click=${(r) => this._toggleMore(r)}>···</button>
2059
- ${this._moreOpen ? l`
2060
- <div class="more-dropdown">
2061
- ${i.map((r) => l`
2062
- <button
2063
- class="more-dropdown-item"
2064
- @click=${(o) => this._onMoreSourceClick(o, r)}
2065
- >
2066
- <span class="more-dropdown-ico" style=${r.iconColor && !r.brandHtml ? `color:${r.iconColor}` : ""}>
2067
- ${r.brandHtml ? T(r.brandHtml) : M`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${F(r.icon)}</svg>`}
2068
- </span>
2069
- ${r.label}
2070
- </button>
2071
- `)}
2072
- </div>
2073
- ` : p}
2074
2132
  </div>
2075
- ` : p}
2133
+ ` : c}
2076
2134
  </div>
2077
- ` : p}
2078
- <input type="file" multiple accept=${this.accept || p} @change=${this._onFileInput} />
2135
+ ` : c}
2136
+ <input type="file" multiple accept=${this.accept || c} @change=${this._onFileInput} />
2079
2137
  </div>
2080
2138
  `;
2081
2139
  }
2082
2140
  render() {
2083
2141
  return l`
2084
2142
  <div class="grid">
2085
- ${this.showDropTile ? this._renderDropTile() : p}
2143
+ ${this.showDropTile ? this._renderDropTile() : c}
2086
2144
  ${this.files.map(
2087
2145
  (e, t) => l`<sfx-file-item .file=${e} style="--tile-index:${t}"></sfx-file-item>`
2088
2146
  )}
@@ -2090,7 +2148,7 @@ const xe = class xe extends P {
2090
2148
  `;
2091
2149
  }
2092
2150
  };
2093
- xe.styles = S`
2151
+ ge.styles = S`
2094
2152
  :host {
2095
2153
  display: block;
2096
2154
  flex: 1;
@@ -2142,10 +2200,10 @@ xe.styles = S`
2142
2200
  flex-direction: column;
2143
2201
  align-items: center;
2144
2202
  justify-content: center;
2145
- gap: 8px;
2203
+ gap: 6px;
2146
2204
  cursor: pointer;
2147
2205
  transition: all 0.18s ease;
2148
- padding: 16px 12px;
2206
+ padding: 12px 10px;
2149
2207
  position: relative;
2150
2208
  z-index: 1;
2151
2209
  min-height: 0;
@@ -2158,8 +2216,8 @@ xe.styles = S`
2158
2216
  }
2159
2217
 
2160
2218
  .drop-tile-rings {
2161
- width: clamp(48px, 8vw, 72px);
2162
- height: clamp(48px, 8vw, 72px);
2219
+ width: clamp(40px, 6vw, 60px);
2220
+ height: clamp(40px, 6vw, 60px);
2163
2221
  position: relative;
2164
2222
  display: flex;
2165
2223
  align-items: center;
@@ -2188,8 +2246,8 @@ xe.styles = S`
2188
2246
  }
2189
2247
 
2190
2248
  .drop-tile-core {
2191
- width: clamp(28px, 5vw, 40px);
2192
- height: clamp(28px, 5vw, 40px);
2249
+ width: clamp(24px, 4vw, 34px);
2250
+ height: clamp(24px, 4vw, 34px);
2193
2251
  border-radius: 50%;
2194
2252
  background: var(--sfx-up-primary-bg, #eff6ff);
2195
2253
  color: var(--sfx-up-primary, #2563eb);
@@ -2207,16 +2265,16 @@ xe.styles = S`
2207
2265
  }
2208
2266
 
2209
2267
  .drop-tile-core svg {
2210
- width: 20px;
2211
- height: 20px;
2268
+ width: 16px;
2269
+ height: 16px;
2212
2270
  }
2213
2271
 
2214
2272
  .drop-tile-text {
2215
- font-size: 12px;
2273
+ font-size: 11px;
2216
2274
  font-weight: 500;
2217
2275
  color: var(--sfx-up-text-secondary, #475569);
2218
2276
  text-align: center;
2219
- line-height: 1.4;
2277
+ line-height: 1.3;
2220
2278
  }
2221
2279
 
2222
2280
  .drop-tile-text span {
@@ -2226,8 +2284,8 @@ xe.styles = S`
2226
2284
 
2227
2285
  .drop-tile-sources {
2228
2286
  display: flex;
2229
- gap: 4px;
2230
- margin-top: 4px;
2287
+ gap: 3px;
2288
+ margin-top: 2px;
2231
2289
  }
2232
2290
 
2233
2291
  .drop-tile-src {
@@ -2392,7 +2450,7 @@ xe.styles = S`
2392
2450
  display: none;
2393
2451
  }
2394
2452
  `;
2395
- let B = xe;
2453
+ let B = ge;
2396
2454
  Z([
2397
2455
  b({ attribute: !1 })
2398
2456
  ], B.prototype, "files");
@@ -2413,7 +2471,7 @@ var at = Object.defineProperty, nt = (a, e, t, i) => {
2413
2471
  (s = a[o]) && (r = s(e, t, r) || r);
2414
2472
  return r && at(e, t, r), r;
2415
2473
  };
2416
- const ge = class ge extends P {
2474
+ const ve = class ve extends U {
2417
2475
  _remove() {
2418
2476
  this.dispatchEvent(
2419
2477
  new CustomEvent("file-remove", {
@@ -2443,8 +2501,8 @@ const ge = class ge extends P {
2443
2501
  }
2444
2502
  render() {
2445
2503
  const e = this.file;
2446
- if (!e) return p;
2447
- const t = N(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 = [
2504
+ 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 = [
2448
2506
  "tile",
2449
2507
  i ? "done" : "",
2450
2508
  r ? "uploading" : "",
@@ -2459,7 +2517,7 @@ const ge = class ge extends P {
2459
2517
  <div class="type-icon">
2460
2518
  <div class="type-icon-inner ${t}">
2461
2519
  ${this._renderTypeIcon(t)}
2462
- ${n ? l`<div class="ext-label">${n}</div>` : p}
2520
+ ${n ? l`<div class="ext-label">${n}</div>` : c}
2463
2521
  </div>
2464
2522
  </div>
2465
2523
  `}
@@ -2473,7 +2531,7 @@ const ge = class ge extends P {
2473
2531
  </svg>
2474
2532
  Preview
2475
2533
  </button>
2476
- ` : p}
2534
+ ` : c}
2477
2535
 
2478
2536
  <!-- Spinner overlay -->
2479
2537
  <div class="spinner-overlay">
@@ -2485,20 +2543,20 @@ const ge = class ge extends P {
2485
2543
  <svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="3" stroke-linecap="round">
2486
2544
  <polyline points="20 6 9 17 4 12" />
2487
2545
  </svg>
2488
- </div>` : p}
2546
+ </div>` : c}
2489
2547
 
2490
2548
  <!-- Progress bar -->
2491
2549
  ${e.status === "uploading" ? l`
2492
2550
  <div class="progress">
2493
2551
  <div class="progress-fill" style="transform:scaleX(${Math.min(e.progress, 100) / 100})"></div>
2494
2552
  </div>
2495
- ` : p}
2553
+ ` : c}
2496
2554
 
2497
2555
  <!-- Error / rejected badge -->
2498
- ${(o || s) && e.error ? l`<div class="error-badge" title=${e.error}>${e.error}</div>` : p}
2556
+ ${(o || s) && e.error ? l`<div class="error-badge" title=${e.error}>${e.error}</div>` : c}
2499
2557
 
2500
2558
  <!-- Video duration badge (hidden when error badge is shown to avoid overlap) -->
2501
- ${!(o || s) && e.duration != null && e.duration > 0 ? l`<div class="duration-badge">${this._formatDuration(e.duration)}</div>` : p}
2559
+ ${!(o || s) && e.duration != null && e.duration > 0 ? l`<div class="duration-badge">${this._formatDuration(e.duration)}</div>` : c}
2502
2560
  </div>
2503
2561
 
2504
2562
  <!-- Action buttons -->
@@ -2510,7 +2568,7 @@ const ge = class ge extends P {
2510
2568
  <path d="M20.49 15a9 9 0 11-2.12-9.36L23 10" />
2511
2569
  </svg>
2512
2570
  </button>
2513
- ` : p}
2571
+ ` : c}
2514
2572
  <button class="act-btn del" @click=${this._remove} title="Remove" aria-label="Remove file">
2515
2573
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
2516
2574
  <polyline points="3 6 5 6 21 6" />
@@ -2549,7 +2607,7 @@ const ge = class ge extends P {
2549
2607
  }
2550
2608
  }
2551
2609
  };
2552
- ge.styles = S`
2610
+ ve.styles = S`
2553
2611
  :host {
2554
2612
  display: block;
2555
2613
  }
@@ -2579,15 +2637,23 @@ ge.styles = S`
2579
2637
  aspect-ratio: 16 / 10;
2580
2638
  overflow: hidden;
2581
2639
  flex-shrink: 0;
2582
- background: var(--sfx-up-border-light, #f3f4f6);
2640
+ background-color: var(--sfx-up-checker-bg, #fff);
2641
+ background-image:
2642
+ linear-gradient(45deg, var(--sfx-up-checker-tile, #f0f0f0) 25%, transparent 25%),
2643
+ linear-gradient(-45deg, var(--sfx-up-checker-tile, #f0f0f0) 25%, transparent 25%),
2644
+ linear-gradient(45deg, transparent 75%, var(--sfx-up-checker-tile, #f0f0f0) 75%),
2645
+ linear-gradient(-45deg, transparent 75%, var(--sfx-up-checker-tile, #f0f0f0) 75%);
2646
+ background-size: 16px 16px;
2647
+ background-position: 0 0, 0 8px, 8px -8px, -8px 0;
2583
2648
  border-radius: 10px 10px 0 0;
2584
2649
  }
2585
2650
 
2586
2651
  .preview-bg {
2587
2652
  position: absolute;
2588
2653
  inset: 0;
2589
- background-size: cover;
2654
+ background-size: contain;
2590
2655
  background-position: center;
2656
+ background-repeat: no-repeat;
2591
2657
  transition: transform 0.4s ease;
2592
2658
  }
2593
2659
 
@@ -2923,10 +2989,10 @@ ge.styles = S`
2923
2989
  .spin-ring { animation: none; }
2924
2990
  }
2925
2991
  `;
2926
- let ne = ge;
2992
+ let le = ve;
2927
2993
  nt([
2928
2994
  b({ attribute: !1 })
2929
- ], ne.prototype, "file");
2995
+ ], le.prototype, "file");
2930
2996
  const J = S`
2931
2997
  .btn,
2932
2998
  .btn-ghost,
@@ -2996,18 +3062,18 @@ const J = S`
2996
3062
  opacity: 0.55;
2997
3063
  cursor: not-allowed;
2998
3064
  }
2999
- `, G = S`
3065
+ `, Q = S`
3000
3066
  button:focus-visible {
3001
3067
  outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
3002
3068
  outline-offset: 2px;
3003
3069
  }
3004
3070
  `;
3005
- var lt = Object.defineProperty, Q = (a, e, t, i) => {
3071
+ var lt = Object.defineProperty, ee = (a, e, t, i) => {
3006
3072
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3007
3073
  (s = a[o]) && (r = s(e, t, r) || r);
3008
3074
  return r && lt(e, t, r), r;
3009
3075
  };
3010
- const Pe = 7, ve = class ve extends P {
3076
+ const Ue = 7, be = class be extends U {
3011
3077
  constructor() {
3012
3078
  super(...arguments), this.fileCount = 0, this.totalSize = 0, this.thumbnails = [], this.primaryLabel = "Done", this.failedFiles = [];
3013
3079
  }
@@ -3037,7 +3103,7 @@ const Pe = 7, ve = class ve extends P {
3037
3103
  );
3038
3104
  }
3039
3105
  render() {
3040
- const e = this.thumbnails.slice(0, Pe), t = this.thumbnails.length - Pe, i = this.fileCount > 0, r = this.failedFiles.length > 0, o = r && !i;
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;
3041
3107
  return l`
3042
3108
  <button class="close-btn" title="Close" @click=${this._close}>
3043
3109
  <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>
@@ -3060,11 +3126,11 @@ const Pe = 7, ve = class ve extends P {
3060
3126
  ${e.map(
3061
3127
  (s) => l`<img class="thumb" src=${s} alt="" />`
3062
3128
  )}
3063
- ${t > 0 ? l`<div class="thumb-more">+${t}</div>` : p}
3129
+ ${t > 0 ? l`<div class="thumb-more">+${t}</div>` : c}
3064
3130
  </div>
3065
- ` : p}
3131
+ ` : c}
3066
3132
 
3067
- ${i ? l`<div class="summary">${this.fileCount} ${this.fileCount === 1 ? "file" : "files"} · ${Y(this.totalSize)} uploaded</div>` : p}
3133
+ ${i ? l`<div class="summary">${this.fileCount} ${this.fileCount === 1 ? "file" : "files"} · ${Y(this.totalSize)} uploaded</div>` : c}
3068
3134
 
3069
3135
  ${r ? l`
3070
3136
  <div class="failed-list">
@@ -3081,18 +3147,18 @@ const Pe = 7, ve = class ve extends P {
3081
3147
  </div>
3082
3148
  `)}
3083
3149
  </div>
3084
- ` : p}
3150
+ ` : c}
3085
3151
 
3086
3152
  <div class="actions">
3087
3153
  <button class="btn-ghost" @click=${this._uploadMore}>Upload more</button>
3088
- ${r ? l`<button class="btn-retry-all" @click=${this._retryAll}>Retry all (${this.failedFiles.length})</button>` : p}
3154
+ ${r ? l`<button class="btn-retry-all" @click=${this._retryAll}>Retry all (${this.failedFiles.length})</button>` : c}
3089
3155
  <button class="btn-primary" @click=${this._primaryAction}>${this.primaryLabel}</button>
3090
3156
  </div>
3091
3157
  </div>
3092
3158
  `;
3093
3159
  }
3094
3160
  };
3095
- ve.styles = [J, G, S`
3161
+ be.styles = [J, Q, S`
3096
3162
  :host {
3097
3163
  display: flex;
3098
3164
  flex: 1;
@@ -3372,28 +3438,28 @@ ve.styles = [J, G, S`
3372
3438
  .icon { animation: none; }
3373
3439
  }
3374
3440
  `];
3375
- let R = ve;
3376
- Q([
3441
+ let L = be;
3442
+ ee([
3377
3443
  b({ type: Number })
3378
- ], R.prototype, "fileCount");
3379
- Q([
3444
+ ], L.prototype, "fileCount");
3445
+ ee([
3380
3446
  b({ type: Number })
3381
- ], R.prototype, "totalSize");
3382
- Q([
3447
+ ], L.prototype, "totalSize");
3448
+ ee([
3383
3449
  b({ type: Array })
3384
- ], R.prototype, "thumbnails");
3385
- Q([
3450
+ ], L.prototype, "thumbnails");
3451
+ ee([
3386
3452
  b({ type: String })
3387
- ], R.prototype, "primaryLabel");
3388
- Q([
3453
+ ], L.prototype, "primaryLabel");
3454
+ ee([
3389
3455
  b({ type: Array })
3390
- ], R.prototype, "failedFiles");
3391
- var dt = Object.defineProperty, A = (a, e, t, i) => {
3456
+ ], L.prototype, "failedFiles");
3457
+ var dt = Object.defineProperty, I = (a, e, t, i) => {
3392
3458
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3393
3459
  (s = a[o]) && (r = s(e, t, r) || r);
3394
3460
  return r && dt(e, t, r), r;
3395
3461
  };
3396
- const be = class be extends P {
3462
+ const me = class me extends U {
3397
3463
  constructor() {
3398
3464
  super(...arguments), this.uploadState = "idle", this.fileCount = 0, this.totalSize = 0, this.failedCount = 0, this.showFillMetadata = !1, this.completedCount = 0, this.uploadProgress = 0;
3399
3465
  }
@@ -3422,7 +3488,7 @@ const be = class be extends P {
3422
3488
  </div>
3423
3489
  <span class="progress-label">${this.completedCount}/${this.fileCount} files</span>
3424
3490
  </div>
3425
- ` : p}
3491
+ ` : c}
3426
3492
  <div class="buttons-row">
3427
3493
  <div class="left">
3428
3494
  ${this.showFillMetadata && this.uploadState === "idle" ? l`
@@ -3436,7 +3502,7 @@ const be = class be extends P {
3436
3502
  </svg>
3437
3503
  Fill Metadata
3438
3504
  </button>
3439
- ` : p}
3505
+ ` : c}
3440
3506
  </div>
3441
3507
  <div class="right">
3442
3508
  <button class="btn-ghost" @click=${this._clear}>
@@ -3464,7 +3530,7 @@ const be = class be extends P {
3464
3530
  </svg>
3465
3531
  Retry all (${this.failedCount})
3466
3532
  </button>
3467
- ` : p}
3533
+ ` : c}
3468
3534
  ${this._renderUploadButton()}
3469
3535
  </div>
3470
3536
  </div>
@@ -3495,7 +3561,7 @@ const be = class be extends P {
3495
3561
  `;
3496
3562
  }
3497
3563
  };
3498
- be.styles = [J, G, S`
3564
+ me.styles = [J, Q, S`
3499
3565
  :host {
3500
3566
  display: flex;
3501
3567
  flex-direction: column;
@@ -3644,29 +3710,29 @@ be.styles = [J, G, S`
3644
3710
  .btn-spin { animation: none; }
3645
3711
  }
3646
3712
  `];
3647
- let O = be;
3648
- A([
3713
+ let F = me;
3714
+ I([
3649
3715
  b({ type: String })
3650
- ], O.prototype, "uploadState");
3651
- A([
3716
+ ], F.prototype, "uploadState");
3717
+ I([
3652
3718
  b({ type: Number })
3653
- ], O.prototype, "fileCount");
3654
- A([
3719
+ ], F.prototype, "fileCount");
3720
+ I([
3655
3721
  b({ type: Number })
3656
- ], O.prototype, "totalSize");
3657
- A([
3722
+ ], F.prototype, "totalSize");
3723
+ I([
3658
3724
  b({ type: Number })
3659
- ], O.prototype, "failedCount");
3660
- A([
3725
+ ], F.prototype, "failedCount");
3726
+ I([
3661
3727
  b({ type: Boolean })
3662
- ], O.prototype, "showFillMetadata");
3663
- A([
3728
+ ], F.prototype, "showFillMetadata");
3729
+ I([
3664
3730
  b({ type: Number })
3665
- ], O.prototype, "completedCount");
3666
- A([
3731
+ ], F.prototype, "completedCount");
3732
+ I([
3667
3733
  b({ type: Number })
3668
- ], O.prototype, "uploadProgress");
3669
- const ct = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
3734
+ ], F.prototype, "uploadProgress");
3735
+ const pt = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
3670
3736
  function ce(a, e) {
3671
3737
  return (t) => {
3672
3738
  if (t.key !== "Tab") return;
@@ -3674,18 +3740,18 @@ function ce(a, e) {
3674
3740
  if (!i) return;
3675
3741
  const r = i.querySelector(e);
3676
3742
  if (!r) return;
3677
- const o = Array.from(r.querySelectorAll(ct));
3743
+ const o = Array.from(r.querySelectorAll(pt));
3678
3744
  if (o.length === 0) return;
3679
3745
  const s = o[0], n = o[o.length - 1], d = i.activeElement;
3680
3746
  t.shiftKey ? (d === s || !r.contains(d)) && (t.preventDefault(), n.focus()) : (d === n || !r.contains(d)) && (t.preventDefault(), s.focus());
3681
3747
  };
3682
3748
  }
3683
- var pt = Object.defineProperty, pe = (a, e, t, i) => {
3749
+ var ct = Object.defineProperty, fe = (a, e, t, i) => {
3684
3750
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3685
3751
  (s = a[o]) && (r = s(e, t, r) || r);
3686
- return r && pt(e, t, r), r;
3752
+ return r && ct(e, t, r), r;
3687
3753
  };
3688
- const me = class me extends P {
3754
+ const we = class we extends U {
3689
3755
  constructor() {
3690
3756
  super(...arguments), this._url = "", this._name = "", this._error = "", this._onBackdropClick = (e) => {
3691
3757
  e.target === e.currentTarget && this._cancel();
@@ -3796,7 +3862,7 @@ const me = class me extends P {
3796
3862
  `;
3797
3863
  }
3798
3864
  };
3799
- me.styles = [J, G, S`
3865
+ we.styles = [J, Q, S`
3800
3866
  :host {
3801
3867
  display: block;
3802
3868
  }
@@ -3970,22 +4036,22 @@ me.styles = [J, G, S`
3970
4036
  }
3971
4037
 
3972
4038
  `];
3973
- let W = me;
3974
- pe([
4039
+ let K = we;
4040
+ fe([
3975
4041
  g()
3976
- ], W.prototype, "_url");
3977
- pe([
4042
+ ], K.prototype, "_url");
4043
+ fe([
3978
4044
  g()
3979
- ], W.prototype, "_name");
3980
- pe([
4045
+ ], K.prototype, "_name");
4046
+ fe([
3981
4047
  g()
3982
- ], W.prototype, "_error");
3983
- var ft = Object.defineProperty, re = (a, e, t, i) => {
4048
+ ], K.prototype, "_error");
4049
+ var ft = Object.defineProperty, ie = (a, e, t, i) => {
3984
4050
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3985
4051
  (s = a[o]) && (r = s(e, t, r) || r);
3986
4052
  return r && ft(e, t, r), r;
3987
4053
  };
3988
- const we = class we extends P {
4054
+ const ye = class ye extends U {
3989
4055
  constructor() {
3990
4056
  super(...arguments), this._stream = null, this._error = "", this._captured = null, this._previewUrl = "", this._onBackdropClick = (e) => {
3991
4057
  e.target === e.currentTarget && this._cancel();
@@ -4063,7 +4129,7 @@ const we = class we extends P {
4063
4129
  `;
4064
4130
  }
4065
4131
  };
4066
- we.styles = [J, G, S`
4132
+ ye.styles = [J, Q, S`
4067
4133
  :host { display: block; }
4068
4134
 
4069
4135
  .backdrop {
@@ -4144,25 +4210,25 @@ we.styles = [J, G, S`
4144
4210
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4145
4211
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
4146
4212
  `];
4147
- let q = we;
4148
- re([
4213
+ let V = ye;
4214
+ ie([
4149
4215
  g()
4150
- ], q.prototype, "_stream");
4151
- re([
4216
+ ], V.prototype, "_stream");
4217
+ ie([
4152
4218
  g()
4153
- ], q.prototype, "_error");
4154
- re([
4219
+ ], V.prototype, "_error");
4220
+ ie([
4155
4221
  g()
4156
- ], q.prototype, "_captured");
4157
- re([
4222
+ ], V.prototype, "_captured");
4223
+ ie([
4158
4224
  g()
4159
- ], q.prototype, "_previewUrl");
4160
- var ut = Object.defineProperty, ee = (a, e, t, i) => {
4225
+ ], V.prototype, "_previewUrl");
4226
+ var ht = Object.defineProperty, te = (a, e, t, i) => {
4161
4227
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
4162
4228
  (s = a[o]) && (r = s(e, t, r) || r);
4163
- return r && ut(e, t, r), r;
4229
+ return r && ht(e, t, r), r;
4164
4230
  };
4165
- const ye = class ye extends P {
4231
+ const _e = class _e extends U {
4166
4232
  constructor() {
4167
4233
  super(...arguments), this._stream = null, this._recording = !1, this._error = "", this._recordedBlob = null, this._previewUrl = "", this._recorder = null, this._chunks = [], this._onBackdropClick = (e) => {
4168
4234
  e.target === e.currentTarget && this._cancel();
@@ -4261,7 +4327,7 @@ const ye = class ye extends P {
4261
4327
  `;
4262
4328
  }
4263
4329
  };
4264
- ye.styles = [J, G, S`
4330
+ _e.styles = [J, Q, S`
4265
4331
  :host { display: block; }
4266
4332
 
4267
4333
  .backdrop {
@@ -4360,32 +4426,32 @@ ye.styles = [J, G, S`
4360
4426
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
4361
4427
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
4362
4428
  `];
4363
- let L = ye;
4364
- ee([
4429
+ let A = _e;
4430
+ te([
4365
4431
  g()
4366
- ], L.prototype, "_stream");
4367
- ee([
4432
+ ], A.prototype, "_stream");
4433
+ te([
4368
4434
  g()
4369
- ], L.prototype, "_recording");
4370
- ee([
4435
+ ], A.prototype, "_recording");
4436
+ te([
4371
4437
  g()
4372
- ], L.prototype, "_error");
4373
- ee([
4438
+ ], A.prototype, "_error");
4439
+ te([
4374
4440
  g()
4375
- ], L.prototype, "_recordedBlob");
4376
- ee([
4441
+ ], A.prototype, "_recordedBlob");
4442
+ te([
4377
4443
  g()
4378
- ], L.prototype, "_previewUrl");
4379
- var ht = Object.defineProperty, $ = (a, e, t, i) => {
4444
+ ], A.prototype, "_previewUrl");
4445
+ var ut = Object.defineProperty, $ = (a, e, t, i) => {
4380
4446
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
4381
4447
  (s = a[o]) && (r = s(e, t, r) || r);
4382
- return r && ht(e, t, r), r;
4448
+ return r && ut(e, t, r), r;
4383
4449
  };
4384
4450
  const De = /* @__PURE__ */ new Set(["unsplash"]);
4385
4451
  var E;
4386
- const C = (E = class extends P {
4452
+ const k = (E = class extends U {
4387
4453
  constructor() {
4388
- super(), this.config = null, this._isOpen = !1, this._activeConnector = null, this._showUrlDialog = !1, this._showCameraDialog = !1, this._showScreenCastDialog = !1, this._previewFileId = null, this._previewDims = "—", this._fullscreenPreviewUrl = null, this._fullscreenVideoFile = null, this._fullscreenZoomed = !1, this._fsPanX = 0, this._fsPanY = 0, this._fsDragging = !1, this._fsDragStartX = 0, this._fsDragStartY = 0, this._fsPanStartX = 0, this._fsPanStartY = 0, this._bodyDragOver = !1, this._isMinimized = !1, this._isPillExpanded = !1, this._bodyDragCounter = 0, this._videoBlobUrls = /* @__PURE__ */ new Map(), this._engine = null, this._cachedSources = X, this._cachedSourcesConfig = void 0, this._rejectedTimers = /* @__PURE__ */ new Map(), this._closeOnCompleteTimer = null, this._apiBase = null, this._authHeaders = null, this._authResolveId = 0, this._prevStoreState = null, this._unsubStoreEvents = null, this._portalContainer = null, this._onFilesSelected = (e) => {
4454
+ super(), this.config = null, this._isOpen = !1, this._activeConnector = null, this._showUrlDialog = !1, this._showCameraDialog = !1, this._showScreenCastDialog = !1, this._previewFileId = null, this._previewDims = "—", this._splitPct = 68, this._isResizing = !1, this._splitRafId = 0, this._fullscreenPreviewUrl = null, this._fullscreenVideoFile = null, this._fullscreenZoomed = !1, this._fsPanX = 0, this._fsPanY = 0, this._fsDragging = !1, this._fsDragStartX = 0, this._fsDragStartY = 0, this._fsPanStartX = 0, this._fsPanStartY = 0, this._bodyDragOver = !1, this._isMinimized = !1, this._isPillExpanded = !1, this._bodyDragCounter = 0, this._videoBlobUrls = /* @__PURE__ */ new Map(), this._engine = null, this._cachedSources = W, this._cachedSourcesConfig = void 0, this._rejectedTimers = /* @__PURE__ */ new Map(), this._closeOnCompleteTimer = null, this._apiBase = null, this._authHeaders = null, this._authResolveId = 0, this._prevStoreState = null, this._unsubStoreEvents = null, this._portalContainer = null, this._onFilesSelected = (e) => {
4389
4455
  this._processIncomingFiles(e.detail.files);
4390
4456
  }, this._onDropTileSourceClick = (e) => {
4391
4457
  this._handleSourceActivation(e.detail.source.id);
@@ -4422,22 +4488,22 @@ const C = (E = class extends P {
4422
4488
  if ((((o = (r = this.config) == null ? void 0 : r.connectors) == null ? void 0 : o.providers) ?? []).includes(e)) {
4423
4489
  if (De.has(e)) {
4424
4490
  if (!customElements.get("sfx-search-provider-browser")) {
4425
- const { SfxSearchProviderBrowser: n } = await import("./search-provider-browser-Dywv08pq.js");
4491
+ const { SfxSearchProviderBrowser: n } = await import("./search-provider-browser-BYkWbFar.js");
4426
4492
  customElements.define("sfx-search-provider-browser", n);
4427
4493
  }
4428
4494
  } else if (!customElements.get("sfx-provider-browser")) {
4429
- const { SfxProviderBrowser: n } = await import("./provider-browser-ZgbnfTHX.js");
4495
+ const { SfxProviderBrowser: n } = await import("./provider-browser-CWEFYWp6.js");
4430
4496
  customElements.define("sfx-provider-browser", n);
4431
4497
  }
4432
4498
  this._activeConnector = e;
4433
4499
  }
4434
4500
  }, this._onUrlSubmit = (e) => {
4435
- var u, h, x;
4501
+ var h, u, x;
4436
4502
  this._showUrlDialog = !1;
4437
- const { url: t, name: i } = e.detail, r = (u = this.config) == null ? void 0 : u.callbacks, o = We(i), s = o.startsWith("image/"), n = this._store.getState(), d = se({ name: i, size: 0, type: o }, n.restrictions, n.files);
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);
4438
4504
  if (d) {
4439
4505
  const f = {
4440
- id: H(),
4506
+ id: q(),
4441
4507
  status: "rejected",
4442
4508
  file: null,
4443
4509
  remoteUrl: t,
@@ -4457,11 +4523,11 @@ const C = (E = class extends P {
4457
4523
  tags: [],
4458
4524
  remoteInfo: null
4459
4525
  };
4460
- I(this._store, f), this._dispatchPublic(v.FILE_REJECTED, { file: f, reason: d }), (h = r == null ? void 0 : r.onFileRejected) == null || h.call(r, f, d);
4526
+ H(this._store, f), this._dispatchPublic(v.FILE_REJECTED, { file: f, reason: d }), (u = r == null ? void 0 : r.onFileRejected) == null || u.call(r, f, d);
4461
4527
  return;
4462
4528
  }
4463
- const c = {
4464
- id: H(),
4529
+ const p = {
4530
+ id: q(),
4465
4531
  status: "idle",
4466
4532
  file: null,
4467
4533
  remoteUrl: t,
@@ -4481,7 +4547,7 @@ const C = (E = class extends P {
4481
4547
  tags: [],
4482
4548
  remoteInfo: null
4483
4549
  };
4484
- I(this._store, c), this._dispatchPublic(v.FILE_ADDED, { file: c }), (x = r == null ? void 0 : r.onFileAdded) == null || x.call(r, c), this._store.getState().queueConfig.autoProceed && this.upload();
4550
+ H(this._store, p), this._dispatchPublic(v.FILE_ADDED, { file: p }), (x = r == null ? void 0 : r.onFileAdded) == null || x.call(r, p), this._store.getState().queueConfig.autoProceed && this.upload();
4485
4551
  }, this._onUrlCancel = () => {
4486
4552
  this._showUrlDialog = !1;
4487
4553
  }, this._onCameraCapture = (e) => {
@@ -4549,14 +4615,14 @@ const C = (E = class extends P {
4549
4615
  var i, r, o;
4550
4616
  const t = (i = this.config) == null ? void 0 : i.callbacks;
4551
4617
  for (const s of e.detail.files) {
4552
- const n = this._store.getState(), d = se(
4618
+ const n = this._store.getState(), d = ae(
4553
4619
  { name: s.name, size: s.size, type: s.mimeType },
4554
4620
  n.restrictions,
4555
4621
  n.files
4556
4622
  );
4557
4623
  if (d) {
4558
- const u = {
4559
- id: H(),
4624
+ const h = {
4625
+ id: q(),
4560
4626
  status: "rejected",
4561
4627
  file: null,
4562
4628
  remoteUrl: null,
@@ -4576,11 +4642,11 @@ const C = (E = class extends P {
4576
4642
  tags: [],
4577
4643
  remoteInfo: s
4578
4644
  };
4579
- I(this._store, u), this._dispatchPublic(v.FILE_REJECTED, { file: u, reason: d }), (r = t == null ? void 0 : t.onFileRejected) == null || r.call(t, u, d);
4645
+ H(this._store, h), this._dispatchPublic(v.FILE_REJECTED, { file: h, reason: d }), (r = t == null ? void 0 : t.onFileRejected) == null || r.call(t, h, d);
4580
4646
  continue;
4581
4647
  }
4582
- const c = {
4583
- id: H(),
4648
+ const p = {
4649
+ id: q(),
4584
4650
  status: "idle",
4585
4651
  file: null,
4586
4652
  remoteUrl: null,
@@ -4600,7 +4666,7 @@ const C = (E = class extends P {
4600
4666
  tags: [],
4601
4667
  remoteInfo: s
4602
4668
  };
4603
- I(this._store, c), this._dispatchPublic(v.FILE_ADDED, { file: c }), (o = t == null ? void 0 : t.onFileAdded) == null || o.call(t, c);
4669
+ H(this._store, p), this._dispatchPublic(v.FILE_ADDED, { file: p }), (o = t == null ? void 0 : t.onFileAdded) == null || o.call(t, p);
4604
4670
  }
4605
4671
  this._activeConnector = null, this._store.getState().queueConfig.autoProceed && this.upload();
4606
4672
  }, this._onConnectorClose = () => {
@@ -4652,7 +4718,28 @@ const C = (E = class extends P {
4652
4718
  }
4653
4719
  this._isOpen && ((t = this.config) == null ? void 0 : t.mode) === "modal" && (((i = this.config) == null ? void 0 : i.headerButton) ?? "close") !== "none" && this._onModalDismiss();
4654
4720
  }
4655
- }, this._dimCache = /* @__PURE__ */ new Map(), this._onFsToggleZoom = (e) => {
4721
+ }, this._dimCache = /* @__PURE__ */ new Map(), this._onSplitPointerDown = (e) => {
4722
+ var i;
4723
+ e.preventDefault(), this._isResizing = !0;
4724
+ const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".preview-layout");
4725
+ t == null || t.classList.add("resizing"), e.target.setPointerCapture(e.pointerId);
4726
+ }, this._onSplitPointerMove = (e) => {
4727
+ if (!this._isResizing || this._splitRafId) return;
4728
+ const t = e.clientX;
4729
+ this._splitRafId = requestAnimationFrame(() => {
4730
+ var s;
4731
+ 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));
4736
+ });
4737
+ }, this._onSplitPointerUp = () => {
4738
+ var t;
4739
+ this._isResizing = !1, this._splitRafId && (cancelAnimationFrame(this._splitRafId), this._splitRafId = 0);
4740
+ const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".preview-layout");
4741
+ e == null || e.classList.remove("resizing");
4742
+ }, this._onFsToggleZoom = (e) => {
4656
4743
  e == null || e.stopPropagation(), this._fullscreenZoomed = !this._fullscreenZoomed, this._fullscreenZoomed || (this._fsPanX = 0, this._fsPanY = 0);
4657
4744
  }, this._onFsOverlayClick = (e) => {
4658
4745
  this._fsDragDidMove || this._onFsToggleZoom(e);
@@ -4676,7 +4763,7 @@ const C = (E = class extends P {
4676
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();
4677
4764
  }, this._onFsClose = (e) => {
4678
4765
  e == null || e.stopPropagation(), this._fullscreenPreviewUrl = null, this._fullscreenVideoFile = null, this._fullscreenZoomed = !1, this._fsPanX = 0, this._fsPanY = 0;
4679
- }, this._store = Oe(), this._storeCtrl = new Me(this, this._store);
4766
+ }, this._store = Oe(), this._storeCtrl = new Re(this, this._store);
4680
4767
  }
4681
4768
  // --- Public API ---
4682
4769
  /** Open the uploader (modal mode). */
@@ -4691,13 +4778,13 @@ const C = (E = class extends P {
4691
4778
  }
4692
4779
  /** Start uploading all queued files. */
4693
4780
  upload() {
4694
- var r, o, s, n, d, c, u;
4781
+ var r, o, s, n, d, p, h;
4695
4782
  if (this._ensureEngine(), !this._engine) {
4696
4783
  console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");
4697
4784
  return;
4698
4785
  }
4699
4786
  const e = [...this._store.getState().files.values()].filter(
4700
- (h) => h.status === "idle" || h.status === "queued"
4787
+ (u) => u.status === "idle" || u.status === "queued"
4701
4788
  );
4702
4789
  if ((o = (r = this.config) == null ? void 0 : r.callbacks) != null && o.onBeforeUpload && this.config.callbacks.onBeforeUpload(e) === !1)
4703
4790
  return;
@@ -4707,7 +4794,7 @@ const C = (E = class extends P {
4707
4794
  cancelable: !0,
4708
4795
  detail: { files: e }
4709
4796
  });
4710
- this.dispatchEvent(t) && (this._dispatchPublic(v.UPLOAD_STARTED, { files: e }), (d = (n = (s = this.config) == null ? void 0 : s.callbacks) == null ? void 0 : n.onUploadStarted) == null || d.call(n, e), this._engine.uploadAll(), (c = this.config) != null && c.minimizeOnUpload && ((u = this.config) == null ? void 0 : u.mode) !== "inline" && (this._isMinimized = !0, this._isPillExpanded = !0, this.requestUpdate()));
4797
+ this.dispatchEvent(t) && (this._dispatchPublic(v.UPLOAD_STARTED, { files: e }), (d = (n = (s = this.config) == null ? void 0 : s.callbacks) == null ? void 0 : n.onUploadStarted) == null || d.call(n, e), this._engine.uploadAll(), (p = this.config) != null && p.minimizeOnUpload && ((h = this.config) == null ? void 0 : h.mode) !== "inline" && (this._isMinimized = !0, this._isPillExpanded = !0, this.requestUpdate()));
4711
4798
  }
4712
4799
  /** Programmatically add files. */
4713
4800
  addFiles(e) {
@@ -4844,7 +4931,7 @@ const C = (E = class extends P {
4844
4931
  }
4845
4932
  _updateFloatingPortal() {
4846
4933
  const e = [...this._storeCtrl.state.files.values()];
4847
- this._isMinimized && e.length > 0 ? (this._injectFloatStyles(), this._portalContainer || (this._portalContainer = document.createElement("div"), this._portalContainer.setAttribute("data-sfx-upload-float", ""), document.body.appendChild(this._portalContainer)), ke(this._renderFloatingPill(e), this._portalContainer)) : this._portalContainer && (ke(p, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
4934
+ this._isMinimized && e.length > 0 ? (this._injectFloatStyles(), this._portalContainer || (this._portalContainer = document.createElement("div"), this._portalContainer.setAttribute("data-sfx-upload-float", ""), document.body.appendChild(this._portalContainer)), T(this._renderFloatingPill(e), this._portalContainer)) : this._portalContainer && (T(c, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
4848
4935
  }
4849
4936
  connectedCallback() {
4850
4937
  super.connectedCallback(), document.addEventListener("keydown", this._onKeyDown), this._prevStoreState = this._store.getState(), this._unsubStoreEvents = this._store.subscribe(() => this._onStoreChange());
@@ -4878,7 +4965,7 @@ const C = (E = class extends P {
4878
4965
  var r, o;
4879
4966
  const t = e.auth;
4880
4967
  if (t.mode === "sass-key") {
4881
- this._apiBase = de(t.container), this._authHeaders = oe(t), this._ensureEngine(), (r = this._engine) == null || r.updateConfig({
4968
+ this._apiBase = pe(t.container), this._authHeaders = se(t), this._ensureEngine(), (r = this._engine) == null || r.updateConfig({
4882
4969
  apiBase: this._apiBase,
4883
4970
  authHeaders: this._authHeaders
4884
4971
  });
@@ -4886,7 +4973,7 @@ const C = (E = class extends P {
4886
4973
  }
4887
4974
  const i = ++this._authResolveId;
4888
4975
  try {
4889
- const s = await qe(t);
4976
+ const s = await Ye(t);
4890
4977
  if (i !== this._authResolveId) return;
4891
4978
  this._apiBase = s.apiBase, this._authHeaders = s.headers, this._ensureEngine(), (o = this._engine) == null || o.updateConfig({
4892
4979
  apiBase: this._apiBase,
@@ -4914,7 +5001,7 @@ const C = (E = class extends P {
4914
5001
  * for file status transitions.
4915
5002
  */
4916
5003
  _onStoreChange() {
4917
- var r, o, s, n, d, c, u, h;
5004
+ var r, o, s, n, d, p, h, u;
4918
5005
  const e = this._store.getState(), t = this._prevStoreState;
4919
5006
  if (this._prevStoreState = e, !t) return;
4920
5007
  const i = (r = this.config) == null ? void 0 : r.callbacks;
@@ -4947,19 +5034,19 @@ const C = (E = class extends P {
4947
5034
  percentage: e.totalProgress,
4948
5035
  speed: e.totalSpeed,
4949
5036
  eta: x
4950
- }), (c = i == null ? void 0 : i.onTotalProgress) == null || c.call(i, e.totalProgress, e.totalSpeed, x);
5037
+ }), (p = i == null ? void 0 : i.onTotalProgress) == null || p.call(i, e.totalProgress, e.totalSpeed, x);
4951
5038
  }
4952
5039
  if (t.isUploading && !e.isUploading) {
4953
5040
  const x = [...e.files.values()];
4954
5041
  if (!x.some((m) => m.status === "cancelled")) {
4955
5042
  const m = x.filter((y) => y.status === "complete"), _ = x.filter((y) => y.status === "failed" || y.status === "error");
4956
- this._dispatchPublic(v.ALL_COMPLETE, { successful: m, failed: _ }), (u = i == null ? void 0 : i.onAllComplete) == null || u.call(i, m, _);
4957
- const w = (h = this.config) == null ? void 0 : h.closeOnComplete;
5043
+ this._dispatchPublic(v.ALL_COMPLETE, { successful: m, failed: _ }), (h = i == null ? void 0 : i.onAllComplete) == null || h.call(i, m, _);
5044
+ const w = (u = this.config) == null ? void 0 : u.closeOnComplete;
4958
5045
  if (w) {
4959
5046
  const y = typeof w == "number" ? w : 1500;
4960
5047
  this._closeOnCompleteTimer = setTimeout(() => {
4961
- var k, D, _e;
4962
- this._closeOnCompleteTimer = null, this._phase === "complete" && (this._dispatchPublic(v.COMPLETE_ACTION, {}), (_e = (D = (k = this.config) == null ? void 0 : k.callbacks) == null ? void 0 : D.onCompleteAction) == null || _e.call(D), this.close());
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());
4963
5050
  }, y);
4964
5051
  }
4965
5052
  }
@@ -4970,15 +5057,15 @@ const C = (E = class extends P {
4970
5057
  const e = (d = this.config) == null ? void 0 : d.connectors;
4971
5058
  if (e === this._cachedSourcesConfig) return this._cachedSources;
4972
5059
  if (this._cachedSourcesConfig = e, !e)
4973
- return this._cachedSources = X, this._cachedSources;
4974
- const t = e.providers.length > 0 ? Je(e.providers) : [], i = e.customSources ?? [], r = X.filter((c) => c.id === "device" || c.id === "url"), o = X.filter((c) => c.id !== "device" && c.id !== "url"), s = /* @__PURE__ */ new Set(), n = [];
4975
- for (const c of [...r, ...t, ...o, ...i])
4976
- if (!s.has(c.id)) {
4977
- if (E._RESERVED_IDS.has(c.id) && c.onActivate) {
4978
- console.warn(`[sfx-uploader] Custom source id "${c.id}" conflicts with a built-in source and was skipped.`);
5060
+ 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])
5063
+ if (!s.has(p.id)) {
5064
+ if (E._RESERVED_IDS.has(p.id) && p.onActivate) {
5065
+ console.warn(`[sfx-uploader] Custom source id "${p.id}" conflicts with a built-in source and was skipped.`);
4979
5066
  continue;
4980
5067
  }
4981
- s.add(c.id), n.push(c);
5068
+ s.add(p.id), n.push(p);
4982
5069
  }
4983
5070
  return this._cachedSources = n, this._cachedSources;
4984
5071
  }
@@ -4995,10 +5082,10 @@ const C = (E = class extends P {
4995
5082
  var i, r, o, s;
4996
5083
  const t = (i = this.config) == null ? void 0 : i.callbacks;
4997
5084
  for (const n of e) {
4998
- const d = this._store.getState(), c = Ze(n, d.restrictions, d.files);
4999
- if (c) {
5085
+ const d = this._store.getState(), p = Ge(n, d.restrictions, d.files);
5086
+ if (p) {
5000
5087
  const x = n.type.startsWith("image/") ? URL.createObjectURL(n) : null, f = {
5001
- id: H(),
5088
+ id: q(),
5002
5089
  status: "rejected",
5003
5090
  file: n,
5004
5091
  remoteUrl: null,
@@ -5010,7 +5097,7 @@ const C = (E = class extends P {
5010
5097
  progress: 0,
5011
5098
  speed: 0,
5012
5099
  bytesUploaded: 0,
5013
- error: c,
5100
+ error: p,
5014
5101
  retryCount: 0,
5015
5102
  response: null,
5016
5103
  addedAt: Date.now(),
@@ -5018,29 +5105,29 @@ const C = (E = class extends P {
5018
5105
  tags: [],
5019
5106
  remoteInfo: null
5020
5107
  };
5021
- I(this._store, f), this._dispatchPublic(v.FILE_REJECTED, { file: f, reason: c }), (r = t == null ? void 0 : t.onFileRejected) == null || r.call(t, f, c);
5108
+ 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);
5022
5109
  const m = (o = this.config) == null ? void 0 : o.rejectedFileAutoRemoveDelay, _ = m === !1 || m === 0 || m === void 0 ? 0 : m;
5023
5110
  if (_ > 0) {
5024
5111
  const w = f.id, y = setTimeout(() => {
5025
5112
  this._rejectedTimers.delete(w);
5026
- const k = this._store.getState().files.get(w);
5027
- k && k.status === "rejected" && Ce(this._store, w);
5113
+ const C = this._store.getState().files.get(w);
5114
+ C && C.status === "rejected" && Ce(this._store, w);
5028
5115
  }, _);
5029
5116
  this._rejectedTimers.set(w, y);
5030
5117
  }
5031
5118
  continue;
5032
5119
  }
5033
- let u = null;
5034
- n.type.startsWith("image/") && (u = URL.createObjectURL(n));
5035
- const h = {
5036
- id: H(),
5120
+ let h = null;
5121
+ n.type.startsWith("image/") && (h = URL.createObjectURL(n));
5122
+ const u = {
5123
+ id: q(),
5037
5124
  status: "idle",
5038
5125
  file: n,
5039
5126
  remoteUrl: null,
5040
5127
  name: n.name,
5041
5128
  size: n.size,
5042
5129
  type: n.type,
5043
- previewUrl: u,
5130
+ previewUrl: h,
5044
5131
  duration: null,
5045
5132
  progress: 0,
5046
5133
  speed: 0,
@@ -5053,13 +5140,13 @@ const C = (E = class extends P {
5053
5140
  tags: [],
5054
5141
  remoteInfo: null
5055
5142
  };
5056
- if (I(this._store, h), this._dispatchPublic(v.FILE_ADDED, { file: h }), (s = t == null ? void 0 : t.onFileAdded) == null || s.call(t, h), n.type.startsWith("video/")) {
5143
+ 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/")) {
5057
5144
  Ke(n).then((f) => {
5058
5145
  if (!f) return;
5059
- const m = this._store.getState(), _ = m.files.get(h.id);
5146
+ const m = this._store.getState(), _ = m.files.get(u.id);
5060
5147
  if (_) {
5061
5148
  const w = new Map(m.files);
5062
- w.set(h.id, { ..._, previewUrl: f }), this._store.setState({ files: w });
5149
+ w.set(u.id, { ..._, previewUrl: f }), this._store.setState({ files: w });
5063
5150
  } else
5064
5151
  URL.revokeObjectURL(f);
5065
5152
  });
@@ -5069,10 +5156,10 @@ const C = (E = class extends P {
5069
5156
  }, x.onloadedmetadata = () => {
5070
5157
  const f = x.duration;
5071
5158
  if (URL.revokeObjectURL(x.src), !isFinite(f)) return;
5072
- const m = this._store.getState(), _ = m.files.get(h.id);
5159
+ const m = this._store.getState(), _ = m.files.get(u.id);
5073
5160
  if (_) {
5074
5161
  const w = new Map(m.files);
5075
- w.set(h.id, { ..._, duration: f }), this._store.setState({ files: w });
5162
+ w.set(u.id, { ..._, duration: f }), this._store.setState({ files: w });
5076
5163
  }
5077
5164
  };
5078
5165
  }
@@ -5085,14 +5172,14 @@ const C = (E = class extends P {
5085
5172
  if (!t) return;
5086
5173
  const i = { ...t };
5087
5174
  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) {
5088
- const c = this._videoBlobUrls.get(t.file);
5089
- c && (URL.revokeObjectURL(c), this._videoBlobUrls.delete(t.file));
5175
+ const p = this._videoBlobUrls.get(t.file);
5176
+ p && (URL.revokeObjectURL(p), this._videoBlobUrls.delete(t.file));
5090
5177
  }
5091
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);
5092
5179
  const r = this._rejectedTimers.get(e);
5093
5180
  if (r && (clearTimeout(r), this._rejectedTimers.delete(e)), this._previewFileId === e) {
5094
- const c = [...this._store.getState().files.values()];
5095
- this._previewFileId = c.length > 0 ? c[0].id : null;
5181
+ const p = [...this._store.getState().files.values()];
5182
+ this._previewFileId = p.length > 0 ? p[0].id : null;
5096
5183
  }
5097
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);
5098
5185
  }
@@ -5108,7 +5195,7 @@ const C = (E = class extends P {
5108
5195
  ${this._renderBody()}
5109
5196
  </div>
5110
5197
  </div>
5111
- ` : p}
5198
+ ` : c}
5112
5199
  ` : l`
5113
5200
  <div class="inline">
5114
5201
  ${this._renderHeader()}
@@ -5118,9 +5205,9 @@ const C = (E = class extends P {
5118
5205
  }
5119
5206
  _renderHeader() {
5120
5207
  var s, n;
5121
- if (this._phase === "complete") return p;
5208
+ if (this._phase === "complete") return c;
5122
5209
  if (this._phase === "uploading") {
5123
- const d = this._storeCtrl.state, c = [...d.files.values()], u = c.filter((x) => x.status === "complete").length, h = d.totalSpeed > 0 ? (d.totalBytes - d.totalBytesUploaded) / d.totalSpeed : 0;
5210
+ const d = this._storeCtrl.state, p = [...d.files.values()], h = p.filter((x) => x.status === "complete").length, u = d.totalSpeed > 0 ? (d.totalBytes - d.totalBytesUploaded) / d.totalSpeed : 0;
5124
5211
  return l`
5125
5212
  <div class="header upload-header">
5126
5213
  <div class="float-header-left">
@@ -5128,8 +5215,8 @@ const C = (E = class extends P {
5128
5215
  <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>
5129
5216
  </div>
5130
5217
  <div>
5131
- <div class="float-title">Uploading ${c.length} ${c.length === 1 ? "file" : "files"}</div>
5132
- <div class="float-subtitle">${u} of ${c.length}${h > 0 ? ` · ~${ie(h)} left` : ""}</div>
5218
+ <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>
5133
5220
  </div>
5134
5221
  </div>
5135
5222
  </div>
@@ -5139,12 +5226,12 @@ const C = (E = class extends P {
5139
5226
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
5140
5227
  <polyline points="15 18 9 12 15 6"/>
5141
5228
  </svg>
5142
- </button>` : p, o = t === "close" ? l`<button class="header-btn header-btn-close" aria-label="Close" @click=${i}>
5229
+ </button>` : c, o = t === "close" ? l`<button class="header-btn header-btn-close" aria-label="Close" @click=${i}>
5143
5230
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
5144
5231
  <line x1="18" y1="6" x2="6" y2="18" />
5145
5232
  <line x1="6" y1="6" x2="18" y2="18" />
5146
5233
  </svg>
5147
- </button>` : p;
5234
+ </button>` : c;
5148
5235
  return l`
5149
5236
  <div class="header">
5150
5237
  ${r}
@@ -5155,7 +5242,7 @@ const C = (E = class extends P {
5155
5242
  <line x1="12" y1="12" x2="12" y2="21" />
5156
5243
  <path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3" />
5157
5244
  </svg>
5158
- </div>` : p}
5245
+ </div>` : c}
5159
5246
  <div class="header-title">Upload Files</div>
5160
5247
  ${o}
5161
5248
  </div>
@@ -5180,11 +5267,11 @@ const C = (E = class extends P {
5180
5267
  <div class="upload-overlay-spinner"></div>
5181
5268
  <div class="upload-overlay-percent">${i}%</div>
5182
5269
  <div class="upload-overlay-title">Uploading ${e.length} ${e.length === 1 ? "file" : "files"}</div>
5183
- <div class="upload-overlay-subtitle">${r} of ${e.length} complete${o > 0 ? l` · ~${ie(o)} left` : p}</div>
5270
+ <div class="upload-overlay-subtitle">${r} of ${e.length} complete${o > 0 ? l` · ~${oe(o)} left` : c}</div>
5184
5271
  <div class="upload-overlay-bar">
5185
5272
  <div class="upload-overlay-bar-fill" style="width:${i}%"></div>
5186
5273
  </div>
5187
- ${(s = this.config) != null && s.minimizeOnUpload ? l`<button class="upload-overlay-minimize" @click=${this._onMinimize}>Minimize & continue in background</button>` : p}
5274
+ ${(s = this.config) != null && s.minimizeOnUpload ? l`<button class="upload-overlay-minimize" @click=${this._onMinimize}>Minimize & continue in background</button>` : c}
5188
5275
  </div>
5189
5276
  `;
5190
5277
  }
@@ -5195,7 +5282,7 @@ const C = (E = class extends P {
5195
5282
  <div class="float-collapsed-left">
5196
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>`}
5197
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>
5198
- ${r ? p : l`<span class="float-collapsed-pct">${i}%</span>`}
5285
+ ${r ? c : l`<span class="float-collapsed-pct">${i}%</span>`}
5199
5286
  </div>
5200
5287
  <div class="float-collapsed-actions">
5201
5288
  <button title="Open uploader" @click=${this._onPillExpand}>
@@ -5218,7 +5305,7 @@ const C = (E = class extends P {
5218
5305
  </div>
5219
5306
  <div>
5220
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>
5221
- <div class="float-subtitle">${r ? `${o} ${o === 1 ? "file" : "files"} uploaded${s > 0 ? `, ${s} failed` : ""}` : `${o} of ${e.length}${n > 0 ? ` · ~${ie(n)} left` : ""}`}</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>
5222
5309
  </div>
5223
5310
  </div>
5224
5311
  <div class="float-actions">
@@ -5242,25 +5329,25 @@ const C = (E = class extends P {
5242
5329
  </div>
5243
5330
  <div class="float-items">
5244
5331
  ${e.map((d) => {
5245
- const c = d.status === "failed" || d.status === "error";
5332
+ const p = d.status === "failed" || d.status === "error";
5246
5333
  return l`
5247
5334
  <div class="float-item">
5248
5335
  <div class="float-item-thumb" style=${d.previewUrl ? `background-image:url(${d.previewUrl});background-size:cover;background-position:center` : ""}>
5249
- ${d.previewUrl ? p : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`}
5336
+ ${d.previewUrl ? c : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`}
5250
5337
  </div>
5251
5338
  <div class="float-item-info">
5252
5339
  <div class="float-item-name">${d.name}</div>
5253
5340
  <div class="float-item-size">${Y(d.size)}</div>
5254
5341
  </div>
5255
5342
  <div class="float-item-status">
5256
- ${d.status === "complete" ? l`<div class="float-item-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>` : c ? l`
5343
+ ${d.status === "complete" ? l`<div class="float-item-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>` : p ? l`
5257
5344
  <div class="float-item-error-wrap">
5258
5345
  <svg class="float-item-error-icon" 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>
5259
5346
  <span class="float-item-tooltip">${d.error || "Upload failed"}</span>
5260
5347
  </div>
5261
5348
  <button class="float-item-retry" @click=${() => {
5262
- var u;
5263
- this._ensureEngine(), (u = this._engine) == null || u.retryFile(d.id);
5349
+ var h;
5350
+ this._ensureEngine(), (h = this._engine) == null || h.retryFile(d.id);
5264
5351
  }}>
5265
5352
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M3 22v-6h6"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/></svg>
5266
5353
  </button>` : l`<div class="float-item-spinner"></div>`}
@@ -5274,12 +5361,12 @@ const C = (E = class extends P {
5274
5361
  }
5275
5362
  _renderPreviewLayout(e) {
5276
5363
  var n;
5277
- if (e.length === 0) return p;
5278
- 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, c) => d + (c.size || 0), 0);
5364
+ 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);
5279
5366
  return l`
5280
5367
  <div class="preview-topbar"></div>
5281
5368
  <div class="preview-layout">
5282
- <div class="file-grid-side">
5369
+ <div class="file-grid-side" style="flex:${this._splitPct}">
5283
5370
  <div class="file-grid-header">
5284
5371
  <span class="file-grid-header-text">${e.length} ${e.length === 1 ? "asset" : "assets"} · ${Y(s)}</span>
5285
5372
  </div>
@@ -5291,8 +5378,13 @@ const C = (E = class extends P {
5291
5378
  @source-click=${this._onDropTileSourceClick}
5292
5379
  ></sfx-file-list>
5293
5380
  </div>
5294
- <div class="preview-divider"></div>
5295
- <div class="preview-panel">
5381
+ <div class="preview-divider"
5382
+ @pointerdown=${this._onSplitPointerDown}
5383
+ @pointermove=${this._onSplitPointerMove}
5384
+ @pointerup=${this._onSplitPointerUp}
5385
+ @lostpointercapture=${this._onSplitPointerUp}
5386
+ ></div>
5387
+ <div class="preview-panel" style="flex:${100 - this._splitPct}">
5296
5388
  <div class="preview-panel-header">
5297
5389
  <span class="preview-panel-filename" title=${t.name}>${t.name}</span>
5298
5390
  <div class="preview-header-actions">
@@ -5307,7 +5399,7 @@ const C = (E = class extends P {
5307
5399
  <line x1="3" y1="21" x2="10" y2="14" />
5308
5400
  </svg>
5309
5401
  </button>
5310
- ` : p}
5402
+ ` : c}
5311
5403
  <button @click=${() => {
5312
5404
  this._previewFileId = null;
5313
5405
  }} title="Close">
@@ -5339,10 +5431,10 @@ const C = (E = class extends P {
5339
5431
  </button>
5340
5432
  </div>
5341
5433
  ` : l`
5342
- <div class="preview-doc-wrap ${N(t)}">
5343
- <div class="preview-doc-icon ${N(t)}">
5344
- ${this._renderDocTypeIcon(N(t))}
5345
- <span class="preview-doc-ext ${N(t)}">${i}</span>
5434
+ <div class="preview-doc-wrap ${X(t)}">
5435
+ <div class="preview-doc-icon ${X(t)}">
5436
+ ${this._renderDocTypeIcon(X(t))}
5437
+ <span class="preview-doc-ext ${X(t)}">${i}</span>
5346
5438
  </div>
5347
5439
  <button class="preview-nav prev" ?disabled=${e.indexOf(t) === 0} @click=${() => this._navigatePreview(e, -1)}>
5348
5440
  <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>
@@ -5433,23 +5525,23 @@ const C = (E = class extends P {
5433
5525
  >
5434
5526
  <div
5435
5527
  class="body ${o ? "has-files" : ""} ${this._bodyDragOver ? "body-drag-over" : ""}"
5436
- @dragenter=${o ? this._onBodyDragEnter : p}
5437
- @dragover=${o ? this._onBodyDragOver : p}
5438
- @dragleave=${o ? this._onBodyDragLeave : p}
5439
- @drop=${o ? this._onBodyDrop : p}
5528
+ @dragenter=${o ? this._onBodyDragEnter : c}
5529
+ @dragover=${o ? this._onBodyDragOver : c}
5530
+ @dragleave=${o ? this._onBodyDragLeave : c}
5531
+ @drop=${o ? this._onBodyDrop : c}
5440
5532
  >
5441
5533
  ${i === "complete" ? l`
5442
5534
  <sfx-success-card
5443
- .fileCount=${t.filter((c) => c.status === "complete").length}
5444
- .totalSize=${t.filter((c) => c.status === "complete").reduce((c, u) => c + (u.size || 0), 0)}
5445
- .thumbnails=${t.filter((c) => c.status === "complete" && c.previewUrl).map((c) => c.previewUrl)}
5446
- .failedFiles=${t.filter((c) => c.status === "failed").map((c) => ({ id: c.id, name: c.name, error: c.error || "Upload failed" }))}
5535
+ .fileCount=${t.filter((p) => p.status === "complete").length}
5536
+ .totalSize=${t.filter((p) => p.status === "complete").reduce((p, h) => p + (h.size || 0), 0)}
5537
+ .thumbnails=${t.filter((p) => p.status === "complete" && p.previewUrl).map((p) => p.previewUrl)}
5538
+ .failedFiles=${t.filter((p) => p.status === "failed").map((p) => ({ id: p.id, name: p.name, error: p.error || "Upload failed" }))}
5447
5539
  @close-uploader=${this._onSuccessCardClose}
5448
5540
  @file-retry=${this._onFileRetry}
5449
5541
  @retry-all=${this._onRetryAll}
5450
5542
  ></sfx-success-card>
5451
5543
  ` : i === "uploading" ? this._renderUploadOverlay(t) : l`
5452
- ${o ? p : l`<sfx-drop-zone
5544
+ ${o ? c : l`<sfx-drop-zone
5453
5545
  .compact=${o}
5454
5546
  .externalDragOver=${this._bodyDragOver}
5455
5547
  .accept=${r}
@@ -5458,7 +5550,7 @@ const C = (E = class extends P {
5458
5550
  ></sfx-drop-zone>`}
5459
5551
 
5460
5552
  ${o ? this._previewFileId ? this._renderPreviewLayout(t) : l`
5461
- <div class="asset-count">${t.length} ${t.length === 1 ? "file" : "files"} · ${Y(t.reduce((c, u) => c + (u.size || 0), 0))}</div>
5553
+ <div class="asset-count">${t.length} ${t.length === 1 ? "file" : "files"} · ${Y(t.reduce((p, h) => p + (h.size || 0), 0))}</div>
5462
5554
  <sfx-file-list
5463
5555
  .files=${t}
5464
5556
  .showDropTile=${!0}
@@ -5466,7 +5558,7 @@ const C = (E = class extends P {
5466
5558
  .accept=${r}
5467
5559
  @source-click=${this._onDropTileSourceClick}
5468
5560
  ></sfx-file-list>
5469
- ` : p}
5561
+ ` : c}
5470
5562
  `}
5471
5563
  </div>
5472
5564
 
@@ -5474,17 +5566,17 @@ const C = (E = class extends P {
5474
5566
  <sfx-actions-bar
5475
5567
  .uploadState=${"idle"}
5476
5568
  .fileCount=${t.length}
5477
- .totalSize=${t.reduce((c, u) => c + (u.size || 0), 0)}
5478
- .failedCount=${t.filter((c) => c.status === "failed" || c.status === "error").length}
5479
- .completedCount=${t.filter((c) => c.status === "complete").length}
5569
+ .totalSize=${t.reduce((p, h) => p + (h.size || 0), 0)}
5570
+ .failedCount=${t.filter((p) => p.status === "failed" || p.status === "error").length}
5571
+ .completedCount=${t.filter((p) => p.status === "complete").length}
5480
5572
  .uploadProgress=${e.totalProgress ?? 0}
5481
5573
  .showFillMetadata=${!!((n = this.config) != null && n.showFillMetadata)}
5482
5574
  ></sfx-actions-bar>
5483
- ` : p}
5575
+ ` : c}
5484
5576
 
5485
- ${this._showUrlDialog ? l`<sfx-url-dialog></sfx-url-dialog>` : p}
5486
- ${this._showCameraDialog ? l`<sfx-camera-dialog></sfx-camera-dialog>` : p}
5487
- ${this._showScreenCastDialog ? l`<sfx-screen-cast-dialog></sfx-screen-cast-dialog>` : p}
5577
+ ${this._showUrlDialog ? l`<sfx-url-dialog></sfx-url-dialog>` : c}
5578
+ ${this._showCameraDialog ? l`<sfx-camera-dialog></sfx-camera-dialog>` : c}
5579
+ ${this._showScreenCastDialog ? l`<sfx-screen-cast-dialog></sfx-screen-cast-dialog>` : c}
5488
5580
  ${this._activeConnector && ((d = this.config) != null && d.connectors) ? l`
5489
5581
  <div class="connector-modal-backdrop" @click=${this._onConnectorBackdropClick}>
5490
5582
  <div class="connector-modal">
@@ -5501,7 +5593,7 @@ const C = (E = class extends P {
5501
5593
  `}
5502
5594
  </div>
5503
5595
  </div>
5504
- ` : p}
5596
+ ` : c}
5505
5597
 
5506
5598
  ${this._fullscreenPreviewUrl || this._fullscreenVideoFile ? l`
5507
5599
  <div
@@ -5515,7 +5607,7 @@ const C = (E = class extends P {
5515
5607
  @touchmove=${this._onFsTouchMove}
5516
5608
  @touchend=${this._onFsPanEnd}
5517
5609
  >
5518
- <div class="fs-toolbar" @click=${(c) => c.stopPropagation()}>
5610
+ <div class="fs-toolbar" @click=${(p) => p.stopPropagation()}>
5519
5611
  <button class="fs-btn" @click=${this._onFsToggleZoom} title="${this._fullscreenZoomed ? "Zoom out" : "Zoom in"}">
5520
5612
  ${this._fullscreenZoomed ? l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>` : l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>`}
5521
5613
  </button>
@@ -5530,7 +5622,7 @@ const C = (E = class extends P {
5530
5622
  src=${this._getVideoBlobUrl(this._fullscreenVideoFile)}
5531
5623
  controls playsinline
5532
5624
  draggable="false"
5533
- @click=${(c) => c.stopPropagation()}
5625
+ @click=${(p) => p.stopPropagation()}
5534
5626
  ></video>` : l`<img
5535
5627
  class="fs-img"
5536
5628
  src=${this._fullscreenPreviewUrl}
@@ -5538,18 +5630,18 @@ const C = (E = class extends P {
5538
5630
  style=${this._fullscreenZoomed ? `transform: scale(2) translate(${this._fsPanX}px, ${this._fsPanY}px)` : ""}
5539
5631
  draggable="false"
5540
5632
  />`}
5541
- <button class="fs-nav prev" @click=${(c) => {
5542
- c.stopPropagation(), this._navigateFs(-1);
5633
+ <button class="fs-nav prev" @click=${(p) => {
5634
+ p.stopPropagation(), this._navigateFs(-1);
5543
5635
  }}>
5544
5636
  <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>
5545
5637
  </button>
5546
- <button class="fs-nav next" @click=${(c) => {
5547
- c.stopPropagation(), this._navigateFs(1);
5638
+ <button class="fs-nav next" @click=${(p) => {
5639
+ p.stopPropagation(), this._navigateFs(1);
5548
5640
  }}>
5549
5641
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="9 6 15 12 9 18"/></svg>
5550
5642
  </button>
5551
5643
  </div>
5552
- ` : p}
5644
+ ` : c}
5553
5645
  </div>
5554
5646
  `;
5555
5647
  }
@@ -5598,6 +5690,8 @@ const C = (E = class extends P {
5598
5690
  --sfx-up-backdrop: rgba(0, 0, 0, 0.45);
5599
5691
  --sfx-up-ring: var(--ring, oklch(0.578 0.198 268.129 / 0.7));
5600
5692
  --sfx-up-max-height: 88vh;
5693
+ --sfx-up-checker-bg: #fff;
5694
+ --sfx-up-checker-tile: #f0f0f0;
5601
5695
  }
5602
5696
 
5603
5697
  /* --- Modal overlay --- */
@@ -5858,14 +5952,14 @@ const C = (E = class extends P {
5858
5952
  }
5859
5953
 
5860
5954
  .preview-layout .file-grid-side {
5861
- flex: 54;
5955
+ flex: 68;
5862
5956
  min-width: 0;
5863
5957
  min-height: 100%;
5864
5958
  overflow: hidden;
5865
5959
  display: flex;
5866
5960
  flex-direction: column;
5867
5961
  position: relative;
5868
- --sfx-up-grid-min: max(48%, 140px);
5962
+ --sfx-up-grid-min: max(30%, 140px);
5869
5963
  }
5870
5964
 
5871
5965
  .preview-layout .file-grid-side::after {
@@ -5911,21 +6005,59 @@ const C = (E = class extends P {
5911
6005
  }
5912
6006
 
5913
6007
  .preview-divider {
5914
- width: 1px;
5915
- background: var(--sfx-up-border, #e8edf5);
6008
+ width: 9px;
5916
6009
  flex-shrink: 0;
5917
6010
  position: relative;
5918
6011
  display: flex;
5919
6012
  align-items: center;
5920
6013
  justify-content: center;
6014
+ cursor: col-resize;
6015
+ user-select: none;
6016
+ -webkit-user-select: none;
6017
+ }
6018
+
6019
+ .preview-divider::before {
6020
+ content: '';
6021
+ position: absolute;
6022
+ top: 0;
6023
+ bottom: 0;
6024
+ left: 4px;
6025
+ width: 1px;
6026
+ background: var(--sfx-up-border, #e8edf5);
5921
6027
  }
5922
6028
 
5923
6029
  .preview-divider::after {
5924
- display: none;
6030
+ content: '';
6031
+ width: 3px;
6032
+ height: 28px;
6033
+ border-radius: 2px;
6034
+ background: var(--sfx-up-border, #d0d7e2);
6035
+ opacity: 0;
6036
+ transition: opacity 0.15s;
6037
+ z-index: 1;
6038
+ }
6039
+
6040
+ .preview-divider:hover::after,
6041
+ .preview-layout.resizing .preview-divider::after {
6042
+ opacity: 1;
6043
+ }
6044
+
6045
+ .preview-layout.resizing {
6046
+ cursor: col-resize;
6047
+ user-select: none;
6048
+ -webkit-user-select: none;
6049
+ }
6050
+
6051
+ .preview-layout.resizing * {
6052
+ pointer-events: none;
6053
+ }
6054
+
6055
+ .preview-layout.resizing .preview-divider {
6056
+ pointer-events: auto;
5925
6057
  }
5926
6058
 
5927
6059
  .preview-panel {
5928
- flex: 46;
6060
+ flex: 32;
5929
6061
  min-width: 0;
5930
6062
  display: flex;
5931
6063
  flex-direction: column;
@@ -6060,7 +6192,14 @@ const C = (E = class extends P {
6060
6192
  position: relative;
6061
6193
  flex: 1;
6062
6194
  min-height: 0;
6063
- background: var(--sfx-up-surface, #f1f5f9);
6195
+ background-color: var(--sfx-up-checker-bg);
6196
+ background-image:
6197
+ linear-gradient(45deg, var(--sfx-up-checker-tile) 25%, transparent 25%),
6198
+ linear-gradient(-45deg, var(--sfx-up-checker-tile) 25%, transparent 25%),
6199
+ linear-gradient(45deg, transparent 75%, var(--sfx-up-checker-tile) 75%),
6200
+ linear-gradient(-45deg, transparent 75%, var(--sfx-up-checker-tile) 75%);
6201
+ background-size: 16px 16px;
6202
+ background-position: 0 0, 0 8px, 8px -8px, -8px 0;
6064
6203
  }
6065
6204
 
6066
6205
  .preview-image {
@@ -6800,71 +6939,74 @@ const C = (E = class extends P {
6800
6939
  ]), E._RESERVED_IDS = /* @__PURE__ */ new Set(["device", "camera", "url", "screen-cast"]), E);
6801
6940
  $([
6802
6941
  b({ attribute: !1 })
6803
- ], C.prototype, "config");
6942
+ ], k.prototype, "config");
6943
+ $([
6944
+ g()
6945
+ ], k.prototype, "_isOpen");
6804
6946
  $([
6805
6947
  g()
6806
- ], C.prototype, "_isOpen");
6948
+ ], k.prototype, "_activeConnector");
6807
6949
  $([
6808
6950
  g()
6809
- ], C.prototype, "_activeConnector");
6951
+ ], k.prototype, "_showUrlDialog");
6810
6952
  $([
6811
6953
  g()
6812
- ], C.prototype, "_showUrlDialog");
6954
+ ], k.prototype, "_showCameraDialog");
6813
6955
  $([
6814
6956
  g()
6815
- ], C.prototype, "_showCameraDialog");
6957
+ ], k.prototype, "_showScreenCastDialog");
6816
6958
  $([
6817
6959
  g()
6818
- ], C.prototype, "_showScreenCastDialog");
6960
+ ], k.prototype, "_previewFileId");
6819
6961
  $([
6820
6962
  g()
6821
- ], C.prototype, "_previewFileId");
6963
+ ], k.prototype, "_previewDims");
6822
6964
  $([
6823
6965
  g()
6824
- ], C.prototype, "_previewDims");
6966
+ ], k.prototype, "_splitPct");
6825
6967
  $([
6826
6968
  g()
6827
- ], C.prototype, "_fullscreenPreviewUrl");
6969
+ ], k.prototype, "_fullscreenPreviewUrl");
6828
6970
  $([
6829
6971
  g()
6830
- ], C.prototype, "_fullscreenVideoFile");
6972
+ ], k.prototype, "_fullscreenVideoFile");
6831
6973
  $([
6832
6974
  g()
6833
- ], C.prototype, "_fullscreenZoomed");
6975
+ ], k.prototype, "_fullscreenZoomed");
6834
6976
  $([
6835
6977
  g()
6836
- ], C.prototype, "_bodyDragOver");
6978
+ ], k.prototype, "_bodyDragOver");
6837
6979
  $([
6838
6980
  g()
6839
- ], C.prototype, "_isMinimized");
6981
+ ], k.prototype, "_isMinimized");
6840
6982
  $([
6841
6983
  g()
6842
- ], C.prototype, "_isPillExpanded");
6843
- let Ct = C;
6984
+ ], k.prototype, "_isPillExpanded");
6985
+ let Ct = k;
6844
6986
  export {
6845
- le as A,
6846
- X as C,
6987
+ de as A,
6988
+ W as C,
6847
6989
  v as P,
6848
- O as S,
6990
+ F as S,
6849
6991
  He as U,
6850
- U as a,
6851
- ne as b,
6992
+ z as a,
6993
+ le as b,
6852
6994
  B as c,
6853
- ze as d,
6854
- ae as e,
6855
- R as f,
6995
+ Pe as d,
6996
+ ne as e,
6997
+ L as f,
6856
6998
  Ct as g,
6857
- je as h,
6858
- oe as i,
6999
+ Fe as h,
7000
+ se as i,
6859
7001
  Oe as j,
6860
- Ye as k,
6861
- de as l,
6862
- Je as m,
6863
- W as n,
6864
- q as o,
6865
- L as p,
7002
+ qe as k,
7003
+ pe as l,
7004
+ Ze as m,
7005
+ K as n,
7006
+ V as o,
7007
+ A as p,
6866
7008
  mt as q,
6867
- qe as r,
7009
+ Ye as r,
6868
7010
  _t as s,
6869
7011
  kt as t,
6870
7012
  wt as u,