@frybynite/image-cloud 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,26 +4,26 @@ const mt = Object.freeze({
4
4
  md: "0 4px 16px rgba(0,0,0,0.4)",
5
5
  lg: "0 8px 32px rgba(0,0,0,0.5)",
6
6
  glow: "0 0 30px rgba(255,255,255,0.6)"
7
- }), At = Object.freeze({
7
+ }), Ct = Object.freeze({
8
8
  energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
9
9
  playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
10
10
  subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
11
- }), Tt = Object.freeze({
11
+ }), Rt = Object.freeze({
12
12
  gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
13
13
  bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
14
14
  wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
15
15
  snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
16
- }), Ct = Object.freeze({
16
+ }), Tt = Object.freeze({
17
17
  gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
18
18
  playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
19
19
  serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
20
20
  flutter: Object.freeze({ amplitude: 20, frequency: 4, decay: !0, decayRate: 0.5, phase: 0 })
21
21
  }), vt = Object.freeze({
22
22
  type: "linear"
23
- }), wt = Object.freeze({
24
- mode: "none"
25
23
  }), Et = Object.freeze({
26
24
  mode: "none"
25
+ }), wt = Object.freeze({
26
+ mode: "none"
27
27
  }), Ot = Object.freeze({
28
28
  default: Object.freeze({
29
29
  border: Object.freeze({
@@ -59,12 +59,12 @@ const mt = Object.freeze({
59
59
  phaseShift: 0,
60
60
  synchronization: "offset"
61
61
  // Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
62
- }), jt = Object.freeze({
62
+ }), Bt = Object.freeze({
63
63
  spacing: 0
64
- }), Wt = Object.freeze({
64
+ }), jt = Object.freeze({
65
65
  mobile: Object.freeze({ maxWidth: 767 }),
66
66
  tablet: Object.freeze({ maxWidth: 1199 })
67
- }), Gt = Object.freeze({
67
+ }), Wt = Object.freeze({
68
68
  mode: "adaptive",
69
69
  // Default to adaptive sizing
70
70
  minSize: 50,
@@ -76,31 +76,31 @@ const mt = Object.freeze({
76
76
  // No variance by default
77
77
  max: 1
78
78
  })
79
- }), qt = Object.freeze({
79
+ }), Gt = Object.freeze({
80
80
  mode: "none",
81
81
  range: Object.freeze({
82
82
  min: -15,
83
83
  max: 15
84
84
  })
85
85
  }), zt = Object.freeze({
86
- sizing: Gt,
87
- rotation: qt
88
- }), _t = Object.freeze({
86
+ sizing: Wt,
87
+ rotation: Gt
88
+ }), Dt = Object.freeze({
89
89
  validateUrls: !0,
90
90
  validationTimeout: 5e3,
91
91
  validationMethod: "head",
92
92
  allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
93
- }), Dt = Object.freeze({
93
+ }), _t = Object.freeze({
94
94
  enabled: !1,
95
95
  centers: !1,
96
96
  loaders: !1
97
- }), Bt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Xt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Yt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Jt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), R = Object.freeze({
97
+ }), qt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Xt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Yt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Jt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), A = Object.freeze({
98
98
  // Loader configuration (always an array, composite behavior is implicit)
99
99
  loaders: [],
100
100
  // Shared loader settings and debug config
101
101
  config: Object.freeze({
102
- loaders: _t,
103
- debug: Dt
102
+ loaders: Dt,
103
+ debug: _t
104
104
  }),
105
105
  // Image sizing and rotation configuration
106
106
  image: zt,
@@ -109,7 +109,7 @@ const mt = Object.freeze({
109
109
  algorithm: "radial",
110
110
  scaleDecay: 0,
111
111
  // No decay by default (0-1 for radial/spiral)
112
- responsive: Wt,
112
+ responsive: jt,
113
113
  targetCoverage: 0.6,
114
114
  // Target 60% of container area
115
115
  densityFactor: 1,
@@ -156,8 +156,8 @@ const mt = Object.freeze({
156
156
  easing: "cubic-bezier(0.25, 1, 0.5, 1)",
157
157
  // smooth deceleration
158
158
  path: vt,
159
- rotation: wt,
160
- scale: Et
159
+ rotation: Et,
160
+ scale: wt
161
161
  }),
162
162
  idle: $t
163
163
  }),
@@ -181,7 +181,9 @@ const mt = Object.freeze({
181
181
  // UI configuration
182
182
  ui: Object.freeze({
183
183
  showLoadingSpinner: !1,
184
- showImageCounter: !1
184
+ showImageCounter: !1,
185
+ showNavButtons: !1,
186
+ showFocusOutline: !1
185
187
  }),
186
188
  // Image styling
187
189
  styling: Ot
@@ -214,15 +216,15 @@ function Kt(o, t) {
214
216
  ...o.sizing,
215
217
  ...t.sizing
216
218
  }, t.sizing.variance)) {
217
- const e = t.sizing.variance, n = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : o.sizing?.variance?.min ?? 1, a = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : o.sizing?.variance?.max ?? 1;
218
- i.sizing.variance = { min: n, max: a };
219
+ const e = t.sizing.variance, n = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : o.sizing?.variance?.min ?? 1, s = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : o.sizing?.variance?.max ?? 1;
220
+ i.sizing.variance = { min: n, max: s };
219
221
  }
220
222
  if (t.rotation !== void 0 && (i.rotation = {
221
223
  ...o.rotation,
222
224
  ...t.rotation
223
225
  }, t.rotation.range)) {
224
- const e = t.rotation.range, n = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : o.rotation?.range?.min ?? -15, a = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : o.rotation?.range?.max ?? 15;
225
- i.rotation.range = { min: n, max: a };
226
+ const e = t.rotation.range, n = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : o.rotation?.range?.min ?? -15, s = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : o.rotation?.range?.max ?? 15;
227
+ i.rotation.range = { min: n, max: s };
226
228
  }
227
229
  return i;
228
230
  }
@@ -266,90 +268,90 @@ function te(o = {}) {
266
268
  });
267
269
  const r = {
268
270
  loaders: {
269
- ..._t,
271
+ ...Dt,
270
272
  ...o.config?.loaders ?? {}
271
273
  }
272
- }, s = {
274
+ }, a = {
273
275
  loaders: n,
274
276
  config: r,
275
277
  image: Kt(zt, e),
276
- layout: { ...R.layout },
277
- animation: { ...R.animation },
278
- interaction: { ...R.interaction },
279
- ui: { ...R.ui },
278
+ layout: { ...A.layout },
279
+ animation: { ...A.animation },
280
+ interaction: { ...A.interaction },
281
+ ui: { ...A.ui },
280
282
  styling: Vt(Ot, o.styling)
281
283
  };
282
- o.layout && (s.layout = {
283
- ...R.layout,
284
+ o.layout && (a.layout = {
285
+ ...A.layout,
284
286
  ...o.layout
285
- }, o.layout.responsive && (s.layout.responsive = {
286
- ...R.layout.responsive,
287
- mobile: o.layout.responsive.mobile ? { ...R.layout.responsive.mobile, ...o.layout.responsive.mobile } : R.layout.responsive.mobile,
288
- tablet: o.layout.responsive.tablet ? { ...R.layout.responsive.tablet, ...o.layout.responsive.tablet } : R.layout.responsive.tablet
289
- }), o.layout.spacing && (s.layout.spacing = {
290
- ...R.layout.spacing,
287
+ }, o.layout.responsive && (a.layout.responsive = {
288
+ ...A.layout.responsive,
289
+ mobile: o.layout.responsive.mobile ? { ...A.layout.responsive.mobile, ...o.layout.responsive.mobile } : A.layout.responsive.mobile,
290
+ tablet: o.layout.responsive.tablet ? { ...A.layout.responsive.tablet, ...o.layout.responsive.tablet } : A.layout.responsive.tablet
291
+ }), o.layout.spacing && (a.layout.spacing = {
292
+ ...A.layout.spacing,
291
293
  ...o.layout.spacing
292
- })), o.animation && (s.animation = {
293
- ...R.animation,
294
+ })), o.animation && (a.animation = {
295
+ ...A.animation,
294
296
  ...o.animation
295
- }, o.animation.easing && (s.animation.easing = {
296
- ...R.animation.easing,
297
+ }, o.animation.easing && (a.animation.easing = {
298
+ ...A.animation.easing,
297
299
  ...o.animation.easing
298
- }), o.animation.queue && (s.animation.queue = {
299
- ...R.animation.queue,
300
+ }), o.animation.queue && (a.animation.queue = {
301
+ ...A.animation.queue,
300
302
  ...o.animation.queue
301
- }), o.animation.entry && (s.animation.entry = {
302
- ...R.animation.entry,
303
+ }), o.animation.entry && (a.animation.entry = {
304
+ ...A.animation.entry,
303
305
  ...o.animation.entry,
304
306
  start: o.animation.entry.start ? {
305
- ...R.animation.entry.start,
307
+ ...A.animation.entry.start,
306
308
  ...o.animation.entry.start,
307
- circular: o.animation.entry.start.circular ? { ...R.animation.entry.start.circular, ...o.animation.entry.start.circular } : R.animation.entry.start.circular
308
- } : R.animation.entry.start,
309
- timing: o.animation.entry.timing ? { ...R.animation.entry.timing, ...o.animation.entry.timing } : R.animation.entry.timing,
310
- path: o.animation.entry.path ? { ...vt, ...o.animation.entry.path } : R.animation.entry.path,
311
- rotation: o.animation.entry.rotation ? { ...wt, ...o.animation.entry.rotation } : R.animation.entry.rotation,
312
- scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : R.animation.entry.scale
313
- }), o.animation.idle && (s.animation.idle = {
309
+ circular: o.animation.entry.start.circular ? { ...A.animation.entry.start.circular, ...o.animation.entry.start.circular } : A.animation.entry.start.circular
310
+ } : A.animation.entry.start,
311
+ timing: o.animation.entry.timing ? { ...A.animation.entry.timing, ...o.animation.entry.timing } : A.animation.entry.timing,
312
+ path: o.animation.entry.path ? { ...vt, ...o.animation.entry.path } : A.animation.entry.path,
313
+ rotation: o.animation.entry.rotation ? { ...Et, ...o.animation.entry.rotation } : A.animation.entry.rotation,
314
+ scale: o.animation.entry.scale ? { ...wt, ...o.animation.entry.scale } : A.animation.entry.scale
315
+ }), o.animation.idle && (a.animation.idle = {
314
316
  ...$t,
315
317
  ...o.animation.idle
316
- })), o.interaction && (s.interaction = {
317
- ...R.interaction,
318
+ })), o.interaction && (a.interaction = {
319
+ ...A.interaction,
318
320
  ...o.interaction
319
- }, o.interaction.focus && (s.interaction.focus = {
320
- ...R.interaction.focus,
321
+ }, o.interaction.focus && (a.interaction.focus = {
322
+ ...A.interaction.focus,
321
323
  ...o.interaction.focus
322
- }), o.interaction.navigation && (s.interaction.navigation = {
323
- ...R.interaction.navigation,
324
+ }), o.interaction.navigation && (a.interaction.navigation = {
325
+ ...A.interaction.navigation,
324
326
  ...o.interaction.navigation
325
327
  }));
326
- const l = o.rendering?.ui;
327
- if (l && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), s.ui = {
328
- ...R.ui,
329
- ...l,
328
+ const c = o.rendering?.ui;
329
+ if (c && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), a.ui = {
330
+ ...A.ui,
331
+ ...c,
330
332
  ...o.ui
331
- }, s.config.debug = {
332
- ...Dt,
333
+ }, a.config.debug = {
334
+ ..._t,
333
335
  ...o.config?.debug ?? {}
334
- }, s.layout.algorithm === "honeycomb" && s.styling) {
335
- const c = { shape: "hexagon", mode: "height-relative" };
336
- s.styling = {
337
- ...s.styling,
338
- default: { ...s.styling.default, clipPath: c },
339
- hover: { ...s.styling.hover, clipPath: c }
336
+ }, a.layout.algorithm === "honeycomb" && a.styling) {
337
+ const l = { shape: "hexagon", mode: "height-relative" };
338
+ a.styling = {
339
+ ...a.styling,
340
+ default: { ...a.styling.default, clipPath: l },
341
+ hover: { ...a.styling.hover, clipPath: l }
340
342
  // focused: untouched — user config respected
341
343
  };
342
344
  }
343
- return s;
345
+ return a;
344
346
  }
345
347
  function ee(o, t) {
346
- return { ...o ? At[o] : At.playful, ...t };
348
+ return { ...o ? Ct[o] : Ct.playful, ...t };
347
349
  }
348
350
  function ie(o, t) {
349
- return { ...o ? Tt[o] : Tt.gentle, ...t };
351
+ return { ...o ? Rt[o] : Rt.gentle, ...t };
350
352
  }
351
353
  function ne(o, t) {
352
- return { ...o ? Ct[o] : Ct.gentle, ...t };
354
+ return { ...o ? Tt[o] : Tt.gentle, ...t };
353
355
  }
354
356
  class oe {
355
357
  constructor(t) {
@@ -376,18 +378,18 @@ class oe {
376
378
  * @param easing - CSS easing function (optional)
377
379
  * @returns AnimationHandle that can be used to cancel or query the animation
378
380
  */
379
- animateTransformCancellable(t, i, e, n = null, a = null) {
381
+ animateTransformCancellable(t, i, e, n = null, s = null) {
380
382
  this.cancelAllAnimations(t);
381
- const r = n ?? this.config.duration, s = a ?? this.config.easing.default, l = this.buildTransformString(i), c = this.buildTransformString(e);
383
+ const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
382
384
  t.style.transition = "none";
383
385
  const u = t.animate(
384
386
  [
385
- { transform: l },
386
- { transform: c }
387
+ { transform: c },
388
+ { transform: l }
387
389
  ],
388
390
  {
389
391
  duration: r,
390
- easing: s,
392
+ easing: a,
391
393
  fill: "forwards"
392
394
  // Keep final state after animation
393
395
  }
@@ -401,7 +403,7 @@ class oe {
401
403
  duration: r
402
404
  };
403
405
  return this.activeAnimations.set(t, h), u.finished.then(() => {
404
- t.style.transform = c, this.activeAnimations.delete(t);
406
+ t.style.transform = l, this.activeAnimations.delete(t);
405
407
  }).catch(() => {
406
408
  this.activeAnimations.delete(t);
407
409
  }), h;
@@ -447,8 +449,8 @@ class oe {
447
449
  const e = getComputedStyle(t).transform;
448
450
  if (e === "none" || !e)
449
451
  return { x: 0, y: 0, rotation: 0, scale: 1 };
450
- const n = new DOMMatrix(e), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e, l = n.f;
451
- return { x: s, y: l, rotation: r, scale: a };
452
+ const n = new DOMMatrix(e), s = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), a = n.e, c = n.f;
453
+ return { x: a, y: c, rotation: r, scale: s };
452
454
  }
453
455
  /**
454
456
  * Check if an element has an active animation
@@ -475,10 +477,10 @@ class oe {
475
477
  * @returns Promise that resolves when animation completes
476
478
  */
477
479
  animateTransform(t, i, e = null, n = null) {
478
- return new Promise((a) => {
479
- const r = e ?? this.config.duration, s = n ?? this.config.easing.default;
480
- t.style.transition = `transform ${r}ms ${s}, box-shadow ${r}ms ${s}`, t.style.transform = this.buildTransformString(i), setTimeout(() => {
481
- a();
480
+ return new Promise((s) => {
481
+ const r = e ?? this.config.duration, a = n ?? this.config.easing.default;
482
+ t.style.transition = `transform ${r}ms ${a}, box-shadow ${r}ms ${a}`, t.style.transform = this.buildTransformString(i), setTimeout(() => {
483
+ s();
482
484
  }, r);
483
485
  });
484
486
  }
@@ -511,27 +513,27 @@ function V(o, t, i) {
511
513
  return o + (t - o) * i;
512
514
  }
513
515
  function se(o, t, i, e) {
514
- const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, l = i.y - t.y, c = ae(a, r);
515
- let u = 0, h = 0, d = 1, f = n, y = !1;
516
- for (let g = 0; g < c.length; g++)
517
- if (o <= c[g].time) {
518
- h = g === 0 ? 0 : c[g - 1].time, d = c[g].time, f = c[g].overshoot, y = c[g].isOvershoot;
516
+ const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, l = ae(s, r);
517
+ let u = 0, h = 0, d = 1, g = n, b = !1;
518
+ for (let f = 0; f < l.length; f++)
519
+ if (o <= l[f].time) {
520
+ h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, b = l[f].isOvershoot;
519
521
  break;
520
522
  }
521
523
  const p = (o - h) / (d - h);
522
- if (y)
523
- u = 1 + f * ot(p);
524
+ if (b)
525
+ u = 1 + g * at(p);
524
526
  else if (h === 0)
525
- u = ot(p);
527
+ u = at(p);
526
528
  else {
527
- const m = 1 + (c.find(
528
- (b, w) => b.time > h && w > 0 && c[w - 1].isOvershoot
529
- )?.overshoot || f);
530
- u = V(m, 1, ot(p));
529
+ const m = 1 + (l.find(
530
+ (y, E) => y.time > h && E > 0 && l[E - 1].isOvershoot
531
+ )?.overshoot || g);
532
+ u = V(m, 1, at(p));
531
533
  }
532
534
  return {
533
- x: t.x + s * u,
534
- y: t.y + l * u
535
+ x: t.x + a * u,
536
+ y: t.y + c * u
535
537
  };
536
538
  }
537
539
  function ae(o, t) {
@@ -540,56 +542,56 @@ function ae(o, t) {
540
542
  i.push({ time: e, overshoot: 0, isOvershoot: !1 });
541
543
  let n = 0.15;
542
544
  const r = 0.4 / (o * 2);
543
- for (let s = 0; s < o; s++)
545
+ for (let a = 0; a < o; a++)
544
546
  e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
545
547
  return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
546
548
  }
547
549
  function re(o, t, i, e) {
548
- const { stiffness: n, damping: a, mass: r, oscillations: s } = e, l = i.x - t.x, c = i.y - t.y, u = Math.sqrt(n / r), h = a / (2 * Math.sqrt(n * r));
550
+ const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = s / (2 * Math.sqrt(n * r));
549
551
  let d;
550
552
  if (h < 1) {
551
- const f = u * Math.sqrt(1 - h * h), y = Math.exp(-h * u * o * 3), p = Math.cos(f * o * s * Math.PI);
552
- d = 1 - y * p;
553
+ const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(g * o * a * Math.PI);
554
+ d = 1 - b * p;
553
555
  } else
554
556
  d = 1 - Math.exp(-u * o * 3);
555
557
  return d = Math.max(0, Math.min(d, 1.3)), {
556
- x: t.x + l * d,
557
- y: t.y + c * d
558
+ x: t.x + c * d,
559
+ y: t.y + l * d
558
560
  };
559
561
  }
560
562
  function ce(o, t, i, e) {
561
- const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: l } = e, c = i.x - t.x, u = i.y - t.y, h = Math.sqrt(c * c + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? c / h : 1, y = a * Math.PI * 2 * o + l, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(y) * p, m = le(o);
563
+ const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, g = h > 0 ? l / h : 1, b = s * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, a) : 1, f = n * Math.sin(b) * p, m = le(o);
562
564
  return {
563
- x: V(t.x, i.x, m) + g * d,
564
- y: V(t.y, i.y, m) + g * f
565
+ x: V(t.x, i.x, m) + f * d,
566
+ y: V(t.y, i.y, m) + f * g
565
567
  };
566
568
  }
567
- function ot(o) {
569
+ function at(o) {
568
570
  return 1 - (1 - o) * (1 - o);
569
571
  }
570
572
  function le(o) {
571
573
  return 1 - Math.pow(1 - o, 3);
572
574
  }
573
575
  function he(o, t, i) {
574
- const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, l = e * r * s;
575
- return t + l;
576
+ const { amplitude: e, frequency: n, decay: s } = i, r = Math.sin(o * n * Math.PI * 2), a = s ? Math.pow(1 - o, 2) : 1, c = e * r * a;
577
+ return t + c;
576
578
  }
577
579
  function de(o, t, i) {
578
- const { overshoot: e, bounces: n } = i, a = [];
579
- a.push({ time: 0.5, scale: e });
580
+ const { overshoot: e, bounces: n } = i, s = [];
581
+ s.push({ time: 0.5, scale: e });
580
582
  let r = e;
581
- const s = 0.5, c = 0.5 / (n * 2);
583
+ const a = 0.5, l = 0.5 / (n * 2);
582
584
  let u = 0.5;
583
585
  for (let d = 0; d < n; d++) {
584
- const f = 1 - (r - 1) * s;
585
- u += c, a.push({ time: u, scale: f }), r = 1 + (r - 1) * s * s, u += c, d < n - 1 && a.push({ time: u, scale: r });
586
+ const g = 1 - (r - 1) * a;
587
+ u += l, s.push({ time: u, scale: g }), r = 1 + (r - 1) * a * a, u += l, d < n - 1 && s.push({ time: u, scale: r });
586
588
  }
587
- a.push({ time: 1, scale: 1 });
589
+ s.push({ time: 1, scale: 1 });
588
590
  let h = 1;
589
- for (let d = 0; d < a.length; d++)
590
- if (o <= a[d].time) {
591
- const f = d === 0 ? 0 : a[d - 1].time, y = d === 0 ? 1 : a[d - 1].scale, p = (o - f) / (a[d].time - f), g = ot(p);
592
- h = y + (a[d].scale - y) * g;
591
+ for (let d = 0; d < s.length; d++)
592
+ if (o <= s[d].time) {
593
+ const g = d === 0 ? 0 : s[d - 1].time, b = d === 0 ? 1 : s[d - 1].scale, p = (o - g) / (s[d].time - g), f = at(p);
594
+ h = b + (s[d].scale - b) * f;
593
595
  break;
594
596
  }
595
597
  return h * t;
@@ -600,32 +602,32 @@ function ue(o) {
600
602
  startPosition: i,
601
603
  endPosition: e,
602
604
  pathConfig: n,
603
- duration: a,
605
+ duration: s,
604
606
  imageWidth: r,
605
- imageHeight: s,
606
- rotation: l,
607
- scale: c,
607
+ imageHeight: a,
608
+ rotation: c,
609
+ scale: l,
608
610
  onComplete: u,
609
611
  rotationConfig: h,
610
612
  startRotation: d,
611
- scaleConfig: f,
612
- startScale: y
613
- } = o, p = n.type, g = d !== void 0 && d !== l, m = h?.mode === "wobble", b = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = y !== void 0 && y !== c, S = f?.mode === "pop", E = f?.pop || { overshoot: 1.2, bounces: 1 };
614
- if ((p === "linear" || p === "arc") && !w && !(v || S)) {
613
+ scaleConfig: g,
614
+ startScale: b
615
+ } = o, p = n.type, f = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, E = f || m, v = b !== void 0 && b !== l, S = g?.mode === "pop", w = g?.pop || { overshoot: 1.2, bounces: 1 };
616
+ if ((p === "linear" || p === "arc") && !E && !(v || S)) {
615
617
  u && u();
616
618
  return;
617
619
  }
618
- const O = performance.now(), L = -r / 2, P = -s / 2;
620
+ const O = performance.now(), L = -r / 2, P = -a / 2;
619
621
  function z(H) {
620
- const N = H - O, A = Math.min(N / a, 1);
621
- let _;
622
+ const N = H - O, C = Math.min(N / s, 1);
623
+ let D;
622
624
  switch (p) {
623
625
  case "bounce": {
624
626
  const k = ee(
625
627
  n.bouncePreset,
626
628
  n.bounce
627
629
  );
628
- _ = se(A, i, e, k);
630
+ D = se(C, i, e, k);
629
631
  break;
630
632
  }
631
633
  case "elastic": {
@@ -633,7 +635,7 @@ function ue(o) {
633
635
  n.elasticPreset,
634
636
  n.elastic
635
637
  );
636
- _ = re(A, i, e, k);
638
+ D = re(C, i, e, k);
637
639
  break;
638
640
  }
639
641
  case "wave": {
@@ -641,27 +643,27 @@ function ue(o) {
641
643
  n.wavePreset,
642
644
  n.wave
643
645
  );
644
- _ = ce(A, i, e, k);
646
+ D = ce(C, i, e, k);
645
647
  break;
646
648
  }
647
649
  default:
648
- _ = {
649
- x: V(i.x, e.x, A),
650
- y: V(i.y, e.y, A)
650
+ D = {
651
+ x: V(i.x, e.x, C),
652
+ y: V(i.y, e.y, C)
651
653
  };
652
654
  }
653
- const G = _.x - e.x, U = _.y - e.y;
655
+ const W = D.x - e.x, U = D.y - e.y;
654
656
  let M;
655
- m ? M = he(A, l, b) : g ? M = V(d, l, A) : M = l;
656
- let T;
657
- S ? T = de(A, c, E) : v ? T = V(y, c, A) : T = c, t.style.transform = `translate(${L}px, ${P}px) translate(${G}px, ${U}px) rotate(${M}deg) scale(${T})`, A < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${L}px, ${P}px) rotate(${l}deg) scale(${c})`, u && u());
657
+ m ? M = he(C, c, y) : f ? M = V(d, c, C) : M = c;
658
+ let R;
659
+ S ? R = de(C, l, w) : v ? R = V(b, l, C) : R = l, t.style.transform = `translate(${L}px, ${P}px) translate(${W}px, ${U}px) rotate(${M}deg) scale(${R})`, C < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${L}px, ${P}px) rotate(${c}deg) scale(${l})`, u && u());
658
660
  }
659
661
  requestAnimationFrame(z);
660
662
  }
661
- function ge(o) {
663
+ function fe(o) {
662
664
  return o === "bounce" || o === "elastic" || o === "wave";
663
665
  }
664
- const fe = {
666
+ const ge = {
665
667
  radial: "center",
666
668
  spiral: "center",
667
669
  grid: "top",
@@ -672,83 +674,83 @@ const fe = {
672
674
  };
673
675
  class me {
674
676
  constructor(t, i) {
675
- this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || vt, this.rotationConfig = t.rotation || wt, this.scaleConfig = t.scale || Et;
677
+ this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || vt, this.rotationConfig = t.rotation || Et, this.scaleConfig = t.scale || wt;
676
678
  }
677
679
  /**
678
680
  * Get the effective start position, considering layout-aware defaults
679
681
  */
680
682
  resolveStartPosition() {
681
- return this.config.start.position ? this.config.start.position : fe[this.layoutAlgorithm] || "nearest-edge";
683
+ return this.config.start.position ? this.config.start.position : ge[this.layoutAlgorithm] || "nearest-edge";
682
684
  }
683
685
  /**
684
686
  * Calculate the starting position for an image's entry animation
685
687
  */
686
- calculateStartPosition(t, i, e, n, a) {
687
- const r = this.resolvedStartPosition, s = this.config.start.offset ?? 100;
688
+ calculateStartPosition(t, i, e, n, s) {
689
+ const r = this.resolvedStartPosition, a = this.config.start.offset ?? 100;
688
690
  switch (r) {
689
691
  case "nearest-edge":
690
- return this.calculateNearestEdge(t, i, e, s);
692
+ return this.calculateNearestEdge(t, i, e, a);
691
693
  case "top":
692
- return this.calculateEdgePosition("top", t, i, e, s);
694
+ return this.calculateEdgePosition("top", t, i, e, a);
693
695
  case "bottom":
694
- return this.calculateEdgePosition("bottom", t, i, e, s);
696
+ return this.calculateEdgePosition("bottom", t, i, e, a);
695
697
  case "left":
696
- return this.calculateEdgePosition("left", t, i, e, s);
698
+ return this.calculateEdgePosition("left", t, i, e, a);
697
699
  case "right":
698
- return this.calculateEdgePosition("right", t, i, e, s);
700
+ return this.calculateEdgePosition("right", t, i, e, a);
699
701
  case "center":
700
702
  return this.calculateCenterPosition(e, t, i);
701
703
  case "random-edge":
702
- return this.calculateRandomEdge(t, i, e, s);
704
+ return this.calculateRandomEdge(t, i, e, a);
703
705
  case "circular":
704
706
  return this.calculateCircularPosition(
705
707
  t,
706
708
  i,
707
709
  e,
708
710
  n,
709
- a
711
+ s
710
712
  );
711
713
  default:
712
- return this.calculateNearestEdge(t, i, e, s);
714
+ return this.calculateNearestEdge(t, i, e, a);
713
715
  }
714
716
  }
715
717
  /**
716
718
  * Calculate start position from the nearest edge (current default behavior)
717
719
  */
718
720
  calculateNearestEdge(t, i, e, n) {
719
- const a = t.x, r = t.y, s = a, l = e.width - a, c = r, u = e.height - r, h = Math.min(s, l, c, u);
720
- let d = t.x, f = t.y;
721
- return h === s ? d = -(i.width + n) : h === l ? d = e.width + n : h === c ? f = -(i.height + n) : f = e.height + n, { x: d, y: f };
721
+ const s = t.x, r = t.y, a = s, c = e.width - s, l = r, u = e.height - r, h = Math.min(a, c, l, u);
722
+ let d = t.x, g = t.y;
723
+ return h === a ? d = -(i.width + n) : h === c ? d = e.width + n : h === l ? g = -(i.height + n) : g = e.height + n, { x: d, y: g };
722
724
  }
723
725
  /**
724
726
  * Calculate start position from a specific edge
725
727
  */
726
- calculateEdgePosition(t, i, e, n, a) {
727
- let r = i.x, s = i.y;
728
+ calculateEdgePosition(t, i, e, n, s) {
729
+ let r = i.x, a = i.y;
728
730
  switch (t) {
729
731
  case "top":
730
- s = -(e.height + a);
732
+ a = -(e.height + s);
731
733
  break;
732
734
  case "bottom":
733
- s = n.height + a;
735
+ a = n.height + s;
734
736
  break;
735
737
  case "left":
736
- r = -(e.width + a);
738
+ r = -(e.width + s);
737
739
  break;
738
740
  case "right":
739
- r = n.width + a;
741
+ r = n.width + s;
740
742
  break;
741
743
  }
742
- return { x: r, y: s };
744
+ return { x: r, y: a };
743
745
  }
744
746
  /**
745
747
  * Calculate start position from center with scale animation
746
748
  */
747
749
  calculateCenterPosition(t, i, e) {
748
- const n = t.width / 2, a = t.height / 2;
750
+ const n = t.width / 2, s = t.height / 2;
749
751
  return {
750
752
  x: n,
751
- y: a,
753
+ y: s,
752
754
  useScale: !0
753
755
  // Signal to use scale animation from 0
754
756
  };
@@ -757,27 +759,27 @@ class me {
757
759
  * Calculate start position from a random edge
758
760
  */
759
761
  calculateRandomEdge(t, i, e, n) {
760
- const a = ["top", "bottom", "left", "right"], r = a[Math.floor(Math.random() * a.length)];
762
+ const s = ["top", "bottom", "left", "right"], r = s[Math.floor(Math.random() * s.length)];
761
763
  return this.calculateEdgePosition(r, t, i, e, n);
762
764
  }
763
765
  /**
764
766
  * Calculate start position on a circle around the container
765
767
  */
766
- calculateCircularPosition(t, i, e, n, a) {
767
- const r = this.config.start.circular || {}, s = r.distribution || "even";
768
- let l;
769
- const c = r.radius || "120%";
770
- if (typeof c == "string" && c.endsWith("%")) {
771
- const p = parseFloat(c) / 100;
772
- l = Math.sqrt(
768
+ calculateCircularPosition(t, i, e, n, s) {
769
+ const r = this.config.start.circular || {}, a = r.distribution || "even";
770
+ let c;
771
+ const l = r.radius || "120%";
772
+ if (typeof l == "string" && l.endsWith("%")) {
773
+ const p = parseFloat(l) / 100;
774
+ c = Math.sqrt(
773
775
  e.width ** 2 + e.height ** 2
774
776
  ) * p / 2;
775
777
  } else
776
- l = typeof c == "number" ? c : 500;
778
+ c = typeof l == "number" ? l : 500;
777
779
  let u;
778
- s === "even" ? u = n / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
779
- const h = e.width / 2, d = e.height / 2, f = h + Math.cos(u) * l, y = d + Math.sin(u) * l;
780
- return { x: f, y };
780
+ a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
781
+ const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
782
+ return { x: g, y: b };
781
783
  }
782
784
  /**
783
785
  * Get animation parameters for an image
@@ -796,9 +798,9 @@ class me {
796
798
  * Build a CSS transform string for the start position
797
799
  * Uses pixel-based centering offset for reliable cross-browser behavior
798
800
  */
799
- buildStartTransform(t, i, e, n, a, r, s, l) {
800
- const c = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = l !== void 0 ? l : n, f = a !== void 0 ? -a / 2 : 0, y = r !== void 0 ? -r / 2 : 0, p = a !== void 0 ? `translate(${f}px, ${y}px)` : "translate(-50%, -50%)";
801
- return t.useScale ? `${p} translate(${c}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${c}px, ${u}px) rotate(${h}deg) scale(${d})`;
801
+ buildStartTransform(t, i, e, n, s, r, a, c) {
802
+ const l = t.x - i.x, u = t.y - i.y, h = a !== void 0 ? a : e, d = c !== void 0 ? c : n, g = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${g}px, ${b}px)` : "translate(-50%, -50%)";
803
+ return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(${d})`;
802
804
  }
803
805
  /**
804
806
  * Build the final CSS transform string
@@ -806,8 +808,8 @@ class me {
806
808
  */
807
809
  buildFinalTransform(t, i, e, n) {
808
810
  if (e !== void 0 && n !== void 0) {
809
- const a = -e / 2, r = -n / 2;
810
- return `translate(${a}px, ${r}px) rotate(${t}deg) scale(${i})`;
811
+ const s = -e / 2, r = -n / 2;
812
+ return `translate(${s}px, ${r}px) rotate(${t}deg) scale(${i})`;
811
813
  }
812
814
  return `translate(-50%, -50%) rotate(${t}deg) scale(${i})`;
813
815
  }
@@ -823,7 +825,7 @@ class me {
823
825
  * Check if the current path type requires JavaScript animation
824
826
  */
825
827
  requiresJSAnimation() {
826
- return ge(this.pathConfig.type);
828
+ return fe(this.pathConfig.type);
827
829
  }
828
830
  /**
829
831
  * Get the path configuration
@@ -925,8 +927,8 @@ class me {
925
927
  amplitude: 15,
926
928
  frequency: 3,
927
929
  decay: !0
928
- }, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2), l = r ? Math.pow(1 - t, 2) : 1, c = n * s * l;
929
- return i + c;
930
+ }, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, l = n * a * c;
931
+ return i + l;
930
932
  }
931
933
  /**
932
934
  * Get the scale configuration
@@ -982,15 +984,15 @@ class me {
982
984
  const e = this.scaleConfig.pop || {
983
985
  overshoot: 1.2,
984
986
  bounces: 1
985
- }, { overshoot: n, bounces: a } = e, r = this.generateScaleBounceKeyframes(a, n);
986
- let s = i;
987
- for (let l = 0; l < r.length; l++)
988
- if (t <= r[l].time) {
989
- const c = l === 0 ? 0 : r[l - 1].time, u = l === 0 ? i : r[l - 1].scale, h = (t - c) / (r[l].time - c), d = this.easeOutQuad(h);
990
- s = u + (r[l].scale - u) * d;
987
+ }, { overshoot: n, bounces: s } = e, r = this.generateScaleBounceKeyframes(s, n);
988
+ let a = i;
989
+ for (let c = 0; c < r.length; c++)
990
+ if (t <= r[c].time) {
991
+ const l = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, h = (t - l) / (r[c].time - l), d = this.easeOutQuad(h);
992
+ a = u + (r[c].scale - u) * d;
991
993
  break;
992
994
  }
993
- return s * i;
995
+ return a * i;
994
996
  }
995
997
  /**
996
998
  * Generate keyframes for scale bounce animation
@@ -999,11 +1001,11 @@ class me {
999
1001
  const e = [];
1000
1002
  e.push({ time: 0.5, scale: i });
1001
1003
  let n = i;
1002
- const a = 0.5, s = 0.5 / (t * 2);
1003
- let l = 0.5;
1004
- for (let c = 0; c < t; c++) {
1005
- const u = 1 - (n - 1) * a;
1006
- l += s, e.push({ time: l, scale: u }), n = 1 + (n - 1) * a * a, l += s, c < t - 1 && e.push({ time: l, scale: n });
1004
+ const s = 0.5, a = 0.5 / (t * 2);
1005
+ let c = 0.5;
1006
+ for (let l = 0; l < t; l++) {
1007
+ const u = 1 - (n - 1) * s;
1008
+ c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, l < t - 1 && e.push({ time: c, scale: n });
1007
1009
  }
1008
1010
  return e.push({ time: 1, scale: 1 }), e;
1009
1011
  }
@@ -1024,7 +1026,7 @@ class pe {
1024
1026
  */
1025
1027
  register(t, i, e, n) {
1026
1028
  if (this.entries.has(t)) return;
1027
- const a = n ?? this.entryDurationMs, r = this.config.startDelay ?? a, s = {
1029
+ const s = n ?? this.entryDurationMs, r = this.config.startDelay ?? s, a = {
1028
1030
  element: t,
1029
1031
  index: i,
1030
1032
  totalImages: e,
@@ -1035,8 +1037,8 @@ class pe {
1035
1037
  stopped: !1,
1036
1038
  startTimer: null
1037
1039
  };
1038
- this.entries.set(t, s), s.startTimer = setTimeout(() => {
1039
- s.startTimer = null, !s.stopped && !s.paused && this._startAnimation(s);
1040
+ this.entries.set(t, a), a.startTimer = setTimeout(() => {
1041
+ a.startTimer = null, !a.stopped && !a.paused && this._startAnimation(a);
1040
1042
  }, r);
1041
1043
  }
1042
1044
  /**
@@ -1099,7 +1101,7 @@ class pe {
1099
1101
  }
1100
1102
  }
1101
1103
  _startWiggle(t) {
1102
- const i = { ...Bt, ...this.config.wiggle }, e = [
1104
+ const i = { ...qt, ...this.config.wiggle }, e = [
1103
1105
  { transform: "rotate(0deg)", offset: 0 },
1104
1106
  { transform: `rotate(${i.maxAngle}deg)`, offset: 0.25 },
1105
1107
  { transform: "rotate(0deg)", offset: 0.5 },
@@ -1140,8 +1142,8 @@ class pe {
1140
1142
  }
1141
1143
  _startBlink(t) {
1142
1144
  const i = { ...Yt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
1143
- let a, r;
1144
- i.style === "fade" ? (a = [
1145
+ let s, r;
1146
+ i.style === "fade" ? (s = [
1145
1147
  { opacity: n, offset: 0 },
1146
1148
  { opacity: 0, offset: 0.5 },
1147
1149
  { opacity: n, offset: 1 }
@@ -1150,7 +1152,7 @@ class pe {
1150
1152
  delay: e,
1151
1153
  iterations: 1 / 0,
1152
1154
  easing: "ease-in-out"
1153
- }) : (a = [
1155
+ }) : (s = [
1154
1156
  { opacity: n, offset: 0 },
1155
1157
  { opacity: n, offset: i.onRatio },
1156
1158
  { opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
@@ -1160,7 +1162,7 @@ class pe {
1160
1162
  duration: i.speed,
1161
1163
  delay: e,
1162
1164
  iterations: 1 / 0
1163
- }), t.blinkAnimation = t.element.animate(a, r);
1165
+ }), t.blinkAnimation = t.element.animate(s, r);
1164
1166
  }
1165
1167
  _startSpin(t) {
1166
1168
  const i = { ...Jt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
@@ -1200,7 +1202,7 @@ class pe {
1200
1202
  t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
1201
1203
  }
1202
1204
  }
1203
- class ye {
1205
+ class be {
1204
1206
  constructor(t, i = {}) {
1205
1207
  this.config = t, this.imageConfig = i;
1206
1208
  }
@@ -1212,10 +1214,10 @@ class ye {
1212
1214
  * @returns Array of layout objects with position, rotation, scale
1213
1215
  */
1214
1216
  generate(t, i, e = {}) {
1215
- const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, l = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, y = d !== 1 || f !== 1, g = l * 1.5 / 2, m = l / 2, b = a - s - g, w = r - s - m, v = s + g, S = s + m;
1216
- for (let E = 0; E < t; E++) {
1217
- const I = this.random(v, b), O = this.random(S, w), L = c === "random" ? this.random(u, h) : 0, P = y ? this.random(d, f) : 1, z = l * P, H = {
1218
- id: E,
1217
+ const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, f = c * 1.5 / 2, m = c / 2, y = s - a - f, E = r - a - m, v = a + f, S = a + m;
1218
+ for (let w = 0; w < t; w++) {
1219
+ const I = this.random(v, y), O = this.random(S, E), L = l === "random" ? this.random(u, h) : 0, P = b ? this.random(d, g) : 1, z = c * P, H = {
1220
+ id: w,
1219
1221
  x: I,
1220
1222
  y: O,
1221
1223
  rotation: L,
@@ -1236,7 +1238,7 @@ class ye {
1236
1238
  return Math.random() * (i - t) + t;
1237
1239
  }
1238
1240
  }
1239
- class be {
1241
+ class ye {
1240
1242
  constructor(t, i = {}) {
1241
1243
  this.config = t, this.imageConfig = i;
1242
1244
  }
@@ -1248,20 +1250,20 @@ class be {
1248
1250
  * @returns Array of layout objects with position, rotation, scale
1249
1251
  */
1250
1252
  generate(t, i, e = {}) {
1251
- const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, y = this.config.scaleDecay ?? 0, p = {
1253
+ const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
1252
1254
  ...Nt,
1253
1255
  ...this.config.radial
1254
- }, g = e.fixedHeight ?? s, m = a / 2, b = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, S = Math.max(g * 0.8, Math.min(
1255
- m - v - g / 2,
1256
- b - v - g / 2
1256
+ }, f = e.fixedHeight ?? a, m = s / 2, y = r / 2, E = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, S = Math.max(f * 0.8, Math.min(
1257
+ m - v - f / 2,
1258
+ y - v - f / 2
1257
1259
  ));
1258
1260
  if (t > 0) {
1259
- const O = f ? this.random(h, d) : 1, L = g * O;
1261
+ const O = g ? this.random(h, d) : 1, L = f * O;
1260
1262
  n.push({
1261
1263
  id: 0,
1262
1264
  x: m,
1263
- y: b,
1264
- rotation: l === "random" ? this.random(c * 0.33, u * 0.33) : 0,
1265
+ y,
1266
+ rotation: c === "random" ? this.random(l * 0.33, u * 0.33) : 0,
1265
1267
  // Less rotation for center
1266
1268
  scale: O,
1267
1269
  baseSize: L,
@@ -1269,30 +1271,30 @@ class be {
1269
1271
  // Center image is highest
1270
1272
  });
1271
1273
  }
1272
- let E = 1, I = 1;
1273
- for (; E < t; ) {
1274
- const O = I / w, L = y > 0 ? 1 - O * y * 0.5 : 1, P = Math.max(g * 0.8, S / w * 1.5 / p.tightness), z = I * P, H = z * 1.5, N = Math.PI * (3 * (H + z) - Math.sqrt((3 * H + z) * (H + 3 * z))), A = this.estimateWidth(g), _ = Math.floor(N / (A * 0.7));
1275
- if (_ === 0) {
1274
+ let w = 1, I = 1;
1275
+ for (; w < t; ) {
1276
+ const O = I / E, L = b > 0 ? 1 - O * b * 0.5 : 1, P = Math.max(f * 0.8, S / E * 1.5 / p.tightness), z = I * P, H = z * 1.5, N = Math.PI * (3 * (H + z) - Math.sqrt((3 * H + z) * (H + 3 * z))), C = this.estimateWidth(f), D = Math.floor(N / (C * 0.7));
1277
+ if (D === 0) {
1276
1278
  I++;
1277
1279
  continue;
1278
1280
  }
1279
- const G = 2 * Math.PI / _, U = I * (20 * Math.PI / 180);
1280
- for (let M = 0; M < _ && E < t; M++) {
1281
- const T = M * G + U, k = f ? this.random(h, d) : 1, B = L * k, C = g * B;
1282
- let D = m + Math.cos(T) * H, F = b + Math.sin(T) * z;
1283
- const $ = C * 1.5 / 2, j = C / 2;
1284
- D - $ < v ? D = v + $ : D + $ > a - v && (D = a - v - $), F - j < v ? F = v + j : F + j > r - v && (F = r - v - j);
1285
- const Y = l === "random" ? this.random(c, u) : 0;
1281
+ const W = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
1282
+ for (let M = 0; M < D && w < t; M++) {
1283
+ const R = M * W + U, k = g ? this.random(h, d) : 1, q = L * k, T = f * q;
1284
+ let _ = m + Math.cos(R) * H, F = y + Math.sin(R) * z;
1285
+ const $ = T * 1.5 / 2, B = T / 2;
1286
+ _ - $ < v ? _ = v + $ : _ + $ > s - v && (_ = s - v - $), F - B < v ? F = v + B : F + B > r - v && (F = r - v - B);
1287
+ const Y = c === "random" ? this.random(l, u) : 0;
1286
1288
  n.push({
1287
- id: E,
1288
- x: D,
1289
+ id: w,
1290
+ x: _,
1289
1291
  y: F,
1290
1292
  rotation: Y,
1291
- scale: B,
1292
- baseSize: C,
1293
+ scale: q,
1294
+ baseSize: T,
1293
1295
  zIndex: Math.max(1, 100 - I)
1294
1296
  // Outer rings have lower z-index
1295
- }), E++;
1297
+ }), w++;
1296
1298
  }
1297
1299
  I++;
1298
1300
  }
@@ -1345,7 +1347,7 @@ const ve = {
1345
1347
  { x: 0, y: 1 }
1346
1348
  // down
1347
1349
  ];
1348
- class we {
1350
+ class Ee {
1349
1351
  constructor(t, i = {}) {
1350
1352
  this.config = t, this.imageConfig = i;
1351
1353
  }
@@ -1357,65 +1359,65 @@ class we {
1357
1359
  * @returns Array of layout objects with position, rotation, scale
1358
1360
  */
1359
1361
  generate(t, i, e = {}) {
1360
- const n = [], { width: a, height: r } = i, s = { ...ve, ...this.config.grid }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, y = a - 2 * l, p = r - 2 * l, { columns: g, rows: m } = this.calculateGridDimensions(
1362
+ const n = [], { width: s, height: r } = i, a = { ...ve, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = s - 2 * c, p = r - 2 * c, { columns: f, rows: m } = this.calculateGridDimensions(
1361
1363
  t,
1362
- y,
1364
+ b,
1363
1365
  p,
1364
- c,
1365
- s
1366
- ), b = s.stagger === "row", w = s.stagger === "column", v = b ? g + 0.5 : g, S = w ? m + 0.5 : m, E = (y - s.gap * (g - 1)) / v, I = (p - s.gap * (m - 1)) / S, O = b ? E / 2 : 0, L = w ? I / 2 : 0, P = 1 + s.overlap, z = Math.min(E, I) * P, H = e.fixedHeight ? Math.min(e.fixedHeight, z) : z, N = g * E + (g - 1) * s.gap + O, A = m * I + (m - 1) * s.gap + L, _ = l + (y - N) / 2, G = l + (p - A) / 2, U = g * m, M = s.columns !== "auto" && s.rows !== "auto", T = M && t > U;
1366
+ l,
1367
+ a
1368
+ ), y = a.stagger === "row", E = a.stagger === "column", v = y ? f + 0.5 : f, S = E ? m + 0.5 : m, w = (b - a.gap * (f - 1)) / v, I = (p - a.gap * (m - 1)) / S, O = y ? w / 2 : 0, L = E ? I / 2 : 0, P = 1 + a.overlap, z = Math.min(w, I) * P, H = e.fixedHeight ? Math.min(e.fixedHeight, z) : z, N = f * w + (f - 1) * a.gap + O, C = m * I + (m - 1) * a.gap + L, D = c + (b - N) / 2, W = c + (p - C) / 2, U = f * m, M = a.columns !== "auto" && a.rows !== "auto", R = M && t > U;
1367
1369
  typeof window < "u" && (window.__gridOverflowDebug = {
1368
- gridConfigColumns: s.columns,
1369
- gridConfigRows: s.rows,
1370
- columns: g,
1370
+ gridConfigColumns: a.columns,
1371
+ gridConfigRows: a.rows,
1372
+ columns: f,
1371
1373
  rows: m,
1372
1374
  cellCount: U,
1373
1375
  hasFixedGrid: M,
1374
1376
  imageCount: t,
1375
- isOverflowMode: T
1377
+ isOverflowMode: R
1376
1378
  });
1377
- const k = T ? new Array(U).fill(0) : [], B = Math.min(E, I) * s.overflowOffset;
1378
- for (let C = 0; C < t; C++) {
1379
- let D, F, X = 0;
1380
- if (T && C >= U) {
1381
- const q = C - U, W = q % U;
1382
- X = Math.floor(q / U) + 1, k[W]++, s.fillDirection === "row" ? (D = W % g, F = Math.floor(W / g)) : (F = W % m, D = Math.floor(W / m));
1379
+ const k = R ? new Array(U).fill(0) : [], q = Math.min(w, I) * a.overflowOffset;
1380
+ for (let T = 0; T < t; T++) {
1381
+ let _, F, X = 0;
1382
+ if (R && T >= U) {
1383
+ const G = T - U, j = G % U;
1384
+ X = Math.floor(G / U) + 1, k[j]++, a.fillDirection === "row" ? (_ = j % f, F = Math.floor(j / f)) : (F = j % m, _ = Math.floor(j / m));
1383
1385
  } else
1384
- s.fillDirection === "row" ? (D = C % g, F = Math.floor(C / g)) : (F = C % m, D = Math.floor(C / m));
1385
- let $ = _ + D * (E + s.gap) + E / 2, j = G + F * (I + s.gap) + I / 2;
1386
- if (s.stagger === "row" && F % 2 === 1 ? $ += E / 2 : s.stagger === "column" && D % 2 === 1 && (j += I / 2), X > 0) {
1387
- const q = (X - 1) % Lt.length, W = Lt[q];
1388
- $ += W.x * B, j += W.y * B;
1386
+ a.fillDirection === "row" ? (_ = T % f, F = Math.floor(T / f)) : (F = T % m, _ = Math.floor(T / m));
1387
+ let $ = D + _ * (w + a.gap) + w / 2, B = W + F * (I + a.gap) + I / 2;
1388
+ if (a.stagger === "row" && F % 2 === 1 ? $ += w / 2 : a.stagger === "column" && _ % 2 === 1 && (B += I / 2), X > 0) {
1389
+ const G = (X - 1) % Lt.length, j = Lt[G];
1390
+ $ += j.x * q, B += j.y * q;
1389
1391
  }
1390
- if (s.jitter > 0) {
1391
- const q = E / 2 * s.jitter, W = I / 2 * s.jitter;
1392
- $ += this.random(-q, q), j += this.random(-W, W);
1392
+ if (a.jitter > 0) {
1393
+ const G = w / 2 * a.jitter, j = I / 2 * a.jitter;
1394
+ $ += this.random(-G, G), B += this.random(-j, j);
1393
1395
  }
1394
- let Y = $, J = j;
1395
- if (!T && s.fillDirection === "row") {
1396
- const q = t % g || g;
1397
- if (F === Math.floor((t - 1) / g) && q < g) {
1398
- const Rt = q * E + (q - 1) * s.gap;
1396
+ let Y = $, J = B;
1397
+ if (!R && a.fillDirection === "row") {
1398
+ const G = t % f || f;
1399
+ if (F === Math.floor((t - 1) / f) && G < f) {
1400
+ const At = G * w + (G - 1) * a.gap;
1399
1401
  let gt = 0;
1400
- s.alignment === "center" ? gt = (N - Rt) / 2 : s.alignment === "end" && (gt = N - Rt), Y += gt;
1402
+ a.alignment === "center" ? gt = (N - At) / 2 : a.alignment === "end" && (gt = N - At), Y += gt;
1401
1403
  }
1402
1404
  }
1403
- const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt = l + it, ht = a - l - it, Ut = l + nt, Ht = r - l - nt;
1404
- Y = Math.max(lt, Math.min(Y, ht)), J = Math.max(Ut, Math.min(J, Ht));
1405
- let dt = 0;
1405
+ const ct = g ? this.random(h, d) : 1, K = H * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, Ut = c + ot, Ht = r - c - ot;
1406
+ Y = Math.max(ht, Math.min(Y, dt)), J = Math.max(Ut, Math.min(J, Ht));
1407
+ let ut = 0;
1406
1408
  if (u === "random") {
1407
- const q = this.imageConfig.rotation?.range?.min ?? -15, W = this.imageConfig.rotation?.range?.max ?? 15;
1408
- s.jitter > 0 ? dt = this.random(q * s.jitter, W * s.jitter) : dt = this.random(q, W);
1409
+ const G = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
1410
+ a.jitter > 0 ? ut = this.random(G * a.jitter, j * a.jitter) : ut = this.random(G, j);
1409
1411
  }
1410
- let ut;
1411
- T && X > 0 ? ut = 50 - X : ut = T ? 100 + C : C + 1, n.push({
1412
- id: C,
1412
+ let ft;
1413
+ R && X > 0 ? ft = 50 - X : ft = R ? 100 + T : T + 1, n.push({
1414
+ id: T,
1413
1415
  x: Y,
1414
1416
  y: J,
1415
- rotation: dt,
1416
- scale: rt,
1417
+ rotation: ut,
1418
+ scale: ct,
1417
1419
  baseSize: K,
1418
- zIndex: ut
1420
+ zIndex: ft
1419
1421
  });
1420
1422
  }
1421
1423
  return n;
@@ -1423,20 +1425,20 @@ class we {
1423
1425
  /**
1424
1426
  * Calculate optimal grid dimensions based on image count and container
1425
1427
  */
1426
- calculateGridDimensions(t, i, e, n, a) {
1427
- let r, s;
1428
- if (a.columns !== "auto" && a.rows !== "auto")
1429
- r = a.columns, s = a.rows;
1430
- else if (a.columns !== "auto")
1431
- r = a.columns, s = Math.ceil(t / r);
1432
- else if (a.rows !== "auto")
1433
- s = a.rows, r = Math.ceil(t / s);
1428
+ calculateGridDimensions(t, i, e, n, s) {
1429
+ let r, a;
1430
+ if (s.columns !== "auto" && s.rows !== "auto")
1431
+ r = s.columns, a = s.rows;
1432
+ else if (s.columns !== "auto")
1433
+ r = s.columns, a = Math.ceil(t / r);
1434
+ else if (s.rows !== "auto")
1435
+ a = s.rows, r = Math.ceil(t / a);
1434
1436
  else {
1435
- const l = i / e;
1436
- for (r = Math.max(1, Math.round(Math.sqrt(t * l / 1.4))), s = Math.ceil(t / r); r > 1 && (r - 1) * s >= t; )
1437
+ const c = i / e;
1438
+ for (r = Math.max(1, Math.round(Math.sqrt(t * c / 1.4))), a = Math.ceil(t / r); r > 1 && (r - 1) * a >= t; )
1437
1439
  r--;
1438
1440
  }
1439
- return { columns: Math.max(1, r), rows: Math.max(1, s) };
1441
+ return { columns: Math.max(1, r), rows: Math.max(1, a) };
1440
1442
  }
1441
1443
  /**
1442
1444
  * Utility: Generate random number between min and max
@@ -1445,7 +1447,7 @@ class we {
1445
1447
  return Math.random() * (i - t) + t;
1446
1448
  }
1447
1449
  }
1448
- const Ee = Math.PI * (3 - Math.sqrt(5)), xe = {
1450
+ const we = Math.PI * (3 - Math.sqrt(5)), xe = {
1449
1451
  spiralType: "golden",
1450
1452
  direction: "counterclockwise",
1451
1453
  tightness: 1,
@@ -1464,35 +1466,35 @@ class Se {
1464
1466
  * @returns Array of layout objects with position, rotation, scale
1465
1467
  */
1466
1468
  generate(t, i, e = {}) {
1467
- const n = [], { width: a, height: r } = i, s = { ...xe, ...this.config.spiral }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, y = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || y !== 1, g = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, b = r / 2, w = Math.min(
1468
- m - l - c / 2,
1469
- b - l - c / 2
1470
- ), v = s.direction === "clockwise" ? -1 : 1;
1469
+ const n = [], { width: s, height: r } = i, a = { ...xe, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, y = r / 2, E = Math.min(
1470
+ m - c - l / 2,
1471
+ y - c - l / 2
1472
+ ), v = a.direction === "clockwise" ? -1 : 1;
1471
1473
  for (let S = 0; S < t; S++) {
1472
- let E, I;
1473
- if (s.spiralType === "golden")
1474
- E = S * Ee * v + s.startAngle, I = this.calculateGoldenRadius(S, t, w, s.tightness);
1475
- else if (s.spiralType === "archimedean") {
1476
- const $ = S * 0.5 * s.tightness;
1477
- E = $ * v + s.startAngle, I = this.calculateArchimedeanRadius($, t, w, s.tightness);
1474
+ let w, I;
1475
+ if (a.spiralType === "golden")
1476
+ w = S * we * v + a.startAngle, I = this.calculateGoldenRadius(S, t, E, a.tightness);
1477
+ else if (a.spiralType === "archimedean") {
1478
+ const $ = S * 0.5 * a.tightness;
1479
+ w = $ * v + a.startAngle, I = this.calculateArchimedeanRadius($, t, E, a.tightness);
1478
1480
  } else {
1479
- const $ = S * 0.3 * s.tightness;
1480
- E = $ * v + s.startAngle, I = this.calculateLogarithmicRadius($, t, w, s.tightness);
1481
+ const $ = S * 0.3 * a.tightness;
1482
+ w = $ * v + a.startAngle, I = this.calculateLogarithmicRadius($, t, E, a.tightness);
1481
1483
  }
1482
- const O = m + Math.cos(E) * I, L = b + Math.sin(E) * I, P = I / w, z = g > 0 ? 1 - P * g * 0.5 : 1, H = p ? this.random(f, y) : 1, N = z * H, A = c * N, G = A * 1.5 / 2, U = A / 2, M = l + G, T = a - l - G, k = l + U, B = r - l - U, C = Math.max(M, Math.min(O, T)), D = Math.max(k, Math.min(L, B));
1484
+ const O = m + Math.cos(w) * I, L = y + Math.sin(w) * I, P = I / E, z = f > 0 ? 1 - P * f * 0.5 : 1, H = p ? this.random(g, b) : 1, N = z * H, C = l * N, W = C * 1.5 / 2, U = C / 2, M = c + W, R = s - c - W, k = c + U, q = r - c - U, T = Math.max(M, Math.min(O, R)), _ = Math.max(k, Math.min(L, q));
1483
1485
  let F = 0;
1484
1486
  if (u === "random") {
1485
- const $ = E * 180 / Math.PI % 360, j = this.random(h, d);
1486
- F = s.spiralType === "golden" ? j : $ * 0.1 + j * 0.9;
1487
- } else u === "tangent" && (F = this.calculateSpiralTangent(E, I, s));
1487
+ const $ = w * 180 / Math.PI % 360, B = this.random(h, d);
1488
+ F = a.spiralType === "golden" ? B : $ * 0.1 + B * 0.9;
1489
+ } else u === "tangent" && (F = this.calculateSpiralTangent(w, I, a));
1488
1490
  const X = t - S;
1489
1491
  n.push({
1490
1492
  id: S,
1491
- x: C,
1492
- y: D,
1493
+ x: T,
1494
+ y: _,
1493
1495
  rotation: F,
1494
1496
  scale: N,
1495
- baseSize: A,
1497
+ baseSize: C,
1496
1498
  zIndex: X
1497
1499
  });
1498
1500
  }
@@ -1507,11 +1509,11 @@ class Se {
1507
1509
  if (e.spiralType === "golden")
1508
1510
  n = t + Math.PI / 2;
1509
1511
  else if (e.spiralType === "archimedean") {
1510
- const r = 1 / e.tightness, s = Math.atan(i / r);
1511
- n = t + s;
1512
+ const r = 1 / e.tightness, a = Math.atan(i / r);
1513
+ n = t + a;
1512
1514
  } else {
1513
- const r = 0.15 / e.tightness, s = Math.atan(1 / r);
1514
- n = t + s;
1515
+ const r = 0.15 / e.tightness, a = Math.atan(1 / r);
1516
+ n = t + a;
1515
1517
  }
1516
1518
  return n * 180 / Math.PI % 360 - 90;
1517
1519
  }
@@ -1528,16 +1530,16 @@ class Se {
1528
1530
  * r = a + b*θ (constant spacing between arms)
1529
1531
  */
1530
1532
  calculateArchimedeanRadius(t, i, e, n) {
1531
- const a = i * 0.5 * n;
1532
- return t / a * e;
1533
+ const s = i * 0.5 * n;
1534
+ return t / s * e;
1533
1535
  }
1534
1536
  /**
1535
1537
  * Calculate radius for logarithmic (equiangular) spiral
1536
1538
  * r = a * e^(b*θ)
1537
1539
  */
1538
1540
  calculateLogarithmicRadius(t, i, e, n) {
1539
- const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t), l = i * 0.3 * n, c = a * Math.exp(r * l);
1540
- return s / c * e;
1541
+ const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, l = s * Math.exp(r * c);
1542
+ return a / l * e;
1541
1543
  }
1542
1544
  /**
1543
1545
  * Utility: Generate random number between min and max
@@ -1554,7 +1556,7 @@ const Ie = {
1554
1556
  overlap: 0.3,
1555
1557
  distribution: "gaussian"
1556
1558
  };
1557
- class Re {
1559
+ class Ae {
1558
1560
  constructor(t, i = {}) {
1559
1561
  this.config = t, this.imageConfig = i;
1560
1562
  }
@@ -1566,48 +1568,48 @@ class Re {
1566
1568
  * @returns Array of layout objects with position, rotation, scale
1567
1569
  */
1568
1570
  generate(t, i, e = {}) {
1569
- const n = [], { width: a, height: r } = i, s = { ...Ie, ...this.config.cluster }, l = this.config.spacing.padding, c = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, y = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || y !== 1, g = this.calculateClusterCount(
1571
+ const n = [], { width: s, height: r } = i, a = { ...Ie, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.calculateClusterCount(
1570
1572
  t,
1571
- s.clusterCount,
1572
- a,
1573
+ a.clusterCount,
1574
+ s,
1573
1575
  r,
1574
- s.clusterSpacing
1576
+ a.clusterSpacing
1575
1577
  ), m = this.generateClusterCenters(
1576
- g,
1577
- a,
1578
+ f,
1579
+ s,
1578
1580
  r,
1579
- l,
1580
- s
1581
- ), b = new Array(g).fill(0);
1581
+ c,
1582
+ a
1583
+ ), y = new Array(f).fill(0);
1582
1584
  for (let v = 0; v < t; v++)
1583
- b[v % g]++;
1584
- let w = 0;
1585
- for (let v = 0; v < g; v++) {
1586
- const S = m[v], E = b[v];
1587
- for (let I = 0; I < E; I++) {
1585
+ y[v % f]++;
1586
+ let E = 0;
1587
+ for (let v = 0; v < f; v++) {
1588
+ const S = m[v], w = y[v];
1589
+ for (let I = 0; I < w; I++) {
1588
1590
  let O, L;
1589
- if (s.distribution === "gaussian")
1591
+ if (a.distribution === "gaussian")
1590
1592
  O = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
1591
1593
  else {
1592
1594
  const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
1593
1595
  O = Math.cos(F) * X, L = Math.sin(F) * X;
1594
1596
  }
1595
- const P = 1 + s.overlap * 0.5, z = 1 + s.overlap * 0.3;
1597
+ const P = 1 + a.overlap * 0.5, z = 1 + a.overlap * 0.3;
1596
1598
  O /= P, L /= P;
1597
- const H = p ? this.random(f, y) : 1, N = z * H, A = c * N;
1598
- let _ = S.x + O, G = S.y + L;
1599
- const M = A * 1.5 / 2, T = A / 2;
1600
- _ = Math.max(l + M, Math.min(_, a - l - M)), G = Math.max(l + T, Math.min(G, r - l - T));
1601
- const k = u === "random" ? this.random(h, d) : 0, C = Math.sqrt(O * O + L * L) / S.spread, D = Math.round((1 - C) * 50) + 1;
1599
+ const H = p ? this.random(g, b) : 1, N = z * H, C = l * N;
1600
+ let D = S.x + O, W = S.y + L;
1601
+ const M = C * 1.5 / 2, R = C / 2;
1602
+ D = Math.max(c + M, Math.min(D, s - c - M)), W = Math.max(c + R, Math.min(W, r - c - R));
1603
+ const k = u === "random" ? this.random(h, d) : 0, T = Math.sqrt(O * O + L * L) / S.spread, _ = Math.round((1 - T) * 50) + 1;
1602
1604
  n.push({
1603
- id: w,
1604
- x: _,
1605
- y: G,
1605
+ id: E,
1606
+ x: D,
1607
+ y: W,
1606
1608
  rotation: k,
1607
1609
  scale: N,
1608
- baseSize: A,
1609
- zIndex: D
1610
- }), w++;
1610
+ baseSize: C,
1611
+ zIndex: _
1612
+ }), E++;
1611
1613
  }
1612
1614
  }
1613
1615
  return n;
@@ -1615,36 +1617,36 @@ class Re {
1615
1617
  /**
1616
1618
  * Calculate optimal number of clusters based on image count and container
1617
1619
  */
1618
- calculateClusterCount(t, i, e, n, a) {
1620
+ calculateClusterCount(t, i, e, n, s) {
1619
1621
  if (i !== "auto")
1620
1622
  return Math.max(1, Math.min(i, t));
1621
- const s = Math.max(1, Math.ceil(t / 8)), l = Math.floor(
1622
- e / a * (n / a) * 0.6
1623
+ const a = Math.max(1, Math.ceil(t / 8)), c = Math.floor(
1624
+ e / s * (n / s) * 0.6
1623
1625
  );
1624
- return Math.max(1, Math.min(s, l, 10));
1626
+ return Math.max(1, Math.min(a, c, 10));
1625
1627
  }
1626
1628
  /**
1627
1629
  * Generate cluster center positions with spacing constraints
1628
1630
  */
1629
- generateClusterCenters(t, i, e, n, a) {
1630
- const r = [], l = n + a.clusterSpread, c = i - n - a.clusterSpread, u = n + a.clusterSpread, h = e - n - a.clusterSpread;
1631
+ generateClusterCenters(t, i, e, n, s) {
1632
+ const r = [], c = n + s.clusterSpread, l = i - n - s.clusterSpread, u = n + s.clusterSpread, h = e - n - s.clusterSpread;
1631
1633
  for (let d = 0; d < t; d++) {
1632
- let f = null, y = -1;
1634
+ let g = null, b = -1;
1633
1635
  for (let p = 0; p < 100; p++) {
1634
- const g = {
1635
- x: this.random(l, c),
1636
+ const f = {
1637
+ x: this.random(c, l),
1636
1638
  y: this.random(u, h),
1637
- spread: this.calculateClusterSpread(a)
1639
+ spread: this.calculateClusterSpread(s)
1638
1640
  };
1639
1641
  let m = 1 / 0;
1640
- for (const b of r) {
1641
- const w = g.x - b.x, v = g.y - b.y, S = Math.sqrt(w * w + v * v);
1642
+ for (const y of r) {
1643
+ const E = f.x - y.x, v = f.y - y.y, S = Math.sqrt(E * E + v * v);
1642
1644
  m = Math.min(m, S);
1643
1645
  }
1644
- if ((r.length === 0 || m > y) && (f = g, y = m), m >= a.clusterSpacing)
1646
+ if ((r.length === 0 || m > b) && (g = f, b = m), m >= s.clusterSpacing)
1645
1647
  break;
1646
1648
  }
1647
- f && r.push(f);
1649
+ g && r.push(g);
1648
1650
  }
1649
1651
  return r;
1650
1652
  }
@@ -1672,7 +1674,7 @@ class Re {
1672
1674
  return Math.random() * (i - t) + t;
1673
1675
  }
1674
1676
  }
1675
- class Ae {
1677
+ class Ce {
1676
1678
  constructor(t, i = {}) {
1677
1679
  this.config = t, this.imageConfig = i;
1678
1680
  }
@@ -1684,26 +1686,26 @@ class Ae {
1684
1686
  * @returns Array of layout objects with position, rotation, scale
1685
1687
  */
1686
1688
  generate(t, i, e = {}) {
1687
- const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, l = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, y = d !== 1 || f !== 1, p = e.fixedHeight ?? s, g = {
1689
+ const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, p = e.fixedHeight ?? a, f = {
1688
1690
  ...kt,
1689
1691
  ...this.config.wave
1690
- }, { rows: m, amplitude: b, frequency: w, phaseShift: v, synchronization: S } = g, E = Math.ceil(t / m), L = p * 1.5 / 2, P = l + L, z = a - l - L, H = z - P, N = E > 1 ? H / (E - 1) : 0, A = l + b + p / 2, _ = r - l - b - p / 2, G = _ - A, U = m > 1 ? G / (m - 1) : 0;
1692
+ }, { rows: m, amplitude: y, frequency: E, phaseShift: v, synchronization: S } = f, w = Math.ceil(t / m), L = p * 1.5 / 2, P = c + L, z = s - c - L, H = z - P, N = w > 1 ? H / (w - 1) : 0, C = c + y + p / 2, D = r - c - y - p / 2, W = D - C, U = m > 1 ? W / (m - 1) : 0;
1691
1693
  let M = 0;
1692
- for (let T = 0; T < m && M < t; T++) {
1693
- const k = m === 1 ? (A + _) / 2 : A + T * U;
1694
- let B = 0;
1695
- S === "offset" ? B = T * v : S === "alternating" && (B = T * Math.PI);
1696
- for (let C = 0; C < E && M < t; C++) {
1697
- const D = E === 1 ? (P + z) / 2 : P + C * N, F = this.calculateWaveY(D, a, b, w, B), X = D, $ = k + F, j = y ? this.random(d, f) : 1, Y = p * j;
1694
+ for (let R = 0; R < m && M < t; R++) {
1695
+ const k = m === 1 ? (C + D) / 2 : C + R * U;
1696
+ let q = 0;
1697
+ S === "offset" ? q = R * v : S === "alternating" && (q = R * Math.PI);
1698
+ for (let T = 0; T < w && M < t; T++) {
1699
+ const _ = w === 1 ? (P + z) / 2 : P + T * N, F = this.calculateWaveY(_, s, y, E, q), X = _, $ = k + F, B = b ? this.random(d, g) : 1, Y = p * B;
1698
1700
  let J = 0;
1699
- c === "tangent" ? J = this.calculateRotation(D, a, b, w, B) : c === "random" && (J = this.random(u, h));
1700
- const K = Y * 1.5 / 2, ct = Y / 2, it = l + K, nt = a - l - K, lt = l + ct, ht = r - l - ct;
1701
+ l === "tangent" ? J = this.calculateRotation(_, s, y, E, q) : l === "random" && (J = this.random(u, h));
1702
+ const K = Y * 1.5 / 2, lt = Y / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1701
1703
  n.push({
1702
1704
  id: M,
1703
- x: Math.max(it, Math.min(X, nt)),
1704
- y: Math.max(lt, Math.min($, ht)),
1705
+ x: Math.max(nt, Math.min(X, ot)),
1706
+ y: Math.max(ht, Math.min($, dt)),
1705
1707
  rotation: J,
1706
- scale: j,
1708
+ scale: B,
1707
1709
  baseSize: Y,
1708
1710
  zIndex: M + 1
1709
1711
  }), M++;
@@ -1720,9 +1722,9 @@ class Ae {
1720
1722
  * @param phase - Phase offset
1721
1723
  * @returns Y displacement from baseline
1722
1724
  */
1723
- calculateWaveY(t, i, e, n, a) {
1725
+ calculateWaveY(t, i, e, n, s) {
1724
1726
  const r = t / i;
1725
- return e * Math.sin(n * r * 2 * Math.PI + a);
1727
+ return e * Math.sin(n * r * 2 * Math.PI + s);
1726
1728
  }
1727
1729
  /**
1728
1730
  * Calculate rotation based on wave tangent
@@ -1733,9 +1735,9 @@ class Ae {
1733
1735
  * @param phase - Phase offset
1734
1736
  * @returns Rotation angle in degrees
1735
1737
  */
1736
- calculateRotation(t, i, e, n, a) {
1737
- const r = t / i, s = e * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + a) / i;
1738
- return Math.atan(s) * (180 / Math.PI);
1738
+ calculateRotation(t, i, e, n, s) {
1739
+ const r = t / i, a = e * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + s) / i;
1740
+ return Math.atan(a) * (180 / Math.PI);
1739
1741
  }
1740
1742
  /**
1741
1743
  * Estimate image width based on height
@@ -1762,18 +1764,18 @@ const xt = 100, Q = 100 / Math.sqrt(3), St = [
1762
1764
  // lower-left
1763
1765
  [0, 50]
1764
1766
  // left
1765
- ], Te = St[1][0] / xt, Ce = St[2][1] / xt;
1767
+ ], Re = St[1][0] / xt, Te = St[2][1] / xt;
1766
1768
  function Le(o) {
1767
1769
  return {
1768
- colStep: Te * o,
1769
- rowOffset: Ce * o
1770
+ colStep: Re * o,
1771
+ rowOffset: Te * o
1770
1772
  };
1771
1773
  }
1772
- function Me(o, t, i, e, n, a) {
1773
- const { colStep: r } = Le(a);
1774
+ function Me(o, t, i, e, n, s) {
1775
+ const { colStep: r } = Le(s);
1774
1776
  return {
1775
1777
  px: e + r * o,
1776
- py: n + a * (t + o / 2)
1778
+ py: n + s * (t + o / 2)
1777
1779
  };
1778
1780
  }
1779
1781
  const Fe = [
@@ -1788,9 +1790,9 @@ function Oe(o) {
1788
1790
  if (o === 0) return [[0, 0, 0]];
1789
1791
  const t = [];
1790
1792
  let [i, e, n] = [0, -o, o];
1791
- for (const [a, r, s] of Fe)
1792
- for (let l = 0; l < o; l++)
1793
- t.push([i, e, n]), i += a, e += r, n += s;
1793
+ for (const [s, r, a] of Fe)
1794
+ for (let c = 0; c < o; c++)
1795
+ t.push([i, e, n]), i += s, e += r, n += a;
1794
1796
  return t;
1795
1797
  }
1796
1798
  class ze {
@@ -1800,33 +1802,33 @@ class ze {
1800
1802
  this.config = t;
1801
1803
  }
1802
1804
  generate(t, i, e = {}) {
1803
- const n = [], { width: a, height: r } = i, s = a / 2, l = r / 2, c = e.fixedHeight ?? 200, h = {
1804
- ...jt,
1805
+ const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1806
+ ...Bt,
1805
1807
  ...this.config.honeycomb
1806
- }.spacing ?? 0, d = c + h;
1807
- let f = 0, y = 0;
1808
- for (; f < t; ) {
1809
- const p = Oe(y);
1810
- for (const [g, m, b] of p) {
1811
- if (f >= t) break;
1812
- const { px: w, py: v } = Me(g, m, b, s, l, d);
1808
+ }.spacing ?? 0, d = l + h;
1809
+ let g = 0, b = 0;
1810
+ for (; g < t; ) {
1811
+ const p = Oe(b);
1812
+ for (const [f, m, y] of p) {
1813
+ if (g >= t) break;
1814
+ const { px: E, py: v } = Me(f, m, y, a, c, d);
1813
1815
  n.push({
1814
- id: f,
1815
- x: w,
1816
+ id: g,
1817
+ x: E,
1816
1818
  y: v,
1817
1819
  rotation: 0,
1818
1820
  scale: 1,
1819
- baseSize: c,
1821
+ baseSize: l,
1820
1822
  // Inner rings render above outer rings
1821
- zIndex: Math.max(1, 100 - y)
1822
- }), f++;
1823
+ zIndex: Math.max(1, 100 - b)
1824
+ }), g++;
1823
1825
  }
1824
- y++;
1826
+ b++;
1825
1827
  }
1826
1828
  return n;
1827
1829
  }
1828
1830
  }
1829
- class _e {
1831
+ class De {
1830
1832
  constructor(t) {
1831
1833
  this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
1832
1834
  }
@@ -1837,19 +1839,19 @@ class _e {
1837
1839
  initLayout() {
1838
1840
  switch (this.config.algorithm) {
1839
1841
  case "radial":
1840
- return new be(this.config, this.imageConfig);
1842
+ return new ye(this.config, this.imageConfig);
1841
1843
  case "grid":
1842
- return new we(this.config, this.imageConfig);
1844
+ return new Ee(this.config, this.imageConfig);
1843
1845
  case "spiral":
1844
1846
  return new Se(this.config, this.imageConfig);
1845
1847
  case "cluster":
1846
- return new Re(this.config, this.imageConfig);
1847
- case "wave":
1848
1848
  return new Ae(this.config, this.imageConfig);
1849
+ case "wave":
1850
+ return new Ce(this.config, this.imageConfig);
1849
1851
  case "honeycomb":
1850
1852
  return new ze(this.config, this.imageConfig);
1851
1853
  default:
1852
- return new ye(this.config, this.imageConfig);
1854
+ return new be(this.config, this.imageConfig);
1853
1855
  }
1854
1856
  }
1855
1857
  /**
@@ -1861,8 +1863,8 @@ class _e {
1861
1863
  */
1862
1864
  generateLayout(t, i, e = {}) {
1863
1865
  const n = this.placementLayout.generate(t, i, e);
1864
- return n.forEach((a) => {
1865
- this.layouts.set(a.id, a);
1866
+ return n.forEach((s) => {
1867
+ this.layouts.set(s.id, s);
1866
1868
  }), n;
1867
1869
  }
1868
1870
  /**
@@ -1916,8 +1918,8 @@ class _e {
1916
1918
  return;
1917
1919
  if (typeof e == "number")
1918
1920
  return e;
1919
- const n = e, a = this.resolveBreakpoint(t);
1920
- return a === "mobile" ? n.mobile ?? n.tablet ?? n.screen : a === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
1921
+ const n = e, s = this.resolveBreakpoint(t);
1922
+ return s === "mobile" ? n.mobile ?? n.tablet ?? n.screen : s === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
1921
1923
  }
1922
1924
  /**
1923
1925
  * Calculate adaptive image size based on container dimensions and image count
@@ -1928,18 +1930,18 @@ class _e {
1928
1930
  * @returns Calculated sizing result with height
1929
1931
  */
1930
1932
  calculateAdaptiveSize(t, i, e, n) {
1931
- const a = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1933
+ const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1932
1934
  if (r !== void 0)
1933
1935
  return { height: r };
1934
- const s = a?.minSize ?? 50, l = a?.maxSize ?? 400, c = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * c / i;
1936
+ const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * l / i;
1935
1937
  let m = Math.sqrt(p / 1.4);
1936
1938
  m *= u, m = Math.min(m, e);
1937
- let b = this.clamp(m, s, l);
1938
- if (b === s && m < s) {
1939
- const w = Math.max(s * 0.05, 20);
1940
- b = Math.max(w, m);
1939
+ let y = this.clamp(m, a, c);
1940
+ if (y === a && m < a) {
1941
+ const E = Math.max(a * 0.05, 20);
1942
+ y = Math.max(E, m);
1941
1943
  }
1942
- return this.config.algorithm === "honeycomb" && (b = Math.min(b, this.honeycombMaxImageHeight(i, t))), { height: b };
1944
+ return this.config.algorithm === "honeycomb" && (y = Math.min(y, this.honeycombMaxImageHeight(i, t))), { height: y };
1943
1945
  }
1944
1946
  /**
1945
1947
  * Returns the largest image height at which all honeycomb rings fit within the container.
@@ -1951,7 +1953,7 @@ class _e {
1951
1953
  let e = 0, n = 1;
1952
1954
  for (; n < t; )
1953
1955
  e++, n += 6 * e;
1954
- const a = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, s = i.width / 2, l = i.height / 2, c = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (l - a - r * e) / (e + 0.5), d = (s - a - c * r * e) / (c * e + u);
1956
+ const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, l = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (c - s - r * e) / (e + 0.5), d = (a - s - l * r * e) / (l * e + u);
1955
1957
  return Math.max(10, Math.min(h, d));
1956
1958
  }
1957
1959
  /**
@@ -1971,7 +1973,7 @@ const Mt = {
1971
1973
  hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
1972
1974
  octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
1973
1975
  diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
1974
- }, De = {
1976
+ }, _e = {
1975
1977
  // Circle - uses radius in pixels (refHeight of 100px = 50px radius)
1976
1978
  circle: {
1977
1979
  refHeight: 100,
@@ -2014,15 +2016,15 @@ function $e(o) {
2014
2016
  return o in Mt ? Mt[o] : o;
2015
2017
  }
2016
2018
  function Pe(o, t, i) {
2017
- const e = De[o];
2019
+ const e = _e[o];
2018
2020
  if (!e) return "";
2019
2021
  const n = t / e.refHeight;
2020
2022
  if (o === "circle")
2021
2023
  return `circle(${Math.round(50 * n * 100) / 100}px)`;
2022
- const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * n, l = (Math.min(...r) + Math.max(...r)) / 2 * n, c = (Math.max(...a) - Math.min(...a)) * n, u = (i ?? c) / 2, h = t / 2, d = u - s, f = h - l;
2023
- return `polygon(${e.points.map(([p, g]) => {
2024
- const m = Math.round((p * n + d) * 100) / 100, b = Math.round((g * n + f) * 100) / 100;
2025
- return `${m}px ${b}px`;
2024
+ const s = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, l = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? l) / 2, h = t / 2, d = u - a, g = h - c;
2025
+ return `polygon(${e.points.map(([p, f]) => {
2026
+ const m = Math.round((p * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
2027
+ return `${m}px ${y}px`;
2026
2028
  }).join(", ")})`;
2027
2029
  }
2028
2030
  function Ue(o) {
@@ -2049,47 +2051,47 @@ function tt(o) {
2049
2051
  const t = o.width ?? 0, i = o.style ?? "solid", e = o.color ?? "#000000";
2050
2052
  return `${t}px ${i} ${e}`;
2051
2053
  }
2052
- function et(o, t, i) {
2054
+ function it(o, t, i) {
2053
2055
  if (!o) return {};
2054
2056
  const e = {};
2055
2057
  if (o.borderRadiusTopLeft !== void 0 || o.borderRadiusTopRight !== void 0 || o.borderRadiusBottomRight !== void 0 || o.borderRadiusBottomLeft !== void 0) {
2056
- const s = o.border?.radius ?? 0;
2057
- o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : s && (e.borderTopLeftRadius = `${s}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : s && (e.borderTopRightRadius = `${s}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : s && (e.borderBottomRightRadius = `${s}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : s && (e.borderBottomLeftRadius = `${s}px`);
2058
+ const a = o.border?.radius ?? 0;
2059
+ o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : a && (e.borderTopLeftRadius = `${a}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : a && (e.borderTopRightRadius = `${a}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : a && (e.borderBottomRightRadius = `${a}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : a && (e.borderBottomLeftRadius = `${a}px`);
2058
2060
  } else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
2059
2061
  if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
2060
- const s = o.border || {}, l = { ...s, ...o.borderTop }, c = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, h = { ...s, ...o.borderLeft };
2061
- e.borderTop = tt(l), e.borderRight = tt(c), e.borderBottom = tt(u), e.borderLeft = tt(h);
2062
+ const a = o.border || {}, c = { ...a, ...o.borderTop }, l = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, h = { ...a, ...o.borderLeft };
2063
+ e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
2062
2064
  } else o.border && (e.border = tt(o.border));
2063
2065
  o.shadow !== void 0 && (e.boxShadow = He(o.shadow));
2064
2066
  const r = Ne(o.filter);
2065
2067
  if (e.filter = r || "none", o.opacity !== void 0 && (e.opacity = String(o.opacity)), o.cursor !== void 0 && (e.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
2066
- const s = o.outline.width ?? 0, l = o.outline.style ?? "solid", c = o.outline.color ?? "#000000";
2067
- e.outline = `${s}px ${l} ${c}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2068
+ const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
2069
+ e.outline = `${a}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2068
2070
  }
2069
2071
  if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
2070
- let s;
2071
- const l = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, c = l ? o.clipPath : void 0;
2072
- if (c?.mode === "height-relative" && t)
2073
- s = Pe(c.shape, t, i);
2072
+ let a;
2073
+ const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
2074
+ if (l?.mode === "height-relative" && t)
2075
+ a = Pe(l.shape, t, i);
2074
2076
  else {
2075
- const u = l && c ? c.shape : o.clipPath;
2076
- s = $e(u);
2077
+ const u = c && l ? l.shape : o.clipPath;
2078
+ a = $e(u);
2077
2079
  }
2078
- s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
2080
+ a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
2079
2081
  }
2080
2082
  return e;
2081
2083
  }
2082
2084
  function ke(o, t) {
2083
2085
  t.borderRadius !== void 0 && (o.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (o.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (o.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (o.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (o.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (o.style.border = t.border), t.borderTop !== void 0 && (o.style.borderTop = t.borderTop), t.borderRight !== void 0 && (o.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (o.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (o.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (o.style.boxShadow = t.boxShadow), t.filter !== void 0 && (o.style.filter = t.filter), t.opacity !== void 0 && (o.style.opacity = t.opacity), t.cursor !== void 0 && (o.style.cursor = t.cursor), t.outline !== void 0 && (o.style.outline = t.outline), t.outlineOffset !== void 0 && (o.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (o.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (o.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (o.style.clipPath = t.clipPath), t.overflow !== void 0 && (o.style.overflow = t.overflow);
2084
2086
  }
2085
- function ft(o, t, i, e) {
2086
- const n = et(t, i, e);
2087
+ function st(o, t, i, e) {
2088
+ const n = it(t, i, e);
2087
2089
  ke(o, n);
2088
2090
  }
2089
2091
  function Pt(o) {
2090
2092
  return o ? Array.isArray(o) ? o.join(" ") : o : "";
2091
2093
  }
2092
- function st(o, t) {
2094
+ function et(o, t) {
2093
2095
  const i = Pt(t);
2094
2096
  i && i.split(" ").forEach((e) => {
2095
2097
  e.trim() && o.classList.add(e.trim());
@@ -2105,7 +2107,7 @@ const Ft = {
2105
2107
  UNFOCUSING: 999,
2106
2108
  FOCUSING: 1e3
2107
2109
  };
2108
- class je {
2110
+ class Be {
2109
2111
  constructor(t, i, e) {
2110
2112
  this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
2111
2113
  }
@@ -2138,19 +2140,19 @@ class je {
2138
2140
  * Returns actual pixel dimensions instead of scale factor for sharper rendering
2139
2141
  */
2140
2142
  calculateFocusDimensions(t, i, e) {
2141
- const n = this.normalizeScalePercent(this.config.scalePercent), a = e.height * n, r = t / i;
2142
- let s = a, l = s * r;
2143
- const c = e.width * n;
2144
- return l > c && (l = c, s = l / r), { width: l, height: s };
2143
+ const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
2144
+ let a = s, c = a * r;
2145
+ const l = e.width * n;
2146
+ return c > l && (c = l, a = c / r), { width: c, height: a };
2145
2147
  }
2146
2148
  /**
2147
2149
  * Calculate the transform needed to center an image (position only, no scale)
2148
2150
  * Scale is handled by animating actual dimensions for sharper rendering
2149
2151
  */
2150
2152
  calculateFocusTransform(t, i) {
2151
- const e = t.width / 2, n = t.height / 2, a = e - i.x, r = n - i.y;
2153
+ const e = t.width / 2, n = t.height / 2, s = e - i.x, r = n - i.y;
2152
2154
  return {
2153
- x: a,
2155
+ x: s,
2154
2156
  y: r,
2155
2157
  rotation: 0,
2156
2158
  scale: 1
@@ -2172,23 +2174,23 @@ class je {
2172
2174
  * Create a Web Animation that animates both transform (position) and dimensions
2173
2175
  * This provides sharper zoom by re-rendering at target size instead of scaling pixels
2174
2176
  */
2175
- animateWithDimensions(t, i, e, n, a, r, s, l) {
2176
- const c = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2177
+ animateWithDimensions(t, i, e, n, s, r, a, c) {
2178
+ const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2177
2179
  return t.style.transition = "none", t.animate(
2178
2180
  [
2179
2181
  {
2180
- transform: c,
2182
+ transform: l,
2181
2183
  width: `${n}px`,
2182
- height: `${a}px`
2184
+ height: `${s}px`
2183
2185
  },
2184
2186
  {
2185
2187
  transform: u,
2186
2188
  width: `${r}px`,
2187
- height: `${s}px`
2189
+ height: `${a}px`
2188
2190
  }
2189
2191
  ],
2190
2192
  {
2191
- duration: l,
2193
+ duration: c,
2192
2194
  easing: "cubic-bezier(0.4, 0, 0.2, 1)",
2193
2195
  fill: "forwards"
2194
2196
  }
@@ -2199,8 +2201,8 @@ class je {
2199
2201
  * Applies all focused styling properties, classes, and z-index
2200
2202
  */
2201
2203
  applyFocusedStyling(t, i) {
2202
- if (t.style.zIndex = String(i), t.classList.add("fbn-ic-focused"), st(t, this.focusedClassName), this.styling?.focused) {
2203
- const e = et(this.styling.focused, t.offsetHeight, t.offsetWidth);
2204
+ if (t.style.zIndex = String(i), t.classList.add("fbn-ic-focused"), et(t, this.focusedClassName), this.styling?.focused) {
2205
+ const e = it(this.styling.focused, t.offsetHeight, t.offsetWidth);
2204
2206
  e.borderRadius !== void 0 && (t.style.borderRadius = e.borderRadius), e.borderTopLeftRadius !== void 0 && (t.style.borderTopLeftRadius = e.borderTopLeftRadius), e.borderTopRightRadius !== void 0 && (t.style.borderTopRightRadius = e.borderTopRightRadius), e.borderBottomRightRadius !== void 0 && (t.style.borderBottomRightRadius = e.borderBottomRightRadius), e.borderBottomLeftRadius !== void 0 && (t.style.borderBottomLeftRadius = e.borderBottomLeftRadius), e.border !== void 0 && (t.style.border = e.border), e.borderTop !== void 0 && (t.style.borderTop = e.borderTop), e.borderRight !== void 0 && (t.style.borderRight = e.borderRight), e.borderBottom !== void 0 && (t.style.borderBottom = e.borderBottom), e.borderLeft !== void 0 && (t.style.borderLeft = e.borderLeft), e.boxShadow !== void 0 && (t.style.boxShadow = e.boxShadow), e.filter !== void 0 && (t.style.filter = e.filter), e.opacity !== void 0 && (t.style.opacity = e.opacity), e.cursor !== void 0 && (t.style.cursor = e.cursor), e.outline !== void 0 && (t.style.outline = e.outline), e.outlineOffset !== void 0 && (t.style.outlineOffset = e.outlineOffset), e.objectFit !== void 0 && (t.style.objectFit = e.objectFit), e.aspectRatio !== void 0 && (t.style.aspectRatio = e.aspectRatio);
2205
2207
  }
2206
2208
  }
@@ -2210,7 +2212,7 @@ class je {
2210
2212
  */
2211
2213
  removeFocusedStyling(t, i) {
2212
2214
  if (t.style.zIndex = i, t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName), this.styling?.default) {
2213
- const e = et(this.styling.default, t.offsetHeight, t.offsetWidth);
2215
+ const e = it(this.styling.default, t.offsetHeight, t.offsetWidth);
2214
2216
  e.borderRadius !== void 0 && (t.style.borderRadius = e.borderRadius), e.borderTopLeftRadius !== void 0 && (t.style.borderTopLeftRadius = e.borderTopLeftRadius), e.borderTopRightRadius !== void 0 && (t.style.borderTopRightRadius = e.borderTopRightRadius), e.borderBottomRightRadius !== void 0 && (t.style.borderBottomRightRadius = e.borderBottomRightRadius), e.borderBottomLeftRadius !== void 0 && (t.style.borderBottomLeftRadius = e.borderBottomLeftRadius), e.border !== void 0 && (t.style.border = e.border), e.borderTop !== void 0 && (t.style.borderTop = e.borderTop), e.borderRight !== void 0 && (t.style.borderRight = e.borderRight), e.borderBottom !== void 0 && (t.style.borderBottom = e.borderBottom), e.borderLeft !== void 0 && (t.style.borderLeft = e.borderLeft), e.boxShadow !== void 0 && (t.style.boxShadow = e.boxShadow), e.filter !== void 0 && (t.style.filter = e.filter), e.opacity !== void 0 && (t.style.opacity = e.opacity), e.cursor !== void 0 && (t.style.cursor = e.cursor), e.outline !== void 0 && (t.style.outline = e.outline), e.outlineOffset !== void 0 && (t.style.outlineOffset = e.outlineOffset), e.objectFit !== void 0 && (t.style.objectFit = e.objectFit), e.aspectRatio !== void 0 && (t.style.aspectRatio = e.aspectRatio);
2215
2217
  }
2216
2218
  }
@@ -2221,11 +2223,11 @@ class je {
2221
2223
  startClipPathAnimation(t, i, e) {
2222
2224
  let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
2223
2225
  e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
2224
- const a = () => {
2225
- const r = t.offsetHeight, s = t.offsetWidth, l = et(n, r, s);
2226
- l.clipPath !== void 0 ? t.style.clipPath = l.clipPath : t.style.clipPath = "unset", l.overflow !== void 0 && (t.style.overflow = l.overflow), i.animation.playState === "running" && requestAnimationFrame(a);
2226
+ const s = () => {
2227
+ const r = t.offsetHeight, a = t.offsetWidth, c = it(n, r, a);
2228
+ c.clipPath !== void 0 ? t.style.clipPath = c.clipPath : t.style.clipPath = "unset", c.overflow !== void 0 && (t.style.overflow = c.overflow), i.animation.playState === "running" && requestAnimationFrame(s);
2227
2229
  };
2228
- requestAnimationFrame(a);
2230
+ requestAnimationFrame(s);
2229
2231
  }
2230
2232
  /**
2231
2233
  * Start focus animation for an image using dimension-based zoom
@@ -2233,8 +2235,8 @@ class je {
2233
2235
  * @param fromTransform - Optional starting transform (for mid-animation reversals)
2234
2236
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2235
2237
  */
2236
- startFocusAnimation(t, i, e, n, a) {
2237
- const r = t.style.zIndex || "", s = t.offsetWidth, l = t.offsetHeight, c = this.calculateFocusDimensions(s, l, i), u = this.calculateFocusTransform(i, e);
2238
+ startFocusAnimation(t, i, e, n, s) {
2239
+ const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2238
2240
  this.animationEngine.cancelAllAnimations(t);
2239
2241
  const h = this.config.animationDuration ?? 600;
2240
2242
  this.applyFocusedStyling(t, Ft.FOCUSING);
@@ -2244,16 +2246,16 @@ class je {
2244
2246
  rotation: e.rotation,
2245
2247
  scale: 1
2246
2248
  // No scale - using dimensions
2247
- }, f = a?.width ?? s, y = a?.height ?? l, p = this.animateWithDimensions(
2249
+ }, g = s?.width ?? a, b = s?.height ?? c, p = this.animateWithDimensions(
2248
2250
  t,
2249
2251
  d,
2250
2252
  u,
2251
- f,
2252
- y,
2253
- c.width,
2254
- c.height,
2253
+ g,
2254
+ b,
2255
+ l.width,
2256
+ l.height,
2255
2257
  h
2256
- ), g = {
2258
+ ), f = {
2257
2259
  id: `focus-${Date.now()}`,
2258
2260
  element: t,
2259
2261
  animation: p,
@@ -2267,17 +2269,17 @@ class je {
2267
2269
  originalState: e,
2268
2270
  focusTransform: u,
2269
2271
  originalZIndex: r,
2270
- originalWidth: s,
2271
- originalHeight: l,
2272
- focusWidth: c.width,
2273
- focusHeight: c.height
2274
- }, this.startClipPathAnimation(t, g, !0), {
2272
+ originalWidth: a,
2273
+ originalHeight: c,
2274
+ focusWidth: l.width,
2275
+ focusHeight: l.height
2276
+ }, this.startClipPathAnimation(t, f, !0), {
2275
2277
  element: t,
2276
2278
  originalState: e,
2277
- animationHandle: g,
2279
+ animationHandle: f,
2278
2280
  direction: "in",
2279
- originalWidth: s,
2280
- originalHeight: l
2281
+ originalWidth: a,
2282
+ originalHeight: c
2281
2283
  };
2282
2284
  }
2283
2285
  /**
@@ -2287,9 +2289,9 @@ class je {
2287
2289
  */
2288
2290
  startUnfocusAnimation(t, i, e, n) {
2289
2291
  t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2290
- const a = this.config.animationDuration ?? 600;
2292
+ const s = this.config.animationDuration ?? 600;
2291
2293
  t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
2292
- const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, l = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, c = {
2294
+ const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
2293
2295
  x: 0,
2294
2296
  y: 0,
2295
2297
  rotation: i.rotation,
@@ -2298,25 +2300,25 @@ class je {
2298
2300
  }, u = this.focusData?.originalWidth ?? t.offsetWidth, h = this.focusData?.originalHeight ?? t.offsetHeight, d = this.animateWithDimensions(
2299
2301
  t,
2300
2302
  r,
2301
- c,
2302
- s,
2303
2303
  l,
2304
+ a,
2305
+ c,
2304
2306
  u,
2305
2307
  h,
2306
- a
2307
- ), f = {
2308
+ s
2309
+ ), g = {
2308
2310
  id: `unfocus-${Date.now()}`,
2309
2311
  element: t,
2310
2312
  animation: d,
2311
2313
  fromState: r,
2312
- toState: c,
2314
+ toState: l,
2313
2315
  startTime: performance.now(),
2314
- duration: a
2316
+ duration: s
2315
2317
  };
2316
- return this.startClipPathAnimation(t, f, !1), {
2318
+ return this.startClipPathAnimation(t, g, !1), {
2317
2319
  element: t,
2318
2320
  originalState: i,
2319
- animationHandle: f,
2321
+ animationHandle: g,
2320
2322
  direction: "out",
2321
2323
  originalWidth: u,
2322
2324
  originalHeight: h
@@ -2337,10 +2339,10 @@ class je {
2337
2339
  * Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
2338
2340
  */
2339
2341
  captureMidAnimationState(t) {
2340
- const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, a = t.offsetHeight, r = e.e + n * 0.5, s = e.f + a * 0.5, l = Math.atan2(e.b, e.a) * (180 / Math.PI);
2341
- return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${l}deg)`, t.style.transition = "none", {
2342
- transform: { x: r, y: s, rotation: l, scale: 1 },
2343
- dimensions: { width: n, height: a }
2342
+ const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, s = t.offsetHeight, r = e.e + n * 0.5, a = e.f + s * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
2343
+ return t.style.width = `${n}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${c}deg)`, t.style.transition = "none", {
2344
+ transform: { x: r, y: a, rotation: c, scale: 1 },
2345
+ dimensions: { width: n, height: s }
2344
2346
  };
2345
2347
  }
2346
2348
  /**
@@ -2355,10 +2357,10 @@ class je {
2355
2357
  /**
2356
2358
  * Reset an element instantly to its original position and dimensions (no animation)
2357
2359
  */
2358
- resetElementInstantly(t, i, e, n, a) {
2360
+ resetElementInstantly(t, i, e, n, s) {
2359
2361
  this.animationEngine.cancelAllAnimations(t);
2360
2362
  const r = ["translate(-50%, -50%)"];
2361
- r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), n !== void 0 && a !== void 0 && (t.style.width = `${n}px`, t.style.height = `${a}px`), this.removeFocusedStyling(t, e);
2363
+ r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), n !== void 0 && s !== void 0 && (t.style.width = `${n}px`, t.style.height = `${s}px`), this.removeFocusedStyling(t, e);
2362
2364
  }
2363
2365
  /**
2364
2366
  * Focus (zoom) an image to center of container
@@ -2368,11 +2370,11 @@ class je {
2368
2370
  if (this.currentFocus === t && this.state === x.FOCUSED)
2369
2371
  return this.unfocusImage();
2370
2372
  if (this.incoming?.element === t && this.state === x.FOCUSING) {
2371
- const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
2373
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2372
2374
  this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
2373
2375
  t,
2374
2376
  this.incoming.originalState,
2375
- a,
2377
+ s,
2376
2378
  r
2377
2379
  ), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE;
2378
2380
  return;
@@ -2393,8 +2395,8 @@ class je {
2393
2395
  ]), this.focusGeneration !== n)
2394
2396
  return;
2395
2397
  if (this.outgoing) {
2396
- const a = this.outgoing.element;
2397
- this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2398
+ const s = this.outgoing.element;
2399
+ this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2398
2400
  }
2399
2401
  this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2400
2402
  break;
@@ -2414,8 +2416,8 @@ class je {
2414
2416
  this.waitForAnimation(this.incoming.animationHandle)
2415
2417
  ]), this.focusGeneration !== n) return;
2416
2418
  if (this.outgoing) {
2417
- const a = this.outgoing.element;
2418
- this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2419
+ const s = this.outgoing.element;
2420
+ this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2419
2421
  }
2420
2422
  this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2421
2423
  break;
@@ -2423,24 +2425,24 @@ class je {
2423
2425
  if (this.incoming?.element === t)
2424
2426
  return;
2425
2427
  if (this.outgoing?.element === t) {
2426
- const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
2428
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2427
2429
  if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
2428
- const { transform: s, dimensions: l } = this.captureMidAnimationState(this.incoming.element);
2430
+ const { transform: a, dimensions: c } = this.captureMidAnimationState(this.incoming.element);
2429
2431
  this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2430
2432
  this.incoming.element,
2431
2433
  this.incoming.originalState,
2432
- s,
2433
- l
2434
+ a,
2435
+ c
2434
2436
  );
2435
2437
  } else
2436
2438
  this.outgoing = null;
2437
- if (this.incoming = this.startFocusAnimation(t, i, e, a, r), await Promise.all([
2439
+ if (this.incoming = this.startFocusAnimation(t, i, e, s, r), await Promise.all([
2438
2440
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2439
2441
  this.waitForAnimation(this.incoming.animationHandle)
2440
2442
  ]), this.focusGeneration !== n) return;
2441
2443
  if (this.outgoing) {
2442
- const s = this.outgoing.element;
2443
- this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2444
+ const a = this.outgoing.element;
2445
+ this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2444
2446
  }
2445
2447
  this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2446
2448
  return;
@@ -2452,11 +2454,11 @@ class je {
2452
2454
  this.outgoing.originalWidth,
2453
2455
  this.outgoing.originalHeight
2454
2456
  ), this.outgoing = null), this.incoming) {
2455
- const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2457
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2456
2458
  this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2457
2459
  this.incoming.element,
2458
2460
  this.incoming.originalState,
2459
- a,
2461
+ s,
2460
2462
  r
2461
2463
  );
2462
2464
  }
@@ -2465,8 +2467,8 @@ class je {
2465
2467
  this.waitForAnimation(this.incoming.animationHandle)
2466
2468
  ]), this.focusGeneration !== n) return;
2467
2469
  if (this.outgoing) {
2468
- const a = this.outgoing.element;
2469
- this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2470
+ const s = this.outgoing.element;
2471
+ this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2470
2472
  }
2471
2473
  this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2472
2474
  break;
@@ -2481,35 +2483,35 @@ class je {
2481
2483
  const t = ++this.focusGeneration;
2482
2484
  if (!this.currentFocus || !this.focusData) {
2483
2485
  if (this.incoming && this.state === x.FOCUSING) {
2484
- const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2486
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2485
2487
  if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2486
2488
  this.incoming.element,
2487
2489
  this.incoming.originalState,
2488
- a,
2490
+ s,
2489
2491
  r
2490
2492
  ), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2491
- const s = this.outgoing.element;
2492
- this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(s);
2493
+ const a = this.outgoing.element;
2494
+ this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(a);
2493
2495
  }
2494
2496
  return;
2495
2497
  }
2496
2498
  if (this.state === x.CROSS_ANIMATING && this.incoming) {
2497
- const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2499
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2498
2500
  this.animationEngine.cancelAllAnimations(this.incoming.element);
2499
- const s = this.startUnfocusAnimation(
2501
+ const a = this.startUnfocusAnimation(
2500
2502
  this.incoming.element,
2501
2503
  this.incoming.originalState,
2502
- a,
2504
+ s,
2503
2505
  r
2504
2506
  );
2505
2507
  if (await Promise.all([
2506
2508
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2507
- this.waitForAnimation(s.animationHandle)
2509
+ this.waitForAnimation(a.animationHandle)
2508
2510
  ]), this.focusGeneration !== t) return;
2509
- let l = null;
2510
- this.outgoing && (l = this.outgoing.element, this.removeFocusedStyling(l, this.outgoing.originalState.zIndex?.toString() || ""));
2511
- const c = s.element;
2512
- this.removeFocusedStyling(c, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, l && this.onUnfocusComplete?.(l), this.onUnfocusComplete?.(c);
2511
+ let c = null;
2512
+ this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
2513
+ const l = a.element;
2514
+ this.removeFocusedStyling(l, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(l);
2513
2515
  return;
2514
2516
  }
2515
2517
  this.state = x.UNFOCUSING;
@@ -2554,8 +2556,8 @@ class je {
2554
2556
  */
2555
2557
  setDragOffset(t) {
2556
2558
  if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2557
- const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], a = (e.x ?? 0) + t, r = e.y ?? 0;
2558
- n.push(`translate(${a}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
2559
+ const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
2560
+ n.push(`translate(${s}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
2559
2561
  }
2560
2562
  /**
2561
2563
  * Clear the drag offset, optionally animating back to center
@@ -2564,12 +2566,12 @@ class je {
2564
2566
  */
2565
2567
  clearDragOffset(t, i = 150) {
2566
2568
  if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2567
- const e = this.currentFocus, n = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = n.x ?? 0, s = n.y ?? 0;
2568
- a.push(`translate(${r}px, ${s}px)`), n.rotation !== void 0 && a.push(`rotate(${n.rotation}deg)`);
2569
- const l = a.join(" ");
2570
- t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = l, setTimeout(() => {
2569
+ const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
2570
+ s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
2571
+ const c = s.join(" ");
2572
+ t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = c, setTimeout(() => {
2571
2573
  this.currentFocus === e && (e.style.transition = "none");
2572
- }, i)) : (e.style.transition = "none", e.style.transform = l);
2574
+ }, i)) : (e.style.transition = "none", e.style.transform = c);
2573
2575
  }
2574
2576
  /**
2575
2577
  * Reset zoom state (cancels all animations)
@@ -2596,7 +2598,7 @@ class je {
2596
2598
  ), this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2597
2599
  }
2598
2600
  }
2599
- const We = 50, Ge = 0.5, qe = 20, Be = 0.3, Xe = 150, Ye = 30, at = class at {
2601
+ const je = 50, We = 0.5, Ge = 20, qe = 0.3, Xe = 150, Ye = 30, rt = class rt {
2600
2602
  constructor(t, i) {
2601
2603
  this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = i, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
2602
2604
  }
@@ -2623,7 +2625,7 @@ const We = 50, Ge = 0.5, qe = 20, Be = 0.3, Xe = 150, Ye = 30, at = class at {
2623
2625
  * Used to prevent click-outside from unfocusing immediately after touch
2624
2626
  */
2625
2627
  hadRecentTouch() {
2626
- return Date.now() - this.recentTouchTimestamp < at.TOUCH_CLICK_DELAY;
2628
+ return Date.now() - this.recentTouchTimestamp < rt.TOUCH_CLICK_DELAY;
2627
2629
  }
2628
2630
  handleTouchStart(t) {
2629
2631
  if (t.touches.length !== 1) return;
@@ -2642,28 +2644,28 @@ const We = 50, Ge = 0.5, qe = 20, Be = 0.3, Xe = 150, Ye = 30, at = class at {
2642
2644
  if (!this.touchState || t.touches.length !== 1) return;
2643
2645
  const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
2644
2646
  if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
2645
- const s = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2646
- this.touchState.isHorizontalSwipe = s <= Ye;
2647
+ const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2648
+ this.touchState.isHorizontalSwipe = a <= Ye;
2647
2649
  }
2648
2650
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
2649
2651
  t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
2650
- const a = e * Be;
2651
- this.callbacks.onDragOffset(a);
2652
+ const s = e * qe;
2653
+ this.callbacks.onDragOffset(s);
2652
2654
  }
2653
2655
  }
2654
2656
  handleTouchEnd(t) {
2655
2657
  if (!this.touchState) return;
2656
2658
  this.recentTouchTimestamp = Date.now();
2657
- const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, a = Math.abs(i);
2659
+ const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
2658
2660
  let r = !1;
2659
- this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= We || n >= Ge && a >= qe) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2661
+ this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= je || n >= We && s >= Ge) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2660
2662
  }
2661
2663
  handleTouchCancel(t) {
2662
2664
  this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
2663
2665
  }
2664
2666
  };
2665
- at.TOUCH_CLICK_DELAY = 300;
2666
- let yt = at;
2667
+ rt.TOUCH_CLICK_DELAY = 300;
2668
+ let bt = rt;
2667
2669
  class Je {
2668
2670
  constructor(t) {
2669
2671
  if (this._prepared = !1, this._discoveredUrls = [], this.apiKey = t.apiKey ?? "", this.apiEndpoint = t.apiEndpoint ?? "https://www.googleapis.com/drive/v3/files", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
@@ -2678,8 +2680,8 @@ class Je {
2678
2680
  for (const i of this.sources)
2679
2681
  if ("folders" in i)
2680
2682
  for (const e of i.folders) {
2681
- const n = i.recursive !== void 0 ? i.recursive : !0, a = await this.loadFromFolder(e, t, n);
2682
- this._discoveredUrls.push(...a);
2683
+ const n = i.recursive !== void 0 ? i.recursive : !0, s = await this.loadFromFolder(e, t, n);
2684
+ this._discoveredUrls.push(...s);
2683
2685
  }
2684
2686
  else if ("files" in i) {
2685
2687
  const e = await this.loadFiles(i.files, t);
@@ -2745,8 +2747,8 @@ class Je {
2745
2747
  return this.loadImagesDirectly(n, i);
2746
2748
  try {
2747
2749
  return e ? await this.loadImagesRecursively(n, i) : await this.loadImagesFromSingleFolder(n, i);
2748
- } catch (a) {
2749
- return console.error("Error loading from Google Drive API:", a), this.loadImagesDirectly(n, i);
2750
+ } catch (s) {
2751
+ return console.error("Error loading from Google Drive API:", s), this.loadImagesDirectly(n, i);
2750
2752
  }
2751
2753
  }
2752
2754
  /**
@@ -2756,13 +2758,13 @@ class Je {
2756
2758
  * @returns Promise resolving to array of image URLs
2757
2759
  */
2758
2760
  async loadImagesFromSingleFolder(t, i) {
2759
- const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
2760
- if (!s.ok)
2761
- throw new Error(`API request failed: ${s.status} ${s.statusText}`);
2762
- const c = (await s.json()).files.filter(
2761
+ const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2762
+ if (!a.ok)
2763
+ throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2764
+ const l = (await a.json()).files.filter(
2763
2765
  (u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
2764
2766
  );
2765
- return this.log(`Found ${c.length} images in folder ${t} (non-recursive)`), c.forEach((u) => {
2767
+ return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
2766
2768
  e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
2767
2769
  }), e;
2768
2770
  }
@@ -2775,24 +2777,24 @@ class Je {
2775
2777
  async loadFiles(t, i) {
2776
2778
  const e = [];
2777
2779
  for (const n of t) {
2778
- const a = this.extractFileId(n);
2779
- if (!a) {
2780
+ const s = this.extractFileId(n);
2781
+ if (!s) {
2780
2782
  this.log(`Skipping invalid file URL: ${n}`);
2781
2783
  continue;
2782
2784
  }
2783
2785
  if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
2784
2786
  try {
2785
- const r = `${this.apiEndpoint}/${a}?fields=name,mimeType&key=${this.apiKey}`, s = await fetch(r);
2786
- if (s.ok) {
2787
- const l = await s.json();
2788
- l.mimeType.startsWith("image/") && i.isAllowed(l.name) ? (e.push(`https://lh3.googleusercontent.com/d/${a}=s1600`), this.log(`Added file: ${l.name}`)) : this.log(`Skipping non-image file: ${l.name} (${l.mimeType})`);
2787
+ const r = `${this.apiEndpoint}/${s}?fields=name,mimeType&key=${this.apiKey}`, a = await fetch(r);
2788
+ if (a.ok) {
2789
+ const c = await a.json();
2790
+ c.mimeType.startsWith("image/") && i.isAllowed(c.name) ? (e.push(`https://lh3.googleusercontent.com/d/${s}=s1600`), this.log(`Added file: ${c.name}`)) : this.log(`Skipping non-image file: ${c.name} (${c.mimeType})`);
2789
2791
  } else
2790
- this.log(`Failed to fetch metadata for file ${a}: ${s.status}`);
2792
+ this.log(`Failed to fetch metadata for file ${s}: ${a.status}`);
2791
2793
  } catch (r) {
2792
- this.log(`Error fetching metadata for file ${a}:`, r);
2794
+ this.log(`Error fetching metadata for file ${s}:`, r);
2793
2795
  }
2794
2796
  else
2795
- e.push(`https://lh3.googleusercontent.com/d/${a}=s1600`);
2797
+ e.push(`https://lh3.googleusercontent.com/d/${s}=s1600`);
2796
2798
  }
2797
2799
  return e;
2798
2800
  }
@@ -2826,15 +2828,15 @@ class Je {
2826
2828
  * @returns Promise resolving to array of image URLs
2827
2829
  */
2828
2830
  async loadImagesRecursively(t, i) {
2829
- const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
2830
- if (!s.ok)
2831
- throw new Error(`API request failed: ${s.status} ${s.statusText}`);
2832
- const l = await s.json(), c = l.files.filter(
2831
+ const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2832
+ if (!a.ok)
2833
+ throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2834
+ const c = await a.json(), l = c.files.filter(
2833
2835
  (h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
2834
- ), u = l.files.filter(
2836
+ ), u = c.files.filter(
2835
2837
  (h) => h.mimeType === "application/vnd.google-apps.folder"
2836
2838
  );
2837
- this.log(`Found ${l.files.length} total items in folder ${t}`), l.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${c.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), c.forEach((h) => {
2839
+ this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), l.forEach((h) => {
2838
2840
  e.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
2839
2841
  });
2840
2842
  for (const h of u) {
@@ -2856,8 +2858,8 @@ class Je {
2856
2858
  const e = `https://drive.google.com/embeddedfolderview?id=${t}`, n = await fetch(e, { mode: "cors" });
2857
2859
  if (!n.ok)
2858
2860
  throw new Error("Cannot access folder directly (CORS or permissions issue)");
2859
- const a = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, s = [...a.matchAll(r)];
2860
- return [...new Set(s.map((u) => u[1]))].map(
2861
+ const s = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(r)];
2862
+ return [...new Set(a.map((u) => u[1]))].map(
2861
2863
  (u) => `https://drive.google.com/uc?export=view&id=${u}`
2862
2864
  );
2863
2865
  } catch (e) {
@@ -2950,8 +2952,8 @@ class Ve {
2950
2952
  return console.warn("URLs must be an array:", t), [];
2951
2953
  const e = [];
2952
2954
  for (const n of t) {
2953
- const a = n.split("/").pop() || n;
2954
- if (!i.isAllowed(a)) {
2955
+ const s = n.split("/").pop() || n;
2956
+ if (!i.isAllowed(s)) {
2955
2957
  this.log(`Skipping filtered URL: ${n}`);
2956
2958
  continue;
2957
2959
  }
@@ -2970,12 +2972,12 @@ class Ve {
2970
2972
  if (!Array.isArray(i))
2971
2973
  return console.warn("files must be an array:", i), [];
2972
2974
  const n = [];
2973
- for (const a of i) {
2974
- if (!e.isAllowed(a)) {
2975
- this.log(`Skipping filtered file: ${a}`);
2975
+ for (const s of i) {
2976
+ if (!e.isAllowed(s)) {
2977
+ this.log(`Skipping filtered file: ${s}`);
2976
2978
  continue;
2977
2979
  }
2978
- const r = this.constructUrl(t, a);
2980
+ const r = this.constructUrl(t, s);
2979
2981
  this.validateUrls ? await this.validateUrl(r) ? n.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : n.push(r);
2980
2982
  }
2981
2983
  return n;
@@ -2991,15 +2993,15 @@ class Ve {
2991
2993
  this.log(`Fetching JSON endpoint: ${t}`);
2992
2994
  const e = new AbortController(), n = setTimeout(() => e.abort(), 1e4);
2993
2995
  try {
2994
- const a = await fetch(t, { signal: e.signal });
2995
- if (clearTimeout(n), !a.ok)
2996
- throw new Error(`HTTP ${a.status} fetching ${t}`);
2997
- const r = await a.json();
2996
+ const s = await fetch(t, { signal: e.signal });
2997
+ if (clearTimeout(n), !s.ok)
2998
+ throw new Error(`HTTP ${s.status} fetching ${t}`);
2999
+ const r = await s.json();
2998
3000
  if (!r || !Array.isArray(r.images))
2999
3001
  throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
3000
3002
  return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, i);
3001
- } catch (a) {
3002
- throw clearTimeout(n), a instanceof Error && a.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : a;
3003
+ } catch (s) {
3004
+ throw clearTimeout(n), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : s;
3003
3005
  }
3004
3006
  }
3005
3007
  /**
@@ -3021,11 +3023,11 @@ class Ve {
3021
3023
  if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
3022
3024
  return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
3023
3025
  try {
3024
- const e = new AbortController(), n = setTimeout(() => e.abort(), this.validationTimeout), a = await fetch(t, {
3026
+ const e = new AbortController(), n = setTimeout(() => e.abort(), this.validationTimeout), s = await fetch(t, {
3025
3027
  method: "HEAD",
3026
3028
  signal: e.signal
3027
3029
  });
3028
- return clearTimeout(n), a.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${a.status}`), !1);
3030
+ return clearTimeout(n), s.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${s.status}`), !1);
3029
3031
  } catch (e) {
3030
3032
  return e instanceof Error && (e.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, e.message)), !1;
3031
3033
  }
@@ -3079,8 +3081,8 @@ class Ke {
3079
3081
  this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
3080
3082
  const i = this.loaders.map((e, n) => e.prepare(t).then(() => {
3081
3083
  this.log(`Loader ${n} prepared with ${e.imagesLength()} images`);
3082
- }).catch((a) => {
3083
- console.warn(`Loader ${n} failed to prepare:`, a);
3084
+ }).catch((s) => {
3085
+ console.warn(`Loader ${n} failed to prepare:`, s);
3084
3086
  }));
3085
3087
  await Promise.all(i);
3086
3088
  for (const e of this.loaders)
@@ -3205,6 +3207,37 @@ const Qe = `
3205
3207
  pointer-events: none;
3206
3208
  }
3207
3209
 
3210
+ .fbn-ic-gallery:focus,
3211
+ .fbn-ic-gallery.fbn-ic-has-focus {
3212
+ outline: 2px solid rgba(147, 197, 253, 0.8);
3213
+ outline-offset: -4px;
3214
+ }
3215
+ .fbn-ic-gallery.fbn-ic-suppress-outline:focus {
3216
+ outline: none;
3217
+ }
3218
+ .fbn-ic-gallery.fbn-ic-suppress-outline.fbn-ic-has-focus {
3219
+ outline: 2px solid rgba(99, 102, 241, 0.6);
3220
+ outline-offset: -4px;
3221
+ }
3222
+
3223
+ .fbn-ic-nav-btn {
3224
+ position: absolute;
3225
+ top: 50%;
3226
+ transform: translateY(-50%);
3227
+ z-index: 10001;
3228
+ cursor: pointer;
3229
+ border: none;
3230
+ background: none;
3231
+ padding: 0;
3232
+ line-height: 1;
3233
+ }
3234
+ .fbn-ic-nav-btn-prev {
3235
+ left: 12px;
3236
+ }
3237
+ .fbn-ic-nav-btn-next {
3238
+ right: 12px;
3239
+ }
3240
+
3208
3241
  .fbn-ic-hidden {
3209
3242
  display: none !important;
3210
3243
  }
@@ -3218,11 +3251,11 @@ function ti() {
3218
3251
  }
3219
3252
  class ei {
3220
3253
  constructor(t = {}) {
3221
- this.fullConfig = te(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new oe(this.fullConfig.animation), this.layoutEngine = new _e({
3254
+ this.fullConfig = te(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new oe(this.fullConfig.animation), this.layoutEngine = new De({
3222
3255
  layout: this.fullConfig.layout,
3223
3256
  image: this.fullConfig.image
3224
- }), this.zoomEngine = new je(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = et(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
3225
- const i = this.fullConfig.animation.entry || R.animation.entry;
3257
+ }), this.zoomEngine = new Be(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
3258
+ const i = this.fullConfig.animation.entry || A.animation.entry;
3226
3259
  this.entryAnimationEngine = new me(
3227
3260
  i,
3228
3261
  this.fullConfig.layout.algorithm
@@ -3233,6 +3266,16 @@ class ei {
3233
3266
  i.timing?.duration ?? 600
3234
3267
  ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
3235
3268
  this.idleAnimationEngine?.resumeForImage(n);
3269
+ const s = n;
3270
+ requestAnimationFrame(() => {
3271
+ if (s.matches(":hover") && this.fullConfig.styling?.hover) {
3272
+ const r = this.imageElements.indexOf(s);
3273
+ if (r !== -1) {
3274
+ const a = s.offsetHeight, c = s.cachedRenderedWidth;
3275
+ st(s, this.fullConfig.styling.hover, a, c), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[r] };
3276
+ }
3277
+ }
3278
+ });
3236
3279
  }), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
3237
3280
  }
3238
3281
  /**
@@ -3289,7 +3332,7 @@ class ei {
3289
3332
  this.containerEl = this.containerRef;
3290
3333
  else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
3291
3334
  throw new Error(`Container #${this.containerId} not found`);
3292
- this.containerEl.classList.add("fbn-ic-gallery"), this.containerEl.setAttribute("tabindex", "0"), this.fullConfig.interaction.navigation?.swipe !== !1 && (this.swipeEngine = new yt(this.containerEl, {
3335
+ this.containerEl.classList.add("fbn-ic-gallery"), this.containerEl.setAttribute("tabindex", "0"), this.fullConfig.interaction.navigation?.swipe !== !1 && (this.swipeEngine = new bt(this.containerEl, {
3293
3336
  onNext: () => this.navigateToNextImage(),
3294
3337
  onPrev: () => this.navigateToPreviousImage(),
3295
3338
  onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
@@ -3303,7 +3346,11 @@ class ei {
3303
3346
  }
3304
3347
  setupUI() {
3305
3348
  const t = this.fullConfig.ui;
3306
- t.showLoadingSpinner && (t.loadingElement ? (this.loadingEl = this.resolveElement(t.loadingElement), this.loadingElAutoCreated = !1) : (this.loadingEl = this.createDefaultLoadingElement(), this.loadingElAutoCreated = !0)), t.errorElement ? (this.errorEl = this.resolveElement(t.errorElement), this.errorElAutoCreated = !1) : (this.errorEl = this.createDefaultErrorElement(), this.errorElAutoCreated = !0), t.showImageCounter && (t.counterElement ? (this.counterEl = this.resolveElement(t.counterElement), this.counterElAutoCreated = !1) : (this.counterEl = this.createDefaultCounterElement(), this.counterElAutoCreated = !0));
3349
+ t.showFocusOutline ? this.containerEl?.classList.remove("fbn-ic-suppress-outline") : this.containerEl?.classList.add("fbn-ic-suppress-outline"), t.showLoadingSpinner && (t.loadingElement ? (this.loadingEl = this.resolveElement(t.loadingElement), this.loadingElAutoCreated = !1) : (this.loadingEl = this.createDefaultLoadingElement(), this.loadingElAutoCreated = !0)), t.errorElement ? (this.errorEl = this.resolveElement(t.errorElement), this.errorElAutoCreated = !1) : (this.errorEl = this.createDefaultErrorElement(), this.errorElAutoCreated = !0), t.showImageCounter && (t.counterElement ? (this.counterEl = this.resolveElement(t.counterElement), this.counterElAutoCreated = !1) : (this.counterEl = this.createDefaultCounterElement(), this.counterElAutoCreated = !0)), t.showNavButtons && (t.prevButtonElement ? (this.prevButtonEl = this.resolveElement(t.prevButtonElement), this.prevButtonElAutoCreated = !1) : (this.prevButtonEl = this.createDefaultPrevButtonElement(), this.prevButtonElAutoCreated = !0), t.nextButtonElement ? (this.nextButtonEl = this.resolveElement(t.nextButtonElement), this.nextButtonElAutoCreated = !1) : (this.nextButtonEl = this.createDefaultNextButtonElement(), this.nextButtonElAutoCreated = !0), this.prevButtonEl?.addEventListener("click", (i) => {
3350
+ i.stopPropagation(), this.navigateToPreviousImage();
3351
+ }), this.nextButtonEl?.addEventListener("click", (i) => {
3352
+ i.stopPropagation(), this.navigateToNextImage();
3353
+ }));
3307
3354
  }
3308
3355
  resolveElement(t) {
3309
3356
  return t instanceof HTMLElement ? t : document.getElementById(t);
@@ -3324,11 +3371,19 @@ class ei {
3324
3371
  const t = document.createElement("div");
3325
3372
  return t.className = "fbn-ic-counter fbn-ic-hidden", this.containerEl.appendChild(t), t;
3326
3373
  }
3374
+ createDefaultPrevButtonElement() {
3375
+ const t = document.createElement("button");
3376
+ return t.className = "fbn-ic-nav-btn fbn-ic-nav-btn-prev fbn-ic-hidden", t.textContent = "‹", t.setAttribute("aria-label", "Previous image"), t.setAttribute("tabindex", "-1"), this.containerEl.appendChild(t), t;
3377
+ }
3378
+ createDefaultNextButtonElement() {
3379
+ const t = document.createElement("button");
3380
+ return t.className = "fbn-ic-nav-btn fbn-ic-nav-btn-next fbn-ic-hidden", t.textContent = "›", t.setAttribute("aria-label", "Next image"), t.setAttribute("tabindex", "-1"), this.containerEl.appendChild(t), t;
3381
+ }
3327
3382
  setupEventListeners() {
3328
3383
  this.fullConfig.interaction.navigation?.keyboard !== !1 && this.containerEl.addEventListener("keydown", (t) => {
3329
- t.key === "Escape" ? (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter()) : t.key === "ArrowRight" ? this.navigateToNextImage() : t.key === "ArrowLeft" ? this.navigateToPreviousImage() : (t.key === "Enter" || t.key === " ") && this.hoveredImage && (this.handleImageClick(this.hoveredImage.element, this.hoveredImage.layout), t.preventDefault());
3384
+ t.key === "Escape" ? (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.hideFocusIndicator()) : t.key === "ArrowRight" ? this.navigateToNextImage() : t.key === "ArrowLeft" ? this.navigateToPreviousImage() : (t.key === "Enter" || t.key === " ") && this.hoveredImage && (this.handleImageClick(this.hoveredImage.element, this.hoveredImage.layout), t.preventDefault());
3330
3385
  }), document.addEventListener("click", (t) => {
3331
- this.swipeEngine?.hadRecentTouch() || t.target.closest(".fbn-ic-image") || (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter());
3386
+ this.swipeEngine?.hadRecentTouch() || !t.target.closest(".fbn-ic-image") && !t.target.closest(".fbn-ic-nav-btn") && (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.hideFocusIndicator());
3332
3387
  }), window.addEventListener("resize", () => this.handleResize());
3333
3388
  }
3334
3389
  /**
@@ -3341,7 +3396,7 @@ class ei {
3341
3396
  );
3342
3397
  if (!i) return;
3343
3398
  const e = this.imageLayouts[t];
3344
- e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t));
3399
+ e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t), this.showNavButtons(), this.showFocusIndicator());
3345
3400
  }
3346
3401
  /**
3347
3402
  * Navigate to the previous image (Left arrow)
@@ -3353,7 +3408,7 @@ class ei {
3353
3408
  );
3354
3409
  if (!i) return;
3355
3410
  const e = this.imageLayouts[t];
3356
- e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t));
3411
+ e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t), this.showNavButtons(), this.showFocusIndicator());
3357
3412
  }
3358
3413
  /**
3359
3414
  * Navigate to a specific image by index
@@ -3389,13 +3444,13 @@ class ei {
3389
3444
  this.showError("No images found."), this.showLoading(!1);
3390
3445
  return;
3391
3446
  }
3392
- const e = this.getContainerBounds(), n = this.getImageHeight(), a = window.innerWidth;
3447
+ const e = this.getContainerBounds(), n = this.getImageHeight(), s = window.innerWidth;
3393
3448
  this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${n}px`);
3394
3449
  const r = this.layoutEngine.calculateAdaptiveSize(
3395
3450
  e,
3396
3451
  t,
3397
3452
  n,
3398
- a
3453
+ s
3399
3454
  );
3400
3455
  this.logDebug(`Adaptive sizing result: height=${r.height}px`), await this.createImageCloud(i, r.height), this.showLoading(!1), this.imagesLoaded = !0;
3401
3456
  } catch (t) {
@@ -3412,62 +3467,62 @@ class ei {
3412
3467
  if (!this.containerEl) return;
3413
3468
  const e = this.getContainerBounds();
3414
3469
  this.currentImageHeight = i;
3415
- const n = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3416
- this.imageLayouts = a, this.displayQueue = [];
3470
+ const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3471
+ this.imageLayouts = s, this.displayQueue = [];
3417
3472
  let r = 0;
3418
- const s = (c) => {
3419
- this.containerEl && (this.containerEl.appendChild(c), this.imageElements.push(c), requestAnimationFrame(() => {
3420
- if (c.offsetWidth, c.style.opacity = this.defaultStyles.opacity ?? "1", c.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || c.dataset.startRotation !== c.dataset.rotation || c.dataset.startScale !== c.dataset.scale)) {
3473
+ const a = (l) => {
3474
+ this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(() => {
3475
+ if (l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1", l.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)) {
3421
3476
  const d = {
3422
- x: parseFloat(c.dataset.startX),
3423
- y: parseFloat(c.dataset.startY)
3424
- }, f = {
3425
- x: parseFloat(c.dataset.endX),
3426
- y: parseFloat(c.dataset.endY)
3427
- }, y = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation), m = parseFloat(c.dataset.scale), b = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : g, w = c.dataset.startScale ? parseFloat(c.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
3477
+ x: parseFloat(l.dataset.startX),
3478
+ y: parseFloat(l.dataset.startY)
3479
+ }, g = {
3480
+ x: parseFloat(l.dataset.endX),
3481
+ y: parseFloat(l.dataset.endY)
3482
+ }, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), f = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : f, E = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
3428
3483
  ue({
3429
- element: c,
3484
+ element: l,
3430
3485
  startPosition: d,
3431
- endPosition: f,
3486
+ endPosition: g,
3432
3487
  pathConfig: this.entryAnimationEngine.getPathConfig(),
3433
3488
  duration: v.duration,
3434
- imageWidth: y,
3489
+ imageWidth: b,
3435
3490
  imageHeight: p,
3436
- rotation: g,
3491
+ rotation: f,
3437
3492
  scale: m,
3438
3493
  rotationConfig: this.entryAnimationEngine.getRotationConfig(),
3439
- startRotation: b,
3494
+ startRotation: y,
3440
3495
  scaleConfig: this.entryAnimationEngine.getScaleConfig(),
3441
- startScale: w
3496
+ startScale: E
3442
3497
  });
3443
3498
  } else {
3444
- const d = c.dataset.finalTransform || "";
3445
- c.style.transform = d;
3499
+ const d = l.dataset.finalTransform || "";
3500
+ l.style.transform = d;
3446
3501
  }
3447
- const h = parseInt(c.dataset.imageId || "0");
3502
+ const h = parseInt(l.dataset.imageId || "0");
3448
3503
  if (this.fullConfig.config.debug?.enabled && h < 3) {
3449
- const d = c.dataset.finalTransform || "";
3504
+ const d = l.dataset.finalTransform || "";
3450
3505
  console.log(`Image ${h} final state:`, {
3451
- left: c.style.left,
3452
- top: c.style.top,
3453
- width: c.style.width,
3454
- height: c.style.height,
3455
- computedWidth: c.offsetWidth,
3456
- computedHeight: c.offsetHeight,
3506
+ left: l.style.left,
3507
+ top: l.style.top,
3508
+ width: l.style.width,
3509
+ height: l.style.height,
3510
+ computedWidth: l.offsetWidth,
3511
+ computedHeight: l.offsetHeight,
3457
3512
  transform: d,
3458
3513
  pathType: this.entryAnimationEngine.getPathType()
3459
3514
  });
3460
3515
  }
3461
3516
  if (this.idleAnimationEngine) {
3462
3517
  const d = this.entryAnimationEngine.getTiming().duration;
3463
- this.idleAnimationEngine.register(c, h, this.imageElements.length, d);
3518
+ this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
3464
3519
  }
3465
3520
  }), r++);
3466
- }, l = () => {
3521
+ }, c = () => {
3467
3522
  if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
3468
3523
  for (; this.displayQueue.length > 0; ) {
3469
- const c = this.displayQueue.shift();
3470
- c && s(c);
3524
+ const l = this.displayQueue.shift();
3525
+ l && a(l);
3471
3526
  }
3472
3527
  return;
3473
3528
  }
@@ -3477,78 +3532,78 @@ class ei {
3477
3532
  return;
3478
3533
  }
3479
3534
  if (this.displayQueue.length > 0) {
3480
- const c = this.displayQueue.shift();
3481
- c && s(c);
3535
+ const l = this.displayQueue.shift();
3536
+ l && a(l);
3482
3537
  }
3483
3538
  r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
3484
3539
  }, this.fullConfig.animation.queue.interval);
3485
3540
  };
3486
3541
  if ("IntersectionObserver" in window && this.containerEl) {
3487
- const c = new IntersectionObserver((u) => {
3542
+ const l = new IntersectionObserver((u) => {
3488
3543
  u.forEach((h) => {
3489
- h.isIntersecting && (l(), c.disconnect());
3544
+ h.isIntersecting && (c(), l.disconnect());
3490
3545
  });
3491
3546
  }, { threshold: 0.1, rootMargin: "50px" });
3492
- c.observe(this.containerEl);
3547
+ l.observe(this.containerEl);
3493
3548
  } else
3494
- l();
3495
- this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), a.forEach((c, u) => {
3549
+ c();
3550
+ this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, u) => {
3496
3551
  const h = document.createElement("div");
3497
3552
  h.className = "fbn-ic-debug-center", h.style.position = "absolute", h.style.width = "12px", h.style.height = "12px", h.style.borderRadius = "50%", h.style.backgroundColor = "red", h.style.border = "2px solid yellow", h.style.zIndex = "9999", h.style.pointerEvents = "none";
3498
- const d = c.x, f = c.y;
3499
- h.style.left = `${d - 6}px`, h.style.top = `${f - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(f)})`, this.containerEl.appendChild(h);
3500
- })), t.forEach((c, u) => {
3553
+ const d = l.x, g = l.y;
3554
+ h.style.left = `${d - 6}px`, h.style.top = `${g - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(g)})`, this.containerEl.appendChild(h);
3555
+ })), t.forEach((l, u) => {
3501
3556
  const h = document.createElement("img");
3502
3557
  h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
3503
- const d = a[u];
3504
- h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), st(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3558
+ const d = s[u];
3559
+ h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3505
3560
  if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
3506
- const f = h.cachedRenderedWidth;
3507
- ft(h, this.fullConfig.styling?.hover, i, f), st(h, this.hoverClassName);
3561
+ const g = h.cachedRenderedWidth;
3562
+ st(h, this.fullConfig.styling?.hover, i, g), et(h, this.hoverClassName);
3508
3563
  }
3509
3564
  }), h.addEventListener("mouseleave", () => {
3510
3565
  if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
3511
- const f = h.cachedRenderedWidth;
3512
- ft(h, this.fullConfig.styling?.default, i, f), pt(h, this.hoverClassName), st(h, this.defaultClassName);
3566
+ const g = h.cachedRenderedWidth;
3567
+ st(h, this.fullConfig.styling?.default, i, g), pt(h, this.hoverClassName), et(h, this.defaultClassName);
3513
3568
  }
3514
- }), h.addEventListener("click", (f) => {
3515
- f.stopPropagation(), this.handleImageClick(h, d);
3569
+ }), h.addEventListener("click", (g) => {
3570
+ g.stopPropagation(), this.handleImageClick(h, d);
3516
3571
  }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
3517
3572
  if (n !== this.loadGeneration)
3518
3573
  return;
3519
- const f = h.naturalWidth / h.naturalHeight, y = i * f;
3520
- h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${y}`), h.style.width = `${y}px`, h.cachedRenderedWidth = y, h.aspectRatio = f, ft(h, this.fullConfig.styling?.default, i, y);
3521
- const p = { x: d.x, y: d.y }, g = { width: y, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
3574
+ const g = h.naturalWidth / h.naturalHeight, b = i * g;
3575
+ h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${b}`), h.style.width = `${b}px`, h.cachedRenderedWidth = b, h.aspectRatio = g, st(h, this.fullConfig.styling?.default, i, b);
3576
+ const p = { x: d.x, y: d.y }, f = { width: b, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
3522
3577
  p,
3523
- g,
3578
+ f,
3524
3579
  e,
3525
3580
  u,
3526
3581
  t.length
3527
- ), b = this.entryAnimationEngine.calculateStartRotation(d.rotation), w = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
3582
+ ), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), E = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
3528
3583
  d.rotation,
3529
3584
  d.scale,
3530
- y,
3585
+ b,
3531
3586
  i
3532
3587
  ), S = this.entryAnimationEngine.buildStartTransform(
3533
3588
  m,
3534
3589
  p,
3535
3590
  d.rotation,
3536
3591
  d.scale,
3537
- y,
3538
- i,
3539
3592
  b,
3540
- w
3593
+ i,
3594
+ y,
3595
+ E
3541
3596
  );
3542
3597
  this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
3543
3598
  finalPosition: p,
3544
- imageSize: g,
3599
+ imageSize: f,
3545
3600
  left: d.x,
3546
3601
  top: d.y,
3547
3602
  finalTransform: v,
3548
- renderedWidth: y,
3603
+ renderedWidth: b,
3549
3604
  renderedHeight: i
3550
- }), h.style.transform = S, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || b !== d.rotation || w !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(y), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(b), h.dataset.startScale = String(w)), this.displayQueue.push(h);
3551
- }, h.onerror = () => r++, h.src = c;
3605
+ }), h.style.transform = S, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || E !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(E)), this.displayQueue.push(h);
3606
+ }, h.onerror = () => r++, h.src = l;
3552
3607
  });
3553
3608
  }
3554
3609
  async handleImageClick(t, i) {
@@ -3558,18 +3613,18 @@ class ei {
3558
3613
  height: this.containerEl.offsetHeight
3559
3614
  };
3560
3615
  if (e)
3561
- await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter();
3616
+ await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.hideFocusIndicator();
3562
3617
  else {
3563
3618
  this.idleAnimationEngine?.pauseForImage(t);
3564
- const a = t.dataset.imageId;
3565
- this.currentFocusIndex = a !== void 0 ? parseInt(a, 10) : null, this.swipeEngine?.enable(), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex);
3619
+ const s = t.dataset.imageId;
3620
+ this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator();
3566
3621
  }
3567
3622
  }
3568
3623
  /**
3569
3624
  * Clear the image cloud and reset state
3570
3625
  */
3571
3626
  clearImageCloud() {
3572
- this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.idleAnimationEngine?.stopAll(), this.imagesLoaded = !1;
3627
+ this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.hideFocusIndicator(), this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.idleAnimationEngine?.stopAll(), this.imagesLoaded = !1;
3573
3628
  }
3574
3629
  showLoading(t) {
3575
3630
  !this.fullConfig.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
@@ -3586,11 +3641,23 @@ class ei {
3586
3641
  hideCounter() {
3587
3642
  this.counterEl && this.counterEl.classList.add("fbn-ic-hidden");
3588
3643
  }
3644
+ showFocusIndicator() {
3645
+ this.containerEl?.classList.add("fbn-ic-has-focus");
3646
+ }
3647
+ hideFocusIndicator() {
3648
+ this.containerEl?.classList.remove("fbn-ic-has-focus");
3649
+ }
3650
+ showNavButtons() {
3651
+ this.prevButtonEl?.classList.remove("fbn-ic-hidden"), this.nextButtonEl?.classList.remove("fbn-ic-hidden");
3652
+ }
3653
+ hideNavButtons() {
3654
+ this.prevButtonEl?.classList.add("fbn-ic-hidden"), this.nextButtonEl?.classList.add("fbn-ic-hidden");
3655
+ }
3589
3656
  /**
3590
3657
  * Destroy the gallery and clean up resources
3591
3658
  */
3592
3659
  destroy() {
3593
- this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
3660
+ this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.prevButtonElAutoCreated && this.prevButtonEl && (this.prevButtonEl.remove(), this.prevButtonEl = null), this.nextButtonElAutoCreated && this.nextButtonEl && (this.nextButtonEl.remove(), this.nextButtonEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
3594
3661
  }
3595
3662
  }
3596
3663
  const It = class It extends HTMLElement {
@@ -3613,17 +3680,17 @@ const It = class It extends HTMLElement {
3613
3680
  const t = {}, i = this.getAttribute("config");
3614
3681
  if (i)
3615
3682
  try {
3616
- const a = JSON.parse(i), { container: r, ...s } = a;
3617
- Object.assign(t, s);
3618
- } catch (a) {
3619
- console.error("<image-cloud> invalid config JSON:", a);
3683
+ const s = JSON.parse(i), { container: r, ...a } = s;
3684
+ Object.assign(t, a);
3685
+ } catch (s) {
3686
+ console.error("<image-cloud> invalid config JSON:", s);
3620
3687
  }
3621
3688
  const e = this.getAttribute("images");
3622
3689
  if (e)
3623
3690
  try {
3624
3691
  t.images = JSON.parse(e);
3625
- } catch (a) {
3626
- console.error("<image-cloud> invalid images JSON:", a);
3692
+ } catch (s) {
3693
+ console.error("<image-cloud> invalid images JSON:", s);
3627
3694
  }
3628
3695
  const n = this.getAttribute("layout");
3629
3696
  return n && (t.layout = {
@@ -3652,9 +3719,9 @@ const It = class It extends HTMLElement {
3652
3719
  }
3653
3720
  };
3654
3721
  It.observedAttributes = ["config", "images", "layout"];
3655
- let bt = It;
3656
- typeof customElements < "u" && !customElements.get("image-cloud") && customElements.define("image-cloud", bt);
3722
+ let yt = It;
3723
+ typeof customElements < "u" && !customElements.get("image-cloud") && customElements.define("image-cloud", yt);
3657
3724
  export {
3658
- bt as ImageCloudElement
3725
+ yt as ImageCloudElement
3659
3726
  };
3660
3727
  //# sourceMappingURL=web-component.js.map