@frybynite/image-cloud 0.10.3 → 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,7 +4,7 @@ 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
- }), It = Object.freeze({
7
+ }), St = 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 })
@@ -13,7 +13,7 @@ const mt = Object.freeze({
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
- }), At = Object.freeze({
16
+ }), Rt = 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,9 +22,9 @@ const mt = Object.freeze({
22
22
  type: "linear"
23
23
  }), vt = Object.freeze({
24
24
  mode: "none"
25
- }), Et = Object.freeze({
25
+ }), xt = Object.freeze({
26
26
  mode: "none"
27
- }), Mt = Object.freeze({
27
+ }), Ft = Object.freeze({
28
28
  default: Object.freeze({
29
29
  border: Object.freeze({
30
30
  width: 0,
@@ -52,16 +52,16 @@ const mt = Object.freeze({
52
52
  })
53
53
  }), Ut = Object.freeze({
54
54
  tightness: 1
55
- }), Ht = Object.freeze({
55
+ }), kt = Object.freeze({
56
56
  rows: 1,
57
57
  amplitude: 100,
58
58
  frequency: 2,
59
59
  phaseShift: 0,
60
60
  synchronization: "offset"
61
61
  // Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
62
- }), Nt = Object.freeze({
62
+ }), Ht = Object.freeze({
63
63
  spacing: 0
64
- }), kt = Object.freeze({
64
+ }), Nt = Object.freeze({
65
65
  mobile: Object.freeze({ maxWidth: 767 }),
66
66
  tablet: Object.freeze({ maxWidth: 1199 })
67
67
  }), Bt = Object.freeze({
@@ -82,7 +82,7 @@ const mt = Object.freeze({
82
82
  min: -15,
83
83
  max: 15
84
84
  })
85
- }), Ft = Object.freeze({
85
+ }), Mt = Object.freeze({
86
86
  sizing: Bt,
87
87
  rotation: jt
88
88
  }), Ot = Object.freeze({
@@ -94,7 +94,7 @@ const mt = Object.freeze({
94
94
  enabled: !1,
95
95
  centers: !1,
96
96
  loaders: !1
97
- }), Wt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Gt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), qt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Xt = Object.freeze({ speed: 4e3, direction: "clockwise" }), Dt = Object.freeze({ type: "none" }), C = Object.freeze({
97
+ }), Wt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Gt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), qt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Yt = Object.freeze({ speed: 4e3, direction: "clockwise" }), Dt = 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
@@ -103,13 +103,13 @@ const mt = Object.freeze({
103
103
  debug: zt
104
104
  }),
105
105
  // Image sizing and rotation configuration
106
- image: Ft,
106
+ image: Mt,
107
107
  // Pattern-based layout configuration
108
108
  layout: Object.freeze({
109
109
  algorithm: "radial",
110
110
  scaleDecay: 0,
111
111
  // No decay by default (0-1 for radial/spiral)
112
- responsive: kt,
112
+ responsive: Nt,
113
113
  targetCoverage: 0.6,
114
114
  // Target 60% of container area
115
115
  densityFactor: 1,
@@ -157,7 +157,7 @@ const mt = Object.freeze({
157
157
  // smooth deceleration
158
158
  path: yt,
159
159
  rotation: vt,
160
- scale: Et
160
+ scale: xt
161
161
  }),
162
162
  idle: Dt
163
163
  }),
@@ -184,119 +184,119 @@ const mt = Object.freeze({
184
184
  showFocusOutline: !1
185
185
  }),
186
186
  // Image styling
187
- styling: Mt
187
+ styling: Ft
188
188
  });
189
- function Z(o, t) {
190
- if (!o) return t || {};
191
- if (!t) return { ...o };
192
- const i = { ...o };
193
- return t.border !== void 0 && (i.border = { ...o.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...o.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...o.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...o.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...o.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...o.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...o.outline, ...t.outline }), t.shadow !== void 0 && (i.shadow = t.shadow), t.clipPath !== void 0 && (i.clipPath = t.clipPath), t.opacity !== void 0 && (i.opacity = t.opacity), t.cursor !== void 0 && (i.cursor = t.cursor), t.className !== void 0 && (i.className = t.className), t.objectFit !== void 0 && (i.objectFit = t.objectFit), t.aspectRatio !== void 0 && (i.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (i.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (i.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (i.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (i.borderRadiusBottomLeft = t.borderRadiusBottomLeft), i;
189
+ function Z(n, t) {
190
+ if (!n) return t || {};
191
+ if (!t) return { ...n };
192
+ const i = { ...n };
193
+ return t.border !== void 0 && (i.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...n.outline, ...t.outline }), t.shadow !== void 0 && (i.shadow = t.shadow), t.clipPath !== void 0 && (i.clipPath = t.clipPath), t.opacity !== void 0 && (i.opacity = t.opacity), t.cursor !== void 0 && (i.cursor = t.cursor), t.className !== void 0 && (i.className = t.className), t.objectFit !== void 0 && (i.objectFit = t.objectFit), t.aspectRatio !== void 0 && (i.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (i.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (i.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (i.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (i.borderRadiusBottomLeft = t.borderRadiusBottomLeft), i;
194
194
  }
195
- function Yt(o, t) {
196
- if (!t) return { ...o };
197
- const i = Z(o.default, t.default), e = Z(
198
- Z(i, o.hover),
195
+ function Xt(n, t) {
196
+ if (!t) return { ...n };
197
+ const i = Z(n.default, t.default), e = Z(
198
+ Z(i, n.hover),
199
199
  t.hover
200
- ), n = Z(
201
- Z(i, o.focused),
200
+ ), o = Z(
201
+ Z(i, n.focused),
202
202
  t.focused
203
203
  );
204
204
  return {
205
205
  default: i,
206
206
  hover: e,
207
- focused: n
207
+ focused: o
208
208
  };
209
209
  }
210
- function Jt(o, t) {
211
- if (!t) return { ...o };
212
- const i = { ...o };
210
+ function Vt(n, t) {
211
+ if (!t) return { ...n };
212
+ const i = { ...n };
213
213
  if (t.sizing !== void 0 && (i.sizing = {
214
- ...o.sizing,
214
+ ...n.sizing,
215
215
  ...t.sizing
216
216
  }, t.sizing.variance)) {
217
- const e = t.sizing.variance, n = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : o.sizing?.variance?.min ?? 1, s = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : o.sizing?.variance?.max ?? 1;
218
- i.sizing.variance = { min: n, max: s };
217
+ const e = t.sizing.variance, o = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : n.sizing?.variance?.min ?? 1, s = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : n.sizing?.variance?.max ?? 1;
218
+ i.sizing.variance = { min: o, max: s };
219
219
  }
220
220
  if (t.rotation !== void 0 && (i.rotation = {
221
- ...o.rotation,
221
+ ...n.rotation,
222
222
  ...t.rotation
223
223
  }, t.rotation.range)) {
224
- const e = t.rotation.range, n = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : o.rotation?.range?.min ?? -15, s = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : o.rotation?.range?.max ?? 15;
225
- i.rotation.range = { min: n, max: s };
224
+ const e = t.rotation.range, o = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : n.rotation?.range?.min ?? -15, s = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : n.rotation?.range?.max ?? 15;
225
+ i.rotation.range = { min: o, max: s };
226
226
  }
227
227
  return i;
228
228
  }
229
- function Vt(o = {}) {
230
- const t = o.image, i = [...o.loaders ?? []];
231
- o.images && o.images.length > 0 && i.unshift({
229
+ function Jt(n = {}) {
230
+ const t = n.image, i = [...n.loaders ?? []];
231
+ n.images && n.images.length > 0 && i.unshift({
232
232
  static: {
233
- sources: [{ urls: o.images }]
233
+ sources: [{ urls: n.images }]
234
234
  }
235
235
  });
236
- const n = {
236
+ const o = {
237
237
  loaders: {
238
238
  ...Ot,
239
- ...o.config?.loaders ?? {}
239
+ ...n.config?.loaders ?? {}
240
240
  }
241
241
  }, s = {
242
242
  loaders: i,
243
- config: n,
244
- image: Jt(Ft, t),
245
- layout: { ...C.layout },
246
- animation: { ...C.animation },
247
- interaction: { ...C.interaction },
248
- ui: { ...C.ui },
249
- styling: Yt(Mt, o.styling)
243
+ config: o,
244
+ image: Vt(Mt, t),
245
+ layout: { ...L.layout },
246
+ animation: { ...L.animation },
247
+ interaction: { ...L.interaction },
248
+ ui: { ...L.ui },
249
+ styling: Xt(Ft, n.styling)
250
250
  };
251
- if (o.layout && (s.layout = {
252
- ...C.layout,
253
- ...o.layout
254
- }, o.layout.responsive && (s.layout.responsive = {
255
- ...C.layout.responsive,
256
- mobile: o.layout.responsive.mobile ? { ...C.layout.responsive.mobile, ...o.layout.responsive.mobile } : C.layout.responsive.mobile,
257
- tablet: o.layout.responsive.tablet ? { ...C.layout.responsive.tablet, ...o.layout.responsive.tablet } : C.layout.responsive.tablet
258
- }), o.layout.spacing && (s.layout.spacing = {
259
- ...C.layout.spacing,
260
- ...o.layout.spacing
261
- })), o.animation && (s.animation = {
262
- ...C.animation,
263
- ...o.animation
264
- }, o.animation.easing && (s.animation.easing = {
265
- ...C.animation.easing,
266
- ...o.animation.easing
267
- }), o.animation.queue && (s.animation.queue = {
268
- ...C.animation.queue,
269
- ...o.animation.queue
270
- }), o.animation.entry && (s.animation.entry = {
271
- ...C.animation.entry,
272
- ...o.animation.entry,
273
- start: o.animation.entry.start ? {
274
- ...C.animation.entry.start,
275
- ...o.animation.entry.start,
276
- circular: o.animation.entry.start.circular ? { ...C.animation.entry.start.circular, ...o.animation.entry.start.circular } : C.animation.entry.start.circular
277
- } : C.animation.entry.start,
278
- timing: o.animation.entry.timing ? { ...C.animation.entry.timing, ...o.animation.entry.timing } : C.animation.entry.timing,
279
- path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : C.animation.entry.path,
280
- rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : C.animation.entry.rotation,
281
- scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : C.animation.entry.scale
282
- }), o.animation.idle && (s.animation.idle = {
251
+ if (n.layout && (s.layout = {
252
+ ...L.layout,
253
+ ...n.layout
254
+ }, n.layout.responsive && (s.layout.responsive = {
255
+ ...L.layout.responsive,
256
+ mobile: n.layout.responsive.mobile ? { ...L.layout.responsive.mobile, ...n.layout.responsive.mobile } : L.layout.responsive.mobile,
257
+ tablet: n.layout.responsive.tablet ? { ...L.layout.responsive.tablet, ...n.layout.responsive.tablet } : L.layout.responsive.tablet
258
+ }), n.layout.spacing && (s.layout.spacing = {
259
+ ...L.layout.spacing,
260
+ ...n.layout.spacing
261
+ })), n.animation && (s.animation = {
262
+ ...L.animation,
263
+ ...n.animation
264
+ }, n.animation.easing && (s.animation.easing = {
265
+ ...L.animation.easing,
266
+ ...n.animation.easing
267
+ }), n.animation.queue && (s.animation.queue = {
268
+ ...L.animation.queue,
269
+ ...n.animation.queue
270
+ }), n.animation.entry && (s.animation.entry = {
271
+ ...L.animation.entry,
272
+ ...n.animation.entry,
273
+ start: n.animation.entry.start ? {
274
+ ...L.animation.entry.start,
275
+ ...n.animation.entry.start,
276
+ circular: n.animation.entry.start.circular ? { ...L.animation.entry.start.circular, ...n.animation.entry.start.circular } : L.animation.entry.start.circular
277
+ } : L.animation.entry.start,
278
+ timing: n.animation.entry.timing ? { ...L.animation.entry.timing, ...n.animation.entry.timing } : L.animation.entry.timing,
279
+ path: n.animation.entry.path ? { ...yt, ...n.animation.entry.path } : L.animation.entry.path,
280
+ rotation: n.animation.entry.rotation ? { ...vt, ...n.animation.entry.rotation } : L.animation.entry.rotation,
281
+ scale: n.animation.entry.scale ? { ...xt, ...n.animation.entry.scale } : L.animation.entry.scale
282
+ }), n.animation.idle && (s.animation.idle = {
283
283
  ...Dt,
284
- ...o.animation.idle
285
- })), o.interaction && (s.interaction = {
286
- ...C.interaction,
287
- ...o.interaction
288
- }, o.interaction.focus && (s.interaction.focus = {
289
- ...C.interaction.focus,
290
- ...o.interaction.focus
291
- }), o.interaction.navigation && (s.interaction.navigation = {
292
- ...C.interaction.navigation,
293
- ...o.interaction.navigation
284
+ ...n.animation.idle
285
+ })), n.interaction && (s.interaction = {
286
+ ...L.interaction,
287
+ ...n.interaction
288
+ }, n.interaction.focus && (s.interaction.focus = {
289
+ ...L.interaction.focus,
290
+ ...n.interaction.focus
291
+ }), n.interaction.navigation && (s.interaction.navigation = {
292
+ ...L.interaction.navigation,
293
+ ...n.interaction.navigation
294
294
  })), s.ui = {
295
- ...C.ui,
296
- ...o.ui
295
+ ...L.ui,
296
+ ...n.ui
297
297
  }, s.config.debug = {
298
298
  ...zt,
299
- ...o.config?.debug ?? {}
299
+ ...n.config?.debug ?? {}
300
300
  }, s.layout.algorithm === "honeycomb" && s.styling) {
301
301
  const r = { shape: "hexagon", mode: "height-relative" };
302
302
  s.styling = {
@@ -308,14 +308,14 @@ function Vt(o = {}) {
308
308
  }
309
309
  return s;
310
310
  }
311
- function Kt(o, t) {
312
- return { ...o ? It[o] : It.playful, ...t };
311
+ function Kt(n, t) {
312
+ return { ...n ? St[n] : St.playful, ...t };
313
313
  }
314
- function Zt(o, t) {
315
- return { ...o ? Ct[o] : Ct.gentle, ...t };
314
+ function Zt(n, t) {
315
+ return { ...n ? Ct[n] : Ct.gentle, ...t };
316
316
  }
317
- function Qt(o, t) {
318
- return { ...o ? At[o] : At.gentle, ...t };
317
+ function Qt(n, t) {
318
+ return { ...n ? Rt[n] : Rt.gentle, ...t };
319
319
  }
320
320
  class te {
321
321
  constructor(t) {
@@ -328,8 +328,8 @@ class te {
328
328
  buildTransformString(t) {
329
329
  const i = ["translate(-50%, -50%)"];
330
330
  if (t.x !== void 0 || t.y !== void 0) {
331
- const e = t.x ?? 0, n = t.y ?? 0;
332
- i.push(`translate(${e}px, ${n}px)`);
331
+ const e = t.x ?? 0, o = t.y ?? 0;
332
+ i.push(`translate(${e}px, ${o}px)`);
333
333
  }
334
334
  return t.rotation !== void 0 && i.push(`rotate(${t.rotation}deg)`), t.scale !== void 0 && i.push(`scale(${t.scale})`), i.join(" ");
335
335
  }
@@ -342,14 +342,14 @@ class te {
342
342
  * @param easing - CSS easing function (optional)
343
343
  * @returns AnimationHandle that can be used to cancel or query the animation
344
344
  */
345
- animateTransformCancellable(t, i, e, n = null, s = null) {
345
+ animateTransformCancellable(t, i, e, o = null, s = null) {
346
346
  this.cancelAllAnimations(t);
347
- const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
347
+ const r = o ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), d = this.buildTransformString(e);
348
348
  t.style.transition = "none";
349
349
  const u = t.animate(
350
350
  [
351
351
  { transform: c },
352
- { transform: l }
352
+ { transform: d }
353
353
  ],
354
354
  {
355
355
  duration: r,
@@ -357,7 +357,7 @@ class te {
357
357
  fill: "forwards"
358
358
  // Keep final state after animation
359
359
  }
360
- ), h = {
360
+ ), f = {
361
361
  id: `anim-${++this.animationIdCounter}`,
362
362
  element: t,
363
363
  animation: u,
@@ -366,11 +366,11 @@ class te {
366
366
  startTime: performance.now(),
367
367
  duration: r
368
368
  };
369
- return this.activeAnimations.set(t, h), u.finished.then(() => {
370
- 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);
371
371
  }).catch(() => {
372
372
  this.activeAnimations.delete(t);
373
- }), h;
373
+ }), f;
374
374
  }
375
375
  /**
376
376
  * Cancel an active animation
@@ -381,13 +381,13 @@ class te {
381
381
  cancelAnimation(t, i = !0) {
382
382
  const e = this.getCurrentTransform(t.element);
383
383
  if (t.animation.cancel(), i) {
384
- const n = this.buildTransformString({
384
+ const o = this.buildTransformString({
385
385
  x: e.x,
386
386
  y: e.y,
387
387
  rotation: e.rotation,
388
388
  scale: e.scale
389
389
  });
390
- t.element.style.transform = n;
390
+ t.element.style.transform = o;
391
391
  }
392
392
  return this.activeAnimations.delete(t.element), e;
393
393
  }
@@ -400,8 +400,8 @@ class te {
400
400
  const i = this.activeAnimations.get(t);
401
401
  i && this.cancelAnimation(i, !1);
402
402
  const e = t.getAnimations();
403
- for (const n of e)
404
- n.cancel();
403
+ for (const o of e)
404
+ o.cancel();
405
405
  }
406
406
  /**
407
407
  * Get current transform state of an element (works mid-animation)
@@ -413,7 +413,7 @@ class te {
413
413
  const e = getComputedStyle(t).transform;
414
414
  if (e === "none" || !e)
415
415
  return { x: 0, y: 0, rotation: 0, scale: 1 };
416
- const n = new DOMMatrix(e), s = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), a = n.e, c = n.f;
416
+ const o = new DOMMatrix(e), s = Math.sqrt(o.a * o.a + o.b * o.b), r = Math.atan2(o.b, o.a) * (180 / Math.PI), a = o.e, c = o.f;
417
417
  return { x: a, y: c, rotation: r, scale: s };
418
418
  }
419
419
  /**
@@ -440,9 +440,9 @@ class te {
440
440
  * @param easing - CSS easing function (optional)
441
441
  * @returns Promise that resolves when animation completes
442
442
  */
443
- animateTransform(t, i, e = null, n = null) {
443
+ animateTransform(t, i, e = null, o = null) {
444
444
  return new Promise((s) => {
445
- const r = e ?? this.config.duration, a = n ?? this.config.easing.default;
445
+ const r = e ?? this.config.duration, a = o ?? this.config.easing.default;
446
446
  t.style.transition = `transform ${r}ms ${a}, box-shadow ${r}ms ${a}`, t.style.transform = this.buildTransformString(i), setTimeout(() => {
447
447
  s();
448
448
  }, r);
@@ -473,159 +473,165 @@ class te {
473
473
  return new Promise((i) => setTimeout(i, t));
474
474
  }
475
475
  }
476
- function V(o, t, i) {
477
- return o + (t - o) * i;
476
+ function J(n, t, i) {
477
+ return n + (t - n) * i;
478
478
  }
479
- function ee(o, t, i, e) {
480
- const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, l = ie(s, r);
481
- let u = 0, h = 0, d = 1, g = n, p = !1;
482
- for (let f = 0; f < l.length; f++)
483
- if (o <= l[f].time) {
484
- h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, p = l[f].isOvershoot;
479
+ function ee(n, t, i, e) {
480
+ const { overshoot: o, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, d = ie(s, r);
481
+ let u = 0, f = 0, m = 1, p = o, w = !1;
482
+ for (let l = 0; l < d.length; l++)
483
+ if (n <= d[l].time) {
484
+ f = l === 0 ? 0 : d[l - 1].time, m = d[l].time, p = d[l].overshoot, w = d[l].isOvershoot;
485
485
  break;
486
486
  }
487
- const b = (o - h) / (d - h);
488
- if (p)
489
- u = 1 + g * at(b);
490
- else if (h === 0)
491
- u = at(b);
487
+ const v = (n - f) / (m - f);
488
+ if (w)
489
+ u = 1 + p * at(v);
490
+ else if (f === 0)
491
+ u = at(v);
492
492
  else {
493
- const m = 1 + (l.find(
494
- (y, E) => y.time > h && E > 0 && l[E - 1].isOvershoot
495
- )?.overshoot || g);
496
- u = V(m, 1, at(b));
493
+ const g = 1 + (d.find(
494
+ (h, b) => h.time > f && b > 0 && d[b - 1].isOvershoot
495
+ )?.overshoot || p);
496
+ u = J(g, 1, at(v));
497
497
  }
498
498
  return {
499
499
  x: t.x + a * u,
500
500
  y: t.y + c * u
501
501
  };
502
502
  }
503
- function ie(o, t) {
503
+ function ie(n, t) {
504
504
  const i = [];
505
505
  let e = 0.6;
506
506
  i.push({ time: e, overshoot: 0, isOvershoot: !1 });
507
- let n = 0.15;
508
- const r = 0.4 / (o * 2);
509
- for (let a = 0; a < o; a++)
510
- e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
507
+ let o = 0.15;
508
+ const r = 0.4 / (n * 2);
509
+ for (let a = 0; a < n; a++)
510
+ e += r, i.push({ time: e, overshoot: o, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: o * t, isOvershoot: !1 }), o *= t;
511
511
  return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
512
512
  }
513
- function ne(o, t, i, e) {
514
- 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));
515
- let d;
516
- if (h < 1) {
517
- const g = u * Math.sqrt(1 - h * h), p = Math.exp(-h * u * o * 3), b = Math.cos(g * o * a * Math.PI);
518
- d = 1 - p * b;
513
+ function oe(n, t, i, e) {
514
+ const { stiffness: o, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, d = i.y - t.y, u = Math.sqrt(o / r), f = s / (2 * Math.sqrt(o * r));
515
+ let m;
516
+ if (f < 1) {
517
+ const p = u * Math.sqrt(1 - f * f), w = Math.exp(-f * u * n * 3), v = Math.cos(p * n * a * Math.PI);
518
+ m = 1 - w * v;
519
519
  } else
520
- d = 1 - Math.exp(-u * o * 3);
521
- return d = Math.max(0, Math.min(d, 1.3)), {
522
- x: t.x + c * d,
523
- y: t.y + l * d
520
+ m = 1 - Math.exp(-u * n * 3);
521
+ return m = Math.max(0, Math.min(m, 1.3)), {
522
+ x: t.x + c * m,
523
+ y: t.y + d * m
524
524
  };
525
525
  }
526
- function oe(o, t, i, e) {
527
- 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, p = s * Math.PI * 2 * o + c, b = r ? Math.pow(1 - o, a) : 1, f = n * Math.sin(p) * b, m = se(o);
526
+ function ne(n, t, i, e) {
527
+ const { amplitude: o, 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 * n + c, v = r ? Math.pow(1 - n, a) : 1, l = o * Math.sin(w) * v, g = se(n);
528
528
  return {
529
- x: V(t.x, i.x, m) + f * d,
530
- y: V(t.y, i.y, m) + f * g
529
+ x: J(t.x, i.x, g) + l * m,
530
+ y: J(t.y, i.y, g) + l * p
531
531
  };
532
532
  }
533
- function at(o) {
534
- return 1 - (1 - o) * (1 - o);
533
+ function at(n) {
534
+ return 1 - (1 - n) * (1 - n);
535
535
  }
536
- function se(o) {
537
- return 1 - Math.pow(1 - o, 3);
536
+ function se(n) {
537
+ return 1 - Math.pow(1 - n, 3);
538
538
  }
539
- function ae(o, t, i) {
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;
539
+ function ae(n, t, i) {
540
+ const { amplitude: e, frequency: o, decay: s } = i, r = Math.sin(n * o * Math.PI * 2), a = s ? Math.pow(1 - n, 2) : 1, c = e * r * a;
541
541
  return t + c;
542
542
  }
543
- function re(o, t, i) {
544
- const { overshoot: e, bounces: n } = i, s = [];
543
+ function re(n, t, i) {
544
+ const { overshoot: e, bounces: o } = i, s = [];
545
545
  s.push({ time: 0.5, scale: e });
546
546
  let r = e;
547
- const a = 0.5, l = 0.5 / (n * 2);
547
+ const a = 0.5, d = 0.5 / (o * 2);
548
548
  let u = 0.5;
549
- for (let d = 0; d < n; d++) {
550
- const g = 1 - (r - 1) * a;
551
- 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 < o; 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 < o - 1 && s.push({ time: u, scale: r });
552
552
  }
553
553
  s.push({ time: 1, scale: 1 });
554
- let h = 1;
555
- for (let d = 0; d < s.length; d++)
556
- if (o <= s[d].time) {
557
- const g = d === 0 ? 0 : s[d - 1].time, p = d === 0 ? 1 : s[d - 1].scale, b = (o - g) / (s[d].time - g), f = at(b);
558
- h = p + (s[d].scale - p) * f;
554
+ let f = 1;
555
+ for (let m = 0; m < s.length; m++)
556
+ if (n <= s[m].time) {
557
+ const p = m === 0 ? 0 : s[m - 1].time, w = m === 0 ? 1 : s[m - 1].scale, v = (n - p) / (s[m].time - p), l = at(v);
558
+ f = w + (s[m].scale - w) * l;
559
559
  break;
560
560
  }
561
- return h * t;
561
+ return f * t;
562
562
  }
563
- function ce(o) {
563
+ function ce(n) {
564
564
  const {
565
565
  element: t,
566
566
  startPosition: i,
567
567
  endPosition: e,
568
- pathConfig: n,
568
+ pathConfig: o,
569
569
  duration: s,
570
570
  imageWidth: r,
571
571
  imageHeight: a,
572
572
  rotation: c,
573
- scale: l,
573
+ scale: d,
574
574
  onComplete: u,
575
- rotationConfig: h,
576
- startRotation: d,
577
- scaleConfig: g,
578
- startScale: p
579
- } = o, b = 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 = p !== void 0 && p !== l, S = g?.mode === "pop", w = g?.pop || { overshoot: 1.2, bounces: 1 };
580
- if (b === "linear" && !E && !(v || S)) {
575
+ onProgress: f,
576
+ rotationConfig: m,
577
+ startRotation: p,
578
+ scaleConfig: w,
579
+ startScale: v
580
+ } = n, l = o.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, x = w?.mode === "pop", E = w?.pop || { overshoot: 1.2, bounces: 1 };
581
+ if (l === "linear" && !I && !(y || x)) {
581
582
  u && u();
582
583
  return;
583
584
  }
584
- const O = performance.now(), L = -r / 2, _ = -a / 2;
585
- function z(H) {
586
- const N = H - O, A = Math.min(N / s, 1);
587
- let D;
588
- switch (b) {
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) {
589
590
  case "bounce": {
590
- const k = Kt(
591
- n.bouncePreset,
592
- n.bounce
591
+ const N = Kt(
592
+ o.bouncePreset,
593
+ o.bounce
593
594
  );
594
- D = ee(A, i, e, k);
595
+ S = ee(O, i, e, N);
595
596
  break;
596
597
  }
597
598
  case "elastic": {
598
- const k = Zt(
599
- n.elasticPreset,
600
- n.elastic
599
+ const N = Zt(
600
+ o.elasticPreset,
601
+ o.elastic
601
602
  );
602
- D = ne(A, i, e, k);
603
+ S = oe(O, i, e, N);
603
604
  break;
604
605
  }
605
606
  case "wave": {
606
- const k = Qt(
607
- n.wavePreset,
608
- n.wave
607
+ const N = Qt(
608
+ o.wavePreset,
609
+ o.wave
609
610
  );
610
- D = oe(A, i, e, k);
611
+ S = ne(O, i, e, N);
611
612
  break;
612
613
  }
613
614
  default:
614
- D = {
615
- x: V(i.x, e.x, A),
616
- y: V(i.y, e.y, A)
615
+ S = {
616
+ x: J(i.x, e.x, O),
617
+ y: J(i.y, e.y, O)
617
618
  };
618
619
  }
619
- const W = D.x - e.x, U = D.y - e.y;
620
- let M;
621
- m ? M = ae(A, c, y) : f ? M = V(d, c, A) : M = c;
622
- let R;
623
- S ? R = re(A, l, w) : v ? R = V(p, l, A) : R = l, t.style.transform = `translate(${L}px, ${_}px) translate(${W}px, ${U}px) rotate(${M}deg) scale(${R})`, A < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
620
+ const _ = S.x - e.x, $ = S.y - e.y;
621
+ let A;
622
+ h ? A = ae(O, c, b) : g ? A = J(p, c, O) : A = c;
623
+ let j;
624
+ x ? j = re(O, d, E) : y ? j = J(v, d, O) : j = d, t.style.transform = `translate(${M}px, ${T}px) translate(${_}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());
624
630
  }
625
631
  requestAnimationFrame(z);
626
632
  }
627
- function le(o) {
628
- return o === "bounce" || o === "elastic" || o === "wave";
633
+ function le(n) {
634
+ return n === "bounce" || n === "elastic" || n === "wave";
629
635
  }
630
636
  const he = {
631
637
  radial: "center",
@@ -638,7 +644,7 @@ const he = {
638
644
  };
639
645
  class de {
640
646
  constructor(t, i) {
641
- this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || Et;
647
+ this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || xt;
642
648
  }
643
649
  /**
644
650
  * Get the effective start position, considering layout-aware defaults
@@ -649,7 +655,7 @@ class de {
649
655
  /**
650
656
  * Calculate the starting position for an image's entry animation
651
657
  */
652
- calculateStartPosition(t, i, e, n, s) {
658
+ calculateStartPosition(t, i, e, o, s) {
653
659
  const r = this.resolvedStartPosition, a = this.config.start.offset ?? 100;
654
660
  switch (r) {
655
661
  case "nearest-edge":
@@ -671,7 +677,7 @@ class de {
671
677
  t,
672
678
  i,
673
679
  e,
674
- n,
680
+ o,
675
681
  s
676
682
  );
677
683
  default:
@@ -681,28 +687,28 @@ class de {
681
687
  /**
682
688
  * Calculate start position from the nearest edge (current default behavior)
683
689
  */
684
- calculateNearestEdge(t, i, e, n) {
685
- 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);
686
- let d = t.x, g = t.y;
687
- 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 };
690
+ calculateNearestEdge(t, i, e, o) {
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 + o) : f === c ? m = e.width + o : f === d ? p = -(i.height + o) : p = e.height + o, { x: m, y: p };
688
694
  }
689
695
  /**
690
696
  * Calculate start position from a specific edge
691
697
  */
692
- calculateEdgePosition(t, i, e, n, s) {
698
+ calculateEdgePosition(t, i, e, o, s) {
693
699
  let r = i.x, a = i.y;
694
700
  switch (t) {
695
701
  case "top":
696
702
  a = -(e.height + s);
697
703
  break;
698
704
  case "bottom":
699
- a = n.height + s;
705
+ a = o.height + s;
700
706
  break;
701
707
  case "left":
702
708
  r = -(e.width + s);
703
709
  break;
704
710
  case "right":
705
- r = n.width + s;
711
+ r = o.width + s;
706
712
  break;
707
713
  }
708
714
  return { x: r, y: a };
@@ -711,9 +717,9 @@ class de {
711
717
  * Calculate start position from center with scale animation
712
718
  */
713
719
  calculateCenterPosition(t, i, e) {
714
- const n = t.width / 2, s = t.height / 2;
720
+ const o = t.width / 2, s = t.height / 2;
715
721
  return {
716
- x: n,
722
+ x: o,
717
723
  y: s,
718
724
  useScale: !0
719
725
  // Signal to use scale animation from 0
@@ -722,28 +728,28 @@ class de {
722
728
  /**
723
729
  * Calculate start position from a random edge
724
730
  */
725
- calculateRandomEdge(t, i, e, n) {
731
+ calculateRandomEdge(t, i, e, o) {
726
732
  const s = ["top", "bottom", "left", "right"], r = s[Math.floor(Math.random() * s.length)];
727
- return this.calculateEdgePosition(r, t, i, e, n);
733
+ return this.calculateEdgePosition(r, t, i, e, o);
728
734
  }
729
735
  /**
730
736
  * Calculate start position on a circle around the container
731
737
  */
732
- calculateCircularPosition(t, i, e, n, s) {
738
+ calculateCircularPosition(t, i, e, o, s) {
733
739
  const r = this.config.start.circular || {}, a = r.distribution || "even";
734
740
  let c;
735
- const l = r.radius || "120%";
736
- if (typeof l == "string" && l.endsWith("%")) {
737
- const b = parseFloat(l) / 100;
741
+ const d = r.radius || "120%";
742
+ if (typeof d == "string" && d.endsWith("%")) {
743
+ const v = parseFloat(d) / 100;
738
744
  c = Math.sqrt(
739
745
  e.width ** 2 + e.height ** 2
740
- ) * b / 2;
746
+ ) * v / 2;
741
747
  } else
742
- c = typeof l == "number" ? l : 500;
748
+ c = typeof d == "number" ? d : 500;
743
749
  let u;
744
- a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
745
- const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, p = d + Math.sin(u) * c;
746
- return { x: g, y: p };
750
+ a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
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 };
747
753
  }
748
754
  /**
749
755
  * Get animation parameters for an image
@@ -762,17 +768,17 @@ class de {
762
768
  * Build a CSS transform string for the start position
763
769
  * Uses pixel-based centering offset for reliable cross-browser behavior
764
770
  */
765
- buildStartTransform(t, i, e, n, s, r, a, c) {
766
- 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, p = r !== void 0 ? -r / 2 : 0, b = s !== void 0 ? `translate(${g}px, ${p}px)` : "translate(-50%, -50%)";
767
- return t.useScale ? `${b} translate(${l}px, ${u}px) rotate(${h}deg) scale(0)` : `${b} translate(${l}px, ${u}px) rotate(${h}deg) scale(${d})`;
771
+ buildStartTransform(t, i, e, o, s, r, a, c) {
772
+ const d = t.x - i.x, u = t.y - i.y, f = a !== void 0 ? a : e, m = c !== void 0 ? c : o, 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})`;
768
774
  }
769
775
  /**
770
776
  * Build the final CSS transform string
771
777
  * Uses pixel-based centering offset for reliable cross-browser behavior
772
778
  */
773
- buildFinalTransform(t, i, e, n) {
774
- if (e !== void 0 && n !== void 0) {
775
- const s = -e / 2, r = -n / 2;
779
+ buildFinalTransform(t, i, e, o) {
780
+ if (e !== void 0 && o !== void 0) {
781
+ const s = -e / 2, r = -o / 2;
776
782
  return `translate(${s}px, ${r}px) rotate(${t}deg) scale(${i})`;
777
783
  }
778
784
  return `translate(-50%, -50%) rotate(${t}deg) scale(${i})`;
@@ -838,12 +844,12 @@ class de {
838
844
  return t + (Math.random() - 0.5) * 60;
839
845
  if (typeof e == "number")
840
846
  return e;
841
- const n = e.max - e.min;
842
- return e.min + Math.random() * n;
847
+ const o = e.max - e.min;
848
+ return e.min + Math.random() * o;
843
849
  }
844
850
  case "spin": {
845
- const e = this.rotationConfig.spinCount ?? 1, n = this.resolveSpinDirection(t);
846
- return t + e * 360 * n;
851
+ const e = this.rotationConfig.spinCount ?? 1, o = this.resolveSpinDirection(t);
852
+ return t + e * 360 * o;
847
853
  }
848
854
  case "random":
849
855
  return t + (Math.random() - 0.5) * 60;
@@ -891,8 +897,8 @@ class de {
891
897
  amplitude: 15,
892
898
  frequency: 3,
893
899
  decay: !0
894
- }, { 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;
895
- return i + l;
900
+ }, { amplitude: o, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, d = o * a * c;
901
+ return i + d;
896
902
  }
897
903
  /**
898
904
  * Get the scale configuration
@@ -948,12 +954,12 @@ class de {
948
954
  const e = this.scaleConfig.pop || {
949
955
  overshoot: 1.2,
950
956
  bounces: 1
951
- }, { overshoot: n, bounces: s } = e, r = this.generateScaleBounceKeyframes(s, n);
957
+ }, { overshoot: o, bounces: s } = e, r = this.generateScaleBounceKeyframes(s, o);
952
958
  let a = i;
953
959
  for (let c = 0; c < r.length; c++)
954
960
  if (t <= r[c].time) {
955
- 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);
956
- 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;
957
963
  break;
958
964
  }
959
965
  return a * i;
@@ -964,12 +970,12 @@ class de {
964
970
  generateScaleBounceKeyframes(t, i) {
965
971
  const e = [];
966
972
  e.push({ time: 0.5, scale: i });
967
- let n = i;
973
+ let o = i;
968
974
  const s = 0.5, a = 0.5 / (t * 2);
969
975
  let c = 0.5;
970
- for (let l = 0; l < t; l++) {
971
- const u = 1 - (n - 1) * s;
972
- 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 });
976
+ for (let d = 0; d < t; d++) {
977
+ const u = 1 - (o - 1) * s;
978
+ c += a, e.push({ time: c, scale: u }), o = 1 + (o - 1) * s * s, c += a, d < t - 1 && e.push({ time: c, scale: o });
973
979
  }
974
980
  return e.push({ time: 1, scale: 1 }), e;
975
981
  }
@@ -988,9 +994,9 @@ class ue {
988
994
  * Register an image element for idle animation.
989
995
  * Starts animation after entry duration completes.
990
996
  */
991
- register(t, i, e, n) {
997
+ register(t, i, e, o) {
992
998
  if (this.entries.has(t)) return;
993
- const s = n ?? this.entryDurationMs, r = this.config.startDelay ?? s, a = {
999
+ const s = o ?? this.entryDurationMs, r = this.config.startDelay ?? s, a = {
994
1000
  element: t,
995
1001
  index: i,
996
1002
  totalImages: e,
@@ -1105,23 +1111,23 @@ class ue {
1105
1111
  });
1106
1112
  }
1107
1113
  _startBlink(t) {
1108
- const i = { ...qt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
1114
+ const i = { ...qt, ...this.config.blink }, e = -(Math.random() * i.speed), o = parseFloat(getComputedStyle(t.element).opacity) || 1;
1109
1115
  let s, r;
1110
1116
  i.style === "fade" ? (s = [
1111
- { opacity: n, offset: 0 },
1117
+ { opacity: o, offset: 0 },
1112
1118
  { opacity: 0, offset: 0.5 },
1113
- { opacity: n, offset: 1 }
1119
+ { opacity: o, offset: 1 }
1114
1120
  ], r = {
1115
1121
  duration: i.speed,
1116
1122
  delay: e,
1117
1123
  iterations: 1 / 0,
1118
1124
  easing: "ease-in-out"
1119
1125
  }) : (s = [
1120
- { opacity: n, offset: 0 },
1121
- { opacity: n, offset: i.onRatio },
1126
+ { opacity: o, offset: 0 },
1127
+ { opacity: o, offset: i.onRatio },
1122
1128
  { opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
1123
1129
  { opacity: 0, offset: 0.99 },
1124
- { opacity: n, offset: 1 }
1130
+ { opacity: o, offset: 1 }
1125
1131
  ], r = {
1126
1132
  duration: i.speed,
1127
1133
  delay: e,
@@ -1129,7 +1135,7 @@ class ue {
1129
1135
  }), t.blinkAnimation = t.element.animate(s, r);
1130
1136
  }
1131
1137
  _startSpin(t) {
1132
- const i = { ...Xt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
1138
+ const i = { ...Yt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
1133
1139
  t.animation = t.element.animate(
1134
1140
  [{ transform: "rotate(0deg)" }, { transform: `rotate(${e}deg)` }],
1135
1141
  {
@@ -1150,8 +1156,8 @@ class ue {
1150
1156
  if (this.togetherSpeed = t, this.togetherRafId !== null) return;
1151
1157
  const i = () => {
1152
1158
  const e = performance.now() % this.togetherSpeed;
1153
- for (const n of this.entries.values())
1154
- !n.stopped && !n.paused && n.animation && (n.animation.currentTime = e);
1159
+ for (const o of this.entries.values())
1160
+ !o.stopped && !o.paused && o.animation && (o.animation.currentTime = e);
1155
1161
  this.togetherRafId = requestAnimationFrame(i);
1156
1162
  };
1157
1163
  this.togetherRafId = requestAnimationFrame(i);
@@ -1178,19 +1184,19 @@ class fe {
1178
1184
  * @returns Array of layout objects with position, rotation, scale
1179
1185
  */
1180
1186
  generate(t, i, e = {}) {
1181
- 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, p = 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;
1182
- for (let w = 0; w < t; w++) {
1183
- const I = this.random(v, y), O = this.random(S, E), L = l === "random" ? this.random(u, h) : 0, _ = p ? this.random(d, g) : 1, z = c * _, H = {
1184
- id: w,
1185
- x: I,
1186
- y: O,
1187
- rotation: L,
1188
- scale: _,
1189
- baseSize: z
1187
+ const o = [], { 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 x = 0; x < t; x++) {
1189
+ const E = 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: x,
1191
+ x: E,
1192
+ y: F,
1193
+ rotation: R,
1194
+ scale: M,
1195
+ baseSize: T
1190
1196
  };
1191
- n.push(H);
1197
+ o.push(z);
1192
1198
  }
1193
- return n;
1199
+ return o;
1194
1200
  }
1195
1201
  /**
1196
1202
  * Utility: Generate random number between min and max
@@ -1214,55 +1220,55 @@ class ge {
1214
1220
  * @returns Array of layout objects with position, rotation, scale
1215
1221
  */
1216
1222
  generate(t, i, e = {}) {
1217
- 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, p = this.config.scaleDecay ?? 0, b = {
1223
+ const o = [], { 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 = {
1218
1224
  ...Ut,
1219
1225
  ...this.config.radial
1220
- }, 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(
1221
- m - v - f / 2,
1222
- 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
1223
1229
  ));
1224
1230
  if (t > 0) {
1225
- const O = g ? this.random(h, d) : 1, L = f * O;
1226
- n.push({
1231
+ const F = p ? this.random(f, m) : 1, R = l * F;
1232
+ o.push({
1227
1233
  id: 0,
1228
- x: m,
1229
- y,
1230
- 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,
1231
1237
  // Less rotation for center
1232
- scale: O,
1233
- baseSize: L,
1238
+ scale: F,
1239
+ baseSize: R,
1234
1240
  zIndex: 100
1235
1241
  // Center image is highest
1236
1242
  });
1237
1243
  }
1238
- let w = 1, I = 1;
1239
- for (; w < t; ) {
1240
- const O = I / E, L = p > 0 ? 1 - O * p * 0.5 : 1, _ = Math.max(f * 0.8, S / E * 1.5 / b.tightness), z = I * _, H = z * 1.5, N = Math.PI * (3 * (H + z) - Math.sqrt((3 * H + z) * (H + 3 * z))), A = this.estimateWidth(f), D = Math.floor(N / (A * 0.7));
1241
- if (D === 0) {
1242
- I++;
1244
+ let x = 1, E = 1;
1245
+ for (; x < t; ) {
1246
+ const F = E / b, R = w > 0 ? 1 - F * w * 0.5 : 1, M = Math.max(l * 0.8, y / b * 1.5 / v.tightness), T = E * 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
+ E++;
1243
1249
  continue;
1244
1250
  }
1245
- const W = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
1246
- for (let M = 0; M < D && w < t; M++) {
1247
- const R = M * W + U, k = g ? this.random(h, d) : 1, q = L * k, T = f * q;
1248
- let $ = m + Math.cos(R) * H, F = y + Math.sin(R) * z;
1249
- const P = T * 1.5 / 2, B = T / 2;
1250
- $ - P < v ? $ = v + P : $ + P > s - v && ($ = s - v - P), F - B < v ? F = v + B : F + B > r - v && (F = r - v - B);
1251
- const Y = c === "random" ? this.random(l, u) : 0;
1252
- n.push({
1253
- id: w,
1254
- x: $,
1255
- y: F,
1256
- rotation: Y,
1257
- scale: q,
1258
- baseSize: T,
1259
- zIndex: Math.max(1, 100 - I)
1251
+ const S = 2 * Math.PI / O, _ = E * (20 * Math.PI / 180);
1252
+ for (let $ = 0; $ < O && x < t; $++) {
1253
+ const A = $ * S + _, j = p ? this.random(f, m) : 1, N = R * j, P = l * N;
1254
+ let H = g + Math.cos(A) * z, U = h + Math.sin(A) * T;
1255
+ const B = P * 1.5 / 2, W = P / 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;
1258
+ o.push({
1259
+ id: x,
1260
+ x: H,
1261
+ y: U,
1262
+ rotation: X,
1263
+ scale: N,
1264
+ baseSize: P,
1265
+ zIndex: Math.max(1, 100 - E)
1260
1266
  // Outer rings have lower z-index
1261
- }), w++;
1267
+ }), x++;
1262
1268
  }
1263
- I++;
1269
+ E++;
1264
1270
  }
1265
- return n;
1271
+ return o;
1266
1272
  }
1267
1273
  /**
1268
1274
  * Estimate image width based on height
@@ -1293,7 +1299,7 @@ const me = {
1293
1299
  alignment: "center",
1294
1300
  gap: 10,
1295
1301
  overflowOffset: 0.25
1296
- }, Rt = [
1302
+ }, Tt = [
1297
1303
  { x: 1, y: 1 },
1298
1304
  // bottom-right
1299
1305
  { x: -1, y: -1 },
@@ -1323,73 +1329,73 @@ class pe {
1323
1329
  * @returns Array of layout objects with position, rotation, scale
1324
1330
  */
1325
1331
  generate(t, i, e = {}) {
1326
- const n = [], { width: s, height: r } = i, a = { ...me, ...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, p = s - 2 * c, b = r - 2 * c, { columns: f, rows: m } = this.calculateGridDimensions(
1332
+ const o = [], { width: s, height: r } = i, a = { ...me, ...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(
1327
1333
  t,
1328
- p,
1329
- b,
1330
- l,
1334
+ w,
1335
+ v,
1336
+ d,
1331
1337
  a
1332
- ), y = a.stagger === "row", E = a.stagger === "column", v = y ? f + 0.5 : f, S = E ? m + 0.5 : m, w = (p - a.gap * (f - 1)) / v, I = (b - a.gap * (m - 1)) / S, O = y ? w / 2 : 0, L = E ? I / 2 : 0, _ = 1 + a.overlap, z = Math.min(w, I) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, z) : z, N = f * w + (f - 1) * a.gap + O, A = m * I + (m - 1) * a.gap + L, D = c + (p - N) / 2, W = c + (b - A) / 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, x = (w - a.gap * (l - 1)) / I, E = (v - a.gap * (g - 1)) / y, F = h ? x / 2 : 0, R = b ? E / 2 : 0, M = 1 + a.overlap, T = Math.min(x, E) * M, z = e.fixedHeight ? Math.min(e.fixedHeight, T) : T, k = l * x + (l - 1) * a.gap + F, D = g * E + (g - 1) * a.gap + R, O = c + (w - k) / 2, S = c + (v - D) / 2, _ = l * g, $ = a.columns !== "auto" && a.rows !== "auto", A = $ && t > _;
1333
1339
  typeof window < "u" && (window.__gridOverflowDebug = {
1334
1340
  gridConfigColumns: a.columns,
1335
1341
  gridConfigRows: a.rows,
1336
- columns: f,
1337
- rows: m,
1338
- cellCount: U,
1339
- hasFixedGrid: M,
1342
+ columns: l,
1343
+ rows: g,
1344
+ cellCount: _,
1345
+ hasFixedGrid: $,
1340
1346
  imageCount: t,
1341
- isOverflowMode: R
1347
+ isOverflowMode: A
1342
1348
  });
1343
- const k = R ? new Array(U).fill(0) : [], q = Math.min(w, I) * a.overflowOffset;
1344
- for (let T = 0; T < t; T++) {
1345
- let $, F, X = 0;
1346
- if (R && T >= U) {
1347
- const G = T - U, j = G % U;
1348
- 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(_).fill(0) : [], N = Math.min(x, E) * a.overflowOffset;
1350
+ for (let P = 0; P < t; P++) {
1351
+ let H, U, Y = 0;
1352
+ if (A && P >= _) {
1353
+ const q = P - _, G = q % _;
1354
+ Y = Math.floor(q / _) + 1, j[G]++, a.fillDirection === "row" ? (H = G % l, U = Math.floor(G / l)) : (U = G % g, H = Math.floor(G / g));
1349
1355
  } else
1350
- a.fillDirection === "row" ? ($ = T % f, F = Math.floor(T / f)) : (F = T % m, $ = Math.floor(T / m));
1351
- let P = D + $ * (w + a.gap) + w / 2, B = W + F * (I + a.gap) + I / 2;
1352
- if (a.stagger === "row" && F % 2 === 1 ? P += w / 2 : a.stagger === "column" && $ % 2 === 1 && (B += I / 2), X > 0) {
1353
- const G = (X - 1) % Rt.length, j = Rt[G];
1354
- P += j.x * q, B += j.y * q;
1356
+ a.fillDirection === "row" ? (H = P % l, U = Math.floor(P / l)) : (U = P % g, H = Math.floor(P / g));
1357
+ let B = O + H * (x + a.gap) + x / 2, W = S + U * (E + a.gap) + E / 2;
1358
+ if (a.stagger === "row" && U % 2 === 1 ? B += x / 2 : a.stagger === "column" && H % 2 === 1 && (W += E / 2), Y > 0) {
1359
+ const q = (Y - 1) % Tt.length, G = Tt[q];
1360
+ B += G.x * N, W += G.y * N;
1355
1361
  }
1356
1362
  if (a.jitter > 0) {
1357
- const G = w / 2 * a.jitter, j = I / 2 * a.jitter;
1358
- P += this.random(-G, G), B += this.random(-j, j);
1363
+ const q = x / 2 * a.jitter, G = E / 2 * a.jitter;
1364
+ B += this.random(-q, q), W += this.random(-G, G);
1359
1365
  }
1360
- let Y = P, J = B;
1361
- if (!R && a.fillDirection === "row") {
1362
- const G = t % f || f;
1363
- if (F === Math.floor((t - 1) / f) && G < f) {
1364
- const St = G * w + (G - 1) * a.gap;
1366
+ let X = B, V = 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 It = q * x + (q - 1) * a.gap;
1365
1371
  let gt = 0;
1366
- a.alignment === "center" ? gt = (N - St) / 2 : a.alignment === "end" && (gt = N - St), Y += gt;
1372
+ a.alignment === "center" ? gt = (k - It) / 2 : a.alignment === "end" && (gt = k - It), X += gt;
1367
1373
  }
1368
1374
  }
1369
- 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, Pt = c + ot, _t = r - c - ot;
1370
- Y = Math.max(ht, Math.min(Y, dt)), J = Math.max(Pt, Math.min(J, _t));
1375
+ const ct = p ? this.random(f, m) : 1, K = z * ct, ot = K * 1.5 / 2, nt = K / 2, ht = c + ot, dt = s - c - ot, Pt = c + nt, _t = r - c - nt;
1376
+ X = Math.max(ht, Math.min(X, dt)), V = Math.max(Pt, Math.min(V, _t));
1371
1377
  let ut = 0;
1372
1378
  if (u === "random") {
1373
- const G = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
1374
- 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);
1375
1381
  }
1376
1382
  let ft;
1377
- R && X > 0 ? ft = 50 - X : ft = R ? 100 + T : T + 1, n.push({
1378
- id: T,
1379
- x: Y,
1380
- y: J,
1383
+ A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + P : P + 1, o.push({
1384
+ id: P,
1385
+ x: X,
1386
+ y: V,
1381
1387
  rotation: ut,
1382
1388
  scale: ct,
1383
1389
  baseSize: K,
1384
1390
  zIndex: ft
1385
1391
  });
1386
1392
  }
1387
- return n;
1393
+ return o;
1388
1394
  }
1389
1395
  /**
1390
1396
  * Calculate optimal grid dimensions based on image count and container
1391
1397
  */
1392
- calculateGridDimensions(t, i, e, n, s) {
1398
+ calculateGridDimensions(t, i, e, o, s) {
1393
1399
  let r, a;
1394
1400
  if (s.columns !== "auto" && s.rows !== "auto")
1395
1401
  r = s.columns, a = s.rows;
@@ -1430,80 +1436,80 @@ class ve {
1430
1436
  * @returns Array of layout objects with position, rotation, scale
1431
1437
  */
1432
1438
  generate(t, i, e = {}) {
1433
- const n = [], { width: s, height: r } = i, a = { ...ye, ...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, p = this.imageConfig.sizing?.variance?.max ?? 1, b = g !== 1 || p !== 1, f = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, y = r / 2, E = Math.min(
1434
- m - c - l / 2,
1435
- y - c - l / 2
1436
- ), v = a.direction === "clockwise" ? -1 : 1;
1437
- for (let S = 0; S < t; S++) {
1438
- let w, I;
1439
+ const o = [], { width: s, height: r } = i, a = { ...ye, ...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 x, E;
1439
1445
  if (a.spiralType === "golden")
1440
- w = S * be * v + a.startAngle, I = this.calculateGoldenRadius(S, t, E, a.tightness);
1446
+ x = y * be * I + a.startAngle, E = this.calculateGoldenRadius(y, t, b, a.tightness);
1441
1447
  else if (a.spiralType === "archimedean") {
1442
- const P = S * 0.5 * a.tightness;
1443
- w = P * v + a.startAngle, I = this.calculateArchimedeanRadius(P, t, E, a.tightness);
1448
+ const B = y * 0.5 * a.tightness;
1449
+ x = B * I + a.startAngle, E = this.calculateArchimedeanRadius(B, t, b, a.tightness);
1444
1450
  } else {
1445
- const P = S * 0.3 * a.tightness;
1446
- w = P * v + a.startAngle, I = this.calculateLogarithmicRadius(P, t, E, a.tightness);
1451
+ const B = y * 0.3 * a.tightness;
1452
+ x = B * I + a.startAngle, E = this.calculateLogarithmicRadius(B, t, b, a.tightness);
1447
1453
  }
1448
- const O = m + Math.cos(w) * I, L = y + Math.sin(w) * I, _ = I / E, z = f > 0 ? 1 - _ * f * 0.5 : 1, H = b ? this.random(g, p) : 1, N = z * H, A = l * N, W = A * 1.5 / 2, U = A / 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));
1449
- let F = 0;
1454
+ const F = g + Math.cos(x) * E, R = h + Math.sin(x) * E, M = E / 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, _ = D / 2, $ = c + S, A = s - c - S, j = c + _, N = r - c - _, P = Math.max($, Math.min(F, A)), H = Math.max(j, Math.min(R, N));
1455
+ let U = 0;
1450
1456
  if (u === "random") {
1451
- const P = w * 180 / Math.PI % 360, B = this.random(h, d);
1452
- F = a.spiralType === "golden" ? B : P * 0.1 + B * 0.9;
1453
- } else u === "tangent" && (F = this.calculateSpiralTangent(w, I, a));
1454
- const X = t - S;
1455
- n.push({
1456
- id: S,
1457
- x: T,
1458
- y: $,
1459
- rotation: F,
1460
- scale: N,
1461
- baseSize: A,
1462
- zIndex: X
1457
+ const B = x * 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(x, E, a));
1460
+ const Y = t - y;
1461
+ o.push({
1462
+ id: y,
1463
+ x: P,
1464
+ y: H,
1465
+ rotation: U,
1466
+ scale: k,
1467
+ baseSize: D,
1468
+ zIndex: Y
1463
1469
  });
1464
1470
  }
1465
- return n;
1471
+ return o;
1466
1472
  }
1467
1473
  /**
1468
1474
  * Calculate tangent angle for spiral curve at given position
1469
1475
  * This aligns the image along the spiral's direction of travel
1470
1476
  */
1471
1477
  calculateSpiralTangent(t, i, e) {
1472
- let n;
1478
+ let o;
1473
1479
  if (e.spiralType === "golden")
1474
- n = t + Math.PI / 2;
1480
+ o = t + Math.PI / 2;
1475
1481
  else if (e.spiralType === "archimedean") {
1476
1482
  const r = 1 / e.tightness, a = Math.atan(i / r);
1477
- n = t + a;
1483
+ o = t + a;
1478
1484
  } else {
1479
1485
  const r = 0.15 / e.tightness, a = Math.atan(1 / r);
1480
- n = t + a;
1486
+ o = t + a;
1481
1487
  }
1482
- return n * 180 / Math.PI % 360 - 90;
1488
+ return o * 180 / Math.PI % 360 - 90;
1483
1489
  }
1484
1490
  /**
1485
1491
  * Calculate radius for golden spiral (Vogel's model)
1486
1492
  * Creates even distribution like sunflower seeds
1487
1493
  */
1488
- calculateGoldenRadius(t, i, e, n) {
1489
- const r = e / Math.sqrt(i) * Math.sqrt(t) / n;
1494
+ calculateGoldenRadius(t, i, e, o) {
1495
+ const r = e / Math.sqrt(i) * Math.sqrt(t) / o;
1490
1496
  return Math.min(r, e);
1491
1497
  }
1492
1498
  /**
1493
1499
  * Calculate radius for Archimedean spiral
1494
1500
  * r = a + b*θ (constant spacing between arms)
1495
1501
  */
1496
- calculateArchimedeanRadius(t, i, e, n) {
1497
- const s = i * 0.5 * n;
1502
+ calculateArchimedeanRadius(t, i, e, o) {
1503
+ const s = i * 0.5 * o;
1498
1504
  return t / s * e;
1499
1505
  }
1500
1506
  /**
1501
1507
  * Calculate radius for logarithmic (equiangular) spiral
1502
1508
  * r = a * e^(b*θ)
1503
1509
  */
1504
- calculateLogarithmicRadius(t, i, e, n) {
1505
- 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);
1506
- return a / l * e;
1510
+ calculateLogarithmicRadius(t, i, e, o) {
1511
+ const s = e * 0.05, r = 0.15 / o, a = s * Math.exp(r * t), c = i * 0.3 * o, d = s * Math.exp(r * c);
1512
+ return a / d * e;
1507
1513
  }
1508
1514
  /**
1509
1515
  * Utility: Generate random number between min and max
@@ -1512,7 +1518,7 @@ class ve {
1512
1518
  return Math.random() * (i - t) + t;
1513
1519
  }
1514
1520
  }
1515
- const Ee = {
1521
+ const xe = {
1516
1522
  clusterCount: "auto",
1517
1523
  clusterSpread: 150,
1518
1524
  clusterSpacing: 200,
@@ -1520,7 +1526,7 @@ const Ee = {
1520
1526
  overlap: 0.3,
1521
1527
  distribution: "gaussian"
1522
1528
  };
1523
- class we {
1529
+ class Ee {
1524
1530
  constructor(t, i = {}) {
1525
1531
  this.config = t, this.imageConfig = i;
1526
1532
  }
@@ -1532,85 +1538,85 @@ class we {
1532
1538
  * @returns Array of layout objects with position, rotation, scale
1533
1539
  */
1534
1540
  generate(t, i, e = {}) {
1535
- const n = [], { width: s, height: r } = i, a = { ...Ee, ...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, p = this.imageConfig.sizing?.variance?.max ?? 1, b = g !== 1 || p !== 1, f = this.calculateClusterCount(
1541
+ const o = [], { width: s, height: r } = i, a = { ...xe, ...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(
1536
1542
  t,
1537
1543
  a.clusterCount,
1538
1544
  s,
1539
1545
  r,
1540
1546
  a.clusterSpacing
1541
- ), m = this.generateClusterCenters(
1542
- f,
1547
+ ), g = this.generateClusterCenters(
1548
+ l,
1543
1549
  s,
1544
1550
  r,
1545
1551
  c,
1546
1552
  a
1547
- ), y = new Array(f).fill(0);
1548
- for (let v = 0; v < t; v++)
1549
- y[v % f]++;
1550
- let E = 0;
1551
- for (let v = 0; v < f; v++) {
1552
- const S = m[v], w = y[v];
1553
- for (let I = 0; I < w; I++) {
1554
- 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], x = h[I];
1559
+ for (let E = 0; E < x; E++) {
1560
+ let F, R;
1555
1561
  if (a.distribution === "gaussian")
1556
- O = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
1562
+ F = this.gaussianRandom() * y.spread, R = this.gaussianRandom() * y.spread;
1557
1563
  else {
1558
- const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
1559
- 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;
1560
1566
  }
1561
- const _ = 1 + a.overlap * 0.5, z = 1 + a.overlap * 0.3;
1562
- O /= _, L /= _;
1563
- const H = b ? this.random(g, p) : 1, N = z * H, A = l * N;
1564
- let D = S.x + O, W = S.y + L;
1565
- const M = A * 1.5 / 2, R = A / 2;
1566
- D = Math.max(c + M, Math.min(D, s - c - M)), W = Math.max(c + R, Math.min(W, r - c - R));
1567
- const k = u === "random" ? this.random(h, d) : 0, T = Math.sqrt(O * O + L * L) / S.spread, $ = Math.round((1 - T) * 50) + 1;
1568
- n.push({
1569
- id: E,
1570
- x: D,
1571
- y: W,
1572
- rotation: k,
1573
- scale: N,
1574
- baseSize: A,
1575
- zIndex: $
1576
- }), E++;
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, P = Math.sqrt(F * F + R * R) / y.spread, H = Math.round((1 - P) * 50) + 1;
1574
+ o.push({
1575
+ id: b,
1576
+ x: O,
1577
+ y: S,
1578
+ rotation: j,
1579
+ scale: k,
1580
+ baseSize: D,
1581
+ zIndex: H
1582
+ }), b++;
1577
1583
  }
1578
1584
  }
1579
- return n;
1585
+ return o;
1580
1586
  }
1581
1587
  /**
1582
1588
  * Calculate optimal number of clusters based on image count and container
1583
1589
  */
1584
- calculateClusterCount(t, i, e, n, s) {
1590
+ calculateClusterCount(t, i, e, o, s) {
1585
1591
  if (i !== "auto")
1586
1592
  return Math.max(1, Math.min(i, t));
1587
1593
  const a = Math.max(1, Math.ceil(t / 8)), c = Math.floor(
1588
- e / s * (n / s) * 0.6
1594
+ e / s * (o / s) * 0.6
1589
1595
  );
1590
1596
  return Math.max(1, Math.min(a, c, 10));
1591
1597
  }
1592
1598
  /**
1593
1599
  * Generate cluster center positions with spacing constraints
1594
1600
  */
1595
- generateClusterCenters(t, i, e, n, s) {
1596
- const r = [], c = n + s.clusterSpread, l = i - n - s.clusterSpread, u = n + s.clusterSpread, h = e - n - s.clusterSpread;
1597
- for (let d = 0; d < t; d++) {
1598
- let g = null, p = -1;
1599
- for (let b = 0; b < 100; b++) {
1600
- const f = {
1601
- x: this.random(c, l),
1602
- y: this.random(u, h),
1601
+ generateClusterCenters(t, i, e, o, s) {
1602
+ const r = [], c = o + s.clusterSpread, d = i - o - s.clusterSpread, u = o + s.clusterSpread, f = e - o - 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),
1603
1609
  spread: this.calculateClusterSpread(s)
1604
1610
  };
1605
- let m = 1 / 0;
1606
- for (const y of r) {
1607
- const E = f.x - y.x, v = f.y - y.y, S = Math.sqrt(E * E + v * v);
1608
- 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);
1609
1615
  }
1610
- if ((r.length === 0 || m > p) && (g = f, p = m), m >= s.clusterSpacing)
1616
+ if ((r.length === 0 || g > w) && (p = l, w = g), g >= s.clusterSpacing)
1611
1617
  break;
1612
1618
  }
1613
- g && r.push(g);
1619
+ p && r.push(p);
1614
1620
  }
1615
1621
  return r;
1616
1622
  }
@@ -1638,7 +1644,7 @@ class we {
1638
1644
  return Math.random() * (i - t) + t;
1639
1645
  }
1640
1646
  }
1641
- class xe {
1647
+ class we {
1642
1648
  constructor(t, i = {}) {
1643
1649
  this.config = t, this.imageConfig = i;
1644
1650
  }
@@ -1650,32 +1656,32 @@ class xe {
1650
1656
  * @returns Array of layout objects with position, rotation, scale
1651
1657
  */
1652
1658
  generate(t, i, e = {}) {
1653
- 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, p = d !== 1 || g !== 1, b = e.fixedHeight ?? a, f = {
1654
- ...Ht,
1659
+ const o = [], { 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
+ ...kt,
1655
1661
  ...this.config.wave
1656
- }, { rows: m, amplitude: y, frequency: E, phaseShift: v, synchronization: S } = f, w = Math.ceil(t / m), L = b * 1.5 / 2, _ = c + L, z = s - c - L, H = z - _, N = w > 1 ? H / (w - 1) : 0, A = c + y + b / 2, D = r - c - y - b / 2, W = D - A, U = m > 1 ? W / (m - 1) : 0;
1657
- let M = 0;
1658
- for (let R = 0; R < m && M < t; R++) {
1659
- const k = m === 1 ? (A + D) / 2 : A + R * U;
1660
- let q = 0;
1661
- S === "offset" ? q = R * v : S === "alternating" && (q = R * Math.PI);
1662
- for (let T = 0; T < w && M < t; T++) {
1663
- const $ = w === 1 ? (_ + z) / 2 : _ + T * N, F = this.calculateWaveY($, s, y, E, q), X = $, P = k + F, B = p ? this.random(d, g) : 1, Y = b * B;
1664
- let J = 0;
1665
- l === "tangent" ? J = this.calculateRotation($, s, y, E, q) : l === "random" && (J = this.random(u, h));
1666
- const K = Y * 1.5 / 2, lt = Y / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1667
- n.push({
1668
- id: M,
1669
- x: Math.max(nt, Math.min(X, ot)),
1670
- y: Math.max(ht, Math.min(P, dt)),
1671
- rotation: J,
1672
- scale: B,
1673
- baseSize: Y,
1674
- zIndex: M + 1
1675
- }), M++;
1662
+ }, { rows: g, amplitude: h, frequency: b, phaseShift: I, synchronization: y } = l, x = Math.ceil(t / g), R = v * 1.5 / 2, M = c + R, T = s - c - R, z = T - M, k = x > 1 ? z / (x - 1) : 0, D = c + h + v / 2, O = r - c - h - v / 2, S = O - D, _ = 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 * _;
1666
+ let N = 0;
1667
+ y === "offset" ? N = A * I : y === "alternating" && (N = A * Math.PI);
1668
+ for (let P = 0; P < x && $ < t; P++) {
1669
+ const H = x === 1 ? (M + T) / 2 : M + P * k, U = this.calculateWaveY(H, s, h, b, N), Y = H, B = j + U, W = w ? this.random(m, p) : 1, X = v * W;
1670
+ let V = 0;
1671
+ d === "tangent" ? V = this.calculateRotation(H, s, h, b, N) : d === "random" && (V = this.random(u, f));
1672
+ const K = X * 1.5 / 2, lt = X / 2, ot = c + K, nt = s - c - K, ht = c + lt, dt = r - c - lt;
1673
+ o.push({
1674
+ id: $,
1675
+ x: Math.max(ot, Math.min(Y, nt)),
1676
+ y: Math.max(ht, Math.min(B, dt)),
1677
+ rotation: V,
1678
+ scale: W,
1679
+ baseSize: X,
1680
+ zIndex: $ + 1
1681
+ }), $++;
1676
1682
  }
1677
1683
  }
1678
- return n;
1684
+ return o;
1679
1685
  }
1680
1686
  /**
1681
1687
  * Calculate Y position displacement on wave curve
@@ -1686,9 +1692,9 @@ class xe {
1686
1692
  * @param phase - Phase offset
1687
1693
  * @returns Y displacement from baseline
1688
1694
  */
1689
- calculateWaveY(t, i, e, n, s) {
1695
+ calculateWaveY(t, i, e, o, s) {
1690
1696
  const r = t / i;
1691
- return e * Math.sin(n * r * 2 * Math.PI + s);
1697
+ return e * Math.sin(o * r * 2 * Math.PI + s);
1692
1698
  }
1693
1699
  /**
1694
1700
  * Calculate rotation based on wave tangent
@@ -1699,8 +1705,8 @@ class xe {
1699
1705
  * @param phase - Phase offset
1700
1706
  * @returns Rotation angle in degrees
1701
1707
  */
1702
- calculateRotation(t, i, e, n, s) {
1703
- const r = t / i, a = e * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + s) / i;
1708
+ calculateRotation(t, i, e, o, s) {
1709
+ const r = t / i, a = e * o * 2 * Math.PI * Math.cos(o * r * 2 * Math.PI + s) / i;
1704
1710
  return Math.atan(a) * (180 / Math.PI);
1705
1711
  }
1706
1712
  /**
@@ -1715,7 +1721,7 @@ class xe {
1715
1721
  return Math.random() * (i - t) + t;
1716
1722
  }
1717
1723
  }
1718
- const wt = 100, Q = 100 / Math.sqrt(3), xt = [
1724
+ const Et = 100, Q = 100 / Math.sqrt(3), wt = [
1719
1725
  [Q / 2, 0],
1720
1726
  // upper-left
1721
1727
  [3 * Q / 2, 0],
@@ -1728,21 +1734,21 @@ const wt = 100, Q = 100 / Math.sqrt(3), xt = [
1728
1734
  // lower-left
1729
1735
  [0, 50]
1730
1736
  // left
1731
- ], Se = xt[1][0] / wt, Ie = xt[2][1] / wt;
1732
- function Ce(o) {
1737
+ ], Ie = wt[1][0] / Et, Se = wt[2][1] / Et;
1738
+ function Ce(n) {
1733
1739
  return {
1734
- colStep: Se * o,
1735
- rowOffset: Ie * o
1740
+ colStep: Ie * n,
1741
+ rowOffset: Se * n
1736
1742
  };
1737
1743
  }
1738
- function Ae(o, t, i, e, n, s) {
1744
+ function Re(n, t, i, e, o, s) {
1739
1745
  const { colStep: r } = Ce(s);
1740
1746
  return {
1741
- px: e + r * o,
1742
- py: n + s * (t + o / 2)
1747
+ px: e + r * n,
1748
+ py: o + s * (t + n / 2)
1743
1749
  };
1744
1750
  }
1745
- const Re = [
1751
+ const Te = [
1746
1752
  [1, 0, -1],
1747
1753
  [0, 1, -1],
1748
1754
  [-1, 1, 0],
@@ -1750,13 +1756,13 @@ const Re = [
1750
1756
  [0, -1, 1],
1751
1757
  [1, -1, 0]
1752
1758
  ];
1753
- function Te(o) {
1754
- if (o === 0) return [[0, 0, 0]];
1759
+ function Ae(n) {
1760
+ if (n === 0) return [[0, 0, 0]];
1755
1761
  const t = [];
1756
- let [i, e, n] = [0, -o, o];
1757
- for (const [s, r, a] of Re)
1758
- for (let c = 0; c < o; c++)
1759
- t.push([i, e, n]), i += s, e += r, n += a;
1762
+ let [i, e, o] = [0, -n, n];
1763
+ for (const [s, r, a] of Te)
1764
+ for (let c = 0; c < n; c++)
1765
+ t.push([i, e, o]), i += s, e += r, o += a;
1760
1766
  return t;
1761
1767
  }
1762
1768
  class Le {
@@ -1766,33 +1772,33 @@ class Le {
1766
1772
  this.config = t;
1767
1773
  }
1768
1774
  generate(t, i, e = {}) {
1769
- const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1770
- ...Nt,
1775
+ const o = [], { width: s, height: r } = i, a = s / 2, c = r / 2, d = e.fixedHeight ?? 200, f = {
1776
+ ...Ht,
1771
1777
  ...this.config.honeycomb
1772
- }.spacing ?? 0, d = l + h;
1773
- let g = 0, p = 0;
1774
- for (; g < t; ) {
1775
- const b = Te(p);
1776
- for (const [f, m, y] of b) {
1777
- if (g >= t) break;
1778
- const { px: E, py: v } = Ae(f, m, y, a, c, d);
1779
- n.push({
1780
- id: g,
1781
- x: E,
1782
- y: v,
1778
+ }.spacing ?? 0, m = d + f;
1779
+ let p = 0, w = 0;
1780
+ for (; p < t; ) {
1781
+ const v = Ae(w);
1782
+ for (const [l, g, h] of v) {
1783
+ if (p >= t) break;
1784
+ const { px: b, py: I } = Re(l, g, h, a, c, m);
1785
+ o.push({
1786
+ id: p,
1787
+ x: b,
1788
+ y: I,
1783
1789
  rotation: 0,
1784
1790
  scale: 1,
1785
- baseSize: l,
1791
+ baseSize: d,
1786
1792
  // Inner rings render above outer rings
1787
- zIndex: Math.max(1, 100 - p)
1788
- }), g++;
1793
+ zIndex: Math.max(1, 100 - w)
1794
+ }), p++;
1789
1795
  }
1790
- p++;
1796
+ w++;
1791
1797
  }
1792
- return n;
1798
+ return o;
1793
1799
  }
1794
1800
  }
1795
- class Me {
1801
+ class Fe {
1796
1802
  constructor(t) {
1797
1803
  this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
1798
1804
  }
@@ -1809,9 +1815,9 @@ class Me {
1809
1815
  case "spiral":
1810
1816
  return new ve(this.config, this.imageConfig);
1811
1817
  case "cluster":
1812
- return new we(this.config, this.imageConfig);
1818
+ return new Ee(this.config, this.imageConfig);
1813
1819
  case "wave":
1814
- return new xe(this.config, this.imageConfig);
1820
+ return new we(this.config, this.imageConfig);
1815
1821
  case "honeycomb":
1816
1822
  return new Le(this.config, this.imageConfig);
1817
1823
  default:
@@ -1826,10 +1832,10 @@ class Me {
1826
1832
  * @returns Array of layout objects with position, rotation, scale
1827
1833
  */
1828
1834
  generateLayout(t, i, e = {}) {
1829
- const n = this.placementLayout.generate(t, i, e);
1830
- return n.forEach((s) => {
1835
+ const o = this.placementLayout.generate(t, i, e);
1836
+ return o.forEach((s) => {
1831
1837
  this.layouts.set(s.id, s);
1832
- }), n;
1838
+ }), o;
1833
1839
  }
1834
1840
  /**
1835
1841
  * Get the original layout state for an image
@@ -1882,8 +1888,8 @@ class Me {
1882
1888
  return;
1883
1889
  if (typeof e == "number")
1884
1890
  return e;
1885
- const n = e, s = this.resolveBreakpoint(t);
1886
- return s === "mobile" ? n.mobile ?? n.tablet ?? n.screen : s === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
1891
+ const o = e, s = this.resolveBreakpoint(t);
1892
+ return s === "mobile" ? o.mobile ?? o.tablet ?? o.screen : s === "tablet" ? o.tablet ?? o.screen ?? o.mobile : o.screen ?? o.tablet ?? o.mobile;
1887
1893
  }
1888
1894
  /**
1889
1895
  * Calculate adaptive image size based on container dimensions and image count
@@ -1893,19 +1899,19 @@ class Me {
1893
1899
  * @param viewportWidth - Current viewport width for baseHeight resolution
1894
1900
  * @returns Calculated sizing result with height
1895
1901
  */
1896
- calculateAdaptiveSize(t, i, e, n) {
1897
- const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1902
+ calculateAdaptiveSize(t, i, e, o) {
1903
+ const s = this.imageConfig.sizing, r = this.resolveBaseHeight(o);
1898
1904
  if (r !== void 0)
1899
1905
  return { height: r };
1900
- 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, b = h * d * l / i;
1901
- let m = Math.sqrt(b / 1.4);
1902
- m *= u, m = Math.min(m, e);
1903
- let y = this.clamp(m, a, c);
1904
- if (y === a && m < a) {
1905
- const E = Math.max(a * 0.05, 20);
1906
- 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);
1907
1913
  }
1908
- 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 };
1909
1915
  }
1910
1916
  /**
1911
1917
  * Returns the largest image height at which all honeycomb rings fit within the container.
@@ -1914,11 +1920,11 @@ class Me {
1914
1920
  */
1915
1921
  honeycombMaxImageHeight(t, i) {
1916
1922
  if (t <= 1) return 1 / 0;
1917
- let e = 0, n = 1;
1918
- for (; n < t; )
1919
- e++, n += 6 * e;
1920
- 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);
1921
- return Math.max(10, Math.min(h, d));
1923
+ let e = 0, o = 1;
1924
+ for (; o < t; )
1925
+ e++, o += 6 * e;
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));
1922
1928
  }
1923
1929
  /**
1924
1930
  * Utility: Clamp a value between min and max
@@ -1927,8 +1933,8 @@ class Me {
1927
1933
  return Math.max(i, Math.min(e, t));
1928
1934
  }
1929
1935
  }
1930
- var x = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(x || {});
1931
- const Tt = {
1936
+ var C = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(C || {});
1937
+ const At = {
1932
1938
  // Geometric shapes - uses percentages for responsive sizing
1933
1939
  circle: "circle(50%)",
1934
1940
  square: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)",
@@ -1937,7 +1943,7 @@ const Tt = {
1937
1943
  hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
1938
1944
  octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
1939
1945
  diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
1940
- }, Fe = {
1946
+ }, Me = {
1941
1947
  // Circle - uses radius in pixels (refHeight of 100px = 50px radius)
1942
1948
  circle: {
1943
1949
  refHeight: 100,
@@ -1961,8 +1967,8 @@ const Tt = {
1961
1967
  },
1962
1968
  // Hexagon - regular hexagon (reference points imported from hexagonGeometry)
1963
1969
  hexagon: {
1964
- refHeight: wt,
1965
- points: xt
1970
+ refHeight: Et,
1971
+ points: wt
1966
1972
  },
1967
1973
  // Octagon - regular octagon
1968
1974
  octagon: {
@@ -1975,96 +1981,96 @@ const Tt = {
1975
1981
  points: [[50, 0], [100, 50], [50, 100], [0, 50]]
1976
1982
  }
1977
1983
  };
1978
- function Oe(o) {
1979
- if (o)
1980
- return o in Tt ? Tt[o] : o;
1984
+ function Oe(n) {
1985
+ if (n)
1986
+ return n in At ? At[n] : n;
1981
1987
  }
1982
- function ze(o, t, i) {
1983
- const e = Fe[o];
1988
+ function ze(n, t, i) {
1989
+ const e = Me[n];
1984
1990
  if (!e) return "";
1985
- const n = t / e.refHeight;
1986
- if (o === "circle")
1987
- return `circle(${Math.round(50 * n * 100) / 100}px)`;
1988
- const s = e.points.map(([b]) => b), r = e.points.map(([, b]) => b), 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;
1989
- return `polygon(${e.points.map(([b, f]) => {
1990
- const m = Math.round((b * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
1991
- return `${m}px ${y}px`;
1991
+ const o = t / e.refHeight;
1992
+ if (n === "circle")
1993
+ return `circle(${Math.round(50 * o * 100) / 100}px)`;
1994
+ const s = e.points.map(([v]) => v), r = e.points.map(([, v]) => v), a = (Math.min(...s) + Math.max(...s)) / 2 * o, c = (Math.min(...r) + Math.max(...r)) / 2 * o, d = (Math.max(...s) - Math.min(...s)) * o, 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 * o + m) * 100) / 100, h = Math.round((l * o + p) * 100) / 100;
1997
+ return `${g}px ${h}px`;
1992
1998
  }).join(", ")})`;
1993
1999
  }
1994
- function De(o) {
1995
- return o in mt;
2000
+ function De(n) {
2001
+ return n in mt;
1996
2002
  }
1997
- function $e(o) {
1998
- return o ? De(o) ? mt[o] : o : mt.md;
2003
+ function $e(n) {
2004
+ return n ? De(n) ? mt[n] : n : mt.md;
1999
2005
  }
2000
- function Pe(o) {
2001
- if (!o) return "";
2006
+ function Pe(n) {
2007
+ if (!n) return "";
2002
2008
  const t = [];
2003
- 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)
2004
- if (typeof o.dropShadow == "string")
2005
- t.push(`drop-shadow(${o.dropShadow})`);
2009
+ if (n.grayscale !== void 0 && t.push(`grayscale(${n.grayscale})`), n.blur !== void 0 && t.push(`blur(${n.blur}px)`), n.brightness !== void 0 && t.push(`brightness(${n.brightness})`), n.contrast !== void 0 && t.push(`contrast(${n.contrast})`), n.saturate !== void 0 && t.push(`saturate(${n.saturate})`), n.opacity !== void 0 && t.push(`opacity(${n.opacity})`), n.sepia !== void 0 && t.push(`sepia(${n.sepia})`), n.hueRotate !== void 0 && t.push(`hue-rotate(${n.hueRotate}deg)`), n.invert !== void 0 && t.push(`invert(${n.invert})`), n.dropShadow !== void 0)
2010
+ if (typeof n.dropShadow == "string")
2011
+ t.push(`drop-shadow(${n.dropShadow})`);
2006
2012
  else {
2007
- const i = o.dropShadow;
2013
+ const i = n.dropShadow;
2008
2014
  t.push(`drop-shadow(${i.x}px ${i.y}px ${i.blur}px ${i.color})`);
2009
2015
  }
2010
2016
  return t.join(" ");
2011
2017
  }
2012
- function tt(o) {
2013
- if (!o || o.style === "none" || o.width === 0)
2018
+ function tt(n) {
2019
+ if (!n || n.style === "none" || n.width === 0)
2014
2020
  return "none";
2015
- const t = o.width ?? 0, i = o.style ?? "solid", e = o.color ?? "#000000";
2021
+ const t = n.width ?? 0, i = n.style ?? "solid", e = n.color ?? "#000000";
2016
2022
  return `${t}px ${i} ${e}`;
2017
2023
  }
2018
- function it(o, t, i) {
2019
- if (!o) return {};
2024
+ function it(n, t, i) {
2025
+ if (!n) return {};
2020
2026
  const e = {};
2021
- if (o.borderRadiusTopLeft !== void 0 || o.borderRadiusTopRight !== void 0 || o.borderRadiusBottomRight !== void 0 || o.borderRadiusBottomLeft !== void 0) {
2022
- const a = o.border?.radius ?? 0;
2023
- 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`);
2024
- } else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
2025
- if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
2026
- const a = o.border || {}, c = { ...a, ...o.borderTop }, l = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, h = { ...a, ...o.borderLeft };
2027
- e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
2028
- } else o.border && (e.border = tt(o.border));
2029
- o.shadow !== void 0 && (e.boxShadow = $e(o.shadow));
2030
- const r = Pe(o.filter);
2031
- 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) {
2032
- const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
2033
- e.outline = `${a}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2034
- }
2035
- if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
2027
+ if (n.borderRadiusTopLeft !== void 0 || n.borderRadiusTopRight !== void 0 || n.borderRadiusBottomRight !== void 0 || n.borderRadiusBottomLeft !== void 0) {
2028
+ const a = n.border?.radius ?? 0;
2029
+ n.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${n.borderRadiusTopLeft}px` : a && (e.borderTopLeftRadius = `${a}px`), n.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${n.borderRadiusTopRight}px` : a && (e.borderTopRightRadius = `${a}px`), n.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${n.borderRadiusBottomRight}px` : a && (e.borderBottomRightRadius = `${a}px`), n.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${n.borderRadiusBottomLeft}px` : a && (e.borderBottomLeftRadius = `${a}px`);
2030
+ } else n.border?.radius !== void 0 && (e.borderRadius = `${n.border.radius}px`);
2031
+ if (n.borderTop || n.borderRight || n.borderBottom || n.borderLeft) {
2032
+ const a = n.border || {}, c = { ...a, ...n.borderTop }, d = { ...a, ...n.borderRight }, u = { ...a, ...n.borderBottom }, f = { ...a, ...n.borderLeft };
2033
+ e.borderTop = tt(c), e.borderRight = tt(d), e.borderBottom = tt(u), e.borderLeft = tt(f);
2034
+ } else n.border && (e.border = tt(n.border));
2035
+ n.shadow !== void 0 && (e.boxShadow = $e(n.shadow));
2036
+ const r = Pe(n.filter);
2037
+ if (e.filter = r || "none", n.opacity !== void 0 && (e.opacity = String(n.opacity)), n.cursor !== void 0 && (e.cursor = n.cursor), n.outline && n.outline.style !== "none" && (n.outline.width ?? 0) > 0) {
2038
+ const a = n.outline.width ?? 0, c = n.outline.style ?? "solid", d = n.outline.color ?? "#000000";
2039
+ e.outline = `${a}px ${c} ${d}`, n.outline.offset !== void 0 && (e.outlineOffset = `${n.outline.offset}px`);
2040
+ }
2041
+ if (n.objectFit !== void 0 && (e.objectFit = n.objectFit), n.aspectRatio !== void 0 && (e.aspectRatio = n.aspectRatio), n.clipPath !== void 0) {
2036
2042
  let a;
2037
- const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
2038
- if (l?.mode === "height-relative" && t)
2039
- a = ze(l.shape, t, i);
2043
+ const c = typeof n.clipPath == "object" && n.clipPath !== null && "shape" in n.clipPath, d = c ? n.clipPath : void 0;
2044
+ if (d?.mode === "height-relative" && t)
2045
+ a = ze(d.shape, t, i);
2040
2046
  else {
2041
- const u = c && l ? l.shape : o.clipPath;
2047
+ const u = c && d ? d.shape : n.clipPath;
2042
2048
  a = Oe(u);
2043
2049
  }
2044
2050
  a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
2045
2051
  }
2046
2052
  return e;
2047
2053
  }
2048
- function _e(o, t) {
2049
- t.borderRadius !== void 0 && (o.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (o.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (o.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (o.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (o.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (o.style.border = t.border), t.borderTop !== void 0 && (o.style.borderTop = t.borderTop), t.borderRight !== void 0 && (o.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (o.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (o.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (o.style.boxShadow = t.boxShadow), t.filter !== void 0 && (o.style.filter = t.filter), t.opacity !== void 0 && (o.style.opacity = t.opacity), t.cursor !== void 0 && (o.style.cursor = t.cursor), t.outline !== void 0 && (o.style.outline = t.outline), t.outlineOffset !== void 0 && (o.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (o.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (o.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (o.style.clipPath = t.clipPath), t.overflow !== void 0 && (o.style.overflow = t.overflow);
2054
+ function _e(n, t) {
2055
+ t.borderRadius !== void 0 && (n.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (n.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (n.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (n.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (n.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (n.style.border = t.border), t.borderTop !== void 0 && (n.style.borderTop = t.borderTop), t.borderRight !== void 0 && (n.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (n.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (n.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (n.style.boxShadow = t.boxShadow), t.filter !== void 0 && (n.style.filter = t.filter), t.opacity !== void 0 && (n.style.opacity = t.opacity), t.cursor !== void 0 && (n.style.cursor = t.cursor), t.outline !== void 0 && (n.style.outline = t.outline), t.outlineOffset !== void 0 && (n.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (n.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (n.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (n.style.clipPath = t.clipPath), t.overflow !== void 0 && (n.style.overflow = t.overflow);
2050
2056
  }
2051
- function st(o, t, i, e) {
2052
- const n = it(t, i, e);
2053
- _e(o, n);
2057
+ function st(n, t, i, e) {
2058
+ const o = it(t, i, e);
2059
+ _e(n, o);
2054
2060
  }
2055
- function $t(o) {
2056
- return o ? Array.isArray(o) ? o.join(" ") : o : "";
2061
+ function $t(n) {
2062
+ return n ? Array.isArray(n) ? n.join(" ") : n : "";
2057
2063
  }
2058
- function et(o, t) {
2064
+ function et(n, t) {
2059
2065
  const i = $t(t);
2060
2066
  i && i.split(" ").forEach((e) => {
2061
- e.trim() && o.classList.add(e.trim());
2067
+ e.trim() && n.classList.add(e.trim());
2062
2068
  });
2063
2069
  }
2064
- function pt(o, t) {
2070
+ function pt(n, t) {
2065
2071
  const i = $t(t);
2066
2072
  i && i.split(" ").forEach((e) => {
2067
- e.trim() && o.classList.remove(e.trim());
2073
+ e.trim() && n.classList.remove(e.trim());
2068
2074
  });
2069
2075
  }
2070
2076
  const Lt = {
@@ -2073,7 +2079,7 @@ const Lt = {
2073
2079
  };
2074
2080
  class Ue {
2075
2081
  constructor(t, i, e) {
2076
- 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;
2077
2083
  }
2078
2084
  /**
2079
2085
  * Set callback to be fired when an unfocus animation fully completes.
@@ -2091,7 +2097,7 @@ class Ue {
2091
2097
  * Check if any animation is in progress
2092
2098
  */
2093
2099
  isAnimating() {
2094
- return this.state !== x.IDLE && this.state !== x.FOCUSED;
2100
+ return this.state !== C.IDLE && this.state !== C.FOCUSED;
2095
2101
  }
2096
2102
  /**
2097
2103
  * Normalize scalePercent value
@@ -2104,17 +2110,17 @@ class Ue {
2104
2110
  * Returns actual pixel dimensions instead of scale factor for sharper rendering
2105
2111
  */
2106
2112
  calculateFocusDimensions(t, i, e) {
2107
- const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
2113
+ const o = this.normalizeScalePercent(this.config.scalePercent), s = e.height * o, r = t / i;
2108
2114
  let a = s, c = a * r;
2109
- const l = e.width * n;
2110
- return c > l && (c = l, a = c / r), { width: c, height: a };
2115
+ const d = e.width * o;
2116
+ return c > d && (c = d, a = c / r), { width: c, height: a };
2111
2117
  }
2112
2118
  /**
2113
2119
  * Calculate the transform needed to center an image (position only, no scale)
2114
2120
  * Scale is handled by animating actual dimensions for sharper rendering
2115
2121
  */
2116
2122
  calculateFocusTransform(t, i) {
2117
- const e = t.width / 2, n = t.height / 2, s = e - i.x, r = n - i.y;
2123
+ const e = t.width / 2, o = t.height / 2, s = e - i.x, r = o - i.y;
2118
2124
  return {
2119
2125
  x: s,
2120
2126
  y: r,
@@ -2129,8 +2135,8 @@ class Ue {
2129
2135
  buildDimensionZoomTransform(t) {
2130
2136
  const i = ["translate(-50%, -50%)"];
2131
2137
  if (t.x !== void 0 || t.y !== void 0) {
2132
- const e = t.x ?? 0, n = t.y ?? 0;
2133
- i.push(`translate(${e}px, ${n}px)`);
2138
+ const e = t.x ?? 0, o = t.y ?? 0;
2139
+ i.push(`translate(${e}px, ${o}px)`);
2134
2140
  }
2135
2141
  return t.rotation !== void 0 && i.push(`rotate(${t.rotation}deg)`), i.join(" ");
2136
2142
  }
@@ -2138,13 +2144,13 @@ class Ue {
2138
2144
  * Create a Web Animation that animates both transform (position) and dimensions
2139
2145
  * This provides sharper zoom by re-rendering at target size instead of scaling pixels
2140
2146
  */
2141
- animateWithDimensions(t, i, e, n, s, r, a, c) {
2142
- const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2147
+ animateWithDimensions(t, i, e, o, s, r, a, c) {
2148
+ const d = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2143
2149
  return t.style.transition = "none", t.animate(
2144
2150
  [
2145
2151
  {
2146
- transform: l,
2147
- width: `${n}px`,
2152
+ transform: d,
2153
+ width: `${o}px`,
2148
2154
  height: `${s}px`
2149
2155
  },
2150
2156
  {
@@ -2185,10 +2191,10 @@ class Ue {
2185
2191
  * This ensures clip-path changes smoothly as width/height animate
2186
2192
  */
2187
2193
  startClipPathAnimation(t, i, e) {
2188
- let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
2189
- e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
2194
+ let o = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
2195
+ e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (o = { ...o, clipPath: void 0 });
2190
2196
  const s = () => {
2191
- const r = t.offsetHeight, a = t.offsetWidth, c = it(n, r, a);
2197
+ const r = t.offsetHeight, a = t.offsetWidth, c = it(o, r, a);
2192
2198
  c.clipPath !== void 0 ? t.style.clipPath = c.clipPath : t.style.clipPath = "unset", c.overflow !== void 0 && (t.style.overflow = c.overflow), i.animation.playState === "running" && requestAnimationFrame(s);
2193
2199
  };
2194
2200
  requestAnimationFrame(s);
@@ -2199,34 +2205,34 @@ class Ue {
2199
2205
  * @param fromTransform - Optional starting transform (for mid-animation reversals)
2200
2206
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2201
2207
  */
2202
- startFocusAnimation(t, i, e, n, s) {
2203
- const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2208
+ startFocusAnimation(t, i, e, o, s) {
2209
+ const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, d = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2204
2210
  this.animationEngine.cancelAllAnimations(t);
2205
- const h = this.config.animationDuration ?? 600;
2211
+ const f = this.config.animationDuration ?? 600;
2206
2212
  this.applyFocusedStyling(t, Lt.FOCUSING);
2207
- const d = n ?? {
2213
+ const m = o ?? {
2208
2214
  x: 0,
2209
2215
  y: 0,
2210
2216
  rotation: e.rotation,
2211
2217
  scale: 1
2212
2218
  // No scale - using dimensions
2213
- }, g = s?.width ?? a, p = s?.height ?? c, b = this.animateWithDimensions(
2219
+ }, p = s?.width ?? a, w = s?.height ?? c, v = this.animateWithDimensions(
2214
2220
  t,
2215
- d,
2221
+ m,
2216
2222
  u,
2217
- g,
2218
2223
  p,
2219
- l.width,
2220
- l.height,
2221
- h
2222
- ), f = {
2224
+ w,
2225
+ d.width,
2226
+ d.height,
2227
+ f
2228
+ ), l = {
2223
2229
  id: `focus-${Date.now()}`,
2224
2230
  element: t,
2225
- animation: b,
2226
- fromState: d,
2231
+ animation: v,
2232
+ fromState: m,
2227
2233
  toState: u,
2228
2234
  startTime: performance.now(),
2229
- duration: h
2235
+ duration: f
2230
2236
  };
2231
2237
  return this.focusData = {
2232
2238
  element: t,
@@ -2235,12 +2241,12 @@ class Ue {
2235
2241
  originalZIndex: r,
2236
2242
  originalWidth: a,
2237
2243
  originalHeight: c,
2238
- focusWidth: l.width,
2239
- focusHeight: l.height
2240
- }, this.startClipPathAnimation(t, f, !0), {
2244
+ focusWidth: d.width,
2245
+ focusHeight: d.height
2246
+ }, this.startClipPathAnimation(t, l, !0), {
2241
2247
  element: t,
2242
2248
  originalState: e,
2243
- animationHandle: f,
2249
+ animationHandle: l,
2244
2250
  direction: "in",
2245
2251
  originalWidth: a,
2246
2252
  originalHeight: c
@@ -2251,41 +2257,41 @@ class Ue {
2251
2257
  * Animates back to original dimensions for consistent behavior
2252
2258
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2253
2259
  */
2254
- startUnfocusAnimation(t, i, e, n) {
2260
+ startUnfocusAnimation(t, i, e, o) {
2255
2261
  t.style.zIndex = String(Lt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2256
2262
  const s = this.config.animationDuration ?? 600;
2257
2263
  t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
2258
- 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 = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, d = {
2259
2265
  x: 0,
2260
2266
  y: 0,
2261
2267
  rotation: i.rotation,
2262
2268
  scale: 1
2263
2269
  // No scale - using dimensions
2264
- }, 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(
2265
2271
  t,
2266
2272
  r,
2267
- l,
2273
+ d,
2268
2274
  a,
2269
2275
  c,
2270
2276
  u,
2271
- h,
2277
+ f,
2272
2278
  s
2273
- ), g = {
2279
+ ), p = {
2274
2280
  id: `unfocus-${Date.now()}`,
2275
2281
  element: t,
2276
- animation: d,
2282
+ animation: m,
2277
2283
  fromState: r,
2278
- toState: l,
2284
+ toState: d,
2279
2285
  startTime: performance.now(),
2280
2286
  duration: s
2281
2287
  };
2282
- return this.startClipPathAnimation(t, g, !1), {
2288
+ return this.startClipPathAnimation(t, p, !1), {
2283
2289
  element: t,
2284
2290
  originalState: i,
2285
- animationHandle: g,
2291
+ animationHandle: p,
2286
2292
  direction: "out",
2287
2293
  originalWidth: u,
2288
- originalHeight: h
2294
+ originalHeight: f
2289
2295
  };
2290
2296
  }
2291
2297
  /**
@@ -2303,10 +2309,10 @@ class Ue {
2303
2309
  * Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
2304
2310
  */
2305
2311
  captureMidAnimationState(t) {
2306
- const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, s = t.offsetHeight, r = e.e + n * 0.5, a = e.f + s * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
2307
- return t.style.width = `${n}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${c}deg)`, t.style.transition = "none", {
2312
+ const i = getComputedStyle(t), e = new DOMMatrix(i.transform), o = t.offsetWidth, s = t.offsetHeight, r = e.e + o * 0.5, a = e.f + s * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
2313
+ return t.style.width = `${o}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${c}deg)`, t.style.transition = "none", {
2308
2314
  transform: { x: r, y: a, rotation: c, scale: 1 },
2309
- dimensions: { width: n, height: s }
2315
+ dimensions: { width: o, height: s }
2310
2316
  };
2311
2317
  }
2312
2318
  /**
@@ -2321,71 +2327,71 @@ class Ue {
2321
2327
  /**
2322
2328
  * Reset an element instantly to its original position and dimensions (no animation)
2323
2329
  */
2324
- resetElementInstantly(t, i, e, n, s) {
2330
+ resetElementInstantly(t, i, e, o, s) {
2325
2331
  this.animationEngine.cancelAllAnimations(t);
2326
2332
  const r = ["translate(-50%, -50%)"];
2327
- r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), n !== void 0 && s !== void 0 && (t.style.width = `${n}px`, t.style.height = `${s}px`), this.removeFocusedStyling(t, e);
2333
+ r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), o !== void 0 && s !== void 0 && (t.style.width = `${o}px`, t.style.height = `${s}px`), this.removeFocusedStyling(t, e);
2328
2334
  }
2329
2335
  /**
2330
2336
  * Focus (zoom) an image to center of container
2331
2337
  * Implements cross-animation when swapping focus
2332
2338
  */
2333
2339
  async focusImage(t, i, e) {
2334
- if (this.currentFocus === t && this.state === x.FOCUSED)
2340
+ if (this.currentFocus === t && this.state === C.FOCUSED)
2335
2341
  return this.unfocusImage();
2336
- if (this.incoming?.element === t && this.state === x.FOCUSING) {
2342
+ if (this.incoming?.element === t && this.state === C.FOCUSING) {
2337
2343
  const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2338
2344
  this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
2339
2345
  t,
2340
2346
  this.incoming.originalState,
2341
2347
  s,
2342
2348
  r
2343
- ), 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;
2344
2350
  return;
2345
2351
  }
2346
- const n = ++this.focusGeneration;
2352
+ const o = ++this.focusGeneration;
2347
2353
  switch (this.state) {
2348
- case x.IDLE:
2349
- if (this.state = x.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2350
- 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 !== o) return;
2356
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2351
2357
  break;
2352
- case x.FOCUSED:
2353
- 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(
2354
2360
  this.currentFocus,
2355
2361
  this.focusData.originalState
2356
2362
  )), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2357
2363
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2358
2364
  this.waitForAnimation(this.incoming.animationHandle)
2359
- ]), this.focusGeneration !== n)
2365
+ ]), this.focusGeneration !== o)
2360
2366
  return;
2361
2367
  if (this.outgoing) {
2362
2368
  const s = this.outgoing.element;
2363
2369
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2364
2370
  }
2365
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2371
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2366
2372
  break;
2367
- case x.FOCUSING:
2373
+ case C.FOCUSING:
2368
2374
  if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
2369
2375
  this.incoming.element,
2370
2376
  this.incoming.originalState,
2371
2377
  this.focusData?.originalZIndex || "",
2372
2378
  this.focusData?.originalWidth,
2373
2379
  this.focusData?.originalHeight
2374
- ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2375
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2380
+ ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
2381
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2376
2382
  break;
2377
- case x.UNFOCUSING:
2378
- 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([
2379
2385
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2380
2386
  this.waitForAnimation(this.incoming.animationHandle)
2381
- ]), this.focusGeneration !== n) return;
2387
+ ]), this.focusGeneration !== o) return;
2382
2388
  if (this.outgoing) {
2383
2389
  const s = this.outgoing.element;
2384
2390
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2385
2391
  }
2386
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2392
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2387
2393
  break;
2388
- case x.CROSS_ANIMATING:
2394
+ case C.CROSS_ANIMATING:
2389
2395
  if (this.incoming?.element === t)
2390
2396
  return;
2391
2397
  if (this.outgoing?.element === t) {
@@ -2403,12 +2409,12 @@ class Ue {
2403
2409
  if (this.incoming = this.startFocusAnimation(t, i, e, s, r), await Promise.all([
2404
2410
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2405
2411
  this.waitForAnimation(this.incoming.animationHandle)
2406
- ]), this.focusGeneration !== n) return;
2412
+ ]), this.focusGeneration !== o) return;
2407
2413
  if (this.outgoing) {
2408
2414
  const a = this.outgoing.element;
2409
2415
  this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2410
2416
  }
2411
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2417
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2412
2418
  return;
2413
2419
  }
2414
2420
  if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
@@ -2429,12 +2435,12 @@ class Ue {
2429
2435
  if (this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2430
2436
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2431
2437
  this.waitForAnimation(this.incoming.animationHandle)
2432
- ]), this.focusGeneration !== n) return;
2438
+ ]), this.focusGeneration !== o) return;
2433
2439
  if (this.outgoing) {
2434
2440
  const s = this.outgoing.element;
2435
2441
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2436
2442
  }
2437
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2443
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2438
2444
  break;
2439
2445
  }
2440
2446
  }
@@ -2442,24 +2448,24 @@ class Ue {
2442
2448
  * Unfocus current image, returning it to original position
2443
2449
  */
2444
2450
  async unfocusImage() {
2445
- if (this.state === x.UNFOCUSING)
2451
+ if (this.state === C.UNFOCUSING)
2446
2452
  return;
2447
2453
  const t = ++this.focusGeneration;
2448
2454
  if (!this.currentFocus || !this.focusData) {
2449
- if (this.incoming && this.state === x.FOCUSING) {
2455
+ if (this.incoming && this.state === C.FOCUSING) {
2450
2456
  const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2451
2457
  if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2452
2458
  this.incoming.element,
2453
2459
  this.incoming.originalState,
2454
2460
  s,
2455
2461
  r
2456
- ), 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;
2457
2463
  const a = this.outgoing.element;
2458
- 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);
2459
2465
  }
2460
2466
  return;
2461
2467
  }
2462
- if (this.state === x.CROSS_ANIMATING && this.incoming) {
2468
+ if (this.state === C.CROSS_ANIMATING && this.incoming) {
2463
2469
  const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2464
2470
  this.animationEngine.cancelAllAnimations(this.incoming.element);
2465
2471
  const a = this.startUnfocusAnimation(
@@ -2474,13 +2480,13 @@ class Ue {
2474
2480
  ]), this.focusGeneration !== t) return;
2475
2481
  let c = null;
2476
2482
  this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
2477
- const l = a.element;
2478
- 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);
2479
2485
  return;
2480
2486
  }
2481
- this.state = x.UNFOCUSING;
2482
- const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
2483
- 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));
2487
+ this.state = C.UNFOCUSING;
2488
+ const i = this.currentFocus, e = this.focusData.originalState, o = this.focusData.originalZIndex;
2489
+ this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, o), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(i));
2484
2490
  }
2485
2491
  /**
2486
2492
  * Swap focus from current image to a new one (alias for focusImage with cross-animation)
@@ -2498,7 +2504,7 @@ class Ue {
2498
2504
  * Check if an image is currently focused (stable state)
2499
2505
  */
2500
2506
  isFocused(t) {
2501
- return this.currentFocus === t && this.state === x.FOCUSED;
2507
+ return this.currentFocus === t && this.state === C.FOCUSED;
2502
2508
  }
2503
2509
  /**
2504
2510
  * Check if an image is the target of current focus animation
@@ -2519,9 +2525,9 @@ class Ue {
2519
2525
  * Used during swipe gestures for visual feedback
2520
2526
  */
2521
2527
  setDragOffset(t) {
2522
- if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2523
- const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
2524
- 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(" ");
2528
+ if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
2529
+ const i = this.currentFocus, e = this.focusData.focusTransform, o = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
2530
+ o.push(`translate(${s}px, ${r}px)`), e.rotation !== void 0 && o.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = o.join(" ");
2525
2531
  }
2526
2532
  /**
2527
2533
  * Clear the drag offset, optionally animating back to center
@@ -2529,9 +2535,9 @@ class Ue {
2529
2535
  * @param duration - Animation duration in ms (default 150)
2530
2536
  */
2531
2537
  clearDragOffset(t, i = 150) {
2532
- if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2533
- const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
2534
- s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
2538
+ if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
2539
+ const e = this.currentFocus, o = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = o.x ?? 0, a = o.y ?? 0;
2540
+ s.push(`translate(${r}px, ${a}px)`), o.rotation !== void 0 && s.push(`rotate(${o.rotation}deg)`);
2535
2541
  const c = s.join(" ");
2536
2542
  t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = c, setTimeout(() => {
2537
2543
  this.currentFocus === e && (e.style.transition = "none");
@@ -2559,10 +2565,10 @@ class Ue {
2559
2565
  this.focusData.originalZIndex,
2560
2566
  this.focusData.originalWidth,
2561
2567
  this.focusData.originalHeight
2562
- ), 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;
2563
2569
  }
2564
2570
  }
2565
- const He = 50, Ne = 0.5, ke = 20, Be = 0.3, je = 150, We = 30, rt = class rt {
2571
+ const ke = 50, He = 0.5, Ne = 20, Be = 0.3, je = 150, We = 30, rt = class rt {
2566
2572
  constructor(t, i) {
2567
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);
2568
2574
  }
@@ -2606,9 +2612,9 @@ const He = 50, Ne = 0.5, ke = 20, Be = 0.3, je = 150, We = 30, rt = class rt {
2606
2612
  }
2607
2613
  handleTouchMove(t) {
2608
2614
  if (!this.touchState || t.touches.length !== 1) return;
2609
- const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
2610
- if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
2611
- const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2615
+ const i = t.touches[0], e = i.clientX - this.touchState.startX, o = i.clientY - this.touchState.startY;
2616
+ if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + o * o) > 10) {
2617
+ const a = Math.atan2(Math.abs(o), Math.abs(e)) * (180 / Math.PI);
2612
2618
  this.touchState.isHorizontalSwipe = a <= We;
2613
2619
  }
2614
2620
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
@@ -2620,9 +2626,9 @@ const He = 50, Ne = 0.5, ke = 20, Be = 0.3, je = 150, We = 30, rt = class rt {
2620
2626
  handleTouchEnd(t) {
2621
2627
  if (!this.touchState) return;
2622
2628
  this.recentTouchTimestamp = Date.now();
2623
- const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
2629
+ const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, o = Math.abs(i) / e, s = Math.abs(i);
2624
2630
  let r = !1;
2625
- this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= He || n >= Ne && s >= ke) && (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 >= ke || o >= He && s >= Ne) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2626
2632
  }
2627
2633
  handleTouchCancel(t) {
2628
2634
  this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
@@ -2644,7 +2650,7 @@ class Ge {
2644
2650
  for (const i of this.sources)
2645
2651
  if ("folders" in i)
2646
2652
  for (const e of i.folders) {
2647
- const n = i.recursive !== void 0 ? i.recursive : !0, s = await this.loadFromFolder(e, t, n);
2653
+ const o = i.recursive !== void 0 ? i.recursive : !0, s = await this.loadFromFolder(e, t, o);
2648
2654
  this._discoveredUrls.push(...s);
2649
2655
  }
2650
2656
  else if ("files" in i) {
@@ -2690,9 +2696,9 @@ class Ge {
2690
2696
  // Alternative format
2691
2697
  ];
2692
2698
  for (const e of i) {
2693
- const n = t.match(e);
2694
- if (n && n[1])
2695
- return n[1];
2699
+ const o = t.match(e);
2700
+ if (o && o[1])
2701
+ return o[1];
2696
2702
  }
2697
2703
  return null;
2698
2704
  }
@@ -2704,15 +2710,15 @@ class Ge {
2704
2710
  * @returns Promise resolving to array of image URLs
2705
2711
  */
2706
2712
  async loadFromFolder(t, i, e = !0) {
2707
- const n = this.extractFolderId(t);
2708
- if (!n)
2713
+ const o = this.extractFolderId(t);
2714
+ if (!o)
2709
2715
  throw new Error("Invalid Google Drive folder URL. Please check the URL format.");
2710
2716
  if (!this.apiKey || this.apiKey === "YOUR_API_KEY_HERE")
2711
- return this.loadImagesDirectly(n, i);
2717
+ return this.loadImagesDirectly(o, i);
2712
2718
  try {
2713
- return e ? await this.loadImagesRecursively(n, i) : await this.loadImagesFromSingleFolder(n, i);
2719
+ return e ? await this.loadImagesRecursively(o, i) : await this.loadImagesFromSingleFolder(o, i);
2714
2720
  } catch (s) {
2715
- return console.error("Error loading from Google Drive API:", s), this.loadImagesDirectly(n, i);
2721
+ return console.error("Error loading from Google Drive API:", s), this.loadImagesDirectly(o, i);
2716
2722
  }
2717
2723
  }
2718
2724
  /**
@@ -2722,13 +2728,13 @@ class Ge {
2722
2728
  * @returns Promise resolving to array of image URLs
2723
2729
  */
2724
2730
  async loadImagesFromSingleFolder(t, i) {
2725
- 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);
2731
+ const e = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2726
2732
  if (!a.ok)
2727
2733
  throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2728
- const l = (await a.json()).files.filter(
2734
+ const d = (await a.json()).files.filter(
2729
2735
  (u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
2730
2736
  );
2731
- 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) => {
2732
2738
  e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
2733
2739
  }), e;
2734
2740
  }
@@ -2740,10 +2746,10 @@ class Ge {
2740
2746
  */
2741
2747
  async loadFiles(t, i) {
2742
2748
  const e = [];
2743
- for (const n of t) {
2744
- const s = this.extractFileId(n);
2749
+ for (const o of t) {
2750
+ const s = this.extractFileId(o);
2745
2751
  if (!s) {
2746
- this.log(`Skipping invalid file URL: ${n}`);
2752
+ this.log(`Skipping invalid file URL: ${o}`);
2747
2753
  continue;
2748
2754
  }
2749
2755
  if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
@@ -2779,9 +2785,9 @@ class Ge {
2779
2785
  // Generic id parameter
2780
2786
  ];
2781
2787
  for (const e of i) {
2782
- const n = t.match(e);
2783
- if (n && n[1])
2784
- return n[1];
2788
+ const o = t.match(e);
2789
+ if (o && o[1])
2790
+ return o[1];
2785
2791
  }
2786
2792
  return null;
2787
2793
  }
@@ -2792,21 +2798,21 @@ class Ge {
2792
2798
  * @returns Promise resolving to array of image URLs
2793
2799
  */
2794
2800
  async loadImagesRecursively(t, i) {
2795
- 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);
2801
+ const e = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2796
2802
  if (!a.ok)
2797
2803
  throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2798
- const c = await a.json(), l = c.files.filter(
2799
- (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)
2800
2806
  ), u = c.files.filter(
2801
- (h) => h.mimeType === "application/vnd.google-apps.folder"
2807
+ (f) => f.mimeType === "application/vnd.google-apps.folder"
2802
2808
  );
2803
- 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) => {
2804
- 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}`);
2805
2811
  });
2806
- for (const h of u) {
2807
- this.log(`Loading images from subfolder: ${h.name}`);
2808
- const d = await this.loadImagesRecursively(h.id, i);
2809
- 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);
2810
2816
  }
2811
2817
  return e;
2812
2818
  }
@@ -2819,10 +2825,10 @@ class Ge {
2819
2825
  */
2820
2826
  async loadImagesDirectly(t, i) {
2821
2827
  try {
2822
- const e = `https://drive.google.com/embeddedfolderview?id=${t}`, n = await fetch(e, { mode: "cors" });
2823
- if (!n.ok)
2828
+ const e = `https://drive.google.com/embeddedfolderview?id=${t}`, o = await fetch(e, { mode: "cors" });
2829
+ if (!o.ok)
2824
2830
  throw new Error("Cannot access folder directly (CORS or permissions issue)");
2825
- const s = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(r)];
2831
+ const s = await o.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(r)];
2826
2832
  return [...new Set(a.map((u) => u[1]))].map(
2827
2833
  (u) => `https://drive.google.com/uc?export=view&id=${u}`
2828
2834
  );
@@ -2915,13 +2921,13 @@ class qe {
2915
2921
  if (!Array.isArray(t))
2916
2922
  return console.warn("URLs must be an array:", t), [];
2917
2923
  const e = [];
2918
- for (const n of t) {
2919
- const s = n.split("/").pop() || n;
2924
+ for (const o of t) {
2925
+ const s = o.split("/").pop() || o;
2920
2926
  if (!i.isAllowed(s)) {
2921
- this.log(`Skipping filtered URL: ${n}`);
2927
+ this.log(`Skipping filtered URL: ${o}`);
2922
2928
  continue;
2923
2929
  }
2924
- this.validateUrls ? await this.validateUrl(n) ? e.push(n) : console.warn(`Skipping invalid/missing URL: ${n}`) : e.push(n);
2930
+ this.validateUrls ? await this.validateUrl(o) ? e.push(o) : console.warn(`Skipping invalid/missing URL: ${o}`) : e.push(o);
2925
2931
  }
2926
2932
  return e;
2927
2933
  }
@@ -2935,16 +2941,16 @@ class qe {
2935
2941
  async processPath(t, i, e) {
2936
2942
  if (!Array.isArray(i))
2937
2943
  return console.warn("files must be an array:", i), [];
2938
- const n = [];
2944
+ const o = [];
2939
2945
  for (const s of i) {
2940
2946
  if (!e.isAllowed(s)) {
2941
2947
  this.log(`Skipping filtered file: ${s}`);
2942
2948
  continue;
2943
2949
  }
2944
2950
  const r = this.constructUrl(t, s);
2945
- this.validateUrls ? await this.validateUrl(r) ? n.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : n.push(r);
2951
+ this.validateUrls ? await this.validateUrl(r) ? o.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : o.push(r);
2946
2952
  }
2947
- return n;
2953
+ return o;
2948
2954
  }
2949
2955
  /**
2950
2956
  * Process a JSON endpoint source
@@ -2955,17 +2961,17 @@ class qe {
2955
2961
  */
2956
2962
  async processJson(t, i) {
2957
2963
  this.log(`Fetching JSON endpoint: ${t}`);
2958
- const e = new AbortController(), n = setTimeout(() => e.abort(), 1e4);
2964
+ const e = new AbortController(), o = setTimeout(() => e.abort(), 1e4);
2959
2965
  try {
2960
2966
  const s = await fetch(t, { signal: e.signal });
2961
- if (clearTimeout(n), !s.ok)
2967
+ if (clearTimeout(o), !s.ok)
2962
2968
  throw new Error(`HTTP ${s.status} fetching ${t}`);
2963
2969
  const r = await s.json();
2964
2970
  if (!r || !Array.isArray(r.images))
2965
2971
  throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
2966
2972
  return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, i);
2967
2973
  } catch (s) {
2968
- throw clearTimeout(n), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : s;
2974
+ throw clearTimeout(o), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : s;
2969
2975
  }
2970
2976
  }
2971
2977
  /**
@@ -2987,11 +2993,11 @@ class qe {
2987
2993
  if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
2988
2994
  return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
2989
2995
  try {
2990
- const e = new AbortController(), n = setTimeout(() => e.abort(), this.validationTimeout), s = await fetch(t, {
2996
+ const e = new AbortController(), o = setTimeout(() => e.abort(), this.validationTimeout), s = await fetch(t, {
2991
2997
  method: "HEAD",
2992
2998
  signal: e.signal
2993
2999
  });
2994
- return clearTimeout(n), s.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${s.status}`), !1);
3000
+ return clearTimeout(o), s.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${s.status}`), !1);
2995
3001
  } catch (e) {
2996
3002
  return e instanceof Error && (e.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, e.message)), !1;
2997
3003
  }
@@ -3008,8 +3014,8 @@ class qe {
3008
3014
  return `${e}/${i}`;
3009
3015
  if (typeof window > "u")
3010
3016
  return `${e}/${i}`;
3011
- const n = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
3012
- return `${n}${r}/${i}`;
3017
+ const o = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
3018
+ return `${o}${r}/${i}`;
3013
3019
  }
3014
3020
  /**
3015
3021
  * Check if URL is absolute (contains protocol)
@@ -3031,7 +3037,7 @@ class qe {
3031
3037
  this.debugLogging && typeof console < "u" && console.log(...t);
3032
3038
  }
3033
3039
  }
3034
- class Xe {
3040
+ class Ye {
3035
3041
  constructor(t) {
3036
3042
  if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
3037
3043
  throw new Error("CompositeLoader requires at least one loader to be configured");
@@ -3043,16 +3049,16 @@ class Xe {
3043
3049
  */
3044
3050
  async prepare(t) {
3045
3051
  this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
3046
- const i = this.loaders.map((e, n) => e.prepare(t).then(() => {
3047
- this.log(`Loader ${n} prepared with ${e.imagesLength()} images`);
3052
+ const i = this.loaders.map((e, o) => e.prepare(t).then(() => {
3053
+ this.log(`Loader ${o} prepared with ${e.imagesLength()} images`);
3048
3054
  }).catch((s) => {
3049
- console.warn(`Loader ${n} failed to prepare:`, s);
3055
+ console.warn(`Loader ${o} failed to prepare:`, s);
3050
3056
  }));
3051
3057
  await Promise.all(i);
3052
3058
  for (const e of this.loaders)
3053
3059
  if (e.isPrepared()) {
3054
- const n = e.imageURLs();
3055
- this._discoveredUrls.push(...n);
3060
+ const o = e.imageURLs();
3061
+ this._discoveredUrls.push(...o);
3056
3062
  }
3057
3063
  this._prepared = !0, this.log(`CompositeLoader prepared with ${this._discoveredUrls.length} total images`);
3058
3064
  }
@@ -3088,7 +3094,7 @@ class Xe {
3088
3094
  this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
3089
3095
  }
3090
3096
  }
3091
- class Ye {
3097
+ class Xe {
3092
3098
  /**
3093
3099
  * Create a new ImageFilter
3094
3100
  * @param extensions - Array of allowed file extensions (without dots)
@@ -3125,7 +3131,7 @@ class Ye {
3125
3131
  // isAllowedDate(date: Date): boolean
3126
3132
  // isAllowedDimensions(width: number, height: number): boolean
3127
3133
  }
3128
- const Je = `
3134
+ const Ve = `
3129
3135
  .fbn-ic-gallery {
3130
3136
  position: relative;
3131
3137
  width: 100%;
@@ -3206,20 +3212,20 @@ const Je = `
3206
3212
  display: none !important;
3207
3213
  }
3208
3214
  `;
3209
- function Ve() {
3215
+ function Je() {
3210
3216
  if (typeof document > "u") return;
3211
- const o = "fbn-ic-functional-styles";
3212
- if (document.getElementById(o)) return;
3217
+ const n = "fbn-ic-functional-styles";
3218
+ if (document.getElementById(n)) return;
3213
3219
  const t = document.createElement("style");
3214
- t.id = o, t.textContent = Je, document.head.appendChild(t);
3220
+ t.id = n, t.textContent = Ve, document.head.appendChild(t);
3215
3221
  }
3216
3222
  class Ke {
3217
3223
  constructor(t = {}) {
3218
- this.fullConfig = Vt(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 te(this.fullConfig.animation), this.layoutEngine = new Me({
3224
+ this.fullConfig = Jt(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 te(this.fullConfig.animation), this.layoutEngine = new Fe({
3219
3225
  layout: this.fullConfig.layout,
3220
3226
  image: this.fullConfig.image
3221
3227
  }), this.zoomEngine = new Ue(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;
3222
- const i = this.fullConfig.animation.entry || C.animation.entry;
3228
+ const i = this.fullConfig.animation.entry || L.animation.entry;
3223
3229
  this.entryAnimationEngine = new de(
3224
3230
  i,
3225
3231
  this.fullConfig.layout.algorithm
@@ -3228,15 +3234,24 @@ class Ke {
3228
3234
  e && e.type !== "none" ? this.idleAnimationEngine = new ue(
3229
3235
  e,
3230
3236
  i.timing?.duration ?? 600
3231
- ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
3232
- this.idleAnimationEngine?.resumeForImage(n);
3233
- const s = n;
3237
+ ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((o) => {
3238
+ this.idleAnimationEngine?.resumeForImage(o);
3239
+ const s = o, 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
+ }
3234
3249
  requestAnimationFrame(() => {
3235
3250
  if (s.matches(":hover") && this.fullConfig.styling?.hover) {
3236
- const r = this.imageElements.indexOf(s);
3237
- if (r !== -1) {
3238
- const a = s.offsetHeight, c = s.cachedRenderedWidth;
3239
- 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] };
3240
3255
  }
3241
3256
  }
3242
3257
  });
@@ -3247,7 +3262,7 @@ class Ke {
3247
3262
  */
3248
3263
  createImageFilter() {
3249
3264
  const t = this.fullConfig.config.loaders?.allowedExtensions;
3250
- return new Ye(t);
3265
+ return new Xe(t);
3251
3266
  }
3252
3267
  /**
3253
3268
  * Create appropriate image loader based on config
@@ -3257,8 +3272,8 @@ class Ke {
3257
3272
  const t = this.fullConfig.loaders, i = this.fullConfig.config.loaders ?? {};
3258
3273
  if (!t || t.length === 0)
3259
3274
  throw new Error("No loaders configured. Provide `images`, `loaders`, or both.\n Example: imageCloud({ container: 'id', images: ['https://...'] })");
3260
- const e = t.map((n) => this.createLoaderFromEntry(n, i));
3261
- return e.length === 1 ? e[0] : new Xe({
3275
+ const e = t.map((o) => this.createLoaderFromEntry(o, i));
3276
+ return e.length === 1 ? e[0] : new Ye({
3262
3277
  loaders: e,
3263
3278
  debugLogging: this.fullConfig.config.debug?.loaders
3264
3279
  });
@@ -3268,7 +3283,7 @@ class Ke {
3268
3283
  */
3269
3284
  createLoaderFromEntry(t, i) {
3270
3285
  if ("static" in t) {
3271
- const e = t.static, n = {
3286
+ const e = t.static, o = {
3272
3287
  ...e,
3273
3288
  validateUrls: e.validateUrls ?? i.validateUrls,
3274
3289
  validationTimeout: e.validationTimeout ?? i.validationTimeout,
@@ -3276,14 +3291,14 @@ class Ke {
3276
3291
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3277
3292
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3278
3293
  };
3279
- return new qe(n);
3294
+ return new qe(o);
3280
3295
  } else if ("googleDrive" in t) {
3281
- const e = t.googleDrive, n = {
3296
+ const e = t.googleDrive, o = {
3282
3297
  ...e,
3283
3298
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3284
3299
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3285
3300
  };
3286
- return new Ge(n);
3301
+ return new Ge(o);
3287
3302
  } else
3288
3303
  throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
3289
3304
  }
@@ -3292,7 +3307,7 @@ class Ke {
3292
3307
  */
3293
3308
  async init() {
3294
3309
  try {
3295
- if (Ve(), this.containerRef)
3310
+ if (Je(), this.containerRef)
3296
3311
  this.containerEl = this.containerRef;
3297
3312
  else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
3298
3313
  throw new Error(`Container "#${this.containerId}" not found. Ensure an element with id="${this.containerId}" exists in the DOM before calling imageCloud().`);
@@ -3356,7 +3371,7 @@ class Ke {
3356
3371
  navigateToNextImage() {
3357
3372
  if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
3358
3373
  const t = (this.currentFocusIndex + 1) % this.imageLayouts.length, i = this.imageElements.find(
3359
- (n) => n.dataset.imageId === String(t)
3374
+ (o) => o.dataset.imageId === String(t)
3360
3375
  );
3361
3376
  if (!i) return;
3362
3377
  const e = this.imageLayouts[t];
@@ -3368,7 +3383,7 @@ class Ke {
3368
3383
  navigateToPreviousImage() {
3369
3384
  if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
3370
3385
  const t = (this.currentFocusIndex - 1 + this.imageLayouts.length) % this.imageLayouts.length, i = this.imageElements.find(
3371
- (n) => n.dataset.imageId === String(t)
3386
+ (o) => o.dataset.imageId === String(t)
3372
3387
  );
3373
3388
  if (!i) return;
3374
3389
  const e = this.imageLayouts[t];
@@ -3384,8 +3399,8 @@ class Ke {
3384
3399
  }, 500));
3385
3400
  }
3386
3401
  getImageHeight() {
3387
- const t = window.innerWidth, i = this.fullConfig.layout.responsive, n = this.fullConfig.image.sizing?.maxSize ?? 400;
3388
- return i ? t <= i.mobile.maxWidth ? Math.min(100, n) : t <= i.tablet.maxWidth ? Math.min(180, n) : Math.min(225, n) : t <= 767 ? Math.min(100, n) : t <= 1199 ? Math.min(180, n) : Math.min(225, n);
3402
+ const t = window.innerWidth, i = this.fullConfig.layout.responsive, o = this.fullConfig.image.sizing?.maxSize ?? 400;
3403
+ return i ? t <= i.mobile.maxWidth ? Math.min(100, o) : t <= i.tablet.maxWidth ? Math.min(180, o) : Math.min(225, o) : t <= 767 ? Math.min(100, o) : t <= 1199 ? Math.min(180, o) : Math.min(225, o);
3389
3404
  }
3390
3405
  /**
3391
3406
  * Get container bounds for layout calculations
@@ -3408,12 +3423,12 @@ class Ke {
3408
3423
  this.showError("No images found."), this.showLoading(!1);
3409
3424
  return;
3410
3425
  }
3411
- const e = this.getContainerBounds(), n = this.getImageHeight(), s = window.innerWidth;
3412
- this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${n}px`);
3426
+ const e = this.getContainerBounds(), o = this.getImageHeight(), s = window.innerWidth;
3427
+ this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${o}px`);
3413
3428
  const r = this.layoutEngine.calculateAdaptiveSize(
3414
3429
  e,
3415
3430
  t,
3416
- n,
3431
+ o,
3417
3432
  s
3418
3433
  );
3419
3434
  this.logDebug(`Adaptive sizing result: height=${r.height}px`), await this.createImageCloud(i, r.height), this.showLoading(!1), this.imagesLoaded = !0;
@@ -3431,148 +3446,288 @@ class Ke {
3431
3446
  if (!this.containerEl) return;
3432
3447
  const e = this.getContainerBounds();
3433
3448
  this.currentImageHeight = i;
3434
- const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3435
- this.imageLayouts = s, this.displayQueue = [];
3436
- let r = 0;
3437
- const a = (l) => {
3438
- this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(() => {
3439
- if (l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1", l.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)) {
3440
- const d = {
3441
- x: parseFloat(l.dataset.startX),
3442
- y: parseFloat(l.dataset.startY)
3443
- }, g = {
3444
- x: parseFloat(l.dataset.endX),
3445
- y: parseFloat(l.dataset.endY)
3446
- }, p = parseFloat(l.dataset.imageWidth), b = 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();
3449
+ const o = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
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 || o !== 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"), x = parseFloat(l.dataset.startY || "0"), E = 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 = {
3479
+ element: l,
3480
+ index: g,
3481
+ totalImages: this.imageLayouts.length,
3482
+ layout: h,
3483
+ from: { x: y, y: x, rotation: T, scale: z },
3484
+ to: { x: E, 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)
3447
3491
  ce({
3448
3492
  element: l,
3449
- startPosition: d,
3450
- endPosition: g,
3493
+ startPosition: { x: y, y: x },
3494
+ endPosition: { x: E, y: F },
3451
3495
  pathConfig: this.entryAnimationEngine.getPathConfig(),
3452
- duration: v.duration,
3453
- imageWidth: p,
3454
- imageHeight: b,
3455
- rotation: f,
3456
- scale: m,
3496
+ duration: b.duration,
3497
+ imageWidth: k,
3498
+ imageHeight: D,
3499
+ rotation: R,
3500
+ scale: M,
3457
3501
  rotationConfig: this.entryAnimationEngine.getRotationConfig(),
3458
- startRotation: y,
3502
+ startRotation: T,
3459
3503
  scaleConfig: this.entryAnimationEngine.getScaleConfig(),
3460
- startScale: E
3504
+ startScale: z,
3505
+ onProgress: this.callbacks.onEntryProgress && h ? (S, _, $) => {
3506
+ const A = {
3507
+ element: l,
3508
+ index: g,
3509
+ totalImages: this.imageLayouts.length,
3510
+ layout: h,
3511
+ from: { x: y, y: x, rotation: T, scale: z },
3512
+ to: { x: E, y: F, rotation: R, scale: M },
3513
+ startTime: I,
3514
+ duration: b.duration,
3515
+ progress: S,
3516
+ rawProgress: S,
3517
+ elapsed: _,
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
3461
3535
  });
3462
- } else {
3463
- const d = l.dataset.finalTransform || "";
3464
- l.style.transform = d;
3536
+ else {
3537
+ const S = l.dataset.finalTransform || "";
3538
+ if (l.style.transform = S, this.callbacks.onEntryComplete && h) {
3539
+ const _ = ($) => {
3540
+ if ($.propertyName !== "transform") return;
3541
+ l.removeEventListener("transitionend", _);
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", _);
3553
+ }
3465
3554
  }
3466
- const h = parseInt(l.dataset.imageId || "0");
3467
- if (this.fullConfig.config.debug?.enabled && h < 3) {
3468
- const d = l.dataset.finalTransform || "";
3469
- 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:`, {
3470
3558
  left: l.style.left,
3471
3559
  top: l.style.top,
3472
3560
  width: l.style.width,
3473
3561
  height: l.style.height,
3474
3562
  computedWidth: l.offsetWidth,
3475
3563
  computedHeight: l.offsetHeight,
3476
- transform: d,
3564
+ transform: S,
3477
3565
  pathType: this.entryAnimationEngine.getPathType()
3478
3566
  });
3479
3567
  }
3480
3568
  if (this.idleAnimationEngine) {
3481
- const d = this.entryAnimationEngine.getTiming().duration;
3482
- 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);
3483
3571
  }
3484
- }), r++);
3485
- }, c = () => {
3572
+ }), r++, p());
3573
+ }, v = () => {
3486
3574
  if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
3487
3575
  for (; this.displayQueue.length > 0; ) {
3488
3576
  const l = this.displayQueue.shift();
3489
- l && a(l);
3577
+ l && w(l);
3490
3578
  }
3491
3579
  return;
3492
3580
  }
3493
3581
  this.queueInterval !== null && clearInterval(this.queueInterval), this.queueInterval = window.setInterval(() => {
3494
- if (n !== this.loadGeneration) {
3582
+ if (o !== this.loadGeneration) {
3495
3583
  this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
3496
3584
  return;
3497
3585
  }
3498
3586
  if (this.displayQueue.length > 0) {
3499
3587
  const l = this.displayQueue.shift();
3500
- l && a(l);
3588
+ l && w(l);
3501
3589
  }
3502
- 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());
3503
3591
  }, this.fullConfig.animation.queue.interval);
3504
3592
  };
3505
3593
  if ("IntersectionObserver" in window && this.containerEl) {
3506
- const l = new IntersectionObserver((u) => {
3507
- u.forEach((h) => {
3508
- h.isIntersecting && (c(), l.disconnect());
3594
+ const l = new IntersectionObserver((g) => {
3595
+ g.forEach((h) => {
3596
+ h.isIntersecting && (v(), l.disconnect());
3509
3597
  });
3510
3598
  }, { threshold: 0.1, rootMargin: "50px" });
3511
3599
  l.observe(this.containerEl);
3512
3600
  } else
3513
- c();
3514
- 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) => {
3515
3603
  const h = document.createElement("div");
3516
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";
3517
- const d = l.x, g = l.y;
3518
- h.style.left = `${d - 6}px`, h.style.top = `${g - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(g)})`, this.containerEl.appendChild(h);
3519
- })), 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) => {
3520
3608
  const h = document.createElement("img");
3521
- h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
3522
- const d = s[u];
3523
- h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3524
- if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
3525
- const g = h.cachedRenderedWidth;
3526
- 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);
3527
3619
  }
3528
3620
  }), h.addEventListener("mouseleave", () => {
3529
3621
  if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
3530
- const g = h.cachedRenderedWidth;
3531
- 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);
3532
3628
  }
3533
- }), h.addEventListener("click", (g) => {
3534
- g.stopPropagation(), this.handleImageClick(h, d);
3629
+ }), h.addEventListener("click", (y) => {
3630
+ y.stopPropagation(), this.handleImageClick(h, b);
3535
3631
  }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
3536
- if (n !== this.loadGeneration)
3632
+ if (o !== this.loadGeneration)
3537
3633
  return;
3538
- const g = h.naturalWidth / h.naturalHeight, p = i * g;
3539
- h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${p}`), h.style.width = `${p}px`, h.cachedRenderedWidth = p, h.aspectRatio = g, st(h, this.fullConfig.styling?.default, i, p);
3540
- const b = { x: d.x, y: d.y }, f = { width: p, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
3541
- b,
3542
- f,
3634
+ const y = h.naturalWidth / h.naturalHeight, x = i * y;
3635
+ h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${g}] Called with imageHeight=${i}, renderedWidth=${x}`), h.style.width = `${x}px`, h.cachedRenderedWidth = x, h.aspectRatio = y, st(h, this.fullConfig.styling?.default, i, x);
3636
+ const E = { x: b.x, y: b.y }, F = { width: x, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
3637
+ E,
3638
+ F,
3543
3639
  e,
3544
- u,
3640
+ g,
3545
3641
  t.length
3546
- ), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), E = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
3547
- d.rotation,
3548
- d.scale,
3549
- p,
3642
+ ), M = this.entryAnimationEngine.calculateStartRotation(b.rotation), T = this.entryAnimationEngine.calculateStartScale(b.scale), z = this.entryAnimationEngine.buildFinalTransform(
3643
+ b.rotation,
3644
+ b.scale,
3645
+ x,
3550
3646
  i
3551
- ), S = this.entryAnimationEngine.buildStartTransform(
3552
- m,
3553
- b,
3554
- d.rotation,
3555
- d.scale,
3556
- p,
3647
+ ), k = this.entryAnimationEngine.buildStartTransform(
3648
+ R,
3649
+ E,
3650
+ b.rotation,
3651
+ b.scale,
3652
+ x,
3557
3653
  i,
3558
- y,
3559
- E
3654
+ M,
3655
+ T
3560
3656
  );
3561
- this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
3562
- finalPosition: b,
3563
- imageSize: f,
3564
- left: d.x,
3565
- top: d.y,
3566
- finalTransform: v,
3567
- renderedWidth: p,
3657
+ if (this.fullConfig.config.debug?.enabled && g < 3 && console.log(`Image ${g}:`, {
3658
+ finalPosition: E,
3659
+ imageSize: F,
3660
+ left: b.x,
3661
+ top: b.y,
3662
+ finalTransform: z,
3663
+ renderedWidth: x,
3568
3664
  renderedHeight: i
3569
- }), 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(b.x), h.dataset.endY = String(b.y), h.dataset.imageWidth = String(p), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(E)), this.displayQueue.push(h);
3570
- }, 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(E.x), h.dataset.endY = String(E.y), h.dataset.imageWidth = String(x), 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 (o === 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 x = { url: l, index: g, totalImages: t.length }, E = await this.callbacks.onBeforeImageLoad(x);
3708
+ if (E)
3709
+ if (E.fetch !== void 0) {
3710
+ const F = E.url ?? l;
3711
+ try {
3712
+ const M = await (await fetch(F, E.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 E.url && (y = E.url);
3723
+ }
3724
+ d === 0 && (d = performance.now()), f.set(g, performance.now()), h.src = y;
3725
+ })();
3571
3726
  });
3572
3727
  }
3573
3728
  async handleImageClick(t, i) {
3574
3729
  if (!this.containerEl) return;
3575
- const e = this.zoomEngine.isFocused(t), n = {
3730
+ const e = this.zoomEngine.isFocused(t), o = {
3576
3731
  width: this.containerEl.offsetWidth,
3577
3732
  height: this.containerEl.offsetHeight
3578
3733
  };
@@ -3581,7 +3736,15 @@ class Ke {
3581
3736
  else {
3582
3737
  this.idleAnimationEngine?.pauseForImage(t);
3583
3738
  const s = t.dataset.imageId;
3584
- 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, o, 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
+ }
3585
3748
  }
3586
3749
  }
3587
3750
  /**
@@ -3624,36 +3787,36 @@ class Ke {
3624
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;
3625
3788
  }
3626
3789
  }
3627
- async function Ze(o) {
3628
- const t = new Ke(o);
3790
+ async function Ze(n) {
3791
+ const t = new Ke(n);
3629
3792
  return await t.init(), t;
3630
3793
  }
3631
3794
  export {
3632
3795
  te as AnimationEngine,
3633
- It as BOUNCE_PRESETS,
3634
- we as ClusterPlacementLayout,
3635
- Xe as CompositeLoader,
3636
- C as DEFAULT_CONFIG,
3796
+ St as BOUNCE_PRESETS,
3797
+ Ee as ClusterPlacementLayout,
3798
+ Ye as CompositeLoader,
3799
+ L as DEFAULT_CONFIG,
3637
3800
  Ot as DEFAULT_SHARED_LOADER_CONFIG,
3638
3801
  Ct as ELASTIC_PRESETS,
3639
3802
  de as EntryAnimationEngine,
3640
- Je as FUNCTIONAL_CSS,
3803
+ Ve as FUNCTIONAL_CSS,
3641
3804
  Ge as GoogleDriveLoader,
3642
3805
  pe as GridPlacementLayout,
3643
3806
  Le as HoneycombPlacementLayout,
3644
3807
  Ke as ImageCloud,
3645
- Ye as ImageFilter,
3646
- Me as LayoutEngine,
3808
+ Xe as ImageFilter,
3809
+ Fe as LayoutEngine,
3647
3810
  ge as RadialPlacementLayout,
3648
3811
  fe as RandomPlacementLayout,
3649
3812
  ve as SpiralPlacementLayout,
3650
3813
  qe as StaticImageLoader,
3651
- At as WAVE_PATH_PRESETS,
3652
- xe as WavePlacementLayout,
3814
+ Rt as WAVE_PATH_PRESETS,
3815
+ we as WavePlacementLayout,
3653
3816
  Ue as ZoomEngine,
3654
3817
  ce as animatePath,
3655
3818
  Ze as imageCloud,
3656
- Ve as injectFunctionalStyles,
3819
+ Je as injectFunctionalStyles,
3657
3820
  le as requiresJSAnimation
3658
3821
  };
3659
3822
  //# sourceMappingURL=image-cloud.js.map