@flapsdk/vault-runtime 0.1.34 → 0.1.36-next.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.
- package/chunk-A3ER7XYN.js +408 -0
- package/chunk-A3ER7XYN.js.map +1 -0
- package/{chunk-22KTLOYH.js → chunk-FWYBGHBX.js} +17 -4
- package/chunk-FWYBGHBX.js.map +1 -0
- package/{chunk-CXCG5MGE.js → chunk-MLAOJT5Q.js} +138 -117
- package/chunk-MLAOJT5Q.js.map +1 -0
- package/{chunk-JVZ4TFPY.js → chunk-V7U4QTMT.js} +100 -86
- package/chunk-V7U4QTMT.js.map +1 -0
- package/host-client.d.mts +9 -2
- package/host-client.js +3 -3
- package/host.d.mts +5 -5
- package/host.js +4 -4
- package/{hostRuntimeConfig-Dl9t_R9u.d.mts → hostRuntimeConfig-DibvcxHE.d.mts} +1 -1
- package/{mpegts-6MFVUHRP.js → mpegts-J2J6JTD7.js} +6 -6
- package/{mpegts-6MFVUHRP.js.map → mpegts-J2J6JTD7.js.map} +1 -1
- package/package.json +4 -3
- package/runtime-contract.json +2 -1
- package/sdk.d.mts +40 -4
- package/sdk.js +37 -6
- package/sdk.js.map +1 -1
- package/server.d.mts +3 -3
- package/{txError-uPZICnzz.d.mts → txError-OBuRV8xN.d.mts} +15 -2
- package/{types-_ifYbddY.d.mts → types-DUZWZ3mC.d.mts} +98 -2
- package/ui.d.mts +1 -1
- package/ui.js +1 -1
- package/chunk-22KTLOYH.js.map +0 -1
- package/chunk-AGLB72HK.js +0 -61
- package/chunk-AGLB72HK.js.map +0 -1
- package/chunk-CXCG5MGE.js.map +0 -1
- package/chunk-JVZ4TFPY.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { shortenAddress, isValidAddress, ZERO_ADDRESS } from './chunk-B4WKI3EW.js';
|
|
2
2
|
import { isIpfsImageCid, resolveIpfsImageUrls, resolveIpfsImageUrl } from './chunk-SAG36LUR.js';
|
|
3
3
|
import { getTaxVaultHostChainConfig } from './chunk-FUOBTZMQ.js';
|
|
4
|
-
import * as
|
|
4
|
+
import * as React11 from 'react';
|
|
5
5
|
import { createContext, useContext, useState, useEffect, useMemo } from 'react';
|
|
6
6
|
import { Loader2, ExternalLink, AlertTriangle, CheckCircle2, Info, X, ShieldCheck, Play, Pause, VolumeX, Volume2, Maximize, SkipBack, ChevronLeft, ChevronRight, SkipForward } from 'lucide-react';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
@@ -10,6 +10,38 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
11
11
|
import { createPortal } from 'react-dom';
|
|
12
12
|
|
|
13
|
+
var RuntimeContext = createContext(null);
|
|
14
|
+
var MiniAppContext = createContext(null);
|
|
15
|
+
function useFlapSdk(options) {
|
|
16
|
+
const vault = useContext(RuntimeContext);
|
|
17
|
+
const app = useContext(MiniAppContext);
|
|
18
|
+
if (options) {
|
|
19
|
+
const runtime = app ?? vault;
|
|
20
|
+
if (!runtime) throw new Error("useFlapSdk requires a Flap runtime provider.");
|
|
21
|
+
return runtime.forChain(options.chainId);
|
|
22
|
+
}
|
|
23
|
+
if (vault && !app) return vault;
|
|
24
|
+
if (app) throw new Error("Independent Apps must select a network: useFlapSdk({ chainId }).");
|
|
25
|
+
throw new Error("useFlapSdk requires a Flap runtime provider.");
|
|
26
|
+
}
|
|
27
|
+
function useVaultContext() {
|
|
28
|
+
return useFlapSdk().context;
|
|
29
|
+
}
|
|
30
|
+
function useFlapI18n() {
|
|
31
|
+
const vault = useContext(RuntimeContext);
|
|
32
|
+
const app = useContext(MiniAppContext);
|
|
33
|
+
const runtime = app ?? vault;
|
|
34
|
+
if (!runtime) throw new Error("A Flap runtime provider is required.");
|
|
35
|
+
return runtime.i18n;
|
|
36
|
+
}
|
|
37
|
+
function useFlapNotify() {
|
|
38
|
+
const vault = useContext(RuntimeContext);
|
|
39
|
+
const app = useContext(MiniAppContext);
|
|
40
|
+
const runtime = app ?? vault;
|
|
41
|
+
if (!runtime) throw new Error("A Flap runtime provider is required.");
|
|
42
|
+
return runtime.notify;
|
|
43
|
+
}
|
|
44
|
+
|
|
13
45
|
// src/sdk/videoSession.ts
|
|
14
46
|
var videoProviderAbi = [
|
|
15
47
|
{ type: "function", name: "getVideoSessionLength", stateMutability: "view", inputs: [{ name: "user", type: "address" }], outputs: [{ type: "uint256" }] },
|
|
@@ -65,21 +97,6 @@ async function readVideoSessionSlice(sdk, consumer, start, count) {
|
|
|
65
97
|
function createConsumerVideoSessionReader(sdk, consumer) {
|
|
66
98
|
return { readLength: () => readVideoSessionLength(sdk, consumer), readSlice: (start, count) => readVideoSessionSlice(sdk, consumer, start, count) };
|
|
67
99
|
}
|
|
68
|
-
var RuntimeContext = createContext(null);
|
|
69
|
-
function useFlapSdk() {
|
|
70
|
-
const sdk = useContext(RuntimeContext);
|
|
71
|
-
if (!sdk) throw new Error("useFlapSdk must be used within VaultRuntimeProvider.");
|
|
72
|
-
return sdk;
|
|
73
|
-
}
|
|
74
|
-
function useVaultContext() {
|
|
75
|
-
return useFlapSdk().context;
|
|
76
|
-
}
|
|
77
|
-
function useFlapI18n() {
|
|
78
|
-
return useFlapSdk().i18n;
|
|
79
|
-
}
|
|
80
|
-
function useFlapNotify() {
|
|
81
|
-
return useFlapSdk().notify;
|
|
82
|
-
}
|
|
83
100
|
function AddressLink({ address, explorerBaseUrl, label }) {
|
|
84
101
|
if (!address) return /* @__PURE__ */ React.createElement("span", null, "-");
|
|
85
102
|
const href = explorerBaseUrl ? `${explorerBaseUrl.replace(/\/$/, "")}/address/${address}` : void 0;
|
|
@@ -131,13 +148,13 @@ var buttonVariants = cva(
|
|
|
131
148
|
}
|
|
132
149
|
}
|
|
133
150
|
);
|
|
134
|
-
var Button =
|
|
151
|
+
var Button = React11.forwardRef(
|
|
135
152
|
({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
136
153
|
const Comp = asChild ? Slot : "button";
|
|
137
154
|
if (asChild) {
|
|
138
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ React11.createElement(Comp, { "data-flap-ui": "button", className: cn(buttonVariants({ variant, size, className })), ref, ...props }, children);
|
|
139
156
|
}
|
|
140
|
-
return /* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ React11.createElement(
|
|
141
158
|
Comp,
|
|
142
159
|
{
|
|
143
160
|
"data-flap-ui": "button",
|
|
@@ -146,8 +163,8 @@ var Button = React5.forwardRef(
|
|
|
146
163
|
disabled: disabled || loading,
|
|
147
164
|
...props
|
|
148
165
|
},
|
|
149
|
-
loading ? /* @__PURE__ */
|
|
150
|
-
/* @__PURE__ */
|
|
166
|
+
loading ? /* @__PURE__ */ React11.createElement(Loader2, { className: "relative z-10 h-4 w-4 animate-spin" }) : null,
|
|
167
|
+
/* @__PURE__ */ React11.createElement("span", { className: "relative z-10 inline-flex min-w-0 items-center justify-center gap-2" }, children)
|
|
151
168
|
);
|
|
152
169
|
}
|
|
153
170
|
);
|
|
@@ -173,8 +190,8 @@ function normalizeBinanceImageUrl(value) {
|
|
|
173
190
|
|
|
174
191
|
// src/ui/BinanceImage.tsx
|
|
175
192
|
function BinanceImage({ alt, src, fallback = null, className, onError, ...props }) {
|
|
176
|
-
const safeSrc =
|
|
177
|
-
const [failedSrc, setFailedSrc] =
|
|
193
|
+
const safeSrc = React11.useMemo(() => normalizeBinanceImageUrl(src), [src]);
|
|
194
|
+
const [failedSrc, setFailedSrc] = React11.useState(null);
|
|
178
195
|
const {
|
|
179
196
|
alt: _unsafeAlt,
|
|
180
197
|
decoding: _unsafeDecoding,
|
|
@@ -185,11 +202,11 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
|
|
|
185
202
|
...imageProps
|
|
186
203
|
} = props;
|
|
187
204
|
if (!safeSrc || failedSrc === safeSrc) {
|
|
188
|
-
return /* @__PURE__ */
|
|
205
|
+
return /* @__PURE__ */ React11.createElement("span", { className: cn("block", className), "data-flap-binance-image-state": safeSrc ? "error" : "invalid" }, fallback);
|
|
189
206
|
}
|
|
190
207
|
return (
|
|
191
208
|
// eslint-disable-next-line @next/next/no-img-element -- BinanceImage owns the exact-host runtime boundary and browser loading policy.
|
|
192
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ React11.createElement(
|
|
193
210
|
"img",
|
|
194
211
|
{
|
|
195
212
|
...imageProps,
|
|
@@ -208,7 +225,7 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
|
|
|
208
225
|
)
|
|
209
226
|
);
|
|
210
227
|
}
|
|
211
|
-
var Card =
|
|
228
|
+
var Card = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
212
229
|
"div",
|
|
213
230
|
{
|
|
214
231
|
"data-flap-ui": "card",
|
|
@@ -221,20 +238,20 @@ var Card = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ R
|
|
|
221
238
|
}
|
|
222
239
|
));
|
|
223
240
|
Card.displayName = "Card";
|
|
224
|
-
var CardHeader =
|
|
225
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
241
|
+
var CardHeader = React11.forwardRef(
|
|
242
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement("div", { "data-flap-ui": "card-header", ref, className: cn("flex flex-col gap-1.5 p-4 sm:p-5", className), ...props })
|
|
226
243
|
);
|
|
227
244
|
CardHeader.displayName = "CardHeader";
|
|
228
|
-
var CardTitle =
|
|
229
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
245
|
+
var CardTitle = React11.forwardRef(
|
|
246
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement("h3", { "data-flap-ui": "card-title", ref, className: cn("text-base font-semibold uppercase leading-tight tracking-normal text-white sm:text-lg", className), ...props })
|
|
230
247
|
);
|
|
231
248
|
CardTitle.displayName = "CardTitle";
|
|
232
|
-
var CardDescription =
|
|
233
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
249
|
+
var CardDescription = React11.forwardRef(
|
|
250
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement("p", { "data-flap-ui": "card-description", ref, className: cn("text-sm leading-6 text-[#84888C]", className), ...props })
|
|
234
251
|
);
|
|
235
252
|
CardDescription.displayName = "CardDescription";
|
|
236
|
-
var CardContent =
|
|
237
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
253
|
+
var CardContent = React11.forwardRef(
|
|
254
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement("div", { "data-flap-ui": "card-content", ref, className: cn("p-4 pt-0 sm:p-5 sm:pt-0", className), ...props })
|
|
238
255
|
);
|
|
239
256
|
CardContent.displayName = "CardContent";
|
|
240
257
|
function formatMs(ms) {
|
|
@@ -312,23 +329,23 @@ function normalizeExternalUrl(url) {
|
|
|
312
329
|
}
|
|
313
330
|
}
|
|
314
331
|
function WarningIcon({ className }) {
|
|
315
|
-
return /* @__PURE__ */
|
|
332
|
+
return /* @__PURE__ */ React11.createElement("svg", { viewBox: "0 0 80 80", fill: "currentColor", "aria-hidden": "true", shapeRendering: "crispEdges", className }, /* @__PURE__ */ React11.createElement("rect", { x: "32.4395", y: "11.7969", width: "2.62997", height: "6.57492" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 47.5605 11.7969)" }), /* @__PURE__ */ React11.createElement("rect", { x: "35.0693", y: "9.16699", width: "2.62997", height: "5.25994" }), /* @__PURE__ */ React11.createElement("rect", { x: "37.6982", y: "9.16699", width: "4.60245", height: "2.62997" }), /* @__PURE__ */ React11.createElement("rect", { x: "38.333", y: "6.66699", width: "3.33333", height: "2.5" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.25994", transform: "matrix(-1 0 0 1 44.9307 9.16699)" }), /* @__PURE__ */ React11.createElement("rect", { x: "29.8086", y: "16.3989", width: "2.62997", height: "6.57492" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 50.1914 16.3989)" }), /* @__PURE__ */ React11.createElement("rect", { x: "27.1787", y: "21.6592", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 52.8213 21.6592)" }), /* @__PURE__ */ React11.createElement("rect", { x: "24.5488", y: "24.2891", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 55.4512 24.2891)" }), /* @__PURE__ */ React11.createElement("rect", { x: "21.9189", y: "29.5488", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 58.0811 29.5488)" }), /* @__PURE__ */ React11.createElement("rect", { x: "19.2891", y: "34.8086", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 60.7109 34.8086)" }), /* @__PURE__ */ React11.createElement("rect", { x: "16.6592", y: "40.0693", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 63.3408 40.0693)" }), /* @__PURE__ */ React11.createElement("rect", { x: "14.0293", y: "44.6709", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 65.9707 44.6709)" }), /* @__PURE__ */ React11.createElement("rect", { x: "11.3984", y: "48.6165", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 68.6016 48.6165)" }), /* @__PURE__ */ React11.createElement("rect", { x: "8.76855", y: "53.8762", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 71.2314 53.8762)" }), /* @__PURE__ */ React11.createElement("rect", { x: "6.13965", y: "58.4783", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 73.8604 58.4783)" }), /* @__PURE__ */ React11.createElement("rect", { x: "4.16699", y: "62.4236", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 75.833 62.4236)" }), /* @__PURE__ */ React11.createElement("rect", { x: "6.79688", y: "68.3406", width: "2.62997", height: "2.62997" }), /* @__PURE__ */ React11.createElement("rect", { x: "70.5742", y: "68.3406", width: "2.62997", height: "2.62997" }), /* @__PURE__ */ React11.createElement("rect", { x: "9.42578", y: "70.9709", width: "61.1468", height: "2.62997" }), /* @__PURE__ */ React11.createElement("rect", { x: "38.333", y: "30.833", width: "4.16667", height: "22.5" }), /* @__PURE__ */ React11.createElement("rect", { x: "38.333", y: "57.5", width: "4.16667", height: "4.16667" }));
|
|
316
333
|
}
|
|
317
334
|
function ExternalLink2({ url, children, locale, className, copy }) {
|
|
318
|
-
const [open, setOpen] =
|
|
319
|
-
const [acknowledged, setAcknowledged] =
|
|
320
|
-
const [mounted, setMounted] =
|
|
335
|
+
const [open, setOpen] = React11.useState(false);
|
|
336
|
+
const [acknowledged, setAcknowledged] = React11.useState(false);
|
|
337
|
+
const [mounted, setMounted] = React11.useState(false);
|
|
321
338
|
const text = { ...COPY[resolveLocale(locale)], ...copy };
|
|
322
|
-
const safeUrl =
|
|
339
|
+
const safeUrl = React11.useMemo(() => normalizeExternalUrl(url), [url]);
|
|
323
340
|
const canProceed = acknowledged && Boolean(safeUrl);
|
|
324
|
-
|
|
341
|
+
React11.useEffect(() => {
|
|
325
342
|
setMounted(true);
|
|
326
343
|
}, []);
|
|
327
|
-
const close =
|
|
344
|
+
const close = React11.useCallback(() => {
|
|
328
345
|
setOpen(false);
|
|
329
346
|
setAcknowledged(false);
|
|
330
347
|
}, []);
|
|
331
|
-
|
|
348
|
+
React11.useEffect(() => {
|
|
332
349
|
if (!open) return;
|
|
333
350
|
const onKey = (event) => {
|
|
334
351
|
if (event.key === "Escape") close();
|
|
@@ -346,7 +363,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
346
363
|
window.open(safeUrl, "_blank", "noopener,noreferrer");
|
|
347
364
|
close();
|
|
348
365
|
};
|
|
349
|
-
return /* @__PURE__ */
|
|
366
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
350
367
|
"button",
|
|
351
368
|
{
|
|
352
369
|
type: "button",
|
|
@@ -354,17 +371,17 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
354
371
|
onClick: () => setOpen(true),
|
|
355
372
|
className: cn("inline-flex min-w-0 items-center gap-1 text-[#d0ff00] hover:underline", className)
|
|
356
373
|
},
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ React11.createElement("span", { className: "truncate" }, children),
|
|
375
|
+
/* @__PURE__ */ React11.createElement(ExternalLink, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" })
|
|
359
376
|
), open && mounted ? createPortal(
|
|
360
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ React11.createElement(
|
|
361
378
|
"div",
|
|
362
379
|
{
|
|
363
380
|
className: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",
|
|
364
381
|
style: { zIndex: 2147483647 },
|
|
365
382
|
onClick: close
|
|
366
383
|
},
|
|
367
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ React11.createElement(
|
|
368
385
|
"div",
|
|
369
386
|
{
|
|
370
387
|
role: "dialog",
|
|
@@ -380,22 +397,22 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
380
397
|
},
|
|
381
398
|
className: "flex w-[min(540px,100%)] max-h-[calc(100vh-2rem)] flex-col overflow-hidden rounded-[4px] text-white shadow-panel"
|
|
382
399
|
},
|
|
383
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ React11.createElement(
|
|
384
401
|
"div",
|
|
385
402
|
{
|
|
386
403
|
className: "flex items-center justify-between border-b border-[#484b51] px-6 py-[14px]",
|
|
387
404
|
style: { boxSizing: "border-box", height: "49px", lineHeight: 1 }
|
|
388
405
|
},
|
|
389
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ React11.createElement(
|
|
390
407
|
"span",
|
|
391
408
|
{
|
|
392
409
|
className: "truncate text-[18px] font-medium uppercase leading-none tracking-[-0.4px]",
|
|
393
410
|
style: { lineHeight: 1 }
|
|
394
411
|
},
|
|
395
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ React11.createElement("span", { className: "text-[#d0ff00]" }, "//"),
|
|
396
413
|
text.title
|
|
397
414
|
),
|
|
398
|
-
/* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ React11.createElement(
|
|
399
416
|
"button",
|
|
400
417
|
{
|
|
401
418
|
type: "button",
|
|
@@ -403,10 +420,10 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
403
420
|
"aria-label": text.cancel,
|
|
404
421
|
className: "flex size-5 shrink-0 items-center justify-center border border-[#484b51] text-white/80 hover:text-white"
|
|
405
422
|
},
|
|
406
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ React11.createElement(X, { className: "h-3.5 w-3.5" })
|
|
407
424
|
)
|
|
408
425
|
),
|
|
409
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ React11.createElement("div", { className: "flex flex-col gap-6 overflow-y-auto p-6" }, /* @__PURE__ */ React11.createElement("div", { className: "flex flex-col items-center gap-5" }, /* @__PURE__ */ React11.createElement(WarningIcon, { className: "h-20 w-20 text-[#f68f15]" }), /* @__PURE__ */ React11.createElement("h2", { className: "text-center text-[18px] font-medium uppercase leading-[1.4] tracking-[-0.4px]" }, text.heading)), /* @__PURE__ */ React11.createElement("p", { className: "text-[14px] leading-[1.4] tracking-[-0.4px] text-[#a0a3a7]" }, text.description), /* @__PURE__ */ React11.createElement("div", { className: "min-w-0 border border-[#262626] bg-[#0a0a0a] px-3 py-2 text-[13px]" }, /* @__PURE__ */ React11.createElement("div", { className: "mb-1 uppercase tracking-[-0.4px] text-[#6b7280]" }, text.destinationLabel), /* @__PURE__ */ React11.createElement("div", { className: "truncate text-[#d4d4d4]", title: safeUrl ?? url }, safeUrl ? new URL(safeUrl).host : text.invalidDestination)), /* @__PURE__ */ React11.createElement("label", { className: "flex cursor-pointer items-center gap-2 text-[14px] leading-[1.4] tracking-[-0.4px] text-white" }, /* @__PURE__ */ React11.createElement(
|
|
410
427
|
"input",
|
|
411
428
|
{
|
|
412
429
|
type: "checkbox",
|
|
@@ -414,7 +431,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
414
431
|
onChange: (event) => setAcknowledged(event.target.checked),
|
|
415
432
|
className: "sr-only"
|
|
416
433
|
}
|
|
417
|
-
), /* @__PURE__ */
|
|
434
|
+
), /* @__PURE__ */ React11.createElement(
|
|
418
435
|
"span",
|
|
419
436
|
{
|
|
420
437
|
"aria-hidden": "true",
|
|
@@ -423,8 +440,8 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
423
440
|
acknowledged ? "border-[#d0ff00] bg-[#d0ff00] text-[#070808]" : "border-[#a0a3a7] bg-transparent"
|
|
424
441
|
)
|
|
425
442
|
},
|
|
426
|
-
acknowledged ? /* @__PURE__ */
|
|
427
|
-
), /* @__PURE__ */
|
|
443
|
+
acknowledged ? /* @__PURE__ */ React11.createElement("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: 2 }, /* @__PURE__ */ React11.createElement("path", { d: "M2 6.5 L5 9 L10 3", strokeLinecap: "square" })) : null
|
|
444
|
+
), /* @__PURE__ */ React11.createElement("span", { className: "min-w-0" }, text.acknowledge)), /* @__PURE__ */ React11.createElement("div", { className: "flex gap-6" }, /* @__PURE__ */ React11.createElement(
|
|
428
445
|
"button",
|
|
429
446
|
{
|
|
430
447
|
type: "button",
|
|
@@ -432,7 +449,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
432
449
|
className: "flex flex-1 items-center justify-center rounded-[2px] border border-[#84888c] bg-transparent py-3 text-[14px] font-bold uppercase tracking-[-0.4px] text-white transition-colors hover:border-white"
|
|
433
450
|
},
|
|
434
451
|
text.cancel
|
|
435
|
-
), /* @__PURE__ */
|
|
452
|
+
), /* @__PURE__ */ React11.createElement(
|
|
436
453
|
"button",
|
|
437
454
|
{
|
|
438
455
|
type: "button",
|
|
@@ -448,7 +465,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
448
465
|
document.body
|
|
449
466
|
) : null);
|
|
450
467
|
}
|
|
451
|
-
var Input =
|
|
468
|
+
var Input = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
452
469
|
"input",
|
|
453
470
|
{
|
|
454
471
|
"data-flap-ui": "input",
|
|
@@ -462,16 +479,16 @@ var Input = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
462
479
|
));
|
|
463
480
|
Input.displayName = "Input";
|
|
464
481
|
function IpfsImage({ alt, cid, path, validationPath, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
465
|
-
const urls =
|
|
466
|
-
const [urlIndex, setUrlIndex] =
|
|
482
|
+
const urls = React11.useMemo(() => resolveIpfsImageUrls(cid, 56, path), [cid, path]);
|
|
483
|
+
const [urlIndex, setUrlIndex] = React11.useState(0);
|
|
467
484
|
const src = urls[urlIndex];
|
|
468
|
-
|
|
485
|
+
React11.useEffect(() => {
|
|
469
486
|
setUrlIndex(0);
|
|
470
487
|
}, [cid, path]);
|
|
471
488
|
if (!src) return null;
|
|
472
489
|
return (
|
|
473
490
|
// eslint-disable-next-line @next/next/no-img-element -- IpfsImage owns CID-to-gateway fallback; next/image cannot represent this boundary.
|
|
474
|
-
/* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ React11.createElement(
|
|
475
492
|
"img",
|
|
476
493
|
{
|
|
477
494
|
...props,
|
|
@@ -492,13 +509,13 @@ function IpfsImage({ alt, cid, path, validationPath, className, decoding = "asyn
|
|
|
492
509
|
);
|
|
493
510
|
}
|
|
494
511
|
function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...props }) {
|
|
495
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ React11.createElement("div", { ...props, "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden", className) }, /* @__PURE__ */ React11.createElement(IpfsImage, { alt: "", cid, className: cn("h-full w-full object-cover", imageClassName), loading: "eager" }), overlayClassName ? /* @__PURE__ */ React11.createElement("div", { className: cn("absolute inset-0", overlayClassName) }) : null);
|
|
496
513
|
}
|
|
497
514
|
function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
498
515
|
const sdk = useFlapSdk();
|
|
499
|
-
const [metadata, setMetadata] =
|
|
500
|
-
const [state, setState] =
|
|
501
|
-
|
|
516
|
+
const [metadata, setMetadata] = React11.useState(null);
|
|
517
|
+
const [state, setState] = React11.useState("loading");
|
|
518
|
+
React11.useEffect(() => {
|
|
502
519
|
let cancelled = false;
|
|
503
520
|
setState("loading");
|
|
504
521
|
setMetadata(null);
|
|
@@ -514,11 +531,11 @@ function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding =
|
|
|
514
531
|
};
|
|
515
532
|
}, [sdk, sdk.refetchNonce, tokenId]);
|
|
516
533
|
if (state !== "ready" || !metadata) {
|
|
517
|
-
return /* @__PURE__ */
|
|
534
|
+
return /* @__PURE__ */ React11.createElement("span", { "data-flap-nft-media-state": state, className: cn("block", className) }, fallback);
|
|
518
535
|
}
|
|
519
536
|
return (
|
|
520
537
|
// eslint-disable-next-line @next/next/no-img-element -- shared runtime resolves tokenURI metadata to a validated, size-limited data image.
|
|
521
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ React11.createElement(
|
|
522
539
|
"img",
|
|
523
540
|
{
|
|
524
541
|
...props,
|
|
@@ -566,7 +583,7 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
566
583
|
title: _title,
|
|
567
584
|
...safeProps
|
|
568
585
|
} = props;
|
|
569
|
-
return /* @__PURE__ */
|
|
586
|
+
return /* @__PURE__ */ React11.createElement(
|
|
570
587
|
"iframe",
|
|
571
588
|
{
|
|
572
589
|
...safeProps,
|
|
@@ -1351,34 +1368,38 @@ var clock = (seconds) => `${Math.floor(seconds / 60)}:${Math.floor(seconds % 60)
|
|
|
1351
1368
|
function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1352
1369
|
const sdk = useFlapSdk();
|
|
1353
1370
|
const { chainId } = sdk.context;
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
const
|
|
1361
|
-
const
|
|
1371
|
+
const readContractRef = React11.useRef(sdk.readContract);
|
|
1372
|
+
readContractRef.current = sdk.readContract;
|
|
1373
|
+
const reader = React11.useMemo(() => createConsumerVideoSessionReader({
|
|
1374
|
+
context: { chainId },
|
|
1375
|
+
readContract: (request) => readContractRef.current(request)
|
|
1376
|
+
}, consumer), [chainId, consumer]);
|
|
1377
|
+
const sessionRef = React11.useRef(null);
|
|
1378
|
+
const controllerRef = React11.useRef(null);
|
|
1379
|
+
const videoRef = React11.useRef(null);
|
|
1380
|
+
const frameRef = React11.useRef(null);
|
|
1381
|
+
const playIntent = React11.useRef(autoPlay);
|
|
1382
|
+
const autoPlayRef = React11.useRef(autoPlay);
|
|
1362
1383
|
autoPlayRef.current = autoPlay;
|
|
1363
|
-
const [snapshot, setSnapshot] =
|
|
1364
|
-
const [mediaState, setMediaState] =
|
|
1365
|
-
const [time, setTime] =
|
|
1366
|
-
const [paused, setPaused] =
|
|
1367
|
-
const [isMuted, setIsMuted] =
|
|
1368
|
-
const [volume, setVolume] =
|
|
1369
|
-
|
|
1384
|
+
const [snapshot, setSnapshot] = React11.useState(initialSnapshot);
|
|
1385
|
+
const [mediaState, setMediaState] = React11.useState("loading");
|
|
1386
|
+
const [time, setTime] = React11.useState(0);
|
|
1387
|
+
const [paused, setPaused] = React11.useState(true);
|
|
1388
|
+
const [isMuted, setIsMuted] = React11.useState(muted);
|
|
1389
|
+
const [volume, setVolume] = React11.useState(1);
|
|
1390
|
+
React11.useEffect(() => {
|
|
1370
1391
|
setIsMuted(muted);
|
|
1371
1392
|
}, [muted]);
|
|
1372
|
-
const [buffering, setBuffering] =
|
|
1373
|
-
const [page, setPage] =
|
|
1374
|
-
const [jump, setJump] =
|
|
1393
|
+
const [buffering, setBuffering] = React11.useState(false);
|
|
1394
|
+
const [page, setPage] = React11.useState(0);
|
|
1395
|
+
const [jump, setJump] = React11.useState("");
|
|
1375
1396
|
const position = videoClipPosition(snapshot.clips, time, snapshot.mediaStartPtsMs);
|
|
1376
1397
|
const duration = Number(snapshot.endPtsMs - snapshot.firstPtsMs) / 1e3;
|
|
1377
1398
|
const globalTime = Math.max(0, Math.min(duration, Number(snapshot.mediaStartPtsMs - snapshot.firstPtsMs) / 1e3 + time));
|
|
1378
1399
|
const activeIndex = position?.index ?? snapshot.start;
|
|
1379
1400
|
const strings = videoPlayerMessages[sdk.i18n.locale.split("-")[0]] ?? videoPlayerMessages.en;
|
|
1380
1401
|
const text = (key, params) => sdk.i18n.t(`runtime.video.${key}`, strings[key], params);
|
|
1381
|
-
|
|
1402
|
+
React11.useEffect(() => {
|
|
1382
1403
|
const session = new ConsumerVideoSession(reader, setSnapshot);
|
|
1383
1404
|
sessionRef.current = session;
|
|
1384
1405
|
setSnapshot(initialSnapshot);
|
|
@@ -1395,16 +1416,16 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1395
1416
|
sessionRef.current = null;
|
|
1396
1417
|
};
|
|
1397
1418
|
}, [reader, startClip]);
|
|
1398
|
-
|
|
1419
|
+
React11.useEffect(() => {
|
|
1399
1420
|
if (!videoRef.current) return;
|
|
1400
|
-
const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-
|
|
1421
|
+
const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-J2J6JTD7.js')).default, setMediaState);
|
|
1401
1422
|
controllerRef.current = controller;
|
|
1402
1423
|
return () => {
|
|
1403
1424
|
controller.dispose();
|
|
1404
1425
|
controllerRef.current = null;
|
|
1405
1426
|
};
|
|
1406
1427
|
}, []);
|
|
1407
|
-
|
|
1428
|
+
React11.useEffect(() => {
|
|
1408
1429
|
const controller = controllerRef.current;
|
|
1409
1430
|
const session = sessionRef.current;
|
|
1410
1431
|
if (!controller || !session) return;
|
|
@@ -1423,7 +1444,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1423
1444
|
playIntent: () => playIntent.current
|
|
1424
1445
|
}, snapshot.play, snapshot.resumeAt);
|
|
1425
1446
|
}, [snapshot.sessionId, snapshot.revision, snapshot.state]);
|
|
1426
|
-
|
|
1447
|
+
React11.useEffect(() => {
|
|
1427
1448
|
setPage(Math.floor(activeIndex / VIDEO_PICKER_PAGE_SIZE));
|
|
1428
1449
|
}, [activeIndex]);
|
|
1429
1450
|
const advance = () => {
|
|
@@ -1433,7 +1454,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1433
1454
|
void sessionRef.current?.advance(current.index);
|
|
1434
1455
|
}
|
|
1435
1456
|
};
|
|
1436
|
-
|
|
1457
|
+
React11.useEffect(() => {
|
|
1437
1458
|
const video = videoRef.current;
|
|
1438
1459
|
const current = videoClipPosition(snapshot.clips, video?.currentTime ?? 0, snapshot.mediaStartPtsMs);
|
|
1439
1460
|
if (video && current && (current.index >= snapshot.start + snapshot.clips.length - 2 || video.ended)) void sessionRef.current?.advance(current.index);
|
|
@@ -1447,7 +1468,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1447
1468
|
const showVideo = state === "loading" || state === "ready";
|
|
1448
1469
|
const first = page * VIDEO_PICKER_PAGE_SIZE;
|
|
1449
1470
|
const count = Math.max(0, Math.min(VIDEO_PICKER_PAGE_SIZE, snapshot.total - first));
|
|
1450
|
-
return /* @__PURE__ */
|
|
1471
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1451
1472
|
"div",
|
|
1452
1473
|
{
|
|
1453
1474
|
className: cn("w-full min-w-0 space-y-3", className),
|
|
@@ -1480,7 +1501,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1480
1501
|
}
|
|
1481
1502
|
}
|
|
1482
1503
|
},
|
|
1483
|
-
/* @__PURE__ */
|
|
1504
|
+
/* @__PURE__ */ React11.createElement("div", { ref: frameRef, className: "relative overflow-hidden rounded-lg border border-[#303236] bg-black [&:fullscreen]:flex [&:fullscreen]:flex-col [&:fullscreen]:justify-center [&:fullscreen>video]:h-0 [&:fullscreen>video]:min-h-0 [&:fullscreen>video]:flex-1 [&:fullscreen>video]:aspect-auto" }, /* @__PURE__ */ React11.createElement(
|
|
1484
1505
|
"video",
|
|
1485
1506
|
{
|
|
1486
1507
|
ref: videoRef,
|
|
@@ -1516,23 +1537,23 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1516
1537
|
onCanPlay: () => setBuffering(false),
|
|
1517
1538
|
onPlaying: () => setBuffering(false)
|
|
1518
1539
|
}
|
|
1519
|
-
), (state === "loading" || buffering && showVideo) && /* @__PURE__ */
|
|
1540
|
+
), (state === "loading" || buffering && showVideo) && /* @__PURE__ */ React11.createElement("p", { className: "pointer-events-none absolute inset-x-0 top-3 text-center text-sm text-white", role: "status" }, text(state === "loading" ? "loading" : "buffering")), !showVideo && /* @__PURE__ */ React11.createElement("div", { className: "p-4" }, fallback), showVideo && snapshot.total > 0 && /* @__PURE__ */ React11.createElement("div", { className: "space-y-2 border-t border-[#303236] bg-black p-3" }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", "aria-label": text(paused ? "play" : "pause"), onClick: () => {
|
|
1520
1541
|
const video = videoRef.current;
|
|
1521
1542
|
if (video) {
|
|
1522
1543
|
if (video.paused) void video.play().catch(() => void 0);
|
|
1523
1544
|
else video.pause();
|
|
1524
1545
|
}
|
|
1525
|
-
} }, paused ? /* @__PURE__ */
|
|
1546
|
+
} }, paused ? /* @__PURE__ */ React11.createElement(Play, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ React11.createElement(Pause, { "aria-hidden": "true", className: "h-4 w-4" })), /* @__PURE__ */ React11.createElement("span", { className: "flex-1 text-xs text-white", "aria-label": text("timeline"), "data-flap-video-time": true }, clock(globalTime), " / ", clock(duration)), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", "aria-label": text(isMuted ? "unmute" : "mute"), onClick: () => {
|
|
1526
1547
|
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
1527
|
-
} }, isMuted ? /* @__PURE__ */
|
|
1548
|
+
} }, isMuted ? /* @__PURE__ */ React11.createElement(VolumeX, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ React11.createElement(Volume2, { "aria-hidden": "true", className: "h-4 w-4" })), /* @__PURE__ */ React11.createElement("input", { type: "range", min: 0, max: 1, step: 0.05, value: isMuted ? 0 : volume, "aria-label": text("volume"), className: "w-16 accent-[#D0FF00]", onChange: (event) => {
|
|
1528
1549
|
if (videoRef.current) {
|
|
1529
1550
|
videoRef.current.volume = Number(event.target.value);
|
|
1530
1551
|
videoRef.current.muted = Number(event.target.value) === 0;
|
|
1531
1552
|
}
|
|
1532
|
-
} }), /* @__PURE__ */
|
|
1553
|
+
} }), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", "aria-label": text("fullscreen"), onClick: () => {
|
|
1533
1554
|
if (document.fullscreenElement) void document.exitFullscreen().catch(() => void 0);
|
|
1534
1555
|
else void frameRef.current?.requestFullscreen?.().catch(() => void 0);
|
|
1535
|
-
} }, /* @__PURE__ */
|
|
1556
|
+
} }, /* @__PURE__ */ React11.createElement(Maximize, { "aria-hidden": "true", className: "h-4 w-4" }))), /* @__PURE__ */ React11.createElement(
|
|
1536
1557
|
"input",
|
|
1537
1558
|
{
|
|
1538
1559
|
type: "range",
|
|
@@ -1550,7 +1571,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1550
1571
|
}
|
|
1551
1572
|
}
|
|
1552
1573
|
))),
|
|
1553
|
-
snapshot.total > 0 && /* @__PURE__ */
|
|
1574
|
+
snapshot.total > 0 && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs text-[#D4D4D4]" }, /* @__PURE__ */ React11.createElement("span", { role: "status" }, text("position", { index: activeIndex + 1, total: snapshot.total })), /* @__PURE__ */ React11.createElement("span", null, clock(position?.time ?? 0), " / ", clock(position?.duration ?? 0))), /* @__PURE__ */ React11.createElement(
|
|
1554
1575
|
"input",
|
|
1555
1576
|
{
|
|
1556
1577
|
type: "range",
|
|
@@ -1570,7 +1591,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1570
1591
|
}
|
|
1571
1592
|
}
|
|
1572
1593
|
}
|
|
1573
|
-
), /* @__PURE__ */
|
|
1594
|
+
), /* @__PURE__ */ React11.createElement("div", { className: "flex flex-wrap gap-2" }, /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(0), "aria-label": text("first") }, /* @__PURE__ */ React11.createElement(SkipBack, { "aria-hidden": "true", className: "h-4 w-4" }), text("first")), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(activeIndex - 1), "aria-label": text("previous") }, /* @__PURE__ */ React11.createElement(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }), text("previous")), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(activeIndex + 1), "aria-label": text("next") }, text("next"), /* @__PURE__ */ React11.createElement(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(-1), "aria-label": text("latest") }, text("latest"), /* @__PURE__ */ React11.createElement(SkipForward, { "aria-hidden": "true", className: "h-4 w-4" }))), /* @__PURE__ */ React11.createElement("div", { className: "flex flex-wrap gap-1.5", role: "group", "aria-label": label }, Array.from({ length: count }, (_, offset) => first + offset).map((index) => /* @__PURE__ */ React11.createElement(
|
|
1574
1595
|
"button",
|
|
1575
1596
|
{
|
|
1576
1597
|
key: index,
|
|
@@ -1581,12 +1602,12 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1581
1602
|
onClick: () => seek(index)
|
|
1582
1603
|
},
|
|
1583
1604
|
index + 1
|
|
1584
|
-
))), /* @__PURE__ */
|
|
1605
|
+
))), /* @__PURE__ */ React11.createElement("form", { className: "flex flex-wrap items-end gap-2", onSubmit: (event) => {
|
|
1585
1606
|
event.preventDefault();
|
|
1586
1607
|
if (Number.isSafeInteger(Number(jump)) && Number(jump) >= 1 && Number(jump) <= snapshot.total) seek(Number(jump) - 1);
|
|
1587
|
-
} }, /* @__PURE__ */
|
|
1588
|
-
snapshot.refreshFailed && /* @__PURE__ */
|
|
1589
|
-
(snapshot.refreshFailed || state === "error" || state === "invalid") && /* @__PURE__ */
|
|
1608
|
+
} }, /* @__PURE__ */ React11.createElement("label", { className: "min-w-0 flex-1 space-y-1 text-xs text-[#84888C]" }, /* @__PURE__ */ React11.createElement("span", null, text("jump")), /* @__PURE__ */ React11.createElement(Input, { type: "number", min: 1, max: snapshot.total, step: 1, value: jump, onChange: (event) => setJump(event.target.value) })), /* @__PURE__ */ React11.createElement(Button, { type: "submit", variant: "outline", disabled: !Number.isSafeInteger(Number(jump)) || Number(jump) < 1 || Number(jump) > snapshot.total }, text("go"))), snapshot.total > VIDEO_PICKER_PAGE_SIZE && /* @__PURE__ */ React11.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", disabled: page === 0, onClick: () => setPage((value) => value - 1), "aria-label": text("previousPage") }, /* @__PURE__ */ React11.createElement(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" })), /* @__PURE__ */ React11.createElement("span", { className: "text-xs text-[#84888C]" }, text("page", { first: first + 1, last: first + count, total: snapshot.total })), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", disabled: first + count >= snapshot.total, onClick: () => setPage((value) => value + 1), "aria-label": text("nextPage") }, /* @__PURE__ */ React11.createElement(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })))),
|
|
1609
|
+
snapshot.refreshFailed && /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-[#FFB35C]", role: "status" }, text("refreshFailed")),
|
|
1610
|
+
(snapshot.refreshFailed || state === "error" || state === "invalid") && /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", onClick: () => {
|
|
1590
1611
|
if (snapshot.total) seek(activeIndex);
|
|
1591
1612
|
else void sessionRef.current?.refresh(startClip, playIntent.current);
|
|
1592
1613
|
} }, text("retry"))
|
|
@@ -1595,16 +1616,16 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1595
1616
|
|
|
1596
1617
|
// src/ui/VideoSessionPlayer.tsx
|
|
1597
1618
|
function VideoSessionPlayer(props) {
|
|
1598
|
-
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */
|
|
1619
|
+
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */ React11.createElement(ConsumerVideoSessionPlayer, { ...props }) : /* @__PURE__ */ React11.createElement(VideoClipSessionPlayer, { ...props });
|
|
1599
1620
|
}
|
|
1600
1621
|
async function loadMpegts() {
|
|
1601
|
-
return (await import('./mpegts-
|
|
1622
|
+
return (await import('./mpegts-J2J6JTD7.js')).default;
|
|
1602
1623
|
}
|
|
1603
1624
|
function VideoClipSessionPlayer({ clips, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1604
|
-
const videoRef =
|
|
1605
|
-
const controllerRef =
|
|
1606
|
-
const [state, setState] =
|
|
1607
|
-
|
|
1625
|
+
const videoRef = React11.useRef(null);
|
|
1626
|
+
const controllerRef = React11.useRef(null);
|
|
1627
|
+
const [state, setState] = React11.useState("loading");
|
|
1628
|
+
React11.useEffect(() => {
|
|
1608
1629
|
if (!videoRef.current) return;
|
|
1609
1630
|
const controller = new VideoSessionController(videoRef.current, loadMpegts, setState);
|
|
1610
1631
|
controllerRef.current = controller;
|
|
@@ -1613,11 +1634,11 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
|
|
|
1613
1634
|
controllerRef.current = null;
|
|
1614
1635
|
};
|
|
1615
1636
|
}, []);
|
|
1616
|
-
|
|
1637
|
+
React11.useEffect(() => {
|
|
1617
1638
|
void controllerRef.current?.update(clips, autoPlay);
|
|
1618
1639
|
}, [clips, autoPlay]);
|
|
1619
1640
|
const showVideo = state === "loading" || state === "ready";
|
|
1620
|
-
return /* @__PURE__ */
|
|
1641
|
+
return /* @__PURE__ */ React11.createElement("div", { className: cn("w-full", className), "data-flap-video-session-state": state }, /* @__PURE__ */ React11.createElement(
|
|
1621
1642
|
"video",
|
|
1622
1643
|
{
|
|
1623
1644
|
ref: videoRef,
|
|
@@ -1633,6 +1654,6 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
|
|
|
1633
1654
|
), !showVideo && fallback);
|
|
1634
1655
|
}
|
|
1635
1656
|
|
|
1636
|
-
export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage, Metric, NftMetadataImage, ReviewedFrame, RuntimeContext, StatusBadge, TxButton, VaultBanner, VideoSessionPlayer, VideoSessionReadError, buttonVariants, createConsumerVideoSessionReader, readVideoSessionLength, readVideoSessionSlice, useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext };
|
|
1637
|
-
//# sourceMappingURL=chunk-
|
|
1638
|
-
//# sourceMappingURL=chunk-
|
|
1657
|
+
export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage, Metric, MiniAppContext, NftMetadataImage, ReviewedFrame, RuntimeContext, StatusBadge, TxButton, VaultBanner, VideoSessionPlayer, VideoSessionReadError, buttonVariants, createConsumerVideoSessionReader, readVideoSessionLength, readVideoSessionSlice, useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext };
|
|
1658
|
+
//# sourceMappingURL=chunk-MLAOJT5Q.js.map
|
|
1659
|
+
//# sourceMappingURL=chunk-MLAOJT5Q.js.map
|