@wyxos/vibe 2.2.4 → 3.0.0

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