@scaleflex/uploader 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 Oe {
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
  }
@@ -49,8 +49,8 @@ function Ce(a, e) {
49
49
  const i = new Map(t);
50
50
  i.delete(e), a.setState({ files: i });
51
51
  }
52
- function Oe() {
53
- return new je({
52
+ function Re() {
53
+ return new Oe({
54
54
  files: /* @__PURE__ */ new Map(),
55
55
  queueConfig: {
56
56
  concurrency: 3,
@@ -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 Le = {
185
185
  "google-drive": "drive",
186
186
  dropbox: "dropbox",
187
187
  onedrive: "onedrive",
@@ -190,43 +190,43 @@ 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 Le[a] ?? a;
195
195
  }
196
- function mt(a, e) {
197
- const t = V(a), i = btoa(JSON.stringify({ origin: window.location.origin })), r = K(e);
196
+ function wt(a, 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
- 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}`, {
200
+ async function yt(a, e, t, i = "") {
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})`);
211
211
  }
212
212
  return n.json();
213
213
  }
214
- async function yt(a, e, t) {
215
- const i = V(a), r = await fetch(`${i}/${t}`, {
214
+ async function _t(a, e, 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})`);
225
225
  }
226
226
  return r.json();
227
227
  }
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}`, {
228
+ async function kt(a, e, t, i) {
229
+ const r = N(a), o = G(e), s = i ? `q=${encodeURIComponent(t)}&${i}` : `q=${encodeURIComponent(t)}`, n = await fetch(`${r}/search/${o}/list?${s}`, {
230
230
  method: "GET",
231
231
  headers: {
232
232
  Accept: "application/json",
@@ -240,10 +240,10 @@ async function _t(a, e, t, i) {
240
240
  }
241
241
  return n.json();
242
242
  }
243
- async function Le(a, e, t, i, r, o = !1) {
244
- const s = 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, {
243
+ async function Ae(a, e, t, i, r, o = !1) {
244
+ const s = N(a), n = G(e), d = o ? `${s}/search/${n}/get/${i}` : `${s}/${n}/get/${i}`, p = o ? { Accept: "application/json", "Content-Type": "application/json" } : re(t), h = await fetch(d, {
245
245
  method: "POST",
246
- headers: c,
246
+ headers: p,
247
247
  credentials: "same-origin",
248
248
  body: JSON.stringify({
249
249
  ...r,
@@ -252,33 +252,33 @@ 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
- async function kt(a, e, t) {
264
- const i = V(a), r = K(e), o = await fetch(`${i}/${r}/logout`, {
263
+ async function Ct(a, e, t) {
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 };
270
270
  }
271
- function Ae(a) {
271
+ function Ie(a) {
272
272
  var r;
273
273
  const t = ((r = /^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(a)) == null ? void 0 : r[1]) ?? a;
274
274
  return `${location.protocol === "https:" ? "wss" : "ws"}://${t}`;
275
275
  }
276
- class le extends Error {
276
+ class de extends Error {
277
277
  constructor() {
278
278
  super("Authentication expired"), this.name = "AuthExpiredError";
279
279
  }
280
280
  }
281
- function Ie(a, e) {
281
+ function He(a, e) {
282
282
  const t = a.remoteInfo;
283
283
  if (!t)
284
284
  return e.onError(new Error("remoteInfo is required for companion upload")), { abort() {
@@ -287,17 +287,17 @@ function Ie(a, e) {
287
287
  const s = `${e.apiBase.replace(/\/+$/, "")}/v4/files?folder=${encodeURIComponent(e.folder)}`, n = {};
288
288
  a.meta && Object.keys(a.meta).length > 0 && Object.assign(n, a.meta), a.tags && a.tags.length > 0 && (n.tags = a.tags);
289
289
  const d = !t.token;
290
- return Le(t.companionUrl, t.provider, t.token, t.requestPath, {
290
+ return Ae(t.companionUrl, t.provider, t.token, t.requestPath, {
291
291
  fileId: t.fileId,
292
292
  endpoint: s,
293
293
  headers: e.authHeaders,
294
294
  size: t.size,
295
295
  metadata: Object.keys(n).length > 0 ? n : void 0
296
- }, d).then((c) => {
296
+ }, d).then((p) => {
297
297
  if (i) return;
298
- const h = `${Ae(t.companionUrl)}/api/${c.token}`;
298
+ const u = `${Ie(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) {
@@ -364,7 +364,7 @@ function Ie(a, e) {
364
364
  }
365
365
  };
366
366
  }
367
- class He {
367
+ class qe {
368
368
  constructor(e, t) {
369
369
  this.activeUploads = /* @__PURE__ */ new Map(), this.retryTimers = /* @__PURE__ */ new Map(), this.unsubscribe = null, this.store = e, this.config = t;
370
370
  }
@@ -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 = He(e, { ...o, onProgress: s }) : e.remoteUrl ? n = Be(e, o) : n = Te(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
544
  async function Ye(a, e) {
545
- const t = `${de(a)}/key/${encodeURIComponent(e)}`, i = new AbortController(), r = setTimeout(() => i.abort(), 3e4);
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 Ve(a) {
575
+ const e = pe(a.container);
576
576
  if (a.mode === "security-template") {
577
577
  const t = await Ye(a.container, a.securityTemplateId);
578
- return { apiBase: e, headers: oe(a, t), sassKey: t };
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",
@@ -598,32 +598,32 @@ const v = {
598
598
  FILE_PREVIEW: "sfx-file-preview",
599
599
  FILL_METADATA: "sfx-fill-metadata"
600
600
  };
601
- let Ve = 0;
602
- function H() {
603
- return `file-${Date.now()}-${++Ve}`;
601
+ let Ne = 0;
602
+ function q() {
603
+ return `file-${Date.now()}-${++Ne}`;
604
604
  }
605
605
  function Y(a) {
606
606
  if (a <= 0) return "0 B";
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";
621
621
  }
622
- function Ne(a) {
622
+ function Xe(a) {
623
623
  const e = a.lastIndexOf(".");
624
624
  return e >= 0 ? a.slice(e + 1).toUpperCase() : "";
625
625
  }
626
- const Xe = {
626
+ const We = {
627
627
  jpg: "image/jpeg",
628
628
  jpeg: "image/jpeg",
629
629
  png: "image/png",
@@ -641,12 +641,12 @@ const Xe = {
641
641
  doc: "application/msword",
642
642
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
643
643
  };
644
- function We(a) {
644
+ function Ke(a) {
645
645
  var t;
646
646
  const e = ((t = a.split(".").pop()) == null ? void 0 : t.toLowerCase()) ?? "";
647
- return Xe[e] || "";
647
+ return We[e] || "";
648
648
  }
649
- function Ke(a) {
649
+ function Ge(a) {
650
650
  return new Promise((e) => {
651
651
  const t = document.createElement("video");
652
652
  t.preload = "metadata", t.muted = !0, t.playsInline = !0;
@@ -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`;
@@ -703,7 +703,7 @@ function se(a, e, t) {
703
703
  return null;
704
704
  }
705
705
  function Ze(a, e, t) {
706
- return se(a, e, t);
706
+ return ae(a, e, t);
707
707
  }
708
708
  function Se(a) {
709
709
  return a.allowedFileTypes ? a.allowedFileTypes.join(",") : "";
@@ -762,19 +762,19 @@ const Ee = {
762
762
  function Je(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 Qe = Object.defineProperty, et = (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 && Qe(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 = [
771
- { id: "device", label: "My Device", icon: et, iconColor: "#2563eb" },
772
- { id: "url", label: "URL link", icon: tt, iconColor: "#16a34a" },
773
- { id: "camera", label: "Camera", icon: rt, iconColor: "#7c3aed" },
774
- { id: "screen-cast", label: "Screen capture", icon: it, iconColor: "#ea580c" }
775
- ], fe = class fe extends P {
770
+ const tt = '<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"/>', rt = '<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"/>', it = '<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"/>', ot = '<rect x="2" y="3" width="20" height="14" rx="2"/><circle cx="12" cy="10" r="1"/><path d="M7 21l5-5 5 5"/>', W = [
771
+ { id: "device", label: "My Device", icon: tt, iconColor: "#2563eb" },
772
+ { id: "url", label: "URL link", icon: rt, iconColor: "#16a34a" },
773
+ { id: "camera", label: "Camera", icon: it, iconColor: "#7c3aed" },
774
+ { id: "screen-cast", label: "Screen capture", icon: ot, iconColor: "#ea580c" }
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,27 @@ fe.styles = S`
871
871
  stroke-width: 0;
872
872
  }
873
873
  `;
874
- let ae = fe;
875
- Qe([
874
+ let ne = he;
875
+ et([
876
876
  b({ type: Array })
877
- ], ae.prototype, "sources");
878
- var ot = Object.defineProperty, j = (a, e, t, i) => {
877
+ ], ne.prototype, "sources");
878
+ function Fe(a) {
879
+ let e = a;
880
+ for (; e; ) {
881
+ if (e instanceof HTMLDialogElement && e.open)
882
+ return e;
883
+ e instanceof ShadowRoot ? e = e.host : e = e.parentNode;
884
+ }
885
+ return document.body;
886
+ }
887
+ var st = Object.defineProperty, j = (a, e, t, i) => {
879
888
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
880
889
  (s = a[o]) && (r = s(e, t, r) || r);
881
- return r && ot(e, t, r), r;
890
+ return r && st(e, t, r), r;
882
891
  };
883
- const Ue = 3, ue = class ue extends P {
892
+ const ze = 3, ue = class ue extends U {
884
893
  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) => {
894
+ 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
895
  e.preventDefault(), this._dragCounter++, this._dragCounter === 1 && (this._dragOver = !0);
887
896
  }, this._onDragOver = (e) => {
888
897
  e.preventDefault();
@@ -917,10 +926,11 @@ const Ue = 3, ue = class ue extends P {
917
926
  s && i.push(s);
918
927
  }
919
928
  i.length > 0 && (e.preventDefault(), this._emitFiles(i));
920
- }, this._onDocClick = () => {
921
- this._moreOpen && (this._moreOpen = !1);
929
+ }, this._portalContainer = null, this._onDocClick = (e) => {
930
+ var t;
931
+ this._moreOpen && ((t = this._portalContainer) != null && t.contains(e.target) || (this._moreOpen = !1, this._updateDropdownPortal()));
922
932
  }, this._onDocKeyDown = (e) => {
923
- e.key === "Escape" && this._moreOpen && (this._moreOpen = !1);
933
+ e.key === "Escape" && this._moreOpen && (this._moreOpen = !1, this._updateDropdownPortal());
924
934
  }, this._resizeTimer = null, this._onScrollOrResize = () => {
925
935
  this._moreOpen && this._positionDropdown(), this._resizeTimer && clearTimeout(this._resizeTimer), this._resizeTimer = setTimeout(() => this._updateVisiblePills(), 100);
926
936
  };
@@ -949,24 +959,60 @@ const Ue = 3, ue = class ue extends P {
949
959
  );
950
960
  }
951
961
  _toggleMore(e) {
952
- e.stopPropagation(), this._moreOpen = !this._moreOpen, this._moreOpen && requestAnimationFrame(() => this._positionDropdown());
962
+ e.stopPropagation(), this._moreOpen = !this._moreOpen, this._updateDropdownPortal();
963
+ }
964
+ _updateDropdownPortal() {
965
+ if (this._moreOpen) {
966
+ const e = this.sources.slice(this._visiblePills);
967
+ this._portalContainer || (this._portalContainer = document.createElement("div"), this._portalContainer.setAttribute("data-sfx-more-dropdown", ""), this._injectDropdownStyles(), Fe(this).appendChild(this._portalContainer)), T(
968
+ l`<div class="sfx-more-dropdown open">
969
+ ${e.map(
970
+ (t) => l`
971
+ <button class="sfx-more-item" @click=${(i) => this._onMoreItemClick(t, i)}>
972
+ <div class="sfx-more-item-ico">
973
+ ${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>`}
974
+ </div>
975
+ ${t.label}
976
+ </button>
977
+ `
978
+ )}
979
+ </div>`,
980
+ this._portalContainer
981
+ ), requestAnimationFrame(() => this._positionDropdown());
982
+ } else this._portalContainer && (T(c, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
983
+ }
984
+ _injectDropdownStyles() {
985
+ if (document.querySelector("style[data-sfx-more-dropdown-styles]")) return;
986
+ const e = document.createElement("style");
987
+ e.setAttribute("data-sfx-more-dropdown-styles", ""), e.textContent = `
988
+ [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; }
989
+ [data-sfx-more-dropdown] .sfx-more-dropdown.open { opacity:1; visibility:visible; pointer-events:all; }
990
+ [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; }
991
+ [data-sfx-more-dropdown] .sfx-more-item:hover { background:#f5f7fa; }
992
+ [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; }
993
+ [data-sfx-more-dropdown] .sfx-more-item-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
994
+ [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; }
995
+ [data-sfx-more-dropdown] .sfx-more-item .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
996
+ [data-sfx-more-dropdown] .sfx-more-item .canva-ico { width:22px; height:22px; }
997
+ [data-sfx-more-dropdown] .sfx-more-item .canva-ico svg { width:22px; height:22px; }
998
+ `, document.head.appendChild(e);
953
999
  }
954
1000
  /** Position the fixed dropdown, choosing above or below based on available space. */
955
1001
  _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");
1002
+ var u, x;
1003
+ 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
1004
  if (!e || !t) return;
959
1005
  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`;
1006
+ n >= o + r || n > d ? t.style.top = `${i.top - o - r}px` : t.style.top = `${i.bottom + r}px`;
1007
+ let h = i.right - s;
1008
+ h = Math.max(8, Math.min(h, window.innerWidth - s - 8)), t.style.left = `${h}px`;
963
1009
  }
964
1010
  _onMoreItemClick(e, t) {
965
1011
  t.stopPropagation(), this._moreOpen = !1, this._onSourceIconClick(e);
966
1012
  }
967
1013
  _updateVisiblePills() {
968
1014
  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;
1015
+ 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
1016
  }
971
1017
  connectedCallback() {
972
1018
  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 +1021,7 @@ const Ue = 3, ue = class ue extends P {
975
1021
  e.has("sourcesLayout") && this._updateVisiblePills();
976
1022
  }
977
1023
  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);
1024
+ 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
1025
  }
980
1026
  _renderPill(e) {
981
1027
  return l`
@@ -985,8 +1031,8 @@ const Ue = 3, ue = class ue extends P {
985
1031
  t.stopPropagation(), this._onSourceIconClick(e);
986
1032
  }}
987
1033
  >
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>`}
1034
+ ${e.brandHtml ? M(e.brandHtml) : l`<span class="pill-ico" style=${e.iconColor ? `color:${e.iconColor}` : ""}>
1035
+ ${R`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${O(e.icon)}</svg>`}
990
1036
  </span>`}
991
1037
  ${e.label}
992
1038
  </button>
@@ -1001,17 +1047,17 @@ const Ue = 3, ue = class ue extends P {
1001
1047
  t.stopPropagation(), this._onSourceIconClick(e);
1002
1048
  }}
1003
1049
  >
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>`}
1050
+ ${e.brandHtml ? l`<span class="card-ico">${M(e.brandHtml)}</span>` : l`<span class="card-ico" style=${e.iconColor ? `color:${e.iconColor}` : ""}>
1051
+ ${R`<svg viewBox="0 0 24 24" class=${e.fillIcon ? "fill-icon" : ""}>${O(e.icon)}</svg>`}
1006
1052
  </span>`}
1007
1053
  <span class="card-label">${e.label}</span>
1008
1054
  </button>
1009
1055
  `;
1010
1056
  }
1011
- _renderMoreCard(e) {
1057
+ _renderMoreCard() {
1012
1058
  return l`
1013
1059
  <div class="more-wrap ${this._moreOpen ? "open" : ""}">
1014
- <button class="src-card" @click=${(t) => this._toggleMore(t)}>
1060
+ <button class="src-card" @click=${(e) => this._toggleMore(e)}>
1015
1061
  <span class="card-ico" style="color: var(--sfx-up-text-muted, #94a3b8)">
1016
1062
  <svg viewBox="0 0 24 24" style="fill: currentColor; stroke: none">
1017
1063
  <circle cx="5" cy="12" r="2.5"/>
@@ -1021,40 +1067,16 @@ const Ue = 3, ue = class ue extends P {
1021
1067
  </span>
1022
1068
  <span class="card-label">More</span>
1023
1069
  </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
1070
  </div>
1037
1071
  `;
1038
1072
  }
1039
- _renderMoreDropdown(e) {
1073
+ _renderMoreDropdown() {
1040
1074
  return l`
1041
1075
  <div class="more-wrap ${this._moreOpen ? "open" : ""}">
1042
- <button class="more-pill" @click=${(t) => this._toggleMore(t)}>
1076
+ <button class="more-pill" @click=${(e) => this._toggleMore(e)}>
1043
1077
  More
1044
1078
  <svg class="more-chevron" viewBox="0 0 24 24"><polyline points="6 9 12 15 18 9"/></svg>
1045
1079
  </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
1080
  </div>
1059
1081
  `;
1060
1082
  }
@@ -1093,22 +1115,22 @@ const Ue = 3, ue = class ue extends P {
1093
1115
  <div class="title">
1094
1116
  Drag & Drop or click to <span>browse</span>
1095
1117
  </div>
1096
- ${this.compact ? p : l`<div class="subtitle">Drop files anywhere on this page</div>`}
1118
+ ${this.compact ? c : l`<div class="subtitle">Drop files anywhere on this page</div>`}
1097
1119
 
1098
1120
  ${!this.compact && this.sources.length > 0 ? l`
1099
1121
  <div class="import-divider"><span>or import from</span></div>
1100
1122
  ${this.sourcesLayout === "cards" ? l`
1101
1123
  <div class="sources-cards">
1102
1124
  ${t.map((r) => this._renderCard(r))}
1103
- ${i.length > 0 ? this._renderMoreCard(i) : p}
1125
+ ${i.length > 0 ? this._renderMoreCard() : c}
1104
1126
  </div>
1105
1127
  ` : l`
1106
1128
  <div class="sources-grid">
1107
1129
  ${t.map((r) => this._renderPill(r))}
1108
- ${i.length > 0 ? this._renderMoreDropdown(i) : p}
1130
+ ${i.length > 0 ? this._renderMoreDropdown() : c}
1109
1131
  </div>
1110
1132
  `}
1111
- ` : p}
1133
+ ` : c}
1112
1134
 
1113
1135
  ${this.compact && this.sources.length > 0 ? l`
1114
1136
  <div class="sources-row">
@@ -1123,18 +1145,18 @@ const Ue = 3, ue = class ue extends P {
1123
1145
  o.stopPropagation(), this._onSourceIconClick(r);
1124
1146
  }}
1125
1147
  >
1126
- ${r.brandHtml ? T(r.brandHtml) : M`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${F(r.icon)}</svg>`}
1148
+ ${r.brandHtml ? M(r.brandHtml) : R`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${O(r.icon)}</svg>`}
1127
1149
  </button>
1128
1150
  `
1129
1151
  )}
1130
1152
  </div>
1131
- ` : p}
1153
+ ` : c}
1132
1154
 
1133
1155
  <div class="ripple"></div>
1134
1156
  <input
1135
1157
  type="file"
1136
1158
  multiple
1137
- accept=${this.accept || p}
1159
+ accept=${this.accept || c}
1138
1160
  @change=${this._onFileChange}
1139
1161
  />
1140
1162
  </div>
@@ -1924,38 +1946,38 @@ ue.styles = S`
1924
1946
  }
1925
1947
  }
1926
1948
  `;
1927
- let U = ue;
1949
+ let z = ue;
1928
1950
  j([
1929
1951
  b({ type: Boolean, reflect: !0 })
1930
- ], U.prototype, "compact");
1952
+ ], z.prototype, "compact");
1931
1953
  j([
1932
1954
  b({ type: Boolean, attribute: "external-drag-over" })
1933
- ], U.prototype, "externalDragOver");
1955
+ ], z.prototype, "externalDragOver");
1934
1956
  j([
1935
1957
  b({ type: String })
1936
- ], U.prototype, "accept");
1958
+ ], z.prototype, "accept");
1937
1959
  j([
1938
1960
  b({ type: Array })
1939
- ], U.prototype, "sources");
1961
+ ], z.prototype, "sources");
1940
1962
  j([
1941
1963
  b({ type: String, attribute: "sources-layout" })
1942
- ], U.prototype, "sourcesLayout");
1964
+ ], z.prototype, "sourcesLayout");
1943
1965
  j([
1944
1966
  g()
1945
- ], U.prototype, "_dragOver");
1967
+ ], z.prototype, "_dragOver");
1946
1968
  j([
1947
1969
  g()
1948
- ], U.prototype, "_moreOpen");
1970
+ ], z.prototype, "_moreOpen");
1949
1971
  j([
1950
1972
  g()
1951
- ], U.prototype, "_visiblePills");
1973
+ ], z.prototype, "_visiblePills");
1952
1974
  j([
1953
- Fe(".ripple")
1954
- ], U.prototype, "_rippleEl");
1975
+ je(".ripple")
1976
+ ], z.prototype, "_rippleEl");
1955
1977
  j([
1956
- Fe('input[type="file"]')
1957
- ], U.prototype, "fileInput");
1958
- const he = class he extends P {
1978
+ je('input[type="file"]')
1979
+ ], z.prototype, "fileInput");
1980
+ const xe = class xe extends U {
1959
1981
  render() {
1960
1982
  return l`
1961
1983
  <div class="line"></div>
@@ -1964,7 +1986,7 @@ const he = class he extends P {
1964
1986
  `;
1965
1987
  }
1966
1988
  };
1967
- he.styles = S`
1989
+ xe.styles = S`
1968
1990
  :host {
1969
1991
  display: flex;
1970
1992
  align-items: center;
@@ -1987,17 +2009,23 @@ he.styles = S`
1987
2009
  white-space: nowrap;
1988
2010
  }
1989
2011
  `;
1990
- let ze = he;
1991
- var st = Object.defineProperty, Z = (a, e, t, i) => {
2012
+ let Pe = xe;
2013
+ var at = Object.defineProperty, Z = (a, e, t, i) => {
1992
2014
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
1993
2015
  (s = a[o]) && (r = s(e, t, r) || r);
1994
- return r && st(e, t, r), r;
2016
+ return r && at(e, t, r), r;
1995
2017
  };
1996
- const xe = class xe extends P {
2018
+ const ge = class ge extends U {
1997
2019
  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));
2020
+ super(...arguments), this.files = [], this.showDropTile = !1, this.sources = [], this.accept = "", this._moreOpen = !1, this._portalContainer = null, this._outsideClickHandler = (e) => {
2021
+ var r;
2022
+ if ((r = this._portalContainer) != null && r.contains(e.target)) return;
2023
+ const t = this.renderRoot.querySelector(".drop-tile-more-wrap"), i = e.composedPath();
2024
+ t && i.includes(t) || (this._moreOpen = !1, this._closePortal(), document.removeEventListener("click", this._outsideClickHandler, !0));
2025
+ }, this._onScrollOrResize = () => {
2026
+ this._moreOpen && this._positionPortal();
2027
+ }, this._onKeyDown = (e) => {
2028
+ e.key === "Escape" && this._moreOpen && (this._moreOpen = !1, this._closePortal(), this._removeGlobalListeners());
2001
2029
  };
2002
2030
  }
2003
2031
  _onDropTileClick() {
@@ -2016,14 +2044,68 @@ const xe = class xe extends P {
2016
2044
  }
2017
2045
  this.dispatchEvent(new CustomEvent("source-click", { detail: { source: t }, bubbles: !0, composed: !0 }));
2018
2046
  }
2047
+ _addGlobalListeners() {
2048
+ requestAnimationFrame(() => document.addEventListener("click", this._outsideClickHandler, !0)), document.addEventListener("keydown", this._onKeyDown), window.addEventListener("scroll", this._onScrollOrResize, !0), window.addEventListener("resize", this._onScrollOrResize);
2049
+ }
2050
+ _removeGlobalListeners() {
2051
+ document.removeEventListener("click", this._outsideClickHandler, !0), document.removeEventListener("keydown", this._onKeyDown), window.removeEventListener("scroll", this._onScrollOrResize, !0), window.removeEventListener("resize", this._onScrollOrResize);
2052
+ }
2019
2053
  _toggleMore(e) {
2020
- e.stopPropagation(), this._moreOpen = !this._moreOpen, this._moreOpen ? requestAnimationFrame(() => document.addEventListener("click", this._outsideClickHandler, !0)) : document.removeEventListener("click", this._outsideClickHandler, !0);
2054
+ e.stopPropagation(), this._moreOpen = !this._moreOpen, this._moreOpen ? (this._openPortal(), this._addGlobalListeners()) : (this._closePortal(), this._removeGlobalListeners());
2055
+ }
2056
+ _openPortal() {
2057
+ const e = this.sources.slice(3);
2058
+ this._portalContainer || (this._portalContainer = document.createElement("div"), this._portalContainer.setAttribute("data-sfx-tile-dropdown", ""), this._injectTileDropdownStyles(), Fe(this).appendChild(this._portalContainer)), T(
2059
+ l`<div class="sfx-tile-dropdown">
2060
+ ${e.map((t) => l`
2061
+ <button
2062
+ class="sfx-tile-dropdown-item"
2063
+ @click=${(i) => this._onMoreSourceClick(i, t)}
2064
+ >
2065
+ <span class="sfx-tile-dropdown-ico" style=${t.iconColor && !t.brandHtml ? `color:${t.iconColor}` : ""}>
2066
+ ${t.brandHtml ? M(t.brandHtml) : R`<svg viewBox="0 0 24 24" class=${t.fillIcon ? "fill-icon" : ""}>${O(t.icon)}</svg>`}
2067
+ </span>
2068
+ ${t.label}
2069
+ </button>
2070
+ `)}
2071
+ </div>`,
2072
+ this._portalContainer
2073
+ ), requestAnimationFrame(() => this._positionPortal());
2074
+ }
2075
+ _positionPortal() {
2076
+ var u;
2077
+ const e = this.renderRoot.querySelector(".drop-tile-more"), t = (u = this._portalContainer) == null ? void 0 : u.querySelector(".sfx-tile-dropdown");
2078
+ if (!e || !t) return;
2079
+ const i = e.getBoundingClientRect(), r = 6, o = t.scrollHeight, s = t.offsetWidth, n = i.top, d = window.innerHeight - i.bottom;
2080
+ n >= o + r || n > d ? t.style.top = `${i.top - o - r}px` : t.style.top = `${i.bottom + r}px`;
2081
+ let h = i.right - s;
2082
+ h = Math.max(8, Math.min(h, window.innerWidth - s - 8)), t.style.left = `${h}px`;
2083
+ }
2084
+ _closePortal() {
2085
+ this._portalContainer && (T(c, this._portalContainer), this._portalContainer.remove(), this._portalContainer = null);
2086
+ }
2087
+ _injectTileDropdownStyles() {
2088
+ if (document.querySelector("style[data-sfx-tile-dropdown-styles]")) return;
2089
+ const e = document.createElement("style");
2090
+ e.setAttribute("data-sfx-tile-dropdown-styles", ""), e.textContent = `
2091
+ [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; }
2092
+ [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; }
2093
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-item:hover { background:#f5f7fa; }
2094
+ [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; }
2095
+ [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; }
2096
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico svg.fill-icon { fill:currentColor; stroke:none; }
2097
+ [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; }
2098
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .brand-ico svg { fill:white; stroke:none; stroke-width:0; }
2099
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico { width:22px; height:22px; }
2100
+ [data-sfx-tile-dropdown] .sfx-tile-dropdown-ico .canva-ico svg { width:22px; height:22px; }
2101
+ @keyframes sfxTileDropIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
2102
+ `, document.head.appendChild(e);
2021
2103
  }
2022
2104
  disconnectedCallback() {
2023
- super.disconnectedCallback(), this._moreOpen = !1, document.removeEventListener("click", this._outsideClickHandler, !0);
2105
+ super.disconnectedCallback(), this._moreOpen = !1, this._closePortal(), this._removeGlobalListeners();
2024
2106
  }
2025
2107
  _onMoreSourceClick(e, t) {
2026
- this._moreOpen = !1, document.removeEventListener("click", this._outsideClickHandler, !0), this._onSourceClick(e, t);
2108
+ this._moreOpen = !1, this._closePortal(), this._removeGlobalListeners(), this._onSourceClick(e, t);
2027
2109
  }
2028
2110
  _renderDropTile() {
2029
2111
  const t = this.sources.slice(0, 3), i = this.sources.slice(3);
@@ -2050,39 +2132,24 @@ const xe = class xe extends P {
2050
2132
  title=${r.label}
2051
2133
  @click=${(o) => this._onSourceClick(o, r)}
2052
2134
  >
2053
- ${r.brandHtml ? T(r.brandHtml) : M`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${F(r.icon)}</svg>`}
2135
+ ${r.brandHtml ? M(r.brandHtml) : R`<svg viewBox="0 0 24 24" class=${r.fillIcon ? "fill-icon" : ""}>${O(r.icon)}</svg>`}
2054
2136
  </button>
2055
2137
  `)}
2056
2138
  ${i.length > 0 ? l`
2057
2139
  <div class="drop-tile-more-wrap">
2058
2140
  <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
2141
  </div>
2075
- ` : p}
2142
+ ` : c}
2076
2143
  </div>
2077
- ` : p}
2078
- <input type="file" multiple accept=${this.accept || p} @change=${this._onFileInput} />
2144
+ ` : c}
2145
+ <input type="file" multiple accept=${this.accept || c} @change=${this._onFileInput} />
2079
2146
  </div>
2080
2147
  `;
2081
2148
  }
2082
2149
  render() {
2083
2150
  return l`
2084
2151
  <div class="grid">
2085
- ${this.showDropTile ? this._renderDropTile() : p}
2152
+ ${this.showDropTile ? this._renderDropTile() : c}
2086
2153
  ${this.files.map(
2087
2154
  (e, t) => l`<sfx-file-item .file=${e} style="--tile-index:${t}"></sfx-file-item>`
2088
2155
  )}
@@ -2090,7 +2157,7 @@ const xe = class xe extends P {
2090
2157
  `;
2091
2158
  }
2092
2159
  };
2093
- xe.styles = S`
2160
+ ge.styles = S`
2094
2161
  :host {
2095
2162
  display: block;
2096
2163
  flex: 1;
@@ -2142,10 +2209,10 @@ xe.styles = S`
2142
2209
  flex-direction: column;
2143
2210
  align-items: center;
2144
2211
  justify-content: center;
2145
- gap: 8px;
2212
+ gap: 6px;
2146
2213
  cursor: pointer;
2147
2214
  transition: all 0.18s ease;
2148
- padding: 16px 12px;
2215
+ padding: 12px 10px;
2149
2216
  position: relative;
2150
2217
  z-index: 1;
2151
2218
  min-height: 0;
@@ -2158,8 +2225,8 @@ xe.styles = S`
2158
2225
  }
2159
2226
 
2160
2227
  .drop-tile-rings {
2161
- width: clamp(48px, 8vw, 72px);
2162
- height: clamp(48px, 8vw, 72px);
2228
+ width: clamp(40px, 6vw, 60px);
2229
+ height: clamp(40px, 6vw, 60px);
2163
2230
  position: relative;
2164
2231
  display: flex;
2165
2232
  align-items: center;
@@ -2188,8 +2255,8 @@ xe.styles = S`
2188
2255
  }
2189
2256
 
2190
2257
  .drop-tile-core {
2191
- width: clamp(28px, 5vw, 40px);
2192
- height: clamp(28px, 5vw, 40px);
2258
+ width: clamp(24px, 4vw, 34px);
2259
+ height: clamp(24px, 4vw, 34px);
2193
2260
  border-radius: 50%;
2194
2261
  background: var(--sfx-up-primary-bg, #eff6ff);
2195
2262
  color: var(--sfx-up-primary, #2563eb);
@@ -2207,16 +2274,16 @@ xe.styles = S`
2207
2274
  }
2208
2275
 
2209
2276
  .drop-tile-core svg {
2210
- width: 20px;
2211
- height: 20px;
2277
+ width: 16px;
2278
+ height: 16px;
2212
2279
  }
2213
2280
 
2214
2281
  .drop-tile-text {
2215
- font-size: 12px;
2282
+ font-size: 11px;
2216
2283
  font-weight: 500;
2217
2284
  color: var(--sfx-up-text-secondary, #475569);
2218
2285
  text-align: center;
2219
- line-height: 1.4;
2286
+ line-height: 1.3;
2220
2287
  }
2221
2288
 
2222
2289
  .drop-tile-text span {
@@ -2226,8 +2293,8 @@ xe.styles = S`
2226
2293
 
2227
2294
  .drop-tile-sources {
2228
2295
  display: flex;
2229
- gap: 4px;
2230
- margin-top: 4px;
2296
+ gap: 3px;
2297
+ margin-top: 2px;
2231
2298
  }
2232
2299
 
2233
2300
  .drop-tile-src {
@@ -2392,7 +2459,7 @@ xe.styles = S`
2392
2459
  display: none;
2393
2460
  }
2394
2461
  `;
2395
- let B = xe;
2462
+ let B = ge;
2396
2463
  Z([
2397
2464
  b({ attribute: !1 })
2398
2465
  ], B.prototype, "files");
@@ -2408,12 +2475,12 @@ Z([
2408
2475
  Z([
2409
2476
  g()
2410
2477
  ], B.prototype, "_moreOpen");
2411
- var at = Object.defineProperty, nt = (a, e, t, i) => {
2478
+ var nt = Object.defineProperty, lt = (a, e, t, i) => {
2412
2479
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
2413
2480
  (s = a[o]) && (r = s(e, t, r) || r);
2414
- return r && at(e, t, r), r;
2481
+ return r && nt(e, t, r), r;
2415
2482
  };
2416
- const ge = class ge extends P {
2483
+ const ve = class ve extends U {
2417
2484
  _remove() {
2418
2485
  this.dispatchEvent(
2419
2486
  new CustomEvent("file-remove", {
@@ -2443,8 +2510,8 @@ const ge = class ge extends P {
2443
2510
  }
2444
2511
  render() {
2445
2512
  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 = [
2513
+ if (!e) return c;
2514
+ const t = X(e), i = e.status === "complete", r = e.status === "uploading", o = e.status === "error" || e.status === "failed", s = e.status === "rejected", n = Xe(e.name), d = [
2448
2515
  "tile",
2449
2516
  i ? "done" : "",
2450
2517
  r ? "uploading" : "",
@@ -2459,7 +2526,7 @@ const ge = class ge extends P {
2459
2526
  <div class="type-icon">
2460
2527
  <div class="type-icon-inner ${t}">
2461
2528
  ${this._renderTypeIcon(t)}
2462
- ${n ? l`<div class="ext-label">${n}</div>` : p}
2529
+ ${n ? l`<div class="ext-label">${n}</div>` : c}
2463
2530
  </div>
2464
2531
  </div>
2465
2532
  `}
@@ -2473,7 +2540,7 @@ const ge = class ge extends P {
2473
2540
  </svg>
2474
2541
  Preview
2475
2542
  </button>
2476
- ` : p}
2543
+ ` : c}
2477
2544
 
2478
2545
  <!-- Spinner overlay -->
2479
2546
  <div class="spinner-overlay">
@@ -2485,20 +2552,20 @@ const ge = class ge extends P {
2485
2552
  <svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="3" stroke-linecap="round">
2486
2553
  <polyline points="20 6 9 17 4 12" />
2487
2554
  </svg>
2488
- </div>` : p}
2555
+ </div>` : c}
2489
2556
 
2490
2557
  <!-- Progress bar -->
2491
2558
  ${e.status === "uploading" ? l`
2492
2559
  <div class="progress">
2493
2560
  <div class="progress-fill" style="transform:scaleX(${Math.min(e.progress, 100) / 100})"></div>
2494
2561
  </div>
2495
- ` : p}
2562
+ ` : c}
2496
2563
 
2497
2564
  <!-- Error / rejected badge -->
2498
- ${(o || s) && e.error ? l`<div class="error-badge" title=${e.error}>${e.error}</div>` : p}
2565
+ ${(o || s) && e.error ? l`<div class="error-badge" title=${e.error}>${e.error}</div>` : c}
2499
2566
 
2500
2567
  <!-- 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}
2568
+ ${!(o || s) && e.duration != null && e.duration > 0 ? l`<div class="duration-badge">${this._formatDuration(e.duration)}</div>` : c}
2502
2569
  </div>
2503
2570
 
2504
2571
  <!-- Action buttons -->
@@ -2510,7 +2577,7 @@ const ge = class ge extends P {
2510
2577
  <path d="M20.49 15a9 9 0 11-2.12-9.36L23 10" />
2511
2578
  </svg>
2512
2579
  </button>
2513
- ` : p}
2580
+ ` : c}
2514
2581
  <button class="act-btn del" @click=${this._remove} title="Remove" aria-label="Remove file">
2515
2582
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
2516
2583
  <polyline points="3 6 5 6 21 6" />
@@ -2549,7 +2616,7 @@ const ge = class ge extends P {
2549
2616
  }
2550
2617
  }
2551
2618
  };
2552
- ge.styles = S`
2619
+ ve.styles = S`
2553
2620
  :host {
2554
2621
  display: block;
2555
2622
  }
@@ -2579,15 +2646,23 @@ ge.styles = S`
2579
2646
  aspect-ratio: 16 / 10;
2580
2647
  overflow: hidden;
2581
2648
  flex-shrink: 0;
2582
- background: var(--sfx-up-border-light, #f3f4f6);
2649
+ background-color: var(--sfx-up-checker-bg, #fff);
2650
+ background-image:
2651
+ linear-gradient(45deg, var(--sfx-up-checker-tile, #f0f0f0) 25%, transparent 25%),
2652
+ linear-gradient(-45deg, var(--sfx-up-checker-tile, #f0f0f0) 25%, transparent 25%),
2653
+ linear-gradient(45deg, transparent 75%, var(--sfx-up-checker-tile, #f0f0f0) 75%),
2654
+ linear-gradient(-45deg, transparent 75%, var(--sfx-up-checker-tile, #f0f0f0) 75%);
2655
+ background-size: 16px 16px;
2656
+ background-position: 0 0, 0 8px, 8px -8px, -8px 0;
2583
2657
  border-radius: 10px 10px 0 0;
2584
2658
  }
2585
2659
 
2586
2660
  .preview-bg {
2587
2661
  position: absolute;
2588
2662
  inset: 0;
2589
- background-size: cover;
2663
+ background-size: contain;
2590
2664
  background-position: center;
2665
+ background-repeat: no-repeat;
2591
2666
  transition: transform 0.4s ease;
2592
2667
  }
2593
2668
 
@@ -2923,10 +2998,10 @@ ge.styles = S`
2923
2998
  .spin-ring { animation: none; }
2924
2999
  }
2925
3000
  `;
2926
- let ne = ge;
2927
- nt([
3001
+ let le = ve;
3002
+ lt([
2928
3003
  b({ attribute: !1 })
2929
- ], ne.prototype, "file");
3004
+ ], le.prototype, "file");
2930
3005
  const J = S`
2931
3006
  .btn,
2932
3007
  .btn-ghost,
@@ -2996,18 +3071,18 @@ const J = S`
2996
3071
  opacity: 0.55;
2997
3072
  cursor: not-allowed;
2998
3073
  }
2999
- `, G = S`
3074
+ `, Q = S`
3000
3075
  button:focus-visible {
3001
3076
  outline: 2px solid var(--sfx-up-ring, oklch(0.578 0.198 268.129 / 0.7));
3002
3077
  outline-offset: 2px;
3003
3078
  }
3004
3079
  `;
3005
- var lt = Object.defineProperty, Q = (a, e, t, i) => {
3080
+ var dt = Object.defineProperty, ee = (a, e, t, i) => {
3006
3081
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3007
3082
  (s = a[o]) && (r = s(e, t, r) || r);
3008
- return r && lt(e, t, r), r;
3083
+ return r && dt(e, t, r), r;
3009
3084
  };
3010
- const Pe = 7, ve = class ve extends P {
3085
+ const Ue = 7, be = class be extends U {
3011
3086
  constructor() {
3012
3087
  super(...arguments), this.fileCount = 0, this.totalSize = 0, this.thumbnails = [], this.primaryLabel = "Done", this.failedFiles = [];
3013
3088
  }
@@ -3037,7 +3112,7 @@ const Pe = 7, ve = class ve extends P {
3037
3112
  );
3038
3113
  }
3039
3114
  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;
3115
+ 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
3116
  return l`
3042
3117
  <button class="close-btn" title="Close" @click=${this._close}>
3043
3118
  <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 +3135,11 @@ const Pe = 7, ve = class ve extends P {
3060
3135
  ${e.map(
3061
3136
  (s) => l`<img class="thumb" src=${s} alt="" />`
3062
3137
  )}
3063
- ${t > 0 ? l`<div class="thumb-more">+${t}</div>` : p}
3138
+ ${t > 0 ? l`<div class="thumb-more">+${t}</div>` : c}
3064
3139
  </div>
3065
- ` : p}
3140
+ ` : c}
3066
3141
 
3067
- ${i ? l`<div class="summary">${this.fileCount} ${this.fileCount === 1 ? "file" : "files"} · ${Y(this.totalSize)} uploaded</div>` : p}
3142
+ ${i ? l`<div class="summary">${this.fileCount} ${this.fileCount === 1 ? "file" : "files"} · ${Y(this.totalSize)} uploaded</div>` : c}
3068
3143
 
3069
3144
  ${r ? l`
3070
3145
  <div class="failed-list">
@@ -3081,18 +3156,18 @@ const Pe = 7, ve = class ve extends P {
3081
3156
  </div>
3082
3157
  `)}
3083
3158
  </div>
3084
- ` : p}
3159
+ ` : c}
3085
3160
 
3086
3161
  <div class="actions">
3087
3162
  <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}
3163
+ ${r ? l`<button class="btn-retry-all" @click=${this._retryAll}>Retry all (${this.failedFiles.length})</button>` : c}
3089
3164
  <button class="btn-primary" @click=${this._primaryAction}>${this.primaryLabel}</button>
3090
3165
  </div>
3091
3166
  </div>
3092
3167
  `;
3093
3168
  }
3094
3169
  };
3095
- ve.styles = [J, G, S`
3170
+ be.styles = [J, Q, S`
3096
3171
  :host {
3097
3172
  display: flex;
3098
3173
  flex: 1;
@@ -3372,28 +3447,28 @@ ve.styles = [J, G, S`
3372
3447
  .icon { animation: none; }
3373
3448
  }
3374
3449
  `];
3375
- let R = ve;
3376
- Q([
3450
+ let L = be;
3451
+ ee([
3377
3452
  b({ type: Number })
3378
- ], R.prototype, "fileCount");
3379
- Q([
3453
+ ], L.prototype, "fileCount");
3454
+ ee([
3380
3455
  b({ type: Number })
3381
- ], R.prototype, "totalSize");
3382
- Q([
3456
+ ], L.prototype, "totalSize");
3457
+ ee([
3383
3458
  b({ type: Array })
3384
- ], R.prototype, "thumbnails");
3385
- Q([
3459
+ ], L.prototype, "thumbnails");
3460
+ ee([
3386
3461
  b({ type: String })
3387
- ], R.prototype, "primaryLabel");
3388
- Q([
3462
+ ], L.prototype, "primaryLabel");
3463
+ ee([
3389
3464
  b({ type: Array })
3390
- ], R.prototype, "failedFiles");
3391
- var dt = Object.defineProperty, A = (a, e, t, i) => {
3465
+ ], L.prototype, "failedFiles");
3466
+ var pt = Object.defineProperty, I = (a, e, t, i) => {
3392
3467
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3393
3468
  (s = a[o]) && (r = s(e, t, r) || r);
3394
- return r && dt(e, t, r), r;
3469
+ return r && pt(e, t, r), r;
3395
3470
  };
3396
- const be = class be extends P {
3471
+ const me = class me extends U {
3397
3472
  constructor() {
3398
3473
  super(...arguments), this.uploadState = "idle", this.fileCount = 0, this.totalSize = 0, this.failedCount = 0, this.showFillMetadata = !1, this.completedCount = 0, this.uploadProgress = 0;
3399
3474
  }
@@ -3422,7 +3497,7 @@ const be = class be extends P {
3422
3497
  </div>
3423
3498
  <span class="progress-label">${this.completedCount}/${this.fileCount} files</span>
3424
3499
  </div>
3425
- ` : p}
3500
+ ` : c}
3426
3501
  <div class="buttons-row">
3427
3502
  <div class="left">
3428
3503
  ${this.showFillMetadata && this.uploadState === "idle" ? l`
@@ -3436,7 +3511,7 @@ const be = class be extends P {
3436
3511
  </svg>
3437
3512
  Fill Metadata
3438
3513
  </button>
3439
- ` : p}
3514
+ ` : c}
3440
3515
  </div>
3441
3516
  <div class="right">
3442
3517
  <button class="btn-ghost" @click=${this._clear}>
@@ -3464,7 +3539,7 @@ const be = class be extends P {
3464
3539
  </svg>
3465
3540
  Retry all (${this.failedCount})
3466
3541
  </button>
3467
- ` : p}
3542
+ ` : c}
3468
3543
  ${this._renderUploadButton()}
3469
3544
  </div>
3470
3545
  </div>
@@ -3495,7 +3570,7 @@ const be = class be extends P {
3495
3570
  `;
3496
3571
  }
3497
3572
  };
3498
- be.styles = [J, G, S`
3573
+ me.styles = [J, Q, S`
3499
3574
  :host {
3500
3575
  display: flex;
3501
3576
  flex-direction: column;
@@ -3644,28 +3719,28 @@ be.styles = [J, G, S`
3644
3719
  .btn-spin { animation: none; }
3645
3720
  }
3646
3721
  `];
3647
- let O = be;
3648
- A([
3722
+ let F = me;
3723
+ I([
3649
3724
  b({ type: String })
3650
- ], O.prototype, "uploadState");
3651
- A([
3725
+ ], F.prototype, "uploadState");
3726
+ I([
3652
3727
  b({ type: Number })
3653
- ], O.prototype, "fileCount");
3654
- A([
3728
+ ], F.prototype, "fileCount");
3729
+ I([
3655
3730
  b({ type: Number })
3656
- ], O.prototype, "totalSize");
3657
- A([
3731
+ ], F.prototype, "totalSize");
3732
+ I([
3658
3733
  b({ type: Number })
3659
- ], O.prototype, "failedCount");
3660
- A([
3734
+ ], F.prototype, "failedCount");
3735
+ I([
3661
3736
  b({ type: Boolean })
3662
- ], O.prototype, "showFillMetadata");
3663
- A([
3737
+ ], F.prototype, "showFillMetadata");
3738
+ I([
3664
3739
  b({ type: Number })
3665
- ], O.prototype, "completedCount");
3666
- A([
3740
+ ], F.prototype, "completedCount");
3741
+ I([
3667
3742
  b({ type: Number })
3668
- ], O.prototype, "uploadProgress");
3743
+ ], F.prototype, "uploadProgress");
3669
3744
  const ct = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
3670
3745
  function ce(a, e) {
3671
3746
  return (t) => {
@@ -3680,12 +3755,12 @@ function ce(a, e) {
3680
3755
  t.shiftKey ? (d === s || !r.contains(d)) && (t.preventDefault(), n.focus()) : (d === n || !r.contains(d)) && (t.preventDefault(), s.focus());
3681
3756
  };
3682
3757
  }
3683
- var pt = Object.defineProperty, pe = (a, e, t, i) => {
3758
+ var ft = Object.defineProperty, fe = (a, e, t, i) => {
3684
3759
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3685
3760
  (s = a[o]) && (r = s(e, t, r) || r);
3686
- return r && pt(e, t, r), r;
3761
+ return r && ft(e, t, r), r;
3687
3762
  };
3688
- const me = class me extends P {
3763
+ const we = class we extends U {
3689
3764
  constructor() {
3690
3765
  super(...arguments), this._url = "", this._name = "", this._error = "", this._onBackdropClick = (e) => {
3691
3766
  e.target === e.currentTarget && this._cancel();
@@ -3796,7 +3871,7 @@ const me = class me extends P {
3796
3871
  `;
3797
3872
  }
3798
3873
  };
3799
- me.styles = [J, G, S`
3874
+ we.styles = [J, Q, S`
3800
3875
  :host {
3801
3876
  display: block;
3802
3877
  }
@@ -3970,22 +4045,22 @@ me.styles = [J, G, S`
3970
4045
  }
3971
4046
 
3972
4047
  `];
3973
- let W = me;
3974
- pe([
4048
+ let K = we;
4049
+ fe([
3975
4050
  g()
3976
- ], W.prototype, "_url");
3977
- pe([
4051
+ ], K.prototype, "_url");
4052
+ fe([
3978
4053
  g()
3979
- ], W.prototype, "_name");
3980
- pe([
4054
+ ], K.prototype, "_name");
4055
+ fe([
3981
4056
  g()
3982
- ], W.prototype, "_error");
3983
- var ft = Object.defineProperty, re = (a, e, t, i) => {
4057
+ ], K.prototype, "_error");
4058
+ var ht = Object.defineProperty, ie = (a, e, t, i) => {
3984
4059
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
3985
4060
  (s = a[o]) && (r = s(e, t, r) || r);
3986
- return r && ft(e, t, r), r;
4061
+ return r && ht(e, t, r), r;
3987
4062
  };
3988
- const we = class we extends P {
4063
+ const ye = class ye extends U {
3989
4064
  constructor() {
3990
4065
  super(...arguments), this._stream = null, this._error = "", this._captured = null, this._previewUrl = "", this._onBackdropClick = (e) => {
3991
4066
  e.target === e.currentTarget && this._cancel();
@@ -4063,7 +4138,7 @@ const we = class we extends P {
4063
4138
  `;
4064
4139
  }
4065
4140
  };
4066
- we.styles = [J, G, S`
4141
+ ye.styles = [J, Q, S`
4067
4142
  :host { display: block; }
4068
4143
 
4069
4144
  .backdrop {
@@ -4144,25 +4219,25 @@ we.styles = [J, G, S`
4144
4219
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4145
4220
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
4146
4221
  `];
4147
- let q = we;
4148
- re([
4222
+ let V = ye;
4223
+ ie([
4149
4224
  g()
4150
- ], q.prototype, "_stream");
4151
- re([
4225
+ ], V.prototype, "_stream");
4226
+ ie([
4152
4227
  g()
4153
- ], q.prototype, "_error");
4154
- re([
4228
+ ], V.prototype, "_error");
4229
+ ie([
4155
4230
  g()
4156
- ], q.prototype, "_captured");
4157
- re([
4231
+ ], V.prototype, "_captured");
4232
+ ie([
4158
4233
  g()
4159
- ], q.prototype, "_previewUrl");
4160
- var ut = Object.defineProperty, ee = (a, e, t, i) => {
4234
+ ], V.prototype, "_previewUrl");
4235
+ var ut = Object.defineProperty, te = (a, e, t, i) => {
4161
4236
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
4162
4237
  (s = a[o]) && (r = s(e, t, r) || r);
4163
4238
  return r && ut(e, t, r), r;
4164
4239
  };
4165
- const ye = class ye extends P {
4240
+ const _e = class _e extends U {
4166
4241
  constructor() {
4167
4242
  super(...arguments), this._stream = null, this._recording = !1, this._error = "", this._recordedBlob = null, this._previewUrl = "", this._recorder = null, this._chunks = [], this._onBackdropClick = (e) => {
4168
4243
  e.target === e.currentTarget && this._cancel();
@@ -4261,7 +4336,7 @@ const ye = class ye extends P {
4261
4336
  `;
4262
4337
  }
4263
4338
  };
4264
- ye.styles = [J, G, S`
4339
+ _e.styles = [J, Q, S`
4265
4340
  :host { display: block; }
4266
4341
 
4267
4342
  .backdrop {
@@ -4360,32 +4435,32 @@ ye.styles = [J, G, S`
4360
4435
  @keyframes slideUp { from { transform: translateY(18px) scale(0.97); } to { transform: translateY(0) scale(1); } }
4361
4436
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
4362
4437
  `];
4363
- let L = ye;
4364
- ee([
4438
+ let A = _e;
4439
+ te([
4365
4440
  g()
4366
- ], L.prototype, "_stream");
4367
- ee([
4441
+ ], A.prototype, "_stream");
4442
+ te([
4368
4443
  g()
4369
- ], L.prototype, "_recording");
4370
- ee([
4444
+ ], A.prototype, "_recording");
4445
+ te([
4371
4446
  g()
4372
- ], L.prototype, "_error");
4373
- ee([
4447
+ ], A.prototype, "_error");
4448
+ te([
4374
4449
  g()
4375
- ], L.prototype, "_recordedBlob");
4376
- ee([
4450
+ ], A.prototype, "_recordedBlob");
4451
+ te([
4377
4452
  g()
4378
- ], L.prototype, "_previewUrl");
4379
- var ht = Object.defineProperty, $ = (a, e, t, i) => {
4453
+ ], A.prototype, "_previewUrl");
4454
+ var xt = Object.defineProperty, $ = (a, e, t, i) => {
4380
4455
  for (var r = void 0, o = a.length - 1, s; o >= 0; o--)
4381
4456
  (s = a[o]) && (r = s(e, t, r) || r);
4382
- return r && ht(e, t, r), r;
4457
+ return r && xt(e, t, r), r;
4383
4458
  };
4384
4459
  const De = /* @__PURE__ */ new Set(["unsplash"]);
4385
4460
  var E;
4386
- const C = (E = class extends P {
4461
+ const k = (E = class extends U {
4387
4462
  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) => {
4463
+ 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
4464
  this._processIncomingFiles(e.detail.files);
4390
4465
  }, this._onDropTileSourceClick = (e) => {
4391
4466
  this._handleSourceActivation(e.detail.source.id);
@@ -4422,22 +4497,22 @@ const C = (E = class extends P {
4422
4497
  if ((((o = (r = this.config) == null ? void 0 : r.connectors) == null ? void 0 : o.providers) ?? []).includes(e)) {
4423
4498
  if (De.has(e)) {
4424
4499
  if (!customElements.get("sfx-search-provider-browser")) {
4425
- const { SfxSearchProviderBrowser: n } = await import("./search-provider-browser-Dywv08pq.js");
4500
+ const { SfxSearchProviderBrowser: n } = await import("./search-provider-browser-Cn0v6Gcq.js");
4426
4501
  customElements.define("sfx-search-provider-browser", n);
4427
4502
  }
4428
4503
  } else if (!customElements.get("sfx-provider-browser")) {
4429
- const { SfxProviderBrowser: n } = await import("./provider-browser-ZgbnfTHX.js");
4504
+ const { SfxProviderBrowser: n } = await import("./provider-browser-DcYDZQos.js");
4430
4505
  customElements.define("sfx-provider-browser", n);
4431
4506
  }
4432
4507
  this._activeConnector = e;
4433
4508
  }
4434
4509
  }, this._onUrlSubmit = (e) => {
4435
- var u, h, x;
4510
+ var h, u, x;
4436
4511
  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);
4512
+ const { url: t, name: i } = e.detail, r = (h = this.config) == null ? void 0 : h.callbacks, o = Ke(i), s = o.startsWith("image/"), n = this._store.getState(), d = ae({ name: i, size: 0, type: o }, n.restrictions, n.files);
4438
4513
  if (d) {
4439
4514
  const f = {
4440
- id: H(),
4515
+ id: q(),
4441
4516
  status: "rejected",
4442
4517
  file: null,
4443
4518
  remoteUrl: t,
@@ -4457,11 +4532,11 @@ const C = (E = class extends P {
4457
4532
  tags: [],
4458
4533
  remoteInfo: null
4459
4534
  };
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);
4535
+ 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
4536
  return;
4462
4537
  }
4463
- const c = {
4464
- id: H(),
4538
+ const p = {
4539
+ id: q(),
4465
4540
  status: "idle",
4466
4541
  file: null,
4467
4542
  remoteUrl: t,
@@ -4481,7 +4556,7 @@ const C = (E = class extends P {
4481
4556
  tags: [],
4482
4557
  remoteInfo: null
4483
4558
  };
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();
4559
+ 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
4560
  }, this._onUrlCancel = () => {
4486
4561
  this._showUrlDialog = !1;
4487
4562
  }, this._onCameraCapture = (e) => {
@@ -4549,14 +4624,14 @@ const C = (E = class extends P {
4549
4624
  var i, r, o;
4550
4625
  const t = (i = this.config) == null ? void 0 : i.callbacks;
4551
4626
  for (const s of e.detail.files) {
4552
- const n = this._store.getState(), d = se(
4627
+ const n = this._store.getState(), d = ae(
4553
4628
  { name: s.name, size: s.size, type: s.mimeType },
4554
4629
  n.restrictions,
4555
4630
  n.files
4556
4631
  );
4557
4632
  if (d) {
4558
- const u = {
4559
- id: H(),
4633
+ const h = {
4634
+ id: q(),
4560
4635
  status: "rejected",
4561
4636
  file: null,
4562
4637
  remoteUrl: null,
@@ -4576,11 +4651,11 @@ const C = (E = class extends P {
4576
4651
  tags: [],
4577
4652
  remoteInfo: s
4578
4653
  };
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);
4654
+ 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
4655
  continue;
4581
4656
  }
4582
- const c = {
4583
- id: H(),
4657
+ const p = {
4658
+ id: q(),
4584
4659
  status: "idle",
4585
4660
  file: null,
4586
4661
  remoteUrl: null,
@@ -4600,7 +4675,7 @@ const C = (E = class extends P {
4600
4675
  tags: [],
4601
4676
  remoteInfo: s
4602
4677
  };
4603
- I(this._store, c), this._dispatchPublic(v.FILE_ADDED, { file: c }), (o = t == null ? void 0 : t.onFileAdded) == null || o.call(t, c);
4678
+ H(this._store, p), this._dispatchPublic(v.FILE_ADDED, { file: p }), (o = t == null ? void 0 : t.onFileAdded) == null || o.call(t, p);
4604
4679
  }
4605
4680
  this._activeConnector = null, this._store.getState().queueConfig.autoProceed && this.upload();
4606
4681
  }, this._onConnectorClose = () => {
@@ -4652,7 +4727,28 @@ const C = (E = class extends P {
4652
4727
  }
4653
4728
  this._isOpen && ((t = this.config) == null ? void 0 : t.mode) === "modal" && (((i = this.config) == null ? void 0 : i.headerButton) ?? "close") !== "none" && this._onModalDismiss();
4654
4729
  }
4655
- }, this._dimCache = /* @__PURE__ */ new Map(), this._onFsToggleZoom = (e) => {
4730
+ }, this._dimCache = /* @__PURE__ */ new Map(), this._onSplitPointerDown = (e) => {
4731
+ var i;
4732
+ e.preventDefault(), this._isResizing = !0;
4733
+ const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".preview-layout");
4734
+ t == null || t.classList.add("resizing"), e.target.setPointerCapture(e.pointerId);
4735
+ }, this._onSplitPointerMove = (e) => {
4736
+ if (!this._isResizing || this._splitRafId) return;
4737
+ const t = e.clientX;
4738
+ this._splitRafId = requestAnimationFrame(() => {
4739
+ var s;
4740
+ this._splitRafId = 0;
4741
+ const i = (s = this.shadowRoot) == null ? void 0 : s.querySelector(".preview-layout");
4742
+ if (!i) return;
4743
+ const r = i.getBoundingClientRect(), o = (t - r.left) / r.width * 100;
4744
+ this._splitPct = Math.max(25, Math.min(75, o));
4745
+ });
4746
+ }, this._onSplitPointerUp = () => {
4747
+ var t;
4748
+ this._isResizing = !1, this._splitRafId && (cancelAnimationFrame(this._splitRafId), this._splitRafId = 0);
4749
+ const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".preview-layout");
4750
+ e == null || e.classList.remove("resizing");
4751
+ }, this._onFsToggleZoom = (e) => {
4656
4752
  e == null || e.stopPropagation(), this._fullscreenZoomed = !this._fullscreenZoomed, this._fullscreenZoomed || (this._fsPanX = 0, this._fsPanY = 0);
4657
4753
  }, this._onFsOverlayClick = (e) => {
4658
4754
  this._fsDragDidMove || this._onFsToggleZoom(e);
@@ -4676,7 +4772,7 @@ const C = (E = class extends P {
4676
4772
  (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
4773
  }, this._onFsClose = (e) => {
4678
4774
  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);
4775
+ }, this._store = Re(), this._storeCtrl = new Me(this, this._store);
4680
4776
  }
4681
4777
  // --- Public API ---
4682
4778
  /** Open the uploader (modal mode). */
@@ -4691,13 +4787,13 @@ const C = (E = class extends P {
4691
4787
  }
4692
4788
  /** Start uploading all queued files. */
4693
4789
  upload() {
4694
- var r, o, s, n, d, c, u;
4790
+ var r, o, s, n, d, p, h;
4695
4791
  if (this._ensureEngine(), !this._engine) {
4696
4792
  console.warn("[sfx-uploader] Cannot upload: auth not resolved yet");
4697
4793
  return;
4698
4794
  }
4699
4795
  const e = [...this._store.getState().files.values()].filter(
4700
- (h) => h.status === "idle" || h.status === "queued"
4796
+ (u) => u.status === "idle" || u.status === "queued"
4701
4797
  );
4702
4798
  if ((o = (r = this.config) == null ? void 0 : r.callbacks) != null && o.onBeforeUpload && this.config.callbacks.onBeforeUpload(e) === !1)
4703
4799
  return;
@@ -4707,7 +4803,7 @@ const C = (E = class extends P {
4707
4803
  cancelable: !0,
4708
4804
  detail: { files: e }
4709
4805
  });
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()));
4806
+ 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
4807
  }
4712
4808
  /** Programmatically add files. */
4713
4809
  addFiles(e) {
@@ -4844,7 +4940,7 @@ const C = (E = class extends P {
4844
4940
  }
4845
4941
  _updateFloatingPortal() {
4846
4942
  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);
4943
+ 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
4944
  }
4849
4945
  connectedCallback() {
4850
4946
  super.connectedCallback(), document.addEventListener("keydown", this._onKeyDown), this._prevStoreState = this._store.getState(), this._unsubStoreEvents = this._store.subscribe(() => this._onStoreChange());
@@ -4878,7 +4974,7 @@ const C = (E = class extends P {
4878
4974
  var r, o;
4879
4975
  const t = e.auth;
4880
4976
  if (t.mode === "sass-key") {
4881
- this._apiBase = de(t.container), this._authHeaders = oe(t), this._ensureEngine(), (r = this._engine) == null || r.updateConfig({
4977
+ this._apiBase = pe(t.container), this._authHeaders = se(t), this._ensureEngine(), (r = this._engine) == null || r.updateConfig({
4882
4978
  apiBase: this._apiBase,
4883
4979
  authHeaders: this._authHeaders
4884
4980
  });
@@ -4886,7 +4982,7 @@ const C = (E = class extends P {
4886
4982
  }
4887
4983
  const i = ++this._authResolveId;
4888
4984
  try {
4889
- const s = await qe(t);
4985
+ const s = await Ve(t);
4890
4986
  if (i !== this._authResolveId) return;
4891
4987
  this._apiBase = s.apiBase, this._authHeaders = s.headers, this._ensureEngine(), (o = this._engine) == null || o.updateConfig({
4892
4988
  apiBase: this._apiBase,
@@ -4898,7 +4994,7 @@ const C = (E = class extends P {
4898
4994
  }
4899
4995
  }
4900
4996
  _ensureEngine() {
4901
- !this._engine && this._apiBase && this._authHeaders && (this._engine = new He(this._store, {
4997
+ !this._engine && this._apiBase && this._authHeaders && (this._engine = new qe(this._store, {
4902
4998
  apiBase: this._apiBase,
4903
4999
  authHeaders: this._authHeaders
4904
5000
  }), this._engine.start());
@@ -4914,7 +5010,7 @@ const C = (E = class extends P {
4914
5010
  * for file status transitions.
4915
5011
  */
4916
5012
  _onStoreChange() {
4917
- var r, o, s, n, d, c, u, h;
5013
+ var r, o, s, n, d, p, h, u;
4918
5014
  const e = this._store.getState(), t = this._prevStoreState;
4919
5015
  if (this._prevStoreState = e, !t) return;
4920
5016
  const i = (r = this.config) == null ? void 0 : r.callbacks;
@@ -4947,19 +5043,19 @@ const C = (E = class extends P {
4947
5043
  percentage: e.totalProgress,
4948
5044
  speed: e.totalSpeed,
4949
5045
  eta: x
4950
- }), (c = i == null ? void 0 : i.onTotalProgress) == null || c.call(i, e.totalProgress, e.totalSpeed, x);
5046
+ }), (p = i == null ? void 0 : i.onTotalProgress) == null || p.call(i, e.totalProgress, e.totalSpeed, x);
4951
5047
  }
4952
5048
  if (t.isUploading && !e.isUploading) {
4953
5049
  const x = [...e.files.values()];
4954
5050
  if (!x.some((m) => m.status === "cancelled")) {
4955
5051
  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;
5052
+ this._dispatchPublic(v.ALL_COMPLETE, { successful: m, failed: _ }), (h = i == null ? void 0 : i.onAllComplete) == null || h.call(i, m, _);
5053
+ const w = (u = this.config) == null ? void 0 : u.closeOnComplete;
4958
5054
  if (w) {
4959
5055
  const y = typeof w == "number" ? w : 1500;
4960
5056
  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());
5057
+ var C, D, ke;
5058
+ 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
5059
  }, y);
4964
5060
  }
4965
5061
  }
@@ -4970,15 +5066,15 @@ const C = (E = class extends P {
4970
5066
  const e = (d = this.config) == null ? void 0 : d.connectors;
4971
5067
  if (e === this._cachedSourcesConfig) return this._cachedSources;
4972
5068
  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.`);
5069
+ return this._cachedSources = W, this._cachedSources;
5070
+ const t = e.providers.length > 0 ? Je(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 = [];
5071
+ for (const p of [...r, ...t, ...o, ...i])
5072
+ if (!s.has(p.id)) {
5073
+ if (E._RESERVED_IDS.has(p.id) && p.onActivate) {
5074
+ console.warn(`[sfx-uploader] Custom source id "${p.id}" conflicts with a built-in source and was skipped.`);
4979
5075
  continue;
4980
5076
  }
4981
- s.add(c.id), n.push(c);
5077
+ s.add(p.id), n.push(p);
4982
5078
  }
4983
5079
  return this._cachedSources = n, this._cachedSources;
4984
5080
  }
@@ -4995,10 +5091,10 @@ const C = (E = class extends P {
4995
5091
  var i, r, o, s;
4996
5092
  const t = (i = this.config) == null ? void 0 : i.callbacks;
4997
5093
  for (const n of e) {
4998
- const d = this._store.getState(), c = Ze(n, d.restrictions, d.files);
4999
- if (c) {
5094
+ const d = this._store.getState(), p = Ze(n, d.restrictions, d.files);
5095
+ if (p) {
5000
5096
  const x = n.type.startsWith("image/") ? URL.createObjectURL(n) : null, f = {
5001
- id: H(),
5097
+ id: q(),
5002
5098
  status: "rejected",
5003
5099
  file: n,
5004
5100
  remoteUrl: null,
@@ -5010,7 +5106,7 @@ const C = (E = class extends P {
5010
5106
  progress: 0,
5011
5107
  speed: 0,
5012
5108
  bytesUploaded: 0,
5013
- error: c,
5109
+ error: p,
5014
5110
  retryCount: 0,
5015
5111
  response: null,
5016
5112
  addedAt: Date.now(),
@@ -5018,29 +5114,29 @@ const C = (E = class extends P {
5018
5114
  tags: [],
5019
5115
  remoteInfo: null
5020
5116
  };
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);
5117
+ 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
5118
  const m = (o = this.config) == null ? void 0 : o.rejectedFileAutoRemoveDelay, _ = m === !1 || m === 0 || m === void 0 ? 0 : m;
5023
5119
  if (_ > 0) {
5024
5120
  const w = f.id, y = setTimeout(() => {
5025
5121
  this._rejectedTimers.delete(w);
5026
- const k = this._store.getState().files.get(w);
5027
- k && k.status === "rejected" && Ce(this._store, w);
5122
+ const C = this._store.getState().files.get(w);
5123
+ C && C.status === "rejected" && Ce(this._store, w);
5028
5124
  }, _);
5029
5125
  this._rejectedTimers.set(w, y);
5030
5126
  }
5031
5127
  continue;
5032
5128
  }
5033
- let u = null;
5034
- n.type.startsWith("image/") && (u = URL.createObjectURL(n));
5035
- const h = {
5036
- id: H(),
5129
+ let h = null;
5130
+ n.type.startsWith("image/") && (h = URL.createObjectURL(n));
5131
+ const u = {
5132
+ id: q(),
5037
5133
  status: "idle",
5038
5134
  file: n,
5039
5135
  remoteUrl: null,
5040
5136
  name: n.name,
5041
5137
  size: n.size,
5042
5138
  type: n.type,
5043
- previewUrl: u,
5139
+ previewUrl: h,
5044
5140
  duration: null,
5045
5141
  progress: 0,
5046
5142
  speed: 0,
@@ -5053,13 +5149,13 @@ const C = (E = class extends P {
5053
5149
  tags: [],
5054
5150
  remoteInfo: null
5055
5151
  };
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/")) {
5057
- Ke(n).then((f) => {
5152
+ 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/")) {
5153
+ Ge(n).then((f) => {
5058
5154
  if (!f) return;
5059
- const m = this._store.getState(), _ = m.files.get(h.id);
5155
+ const m = this._store.getState(), _ = m.files.get(u.id);
5060
5156
  if (_) {
5061
5157
  const w = new Map(m.files);
5062
- w.set(h.id, { ..._, previewUrl: f }), this._store.setState({ files: w });
5158
+ w.set(u.id, { ..._, previewUrl: f }), this._store.setState({ files: w });
5063
5159
  } else
5064
5160
  URL.revokeObjectURL(f);
5065
5161
  });
@@ -5069,10 +5165,10 @@ const C = (E = class extends P {
5069
5165
  }, x.onloadedmetadata = () => {
5070
5166
  const f = x.duration;
5071
5167
  if (URL.revokeObjectURL(x.src), !isFinite(f)) return;
5072
- const m = this._store.getState(), _ = m.files.get(h.id);
5168
+ const m = this._store.getState(), _ = m.files.get(u.id);
5073
5169
  if (_) {
5074
5170
  const w = new Map(m.files);
5075
- w.set(h.id, { ..._, duration: f }), this._store.setState({ files: w });
5171
+ w.set(u.id, { ..._, duration: f }), this._store.setState({ files: w });
5076
5172
  }
5077
5173
  };
5078
5174
  }
@@ -5085,14 +5181,14 @@ const C = (E = class extends P {
5085
5181
  if (!t) return;
5086
5182
  const i = { ...t };
5087
5183
  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));
5184
+ const p = this._videoBlobUrls.get(t.file);
5185
+ p && (URL.revokeObjectURL(p), this._videoBlobUrls.delete(t.file));
5090
5186
  }
5091
5187
  (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
5188
  const r = this._rejectedTimers.get(e);
5093
5189
  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;
5190
+ const p = [...this._store.getState().files.values()];
5191
+ this._previewFileId = p.length > 0 ? p[0].id : null;
5096
5192
  }
5097
5193
  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
5194
  }
@@ -5108,7 +5204,7 @@ const C = (E = class extends P {
5108
5204
  ${this._renderBody()}
5109
5205
  </div>
5110
5206
  </div>
5111
- ` : p}
5207
+ ` : c}
5112
5208
  ` : l`
5113
5209
  <div class="inline">
5114
5210
  ${this._renderHeader()}
@@ -5118,9 +5214,9 @@ const C = (E = class extends P {
5118
5214
  }
5119
5215
  _renderHeader() {
5120
5216
  var s, n;
5121
- if (this._phase === "complete") return p;
5217
+ if (this._phase === "complete") return c;
5122
5218
  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;
5219
+ 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
5220
  return l`
5125
5221
  <div class="header upload-header">
5126
5222
  <div class="float-header-left">
@@ -5128,8 +5224,8 @@ const C = (E = class extends P {
5128
5224
  <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
5225
  </div>
5130
5226
  <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>
5227
+ <div class="float-title">Uploading ${p.length} ${p.length === 1 ? "file" : "files"}</div>
5228
+ <div class="float-subtitle">${h} of ${p.length}${u > 0 ? ` · ~${oe(u)} left` : ""}</div>
5133
5229
  </div>
5134
5230
  </div>
5135
5231
  </div>
@@ -5139,12 +5235,12 @@ const C = (E = class extends P {
5139
5235
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
5140
5236
  <polyline points="15 18 9 12 15 6"/>
5141
5237
  </svg>
5142
- </button>` : p, o = t === "close" ? l`<button class="header-btn header-btn-close" aria-label="Close" @click=${i}>
5238
+ </button>` : c, o = t === "close" ? l`<button class="header-btn header-btn-close" aria-label="Close" @click=${i}>
5143
5239
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
5144
5240
  <line x1="18" y1="6" x2="6" y2="18" />
5145
5241
  <line x1="6" y1="6" x2="18" y2="18" />
5146
5242
  </svg>
5147
- </button>` : p;
5243
+ </button>` : c;
5148
5244
  return l`
5149
5245
  <div class="header">
5150
5246
  ${r}
@@ -5155,7 +5251,7 @@ const C = (E = class extends P {
5155
5251
  <line x1="12" y1="12" x2="12" y2="21" />
5156
5252
  <path d="M20.39 18.39A5 5 0 0018 9h-1.26A8 8 0 103 16.3" />
5157
5253
  </svg>
5158
- </div>` : p}
5254
+ </div>` : c}
5159
5255
  <div class="header-title">Upload Files</div>
5160
5256
  ${o}
5161
5257
  </div>
@@ -5180,11 +5276,11 @@ const C = (E = class extends P {
5180
5276
  <div class="upload-overlay-spinner"></div>
5181
5277
  <div class="upload-overlay-percent">${i}%</div>
5182
5278
  <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>
5279
+ <div class="upload-overlay-subtitle">${r} of ${e.length} complete${o > 0 ? l` · ~${oe(o)} left` : c}</div>
5184
5280
  <div class="upload-overlay-bar">
5185
5281
  <div class="upload-overlay-bar-fill" style="width:${i}%"></div>
5186
5282
  </div>
5187
- ${(s = this.config) != null && s.minimizeOnUpload ? l`<button class="upload-overlay-minimize" @click=${this._onMinimize}>Minimize & continue in background</button>` : p}
5283
+ ${(s = this.config) != null && s.minimizeOnUpload ? l`<button class="upload-overlay-minimize" @click=${this._onMinimize}>Minimize & continue in background</button>` : c}
5188
5284
  </div>
5189
5285
  `;
5190
5286
  }
@@ -5195,7 +5291,7 @@ const C = (E = class extends P {
5195
5291
  <div class="float-collapsed-left">
5196
5292
  ${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
5293
  <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>`}
5294
+ ${r ? c : l`<span class="float-collapsed-pct">${i}%</span>`}
5199
5295
  </div>
5200
5296
  <div class="float-collapsed-actions">
5201
5297
  <button title="Open uploader" @click=${this._onPillExpand}>
@@ -5218,7 +5314,7 @@ const C = (E = class extends P {
5218
5314
  </div>
5219
5315
  <div>
5220
5316
  <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>
5317
+ <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
5318
  </div>
5223
5319
  </div>
5224
5320
  <div class="float-actions">
@@ -5242,25 +5338,25 @@ const C = (E = class extends P {
5242
5338
  </div>
5243
5339
  <div class="float-items">
5244
5340
  ${e.map((d) => {
5245
- const c = d.status === "failed" || d.status === "error";
5341
+ const p = d.status === "failed" || d.status === "error";
5246
5342
  return l`
5247
5343
  <div class="float-item">
5248
5344
  <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>`}
5345
+ ${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
5346
  </div>
5251
5347
  <div class="float-item-info">
5252
5348
  <div class="float-item-name">${d.name}</div>
5253
5349
  <div class="float-item-size">${Y(d.size)}</div>
5254
5350
  </div>
5255
5351
  <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`
5352
+ ${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
5353
  <div class="float-item-error-wrap">
5258
5354
  <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
5355
  <span class="float-item-tooltip">${d.error || "Upload failed"}</span>
5260
5356
  </div>
5261
5357
  <button class="float-item-retry" @click=${() => {
5262
- var u;
5263
- this._ensureEngine(), (u = this._engine) == null || u.retryFile(d.id);
5358
+ var h;
5359
+ this._ensureEngine(), (h = this._engine) == null || h.retryFile(d.id);
5264
5360
  }}>
5265
5361
  <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
5362
  </button>` : l`<div class="float-item-spinner"></div>`}
@@ -5274,12 +5370,12 @@ const C = (E = class extends P {
5274
5370
  }
5275
5371
  _renderPreviewLayout(e) {
5276
5372
  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);
5373
+ if (e.length === 0) return c;
5374
+ 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
5375
  return l`
5280
5376
  <div class="preview-topbar"></div>
5281
5377
  <div class="preview-layout">
5282
- <div class="file-grid-side">
5378
+ <div class="file-grid-side" style="flex:${this._splitPct}">
5283
5379
  <div class="file-grid-header">
5284
5380
  <span class="file-grid-header-text">${e.length} ${e.length === 1 ? "asset" : "assets"} · ${Y(s)}</span>
5285
5381
  </div>
@@ -5291,8 +5387,13 @@ const C = (E = class extends P {
5291
5387
  @source-click=${this._onDropTileSourceClick}
5292
5388
  ></sfx-file-list>
5293
5389
  </div>
5294
- <div class="preview-divider"></div>
5295
- <div class="preview-panel">
5390
+ <div class="preview-divider"
5391
+ @pointerdown=${this._onSplitPointerDown}
5392
+ @pointermove=${this._onSplitPointerMove}
5393
+ @pointerup=${this._onSplitPointerUp}
5394
+ @lostpointercapture=${this._onSplitPointerUp}
5395
+ ></div>
5396
+ <div class="preview-panel" style="flex:${100 - this._splitPct}">
5296
5397
  <div class="preview-panel-header">
5297
5398
  <span class="preview-panel-filename" title=${t.name}>${t.name}</span>
5298
5399
  <div class="preview-header-actions">
@@ -5307,7 +5408,7 @@ const C = (E = class extends P {
5307
5408
  <line x1="3" y1="21" x2="10" y2="14" />
5308
5409
  </svg>
5309
5410
  </button>
5310
- ` : p}
5411
+ ` : c}
5311
5412
  <button @click=${() => {
5312
5413
  this._previewFileId = null;
5313
5414
  }} title="Close">
@@ -5339,10 +5440,10 @@ const C = (E = class extends P {
5339
5440
  </button>
5340
5441
  </div>
5341
5442
  ` : 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>
5443
+ <div class="preview-doc-wrap ${X(t)}">
5444
+ <div class="preview-doc-icon ${X(t)}">
5445
+ ${this._renderDocTypeIcon(X(t))}
5446
+ <span class="preview-doc-ext ${X(t)}">${i}</span>
5346
5447
  </div>
5347
5448
  <button class="preview-nav prev" ?disabled=${e.indexOf(t) === 0} @click=${() => this._navigatePreview(e, -1)}>
5348
5449
  <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 +5534,23 @@ const C = (E = class extends P {
5433
5534
  >
5434
5535
  <div
5435
5536
  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}
5537
+ @dragenter=${o ? this._onBodyDragEnter : c}
5538
+ @dragover=${o ? this._onBodyDragOver : c}
5539
+ @dragleave=${o ? this._onBodyDragLeave : c}
5540
+ @drop=${o ? this._onBodyDrop : c}
5440
5541
  >
5441
5542
  ${i === "complete" ? l`
5442
5543
  <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" }))}
5544
+ .fileCount=${t.filter((p) => p.status === "complete").length}
5545
+ .totalSize=${t.filter((p) => p.status === "complete").reduce((p, h) => p + (h.size || 0), 0)}
5546
+ .thumbnails=${t.filter((p) => p.status === "complete" && p.previewUrl).map((p) => p.previewUrl)}
5547
+ .failedFiles=${t.filter((p) => p.status === "failed").map((p) => ({ id: p.id, name: p.name, error: p.error || "Upload failed" }))}
5447
5548
  @close-uploader=${this._onSuccessCardClose}
5448
5549
  @file-retry=${this._onFileRetry}
5449
5550
  @retry-all=${this._onRetryAll}
5450
5551
  ></sfx-success-card>
5451
5552
  ` : i === "uploading" ? this._renderUploadOverlay(t) : l`
5452
- ${o ? p : l`<sfx-drop-zone
5553
+ ${o ? c : l`<sfx-drop-zone
5453
5554
  .compact=${o}
5454
5555
  .externalDragOver=${this._bodyDragOver}
5455
5556
  .accept=${r}
@@ -5458,7 +5559,7 @@ const C = (E = class extends P {
5458
5559
  ></sfx-drop-zone>`}
5459
5560
 
5460
5561
  ${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>
5562
+ <div class="asset-count">${t.length} ${t.length === 1 ? "file" : "files"} · ${Y(t.reduce((p, h) => p + (h.size || 0), 0))}</div>
5462
5563
  <sfx-file-list
5463
5564
  .files=${t}
5464
5565
  .showDropTile=${!0}
@@ -5466,7 +5567,7 @@ const C = (E = class extends P {
5466
5567
  .accept=${r}
5467
5568
  @source-click=${this._onDropTileSourceClick}
5468
5569
  ></sfx-file-list>
5469
- ` : p}
5570
+ ` : c}
5470
5571
  `}
5471
5572
  </div>
5472
5573
 
@@ -5474,17 +5575,17 @@ const C = (E = class extends P {
5474
5575
  <sfx-actions-bar
5475
5576
  .uploadState=${"idle"}
5476
5577
  .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}
5578
+ .totalSize=${t.reduce((p, h) => p + (h.size || 0), 0)}
5579
+ .failedCount=${t.filter((p) => p.status === "failed" || p.status === "error").length}
5580
+ .completedCount=${t.filter((p) => p.status === "complete").length}
5480
5581
  .uploadProgress=${e.totalProgress ?? 0}
5481
5582
  .showFillMetadata=${!!((n = this.config) != null && n.showFillMetadata)}
5482
5583
  ></sfx-actions-bar>
5483
- ` : p}
5584
+ ` : c}
5484
5585
 
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}
5586
+ ${this._showUrlDialog ? l`<sfx-url-dialog></sfx-url-dialog>` : c}
5587
+ ${this._showCameraDialog ? l`<sfx-camera-dialog></sfx-camera-dialog>` : c}
5588
+ ${this._showScreenCastDialog ? l`<sfx-screen-cast-dialog></sfx-screen-cast-dialog>` : c}
5488
5589
  ${this._activeConnector && ((d = this.config) != null && d.connectors) ? l`
5489
5590
  <div class="connector-modal-backdrop" @click=${this._onConnectorBackdropClick}>
5490
5591
  <div class="connector-modal">
@@ -5501,7 +5602,7 @@ const C = (E = class extends P {
5501
5602
  `}
5502
5603
  </div>
5503
5604
  </div>
5504
- ` : p}
5605
+ ` : c}
5505
5606
 
5506
5607
  ${this._fullscreenPreviewUrl || this._fullscreenVideoFile ? l`
5507
5608
  <div
@@ -5515,7 +5616,7 @@ const C = (E = class extends P {
5515
5616
  @touchmove=${this._onFsTouchMove}
5516
5617
  @touchend=${this._onFsPanEnd}
5517
5618
  >
5518
- <div class="fs-toolbar" @click=${(c) => c.stopPropagation()}>
5619
+ <div class="fs-toolbar" @click=${(p) => p.stopPropagation()}>
5519
5620
  <button class="fs-btn" @click=${this._onFsToggleZoom} title="${this._fullscreenZoomed ? "Zoom out" : "Zoom in"}">
5520
5621
  ${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
5622
  </button>
@@ -5530,7 +5631,7 @@ const C = (E = class extends P {
5530
5631
  src=${this._getVideoBlobUrl(this._fullscreenVideoFile)}
5531
5632
  controls playsinline
5532
5633
  draggable="false"
5533
- @click=${(c) => c.stopPropagation()}
5634
+ @click=${(p) => p.stopPropagation()}
5534
5635
  ></video>` : l`<img
5535
5636
  class="fs-img"
5536
5637
  src=${this._fullscreenPreviewUrl}
@@ -5538,18 +5639,18 @@ const C = (E = class extends P {
5538
5639
  style=${this._fullscreenZoomed ? `transform: scale(2) translate(${this._fsPanX}px, ${this._fsPanY}px)` : ""}
5539
5640
  draggable="false"
5540
5641
  />`}
5541
- <button class="fs-nav prev" @click=${(c) => {
5542
- c.stopPropagation(), this._navigateFs(-1);
5642
+ <button class="fs-nav prev" @click=${(p) => {
5643
+ p.stopPropagation(), this._navigateFs(-1);
5543
5644
  }}>
5544
5645
  <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
5646
  </button>
5546
- <button class="fs-nav next" @click=${(c) => {
5547
- c.stopPropagation(), this._navigateFs(1);
5647
+ <button class="fs-nav next" @click=${(p) => {
5648
+ p.stopPropagation(), this._navigateFs(1);
5548
5649
  }}>
5549
5650
  <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
5651
  </button>
5551
5652
  </div>
5552
- ` : p}
5653
+ ` : c}
5553
5654
  </div>
5554
5655
  `;
5555
5656
  }
@@ -5598,6 +5699,8 @@ const C = (E = class extends P {
5598
5699
  --sfx-up-backdrop: rgba(0, 0, 0, 0.45);
5599
5700
  --sfx-up-ring: var(--ring, oklch(0.578 0.198 268.129 / 0.7));
5600
5701
  --sfx-up-max-height: 88vh;
5702
+ --sfx-up-checker-bg: #fff;
5703
+ --sfx-up-checker-tile: #f0f0f0;
5601
5704
  }
5602
5705
 
5603
5706
  /* --- Modal overlay --- */
@@ -5858,14 +5961,14 @@ const C = (E = class extends P {
5858
5961
  }
5859
5962
 
5860
5963
  .preview-layout .file-grid-side {
5861
- flex: 54;
5964
+ flex: 68;
5862
5965
  min-width: 0;
5863
5966
  min-height: 100%;
5864
5967
  overflow: hidden;
5865
5968
  display: flex;
5866
5969
  flex-direction: column;
5867
5970
  position: relative;
5868
- --sfx-up-grid-min: max(48%, 140px);
5971
+ --sfx-up-grid-min: max(30%, 140px);
5869
5972
  }
5870
5973
 
5871
5974
  .preview-layout .file-grid-side::after {
@@ -5911,21 +6014,59 @@ const C = (E = class extends P {
5911
6014
  }
5912
6015
 
5913
6016
  .preview-divider {
5914
- width: 1px;
5915
- background: var(--sfx-up-border, #e8edf5);
6017
+ width: 9px;
5916
6018
  flex-shrink: 0;
5917
6019
  position: relative;
5918
6020
  display: flex;
5919
6021
  align-items: center;
5920
6022
  justify-content: center;
6023
+ cursor: col-resize;
6024
+ user-select: none;
6025
+ -webkit-user-select: none;
6026
+ }
6027
+
6028
+ .preview-divider::before {
6029
+ content: '';
6030
+ position: absolute;
6031
+ top: 0;
6032
+ bottom: 0;
6033
+ left: 4px;
6034
+ width: 1px;
6035
+ background: var(--sfx-up-border, #e8edf5);
5921
6036
  }
5922
6037
 
5923
6038
  .preview-divider::after {
5924
- display: none;
6039
+ content: '';
6040
+ width: 3px;
6041
+ height: 28px;
6042
+ border-radius: 2px;
6043
+ background: var(--sfx-up-border, #d0d7e2);
6044
+ opacity: 0;
6045
+ transition: opacity 0.15s;
6046
+ z-index: 1;
6047
+ }
6048
+
6049
+ .preview-divider:hover::after,
6050
+ .preview-layout.resizing .preview-divider::after {
6051
+ opacity: 1;
6052
+ }
6053
+
6054
+ .preview-layout.resizing {
6055
+ cursor: col-resize;
6056
+ user-select: none;
6057
+ -webkit-user-select: none;
6058
+ }
6059
+
6060
+ .preview-layout.resizing * {
6061
+ pointer-events: none;
6062
+ }
6063
+
6064
+ .preview-layout.resizing .preview-divider {
6065
+ pointer-events: auto;
5925
6066
  }
5926
6067
 
5927
6068
  .preview-panel {
5928
- flex: 46;
6069
+ flex: 32;
5929
6070
  min-width: 0;
5930
6071
  display: flex;
5931
6072
  flex-direction: column;
@@ -6060,7 +6201,14 @@ const C = (E = class extends P {
6060
6201
  position: relative;
6061
6202
  flex: 1;
6062
6203
  min-height: 0;
6063
- background: var(--sfx-up-surface, #f1f5f9);
6204
+ background-color: var(--sfx-up-checker-bg);
6205
+ background-image:
6206
+ linear-gradient(45deg, var(--sfx-up-checker-tile) 25%, transparent 25%),
6207
+ linear-gradient(-45deg, var(--sfx-up-checker-tile) 25%, transparent 25%),
6208
+ linear-gradient(45deg, transparent 75%, var(--sfx-up-checker-tile) 75%),
6209
+ linear-gradient(-45deg, transparent 75%, var(--sfx-up-checker-tile) 75%);
6210
+ background-size: 16px 16px;
6211
+ background-position: 0 0, 0 8px, 8px -8px, -8px 0;
6064
6212
  }
6065
6213
 
6066
6214
  .preview-image {
@@ -6800,73 +6948,76 @@ const C = (E = class extends P {
6800
6948
  ]), E._RESERVED_IDS = /* @__PURE__ */ new Set(["device", "camera", "url", "screen-cast"]), E);
6801
6949
  $([
6802
6950
  b({ attribute: !1 })
6803
- ], C.prototype, "config");
6951
+ ], k.prototype, "config");
6952
+ $([
6953
+ g()
6954
+ ], k.prototype, "_isOpen");
6804
6955
  $([
6805
6956
  g()
6806
- ], C.prototype, "_isOpen");
6957
+ ], k.prototype, "_activeConnector");
6807
6958
  $([
6808
6959
  g()
6809
- ], C.prototype, "_activeConnector");
6960
+ ], k.prototype, "_showUrlDialog");
6810
6961
  $([
6811
6962
  g()
6812
- ], C.prototype, "_showUrlDialog");
6963
+ ], k.prototype, "_showCameraDialog");
6813
6964
  $([
6814
6965
  g()
6815
- ], C.prototype, "_showCameraDialog");
6966
+ ], k.prototype, "_showScreenCastDialog");
6816
6967
  $([
6817
6968
  g()
6818
- ], C.prototype, "_showScreenCastDialog");
6969
+ ], k.prototype, "_previewFileId");
6819
6970
  $([
6820
6971
  g()
6821
- ], C.prototype, "_previewFileId");
6972
+ ], k.prototype, "_previewDims");
6822
6973
  $([
6823
6974
  g()
6824
- ], C.prototype, "_previewDims");
6975
+ ], k.prototype, "_splitPct");
6825
6976
  $([
6826
6977
  g()
6827
- ], C.prototype, "_fullscreenPreviewUrl");
6978
+ ], k.prototype, "_fullscreenPreviewUrl");
6828
6979
  $([
6829
6980
  g()
6830
- ], C.prototype, "_fullscreenVideoFile");
6981
+ ], k.prototype, "_fullscreenVideoFile");
6831
6982
  $([
6832
6983
  g()
6833
- ], C.prototype, "_fullscreenZoomed");
6984
+ ], k.prototype, "_fullscreenZoomed");
6834
6985
  $([
6835
6986
  g()
6836
- ], C.prototype, "_bodyDragOver");
6987
+ ], k.prototype, "_bodyDragOver");
6837
6988
  $([
6838
6989
  g()
6839
- ], C.prototype, "_isMinimized");
6990
+ ], k.prototype, "_isMinimized");
6840
6991
  $([
6841
6992
  g()
6842
- ], C.prototype, "_isPillExpanded");
6843
- let Ct = C;
6993
+ ], k.prototype, "_isPillExpanded");
6994
+ let $t = k;
6844
6995
  export {
6845
- le as A,
6846
- X as C,
6996
+ de as A,
6997
+ W as C,
6847
6998
  v as P,
6848
- O as S,
6849
- He as U,
6850
- U as a,
6851
- ne as b,
6999
+ F as S,
7000
+ qe as U,
7001
+ z as a,
7002
+ le as b,
6852
7003
  B as c,
6853
- ze as d,
6854
- ae as e,
6855
- R as f,
6856
- Ct as g,
6857
- je as h,
6858
- oe as i,
6859
- Oe as j,
7004
+ Pe as d,
7005
+ ne as e,
7006
+ L as f,
7007
+ $t as g,
7008
+ Oe as h,
7009
+ se as i,
7010
+ Re as j,
6860
7011
  Ye as k,
6861
- de as l,
7012
+ pe as l,
6862
7013
  Je as m,
6863
- W as n,
6864
- q as o,
6865
- L as p,
6866
- mt as q,
6867
- qe as r,
6868
- _t as s,
6869
- kt as t,
6870
- wt as u,
6871
- yt as v
7014
+ K as n,
7015
+ V as o,
7016
+ A as p,
7017
+ wt as q,
7018
+ Ve as r,
7019
+ kt as s,
7020
+ Ct as t,
7021
+ yt as u,
7022
+ _t as v
6872
7023
  };