@frybynite/image-cloud 0.8.3 → 0.9.1

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.
@@ -22,9 +22,9 @@ const mt = Object.freeze({
22
22
  type: "linear"
23
23
  }), wt = Object.freeze({
24
24
  mode: "none"
25
- }), xt = Object.freeze({
25
+ }), Et = Object.freeze({
26
26
  mode: "none"
27
- }), zt = Object.freeze({
27
+ }), Ot = Object.freeze({
28
28
  default: Object.freeze({
29
29
  border: Object.freeze({
30
30
  width: 0,
@@ -50,7 +50,7 @@ const mt = Object.freeze({
50
50
  focused: Object.freeze({
51
51
  shadow: "none"
52
52
  })
53
- }), Ht = Object.freeze({
53
+ }), kt = Object.freeze({
54
54
  tightness: 1
55
55
  }), Nt = Object.freeze({
56
56
  rows: 1,
@@ -61,10 +61,10 @@ const mt = Object.freeze({
61
61
  // Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
62
62
  }), jt = Object.freeze({
63
63
  spacing: 0
64
- }), kt = Object.freeze({
64
+ }), Wt = Object.freeze({
65
65
  mobile: Object.freeze({ maxWidth: 767 }),
66
66
  tablet: Object.freeze({ maxWidth: 1199 })
67
- }), Wt = Object.freeze({
67
+ }), Gt = Object.freeze({
68
68
  mode: "adaptive",
69
69
  // Default to adaptive sizing
70
70
  minSize: 50,
@@ -76,40 +76,40 @@ const mt = Object.freeze({
76
76
  // No variance by default
77
77
  max: 1
78
78
  })
79
- }), Gt = Object.freeze({
79
+ }), qt = Object.freeze({
80
80
  mode: "none",
81
81
  range: Object.freeze({
82
82
  min: -15,
83
83
  max: 15
84
84
  })
85
- }), Ot = Object.freeze({
86
- sizing: Wt,
87
- rotation: Gt
85
+ }), zt = Object.freeze({
86
+ sizing: Gt,
87
+ rotation: qt
88
88
  }), Dt = Object.freeze({
89
89
  validateUrls: !0,
90
90
  validationTimeout: 5e3,
91
91
  validationMethod: "head",
92
92
  allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
93
- }), $t = Object.freeze({
93
+ }), _t = Object.freeze({
94
94
  enabled: !1,
95
95
  centers: !1,
96
96
  loaders: !1
97
- }), E = Object.freeze({
97
+ }), Bt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Xt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Yt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Jt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), x = Object.freeze({
98
98
  // Loader configuration (always an array, composite behavior is implicit)
99
99
  loaders: [],
100
100
  // Shared loader settings and debug config
101
101
  config: Object.freeze({
102
102
  loaders: Dt,
103
- debug: $t
103
+ debug: _t
104
104
  }),
105
105
  // Image sizing and rotation configuration
106
- image: Ot,
106
+ image: zt,
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: Wt,
113
113
  targetCoverage: 0.6,
114
114
  // Target 60% of container area
115
115
  densityFactor: 1,
@@ -136,10 +136,8 @@ const mt = Object.freeze({
136
136
  queue: Object.freeze({
137
137
  enabled: !0,
138
138
  // When false, all images display simultaneously
139
- interval: 150,
139
+ interval: 150
140
140
  // ms between processing queue items (when enabled)
141
- maxConcurrent: void 0
142
- // STUB: Not implemented yet
143
141
  }),
144
142
  performance: Object.freeze({
145
143
  useGPU: void 0,
@@ -167,8 +165,9 @@ const mt = Object.freeze({
167
165
  // smooth deceleration
168
166
  path: vt,
169
167
  rotation: wt,
170
- scale: xt
171
- })
168
+ scale: Et
169
+ }),
170
+ idle: $t
172
171
  }),
173
172
  // Pattern-based interaction configuration
174
173
  interaction: Object.freeze({
@@ -192,7 +191,8 @@ const mt = Object.freeze({
192
191
  // STUB: Not implemented yet
193
192
  doubleTapToFocus: void 0
194
193
  // STUB: Not implemented yet
195
- })
194
+ }),
195
+ disableDragging: !1
196
196
  }),
197
197
  // Pattern-based rendering configuration
198
198
  rendering: Object.freeze({
@@ -212,50 +212,50 @@ const mt = Object.freeze({
212
212
  })
213
213
  }),
214
214
  // Image styling
215
- styling: zt
215
+ styling: Ot
216
216
  });
217
- function Z(n, t) {
218
- if (!n) return t || {};
219
- if (!t) return { ...n };
220
- const i = { ...n };
221
- 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;
217
+ function Z(o, t) {
218
+ if (!o) return t || {};
219
+ if (!t) return { ...o };
220
+ const i = { ...o };
221
+ 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;
222
222
  }
223
- function qt(n, t) {
224
- if (!t) return { ...n };
225
- const i = Z(n.default, t.default), e = Z(
226
- Z(i, n.hover),
223
+ function Vt(o, t) {
224
+ if (!t) return { ...o };
225
+ const i = Z(o.default, t.default), e = Z(
226
+ Z(i, o.hover),
227
227
  t.hover
228
- ), o = Z(
229
- Z(i, n.focused),
228
+ ), n = Z(
229
+ Z(i, o.focused),
230
230
  t.focused
231
231
  );
232
232
  return {
233
233
  default: i,
234
234
  hover: e,
235
- focused: o
235
+ focused: n
236
236
  };
237
237
  }
238
- function Xt(n, t) {
239
- if (!t) return { ...n };
240
- const i = { ...n };
238
+ function Kt(o, t) {
239
+ if (!t) return { ...o };
240
+ const i = { ...o };
241
241
  if (t.sizing !== void 0 && (i.sizing = {
242
- ...n.sizing,
242
+ ...o.sizing,
243
243
  ...t.sizing
244
244
  }, t.sizing.variance)) {
245
- const e = t.sizing.variance, o = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : n.sizing?.variance?.min ?? 1, a = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : n.sizing?.variance?.max ?? 1;
246
- i.sizing.variance = { min: o, max: a };
245
+ const e = t.sizing.variance, n = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : o.sizing?.variance?.min ?? 1, a = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : o.sizing?.variance?.max ?? 1;
246
+ i.sizing.variance = { min: n, max: a };
247
247
  }
248
248
  if (t.rotation !== void 0 && (i.rotation = {
249
- ...n.rotation,
249
+ ...o.rotation,
250
250
  ...t.rotation
251
251
  }, t.rotation.range)) {
252
- const e = t.rotation.range, o = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : n.rotation?.range?.min ?? -15, a = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : n.rotation?.range?.max ?? 15;
253
- i.rotation.range = { min: o, max: a };
252
+ const e = t.rotation.range, n = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : o.rotation?.range?.min ?? -15, a = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : o.rotation?.range?.max ?? 15;
253
+ i.rotation.range = { min: n, max: a };
254
254
  }
255
255
  return i;
256
256
  }
257
- function Yt(n) {
258
- const t = n.layout?.rotation;
257
+ function Zt(o) {
258
+ const t = o.layout?.rotation;
259
259
  if (t && "enabled" in t)
260
260
  return {
261
261
  rotation: {
@@ -264,8 +264,8 @@ function Yt(n) {
264
264
  }
265
265
  };
266
266
  }
267
- function Bt(n) {
268
- const t = n.layout?.sizing?.variance;
267
+ function Qt(o) {
268
+ const t = o.layout?.sizing?.variance;
269
269
  if (t)
270
270
  return {
271
271
  sizing: {
@@ -275,98 +275,101 @@ function Bt(n) {
275
275
  }
276
276
  };
277
277
  }
278
- function Jt(n = {}) {
279
- const t = Yt(n), i = Bt(n);
280
- let e = n.image;
278
+ function te(o = {}) {
279
+ const t = Zt(o), i = Qt(o);
280
+ let e = o.image;
281
281
  (t || i) && (e = {
282
282
  ...i || {},
283
283
  ...t || {},
284
284
  ...e
285
- }, e.rotation && t?.rotation && n.image?.rotation && (e.rotation = {
285
+ }, e.rotation && t?.rotation && o.image?.rotation && (e.rotation = {
286
286
  ...t.rotation,
287
- ...n.image.rotation
287
+ ...o.image.rotation
288
288
  }));
289
- const o = [...n.loaders ?? []];
290
- n.images && n.images.length > 0 && o.unshift({
289
+ const n = [...o.loaders ?? []];
290
+ o.images && o.images.length > 0 && n.unshift({
291
291
  static: {
292
- sources: [{ urls: n.images }]
292
+ sources: [{ urls: o.images }]
293
293
  }
294
294
  });
295
295
  const r = {
296
296
  loaders: {
297
297
  ...Dt,
298
- ...n.config?.loaders ?? {}
298
+ ...o.config?.loaders ?? {}
299
299
  }
300
300
  }, s = {
301
- loaders: o,
301
+ loaders: n,
302
302
  config: r,
303
- image: Xt(Ot, e),
304
- layout: { ...E.layout },
305
- animation: { ...E.animation },
306
- interaction: { ...E.interaction },
307
- rendering: { ...E.rendering },
308
- styling: qt(zt, n.styling)
303
+ image: Kt(zt, e),
304
+ layout: { ...x.layout },
305
+ animation: { ...x.animation },
306
+ interaction: { ...x.interaction },
307
+ rendering: { ...x.rendering },
308
+ styling: Vt(Ot, o.styling)
309
309
  };
310
- if (n.layout && (s.layout = {
311
- ...E.layout,
312
- ...n.layout
313
- }, n.layout.responsive && (s.layout.responsive = {
314
- ...E.layout.responsive,
315
- mobile: n.layout.responsive.mobile ? { ...E.layout.responsive.mobile, ...n.layout.responsive.mobile } : E.layout.responsive.mobile,
316
- tablet: n.layout.responsive.tablet ? { ...E.layout.responsive.tablet, ...n.layout.responsive.tablet } : E.layout.responsive.tablet
317
- }), n.layout.spacing && (s.layout.spacing = {
318
- ...E.layout.spacing,
319
- ...n.layout.spacing
320
- })), n.animation && (s.animation = {
321
- ...E.animation,
322
- ...n.animation
323
- }, n.animation.easing && (s.animation.easing = {
324
- ...E.animation.easing,
325
- ...n.animation.easing
326
- }), n.animation.queue && (s.animation.queue = {
327
- ...E.animation.queue,
328
- ...n.animation.queue
329
- }), n.animation.performance && (s.animation.performance = {
330
- ...E.animation.performance,
331
- ...n.animation.performance
332
- }), n.animation.entry && (s.animation.entry = {
333
- ...E.animation.entry,
334
- ...n.animation.entry,
335
- start: n.animation.entry.start ? {
336
- ...E.animation.entry.start,
337
- ...n.animation.entry.start,
338
- circular: n.animation.entry.start.circular ? { ...E.animation.entry.start.circular, ...n.animation.entry.start.circular } : E.animation.entry.start.circular
339
- } : E.animation.entry.start,
340
- timing: n.animation.entry.timing ? { ...E.animation.entry.timing, ...n.animation.entry.timing } : E.animation.entry.timing,
341
- path: n.animation.entry.path ? { ...vt, ...n.animation.entry.path } : E.animation.entry.path,
342
- rotation: n.animation.entry.rotation ? { ...wt, ...n.animation.entry.rotation } : E.animation.entry.rotation,
343
- scale: n.animation.entry.scale ? { ...xt, ...n.animation.entry.scale } : E.animation.entry.scale
344
- })), n.interaction && (s.interaction = {
345
- ...E.interaction,
346
- ...n.interaction
347
- }, n.interaction.focus && (s.interaction.focus = {
348
- ...E.interaction.focus,
349
- ...n.interaction.focus
350
- }), n.interaction.navigation && (s.interaction.navigation = {
351
- ...E.interaction.navigation,
352
- ...n.interaction.navigation
353
- }), n.interaction.gestures && (s.interaction.gestures = {
354
- ...E.interaction.gestures,
355
- ...n.interaction.gestures
356
- })), n.rendering && (s.rendering = {
357
- ...E.rendering,
358
- ...n.rendering
359
- }, n.rendering.responsive && (s.rendering.responsive = {
360
- ...E.rendering.responsive,
361
- ...n.rendering.responsive,
362
- breakpoints: n.rendering.responsive.breakpoints ? { ...E.rendering.responsive.breakpoints, ...n.rendering.responsive.breakpoints } : E.rendering.responsive.breakpoints,
363
- mobileDetection: n.rendering.responsive.mobileDetection ? n.rendering.responsive.mobileDetection : E.rendering.responsive.mobileDetection
364
- }), n.rendering.ui && (s.rendering.ui = {
365
- ...E.rendering.ui,
366
- ...n.rendering.ui
367
- })), s.config.debug = {
310
+ if (o.layout && (s.layout = {
311
+ ...x.layout,
312
+ ...o.layout
313
+ }, o.layout.responsive && (s.layout.responsive = {
314
+ ...x.layout.responsive,
315
+ mobile: o.layout.responsive.mobile ? { ...x.layout.responsive.mobile, ...o.layout.responsive.mobile } : x.layout.responsive.mobile,
316
+ tablet: o.layout.responsive.tablet ? { ...x.layout.responsive.tablet, ...o.layout.responsive.tablet } : x.layout.responsive.tablet
317
+ }), o.layout.spacing && (s.layout.spacing = {
318
+ ...x.layout.spacing,
319
+ ...o.layout.spacing
320
+ })), o.animation && (s.animation = {
321
+ ...x.animation,
322
+ ...o.animation
323
+ }, o.animation.easing && (s.animation.easing = {
324
+ ...x.animation.easing,
325
+ ...o.animation.easing
326
+ }), o.animation.queue && (s.animation.queue = {
327
+ ...x.animation.queue,
328
+ ...o.animation.queue
329
+ }), o.animation.performance && (s.animation.performance = {
330
+ ...x.animation.performance,
331
+ ...o.animation.performance
332
+ }), o.animation.entry && (s.animation.entry = {
333
+ ...x.animation.entry,
334
+ ...o.animation.entry,
335
+ start: o.animation.entry.start ? {
336
+ ...x.animation.entry.start,
337
+ ...o.animation.entry.start,
338
+ circular: o.animation.entry.start.circular ? { ...x.animation.entry.start.circular, ...o.animation.entry.start.circular } : x.animation.entry.start.circular
339
+ } : x.animation.entry.start,
340
+ timing: o.animation.entry.timing ? { ...x.animation.entry.timing, ...o.animation.entry.timing } : x.animation.entry.timing,
341
+ path: o.animation.entry.path ? { ...vt, ...o.animation.entry.path } : x.animation.entry.path,
342
+ rotation: o.animation.entry.rotation ? { ...wt, ...o.animation.entry.rotation } : x.animation.entry.rotation,
343
+ scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : x.animation.entry.scale
344
+ }), o.animation.idle && (s.animation.idle = {
368
345
  ...$t,
369
- ...n.config?.debug ?? {}
346
+ ...o.animation.idle
347
+ })), o.interaction && (s.interaction = {
348
+ ...x.interaction,
349
+ ...o.interaction
350
+ }, o.interaction.focus && (s.interaction.focus = {
351
+ ...x.interaction.focus,
352
+ ...o.interaction.focus
353
+ }), o.interaction.navigation && (s.interaction.navigation = {
354
+ ...x.interaction.navigation,
355
+ ...o.interaction.navigation
356
+ }), o.interaction.gestures && (s.interaction.gestures = {
357
+ ...x.interaction.gestures,
358
+ ...o.interaction.gestures
359
+ })), o.rendering && (s.rendering = {
360
+ ...x.rendering,
361
+ ...o.rendering
362
+ }, o.rendering.responsive && (s.rendering.responsive = {
363
+ ...x.rendering.responsive,
364
+ ...o.rendering.responsive,
365
+ breakpoints: o.rendering.responsive.breakpoints ? { ...x.rendering.responsive.breakpoints, ...o.rendering.responsive.breakpoints } : x.rendering.responsive.breakpoints,
366
+ mobileDetection: o.rendering.responsive.mobileDetection ? o.rendering.responsive.mobileDetection : x.rendering.responsive.mobileDetection
367
+ }), o.rendering.ui && (s.rendering.ui = {
368
+ ...x.rendering.ui,
369
+ ...o.rendering.ui
370
+ })), s.config.debug = {
371
+ ..._t,
372
+ ...o.config?.debug ?? {}
370
373
  }, s.layout.algorithm === "honeycomb" && s.styling) {
371
374
  const c = { shape: "hexagon", mode: "height-relative" };
372
375
  s.styling = {
@@ -378,16 +381,16 @@ function Jt(n = {}) {
378
381
  }
379
382
  return s;
380
383
  }
381
- function Vt(n, t) {
382
- return { ...n ? Tt[n] : Tt.playful, ...t };
384
+ function ee(o, t) {
385
+ return { ...o ? Tt[o] : Tt.playful, ...t };
383
386
  }
384
- function Kt(n, t) {
385
- return { ...n ? At[n] : At.gentle, ...t };
387
+ function ie(o, t) {
388
+ return { ...o ? At[o] : At.gentle, ...t };
386
389
  }
387
- function Zt(n, t) {
388
- return { ...n ? Ct[n] : Ct.gentle, ...t };
390
+ function ne(o, t) {
391
+ return { ...o ? Ct[o] : Ct.gentle, ...t };
389
392
  }
390
- class Qt {
393
+ class oe {
391
394
  constructor(t) {
392
395
  this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
393
396
  }
@@ -398,8 +401,8 @@ class Qt {
398
401
  buildTransformString(t) {
399
402
  const i = ["translate(-50%, -50%)"];
400
403
  if (t.x !== void 0 || t.y !== void 0) {
401
- const e = t.x ?? 0, o = t.y ?? 0;
402
- i.push(`translate(${e}px, ${o}px)`);
404
+ const e = t.x ?? 0, n = t.y ?? 0;
405
+ i.push(`translate(${e}px, ${n}px)`);
403
406
  }
404
407
  return t.rotation !== void 0 && i.push(`rotate(${t.rotation}deg)`), t.scale !== void 0 && i.push(`scale(${t.scale})`), i.join(" ");
405
408
  }
@@ -412,9 +415,9 @@ class Qt {
412
415
  * @param easing - CSS easing function (optional)
413
416
  * @returns AnimationHandle that can be used to cancel or query the animation
414
417
  */
415
- animateTransformCancellable(t, i, e, o = null, a = null) {
418
+ animateTransformCancellable(t, i, e, n = null, a = null) {
416
419
  this.cancelAllAnimations(t);
417
- const r = o ?? this.config.duration, s = a ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
420
+ const r = n ?? this.config.duration, s = a ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
418
421
  t.style.transition = "none";
419
422
  const u = t.animate(
420
423
  [
@@ -451,13 +454,13 @@ class Qt {
451
454
  cancelAnimation(t, i = !0) {
452
455
  const e = this.getCurrentTransform(t.element);
453
456
  if (t.animation.cancel(), i) {
454
- const o = this.buildTransformString({
457
+ const n = this.buildTransformString({
455
458
  x: e.x,
456
459
  y: e.y,
457
460
  rotation: e.rotation,
458
461
  scale: e.scale
459
462
  });
460
- t.element.style.transform = o;
463
+ t.element.style.transform = n;
461
464
  }
462
465
  return this.activeAnimations.delete(t.element), e;
463
466
  }
@@ -470,8 +473,8 @@ class Qt {
470
473
  const i = this.activeAnimations.get(t);
471
474
  i && this.cancelAnimation(i, !1);
472
475
  const e = t.getAnimations();
473
- for (const o of e)
474
- o.cancel();
476
+ for (const n of e)
477
+ n.cancel();
475
478
  }
476
479
  /**
477
480
  * Get current transform state of an element (works mid-animation)
@@ -483,7 +486,7 @@ class Qt {
483
486
  const e = getComputedStyle(t).transform;
484
487
  if (e === "none" || !e)
485
488
  return { x: 0, y: 0, rotation: 0, scale: 1 };
486
- const o = new DOMMatrix(e), a = Math.sqrt(o.a * o.a + o.b * o.b), r = Math.atan2(o.b, o.a) * (180 / Math.PI), s = o.e, c = o.f;
489
+ const n = new DOMMatrix(e), a = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), s = n.e, c = n.f;
487
490
  return { x: s, y: c, rotation: r, scale: a };
488
491
  }
489
492
  /**
@@ -510,9 +513,9 @@ class Qt {
510
513
  * @param easing - CSS easing function (optional)
511
514
  * @returns Promise that resolves when animation completes
512
515
  */
513
- animateTransform(t, i, e = null, o = null) {
516
+ animateTransform(t, i, e = null, n = null) {
514
517
  return new Promise((a) => {
515
- const r = e ?? this.config.duration, s = o ?? this.config.easing.default;
518
+ const r = e ?? this.config.duration, s = n ?? this.config.easing.default;
516
519
  t.style.transition = `transform ${r}ms ${s}, box-shadow ${r}ms ${s}`, t.style.transform = this.buildTransformString(i), setTimeout(() => {
517
520
  a();
518
521
  }, r);
@@ -543,18 +546,18 @@ class Qt {
543
546
  return new Promise((i) => setTimeout(i, t));
544
547
  }
545
548
  }
546
- function V(n, t, i) {
547
- return n + (t - n) * i;
549
+ function V(o, t, i) {
550
+ return o + (t - o) * i;
548
551
  }
549
- function te(n, t, i, e) {
550
- const { overshoot: o, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l = ee(a, r);
551
- let u = 0, h = 0, d = 1, f = o, b = !1;
552
+ function se(o, t, i, e) {
553
+ const { overshoot: n, bounces: a, decayRatio: r } = e, s = i.x - t.x, c = i.y - t.y, l = ae(a, r);
554
+ let u = 0, h = 0, d = 1, f = n, b = !1;
552
555
  for (let g = 0; g < l.length; g++)
553
- if (n <= l[g].time) {
556
+ if (o <= l[g].time) {
554
557
  h = g === 0 ? 0 : l[g - 1].time, d = l[g].time, f = l[g].overshoot, b = l[g].isOvershoot;
555
558
  break;
556
559
  }
557
- const p = (n - h) / (d - h);
560
+ const p = (o - h) / (d - h);
558
561
  if (b)
559
562
  u = 1 + f * ot(p);
560
563
  else if (h === 0)
@@ -570,72 +573,72 @@ function te(n, t, i, e) {
570
573
  y: t.y + c * u
571
574
  };
572
575
  }
573
- function ee(n, t) {
576
+ function ae(o, t) {
574
577
  const i = [];
575
578
  let e = 0.6;
576
579
  i.push({ time: e, overshoot: 0, isOvershoot: !1 });
577
- let o = 0.15;
578
- const r = 0.4 / (n * 2);
579
- for (let s = 0; s < n; s++)
580
- e += r, i.push({ time: e, overshoot: o, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: o * t, isOvershoot: !1 }), o *= t;
580
+ let n = 0.15;
581
+ const r = 0.4 / (o * 2);
582
+ for (let s = 0; s < o; s++)
583
+ e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
581
584
  return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
582
585
  }
583
- function ie(n, t, i, e) {
584
- const { stiffness: o, damping: a, mass: r, oscillations: s } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(o / r), h = a / (2 * Math.sqrt(o * r));
586
+ function re(o, t, i, e) {
587
+ const { stiffness: n, damping: a, mass: r, oscillations: s } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = a / (2 * Math.sqrt(n * r));
585
588
  let d;
586
589
  if (h < 1) {
587
- const f = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * n * 3), p = Math.cos(f * n * s * Math.PI);
590
+ const f = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(f * o * s * Math.PI);
588
591
  d = 1 - b * p;
589
592
  } else
590
- d = 1 - Math.exp(-u * n * 3);
593
+ d = 1 - Math.exp(-u * o * 3);
591
594
  return d = Math.max(0, Math.min(d, 1.3)), {
592
595
  x: t.x + c * d,
593
596
  y: t.y + l * d
594
597
  };
595
598
  }
596
- function ne(n, t, i, e) {
597
- const { amplitude: o, frequency: a, decay: r, decayRate: s, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? l / h : 1, b = a * Math.PI * 2 * n + c, p = r ? Math.pow(1 - n, s) : 1, g = o * Math.sin(b) * p, m = oe(n);
599
+ function ce(o, t, i, e) {
600
+ const { amplitude: n, frequency: a, decay: r, decayRate: s, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? l / h : 1, b = a * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, s) : 1, g = n * Math.sin(b) * p, m = le(o);
598
601
  return {
599
602
  x: V(t.x, i.x, m) + g * d,
600
603
  y: V(t.y, i.y, m) + g * f
601
604
  };
602
605
  }
603
- function ot(n) {
604
- return 1 - (1 - n) * (1 - n);
606
+ function ot(o) {
607
+ return 1 - (1 - o) * (1 - o);
605
608
  }
606
- function oe(n) {
607
- return 1 - Math.pow(1 - n, 3);
609
+ function le(o) {
610
+ return 1 - Math.pow(1 - o, 3);
608
611
  }
609
- function se(n, t, i) {
610
- const { amplitude: e, frequency: o, decay: a } = i, r = Math.sin(n * o * Math.PI * 2), s = a ? Math.pow(1 - n, 2) : 1, c = e * r * s;
612
+ function he(o, t, i) {
613
+ const { amplitude: e, frequency: n, decay: a } = i, r = Math.sin(o * n * Math.PI * 2), s = a ? Math.pow(1 - o, 2) : 1, c = e * r * s;
611
614
  return t + c;
612
615
  }
613
- function ae(n, t, i) {
614
- const { overshoot: e, bounces: o } = i, a = [];
616
+ function de(o, t, i) {
617
+ const { overshoot: e, bounces: n } = i, a = [];
615
618
  a.push({ time: 0.5, scale: e });
616
619
  let r = e;
617
- const s = 0.5, l = 0.5 / (o * 2);
620
+ const s = 0.5, l = 0.5 / (n * 2);
618
621
  let u = 0.5;
619
- for (let d = 0; d < o; d++) {
622
+ for (let d = 0; d < n; d++) {
620
623
  const f = 1 - (r - 1) * s;
621
- u += l, a.push({ time: u, scale: f }), r = 1 + (r - 1) * s * s, u += l, d < o - 1 && a.push({ time: u, scale: r });
624
+ u += l, a.push({ time: u, scale: f }), r = 1 + (r - 1) * s * s, u += l, d < n - 1 && a.push({ time: u, scale: r });
622
625
  }
623
626
  a.push({ time: 1, scale: 1 });
624
627
  let h = 1;
625
628
  for (let d = 0; d < a.length; d++)
626
- if (n <= a[d].time) {
627
- const f = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (n - f) / (a[d].time - f), g = ot(p);
629
+ if (o <= a[d].time) {
630
+ const f = d === 0 ? 0 : a[d - 1].time, b = d === 0 ? 1 : a[d - 1].scale, p = (o - f) / (a[d].time - f), g = ot(p);
628
631
  h = b + (a[d].scale - b) * g;
629
632
  break;
630
633
  }
631
634
  return h * t;
632
635
  }
633
- function re(n) {
636
+ function ue(o) {
634
637
  const {
635
638
  element: t,
636
639
  startPosition: i,
637
640
  endPosition: e,
638
- pathConfig: o,
641
+ pathConfig: n,
639
642
  duration: a,
640
643
  imageWidth: r,
641
644
  imageHeight: s,
@@ -646,38 +649,38 @@ function re(n) {
646
649
  startRotation: d,
647
650
  scaleConfig: f,
648
651
  startScale: b
649
- } = n, p = o.type, g = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = b !== void 0 && b !== l, R = f?.mode === "pop", x = f?.pop || { overshoot: 1.2, bounces: 1 };
650
- if ((p === "linear" || p === "arc") && !w && !(v || R)) {
652
+ } = o, p = n.type, g = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, w = g || m, v = b !== void 0 && b !== l, I = f?.mode === "pop", E = f?.pop || { overshoot: 1.2, bounces: 1 };
653
+ if ((p === "linear" || p === "arc") && !w && !(v || I)) {
651
654
  u && u();
652
655
  return;
653
656
  }
654
- const z = performance.now(), L = -r / 2, _ = -s / 2;
655
- function O(H) {
656
- const N = H - z, T = Math.min(N / a, 1);
657
+ const O = performance.now(), L = -r / 2, P = -s / 2;
658
+ function z(H) {
659
+ const k = H - O, T = Math.min(k / a, 1);
657
660
  let D;
658
661
  switch (p) {
659
662
  case "bounce": {
660
- const j = Vt(
661
- o.bouncePreset,
662
- o.bounce
663
+ const N = ee(
664
+ n.bouncePreset,
665
+ n.bounce
663
666
  );
664
- D = te(T, i, e, j);
667
+ D = se(T, i, e, N);
665
668
  break;
666
669
  }
667
670
  case "elastic": {
668
- const j = Kt(
669
- o.elasticPreset,
670
- o.elastic
671
+ const N = ie(
672
+ n.elasticPreset,
673
+ n.elastic
671
674
  );
672
- D = ie(T, i, e, j);
675
+ D = re(T, i, e, N);
673
676
  break;
674
677
  }
675
678
  case "wave": {
676
- const j = Zt(
677
- o.wavePreset,
678
- o.wave
679
+ const N = ne(
680
+ n.wavePreset,
681
+ n.wave
679
682
  );
680
- D = ne(T, i, e, j);
683
+ D = ce(T, i, e, N);
681
684
  break;
682
685
  }
683
686
  default:
@@ -688,16 +691,16 @@ function re(n) {
688
691
  }
689
692
  const G = D.x - e.x, U = D.y - e.y;
690
693
  let M;
691
- m ? M = se(T, c, y) : g ? M = V(d, c, T) : M = c;
694
+ m ? M = he(T, c, y) : g ? M = V(d, c, T) : M = c;
692
695
  let A;
693
- R ? A = ae(T, l, x) : v ? A = V(b, l, T) : A = l, t.style.transform = `translate(${L}px, ${_}px) translate(${G}px, ${U}px) rotate(${M}deg) scale(${A})`, T < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
696
+ I ? A = de(T, l, E) : v ? A = V(b, l, T) : A = l, t.style.transform = `translate(${L}px, ${P}px) translate(${G}px, ${U}px) rotate(${M}deg) scale(${A})`, T < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${L}px, ${P}px) rotate(${c}deg) scale(${l})`, u && u());
694
697
  }
695
- requestAnimationFrame(O);
698
+ requestAnimationFrame(z);
696
699
  }
697
- function ce(n) {
698
- return n === "bounce" || n === "elastic" || n === "wave";
700
+ function ge(o) {
701
+ return o === "bounce" || o === "elastic" || o === "wave";
699
702
  }
700
- const le = {
703
+ const fe = {
701
704
  radial: "center",
702
705
  spiral: "center",
703
706
  grid: "top",
@@ -706,20 +709,20 @@ const le = {
706
709
  wave: "left",
707
710
  honeycomb: "center"
708
711
  };
709
- class he {
712
+ class me {
710
713
  constructor(t, i) {
711
- this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || vt, this.rotationConfig = t.rotation || wt, this.scaleConfig = t.scale || xt;
714
+ this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || vt, this.rotationConfig = t.rotation || wt, this.scaleConfig = t.scale || Et;
712
715
  }
713
716
  /**
714
717
  * Get the effective start position, considering layout-aware defaults
715
718
  */
716
719
  resolveStartPosition() {
717
- return this.config.start.position ? this.config.start.position : le[this.layoutAlgorithm] || "nearest-edge";
720
+ return this.config.start.position ? this.config.start.position : fe[this.layoutAlgorithm] || "nearest-edge";
718
721
  }
719
722
  /**
720
723
  * Calculate the starting position for an image's entry animation
721
724
  */
722
- calculateStartPosition(t, i, e, o, a) {
725
+ calculateStartPosition(t, i, e, n, a) {
723
726
  const r = this.resolvedStartPosition, s = this.config.start.offset ?? 100;
724
727
  switch (r) {
725
728
  case "nearest-edge":
@@ -741,7 +744,7 @@ class he {
741
744
  t,
742
745
  i,
743
746
  e,
744
- o,
747
+ n,
745
748
  a
746
749
  );
747
750
  default:
@@ -751,28 +754,28 @@ class he {
751
754
  /**
752
755
  * Calculate start position from the nearest edge (current default behavior)
753
756
  */
754
- calculateNearestEdge(t, i, e, o) {
757
+ calculateNearestEdge(t, i, e, n) {
755
758
  const a = t.x, r = t.y, s = a, c = e.width - a, l = r, u = e.height - r, h = Math.min(s, c, l, u);
756
759
  let d = t.x, f = t.y;
757
- return h === s ? d = -(i.width + o) : h === c ? d = e.width + o : h === l ? f = -(i.height + o) : f = e.height + o, { x: d, y: f };
760
+ return h === s ? d = -(i.width + n) : h === c ? d = e.width + n : h === l ? f = -(i.height + n) : f = e.height + n, { x: d, y: f };
758
761
  }
759
762
  /**
760
763
  * Calculate start position from a specific edge
761
764
  */
762
- calculateEdgePosition(t, i, e, o, a) {
765
+ calculateEdgePosition(t, i, e, n, a) {
763
766
  let r = i.x, s = i.y;
764
767
  switch (t) {
765
768
  case "top":
766
769
  s = -(e.height + a);
767
770
  break;
768
771
  case "bottom":
769
- s = o.height + a;
772
+ s = n.height + a;
770
773
  break;
771
774
  case "left":
772
775
  r = -(e.width + a);
773
776
  break;
774
777
  case "right":
775
- r = o.width + a;
778
+ r = n.width + a;
776
779
  break;
777
780
  }
778
781
  return { x: r, y: s };
@@ -781,9 +784,9 @@ class he {
781
784
  * Calculate start position from center with scale animation
782
785
  */
783
786
  calculateCenterPosition(t, i, e) {
784
- const o = t.width / 2, a = t.height / 2;
787
+ const n = t.width / 2, a = t.height / 2;
785
788
  return {
786
- x: o,
789
+ x: n,
787
790
  y: a,
788
791
  useScale: !0
789
792
  // Signal to use scale animation from 0
@@ -792,14 +795,14 @@ class he {
792
795
  /**
793
796
  * Calculate start position from a random edge
794
797
  */
795
- calculateRandomEdge(t, i, e, o) {
798
+ calculateRandomEdge(t, i, e, n) {
796
799
  const a = ["top", "bottom", "left", "right"], r = a[Math.floor(Math.random() * a.length)];
797
- return this.calculateEdgePosition(r, t, i, e, o);
800
+ return this.calculateEdgePosition(r, t, i, e, n);
798
801
  }
799
802
  /**
800
803
  * Calculate start position on a circle around the container
801
804
  */
802
- calculateCircularPosition(t, i, e, o, a) {
805
+ calculateCircularPosition(t, i, e, n, a) {
803
806
  const r = this.config.start.circular || {}, s = r.distribution || "even";
804
807
  let c;
805
808
  const l = r.radius || "120%";
@@ -811,7 +814,7 @@ class he {
811
814
  } else
812
815
  c = typeof l == "number" ? l : 500;
813
816
  let u;
814
- s === "even" ? u = o / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
817
+ s === "even" ? u = n / a * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
815
818
  const h = e.width / 2, d = e.height / 2, f = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
816
819
  return { x: f, y: b };
817
820
  }
@@ -832,17 +835,17 @@ class he {
832
835
  * Build a CSS transform string for the start position
833
836
  * Uses pixel-based centering offset for reliable cross-browser behavior
834
837
  */
835
- buildStartTransform(t, i, e, o, a, r, s, c) {
836
- const l = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = c !== void 0 ? c : o, f = a !== void 0 ? -a / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = a !== void 0 ? `translate(${f}px, ${b}px)` : "translate(-50%, -50%)";
838
+ buildStartTransform(t, i, e, n, a, r, s, c) {
839
+ const l = t.x - i.x, u = t.y - i.y, h = s !== void 0 ? s : e, d = c !== void 0 ? c : n, f = a !== void 0 ? -a / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = a !== void 0 ? `translate(${f}px, ${b}px)` : "translate(-50%, -50%)";
837
840
  return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(${d})`;
838
841
  }
839
842
  /**
840
843
  * Build the final CSS transform string
841
844
  * Uses pixel-based centering offset for reliable cross-browser behavior
842
845
  */
843
- buildFinalTransform(t, i, e, o) {
844
- if (e !== void 0 && o !== void 0) {
845
- const a = -e / 2, r = -o / 2;
846
+ buildFinalTransform(t, i, e, n) {
847
+ if (e !== void 0 && n !== void 0) {
848
+ const a = -e / 2, r = -n / 2;
846
849
  return `translate(${a}px, ${r}px) rotate(${t}deg) scale(${i})`;
847
850
  }
848
851
  return `translate(-50%, -50%) rotate(${t}deg) scale(${i})`;
@@ -859,7 +862,7 @@ class he {
859
862
  * Check if the current path type requires JavaScript animation
860
863
  */
861
864
  requiresJSAnimation() {
862
- return ce(this.pathConfig.type);
865
+ return ge(this.pathConfig.type);
863
866
  }
864
867
  /**
865
868
  * Get the path configuration
@@ -908,12 +911,12 @@ class he {
908
911
  return t + (Math.random() - 0.5) * 60;
909
912
  if (typeof e == "number")
910
913
  return e;
911
- const o = e.max - e.min;
912
- return e.min + Math.random() * o;
914
+ const n = e.max - e.min;
915
+ return e.min + Math.random() * n;
913
916
  }
914
917
  case "spin": {
915
- const e = this.rotationConfig.spinCount ?? 1, o = this.resolveSpinDirection(t);
916
- return t + e * 360 * o;
918
+ const e = this.rotationConfig.spinCount ?? 1, n = this.resolveSpinDirection(t);
919
+ return t + e * 360 * n;
917
920
  }
918
921
  case "random":
919
922
  return t + (Math.random() - 0.5) * 60;
@@ -961,7 +964,7 @@ class he {
961
964
  amplitude: 15,
962
965
  frequency: 3,
963
966
  decay: !0
964
- }, { amplitude: o, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, l = o * s * c;
967
+ }, { amplitude: n, frequency: a, decay: r } = e, s = Math.sin(t * a * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, l = n * s * c;
965
968
  return i + l;
966
969
  }
967
970
  /**
@@ -1018,7 +1021,7 @@ class he {
1018
1021
  const e = this.scaleConfig.pop || {
1019
1022
  overshoot: 1.2,
1020
1023
  bounces: 1
1021
- }, { overshoot: o, bounces: a } = e, r = this.generateScaleBounceKeyframes(a, o);
1024
+ }, { overshoot: n, bounces: a } = e, r = this.generateScaleBounceKeyframes(a, n);
1022
1025
  let s = i;
1023
1026
  for (let c = 0; c < r.length; c++)
1024
1027
  if (t <= r[c].time) {
@@ -1034,12 +1037,12 @@ class he {
1034
1037
  generateScaleBounceKeyframes(t, i) {
1035
1038
  const e = [];
1036
1039
  e.push({ time: 0.5, scale: i });
1037
- let o = i;
1040
+ let n = i;
1038
1041
  const a = 0.5, s = 0.5 / (t * 2);
1039
1042
  let c = 0.5;
1040
1043
  for (let l = 0; l < t; l++) {
1041
- const u = 1 - (o - 1) * a;
1042
- c += s, e.push({ time: c, scale: u }), o = 1 + (o - 1) * a * a, c += s, l < t - 1 && e.push({ time: c, scale: o });
1044
+ const u = 1 - (n - 1) * a;
1045
+ c += s, e.push({ time: c, scale: u }), n = 1 + (n - 1) * a * a, c += s, l < t - 1 && e.push({ time: c, scale: n });
1043
1046
  }
1044
1047
  return e.push({ time: 1, scale: 1 }), e;
1045
1048
  }
@@ -1050,7 +1053,193 @@ class he {
1050
1053
  return 1 - (1 - t) * (1 - t);
1051
1054
  }
1052
1055
  }
1053
- class de {
1056
+ class pe {
1057
+ constructor(t, i = 600) {
1058
+ this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
1059
+ }
1060
+ /**
1061
+ * Register an image element for idle animation.
1062
+ * Starts animation after entry duration completes.
1063
+ */
1064
+ register(t, i, e, n) {
1065
+ if (this.entries.has(t)) return;
1066
+ const a = n ?? this.entryDurationMs, r = this.config.startDelay ?? a, s = {
1067
+ element: t,
1068
+ index: i,
1069
+ totalImages: e,
1070
+ animation: null,
1071
+ blinkAnimation: null,
1072
+ customTeardown: null,
1073
+ paused: !1,
1074
+ stopped: !1,
1075
+ startTimer: null
1076
+ };
1077
+ this.entries.set(t, s), s.startTimer = setTimeout(() => {
1078
+ s.startTimer = null, !s.stopped && !s.paused && this._startAnimation(s);
1079
+ }, r);
1080
+ }
1081
+ /**
1082
+ * Pause idle animation for a specific image (set to neutral then pause).
1083
+ */
1084
+ pauseForImage(t) {
1085
+ const i = this.entries.get(t);
1086
+ i && (i.paused = !0, i.startTimer !== null && (clearTimeout(i.startTimer), i.startTimer = null), this._pauseEntry(i));
1087
+ }
1088
+ /**
1089
+ * Resume idle animation for a specific image by starting a fresh animation.
1090
+ * Always restarts rather than resuming, to avoid Web Animations API
1091
+ * quirks with negative-delay animations after pause/cancel.
1092
+ */
1093
+ resumeForImage(t) {
1094
+ const i = this.entries.get(t);
1095
+ !i || i.stopped || (i.paused = !1, this._startAnimation(i));
1096
+ }
1097
+ /**
1098
+ * Stop and remove idle animation for a specific image.
1099
+ */
1100
+ stopForImage(t) {
1101
+ const i = this.entries.get(t);
1102
+ i && (i.stopped = !0, i.startTimer !== null && (clearTimeout(i.startTimer), i.startTimer = null), this._cancelEntry(i), this.entries.delete(t));
1103
+ }
1104
+ pauseAll() {
1105
+ for (const t of this.entries.values())
1106
+ t.paused = !0, t.startTimer !== null && (clearTimeout(t.startTimer), t.startTimer = null), this._pauseEntry(t);
1107
+ }
1108
+ resumeAll() {
1109
+ for (const t of this.entries.values())
1110
+ t.stopped || (t.paused = !1, this._startAnimation(t));
1111
+ }
1112
+ stopAll() {
1113
+ for (const t of this.entries.values())
1114
+ t.stopped = !0, t.startTimer !== null && (clearTimeout(t.startTimer), t.startTimer = null), this._cancelEntry(t);
1115
+ this.entries.clear(), this._stopTogetherLoop();
1116
+ }
1117
+ // ──────────────────────────────────────────────────────────────────────────
1118
+ // Private helpers
1119
+ // ──────────────────────────────────────────────────────────────────────────
1120
+ _startAnimation(t) {
1121
+ const { type: i } = this.config;
1122
+ switch (i) {
1123
+ case "wiggle":
1124
+ this._startWiggle(t);
1125
+ break;
1126
+ case "pulse":
1127
+ this._startPulse(t);
1128
+ break;
1129
+ case "blink":
1130
+ this._startBlink(t);
1131
+ break;
1132
+ case "spin":
1133
+ this._startSpin(t);
1134
+ break;
1135
+ case "custom":
1136
+ this._startCustom(t);
1137
+ break;
1138
+ }
1139
+ }
1140
+ _startWiggle(t) {
1141
+ const i = { ...Bt, ...this.config.wiggle }, e = [
1142
+ { transform: "rotate(0deg)", offset: 0 },
1143
+ { transform: `rotate(${i.maxAngle}deg)`, offset: 0.25 },
1144
+ { transform: "rotate(0deg)", offset: 0.5 },
1145
+ { transform: `rotate(${-i.maxAngle}deg)`, offset: 0.75 },
1146
+ { transform: "rotate(0deg)", offset: 1 }
1147
+ ];
1148
+ i.sync === "together" ? (t.animation = t.element.animate(e, {
1149
+ duration: i.speed,
1150
+ iterations: 1 / 0,
1151
+ composite: "add",
1152
+ fill: "both"
1153
+ }), t.animation.pause(), this._startTogetherLoop(i.speed)) : t.animation = t.element.animate(e, {
1154
+ duration: i.speed,
1155
+ delay: -(Math.random() * i.speed),
1156
+ iterations: 1 / 0,
1157
+ composite: "add"
1158
+ });
1159
+ }
1160
+ _startPulse(t) {
1161
+ const i = { ...Xt, ...this.config.pulse }, e = [
1162
+ { transform: "scale(1)", offset: 0 },
1163
+ { transform: `scale(${i.maxScale})`, offset: 0.25 },
1164
+ { transform: "scale(1)", offset: 0.5 },
1165
+ { transform: `scale(${i.minScale})`, offset: 0.75 },
1166
+ { transform: "scale(1)", offset: 1 }
1167
+ ];
1168
+ i.sync === "together" ? (t.animation = t.element.animate(e, {
1169
+ duration: i.speed,
1170
+ iterations: 1 / 0,
1171
+ composite: "add",
1172
+ fill: "both"
1173
+ }), t.animation.pause(), this._startTogetherLoop(i.speed)) : t.animation = t.element.animate(e, {
1174
+ duration: i.speed,
1175
+ delay: -(Math.random() * i.speed),
1176
+ iterations: 1 / 0,
1177
+ composite: "add"
1178
+ });
1179
+ }
1180
+ _startBlink(t) {
1181
+ const i = { ...Yt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
1182
+ let a, r;
1183
+ i.style === "fade" ? (a = [
1184
+ { opacity: n, offset: 0 },
1185
+ { opacity: 0, offset: 0.5 },
1186
+ { opacity: n, offset: 1 }
1187
+ ], r = {
1188
+ duration: i.speed,
1189
+ delay: e,
1190
+ iterations: 1 / 0,
1191
+ easing: "ease-in-out"
1192
+ }) : (a = [
1193
+ { opacity: n, offset: 0 },
1194
+ { opacity: n, offset: i.onRatio },
1195
+ { opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
1196
+ { opacity: 0, offset: 0.99 },
1197
+ { opacity: n, offset: 1 }
1198
+ ], r = {
1199
+ duration: i.speed,
1200
+ delay: e,
1201
+ iterations: 1 / 0
1202
+ }), t.blinkAnimation = t.element.animate(a, r);
1203
+ }
1204
+ _startSpin(t) {
1205
+ const i = { ...Jt, ...this.config.spin }, e = i.direction === "clockwise" ? 360 : -360;
1206
+ t.animation = t.element.animate(
1207
+ [{ transform: "rotate(0deg)" }, { transform: `rotate(${e}deg)` }],
1208
+ {
1209
+ duration: i.speed,
1210
+ iterations: 1 / 0,
1211
+ easing: "linear",
1212
+ composite: "add"
1213
+ }
1214
+ );
1215
+ }
1216
+ _startCustom(t) {
1217
+ const i = this.config.custom;
1218
+ if (!i) return;
1219
+ const e = i({ element: t.element, index: t.index, totalImages: t.totalImages });
1220
+ typeof e == "function" ? t.customTeardown = e : e && typeof e.play == "function" && (t.animation = e);
1221
+ }
1222
+ _startTogetherLoop(t) {
1223
+ if (this.togetherSpeed = t, this.togetherRafId !== null) return;
1224
+ const i = () => {
1225
+ const e = performance.now() % this.togetherSpeed;
1226
+ for (const n of this.entries.values())
1227
+ !n.stopped && !n.paused && n.animation && (n.animation.currentTime = e);
1228
+ this.togetherRafId = requestAnimationFrame(i);
1229
+ };
1230
+ this.togetherRafId = requestAnimationFrame(i);
1231
+ }
1232
+ _stopTogetherLoop() {
1233
+ this.togetherRafId !== null && (cancelAnimationFrame(this.togetherRafId), this.togetherRafId = null);
1234
+ }
1235
+ _pauseEntry(t) {
1236
+ t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null);
1237
+ }
1238
+ _cancelEntry(t) {
1239
+ t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
1240
+ }
1241
+ }
1242
+ class be {
1054
1243
  constructor(t, i = {}) {
1055
1244
  this.config = t, this.imageConfig = i;
1056
1245
  }
@@ -1062,19 +1251,19 @@ class de {
1062
1251
  * @returns Array of layout objects with position, rotation, scale
1063
1252
  */
1064
1253
  generate(t, i, e = {}) {
1065
- const o = [], { width: a, height: r } = i, s = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = c * 1.5 / 2, m = c / 2, y = a - s - g, w = r - s - m, v = s + g, R = s + m;
1066
- for (let x = 0; x < t; x++) {
1067
- const I = this.random(v, y), z = this.random(R, w), L = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, f) : 1, O = c * _, H = {
1068
- id: x,
1069
- x: I,
1070
- y: z,
1254
+ const n = [], { width: a, height: r } = i, s = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = c * 1.5 / 2, m = c / 2, y = a - s - g, w = r - s - m, v = s + g, I = s + m;
1255
+ for (let E = 0; E < t; E++) {
1256
+ const R = this.random(v, y), O = this.random(I, w), L = l === "random" ? this.random(u, h) : 0, P = b ? this.random(d, f) : 1, z = c * P, H = {
1257
+ id: E,
1258
+ x: R,
1259
+ y: O,
1071
1260
  rotation: L,
1072
- scale: _,
1073
- baseSize: O
1261
+ scale: P,
1262
+ baseSize: z
1074
1263
  };
1075
- o.push(H);
1264
+ n.push(H);
1076
1265
  }
1077
- return o;
1266
+ return n;
1078
1267
  }
1079
1268
  /**
1080
1269
  * Utility: Generate random number between min and max
@@ -1086,7 +1275,7 @@ class de {
1086
1275
  return Math.random() * (i - t) + t;
1087
1276
  }
1088
1277
  }
1089
- class ue {
1278
+ class ye {
1090
1279
  constructor(t, i = {}) {
1091
1280
  this.config = t, this.imageConfig = i;
1092
1281
  }
@@ -1098,55 +1287,55 @@ class ue {
1098
1287
  * @returns Array of layout objects with position, rotation, scale
1099
1288
  */
1100
1289
  generate(t, i, e = {}) {
1101
- const o = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
1102
- ...Ht,
1290
+ const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
1291
+ ...kt,
1103
1292
  ...this.config.radial
1104
- }, g = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, R = Math.max(g * 0.8, Math.min(
1293
+ }, g = e.fixedHeight ?? s, m = a / 2, y = r / 2, w = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, I = Math.max(g * 0.8, Math.min(
1105
1294
  m - v - g / 2,
1106
1295
  y - v - g / 2
1107
1296
  ));
1108
1297
  if (t > 0) {
1109
- const z = f ? this.random(h, d) : 1, L = g * z;
1110
- o.push({
1298
+ const O = f ? this.random(h, d) : 1, L = g * O;
1299
+ n.push({
1111
1300
  id: 0,
1112
1301
  x: m,
1113
1302
  y,
1114
1303
  rotation: c === "random" ? this.random(l * 0.33, u * 0.33) : 0,
1115
1304
  // Less rotation for center
1116
- scale: z,
1305
+ scale: O,
1117
1306
  baseSize: L,
1118
1307
  zIndex: 100
1119
1308
  // Center image is highest
1120
1309
  });
1121
1310
  }
1122
- let x = 1, I = 1;
1123
- for (; x < t; ) {
1124
- const z = I / w, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(g * 0.8, R / w * 1.5 / p.tightness), O = I * _, H = O * 1.5, N = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), T = this.estimateWidth(g), D = Math.floor(N / (T * 0.7));
1311
+ let E = 1, R = 1;
1312
+ for (; E < t; ) {
1313
+ const O = R / w, L = b > 0 ? 1 - O * b * 0.5 : 1, P = Math.max(g * 0.8, I / w * 1.5 / p.tightness), z = R * P, H = z * 1.5, k = Math.PI * (3 * (H + z) - Math.sqrt((3 * H + z) * (H + 3 * z))), T = this.estimateWidth(g), D = Math.floor(k / (T * 0.7));
1125
1314
  if (D === 0) {
1126
- I++;
1315
+ R++;
1127
1316
  continue;
1128
1317
  }
1129
- const G = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
1130
- for (let M = 0; M < D && x < t; M++) {
1131
- const A = M * G + U, j = f ? this.random(h, d) : 1, X = L * j, C = g * X;
1132
- let $ = m + Math.cos(A) * H, F = y + Math.sin(A) * O;
1133
- const P = C * 1.5 / 2, k = C / 2;
1134
- $ - P < v ? $ = v + P : $ + P > a - v && ($ = a - v - P), F - k < v ? F = v + k : F + k > r - v && (F = r - v - k);
1135
- const B = c === "random" ? this.random(l, u) : 0;
1136
- o.push({
1137
- id: x,
1138
- x: $,
1318
+ const G = 2 * Math.PI / D, U = R * (20 * Math.PI / 180);
1319
+ for (let M = 0; M < D && E < t; M++) {
1320
+ const A = M * G + U, N = f ? this.random(h, d) : 1, B = L * N, C = g * B;
1321
+ let _ = m + Math.cos(A) * H, F = y + Math.sin(A) * z;
1322
+ const $ = C * 1.5 / 2, j = C / 2;
1323
+ _ - $ < v ? _ = v + $ : _ + $ > a - v && (_ = a - v - $), F - j < v ? F = v + j : F + j > r - v && (F = r - v - j);
1324
+ const Y = c === "random" ? this.random(l, u) : 0;
1325
+ n.push({
1326
+ id: E,
1327
+ x: _,
1139
1328
  y: F,
1140
- rotation: B,
1141
- scale: X,
1329
+ rotation: Y,
1330
+ scale: B,
1142
1331
  baseSize: C,
1143
- zIndex: Math.max(1, 100 - I)
1332
+ zIndex: Math.max(1, 100 - R)
1144
1333
  // Outer rings have lower z-index
1145
- }), x++;
1334
+ }), E++;
1146
1335
  }
1147
- I++;
1336
+ R++;
1148
1337
  }
1149
- return o;
1338
+ return n;
1150
1339
  }
1151
1340
  /**
1152
1341
  * Estimate image width based on height
@@ -1167,7 +1356,7 @@ class ue {
1167
1356
  return Math.random() * (i - t) + t;
1168
1357
  }
1169
1358
  }
1170
- const ge = {
1359
+ const ve = {
1171
1360
  columns: "auto",
1172
1361
  rows: "auto",
1173
1362
  stagger: "none",
@@ -1195,7 +1384,7 @@ const ge = {
1195
1384
  { x: 0, y: 1 }
1196
1385
  // down
1197
1386
  ];
1198
- class fe {
1387
+ class we {
1199
1388
  constructor(t, i = {}) {
1200
1389
  this.config = t, this.imageConfig = i;
1201
1390
  }
@@ -1207,13 +1396,13 @@ class fe {
1207
1396
  * @returns Array of layout objects with position, rotation, scale
1208
1397
  */
1209
1398
  generate(t, i, e = {}) {
1210
- const o = [], { width: a, height: r } = i, s = { ...ge, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = a - 2 * c, p = r - 2 * c, { columns: g, rows: m } = this.calculateGridDimensions(
1399
+ const n = [], { width: a, height: r } = i, s = { ...ve, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = a - 2 * c, p = r - 2 * c, { columns: g, rows: m } = this.calculateGridDimensions(
1211
1400
  t,
1212
1401
  b,
1213
1402
  p,
1214
1403
  l,
1215
1404
  s
1216
- ), y = s.stagger === "row", w = s.stagger === "column", v = y ? g + 0.5 : g, R = w ? m + 0.5 : m, x = (b - s.gap * (g - 1)) / v, I = (p - s.gap * (m - 1)) / R, z = y ? x / 2 : 0, L = w ? I / 2 : 0, _ = 1 + s.overlap, O = Math.min(x, I) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, N = g * x + (g - 1) * s.gap + z, T = m * I + (m - 1) * s.gap + L, D = c + (b - N) / 2, G = c + (p - T) / 2, U = g * m, M = s.columns !== "auto" && s.rows !== "auto", A = M && t > U;
1405
+ ), y = s.stagger === "row", w = s.stagger === "column", v = y ? g + 0.5 : g, I = w ? m + 0.5 : m, E = (b - s.gap * (g - 1)) / v, R = (p - s.gap * (m - 1)) / I, O = y ? E / 2 : 0, L = w ? R / 2 : 0, P = 1 + s.overlap, z = Math.min(E, R) * P, H = e.fixedHeight ? Math.min(e.fixedHeight, z) : z, k = g * E + (g - 1) * s.gap + O, T = m * R + (m - 1) * s.gap + L, D = c + (b - k) / 2, G = c + (p - T) / 2, U = g * m, M = s.columns !== "auto" && s.rows !== "auto", A = M && t > U;
1217
1406
  typeof window < "u" && (window.__gridOverflowDebug = {
1218
1407
  gridConfigColumns: s.columns,
1219
1408
  gridConfigRows: s.rows,
@@ -1224,43 +1413,43 @@ class fe {
1224
1413
  imageCount: t,
1225
1414
  isOverflowMode: A
1226
1415
  });
1227
- const j = A ? new Array(U).fill(0) : [], X = Math.min(x, I) * s.overflowOffset;
1416
+ const N = A ? new Array(U).fill(0) : [], B = Math.min(E, R) * s.overflowOffset;
1228
1417
  for (let C = 0; C < t; C++) {
1229
- let $, F, Y = 0;
1418
+ let _, F, X = 0;
1230
1419
  if (A && C >= U) {
1231
1420
  const q = C - U, W = q % U;
1232
- Y = Math.floor(q / U) + 1, j[W]++, s.fillDirection === "row" ? ($ = W % g, F = Math.floor(W / g)) : (F = W % m, $ = Math.floor(W / m));
1421
+ X = Math.floor(q / U) + 1, N[W]++, s.fillDirection === "row" ? (_ = W % g, F = Math.floor(W / g)) : (F = W % m, _ = Math.floor(W / m));
1233
1422
  } else
1234
- s.fillDirection === "row" ? ($ = C % g, F = Math.floor(C / g)) : (F = C % m, $ = Math.floor(C / m));
1235
- let P = D + $ * (x + s.gap) + x / 2, k = G + F * (I + s.gap) + I / 2;
1236
- if (s.stagger === "row" && F % 2 === 1 ? P += x / 2 : s.stagger === "column" && $ % 2 === 1 && (k += I / 2), Y > 0) {
1237
- const q = (Y - 1) % Lt.length, W = Lt[q];
1238
- P += W.x * X, k += W.y * X;
1423
+ s.fillDirection === "row" ? (_ = C % g, F = Math.floor(C / g)) : (F = C % m, _ = Math.floor(C / m));
1424
+ let $ = D + _ * (E + s.gap) + E / 2, j = G + F * (R + s.gap) + R / 2;
1425
+ if (s.stagger === "row" && F % 2 === 1 ? $ += E / 2 : s.stagger === "column" && _ % 2 === 1 && (j += R / 2), X > 0) {
1426
+ const q = (X - 1) % Lt.length, W = Lt[q];
1427
+ $ += W.x * B, j += W.y * B;
1239
1428
  }
1240
1429
  if (s.jitter > 0) {
1241
- const q = x / 2 * s.jitter, W = I / 2 * s.jitter;
1242
- P += this.random(-q, q), k += this.random(-W, W);
1430
+ const q = E / 2 * s.jitter, W = R / 2 * s.jitter;
1431
+ $ += this.random(-q, q), j += this.random(-W, W);
1243
1432
  }
1244
- let B = P, J = k;
1433
+ let Y = $, J = j;
1245
1434
  if (!A && s.fillDirection === "row") {
1246
1435
  const q = t % g || g;
1247
1436
  if (F === Math.floor((t - 1) / g) && q < g) {
1248
- const It = q * x + (q - 1) * s.gap;
1437
+ const Rt = q * E + (q - 1) * s.gap;
1249
1438
  let gt = 0;
1250
- s.alignment === "center" ? gt = (N - It) / 2 : s.alignment === "end" && (gt = N - It), B += gt;
1439
+ s.alignment === "center" ? gt = (k - Rt) / 2 : s.alignment === "end" && (gt = k - Rt), Y += gt;
1251
1440
  }
1252
1441
  }
1253
- const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt = c + it, ht = a - c - it, _t = c + nt, Ut = r - c - nt;
1254
- B = Math.max(lt, Math.min(B, ht)), J = Math.max(_t, Math.min(J, Ut));
1442
+ const rt = f ? this.random(h, d) : 1, K = H * rt, it = K * 1.5 / 2, nt = K / 2, lt = c + it, ht = a - c - it, Ut = c + nt, Ht = r - c - nt;
1443
+ Y = Math.max(lt, Math.min(Y, ht)), J = Math.max(Ut, Math.min(J, Ht));
1255
1444
  let dt = 0;
1256
1445
  if (u === "random") {
1257
1446
  const q = this.imageConfig.rotation?.range?.min ?? -15, W = this.imageConfig.rotation?.range?.max ?? 15;
1258
1447
  s.jitter > 0 ? dt = this.random(q * s.jitter, W * s.jitter) : dt = this.random(q, W);
1259
1448
  }
1260
1449
  let ut;
1261
- A && Y > 0 ? ut = 50 - Y : ut = A ? 100 + C : C + 1, o.push({
1450
+ A && X > 0 ? ut = 50 - X : ut = A ? 100 + C : C + 1, n.push({
1262
1451
  id: C,
1263
- x: B,
1452
+ x: Y,
1264
1453
  y: J,
1265
1454
  rotation: dt,
1266
1455
  scale: rt,
@@ -1268,12 +1457,12 @@ class fe {
1268
1457
  zIndex: ut
1269
1458
  });
1270
1459
  }
1271
- return o;
1460
+ return n;
1272
1461
  }
1273
1462
  /**
1274
1463
  * Calculate optimal grid dimensions based on image count and container
1275
1464
  */
1276
- calculateGridDimensions(t, i, e, o, a) {
1465
+ calculateGridDimensions(t, i, e, n, a) {
1277
1466
  let r, s;
1278
1467
  if (a.columns !== "auto" && a.rows !== "auto")
1279
1468
  r = a.columns, s = a.rows;
@@ -1295,14 +1484,14 @@ class fe {
1295
1484
  return Math.random() * (i - t) + t;
1296
1485
  }
1297
1486
  }
1298
- const me = Math.PI * (3 - Math.sqrt(5)), pe = {
1487
+ const Ee = Math.PI * (3 - Math.sqrt(5)), xe = {
1299
1488
  spiralType: "golden",
1300
1489
  direction: "counterclockwise",
1301
1490
  tightness: 1,
1302
1491
  scaleDecay: 0,
1303
1492
  startAngle: 0
1304
1493
  };
1305
- class be {
1494
+ class Se {
1306
1495
  constructor(t, i = {}) {
1307
1496
  this.config = t, this.imageConfig = i;
1308
1497
  }
@@ -1314,79 +1503,79 @@ class be {
1314
1503
  * @returns Array of layout objects with position, rotation, scale
1315
1504
  */
1316
1505
  generate(t, i, e = {}) {
1317
- const o = [], { width: a, height: r } = i, s = { ...pe, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, y = r / 2, w = Math.min(
1506
+ const n = [], { width: a, height: r } = i, s = { ...xe, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, m = a / 2, y = r / 2, w = Math.min(
1318
1507
  m - c - l / 2,
1319
1508
  y - c - l / 2
1320
1509
  ), v = s.direction === "clockwise" ? -1 : 1;
1321
- for (let R = 0; R < t; R++) {
1322
- let x, I;
1510
+ for (let I = 0; I < t; I++) {
1511
+ let E, R;
1323
1512
  if (s.spiralType === "golden")
1324
- x = R * me * v + s.startAngle, I = this.calculateGoldenRadius(R, t, w, s.tightness);
1513
+ E = I * Ee * v + s.startAngle, R = this.calculateGoldenRadius(I, t, w, s.tightness);
1325
1514
  else if (s.spiralType === "archimedean") {
1326
- const P = R * 0.5 * s.tightness;
1327
- x = P * v + s.startAngle, I = this.calculateArchimedeanRadius(P, t, w, s.tightness);
1515
+ const $ = I * 0.5 * s.tightness;
1516
+ E = $ * v + s.startAngle, R = this.calculateArchimedeanRadius($, t, w, s.tightness);
1328
1517
  } else {
1329
- const P = R * 0.3 * s.tightness;
1330
- x = P * v + s.startAngle, I = this.calculateLogarithmicRadius(P, t, w, s.tightness);
1518
+ const $ = I * 0.3 * s.tightness;
1519
+ E = $ * v + s.startAngle, R = this.calculateLogarithmicRadius($, t, w, s.tightness);
1331
1520
  }
1332
- const z = m + Math.cos(x) * I, L = y + Math.sin(x) * I, _ = I / w, O = g > 0 ? 1 - _ * g * 0.5 : 1, H = p ? this.random(f, b) : 1, N = O * H, T = l * N, G = T * 1.5 / 2, U = T / 2, M = c + G, A = a - c - G, j = c + U, X = r - c - U, C = Math.max(M, Math.min(z, A)), $ = Math.max(j, Math.min(L, X));
1521
+ const O = m + Math.cos(E) * R, L = y + Math.sin(E) * R, P = R / w, z = g > 0 ? 1 - P * g * 0.5 : 1, H = p ? this.random(f, b) : 1, k = z * H, T = l * k, G = T * 1.5 / 2, U = T / 2, M = c + G, A = a - c - G, N = c + U, B = r - c - U, C = Math.max(M, Math.min(O, A)), _ = Math.max(N, Math.min(L, B));
1333
1522
  let F = 0;
1334
1523
  if (u === "random") {
1335
- const P = x * 180 / Math.PI % 360, k = this.random(h, d);
1336
- F = s.spiralType === "golden" ? k : P * 0.1 + k * 0.9;
1337
- } else u === "tangent" && (F = this.calculateSpiralTangent(x, I, s));
1338
- const Y = t - R;
1339
- o.push({
1340
- id: R,
1524
+ const $ = E * 180 / Math.PI % 360, j = this.random(h, d);
1525
+ F = s.spiralType === "golden" ? j : $ * 0.1 + j * 0.9;
1526
+ } else u === "tangent" && (F = this.calculateSpiralTangent(E, R, s));
1527
+ const X = t - I;
1528
+ n.push({
1529
+ id: I,
1341
1530
  x: C,
1342
- y: $,
1531
+ y: _,
1343
1532
  rotation: F,
1344
- scale: N,
1533
+ scale: k,
1345
1534
  baseSize: T,
1346
- zIndex: Y
1535
+ zIndex: X
1347
1536
  });
1348
1537
  }
1349
- return o;
1538
+ return n;
1350
1539
  }
1351
1540
  /**
1352
1541
  * Calculate tangent angle for spiral curve at given position
1353
1542
  * This aligns the image along the spiral's direction of travel
1354
1543
  */
1355
1544
  calculateSpiralTangent(t, i, e) {
1356
- let o;
1545
+ let n;
1357
1546
  if (e.spiralType === "golden")
1358
- o = t + Math.PI / 2;
1547
+ n = t + Math.PI / 2;
1359
1548
  else if (e.spiralType === "archimedean") {
1360
1549
  const r = 1 / e.tightness, s = Math.atan(i / r);
1361
- o = t + s;
1550
+ n = t + s;
1362
1551
  } else {
1363
1552
  const r = 0.15 / e.tightness, s = Math.atan(1 / r);
1364
- o = t + s;
1553
+ n = t + s;
1365
1554
  }
1366
- return o * 180 / Math.PI % 360 - 90;
1555
+ return n * 180 / Math.PI % 360 - 90;
1367
1556
  }
1368
1557
  /**
1369
1558
  * Calculate radius for golden spiral (Vogel's model)
1370
1559
  * Creates even distribution like sunflower seeds
1371
1560
  */
1372
- calculateGoldenRadius(t, i, e, o) {
1373
- const r = e / Math.sqrt(i) * Math.sqrt(t) / o;
1561
+ calculateGoldenRadius(t, i, e, n) {
1562
+ const r = e / Math.sqrt(i) * Math.sqrt(t) / n;
1374
1563
  return Math.min(r, e);
1375
1564
  }
1376
1565
  /**
1377
1566
  * Calculate radius for Archimedean spiral
1378
1567
  * r = a + b*θ (constant spacing between arms)
1379
1568
  */
1380
- calculateArchimedeanRadius(t, i, e, o) {
1381
- const a = i * 0.5 * o;
1569
+ calculateArchimedeanRadius(t, i, e, n) {
1570
+ const a = i * 0.5 * n;
1382
1571
  return t / a * e;
1383
1572
  }
1384
1573
  /**
1385
1574
  * Calculate radius for logarithmic (equiangular) spiral
1386
1575
  * r = a * e^(b*θ)
1387
1576
  */
1388
- calculateLogarithmicRadius(t, i, e, o) {
1389
- const a = e * 0.05, r = 0.15 / o, s = a * Math.exp(r * t), c = i * 0.3 * o, l = a * Math.exp(r * c);
1577
+ calculateLogarithmicRadius(t, i, e, n) {
1578
+ const a = e * 0.05, r = 0.15 / n, s = a * Math.exp(r * t), c = i * 0.3 * n, l = a * Math.exp(r * c);
1390
1579
  return s / l * e;
1391
1580
  }
1392
1581
  /**
@@ -1396,7 +1585,7 @@ class be {
1396
1585
  return Math.random() * (i - t) + t;
1397
1586
  }
1398
1587
  }
1399
- const ye = {
1588
+ const Ie = {
1400
1589
  clusterCount: "auto",
1401
1590
  clusterSpread: 150,
1402
1591
  clusterSpacing: 200,
@@ -1404,7 +1593,7 @@ const ye = {
1404
1593
  overlap: 0.3,
1405
1594
  distribution: "gaussian"
1406
1595
  };
1407
- class ve {
1596
+ class Re {
1408
1597
  constructor(t, i = {}) {
1409
1598
  this.config = t, this.imageConfig = i;
1410
1599
  }
@@ -1416,7 +1605,7 @@ class ve {
1416
1605
  * @returns Array of layout objects with position, rotation, scale
1417
1606
  */
1418
1607
  generate(t, i, e = {}) {
1419
- const o = [], { width: a, height: r } = i, s = { ...ye, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.calculateClusterCount(
1608
+ const n = [], { width: a, height: r } = i, s = { ...Ie, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.calculateClusterCount(
1420
1609
  t,
1421
1610
  s.clusterCount,
1422
1611
  a,
@@ -1433,51 +1622,51 @@ class ve {
1433
1622
  y[v % g]++;
1434
1623
  let w = 0;
1435
1624
  for (let v = 0; v < g; v++) {
1436
- const R = m[v], x = y[v];
1437
- for (let I = 0; I < x; I++) {
1438
- let z, L;
1625
+ const I = m[v], E = y[v];
1626
+ for (let R = 0; R < E; R++) {
1627
+ let O, L;
1439
1628
  if (s.distribution === "gaussian")
1440
- z = this.gaussianRandom() * R.spread, L = this.gaussianRandom() * R.spread;
1629
+ O = this.gaussianRandom() * I.spread, L = this.gaussianRandom() * I.spread;
1441
1630
  else {
1442
- const F = this.random(0, Math.PI * 2), Y = this.random(0, R.spread);
1443
- z = Math.cos(F) * Y, L = Math.sin(F) * Y;
1631
+ const F = this.random(0, Math.PI * 2), X = this.random(0, I.spread);
1632
+ O = Math.cos(F) * X, L = Math.sin(F) * X;
1444
1633
  }
1445
- const _ = 1 + s.overlap * 0.5, O = 1 + s.overlap * 0.3;
1446
- z /= _, L /= _;
1447
- const H = p ? this.random(f, b) : 1, N = O * H, T = l * N;
1448
- let D = R.x + z, G = R.y + L;
1634
+ const P = 1 + s.overlap * 0.5, z = 1 + s.overlap * 0.3;
1635
+ O /= P, L /= P;
1636
+ const H = p ? this.random(f, b) : 1, k = z * H, T = l * k;
1637
+ let D = I.x + O, G = I.y + L;
1449
1638
  const M = T * 1.5 / 2, A = T / 2;
1450
1639
  D = Math.max(c + M, Math.min(D, a - c - M)), G = Math.max(c + A, Math.min(G, r - c - A));
1451
- const j = u === "random" ? this.random(h, d) : 0, C = Math.sqrt(z * z + L * L) / R.spread, $ = Math.round((1 - C) * 50) + 1;
1452
- o.push({
1640
+ const N = u === "random" ? this.random(h, d) : 0, C = Math.sqrt(O * O + L * L) / I.spread, _ = Math.round((1 - C) * 50) + 1;
1641
+ n.push({
1453
1642
  id: w,
1454
1643
  x: D,
1455
1644
  y: G,
1456
- rotation: j,
1457
- scale: N,
1645
+ rotation: N,
1646
+ scale: k,
1458
1647
  baseSize: T,
1459
- zIndex: $
1648
+ zIndex: _
1460
1649
  }), w++;
1461
1650
  }
1462
1651
  }
1463
- return o;
1652
+ return n;
1464
1653
  }
1465
1654
  /**
1466
1655
  * Calculate optimal number of clusters based on image count and container
1467
1656
  */
1468
- calculateClusterCount(t, i, e, o, a) {
1657
+ calculateClusterCount(t, i, e, n, a) {
1469
1658
  if (i !== "auto")
1470
1659
  return Math.max(1, Math.min(i, t));
1471
1660
  const s = Math.max(1, Math.ceil(t / 8)), c = Math.floor(
1472
- e / a * (o / a) * 0.6
1661
+ e / a * (n / a) * 0.6
1473
1662
  );
1474
1663
  return Math.max(1, Math.min(s, c, 10));
1475
1664
  }
1476
1665
  /**
1477
1666
  * Generate cluster center positions with spacing constraints
1478
1667
  */
1479
- generateClusterCenters(t, i, e, o, a) {
1480
- const r = [], c = o + a.clusterSpread, l = i - o - a.clusterSpread, u = o + a.clusterSpread, h = e - o - a.clusterSpread;
1668
+ generateClusterCenters(t, i, e, n, a) {
1669
+ const r = [], c = n + a.clusterSpread, l = i - n - a.clusterSpread, u = n + a.clusterSpread, h = e - n - a.clusterSpread;
1481
1670
  for (let d = 0; d < t; d++) {
1482
1671
  let f = null, b = -1;
1483
1672
  for (let p = 0; p < 100; p++) {
@@ -1488,8 +1677,8 @@ class ve {
1488
1677
  };
1489
1678
  let m = 1 / 0;
1490
1679
  for (const y of r) {
1491
- const w = g.x - y.x, v = g.y - y.y, R = Math.sqrt(w * w + v * v);
1492
- m = Math.min(m, R);
1680
+ const w = g.x - y.x, v = g.y - y.y, I = Math.sqrt(w * w + v * v);
1681
+ m = Math.min(m, I);
1493
1682
  }
1494
1683
  if ((r.length === 0 || m > b) && (f = g, b = m), m >= a.clusterSpacing)
1495
1684
  break;
@@ -1522,7 +1711,7 @@ class ve {
1522
1711
  return Math.random() * (i - t) + t;
1523
1712
  }
1524
1713
  }
1525
- class we {
1714
+ class Te {
1526
1715
  constructor(t, i = {}) {
1527
1716
  this.config = t, this.imageConfig = i;
1528
1717
  }
@@ -1534,32 +1723,32 @@ class we {
1534
1723
  * @returns Array of layout objects with position, rotation, scale
1535
1724
  */
1536
1725
  generate(t, i, e = {}) {
1537
- const o = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, p = e.fixedHeight ?? s, g = {
1726
+ const n = [], { width: a, height: r } = i, s = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, p = e.fixedHeight ?? s, g = {
1538
1727
  ...Nt,
1539
1728
  ...this.config.wave
1540
- }, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization: R } = g, x = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = a - c - L, H = O - _, N = x > 1 ? H / (x - 1) : 0, T = c + y + p / 2, D = r - c - y - p / 2, G = D - T, U = m > 1 ? G / (m - 1) : 0;
1729
+ }, { rows: m, amplitude: y, frequency: w, phaseShift: v, synchronization: I } = g, E = Math.ceil(t / m), L = p * 1.5 / 2, P = c + L, z = a - c - L, H = z - P, k = E > 1 ? H / (E - 1) : 0, T = c + y + p / 2, D = r - c - y - p / 2, G = D - T, U = m > 1 ? G / (m - 1) : 0;
1541
1730
  let M = 0;
1542
1731
  for (let A = 0; A < m && M < t; A++) {
1543
- const j = m === 1 ? (T + D) / 2 : T + A * U;
1544
- let X = 0;
1545
- R === "offset" ? X = A * v : R === "alternating" && (X = A * Math.PI);
1546
- for (let C = 0; C < x && M < t; C++) {
1547
- const $ = x === 1 ? (_ + O) / 2 : _ + C * N, F = this.calculateWaveY($, a, y, w, X), Y = $, P = j + F, k = b ? this.random(d, f) : 1, B = p * k;
1732
+ const N = m === 1 ? (T + D) / 2 : T + A * U;
1733
+ let B = 0;
1734
+ I === "offset" ? B = A * v : I === "alternating" && (B = A * Math.PI);
1735
+ for (let C = 0; C < E && M < t; C++) {
1736
+ const _ = E === 1 ? (P + z) / 2 : P + C * k, F = this.calculateWaveY(_, a, y, w, B), X = _, $ = N + F, j = b ? this.random(d, f) : 1, Y = p * j;
1548
1737
  let J = 0;
1549
- l === "tangent" ? J = this.calculateRotation($, a, y, w, X) : l === "random" && (J = this.random(u, h));
1550
- const K = B * 1.5 / 2, ct = B / 2, it = c + K, nt = a - c - K, lt = c + ct, ht = r - c - ct;
1551
- o.push({
1738
+ l === "tangent" ? J = this.calculateRotation(_, a, y, w, B) : l === "random" && (J = this.random(u, h));
1739
+ const K = Y * 1.5 / 2, ct = Y / 2, it = c + K, nt = a - c - K, lt = c + ct, ht = r - c - ct;
1740
+ n.push({
1552
1741
  id: M,
1553
- x: Math.max(it, Math.min(Y, nt)),
1554
- y: Math.max(lt, Math.min(P, ht)),
1742
+ x: Math.max(it, Math.min(X, nt)),
1743
+ y: Math.max(lt, Math.min($, ht)),
1555
1744
  rotation: J,
1556
- scale: k,
1557
- baseSize: B,
1745
+ scale: j,
1746
+ baseSize: Y,
1558
1747
  zIndex: M + 1
1559
1748
  }), M++;
1560
1749
  }
1561
1750
  }
1562
- return o;
1751
+ return n;
1563
1752
  }
1564
1753
  /**
1565
1754
  * Calculate Y position displacement on wave curve
@@ -1570,9 +1759,9 @@ class we {
1570
1759
  * @param phase - Phase offset
1571
1760
  * @returns Y displacement from baseline
1572
1761
  */
1573
- calculateWaveY(t, i, e, o, a) {
1762
+ calculateWaveY(t, i, e, n, a) {
1574
1763
  const r = t / i;
1575
- return e * Math.sin(o * r * 2 * Math.PI + a);
1764
+ return e * Math.sin(n * r * 2 * Math.PI + a);
1576
1765
  }
1577
1766
  /**
1578
1767
  * Calculate rotation based on wave tangent
@@ -1583,8 +1772,8 @@ class we {
1583
1772
  * @param phase - Phase offset
1584
1773
  * @returns Rotation angle in degrees
1585
1774
  */
1586
- calculateRotation(t, i, e, o, a) {
1587
- const r = t / i, s = e * o * 2 * Math.PI * Math.cos(o * r * 2 * Math.PI + a) / i;
1775
+ calculateRotation(t, i, e, n, a) {
1776
+ const r = t / i, s = e * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + a) / i;
1588
1777
  return Math.atan(s) * (180 / Math.PI);
1589
1778
  }
1590
1779
  /**
@@ -1599,7 +1788,7 @@ class we {
1599
1788
  return Math.random() * (i - t) + t;
1600
1789
  }
1601
1790
  }
1602
- const Et = 100, Q = 100 / Math.sqrt(3), St = [
1791
+ const xt = 100, Q = 100 / Math.sqrt(3), St = [
1603
1792
  [Q / 2, 0],
1604
1793
  // upper-left
1605
1794
  [3 * Q / 2, 0],
@@ -1612,21 +1801,21 @@ const Et = 100, Q = 100 / Math.sqrt(3), St = [
1612
1801
  // lower-left
1613
1802
  [0, 50]
1614
1803
  // left
1615
- ], xe = St[1][0] / Et, Ee = St[2][1] / Et;
1616
- function Se(n) {
1804
+ ], Ae = St[1][0] / xt, Ce = St[2][1] / xt;
1805
+ function Le(o) {
1617
1806
  return {
1618
- colStep: xe * n,
1619
- rowOffset: Ee * n
1807
+ colStep: Ae * o,
1808
+ rowOffset: Ce * o
1620
1809
  };
1621
1810
  }
1622
- function Re(n, t, i, e, o, a) {
1623
- const { colStep: r } = Se(a);
1811
+ function Me(o, t, i, e, n, a) {
1812
+ const { colStep: r } = Le(a);
1624
1813
  return {
1625
- px: e + r * n,
1626
- py: o + a * (t + n / 2)
1814
+ px: e + r * o,
1815
+ py: n + a * (t + o / 2)
1627
1816
  };
1628
1817
  }
1629
- const Ie = [
1818
+ const Fe = [
1630
1819
  [1, 0, -1],
1631
1820
  [0, 1, -1],
1632
1821
  [-1, 1, 0],
@@ -1634,33 +1823,33 @@ const Ie = [
1634
1823
  [0, -1, 1],
1635
1824
  [1, -1, 0]
1636
1825
  ];
1637
- function Te(n) {
1638
- if (n === 0) return [[0, 0, 0]];
1826
+ function Oe(o) {
1827
+ if (o === 0) return [[0, 0, 0]];
1639
1828
  const t = [];
1640
- let [i, e, o] = [0, -n, n];
1641
- for (const [a, r, s] of Ie)
1642
- for (let c = 0; c < n; c++)
1643
- t.push([i, e, o]), i += a, e += r, o += s;
1829
+ let [i, e, n] = [0, -o, o];
1830
+ for (const [a, r, s] of Fe)
1831
+ for (let c = 0; c < o; c++)
1832
+ t.push([i, e, n]), i += a, e += r, n += s;
1644
1833
  return t;
1645
1834
  }
1646
- class Ae {
1835
+ class ze {
1647
1836
  // imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
1648
1837
  // would break hex tiling). Kept as parameter for interface compatibility.
1649
1838
  constructor(t, i = {}) {
1650
1839
  this.config = t;
1651
1840
  }
1652
1841
  generate(t, i, e = {}) {
1653
- const o = [], { width: a, height: r } = i, s = a / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1842
+ const n = [], { width: a, height: r } = i, s = a / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1654
1843
  ...jt,
1655
1844
  ...this.config.honeycomb
1656
1845
  }.spacing ?? 0, d = l + h;
1657
1846
  let f = 0, b = 0;
1658
1847
  for (; f < t; ) {
1659
- const p = Te(b);
1848
+ const p = Oe(b);
1660
1849
  for (const [g, m, y] of p) {
1661
1850
  if (f >= t) break;
1662
- const { px: w, py: v } = Re(g, m, y, s, c, d);
1663
- o.push({
1851
+ const { px: w, py: v } = Me(g, m, y, s, c, d);
1852
+ n.push({
1664
1853
  id: f,
1665
1854
  x: w,
1666
1855
  y: v,
@@ -1673,10 +1862,10 @@ class Ae {
1673
1862
  }
1674
1863
  b++;
1675
1864
  }
1676
- return o;
1865
+ return n;
1677
1866
  }
1678
1867
  }
1679
- class Ce {
1868
+ class De {
1680
1869
  constructor(t) {
1681
1870
  this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
1682
1871
  }
@@ -1687,19 +1876,19 @@ class Ce {
1687
1876
  initLayout() {
1688
1877
  switch (this.config.algorithm) {
1689
1878
  case "radial":
1690
- return new ue(this.config, this.imageConfig);
1879
+ return new ye(this.config, this.imageConfig);
1691
1880
  case "grid":
1692
- return new fe(this.config, this.imageConfig);
1881
+ return new we(this.config, this.imageConfig);
1693
1882
  case "spiral":
1694
- return new be(this.config, this.imageConfig);
1883
+ return new Se(this.config, this.imageConfig);
1695
1884
  case "cluster":
1696
- return new ve(this.config, this.imageConfig);
1885
+ return new Re(this.config, this.imageConfig);
1697
1886
  case "wave":
1698
- return new we(this.config, this.imageConfig);
1887
+ return new Te(this.config, this.imageConfig);
1699
1888
  case "honeycomb":
1700
- return new Ae(this.config, this.imageConfig);
1889
+ return new ze(this.config, this.imageConfig);
1701
1890
  default:
1702
- return new de(this.config, this.imageConfig);
1891
+ return new be(this.config, this.imageConfig);
1703
1892
  }
1704
1893
  }
1705
1894
  /**
@@ -1710,10 +1899,10 @@ class Ce {
1710
1899
  * @returns Array of layout objects with position, rotation, scale
1711
1900
  */
1712
1901
  generateLayout(t, i, e = {}) {
1713
- const o = this.placementLayout.generate(t, i, e);
1714
- return o.forEach((a) => {
1902
+ const n = this.placementLayout.generate(t, i, e);
1903
+ return n.forEach((a) => {
1715
1904
  this.layouts.set(a.id, a);
1716
- }), o;
1905
+ }), n;
1717
1906
  }
1718
1907
  /**
1719
1908
  * Get the original layout state for an image
@@ -1766,8 +1955,8 @@ class Ce {
1766
1955
  return;
1767
1956
  if (typeof e == "number")
1768
1957
  return e;
1769
- const o = e, a = this.resolveBreakpoint(t);
1770
- return a === "mobile" ? o.mobile ?? o.tablet ?? o.screen : a === "tablet" ? o.tablet ?? o.screen ?? o.mobile : o.screen ?? o.tablet ?? o.mobile;
1958
+ const n = e, a = this.resolveBreakpoint(t);
1959
+ return a === "mobile" ? n.mobile ?? n.tablet ?? n.screen : a === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
1771
1960
  }
1772
1961
  /**
1773
1962
  * Calculate adaptive image size based on container dimensions and image count
@@ -1777,8 +1966,8 @@ class Ce {
1777
1966
  * @param viewportWidth - Current viewport width for baseHeight resolution
1778
1967
  * @returns Calculated sizing result with height
1779
1968
  */
1780
- calculateAdaptiveSize(t, i, e, o) {
1781
- const a = this.imageConfig.sizing, r = this.resolveBaseHeight(o);
1969
+ calculateAdaptiveSize(t, i, e, n) {
1970
+ const a = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1782
1971
  if (r !== void 0)
1783
1972
  return { height: r };
1784
1973
  const s = a?.minSize ?? 50, c = a?.maxSize ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * l / i;
@@ -1798,9 +1987,9 @@ class Ce {
1798
1987
  */
1799
1988
  honeycombMaxImageHeight(t, i) {
1800
1989
  if (t <= 1) return 1 / 0;
1801
- let e = 0, o = 1;
1802
- for (; o < t; )
1803
- e++, o += 6 * e;
1990
+ let e = 0, n = 1;
1991
+ for (; n < t; )
1992
+ e++, n += 6 * e;
1804
1993
  const a = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, s = i.width / 2, c = i.height / 2, l = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (c - a - r * e) / (e + 0.5), d = (s - a - l * r * e) / (l * e + u);
1805
1994
  return Math.max(10, Math.min(h, d));
1806
1995
  }
@@ -1811,7 +2000,7 @@ class Ce {
1811
2000
  return Math.max(i, Math.min(e, t));
1812
2001
  }
1813
2002
  }
1814
- var S = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(S || {});
2003
+ var S = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(S || {});
1815
2004
  const Mt = {
1816
2005
  // Geometric shapes - uses percentages for responsive sizing
1817
2006
  circle: "circle(50%)",
@@ -1821,7 +2010,7 @@ const Mt = {
1821
2010
  hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
1822
2011
  octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
1823
2012
  diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
1824
- }, Le = {
2013
+ }, _e = {
1825
2014
  // Circle - uses radius in pixels (refHeight of 100px = 50px radius)
1826
2015
  circle: {
1827
2016
  refHeight: 100,
@@ -1845,7 +2034,7 @@ const Mt = {
1845
2034
  },
1846
2035
  // Hexagon - regular hexagon (reference points imported from hexagonGeometry)
1847
2036
  hexagon: {
1848
- refHeight: Et,
2037
+ refHeight: xt,
1849
2038
  points: St
1850
2039
  },
1851
2040
  // Octagon - regular octagon
@@ -1859,105 +2048,111 @@ const Mt = {
1859
2048
  points: [[50, 0], [100, 50], [50, 100], [0, 50]]
1860
2049
  }
1861
2050
  };
1862
- function Me(n) {
1863
- if (n)
1864
- return n in Mt ? Mt[n] : n;
2051
+ function $e(o) {
2052
+ if (o)
2053
+ return o in Mt ? Mt[o] : o;
1865
2054
  }
1866
- function Fe(n, t, i) {
1867
- const e = Le[n];
2055
+ function Pe(o, t, i) {
2056
+ const e = _e[o];
1868
2057
  if (!e) return "";
1869
- const o = t / e.refHeight;
1870
- if (n === "circle")
1871
- return `circle(${Math.round(50 * o * 100) / 100}px)`;
1872
- const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * o, c = (Math.min(...r) + Math.max(...r)) / 2 * o, l = (Math.max(...a) - Math.min(...a)) * o, u = (i ?? l) / 2, h = t / 2, d = u - s, f = h - c;
2058
+ const n = t / e.refHeight;
2059
+ if (o === "circle")
2060
+ return `circle(${Math.round(50 * n * 100) / 100}px)`;
2061
+ const a = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), s = (Math.min(...a) + Math.max(...a)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, l = (Math.max(...a) - Math.min(...a)) * n, u = (i ?? l) / 2, h = t / 2, d = u - s, f = h - c;
1873
2062
  return `polygon(${e.points.map(([p, g]) => {
1874
- const m = Math.round((p * o + d) * 100) / 100, y = Math.round((g * o + f) * 100) / 100;
2063
+ const m = Math.round((p * n + d) * 100) / 100, y = Math.round((g * n + f) * 100) / 100;
1875
2064
  return `${m}px ${y}px`;
1876
2065
  }).join(", ")})`;
1877
2066
  }
1878
- function ze(n) {
1879
- return n in mt;
2067
+ function Ue(o) {
2068
+ return o in mt;
1880
2069
  }
1881
- function Oe(n) {
1882
- return n ? ze(n) ? mt[n] : n : mt.md;
2070
+ function He(o) {
2071
+ return o ? Ue(o) ? mt[o] : o : mt.md;
1883
2072
  }
1884
- function De(n) {
1885
- if (!n) return "";
2073
+ function ke(o) {
2074
+ if (!o) return "";
1886
2075
  const t = [];
1887
- 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)
1888
- if (typeof n.dropShadow == "string")
1889
- t.push(`drop-shadow(${n.dropShadow})`);
2076
+ 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)
2077
+ if (typeof o.dropShadow == "string")
2078
+ t.push(`drop-shadow(${o.dropShadow})`);
1890
2079
  else {
1891
- const i = n.dropShadow;
2080
+ const i = o.dropShadow;
1892
2081
  t.push(`drop-shadow(${i.x}px ${i.y}px ${i.blur}px ${i.color})`);
1893
2082
  }
1894
2083
  return t.join(" ");
1895
2084
  }
1896
- function tt(n) {
1897
- if (!n || n.style === "none" || n.width === 0)
2085
+ function tt(o) {
2086
+ if (!o || o.style === "none" || o.width === 0)
1898
2087
  return "none";
1899
- const t = n.width ?? 0, i = n.style ?? "solid", e = n.color ?? "#000000";
2088
+ const t = o.width ?? 0, i = o.style ?? "solid", e = o.color ?? "#000000";
1900
2089
  return `${t}px ${i} ${e}`;
1901
2090
  }
1902
- function et(n, t, i) {
1903
- if (!n) return {};
2091
+ function et(o, t, i) {
2092
+ if (!o) return {};
1904
2093
  const e = {};
1905
- if (n.borderRadiusTopLeft !== void 0 || n.borderRadiusTopRight !== void 0 || n.borderRadiusBottomRight !== void 0 || n.borderRadiusBottomLeft !== void 0) {
1906
- const s = n.border?.radius ?? 0;
1907
- n.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${n.borderRadiusTopLeft}px` : s && (e.borderTopLeftRadius = `${s}px`), n.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${n.borderRadiusTopRight}px` : s && (e.borderTopRightRadius = `${s}px`), n.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${n.borderRadiusBottomRight}px` : s && (e.borderBottomRightRadius = `${s}px`), n.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${n.borderRadiusBottomLeft}px` : s && (e.borderBottomLeftRadius = `${s}px`);
1908
- } else n.border?.radius !== void 0 && (e.borderRadius = `${n.border.radius}px`);
1909
- if (n.borderTop || n.borderRight || n.borderBottom || n.borderLeft) {
1910
- const s = n.border || {}, c = { ...s, ...n.borderTop }, l = { ...s, ...n.borderRight }, u = { ...s, ...n.borderBottom }, h = { ...s, ...n.borderLeft };
2094
+ if (o.borderRadiusTopLeft !== void 0 || o.borderRadiusTopRight !== void 0 || o.borderRadiusBottomRight !== void 0 || o.borderRadiusBottomLeft !== void 0) {
2095
+ const s = o.border?.radius ?? 0;
2096
+ o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : s && (e.borderTopLeftRadius = `${s}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : s && (e.borderTopRightRadius = `${s}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : s && (e.borderBottomRightRadius = `${s}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : s && (e.borderBottomLeftRadius = `${s}px`);
2097
+ } else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
2098
+ if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
2099
+ const s = o.border || {}, c = { ...s, ...o.borderTop }, l = { ...s, ...o.borderRight }, u = { ...s, ...o.borderBottom }, h = { ...s, ...o.borderLeft };
1911
2100
  e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
1912
- } else n.border && (e.border = tt(n.border));
1913
- n.shadow !== void 0 && (e.boxShadow = Oe(n.shadow));
1914
- const r = De(n.filter);
1915
- 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) {
1916
- const s = n.outline.width ?? 0, c = n.outline.style ?? "solid", l = n.outline.color ?? "#000000";
1917
- e.outline = `${s}px ${c} ${l}`, n.outline.offset !== void 0 && (e.outlineOffset = `${n.outline.offset}px`);
1918
- }
1919
- if (n.objectFit !== void 0 && (e.objectFit = n.objectFit), n.aspectRatio !== void 0 && (e.aspectRatio = n.aspectRatio), n.clipPath !== void 0) {
2101
+ } else o.border && (e.border = tt(o.border));
2102
+ o.shadow !== void 0 && (e.boxShadow = He(o.shadow));
2103
+ const r = ke(o.filter);
2104
+ 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) {
2105
+ const s = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
2106
+ e.outline = `${s}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2107
+ }
2108
+ if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
1920
2109
  let s;
1921
- const c = typeof n.clipPath == "object" && n.clipPath !== null && "shape" in n.clipPath, l = c ? n.clipPath : void 0;
2110
+ const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
1922
2111
  if (l?.mode === "height-relative" && t)
1923
- s = Fe(l.shape, t, i);
2112
+ s = Pe(l.shape, t, i);
1924
2113
  else {
1925
- const u = c && l ? l.shape : n.clipPath;
1926
- s = Me(u);
2114
+ const u = c && l ? l.shape : o.clipPath;
2115
+ s = $e(u);
1927
2116
  }
1928
2117
  s && (s === "none" ? e.clipPath = "unset" : (e.clipPath = s, e.overflow = "hidden"));
1929
2118
  }
1930
2119
  return e;
1931
2120
  }
1932
- function $e(n, t) {
1933
- 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);
2121
+ function Ne(o, t) {
2122
+ 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);
1934
2123
  }
1935
- function ft(n, t, i, e) {
1936
- const o = et(t, i, e);
1937
- $e(n, o);
2124
+ function ft(o, t, i, e) {
2125
+ const n = et(t, i, e);
2126
+ Ne(o, n);
1938
2127
  }
1939
- function Pt(n) {
1940
- return n ? Array.isArray(n) ? n.join(" ") : n : "";
2128
+ function Pt(o) {
2129
+ return o ? Array.isArray(o) ? o.join(" ") : o : "";
1941
2130
  }
1942
- function st(n, t) {
2131
+ function st(o, t) {
1943
2132
  const i = Pt(t);
1944
2133
  i && i.split(" ").forEach((e) => {
1945
- e.trim() && n.classList.add(e.trim());
2134
+ e.trim() && o.classList.add(e.trim());
1946
2135
  });
1947
2136
  }
1948
- function pt(n, t) {
2137
+ function pt(o, t) {
1949
2138
  const i = Pt(t);
1950
2139
  i && i.split(" ").forEach((e) => {
1951
- e.trim() && n.classList.remove(e.trim());
2140
+ e.trim() && o.classList.remove(e.trim());
1952
2141
  });
1953
2142
  }
1954
2143
  const Ft = {
1955
2144
  UNFOCUSING: 999,
1956
2145
  FOCUSING: 1e3
1957
2146
  };
1958
- class Pe {
2147
+ class je {
1959
2148
  constructor(t, i, e) {
1960
- this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
2149
+ this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
2150
+ }
2151
+ /**
2152
+ * Set callback to be fired when an unfocus animation fully completes.
2153
+ */
2154
+ setOnUnfocusCompleteCallback(t) {
2155
+ this.onUnfocusComplete = t;
1961
2156
  }
1962
2157
  /**
1963
2158
  * Get current state machine state
@@ -1982,9 +2177,9 @@ class Pe {
1982
2177
  * Returns actual pixel dimensions instead of scale factor for sharper rendering
1983
2178
  */
1984
2179
  calculateFocusDimensions(t, i, e) {
1985
- const o = this.normalizeScalePercent(this.config.scalePercent), a = e.height * o, r = t / i;
2180
+ const n = this.normalizeScalePercent(this.config.scalePercent), a = e.height * n, r = t / i;
1986
2181
  let s = a, c = s * r;
1987
- const l = e.width * o;
2182
+ const l = e.width * n;
1988
2183
  return c > l && (c = l, s = c / r), { width: c, height: s };
1989
2184
  }
1990
2185
  /**
@@ -1992,7 +2187,7 @@ class Pe {
1992
2187
  * Scale is handled by animating actual dimensions for sharper rendering
1993
2188
  */
1994
2189
  calculateFocusTransform(t, i) {
1995
- const e = t.width / 2, o = t.height / 2, a = e - i.x, r = o - i.y;
2190
+ const e = t.width / 2, n = t.height / 2, a = e - i.x, r = n - i.y;
1996
2191
  return {
1997
2192
  x: a,
1998
2193
  y: r,
@@ -2007,8 +2202,8 @@ class Pe {
2007
2202
  buildDimensionZoomTransform(t) {
2008
2203
  const i = ["translate(-50%, -50%)"];
2009
2204
  if (t.x !== void 0 || t.y !== void 0) {
2010
- const e = t.x ?? 0, o = t.y ?? 0;
2011
- i.push(`translate(${e}px, ${o}px)`);
2205
+ const e = t.x ?? 0, n = t.y ?? 0;
2206
+ i.push(`translate(${e}px, ${n}px)`);
2012
2207
  }
2013
2208
  return t.rotation !== void 0 && i.push(`rotate(${t.rotation}deg)`), i.join(" ");
2014
2209
  }
@@ -2016,13 +2211,13 @@ class Pe {
2016
2211
  * Create a Web Animation that animates both transform (position) and dimensions
2017
2212
  * This provides sharper zoom by re-rendering at target size instead of scaling pixels
2018
2213
  */
2019
- animateWithDimensions(t, i, e, o, a, r, s, c) {
2214
+ animateWithDimensions(t, i, e, n, a, r, s, c) {
2020
2215
  const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2021
2216
  return t.style.transition = "none", t.animate(
2022
2217
  [
2023
2218
  {
2024
2219
  transform: l,
2025
- width: `${o}px`,
2220
+ width: `${n}px`,
2026
2221
  height: `${a}px`
2027
2222
  },
2028
2223
  {
@@ -2063,10 +2258,10 @@ class Pe {
2063
2258
  * This ensures clip-path changes smoothly as width/height animate
2064
2259
  */
2065
2260
  startClipPathAnimation(t, i, e) {
2066
- let o = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
2067
- e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (o = { ...o, clipPath: void 0 });
2261
+ let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
2262
+ e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
2068
2263
  const a = () => {
2069
- const r = t.offsetHeight, s = t.offsetWidth, c = et(o, r, s);
2264
+ const r = t.offsetHeight, s = t.offsetWidth, c = et(n, r, s);
2070
2265
  c.clipPath !== void 0 ? t.style.clipPath = c.clipPath : t.style.clipPath = "unset", c.overflow !== void 0 && (t.style.overflow = c.overflow), i.animation.playState === "running" && requestAnimationFrame(a);
2071
2266
  };
2072
2267
  requestAnimationFrame(a);
@@ -2077,12 +2272,12 @@ class Pe {
2077
2272
  * @param fromTransform - Optional starting transform (for mid-animation reversals)
2078
2273
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2079
2274
  */
2080
- startFocusAnimation(t, i, e, o, a) {
2275
+ startFocusAnimation(t, i, e, n, a) {
2081
2276
  const r = t.style.zIndex || "", s = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(s, c, i), u = this.calculateFocusTransform(i, e);
2082
2277
  this.animationEngine.cancelAllAnimations(t);
2083
2278
  const h = this.config.animationDuration ?? 600;
2084
2279
  this.applyFocusedStyling(t, Ft.FOCUSING);
2085
- const d = o ?? {
2280
+ const d = n ?? {
2086
2281
  x: 0,
2087
2282
  y: 0,
2088
2283
  rotation: e.rotation,
@@ -2129,11 +2324,11 @@ class Pe {
2129
2324
  * Animates back to original dimensions for consistent behavior
2130
2325
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2131
2326
  */
2132
- startUnfocusAnimation(t, i, e, o) {
2327
+ startUnfocusAnimation(t, i, e, n) {
2133
2328
  t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2134
2329
  const a = this.config.animationDuration ?? 600;
2135
2330
  t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
2136
- const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
2331
+ const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, s = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
2137
2332
  x: 0,
2138
2333
  y: 0,
2139
2334
  rotation: i.rotation,
@@ -2181,10 +2376,10 @@ class Pe {
2181
2376
  * Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
2182
2377
  */
2183
2378
  captureMidAnimationState(t) {
2184
- const i = getComputedStyle(t), e = new DOMMatrix(i.transform), o = t.offsetWidth, a = t.offsetHeight, r = e.e + o * 0.5, s = e.f + a * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
2185
- return t.style.width = `${o}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${c}deg)`, t.style.transition = "none", {
2379
+ const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, a = t.offsetHeight, r = e.e + n * 0.5, s = e.f + a * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
2380
+ return t.style.width = `${n}px`, t.style.height = `${a}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${s}px) rotate(${c}deg)`, t.style.transition = "none", {
2186
2381
  transform: { x: r, y: s, rotation: c, scale: 1 },
2187
- dimensions: { width: o, height: a }
2382
+ dimensions: { width: n, height: a }
2188
2383
  };
2189
2384
  }
2190
2385
  /**
@@ -2199,10 +2394,10 @@ class Pe {
2199
2394
  /**
2200
2395
  * Reset an element instantly to its original position and dimensions (no animation)
2201
2396
  */
2202
- resetElementInstantly(t, i, e, o, a) {
2397
+ resetElementInstantly(t, i, e, n, a) {
2203
2398
  this.animationEngine.cancelAllAnimations(t);
2204
2399
  const r = ["translate(-50%, -50%)"];
2205
- r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), o !== void 0 && a !== void 0 && (t.style.width = `${o}px`, t.style.height = `${a}px`), this.removeFocusedStyling(t, e);
2400
+ r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), n !== void 0 && a !== void 0 && (t.style.width = `${n}px`, t.style.height = `${a}px`), this.removeFocusedStyling(t, e);
2206
2401
  }
2207
2402
  /**
2208
2403
  * Focus (zoom) an image to center of container
@@ -2221,10 +2416,10 @@ class Pe {
2221
2416
  ), this.incoming = null, this.state = S.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE;
2222
2417
  return;
2223
2418
  }
2224
- const o = ++this.focusGeneration;
2419
+ const n = ++this.focusGeneration;
2225
2420
  switch (this.state) {
2226
2421
  case S.IDLE:
2227
- if (this.state = S.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
2422
+ if (this.state = S.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2228
2423
  this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2229
2424
  break;
2230
2425
  case S.FOCUSED:
@@ -2234,9 +2429,13 @@ class Pe {
2234
2429
  )), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2235
2430
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2236
2431
  this.waitForAnimation(this.incoming.animationHandle)
2237
- ]), this.focusGeneration !== o)
2432
+ ]), this.focusGeneration !== n)
2238
2433
  return;
2239
- this.outgoing && (this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2434
+ if (this.outgoing) {
2435
+ const a = this.outgoing.element;
2436
+ this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2437
+ }
2438
+ this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2240
2439
  break;
2241
2440
  case S.FOCUSING:
2242
2441
  if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
@@ -2245,15 +2444,19 @@ class Pe {
2245
2444
  this.focusData?.originalZIndex || "",
2246
2445
  this.focusData?.originalWidth,
2247
2446
  this.focusData?.originalHeight
2248
- ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
2447
+ ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2249
2448
  this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2250
2449
  break;
2251
2450
  case S.UNFOCUSING:
2252
2451
  if (this.state = S.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2253
2452
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2254
2453
  this.waitForAnimation(this.incoming.animationHandle)
2255
- ]), this.focusGeneration !== o) return;
2256
- this.outgoing && (this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2454
+ ]), this.focusGeneration !== n) return;
2455
+ if (this.outgoing) {
2456
+ const a = this.outgoing.element;
2457
+ this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2458
+ }
2459
+ this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2257
2460
  break;
2258
2461
  case S.CROSS_ANIMATING:
2259
2462
  if (this.incoming?.element === t)
@@ -2273,8 +2476,12 @@ class Pe {
2273
2476
  if (this.incoming = this.startFocusAnimation(t, i, e, a, r), await Promise.all([
2274
2477
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2275
2478
  this.waitForAnimation(this.incoming.animationHandle)
2276
- ]), this.focusGeneration !== o) return;
2277
- this.outgoing && (this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2479
+ ]), this.focusGeneration !== n) return;
2480
+ if (this.outgoing) {
2481
+ const s = this.outgoing.element;
2482
+ this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2483
+ }
2484
+ this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2278
2485
  return;
2279
2486
  }
2280
2487
  if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
@@ -2295,8 +2502,12 @@ class Pe {
2295
2502
  if (this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2296
2503
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2297
2504
  this.waitForAnimation(this.incoming.animationHandle)
2298
- ]), this.focusGeneration !== o) return;
2299
- this.outgoing && (this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null), this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2505
+ ]), this.focusGeneration !== n) return;
2506
+ if (this.outgoing) {
2507
+ const a = this.outgoing.element;
2508
+ this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2509
+ }
2510
+ this.currentFocus = t, this.incoming = null, this.state = S.FOCUSED;
2300
2511
  break;
2301
2512
  }
2302
2513
  }
@@ -2316,7 +2527,8 @@ class Pe {
2316
2527
  a,
2317
2528
  r
2318
2529
  ), this.incoming = null, this.state = S.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2319
- this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = S.IDLE;
2530
+ const s = this.outgoing.element;
2531
+ this.removeFocusedStyling(s, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(s);
2320
2532
  }
2321
2533
  return;
2322
2534
  }
@@ -2333,12 +2545,15 @@ class Pe {
2333
2545
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2334
2546
  this.waitForAnimation(s.animationHandle)
2335
2547
  ]), this.focusGeneration !== t) return;
2336
- this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(s.element, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE;
2548
+ let c = null;
2549
+ this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
2550
+ const l = s.element;
2551
+ this.removeFocusedStyling(l, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(l);
2337
2552
  return;
2338
2553
  }
2339
2554
  this.state = S.UNFOCUSING;
2340
- const i = this.currentFocus, e = this.focusData.originalState, o = this.focusData.originalZIndex;
2341
- 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 = S.IDLE);
2555
+ const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
2556
+ this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = S.IDLE, this.onUnfocusComplete?.(i));
2342
2557
  }
2343
2558
  /**
2344
2559
  * Swap focus from current image to a new one (alias for focusImage with cross-animation)
@@ -2378,8 +2593,8 @@ class Pe {
2378
2593
  */
2379
2594
  setDragOffset(t) {
2380
2595
  if (!this.currentFocus || !this.focusData || this.state !== S.FOCUSED) return;
2381
- const i = this.currentFocus, e = this.focusData.focusTransform, o = ["translate(-50%, -50%)"], a = (e.x ?? 0) + t, r = e.y ?? 0;
2382
- o.push(`translate(${a}px, ${r}px)`), e.rotation !== void 0 && o.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = o.join(" ");
2596
+ const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], a = (e.x ?? 0) + t, r = e.y ?? 0;
2597
+ n.push(`translate(${a}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
2383
2598
  }
2384
2599
  /**
2385
2600
  * Clear the drag offset, optionally animating back to center
@@ -2388,8 +2603,8 @@ class Pe {
2388
2603
  */
2389
2604
  clearDragOffset(t, i = 150) {
2390
2605
  if (!this.currentFocus || !this.focusData || this.state !== S.FOCUSED) return;
2391
- const e = this.currentFocus, o = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = o.x ?? 0, s = o.y ?? 0;
2392
- a.push(`translate(${r}px, ${s}px)`), o.rotation !== void 0 && a.push(`rotate(${o.rotation}deg)`);
2606
+ const e = this.currentFocus, n = this.focusData.focusTransform, a = ["translate(-50%, -50%)"], r = n.x ?? 0, s = n.y ?? 0;
2607
+ a.push(`translate(${r}px, ${s}px)`), n.rotation !== void 0 && a.push(`rotate(${n.rotation}deg)`);
2393
2608
  const c = a.join(" ");
2394
2609
  t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = c, setTimeout(() => {
2395
2610
  this.currentFocus === e && (e.style.transition = "none");
@@ -2420,7 +2635,7 @@ class Pe {
2420
2635
  ), this.state = S.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2421
2636
  }
2422
2637
  }
2423
- const _e = 50, Ue = 0.5, He = 20, Ne = 0.3, je = 150, ke = 30, at = class at {
2638
+ const We = 50, Ge = 0.5, qe = 20, Be = 0.3, Xe = 150, Ye = 30, at = class at {
2424
2639
  constructor(t, i) {
2425
2640
  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);
2426
2641
  }
@@ -2464,23 +2679,23 @@ const _e = 50, Ue = 0.5, He = 20, Ne = 0.3, je = 150, ke = 30, at = class at {
2464
2679
  }
2465
2680
  handleTouchMove(t) {
2466
2681
  if (!this.touchState || t.touches.length !== 1) return;
2467
- const i = t.touches[0], e = i.clientX - this.touchState.startX, o = i.clientY - this.touchState.startY;
2468
- if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + o * o) > 10) {
2469
- const s = Math.atan2(Math.abs(o), Math.abs(e)) * (180 / Math.PI);
2470
- this.touchState.isHorizontalSwipe = s <= ke;
2682
+ const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
2683
+ if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
2684
+ const s = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2685
+ this.touchState.isHorizontalSwipe = s <= Ye;
2471
2686
  }
2472
2687
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
2473
2688
  t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
2474
- const a = e * Ne;
2689
+ const a = e * Be;
2475
2690
  this.callbacks.onDragOffset(a);
2476
2691
  }
2477
2692
  }
2478
2693
  handleTouchEnd(t) {
2479
2694
  if (!this.touchState) return;
2480
2695
  this.recentTouchTimestamp = Date.now();
2481
- const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, o = Math.abs(i) / e, a = Math.abs(i);
2696
+ const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, a = Math.abs(i);
2482
2697
  let r = !1;
2483
- this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= _e || o >= Ue && a >= He) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2698
+ this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (a >= We || n >= Ge && a >= qe) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2484
2699
  }
2485
2700
  handleTouchCancel(t) {
2486
2701
  this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
@@ -2488,7 +2703,7 @@ const _e = 50, Ue = 0.5, He = 20, Ne = 0.3, je = 150, ke = 30, at = class at {
2488
2703
  };
2489
2704
  at.TOUCH_CLICK_DELAY = 300;
2490
2705
  let bt = at;
2491
- class We {
2706
+ class Je {
2492
2707
  constructor(t) {
2493
2708
  if (this._prepared = !1, this._discoveredUrls = [], this.apiKey = t.apiKey ?? "", this.apiEndpoint = t.apiEndpoint ?? "https://www.googleapis.com/drive/v3/files", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
2494
2709
  throw new Error("GoogleDriveLoader requires at least one source to be configured");
@@ -2502,7 +2717,7 @@ class We {
2502
2717
  for (const i of this.sources)
2503
2718
  if ("folders" in i)
2504
2719
  for (const e of i.folders) {
2505
- const o = i.recursive !== void 0 ? i.recursive : !0, a = await this.loadFromFolder(e, t, o);
2720
+ const n = i.recursive !== void 0 ? i.recursive : !0, a = await this.loadFromFolder(e, t, n);
2506
2721
  this._discoveredUrls.push(...a);
2507
2722
  }
2508
2723
  else if ("files" in i) {
@@ -2548,9 +2763,9 @@ class We {
2548
2763
  // Alternative format
2549
2764
  ];
2550
2765
  for (const e of i) {
2551
- const o = t.match(e);
2552
- if (o && o[1])
2553
- return o[1];
2766
+ const n = t.match(e);
2767
+ if (n && n[1])
2768
+ return n[1];
2554
2769
  }
2555
2770
  return null;
2556
2771
  }
@@ -2562,15 +2777,15 @@ class We {
2562
2777
  * @returns Promise resolving to array of image URLs
2563
2778
  */
2564
2779
  async loadFromFolder(t, i, e = !0) {
2565
- const o = this.extractFolderId(t);
2566
- if (!o)
2780
+ const n = this.extractFolderId(t);
2781
+ if (!n)
2567
2782
  throw new Error("Invalid Google Drive folder URL. Please check the URL format.");
2568
2783
  if (!this.apiKey || this.apiKey === "YOUR_API_KEY_HERE")
2569
- return this.loadImagesDirectly(o, i);
2784
+ return this.loadImagesDirectly(n, i);
2570
2785
  try {
2571
- return e ? await this.loadImagesRecursively(o, i) : await this.loadImagesFromSingleFolder(o, i);
2786
+ return e ? await this.loadImagesRecursively(n, i) : await this.loadImagesFromSingleFolder(n, i);
2572
2787
  } catch (a) {
2573
- return console.error("Error loading from Google Drive API:", a), this.loadImagesDirectly(o, i);
2788
+ return console.error("Error loading from Google Drive API:", a), this.loadImagesDirectly(n, i);
2574
2789
  }
2575
2790
  }
2576
2791
  /**
@@ -2580,7 +2795,7 @@ class We {
2580
2795
  * @returns Promise resolving to array of image URLs
2581
2796
  */
2582
2797
  async loadImagesFromSingleFolder(t, i) {
2583
- const e = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
2798
+ const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
2584
2799
  if (!s.ok)
2585
2800
  throw new Error(`API request failed: ${s.status} ${s.statusText}`);
2586
2801
  const l = (await s.json()).files.filter(
@@ -2598,10 +2813,10 @@ class We {
2598
2813
  */
2599
2814
  async loadFiles(t, i) {
2600
2815
  const e = [];
2601
- for (const o of t) {
2602
- const a = this.extractFileId(o);
2816
+ for (const n of t) {
2817
+ const a = this.extractFileId(n);
2603
2818
  if (!a) {
2604
- this.log(`Skipping invalid file URL: ${o}`);
2819
+ this.log(`Skipping invalid file URL: ${n}`);
2605
2820
  continue;
2606
2821
  }
2607
2822
  if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
@@ -2637,9 +2852,9 @@ class We {
2637
2852
  // Generic id parameter
2638
2853
  ];
2639
2854
  for (const e of i) {
2640
- const o = t.match(e);
2641
- if (o && o[1])
2642
- return o[1];
2855
+ const n = t.match(e);
2856
+ if (n && n[1])
2857
+ return n[1];
2643
2858
  }
2644
2859
  return null;
2645
2860
  }
@@ -2650,7 +2865,7 @@ class We {
2650
2865
  * @returns Promise resolving to array of image URLs
2651
2866
  */
2652
2867
  async loadImagesRecursively(t, i) {
2653
- const e = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
2868
+ const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, s = await fetch(r);
2654
2869
  if (!s.ok)
2655
2870
  throw new Error(`API request failed: ${s.status} ${s.statusText}`);
2656
2871
  const c = await s.json(), l = c.files.filter(
@@ -2677,10 +2892,10 @@ class We {
2677
2892
  */
2678
2893
  async loadImagesDirectly(t, i) {
2679
2894
  try {
2680
- const e = `https://drive.google.com/embeddedfolderview?id=${t}`, o = await fetch(e, { mode: "cors" });
2681
- if (!o.ok)
2895
+ const e = `https://drive.google.com/embeddedfolderview?id=${t}`, n = await fetch(e, { mode: "cors" });
2896
+ if (!n.ok)
2682
2897
  throw new Error("Cannot access folder directly (CORS or permissions issue)");
2683
- const a = await o.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, s = [...a.matchAll(r)];
2898
+ const a = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, s = [...a.matchAll(r)];
2684
2899
  return [...new Set(s.map((u) => u[1]))].map(
2685
2900
  (u) => `https://drive.google.com/uc?export=view&id=${u}`
2686
2901
  );
@@ -2709,7 +2924,7 @@ class We {
2709
2924
  this.debugLogging && typeof console < "u" && console.log(...t);
2710
2925
  }
2711
2926
  }
2712
- class Ge {
2927
+ class Ve {
2713
2928
  constructor(t) {
2714
2929
  if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
2715
2930
  throw new Error("StaticImageLoader requires at least one source to be configured");
@@ -2773,13 +2988,13 @@ class Ge {
2773
2988
  if (!Array.isArray(t))
2774
2989
  return console.warn("URLs must be an array:", t), [];
2775
2990
  const e = [];
2776
- for (const o of t) {
2777
- const a = o.split("/").pop() || o;
2991
+ for (const n of t) {
2992
+ const a = n.split("/").pop() || n;
2778
2993
  if (!i.isAllowed(a)) {
2779
- this.log(`Skipping filtered URL: ${o}`);
2994
+ this.log(`Skipping filtered URL: ${n}`);
2780
2995
  continue;
2781
2996
  }
2782
- this.validateUrls ? await this.validateUrl(o) ? e.push(o) : console.warn(`Skipping invalid/missing URL: ${o}`) : e.push(o);
2997
+ this.validateUrls ? await this.validateUrl(n) ? e.push(n) : console.warn(`Skipping invalid/missing URL: ${n}`) : e.push(n);
2783
2998
  }
2784
2999
  return e;
2785
3000
  }
@@ -2793,16 +3008,16 @@ class Ge {
2793
3008
  async processPath(t, i, e) {
2794
3009
  if (!Array.isArray(i))
2795
3010
  return console.warn("files must be an array:", i), [];
2796
- const o = [];
3011
+ const n = [];
2797
3012
  for (const a of i) {
2798
3013
  if (!e.isAllowed(a)) {
2799
3014
  this.log(`Skipping filtered file: ${a}`);
2800
3015
  continue;
2801
3016
  }
2802
3017
  const r = this.constructUrl(t, a);
2803
- this.validateUrls ? await this.validateUrl(r) ? o.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : o.push(r);
3018
+ this.validateUrls ? await this.validateUrl(r) ? n.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : n.push(r);
2804
3019
  }
2805
- return o;
3020
+ return n;
2806
3021
  }
2807
3022
  /**
2808
3023
  * Process a JSON endpoint source
@@ -2813,17 +3028,17 @@ class Ge {
2813
3028
  */
2814
3029
  async processJson(t, i) {
2815
3030
  this.log(`Fetching JSON endpoint: ${t}`);
2816
- const e = new AbortController(), o = setTimeout(() => e.abort(), 1e4);
3031
+ const e = new AbortController(), n = setTimeout(() => e.abort(), 1e4);
2817
3032
  try {
2818
3033
  const a = await fetch(t, { signal: e.signal });
2819
- if (clearTimeout(o), !a.ok)
3034
+ if (clearTimeout(n), !a.ok)
2820
3035
  throw new Error(`HTTP ${a.status} fetching ${t}`);
2821
3036
  const r = await a.json();
2822
3037
  if (!r || !Array.isArray(r.images))
2823
3038
  throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
2824
3039
  return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, i);
2825
3040
  } catch (a) {
2826
- throw clearTimeout(o), a instanceof Error && a.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : a;
3041
+ throw clearTimeout(n), a instanceof Error && a.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : a;
2827
3042
  }
2828
3043
  }
2829
3044
  /**
@@ -2845,11 +3060,11 @@ class Ge {
2845
3060
  if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
2846
3061
  return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
2847
3062
  try {
2848
- const e = new AbortController(), o = setTimeout(() => e.abort(), this.validationTimeout), a = await fetch(t, {
3063
+ const e = new AbortController(), n = setTimeout(() => e.abort(), this.validationTimeout), a = await fetch(t, {
2849
3064
  method: "HEAD",
2850
3065
  signal: e.signal
2851
3066
  });
2852
- return clearTimeout(o), a.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${a.status}`), !1);
3067
+ return clearTimeout(n), a.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${a.status}`), !1);
2853
3068
  } catch (e) {
2854
3069
  return e instanceof Error && (e.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, e.message)), !1;
2855
3070
  }
@@ -2866,8 +3081,8 @@ class Ge {
2866
3081
  return `${e}/${i}`;
2867
3082
  if (typeof window > "u")
2868
3083
  return `${e}/${i}`;
2869
- const o = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
2870
- return `${o}${r}/${i}`;
3084
+ const n = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
3085
+ return `${n}${r}/${i}`;
2871
3086
  }
2872
3087
  /**
2873
3088
  * Check if URL is absolute (contains protocol)
@@ -2889,7 +3104,7 @@ class Ge {
2889
3104
  this.debugLogging && typeof console < "u" && console.log(...t);
2890
3105
  }
2891
3106
  }
2892
- class qe {
3107
+ class Ke {
2893
3108
  constructor(t) {
2894
3109
  if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
2895
3110
  throw new Error("CompositeLoader requires at least one loader to be configured");
@@ -2901,16 +3116,16 @@ class qe {
2901
3116
  */
2902
3117
  async prepare(t) {
2903
3118
  this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
2904
- const i = this.loaders.map((e, o) => e.prepare(t).then(() => {
2905
- this.log(`Loader ${o} prepared with ${e.imagesLength()} images`);
3119
+ const i = this.loaders.map((e, n) => e.prepare(t).then(() => {
3120
+ this.log(`Loader ${n} prepared with ${e.imagesLength()} images`);
2906
3121
  }).catch((a) => {
2907
- console.warn(`Loader ${o} failed to prepare:`, a);
3122
+ console.warn(`Loader ${n} failed to prepare:`, a);
2908
3123
  }));
2909
3124
  await Promise.all(i);
2910
3125
  for (const e of this.loaders)
2911
3126
  if (e.isPrepared()) {
2912
- const o = e.imageURLs();
2913
- this._discoveredUrls.push(...o);
3127
+ const n = e.imageURLs();
3128
+ this._discoveredUrls.push(...n);
2914
3129
  }
2915
3130
  this._prepared = !0, this.log(`CompositeLoader prepared with ${this._discoveredUrls.length} total images`);
2916
3131
  }
@@ -2946,7 +3161,7 @@ class qe {
2946
3161
  this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
2947
3162
  }
2948
3163
  }
2949
- class Xe {
3164
+ class Ze {
2950
3165
  /**
2951
3166
  * Create a new ImageFilter
2952
3167
  * @param extensions - Array of allowed file extensions (without dots)
@@ -2983,7 +3198,7 @@ class Xe {
2983
3198
  // isAllowedDate(date: Date): boolean
2984
3199
  // isAllowedDimensions(width: number, height: number): boolean
2985
3200
  }
2986
- const Ye = `
3201
+ const Qe = `
2987
3202
  .fbn-ic-gallery {
2988
3203
  position: relative;
2989
3204
  width: 100%;
@@ -3033,31 +3248,38 @@ const Ye = `
3033
3248
  display: none !important;
3034
3249
  }
3035
3250
  `;
3036
- function Be() {
3251
+ function ti() {
3037
3252
  if (typeof document > "u") return;
3038
- const n = "fbn-ic-functional-styles";
3039
- if (document.getElementById(n)) return;
3253
+ const o = "fbn-ic-functional-styles";
3254
+ if (document.getElementById(o)) return;
3040
3255
  const t = document.createElement("style");
3041
- t.id = n, t.textContent = Ye, document.head.appendChild(t);
3256
+ t.id = o, t.textContent = Qe, document.head.appendChild(t);
3042
3257
  }
3043
- class Je {
3258
+ class ei {
3044
3259
  constructor(t = {}) {
3045
- this.fullConfig = Jt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new Qt(this.fullConfig.animation), this.layoutEngine = new Ce({
3260
+ this.fullConfig = te(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new oe(this.fullConfig.animation), this.layoutEngine = new De({
3046
3261
  layout: this.fullConfig.layout,
3047
3262
  image: this.fullConfig.image
3048
- }), this.zoomEngine = new Pe(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = et(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
3049
- const i = this.fullConfig.animation.entry || E.animation.entry;
3050
- this.entryAnimationEngine = new he(
3263
+ }), this.zoomEngine = new je(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = et(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
3264
+ const i = this.fullConfig.animation.entry || x.animation.entry;
3265
+ this.entryAnimationEngine = new me(
3051
3266
  i,
3052
3267
  this.fullConfig.layout.algorithm
3053
- ), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
3268
+ );
3269
+ const e = this.fullConfig.animation.idle;
3270
+ e && e.type !== "none" ? this.idleAnimationEngine = new pe(
3271
+ e,
3272
+ i.timing?.duration ?? 600
3273
+ ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
3274
+ this.idleAnimationEngine?.resumeForImage(n);
3275
+ }), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
3054
3276
  }
3055
3277
  /**
3056
3278
  * Create image filter based on shared loader config
3057
3279
  */
3058
3280
  createImageFilter() {
3059
3281
  const t = this.fullConfig.config.loaders?.allowedExtensions;
3060
- return new Xe(t);
3282
+ return new Ze(t);
3061
3283
  }
3062
3284
  /**
3063
3285
  * Create appropriate image loader based on config
@@ -3067,8 +3289,8 @@ class Je {
3067
3289
  const t = this.fullConfig.loaders, i = this.fullConfig.config.loaders ?? {};
3068
3290
  if (!t || t.length === 0)
3069
3291
  throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
3070
- const e = t.map((o) => this.createLoaderFromEntry(o, i));
3071
- return e.length === 1 ? e[0] : new qe({
3292
+ const e = t.map((n) => this.createLoaderFromEntry(n, i));
3293
+ return e.length === 1 ? e[0] : new Ke({
3072
3294
  loaders: e,
3073
3295
  debugLogging: this.fullConfig.config.debug?.loaders
3074
3296
  });
@@ -3078,7 +3300,7 @@ class Je {
3078
3300
  */
3079
3301
  createLoaderFromEntry(t, i) {
3080
3302
  if ("static" in t) {
3081
- const e = t.static, o = {
3303
+ const e = t.static, n = {
3082
3304
  ...e,
3083
3305
  validateUrls: e.validateUrls ?? i.validateUrls,
3084
3306
  validationTimeout: e.validationTimeout ?? i.validationTimeout,
@@ -3086,14 +3308,14 @@ class Je {
3086
3308
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3087
3309
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3088
3310
  };
3089
- return new Ge(o);
3311
+ return new Ve(n);
3090
3312
  } else if ("googleDrive" in t) {
3091
- const e = t.googleDrive, o = {
3313
+ const e = t.googleDrive, n = {
3092
3314
  ...e,
3093
3315
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3094
3316
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3095
3317
  };
3096
- return new We(o);
3318
+ return new Je(n);
3097
3319
  } else
3098
3320
  throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
3099
3321
  }
@@ -3102,7 +3324,7 @@ class Je {
3102
3324
  */
3103
3325
  async init() {
3104
3326
  try {
3105
- if (Be(), this.containerRef)
3327
+ if (ti(), this.containerRef)
3106
3328
  this.containerEl = this.containerRef;
3107
3329
  else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
3108
3330
  throw new Error(`Container #${this.containerId} not found`);
@@ -3111,7 +3333,7 @@ class Je {
3111
3333
  onPrev: () => this.navigateToPreviousImage(),
3112
3334
  onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
3113
3335
  onDragEnd: (t) => {
3114
- t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, je);
3336
+ t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Xe);
3115
3337
  }
3116
3338
  }), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
3117
3339
  } catch (t) {
@@ -3154,7 +3376,7 @@ class Je {
3154
3376
  navigateToNextImage() {
3155
3377
  if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
3156
3378
  const t = (this.currentFocusIndex + 1) % this.imageLayouts.length, i = this.imageElements.find(
3157
- (o) => o.dataset.imageId === String(t)
3379
+ (n) => n.dataset.imageId === String(t)
3158
3380
  );
3159
3381
  if (!i) return;
3160
3382
  const e = this.imageLayouts[t];
@@ -3166,7 +3388,7 @@ class Je {
3166
3388
  navigateToPreviousImage() {
3167
3389
  if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
3168
3390
  const t = (this.currentFocusIndex - 1 + this.imageLayouts.length) % this.imageLayouts.length, i = this.imageElements.find(
3169
- (o) => o.dataset.imageId === String(t)
3391
+ (n) => n.dataset.imageId === String(t)
3170
3392
  );
3171
3393
  if (!i) return;
3172
3394
  const e = this.imageLayouts[t];
@@ -3182,8 +3404,8 @@ class Je {
3182
3404
  }, 500));
3183
3405
  }
3184
3406
  getImageHeight() {
3185
- const t = window.innerWidth, i = this.fullConfig.layout.responsive, o = this.fullConfig.image.sizing?.maxSize ?? 400;
3186
- 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);
3407
+ const t = window.innerWidth, i = this.fullConfig.layout.responsive, n = this.fullConfig.image.sizing?.maxSize ?? 400;
3408
+ 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);
3187
3409
  }
3188
3410
  /**
3189
3411
  * Get container bounds for layout calculations
@@ -3206,12 +3428,12 @@ class Je {
3206
3428
  this.showError("No images found."), this.showLoading(!1);
3207
3429
  return;
3208
3430
  }
3209
- const e = this.getContainerBounds(), o = this.getImageHeight(), a = window.innerWidth;
3210
- this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${o}px`);
3431
+ const e = this.getContainerBounds(), n = this.getImageHeight(), a = window.innerWidth;
3432
+ this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${n}px`);
3211
3433
  const r = this.layoutEngine.calculateAdaptiveSize(
3212
3434
  e,
3213
3435
  t,
3214
- o,
3436
+ n,
3215
3437
  a
3216
3438
  );
3217
3439
  this.logDebug(`Adaptive sizing result: height=${r.height}px`), await this.createImageCloud(i, r.height), this.showLoading(!1), this.imagesLoaded = !0;
@@ -3229,7 +3451,7 @@ class Je {
3229
3451
  if (!this.containerEl) return;
3230
3452
  const e = this.getContainerBounds();
3231
3453
  this.currentImageHeight = i;
3232
- const o = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3454
+ const n = this.loadGeneration, a = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3233
3455
  this.imageLayouts = a, this.displayQueue = [];
3234
3456
  let r = 0;
3235
3457
  const s = (l) => {
@@ -3242,7 +3464,7 @@ class Je {
3242
3464
  x: parseFloat(l.dataset.endX),
3243
3465
  y: parseFloat(l.dataset.endY)
3244
3466
  }, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), g = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : g, w = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
3245
- re({
3467
+ ue({
3246
3468
  element: l,
3247
3469
  startPosition: d,
3248
3470
  endPosition: f,
@@ -3275,6 +3497,10 @@ class Je {
3275
3497
  pathType: this.entryAnimationEngine.getPathType()
3276
3498
  });
3277
3499
  }
3500
+ if (this.idleAnimationEngine) {
3501
+ const d = this.entryAnimationEngine.getTiming().duration;
3502
+ this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
3503
+ }
3278
3504
  }), r++);
3279
3505
  }, c = () => {
3280
3506
  if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
@@ -3285,7 +3511,7 @@ class Je {
3285
3511
  return;
3286
3512
  }
3287
3513
  this.queueInterval !== null && clearInterval(this.queueInterval), this.queueInterval = window.setInterval(() => {
3288
- if (o !== this.loadGeneration) {
3514
+ if (n !== this.loadGeneration) {
3289
3515
  this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
3290
3516
  return;
3291
3517
  }
@@ -3312,7 +3538,7 @@ class Je {
3312
3538
  h.style.left = `${d - 6}px`, h.style.top = `${f - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(f)})`, this.containerEl.appendChild(h);
3313
3539
  })), t.forEach((l, u) => {
3314
3540
  const h = document.createElement("img");
3315
- h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
3541
+ h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.disableDragging && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
3316
3542
  const d = a[u];
3317
3543
  h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), st(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3318
3544
  if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
@@ -3327,7 +3553,7 @@ class Je {
3327
3553
  }), h.addEventListener("click", (f) => {
3328
3554
  f.stopPropagation(), this.handleImageClick(h, d);
3329
3555
  }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
3330
- if (o !== this.loadGeneration)
3556
+ if (n !== this.loadGeneration)
3331
3557
  return;
3332
3558
  const f = h.naturalWidth / h.naturalHeight, b = i * f;
3333
3559
  h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${b}`), h.style.width = `${b}px`, h.cachedRenderedWidth = b, h.aspectRatio = f, ft(h, this.fullConfig.styling?.default, i, b);
@@ -3342,7 +3568,7 @@ class Je {
3342
3568
  d.scale,
3343
3569
  b,
3344
3570
  i
3345
- ), R = this.entryAnimationEngine.buildStartTransform(
3571
+ ), I = this.entryAnimationEngine.buildStartTransform(
3346
3572
  m,
3347
3573
  p,
3348
3574
  d.rotation,
@@ -3360,28 +3586,29 @@ class Je {
3360
3586
  finalTransform: v,
3361
3587
  renderedWidth: b,
3362
3588
  renderedHeight: i
3363
- }), h.style.transform = R, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || w !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(w)), this.displayQueue.push(h);
3589
+ }), h.style.transform = I, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || w !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(w)), this.displayQueue.push(h);
3364
3590
  }, h.onerror = () => r++, h.src = l;
3365
3591
  });
3366
3592
  }
3367
3593
  async handleImageClick(t, i) {
3368
3594
  if (!this.containerEl) return;
3369
- const e = this.zoomEngine.isFocused(t), o = {
3595
+ const e = this.zoomEngine.isFocused(t), n = {
3370
3596
  width: this.containerEl.offsetWidth,
3371
3597
  height: this.containerEl.offsetHeight
3372
3598
  };
3373
3599
  if (e)
3374
3600
  await this.zoomEngine.unfocusImage(), this.currentFocusIndex = null, this.swipeEngine?.disable(), this.hideCounter();
3375
3601
  else {
3602
+ this.idleAnimationEngine?.pauseForImage(t);
3376
3603
  const a = t.dataset.imageId;
3377
- this.currentFocusIndex = a !== void 0 ? parseInt(a, 10) : null, this.swipeEngine?.enable(), await this.zoomEngine.focusImage(t, o, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex);
3604
+ this.currentFocusIndex = a !== void 0 ? parseInt(a, 10) : null, this.swipeEngine?.enable(), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex);
3378
3605
  }
3379
3606
  }
3380
3607
  /**
3381
3608
  * Clear the image cloud and reset state
3382
3609
  */
3383
3610
  clearImageCloud() {
3384
- this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.imagesLoaded = !1;
3611
+ this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.idleAnimationEngine?.stopAll(), this.imagesLoaded = !1;
3385
3612
  }
3386
3613
  showLoading(t) {
3387
3614
  !this.fullConfig.rendering.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
@@ -3402,10 +3629,10 @@ class Je {
3402
3629
  * Destroy the gallery and clean up resources
3403
3630
  */
3404
3631
  destroy() {
3405
- this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy();
3632
+ this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
3406
3633
  }
3407
3634
  }
3408
- const Rt = class Rt extends HTMLElement {
3635
+ const It = class It extends HTMLElement {
3409
3636
  constructor() {
3410
3637
  super(...arguments), this._instance = null, this._container = null;
3411
3638
  }
@@ -3437,17 +3664,17 @@ const Rt = class Rt extends HTMLElement {
3437
3664
  } catch (a) {
3438
3665
  console.error("<image-cloud> invalid images JSON:", a);
3439
3666
  }
3440
- const o = this.getAttribute("layout");
3441
- return o && (t.layout = {
3667
+ const n = this.getAttribute("layout");
3668
+ return n && (t.layout = {
3442
3669
  ...t.layout,
3443
- algorithm: o
3670
+ algorithm: n
3444
3671
  }), t;
3445
3672
  }
3446
3673
  _init() {
3447
3674
  if (this._container)
3448
3675
  try {
3449
3676
  const t = this._getOptions();
3450
- this._instance = new Je({
3677
+ this._instance = new ei({
3451
3678
  container: this._container,
3452
3679
  ...t
3453
3680
  }), this._instance.init().then(() => {
@@ -3463,8 +3690,8 @@ const Rt = class Rt extends HTMLElement {
3463
3690
  this._instance?.destroy(), this._instance = null;
3464
3691
  }
3465
3692
  };
3466
- Rt.observedAttributes = ["config", "images", "layout"];
3467
- let yt = Rt;
3693
+ It.observedAttributes = ["config", "images", "layout"];
3694
+ let yt = It;
3468
3695
  typeof customElements < "u" && !customElements.get("image-cloud") && customElements.define("image-cloud", yt);
3469
3696
  export {
3470
3697
  yt as ImageCloudElement