@flapsdk/vault-runtime 0.1.36-next.0 → 0.1.36
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-FWYBGHBX.js → chunk-22KTLOYH.js} +4 -17
- package/chunk-22KTLOYH.js.map +1 -0
- package/chunk-AGLB72HK.js +61 -0
- package/chunk-AGLB72HK.js.map +1 -0
- package/{chunk-MLAOJT5Q.js → chunk-IN34R3DY.js} +494 -361
- package/chunk-IN34R3DY.js.map +1 -0
- package/{chunk-V7U4QTMT.js → chunk-QLVWFL4T.js} +164 -106
- package/chunk-QLVWFL4T.js.map +1 -0
- package/host-client.d.mts +2 -9
- package/host-client.js +3 -3
- package/host.d.mts +5 -5
- package/host.js +4 -4
- package/{hostRuntimeConfig-DibvcxHE.d.mts → hostRuntimeConfig-DAz-f577.d.mts} +1 -1
- package/{mpegts-J2J6JTD7.js → mpegts-536UQHCG.js} +6 -6
- package/{mpegts-J2J6JTD7.js.map → mpegts-536UQHCG.js.map} +1 -1
- package/package.json +3 -4
- package/runtime-contract.json +1 -2
- package/sdk.d.mts +4 -40
- package/sdk.js +6 -37
- package/sdk.js.map +1 -1
- package/server.d.mts +3 -3
- package/{txError-OBuRV8xN.d.mts → txError-DmiNOh9R.d.mts} +2 -15
- package/{types-DUZWZ3mC.d.mts → types-BbjEsfiD.d.mts} +4 -98
- package/ui.d.mts +1 -1
- package/ui.js +1 -1
- package/chunk-A3ER7XYN.js +0 -408
- package/chunk-A3ER7XYN.js.map +0 -1
- package/chunk-FWYBGHBX.js.map +0 -1
- package/chunk-MLAOJT5Q.js.map +0 -1
- package/chunk-V7U4QTMT.js.map +0 -1
|
@@ -1,47 +1,16 @@
|
|
|
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 React8 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
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
8
|
import { clsx } from 'clsx';
|
|
8
9
|
import { twMerge } from 'tailwind-merge';
|
|
9
10
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
11
|
import { cva } from 'class-variance-authority';
|
|
11
12
|
import { createPortal } from 'react-dom';
|
|
12
13
|
|
|
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
|
-
|
|
45
14
|
// src/sdk/videoSession.ts
|
|
46
15
|
var videoProviderAbi = [
|
|
47
16
|
{ type: "function", name: "getVideoSessionLength", stateMutability: "view", inputs: [{ name: "user", type: "address" }], outputs: [{ type: "uint256" }] },
|
|
@@ -97,17 +66,33 @@ async function readVideoSessionSlice(sdk, consumer, start, count) {
|
|
|
97
66
|
function createConsumerVideoSessionReader(sdk, consumer) {
|
|
98
67
|
return { readLength: () => readVideoSessionLength(sdk, consumer), readSlice: (start, count) => readVideoSessionSlice(sdk, consumer, start, count) };
|
|
99
68
|
}
|
|
69
|
+
var RuntimeContext = createContext(null);
|
|
70
|
+
function useFlapSdk() {
|
|
71
|
+
const sdk = useContext(RuntimeContext);
|
|
72
|
+
if (!sdk) throw new Error("useFlapSdk must be used within VaultRuntimeProvider.");
|
|
73
|
+
return sdk;
|
|
74
|
+
}
|
|
75
|
+
function useVaultContext() {
|
|
76
|
+
return useFlapSdk().context;
|
|
77
|
+
}
|
|
78
|
+
function useFlapI18n() {
|
|
79
|
+
return useFlapSdk().i18n;
|
|
80
|
+
}
|
|
81
|
+
function useFlapNotify() {
|
|
82
|
+
return useFlapSdk().notify;
|
|
83
|
+
}
|
|
100
84
|
function AddressLink({ address, explorerBaseUrl, label }) {
|
|
101
|
-
if (!address) return /* @__PURE__ */
|
|
85
|
+
if (!address) return /* @__PURE__ */ jsx("span", { children: "-" });
|
|
102
86
|
const href = explorerBaseUrl ? `${explorerBaseUrl.replace(/\/$/, "")}/address/${address}` : void 0;
|
|
103
|
-
const content = /* @__PURE__ */
|
|
104
|
-
|
|
87
|
+
const content = /* @__PURE__ */ jsxs("span", { className: "inline-flex min-w-0 items-center gap-1 text-primary", children: [
|
|
88
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: label || shortenAddress(address) }),
|
|
89
|
+
href ? /* @__PURE__ */ jsx(ExternalLink, { className: "h-3.5 w-3.5 shrink-0" }) : null
|
|
90
|
+
] });
|
|
91
|
+
return href ? /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noreferrer", children: content }) : content;
|
|
105
92
|
}
|
|
106
93
|
function cn(...inputs) {
|
|
107
94
|
return twMerge(clsx(inputs));
|
|
108
95
|
}
|
|
109
|
-
|
|
110
|
-
// src/ui/Alert.tsx
|
|
111
96
|
var toneClass = {
|
|
112
97
|
info: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
113
98
|
success: "border-[#D0FF00]/45 bg-[#101400] text-[#D0FF00]",
|
|
@@ -122,7 +107,10 @@ var iconMap = {
|
|
|
122
107
|
};
|
|
123
108
|
function Alert({ children, tone = "info", className }) {
|
|
124
109
|
const Icon = iconMap[tone];
|
|
125
|
-
return /* @__PURE__ */
|
|
110
|
+
return /* @__PURE__ */ jsxs("div", { "data-flap-ui": "alert", className: cn("flex gap-3 rounded-[6px] border p-3 text-sm font-medium leading-6", toneClass[tone], className), children: [
|
|
111
|
+
/* @__PURE__ */ jsx(Icon, { className: "mt-0.5 h-4 w-4 shrink-0 opacity-90" }),
|
|
112
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 break-words", children })
|
|
113
|
+
] });
|
|
126
114
|
}
|
|
127
115
|
var buttonVariants = cva(
|
|
128
116
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-semibold uppercase leading-[1.4] tracking-normal duration-0 hover:transition-colors hover:duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#D0FF00]/45 disabled:pointer-events-none disabled:opacity-50",
|
|
@@ -148,23 +136,25 @@ var buttonVariants = cva(
|
|
|
148
136
|
}
|
|
149
137
|
}
|
|
150
138
|
);
|
|
151
|
-
var Button =
|
|
139
|
+
var Button = React8.forwardRef(
|
|
152
140
|
({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
153
141
|
const Comp = asChild ? Slot : "button";
|
|
154
142
|
if (asChild) {
|
|
155
|
-
return /* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ jsx(Comp, { "data-flap-ui": "button", className: cn(buttonVariants({ variant, size, className })), ref, ...props, children });
|
|
156
144
|
}
|
|
157
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
158
146
|
Comp,
|
|
159
147
|
{
|
|
160
148
|
"data-flap-ui": "button",
|
|
161
149
|
className: cn(buttonVariants({ variant, size, className })),
|
|
162
150
|
ref,
|
|
163
151
|
disabled: disabled || loading,
|
|
164
|
-
...props
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
152
|
+
...props,
|
|
153
|
+
children: [
|
|
154
|
+
loading ? /* @__PURE__ */ jsx(Loader2, { className: "relative z-10 h-4 w-4 animate-spin" }) : null,
|
|
155
|
+
/* @__PURE__ */ jsx("span", { className: "relative z-10 inline-flex min-w-0 items-center justify-center gap-2", children })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
168
158
|
);
|
|
169
159
|
}
|
|
170
160
|
);
|
|
@@ -187,11 +177,9 @@ function normalizeBinanceImageUrl(value) {
|
|
|
187
177
|
return null;
|
|
188
178
|
}
|
|
189
179
|
}
|
|
190
|
-
|
|
191
|
-
// src/ui/BinanceImage.tsx
|
|
192
180
|
function BinanceImage({ alt, src, fallback = null, className, onError, ...props }) {
|
|
193
|
-
const safeSrc =
|
|
194
|
-
const [failedSrc, setFailedSrc] =
|
|
181
|
+
const safeSrc = React8.useMemo(() => normalizeBinanceImageUrl(src), [src]);
|
|
182
|
+
const [failedSrc, setFailedSrc] = React8.useState(null);
|
|
195
183
|
const {
|
|
196
184
|
alt: _unsafeAlt,
|
|
197
185
|
decoding: _unsafeDecoding,
|
|
@@ -202,11 +190,11 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
|
|
|
202
190
|
...imageProps
|
|
203
191
|
} = props;
|
|
204
192
|
if (!safeSrc || failedSrc === safeSrc) {
|
|
205
|
-
return /* @__PURE__ */
|
|
193
|
+
return /* @__PURE__ */ jsx("span", { className: cn("block", className), "data-flap-binance-image-state": safeSrc ? "error" : "invalid", children: fallback });
|
|
206
194
|
}
|
|
207
195
|
return (
|
|
208
196
|
// eslint-disable-next-line @next/next/no-img-element -- BinanceImage owns the exact-host runtime boundary and browser loading policy.
|
|
209
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ jsx(
|
|
210
198
|
"img",
|
|
211
199
|
{
|
|
212
200
|
...imageProps,
|
|
@@ -225,7 +213,7 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
|
|
|
225
213
|
)
|
|
226
214
|
);
|
|
227
215
|
}
|
|
228
|
-
var Card =
|
|
216
|
+
var Card = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
229
217
|
"div",
|
|
230
218
|
{
|
|
231
219
|
"data-flap-ui": "card",
|
|
@@ -238,20 +226,20 @@ var Card = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
238
226
|
}
|
|
239
227
|
));
|
|
240
228
|
Card.displayName = "Card";
|
|
241
|
-
var CardHeader =
|
|
242
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
229
|
+
var CardHeader = React8.forwardRef(
|
|
230
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { "data-flap-ui": "card-header", ref, className: cn("flex flex-col gap-1.5 p-4 sm:p-5", className), ...props })
|
|
243
231
|
);
|
|
244
232
|
CardHeader.displayName = "CardHeader";
|
|
245
|
-
var CardTitle =
|
|
246
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
233
|
+
var CardTitle = React8.forwardRef(
|
|
234
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("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 })
|
|
247
235
|
);
|
|
248
236
|
CardTitle.displayName = "CardTitle";
|
|
249
|
-
var CardDescription =
|
|
250
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
237
|
+
var CardDescription = React8.forwardRef(
|
|
238
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { "data-flap-ui": "card-description", ref, className: cn("text-sm leading-6 text-[#84888C]", className), ...props })
|
|
251
239
|
);
|
|
252
240
|
CardDescription.displayName = "CardDescription";
|
|
253
|
-
var CardContent =
|
|
254
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
241
|
+
var CardContent = React8.forwardRef(
|
|
242
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { "data-flap-ui": "card-content", ref, className: cn("p-4 pt-0 sm:p-5 sm:pt-0", className), ...props })
|
|
255
243
|
);
|
|
256
244
|
CardContent.displayName = "CardContent";
|
|
257
245
|
function formatMs(ms) {
|
|
@@ -275,15 +263,17 @@ function Countdown({ targetTimeMs, fallback = "-" }) {
|
|
|
275
263
|
if (!targetTimeMs) return fallback;
|
|
276
264
|
return formatMs(targetTimeMs - now);
|
|
277
265
|
}, [fallback, now, targetTimeMs]);
|
|
278
|
-
return /* @__PURE__ */
|
|
266
|
+
return /* @__PURE__ */ jsx("span", { children: text });
|
|
279
267
|
}
|
|
280
|
-
|
|
281
|
-
// src/ui/DataRow.tsx
|
|
282
268
|
function DataRow({ label, value, detail, className }) {
|
|
283
|
-
return /* @__PURE__ */
|
|
269
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-start justify-between gap-4 border-b border-white/8 py-3 last:border-0", className), children: [
|
|
270
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 text-sm text-white/54", children: label }),
|
|
271
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 text-right", children: [
|
|
272
|
+
/* @__PURE__ */ jsx("div", { className: "break-words text-sm font-semibold text-white", children: value }),
|
|
273
|
+
detail ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-white/42", children: detail }) : null
|
|
274
|
+
] })
|
|
275
|
+
] });
|
|
284
276
|
}
|
|
285
|
-
|
|
286
|
-
// src/ui/DetailTile.tsx
|
|
287
277
|
var toneClass2 = {
|
|
288
278
|
default: "border-[#303236] bg-[#0B0D0E]",
|
|
289
279
|
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
@@ -292,7 +282,14 @@ var toneClass2 = {
|
|
|
292
282
|
muted: "border-[#303236] bg-black"
|
|
293
283
|
};
|
|
294
284
|
function DetailTile({ label, value, detail, icon, tone = "default", className, valueClassName }) {
|
|
295
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ jsxs("div", { "data-flap-ui": "detail-tile", className: cn("min-w-0 rounded-[6px] border p-3", toneClass2[tone], className), children: [
|
|
286
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2 text-xs font-medium uppercase leading-[1.4] text-[#84888C]", children: [
|
|
287
|
+
icon ? /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[#D0FF00]", children: icon }) : null,
|
|
288
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: label })
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ jsx("div", { className: cn("mt-2 min-w-0 break-words text-base font-semibold leading-snug text-white", valueClassName), children: value }),
|
|
291
|
+
detail ? /* @__PURE__ */ jsx("div", { className: "mt-1 min-w-0 break-words text-xs leading-5 text-[#84888C]", children: detail }) : null
|
|
292
|
+
] });
|
|
296
293
|
}
|
|
297
294
|
var COPY = {
|
|
298
295
|
en: {
|
|
@@ -329,23 +326,57 @@ function normalizeExternalUrl(url) {
|
|
|
329
326
|
}
|
|
330
327
|
}
|
|
331
328
|
function WarningIcon({ className }) {
|
|
332
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 80 80", fill: "currentColor", "aria-hidden": "true", shapeRendering: "crispEdges", className, children: [
|
|
330
|
+
/* @__PURE__ */ jsx("rect", { x: "32.4395", y: "11.7969", width: "2.62997", height: "6.57492" }),
|
|
331
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 47.5605 11.7969)" }),
|
|
332
|
+
/* @__PURE__ */ jsx("rect", { x: "35.0693", y: "9.16699", width: "2.62997", height: "5.25994" }),
|
|
333
|
+
/* @__PURE__ */ jsx("rect", { x: "37.6982", y: "9.16699", width: "4.60245", height: "2.62997" }),
|
|
334
|
+
/* @__PURE__ */ jsx("rect", { x: "38.333", y: "6.66699", width: "3.33333", height: "2.5" }),
|
|
335
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.25994", transform: "matrix(-1 0 0 1 44.9307 9.16699)" }),
|
|
336
|
+
/* @__PURE__ */ jsx("rect", { x: "29.8086", y: "16.3989", width: "2.62997", height: "6.57492" }),
|
|
337
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 50.1914 16.3989)" }),
|
|
338
|
+
/* @__PURE__ */ jsx("rect", { x: "27.1787", y: "21.6592", width: "2.62997", height: "5.91743" }),
|
|
339
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 52.8213 21.6592)" }),
|
|
340
|
+
/* @__PURE__ */ jsx("rect", { x: "24.5488", y: "24.2891", width: "2.62997", height: "7.23242" }),
|
|
341
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 55.4512 24.2891)" }),
|
|
342
|
+
/* @__PURE__ */ jsx("rect", { x: "21.9189", y: "29.5488", width: "2.62997", height: "7.23242" }),
|
|
343
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 58.0811 29.5488)" }),
|
|
344
|
+
/* @__PURE__ */ jsx("rect", { x: "19.2891", y: "34.8086", width: "2.62997", height: "7.23242" }),
|
|
345
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 60.7109 34.8086)" }),
|
|
346
|
+
/* @__PURE__ */ jsx("rect", { x: "16.6592", y: "40.0693", width: "2.62997", height: "5.91743" }),
|
|
347
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 63.3408 40.0693)" }),
|
|
348
|
+
/* @__PURE__ */ jsx("rect", { x: "14.0293", y: "44.6709", width: "2.62997", height: "5.91743" }),
|
|
349
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 65.9707 44.6709)" }),
|
|
350
|
+
/* @__PURE__ */ jsx("rect", { x: "11.3984", y: "48.6165", width: "2.62997", height: "5.91743" }),
|
|
351
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 68.6016 48.6165)" }),
|
|
352
|
+
/* @__PURE__ */ jsx("rect", { x: "8.76855", y: "53.8762", width: "2.62997", height: "5.91743" }),
|
|
353
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 71.2314 53.8762)" }),
|
|
354
|
+
/* @__PURE__ */ jsx("rect", { x: "6.13965", y: "58.4783", width: "2.62997", height: "5.91743" }),
|
|
355
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 73.8604 58.4783)" }),
|
|
356
|
+
/* @__PURE__ */ jsx("rect", { x: "4.16699", y: "62.4236", width: "2.62997", height: "5.91743" }),
|
|
357
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 75.833 62.4236)" }),
|
|
358
|
+
/* @__PURE__ */ jsx("rect", { x: "6.79688", y: "68.3406", width: "2.62997", height: "2.62997" }),
|
|
359
|
+
/* @__PURE__ */ jsx("rect", { x: "70.5742", y: "68.3406", width: "2.62997", height: "2.62997" }),
|
|
360
|
+
/* @__PURE__ */ jsx("rect", { x: "9.42578", y: "70.9709", width: "61.1468", height: "2.62997" }),
|
|
361
|
+
/* @__PURE__ */ jsx("rect", { x: "38.333", y: "30.833", width: "4.16667", height: "22.5" }),
|
|
362
|
+
/* @__PURE__ */ jsx("rect", { x: "38.333", y: "57.5", width: "4.16667", height: "4.16667" })
|
|
363
|
+
] });
|
|
333
364
|
}
|
|
334
365
|
function ExternalLink2({ url, children, locale, className, copy }) {
|
|
335
|
-
const [open, setOpen] =
|
|
336
|
-
const [acknowledged, setAcknowledged] =
|
|
337
|
-
const [mounted, setMounted] =
|
|
366
|
+
const [open, setOpen] = React8.useState(false);
|
|
367
|
+
const [acknowledged, setAcknowledged] = React8.useState(false);
|
|
368
|
+
const [mounted, setMounted] = React8.useState(false);
|
|
338
369
|
const text = { ...COPY[resolveLocale(locale)], ...copy };
|
|
339
|
-
const safeUrl =
|
|
370
|
+
const safeUrl = React8.useMemo(() => normalizeExternalUrl(url), [url]);
|
|
340
371
|
const canProceed = acknowledged && Boolean(safeUrl);
|
|
341
|
-
|
|
372
|
+
React8.useEffect(() => {
|
|
342
373
|
setMounted(true);
|
|
343
374
|
}, []);
|
|
344
|
-
const close =
|
|
375
|
+
const close = React8.useCallback(() => {
|
|
345
376
|
setOpen(false);
|
|
346
377
|
setAcknowledged(false);
|
|
347
378
|
}, []);
|
|
348
|
-
|
|
379
|
+
React8.useEffect(() => {
|
|
349
380
|
if (!open) return;
|
|
350
381
|
const onKey = (event) => {
|
|
351
382
|
if (event.key === "Escape") close();
|
|
@@ -363,109 +394,139 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
363
394
|
window.open(safeUrl, "_blank", "noopener,noreferrer");
|
|
364
395
|
close();
|
|
365
396
|
};
|
|
366
|
-
return /* @__PURE__ */
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
type: "button",
|
|
370
|
-
"data-flap-ui": "external-link",
|
|
371
|
-
onClick: () => setOpen(true),
|
|
372
|
-
className: cn("inline-flex min-w-0 items-center gap-1 text-[#d0ff00] hover:underline", className)
|
|
373
|
-
},
|
|
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" })
|
|
376
|
-
), open && mounted ? createPortal(
|
|
377
|
-
/* @__PURE__ */ React11.createElement(
|
|
378
|
-
"div",
|
|
397
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
398
|
+
/* @__PURE__ */ jsxs(
|
|
399
|
+
"button",
|
|
379
400
|
{
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
onClick:
|
|
383
|
-
|
|
384
|
-
|
|
401
|
+
type: "button",
|
|
402
|
+
"data-flap-ui": "external-link",
|
|
403
|
+
onClick: () => setOpen(true),
|
|
404
|
+
className: cn("inline-flex min-w-0 items-center gap-1 text-[#d0ff00] hover:underline", className),
|
|
405
|
+
children: [
|
|
406
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children }),
|
|
407
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" })
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
open && mounted ? createPortal(
|
|
412
|
+
/* @__PURE__ */ jsx(
|
|
385
413
|
"div",
|
|
386
414
|
{
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
width: "min(540px, 100%)",
|
|
393
|
-
maxHeight: "calc(100vh - 2rem)",
|
|
394
|
-
fontFamily: "'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace",
|
|
395
|
-
backgroundColor: "#070808",
|
|
396
|
-
border: "1px solid #414141"
|
|
397
|
-
},
|
|
398
|
-
className: "flex w-[min(540px,100%)] max-h-[calc(100vh-2rem)] flex-col overflow-hidden rounded-[4px] text-white shadow-panel"
|
|
399
|
-
},
|
|
400
|
-
/* @__PURE__ */ React11.createElement(
|
|
401
|
-
"div",
|
|
402
|
-
{
|
|
403
|
-
className: "flex items-center justify-between border-b border-[#484b51] px-6 py-[14px]",
|
|
404
|
-
style: { boxSizing: "border-box", height: "49px", lineHeight: 1 }
|
|
405
|
-
},
|
|
406
|
-
/* @__PURE__ */ React11.createElement(
|
|
407
|
-
"span",
|
|
415
|
+
className: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",
|
|
416
|
+
style: { zIndex: 2147483647 },
|
|
417
|
+
onClick: close,
|
|
418
|
+
children: /* @__PURE__ */ jsxs(
|
|
419
|
+
"div",
|
|
408
420
|
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
"
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
421
|
+
role: "dialog",
|
|
422
|
+
"aria-modal": "true",
|
|
423
|
+
"aria-label": text.title,
|
|
424
|
+
onClick: (event) => event.stopPropagation(),
|
|
425
|
+
style: {
|
|
426
|
+
width: "min(540px, 100%)",
|
|
427
|
+
maxHeight: "calc(100vh - 2rem)",
|
|
428
|
+
fontFamily: "'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace",
|
|
429
|
+
backgroundColor: "#070808",
|
|
430
|
+
border: "1px solid #414141"
|
|
431
|
+
},
|
|
432
|
+
className: "flex w-[min(540px,100%)] max-h-[calc(100vh-2rem)] flex-col overflow-hidden rounded-[4px] text-white shadow-panel",
|
|
433
|
+
children: [
|
|
434
|
+
/* @__PURE__ */ jsxs(
|
|
435
|
+
"div",
|
|
436
|
+
{
|
|
437
|
+
className: "flex items-center justify-between border-b border-[#484b51] px-6 py-[14px]",
|
|
438
|
+
style: { boxSizing: "border-box", height: "49px", lineHeight: 1 },
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsxs(
|
|
441
|
+
"span",
|
|
442
|
+
{
|
|
443
|
+
className: "truncate text-[18px] font-medium uppercase leading-none tracking-[-0.4px]",
|
|
444
|
+
style: { lineHeight: 1 },
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ jsx("span", { className: "text-[#d0ff00]", children: "//" }),
|
|
447
|
+
text.title
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
/* @__PURE__ */ jsx(
|
|
452
|
+
"button",
|
|
453
|
+
{
|
|
454
|
+
type: "button",
|
|
455
|
+
onClick: close,
|
|
456
|
+
"aria-label": text.cancel,
|
|
457
|
+
className: "flex size-5 shrink-0 items-center justify-center border border-[#484b51] text-white/80 hover:text-white",
|
|
458
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
]
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 overflow-y-auto p-6", children: [
|
|
465
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-5", children: [
|
|
466
|
+
/* @__PURE__ */ jsx(WarningIcon, { className: "h-20 w-20 text-[#f68f15]" }),
|
|
467
|
+
/* @__PURE__ */ jsx("h2", { className: "text-center text-[18px] font-medium uppercase leading-[1.4] tracking-[-0.4px]", children: text.heading })
|
|
468
|
+
] }),
|
|
469
|
+
/* @__PURE__ */ jsx("p", { className: "text-[14px] leading-[1.4] tracking-[-0.4px] text-[#a0a3a7]", children: text.description }),
|
|
470
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 border border-[#262626] bg-[#0a0a0a] px-3 py-2 text-[13px]", children: [
|
|
471
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 uppercase tracking-[-0.4px] text-[#6b7280]", children: text.destinationLabel }),
|
|
472
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-[#d4d4d4]", title: safeUrl ?? url, children: safeUrl ? new URL(safeUrl).host : text.invalidDestination })
|
|
473
|
+
] }),
|
|
474
|
+
/* @__PURE__ */ jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-[14px] leading-[1.4] tracking-[-0.4px] text-white", children: [
|
|
475
|
+
/* @__PURE__ */ jsx(
|
|
476
|
+
"input",
|
|
477
|
+
{
|
|
478
|
+
type: "checkbox",
|
|
479
|
+
checked: acknowledged,
|
|
480
|
+
onChange: (event) => setAcknowledged(event.target.checked),
|
|
481
|
+
className: "sr-only"
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
/* @__PURE__ */ jsx(
|
|
485
|
+
"span",
|
|
486
|
+
{
|
|
487
|
+
"aria-hidden": "true",
|
|
488
|
+
className: cn(
|
|
489
|
+
"flex size-4 shrink-0 items-center justify-center border",
|
|
490
|
+
acknowledged ? "border-[#d0ff00] bg-[#d0ff00] text-[#070808]" : "border-[#a0a3a7] bg-transparent"
|
|
491
|
+
),
|
|
492
|
+
children: acknowledged ? /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx("path", { d: "M2 6.5 L5 9 L10 3", strokeLinecap: "square" }) }) : null
|
|
493
|
+
}
|
|
494
|
+
),
|
|
495
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: text.acknowledge })
|
|
496
|
+
] }),
|
|
497
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
498
|
+
/* @__PURE__ */ jsx(
|
|
499
|
+
"button",
|
|
500
|
+
{
|
|
501
|
+
type: "button",
|
|
502
|
+
onClick: close,
|
|
503
|
+
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",
|
|
504
|
+
children: text.cancel
|
|
505
|
+
}
|
|
506
|
+
),
|
|
507
|
+
/* @__PURE__ */ jsx(
|
|
508
|
+
"button",
|
|
509
|
+
{
|
|
510
|
+
type: "button",
|
|
511
|
+
onClick: proceed,
|
|
512
|
+
disabled: !canProceed,
|
|
513
|
+
style: { backgroundColor: canProceed ? "#d0ff00" : "#536600", color: "#070808" },
|
|
514
|
+
className: "flex flex-1 items-center justify-center rounded-[2px] py-3 text-[14px] font-bold uppercase tracking-[-0.4px] transition-colors",
|
|
515
|
+
children: text.proceed
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
] })
|
|
519
|
+
] })
|
|
520
|
+
]
|
|
521
|
+
}
|
|
424
522
|
)
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
checked: acknowledged,
|
|
431
|
-
onChange: (event) => setAcknowledged(event.target.checked),
|
|
432
|
-
className: "sr-only"
|
|
433
|
-
}
|
|
434
|
-
), /* @__PURE__ */ React11.createElement(
|
|
435
|
-
"span",
|
|
436
|
-
{
|
|
437
|
-
"aria-hidden": "true",
|
|
438
|
-
className: cn(
|
|
439
|
-
"flex size-4 shrink-0 items-center justify-center border",
|
|
440
|
-
acknowledged ? "border-[#d0ff00] bg-[#d0ff00] text-[#070808]" : "border-[#a0a3a7] bg-transparent"
|
|
441
|
-
)
|
|
442
|
-
},
|
|
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(
|
|
445
|
-
"button",
|
|
446
|
-
{
|
|
447
|
-
type: "button",
|
|
448
|
-
onClick: close,
|
|
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"
|
|
450
|
-
},
|
|
451
|
-
text.cancel
|
|
452
|
-
), /* @__PURE__ */ React11.createElement(
|
|
453
|
-
"button",
|
|
454
|
-
{
|
|
455
|
-
type: "button",
|
|
456
|
-
onClick: proceed,
|
|
457
|
-
disabled: !canProceed,
|
|
458
|
-
style: { backgroundColor: canProceed ? "#d0ff00" : "#536600", color: "#070808" },
|
|
459
|
-
className: "flex flex-1 items-center justify-center rounded-[2px] py-3 text-[14px] font-bold uppercase tracking-[-0.4px] transition-colors"
|
|
460
|
-
},
|
|
461
|
-
text.proceed
|
|
462
|
-
)))
|
|
463
|
-
)
|
|
464
|
-
),
|
|
465
|
-
document.body
|
|
466
|
-
) : null);
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
document.body
|
|
526
|
+
) : null
|
|
527
|
+
] });
|
|
467
528
|
}
|
|
468
|
-
var Input =
|
|
529
|
+
var Input = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
469
530
|
"input",
|
|
470
531
|
{
|
|
471
532
|
"data-flap-ui": "input",
|
|
@@ -479,16 +540,16 @@ var Input = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
479
540
|
));
|
|
480
541
|
Input.displayName = "Input";
|
|
481
542
|
function IpfsImage({ alt, cid, path, validationPath, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
482
|
-
const urls =
|
|
483
|
-
const [urlIndex, setUrlIndex] =
|
|
543
|
+
const urls = React8.useMemo(() => resolveIpfsImageUrls(cid, 56, path), [cid, path]);
|
|
544
|
+
const [urlIndex, setUrlIndex] = React8.useState(0);
|
|
484
545
|
const src = urls[urlIndex];
|
|
485
|
-
|
|
546
|
+
React8.useEffect(() => {
|
|
486
547
|
setUrlIndex(0);
|
|
487
548
|
}, [cid, path]);
|
|
488
549
|
if (!src) return null;
|
|
489
550
|
return (
|
|
490
551
|
// eslint-disable-next-line @next/next/no-img-element -- IpfsImage owns CID-to-gateway fallback; next/image cannot represent this boundary.
|
|
491
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ jsx(
|
|
492
553
|
"img",
|
|
493
554
|
{
|
|
494
555
|
...props,
|
|
@@ -509,13 +570,16 @@ function IpfsImage({ alt, cid, path, validationPath, className, decoding = "asyn
|
|
|
509
570
|
);
|
|
510
571
|
}
|
|
511
572
|
function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...props }) {
|
|
512
|
-
return /* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ jsxs("div", { ...props, "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden", className), children: [
|
|
574
|
+
/* @__PURE__ */ jsx(IpfsImage, { alt: "", cid, className: cn("h-full w-full object-cover", imageClassName), loading: "eager" }),
|
|
575
|
+
overlayClassName ? /* @__PURE__ */ jsx("div", { className: cn("absolute inset-0", overlayClassName) }) : null
|
|
576
|
+
] });
|
|
513
577
|
}
|
|
514
578
|
function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
515
579
|
const sdk = useFlapSdk();
|
|
516
|
-
const [metadata, setMetadata] =
|
|
517
|
-
const [state, setState] =
|
|
518
|
-
|
|
580
|
+
const [metadata, setMetadata] = React8.useState(null);
|
|
581
|
+
const [state, setState] = React8.useState("loading");
|
|
582
|
+
React8.useEffect(() => {
|
|
519
583
|
let cancelled = false;
|
|
520
584
|
setState("loading");
|
|
521
585
|
setMetadata(null);
|
|
@@ -531,11 +595,11 @@ function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding =
|
|
|
531
595
|
};
|
|
532
596
|
}, [sdk, sdk.refetchNonce, tokenId]);
|
|
533
597
|
if (state !== "ready" || !metadata) {
|
|
534
|
-
return /* @__PURE__ */
|
|
598
|
+
return /* @__PURE__ */ jsx("span", { "data-flap-nft-media-state": state, className: cn("block", className), children: fallback });
|
|
535
599
|
}
|
|
536
600
|
return (
|
|
537
601
|
// eslint-disable-next-line @next/next/no-img-element -- shared runtime resolves tokenURI metadata to a validated, size-limited data image.
|
|
538
|
-
/* @__PURE__ */
|
|
602
|
+
/* @__PURE__ */ jsx(
|
|
539
603
|
"img",
|
|
540
604
|
{
|
|
541
605
|
...props,
|
|
@@ -554,8 +618,6 @@ function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding =
|
|
|
554
618
|
)
|
|
555
619
|
);
|
|
556
620
|
}
|
|
557
|
-
|
|
558
|
-
// src/ui/Metric.tsx
|
|
559
621
|
var toneClass3 = {
|
|
560
622
|
default: "border-[#303236] bg-[#0B0D0E]",
|
|
561
623
|
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
@@ -571,7 +633,11 @@ var valueToneClass = {
|
|
|
571
633
|
muted: "text-white"
|
|
572
634
|
};
|
|
573
635
|
function Metric({ label, value, hint, tone = "default", className }) {
|
|
574
|
-
return /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ jsxs("div", { "data-flap-ui": "metric", className: cn("rounded-[6px] border p-3", toneClass3[tone], className), children: [
|
|
637
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-xs font-medium uppercase leading-[1.4] text-[#84888C]", children: label }),
|
|
638
|
+
/* @__PURE__ */ jsx("div", { className: cn("mt-2 break-words text-xl font-semibold tracking-normal", valueToneClass[tone]), children: value }),
|
|
639
|
+
hint ? /* @__PURE__ */ jsx("div", { className: "mt-1 truncate text-xs text-[#D4D4D4]", children: hint }) : null
|
|
640
|
+
] });
|
|
575
641
|
}
|
|
576
642
|
function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
577
643
|
const {
|
|
@@ -583,7 +649,7 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
583
649
|
title: _title,
|
|
584
650
|
...safeProps
|
|
585
651
|
} = props;
|
|
586
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ jsx(
|
|
587
653
|
"iframe",
|
|
588
654
|
{
|
|
589
655
|
...safeProps,
|
|
@@ -598,8 +664,6 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
598
664
|
}
|
|
599
665
|
);
|
|
600
666
|
}
|
|
601
|
-
|
|
602
|
-
// src/ui/StatusBadge.tsx
|
|
603
667
|
var toneClass4 = {
|
|
604
668
|
neutral: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
605
669
|
success: "border-[#D0FF00]/65 bg-[#101400] text-[#D0FF00]",
|
|
@@ -607,10 +671,8 @@ var toneClass4 = {
|
|
|
607
671
|
danger: "border-[#FF4A55]/65 bg-[#1D0709] text-[#FF8A91]"
|
|
608
672
|
};
|
|
609
673
|
function StatusBadge({ children, tone = "neutral" }) {
|
|
610
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ jsx("span", { "data-flap-ui": "status-badge", className: cn("inline-flex items-center rounded-[6px] border px-2.5 py-1 text-xs font-semibold uppercase leading-none", toneClass4[tone]), children });
|
|
611
675
|
}
|
|
612
|
-
|
|
613
|
-
// src/ui/TxButton.tsx
|
|
614
676
|
var labels = {
|
|
615
677
|
idle: "",
|
|
616
678
|
validating: "Validating",
|
|
@@ -624,18 +686,29 @@ var labels = {
|
|
|
624
686
|
};
|
|
625
687
|
function TxButton({ state = "idle", idleLabel, children, ...props }) {
|
|
626
688
|
const loading = ["validating", "approving", "approval_confirming", "simulating", "writing", "confirming"].includes(state);
|
|
627
|
-
return /* @__PURE__ */
|
|
689
|
+
return /* @__PURE__ */ jsx(Button, { loading, ...props, children: children || labels[state] || idleLabel });
|
|
628
690
|
}
|
|
629
691
|
function VaultBanner({ title, description, badges, meta, action, icon, className }) {
|
|
630
|
-
return /* @__PURE__ */
|
|
692
|
+
return /* @__PURE__ */ jsx(
|
|
631
693
|
"section",
|
|
632
694
|
{
|
|
633
695
|
className: cn(
|
|
634
696
|
"rounded-lg border border-[#3b82f6] bg-[#172a5a] p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]",
|
|
635
697
|
className
|
|
636
|
-
)
|
|
637
|
-
|
|
638
|
-
|
|
698
|
+
),
|
|
699
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
700
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
701
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
702
|
+
/* @__PURE__ */ jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[#8fc8ff]", children: icon ?? /* @__PURE__ */ jsx(ShieldCheck, { className: "h-4 w-4" }) }),
|
|
703
|
+
/* @__PURE__ */ jsx("h3", { className: "min-w-0 text-base font-semibold leading-tight text-white", children: title }),
|
|
704
|
+
badges
|
|
705
|
+
] }),
|
|
706
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 max-w-3xl text-sm font-medium leading-6 text-[#d8e2ef]", children: description }),
|
|
707
|
+
meta ? /* @__PURE__ */ jsx("div", { className: "mt-2 text-xs font-medium leading-5 text-[#92a4bd]", children: meta }) : null
|
|
708
|
+
] }),
|
|
709
|
+
action ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action }) : null
|
|
710
|
+
] })
|
|
711
|
+
}
|
|
639
712
|
);
|
|
640
713
|
}
|
|
641
714
|
|
|
@@ -1361,45 +1434,43 @@ var videoPlayerMessages = {
|
|
|
1361
1434
|
go: "\uC774\uB3D9"
|
|
1362
1435
|
}
|
|
1363
1436
|
};
|
|
1364
|
-
|
|
1365
|
-
// src/ui/ConsumerVideoSessionPlayer.tsx
|
|
1366
1437
|
var initialSnapshot = { sessionId: 0, state: "loading", total: 0, start: 0, clips: [], revision: 0, resumeAt: 0, play: false, refreshFailed: false, preservePosition: false, firstPtsMs: 0n, endPtsMs: 0n, mediaStartPtsMs: 0n, mediaStartIndex: 0, mediaVideoCid: "" };
|
|
1367
1438
|
var clock = (seconds) => `${Math.floor(seconds / 60)}:${Math.floor(seconds % 60).toString().padStart(2, "0")}`;
|
|
1368
1439
|
function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1369
1440
|
const sdk = useFlapSdk();
|
|
1370
1441
|
const { chainId } = sdk.context;
|
|
1371
|
-
const readContractRef =
|
|
1442
|
+
const readContractRef = React8.useRef(sdk.readContract);
|
|
1372
1443
|
readContractRef.current = sdk.readContract;
|
|
1373
|
-
const reader =
|
|
1444
|
+
const reader = React8.useMemo(() => createConsumerVideoSessionReader({
|
|
1374
1445
|
context: { chainId },
|
|
1375
1446
|
readContract: (request) => readContractRef.current(request)
|
|
1376
1447
|
}, consumer), [chainId, consumer]);
|
|
1377
|
-
const sessionRef =
|
|
1378
|
-
const controllerRef =
|
|
1379
|
-
const videoRef =
|
|
1380
|
-
const frameRef =
|
|
1381
|
-
const playIntent =
|
|
1382
|
-
const autoPlayRef =
|
|
1448
|
+
const sessionRef = React8.useRef(null);
|
|
1449
|
+
const controllerRef = React8.useRef(null);
|
|
1450
|
+
const videoRef = React8.useRef(null);
|
|
1451
|
+
const frameRef = React8.useRef(null);
|
|
1452
|
+
const playIntent = React8.useRef(autoPlay);
|
|
1453
|
+
const autoPlayRef = React8.useRef(autoPlay);
|
|
1383
1454
|
autoPlayRef.current = autoPlay;
|
|
1384
|
-
const [snapshot, setSnapshot] =
|
|
1385
|
-
const [mediaState, setMediaState] =
|
|
1386
|
-
const [time, setTime] =
|
|
1387
|
-
const [paused, setPaused] =
|
|
1388
|
-
const [isMuted, setIsMuted] =
|
|
1389
|
-
const [volume, setVolume] =
|
|
1390
|
-
|
|
1455
|
+
const [snapshot, setSnapshot] = React8.useState(initialSnapshot);
|
|
1456
|
+
const [mediaState, setMediaState] = React8.useState("loading");
|
|
1457
|
+
const [time, setTime] = React8.useState(0);
|
|
1458
|
+
const [paused, setPaused] = React8.useState(true);
|
|
1459
|
+
const [isMuted, setIsMuted] = React8.useState(muted);
|
|
1460
|
+
const [volume, setVolume] = React8.useState(1);
|
|
1461
|
+
React8.useEffect(() => {
|
|
1391
1462
|
setIsMuted(muted);
|
|
1392
1463
|
}, [muted]);
|
|
1393
|
-
const [buffering, setBuffering] =
|
|
1394
|
-
const [page, setPage] =
|
|
1395
|
-
const [jump, setJump] =
|
|
1464
|
+
const [buffering, setBuffering] = React8.useState(false);
|
|
1465
|
+
const [page, setPage] = React8.useState(0);
|
|
1466
|
+
const [jump, setJump] = React8.useState("");
|
|
1396
1467
|
const position = videoClipPosition(snapshot.clips, time, snapshot.mediaStartPtsMs);
|
|
1397
1468
|
const duration = Number(snapshot.endPtsMs - snapshot.firstPtsMs) / 1e3;
|
|
1398
1469
|
const globalTime = Math.max(0, Math.min(duration, Number(snapshot.mediaStartPtsMs - snapshot.firstPtsMs) / 1e3 + time));
|
|
1399
1470
|
const activeIndex = position?.index ?? snapshot.start;
|
|
1400
1471
|
const strings = videoPlayerMessages[sdk.i18n.locale.split("-")[0]] ?? videoPlayerMessages.en;
|
|
1401
1472
|
const text = (key, params) => sdk.i18n.t(`runtime.video.${key}`, strings[key], params);
|
|
1402
|
-
|
|
1473
|
+
React8.useEffect(() => {
|
|
1403
1474
|
const session = new ConsumerVideoSession(reader, setSnapshot);
|
|
1404
1475
|
sessionRef.current = session;
|
|
1405
1476
|
setSnapshot(initialSnapshot);
|
|
@@ -1416,16 +1487,16 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1416
1487
|
sessionRef.current = null;
|
|
1417
1488
|
};
|
|
1418
1489
|
}, [reader, startClip]);
|
|
1419
|
-
|
|
1490
|
+
React8.useEffect(() => {
|
|
1420
1491
|
if (!videoRef.current) return;
|
|
1421
|
-
const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-
|
|
1492
|
+
const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-536UQHCG.js')).default, setMediaState);
|
|
1422
1493
|
controllerRef.current = controller;
|
|
1423
1494
|
return () => {
|
|
1424
1495
|
controller.dispose();
|
|
1425
1496
|
controllerRef.current = null;
|
|
1426
1497
|
};
|
|
1427
1498
|
}, []);
|
|
1428
|
-
|
|
1499
|
+
React8.useEffect(() => {
|
|
1429
1500
|
const controller = controllerRef.current;
|
|
1430
1501
|
const session = sessionRef.current;
|
|
1431
1502
|
if (!controller || !session) return;
|
|
@@ -1444,7 +1515,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1444
1515
|
playIntent: () => playIntent.current
|
|
1445
1516
|
}, snapshot.play, snapshot.resumeAt);
|
|
1446
1517
|
}, [snapshot.sessionId, snapshot.revision, snapshot.state]);
|
|
1447
|
-
|
|
1518
|
+
React8.useEffect(() => {
|
|
1448
1519
|
setPage(Math.floor(activeIndex / VIDEO_PICKER_PAGE_SIZE));
|
|
1449
1520
|
}, [activeIndex]);
|
|
1450
1521
|
const advance = () => {
|
|
@@ -1454,7 +1525,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1454
1525
|
void sessionRef.current?.advance(current.index);
|
|
1455
1526
|
}
|
|
1456
1527
|
};
|
|
1457
|
-
|
|
1528
|
+
React8.useEffect(() => {
|
|
1458
1529
|
const video = videoRef.current;
|
|
1459
1530
|
const current = videoClipPosition(snapshot.clips, video?.currentTime ?? 0, snapshot.mediaStartPtsMs);
|
|
1460
1531
|
if (video && current && (current.index >= snapshot.start + snapshot.clips.length - 2 || video.ended)) void sessionRef.current?.advance(current.index);
|
|
@@ -1468,7 +1539,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1468
1539
|
const showVideo = state === "loading" || state === "ready";
|
|
1469
1540
|
const first = page * VIDEO_PICKER_PAGE_SIZE;
|
|
1470
1541
|
const count = Math.max(0, Math.min(VIDEO_PICKER_PAGE_SIZE, snapshot.total - first));
|
|
1471
|
-
return /* @__PURE__ */
|
|
1542
|
+
return /* @__PURE__ */ jsxs(
|
|
1472
1543
|
"div",
|
|
1473
1544
|
{
|
|
1474
1545
|
className: cn("w-full min-w-0 space-y-3", className),
|
|
@@ -1499,133 +1570,192 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1499
1570
|
event.preventDefault();
|
|
1500
1571
|
seek(Math.max(0, activeIndex - 1));
|
|
1501
1572
|
}
|
|
1502
|
-
}
|
|
1503
|
-
},
|
|
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(
|
|
1505
|
-
"video",
|
|
1506
|
-
{
|
|
1507
|
-
ref: videoRef,
|
|
1508
|
-
"aria-label": label,
|
|
1509
|
-
playsInline: true,
|
|
1510
|
-
disablePictureInPicture: true,
|
|
1511
|
-
disableRemotePlayback: true,
|
|
1512
|
-
preload: "metadata",
|
|
1513
|
-
muted: isMuted,
|
|
1514
|
-
tabIndex: 0,
|
|
1515
|
-
className: showVideo ? "block aspect-video w-full object-contain" : "hidden",
|
|
1516
|
-
onTimeUpdate: () => {
|
|
1517
|
-
setTime(videoRef.current?.currentTime ?? 0);
|
|
1518
|
-
advance();
|
|
1519
|
-
},
|
|
1520
|
-
onPlay: () => {
|
|
1521
|
-
playIntent.current = true;
|
|
1522
|
-
setPaused(false);
|
|
1523
|
-
},
|
|
1524
|
-
onPause: () => {
|
|
1525
|
-
setPaused(true);
|
|
1526
|
-
if (!videoRef.current?.ended && mediaState === "ready") playIntent.current = false;
|
|
1527
|
-
},
|
|
1528
|
-
onVolumeChange: () => {
|
|
1529
|
-
if (videoRef.current) {
|
|
1530
|
-
setIsMuted(videoRef.current.muted);
|
|
1531
|
-
setVolume(videoRef.current.volume);
|
|
1532
|
-
}
|
|
1533
|
-
},
|
|
1534
|
-
onEnded: () => advance(),
|
|
1535
|
-
onWaiting: () => setBuffering(true),
|
|
1536
|
-
onStalled: () => setBuffering(true),
|
|
1537
|
-
onCanPlay: () => setBuffering(false),
|
|
1538
|
-
onPlaying: () => setBuffering(false)
|
|
1539
|
-
}
|
|
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: () => {
|
|
1541
|
-
const video = videoRef.current;
|
|
1542
|
-
if (video) {
|
|
1543
|
-
if (video.paused) void video.play().catch(() => void 0);
|
|
1544
|
-
else video.pause();
|
|
1545
|
-
}
|
|
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: () => {
|
|
1547
|
-
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
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) => {
|
|
1549
|
-
if (videoRef.current) {
|
|
1550
|
-
videoRef.current.volume = Number(event.target.value);
|
|
1551
|
-
videoRef.current.muted = Number(event.target.value) === 0;
|
|
1552
|
-
}
|
|
1553
|
-
} }), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", "aria-label": text("fullscreen"), onClick: () => {
|
|
1554
|
-
if (document.fullscreenElement) void document.exitFullscreen().catch(() => void 0);
|
|
1555
|
-
else void frameRef.current?.requestFullscreen?.().catch(() => void 0);
|
|
1556
|
-
} }, /* @__PURE__ */ React11.createElement(Maximize, { "aria-hidden": "true", className: "h-4 w-4" }))), /* @__PURE__ */ React11.createElement(
|
|
1557
|
-
"input",
|
|
1558
|
-
{
|
|
1559
|
-
type: "range",
|
|
1560
|
-
min: 0,
|
|
1561
|
-
max: duration,
|
|
1562
|
-
step: 0.05,
|
|
1563
|
-
value: globalTime,
|
|
1564
|
-
disabled: state !== "ready",
|
|
1565
|
-
"aria-label": text("timelineSeek"),
|
|
1566
|
-
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1567
|
-
onChange: (event) => {
|
|
1568
|
-
const video = videoRef.current;
|
|
1569
|
-
const play = video ? !video.paused || video.ended && playIntent.current : playIntent.current;
|
|
1570
|
-
void sessionRef.current?.seekTime(Number(event.target.value), play);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
))),
|
|
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(
|
|
1575
|
-
"input",
|
|
1576
|
-
{
|
|
1577
|
-
type: "range",
|
|
1578
|
-
"aria-label": text("time"),
|
|
1579
|
-
min: 0,
|
|
1580
|
-
max: position?.duration ?? 0,
|
|
1581
|
-
step: 0.05,
|
|
1582
|
-
value: position?.time ?? 0,
|
|
1583
|
-
disabled: !position || state !== "ready",
|
|
1584
|
-
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1585
|
-
onChange: (event) => {
|
|
1586
|
-
const video = videoRef.current;
|
|
1587
|
-
const clip = snapshot.clips.find((item) => item.index === activeIndex);
|
|
1588
|
-
if (video && clip) {
|
|
1589
|
-
video.currentTime = Number(clip.startPtsMs - snapshot.mediaStartPtsMs) / 1e3 + Number(event.target.value);
|
|
1590
|
-
setTime(video.currentTime);
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
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(
|
|
1595
|
-
"button",
|
|
1596
|
-
{
|
|
1597
|
-
key: index,
|
|
1598
|
-
type: "button",
|
|
1599
|
-
"aria-label": text("clip", { index: index + 1 }),
|
|
1600
|
-
"aria-pressed": index === activeIndex,
|
|
1601
|
-
className: cn("min-h-11 min-w-11 rounded-md border px-2 text-sm", index === activeIndex ? "border-[#D0FF00] bg-[#D0FF00] text-black" : "border-[#303236] bg-[#171717] text-white hover:border-[#D0FF00]", "focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#D0FF00]"),
|
|
1602
|
-
onClick: () => seek(index)
|
|
1603
1573
|
},
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1574
|
+
children: [
|
|
1575
|
+
/* @__PURE__ */ jsxs("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", children: [
|
|
1576
|
+
/* @__PURE__ */ jsx(
|
|
1577
|
+
"video",
|
|
1578
|
+
{
|
|
1579
|
+
ref: videoRef,
|
|
1580
|
+
"aria-label": label,
|
|
1581
|
+
playsInline: true,
|
|
1582
|
+
disablePictureInPicture: true,
|
|
1583
|
+
disableRemotePlayback: true,
|
|
1584
|
+
preload: "metadata",
|
|
1585
|
+
muted: isMuted,
|
|
1586
|
+
tabIndex: 0,
|
|
1587
|
+
className: showVideo ? "block aspect-video w-full object-contain" : "hidden",
|
|
1588
|
+
onTimeUpdate: () => {
|
|
1589
|
+
setTime(videoRef.current?.currentTime ?? 0);
|
|
1590
|
+
advance();
|
|
1591
|
+
},
|
|
1592
|
+
onPlay: () => {
|
|
1593
|
+
playIntent.current = true;
|
|
1594
|
+
setPaused(false);
|
|
1595
|
+
},
|
|
1596
|
+
onPause: () => {
|
|
1597
|
+
setPaused(true);
|
|
1598
|
+
if (!videoRef.current?.ended && mediaState === "ready") playIntent.current = false;
|
|
1599
|
+
},
|
|
1600
|
+
onVolumeChange: () => {
|
|
1601
|
+
if (videoRef.current) {
|
|
1602
|
+
setIsMuted(videoRef.current.muted);
|
|
1603
|
+
setVolume(videoRef.current.volume);
|
|
1604
|
+
}
|
|
1605
|
+
},
|
|
1606
|
+
onEnded: () => advance(),
|
|
1607
|
+
onWaiting: () => setBuffering(true),
|
|
1608
|
+
onStalled: () => setBuffering(true),
|
|
1609
|
+
onCanPlay: () => setBuffering(false),
|
|
1610
|
+
onPlaying: () => setBuffering(false)
|
|
1611
|
+
}
|
|
1612
|
+
),
|
|
1613
|
+
(state === "loading" || buffering && showVideo) && /* @__PURE__ */ jsx("p", { className: "pointer-events-none absolute inset-x-0 top-3 text-center text-sm text-white", role: "status", children: text(state === "loading" ? "loading" : "buffering") }),
|
|
1614
|
+
!showVideo && /* @__PURE__ */ jsx("div", { className: "p-4", children: fallback }),
|
|
1615
|
+
showVideo && snapshot.total > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t border-[#303236] bg-black p-3", children: [
|
|
1616
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1617
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text(paused ? "play" : "pause"), onClick: () => {
|
|
1618
|
+
const video = videoRef.current;
|
|
1619
|
+
if (video) {
|
|
1620
|
+
if (video.paused) void video.play().catch(() => void 0);
|
|
1621
|
+
else video.pause();
|
|
1622
|
+
}
|
|
1623
|
+
}, children: paused ? /* @__PURE__ */ jsx(Play, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Pause, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1624
|
+
/* @__PURE__ */ jsxs("span", { className: "flex-1 text-xs text-white", "aria-label": text("timeline"), "data-flap-video-time": true, children: [
|
|
1625
|
+
clock(globalTime),
|
|
1626
|
+
" / ",
|
|
1627
|
+
clock(duration)
|
|
1628
|
+
] }),
|
|
1629
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text(isMuted ? "unmute" : "mute"), onClick: () => {
|
|
1630
|
+
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
1631
|
+
}, children: isMuted ? /* @__PURE__ */ jsx(VolumeX, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Volume2, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1632
|
+
/* @__PURE__ */ jsx("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) => {
|
|
1633
|
+
if (videoRef.current) {
|
|
1634
|
+
videoRef.current.volume = Number(event.target.value);
|
|
1635
|
+
videoRef.current.muted = Number(event.target.value) === 0;
|
|
1636
|
+
}
|
|
1637
|
+
} }),
|
|
1638
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text("fullscreen"), onClick: () => {
|
|
1639
|
+
if (document.fullscreenElement) void document.exitFullscreen().catch(() => void 0);
|
|
1640
|
+
else void frameRef.current?.requestFullscreen?.().catch(() => void 0);
|
|
1641
|
+
}, children: /* @__PURE__ */ jsx(Maximize, { "aria-hidden": "true", className: "h-4 w-4" }) })
|
|
1642
|
+
] }),
|
|
1643
|
+
/* @__PURE__ */ jsx(
|
|
1644
|
+
"input",
|
|
1645
|
+
{
|
|
1646
|
+
type: "range",
|
|
1647
|
+
min: 0,
|
|
1648
|
+
max: duration,
|
|
1649
|
+
step: 0.05,
|
|
1650
|
+
value: globalTime,
|
|
1651
|
+
disabled: state !== "ready",
|
|
1652
|
+
"aria-label": text("timelineSeek"),
|
|
1653
|
+
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1654
|
+
onChange: (event) => {
|
|
1655
|
+
const video = videoRef.current;
|
|
1656
|
+
const play = video ? !video.paused || video.ended && playIntent.current : playIntent.current;
|
|
1657
|
+
void sessionRef.current?.seekTime(Number(event.target.value), play);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
)
|
|
1661
|
+
] })
|
|
1662
|
+
] }),
|
|
1663
|
+
snapshot.total > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1664
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs text-[#D4D4D4]", children: [
|
|
1665
|
+
/* @__PURE__ */ jsx("span", { role: "status", children: text("position", { index: activeIndex + 1, total: snapshot.total }) }),
|
|
1666
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
1667
|
+
clock(position?.time ?? 0),
|
|
1668
|
+
" / ",
|
|
1669
|
+
clock(position?.duration ?? 0)
|
|
1670
|
+
] })
|
|
1671
|
+
] }),
|
|
1672
|
+
/* @__PURE__ */ jsx(
|
|
1673
|
+
"input",
|
|
1674
|
+
{
|
|
1675
|
+
type: "range",
|
|
1676
|
+
"aria-label": text("time"),
|
|
1677
|
+
min: 0,
|
|
1678
|
+
max: position?.duration ?? 0,
|
|
1679
|
+
step: 0.05,
|
|
1680
|
+
value: position?.time ?? 0,
|
|
1681
|
+
disabled: !position || state !== "ready",
|
|
1682
|
+
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1683
|
+
onChange: (event) => {
|
|
1684
|
+
const video = videoRef.current;
|
|
1685
|
+
const clip = snapshot.clips.find((item) => item.index === activeIndex);
|
|
1686
|
+
if (video && clip) {
|
|
1687
|
+
video.currentTime = Number(clip.startPtsMs - snapshot.mediaStartPtsMs) / 1e3 + Number(event.target.value);
|
|
1688
|
+
setTime(video.currentTime);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
),
|
|
1693
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
1694
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(0), "aria-label": text("first"), children: [
|
|
1695
|
+
/* @__PURE__ */ jsx(SkipBack, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
1696
|
+
text("first")
|
|
1697
|
+
] }),
|
|
1698
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(activeIndex - 1), "aria-label": text("previous"), children: [
|
|
1699
|
+
/* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
1700
|
+
text("previous")
|
|
1701
|
+
] }),
|
|
1702
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(activeIndex + 1), "aria-label": text("next"), children: [
|
|
1703
|
+
text("next"),
|
|
1704
|
+
/* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
1705
|
+
] }),
|
|
1706
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(-1), "aria-label": text("latest"), children: [
|
|
1707
|
+
text("latest"),
|
|
1708
|
+
/* @__PURE__ */ jsx(SkipForward, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
1709
|
+
] })
|
|
1710
|
+
] }),
|
|
1711
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", role: "group", "aria-label": label, children: Array.from({ length: count }, (_, offset) => first + offset).map((index) => /* @__PURE__ */ jsx(
|
|
1712
|
+
"button",
|
|
1713
|
+
{
|
|
1714
|
+
type: "button",
|
|
1715
|
+
"aria-label": text("clip", { index: index + 1 }),
|
|
1716
|
+
"aria-pressed": index === activeIndex,
|
|
1717
|
+
className: cn("min-h-11 min-w-11 rounded-md border px-2 text-sm", index === activeIndex ? "border-[#D0FF00] bg-[#D0FF00] text-black" : "border-[#303236] bg-[#171717] text-white hover:border-[#D0FF00]", "focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#D0FF00]"),
|
|
1718
|
+
onClick: () => seek(index),
|
|
1719
|
+
children: index + 1
|
|
1720
|
+
},
|
|
1721
|
+
index
|
|
1722
|
+
)) }),
|
|
1723
|
+
/* @__PURE__ */ jsxs("form", { className: "flex flex-wrap items-end gap-2", onSubmit: (event) => {
|
|
1724
|
+
event.preventDefault();
|
|
1725
|
+
if (Number.isSafeInteger(Number(jump)) && Number(jump) >= 1 && Number(jump) <= snapshot.total) seek(Number(jump) - 1);
|
|
1726
|
+
}, children: [
|
|
1727
|
+
/* @__PURE__ */ jsxs("label", { className: "min-w-0 flex-1 space-y-1 text-xs text-[#84888C]", children: [
|
|
1728
|
+
/* @__PURE__ */ jsx("span", { children: text("jump") }),
|
|
1729
|
+
/* @__PURE__ */ jsx(Input, { type: "number", min: 1, max: snapshot.total, step: 1, value: jump, onChange: (event) => setJump(event.target.value) })
|
|
1730
|
+
] }),
|
|
1731
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", variant: "outline", disabled: !Number.isSafeInteger(Number(jump)) || Number(jump) < 1 || Number(jump) > snapshot.total, children: text("go") })
|
|
1732
|
+
] }),
|
|
1733
|
+
snapshot.total > VIDEO_PICKER_PAGE_SIZE && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1734
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", disabled: page === 0, onClick: () => setPage((value) => value - 1), "aria-label": text("previousPage"), children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1735
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-[#84888C]", children: text("page", { first: first + 1, last: first + count, total: snapshot.total }) }),
|
|
1736
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", disabled: first + count >= snapshot.total, onClick: () => setPage((value) => value + 1), "aria-label": text("nextPage"), children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" }) })
|
|
1737
|
+
] })
|
|
1738
|
+
] }),
|
|
1739
|
+
snapshot.refreshFailed && /* @__PURE__ */ jsx("p", { className: "text-sm text-[#FFB35C]", role: "status", children: text("refreshFailed") }),
|
|
1740
|
+
(snapshot.refreshFailed || state === "error" || state === "invalid") && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
1741
|
+
if (snapshot.total) seek(activeIndex);
|
|
1742
|
+
else void sessionRef.current?.refresh(startClip, playIntent.current);
|
|
1743
|
+
}, children: text("retry") })
|
|
1744
|
+
]
|
|
1745
|
+
}
|
|
1614
1746
|
);
|
|
1615
1747
|
}
|
|
1616
|
-
|
|
1617
|
-
// src/ui/VideoSessionPlayer.tsx
|
|
1618
1748
|
function VideoSessionPlayer(props) {
|
|
1619
|
-
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */
|
|
1749
|
+
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */ jsx(ConsumerVideoSessionPlayer, { ...props }) : /* @__PURE__ */ jsx(VideoClipSessionPlayer, { ...props });
|
|
1620
1750
|
}
|
|
1621
1751
|
async function loadMpegts() {
|
|
1622
|
-
return (await import('./mpegts-
|
|
1752
|
+
return (await import('./mpegts-536UQHCG.js')).default;
|
|
1623
1753
|
}
|
|
1624
1754
|
function VideoClipSessionPlayer({ clips, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1625
|
-
const videoRef =
|
|
1626
|
-
const controllerRef =
|
|
1627
|
-
const [state, setState] =
|
|
1628
|
-
|
|
1755
|
+
const videoRef = React8.useRef(null);
|
|
1756
|
+
const controllerRef = React8.useRef(null);
|
|
1757
|
+
const [state, setState] = React8.useState("loading");
|
|
1758
|
+
React8.useEffect(() => {
|
|
1629
1759
|
if (!videoRef.current) return;
|
|
1630
1760
|
const controller = new VideoSessionController(videoRef.current, loadMpegts, setState);
|
|
1631
1761
|
controllerRef.current = controller;
|
|
@@ -1634,26 +1764,29 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
|
|
|
1634
1764
|
controllerRef.current = null;
|
|
1635
1765
|
};
|
|
1636
1766
|
}, []);
|
|
1637
|
-
|
|
1767
|
+
React8.useEffect(() => {
|
|
1638
1768
|
void controllerRef.current?.update(clips, autoPlay);
|
|
1639
1769
|
}, [clips, autoPlay]);
|
|
1640
1770
|
const showVideo = state === "loading" || state === "ready";
|
|
1641
|
-
return /* @__PURE__ */
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1771
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), "data-flap-video-session-state": state, children: [
|
|
1772
|
+
/* @__PURE__ */ jsx(
|
|
1773
|
+
"video",
|
|
1774
|
+
{
|
|
1775
|
+
ref: videoRef,
|
|
1776
|
+
"aria-label": label,
|
|
1777
|
+
className: showVideo ? "block w-full" : "hidden",
|
|
1778
|
+
controls: true,
|
|
1779
|
+
playsInline: true,
|
|
1780
|
+
disablePictureInPicture: true,
|
|
1781
|
+
disableRemotePlayback: true,
|
|
1782
|
+
preload: "metadata",
|
|
1783
|
+
muted
|
|
1784
|
+
}
|
|
1785
|
+
),
|
|
1786
|
+
!showVideo && fallback
|
|
1787
|
+
] });
|
|
1655
1788
|
}
|
|
1656
1789
|
|
|
1657
|
-
export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage, Metric,
|
|
1658
|
-
//# sourceMappingURL=chunk-
|
|
1659
|
-
//# sourceMappingURL=chunk-
|
|
1790
|
+
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 };
|
|
1791
|
+
//# sourceMappingURL=chunk-IN34R3DY.js.map
|
|
1792
|
+
//# sourceMappingURL=chunk-IN34R3DY.js.map
|