@wyxos/vibe 2.2.5 → 3.0.1

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