@frybynite/image-cloud 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,16 +4,16 @@ const mt = Object.freeze({
4
4
  md: "0 4px 16px rgba(0,0,0,0.4)",
5
5
  lg: "0 8px 32px rgba(0,0,0,0.5)",
6
6
  glow: "0 0 30px rgba(255,255,255,0.6)"
7
- }), Ct = Object.freeze({
7
+ }), Rt = Object.freeze({
8
8
  energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
9
9
  playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
10
10
  subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
11
- }), Rt = Object.freeze({
11
+ }), Tt = Object.freeze({
12
12
  gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
13
13
  bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
14
14
  wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
15
15
  snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
16
- }), Tt = Object.freeze({
16
+ }), At = Object.freeze({
17
17
  gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
18
18
  playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
19
19
  serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
@@ -22,7 +22,7 @@ const mt = Object.freeze({
22
22
  type: "linear"
23
23
  }), Et = Object.freeze({
24
24
  mode: "none"
25
- }), wt = Object.freeze({
25
+ }), xt = Object.freeze({
26
26
  mode: "none"
27
27
  }), Ot = Object.freeze({
28
28
  default: Object.freeze({
@@ -50,9 +50,9 @@ const mt = Object.freeze({
50
50
  focused: Object.freeze({
51
51
  shadow: "none"
52
52
  })
53
- }), Nt = Object.freeze({
53
+ }), Ht = Object.freeze({
54
54
  tightness: 1
55
- }), kt = Object.freeze({
55
+ }), Nt = Object.freeze({
56
56
  rows: 1,
57
57
  amplitude: 100,
58
58
  frequency: 2,
@@ -94,7 +94,7 @@ const mt = Object.freeze({
94
94
  enabled: !1,
95
95
  centers: !1,
96
96
  loaders: !1
97
- }), qt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Xt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Yt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Jt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), A = Object.freeze({
97
+ }), qt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Yt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Xt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Jt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), L = Object.freeze({
98
98
  // Loader configuration (always an array, composite behavior is implicit)
99
99
  loaders: [],
100
100
  // Shared loader settings and debug config
@@ -157,7 +157,7 @@ const mt = Object.freeze({
157
157
  // smooth deceleration
158
158
  path: vt,
159
159
  rotation: Et,
160
- scale: wt
160
+ scale: xt
161
161
  }),
162
162
  idle: $t
163
163
  }),
@@ -172,9 +172,7 @@ const mt = Object.freeze({
172
172
  }),
173
173
  navigation: Object.freeze({
174
174
  keyboard: !0,
175
- swipe: !0,
176
- mouseWheel: void 0
177
- // STUB: Not implemented yet
175
+ swipe: !0
178
176
  }),
179
177
  dragging: !0
180
178
  }),
@@ -228,132 +226,98 @@ function Kt(o, t) {
228
226
  }
229
227
  return i;
230
228
  }
231
- function Zt(o) {
232
- const t = o.layout?.rotation;
233
- if (t && "enabled" in t)
234
- return {
235
- rotation: {
236
- mode: t.enabled ? "random" : "none",
237
- range: t.range
238
- }
239
- };
240
- }
241
- function Qt(o) {
242
- const t = o.layout?.sizing?.variance;
243
- if (t)
244
- return {
245
- sizing: {
246
- mode: "adaptive",
247
- // Legacy variance config implies adaptive mode
248
- variance: t
249
- }
250
- };
251
- }
252
- function te(o = {}) {
253
- const t = Zt(o), i = Qt(o);
254
- let e = o.image;
255
- (t || i) && (e = {
256
- ...i || {},
257
- ...t || {},
258
- ...e
259
- }, e.rotation && t?.rotation && o.image?.rotation && (e.rotation = {
260
- ...t.rotation,
261
- ...o.image.rotation
262
- }));
263
- const n = [...o.loaders ?? []];
264
- o.images && o.images.length > 0 && n.unshift({
229
+ function Zt(o = {}) {
230
+ const t = o.image, i = [...o.loaders ?? []];
231
+ o.images && o.images.length > 0 && i.unshift({
265
232
  static: {
266
233
  sources: [{ urls: o.images }]
267
234
  }
268
235
  });
269
- const r = {
236
+ const n = {
270
237
  loaders: {
271
238
  ...Dt,
272
239
  ...o.config?.loaders ?? {}
273
240
  }
274
- }, a = {
275
- loaders: n,
276
- config: r,
277
- image: Kt(zt, e),
278
- layout: { ...A.layout },
279
- animation: { ...A.animation },
280
- interaction: { ...A.interaction },
281
- ui: { ...A.ui },
241
+ }, s = {
242
+ loaders: i,
243
+ config: n,
244
+ image: Kt(zt, t),
245
+ layout: { ...L.layout },
246
+ animation: { ...L.animation },
247
+ interaction: { ...L.interaction },
248
+ ui: { ...L.ui },
282
249
  styling: Vt(Ot, o.styling)
283
250
  };
284
- o.layout && (a.layout = {
285
- ...A.layout,
251
+ if (o.layout && (s.layout = {
252
+ ...L.layout,
286
253
  ...o.layout
287
- }, o.layout.responsive && (a.layout.responsive = {
288
- ...A.layout.responsive,
289
- mobile: o.layout.responsive.mobile ? { ...A.layout.responsive.mobile, ...o.layout.responsive.mobile } : A.layout.responsive.mobile,
290
- tablet: o.layout.responsive.tablet ? { ...A.layout.responsive.tablet, ...o.layout.responsive.tablet } : A.layout.responsive.tablet
291
- }), o.layout.spacing && (a.layout.spacing = {
292
- ...A.layout.spacing,
254
+ }, o.layout.responsive && (s.layout.responsive = {
255
+ ...L.layout.responsive,
256
+ mobile: o.layout.responsive.mobile ? { ...L.layout.responsive.mobile, ...o.layout.responsive.mobile } : L.layout.responsive.mobile,
257
+ tablet: o.layout.responsive.tablet ? { ...L.layout.responsive.tablet, ...o.layout.responsive.tablet } : L.layout.responsive.tablet
258
+ }), o.layout.spacing && (s.layout.spacing = {
259
+ ...L.layout.spacing,
293
260
  ...o.layout.spacing
294
- })), o.animation && (a.animation = {
295
- ...A.animation,
261
+ })), o.animation && (s.animation = {
262
+ ...L.animation,
296
263
  ...o.animation
297
- }, o.animation.easing && (a.animation.easing = {
298
- ...A.animation.easing,
264
+ }, o.animation.easing && (s.animation.easing = {
265
+ ...L.animation.easing,
299
266
  ...o.animation.easing
300
- }), o.animation.queue && (a.animation.queue = {
301
- ...A.animation.queue,
267
+ }), o.animation.queue && (s.animation.queue = {
268
+ ...L.animation.queue,
302
269
  ...o.animation.queue
303
- }), o.animation.entry && (a.animation.entry = {
304
- ...A.animation.entry,
270
+ }), o.animation.entry && (s.animation.entry = {
271
+ ...L.animation.entry,
305
272
  ...o.animation.entry,
306
273
  start: o.animation.entry.start ? {
307
- ...A.animation.entry.start,
274
+ ...L.animation.entry.start,
308
275
  ...o.animation.entry.start,
309
- circular: o.animation.entry.start.circular ? { ...A.animation.entry.start.circular, ...o.animation.entry.start.circular } : A.animation.entry.start.circular
310
- } : A.animation.entry.start,
311
- timing: o.animation.entry.timing ? { ...A.animation.entry.timing, ...o.animation.entry.timing } : A.animation.entry.timing,
312
- path: o.animation.entry.path ? { ...vt, ...o.animation.entry.path } : A.animation.entry.path,
313
- rotation: o.animation.entry.rotation ? { ...Et, ...o.animation.entry.rotation } : A.animation.entry.rotation,
314
- scale: o.animation.entry.scale ? { ...wt, ...o.animation.entry.scale } : A.animation.entry.scale
315
- }), o.animation.idle && (a.animation.idle = {
276
+ circular: o.animation.entry.start.circular ? { ...L.animation.entry.start.circular, ...o.animation.entry.start.circular } : L.animation.entry.start.circular
277
+ } : L.animation.entry.start,
278
+ timing: o.animation.entry.timing ? { ...L.animation.entry.timing, ...o.animation.entry.timing } : L.animation.entry.timing,
279
+ path: o.animation.entry.path ? { ...vt, ...o.animation.entry.path } : L.animation.entry.path,
280
+ rotation: o.animation.entry.rotation ? { ...Et, ...o.animation.entry.rotation } : L.animation.entry.rotation,
281
+ scale: o.animation.entry.scale ? { ...xt, ...o.animation.entry.scale } : L.animation.entry.scale
282
+ }), o.animation.idle && (s.animation.idle = {
316
283
  ...$t,
317
284
  ...o.animation.idle
318
- })), o.interaction && (a.interaction = {
319
- ...A.interaction,
285
+ })), o.interaction && (s.interaction = {
286
+ ...L.interaction,
320
287
  ...o.interaction
321
- }, o.interaction.focus && (a.interaction.focus = {
322
- ...A.interaction.focus,
288
+ }, o.interaction.focus && (s.interaction.focus = {
289
+ ...L.interaction.focus,
323
290
  ...o.interaction.focus
324
- }), o.interaction.navigation && (a.interaction.navigation = {
325
- ...A.interaction.navigation,
291
+ }), o.interaction.navigation && (s.interaction.navigation = {
292
+ ...L.interaction.navigation,
326
293
  ...o.interaction.navigation
327
- }));
328
- const c = o.rendering?.ui;
329
- if (c && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), a.ui = {
330
- ...A.ui,
331
- ...c,
294
+ })), s.ui = {
295
+ ...L.ui,
332
296
  ...o.ui
333
- }, a.config.debug = {
297
+ }, s.config.debug = {
334
298
  ..._t,
335
299
  ...o.config?.debug ?? {}
336
- }, a.layout.algorithm === "honeycomb" && a.styling) {
337
- const l = { shape: "hexagon", mode: "height-relative" };
338
- a.styling = {
339
- ...a.styling,
340
- default: { ...a.styling.default, clipPath: l },
341
- hover: { ...a.styling.hover, clipPath: l }
300
+ }, s.layout.algorithm === "honeycomb" && s.styling) {
301
+ const r = { shape: "hexagon", mode: "height-relative" };
302
+ s.styling = {
303
+ ...s.styling,
304
+ default: { ...s.styling.default, clipPath: r },
305
+ hover: { ...s.styling.hover, clipPath: r }
342
306
  // focused: untouched — user config respected
343
307
  };
344
308
  }
345
- return a;
309
+ return s;
346
310
  }
347
- function ee(o, t) {
348
- return { ...o ? Ct[o] : Ct.playful, ...t };
349
- }
350
- function ie(o, t) {
351
- return { ...o ? Rt[o] : Rt.gentle, ...t };
311
+ function Qt(o, t) {
312
+ return { ...o ? Rt[o] : Rt.playful, ...t };
352
313
  }
353
- function ne(o, t) {
314
+ function te(o, t) {
354
315
  return { ...o ? Tt[o] : Tt.gentle, ...t };
355
316
  }
356
- class oe {
317
+ function ee(o, t) {
318
+ return { ...o ? At[o] : At.gentle, ...t };
319
+ }
320
+ class ie {
357
321
  constructor(t) {
358
322
  this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
359
323
  }
@@ -380,12 +344,12 @@ class oe {
380
344
  */
381
345
  animateTransformCancellable(t, i, e, n = null, s = null) {
382
346
  this.cancelAllAnimations(t);
383
- const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
347
+ const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), d = this.buildTransformString(e);
384
348
  t.style.transition = "none";
385
349
  const u = t.animate(
386
350
  [
387
351
  { transform: c },
388
- { transform: l }
352
+ { transform: d }
389
353
  ],
390
354
  {
391
355
  duration: r,
@@ -393,7 +357,7 @@ class oe {
393
357
  fill: "forwards"
394
358
  // Keep final state after animation
395
359
  }
396
- ), h = {
360
+ ), f = {
397
361
  id: `anim-${++this.animationIdCounter}`,
398
362
  element: t,
399
363
  animation: u,
@@ -402,11 +366,11 @@ class oe {
402
366
  startTime: performance.now(),
403
367
  duration: r
404
368
  };
405
- return this.activeAnimations.set(t, h), u.finished.then(() => {
406
- t.style.transform = l, this.activeAnimations.delete(t);
369
+ return this.activeAnimations.set(t, f), u.finished.then(() => {
370
+ t.style.transform = d, this.activeAnimations.delete(t);
407
371
  }).catch(() => {
408
372
  this.activeAnimations.delete(t);
409
- }), h;
373
+ }), f;
410
374
  }
411
375
  /**
412
376
  * Cancel an active animation
@@ -512,31 +476,31 @@ class oe {
512
476
  function V(o, t, i) {
513
477
  return o + (t - o) * i;
514
478
  }
515
- function se(o, t, i, e) {
516
- const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, l = ae(s, r);
517
- let u = 0, h = 0, d = 1, g = n, b = !1;
518
- for (let f = 0; f < l.length; f++)
519
- if (o <= l[f].time) {
520
- h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, b = l[f].isOvershoot;
479
+ function ne(o, t, i, e) {
480
+ const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, d = oe(s, r);
481
+ let u = 0, f = 0, m = 1, p = n, w = !1;
482
+ for (let l = 0; l < d.length; l++)
483
+ if (o <= d[l].time) {
484
+ f = l === 0 ? 0 : d[l - 1].time, m = d[l].time, p = d[l].overshoot, w = d[l].isOvershoot;
521
485
  break;
522
486
  }
523
- const p = (o - h) / (d - h);
524
- if (b)
525
- u = 1 + g * at(p);
526
- else if (h === 0)
527
- u = at(p);
487
+ const v = (o - f) / (m - f);
488
+ if (w)
489
+ u = 1 + p * at(v);
490
+ else if (f === 0)
491
+ u = at(v);
528
492
  else {
529
- const m = 1 + (l.find(
530
- (y, E) => y.time > h && E > 0 && l[E - 1].isOvershoot
531
- )?.overshoot || g);
532
- u = V(m, 1, at(p));
493
+ const g = 1 + (d.find(
494
+ (h, b) => h.time > f && b > 0 && d[b - 1].isOvershoot
495
+ )?.overshoot || p);
496
+ u = V(g, 1, at(v));
533
497
  }
534
498
  return {
535
499
  x: t.x + a * u,
536
500
  y: t.y + c * u
537
501
  };
538
502
  }
539
- function ae(o, t) {
503
+ function oe(o, t) {
540
504
  const i = [];
541
505
  let e = 0.6;
542
506
  i.push({ time: e, overshoot: 0, isOvershoot: !1 });
@@ -546,57 +510,57 @@ function ae(o, t) {
546
510
  e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
547
511
  return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
548
512
  }
549
- function re(o, t, i, e) {
550
- const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = s / (2 * Math.sqrt(n * r));
551
- let d;
552
- if (h < 1) {
553
- const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(g * o * a * Math.PI);
554
- d = 1 - b * p;
513
+ function se(o, t, i, e) {
514
+ const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, d = i.y - t.y, u = Math.sqrt(n / r), f = s / (2 * Math.sqrt(n * r));
515
+ let m;
516
+ if (f < 1) {
517
+ const p = u * Math.sqrt(1 - f * f), w = Math.exp(-f * u * o * 3), v = Math.cos(p * o * a * Math.PI);
518
+ m = 1 - w * v;
555
519
  } else
556
- d = 1 - Math.exp(-u * o * 3);
557
- return d = Math.max(0, Math.min(d, 1.3)), {
558
- x: t.x + c * d,
559
- y: t.y + l * d
520
+ m = 1 - Math.exp(-u * o * 3);
521
+ return m = Math.max(0, Math.min(m, 1.3)), {
522
+ x: t.x + c * m,
523
+ y: t.y + d * m
560
524
  };
561
525
  }
562
- function ce(o, t, i, e) {
563
- const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, g = h > 0 ? l / h : 1, b = s * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, a) : 1, f = n * Math.sin(b) * p, m = le(o);
526
+ function ae(o, t, i, e) {
527
+ const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, d = i.x - t.x, u = i.y - t.y, f = Math.sqrt(d * d + u * u), m = f > 0 ? -u / f : 0, p = f > 0 ? d / f : 1, w = s * Math.PI * 2 * o + c, v = r ? Math.pow(1 - o, a) : 1, l = n * Math.sin(w) * v, g = re(o);
564
528
  return {
565
- x: V(t.x, i.x, m) + f * d,
566
- y: V(t.y, i.y, m) + f * g
529
+ x: V(t.x, i.x, g) + l * m,
530
+ y: V(t.y, i.y, g) + l * p
567
531
  };
568
532
  }
569
533
  function at(o) {
570
534
  return 1 - (1 - o) * (1 - o);
571
535
  }
572
- function le(o) {
536
+ function re(o) {
573
537
  return 1 - Math.pow(1 - o, 3);
574
538
  }
575
- function he(o, t, i) {
539
+ function ce(o, t, i) {
576
540
  const { amplitude: e, frequency: n, decay: s } = i, r = Math.sin(o * n * Math.PI * 2), a = s ? Math.pow(1 - o, 2) : 1, c = e * r * a;
577
541
  return t + c;
578
542
  }
579
- function de(o, t, i) {
543
+ function le(o, t, i) {
580
544
  const { overshoot: e, bounces: n } = i, s = [];
581
545
  s.push({ time: 0.5, scale: e });
582
546
  let r = e;
583
- const a = 0.5, l = 0.5 / (n * 2);
547
+ const a = 0.5, d = 0.5 / (n * 2);
584
548
  let u = 0.5;
585
- for (let d = 0; d < n; d++) {
586
- const g = 1 - (r - 1) * a;
587
- u += l, s.push({ time: u, scale: g }), r = 1 + (r - 1) * a * a, u += l, d < n - 1 && s.push({ time: u, scale: r });
549
+ for (let m = 0; m < n; m++) {
550
+ const p = 1 - (r - 1) * a;
551
+ u += d, s.push({ time: u, scale: p }), r = 1 + (r - 1) * a * a, u += d, m < n - 1 && s.push({ time: u, scale: r });
588
552
  }
589
553
  s.push({ time: 1, scale: 1 });
590
- let h = 1;
591
- for (let d = 0; d < s.length; d++)
592
- if (o <= s[d].time) {
593
- const g = d === 0 ? 0 : s[d - 1].time, b = d === 0 ? 1 : s[d - 1].scale, p = (o - g) / (s[d].time - g), f = at(p);
594
- h = b + (s[d].scale - b) * f;
554
+ let f = 1;
555
+ for (let m = 0; m < s.length; m++)
556
+ if (o <= s[m].time) {
557
+ const p = m === 0 ? 0 : s[m - 1].time, w = m === 0 ? 1 : s[m - 1].scale, v = (o - p) / (s[m].time - p), l = at(v);
558
+ f = w + (s[m].scale - w) * l;
595
559
  break;
596
560
  }
597
- return h * t;
561
+ return f * t;
598
562
  }
599
- function ue(o) {
563
+ function he(o) {
600
564
  const {
601
565
  element: t,
602
566
  startPosition: i,
@@ -606,64 +570,70 @@ function ue(o) {
606
570
  imageWidth: r,
607
571
  imageHeight: a,
608
572
  rotation: c,
609
- scale: l,
573
+ scale: d,
610
574
  onComplete: u,
611
- rotationConfig: h,
612
- startRotation: d,
613
- scaleConfig: g,
614
- startScale: b
615
- } = o, p = n.type, f = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, E = f || m, v = b !== void 0 && b !== l, S = g?.mode === "pop", w = g?.pop || { overshoot: 1.2, bounces: 1 };
616
- if ((p === "linear" || p === "arc") && !E && !(v || S)) {
575
+ onProgress: f,
576
+ rotationConfig: m,
577
+ startRotation: p,
578
+ scaleConfig: w,
579
+ startScale: v
580
+ } = o, l = n.type, g = p !== void 0 && p !== c, h = m?.mode === "wobble", b = m?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, I = g || h, y = v !== void 0 && v !== d, E = w?.mode === "pop", x = w?.pop || { overshoot: 1.2, bounces: 1 };
581
+ if (l === "linear" && !I && !(y || E)) {
617
582
  u && u();
618
583
  return;
619
584
  }
620
- const O = performance.now(), L = -r / 2, P = -a / 2;
621
- function z(H) {
622
- const N = H - O, C = Math.min(N / s, 1);
623
- let D;
624
- switch (p) {
585
+ const R = performance.now(), M = -r / 2, T = -a / 2;
586
+ function z(k) {
587
+ const D = k - R, O = Math.min(D / s, 1);
588
+ let S;
589
+ switch (l) {
625
590
  case "bounce": {
626
- const k = ee(
591
+ const N = Qt(
627
592
  n.bouncePreset,
628
593
  n.bounce
629
594
  );
630
- D = se(C, i, e, k);
595
+ S = ne(O, i, e, N);
631
596
  break;
632
597
  }
633
598
  case "elastic": {
634
- const k = ie(
599
+ const N = te(
635
600
  n.elasticPreset,
636
601
  n.elastic
637
602
  );
638
- D = re(C, i, e, k);
603
+ S = se(O, i, e, N);
639
604
  break;
640
605
  }
641
606
  case "wave": {
642
- const k = ne(
607
+ const N = ee(
643
608
  n.wavePreset,
644
609
  n.wave
645
610
  );
646
- D = ce(C, i, e, k);
611
+ S = ae(O, i, e, N);
647
612
  break;
648
613
  }
649
614
  default:
650
- D = {
651
- x: V(i.x, e.x, C),
652
- y: V(i.y, e.y, C)
615
+ S = {
616
+ x: V(i.x, e.x, O),
617
+ y: V(i.y, e.y, O)
653
618
  };
654
619
  }
655
- const W = D.x - e.x, U = D.y - e.y;
656
- let M;
657
- m ? M = he(C, c, y) : f ? M = V(d, c, C) : M = c;
658
- let R;
659
- S ? R = de(C, l, w) : v ? R = V(b, l, C) : R = l, t.style.transform = `translate(${L}px, ${P}px) translate(${W}px, ${U}px) rotate(${M}deg) scale(${R})`, C < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${L}px, ${P}px) rotate(${c}deg) scale(${l})`, u && u());
620
+ const P = S.x - e.x, _ = S.y - e.y;
621
+ let A;
622
+ h ? A = ce(O, c, b) : g ? A = V(p, c, O) : A = c;
623
+ let j;
624
+ E ? j = le(O, d, x) : y ? j = V(v, d, O) : j = d, t.style.transform = `translate(${M}px, ${T}px) translate(${P}px, ${_}px) rotate(${A}deg) scale(${j})`, f && O < 1 && f(O, D, {
625
+ x: S.x,
626
+ y: S.y,
627
+ rotation: A,
628
+ scale: j
629
+ }), O < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${M}px, ${T}px) rotate(${c}deg) scale(${d})`, u && u());
660
630
  }
661
631
  requestAnimationFrame(z);
662
632
  }
663
- function fe(o) {
633
+ function de(o) {
664
634
  return o === "bounce" || o === "elastic" || o === "wave";
665
635
  }
666
- const ge = {
636
+ const ue = {
667
637
  radial: "center",
668
638
  spiral: "center",
669
639
  grid: "top",
@@ -672,15 +642,15 @@ const ge = {
672
642
  wave: "left",
673
643
  honeycomb: "center"
674
644
  };
675
- class me {
645
+ class fe {
676
646
  constructor(t, i) {
677
- this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || vt, this.rotationConfig = t.rotation || Et, this.scaleConfig = t.scale || wt;
647
+ this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || vt, this.rotationConfig = t.rotation || Et, this.scaleConfig = t.scale || xt;
678
648
  }
679
649
  /**
680
650
  * Get the effective start position, considering layout-aware defaults
681
651
  */
682
652
  resolveStartPosition() {
683
- return this.config.start.position ? this.config.start.position : ge[this.layoutAlgorithm] || "nearest-edge";
653
+ return this.config.start.position ? this.config.start.position : ue[this.layoutAlgorithm] || "nearest-edge";
684
654
  }
685
655
  /**
686
656
  * Calculate the starting position for an image's entry animation
@@ -718,9 +688,9 @@ class me {
718
688
  * Calculate start position from the nearest edge (current default behavior)
719
689
  */
720
690
  calculateNearestEdge(t, i, e, n) {
721
- const s = t.x, r = t.y, a = s, c = e.width - s, l = r, u = e.height - r, h = Math.min(a, c, l, u);
722
- let d = t.x, g = t.y;
723
- return h === a ? d = -(i.width + n) : h === c ? d = e.width + n : h === l ? g = -(i.height + n) : g = e.height + n, { x: d, y: g };
691
+ const s = t.x, r = t.y, a = s, c = e.width - s, d = r, u = e.height - r, f = Math.min(a, c, d, u);
692
+ let m = t.x, p = t.y;
693
+ return f === a ? m = -(i.width + n) : f === c ? m = e.width + n : f === d ? p = -(i.height + n) : p = e.height + n, { x: m, y: p };
724
694
  }
725
695
  /**
726
696
  * Calculate start position from a specific edge
@@ -768,18 +738,18 @@ class me {
768
738
  calculateCircularPosition(t, i, e, n, s) {
769
739
  const r = this.config.start.circular || {}, a = r.distribution || "even";
770
740
  let c;
771
- const l = r.radius || "120%";
772
- if (typeof l == "string" && l.endsWith("%")) {
773
- const p = parseFloat(l) / 100;
741
+ const d = r.radius || "120%";
742
+ if (typeof d == "string" && d.endsWith("%")) {
743
+ const v = parseFloat(d) / 100;
774
744
  c = Math.sqrt(
775
745
  e.width ** 2 + e.height ** 2
776
- ) * p / 2;
746
+ ) * v / 2;
777
747
  } else
778
- c = typeof l == "number" ? l : 500;
748
+ c = typeof d == "number" ? d : 500;
779
749
  let u;
780
750
  a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
781
- const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
782
- return { x: g, y: b };
751
+ const f = e.width / 2, m = e.height / 2, p = f + Math.cos(u) * c, w = m + Math.sin(u) * c;
752
+ return { x: p, y: w };
783
753
  }
784
754
  /**
785
755
  * Get animation parameters for an image
@@ -799,8 +769,8 @@ class me {
799
769
  * Uses pixel-based centering offset for reliable cross-browser behavior
800
770
  */
801
771
  buildStartTransform(t, i, e, n, s, r, a, c) {
802
- const l = t.x - i.x, u = t.y - i.y, h = a !== void 0 ? a : e, d = c !== void 0 ? c : n, g = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${g}px, ${b}px)` : "translate(-50%, -50%)";
803
- return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(${d})`;
772
+ const d = t.x - i.x, u = t.y - i.y, f = a !== void 0 ? a : e, m = c !== void 0 ? c : n, p = s !== void 0 ? -s / 2 : 0, w = r !== void 0 ? -r / 2 : 0, v = s !== void 0 ? `translate(${p}px, ${w}px)` : "translate(-50%, -50%)";
773
+ return t.useScale ? `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(0)` : `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(${m})`;
804
774
  }
805
775
  /**
806
776
  * Build the final CSS transform string
@@ -825,7 +795,7 @@ class me {
825
795
  * Check if the current path type requires JavaScript animation
826
796
  */
827
797
  requiresJSAnimation() {
828
- return fe(this.pathConfig.type);
798
+ return de(this.pathConfig.type);
829
799
  }
830
800
  /**
831
801
  * Get the path configuration
@@ -927,8 +897,8 @@ class me {
927
897
  amplitude: 15,
928
898
  frequency: 3,
929
899
  decay: !0
930
- }, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, l = n * a * c;
931
- return i + l;
900
+ }, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, d = n * a * c;
901
+ return i + d;
932
902
  }
933
903
  /**
934
904
  * Get the scale configuration
@@ -988,8 +958,8 @@ class me {
988
958
  let a = i;
989
959
  for (let c = 0; c < r.length; c++)
990
960
  if (t <= r[c].time) {
991
- const l = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, h = (t - l) / (r[c].time - l), d = this.easeOutQuad(h);
992
- a = u + (r[c].scale - u) * d;
961
+ const d = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, f = (t - d) / (r[c].time - d), m = this.easeOutQuad(f);
962
+ a = u + (r[c].scale - u) * m;
993
963
  break;
994
964
  }
995
965
  return a * i;
@@ -1003,9 +973,9 @@ class me {
1003
973
  let n = i;
1004
974
  const s = 0.5, a = 0.5 / (t * 2);
1005
975
  let c = 0.5;
1006
- for (let l = 0; l < t; l++) {
976
+ for (let d = 0; d < t; d++) {
1007
977
  const u = 1 - (n - 1) * s;
1008
- c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, l < t - 1 && e.push({ time: c, scale: n });
978
+ c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, d < t - 1 && e.push({ time: c, scale: n });
1009
979
  }
1010
980
  return e.push({ time: 1, scale: 1 }), e;
1011
981
  }
@@ -1016,7 +986,7 @@ class me {
1016
986
  return 1 - (1 - t) * (1 - t);
1017
987
  }
1018
988
  }
1019
- class pe {
989
+ class ge {
1020
990
  constructor(t, i = 600) {
1021
991
  this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
1022
992
  }
@@ -1121,7 +1091,7 @@ class pe {
1121
1091
  });
1122
1092
  }
1123
1093
  _startPulse(t) {
1124
- const i = { ...Xt, ...this.config.pulse }, e = [
1094
+ const i = { ...Yt, ...this.config.pulse }, e = [
1125
1095
  { transform: "scale(1)", offset: 0 },
1126
1096
  { transform: `scale(${i.maxScale})`, offset: 0.25 },
1127
1097
  { transform: "scale(1)", offset: 0.5 },
@@ -1141,7 +1111,7 @@ class pe {
1141
1111
  });
1142
1112
  }
1143
1113
  _startBlink(t) {
1144
- const i = { ...Yt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
1114
+ const i = { ...Xt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
1145
1115
  let s, r;
1146
1116
  i.style === "fade" ? (s = [
1147
1117
  { opacity: n, offset: 0 },
@@ -1202,7 +1172,7 @@ class pe {
1202
1172
  t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
1203
1173
  }
1204
1174
  }
1205
- class be {
1175
+ class me {
1206
1176
  constructor(t, i = {}) {
1207
1177
  this.config = t, this.imageConfig = i;
1208
1178
  }
@@ -1214,17 +1184,17 @@ class be {
1214
1184
  * @returns Array of layout objects with position, rotation, scale
1215
1185
  */
1216
1186
  generate(t, i, e = {}) {
1217
- const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, f = c * 1.5 / 2, m = c / 2, y = s - a - f, E = r - a - m, v = a + f, S = a + m;
1218
- for (let w = 0; w < t; w++) {
1219
- const I = this.random(v, y), O = this.random(S, E), L = l === "random" ? this.random(u, h) : 0, P = b ? this.random(d, g) : 1, z = c * P, H = {
1220
- id: w,
1221
- x: I,
1222
- y: O,
1223
- rotation: L,
1224
- scale: P,
1225
- baseSize: z
1187
+ const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, l = c * 1.5 / 2, g = c / 2, h = s - a - l, b = r - a - g, I = a + l, y = a + g;
1188
+ for (let E = 0; E < t; E++) {
1189
+ const x = this.random(I, h), F = this.random(y, b), R = d === "random" ? this.random(u, f) : 0, M = w ? this.random(m, p) : 1, T = c * M, z = {
1190
+ id: E,
1191
+ x,
1192
+ y: F,
1193
+ rotation: R,
1194
+ scale: M,
1195
+ baseSize: T
1226
1196
  };
1227
- n.push(H);
1197
+ n.push(z);
1228
1198
  }
1229
1199
  return n;
1230
1200
  }
@@ -1238,7 +1208,7 @@ class be {
1238
1208
  return Math.random() * (i - t) + t;
1239
1209
  }
1240
1210
  }
1241
- class ye {
1211
+ class pe {
1242
1212
  constructor(t, i = {}) {
1243
1213
  this.config = t, this.imageConfig = i;
1244
1214
  }
@@ -1250,53 +1220,53 @@ class ye {
1250
1220
  * @returns Array of layout objects with position, rotation, scale
1251
1221
  */
1252
1222
  generate(t, i, e = {}) {
1253
- const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
1254
- ...Nt,
1223
+ const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = this.config.scaleDecay ?? 0, v = {
1224
+ ...Ht,
1255
1225
  ...this.config.radial
1256
- }, f = e.fixedHeight ?? a, m = s / 2, y = r / 2, E = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, S = Math.max(f * 0.8, Math.min(
1257
- m - v - f / 2,
1258
- y - v - f / 2
1226
+ }, l = e.fixedHeight ?? a, g = s / 2, h = r / 2, b = Math.ceil(Math.sqrt(t)), I = this.config.spacing.padding ?? 50, y = Math.max(l * 0.8, Math.min(
1227
+ g - I - l / 2,
1228
+ h - I - l / 2
1259
1229
  ));
1260
1230
  if (t > 0) {
1261
- const O = g ? this.random(h, d) : 1, L = f * O;
1231
+ const F = p ? this.random(f, m) : 1, R = l * F;
1262
1232
  n.push({
1263
1233
  id: 0,
1264
- x: m,
1265
- y,
1266
- rotation: c === "random" ? this.random(l * 0.33, u * 0.33) : 0,
1234
+ x: g,
1235
+ y: h,
1236
+ rotation: c === "random" ? this.random(d * 0.33, u * 0.33) : 0,
1267
1237
  // Less rotation for center
1268
- scale: O,
1269
- baseSize: L,
1238
+ scale: F,
1239
+ baseSize: R,
1270
1240
  zIndex: 100
1271
1241
  // Center image is highest
1272
1242
  });
1273
1243
  }
1274
- let w = 1, I = 1;
1275
- for (; w < t; ) {
1276
- const O = I / E, L = b > 0 ? 1 - O * b * 0.5 : 1, P = Math.max(f * 0.8, S / E * 1.5 / p.tightness), z = I * P, H = z * 1.5, N = Math.PI * (3 * (H + z) - Math.sqrt((3 * H + z) * (H + 3 * z))), C = this.estimateWidth(f), D = Math.floor(N / (C * 0.7));
1277
- if (D === 0) {
1278
- I++;
1244
+ let E = 1, x = 1;
1245
+ for (; E < t; ) {
1246
+ const F = x / b, R = w > 0 ? 1 - F * w * 0.5 : 1, M = Math.max(l * 0.8, y / b * 1.5 / v.tightness), T = x * M, z = T * 1.5, k = Math.PI * (3 * (z + T) - Math.sqrt((3 * z + T) * (z + 3 * T))), D = this.estimateWidth(l), O = Math.floor(k / (D * 0.7));
1247
+ if (O === 0) {
1248
+ x++;
1279
1249
  continue;
1280
1250
  }
1281
- const W = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
1282
- for (let M = 0; M < D && w < t; M++) {
1283
- const R = M * W + U, k = g ? this.random(h, d) : 1, q = L * k, T = f * q;
1284
- let _ = m + Math.cos(R) * H, F = y + Math.sin(R) * z;
1285
- const $ = T * 1.5 / 2, B = T / 2;
1286
- _ - $ < v ? _ = v + $ : _ + $ > s - v && (_ = s - v - $), F - B < v ? F = v + B : F + B > r - v && (F = r - v - B);
1287
- const Y = c === "random" ? this.random(l, u) : 0;
1251
+ const S = 2 * Math.PI / O, P = x * (20 * Math.PI / 180);
1252
+ for (let _ = 0; _ < O && E < t; _++) {
1253
+ const A = _ * S + P, j = p ? this.random(f, m) : 1, N = R * j, $ = l * N;
1254
+ let H = g + Math.cos(A) * z, U = h + Math.sin(A) * T;
1255
+ const B = $ * 1.5 / 2, W = $ / 2;
1256
+ H - B < I ? H = I + B : H + B > s - I && (H = s - I - B), U - W < I ? U = I + W : U + W > r - I && (U = r - I - W);
1257
+ const X = c === "random" ? this.random(d, u) : 0;
1288
1258
  n.push({
1289
- id: w,
1290
- x: _,
1291
- y: F,
1292
- rotation: Y,
1293
- scale: q,
1294
- baseSize: T,
1295
- zIndex: Math.max(1, 100 - I)
1259
+ id: E,
1260
+ x: H,
1261
+ y: U,
1262
+ rotation: X,
1263
+ scale: N,
1264
+ baseSize: $,
1265
+ zIndex: Math.max(1, 100 - x)
1296
1266
  // Outer rings have lower z-index
1297
- }), w++;
1267
+ }), E++;
1298
1268
  }
1299
- I++;
1269
+ x++;
1300
1270
  }
1301
1271
  return n;
1302
1272
  }
@@ -1319,7 +1289,7 @@ class ye {
1319
1289
  return Math.random() * (i - t) + t;
1320
1290
  }
1321
1291
  }
1322
- const ve = {
1292
+ const be = {
1323
1293
  columns: "auto",
1324
1294
  rows: "auto",
1325
1295
  stagger: "none",
@@ -1347,7 +1317,7 @@ const ve = {
1347
1317
  { x: 0, y: 1 }
1348
1318
  // down
1349
1319
  ];
1350
- class Ee {
1320
+ class ye {
1351
1321
  constructor(t, i = {}) {
1352
1322
  this.config = t, this.imageConfig = i;
1353
1323
  }
@@ -1359,60 +1329,60 @@ class Ee {
1359
1329
  * @returns Array of layout objects with position, rotation, scale
1360
1330
  */
1361
1331
  generate(t, i, e = {}) {
1362
- const n = [], { width: s, height: r } = i, a = { ...ve, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = s - 2 * c, p = r - 2 * c, { columns: f, rows: m } = this.calculateGridDimensions(
1332
+ const n = [], { width: s, height: r } = i, a = { ...be, ...this.config.grid }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = s - 2 * c, v = r - 2 * c, { columns: l, rows: g } = this.calculateGridDimensions(
1363
1333
  t,
1364
- b,
1365
- p,
1366
- l,
1334
+ w,
1335
+ v,
1336
+ d,
1367
1337
  a
1368
- ), y = a.stagger === "row", E = a.stagger === "column", v = y ? f + 0.5 : f, S = E ? m + 0.5 : m, w = (b - a.gap * (f - 1)) / v, I = (p - a.gap * (m - 1)) / S, O = y ? w / 2 : 0, L = E ? I / 2 : 0, P = 1 + a.overlap, z = Math.min(w, I) * P, H = e.fixedHeight ? Math.min(e.fixedHeight, z) : z, N = f * w + (f - 1) * a.gap + O, C = m * I + (m - 1) * a.gap + L, D = c + (b - N) / 2, W = c + (p - C) / 2, U = f * m, M = a.columns !== "auto" && a.rows !== "auto", R = M && t > U;
1338
+ ), h = a.stagger === "row", b = a.stagger === "column", I = h ? l + 0.5 : l, y = b ? g + 0.5 : g, E = (w - a.gap * (l - 1)) / I, x = (v - a.gap * (g - 1)) / y, F = h ? E / 2 : 0, R = b ? x / 2 : 0, M = 1 + a.overlap, T = Math.min(E, x) * M, z = e.fixedHeight ? Math.min(e.fixedHeight, T) : T, k = l * E + (l - 1) * a.gap + F, D = g * x + (g - 1) * a.gap + R, O = c + (w - k) / 2, S = c + (v - D) / 2, P = l * g, _ = a.columns !== "auto" && a.rows !== "auto", A = _ && t > P;
1369
1339
  typeof window < "u" && (window.__gridOverflowDebug = {
1370
1340
  gridConfigColumns: a.columns,
1371
1341
  gridConfigRows: a.rows,
1372
- columns: f,
1373
- rows: m,
1374
- cellCount: U,
1375
- hasFixedGrid: M,
1342
+ columns: l,
1343
+ rows: g,
1344
+ cellCount: P,
1345
+ hasFixedGrid: _,
1376
1346
  imageCount: t,
1377
- isOverflowMode: R
1347
+ isOverflowMode: A
1378
1348
  });
1379
- const k = R ? new Array(U).fill(0) : [], q = Math.min(w, I) * a.overflowOffset;
1380
- for (let T = 0; T < t; T++) {
1381
- let _, F, X = 0;
1382
- if (R && T >= U) {
1383
- const G = T - U, j = G % U;
1384
- X = Math.floor(G / U) + 1, k[j]++, a.fillDirection === "row" ? (_ = j % f, F = Math.floor(j / f)) : (F = j % m, _ = Math.floor(j / m));
1349
+ const j = A ? new Array(P).fill(0) : [], N = Math.min(E, x) * a.overflowOffset;
1350
+ for (let $ = 0; $ < t; $++) {
1351
+ let H, U, Y = 0;
1352
+ if (A && $ >= P) {
1353
+ const q = $ - P, G = q % P;
1354
+ Y = Math.floor(q / P) + 1, j[G]++, a.fillDirection === "row" ? (H = G % l, U = Math.floor(G / l)) : (U = G % g, H = Math.floor(G / g));
1385
1355
  } else
1386
- a.fillDirection === "row" ? (_ = T % f, F = Math.floor(T / f)) : (F = T % m, _ = Math.floor(T / m));
1387
- let $ = D + _ * (w + a.gap) + w / 2, B = W + F * (I + a.gap) + I / 2;
1388
- if (a.stagger === "row" && F % 2 === 1 ? $ += w / 2 : a.stagger === "column" && _ % 2 === 1 && (B += I / 2), X > 0) {
1389
- const G = (X - 1) % Lt.length, j = Lt[G];
1390
- $ += j.x * q, B += j.y * q;
1356
+ a.fillDirection === "row" ? (H = $ % l, U = Math.floor($ / l)) : (U = $ % g, H = Math.floor($ / g));
1357
+ let B = O + H * (E + a.gap) + E / 2, W = S + U * (x + a.gap) + x / 2;
1358
+ if (a.stagger === "row" && U % 2 === 1 ? B += E / 2 : a.stagger === "column" && H % 2 === 1 && (W += x / 2), Y > 0) {
1359
+ const q = (Y - 1) % Lt.length, G = Lt[q];
1360
+ B += G.x * N, W += G.y * N;
1391
1361
  }
1392
1362
  if (a.jitter > 0) {
1393
- const G = w / 2 * a.jitter, j = I / 2 * a.jitter;
1394
- $ += this.random(-G, G), B += this.random(-j, j);
1363
+ const q = E / 2 * a.jitter, G = x / 2 * a.jitter;
1364
+ B += this.random(-q, q), W += this.random(-G, G);
1395
1365
  }
1396
- let Y = $, J = B;
1397
- if (!R && a.fillDirection === "row") {
1398
- const G = t % f || f;
1399
- if (F === Math.floor((t - 1) / f) && G < f) {
1400
- const At = G * w + (G - 1) * a.gap;
1366
+ let X = B, J = W;
1367
+ if (!A && a.fillDirection === "row") {
1368
+ const q = t % l || l;
1369
+ if (U === Math.floor((t - 1) / l) && q < l) {
1370
+ const Ct = q * E + (q - 1) * a.gap;
1401
1371
  let gt = 0;
1402
- a.alignment === "center" ? gt = (N - At) / 2 : a.alignment === "end" && (gt = N - At), Y += gt;
1372
+ a.alignment === "center" ? gt = (k - Ct) / 2 : a.alignment === "end" && (gt = k - Ct), X += gt;
1403
1373
  }
1404
1374
  }
1405
- const ct = g ? this.random(h, d) : 1, K = H * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, Ut = c + ot, Ht = r - c - ot;
1406
- Y = Math.max(ht, Math.min(Y, dt)), J = Math.max(Ut, Math.min(J, Ht));
1375
+ const ct = p ? this.random(f, m) : 1, K = z * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, Ut = c + ot, kt = r - c - ot;
1376
+ X = Math.max(ht, Math.min(X, dt)), J = Math.max(Ut, Math.min(J, kt));
1407
1377
  let ut = 0;
1408
1378
  if (u === "random") {
1409
- const G = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
1410
- a.jitter > 0 ? ut = this.random(G * a.jitter, j * a.jitter) : ut = this.random(G, j);
1379
+ const q = this.imageConfig.rotation?.range?.min ?? -15, G = this.imageConfig.rotation?.range?.max ?? 15;
1380
+ a.jitter > 0 ? ut = this.random(q * a.jitter, G * a.jitter) : ut = this.random(q, G);
1411
1381
  }
1412
1382
  let ft;
1413
- R && X > 0 ? ft = 50 - X : ft = R ? 100 + T : T + 1, n.push({
1414
- id: T,
1415
- x: Y,
1383
+ A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + $ : $ + 1, n.push({
1384
+ id: $,
1385
+ x: X,
1416
1386
  y: J,
1417
1387
  rotation: ut,
1418
1388
  scale: ct,
@@ -1447,14 +1417,14 @@ class Ee {
1447
1417
  return Math.random() * (i - t) + t;
1448
1418
  }
1449
1419
  }
1450
- const we = Math.PI * (3 - Math.sqrt(5)), xe = {
1420
+ const ve = Math.PI * (3 - Math.sqrt(5)), Ee = {
1451
1421
  spiralType: "golden",
1452
1422
  direction: "counterclockwise",
1453
1423
  tightness: 1,
1454
1424
  scaleDecay: 0,
1455
1425
  startAngle: 0
1456
1426
  };
1457
- class Se {
1427
+ class xe {
1458
1428
  constructor(t, i = {}) {
1459
1429
  this.config = t, this.imageConfig = i;
1460
1430
  }
@@ -1466,36 +1436,36 @@ class Se {
1466
1436
  * @returns Array of layout objects with position, rotation, scale
1467
1437
  */
1468
1438
  generate(t, i, e = {}) {
1469
- const n = [], { width: s, height: r } = i, a = { ...xe, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, y = r / 2, E = Math.min(
1470
- m - c - l / 2,
1471
- y - c - l / 2
1472
- ), v = a.direction === "clockwise" ? -1 : 1;
1473
- for (let S = 0; S < t; S++) {
1474
- let w, I;
1439
+ const n = [], { width: s, height: r } = i, a = { ...Ee, ...this.config.spiral }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, w = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || w !== 1, l = this.config.scaleDecay ?? a.scaleDecay, g = s / 2, h = r / 2, b = Math.min(
1440
+ g - c - d / 2,
1441
+ h - c - d / 2
1442
+ ), I = a.direction === "clockwise" ? -1 : 1;
1443
+ for (let y = 0; y < t; y++) {
1444
+ let E, x;
1475
1445
  if (a.spiralType === "golden")
1476
- w = S * we * v + a.startAngle, I = this.calculateGoldenRadius(S, t, E, a.tightness);
1446
+ E = y * ve * I + a.startAngle, x = this.calculateGoldenRadius(y, t, b, a.tightness);
1477
1447
  else if (a.spiralType === "archimedean") {
1478
- const $ = S * 0.5 * a.tightness;
1479
- w = $ * v + a.startAngle, I = this.calculateArchimedeanRadius($, t, E, a.tightness);
1448
+ const B = y * 0.5 * a.tightness;
1449
+ E = B * I + a.startAngle, x = this.calculateArchimedeanRadius(B, t, b, a.tightness);
1480
1450
  } else {
1481
- const $ = S * 0.3 * a.tightness;
1482
- w = $ * v + a.startAngle, I = this.calculateLogarithmicRadius($, t, E, a.tightness);
1451
+ const B = y * 0.3 * a.tightness;
1452
+ E = B * I + a.startAngle, x = this.calculateLogarithmicRadius(B, t, b, a.tightness);
1483
1453
  }
1484
- const O = m + Math.cos(w) * I, L = y + Math.sin(w) * I, P = I / E, z = f > 0 ? 1 - P * f * 0.5 : 1, H = p ? this.random(g, b) : 1, N = z * H, C = l * N, W = C * 1.5 / 2, U = C / 2, M = c + W, R = s - c - W, k = c + U, q = r - c - U, T = Math.max(M, Math.min(O, R)), _ = Math.max(k, Math.min(L, q));
1485
- let F = 0;
1454
+ const F = g + Math.cos(E) * x, R = h + Math.sin(E) * x, M = x / b, T = l > 0 ? 1 - M * l * 0.5 : 1, z = v ? this.random(p, w) : 1, k = T * z, D = d * k, S = D * 1.5 / 2, P = D / 2, _ = c + S, A = s - c - S, j = c + P, N = r - c - P, $ = Math.max(_, Math.min(F, A)), H = Math.max(j, Math.min(R, N));
1455
+ let U = 0;
1486
1456
  if (u === "random") {
1487
- const $ = w * 180 / Math.PI % 360, B = this.random(h, d);
1488
- F = a.spiralType === "golden" ? B : $ * 0.1 + B * 0.9;
1489
- } else u === "tangent" && (F = this.calculateSpiralTangent(w, I, a));
1490
- const X = t - S;
1457
+ const B = E * 180 / Math.PI % 360, W = this.random(f, m);
1458
+ U = a.spiralType === "golden" ? W : B * 0.1 + W * 0.9;
1459
+ } else u === "tangent" && (U = this.calculateSpiralTangent(E, x, a));
1460
+ const Y = t - y;
1491
1461
  n.push({
1492
- id: S,
1493
- x: T,
1494
- y: _,
1495
- rotation: F,
1496
- scale: N,
1497
- baseSize: C,
1498
- zIndex: X
1462
+ id: y,
1463
+ x: $,
1464
+ y: H,
1465
+ rotation: U,
1466
+ scale: k,
1467
+ baseSize: D,
1468
+ zIndex: Y
1499
1469
  });
1500
1470
  }
1501
1471
  return n;
@@ -1538,8 +1508,8 @@ class Se {
1538
1508
  * r = a * e^(b*θ)
1539
1509
  */
1540
1510
  calculateLogarithmicRadius(t, i, e, n) {
1541
- const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, l = s * Math.exp(r * c);
1542
- return a / l * e;
1511
+ const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, d = s * Math.exp(r * c);
1512
+ return a / d * e;
1543
1513
  }
1544
1514
  /**
1545
1515
  * Utility: Generate random number between min and max
@@ -1548,7 +1518,7 @@ class Se {
1548
1518
  return Math.random() * (i - t) + t;
1549
1519
  }
1550
1520
  }
1551
- const Ie = {
1521
+ const we = {
1552
1522
  clusterCount: "auto",
1553
1523
  clusterSpread: 150,
1554
1524
  clusterSpacing: 200,
@@ -1556,7 +1526,7 @@ const Ie = {
1556
1526
  overlap: 0.3,
1557
1527
  distribution: "gaussian"
1558
1528
  };
1559
- class Ae {
1529
+ class Ie {
1560
1530
  constructor(t, i = {}) {
1561
1531
  this.config = t, this.imageConfig = i;
1562
1532
  }
@@ -1568,48 +1538,48 @@ class Ae {
1568
1538
  * @returns Array of layout objects with position, rotation, scale
1569
1539
  */
1570
1540
  generate(t, i, e = {}) {
1571
- const n = [], { width: s, height: r } = i, a = { ...Ie, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.calculateClusterCount(
1541
+ const n = [], { width: s, height: r } = i, a = { ...we, ...this.config.cluster }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, w = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || w !== 1, l = this.calculateClusterCount(
1572
1542
  t,
1573
1543
  a.clusterCount,
1574
1544
  s,
1575
1545
  r,
1576
1546
  a.clusterSpacing
1577
- ), m = this.generateClusterCenters(
1578
- f,
1547
+ ), g = this.generateClusterCenters(
1548
+ l,
1579
1549
  s,
1580
1550
  r,
1581
1551
  c,
1582
1552
  a
1583
- ), y = new Array(f).fill(0);
1584
- for (let v = 0; v < t; v++)
1585
- y[v % f]++;
1586
- let E = 0;
1587
- for (let v = 0; v < f; v++) {
1588
- const S = m[v], w = y[v];
1589
- for (let I = 0; I < w; I++) {
1590
- let O, L;
1553
+ ), h = new Array(l).fill(0);
1554
+ for (let I = 0; I < t; I++)
1555
+ h[I % l]++;
1556
+ let b = 0;
1557
+ for (let I = 0; I < l; I++) {
1558
+ const y = g[I], E = h[I];
1559
+ for (let x = 0; x < E; x++) {
1560
+ let F, R;
1591
1561
  if (a.distribution === "gaussian")
1592
- O = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
1562
+ F = this.gaussianRandom() * y.spread, R = this.gaussianRandom() * y.spread;
1593
1563
  else {
1594
- const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
1595
- O = Math.cos(F) * X, L = Math.sin(F) * X;
1564
+ const U = this.random(0, Math.PI * 2), Y = this.random(0, y.spread);
1565
+ F = Math.cos(U) * Y, R = Math.sin(U) * Y;
1596
1566
  }
1597
- const P = 1 + a.overlap * 0.5, z = 1 + a.overlap * 0.3;
1598
- O /= P, L /= P;
1599
- const H = p ? this.random(g, b) : 1, N = z * H, C = l * N;
1600
- let D = S.x + O, W = S.y + L;
1601
- const M = C * 1.5 / 2, R = C / 2;
1602
- D = Math.max(c + M, Math.min(D, s - c - M)), W = Math.max(c + R, Math.min(W, r - c - R));
1603
- const k = u === "random" ? this.random(h, d) : 0, T = Math.sqrt(O * O + L * L) / S.spread, _ = Math.round((1 - T) * 50) + 1;
1567
+ const M = 1 + a.overlap * 0.5, T = 1 + a.overlap * 0.3;
1568
+ F /= M, R /= M;
1569
+ const z = v ? this.random(p, w) : 1, k = T * z, D = d * k;
1570
+ let O = y.x + F, S = y.y + R;
1571
+ const _ = D * 1.5 / 2, A = D / 2;
1572
+ O = Math.max(c + _, Math.min(O, s - c - _)), S = Math.max(c + A, Math.min(S, r - c - A));
1573
+ const j = u === "random" ? this.random(f, m) : 0, $ = Math.sqrt(F * F + R * R) / y.spread, H = Math.round((1 - $) * 50) + 1;
1604
1574
  n.push({
1605
- id: E,
1606
- x: D,
1607
- y: W,
1608
- rotation: k,
1609
- scale: N,
1610
- baseSize: C,
1611
- zIndex: _
1612
- }), E++;
1575
+ id: b,
1576
+ x: O,
1577
+ y: S,
1578
+ rotation: j,
1579
+ scale: k,
1580
+ baseSize: D,
1581
+ zIndex: H
1582
+ }), b++;
1613
1583
  }
1614
1584
  }
1615
1585
  return n;
@@ -1629,24 +1599,24 @@ class Ae {
1629
1599
  * Generate cluster center positions with spacing constraints
1630
1600
  */
1631
1601
  generateClusterCenters(t, i, e, n, s) {
1632
- const r = [], c = n + s.clusterSpread, l = i - n - s.clusterSpread, u = n + s.clusterSpread, h = e - n - s.clusterSpread;
1633
- for (let d = 0; d < t; d++) {
1634
- let g = null, b = -1;
1635
- for (let p = 0; p < 100; p++) {
1636
- const f = {
1637
- x: this.random(c, l),
1638
- y: this.random(u, h),
1602
+ const r = [], c = n + s.clusterSpread, d = i - n - s.clusterSpread, u = n + s.clusterSpread, f = e - n - s.clusterSpread;
1603
+ for (let m = 0; m < t; m++) {
1604
+ let p = null, w = -1;
1605
+ for (let v = 0; v < 100; v++) {
1606
+ const l = {
1607
+ x: this.random(c, d),
1608
+ y: this.random(u, f),
1639
1609
  spread: this.calculateClusterSpread(s)
1640
1610
  };
1641
- let m = 1 / 0;
1642
- for (const y of r) {
1643
- const E = f.x - y.x, v = f.y - y.y, S = Math.sqrt(E * E + v * v);
1644
- m = Math.min(m, S);
1611
+ let g = 1 / 0;
1612
+ for (const h of r) {
1613
+ const b = l.x - h.x, I = l.y - h.y, y = Math.sqrt(b * b + I * I);
1614
+ g = Math.min(g, y);
1645
1615
  }
1646
- if ((r.length === 0 || m > b) && (g = f, b = m), m >= s.clusterSpacing)
1616
+ if ((r.length === 0 || g > w) && (p = l, w = g), g >= s.clusterSpacing)
1647
1617
  break;
1648
1618
  }
1649
- g && r.push(g);
1619
+ p && r.push(p);
1650
1620
  }
1651
1621
  return r;
1652
1622
  }
@@ -1674,7 +1644,7 @@ class Ae {
1674
1644
  return Math.random() * (i - t) + t;
1675
1645
  }
1676
1646
  }
1677
- class Ce {
1647
+ class Se {
1678
1648
  constructor(t, i = {}) {
1679
1649
  this.config = t, this.imageConfig = i;
1680
1650
  }
@@ -1686,29 +1656,29 @@ class Ce {
1686
1656
  * @returns Array of layout objects with position, rotation, scale
1687
1657
  */
1688
1658
  generate(t, i, e = {}) {
1689
- const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, p = e.fixedHeight ?? a, f = {
1690
- ...kt,
1659
+ const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, v = e.fixedHeight ?? a, l = {
1660
+ ...Nt,
1691
1661
  ...this.config.wave
1692
- }, { rows: m, amplitude: y, frequency: E, phaseShift: v, synchronization: S } = f, w = Math.ceil(t / m), L = p * 1.5 / 2, P = c + L, z = s - c - L, H = z - P, N = w > 1 ? H / (w - 1) : 0, C = c + y + p / 2, D = r - c - y - p / 2, W = D - C, U = m > 1 ? W / (m - 1) : 0;
1693
- let M = 0;
1694
- for (let R = 0; R < m && M < t; R++) {
1695
- const k = m === 1 ? (C + D) / 2 : C + R * U;
1696
- let q = 0;
1697
- S === "offset" ? q = R * v : S === "alternating" && (q = R * Math.PI);
1698
- for (let T = 0; T < w && M < t; T++) {
1699
- const _ = w === 1 ? (P + z) / 2 : P + T * N, F = this.calculateWaveY(_, s, y, E, q), X = _, $ = k + F, B = b ? this.random(d, g) : 1, Y = p * B;
1662
+ }, { rows: g, amplitude: h, frequency: b, phaseShift: I, synchronization: y } = l, E = Math.ceil(t / g), R = v * 1.5 / 2, M = c + R, T = s - c - R, z = T - M, k = E > 1 ? z / (E - 1) : 0, D = c + h + v / 2, O = r - c - h - v / 2, S = O - D, P = g > 1 ? S / (g - 1) : 0;
1663
+ let _ = 0;
1664
+ for (let A = 0; A < g && _ < t; A++) {
1665
+ const j = g === 1 ? (D + O) / 2 : D + A * P;
1666
+ let N = 0;
1667
+ y === "offset" ? N = A * I : y === "alternating" && (N = A * Math.PI);
1668
+ for (let $ = 0; $ < E && _ < t; $++) {
1669
+ const H = E === 1 ? (M + T) / 2 : M + $ * k, U = this.calculateWaveY(H, s, h, b, N), Y = H, B = j + U, W = w ? this.random(m, p) : 1, X = v * W;
1700
1670
  let J = 0;
1701
- l === "tangent" ? J = this.calculateRotation(_, s, y, E, q) : l === "random" && (J = this.random(u, h));
1702
- const K = Y * 1.5 / 2, lt = Y / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1671
+ d === "tangent" ? J = this.calculateRotation(H, s, h, b, N) : d === "random" && (J = this.random(u, f));
1672
+ const K = X * 1.5 / 2, lt = X / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1703
1673
  n.push({
1704
- id: M,
1705
- x: Math.max(nt, Math.min(X, ot)),
1706
- y: Math.max(ht, Math.min($, dt)),
1674
+ id: _,
1675
+ x: Math.max(nt, Math.min(Y, ot)),
1676
+ y: Math.max(ht, Math.min(B, dt)),
1707
1677
  rotation: J,
1708
- scale: B,
1709
- baseSize: Y,
1710
- zIndex: M + 1
1711
- }), M++;
1678
+ scale: W,
1679
+ baseSize: X,
1680
+ zIndex: _ + 1
1681
+ }), _++;
1712
1682
  }
1713
1683
  }
1714
1684
  return n;
@@ -1751,7 +1721,7 @@ class Ce {
1751
1721
  return Math.random() * (i - t) + t;
1752
1722
  }
1753
1723
  }
1754
- const xt = 100, Q = 100 / Math.sqrt(3), St = [
1724
+ const wt = 100, Q = 100 / Math.sqrt(3), It = [
1755
1725
  [Q / 2, 0],
1756
1726
  // upper-left
1757
1727
  [3 * Q / 2, 0],
@@ -1764,21 +1734,21 @@ const xt = 100, Q = 100 / Math.sqrt(3), St = [
1764
1734
  // lower-left
1765
1735
  [0, 50]
1766
1736
  // left
1767
- ], Re = St[1][0] / xt, Te = St[2][1] / xt;
1768
- function Le(o) {
1737
+ ], Ce = It[1][0] / wt, Re = It[2][1] / wt;
1738
+ function Te(o) {
1769
1739
  return {
1770
- colStep: Re * o,
1771
- rowOffset: Te * o
1740
+ colStep: Ce * o,
1741
+ rowOffset: Re * o
1772
1742
  };
1773
1743
  }
1774
- function Me(o, t, i, e, n, s) {
1775
- const { colStep: r } = Le(s);
1744
+ function Ae(o, t, i, e, n, s) {
1745
+ const { colStep: r } = Te(s);
1776
1746
  return {
1777
1747
  px: e + r * o,
1778
1748
  py: n + s * (t + o / 2)
1779
1749
  };
1780
1750
  }
1781
- const Fe = [
1751
+ const Le = [
1782
1752
  [1, 0, -1],
1783
1753
  [0, 1, -1],
1784
1754
  [-1, 1, 0],
@@ -1786,49 +1756,49 @@ const Fe = [
1786
1756
  [0, -1, 1],
1787
1757
  [1, -1, 0]
1788
1758
  ];
1789
- function Oe(o) {
1759
+ function Fe(o) {
1790
1760
  if (o === 0) return [[0, 0, 0]];
1791
1761
  const t = [];
1792
1762
  let [i, e, n] = [0, -o, o];
1793
- for (const [s, r, a] of Fe)
1763
+ for (const [s, r, a] of Le)
1794
1764
  for (let c = 0; c < o; c++)
1795
1765
  t.push([i, e, n]), i += s, e += r, n += a;
1796
1766
  return t;
1797
1767
  }
1798
- class ze {
1768
+ class Me {
1799
1769
  // imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
1800
1770
  // would break hex tiling). Kept as parameter for interface compatibility.
1801
1771
  constructor(t, i = {}) {
1802
1772
  this.config = t;
1803
1773
  }
1804
1774
  generate(t, i, e = {}) {
1805
- const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1775
+ const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, d = e.fixedHeight ?? 200, f = {
1806
1776
  ...Bt,
1807
1777
  ...this.config.honeycomb
1808
- }.spacing ?? 0, d = l + h;
1809
- let g = 0, b = 0;
1810
- for (; g < t; ) {
1811
- const p = Oe(b);
1812
- for (const [f, m, y] of p) {
1813
- if (g >= t) break;
1814
- const { px: E, py: v } = Me(f, m, y, a, c, d);
1778
+ }.spacing ?? 0, m = d + f;
1779
+ let p = 0, w = 0;
1780
+ for (; p < t; ) {
1781
+ const v = Fe(w);
1782
+ for (const [l, g, h] of v) {
1783
+ if (p >= t) break;
1784
+ const { px: b, py: I } = Ae(l, g, h, a, c, m);
1815
1785
  n.push({
1816
- id: g,
1817
- x: E,
1818
- y: v,
1786
+ id: p,
1787
+ x: b,
1788
+ y: I,
1819
1789
  rotation: 0,
1820
1790
  scale: 1,
1821
- baseSize: l,
1791
+ baseSize: d,
1822
1792
  // Inner rings render above outer rings
1823
- zIndex: Math.max(1, 100 - b)
1824
- }), g++;
1793
+ zIndex: Math.max(1, 100 - w)
1794
+ }), p++;
1825
1795
  }
1826
- b++;
1796
+ w++;
1827
1797
  }
1828
1798
  return n;
1829
1799
  }
1830
1800
  }
1831
- class De {
1801
+ class Oe {
1832
1802
  constructor(t) {
1833
1803
  this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
1834
1804
  }
@@ -1839,19 +1809,19 @@ class De {
1839
1809
  initLayout() {
1840
1810
  switch (this.config.algorithm) {
1841
1811
  case "radial":
1842
- return new ye(this.config, this.imageConfig);
1812
+ return new pe(this.config, this.imageConfig);
1843
1813
  case "grid":
1844
- return new Ee(this.config, this.imageConfig);
1814
+ return new ye(this.config, this.imageConfig);
1845
1815
  case "spiral":
1846
- return new Se(this.config, this.imageConfig);
1816
+ return new xe(this.config, this.imageConfig);
1847
1817
  case "cluster":
1848
- return new Ae(this.config, this.imageConfig);
1818
+ return new Ie(this.config, this.imageConfig);
1849
1819
  case "wave":
1850
- return new Ce(this.config, this.imageConfig);
1820
+ return new Se(this.config, this.imageConfig);
1851
1821
  case "honeycomb":
1852
- return new ze(this.config, this.imageConfig);
1822
+ return new Me(this.config, this.imageConfig);
1853
1823
  default:
1854
- return new be(this.config, this.imageConfig);
1824
+ return new me(this.config, this.imageConfig);
1855
1825
  }
1856
1826
  }
1857
1827
  /**
@@ -1933,15 +1903,15 @@ class De {
1933
1903
  const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1934
1904
  if (r !== void 0)
1935
1905
  return { height: r };
1936
- const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * l / i;
1937
- let m = Math.sqrt(p / 1.4);
1938
- m *= u, m = Math.min(m, e);
1939
- let y = this.clamp(m, a, c);
1940
- if (y === a && m < a) {
1941
- const E = Math.max(a * 0.05, 20);
1942
- y = Math.max(E, m);
1906
+ const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, d = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: f, height: m } = t, v = f * m * d / i;
1907
+ let g = Math.sqrt(v / 1.4);
1908
+ g *= u, g = Math.min(g, e);
1909
+ let h = this.clamp(g, a, c);
1910
+ if (h === a && g < a) {
1911
+ const b = Math.max(a * 0.05, 20);
1912
+ h = Math.max(b, g);
1943
1913
  }
1944
- return this.config.algorithm === "honeycomb" && (y = Math.min(y, this.honeycombMaxImageHeight(i, t))), { height: y };
1914
+ return this.config.algorithm === "honeycomb" && (h = Math.min(h, this.honeycombMaxImageHeight(i, t))), { height: h };
1945
1915
  }
1946
1916
  /**
1947
1917
  * Returns the largest image height at which all honeycomb rings fit within the container.
@@ -1953,8 +1923,8 @@ class De {
1953
1923
  let e = 0, n = 1;
1954
1924
  for (; n < t; )
1955
1925
  e++, n += 6 * e;
1956
- const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, l = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (c - s - r * e) / (e + 0.5), d = (a - s - l * r * e) / (l * e + u);
1957
- return Math.max(10, Math.min(h, d));
1926
+ const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, d = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), f = (c - s - r * e) / (e + 0.5), m = (a - s - d * r * e) / (d * e + u);
1927
+ return Math.max(10, Math.min(f, m));
1958
1928
  }
1959
1929
  /**
1960
1930
  * Utility: Clamp a value between min and max
@@ -1963,8 +1933,8 @@ class De {
1963
1933
  return Math.max(i, Math.min(e, t));
1964
1934
  }
1965
1935
  }
1966
- var x = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(x || {});
1967
- const Mt = {
1936
+ var C = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(C || {});
1937
+ const Ft = {
1968
1938
  // Geometric shapes - uses percentages for responsive sizing
1969
1939
  circle: "circle(50%)",
1970
1940
  square: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)",
@@ -1973,7 +1943,7 @@ const Mt = {
1973
1943
  hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
1974
1944
  octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
1975
1945
  diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
1976
- }, _e = {
1946
+ }, ze = {
1977
1947
  // Circle - uses radius in pixels (refHeight of 100px = 50px radius)
1978
1948
  circle: {
1979
1949
  refHeight: 100,
@@ -1997,8 +1967,8 @@ const Mt = {
1997
1967
  },
1998
1968
  // Hexagon - regular hexagon (reference points imported from hexagonGeometry)
1999
1969
  hexagon: {
2000
- refHeight: xt,
2001
- points: St
1970
+ refHeight: wt,
1971
+ points: It
2002
1972
  },
2003
1973
  // Octagon - regular octagon
2004
1974
  octagon: {
@@ -2011,29 +1981,29 @@ const Mt = {
2011
1981
  points: [[50, 0], [100, 50], [50, 100], [0, 50]]
2012
1982
  }
2013
1983
  };
2014
- function $e(o) {
1984
+ function De(o) {
2015
1985
  if (o)
2016
- return o in Mt ? Mt[o] : o;
1986
+ return o in Ft ? Ft[o] : o;
2017
1987
  }
2018
- function Pe(o, t, i) {
2019
- const e = _e[o];
1988
+ function _e(o, t, i) {
1989
+ const e = ze[o];
2020
1990
  if (!e) return "";
2021
1991
  const n = t / e.refHeight;
2022
1992
  if (o === "circle")
2023
1993
  return `circle(${Math.round(50 * n * 100) / 100}px)`;
2024
- const s = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, l = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? l) / 2, h = t / 2, d = u - a, g = h - c;
2025
- return `polygon(${e.points.map(([p, f]) => {
2026
- const m = Math.round((p * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
2027
- return `${m}px ${y}px`;
1994
+ const s = e.points.map(([v]) => v), r = e.points.map(([, v]) => v), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, d = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? d) / 2, f = t / 2, m = u - a, p = f - c;
1995
+ return `polygon(${e.points.map(([v, l]) => {
1996
+ const g = Math.round((v * n + m) * 100) / 100, h = Math.round((l * n + p) * 100) / 100;
1997
+ return `${g}px ${h}px`;
2028
1998
  }).join(", ")})`;
2029
1999
  }
2030
- function Ue(o) {
2000
+ function $e(o) {
2031
2001
  return o in mt;
2032
2002
  }
2033
- function He(o) {
2034
- return o ? Ue(o) ? mt[o] : o : mt.md;
2003
+ function Pe(o) {
2004
+ return o ? $e(o) ? mt[o] : o : mt.md;
2035
2005
  }
2036
- function Ne(o) {
2006
+ function Ue(o) {
2037
2007
  if (!o) return "";
2038
2008
  const t = [];
2039
2009
  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)
@@ -2059,23 +2029,23 @@ function it(o, t, i) {
2059
2029
  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`);
2060
2030
  } else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
2061
2031
  if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
2062
- const a = o.border || {}, c = { ...a, ...o.borderTop }, l = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, h = { ...a, ...o.borderLeft };
2063
- e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
2032
+ const a = o.border || {}, c = { ...a, ...o.borderTop }, d = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, f = { ...a, ...o.borderLeft };
2033
+ e.borderTop = tt(c), e.borderRight = tt(d), e.borderBottom = tt(u), e.borderLeft = tt(f);
2064
2034
  } else o.border && (e.border = tt(o.border));
2065
- o.shadow !== void 0 && (e.boxShadow = He(o.shadow));
2066
- const r = Ne(o.filter);
2035
+ o.shadow !== void 0 && (e.boxShadow = Pe(o.shadow));
2036
+ const r = Ue(o.filter);
2067
2037
  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) {
2068
- const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
2069
- e.outline = `${a}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2038
+ const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", d = o.outline.color ?? "#000000";
2039
+ e.outline = `${a}px ${c} ${d}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2070
2040
  }
2071
2041
  if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
2072
2042
  let a;
2073
- const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
2074
- if (l?.mode === "height-relative" && t)
2075
- a = Pe(l.shape, t, i);
2043
+ const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, d = c ? o.clipPath : void 0;
2044
+ if (d?.mode === "height-relative" && t)
2045
+ a = _e(d.shape, t, i);
2076
2046
  else {
2077
- const u = c && l ? l.shape : o.clipPath;
2078
- a = $e(u);
2047
+ const u = c && d ? d.shape : o.clipPath;
2048
+ a = De(u);
2079
2049
  }
2080
2050
  a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
2081
2051
  }
@@ -2103,13 +2073,13 @@ function pt(o, t) {
2103
2073
  e.trim() && o.classList.remove(e.trim());
2104
2074
  });
2105
2075
  }
2106
- const Ft = {
2076
+ const Mt = {
2107
2077
  UNFOCUSING: 999,
2108
2078
  FOCUSING: 1e3
2109
2079
  };
2110
- class Be {
2080
+ class He {
2111
2081
  constructor(t, i, e) {
2112
- this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
2082
+ this.state = C.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;
2113
2083
  }
2114
2084
  /**
2115
2085
  * Set callback to be fired when an unfocus animation fully completes.
@@ -2127,7 +2097,7 @@ class Be {
2127
2097
  * Check if any animation is in progress
2128
2098
  */
2129
2099
  isAnimating() {
2130
- return this.state !== x.IDLE && this.state !== x.FOCUSED;
2100
+ return this.state !== C.IDLE && this.state !== C.FOCUSED;
2131
2101
  }
2132
2102
  /**
2133
2103
  * Normalize scalePercent value
@@ -2142,8 +2112,8 @@ class Be {
2142
2112
  calculateFocusDimensions(t, i, e) {
2143
2113
  const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
2144
2114
  let a = s, c = a * r;
2145
- const l = e.width * n;
2146
- return c > l && (c = l, a = c / r), { width: c, height: a };
2115
+ const d = e.width * n;
2116
+ return c > d && (c = d, a = c / r), { width: c, height: a };
2147
2117
  }
2148
2118
  /**
2149
2119
  * Calculate the transform needed to center an image (position only, no scale)
@@ -2175,11 +2145,11 @@ class Be {
2175
2145
  * This provides sharper zoom by re-rendering at target size instead of scaling pixels
2176
2146
  */
2177
2147
  animateWithDimensions(t, i, e, n, s, r, a, c) {
2178
- const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2148
+ const d = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2179
2149
  return t.style.transition = "none", t.animate(
2180
2150
  [
2181
2151
  {
2182
- transform: l,
2152
+ transform: d,
2183
2153
  width: `${n}px`,
2184
2154
  height: `${s}px`
2185
2155
  },
@@ -2236,33 +2206,33 @@ class Be {
2236
2206
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2237
2207
  */
2238
2208
  startFocusAnimation(t, i, e, n, s) {
2239
- const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2209
+ const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, d = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2240
2210
  this.animationEngine.cancelAllAnimations(t);
2241
- const h = this.config.animationDuration ?? 600;
2242
- this.applyFocusedStyling(t, Ft.FOCUSING);
2243
- const d = n ?? {
2211
+ const f = this.config.animationDuration ?? 600;
2212
+ this.applyFocusedStyling(t, Mt.FOCUSING);
2213
+ const m = n ?? {
2244
2214
  x: 0,
2245
2215
  y: 0,
2246
2216
  rotation: e.rotation,
2247
2217
  scale: 1
2248
2218
  // No scale - using dimensions
2249
- }, g = s?.width ?? a, b = s?.height ?? c, p = this.animateWithDimensions(
2219
+ }, p = s?.width ?? a, w = s?.height ?? c, v = this.animateWithDimensions(
2250
2220
  t,
2251
- d,
2221
+ m,
2252
2222
  u,
2253
- g,
2254
- b,
2255
- l.width,
2256
- l.height,
2257
- h
2258
- ), f = {
2223
+ p,
2224
+ w,
2225
+ d.width,
2226
+ d.height,
2227
+ f
2228
+ ), l = {
2259
2229
  id: `focus-${Date.now()}`,
2260
2230
  element: t,
2261
- animation: p,
2262
- fromState: d,
2231
+ animation: v,
2232
+ fromState: m,
2263
2233
  toState: u,
2264
2234
  startTime: performance.now(),
2265
- duration: h
2235
+ duration: f
2266
2236
  };
2267
2237
  return this.focusData = {
2268
2238
  element: t,
@@ -2271,12 +2241,12 @@ class Be {
2271
2241
  originalZIndex: r,
2272
2242
  originalWidth: a,
2273
2243
  originalHeight: c,
2274
- focusWidth: l.width,
2275
- focusHeight: l.height
2276
- }, this.startClipPathAnimation(t, f, !0), {
2244
+ focusWidth: d.width,
2245
+ focusHeight: d.height
2246
+ }, this.startClipPathAnimation(t, l, !0), {
2277
2247
  element: t,
2278
2248
  originalState: e,
2279
- animationHandle: f,
2249
+ animationHandle: l,
2280
2250
  direction: "in",
2281
2251
  originalWidth: a,
2282
2252
  originalHeight: c
@@ -2288,40 +2258,40 @@ class Be {
2288
2258
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2289
2259
  */
2290
2260
  startUnfocusAnimation(t, i, e, n) {
2291
- t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2261
+ t.style.zIndex = String(Mt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2292
2262
  const s = this.config.animationDuration ?? 600;
2293
2263
  t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
2294
- const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
2264
+ 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, d = {
2295
2265
  x: 0,
2296
2266
  y: 0,
2297
2267
  rotation: i.rotation,
2298
2268
  scale: 1
2299
2269
  // No scale - using dimensions
2300
- }, u = this.focusData?.originalWidth ?? t.offsetWidth, h = this.focusData?.originalHeight ?? t.offsetHeight, d = this.animateWithDimensions(
2270
+ }, u = this.focusData?.originalWidth ?? t.offsetWidth, f = this.focusData?.originalHeight ?? t.offsetHeight, m = this.animateWithDimensions(
2301
2271
  t,
2302
2272
  r,
2303
- l,
2273
+ d,
2304
2274
  a,
2305
2275
  c,
2306
2276
  u,
2307
- h,
2277
+ f,
2308
2278
  s
2309
- ), g = {
2279
+ ), p = {
2310
2280
  id: `unfocus-${Date.now()}`,
2311
2281
  element: t,
2312
- animation: d,
2282
+ animation: m,
2313
2283
  fromState: r,
2314
- toState: l,
2284
+ toState: d,
2315
2285
  startTime: performance.now(),
2316
2286
  duration: s
2317
2287
  };
2318
- return this.startClipPathAnimation(t, g, !1), {
2288
+ return this.startClipPathAnimation(t, p, !1), {
2319
2289
  element: t,
2320
2290
  originalState: i,
2321
- animationHandle: g,
2291
+ animationHandle: p,
2322
2292
  direction: "out",
2323
2293
  originalWidth: u,
2324
- originalHeight: h
2294
+ originalHeight: f
2325
2295
  };
2326
2296
  }
2327
2297
  /**
@@ -2367,26 +2337,26 @@ class Be {
2367
2337
  * Implements cross-animation when swapping focus
2368
2338
  */
2369
2339
  async focusImage(t, i, e) {
2370
- if (this.currentFocus === t && this.state === x.FOCUSED)
2340
+ if (this.currentFocus === t && this.state === C.FOCUSED)
2371
2341
  return this.unfocusImage();
2372
- if (this.incoming?.element === t && this.state === x.FOCUSING) {
2342
+ if (this.incoming?.element === t && this.state === C.FOCUSING) {
2373
2343
  const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2374
2344
  this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
2375
2345
  t,
2376
2346
  this.incoming.originalState,
2377
2347
  s,
2378
2348
  r
2379
- ), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE;
2349
+ ), this.incoming = null, this.state = C.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 = C.IDLE;
2380
2350
  return;
2381
2351
  }
2382
2352
  const n = ++this.focusGeneration;
2383
2353
  switch (this.state) {
2384
- case x.IDLE:
2385
- if (this.state = x.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2386
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2354
+ case C.IDLE:
2355
+ if (this.state = C.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2356
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2387
2357
  break;
2388
- case x.FOCUSED:
2389
- if (this.state = x.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
2358
+ case C.FOCUSED:
2359
+ if (this.state = C.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
2390
2360
  this.currentFocus,
2391
2361
  this.focusData.originalState
2392
2362
  )), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
@@ -2398,9 +2368,9 @@ class Be {
2398
2368
  const s = this.outgoing.element;
2399
2369
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2400
2370
  }
2401
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2371
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2402
2372
  break;
2403
- case x.FOCUSING:
2373
+ case C.FOCUSING:
2404
2374
  if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
2405
2375
  this.incoming.element,
2406
2376
  this.incoming.originalState,
@@ -2408,10 +2378,10 @@ class Be {
2408
2378
  this.focusData?.originalWidth,
2409
2379
  this.focusData?.originalHeight
2410
2380
  ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2411
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2381
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2412
2382
  break;
2413
- case x.UNFOCUSING:
2414
- if (this.state = x.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2383
+ case C.UNFOCUSING:
2384
+ if (this.state = C.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2415
2385
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2416
2386
  this.waitForAnimation(this.incoming.animationHandle)
2417
2387
  ]), this.focusGeneration !== n) return;
@@ -2419,9 +2389,9 @@ class Be {
2419
2389
  const s = this.outgoing.element;
2420
2390
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2421
2391
  }
2422
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2392
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2423
2393
  break;
2424
- case x.CROSS_ANIMATING:
2394
+ case C.CROSS_ANIMATING:
2425
2395
  if (this.incoming?.element === t)
2426
2396
  return;
2427
2397
  if (this.outgoing?.element === t) {
@@ -2444,7 +2414,7 @@ class Be {
2444
2414
  const a = this.outgoing.element;
2445
2415
  this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2446
2416
  }
2447
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2417
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2448
2418
  return;
2449
2419
  }
2450
2420
  if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
@@ -2470,7 +2440,7 @@ class Be {
2470
2440
  const s = this.outgoing.element;
2471
2441
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2472
2442
  }
2473
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2443
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2474
2444
  break;
2475
2445
  }
2476
2446
  }
@@ -2478,24 +2448,24 @@ class Be {
2478
2448
  * Unfocus current image, returning it to original position
2479
2449
  */
2480
2450
  async unfocusImage() {
2481
- if (this.state === x.UNFOCUSING)
2451
+ if (this.state === C.UNFOCUSING)
2482
2452
  return;
2483
2453
  const t = ++this.focusGeneration;
2484
2454
  if (!this.currentFocus || !this.focusData) {
2485
- if (this.incoming && this.state === x.FOCUSING) {
2455
+ if (this.incoming && this.state === C.FOCUSING) {
2486
2456
  const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2487
2457
  if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2488
2458
  this.incoming.element,
2489
2459
  this.incoming.originalState,
2490
2460
  s,
2491
2461
  r
2492
- ), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2462
+ ), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2493
2463
  const a = this.outgoing.element;
2494
- this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(a);
2464
+ this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(a);
2495
2465
  }
2496
2466
  return;
2497
2467
  }
2498
- if (this.state === x.CROSS_ANIMATING && this.incoming) {
2468
+ if (this.state === C.CROSS_ANIMATING && this.incoming) {
2499
2469
  const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2500
2470
  this.animationEngine.cancelAllAnimations(this.incoming.element);
2501
2471
  const a = this.startUnfocusAnimation(
@@ -2510,13 +2480,13 @@ class Be {
2510
2480
  ]), this.focusGeneration !== t) return;
2511
2481
  let c = null;
2512
2482
  this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
2513
- const l = a.element;
2514
- this.removeFocusedStyling(l, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(l);
2483
+ const d = a.element;
2484
+ this.removeFocusedStyling(d, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(d);
2515
2485
  return;
2516
2486
  }
2517
- this.state = x.UNFOCUSING;
2487
+ this.state = C.UNFOCUSING;
2518
2488
  const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
2519
- 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));
2489
+ 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 = C.IDLE, this.onUnfocusComplete?.(i));
2520
2490
  }
2521
2491
  /**
2522
2492
  * Swap focus from current image to a new one (alias for focusImage with cross-animation)
@@ -2534,7 +2504,7 @@ class Be {
2534
2504
  * Check if an image is currently focused (stable state)
2535
2505
  */
2536
2506
  isFocused(t) {
2537
- return this.currentFocus === t && this.state === x.FOCUSED;
2507
+ return this.currentFocus === t && this.state === C.FOCUSED;
2538
2508
  }
2539
2509
  /**
2540
2510
  * Check if an image is the target of current focus animation
@@ -2555,7 +2525,7 @@ class Be {
2555
2525
  * Used during swipe gestures for visual feedback
2556
2526
  */
2557
2527
  setDragOffset(t) {
2558
- if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2528
+ if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
2559
2529
  const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
2560
2530
  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(" ");
2561
2531
  }
@@ -2565,7 +2535,7 @@ class Be {
2565
2535
  * @param duration - Animation duration in ms (default 150)
2566
2536
  */
2567
2537
  clearDragOffset(t, i = 150) {
2568
- if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2538
+ if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
2569
2539
  const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
2570
2540
  s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
2571
2541
  const c = s.join(" ");
@@ -2595,10 +2565,10 @@ class Be {
2595
2565
  this.focusData.originalZIndex,
2596
2566
  this.focusData.originalWidth,
2597
2567
  this.focusData.originalHeight
2598
- ), this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2568
+ ), this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2599
2569
  }
2600
2570
  }
2601
- const je = 50, We = 0.5, Ge = 20, qe = 0.3, Xe = 150, Ye = 30, rt = class rt {
2571
+ const Ne = 50, Be = 0.5, je = 20, We = 0.3, Ge = 150, qe = 30, rt = class rt {
2602
2572
  constructor(t, i) {
2603
2573
  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);
2604
2574
  }
@@ -2645,11 +2615,11 @@ const je = 50, We = 0.5, Ge = 20, qe = 0.3, Xe = 150, Ye = 30, rt = class rt {
2645
2615
  const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
2646
2616
  if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
2647
2617
  const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2648
- this.touchState.isHorizontalSwipe = a <= Ye;
2618
+ this.touchState.isHorizontalSwipe = a <= qe;
2649
2619
  }
2650
2620
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
2651
2621
  t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
2652
- const s = e * qe;
2622
+ const s = e * We;
2653
2623
  this.callbacks.onDragOffset(s);
2654
2624
  }
2655
2625
  }
@@ -2658,7 +2628,7 @@ const je = 50, We = 0.5, Ge = 20, qe = 0.3, Xe = 150, Ye = 30, rt = class rt {
2658
2628
  this.recentTouchTimestamp = Date.now();
2659
2629
  const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
2660
2630
  let r = !1;
2661
- this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= je || n >= We && s >= Ge) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2631
+ this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Ne || n >= Be && s >= je) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2662
2632
  }
2663
2633
  handleTouchCancel(t) {
2664
2634
  this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
@@ -2666,7 +2636,7 @@ const je = 50, We = 0.5, Ge = 20, qe = 0.3, Xe = 150, Ye = 30, rt = class rt {
2666
2636
  };
2667
2637
  rt.TOUCH_CLICK_DELAY = 300;
2668
2638
  let bt = rt;
2669
- class Je {
2639
+ class Ye {
2670
2640
  constructor(t) {
2671
2641
  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)
2672
2642
  throw new Error("GoogleDriveLoader requires at least one source to be configured");
@@ -2761,10 +2731,10 @@ class Je {
2761
2731
  const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2762
2732
  if (!a.ok)
2763
2733
  throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2764
- const l = (await a.json()).files.filter(
2734
+ const d = (await a.json()).files.filter(
2765
2735
  (u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
2766
2736
  );
2767
- return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
2737
+ return this.log(`Found ${d.length} images in folder ${t} (non-recursive)`), d.forEach((u) => {
2768
2738
  e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
2769
2739
  }), e;
2770
2740
  }
@@ -2831,18 +2801,18 @@ class Je {
2831
2801
  const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2832
2802
  if (!a.ok)
2833
2803
  throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2834
- const c = await a.json(), l = c.files.filter(
2835
- (h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
2804
+ const c = await a.json(), d = c.files.filter(
2805
+ (f) => f.mimeType.startsWith("image/") && i.isAllowed(f.name)
2836
2806
  ), u = c.files.filter(
2837
- (h) => h.mimeType === "application/vnd.google-apps.folder"
2807
+ (f) => f.mimeType === "application/vnd.google-apps.folder"
2838
2808
  );
2839
- this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), l.forEach((h) => {
2840
- e.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
2809
+ this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((f) => this.log(` - File: ${f.name} (${f.mimeType})`)), this.log(`- ${d.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), d.forEach((f) => {
2810
+ e.push(`https://lh3.googleusercontent.com/d/${f.id}=s1600`), this.log(`Added file: ${f.name}`);
2841
2811
  });
2842
- for (const h of u) {
2843
- this.log(`Loading images from subfolder: ${h.name}`);
2844
- const d = await this.loadImagesRecursively(h.id, i);
2845
- e.push(...d);
2812
+ for (const f of u) {
2813
+ this.log(`Loading images from subfolder: ${f.name}`);
2814
+ const m = await this.loadImagesRecursively(f.id, i);
2815
+ e.push(...m);
2846
2816
  }
2847
2817
  return e;
2848
2818
  }
@@ -2887,7 +2857,7 @@ class Je {
2887
2857
  this.debugLogging && typeof console < "u" && console.log(...t);
2888
2858
  }
2889
2859
  }
2890
- class Ve {
2860
+ class Xe {
2891
2861
  constructor(t) {
2892
2862
  if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
2893
2863
  throw new Error("StaticImageLoader requires at least one source to be configured");
@@ -3067,7 +3037,7 @@ class Ve {
3067
3037
  this.debugLogging && typeof console < "u" && console.log(...t);
3068
3038
  }
3069
3039
  }
3070
- class Ke {
3040
+ class Je {
3071
3041
  constructor(t) {
3072
3042
  if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
3073
3043
  throw new Error("CompositeLoader requires at least one loader to be configured");
@@ -3124,7 +3094,7 @@ class Ke {
3124
3094
  this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
3125
3095
  }
3126
3096
  }
3127
- class Ze {
3097
+ class Ve {
3128
3098
  /**
3129
3099
  * Create a new ImageFilter
3130
3100
  * @param extensions - Array of allowed file extensions (without dots)
@@ -3161,7 +3131,7 @@ class Ze {
3161
3131
  // isAllowedDate(date: Date): boolean
3162
3132
  // isAllowedDimensions(width: number, height: number): boolean
3163
3133
  }
3164
- const Qe = `
3134
+ const Ke = `
3165
3135
  .fbn-ic-gallery {
3166
3136
  position: relative;
3167
3137
  width: 100%;
@@ -3242,37 +3212,46 @@ const Qe = `
3242
3212
  display: none !important;
3243
3213
  }
3244
3214
  `;
3245
- function ti() {
3215
+ function Ze() {
3246
3216
  if (typeof document > "u") return;
3247
3217
  const o = "fbn-ic-functional-styles";
3248
3218
  if (document.getElementById(o)) return;
3249
3219
  const t = document.createElement("style");
3250
- t.id = o, t.textContent = Qe, document.head.appendChild(t);
3220
+ t.id = o, t.textContent = Ke, document.head.appendChild(t);
3251
3221
  }
3252
- class ei {
3222
+ class Qe {
3253
3223
  constructor(t = {}) {
3254
- this.fullConfig = te(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new oe(this.fullConfig.animation), this.layoutEngine = new De({
3224
+ this.fullConfig = Zt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.callbacks = t.on ?? {}, 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 ie(this.fullConfig.animation), this.layoutEngine = new Oe({
3255
3225
  layout: this.fullConfig.layout,
3256
3226
  image: this.fullConfig.image
3257
- }), this.zoomEngine = new Be(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
3258
- const i = this.fullConfig.animation.entry || A.animation.entry;
3259
- this.entryAnimationEngine = new me(
3227
+ }), this.zoomEngine = new He(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;
3228
+ const i = this.fullConfig.animation.entry || L.animation.entry;
3229
+ this.entryAnimationEngine = new fe(
3260
3230
  i,
3261
3231
  this.fullConfig.layout.algorithm
3262
3232
  );
3263
3233
  const e = this.fullConfig.animation.idle;
3264
- e && e.type !== "none" ? this.idleAnimationEngine = new pe(
3234
+ e && e.type !== "none" ? this.idleAnimationEngine = new ge(
3265
3235
  e,
3266
3236
  i.timing?.duration ?? 600
3267
3237
  ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
3268
3238
  this.idleAnimationEngine?.resumeForImage(n);
3269
- const s = n;
3239
+ const s = n, r = this.imageElements.indexOf(s);
3240
+ if (this.callbacks.onImageUnfocus && r !== -1) {
3241
+ const a = this.imageLoader.imageURLs(), c = {
3242
+ element: s,
3243
+ index: r,
3244
+ url: a[r] ?? "",
3245
+ layout: this.imageLayouts[r]
3246
+ };
3247
+ this.callbacks.onImageUnfocus(c);
3248
+ }
3270
3249
  requestAnimationFrame(() => {
3271
3250
  if (s.matches(":hover") && this.fullConfig.styling?.hover) {
3272
- const r = this.imageElements.indexOf(s);
3273
- if (r !== -1) {
3274
- const a = s.offsetHeight, c = s.cachedRenderedWidth;
3275
- st(s, this.fullConfig.styling.hover, a, c), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[r] };
3251
+ const a = this.imageElements.indexOf(s);
3252
+ if (a !== -1) {
3253
+ const c = s.offsetHeight, d = s.cachedRenderedWidth;
3254
+ st(s, this.fullConfig.styling.hover, c, d), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[a] };
3276
3255
  }
3277
3256
  }
3278
3257
  });
@@ -3283,7 +3262,7 @@ class ei {
3283
3262
  */
3284
3263
  createImageFilter() {
3285
3264
  const t = this.fullConfig.config.loaders?.allowedExtensions;
3286
- return new Ze(t);
3265
+ return new Ve(t);
3287
3266
  }
3288
3267
  /**
3289
3268
  * Create appropriate image loader based on config
@@ -3294,7 +3273,7 @@ class ei {
3294
3273
  if (!t || t.length === 0)
3295
3274
  throw new Error("No loaders configured. Provide `images`, `loaders`, or both.\n Example: imageCloud({ container: 'id', images: ['https://...'] })");
3296
3275
  const e = t.map((n) => this.createLoaderFromEntry(n, i));
3297
- return e.length === 1 ? e[0] : new Ke({
3276
+ return e.length === 1 ? e[0] : new Je({
3298
3277
  loaders: e,
3299
3278
  debugLogging: this.fullConfig.config.debug?.loaders
3300
3279
  });
@@ -3312,14 +3291,14 @@ class ei {
3312
3291
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3313
3292
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3314
3293
  };
3315
- return new Ve(n);
3294
+ return new Xe(n);
3316
3295
  } else if ("googleDrive" in t) {
3317
3296
  const e = t.googleDrive, n = {
3318
3297
  ...e,
3319
3298
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3320
3299
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3321
3300
  };
3322
- return new Je(n);
3301
+ return new Ye(n);
3323
3302
  } else
3324
3303
  throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
3325
3304
  }
@@ -3328,7 +3307,7 @@ class ei {
3328
3307
  */
3329
3308
  async init() {
3330
3309
  try {
3331
- if (ti(), this.containerRef)
3310
+ if (Ze(), this.containerRef)
3332
3311
  this.containerEl = this.containerRef;
3333
3312
  else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
3334
3313
  throw new Error(`Container "#${this.containerId}" not found. Ensure an element with id="${this.containerId}" exists in the DOM before calling imageCloud().`);
@@ -3337,7 +3316,7 @@ class ei {
3337
3316
  onPrev: () => this.navigateToPreviousImage(),
3338
3317
  onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
3339
3318
  onDragEnd: (t) => {
3340
- t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Xe);
3319
+ t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Ge);
3341
3320
  }
3342
3321
  })), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
3343
3322
  } catch (t) {
@@ -3468,61 +3447,134 @@ class ei {
3468
3447
  const e = this.getContainerBounds();
3469
3448
  this.currentImageHeight = i;
3470
3449
  const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3471
- this.imageLayouts = s, this.displayQueue = [];
3472
- let r = 0;
3473
- const a = (l) => {
3474
- this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(() => {
3475
- if (l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1", l.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)) {
3476
- const d = {
3477
- x: parseFloat(l.dataset.startX),
3478
- y: parseFloat(l.dataset.startY)
3479
- }, g = {
3480
- x: parseFloat(l.dataset.endX),
3481
- y: parseFloat(l.dataset.endY)
3482
- }, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), f = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : f, E = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
3483
- ue({
3450
+ if (this.imageLayouts = s, this.callbacks.onLayoutComplete) {
3451
+ const l = {
3452
+ layouts: [...s],
3453
+ // shallow copy caller should not mutate
3454
+ containerBounds: { ...e },
3455
+ algorithm: this.fullConfig.layout.algorithm,
3456
+ imageCount: t.length
3457
+ };
3458
+ this.callbacks.onLayoutComplete(l);
3459
+ }
3460
+ this.displayQueue = [];
3461
+ let r = 0, a = 0, c = 0, d = 0, u = !1;
3462
+ const f = /* @__PURE__ */ new Map(), m = () => {
3463
+ if (u || n !== this.loadGeneration || !this.callbacks.onGalleryReady) return;
3464
+ u = !0;
3465
+ const l = {
3466
+ totalImages: t.length,
3467
+ failedImages: c,
3468
+ loadDuration: d > 0 ? performance.now() - d : 0
3469
+ };
3470
+ this.callbacks.onGalleryReady(l);
3471
+ }, p = () => {
3472
+ r >= t.length && this.displayQueue.length === 0 && m();
3473
+ }, w = (l) => {
3474
+ this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(async () => {
3475
+ l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1";
3476
+ const g = parseInt(l.dataset.imageId || "0"), h = this.imageLayouts[g], b = this.entryAnimationEngine.getTiming(), I = performance.now(), y = parseFloat(l.dataset.startX || "0"), E = parseFloat(l.dataset.startY || "0"), x = parseFloat(l.dataset.endX || "0"), F = parseFloat(l.dataset.endY || "0"), R = parseFloat(l.dataset.rotation || "0"), M = parseFloat(l.dataset.scale || "1"), T = parseFloat(l.dataset.startRotation || l.dataset.rotation || "0"), z = parseFloat(l.dataset.startScale || l.dataset.scale || "1"), k = parseFloat(l.dataset.imageWidth || "0"), D = parseFloat(l.dataset.imageHeight || "0");
3477
+ if (this.callbacks.onEntryStart && h) {
3478
+ const S = {
3484
3479
  element: l,
3485
- startPosition: d,
3486
- endPosition: g,
3480
+ index: g,
3481
+ totalImages: this.imageLayouts.length,
3482
+ layout: h,
3483
+ from: { x: y, y: E, rotation: T, scale: z },
3484
+ to: { x, y: F, rotation: R, scale: M },
3485
+ startTime: I,
3486
+ duration: b.duration
3487
+ };
3488
+ this.callbacks.onEntryStart(S);
3489
+ }
3490
+ if (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)
3491
+ he({
3492
+ element: l,
3493
+ startPosition: { x: y, y: E },
3494
+ endPosition: { x, y: F },
3487
3495
  pathConfig: this.entryAnimationEngine.getPathConfig(),
3488
- duration: v.duration,
3489
- imageWidth: b,
3490
- imageHeight: p,
3491
- rotation: f,
3492
- scale: m,
3496
+ duration: b.duration,
3497
+ imageWidth: k,
3498
+ imageHeight: D,
3499
+ rotation: R,
3500
+ scale: M,
3493
3501
  rotationConfig: this.entryAnimationEngine.getRotationConfig(),
3494
- startRotation: y,
3502
+ startRotation: T,
3495
3503
  scaleConfig: this.entryAnimationEngine.getScaleConfig(),
3496
- startScale: E
3504
+ startScale: z,
3505
+ onProgress: this.callbacks.onEntryProgress && h ? (S, P, _) => {
3506
+ const A = {
3507
+ element: l,
3508
+ index: g,
3509
+ totalImages: this.imageLayouts.length,
3510
+ layout: h,
3511
+ from: { x: y, y: E, rotation: T, scale: z },
3512
+ to: { x, y: F, rotation: R, scale: M },
3513
+ startTime: I,
3514
+ duration: b.duration,
3515
+ progress: S,
3516
+ rawProgress: S,
3517
+ elapsed: P,
3518
+ current: _
3519
+ };
3520
+ this.callbacks.onEntryProgress(A);
3521
+ } : void 0,
3522
+ onComplete: h ? () => {
3523
+ if (this.callbacks.onEntryComplete) {
3524
+ const S = {
3525
+ element: l,
3526
+ index: g,
3527
+ layout: h,
3528
+ startTime: I,
3529
+ endTime: performance.now(),
3530
+ duration: b.duration
3531
+ };
3532
+ this.callbacks.onEntryComplete(S);
3533
+ }
3534
+ } : void 0
3497
3535
  });
3498
- } else {
3499
- const d = l.dataset.finalTransform || "";
3500
- l.style.transform = d;
3536
+ else {
3537
+ const S = l.dataset.finalTransform || "";
3538
+ if (l.style.transform = S, this.callbacks.onEntryComplete && h) {
3539
+ const P = (_) => {
3540
+ if (_.propertyName !== "transform") return;
3541
+ l.removeEventListener("transitionend", P);
3542
+ const A = {
3543
+ element: l,
3544
+ index: g,
3545
+ layout: h,
3546
+ startTime: I,
3547
+ endTime: performance.now(),
3548
+ duration: b.duration
3549
+ };
3550
+ this.callbacks.onEntryComplete(A);
3551
+ };
3552
+ l.addEventListener("transitionend", P);
3553
+ }
3501
3554
  }
3502
- const h = parseInt(l.dataset.imageId || "0");
3503
- if (this.fullConfig.config.debug?.enabled && h < 3) {
3504
- const d = l.dataset.finalTransform || "";
3505
- console.log(`Image ${h} final state:`, {
3555
+ if (this.fullConfig.config.debug?.enabled && g < 3) {
3556
+ const S = l.dataset.finalTransform || "";
3557
+ console.log(`Image ${g} final state:`, {
3506
3558
  left: l.style.left,
3507
3559
  top: l.style.top,
3508
3560
  width: l.style.width,
3509
3561
  height: l.style.height,
3510
3562
  computedWidth: l.offsetWidth,
3511
3563
  computedHeight: l.offsetHeight,
3512
- transform: d,
3564
+ transform: S,
3513
3565
  pathType: this.entryAnimationEngine.getPathType()
3514
3566
  });
3515
3567
  }
3516
3568
  if (this.idleAnimationEngine) {
3517
- const d = this.entryAnimationEngine.getTiming().duration;
3518
- this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
3569
+ const S = this.entryAnimationEngine.getTiming().duration;
3570
+ this.idleAnimationEngine.register(l, g, this.imageElements.length, S);
3519
3571
  }
3520
- }), r++);
3521
- }, c = () => {
3572
+ }), r++, p());
3573
+ }, v = () => {
3522
3574
  if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
3523
3575
  for (; this.displayQueue.length > 0; ) {
3524
3576
  const l = this.displayQueue.shift();
3525
- l && a(l);
3577
+ l && w(l);
3526
3578
  }
3527
3579
  return;
3528
3580
  }
@@ -3533,77 +3585,144 @@ class ei {
3533
3585
  }
3534
3586
  if (this.displayQueue.length > 0) {
3535
3587
  const l = this.displayQueue.shift();
3536
- l && a(l);
3588
+ l && w(l);
3537
3589
  }
3538
- r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
3590
+ r >= t.length && this.displayQueue.length === 0 && (this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), m());
3539
3591
  }, this.fullConfig.animation.queue.interval);
3540
3592
  };
3541
3593
  if ("IntersectionObserver" in window && this.containerEl) {
3542
- const l = new IntersectionObserver((u) => {
3543
- u.forEach((h) => {
3544
- h.isIntersecting && (c(), l.disconnect());
3594
+ const l = new IntersectionObserver((g) => {
3595
+ g.forEach((h) => {
3596
+ h.isIntersecting && (v(), l.disconnect());
3545
3597
  });
3546
3598
  }, { threshold: 0.1, rootMargin: "50px" });
3547
3599
  l.observe(this.containerEl);
3548
3600
  } else
3549
- c();
3550
- this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, u) => {
3601
+ v();
3602
+ this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, g) => {
3551
3603
  const h = document.createElement("div");
3552
3604
  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";
3553
- const d = l.x, g = l.y;
3554
- h.style.left = `${d - 6}px`, h.style.top = `${g - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(g)})`, this.containerEl.appendChild(h);
3555
- })), t.forEach((l, u) => {
3605
+ const b = l.x, I = l.y;
3606
+ h.style.left = `${b - 6}px`, h.style.top = `${I - 6}px`, h.title = `Image ${g}: center (${Math.round(b)}, ${Math.round(I)})`, this.containerEl.appendChild(h);
3607
+ })), t.forEach((l, g) => {
3556
3608
  const h = document.createElement("img");
3557
- h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
3558
- const d = s[u];
3559
- h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3560
- if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
3561
- const g = h.cachedRenderedWidth;
3562
- st(h, this.fullConfig.styling?.hover, i, g), et(h, this.hoverClassName);
3609
+ h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(g), h.dataset.createdFlag = "true";
3610
+ const b = s[g];
3611
+ h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${b.x}px`, h.style.top = `${b.y}px`, b.zIndex && (h.style.zIndex = String(b.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3612
+ if (this.hoveredImage = { element: h, layout: b }, !this.zoomEngine.isInvolved(h)) {
3613
+ const y = h.cachedRenderedWidth;
3614
+ st(h, this.fullConfig.styling?.hover, i, y), et(h, this.hoverClassName);
3615
+ }
3616
+ if (this.callbacks.onImageHover) {
3617
+ const y = { element: h, index: g, url: l, layout: b };
3618
+ this.callbacks.onImageHover(y);
3563
3619
  }
3564
3620
  }), h.addEventListener("mouseleave", () => {
3565
3621
  if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
3566
- const g = h.cachedRenderedWidth;
3567
- st(h, this.fullConfig.styling?.default, i, g), pt(h, this.hoverClassName), et(h, this.defaultClassName);
3622
+ const y = h.cachedRenderedWidth;
3623
+ st(h, this.fullConfig.styling?.default, i, y), pt(h, this.hoverClassName), et(h, this.defaultClassName);
3624
+ }
3625
+ if (this.callbacks.onImageUnhover) {
3626
+ const y = { element: h, index: g, url: l, layout: b };
3627
+ this.callbacks.onImageUnhover(y);
3568
3628
  }
3569
- }), h.addEventListener("click", (g) => {
3570
- g.stopPropagation(), this.handleImageClick(h, d);
3629
+ }), h.addEventListener("click", (y) => {
3630
+ y.stopPropagation(), this.handleImageClick(h, b);
3571
3631
  }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
3572
3632
  if (n !== this.loadGeneration)
3573
3633
  return;
3574
- const g = h.naturalWidth / h.naturalHeight, b = i * g;
3575
- h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${b}`), h.style.width = `${b}px`, h.cachedRenderedWidth = b, h.aspectRatio = g, st(h, this.fullConfig.styling?.default, i, b);
3576
- const p = { x: d.x, y: d.y }, f = { width: b, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
3577
- p,
3578
- f,
3634
+ const y = h.naturalWidth / h.naturalHeight, E = i * y;
3635
+ h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${g}] Called with imageHeight=${i}, renderedWidth=${E}`), h.style.width = `${E}px`, h.cachedRenderedWidth = E, h.aspectRatio = y, st(h, this.fullConfig.styling?.default, i, E);
3636
+ const x = { x: b.x, y: b.y }, F = { width: E, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
3637
+ x,
3638
+ F,
3579
3639
  e,
3580
- u,
3640
+ g,
3581
3641
  t.length
3582
- ), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), E = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
3583
- d.rotation,
3584
- d.scale,
3585
- b,
3642
+ ), M = this.entryAnimationEngine.calculateStartRotation(b.rotation), T = this.entryAnimationEngine.calculateStartScale(b.scale), z = this.entryAnimationEngine.buildFinalTransform(
3643
+ b.rotation,
3644
+ b.scale,
3645
+ E,
3586
3646
  i
3587
- ), S = this.entryAnimationEngine.buildStartTransform(
3588
- m,
3589
- p,
3590
- d.rotation,
3591
- d.scale,
3592
- b,
3647
+ ), k = this.entryAnimationEngine.buildStartTransform(
3648
+ R,
3649
+ x,
3650
+ b.rotation,
3651
+ b.scale,
3652
+ E,
3593
3653
  i,
3594
- y,
3595
- E
3654
+ M,
3655
+ T
3596
3656
  );
3597
- this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
3598
- finalPosition: p,
3599
- imageSize: f,
3600
- left: d.x,
3601
- top: d.y,
3602
- finalTransform: v,
3603
- renderedWidth: b,
3657
+ if (this.fullConfig.config.debug?.enabled && g < 3 && console.log(`Image ${g}:`, {
3658
+ finalPosition: x,
3659
+ imageSize: F,
3660
+ left: b.x,
3661
+ top: b.y,
3662
+ finalTransform: z,
3663
+ renderedWidth: E,
3604
3664
  renderedHeight: i
3605
- }), h.style.transform = S, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || E !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(E)), this.displayQueue.push(h);
3606
- }, h.onerror = () => r++, h.src = l;
3665
+ }), h.style.transform = k, h.dataset.finalTransform = z, h.dataset.startX = String(R.x), h.dataset.startY = String(R.y), h.dataset.endX = String(x.x), h.dataset.endY = String(x.y), h.dataset.imageWidth = String(E), h.dataset.imageHeight = String(i), h.dataset.rotation = String(b.rotation), h.dataset.scale = String(b.scale), h.dataset.startRotation = String(M), h.dataset.startScale = String(T), a++, this.callbacks.onImageLoaded) {
3666
+ const D = {
3667
+ element: h,
3668
+ url: l,
3669
+ index: g,
3670
+ totalImages: t.length,
3671
+ loadTime: performance.now() - (f.get(g) ?? performance.now())
3672
+ };
3673
+ this.callbacks.onImageLoaded(D);
3674
+ }
3675
+ if (this.callbacks.onLoadProgress) {
3676
+ const D = {
3677
+ loaded: a,
3678
+ failed: c,
3679
+ total: t.length,
3680
+ percent: (a + c) / t.length * 100
3681
+ };
3682
+ this.callbacks.onLoadProgress(D);
3683
+ }
3684
+ this.displayQueue.push(h);
3685
+ };
3686
+ const I = () => {
3687
+ if (n === this.loadGeneration) {
3688
+ if (c++, this.callbacks.onImageError) {
3689
+ const y = { url: l, index: g, totalImages: t.length };
3690
+ this.callbacks.onImageError(y);
3691
+ }
3692
+ if (this.callbacks.onLoadProgress) {
3693
+ const y = {
3694
+ loaded: a,
3695
+ failed: c,
3696
+ total: t.length,
3697
+ percent: (a + c) / t.length * 100
3698
+ };
3699
+ this.callbacks.onLoadProgress(y);
3700
+ }
3701
+ r++, p();
3702
+ }
3703
+ };
3704
+ h.onerror = () => I(), (async () => {
3705
+ let y = l;
3706
+ if (this.callbacks.onBeforeImageLoad) {
3707
+ const E = { url: l, index: g, totalImages: t.length }, x = await this.callbacks.onBeforeImageLoad(E);
3708
+ if (x)
3709
+ if (x.fetch !== void 0) {
3710
+ const F = x.url ?? l;
3711
+ try {
3712
+ const M = await (await fetch(F, x.fetch)).blob(), T = URL.createObjectURL(M);
3713
+ y = T;
3714
+ const z = h.onload;
3715
+ h.onload = (k) => {
3716
+ URL.revokeObjectURL(T), z?.call(h, k);
3717
+ };
3718
+ } catch {
3719
+ I();
3720
+ return;
3721
+ }
3722
+ } else x.url && (y = x.url);
3723
+ }
3724
+ d === 0 && (d = performance.now()), f.set(g, performance.now()), h.src = y;
3725
+ })();
3607
3726
  });
3608
3727
  }
3609
3728
  async handleImageClick(t, i) {
@@ -3617,7 +3736,15 @@ class ei {
3617
3736
  else {
3618
3737
  this.idleAnimationEngine?.pauseForImage(t);
3619
3738
  const s = t.dataset.imageId;
3620
- this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator();
3739
+ if (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(), this.callbacks.onImageFocus && this.currentFocusIndex !== null) {
3740
+ const r = this.imageLoader.imageURLs(), a = {
3741
+ element: t,
3742
+ index: this.currentFocusIndex,
3743
+ url: r[this.currentFocusIndex] ?? "",
3744
+ layout: i
3745
+ };
3746
+ this.callbacks.onImageFocus(a);
3747
+ }
3621
3748
  }
3622
3749
  }
3623
3750
  /**
@@ -3660,7 +3787,7 @@ class ei {
3660
3787
  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;
3661
3788
  }
3662
3789
  }
3663
- const It = class It extends HTMLElement {
3790
+ const St = class St extends HTMLElement {
3664
3791
  constructor() {
3665
3792
  super(...arguments), this._instance = null, this._container = null;
3666
3793
  }
@@ -3702,7 +3829,7 @@ const It = class It extends HTMLElement {
3702
3829
  if (this._container)
3703
3830
  try {
3704
3831
  const t = this._getOptions();
3705
- this._instance = new ei({
3832
+ this._instance = new Qe({
3706
3833
  container: this._container,
3707
3834
  ...t
3708
3835
  }), this._instance.init().then(() => {
@@ -3718,8 +3845,8 @@ const It = class It extends HTMLElement {
3718
3845
  this._instance?.destroy(), this._instance = null;
3719
3846
  }
3720
3847
  };
3721
- It.observedAttributes = ["config", "images", "layout"];
3722
- let yt = It;
3848
+ St.observedAttributes = ["config", "images", "layout"];
3849
+ let yt = St;
3723
3850
  typeof customElements < "u" && !customElements.get("image-cloud") && customElements.define("image-cloud", yt);
3724
3851
  export {
3725
3852
  yt as ImageCloudElement