@opensite/ui 3.9.0 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,768 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import React__default, { useMemo } from 'react';
4
+ import { ImmersiveFeedProvider, ImmersiveViewer, useImmersiveFeed, ThumbnailCard } from '@page-speed/media-immersive';
5
+ import { clsx } from 'clsx';
6
+ import { twMerge } from 'tailwind-merge';
7
+ import { Icon } from '@page-speed/icon';
8
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
9
+
10
+ // components/blocks/gallery/instagram-post-grid.tsx
11
+ function cn(...inputs) {
12
+ return twMerge(clsx(inputs));
13
+ }
14
+ var DEFAULT_ICON_API_KEY = "au382bi7fsh96w9h9xlrnat2jglx";
15
+ var DynamicIcon = React.memo(function DynamicIcon2({
16
+ apiKey,
17
+ name,
18
+ ...props
19
+ }) {
20
+ if (name == null) return null;
21
+ if (typeof name !== "string") {
22
+ return /* @__PURE__ */ jsx(Fragment, { children: name });
23
+ }
24
+ return /* @__PURE__ */ jsx(Icon, { ...props, name, apiKey: apiKey ?? DEFAULT_ICON_API_KEY });
25
+ });
26
+ DynamicIcon.displayName = "DynamicIcon";
27
+ var maxWidthStyles = {
28
+ sm: "max-w-screen-sm",
29
+ md: "max-w-screen-md",
30
+ lg: "max-w-screen-lg",
31
+ xl: "max-w-7xl",
32
+ "2xl": "max-w-screen-2xl",
33
+ "4xl": "max-w-[1536px]",
34
+ full: "max-w-full"
35
+ };
36
+ var Container = React__default.forwardRef(
37
+ ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
38
+ const Component = as;
39
+ return /* @__PURE__ */ jsx(
40
+ Component,
41
+ {
42
+ ref,
43
+ className: cn(
44
+ "mx-auto w-full px-2 sm:px-4 lg:px-8",
45
+ maxWidthStyles[maxWidth],
46
+ className
47
+ ),
48
+ ...props,
49
+ children
50
+ }
51
+ );
52
+ }
53
+ );
54
+ Container.displayName = "Container";
55
+
56
+ // lib/patternSvgs.ts
57
+ var patternSvgs = {
58
+ squareAltGrid: "https://cdn.ing/assets/files/record/286187/4gpn0yq2ptra8iwlvmwwv860ggwv",
59
+ grid1: "https://cdn.ing/assets/files/record/286186/nbdflpgp4ostrno079hygibsflp3",
60
+ noise: "https://cdn.ing/assets/i/r/286188/zrqcp9hynh3j7p2laihwzfbujgrl/noise.png",
61
+ dots: "https://cdn.ing/assets/files/record/286198/yfsjx9thvtxzhl2qtshxyhkrm524",
62
+ dotPattern: "https://cdn.ing/assets/files/record/286192/7ig0cku8aqbboiza8nuk6hw0nnsr",
63
+ dotPattern2: "https://cdn.ing/assets/files/record/286189/arez6gd2s7isn9i1o6c7sexdq7bl",
64
+ circles: "https://cdn.ing/assets/files/record/286190/gtmia3sncjtzetdshc20zf1d3c17",
65
+ waves: "https://cdn.ing/assets/files/record/286191/mqlb33fzxz9cdth1bx7if0wmpkp1",
66
+ crossPattern: "https://cdn.ing/assets/files/record/286193/9yfqwdbnqaipbp7fsb3wbzzmq472",
67
+ architect: "https://cdn.ing/assets/files/record/286194/vgs88ugpvyhxu13wqgy0acvae6re",
68
+ tinyCheckers: "https://cdn.ing/assets/files/record/286195/65efaknsw8kcpf9o3c2gybytsl5b",
69
+ p6: "https://cdn.ing/assets/i/r/286196/6kl0rqnd6mjk8j7e525fo8fo0vkc/p6.webp"
70
+ };
71
+ var maskTop = "radial-gradient(ellipse 70% 60% at 50% 0%, #000 60%, transparent 100%)";
72
+ var maskBottom = "radial-gradient(ellipse 100% 80% at 50% 100%, #000 50%, transparent 90%)";
73
+ var maskCenter = "radial-gradient(ellipse 60% 60% at 50% 50%, #000 30%, transparent 70%)";
74
+ var maskTopLeft = "radial-gradient(ellipse 80% 80% at 0% 0%, #000 50%, transparent 90%)";
75
+ var maskTopRight = "radial-gradient(ellipse 80% 80% at 100% 0%, #000 50%, transparent 90%)";
76
+ var maskBottomLeft = "radial-gradient(ellipse 80% 80% at 0% 100%, #000 50%, transparent 90%)";
77
+ var maskBottomRight = "radial-gradient(ellipse 80% 80% at 100% 100%, #000 50%, transparent 90%)";
78
+ var circuitBoardPattern = (id, mask) => /* @__PURE__ */ jsxs(
79
+ "svg",
80
+ {
81
+ className: "h-full w-full",
82
+ xmlns: "http://www.w3.org/2000/svg",
83
+ style: mask ? {
84
+ maskImage: mask,
85
+ WebkitMaskImage: mask
86
+ } : void 0,
87
+ children: [
88
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
89
+ "pattern",
90
+ {
91
+ id,
92
+ x: "0",
93
+ y: "0",
94
+ width: "100",
95
+ height: "100",
96
+ patternUnits: "userSpaceOnUse",
97
+ children: [
98
+ /* @__PURE__ */ jsx(
99
+ "path",
100
+ {
101
+ d: "M0 50h40M60 50h40M50 0v40M50 60v40",
102
+ stroke: "hsl(var(--muted))",
103
+ strokeWidth: "1",
104
+ fill: "none"
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "50", r: "3", fill: "hsl(var(--muted))" }),
108
+ /* @__PURE__ */ jsx("circle", { cx: "0", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
109
+ /* @__PURE__ */ jsx("circle", { cx: "100", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
110
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "0", r: "2", fill: "hsl(var(--muted))" }),
111
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "100", r: "2", fill: "hsl(var(--muted))" })
112
+ ]
113
+ }
114
+ ) }),
115
+ /* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
116
+ ]
117
+ }
118
+ );
119
+ var gridDotsPattern = (id, mask) => /* @__PURE__ */ jsxs(
120
+ "svg",
121
+ {
122
+ className: "h-full w-full",
123
+ xmlns: "http://www.w3.org/2000/svg",
124
+ style: mask ? {
125
+ maskImage: mask,
126
+ WebkitMaskImage: mask
127
+ } : void 0,
128
+ children: [
129
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
130
+ "pattern",
131
+ {
132
+ id,
133
+ x: "0",
134
+ y: "0",
135
+ width: "40",
136
+ height: "40",
137
+ patternUnits: "userSpaceOnUse",
138
+ children: [
139
+ /* @__PURE__ */ jsx(
140
+ "path",
141
+ {
142
+ d: "M0 20h40M20 0v40",
143
+ stroke: "hsl(var(--muted))",
144
+ strokeWidth: "0.5",
145
+ fill: "none"
146
+ }
147
+ ),
148
+ /* @__PURE__ */ jsx("circle", { cx: "20", cy: "20", r: "2", fill: "hsl(var(--muted))" })
149
+ ]
150
+ }
151
+ ) }),
152
+ /* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
153
+ ]
154
+ }
155
+ );
156
+ var gridPattern = (size, mask) => /* @__PURE__ */ jsx(
157
+ "div",
158
+ {
159
+ className: "h-full w-full bg-[linear-gradient(to_right,_hsl(var(--muted))_1px,_transparent_1px),linear-gradient(to_bottom,_hsl(var(--muted))_1px,_transparent_1px)]",
160
+ style: {
161
+ backgroundSize: `${size}px ${size}px`,
162
+ ...mask ? {
163
+ maskImage: mask,
164
+ WebkitMaskImage: mask
165
+ } : {}
166
+ }
167
+ }
168
+ );
169
+ var diagonalCrossPattern = (mask) => /* @__PURE__ */ jsx(
170
+ "div",
171
+ {
172
+ className: "h-full w-full",
173
+ style: {
174
+ backgroundImage: "repeating-linear-gradient(45deg, transparent, transparent 32px, hsl(var(--muted)) 32px, hsl(var(--muted)) 33px), repeating-linear-gradient(135deg, transparent, transparent 32px, hsl(var(--muted)) 32px, hsl(var(--muted)) 33px)",
175
+ ...mask ? {
176
+ maskImage: mask,
177
+ WebkitMaskImage: mask
178
+ } : {}
179
+ }
180
+ }
181
+ );
182
+ var dashedGridMaskBase = "repeating-linear-gradient(to right, black 0px, black 3px, transparent 3px, transparent 8px), repeating-linear-gradient(to bottom, black 0px, black 3px, transparent 3px, transparent 8px)";
183
+ var dashedGridPattern = (fadeMask) => {
184
+ const mask = fadeMask ? `${dashedGridMaskBase}, ${fadeMask}` : dashedGridMaskBase;
185
+ return /* @__PURE__ */ jsx(
186
+ "div",
187
+ {
188
+ className: "h-full w-full",
189
+ style: {
190
+ backgroundImage: "linear-gradient(to right, hsl(var(--muted)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--muted)) 1px, transparent 1px)",
191
+ backgroundSize: "20px 20px",
192
+ backgroundPosition: "0 0, 0 0",
193
+ maskImage: mask,
194
+ WebkitMaskImage: mask,
195
+ maskComposite: "intersect",
196
+ WebkitMaskComposite: "source-in"
197
+ }
198
+ }
199
+ );
200
+ };
201
+ var gradientGlow = (position) => /* @__PURE__ */ jsx(
202
+ "div",
203
+ {
204
+ className: cn(
205
+ "pointer-events-none absolute left-1/2 z-0 aspect-square w-3/4 -translate-x-1/2 rounded-full opacity-50 blur-3xl",
206
+ position === "top" ? "-top-1/4" : "-bottom-1/4"
207
+ ),
208
+ style: {
209
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
210
+ }
211
+ }
212
+ );
213
+ var spotlight = (position) => /* @__PURE__ */ jsx(
214
+ "div",
215
+ {
216
+ className: cn(
217
+ "pointer-events-none absolute top-1/2 z-0 aspect-square w-3/4 -translate-y-1/2 rounded-full opacity-40 blur-3xl",
218
+ position === "left" ? "-left-1/4" : "-right-1/4"
219
+ ),
220
+ style: {
221
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
222
+ }
223
+ }
224
+ );
225
+ var patternOverlays = {
226
+ circuitBoardBasic: () => circuitBoardPattern("circuit-board-basic"),
227
+ circuitBoardFadeTop: () => circuitBoardPattern("circuit-board-fade-top", maskTop),
228
+ circuitBoardFadeBottom: () => circuitBoardPattern("circuit-board-fade-bottom", maskBottom),
229
+ circuitBoardFadeCenter: () => circuitBoardPattern("circuit-board-fade-center", maskCenter),
230
+ circuitBoardFadeTopLeft: () => circuitBoardPattern("circuit-board-fade-top-left", maskTopLeft),
231
+ circuitBoardFadeTopRight: () => circuitBoardPattern("circuit-board-fade-top-right", maskTopRight),
232
+ circuitBoardFadeBottomLeft: () => circuitBoardPattern("circuit-board-fade-bottom-left", maskBottomLeft),
233
+ circuitBoardFadeBottomRight: () => circuitBoardPattern("circuit-board-fade-bottom-right", maskBottomRight),
234
+ dashedGridBasic: () => dashedGridPattern(),
235
+ dashedGridFadeTop: () => dashedGridPattern(maskTop),
236
+ dashedGridFadeBottom: () => dashedGridPattern(maskBottom),
237
+ dashedGridFadeCenter: () => dashedGridPattern(maskCenter),
238
+ dashedGridFadeTopLeft: () => dashedGridPattern(maskTopLeft),
239
+ dashedGridFadeTopRight: () => dashedGridPattern(maskTopRight),
240
+ dashedGridFadeBottomLeft: () => dashedGridPattern(maskBottomLeft),
241
+ dashedGridFadeBottomRight: () => dashedGridPattern(maskBottomRight),
242
+ diagonalCrossBasic: () => diagonalCrossPattern(),
243
+ diagonalCrossFadeTop: () => diagonalCrossPattern(maskTop),
244
+ diagonalCrossFadeBottom: () => diagonalCrossPattern(maskBottom),
245
+ diagonalCrossFadeCenter: () => diagonalCrossPattern(maskCenter),
246
+ diagonalCrossFadeTopLeft: () => diagonalCrossPattern(maskTopLeft),
247
+ diagonalCrossFadeTopRight: () => diagonalCrossPattern(maskTopRight),
248
+ diagonalCrossFadeBottomLeft: () => diagonalCrossPattern(maskBottomLeft),
249
+ diagonalCrossFadeBottomRight: () => diagonalCrossPattern(maskBottomRight),
250
+ gridBasic: () => gridPattern(40),
251
+ gridFadeTop: () => gridPattern(32, maskTop),
252
+ gridFadeBottom: () => gridPattern(32, maskBottom),
253
+ gridFadeCenter: () => gridPattern(40, maskCenter),
254
+ gridFadeTopLeft: () => gridPattern(32, maskTopLeft),
255
+ gridFadeTopRight: () => gridPattern(32, maskTopRight),
256
+ gridFadeBottomLeft: () => gridPattern(32, maskBottomLeft),
257
+ gridFadeBottomRight: () => gridPattern(32, maskBottomRight),
258
+ gridDotsBasic: () => gridDotsPattern("grid-dots-basic"),
259
+ gridDotsFadeCenter: () => gridDotsPattern("grid-dots-fade-center", maskCenter),
260
+ gradientGlowTop: () => gradientGlow("top"),
261
+ gradientGlowBottom: () => gradientGlow("bottom"),
262
+ spotlightLeft: () => spotlight("left"),
263
+ spotlightRight: () => spotlight("right")
264
+ };
265
+ var inlinePatternStyles = {
266
+ radialGradientTop: {
267
+ background: "radial-gradient(125% 125% at 50% 10%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
268
+ },
269
+ radialGradientBottom: {
270
+ background: "radial-gradient(125% 125% at 50% 90%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
271
+ }
272
+ };
273
+ function PatternBackground({
274
+ pattern,
275
+ opacity = 0.08,
276
+ className,
277
+ style
278
+ }) {
279
+ if (!pattern) {
280
+ return null;
281
+ }
282
+ if (pattern in inlinePatternStyles) {
283
+ const inlineStyle = inlinePatternStyles[pattern];
284
+ return /* @__PURE__ */ jsx(
285
+ "div",
286
+ {
287
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
288
+ style: { ...inlineStyle, opacity, ...style },
289
+ "aria-hidden": "true"
290
+ }
291
+ );
292
+ }
293
+ if (pattern in patternOverlays) {
294
+ const Overlay = patternOverlays[pattern];
295
+ return /* @__PURE__ */ jsx(
296
+ "div",
297
+ {
298
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
299
+ style: { opacity, ...style },
300
+ "aria-hidden": "true",
301
+ children: Overlay()
302
+ }
303
+ );
304
+ }
305
+ const patternUrl = pattern in patternSvgs ? patternSvgs[pattern] : pattern;
306
+ return /* @__PURE__ */ jsx(
307
+ "div",
308
+ {
309
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
310
+ style: {
311
+ backgroundImage: `url(${patternUrl})`,
312
+ backgroundRepeat: "repeat",
313
+ backgroundSize: "auto",
314
+ opacity,
315
+ ...style
316
+ },
317
+ "aria-hidden": "true"
318
+ }
319
+ );
320
+ }
321
+ var backgroundStyles = {
322
+ default: "bg-background text-foreground",
323
+ white: "bg-white text-dark",
324
+ gray: "bg-muted/30 text-foreground",
325
+ dark: "bg-foreground text-background",
326
+ transparent: "bg-transparent text-foreground",
327
+ gradient: "bg-linear-to-br from-primary via-primary/90 to-foreground text-primary-foreground",
328
+ primary: "bg-primary text-primary-foreground",
329
+ secondary: "bg-secondary text-secondary-foreground",
330
+ muted: "bg-muted text-muted-foreground"
331
+ };
332
+ var spacingStyles = {
333
+ none: "py-0 md:py-0",
334
+ sm: "py-12 md:py-16",
335
+ md: "py-16 md:py-24",
336
+ lg: "py-20 md:py-32",
337
+ xl: "py-24 md:py-40",
338
+ hero: "pt-32 pb-12 md:pt-40 md:pb-40"
339
+ };
340
+ var predefinedSpacings = ["none", "sm", "md", "lg", "xl", "hero"];
341
+ var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
342
+ var Section = React__default.forwardRef(
343
+ ({
344
+ id,
345
+ title,
346
+ subtitle,
347
+ children,
348
+ className,
349
+ style,
350
+ background = "default",
351
+ spacing = "lg",
352
+ pattern,
353
+ patternOpacity,
354
+ patternClassName,
355
+ containerClassName,
356
+ containerMaxWidth = "xl",
357
+ ...props
358
+ }, ref) => {
359
+ const effectivePatternOpacity = patternOpacity !== void 0 ? patternOpacity : pattern ? 1 : 0;
360
+ return /* @__PURE__ */ jsxs(
361
+ "section",
362
+ {
363
+ ref,
364
+ id,
365
+ className: cn(
366
+ "relative",
367
+ pattern ? "overflow-hidden" : null,
368
+ backgroundStyles[background],
369
+ isPredefinedSpacing(spacing) ? spacingStyles[spacing] : spacing,
370
+ className
371
+ ),
372
+ style,
373
+ ...props,
374
+ children: [
375
+ /* @__PURE__ */ jsx(
376
+ PatternBackground,
377
+ {
378
+ pattern,
379
+ opacity: effectivePatternOpacity,
380
+ className: patternClassName
381
+ }
382
+ ),
383
+ /* @__PURE__ */ jsxs(
384
+ Container,
385
+ {
386
+ maxWidth: containerMaxWidth,
387
+ className: cn("relative z-10", containerClassName),
388
+ children: [
389
+ (title || subtitle) && /* @__PURE__ */ jsxs("div", { className: "mb-6 text-center md:mb-16", children: [
390
+ subtitle && /* @__PURE__ */ jsx("p", { className: "mb-2 text-sm font-semibold uppercase tracking-wider", children: subtitle }),
391
+ title && /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl", children: title })
392
+ ] }),
393
+ children
394
+ ]
395
+ }
396
+ )
397
+ ]
398
+ }
399
+ );
400
+ }
401
+ );
402
+ Section.displayName = "Section";
403
+ var IG_TILE_WIDTH = 320;
404
+ var IG_TILE_STYLE = { width: "100%" };
405
+ var TITLE_MAX = 90;
406
+ function truncate(text, max = TITLE_MAX) {
407
+ const trimmed = text.trim();
408
+ if (trimmed.length <= max) return trimmed;
409
+ const slice = trimmed.slice(0, max);
410
+ const lastSpace = slice.lastIndexOf(" ");
411
+ const head = lastSpace > max * 0.6 ? slice.slice(0, lastSpace) : slice;
412
+ return `${head.trimEnd()}\u2026`;
413
+ }
414
+ function captionToString(caption) {
415
+ return typeof caption === "string" ? caption : "";
416
+ }
417
+ function toMediaItem(item) {
418
+ const isVideo = Boolean(item.isVideo && item.videoUrl);
419
+ const fullCaption = captionToString(item.caption);
420
+ const title = truncate(fullCaption) || item.imageAlt || "Instagram post";
421
+ const meta = {
422
+ href: item.href,
423
+ likeCount: item.likeCount,
424
+ commentCount: item.commentCount,
425
+ viewCount: item.viewCount,
426
+ date: item.date
427
+ };
428
+ return {
429
+ id: item.id,
430
+ type: isVideo ? "video" : "image",
431
+ poster: item.image,
432
+ // Video source only when the post is a real video (image posts ignore it).
433
+ src: isVideo ? item.videoUrl : void 0,
434
+ title,
435
+ caption: fullCaption || void 0,
436
+ kind: "Instagram",
437
+ meta
438
+ };
439
+ }
440
+ function openPermalink(item) {
441
+ if (typeof window === "undefined") return;
442
+ const href = item.meta?.href;
443
+ if (!href) return;
444
+ window.open(href, "_blank", "noopener,noreferrer");
445
+ }
446
+ function likeBadge(likeCount) {
447
+ return /* @__PURE__ */ jsxs(
448
+ "span",
449
+ {
450
+ "aria-label": `${likeCount.toLocaleString()} likes`,
451
+ style: {
452
+ display: "inline-flex",
453
+ alignItems: "center",
454
+ gap: 4,
455
+ padding: "3px 8px",
456
+ borderRadius: 999,
457
+ background: "rgba(8,12,24,0.65)",
458
+ backdropFilter: "blur(6px)",
459
+ WebkitBackdropFilter: "blur(6px)",
460
+ color: "#fff",
461
+ fontSize: 11,
462
+ fontWeight: 700,
463
+ lineHeight: 1
464
+ },
465
+ children: [
466
+ /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/heart", size: 13, "aria-hidden": "true" }),
467
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: likeCount.toLocaleString() })
468
+ ]
469
+ }
470
+ );
471
+ }
472
+ var VIEWER_ACTIONS = [
473
+ {
474
+ id: "open-in-instagram",
475
+ icon: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/external-link", size: 22, "aria-hidden": "true" }),
476
+ label: "Instagram",
477
+ ariaLabel: "Open in Instagram",
478
+ onPress: (item) => openPermalink(item)
479
+ }
480
+ ];
481
+ function RailStat({
482
+ iconName,
483
+ count,
484
+ label,
485
+ onPress
486
+ }) {
487
+ return /* @__PURE__ */ jsxs(
488
+ "button",
489
+ {
490
+ type: "button",
491
+ "aria-label": `${count.toLocaleString()} ${label}`,
492
+ onClick: (e) => {
493
+ e.stopPropagation();
494
+ onPress();
495
+ },
496
+ style: {
497
+ display: "flex",
498
+ flexDirection: "column",
499
+ alignItems: "center",
500
+ gap: 5,
501
+ padding: 0,
502
+ border: "none",
503
+ background: "transparent",
504
+ color: "inherit",
505
+ cursor: "pointer",
506
+ font: "inherit"
507
+ },
508
+ children: [
509
+ /* @__PURE__ */ jsx(
510
+ "span",
511
+ {
512
+ style: {
513
+ width: 46,
514
+ height: 46,
515
+ borderRadius: "50%",
516
+ background: "var(--psmi-chrome-bg, rgba(255,255,255,0.14))",
517
+ backdropFilter: "blur(6px)",
518
+ WebkitBackdropFilter: "blur(6px)",
519
+ display: "flex",
520
+ alignItems: "center",
521
+ justifyContent: "center"
522
+ },
523
+ children: /* @__PURE__ */ jsx(DynamicIcon, { name: iconName, size: 22, "aria-hidden": "true" })
524
+ }
525
+ ),
526
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { fontSize: 11, fontWeight: 600 }, children: count.toLocaleString() })
527
+ ]
528
+ }
529
+ );
530
+ }
531
+ function InstagramViewerRail({ item }) {
532
+ const meta = item.meta ?? {};
533
+ const open = () => openPermalink(item);
534
+ return /* @__PURE__ */ jsxs(
535
+ "div",
536
+ {
537
+ style: {
538
+ position: "absolute",
539
+ right: 11,
540
+ bottom: 135,
541
+ display: "flex",
542
+ flexDirection: "column",
543
+ alignItems: "center",
544
+ gap: 18,
545
+ color: "var(--psmi-chrome-fg, #fff)",
546
+ zIndex: 3
547
+ },
548
+ children: [
549
+ typeof meta.likeCount === "number" ? /* @__PURE__ */ jsx(
550
+ RailStat,
551
+ {
552
+ iconName: "lucide/heart",
553
+ count: meta.likeCount,
554
+ label: "likes",
555
+ onPress: open
556
+ }
557
+ ) : null,
558
+ typeof meta.commentCount === "number" ? /* @__PURE__ */ jsx(
559
+ RailStat,
560
+ {
561
+ iconName: "lucide/message-circle",
562
+ count: meta.commentCount,
563
+ label: "comments",
564
+ onPress: open
565
+ }
566
+ ) : null,
567
+ typeof meta.viewCount === "number" ? /* @__PURE__ */ jsx(
568
+ RailStat,
569
+ {
570
+ iconName: "lucide/eye",
571
+ count: meta.viewCount,
572
+ label: "views",
573
+ onPress: open
574
+ }
575
+ ) : null,
576
+ meta.href ? /* @__PURE__ */ jsxs(
577
+ "a",
578
+ {
579
+ href: meta.href,
580
+ target: "_blank",
581
+ rel: "noopener noreferrer",
582
+ "aria-label": "Open in Instagram",
583
+ onClick: (e) => e.stopPropagation(),
584
+ style: {
585
+ display: "flex",
586
+ flexDirection: "column",
587
+ alignItems: "center",
588
+ gap: 5,
589
+ padding: 0,
590
+ border: "none",
591
+ background: "transparent",
592
+ color: "inherit",
593
+ cursor: "pointer",
594
+ font: "inherit",
595
+ textDecoration: "none"
596
+ },
597
+ children: [
598
+ /* @__PURE__ */ jsx(
599
+ "span",
600
+ {
601
+ style: {
602
+ width: 46,
603
+ height: 46,
604
+ borderRadius: "50%",
605
+ background: "var(--psmi-chrome-bg, rgba(255,255,255,0.14))",
606
+ backdropFilter: "blur(6px)",
607
+ WebkitBackdropFilter: "blur(6px)",
608
+ display: "flex",
609
+ alignItems: "center",
610
+ justifyContent: "center"
611
+ },
612
+ children: /* @__PURE__ */ jsx(
613
+ DynamicIcon,
614
+ {
615
+ name: "lucide/external-link",
616
+ size: 22,
617
+ "aria-hidden": "true"
618
+ }
619
+ )
620
+ }
621
+ ),
622
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { fontSize: 11, fontWeight: 600 }, children: "Instagram" })
623
+ ]
624
+ }
625
+ ) : null
626
+ ]
627
+ }
628
+ );
629
+ }
630
+ function InstagramFeedGrid({
631
+ mediaItems,
632
+ gridClassName,
633
+ itemClassName,
634
+ imageClassName,
635
+ optixFlowConfig
636
+ }) {
637
+ const { open } = useImmersiveFeed();
638
+ const posterImgProps = useMemo(() => {
639
+ const next = {};
640
+ if (imageClassName) next.className = imageClassName;
641
+ if (optixFlowConfig) next.optixFlowConfig = optixFlowConfig;
642
+ return Object.keys(next).length > 0 ? next : void 0;
643
+ }, [imageClassName, optixFlowConfig]);
644
+ return /* @__PURE__ */ jsx(
645
+ "div",
646
+ {
647
+ className: cn(
648
+ "grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",
649
+ gridClassName
650
+ ),
651
+ children: mediaItems.map((mediaItem) => {
652
+ const likeCount = mediaItem.meta?.likeCount;
653
+ return /* @__PURE__ */ jsx(
654
+ ThumbnailCard,
655
+ {
656
+ item: mediaItem,
657
+ onOpen: open,
658
+ size: IG_TILE_WIDTH,
659
+ style: IG_TILE_STYLE,
660
+ className: itemClassName,
661
+ elevated: false,
662
+ showDuration: false,
663
+ glyphMode: "hover",
664
+ posterImgProps,
665
+ badgeSlot: typeof likeCount === "number" ? likeBadge(likeCount) : void 0
666
+ },
667
+ mediaItem.id
668
+ );
669
+ })
670
+ }
671
+ );
672
+ }
673
+ function InstagramPostGrid({
674
+ sectionId = "instagram-post-grid",
675
+ heading,
676
+ subheading,
677
+ items,
678
+ itemsSlot,
679
+ className,
680
+ containerClassName,
681
+ headerClassName,
682
+ headingClassName,
683
+ subheadingClassName,
684
+ gridClassName,
685
+ itemClassName,
686
+ imageClassName,
687
+ optixFlowConfig,
688
+ background,
689
+ spacing,
690
+ pattern,
691
+ patternOpacity,
692
+ patternClassName
693
+ }) {
694
+ const mediaItems = useMemo(() => {
695
+ if (itemsSlot || !items) return [];
696
+ return items.filter((item) => Boolean(item.image)).map(toMediaItem);
697
+ }, [items, itemsSlot]);
698
+ if (!itemsSlot && (!items || items.length === 0)) {
699
+ return null;
700
+ }
701
+ return /* @__PURE__ */ jsxs(
702
+ Section,
703
+ {
704
+ id: sectionId,
705
+ background,
706
+ spacing,
707
+ pattern,
708
+ patternOpacity,
709
+ patternClassName,
710
+ className,
711
+ containerClassName,
712
+ children: [
713
+ (heading || subheading) && /* @__PURE__ */ jsxs("div", { className: cn("mb-8 flex flex-col gap-2", headerClassName), children: [
714
+ heading && (typeof heading === "string" ? /* @__PURE__ */ jsx(
715
+ "h2",
716
+ {
717
+ className: cn(
718
+ "text-xl font-medium tracking-tight md:text-2xl lg:text-3xl text-balance",
719
+ headingClassName
720
+ ),
721
+ children: heading
722
+ }
723
+ ) : /* @__PURE__ */ jsx("div", { className: headingClassName, children: heading })),
724
+ subheading && (typeof subheading === "string" ? /* @__PURE__ */ jsx(
725
+ "p",
726
+ {
727
+ className: cn(
728
+ "max-w-2xl text-balance text-muted-foreground",
729
+ subheadingClassName
730
+ ),
731
+ children: subheading
732
+ }
733
+ ) : /* @__PURE__ */ jsx("div", { className: subheadingClassName, children: subheading }))
734
+ ] }),
735
+ itemsSlot ? /* @__PURE__ */ jsx(
736
+ "div",
737
+ {
738
+ className: cn(
739
+ "grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",
740
+ gridClassName
741
+ ),
742
+ children: itemsSlot
743
+ }
744
+ ) : /* @__PURE__ */ jsxs(ImmersiveFeedProvider, { items: mediaItems, actions: VIEWER_ACTIONS, children: [
745
+ /* @__PURE__ */ jsx(
746
+ InstagramFeedGrid,
747
+ {
748
+ mediaItems,
749
+ gridClassName,
750
+ itemClassName,
751
+ imageClassName,
752
+ optixFlowConfig
753
+ }
754
+ ),
755
+ /* @__PURE__ */ jsx(
756
+ ImmersiveViewer,
757
+ {
758
+ ariaLabel: "Instagram post viewer",
759
+ renderActions: ({ item }) => /* @__PURE__ */ jsx(InstagramViewerRail, { item })
760
+ }
761
+ )
762
+ ] })
763
+ ]
764
+ }
765
+ );
766
+ }
767
+
768
+ export { InstagramPostGrid };