@frybynite/image-cloud 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as Ht } from "react/jsx-runtime";
2
- import { forwardRef as kt, useRef as It, useImperativeHandle as Nt, useEffect as jt } from "react";
2
+ import { forwardRef as Nt, useRef as It, useImperativeHandle as kt, useEffect as Bt } from "react";
3
3
  const mt = Object.freeze({
4
4
  none: "none",
5
5
  sm: "0 2px 4px rgba(0,0,0,0.1)",
@@ -10,12 +10,12 @@ const mt = Object.freeze({
10
10
  energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
11
11
  playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
12
12
  subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
13
- }), Tt = Object.freeze({
13
+ }), At = Object.freeze({
14
14
  gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
15
15
  bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
16
16
  wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
17
17
  snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
18
- }), At = Object.freeze({
18
+ }), Ct = Object.freeze({
19
19
  gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
20
20
  playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
21
21
  serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
@@ -24,9 +24,9 @@ const mt = Object.freeze({
24
24
  type: "linear"
25
25
  }), vt = Object.freeze({
26
26
  mode: "none"
27
- }), wt = Object.freeze({
27
+ }), Et = Object.freeze({
28
28
  mode: "none"
29
- }), Ft = Object.freeze({
29
+ }), Mt = Object.freeze({
30
30
  default: Object.freeze({
31
31
  border: Object.freeze({
32
32
  width: 0,
@@ -52,18 +52,18 @@ const mt = Object.freeze({
52
52
  focused: Object.freeze({
53
53
  shadow: "none"
54
54
  })
55
- }), Wt = Object.freeze({
55
+ }), jt = Object.freeze({
56
56
  tightness: 1
57
- }), Gt = Object.freeze({
57
+ }), Wt = Object.freeze({
58
58
  rows: 1,
59
59
  amplitude: 100,
60
60
  frequency: 2,
61
61
  phaseShift: 0,
62
62
  synchronization: "offset"
63
63
  // Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
64
- }), qt = Object.freeze({
64
+ }), Gt = Object.freeze({
65
65
  spacing: 0
66
- }), Bt = Object.freeze({
66
+ }), qt = Object.freeze({
67
67
  mobile: Object.freeze({ maxWidth: 767 }),
68
68
  tablet: Object.freeze({ maxWidth: 1199 })
69
69
  }), Xt = Object.freeze({
@@ -96,7 +96,7 @@ const mt = Object.freeze({
96
96
  enabled: !1,
97
97
  centers: !1,
98
98
  loaders: !1
99
- }), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), E = Object.freeze({
99
+ }), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), R = Object.freeze({
100
100
  // Loader configuration (always an array, composite behavior is implicit)
101
101
  loaders: [],
102
102
  // Shared loader settings and debug config
@@ -111,7 +111,7 @@ const mt = Object.freeze({
111
111
  algorithm: "radial",
112
112
  scaleDecay: 0,
113
113
  // No decay by default (0-1 for radial/spiral)
114
- responsive: Bt,
114
+ responsive: qt,
115
115
  targetCoverage: 0.6,
116
116
  // Target 60% of container area
117
117
  densityFactor: 1,
@@ -159,7 +159,7 @@ const mt = Object.freeze({
159
159
  // smooth deceleration
160
160
  path: yt,
161
161
  rotation: vt,
162
- scale: wt
162
+ scale: Et
163
163
  }),
164
164
  idle: $t
165
165
  }),
@@ -180,25 +180,15 @@ const mt = Object.freeze({
180
180
  }),
181
181
  dragging: !0
182
182
  }),
183
- // Pattern-based rendering configuration
184
- rendering: Object.freeze({
185
- responsive: Object.freeze({
186
- breakpoints: Object.freeze({
187
- mobile: 768,
188
- tablet: void 0,
189
- // STUB: Not implemented yet
190
- desktop: void 0
191
- // STUB: Not implemented yet
192
- }),
193
- mobileDetection: () => typeof window > "u" ? !1 : window.innerWidth <= 768
194
- }),
195
- ui: Object.freeze({
196
- showLoadingSpinner: !1,
197
- showImageCounter: !1
198
- })
183
+ // UI configuration
184
+ ui: Object.freeze({
185
+ showLoadingSpinner: !1,
186
+ showImageCounter: !1,
187
+ showNavButtons: !1,
188
+ showFocusOutline: !1
199
189
  }),
200
190
  // Image styling
201
- styling: Ft
191
+ styling: Mt
202
192
  });
203
193
  function Z(o, t) {
204
194
  if (!o) return t || {};
@@ -228,15 +218,15 @@ function te(o, t) {
228
218
  ...o.sizing,
229
219
  ...t.sizing
230
220
  }, t.sizing.variance)) {
231
- 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;
232
- i.sizing.variance = { min: n, max: a };
221
+ 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;
222
+ i.sizing.variance = { min: n, max: s };
233
223
  }
234
224
  if (t.rotation !== void 0 && (i.rotation = {
235
225
  ...o.rotation,
236
226
  ...t.rotation
237
227
  }, t.rotation.range)) {
238
- 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;
239
- i.rotation.range = { min: n, max: a };
228
+ 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;
229
+ i.rotation.range = { min: n, max: s };
240
230
  }
241
231
  return i;
242
232
  }
@@ -283,92 +273,87 @@ function ne(o = {}) {
283
273
  ...Ot,
284
274
  ...o.config?.loaders ?? {}
285
275
  }
286
- }, s = {
276
+ }, a = {
287
277
  loaders: n,
288
278
  config: r,
289
279
  image: te(zt, e),
290
- layout: { ...E.layout },
291
- animation: { ...E.animation },
292
- interaction: { ...E.interaction },
293
- rendering: { ...E.rendering },
294
- styling: Qt(Ft, o.styling)
280
+ layout: { ...R.layout },
281
+ animation: { ...R.animation },
282
+ interaction: { ...R.interaction },
283
+ ui: { ...R.ui },
284
+ styling: Qt(Mt, o.styling)
295
285
  };
296
- if (o.layout && (s.layout = {
297
- ...E.layout,
286
+ o.layout && (a.layout = {
287
+ ...R.layout,
298
288
  ...o.layout
299
- }, o.layout.responsive && (s.layout.responsive = {
300
- ...E.layout.responsive,
301
- mobile: o.layout.responsive.mobile ? { ...E.layout.responsive.mobile, ...o.layout.responsive.mobile } : E.layout.responsive.mobile,
302
- tablet: o.layout.responsive.tablet ? { ...E.layout.responsive.tablet, ...o.layout.responsive.tablet } : E.layout.responsive.tablet
303
- }), o.layout.spacing && (s.layout.spacing = {
304
- ...E.layout.spacing,
289
+ }, o.layout.responsive && (a.layout.responsive = {
290
+ ...R.layout.responsive,
291
+ mobile: o.layout.responsive.mobile ? { ...R.layout.responsive.mobile, ...o.layout.responsive.mobile } : R.layout.responsive.mobile,
292
+ tablet: o.layout.responsive.tablet ? { ...R.layout.responsive.tablet, ...o.layout.responsive.tablet } : R.layout.responsive.tablet
293
+ }), o.layout.spacing && (a.layout.spacing = {
294
+ ...R.layout.spacing,
305
295
  ...o.layout.spacing
306
- })), o.animation && (s.animation = {
307
- ...E.animation,
296
+ })), o.animation && (a.animation = {
297
+ ...R.animation,
308
298
  ...o.animation
309
- }, o.animation.easing && (s.animation.easing = {
310
- ...E.animation.easing,
299
+ }, o.animation.easing && (a.animation.easing = {
300
+ ...R.animation.easing,
311
301
  ...o.animation.easing
312
- }), o.animation.queue && (s.animation.queue = {
313
- ...E.animation.queue,
302
+ }), o.animation.queue && (a.animation.queue = {
303
+ ...R.animation.queue,
314
304
  ...o.animation.queue
315
- }), o.animation.entry && (s.animation.entry = {
316
- ...E.animation.entry,
305
+ }), o.animation.entry && (a.animation.entry = {
306
+ ...R.animation.entry,
317
307
  ...o.animation.entry,
318
308
  start: o.animation.entry.start ? {
319
- ...E.animation.entry.start,
309
+ ...R.animation.entry.start,
320
310
  ...o.animation.entry.start,
321
- circular: o.animation.entry.start.circular ? { ...E.animation.entry.start.circular, ...o.animation.entry.start.circular } : E.animation.entry.start.circular
322
- } : E.animation.entry.start,
323
- timing: o.animation.entry.timing ? { ...E.animation.entry.timing, ...o.animation.entry.timing } : E.animation.entry.timing,
324
- path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : E.animation.entry.path,
325
- rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : E.animation.entry.rotation,
326
- scale: o.animation.entry.scale ? { ...wt, ...o.animation.entry.scale } : E.animation.entry.scale
327
- }), o.animation.idle && (s.animation.idle = {
311
+ circular: o.animation.entry.start.circular ? { ...R.animation.entry.start.circular, ...o.animation.entry.start.circular } : R.animation.entry.start.circular
312
+ } : R.animation.entry.start,
313
+ timing: o.animation.entry.timing ? { ...R.animation.entry.timing, ...o.animation.entry.timing } : R.animation.entry.timing,
314
+ path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : R.animation.entry.path,
315
+ rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : R.animation.entry.rotation,
316
+ scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : R.animation.entry.scale
317
+ }), o.animation.idle && (a.animation.idle = {
328
318
  ...$t,
329
319
  ...o.animation.idle
330
- })), o.interaction && (s.interaction = {
331
- ...E.interaction,
320
+ })), o.interaction && (a.interaction = {
321
+ ...R.interaction,
332
322
  ...o.interaction
333
- }, o.interaction.focus && (s.interaction.focus = {
334
- ...E.interaction.focus,
323
+ }, o.interaction.focus && (a.interaction.focus = {
324
+ ...R.interaction.focus,
335
325
  ...o.interaction.focus
336
- }), o.interaction.navigation && (s.interaction.navigation = {
337
- ...E.interaction.navigation,
326
+ }), o.interaction.navigation && (a.interaction.navigation = {
327
+ ...R.interaction.navigation,
338
328
  ...o.interaction.navigation
339
- })), o.rendering && (s.rendering = {
340
- ...E.rendering,
341
- ...o.rendering
342
- }, o.rendering.responsive && (s.rendering.responsive = {
343
- ...E.rendering.responsive,
344
- ...o.rendering.responsive,
345
- breakpoints: o.rendering.responsive.breakpoints ? { ...E.rendering.responsive.breakpoints, ...o.rendering.responsive.breakpoints } : E.rendering.responsive.breakpoints,
346
- mobileDetection: o.rendering.responsive.mobileDetection ? o.rendering.responsive.mobileDetection : E.rendering.responsive.mobileDetection
347
- }), o.rendering.ui && (s.rendering.ui = {
348
- ...E.rendering.ui,
349
- ...o.rendering.ui
350
- })), s.config.debug = {
329
+ }));
330
+ const c = o.rendering?.ui;
331
+ if (c && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), a.ui = {
332
+ ...R.ui,
333
+ ...c,
334
+ ...o.ui
335
+ }, a.config.debug = {
351
336
  ...Dt,
352
337
  ...o.config?.debug ?? {}
353
- }, s.layout.algorithm === "honeycomb" && s.styling) {
354
- const c = { shape: "hexagon", mode: "height-relative" };
355
- s.styling = {
356
- ...s.styling,
357
- default: { ...s.styling.default, clipPath: c },
358
- hover: { ...s.styling.hover, clipPath: c }
338
+ }, a.layout.algorithm === "honeycomb" && a.styling) {
339
+ const l = { shape: "hexagon", mode: "height-relative" };
340
+ a.styling = {
341
+ ...a.styling,
342
+ default: { ...a.styling.default, clipPath: l },
343
+ hover: { ...a.styling.hover, clipPath: l }
359
344
  // focused: untouched — user config respected
360
345
  };
361
346
  }
362
- return s;
347
+ return a;
363
348
  }
364
349
  function oe(o, t) {
365
350
  return { ...o ? Rt[o] : Rt.playful, ...t };
366
351
  }
367
352
  function se(o, t) {
368
- return { ...o ? Tt[o] : Tt.gentle, ...t };
353
+ return { ...o ? At[o] : At.gentle, ...t };
369
354
  }
370
355
  function ae(o, t) {
371
- return { ...o ? At[o] : At.gentle, ...t };
356
+ return { ...o ? Ct[o] : Ct.gentle, ...t };
372
357
  }
373
358
  class re {
374
359
  constructor(t) {
@@ -395,9 +380,9 @@ class re {
395
380
  * @param easing - CSS easing function (optional)
396
381
  * @returns AnimationHandle that can be used to cancel or query the animation
397
382
  */
398
- animateTransformCancellable(t, i, e, n = null, a = null) {
383
+ animateTransformCancellable(t, i, e, n = null, s = null) {
399
384
  this.cancelAllAnimations(t);
400
- const r = n ?? this.config.duration, s = a ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
385
+ const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
401
386
  t.style.transition = "none";
402
387
  const u = t.animate(
403
388
  [
@@ -406,7 +391,7 @@ class re {
406
391
  ],
407
392
  {
408
393
  duration: r,
409
- easing: s,
394
+ easing: a,
410
395
  fill: "forwards"
411
396
  // Keep final state after animation
412
397
  }
@@ -466,8 +451,8 @@ class re {
466
451
  const e = getComputedStyle(t).transform;
467
452
  if (e === "none" || !e)
468
453
  return { x: 0, y: 0, rotation: 0, scale: 1 };
469
- 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, c = n.f;
470
- return { x: s, y: c, rotation: r, scale: a };
454
+ 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;
455
+ return { x: a, y: c, rotation: r, scale: s };
471
456
  }
472
457
  /**
473
458
  * Check if an element has an active animation
@@ -494,10 +479,10 @@ class re {
494
479
  * @returns Promise that resolves when animation completes
495
480
  */
496
481
  animateTransform(t, i, e = null, n = null) {
497
- return new Promise((a) => {
498
- const r = e ?? this.config.duration, s = n ?? this.config.easing.default;
499
- t.style.transition = `transform ${r}ms ${s}, box-shadow ${r}ms ${s}`, t.style.transform = this.buildTransformString(i), setTimeout(() => {
500
- a();
482
+ return new Promise((s) => {
483
+ const r = e ?? this.config.duration, a = n ?? this.config.easing.default;
484
+ t.style.transition = `transform ${r}ms ${a}, box-shadow ${r}ms ${a}`, t.style.transform = this.buildTransformString(i), setTimeout(() => {
485
+ s();
501
486
  }, r);
502
487
  });
503
488
  }
@@ -530,26 +515,26 @@ function J(o, t, i) {
530
515
  return o + (t - o) * i;
531
516
  }
532
517
  function ce(o, t, i, e) {
533
- const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l = le(a, r);
534
- let u = 0, h = 0, d = 1, f = n, b = !1;
535
- for (let g = 0; g < l.length; g++)
536
- if (o <= l[g].time) {
537
- h = g === 0 ? 0 : l[g - 1].time, d = l[g].time, f = l[g].overshoot, b = l[g].isOvershoot;
518
+ const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, l = le(s, r);
519
+ let u = 0, h = 0, d = 1, g = n, b = !1;
520
+ for (let f = 0; f < l.length; f++)
521
+ if (o <= l[f].time) {
522
+ h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, b = l[f].isOvershoot;
538
523
  break;
539
524
  }
540
525
  const p = (o - h) / (d - h);
541
526
  if (b)
542
- u = 1 + f * ot(p);
527
+ u = 1 + g * at(p);
543
528
  else if (h === 0)
544
- u = ot(p);
529
+ u = at(p);
545
530
  else {
546
531
  const m = 1 + (l.find(
547
- (y, w) => y.time > h && w > 0 && l[w - 1].isOvershoot
548
- )?.overshoot || f);
549
- u = J(m, 1, ot(p));
532
+ (y, E) => y.time > h && E > 0 && l[E - 1].isOvershoot
533
+ )?.overshoot || g);
534
+ u = J(m, 1, at(p));
550
535
  }
551
536
  return {
552
- x: t.x + s * u,
537
+ x: t.x + a * u,
553
538
  y: t.y + c * u
554
539
  };
555
540
  }
@@ -559,15 +544,15 @@ function le(o, t) {
559
544
  i.push({ time: e, overshoot: 0, isOvershoot: !1 });
560
545
  let n = 0.15;
561
546
  const r = 0.4 / (o * 2);
562
- for (let s = 0; s < o; s++)
547
+ for (let a = 0; a < o; a++)
563
548
  e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
564
549
  return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
565
550
  }
566
551
  function he(o, t, i, e) {
567
- const { stiffness: n, damping: a, mass: r, oscillations: s } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = a / (2 * Math.sqrt(n * r));
552
+ 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));
568
553
  let d;
569
554
  if (h < 1) {
570
- const f = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(f * o * s * Math.PI);
555
+ const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(g * o * a * Math.PI);
571
556
  d = 1 - b * p;
572
557
  } else
573
558
  d = 1 - Math.exp(-u * o * 3);
@@ -577,38 +562,38 @@ function he(o, t, i, e) {
577
562
  };
578
563
  }
579
564
  function de(o, t, i, e) {
580
- const { amplitude: n, frequency: a, decay: r, decayRate: s, 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, f = h > 0 ? l / h : 1, b = a * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(b) * p, m = ue(o);
565
+ 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 = ue(o);
581
566
  return {
582
- x: J(t.x, i.x, m) + g * d,
583
- y: J(t.y, i.y, m) + g * f
567
+ x: J(t.x, i.x, m) + f * d,
568
+ y: J(t.y, i.y, m) + f * g
584
569
  };
585
570
  }
586
- function ot(o) {
571
+ function at(o) {
587
572
  return 1 - (1 - o) * (1 - o);
588
573
  }
589
574
  function ue(o) {
590
575
  return 1 - Math.pow(1 - o, 3);
591
576
  }
592
- function ge(o, t, i) {
593
- const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, c = e * r * s;
577
+ function fe(o, t, i) {
578
+ 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;
594
579
  return t + c;
595
580
  }
596
- function fe(o, t, i) {
597
- const { overshoot: e, bounces: n } = i, a = [];
598
- a.push({ time: 0.5, scale: e });
581
+ function ge(o, t, i) {
582
+ const { overshoot: e, bounces: n } = i, s = [];
583
+ s.push({ time: 0.5, scale: e });
599
584
  let r = e;
600
- const s = 0.5, l = 0.5 / (n * 2);
585
+ const a = 0.5, l = 0.5 / (n * 2);
601
586
  let u = 0.5;
602
587
  for (let d = 0; d < n; d++) {
603
- const f = 1 - (r - 1) * s;
604
- u += l, a.push({ time: u, scale: f }), r = 1 + (r - 1) * s * s, u += l, d < n - 1 && a.push({ time: u, scale: r });
588
+ const g = 1 - (r - 1) * a;
589
+ 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 });
605
590
  }
606
- a.push({ time: 1, scale: 1 });
591
+ s.push({ time: 1, scale: 1 });
607
592
  let h = 1;
608
- for (let d = 0; d < a.length; d++)
609
- if (o <= a[d].time) {
610
- const f = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (o - f) / (a[d].time - f), g = ot(p);
611
- h = b + (a[d].scale - b) * g;
593
+ for (let d = 0; d < s.length; d++)
594
+ if (o <= s[d].time) {
595
+ 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);
596
+ h = b + (s[d].scale - b) * f;
612
597
  break;
613
598
  }
614
599
  return h * t;
@@ -619,61 +604,61 @@ function me(o) {
619
604
  startPosition: i,
620
605
  endPosition: e,
621
606
  pathConfig: n,
622
- duration: a,
607
+ duration: s,
623
608
  imageWidth: r,
624
- imageHeight: s,
609
+ imageHeight: a,
625
610
  rotation: c,
626
611
  scale: l,
627
612
  onComplete: u,
628
613
  rotationConfig: h,
629
614
  startRotation: d,
630
- scaleConfig: f,
615
+ scaleConfig: g,
631
616
  startScale: b
632
- } = o, p = n.type, g = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = b !== void 0 && b !== l, I = f?.mode === "pop", x = f?.pop || { overshoot: 1.2, bounces: 1 };
633
- if ((p === "linear" || p === "arc") && !w && !(v || I)) {
617
+ } = 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 };
618
+ if ((p === "linear" || p === "arc") && !E && !(v || S)) {
634
619
  u && u();
635
620
  return;
636
621
  }
637
- const z = performance.now(), L = -r / 2, _ = -s / 2;
622
+ const z = performance.now(), L = -r / 2, _ = -a / 2;
638
623
  function O(H) {
639
- const k = H - z, T = Math.min(k / a, 1);
624
+ const N = H - z, A = Math.min(N / s, 1);
640
625
  let D;
641
626
  switch (p) {
642
627
  case "bounce": {
643
- const N = oe(
628
+ const k = oe(
644
629
  n.bouncePreset,
645
630
  n.bounce
646
631
  );
647
- D = ce(T, i, e, N);
632
+ D = ce(A, i, e, k);
648
633
  break;
649
634
  }
650
635
  case "elastic": {
651
- const N = se(
636
+ const k = se(
652
637
  n.elasticPreset,
653
638
  n.elastic
654
639
  );
655
- D = he(T, i, e, N);
640
+ D = he(A, i, e, k);
656
641
  break;
657
642
  }
658
643
  case "wave": {
659
- const N = ae(
644
+ const k = ae(
660
645
  n.wavePreset,
661
646
  n.wave
662
647
  );
663
- D = de(T, i, e, N);
648
+ D = de(A, i, e, k);
664
649
  break;
665
650
  }
666
651
  default:
667
652
  D = {
668
- x: J(i.x, e.x, T),
669
- y: J(i.y, e.y, T)
653
+ x: J(i.x, e.x, A),
654
+ y: J(i.y, e.y, A)
670
655
  };
671
656
  }
672
- const G = D.x - e.x, U = D.y - e.y;
673
- let M;
674
- m ? M = ge(T, c, y) : g ? M = J(d, c, T) : M = c;
675
- let A;
676
- I ? A = fe(T, l, x) : v ? A = J(b, l, T) : A = l, t.style.transform = `translate(${L}px, ${_}px) translate(${G}px, ${U}px) rotate(${M}deg) scale(${A})`, T < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
657
+ const W = D.x - e.x, U = D.y - e.y;
658
+ let F;
659
+ m ? F = fe(A, c, y) : f ? F = J(d, c, A) : F = c;
660
+ let C;
661
+ S ? C = ge(A, l, w) : v ? C = J(b, l, A) : C = l, t.style.transform = `translate(${L}px, ${_}px) translate(${W}px, ${U}px) rotate(${F}deg) scale(${C})`, A < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
677
662
  }
678
663
  requestAnimationFrame(O);
679
664
  }
@@ -691,7 +676,7 @@ const be = {
691
676
  };
692
677
  class ye {
693
678
  constructor(t, i) {
694
- this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || wt;
679
+ this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || Et;
695
680
  }
696
681
  /**
697
682
  * Get the effective start position, considering layout-aware defaults
@@ -702,72 +687,72 @@ class ye {
702
687
  /**
703
688
  * Calculate the starting position for an image's entry animation
704
689
  */
705
- calculateStartPosition(t, i, e, n, a) {
706
- const r = this.resolvedStartPosition, s = this.config.start.offset ?? 100;
690
+ calculateStartPosition(t, i, e, n, s) {
691
+ const r = this.resolvedStartPosition, a = this.config.start.offset ?? 100;
707
692
  switch (r) {
708
693
  case "nearest-edge":
709
- return this.calculateNearestEdge(t, i, e, s);
694
+ return this.calculateNearestEdge(t, i, e, a);
710
695
  case "top":
711
- return this.calculateEdgePosition("top", t, i, e, s);
696
+ return this.calculateEdgePosition("top", t, i, e, a);
712
697
  case "bottom":
713
- return this.calculateEdgePosition("bottom", t, i, e, s);
698
+ return this.calculateEdgePosition("bottom", t, i, e, a);
714
699
  case "left":
715
- return this.calculateEdgePosition("left", t, i, e, s);
700
+ return this.calculateEdgePosition("left", t, i, e, a);
716
701
  case "right":
717
- return this.calculateEdgePosition("right", t, i, e, s);
702
+ return this.calculateEdgePosition("right", t, i, e, a);
718
703
  case "center":
719
704
  return this.calculateCenterPosition(e, t, i);
720
705
  case "random-edge":
721
- return this.calculateRandomEdge(t, i, e, s);
706
+ return this.calculateRandomEdge(t, i, e, a);
722
707
  case "circular":
723
708
  return this.calculateCircularPosition(
724
709
  t,
725
710
  i,
726
711
  e,
727
712
  n,
728
- a
713
+ s
729
714
  );
730
715
  default:
731
- return this.calculateNearestEdge(t, i, e, s);
716
+ return this.calculateNearestEdge(t, i, e, a);
732
717
  }
733
718
  }
734
719
  /**
735
720
  * Calculate start position from the nearest edge (current default behavior)
736
721
  */
737
722
  calculateNearestEdge(t, i, e, n) {
738
- const a = t.x, r = t.y, s = a, c = e.width - a, l = r, u = e.height - r, h = Math.min(s, c, l, u);
739
- let d = t.x, f = t.y;
740
- return h === s ? d = -(i.width + n) : h === c ? d = e.width + n : h === l ? f = -(i.height + n) : f = e.height + n, { x: d, y: f };
723
+ 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);
724
+ let d = t.x, g = t.y;
725
+ 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 };
741
726
  }
742
727
  /**
743
728
  * Calculate start position from a specific edge
744
729
  */
745
- calculateEdgePosition(t, i, e, n, a) {
746
- let r = i.x, s = i.y;
730
+ calculateEdgePosition(t, i, e, n, s) {
731
+ let r = i.x, a = i.y;
747
732
  switch (t) {
748
733
  case "top":
749
- s = -(e.height + a);
734
+ a = -(e.height + s);
750
735
  break;
751
736
  case "bottom":
752
- s = n.height + a;
737
+ a = n.height + s;
753
738
  break;
754
739
  case "left":
755
- r = -(e.width + a);
740
+ r = -(e.width + s);
756
741
  break;
757
742
  case "right":
758
- r = n.width + a;
743
+ r = n.width + s;
759
744
  break;
760
745
  }
761
- return { x: r, y: s };
746
+ return { x: r, y: a };
762
747
  }
763
748
  /**
764
749
  * Calculate start position from center with scale animation
765
750
  */
766
751
  calculateCenterPosition(t, i, e) {
767
- const n = t.width / 2, a = t.height / 2;
752
+ const n = t.width / 2, s = t.height / 2;
768
753
  return {
769
754
  x: n,
770
- y: a,
755
+ y: s,
771
756
  useScale: !0
772
757
  // Signal to use scale animation from 0
773
758
  };
@@ -776,14 +761,14 @@ class ye {
776
761
  * Calculate start position from a random edge
777
762
  */
778
763
  calculateRandomEdge(t, i, e, n) {
779
- const a = ["top", "bottom", "left", "right"], r = a[Math.floor(Math.random() * a.length)];
764
+ const s = ["top", "bottom", "left", "right"], r = s[Math.floor(Math.random() * s.length)];
780
765
  return this.calculateEdgePosition(r, t, i, e, n);
781
766
  }
782
767
  /**
783
768
  * Calculate start position on a circle around the container
784
769
  */
785
- calculateCircularPosition(t, i, e, n, a) {
786
- const r = this.config.start.circular || {}, s = r.distribution || "even";
770
+ calculateCircularPosition(t, i, e, n, s) {
771
+ const r = this.config.start.circular || {}, a = r.distribution || "even";
787
772
  let c;
788
773
  const l = r.radius || "120%";
789
774
  if (typeof l == "string" && l.endsWith("%")) {
@@ -794,9 +779,9 @@ class ye {
794
779
  } else
795
780
  c = typeof l == "number" ? l : 500;
796
781
  let u;
797
- s === "even" ? u = n / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
798
- const h = e.width / 2, d = e.height / 2, f = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
799
- return { x: f, y: b };
782
+ a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
783
+ const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
784
+ return { x: g, y: b };
800
785
  }
801
786
  /**
802
787
  * Get animation parameters for an image
@@ -815,8 +800,8 @@ class ye {
815
800
  * Build a CSS transform string for the start position
816
801
  * Uses pixel-based centering offset for reliable cross-browser behavior
817
802
  */
818
- buildStartTransform(t, i, e, n, a, r, s, c) {
819
- const l = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = c !== void 0 ? c : n, f = a !== void 0 ? -a / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = a !== void 0 ? `translate(${f}px, ${b}px)` : "translate(-50%, -50%)";
803
+ buildStartTransform(t, i, e, n, s, r, a, c) {
804
+ 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%)";
820
805
  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})`;
821
806
  }
822
807
  /**
@@ -825,8 +810,8 @@ class ye {
825
810
  */
826
811
  buildFinalTransform(t, i, e, n) {
827
812
  if (e !== void 0 && n !== void 0) {
828
- const a = -e / 2, r = -n / 2;
829
- return `translate(${a}px, ${r}px) rotate(${t}deg) scale(${i})`;
813
+ const s = -e / 2, r = -n / 2;
814
+ return `translate(${s}px, ${r}px) rotate(${t}deg) scale(${i})`;
830
815
  }
831
816
  return `translate(-50%, -50%) rotate(${t}deg) scale(${i})`;
832
817
  }
@@ -944,7 +929,7 @@ class ye {
944
929
  amplitude: 15,
945
930
  frequency: 3,
946
931
  decay: !0
947
- }, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, l = n * s * c;
932
+ }, { 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;
948
933
  return i + l;
949
934
  }
950
935
  /**
@@ -1001,15 +986,15 @@ class ye {
1001
986
  const e = this.scaleConfig.pop || {
1002
987
  overshoot: 1.2,
1003
988
  bounces: 1
1004
- }, { overshoot: n, bounces: a } = e, r = this.generateScaleBounceKeyframes(a, n);
1005
- let s = i;
989
+ }, { overshoot: n, bounces: s } = e, r = this.generateScaleBounceKeyframes(s, n);
990
+ let a = i;
1006
991
  for (let c = 0; c < r.length; c++)
1007
992
  if (t <= r[c].time) {
1008
993
  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);
1009
- s = u + (r[c].scale - u) * d;
994
+ a = u + (r[c].scale - u) * d;
1010
995
  break;
1011
996
  }
1012
- return s * i;
997
+ return a * i;
1013
998
  }
1014
999
  /**
1015
1000
  * Generate keyframes for scale bounce animation
@@ -1018,11 +1003,11 @@ class ye {
1018
1003
  const e = [];
1019
1004
  e.push({ time: 0.5, scale: i });
1020
1005
  let n = i;
1021
- const a = 0.5, s = 0.5 / (t * 2);
1006
+ const s = 0.5, a = 0.5 / (t * 2);
1022
1007
  let c = 0.5;
1023
1008
  for (let l = 0; l < t; l++) {
1024
- const u = 1 - (n - 1) * a;
1025
- c += s, e.push({ time: c, scale: u }), n = 1 + (n - 1) * a * a, c += s, l < t - 1 && e.push({ time: c, scale: n });
1009
+ const u = 1 - (n - 1) * s;
1010
+ 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 });
1026
1011
  }
1027
1012
  return e.push({ time: 1, scale: 1 }), e;
1028
1013
  }
@@ -1043,7 +1028,7 @@ class ve {
1043
1028
  */
1044
1029
  register(t, i, e, n) {
1045
1030
  if (this.entries.has(t)) return;
1046
- const a = n ?? this.entryDurationMs, r = this.config.startDelay ?? a, s = {
1031
+ const s = n ?? this.entryDurationMs, r = this.config.startDelay ?? s, a = {
1047
1032
  element: t,
1048
1033
  index: i,
1049
1034
  totalImages: e,
@@ -1054,8 +1039,8 @@ class ve {
1054
1039
  stopped: !1,
1055
1040
  startTimer: null
1056
1041
  };
1057
- this.entries.set(t, s), s.startTimer = setTimeout(() => {
1058
- s.startTimer = null, !s.stopped && !s.paused && this._startAnimation(s);
1042
+ this.entries.set(t, a), a.startTimer = setTimeout(() => {
1043
+ a.startTimer = null, !a.stopped && !a.paused && this._startAnimation(a);
1059
1044
  }, r);
1060
1045
  }
1061
1046
  /**
@@ -1159,8 +1144,8 @@ class ve {
1159
1144
  }
1160
1145
  _startBlink(t) {
1161
1146
  const i = { ...Kt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
1162
- let a, r;
1163
- i.style === "fade" ? (a = [
1147
+ let s, r;
1148
+ i.style === "fade" ? (s = [
1164
1149
  { opacity: n, offset: 0 },
1165
1150
  { opacity: 0, offset: 0.5 },
1166
1151
  { opacity: n, offset: 1 }
@@ -1169,7 +1154,7 @@ class ve {
1169
1154
  delay: e,
1170
1155
  iterations: 1 / 0,
1171
1156
  easing: "ease-in-out"
1172
- }) : (a = [
1157
+ }) : (s = [
1173
1158
  { opacity: n, offset: 0 },
1174
1159
  { opacity: n, offset: i.onRatio },
1175
1160
  { opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
@@ -1179,7 +1164,7 @@ class ve {
1179
1164
  duration: i.speed,
1180
1165
  delay: e,
1181
1166
  iterations: 1 / 0
1182
- }), t.blinkAnimation = t.element.animate(a, r);
1167
+ }), t.blinkAnimation = t.element.animate(s, r);
1183
1168
  }
1184
1169
  _startSpin(t) {
1185
1170
  const i = { ...Zt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
@@ -1219,7 +1204,7 @@ class ve {
1219
1204
  t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
1220
1205
  }
1221
1206
  }
1222
- class we {
1207
+ class Ee {
1223
1208
  constructor(t, i = {}) {
1224
1209
  this.config = t, this.imageConfig = i;
1225
1210
  }
@@ -1231,11 +1216,11 @@ class we {
1231
1216
  * @returns Array of layout objects with position, rotation, scale
1232
1217
  */
1233
1218
  generate(t, i, e = {}) {
1234
- const n = [], { width: a, height: r } = i, s = 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, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = c * 1.5 / 2, m = c / 2, y = a - s - g, w = r - s - m, v = s + g, I = s + m;
1235
- for (let x = 0; x < t; x++) {
1236
- const R = this.random(v, y), z = this.random(I, w), L = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, f) : 1, O = c * _, H = {
1237
- id: x,
1238
- x: R,
1219
+ 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;
1220
+ for (let w = 0; w < t; w++) {
1221
+ const I = this.random(v, y), z = this.random(S, E), L = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, g) : 1, O = c * _, H = {
1222
+ id: w,
1223
+ x: I,
1239
1224
  y: z,
1240
1225
  rotation: L,
1241
1226
  scale: _,
@@ -1255,7 +1240,7 @@ class we {
1255
1240
  return Math.random() * (i - t) + t;
1256
1241
  }
1257
1242
  }
1258
- class xe {
1243
+ class we {
1259
1244
  constructor(t, i = {}) {
1260
1245
  this.config = t, this.imageConfig = i;
1261
1246
  }
@@ -1267,15 +1252,15 @@ class xe {
1267
1252
  * @returns Array of layout objects with position, rotation, scale
1268
1253
  */
1269
1254
  generate(t, i, e = {}) {
1270
- const n = [], { width: a, height: r } = i, s = 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, f = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
1271
- ...Wt,
1255
+ 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 = {
1256
+ ...jt,
1272
1257
  ...this.config.radial
1273
- }, g = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, I = Math.max(g * 0.8, Math.min(
1274
- m - v - g / 2,
1275
- y - v - g / 2
1258
+ }, 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(
1259
+ m - v - f / 2,
1260
+ y - v - f / 2
1276
1261
  ));
1277
1262
  if (t > 0) {
1278
- const z = f ? this.random(h, d) : 1, L = g * z;
1263
+ const z = g ? this.random(h, d) : 1, L = f * z;
1279
1264
  n.push({
1280
1265
  id: 0,
1281
1266
  x: m,
@@ -1288,32 +1273,32 @@ class xe {
1288
1273
  // Center image is highest
1289
1274
  });
1290
1275
  }
1291
- let x = 1, R = 1;
1292
- for (; x < t; ) {
1293
- const z = R / w, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(g * 0.8, I / w * 1.5 / p.tightness), O = R * _, H = O * 1.5, k = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), T = this.estimateWidth(g), D = Math.floor(k / (T * 0.7));
1276
+ let w = 1, I = 1;
1277
+ for (; w < t; ) {
1278
+ const z = I / E, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(f * 0.8, S / E * 1.5 / p.tightness), O = I * _, H = O * 1.5, N = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), A = this.estimateWidth(f), D = Math.floor(N / (A * 0.7));
1294
1279
  if (D === 0) {
1295
- R++;
1280
+ I++;
1296
1281
  continue;
1297
1282
  }
1298
- const G = 2 * Math.PI / D, U = R * (20 * Math.PI / 180);
1299
- for (let M = 0; M < D && x < t; M++) {
1300
- const A = M * G + U, N = f ? this.random(h, d) : 1, B = L * N, C = g * B;
1301
- let $ = m + Math.cos(A) * H, F = y + Math.sin(A) * O;
1302
- const P = C * 1.5 / 2, j = C / 2;
1303
- $ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P), F - j < v ? F = v + j : F + j > r - v && (F = r - v - j);
1283
+ const W = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
1284
+ for (let F = 0; F < D && w < t; F++) {
1285
+ const C = F * W + U, k = g ? this.random(h, d) : 1, q = L * k, T = f * q;
1286
+ let $ = m + Math.cos(C) * H, M = y + Math.sin(C) * O;
1287
+ const P = T * 1.5 / 2, B = T / 2;
1288
+ $ - P < v ? $ = v + P : $ + P > s - v && ($ = s - v - P), M - B < v ? M = v + B : M + B > r - v && (M = r - v - B);
1304
1289
  const Y = c === "random" ? this.random(l, u) : 0;
1305
1290
  n.push({
1306
- id: x,
1291
+ id: w,
1307
1292
  x: $,
1308
- y: F,
1293
+ y: M,
1309
1294
  rotation: Y,
1310
- scale: B,
1311
- baseSize: C,
1312
- zIndex: Math.max(1, 100 - R)
1295
+ scale: q,
1296
+ baseSize: T,
1297
+ zIndex: Math.max(1, 100 - I)
1313
1298
  // Outer rings have lower z-index
1314
- }), x++;
1299
+ }), w++;
1315
1300
  }
1316
- R++;
1301
+ I++;
1317
1302
  }
1318
1303
  return n;
1319
1304
  }
@@ -1336,7 +1321,7 @@ class xe {
1336
1321
  return Math.random() * (i - t) + t;
1337
1322
  }
1338
1323
  }
1339
- const Ee = {
1324
+ const xe = {
1340
1325
  columns: "auto",
1341
1326
  rows: "auto",
1342
1327
  stagger: "none",
@@ -1346,7 +1331,7 @@ const Ee = {
1346
1331
  alignment: "center",
1347
1332
  gap: 10,
1348
1333
  overflowOffset: 0.25
1349
- }, Ct = [
1334
+ }, Tt = [
1350
1335
  { x: 1, y: 1 },
1351
1336
  // bottom-right
1352
1337
  { x: -1, y: -1 },
@@ -1376,65 +1361,65 @@ class Se {
1376
1361
  * @returns Array of layout objects with position, rotation, scale
1377
1362
  */
1378
1363
  generate(t, i, e = {}) {
1379
- const n = [], { width: a, height: r } = i, s = { ...Ee, ...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, f = h !== 1 || d !== 1, b = a - 2 * c, p = r - 2 * c, { columns: g, rows: m } = this.calculateGridDimensions(
1364
+ const n = [], { width: s, height: r } = i, a = { ...xe, ...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(
1380
1365
  t,
1381
1366
  b,
1382
1367
  p,
1383
1368
  l,
1384
- s
1385
- ), y = s.stagger === "row", w = s.stagger === "column", v = y ? g + 0.5 : g, I = w ? m + 0.5 : m, x = (b - s.gap * (g - 1)) / v, R = (p - s.gap * (m - 1)) / I, z = y ? x / 2 : 0, L = w ? R / 2 : 0, _ = 1 + s.overlap, O = Math.min(x, R) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, k = g * x + (g - 1) * s.gap + z, T = m * R + (m - 1) * s.gap + L, D = c + (b - k) / 2, G = c + (p - T) / 2, U = g * m, M = s.columns !== "auto" && s.rows !== "auto", A = M && t > U;
1369
+ a
1370
+ ), 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, z = y ? w / 2 : 0, L = E ? I / 2 : 0, _ = 1 + a.overlap, O = Math.min(w, I) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, N = f * w + (f - 1) * a.gap + z, A = m * I + (m - 1) * a.gap + L, D = c + (b - N) / 2, W = c + (p - A) / 2, U = f * m, F = a.columns !== "auto" && a.rows !== "auto", C = F && t > U;
1386
1371
  typeof window < "u" && (window.__gridOverflowDebug = {
1387
- gridConfigColumns: s.columns,
1388
- gridConfigRows: s.rows,
1389
- columns: g,
1372
+ gridConfigColumns: a.columns,
1373
+ gridConfigRows: a.rows,
1374
+ columns: f,
1390
1375
  rows: m,
1391
1376
  cellCount: U,
1392
- hasFixedGrid: M,
1377
+ hasFixedGrid: F,
1393
1378
  imageCount: t,
1394
- isOverflowMode: A
1379
+ isOverflowMode: C
1395
1380
  });
1396
- const N = A ? new Array(U).fill(0) : [], B = Math.min(x, R) * s.overflowOffset;
1397
- for (let C = 0; C < t; C++) {
1398
- let $, F, X = 0;
1399
- if (A && C >= U) {
1400
- const q = C - U, W = q % U;
1401
- X = Math.floor(q / U) + 1, N[W]++, s.fillDirection === "row" ? ($ = W % g, F = Math.floor(W / g)) : (F = W % m, $ = Math.floor(W / m));
1381
+ const k = C ? new Array(U).fill(0) : [], q = Math.min(w, I) * a.overflowOffset;
1382
+ for (let T = 0; T < t; T++) {
1383
+ let $, M, X = 0;
1384
+ if (C && T >= U) {
1385
+ const G = T - U, j = G % U;
1386
+ X = Math.floor(G / U) + 1, k[j]++, a.fillDirection === "row" ? ($ = j % f, M = Math.floor(j / f)) : (M = j % m, $ = Math.floor(j / m));
1402
1387
  } else
1403
- s.fillDirection === "row" ? ($ = C % g, F = Math.floor(C / g)) : (F = C % m, $ = Math.floor(C / m));
1404
- let P = D + $ * (x + s.gap) + x / 2, j = G + F * (R + s.gap) + R / 2;
1405
- if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (j += R / 2), X > 0) {
1406
- const q = (X - 1) % Ct.length, W = Ct[q];
1407
- P += W.x * B, j += W.y * B;
1388
+ a.fillDirection === "row" ? ($ = T % f, M = Math.floor(T / f)) : (M = T % m, $ = Math.floor(T / m));
1389
+ let P = D + $ * (w + a.gap) + w / 2, B = W + M * (I + a.gap) + I / 2;
1390
+ if (a.stagger === "row" && M % 2 === 1 ? P += w / 2 : a.stagger === "column" && $ % 2 === 1 && (B += I / 2), X > 0) {
1391
+ const G = (X - 1) % Tt.length, j = Tt[G];
1392
+ P += j.x * q, B += j.y * q;
1408
1393
  }
1409
- if (s.jitter > 0) {
1410
- const q = x / 2 * s.jitter, W = R / 2 * s.jitter;
1411
- P += this.random(-q, q), j += this.random(-W, W);
1394
+ if (a.jitter > 0) {
1395
+ const G = w / 2 * a.jitter, j = I / 2 * a.jitter;
1396
+ P += this.random(-G, G), B += this.random(-j, j);
1412
1397
  }
1413
- let Y = P, V = j;
1414
- if (!A && s.fillDirection === "row") {
1415
- const q = t % g || g;
1416
- if (F === Math.floor((t - 1) / g) && q < g) {
1417
- const St = q * x + (q - 1) * s.gap;
1398
+ let Y = P, V = B;
1399
+ if (!C && a.fillDirection === "row") {
1400
+ const G = t % f || f;
1401
+ if (M === Math.floor((t - 1) / f) && G < f) {
1402
+ const St = G * w + (G - 1) * a.gap;
1418
1403
  let gt = 0;
1419
- s.alignment === "center" ? gt = (k - St) / 2 : s.alignment === "end" && (gt = k - St), Y += gt;
1404
+ a.alignment === "center" ? gt = (N - St) / 2 : a.alignment === "end" && (gt = N - St), Y += gt;
1420
1405
  }
1421
1406
  }
1422
- const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt = c + it, ht = a - c - it, _t = c + nt, Ut = r - c - nt;
1423
- Y = Math.max(lt, Math.min(Y, ht)), V = Math.max(_t, Math.min(V, Ut));
1424
- let dt = 0;
1407
+ 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, _t = c + ot, Ut = r - c - ot;
1408
+ Y = Math.max(ht, Math.min(Y, dt)), V = Math.max(_t, Math.min(V, Ut));
1409
+ let ut = 0;
1425
1410
  if (u === "random") {
1426
- const q = this.imageConfig.rotation?.range?.min ?? -15, W = this.imageConfig.rotation?.range?.max ?? 15;
1427
- s.jitter > 0 ? dt = this.random(q * s.jitter, W * s.jitter) : dt = this.random(q, W);
1411
+ const G = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
1412
+ a.jitter > 0 ? ut = this.random(G * a.jitter, j * a.jitter) : ut = this.random(G, j);
1428
1413
  }
1429
- let ut;
1430
- A && X > 0 ? ut = 50 - X : ut = A ? 100 + C : C + 1, n.push({
1431
- id: C,
1414
+ let ft;
1415
+ C && X > 0 ? ft = 50 - X : ft = C ? 100 + T : T + 1, n.push({
1416
+ id: T,
1432
1417
  x: Y,
1433
1418
  y: V,
1434
- rotation: dt,
1435
- scale: rt,
1419
+ rotation: ut,
1420
+ scale: ct,
1436
1421
  baseSize: K,
1437
- zIndex: ut
1422
+ zIndex: ft
1438
1423
  });
1439
1424
  }
1440
1425
  return n;
@@ -1442,20 +1427,20 @@ class Se {
1442
1427
  /**
1443
1428
  * Calculate optimal grid dimensions based on image count and container
1444
1429
  */
1445
- calculateGridDimensions(t, i, e, n, a) {
1446
- let r, s;
1447
- if (a.columns !== "auto" && a.rows !== "auto")
1448
- r = a.columns, s = a.rows;
1449
- else if (a.columns !== "auto")
1450
- r = a.columns, s = Math.ceil(t / r);
1451
- else if (a.rows !== "auto")
1452
- s = a.rows, r = Math.ceil(t / s);
1430
+ calculateGridDimensions(t, i, e, n, s) {
1431
+ let r, a;
1432
+ if (s.columns !== "auto" && s.rows !== "auto")
1433
+ r = s.columns, a = s.rows;
1434
+ else if (s.columns !== "auto")
1435
+ r = s.columns, a = Math.ceil(t / r);
1436
+ else if (s.rows !== "auto")
1437
+ a = s.rows, r = Math.ceil(t / a);
1453
1438
  else {
1454
1439
  const c = i / e;
1455
- for (r = Math.max(1, Math.round(Math.sqrt(t * c / 1.4))), s = Math.ceil(t / r); r > 1 && (r - 1) * s >= t; )
1440
+ for (r = Math.max(1, Math.round(Math.sqrt(t * c / 1.4))), a = Math.ceil(t / r); r > 1 && (r - 1) * a >= t; )
1456
1441
  r--;
1457
1442
  }
1458
- return { columns: Math.max(1, r), rows: Math.max(1, s) };
1443
+ return { columns: Math.max(1, r), rows: Math.max(1, a) };
1459
1444
  }
1460
1445
  /**
1461
1446
  * Utility: Generate random number between min and max
@@ -1471,7 +1456,7 @@ const Ie = Math.PI * (3 - Math.sqrt(5)), Re = {
1471
1456
  scaleDecay: 0,
1472
1457
  startAngle: 0
1473
1458
  };
1474
- class Te {
1459
+ class Ae {
1475
1460
  constructor(t, i = {}) {
1476
1461
  this.config = t, this.imageConfig = i;
1477
1462
  }
@@ -1483,35 +1468,35 @@ class Te {
1483
1468
  * @returns Array of layout objects with position, rotation, scale
1484
1469
  */
1485
1470
  generate(t, i, e = {}) {
1486
- const n = [], { width: a, height: r } = i, s = { ...Re, ...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, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, y = r / 2, w = Math.min(
1471
+ const n = [], { width: s, height: r } = i, a = { ...Re, ...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(
1487
1472
  m - c - l / 2,
1488
1473
  y - c - l / 2
1489
- ), v = s.direction === "clockwise" ? -1 : 1;
1490
- for (let I = 0; I < t; I++) {
1491
- let x, R;
1492
- if (s.spiralType === "golden")
1493
- x = I * Ie * v + s.startAngle, R = this.calculateGoldenRadius(I, t, w, s.tightness);
1494
- else if (s.spiralType === "archimedean") {
1495
- const P = I * 0.5 * s.tightness;
1496
- x = P * v + s.startAngle, R = this.calculateArchimedeanRadius(P, t, w, s.tightness);
1474
+ ), v = a.direction === "clockwise" ? -1 : 1;
1475
+ for (let S = 0; S < t; S++) {
1476
+ let w, I;
1477
+ if (a.spiralType === "golden")
1478
+ w = S * Ie * v + a.startAngle, I = this.calculateGoldenRadius(S, t, E, a.tightness);
1479
+ else if (a.spiralType === "archimedean") {
1480
+ const P = S * 0.5 * a.tightness;
1481
+ w = P * v + a.startAngle, I = this.calculateArchimedeanRadius(P, t, E, a.tightness);
1497
1482
  } else {
1498
- const P = I * 0.3 * s.tightness;
1499
- x = P * v + s.startAngle, R = this.calculateLogarithmicRadius(P, t, w, s.tightness);
1483
+ const P = S * 0.3 * a.tightness;
1484
+ w = P * v + a.startAngle, I = this.calculateLogarithmicRadius(P, t, E, a.tightness);
1500
1485
  }
1501
- const z = m + Math.cos(x) * R, L = y + Math.sin(x) * R, _ = R / w, O = g > 0 ? 1 - _ * g * 0.5 : 1, H = p ? this.random(f, b) : 1, k = O * H, T = l * k, G = T * 1.5 / 2, U = T / 2, M = c + G, A = a - c - G, N = c + U, B = r - c - U, C = Math.max(M, Math.min(z, A)), $ = Math.max(N, Math.min(L, B));
1502
- let F = 0;
1486
+ const z = m + Math.cos(w) * I, L = y + Math.sin(w) * I, _ = I / E, O = f > 0 ? 1 - _ * f * 0.5 : 1, H = p ? this.random(g, b) : 1, N = O * H, A = l * N, W = A * 1.5 / 2, U = A / 2, F = c + W, C = s - c - W, k = c + U, q = r - c - U, T = Math.max(F, Math.min(z, C)), $ = Math.max(k, Math.min(L, q));
1487
+ let M = 0;
1503
1488
  if (u === "random") {
1504
- const P = x * 180 / Math.PI % 360, j = this.random(h, d);
1505
- F = s.spiralType === "golden" ? j : P * 0.1 + j * 0.9;
1506
- } else u === "tangent" && (F = this.calculateSpiralTangent(x, R, s));
1507
- const X = t - I;
1489
+ const P = w * 180 / Math.PI % 360, B = this.random(h, d);
1490
+ M = a.spiralType === "golden" ? B : P * 0.1 + B * 0.9;
1491
+ } else u === "tangent" && (M = this.calculateSpiralTangent(w, I, a));
1492
+ const X = t - S;
1508
1493
  n.push({
1509
- id: I,
1510
- x: C,
1494
+ id: S,
1495
+ x: T,
1511
1496
  y: $,
1512
- rotation: F,
1513
- scale: k,
1514
- baseSize: T,
1497
+ rotation: M,
1498
+ scale: N,
1499
+ baseSize: A,
1515
1500
  zIndex: X
1516
1501
  });
1517
1502
  }
@@ -1526,11 +1511,11 @@ class Te {
1526
1511
  if (e.spiralType === "golden")
1527
1512
  n = t + Math.PI / 2;
1528
1513
  else if (e.spiralType === "archimedean") {
1529
- const r = 1 / e.tightness, s = Math.atan(i / r);
1530
- n = t + s;
1514
+ const r = 1 / e.tightness, a = Math.atan(i / r);
1515
+ n = t + a;
1531
1516
  } else {
1532
- const r = 0.15 / e.tightness, s = Math.atan(1 / r);
1533
- n = t + s;
1517
+ const r = 0.15 / e.tightness, a = Math.atan(1 / r);
1518
+ n = t + a;
1534
1519
  }
1535
1520
  return n * 180 / Math.PI % 360 - 90;
1536
1521
  }
@@ -1547,16 +1532,16 @@ class Te {
1547
1532
  * r = a + b*θ (constant spacing between arms)
1548
1533
  */
1549
1534
  calculateArchimedeanRadius(t, i, e, n) {
1550
- const a = i * 0.5 * n;
1551
- return t / a * e;
1535
+ const s = i * 0.5 * n;
1536
+ return t / s * e;
1552
1537
  }
1553
1538
  /**
1554
1539
  * Calculate radius for logarithmic (equiangular) spiral
1555
1540
  * r = a * e^(b*θ)
1556
1541
  */
1557
1542
  calculateLogarithmicRadius(t, i, e, n) {
1558
- const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t), c = i * 0.3 * n, l = a * Math.exp(r * c);
1559
- return s / l * e;
1543
+ 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);
1544
+ return a / l * e;
1560
1545
  }
1561
1546
  /**
1562
1547
  * Utility: Generate random number between min and max
@@ -1565,7 +1550,7 @@ class Te {
1565
1550
  return Math.random() * (i - t) + t;
1566
1551
  }
1567
1552
  }
1568
- const Ae = {
1553
+ const Ce = {
1569
1554
  clusterCount: "auto",
1570
1555
  clusterSpread: 150,
1571
1556
  clusterSpacing: 200,
@@ -1573,7 +1558,7 @@ const Ae = {
1573
1558
  overlap: 0.3,
1574
1559
  distribution: "gaussian"
1575
1560
  };
1576
- class Ce {
1561
+ class Te {
1577
1562
  constructor(t, i = {}) {
1578
1563
  this.config = t, this.imageConfig = i;
1579
1564
  }
@@ -1585,48 +1570,48 @@ class Ce {
1585
1570
  * @returns Array of layout objects with position, rotation, scale
1586
1571
  */
1587
1572
  generate(t, i, e = {}) {
1588
- const n = [], { width: a, height: r } = i, s = { ...Ae, ...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, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.calculateClusterCount(
1573
+ const n = [], { width: s, height: r } = i, a = { ...Ce, ...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(
1589
1574
  t,
1590
- s.clusterCount,
1591
- a,
1575
+ a.clusterCount,
1576
+ s,
1592
1577
  r,
1593
- s.clusterSpacing
1578
+ a.clusterSpacing
1594
1579
  ), m = this.generateClusterCenters(
1595
- g,
1596
- a,
1580
+ f,
1581
+ s,
1597
1582
  r,
1598
1583
  c,
1599
- s
1600
- ), y = new Array(g).fill(0);
1584
+ a
1585
+ ), y = new Array(f).fill(0);
1601
1586
  for (let v = 0; v < t; v++)
1602
- y[v % g]++;
1603
- let w = 0;
1604
- for (let v = 0; v < g; v++) {
1605
- const I = m[v], x = y[v];
1606
- for (let R = 0; R < x; R++) {
1587
+ y[v % f]++;
1588
+ let E = 0;
1589
+ for (let v = 0; v < f; v++) {
1590
+ const S = m[v], w = y[v];
1591
+ for (let I = 0; I < w; I++) {
1607
1592
  let z, L;
1608
- if (s.distribution === "gaussian")
1609
- z = this.gaussianRandom() * I.spread, L = this.gaussianRandom() * I.spread;
1593
+ if (a.distribution === "gaussian")
1594
+ z = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
1610
1595
  else {
1611
- const F = this.random(0, Math.PI * 2), X = this.random(0, I.spread);
1612
- z = Math.cos(F) * X, L = Math.sin(F) * X;
1596
+ const M = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
1597
+ z = Math.cos(M) * X, L = Math.sin(M) * X;
1613
1598
  }
1614
- const _ = 1 + s.overlap * 0.5, O = 1 + s.overlap * 0.3;
1599
+ const _ = 1 + a.overlap * 0.5, O = 1 + a.overlap * 0.3;
1615
1600
  z /= _, L /= _;
1616
- const H = p ? this.random(f, b) : 1, k = O * H, T = l * k;
1617
- let D = I.x + z, G = I.y + L;
1618
- const M = T * 1.5 / 2, A = T / 2;
1619
- D = Math.max(c + M, Math.min(D, a - c - M)), G = Math.max(c + A, Math.min(G, r - c - A));
1620
- const N = u === "random" ? this.random(h, d) : 0, C = Math.sqrt(z * z + L * L) / I.spread, $ = Math.round((1 - C) * 50) + 1;
1601
+ const H = p ? this.random(g, b) : 1, N = O * H, A = l * N;
1602
+ let D = S.x + z, W = S.y + L;
1603
+ const F = A * 1.5 / 2, C = A / 2;
1604
+ D = Math.max(c + F, Math.min(D, s - c - F)), W = Math.max(c + C, Math.min(W, r - c - C));
1605
+ const k = u === "random" ? this.random(h, d) : 0, T = Math.sqrt(z * z + L * L) / S.spread, $ = Math.round((1 - T) * 50) + 1;
1621
1606
  n.push({
1622
- id: w,
1607
+ id: E,
1623
1608
  x: D,
1624
- y: G,
1625
- rotation: N,
1626
- scale: k,
1627
- baseSize: T,
1609
+ y: W,
1610
+ rotation: k,
1611
+ scale: N,
1612
+ baseSize: A,
1628
1613
  zIndex: $
1629
- }), w++;
1614
+ }), E++;
1630
1615
  }
1631
1616
  }
1632
1617
  return n;
@@ -1634,36 +1619,36 @@ class Ce {
1634
1619
  /**
1635
1620
  * Calculate optimal number of clusters based on image count and container
1636
1621
  */
1637
- calculateClusterCount(t, i, e, n, a) {
1622
+ calculateClusterCount(t, i, e, n, s) {
1638
1623
  if (i !== "auto")
1639
1624
  return Math.max(1, Math.min(i, t));
1640
- const s = Math.max(1, Math.ceil(t / 8)), c = Math.floor(
1641
- e / a * (n / a) * 0.6
1625
+ const a = Math.max(1, Math.ceil(t / 8)), c = Math.floor(
1626
+ e / s * (n / s) * 0.6
1642
1627
  );
1643
- return Math.max(1, Math.min(s, c, 10));
1628
+ return Math.max(1, Math.min(a, c, 10));
1644
1629
  }
1645
1630
  /**
1646
1631
  * Generate cluster center positions with spacing constraints
1647
1632
  */
1648
- generateClusterCenters(t, i, e, n, a) {
1649
- const r = [], c = n + a.clusterSpread, l = i - n - a.clusterSpread, u = n + a.clusterSpread, h = e - n - a.clusterSpread;
1633
+ generateClusterCenters(t, i, e, n, s) {
1634
+ const r = [], c = n + s.clusterSpread, l = i - n - s.clusterSpread, u = n + s.clusterSpread, h = e - n - s.clusterSpread;
1650
1635
  for (let d = 0; d < t; d++) {
1651
- let f = null, b = -1;
1636
+ let g = null, b = -1;
1652
1637
  for (let p = 0; p < 100; p++) {
1653
- const g = {
1638
+ const f = {
1654
1639
  x: this.random(c, l),
1655
1640
  y: this.random(u, h),
1656
- spread: this.calculateClusterSpread(a)
1641
+ spread: this.calculateClusterSpread(s)
1657
1642
  };
1658
1643
  let m = 1 / 0;
1659
1644
  for (const y of r) {
1660
- const w = g.x - y.x, v = g.y - y.y, I = Math.sqrt(w * w + v * v);
1661
- m = Math.min(m, I);
1645
+ const E = f.x - y.x, v = f.y - y.y, S = Math.sqrt(E * E + v * v);
1646
+ m = Math.min(m, S);
1662
1647
  }
1663
- if ((r.length === 0 || m > b) && (f = g, b = m), m >= a.clusterSpacing)
1648
+ if ((r.length === 0 || m > b) && (g = f, b = m), m >= s.clusterSpacing)
1664
1649
  break;
1665
1650
  }
1666
- f && r.push(f);
1651
+ g && r.push(g);
1667
1652
  }
1668
1653
  return r;
1669
1654
  }
@@ -1703,29 +1688,29 @@ class Le {
1703
1688
  * @returns Array of layout objects with position, rotation, scale
1704
1689
  */
1705
1690
  generate(t, i, e = {}) {
1706
- const n = [], { width: a, height: r } = i, s = 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, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, p = e.fixedHeight ?? s, g = {
1707
- ...Gt,
1691
+ 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 = {
1692
+ ...Wt,
1708
1693
  ...this.config.wave
1709
- }, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization: I } = g, x = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = a - c - L, H = O - _, k = x > 1 ? H / (x - 1) : 0, T = c + y + p / 2, D = r - c - y - p / 2, G = D - T, U = m > 1 ? G / (m - 1) : 0;
1710
- let M = 0;
1711
- for (let A = 0; A < m && M < t; A++) {
1712
- const N = m === 1 ? (T + D) / 2 : T + A * U;
1713
- let B = 0;
1714
- I === "offset" ? B = A * v : I === "alternating" && (B = A * Math.PI);
1715
- for (let C = 0; C < x && M < t; C++) {
1716
- const $ = x === 1 ? (_ + O) / 2 : _ + C * k, F = this.calculateWaveY($, a, y, w, B), X = $, P = N + F, j = b ? this.random(d, f) : 1, Y = p * j;
1694
+ }, { rows: m, amplitude: y, frequency: E, phaseShift: v, synchronization: S } = f, w = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = s - c - L, H = O - _, N = w > 1 ? H / (w - 1) : 0, A = c + y + p / 2, D = r - c - y - p / 2, W = D - A, U = m > 1 ? W / (m - 1) : 0;
1695
+ let F = 0;
1696
+ for (let C = 0; C < m && F < t; C++) {
1697
+ const k = m === 1 ? (A + D) / 2 : A + C * U;
1698
+ let q = 0;
1699
+ S === "offset" ? q = C * v : S === "alternating" && (q = C * Math.PI);
1700
+ for (let T = 0; T < w && F < t; T++) {
1701
+ const $ = w === 1 ? (_ + O) / 2 : _ + T * N, M = this.calculateWaveY($, s, y, E, q), X = $, P = k + M, B = b ? this.random(d, g) : 1, Y = p * B;
1717
1702
  let V = 0;
1718
- l === "tangent" ? V = this.calculateRotation($, a, y, w, B) : l === "random" && (V = this.random(u, h));
1719
- const K = Y * 1.5 / 2, ct = Y / 2, it = c + K, nt = a - c - K, lt = c + ct, ht = r - c - ct;
1703
+ l === "tangent" ? V = this.calculateRotation($, s, y, E, q) : l === "random" && (V = this.random(u, h));
1704
+ const K = Y * 1.5 / 2, lt = Y / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1720
1705
  n.push({
1721
- id: M,
1722
- x: Math.max(it, Math.min(X, nt)),
1723
- y: Math.max(lt, Math.min(P, ht)),
1706
+ id: F,
1707
+ x: Math.max(nt, Math.min(X, ot)),
1708
+ y: Math.max(ht, Math.min(P, dt)),
1724
1709
  rotation: V,
1725
- scale: j,
1710
+ scale: B,
1726
1711
  baseSize: Y,
1727
- zIndex: M + 1
1728
- }), M++;
1712
+ zIndex: F + 1
1713
+ }), F++;
1729
1714
  }
1730
1715
  }
1731
1716
  return n;
@@ -1739,9 +1724,9 @@ class Le {
1739
1724
  * @param phase - Phase offset
1740
1725
  * @returns Y displacement from baseline
1741
1726
  */
1742
- calculateWaveY(t, i, e, n, a) {
1727
+ calculateWaveY(t, i, e, n, s) {
1743
1728
  const r = t / i;
1744
- return e * Math.sin(n * r * 2 * Math.PI + a);
1729
+ return e * Math.sin(n * r * 2 * Math.PI + s);
1745
1730
  }
1746
1731
  /**
1747
1732
  * Calculate rotation based on wave tangent
@@ -1752,9 +1737,9 @@ class Le {
1752
1737
  * @param phase - Phase offset
1753
1738
  * @returns Rotation angle in degrees
1754
1739
  */
1755
- calculateRotation(t, i, e, n, a) {
1756
- const r = t / i, s = e * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + a) / i;
1757
- return Math.atan(s) * (180 / Math.PI);
1740
+ calculateRotation(t, i, e, n, s) {
1741
+ const r = t / i, a = e * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + s) / i;
1742
+ return Math.atan(a) * (180 / Math.PI);
1758
1743
  }
1759
1744
  /**
1760
1745
  * Estimate image width based on height
@@ -1768,7 +1753,7 @@ class Le {
1768
1753
  return Math.random() * (i - t) + t;
1769
1754
  }
1770
1755
  }
1771
- const xt = 100, Q = 100 / Math.sqrt(3), Et = [
1756
+ const wt = 100, Q = 100 / Math.sqrt(3), xt = [
1772
1757
  [Q / 2, 0],
1773
1758
  // upper-left
1774
1759
  [3 * Q / 2, 0],
@@ -1781,18 +1766,18 @@ const xt = 100, Q = 100 / Math.sqrt(3), Et = [
1781
1766
  // lower-left
1782
1767
  [0, 50]
1783
1768
  // left
1784
- ], Me = Et[1][0] / xt, Fe = Et[2][1] / xt;
1769
+ ], Fe = xt[1][0] / wt, Me = xt[2][1] / wt;
1785
1770
  function ze(o) {
1786
1771
  return {
1787
- colStep: Me * o,
1788
- rowOffset: Fe * o
1772
+ colStep: Fe * o,
1773
+ rowOffset: Me * o
1789
1774
  };
1790
1775
  }
1791
- function Oe(o, t, i, e, n, a) {
1792
- const { colStep: r } = ze(a);
1776
+ function Oe(o, t, i, e, n, s) {
1777
+ const { colStep: r } = ze(s);
1793
1778
  return {
1794
1779
  px: e + r * o,
1795
- py: n + a * (t + o / 2)
1780
+ py: n + s * (t + o / 2)
1796
1781
  };
1797
1782
  }
1798
1783
  const De = [
@@ -1807,9 +1792,9 @@ function $e(o) {
1807
1792
  if (o === 0) return [[0, 0, 0]];
1808
1793
  const t = [];
1809
1794
  let [i, e, n] = [0, -o, o];
1810
- for (const [a, r, s] of De)
1795
+ for (const [s, r, a] of De)
1811
1796
  for (let c = 0; c < o; c++)
1812
- t.push([i, e, n]), i += a, e += r, n += s;
1797
+ t.push([i, e, n]), i += s, e += r, n += a;
1813
1798
  return t;
1814
1799
  }
1815
1800
  class Pe {
@@ -1819,26 +1804,26 @@ class Pe {
1819
1804
  this.config = t;
1820
1805
  }
1821
1806
  generate(t, i, e = {}) {
1822
- const n = [], { width: a, height: r } = i, s = a / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1823
- ...qt,
1807
+ const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1808
+ ...Gt,
1824
1809
  ...this.config.honeycomb
1825
1810
  }.spacing ?? 0, d = l + h;
1826
- let f = 0, b = 0;
1827
- for (; f < t; ) {
1811
+ let g = 0, b = 0;
1812
+ for (; g < t; ) {
1828
1813
  const p = $e(b);
1829
- for (const [g, m, y] of p) {
1830
- if (f >= t) break;
1831
- const { px: w, py: v } = Oe(g, m, y, s, c, d);
1814
+ for (const [f, m, y] of p) {
1815
+ if (g >= t) break;
1816
+ const { px: E, py: v } = Oe(f, m, y, a, c, d);
1832
1817
  n.push({
1833
- id: f,
1834
- x: w,
1818
+ id: g,
1819
+ x: E,
1835
1820
  y: v,
1836
1821
  rotation: 0,
1837
1822
  scale: 1,
1838
1823
  baseSize: l,
1839
1824
  // Inner rings render above outer rings
1840
1825
  zIndex: Math.max(1, 100 - b)
1841
- }), f++;
1826
+ }), g++;
1842
1827
  }
1843
1828
  b++;
1844
1829
  }
@@ -1856,19 +1841,19 @@ class _e {
1856
1841
  initLayout() {
1857
1842
  switch (this.config.algorithm) {
1858
1843
  case "radial":
1859
- return new xe(this.config, this.imageConfig);
1844
+ return new we(this.config, this.imageConfig);
1860
1845
  case "grid":
1861
1846
  return new Se(this.config, this.imageConfig);
1862
1847
  case "spiral":
1863
- return new Te(this.config, this.imageConfig);
1848
+ return new Ae(this.config, this.imageConfig);
1864
1849
  case "cluster":
1865
- return new Ce(this.config, this.imageConfig);
1850
+ return new Te(this.config, this.imageConfig);
1866
1851
  case "wave":
1867
1852
  return new Le(this.config, this.imageConfig);
1868
1853
  case "honeycomb":
1869
1854
  return new Pe(this.config, this.imageConfig);
1870
1855
  default:
1871
- return new we(this.config, this.imageConfig);
1856
+ return new Ee(this.config, this.imageConfig);
1872
1857
  }
1873
1858
  }
1874
1859
  /**
@@ -1880,8 +1865,8 @@ class _e {
1880
1865
  */
1881
1866
  generateLayout(t, i, e = {}) {
1882
1867
  const n = this.placementLayout.generate(t, i, e);
1883
- return n.forEach((a) => {
1884
- this.layouts.set(a.id, a);
1868
+ return n.forEach((s) => {
1869
+ this.layouts.set(s.id, s);
1885
1870
  }), n;
1886
1871
  }
1887
1872
  /**
@@ -1935,8 +1920,8 @@ class _e {
1935
1920
  return;
1936
1921
  if (typeof e == "number")
1937
1922
  return e;
1938
- const n = e, a = this.resolveBreakpoint(t);
1939
- return a === "mobile" ? n.mobile ?? n.tablet ?? n.screen : a === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
1923
+ const n = e, s = this.resolveBreakpoint(t);
1924
+ return s === "mobile" ? n.mobile ?? n.tablet ?? n.screen : s === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
1940
1925
  }
1941
1926
  /**
1942
1927
  * Calculate adaptive image size based on container dimensions and image count
@@ -1947,16 +1932,16 @@ class _e {
1947
1932
  * @returns Calculated sizing result with height
1948
1933
  */
1949
1934
  calculateAdaptiveSize(t, i, e, n) {
1950
- const a = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1935
+ const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1951
1936
  if (r !== void 0)
1952
1937
  return { height: r };
1953
- const s = a?.minSize ?? 50, c = a?.maxSize ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * l / i;
1938
+ 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;
1954
1939
  let m = Math.sqrt(p / 1.4);
1955
1940
  m *= u, m = Math.min(m, e);
1956
- let y = this.clamp(m, s, c);
1957
- if (y === s && m < s) {
1958
- const w = Math.max(s * 0.05, 20);
1959
- y = Math.max(w, m);
1941
+ let y = this.clamp(m, a, c);
1942
+ if (y === a && m < a) {
1943
+ const E = Math.max(a * 0.05, 20);
1944
+ y = Math.max(E, m);
1960
1945
  }
1961
1946
  return this.config.algorithm === "honeycomb" && (y = Math.min(y, this.honeycombMaxImageHeight(i, t))), { height: y };
1962
1947
  }
@@ -1970,7 +1955,7 @@ class _e {
1970
1955
  let e = 0, n = 1;
1971
1956
  for (; n < t; )
1972
1957
  e++, n += 6 * e;
1973
- const a = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, s = i.width / 2, c = i.height / 2, l = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (c - a - r * e) / (e + 0.5), d = (s - a - l * r * e) / (l * e + u);
1958
+ 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);
1974
1959
  return Math.max(10, Math.min(h, d));
1975
1960
  }
1976
1961
  /**
@@ -1980,7 +1965,7 @@ class _e {
1980
1965
  return Math.max(i, Math.min(e, t));
1981
1966
  }
1982
1967
  }
1983
- var S = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(S || {});
1968
+ var x = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(x || {});
1984
1969
  const Lt = {
1985
1970
  // Geometric shapes - uses percentages for responsive sizing
1986
1971
  circle: "circle(50%)",
@@ -2014,8 +1999,8 @@ const Lt = {
2014
1999
  },
2015
2000
  // Hexagon - regular hexagon (reference points imported from hexagonGeometry)
2016
2001
  hexagon: {
2017
- refHeight: xt,
2018
- points: Et
2002
+ refHeight: wt,
2003
+ points: xt
2019
2004
  },
2020
2005
  // Octagon - regular octagon
2021
2006
  octagon: {
@@ -2032,25 +2017,25 @@ function He(o) {
2032
2017
  if (o)
2033
2018
  return o in Lt ? Lt[o] : o;
2034
2019
  }
2035
- function ke(o, t, i) {
2020
+ function Ne(o, t, i) {
2036
2021
  const e = Ue[o];
2037
2022
  if (!e) return "";
2038
2023
  const n = t / e.refHeight;
2039
2024
  if (o === "circle")
2040
2025
  return `circle(${Math.round(50 * n * 100) / 100}px)`;
2041
- const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, l = (Math.max(...a) - Math.min(...a)) * n, u = (i ?? l) / 2, h = t / 2, d = u - s, f = h - c;
2042
- return `polygon(${e.points.map(([p, g]) => {
2043
- const m = Math.round((p * n + d) * 100) / 100, y = Math.round((g * n + f) * 100) / 100;
2026
+ 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;
2027
+ return `polygon(${e.points.map(([p, f]) => {
2028
+ const m = Math.round((p * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
2044
2029
  return `${m}px ${y}px`;
2045
2030
  }).join(", ")})`;
2046
2031
  }
2047
- function Ne(o) {
2032
+ function ke(o) {
2048
2033
  return o in mt;
2049
2034
  }
2050
- function je(o) {
2051
- return o ? Ne(o) ? mt[o] : o : mt.md;
2035
+ function Be(o) {
2036
+ return o ? ke(o) ? mt[o] : o : mt.md;
2052
2037
  }
2053
- function We(o) {
2038
+ function je(o) {
2054
2039
  if (!o) return "";
2055
2040
  const t = [];
2056
2041
  if (o.grayscale !== void 0 && t.push(`grayscale(${o.grayscale})`), o.blur !== void 0 && t.push(`blur(${o.blur}px)`), o.brightness !== void 0 && t.push(`brightness(${o.brightness})`), o.contrast !== void 0 && t.push(`contrast(${o.contrast})`), o.saturate !== void 0 && t.push(`saturate(${o.saturate})`), o.opacity !== void 0 && t.push(`opacity(${o.opacity})`), o.sepia !== void 0 && t.push(`sepia(${o.sepia})`), o.hueRotate !== void 0 && t.push(`hue-rotate(${o.hueRotate}deg)`), o.invert !== void 0 && t.push(`invert(${o.invert})`), o.dropShadow !== void 0)
@@ -2068,47 +2053,47 @@ function tt(o) {
2068
2053
  const t = o.width ?? 0, i = o.style ?? "solid", e = o.color ?? "#000000";
2069
2054
  return `${t}px ${i} ${e}`;
2070
2055
  }
2071
- function et(o, t, i) {
2056
+ function it(o, t, i) {
2072
2057
  if (!o) return {};
2073
2058
  const e = {};
2074
2059
  if (o.borderRadiusTopLeft !== void 0 || o.borderRadiusTopRight !== void 0 || o.borderRadiusBottomRight !== void 0 || o.borderRadiusBottomLeft !== void 0) {
2075
- const s = o.border?.radius ?? 0;
2076
- 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`);
2060
+ const a = o.border?.radius ?? 0;
2061
+ 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`);
2077
2062
  } else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
2078
2063
  if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
2079
- const s = o.border || {}, c = { ...s, ...o.borderTop }, l = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, h = { ...s, ...o.borderLeft };
2064
+ const a = o.border || {}, c = { ...a, ...o.borderTop }, l = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, h = { ...a, ...o.borderLeft };
2080
2065
  e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
2081
2066
  } else o.border && (e.border = tt(o.border));
2082
- o.shadow !== void 0 && (e.boxShadow = je(o.shadow));
2083
- const r = We(o.filter);
2067
+ o.shadow !== void 0 && (e.boxShadow = Be(o.shadow));
2068
+ const r = je(o.filter);
2084
2069
  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) {
2085
- const s = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
2086
- e.outline = `${s}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2070
+ const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
2071
+ e.outline = `${a}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2087
2072
  }
2088
2073
  if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
2089
- let s;
2074
+ let a;
2090
2075
  const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
2091
2076
  if (l?.mode === "height-relative" && t)
2092
- s = ke(l.shape, t, i);
2077
+ a = Ne(l.shape, t, i);
2093
2078
  else {
2094
2079
  const u = c && l ? l.shape : o.clipPath;
2095
- s = He(u);
2080
+ a = He(u);
2096
2081
  }
2097
- s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
2082
+ a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
2098
2083
  }
2099
2084
  return e;
2100
2085
  }
2101
- function Ge(o, t) {
2086
+ function We(o, t) {
2102
2087
  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);
2103
2088
  }
2104
- function ft(o, t, i, e) {
2105
- const n = et(t, i, e);
2106
- Ge(o, n);
2089
+ function st(o, t, i, e) {
2090
+ const n = it(t, i, e);
2091
+ We(o, n);
2107
2092
  }
2108
2093
  function Pt(o) {
2109
2094
  return o ? Array.isArray(o) ? o.join(" ") : o : "";
2110
2095
  }
2111
- function st(o, t) {
2096
+ function et(o, t) {
2112
2097
  const i = Pt(t);
2113
2098
  i && i.split(" ").forEach((e) => {
2114
2099
  e.trim() && o.classList.add(e.trim());
@@ -2120,13 +2105,13 @@ function pt(o, t) {
2120
2105
  e.trim() && o.classList.remove(e.trim());
2121
2106
  });
2122
2107
  }
2123
- const Mt = {
2108
+ const Ft = {
2124
2109
  UNFOCUSING: 999,
2125
2110
  FOCUSING: 1e3
2126
2111
  };
2127
- class qe {
2112
+ class Ge {
2128
2113
  constructor(t, i, e) {
2129
- this.state = S.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;
2114
+ 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;
2130
2115
  }
2131
2116
  /**
2132
2117
  * Set callback to be fired when an unfocus animation fully completes.
@@ -2144,7 +2129,7 @@ class qe {
2144
2129
  * Check if any animation is in progress
2145
2130
  */
2146
2131
  isAnimating() {
2147
- return this.state !== S.IDLE && this.state !== S.FOCUSED;
2132
+ return this.state !== x.IDLE && this.state !== x.FOCUSED;
2148
2133
  }
2149
2134
  /**
2150
2135
  * Normalize scalePercent value
@@ -2157,19 +2142,19 @@ class qe {
2157
2142
  * Returns actual pixel dimensions instead of scale factor for sharper rendering
2158
2143
  */
2159
2144
  calculateFocusDimensions(t, i, e) {
2160
- const n = this.normalizeScalePercent(this.config.scalePercent), a = e.height * n, r = t / i;
2161
- let s = a, c = s * r;
2145
+ const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
2146
+ let a = s, c = a * r;
2162
2147
  const l = e.width * n;
2163
- return c > l && (c = l, s = c / r), { width: c, height: s };
2148
+ return c > l && (c = l, a = c / r), { width: c, height: a };
2164
2149
  }
2165
2150
  /**
2166
2151
  * Calculate the transform needed to center an image (position only, no scale)
2167
2152
  * Scale is handled by animating actual dimensions for sharper rendering
2168
2153
  */
2169
2154
  calculateFocusTransform(t, i) {
2170
- const e = t.width / 2, n = t.height / 2, a = e - i.x, r = n - i.y;
2155
+ const e = t.width / 2, n = t.height / 2, s = e - i.x, r = n - i.y;
2171
2156
  return {
2172
- x: a,
2157
+ x: s,
2173
2158
  y: r,
2174
2159
  rotation: 0,
2175
2160
  scale: 1
@@ -2191,19 +2176,19 @@ class qe {
2191
2176
  * Create a Web Animation that animates both transform (position) and dimensions
2192
2177
  * This provides sharper zoom by re-rendering at target size instead of scaling pixels
2193
2178
  */
2194
- animateWithDimensions(t, i, e, n, a, r, s, c) {
2179
+ animateWithDimensions(t, i, e, n, s, r, a, c) {
2195
2180
  const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2196
2181
  return t.style.transition = "none", t.animate(
2197
2182
  [
2198
2183
  {
2199
2184
  transform: l,
2200
2185
  width: `${n}px`,
2201
- height: `${a}px`
2186
+ height: `${s}px`
2202
2187
  },
2203
2188
  {
2204
2189
  transform: u,
2205
2190
  width: `${r}px`,
2206
- height: `${s}px`
2191
+ height: `${a}px`
2207
2192
  }
2208
2193
  ],
2209
2194
  {
@@ -2218,8 +2203,8 @@ class qe {
2218
2203
  * Applies all focused styling properties, classes, and z-index
2219
2204
  */
2220
2205
  applyFocusedStyling(t, i) {
2221
- if (t.style.zIndex = String(i), t.classList.add("fbn-ic-focused"), st(t, this.focusedClassName), this.styling?.focused) {
2222
- const e = et(this.styling.focused, t.offsetHeight, t.offsetWidth);
2206
+ if (t.style.zIndex = String(i), t.classList.add("fbn-ic-focused"), et(t, this.focusedClassName), this.styling?.focused) {
2207
+ const e = it(this.styling.focused, t.offsetHeight, t.offsetWidth);
2223
2208
  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);
2224
2209
  }
2225
2210
  }
@@ -2229,7 +2214,7 @@ class qe {
2229
2214
  */
2230
2215
  removeFocusedStyling(t, i) {
2231
2216
  if (t.style.zIndex = i, t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName), this.styling?.default) {
2232
- const e = et(this.styling.default, t.offsetHeight, t.offsetWidth);
2217
+ const e = it(this.styling.default, t.offsetHeight, t.offsetWidth);
2233
2218
  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);
2234
2219
  }
2235
2220
  }
@@ -2240,11 +2225,11 @@ class qe {
2240
2225
  startClipPathAnimation(t, i, e) {
2241
2226
  let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
2242
2227
  e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
2243
- const a = () => {
2244
- const r = t.offsetHeight, s = t.offsetWidth, c = et(n, r, s);
2245
- 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(a);
2228
+ const s = () => {
2229
+ const r = t.offsetHeight, a = t.offsetWidth, c = it(n, r, a);
2230
+ 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);
2246
2231
  };
2247
- requestAnimationFrame(a);
2232
+ requestAnimationFrame(s);
2248
2233
  }
2249
2234
  /**
2250
2235
  * Start focus animation for an image using dimension-based zoom
@@ -2252,27 +2237,27 @@ class qe {
2252
2237
  * @param fromTransform - Optional starting transform (for mid-animation reversals)
2253
2238
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2254
2239
  */
2255
- startFocusAnimation(t, i, e, n, a) {
2256
- const r = t.style.zIndex || "", s = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(s, c, i), u = this.calculateFocusTransform(i, e);
2240
+ startFocusAnimation(t, i, e, n, s) {
2241
+ const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2257
2242
  this.animationEngine.cancelAllAnimations(t);
2258
2243
  const h = this.config.animationDuration ?? 600;
2259
- this.applyFocusedStyling(t, Mt.FOCUSING);
2244
+ this.applyFocusedStyling(t, Ft.FOCUSING);
2260
2245
  const d = n ?? {
2261
2246
  x: 0,
2262
2247
  y: 0,
2263
2248
  rotation: e.rotation,
2264
2249
  scale: 1
2265
2250
  // No scale - using dimensions
2266
- }, f = a?.width ?? s, b = a?.height ?? c, p = this.animateWithDimensions(
2251
+ }, g = s?.width ?? a, b = s?.height ?? c, p = this.animateWithDimensions(
2267
2252
  t,
2268
2253
  d,
2269
2254
  u,
2270
- f,
2255
+ g,
2271
2256
  b,
2272
2257
  l.width,
2273
2258
  l.height,
2274
2259
  h
2275
- ), g = {
2260
+ ), f = {
2276
2261
  id: `focus-${Date.now()}`,
2277
2262
  element: t,
2278
2263
  animation: p,
@@ -2286,16 +2271,16 @@ class qe {
2286
2271
  originalState: e,
2287
2272
  focusTransform: u,
2288
2273
  originalZIndex: r,
2289
- originalWidth: s,
2274
+ originalWidth: a,
2290
2275
  originalHeight: c,
2291
2276
  focusWidth: l.width,
2292
2277
  focusHeight: l.height
2293
- }, this.startClipPathAnimation(t, g, !0), {
2278
+ }, this.startClipPathAnimation(t, f, !0), {
2294
2279
  element: t,
2295
2280
  originalState: e,
2296
- animationHandle: g,
2281
+ animationHandle: f,
2297
2282
  direction: "in",
2298
- originalWidth: s,
2283
+ originalWidth: a,
2299
2284
  originalHeight: c
2300
2285
  };
2301
2286
  }
@@ -2305,10 +2290,10 @@ class qe {
2305
2290
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2306
2291
  */
2307
2292
  startUnfocusAnimation(t, i, e, n) {
2308
- t.style.zIndex = String(Mt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2309
- const a = this.config.animationDuration ?? 600;
2293
+ t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2294
+ const s = this.config.animationDuration ?? 600;
2310
2295
  t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
2311
- const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
2296
+ 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 = {
2312
2297
  x: 0,
2313
2298
  y: 0,
2314
2299
  rotation: i.rotation,
@@ -2318,24 +2303,24 @@ class qe {
2318
2303
  t,
2319
2304
  r,
2320
2305
  l,
2321
- s,
2306
+ a,
2322
2307
  c,
2323
2308
  u,
2324
2309
  h,
2325
- a
2326
- ), f = {
2310
+ s
2311
+ ), g = {
2327
2312
  id: `unfocus-${Date.now()}`,
2328
2313
  element: t,
2329
2314
  animation: d,
2330
2315
  fromState: r,
2331
2316
  toState: l,
2332
2317
  startTime: performance.now(),
2333
- duration: a
2318
+ duration: s
2334
2319
  };
2335
- return this.startClipPathAnimation(t, f, !1), {
2320
+ return this.startClipPathAnimation(t, g, !1), {
2336
2321
  element: t,
2337
2322
  originalState: i,
2338
- animationHandle: f,
2323
+ animationHandle: g,
2339
2324
  direction: "out",
2340
2325
  originalWidth: u,
2341
2326
  originalHeight: h
@@ -2356,10 +2341,10 @@ class qe {
2356
2341
  * Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
2357
2342
  */
2358
2343
  captureMidAnimationState(t) {
2359
- 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, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
2360
- return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${c}deg)`, t.style.transition = "none", {
2361
- transform: { x: r, y: s, rotation: c, scale: 1 },
2362
- dimensions: { width: n, height: a }
2344
+ 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);
2345
+ 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", {
2346
+ transform: { x: r, y: a, rotation: c, scale: 1 },
2347
+ dimensions: { width: n, height: s }
2363
2348
  };
2364
2349
  }
2365
2350
  /**
@@ -2374,36 +2359,36 @@ class qe {
2374
2359
  /**
2375
2360
  * Reset an element instantly to its original position and dimensions (no animation)
2376
2361
  */
2377
- resetElementInstantly(t, i, e, n, a) {
2362
+ resetElementInstantly(t, i, e, n, s) {
2378
2363
  this.animationEngine.cancelAllAnimations(t);
2379
2364
  const r = ["translate(-50%, -50%)"];
2380
- 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);
2365
+ 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);
2381
2366
  }
2382
2367
  /**
2383
2368
  * Focus (zoom) an image to center of container
2384
2369
  * Implements cross-animation when swapping focus
2385
2370
  */
2386
2371
  async focusImage(t, i, e) {
2387
- if (this.currentFocus === t && this.state === S.FOCUSED)
2372
+ if (this.currentFocus === t && this.state === x.FOCUSED)
2388
2373
  return this.unfocusImage();
2389
- if (this.incoming?.element === t && this.state === S.FOCUSING) {
2390
- const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
2374
+ if (this.incoming?.element === t && this.state === x.FOCUSING) {
2375
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2391
2376
  this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
2392
2377
  t,
2393
2378
  this.incoming.originalState,
2394
- a,
2379
+ s,
2395
2380
  r
2396
- ), this.incoming = null, this.state = S.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 = S.IDLE;
2381
+ ), 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;
2397
2382
  return;
2398
2383
  }
2399
2384
  const n = ++this.focusGeneration;
2400
2385
  switch (this.state) {
2401
- case S.IDLE:
2402
- if (this.state = S.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2403
- this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2386
+ case x.IDLE:
2387
+ if (this.state = x.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2388
+ this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2404
2389
  break;
2405
- case S.FOCUSED:
2406
- if (this.state = S.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
2390
+ case x.FOCUSED:
2391
+ if (this.state = x.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
2407
2392
  this.currentFocus,
2408
2393
  this.focusData.originalState
2409
2394
  )), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
@@ -2412,12 +2397,12 @@ class qe {
2412
2397
  ]), this.focusGeneration !== n)
2413
2398
  return;
2414
2399
  if (this.outgoing) {
2415
- const a = this.outgoing.element;
2416
- this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2400
+ const s = this.outgoing.element;
2401
+ this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2417
2402
  }
2418
- this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2403
+ this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2419
2404
  break;
2420
- case S.FOCUSING:
2405
+ case x.FOCUSING:
2421
2406
  if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
2422
2407
  this.incoming.element,
2423
2408
  this.incoming.originalState,
@@ -2425,43 +2410,43 @@ class qe {
2425
2410
  this.focusData?.originalWidth,
2426
2411
  this.focusData?.originalHeight
2427
2412
  ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2428
- this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2413
+ this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2429
2414
  break;
2430
- case S.UNFOCUSING:
2431
- if (this.state = S.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2415
+ case x.UNFOCUSING:
2416
+ if (this.state = x.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2432
2417
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2433
2418
  this.waitForAnimation(this.incoming.animationHandle)
2434
2419
  ]), this.focusGeneration !== n) return;
2435
2420
  if (this.outgoing) {
2436
- const a = this.outgoing.element;
2437
- this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2421
+ const s = this.outgoing.element;
2422
+ this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2438
2423
  }
2439
- this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2424
+ this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2440
2425
  break;
2441
- case S.CROSS_ANIMATING:
2426
+ case x.CROSS_ANIMATING:
2442
2427
  if (this.incoming?.element === t)
2443
2428
  return;
2444
2429
  if (this.outgoing?.element === t) {
2445
- const { transform: a, dimensions: r } = this.captureMidAnimationState(t);
2430
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2446
2431
  if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
2447
- const { transform: s, dimensions: c } = this.captureMidAnimationState(this.incoming.element);
2432
+ const { transform: a, dimensions: c } = this.captureMidAnimationState(this.incoming.element);
2448
2433
  this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2449
2434
  this.incoming.element,
2450
2435
  this.incoming.originalState,
2451
- s,
2436
+ a,
2452
2437
  c
2453
2438
  );
2454
2439
  } else
2455
2440
  this.outgoing = null;
2456
- if (this.incoming = this.startFocusAnimation(t, i, e, a, r), await Promise.all([
2441
+ if (this.incoming = this.startFocusAnimation(t, i, e, s, r), await Promise.all([
2457
2442
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2458
2443
  this.waitForAnimation(this.incoming.animationHandle)
2459
2444
  ]), this.focusGeneration !== n) return;
2460
2445
  if (this.outgoing) {
2461
- const s = this.outgoing.element;
2462
- this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2446
+ const a = this.outgoing.element;
2447
+ this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2463
2448
  }
2464
- this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2449
+ this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2465
2450
  return;
2466
2451
  }
2467
2452
  if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
@@ -2471,11 +2456,11 @@ class qe {
2471
2456
  this.outgoing.originalWidth,
2472
2457
  this.outgoing.originalHeight
2473
2458
  ), this.outgoing = null), this.incoming) {
2474
- const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2459
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2475
2460
  this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2476
2461
  this.incoming.element,
2477
2462
  this.incoming.originalState,
2478
- a,
2463
+ s,
2479
2464
  r
2480
2465
  );
2481
2466
  }
@@ -2484,10 +2469,10 @@ class qe {
2484
2469
  this.waitForAnimation(this.incoming.animationHandle)
2485
2470
  ]), this.focusGeneration !== n) return;
2486
2471
  if (this.outgoing) {
2487
- const a = this.outgoing.element;
2488
- this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2472
+ const s = this.outgoing.element;
2473
+ this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2489
2474
  }
2490
- this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2475
+ this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2491
2476
  break;
2492
2477
  }
2493
2478
  }
@@ -2495,45 +2480,45 @@ class qe {
2495
2480
  * Unfocus current image, returning it to original position
2496
2481
  */
2497
2482
  async unfocusImage() {
2498
- if (this.state === S.UNFOCUSING)
2483
+ if (this.state === x.UNFOCUSING)
2499
2484
  return;
2500
2485
  const t = ++this.focusGeneration;
2501
2486
  if (!this.currentFocus || !this.focusData) {
2502
- if (this.incoming && this.state === S.FOCUSING) {
2503
- const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2487
+ if (this.incoming && this.state === x.FOCUSING) {
2488
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2504
2489
  if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2505
2490
  this.incoming.element,
2506
2491
  this.incoming.originalState,
2507
- a,
2492
+ s,
2508
2493
  r
2509
- ), this.incoming = null, this.state = S.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2510
- const s = this.outgoing.element;
2511
- this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(s);
2494
+ ), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2495
+ const a = this.outgoing.element;
2496
+ this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(a);
2512
2497
  }
2513
2498
  return;
2514
2499
  }
2515
- if (this.state === S.CROSS_ANIMATING && this.incoming) {
2516
- const { transform: a, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2500
+ if (this.state === x.CROSS_ANIMATING && this.incoming) {
2501
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2517
2502
  this.animationEngine.cancelAllAnimations(this.incoming.element);
2518
- const s = this.startUnfocusAnimation(
2503
+ const a = this.startUnfocusAnimation(
2519
2504
  this.incoming.element,
2520
2505
  this.incoming.originalState,
2521
- a,
2506
+ s,
2522
2507
  r
2523
2508
  );
2524
2509
  if (await Promise.all([
2525
2510
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2526
- this.waitForAnimation(s.animationHandle)
2511
+ this.waitForAnimation(a.animationHandle)
2527
2512
  ]), this.focusGeneration !== t) return;
2528
2513
  let c = null;
2529
2514
  this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
2530
- const l = s.element;
2531
- this.removeFocusedStyling(l, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(l);
2515
+ const l = a.element;
2516
+ 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);
2532
2517
  return;
2533
2518
  }
2534
- this.state = S.UNFOCUSING;
2519
+ this.state = x.UNFOCUSING;
2535
2520
  const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
2536
- this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(i));
2521
+ this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(i));
2537
2522
  }
2538
2523
  /**
2539
2524
  * Swap focus from current image to a new one (alias for focusImage with cross-animation)
@@ -2551,7 +2536,7 @@ class qe {
2551
2536
  * Check if an image is currently focused (stable state)
2552
2537
  */
2553
2538
  isFocused(t) {
2554
- return this.currentFocus === t && this.state === S.FOCUSED;
2539
+ return this.currentFocus === t && this.state === x.FOCUSED;
2555
2540
  }
2556
2541
  /**
2557
2542
  * Check if an image is the target of current focus animation
@@ -2572,9 +2557,9 @@ class qe {
2572
2557
  * Used during swipe gestures for visual feedback
2573
2558
  */
2574
2559
  setDragOffset(t) {
2575
- if (!this.currentFocus || !this.focusData || this.state !== S.FOCUSED) return;
2576
- const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], a = (e.x ?? 0) + t, r = e.y ?? 0;
2577
- 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(" ");
2560
+ if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2561
+ const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
2562
+ 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(" ");
2578
2563
  }
2579
2564
  /**
2580
2565
  * Clear the drag offset, optionally animating back to center
@@ -2582,10 +2567,10 @@ class qe {
2582
2567
  * @param duration - Animation duration in ms (default 150)
2583
2568
  */
2584
2569
  clearDragOffset(t, i = 150) {
2585
- if (!this.currentFocus || !this.focusData || this.state !== S.FOCUSED) return;
2586
- const e = this.currentFocus, n = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = n.x ?? 0, s = n.y ?? 0;
2587
- a.push(`translate(${r}px, ${s}px)`), n.rotation !== void 0 && a.push(`rotate(${n.rotation}deg)`);
2588
- const c = a.join(" ");
2570
+ if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2571
+ const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
2572
+ s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
2573
+ const c = s.join(" ");
2589
2574
  t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = c, setTimeout(() => {
2590
2575
  this.currentFocus === e && (e.style.transition = "none");
2591
2576
  }, i)) : (e.style.transition = "none", e.style.transform = c);
@@ -2612,10 +2597,10 @@ class qe {
2612
2597
  this.focusData.originalZIndex,
2613
2598
  this.focusData.originalWidth,
2614
2599
  this.focusData.originalHeight
2615
- ), this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2600
+ ), this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2616
2601
  }
2617
2602
  }
2618
- const Be = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, at = class at {
2603
+ const qe = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, rt = class rt {
2619
2604
  constructor(t, i) {
2620
2605
  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);
2621
2606
  }
@@ -2642,7 +2627,7 @@ const Be = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, at = class at {
2642
2627
  * Used to prevent click-outside from unfocusing immediately after touch
2643
2628
  */
2644
2629
  hadRecentTouch() {
2645
- return Date.now() - this.recentTouchTimestamp < at.TOUCH_CLICK_DELAY;
2630
+ return Date.now() - this.recentTouchTimestamp < rt.TOUCH_CLICK_DELAY;
2646
2631
  }
2647
2632
  handleTouchStart(t) {
2648
2633
  if (t.touches.length !== 1) return;
@@ -2661,28 +2646,28 @@ const Be = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, at = class at {
2661
2646
  if (!this.touchState || t.touches.length !== 1) return;
2662
2647
  const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
2663
2648
  if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
2664
- const s = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2665
- this.touchState.isHorizontalSwipe = s <= Ke;
2649
+ const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2650
+ this.touchState.isHorizontalSwipe = a <= Ke;
2666
2651
  }
2667
2652
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
2668
2653
  t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
2669
- const a = e * Ve;
2670
- this.callbacks.onDragOffset(a);
2654
+ const s = e * Ve;
2655
+ this.callbacks.onDragOffset(s);
2671
2656
  }
2672
2657
  }
2673
2658
  handleTouchEnd(t) {
2674
2659
  if (!this.touchState) return;
2675
2660
  this.recentTouchTimestamp = Date.now();
2676
- const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, a = Math.abs(i);
2661
+ const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
2677
2662
  let r = !1;
2678
- this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= Be || n >= Xe && a >= Ye) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2663
+ this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= qe || n >= Xe && s >= Ye) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2679
2664
  }
2680
2665
  handleTouchCancel(t) {
2681
2666
  this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
2682
2667
  }
2683
2668
  };
2684
- at.TOUCH_CLICK_DELAY = 300;
2685
- let bt = at;
2669
+ rt.TOUCH_CLICK_DELAY = 300;
2670
+ let bt = rt;
2686
2671
  class Ze {
2687
2672
  constructor(t) {
2688
2673
  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)
@@ -2697,8 +2682,8 @@ class Ze {
2697
2682
  for (const i of this.sources)
2698
2683
  if ("folders" in i)
2699
2684
  for (const e of i.folders) {
2700
- const n = i.recursive !== void 0 ? i.recursive : !0, a = await this.loadFromFolder(e, t, n);
2701
- this._discoveredUrls.push(...a);
2685
+ const n = i.recursive !== void 0 ? i.recursive : !0, s = await this.loadFromFolder(e, t, n);
2686
+ this._discoveredUrls.push(...s);
2702
2687
  }
2703
2688
  else if ("files" in i) {
2704
2689
  const e = await this.loadFiles(i.files, t);
@@ -2764,8 +2749,8 @@ class Ze {
2764
2749
  return this.loadImagesDirectly(n, i);
2765
2750
  try {
2766
2751
  return e ? await this.loadImagesRecursively(n, i) : await this.loadImagesFromSingleFolder(n, i);
2767
- } catch (a) {
2768
- return console.error("Error loading from Google Drive API:", a), this.loadImagesDirectly(n, i);
2752
+ } catch (s) {
2753
+ return console.error("Error loading from Google Drive API:", s), this.loadImagesDirectly(n, i);
2769
2754
  }
2770
2755
  }
2771
2756
  /**
@@ -2775,10 +2760,10 @@ class Ze {
2775
2760
  * @returns Promise resolving to array of image URLs
2776
2761
  */
2777
2762
  async loadImagesFromSingleFolder(t, i) {
2778
- 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);
2779
- if (!s.ok)
2780
- throw new Error(`API request failed: ${s.status} ${s.statusText}`);
2781
- const l = (await s.json()).files.filter(
2763
+ 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);
2764
+ if (!a.ok)
2765
+ throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2766
+ const l = (await a.json()).files.filter(
2782
2767
  (u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
2783
2768
  );
2784
2769
  return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
@@ -2794,24 +2779,24 @@ class Ze {
2794
2779
  async loadFiles(t, i) {
2795
2780
  const e = [];
2796
2781
  for (const n of t) {
2797
- const a = this.extractFileId(n);
2798
- if (!a) {
2782
+ const s = this.extractFileId(n);
2783
+ if (!s) {
2799
2784
  this.log(`Skipping invalid file URL: ${n}`);
2800
2785
  continue;
2801
2786
  }
2802
2787
  if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
2803
2788
  try {
2804
- const r = `${this.apiEndpoint}/${a}?fields=name,mimeType&key=${this.apiKey}`, s = await fetch(r);
2805
- if (s.ok) {
2806
- const c = await s.json();
2807
- c.mimeType.startsWith("image/") && i.isAllowed(c.name) ? (e.push(`https://lh3.googleusercontent.com/d/${a}=s1600`), this.log(`Added file: ${c.name}`)) : this.log(`Skipping non-image file: ${c.name} (${c.mimeType})`);
2789
+ const r = `${this.apiEndpoint}/${s}?fields=name,mimeType&key=${this.apiKey}`, a = await fetch(r);
2790
+ if (a.ok) {
2791
+ const c = await a.json();
2792
+ 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})`);
2808
2793
  } else
2809
- this.log(`Failed to fetch metadata for file ${a}: ${s.status}`);
2794
+ this.log(`Failed to fetch metadata for file ${s}: ${a.status}`);
2810
2795
  } catch (r) {
2811
- this.log(`Error fetching metadata for file ${a}:`, r);
2796
+ this.log(`Error fetching metadata for file ${s}:`, r);
2812
2797
  }
2813
2798
  else
2814
- e.push(`https://lh3.googleusercontent.com/d/${a}=s1600`);
2799
+ e.push(`https://lh3.googleusercontent.com/d/${s}=s1600`);
2815
2800
  }
2816
2801
  return e;
2817
2802
  }
@@ -2845,10 +2830,10 @@ class Ze {
2845
2830
  * @returns Promise resolving to array of image URLs
2846
2831
  */
2847
2832
  async loadImagesRecursively(t, i) {
2848
- 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);
2849
- if (!s.ok)
2850
- throw new Error(`API request failed: ${s.status} ${s.statusText}`);
2851
- const c = await s.json(), l = c.files.filter(
2833
+ 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);
2834
+ if (!a.ok)
2835
+ throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2836
+ const c = await a.json(), l = c.files.filter(
2852
2837
  (h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
2853
2838
  ), u = c.files.filter(
2854
2839
  (h) => h.mimeType === "application/vnd.google-apps.folder"
@@ -2875,8 +2860,8 @@ class Ze {
2875
2860
  const e = `https://drive.google.com/embeddedfolderview?id=${t}`, n = await fetch(e, { mode: "cors" });
2876
2861
  if (!n.ok)
2877
2862
  throw new Error("Cannot access folder directly (CORS or permissions issue)");
2878
- const a = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, s = [...a.matchAll(r)];
2879
- return [...new Set(s.map((u) => u[1]))].map(
2863
+ const s = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(r)];
2864
+ return [...new Set(a.map((u) => u[1]))].map(
2880
2865
  (u) => `https://drive.google.com/uc?export=view&id=${u}`
2881
2866
  );
2882
2867
  } catch (e) {
@@ -2969,8 +2954,8 @@ class Qe {
2969
2954
  return console.warn("URLs must be an array:", t), [];
2970
2955
  const e = [];
2971
2956
  for (const n of t) {
2972
- const a = n.split("/").pop() || n;
2973
- if (!i.isAllowed(a)) {
2957
+ const s = n.split("/").pop() || n;
2958
+ if (!i.isAllowed(s)) {
2974
2959
  this.log(`Skipping filtered URL: ${n}`);
2975
2960
  continue;
2976
2961
  }
@@ -2989,12 +2974,12 @@ class Qe {
2989
2974
  if (!Array.isArray(i))
2990
2975
  return console.warn("files must be an array:", i), [];
2991
2976
  const n = [];
2992
- for (const a of i) {
2993
- if (!e.isAllowed(a)) {
2994
- this.log(`Skipping filtered file: ${a}`);
2977
+ for (const s of i) {
2978
+ if (!e.isAllowed(s)) {
2979
+ this.log(`Skipping filtered file: ${s}`);
2995
2980
  continue;
2996
2981
  }
2997
- const r = this.constructUrl(t, a);
2982
+ const r = this.constructUrl(t, s);
2998
2983
  this.validateUrls ? await this.validateUrl(r) ? n.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : n.push(r);
2999
2984
  }
3000
2985
  return n;
@@ -3010,15 +2995,15 @@ class Qe {
3010
2995
  this.log(`Fetching JSON endpoint: ${t}`);
3011
2996
  const e = new AbortController(), n = setTimeout(() => e.abort(), 1e4);
3012
2997
  try {
3013
- const a = await fetch(t, { signal: e.signal });
3014
- if (clearTimeout(n), !a.ok)
3015
- throw new Error(`HTTP ${a.status} fetching ${t}`);
3016
- const r = await a.json();
2998
+ const s = await fetch(t, { signal: e.signal });
2999
+ if (clearTimeout(n), !s.ok)
3000
+ throw new Error(`HTTP ${s.status} fetching ${t}`);
3001
+ const r = await s.json();
3017
3002
  if (!r || !Array.isArray(r.images))
3018
3003
  throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
3019
3004
  return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, i);
3020
- } catch (a) {
3021
- throw clearTimeout(n), a instanceof Error && a.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : a;
3005
+ } catch (s) {
3006
+ throw clearTimeout(n), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : s;
3022
3007
  }
3023
3008
  }
3024
3009
  /**
@@ -3040,11 +3025,11 @@ class Qe {
3040
3025
  if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
3041
3026
  return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
3042
3027
  try {
3043
- const e = new AbortController(), n = setTimeout(() => e.abort(), this.validationTimeout), a = await fetch(t, {
3028
+ const e = new AbortController(), n = setTimeout(() => e.abort(), this.validationTimeout), s = await fetch(t, {
3044
3029
  method: "HEAD",
3045
3030
  signal: e.signal
3046
3031
  });
3047
- return clearTimeout(n), a.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${a.status}`), !1);
3032
+ return clearTimeout(n), s.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${s.status}`), !1);
3048
3033
  } catch (e) {
3049
3034
  return e instanceof Error && (e.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, e.message)), !1;
3050
3035
  }
@@ -3098,8 +3083,8 @@ class ti {
3098
3083
  this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
3099
3084
  const i = this.loaders.map((e, n) => e.prepare(t).then(() => {
3100
3085
  this.log(`Loader ${n} prepared with ${e.imagesLength()} images`);
3101
- }).catch((a) => {
3102
- console.warn(`Loader ${n} failed to prepare:`, a);
3086
+ }).catch((s) => {
3087
+ console.warn(`Loader ${n} failed to prepare:`, s);
3103
3088
  }));
3104
3089
  await Promise.all(i);
3105
3090
  for (const e of this.loaders)
@@ -3224,6 +3209,37 @@ const ii = `
3224
3209
  pointer-events: none;
3225
3210
  }
3226
3211
 
3212
+ .fbn-ic-gallery:focus,
3213
+ .fbn-ic-gallery.fbn-ic-has-focus {
3214
+ outline: 2px solid rgba(147, 197, 253, 0.8);
3215
+ outline-offset: -4px;
3216
+ }
3217
+ .fbn-ic-gallery.fbn-ic-suppress-outline:focus {
3218
+ outline: none;
3219
+ }
3220
+ .fbn-ic-gallery.fbn-ic-suppress-outline.fbn-ic-has-focus {
3221
+ outline: 2px solid rgba(99, 102, 241, 0.6);
3222
+ outline-offset: -4px;
3223
+ }
3224
+
3225
+ .fbn-ic-nav-btn {
3226
+ position: absolute;
3227
+ top: 50%;
3228
+ transform: translateY(-50%);
3229
+ z-index: 10001;
3230
+ cursor: pointer;
3231
+ border: none;
3232
+ background: none;
3233
+ padding: 0;
3234
+ line-height: 1;
3235
+ }
3236
+ .fbn-ic-nav-btn-prev {
3237
+ left: 12px;
3238
+ }
3239
+ .fbn-ic-nav-btn-next {
3240
+ right: 12px;
3241
+ }
3242
+
3227
3243
  .fbn-ic-hidden {
3228
3244
  display: none !important;
3229
3245
  }
@@ -3237,11 +3253,11 @@ function ni() {
3237
3253
  }
3238
3254
  let oi = class {
3239
3255
  constructor(t = {}) {
3240
- this.fullConfig = ne(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 re(this.fullConfig.animation), this.layoutEngine = new _e({
3256
+ this.fullConfig = ne(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 re(this.fullConfig.animation), this.layoutEngine = new _e({
3241
3257
  layout: this.fullConfig.layout,
3242
3258
  image: this.fullConfig.image
3243
- }), this.zoomEngine = new qe(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;
3244
- const i = this.fullConfig.animation.entry || E.animation.entry;
3259
+ }), this.zoomEngine = new Ge(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;
3260
+ const i = this.fullConfig.animation.entry || R.animation.entry;
3245
3261
  this.entryAnimationEngine = new ye(
3246
3262
  i,
3247
3263
  this.fullConfig.layout.algorithm
@@ -3252,6 +3268,16 @@ let oi = class {
3252
3268
  i.timing?.duration ?? 600
3253
3269
  ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
3254
3270
  this.idleAnimationEngine?.resumeForImage(n);
3271
+ const s = n;
3272
+ requestAnimationFrame(() => {
3273
+ if (s.matches(":hover") && this.fullConfig.styling?.hover) {
3274
+ const r = this.imageElements.indexOf(s);
3275
+ if (r !== -1) {
3276
+ const a = s.offsetHeight, c = s.cachedRenderedWidth;
3277
+ st(s, this.fullConfig.styling.hover, a, c), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[r] };
3278
+ }
3279
+ }
3280
+ });
3255
3281
  }), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
3256
3282
  }
3257
3283
  /**
@@ -3321,8 +3347,12 @@ let oi = class {
3321
3347
  }
3322
3348
  }
3323
3349
  setupUI() {
3324
- const t = this.fullConfig.rendering.ui;
3325
- 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));
3350
+ const t = this.fullConfig.ui;
3351
+ 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) => {
3352
+ i.stopPropagation(), this.navigateToPreviousImage();
3353
+ }), this.nextButtonEl?.addEventListener("click", (i) => {
3354
+ i.stopPropagation(), this.navigateToNextImage();
3355
+ }));
3326
3356
  }
3327
3357
  resolveElement(t) {
3328
3358
  return t instanceof HTMLElement ? t : document.getElementById(t);
@@ -3343,11 +3373,19 @@ let oi = class {
3343
3373
  const t = document.createElement("div");
3344
3374
  return t.className = "fbn-ic-counter fbn-ic-hidden", this.containerEl.appendChild(t), t;
3345
3375
  }
3376
+ createDefaultPrevButtonElement() {
3377
+ const t = document.createElement("button");
3378
+ 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;
3379
+ }
3380
+ createDefaultNextButtonElement() {
3381
+ const t = document.createElement("button");
3382
+ 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;
3383
+ }
3346
3384
  setupEventListeners() {
3347
3385
  this.fullConfig.interaction.navigation?.keyboard !== !1 && this.containerEl.addEventListener("keydown", (t) => {
3348
- 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());
3386
+ 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());
3349
3387
  }), document.addEventListener("click", (t) => {
3350
- this.swipeEngine?.hadRecentTouch() || t.target.closest(".fbn-ic-image") || (this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter());
3388
+ 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());
3351
3389
  }), window.addEventListener("resize", () => this.handleResize());
3352
3390
  }
3353
3391
  /**
@@ -3360,7 +3398,7 @@ let oi = class {
3360
3398
  );
3361
3399
  if (!i) return;
3362
3400
  const e = this.imageLayouts[t];
3363
- e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t));
3401
+ e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t), this.showNavButtons(), this.showFocusIndicator());
3364
3402
  }
3365
3403
  /**
3366
3404
  * Navigate to the previous image (Left arrow)
@@ -3372,7 +3410,7 @@ let oi = class {
3372
3410
  );
3373
3411
  if (!i) return;
3374
3412
  const e = this.imageLayouts[t];
3375
- e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t));
3413
+ e && (this.currentFocusIndex = t, this.handleImageClick(i, e), this.updateCounter(t), this.showNavButtons(), this.showFocusIndicator());
3376
3414
  }
3377
3415
  /**
3378
3416
  * Navigate to a specific image by index
@@ -3408,13 +3446,13 @@ let oi = class {
3408
3446
  this.showError("No images found."), this.showLoading(!1);
3409
3447
  return;
3410
3448
  }
3411
- const e = this.getContainerBounds(), n = this.getImageHeight(), a = window.innerWidth;
3449
+ const e = this.getContainerBounds(), n = this.getImageHeight(), s = window.innerWidth;
3412
3450
  this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${n}px`);
3413
3451
  const r = this.layoutEngine.calculateAdaptiveSize(
3414
3452
  e,
3415
3453
  t,
3416
3454
  n,
3417
- a
3455
+ s
3418
3456
  );
3419
3457
  this.logDebug(`Adaptive sizing result: height=${r.height}px`), await this.createImageCloud(i, r.height), this.showLoading(!1), this.imagesLoaded = !0;
3420
3458
  } catch (t) {
@@ -3431,33 +3469,33 @@ let oi = class {
3431
3469
  if (!this.containerEl) return;
3432
3470
  const e = this.getContainerBounds();
3433
3471
  this.currentImageHeight = i;
3434
- const n = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3435
- this.imageLayouts = a, this.displayQueue = [];
3472
+ const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3473
+ this.imageLayouts = s, this.displayQueue = [];
3436
3474
  let r = 0;
3437
- const s = (l) => {
3475
+ const a = (l) => {
3438
3476
  this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(() => {
3439
3477
  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)) {
3440
3478
  const d = {
3441
3479
  x: parseFloat(l.dataset.startX),
3442
3480
  y: parseFloat(l.dataset.startY)
3443
- }, f = {
3481
+ }, g = {
3444
3482
  x: parseFloat(l.dataset.endX),
3445
3483
  y: parseFloat(l.dataset.endY)
3446
- }, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), g = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : g, w = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
3484
+ }, 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();
3447
3485
  me({
3448
3486
  element: l,
3449
3487
  startPosition: d,
3450
- endPosition: f,
3488
+ endPosition: g,
3451
3489
  pathConfig: this.entryAnimationEngine.getPathConfig(),
3452
3490
  duration: v.duration,
3453
3491
  imageWidth: b,
3454
3492
  imageHeight: p,
3455
- rotation: g,
3493
+ rotation: f,
3456
3494
  scale: m,
3457
3495
  rotationConfig: this.entryAnimationEngine.getRotationConfig(),
3458
3496
  startRotation: y,
3459
3497
  scaleConfig: this.entryAnimationEngine.getScaleConfig(),
3460
- startScale: w
3498
+ startScale: E
3461
3499
  });
3462
3500
  } else {
3463
3501
  const d = l.dataset.finalTransform || "";
@@ -3486,7 +3524,7 @@ let oi = class {
3486
3524
  if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
3487
3525
  for (; this.displayQueue.length > 0; ) {
3488
3526
  const l = this.displayQueue.shift();
3489
- l && s(l);
3527
+ l && a(l);
3490
3528
  }
3491
3529
  return;
3492
3530
  }
@@ -3497,7 +3535,7 @@ let oi = class {
3497
3535
  }
3498
3536
  if (this.displayQueue.length > 0) {
3499
3537
  const l = this.displayQueue.shift();
3500
- l && s(l);
3538
+ l && a(l);
3501
3539
  }
3502
3540
  r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
3503
3541
  }, this.fullConfig.animation.queue.interval);
@@ -3511,44 +3549,44 @@ let oi = class {
3511
3549
  l.observe(this.containerEl);
3512
3550
  } else
3513
3551
  c();
3514
- this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), a.forEach((l, u) => {
3552
+ this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, u) => {
3515
3553
  const h = document.createElement("div");
3516
3554
  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";
3517
- const d = l.x, f = l.y;
3518
- 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);
3555
+ const d = l.x, g = l.y;
3556
+ 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);
3519
3557
  })), t.forEach((l, u) => {
3520
3558
  const h = document.createElement("img");
3521
3559
  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";
3522
- const d = a[u];
3523
- 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", () => {
3560
+ const d = s[u];
3561
+ 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", () => {
3524
3562
  if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
3525
- const f = h.cachedRenderedWidth;
3526
- ft(h, this.fullConfig.styling?.hover, i, f), st(h, this.hoverClassName);
3563
+ const g = h.cachedRenderedWidth;
3564
+ st(h, this.fullConfig.styling?.hover, i, g), et(h, this.hoverClassName);
3527
3565
  }
3528
3566
  }), h.addEventListener("mouseleave", () => {
3529
3567
  if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
3530
- const f = h.cachedRenderedWidth;
3531
- ft(h, this.fullConfig.styling?.default, i, f), pt(h, this.hoverClassName), st(h, this.defaultClassName);
3568
+ const g = h.cachedRenderedWidth;
3569
+ st(h, this.fullConfig.styling?.default, i, g), pt(h, this.hoverClassName), et(h, this.defaultClassName);
3532
3570
  }
3533
- }), h.addEventListener("click", (f) => {
3534
- f.stopPropagation(), this.handleImageClick(h, d);
3571
+ }), h.addEventListener("click", (g) => {
3572
+ g.stopPropagation(), this.handleImageClick(h, d);
3535
3573
  }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
3536
3574
  if (n !== this.loadGeneration)
3537
3575
  return;
3538
- const f = h.naturalWidth / h.naturalHeight, b = i * f;
3539
- 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 = f, ft(h, this.fullConfig.styling?.default, i, b);
3540
- const p = { x: d.x, y: d.y }, g = { width: b, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
3576
+ const g = h.naturalWidth / h.naturalHeight, b = i * g;
3577
+ 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);
3578
+ const p = { x: d.x, y: d.y }, f = { width: b, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
3541
3579
  p,
3542
- g,
3580
+ f,
3543
3581
  e,
3544
3582
  u,
3545
3583
  t.length
3546
- ), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), w = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
3584
+ ), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), E = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
3547
3585
  d.rotation,
3548
3586
  d.scale,
3549
3587
  b,
3550
3588
  i
3551
- ), I = this.entryAnimationEngine.buildStartTransform(
3589
+ ), S = this.entryAnimationEngine.buildStartTransform(
3552
3590
  m,
3553
3591
  p,
3554
3592
  d.rotation,
@@ -3556,17 +3594,17 @@ let oi = class {
3556
3594
  b,
3557
3595
  i,
3558
3596
  y,
3559
- w
3597
+ E
3560
3598
  );
3561
3599
  this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
3562
3600
  finalPosition: p,
3563
- imageSize: g,
3601
+ imageSize: f,
3564
3602
  left: d.x,
3565
3603
  top: d.y,
3566
3604
  finalTransform: v,
3567
3605
  renderedWidth: b,
3568
3606
  renderedHeight: i
3569
- }), h.style.transform = I, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== 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(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(w)), this.displayQueue.push(h);
3607
+ }), 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);
3570
3608
  }, h.onerror = () => r++, h.src = l;
3571
3609
  });
3572
3610
  }
@@ -3577,21 +3615,21 @@ let oi = class {
3577
3615
  height: this.containerEl.offsetHeight
3578
3616
  };
3579
3617
  if (e)
3580
- await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter();
3618
+ await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter(), this.hideNavButtons(), this.hideFocusIndicator();
3581
3619
  else {
3582
3620
  this.idleAnimationEngine?.pauseForImage(t);
3583
- const a = t.dataset.imageId;
3584
- 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);
3621
+ const s = t.dataset.imageId;
3622
+ 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();
3585
3623
  }
3586
3624
  }
3587
3625
  /**
3588
3626
  * Clear the image cloud and reset state
3589
3627
  */
3590
3628
  clearImageCloud() {
3591
- 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;
3629
+ 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;
3592
3630
  }
3593
3631
  showLoading(t) {
3594
- !this.fullConfig.rendering.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
3632
+ !this.fullConfig.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
3595
3633
  }
3596
3634
  showError(t) {
3597
3635
  this.errorEl && (this.errorEl.textContent = t, this.errorEl.classList.remove("fbn-ic-hidden"));
@@ -3600,37 +3638,49 @@ let oi = class {
3600
3638
  this.errorEl && this.errorEl.classList.add("fbn-ic-hidden");
3601
3639
  }
3602
3640
  updateCounter(t) {
3603
- !this.fullConfig.rendering.ui.showImageCounter || !this.counterEl || (this.counterEl.textContent = `${t + 1} of ${this.imageElements.length}`, this.counterEl.classList.remove("fbn-ic-hidden"));
3641
+ !this.fullConfig.ui.showImageCounter || !this.counterEl || (this.counterEl.textContent = `${t + 1} of ${this.imageElements.length}`, this.counterEl.classList.remove("fbn-ic-hidden"));
3604
3642
  }
3605
3643
  hideCounter() {
3606
3644
  this.counterEl && this.counterEl.classList.add("fbn-ic-hidden");
3607
3645
  }
3646
+ showFocusIndicator() {
3647
+ this.containerEl?.classList.add("fbn-ic-has-focus");
3648
+ }
3649
+ hideFocusIndicator() {
3650
+ this.containerEl?.classList.remove("fbn-ic-has-focus");
3651
+ }
3652
+ showNavButtons() {
3653
+ this.prevButtonEl?.classList.remove("fbn-ic-hidden"), this.nextButtonEl?.classList.remove("fbn-ic-hidden");
3654
+ }
3655
+ hideNavButtons() {
3656
+ this.prevButtonEl?.classList.add("fbn-ic-hidden"), this.nextButtonEl?.classList.add("fbn-ic-hidden");
3657
+ }
3608
3658
  /**
3609
3659
  * Destroy the gallery and clean up resources
3610
3660
  */
3611
3661
  destroy() {
3612
- 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;
3662
+ 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;
3613
3663
  }
3614
3664
  };
3615
- const ci = kt(
3665
+ const ci = Nt(
3616
3666
  function({ className: t, style: i, ...e }, n) {
3617
- const a = It(null), r = It(null);
3618
- return Nt(n, () => ({
3667
+ const s = It(null), r = It(null);
3668
+ return kt(n, () => ({
3619
3669
  get instance() {
3620
3670
  return r.current;
3621
3671
  }
3622
- })), jt(() => {
3623
- if (!a.current) return;
3624
- const s = new oi({
3625
- container: a.current,
3672
+ })), Bt(() => {
3673
+ if (!s.current) return;
3674
+ const a = new oi({
3675
+ container: s.current,
3626
3676
  ...e
3627
3677
  });
3628
- return r.current = s, s.init().catch((c) => {
3678
+ return r.current = a, a.init().catch((c) => {
3629
3679
  console.error("ImageCloud init failed:", c);
3630
3680
  }), () => {
3631
- s.destroy(), r.current = null;
3681
+ a.destroy(), r.current = null;
3632
3682
  };
3633
- }, [JSON.stringify(e)]), /* @__PURE__ */ Ht("div", { ref: a, className: t, style: i });
3683
+ }, [JSON.stringify(e)]), /* @__PURE__ */ Ht("div", { ref: s, className: t, style: i });
3634
3684
  }
3635
3685
  );
3636
3686
  export {