@wyxos/vibe 3.0.3 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -84,7 +84,7 @@ var R = (e) => {
84
84
  }], ["path", {
85
85
  d: "M14 2v5a1 1 0 0 0 1 1h5",
86
86
  key: "wfsgrz"
87
- }]]), X = K("image-plus", [
87
+ }]]), ne = K("image-plus", [
88
88
  ["path", {
89
89
  d: "M16 5h6",
90
90
  key: "1vod17"
@@ -107,10 +107,10 @@ var R = (e) => {
107
107
  r: "2",
108
108
  key: "af1f0g"
109
109
  }]
110
- ]), ne = K("loader-circle", [["path", {
110
+ ]), re = K("loader-circle", [["path", {
111
111
  d: "M21 12a9 9 0 1 1-6.219-8.56",
112
112
  key: "13zald"
113
- }]]), re = K("pause", [["rect", {
113
+ }]]), ie = K("pause", [["rect", {
114
114
  x: "14",
115
115
  y: "3",
116
116
  width: "5",
@@ -124,10 +124,10 @@ var R = (e) => {
124
124
  height: "18",
125
125
  rx: "1",
126
126
  key: "1wsw3u"
127
- }]]), ie = K("play", [["path", {
127
+ }]]), ae = K("play", [["path", {
128
128
  d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
129
129
  key: "10ikf1"
130
- }]]), ae = K("triangle-alert", [
130
+ }]]), oe = K("triangle-alert", [
131
131
  ["path", {
132
132
  d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
133
133
  key: "wmoenq"
@@ -141,13 +141,13 @@ var R = (e) => {
141
141
  key: "p32p05"
142
142
  }]
143
143
  ]);
144
- function Z(e, t = 150) {
145
- return se(e, (e) => `${e.surface}|${e.occurrenceKey}|${e.url}|${e.kind}`, t);
144
+ function se(e, t = 150) {
145
+ return ce(e, (e) => `${e.surface}|${e.occurrenceKey}|${e.url}|${e.kind}`, t);
146
146
  }
147
- function oe(e, t = 150) {
148
- return se(e, (e) => `${e.surface}|${e.occurrenceKey}|${e.url}`, t);
147
+ function X(e, t = 150) {
148
+ return ce(e, (e) => `${e.surface}|${e.occurrenceKey}|${e.url}`, t);
149
149
  }
150
- function se(e, t, n) {
150
+ function ce(e, t, n) {
151
151
  let r = [], i = /* @__PURE__ */ new Set(), a = null;
152
152
  function o(e) {
153
153
  let o = t(e);
@@ -170,142 +170,30 @@ function se(e, t, n) {
170
170
  };
171
171
  }
172
172
  //#endregion
173
- //#region src/components/viewer-core/useAssetLoadQueue.ts
174
- var ce = {
175
- maxGlobal: 10,
176
- maxPerDomain: 4,
177
- maxVideoPerDomain: 2
178
- };
179
- function le(e) {
180
- return {
181
- maxGlobal: e?.maxGlobal ?? ce.maxGlobal,
182
- maxPerDomain: e?.maxPerDomain ?? ce.maxPerDomain,
183
- maxVideoPerDomain: e?.maxVideoPerDomain ?? ce.maxVideoPerDomain
184
- };
185
- }
186
- function Q(e) {
187
- let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = le(e), i = 0;
188
- function a(e) {
189
- let r = {
190
- ...e,
191
- domain: de(e.url),
192
- enqueuedAt: i,
193
- id: `vibe-asset-load-${i += 1}`
194
- };
195
- return n.set(r.id, r), o(), {
196
- cancel() {
197
- (n.delete(r.id) || t.delete(r.id)) && o();
198
- },
199
- refresh() {
200
- o();
201
- },
202
- release() {
203
- (t.delete(r.id) || n.delete(r.id)) && o();
204
- }
205
- };
206
- }
207
- function o() {
208
- if (n.size === 0) return;
209
- let e = [...n.values()].sort((e, t) => {
210
- let n = ue(e) - ue(t);
211
- return n === 0 ? e.enqueuedAt - t.enqueuedAt : n;
212
- });
213
- for (let i of e) {
214
- if (t.size >= r.maxGlobal) return;
215
- if (l(i)) {
216
- n.delete(i.id), t.set(i.id, i);
217
- try {
218
- i.onGrant();
219
- } catch {
220
- t.delete(i.id);
221
- }
222
- }
223
- }
224
- }
225
- function s() {
226
- return { ...r };
227
- }
228
- function c(e) {
229
- r = le(e), o();
230
- }
231
- function l(e) {
232
- let n = [...t.values()].filter((t) => t.domain === e.domain);
233
- return !(n.length >= r.maxPerDomain || e.assetType === "video" && n.filter((e) => e.assetType === "video").length >= r.maxVideoPerDomain);
234
- }
235
- return {
236
- getLimits: s,
237
- request: a,
238
- setLimits: c
239
- };
240
- }
241
- function ue(e) {
242
- try {
243
- let t = e.getPriority();
244
- return Number.isFinite(t) ? t : Infinity;
245
- } catch {
246
- return Infinity;
247
- }
248
- }
249
- function de(e) {
250
- try {
251
- return new URL(e).hostname || "local";
252
- } catch {
253
- return "local";
254
- }
255
- }
256
- //#endregion
257
173
  //#region src/components/viewer-core/dom.ts
258
- function fe(e) {
174
+ function Z(e) {
259
175
  return e instanceof HTMLElement && [
260
176
  "INPUT",
261
177
  "TEXTAREA",
262
178
  "SELECT"
263
179
  ].includes(e.tagName);
264
180
  }
265
- function pe(e) {
181
+ function Q(e) {
266
182
  return e instanceof HTMLElement && !!e.closest("[data-swipe-lock], input, textarea, select, a");
267
183
  }
268
184
  //#endregion
269
- //#region src/components/viewer-core/itemIdentity.ts
270
- var me = "__vibeOccurrenceKey";
271
- function $(e) {
272
- let t = e[me];
273
- return typeof t == "string" && t.length > 0 ? t : e.id;
274
- }
275
- function he(e, t, n) {
276
- let r = /* @__PURE__ */ new Map(), i = [], a = n;
277
- for (let e of t) {
278
- let t = r.get(e.id), n = $(e);
279
- t ? t.push(n) : r.set(e.id, [n]);
280
- }
281
- for (let t of e) {
282
- let e = r.get(t.id)?.shift() ?? `vibe-occurrence-${a += 1}`;
283
- i.push(ge(t, e));
284
- }
285
- return {
286
- items: i,
287
- nextSequence: a
288
- };
289
- }
290
- function ge(e, t) {
291
- return $(e) === t ? e : {
292
- ...e,
293
- [me]: t
294
- };
295
- }
296
- //#endregion
297
185
  //#region src/components/viewer-core/removalState.ts
298
- function _e() {
186
+ function le() {
299
187
  let e = T(/* @__PURE__ */ new Set()), t = T([]);
300
188
  function n(n) {
301
- let r = ve(n).filter((t) => !e.value.has(t));
189
+ let r = ue(n).filter((t) => !e.value.has(t));
302
190
  if (!r.length) return { ids: [] };
303
191
  let i = new Set(e.value);
304
192
  for (let e of r) i.add(e);
305
193
  return e.value = i, t.value = [...t.value, r], { ids: r };
306
194
  }
307
195
  function r(t) {
308
- let n = ve(t).filter((t) => e.value.has(t));
196
+ let n = ue(t).filter((t) => e.value.has(t));
309
197
  if (!n.length) return { ids: [] };
310
198
  let r = new Set(e.value);
311
199
  for (let e of n) r.delete(e);
@@ -336,64 +224,92 @@ function _e() {
336
224
  undo: i
337
225
  };
338
226
  }
339
- function ve(e) {
227
+ function ue(e) {
340
228
  let t = Array.isArray(e) ? e : [e];
341
229
  return Array.from(new Set(t.filter((e) => typeof e == "string" && e.length > 0)));
342
230
  }
343
231
  //#endregion
232
+ //#region src/components/viewer-core/itemIdentity.ts
233
+ var de = "__vibeOccurrenceKey";
234
+ function $(e) {
235
+ let t = e[de];
236
+ return typeof t == "string" && t.length > 0 ? t : e.id;
237
+ }
238
+ function fe(e, t, n) {
239
+ let r = /* @__PURE__ */ new Map(), i = [], a = n;
240
+ for (let e of t) {
241
+ let t = r.get(e.id), n = $(e);
242
+ t ? t.push(n) : r.set(e.id, [n]);
243
+ }
244
+ for (let t of e) {
245
+ let e = r.get(t.id)?.shift() ?? `vibe-occurrence-${a += 1}`;
246
+ i.push(pe(t, e));
247
+ }
248
+ return {
249
+ items: i,
250
+ nextSequence: a
251
+ };
252
+ }
253
+ function pe(e, t) {
254
+ return $(e) === t ? e : {
255
+ ...e,
256
+ [de]: t
257
+ };
258
+ }
259
+ //#endregion
344
260
  //#region src/components/viewer-core/autoBuckets.ts
345
- function ye(e) {
261
+ function me(e) {
346
262
  return e.flatMap((e) => e.items);
347
263
  }
348
- function be(e, t) {
264
+ function he(e, t) {
349
265
  return t.size ? e.filter((e) => !t.has(e.id)) : e;
350
266
  }
351
- function xe(e, t) {
352
- return be(e.items, t);
267
+ function ge(e, t) {
268
+ return he(e.items, t);
353
269
  }
354
- function Se(e, t) {
355
- return xe(e, t).length;
270
+ function _e(e, t) {
271
+ return ge(e, t).length;
356
272
  }
357
- function Ce(e, t, n) {
273
+ function ve(e, t, n) {
358
274
  if (n < 0) return null;
359
275
  let r = 0;
360
276
  for (let i of e) {
361
- let e = xe(i, t), a = r + e.length;
277
+ let e = ge(i, t), a = r + e.length;
362
278
  if (n < a) return i.cursor;
363
279
  r = a;
364
280
  }
365
281
  return null;
366
282
  }
367
- function we(e, t, n) {
283
+ function ye(e, t, n) {
368
284
  let r = [...e], i = r.findIndex((e) => e.cursor === t);
369
285
  return i >= 0 && r.splice(i, 1, n), r;
370
286
  }
371
- function Te(e, t, n) {
372
- let r = he(e, t, n);
287
+ function be(e, t, n) {
288
+ let r = fe(e, t, n);
373
289
  return {
374
290
  items: r.items,
375
291
  nextSequence: r.nextSequence
376
292
  };
377
293
  }
378
- function Ee(e) {
379
- return e === "filling" || e === "loading" || e === "reloading";
294
+ function xe(e) {
295
+ return e === "filling" || e === "initializing" || e === "loading" || e === "refreshing";
380
296
  }
381
- function De(e) {
297
+ function Se(e) {
382
298
  return !e || !Number.isFinite(e) || e < 1 ? 25 : Math.floor(e);
383
299
  }
384
- function Oe(e) {
300
+ function Ce(e) {
385
301
  return e ?? "__vibe_initial_cursor__";
386
302
  }
387
- function ke(e, t, n) {
303
+ function we(e, t, n) {
388
304
  return Math.min(Math.max(e, t), n);
389
305
  }
390
306
  //#endregion
391
307
  //#region src/components/viewer-core/autoResolveState.ts
392
- function Ae(e) {
308
+ function Te(e) {
393
309
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && (e.name === "AbortError" || e.name === "CanceledError") ? !0 : typeof e == "object" && !!e && "code" in e && e.code === "ERR_CANCELED";
394
310
  }
395
- function je(e) {
396
- let t = Te(e.nextItems, e.previousItems, e.sequence);
311
+ function Ee(e) {
312
+ let t = be(e.nextItems, e.previousItems, e.sequence);
397
313
  return {
398
314
  bucket: {
399
315
  cursor: e.cursor,
@@ -404,7 +320,7 @@ function je(e) {
404
320
  nextSequence: t.nextSequence
405
321
  };
406
322
  }
407
- function Me(e, t, n, r) {
323
+ function De(e, t, n, r) {
408
324
  if (!e.length) return r ? null : {
409
325
  buckets: [],
410
326
  canceled: r,
@@ -414,46 +330,46 @@ function Me(e, t, n, r) {
414
330
  return {
415
331
  buckets: i,
416
332
  canceled: r,
417
- visibleCount: i.reduce((e, t) => e + Se(t, n), 0)
333
+ visibleCount: i.reduce((e, t) => e + _e(t, n), 0)
418
334
  };
419
335
  }
420
- function Ne(e) {
421
- let t = je({
336
+ function Oe(e) {
337
+ let t = Ee({
422
338
  cursor: e.initialState.cursor,
423
339
  nextCursor: e.initialState.nextCursor ?? null,
424
340
  nextItems: e.initialState.items,
425
341
  previousCursor: e.initialState.previousCursor ?? null,
426
342
  previousItems: [],
427
343
  sequence: e.sequence
428
- }), n = be(t.bucket.items, e.removedIds);
344
+ }), n = he(t.bucket.items, e.removedIds);
429
345
  return {
430
- activeIndex: ke(e.initialState.activeIndex ?? 0, 0, Math.max(0, n.length - 1)),
346
+ activeIndex: we(e.initialState.activeIndex ?? 0, 0, Math.max(0, n.length - 1)),
431
347
  buckets: [t.bucket],
432
348
  nextSequence: t.nextSequence
433
349
  };
434
350
  }
435
- function Pe(e, t) {
436
- let n = e[ke(t, 0, Math.max(0, e.length - 1))];
351
+ function ke(e, t) {
352
+ let n = e[we(t, 0, Math.max(0, e.length - 1))];
437
353
  return n ? $(n) : null;
438
354
  }
439
- function Fe(e, t, n = null) {
355
+ function Ae(e, t, n = null) {
440
356
  if (!e.length) return 0;
441
357
  let r = n ? e.findIndex((e) => $(e) === n) : -1;
442
- return r >= 0 ? r : ke(t, 0, e.length - 1);
358
+ return r >= 0 ? r : we(t, 0, e.length - 1);
443
359
  }
444
- function Ie(e, t, n) {
445
- return e ? Se(e, t) < n : !1;
360
+ function je(e, t, n) {
361
+ return e ? _e(e, t) < n : !1;
446
362
  }
447
363
  //#endregion
448
364
  //#region src/components/viewer-core/fillDelay.ts
449
- var Le = 1e3, Re = 100;
450
- function ze(e, t = Le, n = 250) {
365
+ var Me = 2e3, Ne = 1e3, Pe = 100;
366
+ function Fe(e, t = Me, n = Ne) {
451
367
  return t + Math.max(0, e - 1) * n;
452
368
  }
453
- function Be(e, t) {
369
+ function Ie(e, t) {
454
370
  return !Number.isFinite(e) || e == null || e < 0 ? t : Math.floor(e);
455
371
  }
456
- function Ve() {
372
+ function Le() {
457
373
  let e = T(null), t = null, n = null, r = null;
458
374
  function i(i = !1) {
459
375
  if (t &&= (clearInterval(t), null), n &&= (clearTimeout(n), null), e.value = null, i && r) {
@@ -471,7 +387,7 @@ function Ve() {
471
387
  let t = Math.max(0, a - (Date.now() - s));
472
388
  e.value = t, t <= 0 && l();
473
389
  };
474
- t = setInterval(u, Re), n = setTimeout(l, a), u();
390
+ t = setInterval(u, Pe), n = setTimeout(l, a), u();
475
391
  }));
476
392
  }
477
393
  return {
@@ -482,384 +398,345 @@ function Ve() {
482
398
  }
483
399
  //#endregion
484
400
  //#region src/components/viewer-core/useAutoResolveSource.ts
485
- function He(e) {
486
- let t = T([]), n = T(0), r = T([]), a = T(null), o = T("idle"), s = T(null), c = Ve(), l = c.remainingMs, u = T(null), d = T(!1), f = T(!0), p = /* @__PURE__ */ new Set(), m = null, h = null, g = 0, _ = 0, v = i(() => Be(e.fillDelayMs, Le)), y = i(() => Be(e.fillDelayStepMs, 250)), S = i(() => e.mode ?? "dynamic"), C = i(() => De(e.pageSize)), w = i(() => ye(t.value)), E = i(() => be(w.value, e.removedIds.value)), D = i(() => n.value), O = i(() => Ee(o.value) || d.value), k = i(() => t.value[0] ?? null), A = i(() => t.value[t.value.length - 1] ?? null), j = i(() => A.value?.nextCursor ?? null), M = i(() => k.value?.previousCursor ?? null), N = i(() => !!j.value), F = i(() => !!M.value), I = i(() => be(ye(r.value), e.removedIds.value)), L = i(() => Ce(t.value, e.removedIds.value, D.value)), ee = i(() => !E.value.length && !O.value && !!a.value);
487
- P(() => E.value.length, (e) => {
401
+ function Re(e) {
402
+ let t = !!e.initialState?.items.length, n = T([]), r = T(0), a = T([]), o = T(null), s = T(!t && typeof e.resolve == "function" ? "initializing" : "idle"), c = T(null), l = Le(), u = l.remainingMs, d = T(null), f = T(!1), p = T(!0), m = /* @__PURE__ */ new Set(), h = null, g = null, _ = 0, v = 0, y = i(() => Ie(e.fillDelayMs, Me)), S = i(() => Ie(e.fillDelayStepMs, Ne)), C = i(() => typeof e.resolve == "function"), w = i(() => e.mode ?? "dynamic"), E = i(() => Se(e.pageSize)), D = i(() => me(n.value)), O = i(() => he(D.value, e.removedIds.value)), k = i(() => r.value), A = i(() => xe(s.value) || f.value), j = i(() => n.value[0] ?? null), M = i(() => n.value[n.value.length - 1] ?? null), N = i(() => M.value?.nextCursor ?? null), F = i(() => j.value?.previousCursor ?? null), I = i(() => !!N.value), L = i(() => !!F.value), ee = i(() => C.value && n.value.length > 0), R = i(() => he(me(a.value), e.removedIds.value)), z = i(() => ve(n.value, e.removedIds.value, k.value)), B = i(() => !O.value.length && !A.value && !!o.value);
403
+ P(() => O.value.length, (e) => {
488
404
  if (e === 0) {
489
- n.value = 0;
405
+ r.value = 0;
490
406
  return;
491
407
  }
492
- n.value > e - 1 && (n.value = e - 1);
493
- }), P(() => n.value, () => {
494
- f.value && Y();
408
+ r.value > e - 1 && (r.value = e - 1);
409
+ }), P(() => r.value, () => {
410
+ p.value && ie();
495
411
  }), x(() => {
496
- e.resolve && (oe() || R());
412
+ Q() || e.resolve && V();
497
413
  }), b(() => {
498
- m?.abort(), m = null, c.clear(!0);
414
+ h?.abort(), h = null, l.clear(!0);
499
415
  });
500
- async function R() {
501
- h = R;
502
- let r = await ie({
503
- continueUntilFilled: S.value === "dynamic",
416
+ async function V() {
417
+ g = V;
418
+ let t = await X({
419
+ continueUntilFilled: w.value === "dynamic",
504
420
  cursor: e.initialCursor ?? null,
505
421
  direction: "forward",
506
- phase: "loading"
422
+ phase: "initializing"
507
423
  });
508
- r && (t.value = r.buckets, n.value = 0, Z());
424
+ t && (n.value = t.buckets, r.value = 0, Z());
509
425
  }
510
- async function z() {
511
- if (!(!N.value || O.value)) {
512
- if (S.value === "static" && ce("trailing")) return re("trailing");
513
- await X(j.value);
426
+ async function H() {
427
+ if (!A.value) {
428
+ if (!I.value) return ee.value ? se("trailing") : void 0;
429
+ if (w.value === "static" && ue("trailing")) return se("trailing");
430
+ await ae(N.value);
514
431
  }
515
432
  }
516
- async function B() {
517
- if (!(!F.value || O.value)) {
518
- if (S.value === "static" && ce("leading")) return re("leading");
519
- await ne(M.value);
433
+ async function U() {
434
+ if (!(!L.value || A.value)) {
435
+ if (w.value === "static" && ue("leading")) return se("leading");
436
+ await oe(F.value);
520
437
  }
521
438
  }
522
- async function V() {
523
- if (ee.value) {
524
- if (t.value = [], n.value = 0, r.value = [], a.value = null, o.value = "idle", s.value = null, u.value = null, d.value = !1, p.clear(), m?.abort(), m = null, c.clear(!0), oe()) {
439
+ async function W() {
440
+ if (B.value) {
441
+ if (n.value = [], r.value = 0, a.value = [], o.value = null, s.value = C.value ? "initializing" : "idle", c.value = null, d.value = null, f.value = !1, m.clear(), h?.abort(), h = null, l.clear(!0), Q()) {
525
442
  Z();
526
443
  return;
527
444
  }
528
- await R();
445
+ await V();
529
446
  }
530
447
  }
531
- async function H() {
532
- if (ee.value) return V();
533
- o.value !== "failed" || !h || (a.value = null, await h());
448
+ async function G() {
449
+ if (B.value) return W();
450
+ s.value !== "failed" || !g || (o.value = null, await g());
534
451
  }
535
- async function U() {
536
- if (!r.value.length) return d.value = !1, Z();
537
- t.value = [...t.value, ...r.value], r.value = [], d.value = !1, Z();
452
+ async function K() {
453
+ if (!a.value.length) return f.value = !1, Z();
454
+ n.value = [...n.value, ...a.value], a.value = [], f.value = !1, Z();
538
455
  }
539
- function W(t) {
540
- let r = E.value;
541
- if (!r.length) return;
542
- let i = ke(t, 0, r.length - 1);
543
- i !== n.value && (n.value = i, e.emit("update:activeIndex", i));
456
+ function q(t) {
457
+ let n = O.value;
458
+ if (!n.length) return;
459
+ let i = we(t, 0, n.length - 1);
460
+ i !== r.value && (r.value = i, e.emit("update:activeIndex", i));
544
461
  }
545
- function G(e) {
546
- f.value = e;
462
+ function J(e) {
463
+ p.value = e;
547
464
  }
548
- function K() {
549
- g += 1, m?.abort(), m = null, c.clear(!0), p.clear(), a.value = null, s.value = null, u.value = null, r.value.length > 0 && (t.value = [...t.value, ...r.value], r.value = []), d.value = !1, Z();
465
+ function te() {
466
+ _ += 1, h?.abort(), h = null, l.clear(!0), m.clear(), o.value = null, c.value = null, d.value = null, a.value.length > 0 && (n.value = [...n.value, ...a.value], a.value = []), f.value = !1, Z();
550
467
  }
551
- function q() {
552
- return Pe(E.value, D.value);
468
+ function Y() {
469
+ return ke(O.value, k.value);
553
470
  }
554
- function J(e = null) {
555
- n.value = Fe(E.value, D.value, e);
471
+ function ne(e = null) {
472
+ r.value = Ae(O.value, k.value, e);
556
473
  }
557
- function te() {
558
- r.value.length > 0 && !I.value.length && U();
474
+ function re() {
475
+ a.value.length > 0 && !R.value.length && K();
559
476
  }
560
- async function Y() {
561
- !E.value.length || se() || (F.value && n.value < 3 && await B(), N.value && n.value >= E.value.length - 3 && await z());
477
+ async function ie() {
478
+ !O.value.length || le() || (L.value && r.value < 3 && await U(), I.value && r.value >= O.value.length - 3 && await H());
562
479
  }
563
- async function X(e) {
564
- h = async () => {
565
- await X(e);
480
+ async function ae(e) {
481
+ g = async () => {
482
+ await ae(e);
566
483
  };
567
- let n = await ie({
568
- continueUntilFilled: S.value === "dynamic",
484
+ let t = await X({
485
+ continueUntilFilled: w.value === "dynamic",
569
486
  cursor: e,
570
487
  direction: "forward",
571
488
  phase: "loading"
572
489
  });
573
- if (n) {
574
- if (n.canceled) return t.value = [...t.value, ...n.buckets], r.value = [], d.value = !1, Z();
575
- if (r.value = n.buckets, !I.value.length) return t.value = [...t.value, ...r.value], r.value = [], d.value = !1, Z();
576
- d.value = !0;
490
+ if (t) {
491
+ if (t.canceled) return n.value = [...n.value, ...t.buckets], a.value = [], f.value = !1, Z();
492
+ if (a.value = t.buckets, !R.value.length) return n.value = [...n.value, ...a.value], a.value = [], f.value = !1, Z();
493
+ f.value = !0;
577
494
  }
578
495
  }
579
- async function ne(e) {
580
- h = async () => {
581
- await ne(e);
496
+ async function oe(e) {
497
+ g = async () => {
498
+ await oe(e);
582
499
  };
583
- let n = await ie({
584
- continueUntilFilled: S.value === "dynamic",
500
+ let t = await X({
501
+ continueUntilFilled: w.value === "dynamic",
585
502
  cursor: e,
586
503
  direction: "backward",
587
504
  phase: "loading"
588
505
  });
589
- if (!n) return;
590
- let r = q();
591
- t.value = [...n.buckets, ...t.value], J(r), Z();
506
+ if (!t) return;
507
+ let r = Y();
508
+ n.value = [...t.buckets, ...n.value], ne(r), Z();
592
509
  }
593
- async function re(n) {
594
- if (h = async () => {
595
- await re(n);
510
+ async function se(t) {
511
+ if (g = async () => {
512
+ await se(t);
596
513
  }, !e.resolve) return;
597
- let r = n === "leading" ? k.value : A.value;
514
+ let r = t === "leading" ? j.value : M.value;
598
515
  if (!r) return;
599
- let i = Oe(r.cursor);
600
- if (p.has(i)) return;
601
- p.add(i), a.value = null, o.value = "reloading", s.value = null, u.value = null;
602
- let c = ++g, l = typeof AbortController > "u" ? null : new AbortController();
603
- m = l;
516
+ let i = Ce(r.cursor);
517
+ if (m.has(i)) return;
518
+ m.add(i), o.value = null, s.value = "refreshing", c.value = null, d.value = null;
519
+ let a = ++_, l = typeof AbortController > "u" ? null : new AbortController();
520
+ h = l;
604
521
  try {
605
- let n = await e.resolve({
522
+ let t = await e.resolve({
606
523
  cursor: r.cursor,
607
- pageSize: C.value,
524
+ pageSize: E.value,
608
525
  signal: l?.signal
609
526
  });
610
- if (c !== g) return Z();
611
- let i = ae({
527
+ if (a !== _) return Z();
528
+ let i = ce({
612
529
  cursor: r.cursor,
613
- nextCursor: n.nextPage,
614
- nextItems: n.items,
615
- previousCursor: n.previousPage ?? null,
530
+ nextCursor: t.nextPage,
531
+ nextItems: t.items,
532
+ previousCursor: t.previousPage ?? null,
616
533
  previousItems: r.items
617
- }), a = q();
618
- t.value = we(t.value, r.cursor, i), J(a), Z();
534
+ }), o = Y();
535
+ n.value = ye(n.value, r.cursor, i), ne(o), Z();
619
536
  } catch (e) {
620
- if (Ae(e) || c !== g) {
537
+ if (Te(e) || a !== _) {
621
538
  Z();
622
539
  return;
623
540
  }
624
- a.value = e instanceof Error ? e.message : "The viewer could not load items.", o.value = "failed", s.value = null, u.value = null;
541
+ o.value = e instanceof Error ? e.message : "The viewer could not load items.", s.value = "failed", c.value = null, d.value = null;
625
542
  } finally {
626
- m === l && (m = null), p.delete(i);
543
+ h === l && (h = null), m.delete(i);
627
544
  }
628
545
  }
629
- async function ie(t) {
546
+ async function X(t) {
630
547
  if (!e.resolve) return null;
631
- let n = ++g, r = /* @__PURE__ */ new Set(), i = [], l = t.cursor, d = 0;
632
- for (a.value = null, o.value = t.phase, s.value = null, u.value = null;;) {
633
- if (n !== g) return Me(i, t.direction, e.removedIds.value, !0);
634
- let f = Oe(l);
635
- if (r.has(f) || p.has(f)) break;
636
- r.add(f), p.add(f);
637
- let h = typeof AbortController > "u" ? null : new AbortController();
638
- m = h;
548
+ let n = ++_, r = /* @__PURE__ */ new Set(), i = [], a = t.cursor, u = 0;
549
+ for (o.value = null, s.value = t.phase, c.value = null, d.value = null;;) {
550
+ if (n !== _) return De(i, t.direction, e.removedIds.value, !0);
551
+ let f = Ce(a);
552
+ if (r.has(f) || m.has(f)) break;
553
+ r.add(f), m.add(f);
554
+ let p = typeof AbortController > "u" ? null : new AbortController();
555
+ h = p;
639
556
  try {
640
557
  let r = await e.resolve({
641
- cursor: l,
642
- pageSize: C.value,
643
- signal: h?.signal
558
+ cursor: a,
559
+ pageSize: E.value,
560
+ signal: p?.signal
644
561
  });
645
- if (n !== g) return Me(i, t.direction, e.removedIds.value, !0);
646
- let a = ae({
647
- cursor: l,
562
+ if (n !== _) return De(i, t.direction, e.removedIds.value, !0);
563
+ let o = ce({
564
+ cursor: a,
648
565
  nextCursor: r.nextPage,
649
566
  nextItems: r.items,
650
567
  previousCursor: r.previousPage ?? null,
651
568
  previousItems: []
652
569
  });
653
- i.push(a);
654
- let f = i.reduce((t, n) => t + Se(n, e.removedIds.value), 0), p = t.direction === "forward" ? a.nextCursor : a.previousCursor;
655
- if (!t.continueUntilFilled || f >= C.value || !p) return {
570
+ i.push(o);
571
+ let f = i.reduce((t, n) => t + _e(n, e.removedIds.value), 0), m = t.direction === "forward" ? o.nextCursor : o.previousCursor;
572
+ if (!t.continueUntilFilled || f >= E.value || !m) return {
656
573
  canceled: !1,
657
574
  buckets: t.direction === "backward" ? [...i].reverse() : i,
658
575
  visibleCount: f
659
576
  };
660
- o.value = "filling", s.value = f, u.value = C.value, d += 1;
661
- let m = ze(d, v.value, y.value);
662
- if (await c.wait(m), n !== g) return Me(i, t.direction, e.removedIds.value, !0);
663
- l = p;
577
+ s.value = "filling", c.value = f, d.value = E.value, u += 1;
578
+ let h = Fe(u, y.value, S.value);
579
+ if (await l.wait(h), n !== _) return De(i, t.direction, e.removedIds.value, !0);
580
+ a = m;
664
581
  } catch (r) {
665
- return Ae(r) || n !== g ? Me(i, t.direction, e.removedIds.value, !0) : (a.value = r instanceof Error ? r.message : "The viewer could not load items.", o.value = "failed", s.value = null, u.value = null, null);
582
+ return Te(r) || n !== _ ? De(i, t.direction, e.removedIds.value, !0) : (o.value = r instanceof Error ? r.message : "The viewer could not load items.", s.value = "failed", c.value = null, d.value = null, null);
666
583
  } finally {
667
- m === h && (m = null), p.delete(f);
584
+ h === p && (h = null), m.delete(f);
668
585
  }
669
586
  }
670
- return Me(i, t.direction, e.removedIds.value, !1);
587
+ return De(i, t.direction, e.removedIds.value, !1);
671
588
  }
672
- function ae(e) {
673
- let t = je({
589
+ function ce(e) {
590
+ let t = Ee({
674
591
  cursor: e.cursor,
675
592
  nextCursor: e.nextCursor,
676
593
  nextItems: e.nextItems,
677
594
  previousCursor: e.previousCursor,
678
595
  previousItems: e.previousItems,
679
- sequence: _
596
+ sequence: v
680
597
  });
681
- return _ = t.nextSequence, t.bucket;
598
+ return v = t.nextSequence, t.bucket;
682
599
  }
683
600
  function Z() {
684
- o.value = "idle", s.value = null, u.value = null, c.clear();
601
+ s.value = "idle", c.value = null, d.value = null, l.clear();
685
602
  }
686
- function oe() {
603
+ function Q() {
687
604
  if (!e.initialState || !e.initialState.items.length) return !1;
688
- let i = Ne({
605
+ let t = Oe({
689
606
  initialState: e.initialState,
690
607
  removedIds: e.removedIds.value,
691
- sequence: _
608
+ sequence: v
692
609
  });
693
- return t.value = i.buckets, n.value = i.activeIndex, _ = i.nextSequence, a.value = null, r.value = [], d.value = !1, !0;
610
+ return n.value = t.buckets, r.value = t.activeIndex, v = t.nextSequence, o.value = null, a.value = [], f.value = !1, !0;
694
611
  }
695
- function se() {
696
- return o.value === "loading" && t.value.length === 0 && r.value.length === 0;
612
+ function le() {
613
+ return s.value === "initializing";
697
614
  }
698
- function ce(t) {
699
- return Ie(t === "leading" ? k.value : A.value, e.removedIds.value, C.value);
615
+ function ue(t) {
616
+ return je(t === "leading" ? j.value : M.value, e.removedIds.value, E.value);
700
617
  }
701
618
  return {
702
- activeIndex: D,
703
- canRetryInitialLoad: ee,
704
- cancel: K,
705
- commitPendingAppend: U,
706
- currentCursor: L,
707
- errorMessage: a,
708
- fillCollectedCount: s,
709
- fillDelayRemainingMs: l,
710
- fillTargetCount: u,
711
- hasNextPage: N,
712
- hasPreviousPage: F,
713
- items: E,
714
- loading: O,
715
- mode: S,
716
- nextCursor: j,
717
- pendingAppendItems: I,
718
- phase: o,
719
- prefetchNextPage: z,
720
- prefetchPreviousPage: B,
721
- previousCursor: M,
722
- retryInitialLoad: V,
723
- retry: H,
724
- setActiveIndex: W,
725
- setAutoPrefetchEnabled: G,
726
- syncActiveIndexAfterVisibilityChange: J,
727
- getActiveOccurrenceKey: q,
728
- maybeCommitPendingAppendWhenFilteredOut: te
619
+ activeIndex: k,
620
+ canRetryInitialLoad: B,
621
+ cancel: te,
622
+ canRefreshTrailingBoundary: ee,
623
+ commitPendingAppend: K,
624
+ currentCursor: z,
625
+ errorMessage: o,
626
+ fillCollectedCount: c,
627
+ fillDelayRemainingMs: u,
628
+ fillTargetCount: d,
629
+ hasNextPage: I,
630
+ hasPreviousPage: L,
631
+ items: O,
632
+ loading: A,
633
+ mode: w,
634
+ nextCursor: N,
635
+ pendingAppendItems: R,
636
+ phase: s,
637
+ prefetchNextPage: H,
638
+ prefetchPreviousPage: U,
639
+ previousCursor: F,
640
+ retryInitialLoad: W,
641
+ retry: G,
642
+ setActiveIndex: q,
643
+ setAutoPrefetchEnabled: J,
644
+ syncActiveIndexAfterVisibilityChange: ne,
645
+ getActiveOccurrenceKey: Y,
646
+ maybeCommitPendingAppendWhenFilteredOut: re
729
647
  };
730
648
  }
731
649
  //#endregion
732
650
  //#region src/components/viewer-core/useDataSource.ts
733
- function Ue(e, t) {
734
- let n = e, r = e, { clearRemoved: a, getRemovedIds: o, remove: s, removedIds: c, restore: l, undo: u } = _e(), d = He({
651
+ function ze(e, t) {
652
+ let { clearRemoved: n, getRemovedIds: r, remove: a, removedIds: o, restore: s, undo: c } = le(), l = Re({
735
653
  emit: t,
736
- fillDelayMs: r.fillDelayMs,
737
- fillDelayStepMs: r.fillDelayStepMs,
738
- initialCursor: r.initialCursor,
739
- initialState: r.initialState,
740
- mode: r.mode,
741
- pageSize: r.pageSize,
742
- removedIds: c,
743
- resolve: r.resolve
744
- }), f = !1, p = 0, m = T([]), h = i(() => typeof r.resolve == "function"), g = i(() => c.value.size ? m.value.filter((e) => !c.value.has(e.id)) : m.value), _ = i(() => h.value ? d.items.value : g.value), v = i(() => h.value ? d.activeIndex.value : n.activeIndex ?? 0), y = i(() => h.value ? d.loading.value : n.loading ?? !1), b = i(() => h.value ? d.hasNextPage.value : n.hasNextPage ?? !1), x = i(() => h.value ? d.hasPreviousPage.value : n.hasPreviousPage ?? !1), S = i(() => c.value.size), C = i(() => n.paginationDetail ?? null);
745
- P([() => n.items, () => r.resolve], ([e, t]) => {
746
- !Array.isArray(e) || typeof t != "function" || f || (f = !0, console.warn("[Vibe] `resolve` and `items` were both provided. `resolve` mode will be used."));
747
- }, { immediate: !0 }), P(() => n.items ?? [], (e) => {
748
- if (h.value) return;
749
- let t = he(e, m.value, p);
750
- m.value = t.items, p = t.nextSequence;
751
- }, {
752
- deep: !0,
753
- immediate: !0
754
- });
755
- function w(e) {
756
- let r = _.value;
757
- if (!r.length) return;
758
- let i = M(e, 0, r.length - 1);
759
- if (h.value) {
760
- d.setActiveIndex(i);
761
- return;
762
- }
763
- i !== (n.activeIndex ?? 0) && t("update:activeIndex", i);
654
+ fillDelayMs: e.fillDelayMs,
655
+ fillDelayStepMs: e.fillDelayStepMs,
656
+ initialCursor: e.initialCursor,
657
+ initialState: e.initialState,
658
+ mode: e.mode,
659
+ pageSize: e.pageSize,
660
+ removedIds: o,
661
+ resolve: e.resolve
662
+ }), u = l.items, d = l.activeIndex, f = l.loading, p = l.hasNextPage, m = l.hasPreviousPage, h = i(() => o.value.size), g = i(() => e.paginationDetail ?? null), _ = i(() => !l.hasNextPage.value && l.canRefreshTrailingBoundary.value);
663
+ function v(e) {
664
+ let t = u.value;
665
+ t.length && l.setActiveIndex(C(e, 0, t.length - 1));
764
666
  }
765
- function E(e) {
766
- let t = A(), n = s(e);
767
- return n.ids.length ? h.value ? (d.maybeCommitPendingAppendWhenFilteredOut(), d.syncActiveIndexAfterVisibilityChange(t), n) : (j(t), n) : n;
667
+ function y(e) {
668
+ let t = l.getActiveOccurrenceKey(), n = a(e);
669
+ return n.ids.length ? (l.maybeCommitPendingAppendWhenFilteredOut(), l.syncActiveIndexAfterVisibilityChange(t), n) : n;
768
670
  }
769
- function D(e) {
770
- let t = A(), n = l(e);
771
- return n.ids.length ? h.value ? (d.syncActiveIndexAfterVisibilityChange(t), n) : (j(t), n) : n;
671
+ function b(e) {
672
+ let t = l.getActiveOccurrenceKey(), n = s(e);
673
+ return n.ids.length && l.syncActiveIndexAfterVisibilityChange(t), n;
772
674
  }
773
- function O() {
774
- let e = A(), t = u();
775
- return t?.ids.length ? h.value ? (d.syncActiveIndexAfterVisibilityChange(e), t) : (j(e), t) : t;
675
+ function x() {
676
+ let e = l.getActiveOccurrenceKey(), t = c();
677
+ return t?.ids.length && l.syncActiveIndexAfterVisibilityChange(e), t;
776
678
  }
777
- function k() {
778
- let e = A();
779
- if (a(), h.value) {
780
- d.syncActiveIndexAfterVisibilityChange(e);
781
- return;
782
- }
783
- j(e);
679
+ function S() {
680
+ let e = l.getActiveOccurrenceKey();
681
+ n(), l.syncActiveIndexAfterVisibilityChange(e);
784
682
  }
785
- function A() {
786
- let e = _.value[M(v.value, 0, Math.max(0, _.value.length - 1))];
787
- return e ? $(e) : null;
788
- }
789
- function j(e = null) {
790
- if (!_.value.length) return;
791
- let r = e ? _.value.findIndex((t) => $(t) === e) : -1, i = r >= 0 ? r : M(v.value, 0, _.value.length - 1);
792
- i !== (n.activeIndex ?? 0) && t("update:activeIndex", i);
793
- }
794
- function M(e, t, n) {
683
+ function C(e, t, n) {
795
684
  return Math.min(Math.max(e, t), n);
796
685
  }
797
- function N() {
798
- h.value && d.cancel();
686
+ function w() {
687
+ l.cancel();
799
688
  }
800
- async function F() {
801
- if (h.value) {
802
- await d.prefetchNextPage();
803
- return;
804
- }
805
- y.value || typeof n.requestNextPage != "function" || await n.requestNextPage();
689
+ async function T() {
690
+ await l.prefetchNextPage();
806
691
  }
807
- async function I() {
808
- if (h.value) {
809
- await d.prefetchPreviousPage();
810
- return;
811
- }
812
- y.value || typeof n.requestPreviousPage != "function" || await n.requestPreviousPage();
692
+ async function E() {
693
+ await l.prefetchPreviousPage();
813
694
  }
814
- async function L() {
815
- h.value && await d.retry();
695
+ async function D() {
696
+ await l.retry();
816
697
  }
817
698
  return {
818
- activeIndex: v,
819
- canRetryInitialLoad: i(() => h.value ? d.canRetryInitialLoad.value : !1),
820
- cancel: N,
821
- clearRemoved: k,
822
- commitPendingAppend: d.commitPendingAppend,
823
- currentCursor: i(() => h.value ? d.currentCursor.value : null),
824
- errorMessage: i(() => h.value ? d.errorMessage.value : null),
825
- fillCollectedCount: i(() => h.value ? d.fillCollectedCount.value : null),
826
- fillDelayRemainingMs: i(() => h.value ? d.fillDelayRemainingMs.value : null),
827
- fillTargetCount: i(() => h.value ? d.fillTargetCount.value : null),
828
- getRemovedIds: o,
829
- hasNextPage: b,
830
- hasPreviousPage: x,
831
- isAutoMode: h,
832
- items: _,
833
- loading: y,
834
- loadNext: F,
835
- loadPrevious: I,
836
- mode: i(() => h.value ? d.mode.value : null),
837
- nextCursor: i(() => h.value ? d.nextCursor.value : null),
838
- paginationDetail: C,
839
- pendingAppendItems: d.pendingAppendItems,
840
- phase: i(() => h.value ? d.phase.value : y.value ? "loading" : "idle"),
841
- prefetchNextPage: h.value ? d.prefetchNextPage : async () => {
842
- y.value || typeof n.requestNextPage != "function" || await n.requestNextPage();
843
- },
844
- prefetchPreviousPage: h.value ? d.prefetchPreviousPage : async () => {
845
- y.value || typeof n.requestPreviousPage != "function" || await n.requestPreviousPage();
846
- },
847
- previousCursor: i(() => h.value ? d.previousCursor.value : null),
848
- removedCount: S,
849
- remove: E,
850
- restore: D,
851
- retry: L,
852
- retryInitialLoad: d.retryInitialLoad,
853
- setActiveIndex: w,
854
- setAutoPrefetchEnabled: d.setAutoPrefetchEnabled,
855
- undo: O
699
+ activeIndex: d,
700
+ canRefreshExhaustedNextPage: _,
701
+ canRetryInitialLoad: l.canRetryInitialLoad,
702
+ cancel: w,
703
+ clearRemoved: S,
704
+ commitPendingAppend: l.commitPendingAppend,
705
+ currentCursor: l.currentCursor,
706
+ errorMessage: l.errorMessage,
707
+ fillCollectedCount: l.fillCollectedCount,
708
+ fillDelayRemainingMs: l.fillDelayRemainingMs,
709
+ fillTargetCount: l.fillTargetCount,
710
+ getRemovedIds: r,
711
+ hasNextPage: p,
712
+ hasPreviousPage: m,
713
+ items: u,
714
+ loading: f,
715
+ loadNext: T,
716
+ loadPrevious: E,
717
+ mode: l.mode,
718
+ nextCursor: l.nextCursor,
719
+ paginationDetail: g,
720
+ pendingAppendItems: l.pendingAppendItems,
721
+ phase: l.phase,
722
+ prefetchNextPage: l.prefetchNextPage,
723
+ prefetchPreviousPage: l.prefetchPreviousPage,
724
+ previousCursor: l.previousCursor,
725
+ removedCount: h,
726
+ remove: y,
727
+ restore: b,
728
+ retry: D,
729
+ retryInitialLoad: l.retryInitialLoad,
730
+ setActiveIndex: v,
731
+ setAutoPrefetchEnabled: l.setAutoPrefetchEnabled,
732
+ undo: x
856
733
  };
857
734
  }
858
735
  //#endregion
859
736
  //#region src/components/viewer-core/useController.ts
860
- var We = 1024;
861
- function Ge(e, t) {
862
- let n = Ue(e, t), r = T(0), a = T("list"), o = T(0), s = C({
737
+ var Be = 1024;
738
+ function Ve(e, t) {
739
+ let n = ze(e, t), r = T(0), a = T("list"), o = C({
863
740
  activeIndex: 0,
864
741
  currentCursor: null,
865
742
  errorMessage: null,
@@ -868,81 +745,70 @@ function Ge(e, t) {
868
745
  fillTargetCount: null,
869
746
  hasNextPage: !1,
870
747
  hasPreviousPage: !1,
871
- isAutoMode: !1,
872
748
  itemCount: 0,
873
749
  loadState: "loaded",
874
- mode: null,
750
+ mode: "dynamic",
875
751
  nextCursor: null,
876
752
  phase: "idle",
877
753
  previousCursor: null,
878
754
  removedCount: 0,
755
+ removedIds: [],
879
756
  surfaceMode: "list"
880
- }), c = i(() => r.value >= We), l = i(() => e.surfaceMode === "fullscreen" || e.surfaceMode === "list"), u = i(() => c.value ? e.surfaceMode ?? a.value : "fullscreen"), d = i(() => c.value && u.value === "fullscreen");
881
- P(() => e.surfaceMode, (e, t) => {
882
- e && (a.value = e, c.value && t === "fullscreen" && e === "list" && (o.value += 1));
883
- }, { immediate: !0 }), P(c, (e, t) => {
884
- e && !t && a.value === "list" && (o.value += 1);
885
- }), P([u, () => n.pendingAppendItems.value.length], ([e, t]) => {
757
+ }), s = i(() => r.value >= Be), c = i(() => s.value ? a.value : "fullscreen"), l = i(() => s.value && c.value === "fullscreen");
758
+ P(s, (e) => {
759
+ e && m();
760
+ }), P(() => e.surfaceMode, () => {
761
+ m();
762
+ }), P([c, () => n.pendingAppendItems.value.length], ([e, t]) => {
886
763
  e === "list" || t <= 0 || n.commitPendingAppend();
887
- }), P(u, (e) => {
764
+ }), P(c, (e) => {
888
765
  n.setAutoPrefetchEnabled(e === "fullscreen");
889
766
  }, { immediate: !0 }), F(() => {
890
- s.activeIndex = n.activeIndex.value, s.currentCursor = n.currentCursor.value, s.errorMessage = n.errorMessage.value, s.fillCollectedCount = n.fillCollectedCount.value, s.fillDelayRemainingMs = n.fillDelayRemainingMs.value, s.fillTargetCount = n.fillTargetCount.value, s.hasNextPage = n.hasNextPage.value, s.hasPreviousPage = n.hasPreviousPage.value, s.isAutoMode = n.isAutoMode.value, s.itemCount = n.items.value.length, s.loadState = n.loading.value ? "loading" : n.errorMessage.value ? "failed" : "loaded", s.mode = n.mode.value, s.nextCursor = n.nextCursor.value, s.phase = n.phase.value, s.previousCursor = n.previousCursor.value, s.removedCount = n.removedCount.value, s.surfaceMode = u.value;
767
+ o.activeIndex = n.activeIndex.value, o.currentCursor = n.currentCursor.value, o.errorMessage = n.errorMessage.value, o.fillCollectedCount = n.fillCollectedCount.value, o.fillDelayRemainingMs = n.fillDelayRemainingMs.value, o.fillTargetCount = n.fillTargetCount.value, o.hasNextPage = n.hasNextPage.value, o.hasPreviousPage = n.hasPreviousPage.value, o.itemCount = n.items.value.length, o.loadState = n.loading.value ? "loading" : n.errorMessage.value ? "failed" : "loaded", o.mode = n.mode.value, o.nextCursor = n.nextCursor.value, o.phase = n.phase.value, o.previousCursor = n.previousCursor.value, o.removedCount = n.removedCount.value, o.removedIds = n.getRemovedIds(), o.surfaceMode = c.value;
891
768
  }), x(() => {
892
- h(), window.addEventListener("keydown", m), window.addEventListener("resize", h);
769
+ p(), m(), window.addEventListener("keydown", f), window.addEventListener("resize", p);
893
770
  }), b(() => {
894
- window.removeEventListener("keydown", m), window.removeEventListener("resize", h);
771
+ window.removeEventListener("keydown", f), window.removeEventListener("resize", p);
895
772
  });
896
- function f(e) {
897
- n.setActiveIndex(e), c.value && g("fullscreen");
773
+ function u(e) {
774
+ n.setActiveIndex(e), s.value && a.value !== "fullscreen" && (a.value = "fullscreen", t("update:surfaceMode", "fullscreen"));
898
775
  }
899
- function p() {
900
- if (c.value) {
901
- if (l.value) {
902
- u.value !== "list" && t("update:surfaceMode", "list");
903
- return;
904
- }
905
- a.value = "list", o.value += 1;
906
- }
776
+ function d() {
777
+ !s.value || a.value === "list" || (a.value = "list", t("update:surfaceMode", "list"));
907
778
  }
908
- function m(e) {
909
- e.defaultPrevented || e.key !== "Escape" || !c.value || u.value !== "fullscreen" || fe(e.target) || (e.preventDefault(), p());
779
+ function f(e) {
780
+ e.defaultPrevented || e.key !== "Escape" || !s.value || c.value !== "fullscreen" || Z(e.target) || (e.preventDefault(), d());
910
781
  }
911
- function h() {
782
+ function p() {
912
783
  r.value = window.innerWidth || 0;
913
784
  }
914
- function g(n) {
915
- if (l.value) {
916
- e.surfaceMode !== n && t("update:surfaceMode", n);
917
- return;
918
- }
919
- a.value = n;
785
+ function m() {
786
+ !s.value || !e.surfaceMode || e.surfaceMode === a.value || (a.value = e.surfaceMode);
920
787
  }
921
788
  return {
922
789
  ...n,
923
790
  cancel: n.cancel,
924
- isDesktop: c,
925
- listRestoreToken: o,
791
+ isDesktop: s,
926
792
  loadNext: n.loadNext,
927
793
  loadPrevious: n.loadPrevious,
928
- openFullscreen: f,
929
- returnToList: p,
794
+ openFullscreen: u,
795
+ returnToList: d,
930
796
  retry: n.retry,
931
- showBackToList: d,
932
- status: w(s),
933
- surfaceMode: u
797
+ showBackToList: l,
798
+ status: w(o),
799
+ surfaceMode: c
934
800
  };
935
801
  }
936
802
  //#endregion
937
803
  //#region src/components/FullscreenMediaBar.vue?vue&type=script&setup=true&lang.ts
938
- var Ke = {
804
+ var He = {
939
805
  "data-testid": "vibe-media-bar",
940
806
  class: "absolute inset-x-0 bottom-0 z-[5] bg-[linear-gradient(180deg,transparent,rgba(0,0,0,0.42)_24%,rgba(0,0,0,0.78))] px-[clamp(1rem,2.6vw,2.25rem)] pt-4 pb-[1.15rem]"
941
- }, qe = { class: "grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 border-t border-white/12 bg-black/70 px-4 py-3 backdrop-blur-[18px]" }, Je = { class: "text-[0.76rem] font-bold uppercase tracking-[0.18em] text-[#f7f1ea]/74" }, Ye = { class: "relative h-4 w-full" }, Xe = [
807
+ }, Ue = { class: "grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 border-t border-white/12 bg-black/70 px-4 py-3 backdrop-blur-[18px]" }, We = { class: "text-[0.76rem] font-bold uppercase tracking-[0.18em] text-[#f7f1ea]/74" }, Ge = { class: "relative h-4 w-full" }, Ke = [
942
808
  "max",
943
809
  "value",
944
810
  "disabled"
945
- ], Ze = { class: "text-[0.76rem] font-bold uppercase tracking-[0.18em] text-[#f7f1ea]/74" }, Qe = /* @__PURE__ */ d({
811
+ ], qe = { class: "text-[0.76rem] font-bold uppercase tracking-[0.18em] text-[#f7f1ea]/74" }, Je = /* @__PURE__ */ d({
946
812
  __name: "FullscreenMediaBar",
947
813
  props: {
948
814
  currentTime: {},
@@ -954,9 +820,9 @@ var Ke = {
954
820
  emits: ["seek-input"],
955
821
  setup(e, { emit: t }) {
956
822
  let n = e, r = t;
957
- return (e, t) => (S(), s("div", Ke, [c("div", qe, [
958
- c("span", Je, k(n.currentTimeLabel), 1),
959
- c("div", Ye, [
823
+ return (e, t) => (S(), s("div", He, [c("div", Ue, [
824
+ c("span", We, k(n.currentTimeLabel), 1),
825
+ c("div", Ge, [
960
826
  t[1] ||= c("div", { class: "absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-white/12" }, null, -1),
961
827
  c("div", {
962
828
  class: "absolute left-0 top-1/2 h-px -translate-y-1/2 bg-[#f7f1ea]",
@@ -973,25 +839,25 @@ var Ke = {
973
839
  disabled: n.duration <= 0,
974
840
  class: "vibe-media-slider absolute inset-0 z-10 h-4 w-full cursor-pointer bg-transparent disabled:cursor-default disabled:opacity-50",
975
841
  onInput: t[0] ||= (e) => r("seek-input", e)
976
- }, null, 40, Xe)
842
+ }, null, 40, Ke)
977
843
  ]),
978
- c("span", Ze, k(n.durationLabel), 1)
844
+ c("span", qe, k(n.durationLabel), 1)
979
845
  ])]));
980
846
  }
981
- }), $e = { class: "pointer-events-none absolute inset-0 z-[3] flex flex-col justify-between p-[clamp(1.25rem,2.6vw,2.25rem)]" }, et = { class: "grid gap-4" }, tt = { class: "flex min-h-11 items-center justify-between gap-4" }, nt = { class: "min-w-0 flex flex-1 items-center gap-3" }, rt = {
847
+ }), Ye = { class: "pointer-events-none absolute inset-0 z-[3] flex flex-col justify-between p-[clamp(1.25rem,2.6vw,2.25rem)]" }, Xe = { class: "grid gap-4" }, Ze = { class: "flex min-h-11 items-center justify-between gap-4" }, Qe = { class: "min-w-0 flex flex-1 items-center gap-3" }, $e = {
982
848
  key: 1,
983
849
  "data-testid": "vibe-title",
984
850
  class: "m-0 truncate text-left text-[0.82rem] leading-none tracking-[-0.04em] min-[721px]:text-[1.2rem]"
985
- }, it = { class: "pointer-events-auto flex shrink-0 items-center gap-2" }, at = {
851
+ }, et = { class: "pointer-events-auto flex shrink-0 items-center gap-2" }, tt = {
986
852
  "data-testid": "vibe-pagination",
987
853
  class: "inline-flex shrink-0 items-center gap-2 whitespace-nowrap border border-white/14 bg-black/40 px-3 py-2 text-[0.63rem] font-bold uppercase tracking-[0.12em] text-[#f7f1ea]/72 backdrop-blur-[18px] min-[721px]:gap-3 min-[721px]:px-4 min-[721px]:py-3 min-[721px]:text-[0.74rem] min-[721px]:tracking-[0.2em]"
988
- }, ot = { class: "whitespace-nowrap" }, st = {
854
+ }, nt = { class: "whitespace-nowrap" }, rt = {
989
855
  key: 0,
990
856
  class: "whitespace-nowrap border-l border-white/12 pl-2 text-[#f7f1ea]/56 min-[721px]:pl-3"
991
- }, ct = {
857
+ }, it = {
992
858
  key: 0,
993
859
  class: "grid gap-2 max-[720px]:justify-items-start"
994
- }, lt = /* @__PURE__ */ d({
860
+ }, at = /* @__PURE__ */ d({
995
861
  __name: "FullscreenHeader",
996
862
  props: {
997
863
  currentIndex: {},
@@ -1004,7 +870,7 @@ var Ke = {
1004
870
  emits: ["back-to-list"],
1005
871
  setup(e, { emit: t }) {
1006
872
  let n = e, r = t;
1007
- return (e, t) => (S(), s("div", $e, [c("div", et, [c("div", tt, [c("div", nt, [n.showBackToList ? (S(), s("button", {
873
+ return (e, t) => (S(), s("div", Ye, [c("div", Xe, [c("div", Ze, [c("div", Qe, [n.showBackToList ? (S(), s("button", {
1008
874
  key: 0,
1009
875
  type: "button",
1010
876
  "data-testid": "vibe-back-to-list",
@@ -1014,19 +880,45 @@ var Ke = {
1014
880
  }, [u(j(q), {
1015
881
  class: "h-4 w-4 stroke-[2.2]",
1016
882
  "aria-hidden": "true"
1017
- })])) : o("", !0), n.title ? (S(), s("h2", rt, k(n.title), 1)) : o("", !0)]), c("div", it, [c("span", at, [c("span", ot, k(n.currentIndex + 1) + " / " + k(n.total), 1), n.paginationDetail ? (S(), s("span", st, k(n.paginationDetail), 1)) : o("", !0)]), D(e.$slots, "actions")])])]), n.showEndBadge ? (S(), s("div", ct, [...t[1] ||= [c("span", { class: "inline-flex items-center border border-amber-300/35 bg-black/40 px-4 py-3 text-[0.74rem] font-bold uppercase tracking-[0.2em] text-amber-200 backdrop-blur-[18px]" }, " End reached ", -1)]])) : o("", !0)]));
883
+ })])) : o("", !0), n.title ? (S(), s("h2", $e, k(n.title), 1)) : o("", !0)]), c("div", et, [c("span", tt, [c("span", nt, k(n.currentIndex + 1) + " / " + k(n.total), 1), n.paginationDetail ? (S(), s("span", rt, k(n.paginationDetail), 1)) : o("", !0)]), D(e.$slots, "actions")])])]), n.showEndBadge ? (S(), s("div", it, [...t[1] ||= [c("span", { class: "inline-flex items-center border border-amber-300/35 bg-black/40 px-4 py-3 text-[0.74rem] font-bold uppercase tracking-[0.2em] text-amber-200 backdrop-blur-[18px]" }, " End reached ", -1)]])) : o("", !0)]));
1018
884
  }
1019
885
  });
1020
886
  //#endregion
1021
887
  //#region src/components/viewer-core/format.ts
1022
- function ut(e) {
888
+ function ot(e) {
1023
889
  if (!Number.isFinite(e) || e <= 0) return "0:00";
1024
890
  let t = Math.floor(e), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
1025
891
  return n > 0 ? `${n}:${String(r).padStart(2, "0")}:${String(i).padStart(2, "0")}` : `${r}:${String(i).padStart(2, "0")}`;
1026
892
  }
1027
893
  //#endregion
894
+ //#region src/components/viewer-core/surfaceStatus.ts
895
+ function st(e) {
896
+ return e.phase ? e.phase : e.loading ? e.itemCount > 0 ? "loading" : "initializing" : "idle";
897
+ }
898
+ function ct(e) {
899
+ return e.phase === "failed" ? {
900
+ kind: "failed",
901
+ message: e.errorMessage ?? (e.hasItems ? "The viewer could not load more items." : "The viewer could not load items.")
902
+ } : e.phase === "initializing" ? {
903
+ kind: "initializing",
904
+ message: "Loading the first page"
905
+ } : e.phase === "loading" ? {
906
+ kind: "loading-more",
907
+ message: e.hasItems ? "Loading more items" : "Loading the first page"
908
+ } : e.phase === "filling" ? {
909
+ kind: "filling",
910
+ message: "Filling the view"
911
+ } : e.phase === "refreshing" ? {
912
+ kind: "refreshing",
913
+ message: !e.hasNextPage && e.hasItems ? e.surface === "grid" ? "Refreshing the end of the list" : "Refreshing the end of the feed" : "Refreshing visible items"
914
+ } : !e.hasItems || e.hasNextPage ? null : {
915
+ kind: "end",
916
+ message: e.surface === "grid" ? "End of list" : "End of feed"
917
+ };
918
+ }
919
+ //#endregion
1028
920
  //#region src/components/viewer-core/useActivation.ts
1029
- function dt(e) {
921
+ function lt(e) {
1030
922
  let t = !1;
1031
923
  P(e.enabled, async (t) => {
1032
924
  if (n(t), t) {
@@ -1049,42 +941,42 @@ function dt(e) {
1049
941
  }
1050
942
  //#endregion
1051
943
  //#region src/components/viewer-core/assetState.ts
1052
- var ft = {
944
+ var ut = {
1053
945
  currentTime: 0,
1054
946
  duration: 0,
1055
947
  errorKind: null,
1056
948
  paused: !0,
1057
949
  ready: !1
1058
950
  };
1059
- function pt() {
1060
- return { ...ft };
951
+ function dt() {
952
+ return { ...ut };
1061
953
  }
1062
- function mt(e) {
954
+ function ft(e) {
1063
955
  return e.complete && !!(e.currentSrc || e.getAttribute("src"));
1064
956
  }
1065
- function ht(e, t, n) {
1066
- e.currentTime = Number.isFinite(t.currentTime) ? t.currentTime : 0, e.duration = Number.isFinite(t.duration) ? t.duration : 0, e.paused = t.paused, n && n !== "error" && (e.errorKind = null), e.ready = gt(t, n);
957
+ function pt(e, t, n) {
958
+ e.currentTime = Number.isFinite(t.currentTime) ? t.currentTime : 0, e.duration = Number.isFinite(t.duration) ? t.duration : 0, e.paused = t.paused, n && n !== "error" && (e.errorKind = null), e.ready = mt(t, n);
1067
959
  }
1068
- function gt(e, t) {
960
+ function mt(e, t) {
1069
961
  return t === "error" || t === "loadstart" || t === "waiting" || t === "stalled" ? !1 : t === "canplay" || t === "canplaythrough" || t === "playing" ? !0 : e.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA;
1070
962
  }
1071
963
  //#endregion
1072
964
  //#region src/components/viewer-core/loadError.ts
1073
- var _t = /* @__PURE__ */ new Map();
1074
- function vt(e) {
965
+ var ht = /* @__PURE__ */ new Map();
966
+ function gt(e) {
1075
967
  return e === "not-found" ? "404" : "Load error";
1076
968
  }
1077
- function yt(e) {
969
+ function _t(e) {
1078
970
  return e === "generic";
1079
971
  }
1080
- function bt(e) {
1081
- let t = _t.get(e);
972
+ function vt(e) {
973
+ let t = ht.get(e);
1082
974
  if (t) return t;
1083
- let n = xt(e);
1084
- return _t.set(e, n), n;
975
+ let n = yt(e);
976
+ return ht.set(e, n), n;
1085
977
  }
1086
- async function xt(e) {
1087
- if (!St(e)) return "generic";
978
+ async function yt(e) {
979
+ if (!bt(e)) return "generic";
1088
980
  try {
1089
981
  let t = await fetch(e, { method: "HEAD" });
1090
982
  if (!t.ok && t.status === 404) return "not-found";
@@ -1093,12 +985,12 @@ async function xt(e) {
1093
985
  }
1094
986
  return "generic";
1095
987
  }
1096
- function St(e) {
988
+ function bt(e) {
1097
989
  return /^(https?:\/\/|\/)/i.test(e);
1098
990
  }
1099
991
  //#endregion
1100
992
  //#region src/components/viewer-core/mediaPlayback.ts
1101
- function Ct(e) {
993
+ function xt(e) {
1102
994
  try {
1103
995
  let t = e.play();
1104
996
  t && typeof t.catch == "function" && t.catch(() => {});
@@ -1106,12 +998,12 @@ function Ct(e) {
1106
998
  }
1107
999
  //#endregion
1108
1000
  //#region src/components/viewer-core/useMedia.ts
1109
- function wt(e) {
1001
+ function St(e) {
1110
1002
  let t = T({}), n = T({}), r = T({}), a = T({}), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), l = i(() => e.activeItem.value ? $(e.activeItem.value) : null), u = i(() => e.activeMediaItem.value ? $(e.activeMediaItem.value) : null), d = i(() => {
1111
1003
  let t = /* @__PURE__ */ new Map();
1112
1004
  for (let n of e.items.value) t.set($(n), n);
1113
1005
  return t;
1114
- }), f = i(() => u.value ? r.value[u.value] ?? ft : ft), p = i(() => u.value ? f.value.duration : 0), m = i(() => p.value <= 0 ? 0 : Tt(f.value.currentTime / p.value * 100, 0, 100)), h = i(() => l.value ? N(l.value) : null);
1006
+ }), f = i(() => u.value ? r.value[u.value] ?? ut : ut), p = i(() => u.value ? f.value.duration : 0), m = i(() => p.value <= 0 ? 0 : Ct(f.value.currentTime / p.value * 100, 0, 100)), h = i(() => l.value ? N(l.value) : null);
1115
1007
  P(() => l.value, async () => {
1116
1008
  await x();
1117
1009
  }), P(() => e.itemCount.value, async () => {
@@ -1132,7 +1024,7 @@ function wt(e) {
1132
1024
  s.delete(e);
1133
1025
  }
1134
1026
  function y(e, r) {
1135
- r instanceof HTMLImageElement && mt(r) && (t.value[e] = !0, n.value[e] = null, K(e, r.currentSrc || r.src || J(e)));
1027
+ r instanceof HTMLImageElement && ft(r) && (t.value[e] = !0, n.value[e] = null, K(e, r.currentSrc || r.src || J(e)));
1136
1028
  }
1137
1029
  function b() {
1138
1030
  z(), a.value = {}, n.value = {}, t.value = {}, r.value = {}, c.clear();
@@ -1149,14 +1041,14 @@ function wt(e) {
1149
1041
  R(n, e);
1150
1042
  continue;
1151
1043
  }
1152
- n.muted = !0, n.loop = !1, n.playsInline = !0, Ct(n), V(e, n);
1044
+ n.muted = !0, n.loop = !1, n.playsInline = !0, xt(n), V(e, n);
1153
1045
  }
1154
1046
  for (let [e, n] of s.entries()) {
1155
1047
  if (e !== t || r.value[e]?.errorKind) {
1156
1048
  R(n, e);
1157
1049
  continue;
1158
1050
  }
1159
- Ct(n), V(e, n);
1051
+ xt(n), V(e, n);
1160
1052
  }
1161
1053
  }
1162
1054
  function S(e, t) {
@@ -1174,7 +1066,7 @@ function wt(e) {
1174
1066
  async function w(r, i) {
1175
1067
  let a = q(r) ?? e.activeItem.value;
1176
1068
  t.value[r] = !1, n.value[r] = "generic";
1177
- let o = await bt(i);
1069
+ let o = await vt(i);
1178
1070
  n.value[r] = o, a && e.onAssetError?.({
1179
1071
  item: a,
1180
1072
  occurrenceKey: r,
@@ -1192,7 +1084,7 @@ function wt(e) {
1192
1084
  } catch {}
1193
1085
  }
1194
1086
  i.currentTime = 0, i.duration = 0, i.paused = !0, i.ready = !1, i.errorKind = "generic";
1195
- let o = await bt(n);
1087
+ let o = await vt(n);
1196
1088
  i.errorKind = o, a && e.onAssetError?.({
1197
1089
  item: a,
1198
1090
  occurrenceKey: t,
@@ -1212,7 +1104,7 @@ function wt(e) {
1212
1104
  if (!t || !n || !(e.target instanceof HTMLInputElement)) return;
1213
1105
  let r = Number.parseFloat(e.target.value);
1214
1106
  if (!Number.isFinite(r)) return;
1215
- let i = Tt(r, 0, p.value || 0);
1107
+ let i = Ct(r, 0, p.value || 0);
1216
1108
  H(n, i, t), t.currentTime = i;
1217
1109
  }
1218
1110
  function A(e) {
@@ -1229,10 +1121,10 @@ function wt(e) {
1229
1121
  }
1230
1122
  function F(e) {
1231
1123
  let t = N(e);
1232
- return t ? vt(t) : null;
1124
+ return t ? gt(t) : null;
1233
1125
  }
1234
1126
  function I(e) {
1235
- return yt(N(e));
1127
+ return _t(N(e));
1236
1128
  }
1237
1129
  function L(e) {
1238
1130
  return `${e}:${a.value[e] ?? 0}`;
@@ -1259,10 +1151,10 @@ function wt(e) {
1259
1151
  for (let [e, t] of s.entries()) R(t, e);
1260
1152
  }
1261
1153
  function B(e) {
1262
- return r.value[e] || (r.value[e] = pt()), r.value[e];
1154
+ return r.value[e] || (r.value[e] = dt()), r.value[e];
1263
1155
  }
1264
1156
  function V(e, t, n) {
1265
- ht(B(e), t, n);
1157
+ pt(B(e), t, n);
1266
1158
  }
1267
1159
  function H(e, t, n) {
1268
1160
  let r = B(e);
@@ -1277,7 +1169,7 @@ function wt(e) {
1277
1169
  function G(e) {
1278
1170
  if (e) {
1279
1171
  if (e.paused) {
1280
- Ct(e);
1172
+ xt(e);
1281
1173
  return;
1282
1174
  }
1283
1175
  e.pause();
@@ -1328,10 +1220,10 @@ function wt(e) {
1328
1220
  syncMediaPlayback: x
1329
1221
  };
1330
1222
  }
1331
- function Tt(e, t, n) {
1223
+ function Ct(e, t, n) {
1332
1224
  return Math.min(Math.max(e, t), n);
1333
1225
  }
1334
- function Et(e, t, n = 2) {
1226
+ function wt(e, t, n = 2) {
1335
1227
  return t <= 0 ? {
1336
1228
  start: 0,
1337
1229
  end: -1
@@ -1340,14 +1232,14 @@ function Et(e, t, n = 2) {
1340
1232
  end: Math.min(t - 1, e + n)
1341
1233
  };
1342
1234
  }
1343
- function Dt(e, t, n = 2) {
1344
- let r = Et(t, e.length, n);
1235
+ function Tt(e, t, n = 2) {
1236
+ let r = wt(t, e.length, n);
1345
1237
  return r.end < r.start ? [] : e.slice(r.start, r.end + 1).map((e, t) => ({
1346
1238
  item: e,
1347
1239
  index: r.start + t
1348
1240
  }));
1349
1241
  }
1350
- function Ot(e, t, n, r, i) {
1242
+ function Et(e, t, n, r, i) {
1351
1243
  return {
1352
1244
  transform: `translate3d(0, ${(e - t) * n + r}px, 0)`,
1353
1245
  transition: i ? "none" : "transform 320ms cubic-bezier(0.22, 1, 0.36, 1)"
@@ -1355,166 +1247,178 @@ function Ot(e, t, n, r, i) {
1355
1247
  }
1356
1248
  //#endregion
1357
1249
  //#region src/components/viewer-core/useViewer.ts
1358
- function kt(e, t, n = {}) {
1359
- let { activeIndex: r, canRetryInitialLoad: a, errorMessage: o, hasNextPage: s, items: c, loading: l, paginationDetail: u, retryInitialLoad: d, setActiveIndex: f } = Ue(e, t), p = T(null), m = T(0), h = T(!1), g = T(1), _ = n.enabled ?? i(() => !0), v = null, y = 0, b = 0, x = 0, S = i(() => c.value.length === 0 ? 0 : M(r.value, 0, c.value.length - 1)), C = i(() => c.value[S.value] ?? null), w = i(() => C.value?.type === "audio" || C.value?.type === "video" ? C.value : null), E = wt({
1360
- items: c,
1361
- activeItem: C,
1362
- activeMediaItem: w,
1363
- isEnabled: _,
1364
- itemCount: i(() => c.value.length),
1250
+ function Dt(e, t, n = {}) {
1251
+ let r = i(() => e.items), a = i(() => e.activeIndex ?? 0), o = i(() => e.errorMessage ?? null), s = i(() => e.loading ?? !1), c = i(() => e.hasNextPage ?? !1), l = i(() => e.paginationDetail ?? null), u = i(() => st({
1252
+ itemCount: r.value.length,
1253
+ loading: s.value,
1254
+ phase: e.phase
1255
+ })), d = i(() => !1), f = T(null), p = T(0), m = T(!1), h = T(1), g = n.enabled ?? i(() => !0), _ = null, v = 0, y = 0, b = 0, x = i(() => r.value.length === 0 ? 0 : N(a.value, 0, r.value.length - 1)), S = i(() => r.value[x.value] ?? null), C = i(() => S.value?.type === "audio" || S.value?.type === "video" ? S.value : null), w = St({
1256
+ items: r,
1257
+ activeItem: S,
1258
+ activeMediaItem: C,
1259
+ isEnabled: g,
1260
+ itemCount: i(() => r.value.length),
1365
1261
  onAssetError: n.onAssetError,
1366
1262
  onAssetLoad: n.onAssetLoad
1367
- }), D = i(() => c.value.length > 0 && S.value === c.value.length - 1), O = i(() => c.value.length === 0 && l.value ? "Loading the first page" : l.value && s.value ? "Loading more items" : D.value && !s.value && !l.value ? "End of feed" : null), k = i(() => Math.min(96, g.value * .15 || 96)), A = i(() => Et(S.value, c.value.length)), j = i(() => Dt(c.value, S.value));
1368
- dt({
1369
- enabled: _,
1263
+ }), E = i(() => r.value.length > 0 && x.value === r.value.length - 1), D = i(() => ct({
1264
+ errorMessage: o.value,
1265
+ hasItems: r.value.length > 0,
1266
+ hasNextPage: c.value,
1267
+ phase: u.value,
1268
+ surface: "fullscreen"
1269
+ })), O = i(() => D.value?.kind ?? null), k = i(() => D.value?.message ?? null), A = i(() => Math.min(96, h.value * .15 || 96)), j = i(() => wt(x.value, r.value.length)), M = i(() => Tt(r.value, x.value));
1270
+ lt({
1271
+ enabled: g,
1370
1272
  onDisable() {
1371
- V(), E.resetMediaState();
1273
+ H(), w.resetMediaState();
1372
1274
  },
1373
1275
  onEnable() {
1374
- return E.syncMediaPlayback();
1276
+ return w.syncMediaPlayback();
1375
1277
  },
1376
- onKeydown: U,
1377
- onResize: N
1278
+ onKeydown: W,
1279
+ onResize: P
1378
1280
  });
1379
- function M(e, t, n) {
1281
+ function N(e, t, n) {
1380
1282
  return Math.min(Math.max(e, t), n);
1381
1283
  }
1382
- function N() {
1383
- g.value = p.value?.clientHeight || window.innerHeight || 1;
1384
- }
1385
- function P(e) {
1386
- return c.value.length === 0 ? !1 : M(S.value + e, 0, c.value.length - 1) !== S.value;
1284
+ function P() {
1285
+ h.value = f.value?.clientHeight || window.innerHeight || 1;
1387
1286
  }
1388
1287
  function F(e) {
1389
- if (c.value.length === 0) return;
1390
- let t = M(S.value + e, 0, c.value.length - 1);
1391
- t !== S.value && f(t);
1288
+ return r.value.length === 0 ? !1 : N(x.value + e, 0, r.value.length - 1) !== x.value;
1392
1289
  }
1393
1290
  function I(e) {
1394
- let t = e > 0, n = e < 0;
1395
- return t && !P(-1) || n && !P(1) ? e * .24 : e;
1291
+ if (r.value.length === 0) return;
1292
+ let n = N(x.value + e, 0, r.value.length - 1);
1293
+ n !== x.value && t("update:activeIndex", n);
1396
1294
  }
1397
1295
  function L(e) {
1398
- !_.value || c.value.length === 0 || e.pointerType === "mouse" || pe(e.target) || (v = e.pointerId, y = e.clientY, m.value = 0, h.value = !0, p.value?.setPointerCapture?.(e.pointerId));
1296
+ let t = e > 0, n = e < 0;
1297
+ return t && !F(-1) || n && !F(1) ? e * .24 : e;
1399
1298
  }
1400
1299
  function ee(e) {
1401
- !_.value || !h.value || v !== e.pointerId || (m.value = I(e.clientY - y));
1300
+ !g.value || r.value.length === 0 || e.pointerType === "mouse" || Q(e.target) || (_ = e.pointerId, v = e.clientY, p.value = 0, m.value = !0, f.value?.setPointerCapture?.(e.pointerId));
1402
1301
  }
1403
1302
  function R(e) {
1404
- !_.value || v !== e.pointerId || (p.value?.releasePointerCapture?.(e.pointerId), B());
1303
+ !g.value || !m.value || _ !== e.pointerId || (p.value = L(e.clientY - v));
1405
1304
  }
1406
1305
  function z(e) {
1407
- !_.value || v !== e.pointerId || (p.value?.releasePointerCapture?.(e.pointerId), V());
1306
+ !g.value || _ !== e.pointerId || (f.value?.releasePointerCapture?.(e.pointerId), V());
1408
1307
  }
1409
- function B() {
1410
- Math.abs(m.value) >= k.value && (x = Date.now() + 250, F(m.value < 0 ? 1 : -1)), V();
1308
+ function B(e) {
1309
+ !g.value || _ !== e.pointerId || (f.value?.releasePointerCapture?.(e.pointerId), H());
1411
1310
  }
1412
1311
  function V() {
1413
- m.value = 0, h.value = !1, v = null;
1312
+ Math.abs(p.value) >= A.value && (b = Date.now() + 250, I(p.value < 0 ? 1 : -1)), H();
1414
1313
  }
1415
- function H(e) {
1416
- if (!_.value || c.value.length === 0 || h.value || pe(e.target) || Math.abs(e.deltaY) < Math.max(Math.abs(e.deltaX), 24)) return;
1417
- e.preventDefault();
1418
- let t = Date.now();
1419
- t < b || (b = t + 400, F(e.deltaY > 0 ? 1 : -1));
1314
+ function H() {
1315
+ p.value = 0, m.value = !1, _ = null;
1420
1316
  }
1421
1317
  function U(e) {
1422
- !_.value || c.value.length === 0 || fe(e.target) || ((e.key === "ArrowDown" || e.key === "PageDown") && (e.preventDefault(), F(1)), (e.key === "ArrowUp" || e.key === "PageUp") && (e.preventDefault(), F(-1)));
1318
+ if (!g.value || r.value.length === 0 || m.value || Q(e.target) || Math.abs(e.deltaY) < Math.max(Math.abs(e.deltaX), 24)) return;
1319
+ e.preventDefault();
1320
+ let t = Date.now();
1321
+ t < y || (y = t + 400, I(e.deltaY > 0 ? 1 : -1));
1423
1322
  }
1424
- function W(e, t) {
1425
- E.onVideoClick(e, t, x);
1323
+ function W(e) {
1324
+ !g.value || r.value.length === 0 || Z(e.target) || ((e.key === "ArrowDown" || e.key === "PageDown") && (e.preventDefault(), I(1)), (e.key === "ArrowUp" || e.key === "PageUp") && (e.preventDefault(), I(-1)));
1426
1325
  }
1427
1326
  function G(e, t) {
1428
- E.onAudioCoverClick(e, t, x);
1327
+ w.onVideoClick(e, t, b);
1429
1328
  }
1430
- function K(e) {
1431
- E.onMediaSeekInput(e);
1329
+ function K(e, t) {
1330
+ w.onAudioCoverClick(e, t, b);
1432
1331
  }
1433
1332
  function q(e) {
1434
- return e.type === "image" || e.type === "video";
1333
+ w.onMediaSeekInput(e);
1435
1334
  }
1436
1335
  function J(e) {
1437
- return e.type === "audio";
1336
+ return e.type === "image" || e.type === "video";
1438
1337
  }
1439
1338
  function te(e) {
1440
- return Ot(e, S.value, g.value, m.value, h.value);
1339
+ return e.type === "audio";
1340
+ }
1341
+ function Y(e) {
1342
+ return Et(e, x.value, h.value, p.value, m.value);
1441
1343
  }
1442
1344
  return {
1443
- activeItem: C,
1444
- activeAssetErrorKind: E.activeAssetErrorKind,
1445
- activeMediaDuration: E.activeMediaDuration,
1446
- activeMediaItem: w,
1447
- activeMediaProgress: E.activeMediaProgress,
1448
- activeMediaState: E.activeMediaState,
1449
- canRetryAsset: E.canRetryAsset,
1450
- canRetryInitialLoad: a,
1345
+ activeItem: S,
1346
+ activeAssetErrorKind: w.activeAssetErrorKind,
1347
+ activeMediaDuration: w.activeMediaDuration,
1348
+ activeMediaItem: C,
1349
+ activeMediaProgress: w.activeMediaProgress,
1350
+ activeMediaState: w.activeMediaState,
1351
+ canRetryAsset: w.canRetryAsset,
1352
+ canRetryInitialLoad: d,
1451
1353
  errorMessage: o,
1452
- getAssetErrorKind: E.getAssetErrorKind,
1453
- getAssetErrorLabel: E.getAssetErrorLabel,
1454
- getAssetRenderKey: E.getAssetRenderKey,
1455
- formatPlaybackTime: ut,
1456
- getImageSource: E.getImageSource,
1457
- getSlideStyle: te,
1458
- hasNextPage: s,
1459
- isAtEnd: D,
1460
- isAudio: J,
1461
- isVisual: q,
1462
- items: c,
1463
- loading: l,
1464
- mediaStates: E.mediaStates,
1465
- isImageReady: E.isImageReady,
1466
- isMediaReady: E.isMediaReady,
1467
- onAudioCoverClick: G,
1468
- onImageError: E.onImageError,
1469
- onImageLoad: E.onImageLoad,
1470
- onMediaEvent: E.onMediaEvent,
1471
- onMediaError: E.onMediaError,
1472
- onMediaSeekInput: K,
1473
- onPointerCancel: z,
1474
- onPointerDown: L,
1475
- onPointerMove: ee,
1476
- onPointerUp: R,
1477
- onVideoClick: W,
1478
- onWheel: H,
1479
- registerAudioElement: E.registerAudioElement,
1480
- registerImageElement: E.registerImageElement,
1481
- registerVideoElement: E.registerVideoElement,
1482
- renderedItems: j,
1483
- renderedRange: A,
1484
- resolvedActiveIndex: S,
1485
- retryInitialLoad: d,
1486
- retryAsset: E.retryAsset,
1487
- stageRef: p,
1488
- statusMessage: O,
1489
- paginationDetail: u
1354
+ getAssetErrorKind: w.getAssetErrorKind,
1355
+ getAssetErrorLabel: w.getAssetErrorLabel,
1356
+ getAssetRenderKey: w.getAssetRenderKey,
1357
+ formatPlaybackTime: ot,
1358
+ getImageSource: w.getImageSource,
1359
+ getSlideStyle: Y,
1360
+ hasNextPage: c,
1361
+ isAtEnd: E,
1362
+ isAudio: te,
1363
+ isVisual: J,
1364
+ items: r,
1365
+ loading: s,
1366
+ mediaStates: w.mediaStates,
1367
+ isImageReady: w.isImageReady,
1368
+ isMediaReady: w.isMediaReady,
1369
+ onAudioCoverClick: K,
1370
+ onImageError: w.onImageError,
1371
+ onImageLoad: w.onImageLoad,
1372
+ onMediaEvent: w.onMediaEvent,
1373
+ onMediaError: w.onMediaError,
1374
+ onMediaSeekInput: q,
1375
+ onPointerCancel: B,
1376
+ onPointerDown: ee,
1377
+ onPointerMove: R,
1378
+ onPointerUp: z,
1379
+ onVideoClick: G,
1380
+ onWheel: U,
1381
+ registerAudioElement: w.registerAudioElement,
1382
+ registerImageElement: w.registerImageElement,
1383
+ registerVideoElement: w.registerVideoElement,
1384
+ renderedItems: M,
1385
+ renderedRange: j,
1386
+ resolvedActiveIndex: x,
1387
+ retryInitialLoad: async () => {},
1388
+ retryAsset: w.retryAsset,
1389
+ stageRef: f,
1390
+ statusKind: O,
1391
+ statusMessage: k,
1392
+ paginationDetail: l,
1393
+ phase: u
1490
1394
  };
1491
1395
  }
1492
1396
  //#endregion
1493
1397
  //#region src/components/viewer-core/media.ts
1494
- var At = {
1495
- image: X,
1398
+ var Ot = {
1399
+ image: ne,
1496
1400
  video: te,
1497
1401
  audio: J,
1498
1402
  other: Y
1499
- }, jt = {
1403
+ }, kt = {
1500
1404
  image: "Image",
1501
1405
  video: "Video",
1502
1406
  audio: "Audio",
1503
1407
  other: "File"
1504
1408
  };
1505
- function Mt(e) {
1506
- return At[e];
1409
+ function At(e) {
1410
+ return Ot[e];
1507
1411
  }
1508
- function Nt(e) {
1509
- return jt[e];
1412
+ function jt(e) {
1413
+ return kt[e];
1510
1414
  }
1511
1415
  //#endregion
1512
1416
  //#region src/components/viewer-core/slotContent.ts
1513
- function Pt(e) {
1417
+ function Mt(e) {
1514
1418
  if (!Array.isArray(e)) return !1;
1515
1419
  for (let t of e) {
1516
1420
  if (Array.isArray(t)) {
1517
- if (Pt(t)) return !0;
1421
+ if (Mt(t)) return !0;
1518
1422
  continue;
1519
1423
  }
1520
1424
  if (!m(t)) {
@@ -1525,53 +1429,53 @@ function Pt(e) {
1525
1429
  if (t != null && t !== !1) return !0;
1526
1430
  continue;
1527
1431
  }
1528
- if (!Ft(t)) return !0;
1432
+ if (!Nt(t)) return !0;
1529
1433
  }
1530
1434
  return !1;
1531
1435
  }
1532
- function Ft(r) {
1533
- return r.type === e ? !0 : r.type === n ? typeof r.children == "string" ? r.children.trim().length === 0 : !0 : r.type === t ? !Pt(r.children) : !1;
1436
+ function Nt(r) {
1437
+ return r.type === e ? !0 : r.type === n ? typeof r.children == "string" ? r.children.trim().length === 0 : !0 : r.type === t ? !Mt(r.children) : !1;
1534
1438
  }
1535
1439
  //#endregion
1536
1440
  //#region src/components/viewer-core/theme.ts
1537
- var It = {
1441
+ var Pt = {
1538
1442
  image: "bg-[radial-gradient(circle_at_top_center,rgba(251,191,36,0.4)_0,transparent_42%),linear-gradient(180deg,#120d08,#050507)]",
1539
1443
  video: "bg-[radial-gradient(circle_at_top_center,rgba(56,189,248,0.38)_0,transparent_42%),linear-gradient(180deg,#07111c,#050608)]",
1540
1444
  audio: "bg-[radial-gradient(circle_at_top_center,rgba(16,185,129,0.32)_0,transparent_42%),linear-gradient(180deg,#06120f,#040506)]",
1541
1445
  other: "bg-[radial-gradient(circle_at_top_center,rgba(148,163,184,0.28)_0,transparent_42%),linear-gradient(180deg,#0d0c10,#040506)]"
1542
- }, Lt = {
1446
+ }, Ft = {
1543
1447
  image: "bg-[radial-gradient(circle_at_center,rgba(251,191,36,0.4)_0,transparent_42%),linear-gradient(180deg,#120d08,#050507)]",
1544
1448
  video: "bg-[radial-gradient(circle_at_center,rgba(56,189,248,0.38)_0,transparent_42%),linear-gradient(180deg,#07111c,#050608)]",
1545
1449
  audio: "bg-[radial-gradient(circle_at_center,rgba(16,185,129,0.32)_0,transparent_42%),linear-gradient(180deg,#06120f,#040506)]",
1546
1450
  other: "bg-[radial-gradient(circle_at_center,rgba(148,163,184,0.28)_0,transparent_42%),linear-gradient(180deg,#0d0c10,#040506)]"
1547
1451
  };
1548
- function Rt(e) {
1549
- return It[e];
1452
+ function It(e) {
1453
+ return Pt[e];
1550
1454
  }
1551
- function zt(e) {
1552
- return Lt[e];
1455
+ function Lt(e) {
1456
+ return Ft[e];
1553
1457
  }
1554
1458
  //#endregion
1555
1459
  //#region src/components/FullscreenSurface.vue?vue&type=script&setup=true&lang.ts
1556
- var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f7f1ea]" }, Vt = {
1460
+ var Rt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f7f1ea]" }, zt = {
1557
1461
  key: 0,
1558
1462
  class: "relative h-full min-h-0"
1559
- }, Ht = [
1463
+ }, Bt = [
1560
1464
  "data-item-id",
1561
1465
  "data-occurrence-key",
1562
1466
  "data-index",
1563
1467
  "data-active",
1564
1468
  "aria-hidden"
1565
- ], Ut = {
1469
+ ], Vt = {
1566
1470
  key: 0,
1567
1471
  "data-testid": "vibe-asset-spinner",
1568
1472
  class: "pointer-events-none absolute inset-0 z-[2] grid place-items-center"
1569
- }, Wt = { class: "inline-flex h-12 w-12 items-center justify-center rounded-full bg-black/45 shadow-[0_18px_40px_-18px_rgba(0,0,0,0.85)] backdrop-blur-[18px]" }, Gt = ["data-kind"], Kt = { class: "grid justify-items-center gap-4 border border-white/14 bg-black/45 px-8 py-7 text-center backdrop-blur-[18px]" }, qt = { class: "m-0 text-[0.82rem] font-bold uppercase tracking-[0.28em] text-[#f7f1ea]/70" }, Jt = ["onClick"], Yt = [
1473
+ }, Ht = { class: "inline-flex h-12 w-12 items-center justify-center rounded-full bg-black/45 shadow-[0_18px_40px_-18px_rgba(0,0,0,0.85)] backdrop-blur-[18px]" }, Ut = ["data-kind"], Wt = { class: "grid justify-items-center gap-4 border border-white/14 bg-black/45 px-8 py-7 text-center backdrop-blur-[18px]" }, Gt = { class: "m-0 text-[0.82rem] font-bold uppercase tracking-[0.28em] text-[#f7f1ea]/70" }, Kt = ["onClick"], qt = [
1570
1474
  "src",
1571
1475
  "alt",
1572
1476
  "onLoad",
1573
1477
  "onError"
1574
- ], Xt = [
1478
+ ], Jt = [
1575
1479
  "src",
1576
1480
  "preload",
1577
1481
  "onClick",
@@ -1588,15 +1492,15 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1588
1492
  "onStalled",
1589
1493
  "onTimeupdate",
1590
1494
  "onWaiting"
1591
- ], Zt = { class: "relative grid aspect-square w-[clamp(320px,46vw,560px)] max-w-[calc(100vw-2.5rem)] place-items-center" }, Qt = [
1495
+ ], Yt = { class: "relative grid aspect-square w-[clamp(320px,46vw,560px)] max-w-[calc(100vw-2.5rem)] place-items-center" }, Xt = [
1592
1496
  "aria-label",
1593
1497
  "disabled",
1594
1498
  "onClick"
1595
- ], $t = { class: "relative z-[1] inline-flex min-h-[4.25rem] min-w-[4.25rem] items-center justify-center border border-white/18 bg-emerald-500/12 p-4 backdrop-blur-[20px]" }, en = { class: "pointer-events-none absolute bottom-4 right-4 inline-flex h-10 w-10 items-center justify-center border border-white/14 bg-black/50 backdrop-blur-[18px]" }, tn = {
1499
+ ], Zt = { class: "relative z-[1] inline-flex min-h-[4.25rem] min-w-[4.25rem] items-center justify-center border border-white/18 bg-emerald-500/12 p-4 backdrop-blur-[20px]" }, Qt = { class: "pointer-events-none absolute bottom-4 right-4 inline-flex h-10 w-10 items-center justify-center border border-white/14 bg-black/50 backdrop-blur-[18px]" }, $t = {
1596
1500
  key: 0,
1597
1501
  "data-testid": "vibe-asset-spinner",
1598
1502
  class: "pointer-events-none absolute inset-0 z-[3] grid place-items-center"
1599
- }, nn = { class: "inline-flex h-12 w-12 items-center justify-center rounded-full bg-black/45 shadow-[0_18px_40px_-18px_rgba(0,0,0,0.85)] backdrop-blur-[18px]" }, rn = ["data-kind"], an = { class: "m-0 text-[0.82rem] font-bold uppercase tracking-[0.28em] text-[#f7f1ea]/70" }, on = ["onClick"], sn = [
1503
+ }, en = { class: "inline-flex h-12 w-12 items-center justify-center rounded-full bg-black/45 shadow-[0_18px_40px_-18px_rgba(0,0,0,0.85)] backdrop-blur-[18px]" }, tn = ["data-kind"], nn = { class: "m-0 text-[0.82rem] font-bold uppercase tracking-[0.28em] text-[#f7f1ea]/70" }, rn = ["onClick"], an = [
1600
1504
  "src",
1601
1505
  "preload",
1602
1506
  "onCanplay",
@@ -1612,54 +1516,40 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1612
1516
  "onStalled",
1613
1517
  "onTimeupdate",
1614
1518
  "onWaiting"
1615
- ], cn = {
1519
+ ], on = {
1616
1520
  key: 2,
1617
1521
  class: "relative z-[1] grid w-full max-w-[1100px] justify-items-center gap-6 px-[clamp(2rem,4vw,3rem)] py-[clamp(2rem,4vw,3rem)] text-center"
1618
- }, ln = { class: "inline-flex min-h-[4.25rem] min-w-[4.25rem] items-center justify-center border border-white/18 bg-white/8 p-4 backdrop-blur-[20px]" }, un = {
1522
+ }, sn = { class: "inline-flex min-h-[4.25rem] min-w-[4.25rem] items-center justify-center border border-white/18 bg-white/8 p-4 backdrop-blur-[20px]" }, cn = {
1619
1523
  key: 0,
1620
1524
  class: "pointer-events-none absolute inset-0 z-[4]"
1621
- }, dn = { class: "h-full w-full" }, fn = {
1525
+ }, ln = { class: "h-full w-full" }, un = {
1622
1526
  key: 0,
1623
1527
  "data-testid": "vibe-fullscreen-aside",
1624
1528
  class: "h-full min-h-0 overflow-hidden border-l border-white/10 bg-black/45 backdrop-blur-[18px]"
1625
- }, pn = { class: "h-full min-h-0 overflow-y-auto overscroll-y-contain" }, mn = {
1529
+ }, dn = { class: "h-full min-h-0 overflow-y-auto overscroll-y-contain" }, fn = {
1626
1530
  key: 0,
1627
1531
  "data-testid": "vibe-fullscreen-aside",
1628
1532
  class: "absolute inset-y-0 right-0 z-[6] w-full max-w-[22rem] overflow-hidden border-l border-white/10 bg-black/82 backdrop-blur-[18px]"
1629
- }, hn = { class: "h-full min-h-0 overflow-y-auto overscroll-y-contain" }, gn = 1280, _n = 2, vn = /* @__PURE__ */ d({
1533
+ }, pn = { class: "h-full min-h-0 overflow-y-auto overscroll-y-contain" }, mn = 1280, hn = 2, gn = /* @__PURE__ */ d({
1630
1534
  __name: "FullscreenSurface",
1631
1535
  props: {
1632
- items: {},
1633
- activeIndex: { default: 0 },
1634
- fillDelayMs: {},
1635
- fillDelayStepMs: {},
1636
- initialState: {},
1637
- loading: {
1536
+ active: {
1638
1537
  type: Boolean,
1639
- default: !1
1538
+ default: !0
1640
1539
  },
1540
+ activeIndex: { default: 0 },
1541
+ errorMessage: { default: null },
1641
1542
  hasNextPage: {
1642
1543
  type: Boolean,
1643
1544
  default: !1
1644
1545
  },
1645
- mode: {},
1646
- resolve: {},
1647
- initialCursor: {},
1648
- pageSize: {},
1649
- assetLoadLimits: {},
1650
- hasPreviousPage: { type: Boolean },
1651
- paginationDetail: { default: null },
1652
- requestNextPage: {},
1653
- requestPreviousPage: {},
1654
- showStatusBadges: {
1655
- type: Boolean,
1656
- default: !0
1657
- },
1658
- surfaceMode: {},
1659
- active: {
1546
+ items: {},
1547
+ loading: {
1660
1548
  type: Boolean,
1661
- default: !0
1549
+ default: !1
1662
1550
  },
1551
+ paginationDetail: { default: null },
1552
+ phase: { default: null },
1663
1553
  reportAssetError: {
1664
1554
  type: [Function, null],
1665
1555
  default: null
@@ -1671,17 +1561,25 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1671
1561
  showBackToList: {
1672
1562
  type: Boolean,
1673
1563
  default: !1
1564
+ },
1565
+ showEndBadge: {
1566
+ type: Boolean,
1567
+ default: !0
1568
+ },
1569
+ showStatusBadges: {
1570
+ type: Boolean,
1571
+ default: !0
1674
1572
  }
1675
1573
  },
1676
1574
  emits: ["back-to-list", "update:activeIndex"],
1677
1575
  setup(e, { emit: n }) {
1678
- let d = e, p = M(), m = n, g = kt(d, (e, t) => {
1576
+ let d = e, p = M(), m = n, g = Dt(d, (e, t) => {
1679
1577
  m("update:activeIndex", t);
1680
1578
  }, {
1681
1579
  enabled: A(d, "active"),
1682
1580
  onAssetError: d.reportAssetError ?? void 0,
1683
1581
  onAssetLoad: d.reportAssetLoad ?? void 0
1684
- }), C = T(typeof window > "u" ? gn : window.innerWidth || gn), w = i(() => Rt(g.activeItem.value?.type ?? "image")), N = i(() => g.activeMediaItem.value && !g.activeAssetErrorKind.value ? "bottom-[5.8rem] max-[720px]:bottom-[7.4rem]" : "bottom-[1.8rem] max-[720px]:bottom-[1.3rem]"), P = i(() => !!g.activeMediaItem.value && !g.activeAssetErrorKind.value), F = i(() => P.value ? "pb-[5.75rem] max-[720px]:pb-[7rem]" : ""), L = i(() => {
1582
+ }), C = T(typeof window > "u" ? mn : window.innerWidth || mn), w = i(() => It(g.activeItem.value?.type ?? "image")), N = i(() => g.activeMediaItem.value && !g.activeAssetErrorKind.value ? "bottom-[5.8rem] max-[720px]:bottom-[7.4rem]" : "bottom-[1.8rem] max-[720px]:bottom-[1.3rem]"), P = i(() => !!g.activeMediaItem.value && !g.activeAssetErrorKind.value), F = i(() => P.value ? "pb-[5.75rem] max-[720px]:pb-[7rem]" : ""), L = i(() => {
1685
1583
  let e = g.activeItem.value;
1686
1584
  return e ? {
1687
1585
  hasNextPage: d.hasNextPage,
@@ -1691,57 +1589,57 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1691
1589
  paginationDetail: d.paginationDetail,
1692
1590
  total: d.items.length
1693
1591
  } : null;
1694
- }), R = i(() => !L.value || !p["fullscreen-header-actions"] ? [] : p["fullscreen-header-actions"](L.value)), z = i(() => !L.value || !p["fullscreen-aside"] ? [] : p["fullscreen-aside"](L.value)), B = i(() => d.loading ? d.items.length > 0 ? "Loading more items" : "Loading the first page" : g.isAtEnd.value && !d.hasNextPage && !d.loading ? "End of feed" : null), V = i(() => !d.showStatusBadges || !L.value || !B.value ? null : {
1592
+ }), R = i(() => !L.value || !p["fullscreen-header-actions"] ? [] : p["fullscreen-header-actions"](L.value)), z = i(() => !L.value || !p["fullscreen-aside"] ? [] : p["fullscreen-aside"](L.value)), B = i(() => !d.showStatusBadges || !L.value || !g.statusKind.value || !g.statusMessage.value ? null : {
1695
1593
  ...L.value,
1696
- kind: g.isAtEnd.value && !g.hasNextPage.value && !g.loading.value ? "end" : "loading-more",
1697
- message: B.value
1698
- }), H = i(() => !V.value || !p["fullscreen-status"] ? [] : p["fullscreen-status"](V.value)), U = i(() => ({
1699
- gridTemplateColumns: K.value ? "minmax(0, 1fr) 22rem" : "minmax(0, 1fr) 0rem",
1594
+ kind: g.statusKind.value,
1595
+ message: g.statusMessage.value
1596
+ }), V = i(() => !B.value || !p["fullscreen-status"] ? [] : p["fullscreen-status"](B.value)), H = i(() => ({
1597
+ gridTemplateColumns: G.value ? "minmax(0, 1fr) 22rem" : "minmax(0, 1fr) 0rem",
1700
1598
  transition: "grid-template-columns 320ms cubic-bezier(0.22, 1, 0.36, 1)"
1701
- })), W = i(() => Pt(R.value)), G = i(() => Pt(z.value)), K = i(() => G.value && C.value >= gn), q = i(() => G.value && !K.value), J = i(() => Pt(H.value));
1599
+ })), U = i(() => Mt(R.value)), W = i(() => Mt(z.value)), G = i(() => W.value && C.value >= mn), K = i(() => W.value && !G.value), q = i(() => Mt(V.value));
1702
1600
  x(() => {
1703
- window.addEventListener("resize", ue);
1601
+ window.addEventListener("resize", le);
1704
1602
  }), b(() => {
1705
- window.removeEventListener("resize", ue);
1603
+ window.removeEventListener("resize", le);
1706
1604
  });
1707
- function te(e, t) {
1605
+ function J(e, t) {
1708
1606
  let n = t.title?.trim();
1709
- return n ? `${e} ${n}` : `${e} ${Nt(t.type).toLowerCase()}`;
1607
+ return n ? `${e} ${n}` : `${e} ${jt(t.type).toLowerCase()}`;
1710
1608
  }
1711
- function Y(e, t) {
1609
+ function te(e, t) {
1712
1610
  let n = Q(t);
1713
- return !se(e) || e !== g.resolvedActiveIndex.value || g.getAssetErrorKind(n) ? !1 : t.type === "image" ? !g.isImageReady(n) : t.type === "video" || t.type === "audio" ? !g.isMediaReady(n) : !1;
1611
+ return !X(e) || e !== g.resolvedActiveIndex.value || g.getAssetErrorKind(n) ? !1 : t.type === "image" ? !g.isImageReady(n) : t.type === "video" || t.type === "audio" ? !g.isMediaReady(n) : !1;
1714
1612
  }
1715
- function X(e) {
1613
+ function Y(e) {
1716
1614
  return g.getAssetErrorKind(Q(e));
1717
1615
  }
1718
- function Z(e) {
1616
+ function ne(e) {
1719
1617
  return g.getAssetErrorLabel(Q(e)) ?? "Load error";
1720
1618
  }
1721
- function oe(e, t) {
1722
- return se(e) && e === g.resolvedActiveIndex.value && !!X(t);
1619
+ function se(e, t) {
1620
+ return X(e) && e === g.resolvedActiveIndex.value && !!Y(t);
1723
1621
  }
1724
- function se(e) {
1622
+ function X(e) {
1725
1623
  let t = g.resolvedActiveIndex.value;
1726
- return d.active && e >= t && e <= t + _n;
1624
+ return d.active && e >= t && e <= t + hn;
1727
1625
  }
1728
1626
  function ce(e, t) {
1729
- return se(e) ? g.getImageSource(t) : void 0;
1627
+ return X(e) ? g.getImageSource(t) : void 0;
1730
1628
  }
1731
- function le(e, t) {
1732
- return se(e) ? t.url : void 0;
1629
+ function Z(e, t) {
1630
+ return X(e) ? t.url : void 0;
1733
1631
  }
1734
1632
  function Q(e) {
1735
1633
  return $(e);
1736
1634
  }
1737
- function ue() {
1738
- C.value = window.innerWidth || gn;
1635
+ function le() {
1636
+ C.value = window.innerWidth || mn;
1739
1637
  }
1740
- return (e, n) => (S(), s("div", Bt, [
1638
+ return (e, n) => (S(), s("div", Rt, [
1741
1639
  c("div", { class: _(["absolute inset-0 transition-[background] duration-200", w.value]) }, null, 2),
1742
1640
  c("div", {
1743
1641
  class: "relative z-[1] grid h-full min-h-0",
1744
- style: y(U.value)
1642
+ style: y(H.value)
1745
1643
  }, [c("div", {
1746
1644
  ref: "viewer.stageRef",
1747
1645
  "data-testid": "vibe-stage",
@@ -1751,7 +1649,7 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1751
1649
  onPointerup: n[3] ||= (...e) => j(g).onPointerUp && j(g).onPointerUp(...e),
1752
1650
  onPointercancel: n[4] ||= (...e) => j(g).onPointerCancel && j(g).onPointerCancel(...e),
1753
1651
  onWheel: n[5] ||= (...e) => j(g).onWheel && j(g).onWheel(...e)
1754
- }, [j(g).items.value.length > 0 ? (S(), s("div", Vt, [
1652
+ }, [j(g).items.value.length > 0 ? (S(), s("div", zt, [
1755
1653
  (S(!0), s(t, null, E(j(g).renderedItems.value, ({ item: r, index: i }) => (S(), s("article", {
1756
1654
  key: Q(r),
1757
1655
  "data-testid": "vibe-slide",
@@ -1762,30 +1660,30 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1762
1660
  "aria-hidden": i === j(g).resolvedActiveIndex.value ? "false" : "true",
1763
1661
  class: _(["absolute inset-0 flex h-full min-h-full items-center justify-center will-change-transform", i === j(g).resolvedActiveIndex.value ? "pointer-events-auto" : "pointer-events-none"]),
1764
1662
  style: y(j(g).getSlideStyle(i))
1765
- }, [c("div", { class: _(["absolute inset-0 opacity-85", j(zt)(r.type)]) }, null, 2), j(g).isVisual(r) ? (S(), s("div", {
1663
+ }, [c("div", { class: _(["absolute inset-0 opacity-85", j(Lt)(r.type)]) }, null, 2), j(g).isVisual(r) ? (S(), s("div", {
1766
1664
  key: 0,
1767
1665
  class: _(["relative z-[1] flex h-full w-full items-center justify-center overflow-hidden", i === j(g).resolvedActiveIndex.value ? F.value : ""])
1768
- }, [Y(i, r) ? (S(), s("div", Ut, [c("span", Wt, [u(j(ne), {
1666
+ }, [te(i, r) ? (S(), s("div", Vt, [c("span", Ht, [u(j(re), {
1769
1667
  class: "h-5 w-5 animate-spin stroke-[1.9] text-[#f7f1ea]/78",
1770
1668
  "aria-hidden": "true"
1771
- })])])) : o("", !0), oe(i, r) ? (S(), s("div", {
1669
+ })])])) : o("", !0), se(i, r) ? (S(), s("div", {
1772
1670
  key: 1,
1773
1671
  "data-testid": "vibe-asset-error",
1774
- "data-kind": X(r),
1672
+ "data-kind": Y(r),
1775
1673
  class: "grid h-full w-full place-items-center"
1776
- }, [c("div", Kt, [
1777
- u(j(ae), {
1674
+ }, [c("div", Wt, [
1675
+ u(j(oe), {
1778
1676
  class: "h-7 w-7 stroke-[1.9] text-[#f7f1ea]/72",
1779
1677
  "aria-hidden": "true"
1780
1678
  }),
1781
- c("p", qt, k(Z(r)), 1),
1679
+ c("p", Gt, k(ne(r)), 1),
1782
1680
  j(g).canRetryAsset(Q(r)) ? (S(), s("button", {
1783
1681
  key: 0,
1784
1682
  type: "button",
1785
1683
  class: "inline-flex items-center justify-center border border-white/14 bg-black/35 px-4 py-2 text-[0.64rem] font-bold uppercase tracking-[0.22em] text-[#f7f1ea]/82 backdrop-blur-[18px] transition hover:border-white/28 hover:bg-black/50",
1786
1684
  onClick: ee((e) => j(g).retryAsset(Q(r)), ["stop"])
1787
- }, " Retry ", 8, Jt)) : o("", !0)
1788
- ])], 8, Gt)) : r.type === "image" ? (S(), s("img", {
1685
+ }, " Retry ", 8, Kt)) : o("", !0)
1686
+ ])], 8, Ut)) : r.type === "image" ? (S(), s("img", {
1789
1687
  key: j(g).getAssetRenderKey(Q(r)),
1790
1688
  src: ce(i, r),
1791
1689
  alt: r.title ?? "",
@@ -1795,13 +1693,13 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1795
1693
  ref: (e) => j(g).registerImageElement(Q(r), e),
1796
1694
  onLoad: (e) => j(g).onImageLoad(Q(r), r.url),
1797
1695
  onError: (e) => j(g).onImageError(Q(r), r.url)
1798
- }, null, 42, Yt)) : (S(), s("video", {
1696
+ }, null, 42, qt)) : (S(), s("video", {
1799
1697
  key: j(g).getAssetRenderKey(Q(r)),
1800
1698
  class: _(["block h-auto max-h-full w-auto max-w-full cursor-pointer object-contain shadow-[0_40px_120px_-60px_rgba(0,0,0,0.9)] transition-opacity duration-300", j(g).isMediaReady(Q(r)) ? "opacity-100" : "opacity-0"]),
1801
1699
  playsinline: "",
1802
1700
  muted: "",
1803
- src: le(i, r),
1804
- preload: se(i) ? "metadata" : "none",
1701
+ src: Z(i, r),
1702
+ preload: X(i) ? "metadata" : "none",
1805
1703
  ref_for: !0,
1806
1704
  ref: (e) => j(g).registerVideoElement(Q(r), e),
1807
1705
  onClick: ee((e) => j(g).onVideoClick(e, Q(r)), ["stop"]),
@@ -1818,56 +1716,56 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1818
1716
  onStalled: (e) => j(g).onMediaEvent(Q(r), e),
1819
1717
  onTimeupdate: (e) => j(g).onMediaEvent(Q(r), e),
1820
1718
  onWaiting: (e) => j(g).onMediaEvent(Q(r), e)
1821
- }, null, 42, Xt))], 2)) : j(g).isAudio(r) ? (S(), s("div", {
1719
+ }, null, 42, Jt))], 2)) : j(g).isAudio(r) ? (S(), s("div", {
1822
1720
  key: 1,
1823
1721
  class: _(["relative z-[1] grid w-full max-w-[1100px] justify-items-center gap-6 px-[clamp(2rem,4vw,3rem)] py-[clamp(2rem,4vw,3rem)] text-center", i === j(g).resolvedActiveIndex.value ? F.value : ""])
1824
- }, [c("div", Zt, [
1722
+ }, [c("div", Yt, [
1825
1723
  c("button", {
1826
1724
  type: "button",
1827
1725
  class: "relative grid h-full w-full place-items-center border border-white/12 bg-[linear-gradient(180deg,rgba(255,255,255,0.04),rgba(255,255,255,0.02)),radial-gradient(circle_at_center,rgba(16,185,129,0.14),transparent_58%)] text-[#f7f1ea] transition-[border-color,background] duration-200 hover:border-white/30 hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.07),rgba(255,255,255,0.03)),radial-gradient(circle_at_center,rgba(16,185,129,0.18),transparent_58%)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-[#f7f1ea]",
1828
- "aria-label": j(g).mediaStates.value[Q(r)]?.paused ?? !0 ? te("Play", r) : te("Pause", r),
1829
- disabled: !!X(r),
1726
+ "aria-label": j(g).mediaStates.value[Q(r)]?.paused ?? !0 ? J("Play", r) : J("Pause", r),
1727
+ disabled: !!Y(r),
1830
1728
  onClick: (e) => j(g).onAudioCoverClick(e, Q(r))
1831
1729
  }, [
1832
1730
  n[6] ||= c("span", { class: "pointer-events-none absolute inset-0 border border-white/8 bg-[radial-gradient(circle,rgba(16,185,129,0.16),transparent_66%)]" }, null, -1),
1833
1731
  n[7] ||= c("span", { class: "pointer-events-none absolute h-[clamp(220px,30vw,360px)] w-[clamp(220px,30vw,360px)] border border-white/8 bg-[radial-gradient(circle,rgba(255,255,255,0.08),transparent_62%)]" }, null, -1),
1834
- c("span", $t, [D(e.$slots, "item-icon", {
1835
- icon: j(Mt)(r.type),
1732
+ c("span", Zt, [D(e.$slots, "item-icon", {
1733
+ icon: j(At)(r.type),
1836
1734
  item: r
1837
- }, () => [(S(), a(O(j(Mt)(r.type)), {
1735
+ }, () => [(S(), a(O(j(At)(r.type)), {
1838
1736
  class: "h-6 w-6 stroke-[1.9]",
1839
1737
  "aria-hidden": "true"
1840
1738
  }))])]),
1841
- c("span", en, [(S(), a(O(j(g).mediaStates.value[Q(r)]?.paused ?? !0 ? j(ie) : j(re)), {
1739
+ c("span", Qt, [(S(), a(O(j(g).mediaStates.value[Q(r)]?.paused ?? !0 ? j(ae) : j(ie)), {
1842
1740
  class: "h-4 w-4 stroke-2",
1843
1741
  "aria-hidden": "true"
1844
1742
  }))])
1845
- ], 8, Qt),
1846
- Y(i, r) ? (S(), s("div", tn, [c("span", nn, [u(j(ne), {
1743
+ ], 8, Xt),
1744
+ te(i, r) ? (S(), s("div", $t, [c("span", en, [u(j(re), {
1847
1745
  class: "h-5 w-5 animate-spin stroke-[1.9] text-[#f7f1ea]/78",
1848
1746
  "aria-hidden": "true"
1849
1747
  })])])) : o("", !0),
1850
- X(r) ? (S(), s(t, { key: 1 }, [n[8] ||= c("div", { class: "pointer-events-none absolute inset-0 border border-white/8 bg-[radial-gradient(circle,rgba(239,68,68,0.12),transparent_66%)]" }, null, -1), c("div", {
1748
+ Y(r) ? (S(), s(t, { key: 1 }, [n[8] ||= c("div", { class: "pointer-events-none absolute inset-0 border border-white/8 bg-[radial-gradient(circle,rgba(239,68,68,0.12),transparent_66%)]" }, null, -1), c("div", {
1851
1749
  "data-testid": "vibe-asset-error",
1852
- "data-kind": X(r),
1750
+ "data-kind": Y(r),
1853
1751
  class: "relative z-[1] grid justify-items-center gap-4"
1854
1752
  }, [
1855
- u(j(ae), {
1753
+ u(j(oe), {
1856
1754
  class: "h-7 w-7 stroke-[1.9] text-[#f7f1ea]/72",
1857
1755
  "aria-hidden": "true"
1858
1756
  }),
1859
- c("p", an, k(Z(r)), 1),
1757
+ c("p", nn, k(ne(r)), 1),
1860
1758
  j(g).canRetryAsset(Q(r)) ? (S(), s("button", {
1861
1759
  key: 0,
1862
1760
  type: "button",
1863
1761
  class: "pointer-events-auto inline-flex items-center justify-center border border-white/14 bg-black/35 px-4 py-2 text-[0.64rem] font-bold uppercase tracking-[0.22em] text-[#f7f1ea]/82 backdrop-blur-[18px] transition hover:border-white/28 hover:bg-black/50",
1864
1762
  onClick: ee((e) => j(g).retryAsset(Q(r)), ["stop"])
1865
- }, " Retry ", 8, on)) : o("", !0)
1866
- ], 8, rn)], 64)) : o("", !0)
1763
+ }, " Retry ", 8, rn)) : o("", !0)
1764
+ ], 8, tn)], 64)) : o("", !0)
1867
1765
  ]), (S(), s("audio", {
1868
1766
  key: j(g).getAssetRenderKey(Q(r)),
1869
- src: le(i, r),
1870
- preload: se(i) ? "metadata" : "none",
1767
+ src: Z(i, r),
1768
+ preload: X(i) ? "metadata" : "none",
1871
1769
  class: "pointer-events-none absolute h-px w-px opacity-0",
1872
1770
  ref_for: !0,
1873
1771
  ref: (e) => j(g).registerAudioElement(Q(r), e),
@@ -1884,24 +1782,24 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1884
1782
  onStalled: (e) => j(g).onMediaEvent(Q(r), e),
1885
1783
  onTimeupdate: (e) => j(g).onMediaEvent(Q(r), e),
1886
1784
  onWaiting: (e) => j(g).onMediaEvent(Q(r), e)
1887
- }, null, 40, sn))], 2)) : (S(), s("div", cn, [c("div", ln, [D(e.$slots, "item-icon", {
1888
- icon: j(Mt)(r.type),
1785
+ }, null, 40, an))], 2)) : (S(), s("div", on, [c("div", sn, [D(e.$slots, "item-icon", {
1786
+ icon: j(At)(r.type),
1889
1787
  item: r
1890
- }, () => [(S(), a(O(j(Mt)(r.type)), {
1788
+ }, () => [(S(), a(O(j(At)(r.type)), {
1891
1789
  class: "h-6 w-6 stroke-[1.9]",
1892
1790
  "aria-hidden": "true"
1893
- }))])])]))], 14, Ht))), 128)),
1894
- L.value && p["fullscreen-overlay"] ? (S(), s("div", un, [c("div", dn, [D(e.$slots, "fullscreen-overlay", v(f(L.value)))])])) : o("", !0),
1895
- j(g).activeItem.value ? (S(), a(lt, {
1791
+ }))])])]))], 14, Bt))), 128)),
1792
+ L.value && p["fullscreen-overlay"] ? (S(), s("div", cn, [c("div", ln, [D(e.$slots, "fullscreen-overlay", v(f(L.value)))])])) : o("", !0),
1793
+ j(g).activeItem.value ? (S(), a(at, {
1896
1794
  key: 1,
1897
1795
  "current-index": j(g).resolvedActiveIndex.value,
1898
1796
  "pagination-detail": j(g).paginationDetail.value,
1899
1797
  "show-back-to-list": d.showBackToList,
1900
- "show-end-badge": d.showStatusBadges && j(g).isAtEnd.value && !j(g).hasNextPage.value && !j(g).loading.value,
1798
+ "show-end-badge": d.showEndBadge && j(g).isAtEnd.value && !j(g).hasNextPage.value && !j(g).loading.value,
1901
1799
  title: j(g).activeItem.value.title ?? null,
1902
1800
  total: j(g).items.value.length,
1903
1801
  onBackToList: n[0] ||= (e) => m("back-to-list")
1904
- }, l({ _: 2 }, [W.value && L.value ? {
1802
+ }, l({ _: 2 }, [U.value && L.value ? {
1905
1803
  name: "actions",
1906
1804
  fn: I(() => [D(e.$slots, "fullscreen-header-actions", v(f(L.value)))]),
1907
1805
  key: "0"
@@ -1913,7 +1811,7 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1913
1811
  "title",
1914
1812
  "total"
1915
1813
  ])) : o("", !0),
1916
- P.value ? (S(), a(Qe, {
1814
+ P.value ? (S(), a(Je, {
1917
1815
  key: 2,
1918
1816
  "current-time": j(g).activeMediaState.value.currentTime,
1919
1817
  "current-time-label": j(g).formatPlaybackTime(j(g).activeMediaState.value.currentTime),
@@ -1929,13 +1827,14 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1929
1827
  "progress",
1930
1828
  "onSeekInput"
1931
1829
  ])) : o("", !0),
1932
- V.value ? (S(), s("div", {
1830
+ B.value ? (S(), s("div", {
1933
1831
  key: 3,
1934
1832
  class: _(["absolute left-1/2 z-[4] -translate-x-1/2", N.value])
1935
- }, [J.value ? D(e.$slots, "fullscreen-status", v(h({ key: 0 }, V.value))) : (S(), s("div", {
1833
+ }, [q.value ? D(e.$slots, "fullscreen-status", v(h({ key: 0 }, B.value))) : (S(), s("div", {
1936
1834
  key: 1,
1937
- class: _(["inline-flex w-auto items-center border border-white/14 bg-black/40 px-5 py-3 text-[0.75rem] font-bold uppercase tracking-[0.18em] text-[#f7f1ea]/74 backdrop-blur-[18px] max-[720px]:w-[calc(100%-2.5rem)] max-[720px]:justify-center", V.value.kind === "end" ? "border-amber-300/35 text-amber-200" : ""])
1938
- }, k(V.value.message), 3))], 2)) : o("", !0)
1835
+ "data-testid": "vibe-fullscreen-status-badge",
1836
+ class: _(["inline-flex w-auto items-center border border-white/14 bg-black/40 px-5 py-3 text-[0.75rem] font-bold uppercase tracking-[0.18em] text-[#f7f1ea]/74 backdrop-blur-[18px] max-[720px]:w-[calc(100%-2.5rem)] max-[720px]:justify-center", B.value.kind === "end" ? "border-amber-300/35 text-amber-200" : B.value.kind === "failed" ? "border-rose-400/45 text-rose-100" : ""])
1837
+ }, k(B.value.message), 3))], 2)) : o("", !0)
1939
1838
  ])) : o("", !0)], 544), u(r, {
1940
1839
  "enter-active-class": "transform-gpu transition-all duration-320 ease-out",
1941
1840
  "enter-from-class": "translate-x-full opacity-0",
@@ -1944,7 +1843,7 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1944
1843
  "leave-from-class": "translate-x-0 opacity-100",
1945
1844
  "leave-to-class": "translate-x-full opacity-0"
1946
1845
  }, {
1947
- default: I(() => [K.value && L.value ? (S(), s("aside", fn, [c("div", pn, [D(e.$slots, "fullscreen-aside", v(f(L.value)))])])) : o("", !0)]),
1846
+ default: I(() => [G.value && L.value ? (S(), s("aside", un, [c("div", dn, [D(e.$slots, "fullscreen-aside", v(f(L.value)))])])) : o("", !0)]),
1948
1847
  _: 3
1949
1848
  })], 4),
1950
1849
  u(r, {
@@ -1955,29 +1854,29 @@ var Bt = { class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f
1955
1854
  "leave-from-class": "translate-x-0 opacity-100",
1956
1855
  "leave-to-class": "translate-x-full opacity-0"
1957
1856
  }, {
1958
- default: I(() => [q.value && L.value ? (S(), s("aside", mn, [c("div", hn, [D(e.$slots, "fullscreen-aside", v(f(L.value)))])])) : o("", !0)]),
1857
+ default: I(() => [K.value && L.value ? (S(), s("aside", fn, [c("div", pn, [D(e.$slots, "fullscreen-aside", v(f(L.value)))])])) : o("", !0)]),
1959
1858
  _: 3
1960
1859
  })
1961
1860
  ]));
1962
1861
  }
1963
- }), yn = 1, bn = .5;
1964
- function xn(e) {
1862
+ }), _n = 1, vn = .5;
1863
+ function yn(e) {
1965
1864
  if (e.type !== "image" && e.type !== "video") return {
1966
- width: yn,
1967
- height: yn,
1865
+ width: _n,
1866
+ height: _n,
1968
1867
  source: "fallback"
1969
1868
  };
1970
1869
  let t = e.preview?.width, n = e.preview?.height;
1971
- if (On(t) && On(n)) {
1972
- let r = kn(e, t, n);
1870
+ if (En(t) && En(n)) {
1871
+ let r = Dn(e, t, n);
1973
1872
  return {
1974
1873
  width: r.width,
1975
1874
  height: r.height,
1976
1875
  source: "preview"
1977
1876
  };
1978
1877
  }
1979
- if (On(e.width) && On(e.height)) {
1980
- let t = kn(e, e.width, e.height);
1878
+ if (En(e.width) && En(e.height)) {
1879
+ let t = Dn(e, e.width, e.height);
1981
1880
  return {
1982
1881
  width: t.width,
1983
1882
  height: t.height,
@@ -1985,31 +1884,31 @@ function xn(e) {
1985
1884
  };
1986
1885
  }
1987
1886
  return {
1988
- width: yn,
1989
- height: yn,
1887
+ width: _n,
1888
+ height: _n,
1990
1889
  source: "fallback"
1991
1890
  };
1992
1891
  }
1993
- function Sn(e, t) {
1892
+ function bn(e, t) {
1994
1893
  return !e || e <= 0 || !t || t <= 0 ? 1 : Math.max(1, Math.floor(e / t));
1995
1894
  }
1996
- function Cn(e, t, n, r = 0) {
1895
+ function xn(e, t, n, r = 0) {
1997
1896
  if (!e || e <= 0 || !t || t <= 0) return n;
1998
1897
  let i = typeof r == "number" && r > 0 ? r : 0, a = e - Math.max(0, t - 1) * i;
1999
1898
  return !a || a <= 0 ? n : a / t;
2000
1899
  }
2001
- function wn(e, t) {
2002
- let n = xn(e);
1900
+ function Sn(e, t) {
1901
+ let n = yn(e);
2003
1902
  return n.height / n.width * t;
2004
1903
  }
2005
- function Tn(e, t) {
1904
+ function Cn(e, t) {
2006
1905
  let n = Array.from({ length: t.columnCount }, () => 0), r = Array(e.length), i = Array(e.length), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = 0;
2007
1906
  for (let c = 0; c < e.length; c += 1) {
2008
1907
  let l = e[c];
2009
1908
  o.set($(l), c);
2010
1909
  let u = 0;
2011
1910
  for (let e = 1; e < n.length; e += 1) n[e] < n[u] && (u = e);
2012
- let d = u * (t.columnWidth + t.gapX), f = n[u], p = wn(l, t.columnWidth);
1911
+ let d = u * (t.columnWidth + t.gapX), f = n[u], p = Sn(l, t.columnWidth);
2013
1912
  r[c] = {
2014
1913
  x: d,
2015
1914
  y: f
@@ -2028,7 +1927,7 @@ function Tn(e, t) {
2028
1927
  indexById: o
2029
1928
  };
2030
1929
  }
2031
- function En(e) {
1930
+ function wn(e) {
2032
1931
  if (e.itemCount <= 0) return [];
2033
1932
  if (e.viewportHeight <= 0) return Array.from({ length: e.itemCount }, (e, t) => t);
2034
1933
  let t = Math.max(0, e.scrollTop - e.overscanPx), n = e.scrollTop + e.viewportHeight + e.overscanPx, r = Math.floor(t / e.bucketPx), i = Math.floor(n / e.bucketPx), a = /* @__PURE__ */ new Set();
@@ -2038,7 +1937,7 @@ function En(e) {
2038
1937
  }
2039
1938
  return Array.from(a).sort((e, t) => e - t);
2040
1939
  }
2041
- function Dn(e, t, n) {
1940
+ function Tn(e, t, n) {
2042
1941
  let r = /* @__PURE__ */ new Map();
2043
1942
  for (let i of e) {
2044
1943
  let e = t.get($(i));
@@ -2048,11 +1947,11 @@ function Dn(e, t, n) {
2048
1947
  }
2049
1948
  return r;
2050
1949
  }
2051
- function On(e) {
1950
+ function En(e) {
2052
1951
  return typeof e == "number" && Number.isFinite(e) && e > 0;
2053
1952
  }
2054
- function kn(e, t, n) {
2055
- return e.type !== "image" || n / t >= bn ? {
1953
+ function Dn(e, t, n) {
1954
+ return e.type !== "image" || n / t >= vn ? {
2056
1955
  width: t,
2057
1956
  height: n
2058
1957
  } : {
@@ -2062,18 +1961,18 @@ function kn(e, t, n) {
2062
1961
  }
2063
1962
  //#endregion
2064
1963
  //#region src/components/viewer-core/useMasonryMotion.ts
2065
- var An = 300, jn = 600, Mn = 40, Nn = 400;
2066
- function Pn(e, t) {
1964
+ var On = 300, kn = 600, An = 40, jn = 400;
1965
+ function Mn(e, t) {
2067
1966
  return t === "top" ? [...e].reverse() : e;
2068
1967
  }
2069
- function Fn(e) {
2070
- return e <= 0 ? jn : jn + Math.min((e - 1) * Mn, Nn);
1968
+ function Nn(e) {
1969
+ return e <= 0 ? kn : kn + Math.min((e - 1) * An, jn);
2071
1970
  }
2072
- function In(e) {
1971
+ function Pn(e) {
2073
1972
  let t = e.itemHeight > 0 ? e.itemHeight : e.columnWidth;
2074
1973
  return e.direction === "top" ? e.scrollTop - t : e.scrollTop + e.viewportHeight + t;
2075
1974
  }
2076
- function Ln(e) {
1975
+ function Fn(e) {
2077
1976
  let t = T(/* @__PURE__ */ new Set()), n = T(/* @__PURE__ */ new Set()), r = T(/* @__PURE__ */ new Map()), i = T(/* @__PURE__ */ new Map()), a = T(/* @__PURE__ */ new Map()), o = T(/* @__PURE__ */ new Map()), s = T(/* @__PURE__ */ new Set()), c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
2078
1977
  P(e.visibleIndices, (a) => {
2079
1978
  if (!a.length) return;
@@ -2083,20 +1982,20 @@ function Ln(e) {
2083
1982
  !r || !t.value.has(r) || c.has(r) || (c.add(r), o.push(r));
2084
1983
  }
2085
1984
  if (!o.length) return;
2086
- let s = Pn(o, i.value.get(o[0]) ?? "bottom"), l = new Map(r.value);
2087
- for (let e = 0; e < s.length; e += 1) l.set(s[e], Math.min(e * Mn, Nn));
2088
- r.value = l, Rn(() => {
1985
+ let s = Mn(o, i.value.get(o[0]) ?? "bottom"), l = new Map(r.value);
1986
+ for (let e = 0; e < s.length; e += 1) l.set(s[e], Math.min(e * An, jn));
1987
+ r.value = l, In(() => {
2089
1988
  let e = new Set(n.value);
2090
1989
  for (let t of o) e.add(t);
2091
1990
  n.value = e;
2092
- }), zn(() => {
1991
+ }), Ln(() => {
2093
1992
  let e = new Set(t.value);
2094
1993
  for (let t of o) e.delete(t);
2095
1994
  t.value = e, h(() => {
2096
1995
  let e = new Set(n.value), t = new Map(r.value), a = new Map(i.value);
2097
1996
  for (let n of o) e.delete(n), t.delete(n), a.delete(n), c.delete(n);
2098
1997
  n.value = e, r.value = t, i.value = a;
2099
- }, Fn(o.length));
1998
+ }, Nn(o.length));
2100
1999
  });
2101
2000
  }, { flush: "post" }), b(() => {
2102
2001
  for (let e of l) clearTimeout(e);
@@ -2111,7 +2010,7 @@ function Ln(e) {
2111
2010
  }
2112
2011
  t.value = r, i.value = a;
2113
2012
  }
2114
- function d(t, n, r = An) {
2013
+ function d(t, n, r = On) {
2115
2014
  if (!t.size) return;
2116
2015
  let i = /* @__PURE__ */ new Map(), c = [];
2117
2016
  for (let [r, a] of t.entries()) {
@@ -2130,8 +2029,8 @@ function Ln(e) {
2130
2029
  a.value = i, s.value = /* @__PURE__ */ new Set();
2131
2030
  let l = new Map(o.value);
2132
2031
  for (let e of c) l.set(e, r);
2133
- o.value = l, Rn(() => {
2134
- s.value = new Set(c), Rn(() => {
2032
+ o.value = l, In(() => {
2033
+ s.value = new Set(c), In(() => {
2135
2034
  a.value = /* @__PURE__ */ new Map();
2136
2035
  });
2137
2036
  }), h(() => {
@@ -2142,8 +2041,8 @@ function Ln(e) {
2142
2041
  }, r);
2143
2042
  }
2144
2043
  function f(e) {
2145
- if (n.value.has(e)) return `transform ${jn}ms ease-out`;
2146
- if (s.value.has(e)) return `transform ${o.value.get(e) ?? An}ms ease-out`;
2044
+ if (n.value.has(e)) return `transform ${kn}ms ease-out`;
2045
+ if (s.value.has(e)) return `transform ${o.value.get(e) ?? On}ms ease-out`;
2147
2046
  }
2148
2047
  function p(e) {
2149
2048
  if (!n.value.has(e)) return;
@@ -2160,7 +2059,7 @@ function Ln(e) {
2160
2059
  } : {
2161
2060
  dx: 0,
2162
2061
  dy: 0
2163
- }, u = c ? i.value.get(c) ?? "bottom" : "bottom", d = c && t.value.has(c) ? In({
2062
+ }, u = c ? i.value.get(c) ?? "bottom" : "bottom", d = c && t.value.has(c) ? Pn({
2164
2063
  columnWidth: e.columnWidth.value,
2165
2064
  direction: u,
2166
2065
  itemHeight: s,
@@ -2183,28 +2082,28 @@ function Ln(e) {
2183
2082
  playFlipMoveAnimation: d
2184
2083
  };
2185
2084
  }
2186
- function Rn(e) {
2085
+ function In(e) {
2187
2086
  if (typeof requestAnimationFrame == "function") {
2188
2087
  requestAnimationFrame(() => e());
2189
2088
  return;
2190
2089
  }
2191
2090
  setTimeout(e, 0);
2192
2091
  }
2193
- function zn(e) {
2194
- Rn(() => Rn(e));
2092
+ function Ln(e) {
2093
+ In(() => In(e));
2195
2094
  }
2196
2095
  //#endregion
2197
2096
  //#region src/components/viewer-core/masonryViewport.ts
2198
- function Bn(e, t) {
2199
- return e?.clientHeight || Math.round(e?.getBoundingClientRect().height ?? 0) || window.innerHeight || t || 1;
2097
+ function Rn(e, t) {
2098
+ return e?.clientHeight || Math.round(e?.getBoundingClientRect().height ?? 0) || t || window.innerHeight || 1;
2200
2099
  }
2201
- function Vn(e, t, n) {
2202
- return e?.clientWidth || Math.round(e?.getBoundingClientRect().width ?? 0) || window.innerWidth || t || n;
2100
+ function zn(e, t, n) {
2101
+ return e?.clientWidth || Math.round(e?.getBoundingClientRect().width ?? 0) || t || window.innerWidth || n;
2203
2102
  }
2204
- function Hn(e, t, n, r) {
2103
+ function Bn(e, t, n, r) {
2205
2104
  return (e?.scrollHeight ?? r) - (t + n);
2206
2105
  }
2207
- function Un(e, t) {
2106
+ function Vn(e, t) {
2208
2107
  return {
2209
2108
  height: `${e}px`,
2210
2109
  transform: `translate3d(0, ${t}px, 0)`
@@ -2212,8 +2111,8 @@ function Un(e, t) {
2212
2111
  }
2213
2112
  //#endregion
2214
2113
  //#region src/components/viewer-core/useEdgeBoundary.ts
2215
- var Wn = 250, Gn = 1e3;
2216
- function Kn(e) {
2114
+ var Hn = 250, Un = 1e3;
2115
+ function Wn(e) {
2217
2116
  let t = T(!1), n = T(!1), r = T(0), i = T(0), a = T(!1), o = T(!1), s = 0, c = null;
2218
2117
  b(() => {
2219
2118
  y();
@@ -2229,7 +2128,7 @@ function Kn(e) {
2229
2128
  function u(t) {
2230
2129
  if (!x(t) || !e.isAtBoundary()) return;
2231
2130
  let n = Date.now();
2232
- n < s || (s = n + Wn, m());
2131
+ n < s || (s = n + Hn, m());
2233
2132
  }
2234
2133
  function d() {
2235
2134
  if (!g()) return;
@@ -2263,7 +2162,7 @@ function Kn(e) {
2263
2162
  return e.hasPage.value && t.value && r.value > i.value && !e.loading.value && !a.value && typeof e.requestPage.value == "function";
2264
2163
  }
2265
2164
  function _() {
2266
- o.value = !1, v(Gn);
2165
+ o.value = !1, v(Un);
2267
2166
  }
2268
2167
  function v(e) {
2269
2168
  y(), a.value = !0, c = setTimeout(() => {
@@ -2286,133 +2185,142 @@ function Kn(e) {
2286
2185
  }
2287
2186
  //#endregion
2288
2187
  //#region src/components/viewer-core/useMasonryList.ts
2289
- var qn = 600, Jn = 24, Yn = 16, Xn = 300, Zn = 200, Qn = 200, $n = 200, er = 300, tr = 24, nr = 48, rr = 500, ir = 1e3;
2290
- function ar(e) {
2291
- let t = T(null), n = T(0), r = T(typeof window > "u" ? 0 : window.innerHeight || 0), a = T(typeof window > "u" ? 0 : window.innerWidth || Xn), o = T([]), s = T([]), c = T(/* @__PURE__ */ new Map()), l = T(0), u = T(/* @__PURE__ */ new Map()), d = T(null), f = i(() => Math.max(Xn, a.value - Jn * 2)), p = i(() => Sn(f.value, Xn)), m = i(() => Cn(f.value, p.value, Xn, Yn)), h = i(() => or(e.activeIndex.value, 0, Math.max(0, e.items.value.length - 1))), _ = i(() => En({
2188
+ var Gn = 600, Kn = 24, qn = 16, Jn = 300, Yn = 200, Xn = 200, Zn = 200, Qn = 300, $n = 24, er = 48, tr = 500, nr = 1e3;
2189
+ function rr(e) {
2190
+ let t = T(null), n = T(0), r = T(typeof window > "u" ? 0 : window.innerHeight || 0), a = T(typeof window > "u" ? 0 : window.innerWidth || Jn), o = T([]), s = T([]), c = T(/* @__PURE__ */ new Map()), l = T(0), u = T(/* @__PURE__ */ new Map()), d = T(null), f = T(null), p = i(() => Math.max(Jn, a.value - Kn * 2)), m = i(() => bn(p.value, Jn)), h = i(() => xn(p.value, m.value, Jn, qn)), _ = i(() => ir(e.activeIndex.value, 0, Math.max(0, e.items.value.length - 1))), v = i(() => wn({
2292
2191
  itemCount: e.items.value.length,
2293
2192
  viewportHeight: r.value,
2294
2193
  scrollTop: n.value,
2295
- overscanPx: Zn,
2296
- bucketPx: qn,
2194
+ overscanPx: Yn,
2195
+ bucketPx: Gn,
2297
2196
  buckets: c.value
2298
- })), v = i(() => _.value.map((t) => ({
2197
+ })), y = i(() => v.value.map((t) => ({
2299
2198
  item: e.items.value[t],
2300
2199
  index: t
2301
- }))), y = i(() => {
2302
- let e = l.value + Jn * 2, t = d.value ?? 0;
2303
- return Math.max(e, t, r.value) + $n;
2304
- }), S = i(() => e.loading.value ? e.items.value.length > 0 ? "Loading more items" : "Loading the first page" : !e.hasNextPage.value && e.items.value.length > 0 ? "End of list" : null), C = i(() => `${h.value + 1} / ${e.items.value.length}`), w = i(() => Math.max(0, r.value - tr * 2)), E = i(() => y.value > r.value + 1 && w.value > 0), D = i(() => {
2305
- if (!E.value) return 0;
2306
- let e = r.value / y.value * w.value;
2307
- return Math.min(w.value, Math.max(nr, e));
2308
- }), O = i(() => {
2309
- if (!E.value) return tr;
2310
- let e = Math.max(0, y.value - r.value);
2311
- return tr + Math.max(0, w.value - D.value) * (e > 0 ? or(n.value / e, 0, 1) : 0);
2312
- }), k = Ln({
2200
+ }))), S = i(() => {
2201
+ let e = l.value + Kn * 2, t = d.value ?? 0;
2202
+ return Math.max(e, t, r.value) + Zn;
2203
+ }), C = i(() => e.hasNextPage.value || e.allowExhaustedNextPageRefresh.value), w = i(() => `${_.value + 1} / ${e.items.value.length}`), E = i(() => Math.max(0, r.value - $n * 2)), D = i(() => S.value > r.value + 1 && E.value > 0), O = i(() => {
2204
+ if (!D.value) return 0;
2205
+ let e = r.value / S.value * E.value;
2206
+ return Math.min(E.value, Math.max(er, e));
2207
+ }), k = i(() => {
2208
+ if (!D.value) return $n;
2209
+ let e = Math.max(0, S.value - r.value);
2210
+ return $n + Math.max(0, E.value - O.value) * (e > 0 ? ir(n.value / e, 0, 1) : 0);
2211
+ }), A = Fn({
2313
2212
  items: e.items,
2314
- visibleIndices: _,
2213
+ visibleIndices: v,
2315
2214
  positions: o,
2316
2215
  heights: s,
2317
2216
  indexById: u,
2318
- columnWidth: m,
2217
+ columnWidth: h,
2319
2218
  scrollTop: n,
2320
2219
  viewportHeight: r
2321
- }), A = Kn({
2220
+ }), j = Wn({
2322
2221
  direction: "top",
2323
2222
  getAnimationLockMs(e) {
2324
- return Math.max(rr, Fn(e)) + ir;
2223
+ return Math.max(tr, Nn(e)) + nr;
2325
2224
  },
2326
2225
  hasPage: e.hasPreviousPage,
2327
2226
  isAtBoundary() {
2328
- return n.value <= Jn + Yn;
2227
+ return n.value <= Kn + qn;
2329
2228
  },
2330
2229
  loading: e.loading,
2331
2230
  requestPage: e.requestPreviousPage
2332
- }), j = Kn({
2231
+ }), M = Wn({
2333
2232
  direction: "bottom",
2334
2233
  getAnimationLockMs(e) {
2335
- return Fn(e) + ir;
2234
+ return Nn(e) + nr;
2336
2235
  },
2337
- hasPage: e.hasNextPage,
2236
+ hasPage: C,
2338
2237
  isAtBoundary() {
2339
- return J() <= Qn;
2238
+ return te() <= Xn;
2340
2239
  },
2341
2240
  loading: e.loading,
2342
2241
  requestPage: e.requestNextPage
2343
- }), M = null, N = 0, F = null, I = !1;
2242
+ }), N = null, F = 0, I = null, L = !1;
2344
2243
  P([
2345
2244
  () => e.items.value.map((e) => $(e)),
2346
- p,
2347
- m
2245
+ m,
2246
+ h
2348
2247
  ], async ([t], [r = []]) => {
2349
- let i = Dn(e.items.value, u.value, o.value), a = new Set(r), s = e.items.value.filter((e) => !a.has($(e))), c = t.length > r.length && r.length > 0 && t[0] !== r[0], l = c && n.value > Jn + Yn ? e.items.value[h.value] : null, d = l ? $(l) : null;
2350
- L(), s.length > 0 && (k.markEnter(s, c ? "top" : "bottom"), c ? A.onItemsMutated(s.length) : j.onItemsMutated(s.length)), k.playFlipMoveAnimation(i, new Set(s.map((e) => $(e))), c ? rr : void 0), d ? (await g(), V(d, i)) : e.active.value && r.length > 0 && U();
2248
+ let i = Tn(e.items.value, u.value, o.value), a = new Set(r), s = e.items.value.filter((e) => !a.has($(e))), c = t.length > r.length && r.length > 0 && t[0] !== r[0], l = c && n.value > Kn + qn ? e.items.value[_.value] : null, d = l ? $(l) : null;
2249
+ ee(), s.length > 0 && (A.markEnter(s, c ? "top" : "bottom"), c ? j.onItemsMutated(s.length) : M.onItemsMutated(s.length)), A.playFlipMoveAnimation(i, new Set(s.map((e) => $(e))), c ? tr : void 0), d ? (await g(), H(d, i)) : e.active.value && r.length > 0 && W();
2351
2250
  }, { immediate: !0 }), P([
2352
2251
  () => e.pendingAppendItems.value.map((e) => $(e)),
2353
- p,
2354
2252
  m,
2253
+ h,
2355
2254
  r
2356
2255
  ], ([t]) => {
2357
- ne(), t.length && (d.value = Y([...e.items.value, ...e.pendingAppendItems.value]), X());
2358
- }, { immediate: !0 }), P(() => e.restoreToken.value, async () => {
2359
- await g(), B(h.value, "center");
2256
+ ie(), t.length && (d.value = ne([...e.items.value, ...e.pendingAppendItems.value]), re());
2257
+ }, { immediate: !0 }), P(() => e.active.value, async (e, i) => {
2258
+ let a = t.value;
2259
+ if (!a) return;
2260
+ if (!e) {
2261
+ f.value = a.scrollTop;
2262
+ return;
2263
+ }
2264
+ if (i !== !1 || f.value == null) return;
2265
+ await g();
2266
+ let o = Math.max(0, S.value - r.value), s = ir(f.value, 0, o);
2267
+ a.scrollTop = s, n.value = s, j.syncBoundary(), M.syncBoundary();
2360
2268
  }), P(() => e.loading.value, async (t) => {
2361
- !t && !e.pendingAppendItems.value.length && !F && !I && (d.value = null), A.onLoadingChange(t), j.onLoadingChange(t), await g();
2269
+ !t && !e.pendingAppendItems.value.length && !I && !L && (d.value = null), j.onLoadingChange(t), M.onLoadingChange(t), await g();
2362
2270
  }), x(async () => {
2363
- G(), await g(), h.value > 0 ? B(h.value, "center") : H(), A.syncBoundary(), j.syncBoundary(), typeof ResizeObserver < "u" ? (M = new ResizeObserver(() => {
2364
- G();
2365
- }), t.value && M.observe(t.value)) : window.addEventListener("resize", G);
2271
+ K(), await g(), _.value > 0 ? V(_.value, "center") : U(), j.syncBoundary(), M.syncBoundary(), typeof ResizeObserver < "u" ? (N = new ResizeObserver(() => {
2272
+ K();
2273
+ }), t.value && N.observe(t.value)) : window.addEventListener("resize", K);
2366
2274
  }), b(() => {
2367
- M?.disconnect(), M = null, window.removeEventListener("resize", G), ne(), N &&= (cancelAnimationFrame(N), 0);
2275
+ N?.disconnect(), N = null, window.removeEventListener("resize", K), ie(), F &&= (cancelAnimationFrame(F), 0);
2368
2276
  });
2369
- function L() {
2370
- let t = Tn(e.items.value, {
2371
- columnCount: p.value,
2372
- columnWidth: m.value,
2373
- gapX: Yn,
2374
- gapY: Yn,
2375
- bucketPx: qn
2277
+ function ee() {
2278
+ let t = Cn(e.items.value, {
2279
+ columnCount: m.value,
2280
+ columnWidth: h.value,
2281
+ gapX: qn,
2282
+ gapY: qn,
2283
+ bucketPx: Gn
2376
2284
  });
2377
2285
  o.value = t.positions.map((e) => ({
2378
- x: e.x + Jn,
2379
- y: e.y + Jn
2286
+ x: e.x + Kn,
2287
+ y: e.y + Kn
2380
2288
  })), s.value = t.heights, c.value = t.buckets, l.value = t.contentHeight, u.value = t.indexById;
2381
2289
  }
2382
- function ee() {
2383
- e.active.value && (n.value = t.value?.scrollTop ?? 0, r.value = K(), A.syncBoundary(), j.syncBoundary(), W(), !U() && (N ||= requestAnimationFrame(() => {
2384
- N = 0, H();
2290
+ function R() {
2291
+ e.active.value && (n.value = t.value?.scrollTop ?? 0, r.value = q(), j.syncBoundary(), M.syncBoundary(), G(), !W() && (F ||= requestAnimationFrame(() => {
2292
+ F = 0, U();
2385
2293
  })));
2386
2294
  }
2387
- function R(t) {
2388
- e.active.value && (A.onWheel(t), j.onWheel(t), W());
2389
- }
2390
2295
  function z(t) {
2296
+ e.active.value && (j.onWheel(t), M.onWheel(t), G());
2297
+ }
2298
+ function B(t) {
2391
2299
  let n = e.items.value[t], r = n ? $(n) : "";
2392
2300
  return {
2393
- height: `${s.value[t] ?? m.value}px`,
2394
- width: `${m.value}px`,
2395
- transition: r ? k.getCardTransition(r) : void 0,
2396
- transitionDelay: r ? k.getCardTransitionDelay(r) : void 0,
2397
- transform: k.getCardTransform(t)
2301
+ height: `${s.value[t] ?? h.value}px`,
2302
+ width: `${h.value}px`,
2303
+ transition: r ? A.getCardTransition(r) : void 0,
2304
+ transitionDelay: r ? A.getCardTransitionDelay(r) : void 0,
2305
+ transform: A.getCardTransform(t)
2398
2306
  };
2399
2307
  }
2400
- function B(e, i) {
2308
+ function V(e, i) {
2401
2309
  let a = t.value, c = o.value[e], l = s.value[e];
2402
2310
  if (!a || !c || !l) return;
2403
- let u = a.scrollTop, d = Math.max(0, y.value - r.value);
2404
- i === "center" ? u = c.y - (r.value - l) / 2 : c.y < a.scrollTop ? u = c.y - Jn : c.y + l > a.scrollTop + r.value && (u = c.y + l - r.value + Jn), a.scrollTop = or(u, 0, d), n.value = a.scrollTop, H();
2311
+ let u = a.scrollTop, d = Math.max(0, S.value - r.value);
2312
+ i === "center" ? u = c.y - (r.value - l) / 2 : c.y < a.scrollTop ? u = c.y - Kn : c.y + l > a.scrollTop + r.value && (u = c.y + l - r.value + Kn), a.scrollTop = ir(u, 0, d), n.value = a.scrollTop, U();
2405
2313
  }
2406
- function V(e, r) {
2314
+ function H(e, r) {
2407
2315
  let i = t.value, a = r.get(e), s = u.value.get(e), c = s == null ? null : o.value[s];
2408
2316
  if (!i || !a || !c) return;
2409
2317
  let l = c.y - a.y;
2410
2318
  i.scrollTop += l, n.value = i.scrollTop;
2411
2319
  }
2412
- function H() {
2413
- if (!_.value.length || U()) return;
2414
- let t = n.value + r.value / 2, i = h.value, a = Infinity;
2415
- for (let e of _.value) {
2320
+ function U() {
2321
+ if (!v.value.length || W()) return;
2322
+ let t = n.value + r.value / 2, i = _.value, a = Infinity;
2323
+ for (let e of v.value) {
2416
2324
  let n = o.value[e], r = s.value[e];
2417
2325
  if (!n || !r) continue;
2418
2326
  let c = n.y + r / 2, l = Math.abs(c - t);
@@ -2420,79 +2328,78 @@ function ar(e) {
2420
2328
  }
2421
2329
  e.setActiveIndex(i);
2422
2330
  }
2423
- function U() {
2424
- let t = n.value <= Jn + Yn, r = J() <= Qn;
2425
- return t ? (e.setActiveIndex(0), !0) : r ? (e.setActiveIndex(Math.max(0, e.items.value.length - 1)), !0) : !1;
2426
- }
2427
2331
  function W() {
2428
- A.maybeRequestPage(), j.maybeRequestPage();
2332
+ let t = n.value <= Kn + qn, r = te() <= Xn;
2333
+ return t ? (e.setActiveIndex(0), !0) : r ? (e.setActiveIndex(Math.max(0, e.items.value.length - 1)), !0) : !1;
2429
2334
  }
2430
2335
  function G() {
2431
- r.value = K(), a.value = q();
2336
+ j.maybeRequestPage(), M.maybeRequestPage();
2432
2337
  }
2433
2338
  function K() {
2434
- return Bn(t.value, r.value);
2339
+ r.value = q(), a.value = J();
2435
2340
  }
2436
2341
  function q() {
2437
- return Vn(t.value, a.value, Xn);
2342
+ return Rn(t.value, r.value);
2438
2343
  }
2439
2344
  function J() {
2440
- return Hn(t.value, n.value, r.value, y.value);
2345
+ return zn(t.value, a.value, Jn);
2441
2346
  }
2442
2347
  function te() {
2443
- return Un(D.value, O.value);
2348
+ return Bn(t.value, n.value, r.value, S.value);
2444
2349
  }
2445
- function Y(e) {
2446
- return e.length ? Tn(e, {
2447
- columnCount: p.value,
2448
- columnWidth: m.value,
2449
- gapX: Yn,
2450
- gapY: Yn,
2451
- bucketPx: qn
2452
- }).contentHeight + Jn * 2 : 0;
2453
- }
2454
- function X() {
2350
+ function Y() {
2351
+ return Vn(O.value, k.value);
2352
+ }
2353
+ function ne(e) {
2354
+ return e.length ? Cn(e, {
2355
+ columnCount: m.value,
2356
+ columnWidth: h.value,
2357
+ gapX: qn,
2358
+ gapY: qn,
2359
+ bucketPx: Gn
2360
+ }).contentHeight + Kn * 2 : 0;
2361
+ }
2362
+ function re() {
2455
2363
  let t = e.commitPendingAppend.value;
2456
- typeof t == "function" && (F = setTimeout(async () => {
2457
- F = null, I = !0;
2364
+ typeof t == "function" && (I = setTimeout(async () => {
2365
+ I = null, L = !0;
2458
2366
  try {
2459
2367
  if (!e.pendingAppendItems.value.length) return;
2460
2368
  await t(), await g(), await g();
2461
2369
  } finally {
2462
- d.value = null, I = !1;
2370
+ d.value = null, L = !1;
2463
2371
  }
2464
- }, er));
2372
+ }, Qn));
2465
2373
  }
2466
- function ne() {
2467
- F &&= (clearTimeout(F), null);
2374
+ function ie() {
2375
+ I &&= (clearTimeout(I), null);
2468
2376
  }
2469
2377
  return {
2470
- columnWidth: m,
2471
- containerHeight: y,
2472
- footerStatusMessage: S,
2473
- getCardStyle: z,
2474
- getScrollbarThumbStyle: te,
2475
- onScroll: ee,
2476
- onWheel: R,
2477
- paginationLabel: C,
2478
- renderedItems: v,
2479
- resolvedActiveIndex: h,
2480
- scrollToIndex: B,
2481
- showScrollbar: E,
2378
+ columnWidth: h,
2379
+ containerHeight: S,
2380
+ getCardStyle: B,
2381
+ getScrollbarThumbStyle: Y,
2382
+ onScroll: R,
2383
+ onWheel: z,
2384
+ paginationLabel: w,
2385
+ renderedItems: y,
2386
+ resolvedActiveIndex: _,
2387
+ scrollToIndex: V,
2388
+ showScrollbar: D,
2482
2389
  scrollViewportRef: t
2483
2390
  };
2484
2391
  }
2485
- function or(e, t, n) {
2392
+ function ir(e, t, n) {
2486
2393
  return Math.min(Math.max(e, t), n);
2487
2394
  }
2488
2395
  //#endregion
2489
2396
  //#region src/components/viewer-core/listCardAsset.ts
2490
- function sr(e) {
2397
+ function ar(e) {
2491
2398
  if (e) try {
2492
2399
  e.removeAttribute("src"), e.src = "";
2493
2400
  } catch {}
2494
2401
  }
2495
- function cr(e) {
2402
+ function or(e) {
2496
2403
  if (e) {
2497
2404
  try {
2498
2405
  e.currentTime = 0;
@@ -2503,12 +2410,12 @@ function cr(e) {
2503
2410
  } catch {}
2504
2411
  }
2505
2412
  }
2506
- function lr(e, t) {
2413
+ function sr(e, t) {
2507
2414
  if (t) return e.bottom > t.top && e.top < t.bottom;
2508
2415
  let n = window.innerHeight || document.documentElement.clientHeight || 0;
2509
2416
  return e.bottom > 0 && e.top < n;
2510
2417
  }
2511
- function ur(e) {
2418
+ function cr(e) {
2512
2419
  if (!e) return null;
2513
2420
  try {
2514
2421
  return new URL(e, window.location.href).href;
@@ -2518,22 +2425,22 @@ function ur(e) {
2518
2425
  }
2519
2426
  //#endregion
2520
2427
  //#region src/components/viewer-core/listPreview.ts
2521
- var dr = /\.(avif|gif|jpe?g|png|svg|webp)(\?|#|$)/i, fr = /\.(m4v|mov|mp4|mpeg|ogg|ogv|webm)(\?|#|$)/i;
2522
- function pr(e) {
2523
- let t = e.preview?.url ?? e.url, n = xn(e), r = e.title?.trim() || Nt(e.type);
2428
+ var lr = /\.(avif|gif|jpe?g|png|svg|webp)(\?|#|$)/i, ur = /\.(m4v|mov|mp4|mpeg|ogg|ogv|webm)(\?|#|$)/i;
2429
+ function dr(e) {
2430
+ let t = e.preview?.url ?? e.url, n = yn(e), r = e.title?.trim() || jt(e.type);
2524
2431
  return e.type !== "image" && e.type !== "video" ? {
2525
2432
  kind: "fallback",
2526
2433
  url: null,
2527
2434
  width: n.width,
2528
2435
  height: n.height,
2529
2436
  label: r
2530
- } : hr(e, t) ? {
2437
+ } : pr(e, t) ? {
2531
2438
  kind: "video",
2532
2439
  url: t,
2533
2440
  width: n.width,
2534
2441
  height: n.height,
2535
2442
  label: r
2536
- } : mr(e, t) ? {
2443
+ } : fr(e, t) ? {
2537
2444
  kind: "image",
2538
2445
  url: t,
2539
2446
  width: n.width,
@@ -2547,51 +2454,99 @@ function pr(e) {
2547
2454
  label: r
2548
2455
  };
2549
2456
  }
2550
- function mr(e, t) {
2551
- return e.type !== "image" || typeof t != "string" ? !1 : dr.test(t) || gr(t);
2457
+ function fr(e, t) {
2458
+ return e.type !== "image" || typeof t != "string" ? !1 : lr.test(t) || mr(t);
2552
2459
  }
2553
- function hr(e, t) {
2554
- return e.type === "video" && typeof t == "string" && fr.test(t);
2460
+ function pr(e, t) {
2461
+ return e.type === "video" && typeof t == "string" && ur.test(t);
2555
2462
  }
2556
- function gr(e) {
2463
+ function mr(e) {
2557
2464
  return /^https?:\/\//i.test(e);
2558
2465
  }
2559
2466
  //#endregion
2560
- //#region src/components/viewer-core/createFrameScheduler.ts
2561
- function _r(e) {
2562
- let t = 0;
2563
- return {
2564
- cancel() {
2565
- t && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(t), t = 0);
2566
- },
2567
- schedule() {
2568
- if (typeof requestAnimationFrame != "function") {
2569
- e();
2570
- return;
2467
+ //#region src/components/viewer-core/useAssetLoadQueue.ts
2468
+ var hr = {
2469
+ maxGlobal: 10,
2470
+ maxPerDomain: 4,
2471
+ maxVideoPerDomain: 2
2472
+ };
2473
+ function gr(e = hr) {
2474
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = 0;
2475
+ function i(e) {
2476
+ let i = {
2477
+ ...e,
2478
+ domain: yr(e.url),
2479
+ enqueuedAt: r,
2480
+ id: `vibe-asset-load-${r += 1}`
2481
+ };
2482
+ return n.set(i.id, i), a(), {
2483
+ cancel() {
2484
+ (n.delete(i.id) || t.delete(i.id)) && a();
2485
+ },
2486
+ refresh() {
2487
+ a();
2488
+ },
2489
+ release() {
2490
+ (t.delete(i.id) || n.delete(i.id)) && a();
2491
+ }
2492
+ };
2493
+ }
2494
+ function a() {
2495
+ if (n.size === 0) return;
2496
+ let r = [...n.values()].sort((e, t) => {
2497
+ let n = vr(e) - vr(t);
2498
+ return n === 0 ? e.enqueuedAt - t.enqueuedAt : n;
2499
+ });
2500
+ for (let i of r) {
2501
+ if (t.size >= e.maxGlobal) return;
2502
+ if (o(i)) {
2503
+ n.delete(i.id), t.set(i.id, i);
2504
+ try {
2505
+ i.onGrant();
2506
+ } catch {
2507
+ t.delete(i.id);
2508
+ }
2571
2509
  }
2572
- t ||= requestAnimationFrame(() => {
2573
- t = 0, e();
2574
- });
2575
2510
  }
2576
- };
2511
+ }
2512
+ function o(n) {
2513
+ let r = [...t.values()].filter((e) => e.domain === n.domain);
2514
+ return !(r.length >= e.maxPerDomain || n.assetType === "video" && r.filter((e) => e.assetType === "video").length >= e.maxVideoPerDomain);
2515
+ }
2516
+ return { request: i };
2517
+ }
2518
+ var _r = gr();
2519
+ function vr(e) {
2520
+ try {
2521
+ let t = e.getPriority();
2522
+ return Number.isFinite(t) ? t : Infinity;
2523
+ } catch {
2524
+ return Infinity;
2525
+ }
2526
+ }
2527
+ function yr(e) {
2528
+ try {
2529
+ return new URL(e).hostname || "local";
2530
+ } catch {
2531
+ return "local";
2532
+ }
2577
2533
  }
2578
2534
  //#endregion
2579
2535
  //#region src/components/ListCard.vue?vue&type=script&setup=true&lang.ts
2580
- var vr = ["aria-label"], yr = {
2536
+ var br = ["aria-label"], xr = {
2581
2537
  key: 0,
2582
2538
  "data-testid": "vibe-list-card-spinner",
2583
2539
  class: "pointer-events-none absolute inset-0 z-[4] grid place-items-center bg-black/18"
2584
- }, br = { class: "inline-flex h-12 w-12 items-center justify-center rounded-full bg-black/45 shadow-[0_18px_40px_-18px_rgba(0,0,0,0.85)] backdrop-blur-[18px]" }, xr = ["src", "alt"], Sr = ["src"], Cr = ["data-kind"], wr = { class: "grid justify-items-center gap-3 px-4 text-center" }, Tr = { class: "text-[0.68rem] font-bold uppercase tracking-[0.22em] text-[#f7f1ea]/72" }, Er = {
2540
+ }, Sr = { class: "inline-flex h-12 w-12 items-center justify-center rounded-full bg-black/45 shadow-[0_18px_40px_-18px_rgba(0,0,0,0.85)] backdrop-blur-[18px]" }, Cr = ["src", "alt"], wr = ["src"], Tr = ["data-kind"], Er = { class: "grid justify-items-center gap-3 px-4 text-center" }, Dr = { class: "text-[0.68rem] font-bold uppercase tracking-[0.22em] text-[#f7f1ea]/72" }, Or = {
2585
2541
  key: 4,
2586
2542
  class: "grid h-full w-full place-items-center bg-[radial-gradient(circle_at_center,rgba(255,255,255,0.08),transparent_65%),linear-gradient(180deg,rgba(255,255,255,0.04),rgba(255,255,255,0.02))]"
2587
- }, Dr = { class: "inline-flex h-14 w-14 items-center justify-center border border-white/16 bg-black/20" }, Or = { class: "pointer-events-none absolute inset-0 z-[3]" }, kr = /* @__PURE__ */ d({
2543
+ }, kr = { class: "inline-flex h-14 w-14 items-center justify-center border border-white/16 bg-black/20" }, Ar = { class: "pointer-events-none absolute inset-0 z-[3]" }, jr = /* @__PURE__ */ d({
2588
2544
  __name: "ListCard",
2589
2545
  props: {
2590
2546
  active: {
2591
2547
  type: Boolean,
2592
2548
  default: !1
2593
2549
  },
2594
- assetLoadQueue: { default: null },
2595
2550
  index: { default: 0 },
2596
2551
  item: {},
2597
2552
  reportAssetError: {
@@ -2609,80 +2564,80 @@ var vr = ["aria-label"], yr = {
2609
2564
  },
2610
2565
  emits: ["open"],
2611
2566
  setup(e, { emit: t }) {
2612
- let n = e, r = t, l = i(() => pr(n.item)), d = T(!1), f = T(!1), p = T(!1), m = T(l.value.kind === "fallback"), h = T(null), g = T(null), v = T(null), y = T(null), C = T(null), w = T(l.value.kind === "fallback"), E = i(() => w.value ? n.surfaceActive ? d.value ? l.value.url : null : l.value.url : null), A = i(() => n.surfaceActive && d.value && (l.value.kind === "image" || l.value.kind === "video") && !!l.value.url), M = i(() => l.value.kind === "image" && !!E.value), N = i(() => l.value.kind === "video" && !!E.value), F = i(() => !!h.value), I = i(() => yt(h.value)), L = i(() => A.value && !h.value && (!w.value || !m.value)), R = null, z = null, B = /* @__PURE__ */ new Set(), V = Q(), H = _r(() => {
2613
- n.surfaceActive && (X(), q(), J());
2614
- });
2567
+ let n = e, r = t, l = i(() => dr(n.item)), d = T(!1), f = T(!1), p = T(!1), m = T(l.value.kind === "fallback"), h = T(null), g = T(null), v = T(null), y = T(null), C = T(null), w = T(l.value.kind === "fallback"), E = i(() => w.value ? n.surfaceActive ? d.value ? l.value.url : null : l.value.url : null), A = i(() => n.surfaceActive && d.value && (l.value.kind === "image" || l.value.kind === "video") && !!l.value.url), M = i(() => l.value.kind === "image" && !!E.value), N = i(() => l.value.kind === "video" && !!E.value), F = i(() => !!h.value), I = i(() => _t(h.value)), L = i(() => A.value && !h.value && (!w.value || !m.value)), R = null, z = null, B = /* @__PURE__ */ new Set();
2615
2568
  P([E, () => l.value.kind], () => {
2616
2569
  let e = l.value.kind === "fallback";
2617
2570
  m.value = e, h.value = null, e && (w.value = !0);
2618
2571
  }), P(A, () => {
2619
- q();
2572
+ G();
2620
2573
  }), P([
2621
2574
  d,
2622
2575
  m,
2623
2576
  E
2624
2577
  ], () => {
2625
- J();
2578
+ K();
2626
2579
  }), P(() => n.surfaceActive, (e) => {
2627
2580
  if (!e) {
2628
- Y(), J();
2581
+ J(), K();
2629
2582
  return;
2630
2583
  }
2631
- H.schedule();
2584
+ requestAnimationFrame(() => {
2585
+ te(), G(), K();
2586
+ });
2632
2587
  }), x(() => {
2633
2588
  if (!v.value || typeof IntersectionObserver > "u") {
2634
- y.value = null, d.value = !0, q();
2589
+ y.value = null, d.value = !0, G();
2635
2590
  return;
2636
2591
  }
2637
- y.value = v.value.closest("[data-testid=\"vibe-list-scroll\"]"), y.value?.addEventListener("scroll", H.schedule, { passive: !0 }), R = new IntersectionObserver((e) => {
2638
- for (let t of e) t.target === v.value && (n.surfaceActive && X(t), q(), J());
2592
+ y.value = v.value.closest("[data-testid=\"vibe-list-scroll\"]"), R = new IntersectionObserver((e) => {
2593
+ for (let t of e) t.target === v.value && (n.surfaceActive && te(t), G(), K());
2639
2594
  }, {
2640
2595
  root: y.value,
2641
2596
  threshold: [0, 1]
2642
2597
  }), R.observe(v.value);
2643
2598
  }), b(() => {
2644
- te(), y.value?.removeEventListener("scroll", H.schedule), R?.disconnect(), R = null, H.cancel();
2599
+ q(), R?.disconnect(), R = null;
2645
2600
  });
2646
- function U() {
2647
- ce(g.value) && (m.value = !0, h.value = null, re(E.value ?? n.item.url), Y());
2601
+ function V() {
2602
+ X(g.value) && (m.value = !0, h.value = null, Y(E.value ?? n.item.url), J());
2648
2603
  }
2649
- async function W() {
2650
- if (!ce(g.value)) return;
2604
+ async function H() {
2605
+ if (!X(g.value)) return;
2651
2606
  let e = E.value ?? n.item.url;
2652
2607
  m.value = !1, h.value = "generic";
2653
- let t = await bt(e);
2608
+ let t = await vt(e);
2654
2609
  h.value = t, n.reportAssetError?.({
2655
2610
  item: n.item,
2656
2611
  occurrenceKey: $(n.item),
2657
2612
  url: e,
2658
2613
  kind: t,
2659
2614
  surface: "grid"
2660
- }), Y();
2615
+ }), J();
2661
2616
  }
2662
- function G() {
2663
- ce(C.value) && (m.value = !0, h.value = null, re(E.value ?? n.item.url), Y(), J());
2617
+ function U() {
2618
+ X(C.value) && (m.value = !0, h.value = null, Y(E.value ?? n.item.url), J(), K());
2664
2619
  }
2665
- function K() {
2666
- ce(C.value) && (m.value = !1);
2620
+ function W() {
2621
+ X(C.value) && (m.value = !1);
2667
2622
  }
2668
- function q() {
2623
+ function G() {
2669
2624
  if (l.value.kind === "fallback") {
2670
- te(!1);
2625
+ q(!1);
2671
2626
  return;
2672
2627
  }
2673
2628
  if (!n.surfaceActive) {
2674
- Y();
2629
+ J();
2675
2630
  return;
2676
2631
  }
2677
2632
  if (!A.value) {
2678
- te();
2633
+ q();
2679
2634
  return;
2680
2635
  }
2681
2636
  if (w.value || z) {
2682
2637
  z?.refresh();
2683
2638
  return;
2684
2639
  }
2685
- z = (n.assetLoadQueue ?? V).request({
2640
+ z = _r.request({
2686
2641
  assetType: l.value.kind,
2687
2642
  getPriority: se,
2688
2643
  onGrant() {
@@ -2691,7 +2646,7 @@ var vr = ["aria-label"], yr = {
2691
2646
  url: l.value.url ?? n.item.url
2692
2647
  });
2693
2648
  }
2694
- function J() {
2649
+ function K() {
2695
2650
  let e = C.value;
2696
2651
  if (!(!e || l.value.kind !== "video")) {
2697
2652
  if (h.value) {
@@ -2699,7 +2654,7 @@ var vr = ["aria-label"], yr = {
2699
2654
  return;
2700
2655
  }
2701
2656
  if (E.value && d.value && m.value) {
2702
- e.muted = !0, e.loop = !0, e.playsInline = !0, Ct(e);
2657
+ e.muted = !0, e.loop = !0, e.playsInline = !0, xt(e);
2703
2658
  return;
2704
2659
  }
2705
2660
  try {
@@ -2708,21 +2663,21 @@ var vr = ["aria-label"], yr = {
2708
2663
  e.pause();
2709
2664
  }
2710
2665
  }
2711
- function te(e = !0) {
2712
- w.value = l.value.kind === "fallback", h.value = null, m.value = l.value.kind === "fallback", e && (Z(), oe()), Y();
2666
+ function q(e = !0) {
2667
+ w.value = l.value.kind === "fallback", h.value = null, m.value = l.value.kind === "fallback", e && (ie(), ae()), J();
2713
2668
  }
2714
- function Y() {
2669
+ function J() {
2715
2670
  z?.release(), z = null;
2716
2671
  }
2717
- function X(e) {
2672
+ function te(e) {
2718
2673
  let t = v.value;
2719
2674
  if (!t) {
2720
2675
  d.value = !0;
2721
2676
  return;
2722
2677
  }
2723
- d.value = lr(e?.boundingClientRect ?? t.getBoundingClientRect(), e?.rootBounds ?? y.value?.getBoundingClientRect() ?? null);
2678
+ d.value = sr(e?.boundingClientRect ?? t.getBoundingClientRect(), e?.rootBounds ?? y.value?.getBoundingClientRect() ?? null);
2724
2679
  }
2725
- function re(e) {
2680
+ function Y(e) {
2726
2681
  if (!e) return;
2727
2682
  let t = $(n.item), r = `${t}|${e}`;
2728
2683
  B.has(r) || (B.add(r), n.reportAssetLoad?.({
@@ -2732,18 +2687,18 @@ var vr = ["aria-label"], yr = {
2732
2687
  url: e
2733
2688
  }));
2734
2689
  }
2735
- function ie() {
2690
+ function ne() {
2736
2691
  if (!I.value) return;
2737
2692
  let e = $(n.item);
2738
2693
  B.forEach((t) => {
2739
2694
  t.startsWith(`${e}|`) && B.delete(t);
2740
- }), h.value = null, m.value = !1, w.value = !1, Y(), q();
2695
+ }), h.value = null, m.value = !1, w.value = !1, J(), G();
2741
2696
  }
2742
- function Z() {
2743
- sr(g.value);
2697
+ function ie() {
2698
+ ar(g.value);
2744
2699
  }
2745
- function oe() {
2746
- cr(C.value);
2700
+ function ae() {
2701
+ or(C.value);
2747
2702
  }
2748
2703
  function se() {
2749
2704
  let e = v.value;
@@ -2756,17 +2711,17 @@ var vr = ["aria-label"], yr = {
2756
2711
  let n = window.innerHeight / 2;
2757
2712
  return Math.abs((t.top + t.bottom) / 2 - n);
2758
2713
  }
2759
- function ce(e) {
2760
- let t = ur(E.value);
2761
- return !e || !t ? !1 : ur("currentSrc" in e && e.currentSrc || e.getAttribute("src")) === t;
2714
+ function X(e) {
2715
+ let t = cr(E.value);
2716
+ return !e || !t ? !1 : cr("currentSrc" in e && e.currentSrc || e.getAttribute("src")) === t;
2762
2717
  }
2763
- function le() {
2718
+ function ce() {
2764
2719
  r("open");
2765
2720
  }
2766
- function ue() {
2721
+ function Z() {
2767
2722
  f.value = !0;
2768
2723
  }
2769
- function de(e) {
2724
+ function Q(e) {
2770
2725
  let t = e.relatedTarget;
2771
2726
  v.value && t instanceof Node && v.value.contains(t) || (f.value = !1);
2772
2727
  }
@@ -2775,8 +2730,8 @@ var vr = ["aria-label"], yr = {
2775
2730
  ref: v,
2776
2731
  "data-testid": "vibe-list-card-inner",
2777
2732
  class: _(["group relative h-full w-full overflow-hidden border bg-[#0a0b0f] text-[#f7f1ea] transition-[border-color,transform] duration-300", n.active ? "border-white/28" : "border-white/12 hover:border-white/24"]),
2778
- onFocusin: ue,
2779
- onFocusout: de,
2733
+ onFocusin: Z,
2734
+ onFocusout: Q,
2780
2735
  onPointerenter: t[0] ||= (e) => p.value = !0,
2781
2736
  onPointerleave: t[1] ||= (e) => p.value = !1
2782
2737
  }, [
@@ -2785,9 +2740,9 @@ var vr = ["aria-label"], yr = {
2785
2740
  "data-testid": "vibe-list-card-open",
2786
2741
  class: "absolute inset-0 z-[1] block h-full w-full cursor-pointer text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-[#f7f1ea]",
2787
2742
  "aria-label": n.item.title || `Open item ${n.index + 1}`,
2788
- onClick: le
2789
- }, null, 8, vr),
2790
- L.value ? (S(), s("div", yr, [c("span", br, [u(j(ne), {
2743
+ onClick: ce
2744
+ }, null, 8, br),
2745
+ L.value ? (S(), s("div", xr, [c("span", Sr, [u(j(re), {
2791
2746
  class: "h-5 w-5 animate-spin stroke-[1.9] text-[#f7f1ea]/78",
2792
2747
  "aria-hidden": "true"
2793
2748
  })])])) : o("", !0),
@@ -2799,9 +2754,9 @@ var vr = ["aria-label"], yr = {
2799
2754
  alt: l.value.label,
2800
2755
  draggable: "false",
2801
2756
  class: _(["block h-full w-full object-cover transition-opacity duration-300", m.value ? "pointer-events-none opacity-100" : "pointer-events-none opacity-0"]),
2802
- onLoad: U,
2803
- onError: W
2804
- }, null, 42, xr)) : N.value && E.value && !F.value ? (S(), s("video", {
2757
+ onLoad: V,
2758
+ onError: H
2759
+ }, null, 42, Cr)) : N.value && E.value && !F.value ? (S(), s("video", {
2805
2760
  key: 2,
2806
2761
  ref_key: "videoRef",
2807
2762
  ref: C,
@@ -2811,67 +2766,64 @@ var vr = ["aria-label"], yr = {
2811
2766
  playsinline: "",
2812
2767
  preload: "metadata",
2813
2768
  class: _(["block h-full w-full object-cover transition-opacity duration-300", m.value ? "pointer-events-none opacity-100" : "pointer-events-none opacity-0"]),
2814
- onCanplay: G,
2815
- onError: W,
2816
- onLoadstart: K,
2817
- onPlaying: G,
2818
- onStalled: K,
2819
- onWaiting: K
2820
- }, null, 42, Sr)) : F.value ? (S(), s("div", {
2769
+ onCanplay: U,
2770
+ onError: H,
2771
+ onLoadstart: W,
2772
+ onPlaying: U,
2773
+ onStalled: W,
2774
+ onWaiting: W
2775
+ }, null, 42, wr)) : F.value ? (S(), s("div", {
2821
2776
  key: 3,
2822
2777
  "data-testid": "vibe-list-card-error",
2823
2778
  "data-kind": h.value,
2824
2779
  class: "relative z-[2] grid h-full w-full place-items-center bg-[radial-gradient(circle_at_center,rgba(239,68,68,0.12),transparent_65%),linear-gradient(180deg,rgba(255,255,255,0.04),rgba(255,255,255,0.02))]"
2825
- }, [c("div", wr, [
2826
- u(j(ae), {
2780
+ }, [c("div", Er, [
2781
+ u(j(oe), {
2827
2782
  class: "h-6 w-6 stroke-[1.8] text-[#f7f1ea]/78",
2828
2783
  "aria-hidden": "true"
2829
2784
  }),
2830
- c("span", Tr, k(j(vt)(h.value)), 1),
2785
+ c("span", Dr, k(j(gt)(h.value)), 1),
2831
2786
  I.value ? (S(), s("button", {
2832
2787
  key: 0,
2833
2788
  type: "button",
2834
2789
  class: "pointer-events-auto inline-flex items-center justify-center border border-white/14 bg-black/35 px-3 py-2 text-[0.62rem] font-bold uppercase tracking-[0.22em] text-[#f7f1ea]/82 backdrop-blur-[18px] transition hover:border-white/28 hover:bg-black/50",
2835
- onClick: ee(ie, ["stop"])
2790
+ onClick: ee(ne, ["stop"])
2836
2791
  }, " Retry ")) : o("", !0)
2837
- ])], 8, Cr)) : (S(), s("div", Er, [c("div", Dr, [D(e.$slots, "item-icon", {
2838
- icon: j(Mt)(n.item.type),
2792
+ ])], 8, Tr)) : (S(), s("div", Or, [c("div", kr, [D(e.$slots, "item-icon", {
2793
+ icon: j(At)(n.item.type),
2839
2794
  item: n.item
2840
- }, () => [(S(), a(O(j(Mt)(n.item.type)), {
2795
+ }, () => [(S(), a(O(j(At)(n.item.type)), {
2841
2796
  class: "h-6 w-6 stroke-[1.8] text-[#f7f1ea]/78",
2842
2797
  "aria-hidden": "true"
2843
2798
  }))])])])),
2844
- c("div", Or, [D(e.$slots, "grid-item-overlay", {
2799
+ c("div", Ar, [D(e.$slots, "grid-item-overlay", {
2845
2800
  active: n.active,
2846
2801
  focused: f.value,
2847
2802
  hovered: p.value,
2848
2803
  index: n.index,
2849
2804
  item: n.item,
2850
- openFullscreen: le
2805
+ openFullscreen: ce
2851
2806
  })])
2852
2807
  ], 34));
2853
2808
  }
2854
- }), Ar = { class: "relative h-full min-h-0 bg-[radial-gradient(circle_at_top_center,rgba(255,255,255,0.04),transparent_28%),linear-gradient(180deg,#06070b,#05060a)]" }, jr = { class: "pointer-events-none absolute inset-x-0 top-0 z-[2] flex justify-end p-6" }, Mr = {
2809
+ }), Mr = { class: "relative h-full min-h-0 bg-[radial-gradient(circle_at_top_center,rgba(255,255,255,0.04),transparent_28%),linear-gradient(180deg,#06070b,#05060a)]" }, Nr = { class: "pointer-events-none absolute inset-x-0 top-0 z-[2] flex justify-end p-6" }, Pr = {
2855
2810
  "data-testid": "vibe-pagination",
2856
2811
  class: "inline-flex shrink-0 items-center gap-2 whitespace-nowrap border border-white/14 bg-black/40 px-3 py-2 text-[0.63rem] font-bold uppercase tracking-[0.12em] text-[#f7f1ea]/72 backdrop-blur-[18px] min-[721px]:gap-3 min-[721px]:px-4 min-[721px]:py-3 min-[721px]:text-[0.74rem] min-[721px]:tracking-[0.2em]"
2857
- }, Nr = { class: "whitespace-nowrap" }, Pr = {
2812
+ }, Fr = { class: "whitespace-nowrap" }, Ir = {
2858
2813
  key: 0,
2859
2814
  class: "whitespace-nowrap border-l border-white/12 pl-2 text-[#f7f1ea]/56 min-[721px]:pl-3"
2860
- }, Fr = [
2815
+ }, Lr = [
2861
2816
  "data-active",
2862
2817
  "data-index",
2863
2818
  "data-item-id",
2864
2819
  "data-occurrence-key"
2865
- ], Ir = {
2820
+ ], Rr = {
2866
2821
  key: 0,
2867
2822
  class: "pointer-events-none absolute inset-y-0 right-0 z-[3] hidden w-8 min-[1024px]:block"
2868
- }, Lr = {
2823
+ }, zr = {
2869
2824
  key: 1,
2870
2825
  class: "pointer-events-none absolute inset-x-0 bottom-0 z-[2] px-5 pb-5 sm:px-6"
2871
- }, Rr = { class: "mx-auto flex w-full max-w-[1600px] justify-center" }, zr = {
2872
- key: 1,
2873
- class: "inline-flex items-center border border-white/14 bg-black/55 px-4 py-3 text-[0.7rem] font-bold uppercase tracking-[0.18em] text-[#f7f1ea]/72 backdrop-blur-[18px]"
2874
- }, Br = /* @__PURE__ */ d({
2826
+ }, Br = { class: "mx-auto flex w-full max-w-[1600px] justify-center" }, Vr = /* @__PURE__ */ d({
2875
2827
  __name: "ListSurface",
2876
2828
  props: {
2877
2829
  active: {
@@ -2879,11 +2831,15 @@ var vr = ["aria-label"], yr = {
2879
2831
  default: !0
2880
2832
  },
2881
2833
  activeIndex: { default: 0 },
2882
- assetLoadQueue: { default: null },
2834
+ allowExhaustedNextPageRefresh: {
2835
+ type: Boolean,
2836
+ default: !1
2837
+ },
2883
2838
  commitPendingAppend: {
2884
2839
  type: [Function, null],
2885
2840
  default: null
2886
2841
  },
2842
+ errorMessage: { default: null },
2887
2843
  hasNextPage: {
2888
2844
  type: Boolean,
2889
2845
  default: !1
@@ -2899,6 +2855,7 @@ var vr = ["aria-label"], yr = {
2899
2855
  },
2900
2856
  pendingAppendItems: { default: () => [] },
2901
2857
  paginationDetail: { default: null },
2858
+ phase: { default: null },
2902
2859
  reportAssetError: {
2903
2860
  type: [Function, null],
2904
2861
  default: null
@@ -2915,7 +2872,6 @@ var vr = ["aria-label"], yr = {
2915
2872
  type: [Function, null],
2916
2873
  default: null
2917
2874
  },
2918
- restoreToken: {},
2919
2875
  showStatusBadges: {
2920
2876
  type: Boolean,
2921
2877
  default: !0
@@ -2923,8 +2879,9 @@ var vr = ["aria-label"], yr = {
2923
2879
  },
2924
2880
  emits: ["open-fullscreen", "update:activeIndex"],
2925
2881
  setup(e, { emit: n }) {
2926
- let r = e, a = M(), d = n, f = ar({
2882
+ let r = e, a = M(), d = n, f = rr({
2927
2883
  active: A(r, "active"),
2884
+ allowExhaustedNextPageRefresh: A(r, "allowExhaustedNextPageRefresh"),
2928
2885
  items: A(r, "items"),
2929
2886
  activeIndex: A(r, "activeIndex"),
2930
2887
  loading: A(r, "loading"),
@@ -2935,20 +2892,29 @@ var vr = ["aria-label"], yr = {
2935
2892
  commitPendingAppend: A(r, "commitPendingAppend"),
2936
2893
  requestNextPage: A(r, "requestNextPage"),
2937
2894
  requestPreviousPage: A(r, "requestPreviousPage"),
2938
- restoreToken: A(r, "restoreToken"),
2939
2895
  setActiveIndex(e) {
2940
2896
  d("update:activeIndex", e);
2941
2897
  }
2942
- }), p = i(() => r.loading ? r.items.length > 0 ? "Loading more items" : "Loading the first page" : !r.hasNextPage && r.items.length > 0 ? "End of list" : null), m = i(() => !r.showStatusBadges || !p.value ? null : {
2898
+ }), p = i(() => st({
2899
+ itemCount: r.items.length,
2900
+ loading: r.loading,
2901
+ phase: r.phase
2902
+ })), m = i(() => ct({
2903
+ errorMessage: r.errorMessage,
2904
+ hasItems: r.items.length > 0,
2905
+ hasNextPage: r.hasNextPage,
2906
+ phase: p.value,
2907
+ surface: "grid"
2908
+ })), g = i(() => !r.showStatusBadges || !m.value ? null : {
2943
2909
  activeIndex: f.resolvedActiveIndex.value,
2944
- kind: r.loading ? "loading-more" : "end",
2910
+ kind: m.value.kind,
2945
2911
  loading: r.loading,
2946
- message: p.value,
2912
+ message: m.value.message,
2947
2913
  paginationDetail: r.paginationDetail,
2948
2914
  total: r.items.length
2949
- }), g = i(() => !m.value || !a["grid-status"] ? [] : a["grid-status"](m.value)), b = i(() => Pt(g.value));
2950
- return (e, n) => (S(), s("div", Ar, [
2951
- c("div", jr, [c("span", Mr, [c("span", Nr, k(j(f).paginationLabel.value), 1), r.paginationDetail ? (S(), s("span", Pr, k(r.paginationDetail), 1)) : o("", !0)])]),
2915
+ }), b = i(() => !g.value || !a["grid-status"] ? [] : a["grid-status"](g.value)), x = i(() => Mt(b.value));
2916
+ return (e, n) => (S(), s("div", Mr, [
2917
+ c("div", Nr, [c("span", Pr, [c("span", Fr, k(j(f).paginationLabel.value), 1), r.paginationDetail ? (S(), s("span", Ir, k(r.paginationDetail), 1)) : o("", !0)])]),
2952
2918
  c("div", {
2953
2919
  ref: j(f).scrollViewportRef,
2954
2920
  "data-testid": "vibe-list-scroll",
@@ -2968,9 +2934,8 @@ var vr = ["aria-label"], yr = {
2968
2934
  "data-occurrence-key": j($)(t),
2969
2935
  class: "absolute will-change-transform",
2970
2936
  style: y(j(f).getCardStyle(n))
2971
- }, [u(kr, {
2937
+ }, [u(jr, {
2972
2938
  active: n === j(f).resolvedActiveIndex.value,
2973
- "asset-load-queue": r.assetLoadQueue,
2974
2939
  index: n,
2975
2940
  item: t,
2976
2941
  "report-asset-error": r.reportAssetError,
@@ -2987,56 +2952,49 @@ var vr = ["aria-label"], yr = {
2987
2952
  key: "1"
2988
2953
  } : void 0]), 1032, [
2989
2954
  "active",
2990
- "asset-load-queue",
2991
2955
  "index",
2992
2956
  "item",
2993
2957
  "report-asset-error",
2994
2958
  "report-asset-load",
2995
2959
  "surface-active",
2996
2960
  "onOpen"
2997
- ])], 12, Fr))), 128))], 4)], 544),
2998
- j(f).showScrollbar.value ? (S(), s("div", Ir, [n[2] ||= c("div", { class: "absolute bottom-6 right-3 top-6 w-px bg-white/8" }, null, -1), c("div", {
2961
+ ])], 12, Lr))), 128))], 4)], 544),
2962
+ j(f).showScrollbar.value ? (S(), s("div", Rr, [n[2] ||= c("div", { class: "absolute bottom-6 right-3 top-6 w-px bg-white/8" }, null, -1), c("div", {
2999
2963
  "data-testid": "vibe-list-scrollbar-thumb",
3000
2964
  class: _(["absolute right-[0.625rem] w-1 bg-white/34 transition-[height,transform,background-color,opacity] duration-300 ease-out", r.loading ? "bg-white/52" : "bg-white/34"]),
3001
2965
  style: y(j(f).getScrollbarThumbStyle())
3002
2966
  }, null, 6)])) : o("", !0),
3003
- a["grid-footer"] ? (S(), s("div", Lr, [c("div", Rr, [D(e.$slots, "grid-footer")])])) : o("", !0),
3004
- m.value ? (S(), s("div", {
2967
+ a["grid-footer"] ? (S(), s("div", zr, [c("div", Br, [D(e.$slots, "grid-footer")])])) : o("", !0),
2968
+ g.value ? (S(), s("div", {
3005
2969
  key: 2,
3006
2970
  class: _(["pointer-events-none absolute inset-x-0 bottom-0 z-[3] flex justify-center px-6", a["grid-footer"] ? "pb-24" : "pb-6"])
3007
- }, [b.value ? D(e.$slots, "grid-status", v(h({ key: 0 }, m.value))) : (S(), s("span", zr, k(m.value.message), 1))], 2)) : o("", !0)
2971
+ }, [x.value ? D(e.$slots, "grid-status", v(h({ key: 0 }, g.value))) : (S(), s("span", {
2972
+ key: 1,
2973
+ "data-testid": "vibe-grid-status-badge",
2974
+ class: _(["inline-flex items-center border border-white/14 bg-black/55 px-4 py-3 text-[0.7rem] font-bold uppercase tracking-[0.18em] text-[#f7f1ea]/72 backdrop-blur-[18px]", g.value.kind === "end" ? "border-amber-300/35 text-amber-200" : g.value.kind === "failed" ? "border-rose-400/45 text-rose-100" : ""])
2975
+ }, k(g.value.message), 3))], 2)) : o("", !0)
3008
2976
  ]));
3009
2977
  }
3010
- }), Vr = ["data-surface-mode"], Hr = {
2978
+ }), Hr = ["data-surface-mode"], Ur = {
3011
2979
  key: 1,
3012
2980
  class: "absolute left-5 top-5 z-30 border border-amber-400/45 bg-black/35 px-4 py-2 text-xs font-medium uppercase tracking-[0.24em] text-amber-100 backdrop-blur"
3013
- }, Ur = {
2981
+ }, Wr = {
3014
2982
  key: 2,
3015
2983
  class: "relative z-[1] grid h-full w-full content-center justify-items-center gap-6 px-[clamp(2rem,4vw,3rem)] py-[clamp(2rem,4vw,3rem)] text-center"
3016
- }, Wr = ["data-visible", "inert"], Gr = ["data-visible", "inert"], Kr = /* @__PURE__ */ d({
2984
+ }, Gr = ["data-visible", "inert"], Kr = ["data-visible", "inert"], qr = /* @__PURE__ */ d({
3017
2985
  name: "VibeLayout",
3018
2986
  __name: "Layout",
3019
2987
  props: {
3020
- items: {},
3021
- activeIndex: {},
3022
2988
  fillDelayMs: {},
3023
2989
  fillDelayStepMs: {},
2990
+ initialCursor: {},
3024
2991
  initialState: {},
3025
- loading: { type: Boolean },
3026
- hasNextPage: { type: Boolean },
3027
2992
  mode: {},
3028
- resolve: {},
3029
- initialCursor: {},
3030
2993
  pageSize: {},
3031
- assetLoadLimits: {},
3032
- hasPreviousPage: { type: Boolean },
3033
2994
  paginationDetail: {},
3034
- requestNextPage: {},
3035
- requestPreviousPage: {},
3036
- showStatusBadges: {
3037
- type: Boolean,
3038
- default: !0
3039
- },
2995
+ resolve: { type: Function },
2996
+ showEndBadge: { type: Boolean },
2997
+ showStatusBadges: { type: Boolean },
3040
2998
  surfaceMode: {}
3041
2999
  },
3042
3000
  emits: [
@@ -3046,48 +3004,41 @@ var vr = ["aria-label"], yr = {
3046
3004
  "update:surfaceMode"
3047
3005
  ],
3048
3006
  setup(e, { expose: n, emit: i }) {
3049
- let d = e, p = M(), m = i, h = Q(d.assetLoadLimits), g = Ge(d, m), _ = Z((e) => {
3007
+ let d = e, p = M(), m = i, h = Ve(d, m), g = se((e) => {
3050
3008
  m("asset-errors", e);
3051
- }), y = oe((e) => {
3009
+ }), _ = X((e) => {
3052
3010
  m("asset-loads", e);
3053
3011
  });
3054
3012
  return b(() => {
3055
- _.stop(), y.stop();
3056
- }), P(() => d.assetLoadLimits, (e) => {
3057
- h.setLimits(e);
3058
- }, { deep: !0 }), n({
3059
- cancel: g.cancel,
3060
- clearRemoved: g.clearRemoved,
3061
- getRemovedIds: g.getRemovedIds,
3062
- loadNext: g.loadNext,
3063
- loadPrevious: g.loadPrevious,
3064
- remove: g.remove,
3065
- restore: g.restore,
3066
- retry: g.retry,
3067
- status: g.status,
3068
- undo: g.undo
3013
+ g.stop(), _.stop();
3014
+ }), n({
3015
+ cancel: h.cancel,
3016
+ clearRemoved: h.clearRemoved,
3017
+ getRemovedIds: h.getRemovedIds,
3018
+ loadNext: h.loadNext,
3019
+ loadPrevious: h.loadPrevious,
3020
+ remove: h.remove,
3021
+ restore: h.restore,
3022
+ retry: h.retry,
3023
+ status: h.status,
3024
+ undo: h.undo
3069
3025
  }), (e, n) => (S(), s("section", {
3070
3026
  "data-testid": "vibe",
3071
- "data-surface-mode": j(g).surfaceMode.value,
3027
+ "data-surface-mode": j(h).surfaceMode.value,
3072
3028
  class: "relative h-full min-h-0 overflow-hidden bg-[#05060a] text-[#f7f1ea]"
3073
- }, [j(g).canRetryInitialLoad.value && !p["empty-state"] ? (S(), s("button", {
3029
+ }, [j(h).canRetryInitialLoad.value ? (S(), s("button", {
3074
3030
  key: 0,
3075
3031
  type: "button",
3076
3032
  class: "absolute left-5 top-5 z-30 inline-flex items-center border border-rose-400/55 bg-rose-500/18 px-4 py-2 text-xs font-medium uppercase tracking-[0.24em] text-white backdrop-blur transition hover:bg-rose-500/28",
3077
- onClick: n[0] ||= (...e) => j(g).retryInitialLoad && j(g).retryInitialLoad(...e)
3078
- }, " Retry ")) : j(g).errorMessage.value && j(g).items.value.length > 0 ? (S(), s("div", Hr, k(j(g).errorMessage.value), 1)) : o("", !0), j(g).items.value.length === 0 ? (S(), s("div", Ur, [p["empty-state"] ? D(e.$slots, "empty-state", {
3079
- key: 0,
3080
- canRetry: j(g).canRetryInitialLoad.value,
3081
- loading: j(g).loading.value,
3082
- retry: j(g).retryInitialLoad
3083
- }) : j(g).loading.value ? (S(), s(t, { key: 1 }, [u(j(ne), {
3033
+ onClick: n[0] ||= (...e) => j(h).retryInitialLoad && j(h).retryInitialLoad(...e)
3034
+ }, " Retry ")) : j(h).errorMessage.value && j(h).items.value.length > 0 ? (S(), s("div", Ur, k(j(h).errorMessage.value), 1)) : o("", !0), j(h).items.value.length === 0 ? (S(), s("div", Wr, [j(h).loading.value ? (S(), s(t, { key: 0 }, [u(j(re), {
3084
3035
  class: "size-10 animate-spin text-[#f7f1ea]/82",
3085
3036
  "aria-hidden": "true"
3086
- }), n[1] ||= c("p", { class: "m-0 text-[0.9rem] font-semibold uppercase tracking-[0.22em] text-[#f7f1ea]/72" }, " Loading... ", -1)], 64)) : (S(), s(t, { key: 2 }, [
3037
+ }), n[1] ||= c("p", { class: "m-0 text-[0.9rem] font-semibold uppercase tracking-[0.22em] text-[#f7f1ea]/72" }, " Loading... ", -1)], 64)) : (S(), s(t, { key: 1 }, [
3087
3038
  n[2] ||= c("p", { class: "m-0 text-[0.78rem] font-bold uppercase tracking-[0.28em] text-[#f7f1ea]/68" }, " Viewer ready ", -1),
3088
3039
  n[3] ||= c("h2", { class: "m-0 text-[clamp(2rem,4.4vw,3.6rem)] leading-[0.95] tracking-[-0.05em]" }, " No items available ", -1),
3089
3040
  n[4] ||= c("p", { class: "m-0 text-[clamp(0.98rem,1.3vw,1.12rem)] leading-[1.8] text-[#f7f1ea]/70" }, " Attach items to VibeLayout to turn this screen into the viewer. ", -1)
3090
- ], 64))])) : j(g).isDesktop.value ? (S(), s(t, { key: 3 }, [u(r, {
3041
+ ], 64))])) : j(h).isDesktop.value ? (S(), s(t, { key: 3 }, [u(r, {
3091
3042
  appear: "",
3092
3043
  "enter-active-class": "transition-[opacity,transform] duration-300 ease-out",
3093
3044
  "enter-from-class": "translate-y-3 opacity-0",
@@ -3098,28 +3049,29 @@ var vr = ["aria-label"], yr = {
3098
3049
  }, {
3099
3050
  default: I(() => [L(c("div", {
3100
3051
  "data-testid": "vibe-list-surface",
3101
- "data-visible": j(g).surfaceMode.value === "list" ? "true" : "false",
3102
- inert: j(g).surfaceMode.value !== "list",
3052
+ "data-visible": j(h).surfaceMode.value === "list" ? "true" : "false",
3053
+ inert: j(h).surfaceMode.value !== "list",
3103
3054
  class: "absolute inset-0 z-[2]"
3104
- }, [u(Br, {
3105
- active: j(g).surfaceMode.value === "list",
3106
- items: j(g).items.value,
3107
- "active-index": j(g).activeIndex.value,
3108
- "asset-load-queue": j(h),
3109
- loading: j(g).loading.value,
3110
- "has-next-page": j(g).hasNextPage.value,
3111
- "has-previous-page": j(g).hasPreviousPage.value,
3112
- "pending-append-items": j(g).pendingAppendItems.value,
3113
- "commit-pending-append": j(g).commitPendingAppend,
3114
- "pagination-detail": j(g).paginationDetail.value,
3115
- "report-asset-error": j(_).report,
3116
- "report-asset-load": j(y).report,
3117
- "request-next-page": j(g).prefetchNextPage,
3118
- "request-previous-page": j(g).prefetchPreviousPage,
3119
- "restore-token": j(g).listRestoreToken.value,
3120
- "show-status-badges": d.showStatusBadges !== !1,
3121
- onOpenFullscreen: j(g).openFullscreen,
3122
- "onUpdate:activeIndex": j(g).setActiveIndex
3055
+ }, [u(Vr, {
3056
+ active: j(h).surfaceMode.value === "list",
3057
+ "allow-exhausted-next-page-refresh": j(h).canRefreshExhaustedNextPage.value,
3058
+ items: j(h).items.value,
3059
+ "active-index": j(h).activeIndex.value,
3060
+ "error-message": j(h).errorMessage.value,
3061
+ loading: j(h).loading.value,
3062
+ "has-next-page": j(h).hasNextPage.value,
3063
+ "has-previous-page": j(h).hasPreviousPage.value,
3064
+ "pending-append-items": j(h).pendingAppendItems.value,
3065
+ phase: j(h).phase.value,
3066
+ "commit-pending-append": j(h).commitPendingAppend,
3067
+ "pagination-detail": j(h).paginationDetail.value,
3068
+ "report-asset-error": j(g).report,
3069
+ "report-asset-load": j(_).report,
3070
+ "request-next-page": j(h).prefetchNextPage,
3071
+ "request-previous-page": j(h).prefetchPreviousPage,
3072
+ "show-status-badges": d.showStatusBadges ?? !0,
3073
+ onOpenFullscreen: j(h).openFullscreen,
3074
+ "onUpdate:activeIndex": j(h).setActiveIndex
3123
3075
  }, l({ _: 2 }, [
3124
3076
  p["grid-footer"] ? {
3125
3077
  name: "grid-footer",
@@ -3131,7 +3083,7 @@ var vr = ["aria-label"], yr = {
3131
3083
  fn: I((t) => [D(e.$slots, "grid-item-overlay", v(f(t)))]),
3132
3084
  key: "1"
3133
3085
  } : void 0,
3134
- d.showStatusBadges !== !1 && p["grid-status"] ? {
3086
+ p["grid-status"] ? {
3135
3087
  name: "grid-status",
3136
3088
  fn: I((t) => [D(e.$slots, "grid-status", v(f(t)))]),
3137
3089
  key: "2"
@@ -3143,24 +3095,25 @@ var vr = ["aria-label"], yr = {
3143
3095
  } : void 0
3144
3096
  ]), 1032, [
3145
3097
  "active",
3098
+ "allow-exhausted-next-page-refresh",
3146
3099
  "items",
3147
3100
  "active-index",
3148
- "asset-load-queue",
3101
+ "error-message",
3149
3102
  "loading",
3150
3103
  "has-next-page",
3151
3104
  "has-previous-page",
3152
3105
  "pending-append-items",
3106
+ "phase",
3153
3107
  "commit-pending-append",
3154
3108
  "pagination-detail",
3155
3109
  "report-asset-error",
3156
3110
  "report-asset-load",
3157
3111
  "request-next-page",
3158
3112
  "request-previous-page",
3159
- "restore-token",
3160
3113
  "show-status-badges",
3161
3114
  "onOpenFullscreen",
3162
3115
  "onUpdate:activeIndex"
3163
- ])], 8, Wr), [[N, j(g).surfaceMode.value === "list"]])]),
3116
+ ])], 8, Gr), [[N, j(h).surfaceMode.value === "list"]])]),
3164
3117
  _: 3
3165
3118
  }), u(r, {
3166
3119
  appear: "",
@@ -3173,22 +3126,25 @@ var vr = ["aria-label"], yr = {
3173
3126
  }, {
3174
3127
  default: I(() => [L(c("div", {
3175
3128
  "data-testid": "vibe-fullscreen-surface",
3176
- "data-visible": j(g).surfaceMode.value === "fullscreen" ? "true" : "false",
3177
- inert: j(g).surfaceMode.value !== "fullscreen",
3129
+ "data-visible": j(h).surfaceMode.value === "fullscreen" ? "true" : "false",
3130
+ inert: j(h).surfaceMode.value !== "fullscreen",
3178
3131
  class: "absolute inset-0 z-[3]"
3179
- }, [u(vn, {
3180
- items: j(g).items.value,
3181
- active: j(g).surfaceMode.value === "fullscreen",
3182
- "active-index": j(g).activeIndex.value,
3183
- loading: j(g).loading.value,
3184
- "has-next-page": j(g).hasNextPage.value,
3185
- "pagination-detail": j(g).paginationDetail.value,
3186
- "report-asset-error": j(_).report,
3187
- "report-asset-load": j(y).report,
3188
- "show-back-to-list": j(g).showBackToList.value,
3189
- "show-status-badges": d.showStatusBadges !== !1,
3190
- onBackToList: j(g).returnToList,
3191
- "onUpdate:activeIndex": j(g).setActiveIndex
3132
+ }, [u(gn, {
3133
+ items: j(h).items.value,
3134
+ active: j(h).surfaceMode.value === "fullscreen",
3135
+ "active-index": j(h).activeIndex.value,
3136
+ "error-message": j(h).errorMessage.value,
3137
+ loading: j(h).loading.value,
3138
+ "has-next-page": j(h).hasNextPage.value,
3139
+ "pagination-detail": j(h).paginationDetail.value,
3140
+ phase: j(h).phase.value,
3141
+ "report-asset-error": j(g).report,
3142
+ "report-asset-load": j(_).report,
3143
+ "show-end-badge": d.showEndBadge ?? !0,
3144
+ "show-status-badges": d.showStatusBadges ?? !0,
3145
+ "show-back-to-list": j(h).showBackToList.value,
3146
+ onBackToList: j(h).returnToList,
3147
+ "onUpdate:activeIndex": j(h).setActiveIndex
3192
3148
  }, l({ _: 2 }, [
3193
3149
  p["fullscreen-overlay"] ? {
3194
3150
  name: "fullscreen-overlay",
@@ -3205,7 +3161,7 @@ var vr = ["aria-label"], yr = {
3205
3161
  fn: I((t) => [D(e.$slots, "fullscreen-header-actions", v(f(t)))]),
3206
3162
  key: "2"
3207
3163
  } : void 0,
3208
- d.showStatusBadges !== !1 && p["fullscreen-status"] ? {
3164
+ p["fullscreen-status"] ? {
3209
3165
  name: "fullscreen-status",
3210
3166
  fn: I((t) => [D(e.$slots, "fullscreen-status", v(f(t)))]),
3211
3167
  key: "3"
@@ -3219,31 +3175,37 @@ var vr = ["aria-label"], yr = {
3219
3175
  "items",
3220
3176
  "active",
3221
3177
  "active-index",
3178
+ "error-message",
3222
3179
  "loading",
3223
3180
  "has-next-page",
3224
3181
  "pagination-detail",
3182
+ "phase",
3225
3183
  "report-asset-error",
3226
3184
  "report-asset-load",
3227
- "show-back-to-list",
3185
+ "show-end-badge",
3228
3186
  "show-status-badges",
3187
+ "show-back-to-list",
3229
3188
  "onBackToList",
3230
3189
  "onUpdate:activeIndex"
3231
- ])], 8, Gr), [[N, j(g).surfaceMode.value === "fullscreen"]])]),
3190
+ ])], 8, Kr), [[N, j(h).surfaceMode.value === "fullscreen"]])]),
3232
3191
  _: 3
3233
- })], 64)) : (S(), a(vn, {
3192
+ })], 64)) : (S(), a(gn, {
3234
3193
  key: 4,
3235
- items: j(g).items.value,
3194
+ items: j(h).items.value,
3236
3195
  active: !0,
3237
- "active-index": j(g).activeIndex.value,
3238
- loading: j(g).loading.value,
3239
- "has-next-page": j(g).hasNextPage.value,
3240
- "pagination-detail": j(g).paginationDetail.value,
3241
- "report-asset-error": j(_).report,
3242
- "report-asset-load": j(y).report,
3196
+ "active-index": j(h).activeIndex.value,
3197
+ "error-message": j(h).errorMessage.value,
3198
+ loading: j(h).loading.value,
3199
+ "has-next-page": j(h).hasNextPage.value,
3200
+ "pagination-detail": j(h).paginationDetail.value,
3201
+ phase: j(h).phase.value,
3202
+ "report-asset-error": j(g).report,
3203
+ "report-asset-load": j(_).report,
3204
+ "show-end-badge": d.showEndBadge ?? !0,
3205
+ "show-status-badges": d.showStatusBadges ?? !0,
3243
3206
  "show-back-to-list": !1,
3244
- "show-status-badges": d.showStatusBadges !== !1,
3245
- onBackToList: j(g).returnToList,
3246
- "onUpdate:activeIndex": j(g).setActiveIndex
3207
+ onBackToList: j(h).returnToList,
3208
+ "onUpdate:activeIndex": j(h).setActiveIndex
3247
3209
  }, l({ _: 2 }, [
3248
3210
  p["fullscreen-overlay"] ? {
3249
3211
  name: "fullscreen-overlay",
@@ -3260,7 +3222,7 @@ var vr = ["aria-label"], yr = {
3260
3222
  fn: I((t) => [D(e.$slots, "fullscreen-header-actions", v(f(t)))]),
3261
3223
  key: "2"
3262
3224
  } : void 0,
3263
- d.showStatusBadges !== !1 && p["fullscreen-status"] ? {
3225
+ p["fullscreen-status"] ? {
3264
3226
  name: "fullscreen-status",
3265
3227
  fn: I((t) => [D(e.$slots, "fullscreen-status", v(f(t)))]),
3266
3228
  key: "3"
@@ -3273,18 +3235,21 @@ var vr = ["aria-label"], yr = {
3273
3235
  ]), 1032, [
3274
3236
  "items",
3275
3237
  "active-index",
3238
+ "error-message",
3276
3239
  "loading",
3277
3240
  "has-next-page",
3278
3241
  "pagination-detail",
3242
+ "phase",
3279
3243
  "report-asset-error",
3280
3244
  "report-asset-load",
3245
+ "show-end-badge",
3281
3246
  "show-status-badges",
3282
3247
  "onBackToList",
3283
3248
  "onUpdate:activeIndex"
3284
- ]))], 8, Vr));
3249
+ ]))], 8, Hr));
3285
3250
  }
3286
- }), qr = { install(e) {
3287
- e.component("VibeLayout", Kr);
3251
+ }), Jr = { install(e) {
3252
+ e.component("VibeLayout", qr);
3288
3253
  } };
3289
3254
  //#endregion
3290
- export { Kr as VibeLayout, qr as VibePlugin, qr as default };
3255
+ export { qr as VibeLayout, Jr as VibePlugin, Jr as default };