@flapsdk/vault-runtime 0.1.36-next.0 → 0.1.37
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/README.md +45 -0
- package/{chunk-FWYBGHBX.js → chunk-22KTLOYH.js} +4 -17
- package/chunk-22KTLOYH.js.map +1 -0
- package/{chunk-SAG36LUR.js → chunk-27VBKY3J.js} +4 -3
- package/chunk-27VBKY3J.js.map +1 -0
- package/{chunk-MLAOJT5Q.js → chunk-3X2K7YYU.js} +524 -367
- package/chunk-3X2K7YYU.js.map +1 -0
- package/chunk-AGLB72HK.js +61 -0
- package/chunk-AGLB72HK.js.map +1 -0
- package/{chunk-V7U4QTMT.js → chunk-HYBZWS6U.js} +279 -104
- package/chunk-HYBZWS6U.js.map +1 -0
- package/{chunk-PU7VEZWA.js → chunk-SRZFHGSO.js} +3 -3
- package/{chunk-PU7VEZWA.js.map → chunk-SRZFHGSO.js.map} +1 -1
- package/host-client.d.mts +2 -9
- package/host-client.js +5 -5
- package/host.d.mts +5 -5
- package/host.js +4 -4
- package/{hostRuntimeConfig-DibvcxHE.d.mts → hostRuntimeConfig-DM6JjbeO.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 +3 -3
- package/sdk.d.mts +6 -40
- package/sdk.js +9 -39
- package/sdk.js.map +1 -1
- package/server.d.mts +3 -3
- package/server.js +2 -2
- package/{txError-OBuRV8xN.d.mts → txError-vvvBIsa-.d.mts} +2 -15
- package/{types-DUZWZ3mC.d.mts → types-cyAEoeXa.d.mts} +6 -98
- package/ui.d.mts +13 -5
- package/ui.js +2 -2
- 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-SAG36LUR.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
|
-
import { isIpfsImageCid, resolveIpfsImageUrls, resolveIpfsImageUrl } from './chunk-
|
|
2
|
+
import { isIpfsImageCid, resolveIpfsImageUrls, resolveIpfsImageUrl } from './chunk-27VBKY3J.js';
|
|
3
3
|
import { getTaxVaultHostChainConfig } from './chunk-FUOBTZMQ.js';
|
|
4
|
-
import * as
|
|
5
|
-
import { createContext, useContext, useState, useEffect, useMemo } from 'react';
|
|
4
|
+
import * as React9 from 'react';
|
|
5
|
+
import { createContext, useContext, useState, useEffect, useMemo, createElement } 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 = React9.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 = React9.useMemo(() => normalizeBinanceImageUrl(src), [src]);
|
|
182
|
+
const [failedSrc, setFailedSrc] = React9.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 = React9.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 = React9.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 = React9.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 = React9.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 = React9.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] = React9.useState(false);
|
|
367
|
+
const [acknowledged, setAcknowledged] = React9.useState(false);
|
|
368
|
+
const [mounted, setMounted] = React9.useState(false);
|
|
338
369
|
const text = { ...COPY[resolveLocale(locale)], ...copy };
|
|
339
|
-
const safeUrl =
|
|
370
|
+
const safeUrl = React9.useMemo(() => normalizeExternalUrl(url), [url]);
|
|
340
371
|
const canProceed = acknowledged && Boolean(safeUrl);
|
|
341
|
-
|
|
372
|
+
React9.useEffect(() => {
|
|
342
373
|
setMounted(true);
|
|
343
374
|
}, []);
|
|
344
|
-
const close =
|
|
375
|
+
const close = React9.useCallback(() => {
|
|
345
376
|
setOpen(false);
|
|
346
377
|
setAcknowledged(false);
|
|
347
378
|
}, []);
|
|
348
|
-
|
|
379
|
+
React9.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 = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
469
530
|
"input",
|
|
470
531
|
{
|
|
471
532
|
"data-flap-ui": "input",
|
|
@@ -479,26 +540,28 @@ 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
|
|
543
|
+
const urls = React9.useMemo(() => resolveIpfsImageUrls(cid, 56, path), [cid, path]);
|
|
544
|
+
const resourceKey = urls.join("\n");
|
|
545
|
+
const [fallbackState, setFallbackState] = React9.useState({ key: resourceKey, index: 0 });
|
|
546
|
+
const urlIndex = fallbackState.key === resourceKey ? fallbackState.index : 0;
|
|
484
547
|
const src = urls[urlIndex];
|
|
485
|
-
|
|
486
|
-
setUrlIndex(0);
|
|
487
|
-
}, [cid, path]);
|
|
548
|
+
const { src: ignoredSrc, srcSet: ignoredSrcSet, dangerouslySetInnerHTML: ignoredHtml, ...safeProps } = props;
|
|
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__ */ createElement(
|
|
492
553
|
"img",
|
|
493
554
|
{
|
|
494
|
-
...
|
|
555
|
+
...safeProps,
|
|
556
|
+
key: resourceKey,
|
|
495
557
|
alt,
|
|
496
558
|
className: cn("block max-w-full", className),
|
|
497
559
|
decoding,
|
|
498
560
|
loading,
|
|
561
|
+
referrerPolicy: "no-referrer",
|
|
499
562
|
onError: (event) => {
|
|
500
563
|
if (urlIndex < urls.length - 1) {
|
|
501
|
-
|
|
564
|
+
setFallbackState({ key: resourceKey, index: Math.min(urlIndex + 1, urls.length - 1) });
|
|
502
565
|
return;
|
|
503
566
|
}
|
|
504
567
|
onError?.(event);
|
|
@@ -509,13 +572,38 @@ function IpfsImage({ alt, cid, path, validationPath, className, decoding = "asyn
|
|
|
509
572
|
);
|
|
510
573
|
}
|
|
511
574
|
function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...props }) {
|
|
512
|
-
return /* @__PURE__ */
|
|
575
|
+
return /* @__PURE__ */ jsxs("div", { ...props, "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden", className), children: [
|
|
576
|
+
/* @__PURE__ */ jsx(IpfsImage, { alt: "", cid, className: cn("h-full w-full object-cover", imageClassName), loading: "eager" }),
|
|
577
|
+
overlayClassName ? /* @__PURE__ */ jsx("div", { className: cn("absolute inset-0", overlayClassName) }) : null
|
|
578
|
+
] });
|
|
579
|
+
}
|
|
580
|
+
function IpfsText({ cid, path, fallback = null, className, ...props }) {
|
|
581
|
+
const { readIpfsText } = useFlapSdk();
|
|
582
|
+
const key = JSON.stringify([typeof cid === "string" ? cid : null, typeof path === "string" ? path : null]);
|
|
583
|
+
const [result, setResult] = React9.useState();
|
|
584
|
+
React9.useEffect(() => {
|
|
585
|
+
let cancelled = false;
|
|
586
|
+
readIpfsText(cid, path).then(
|
|
587
|
+
(text) => {
|
|
588
|
+
if (!cancelled) setResult({ key, text, state: "ready" });
|
|
589
|
+
},
|
|
590
|
+
() => {
|
|
591
|
+
if (!cancelled) setResult({ key, state: "error" });
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
return () => {
|
|
595
|
+
cancelled = true;
|
|
596
|
+
};
|
|
597
|
+
}, [readIpfsText, cid, path, key]);
|
|
598
|
+
const current = result?.key === key ? result : void 0;
|
|
599
|
+
const { dangerouslySetInnerHTML: ignoredHtml, children: ignoredChildren, ...safeProps } = props;
|
|
600
|
+
return /* @__PURE__ */ jsx("span", { ...safeProps, className: cn("whitespace-pre-wrap break-words", className), "data-flap-ipfs-text-state": current?.state ?? "loading", children: current?.state === "ready" ? current.text : fallback });
|
|
513
601
|
}
|
|
514
602
|
function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
515
603
|
const sdk = useFlapSdk();
|
|
516
|
-
const [metadata, setMetadata] =
|
|
517
|
-
const [state, setState] =
|
|
518
|
-
|
|
604
|
+
const [metadata, setMetadata] = React9.useState(null);
|
|
605
|
+
const [state, setState] = React9.useState("loading");
|
|
606
|
+
React9.useEffect(() => {
|
|
519
607
|
let cancelled = false;
|
|
520
608
|
setState("loading");
|
|
521
609
|
setMetadata(null);
|
|
@@ -531,11 +619,11 @@ function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding =
|
|
|
531
619
|
};
|
|
532
620
|
}, [sdk, sdk.refetchNonce, tokenId]);
|
|
533
621
|
if (state !== "ready" || !metadata) {
|
|
534
|
-
return /* @__PURE__ */
|
|
622
|
+
return /* @__PURE__ */ jsx("span", { "data-flap-nft-media-state": state, className: cn("block", className), children: fallback });
|
|
535
623
|
}
|
|
536
624
|
return (
|
|
537
625
|
// eslint-disable-next-line @next/next/no-img-element -- shared runtime resolves tokenURI metadata to a validated, size-limited data image.
|
|
538
|
-
/* @__PURE__ */
|
|
626
|
+
/* @__PURE__ */ jsx(
|
|
539
627
|
"img",
|
|
540
628
|
{
|
|
541
629
|
...props,
|
|
@@ -554,8 +642,6 @@ function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding =
|
|
|
554
642
|
)
|
|
555
643
|
);
|
|
556
644
|
}
|
|
557
|
-
|
|
558
|
-
// src/ui/Metric.tsx
|
|
559
645
|
var toneClass3 = {
|
|
560
646
|
default: "border-[#303236] bg-[#0B0D0E]",
|
|
561
647
|
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
@@ -571,7 +657,11 @@ var valueToneClass = {
|
|
|
571
657
|
muted: "text-white"
|
|
572
658
|
};
|
|
573
659
|
function Metric({ label, value, hint, tone = "default", className }) {
|
|
574
|
-
return /* @__PURE__ */
|
|
660
|
+
return /* @__PURE__ */ jsxs("div", { "data-flap-ui": "metric", className: cn("rounded-[6px] border p-3", toneClass3[tone], className), children: [
|
|
661
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-xs font-medium uppercase leading-[1.4] text-[#84888C]", children: label }),
|
|
662
|
+
/* @__PURE__ */ jsx("div", { className: cn("mt-2 break-words text-xl font-semibold tracking-normal", valueToneClass[tone]), children: value }),
|
|
663
|
+
hint ? /* @__PURE__ */ jsx("div", { className: "mt-1 truncate text-xs text-[#D4D4D4]", children: hint }) : null
|
|
664
|
+
] });
|
|
575
665
|
}
|
|
576
666
|
function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
577
667
|
const {
|
|
@@ -583,7 +673,7 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
583
673
|
title: _title,
|
|
584
674
|
...safeProps
|
|
585
675
|
} = props;
|
|
586
|
-
return /* @__PURE__ */
|
|
676
|
+
return /* @__PURE__ */ jsx(
|
|
587
677
|
"iframe",
|
|
588
678
|
{
|
|
589
679
|
...safeProps,
|
|
@@ -598,8 +688,6 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
598
688
|
}
|
|
599
689
|
);
|
|
600
690
|
}
|
|
601
|
-
|
|
602
|
-
// src/ui/StatusBadge.tsx
|
|
603
691
|
var toneClass4 = {
|
|
604
692
|
neutral: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
605
693
|
success: "border-[#D0FF00]/65 bg-[#101400] text-[#D0FF00]",
|
|
@@ -607,10 +695,8 @@ var toneClass4 = {
|
|
|
607
695
|
danger: "border-[#FF4A55]/65 bg-[#1D0709] text-[#FF8A91]"
|
|
608
696
|
};
|
|
609
697
|
function StatusBadge({ children, tone = "neutral" }) {
|
|
610
|
-
return /* @__PURE__ */
|
|
698
|
+
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
699
|
}
|
|
612
|
-
|
|
613
|
-
// src/ui/TxButton.tsx
|
|
614
700
|
var labels = {
|
|
615
701
|
idle: "",
|
|
616
702
|
validating: "Validating",
|
|
@@ -624,18 +710,29 @@ var labels = {
|
|
|
624
710
|
};
|
|
625
711
|
function TxButton({ state = "idle", idleLabel, children, ...props }) {
|
|
626
712
|
const loading = ["validating", "approving", "approval_confirming", "simulating", "writing", "confirming"].includes(state);
|
|
627
|
-
return /* @__PURE__ */
|
|
713
|
+
return /* @__PURE__ */ jsx(Button, { loading, ...props, children: children || labels[state] || idleLabel });
|
|
628
714
|
}
|
|
629
715
|
function VaultBanner({ title, description, badges, meta, action, icon, className }) {
|
|
630
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ jsx(
|
|
631
717
|
"section",
|
|
632
718
|
{
|
|
633
719
|
className: cn(
|
|
634
720
|
"rounded-lg border border-[#3b82f6] bg-[#172a5a] p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]",
|
|
635
721
|
className
|
|
636
|
-
)
|
|
637
|
-
|
|
638
|
-
|
|
722
|
+
),
|
|
723
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
724
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
725
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
726
|
+
/* @__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" }) }),
|
|
727
|
+
/* @__PURE__ */ jsx("h3", { className: "min-w-0 text-base font-semibold leading-tight text-white", children: title }),
|
|
728
|
+
badges
|
|
729
|
+
] }),
|
|
730
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 max-w-3xl text-sm font-medium leading-6 text-[#d8e2ef]", children: description }),
|
|
731
|
+
meta ? /* @__PURE__ */ jsx("div", { className: "mt-2 text-xs font-medium leading-5 text-[#92a4bd]", children: meta }) : null
|
|
732
|
+
] }),
|
|
733
|
+
action ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action }) : null
|
|
734
|
+
] })
|
|
735
|
+
}
|
|
639
736
|
);
|
|
640
737
|
}
|
|
641
738
|
|
|
@@ -1361,45 +1458,43 @@ var videoPlayerMessages = {
|
|
|
1361
1458
|
go: "\uC774\uB3D9"
|
|
1362
1459
|
}
|
|
1363
1460
|
};
|
|
1364
|
-
|
|
1365
|
-
// src/ui/ConsumerVideoSessionPlayer.tsx
|
|
1366
1461
|
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
1462
|
var clock = (seconds) => `${Math.floor(seconds / 60)}:${Math.floor(seconds % 60).toString().padStart(2, "0")}`;
|
|
1368
1463
|
function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1369
1464
|
const sdk = useFlapSdk();
|
|
1370
1465
|
const { chainId } = sdk.context;
|
|
1371
|
-
const readContractRef =
|
|
1466
|
+
const readContractRef = React9.useRef(sdk.readContract);
|
|
1372
1467
|
readContractRef.current = sdk.readContract;
|
|
1373
|
-
const reader =
|
|
1468
|
+
const reader = React9.useMemo(() => createConsumerVideoSessionReader({
|
|
1374
1469
|
context: { chainId },
|
|
1375
1470
|
readContract: (request) => readContractRef.current(request)
|
|
1376
1471
|
}, consumer), [chainId, consumer]);
|
|
1377
|
-
const sessionRef =
|
|
1378
|
-
const controllerRef =
|
|
1379
|
-
const videoRef =
|
|
1380
|
-
const frameRef =
|
|
1381
|
-
const playIntent =
|
|
1382
|
-
const autoPlayRef =
|
|
1472
|
+
const sessionRef = React9.useRef(null);
|
|
1473
|
+
const controllerRef = React9.useRef(null);
|
|
1474
|
+
const videoRef = React9.useRef(null);
|
|
1475
|
+
const frameRef = React9.useRef(null);
|
|
1476
|
+
const playIntent = React9.useRef(autoPlay);
|
|
1477
|
+
const autoPlayRef = React9.useRef(autoPlay);
|
|
1383
1478
|
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
|
-
|
|
1479
|
+
const [snapshot, setSnapshot] = React9.useState(initialSnapshot);
|
|
1480
|
+
const [mediaState, setMediaState] = React9.useState("loading");
|
|
1481
|
+
const [time, setTime] = React9.useState(0);
|
|
1482
|
+
const [paused, setPaused] = React9.useState(true);
|
|
1483
|
+
const [isMuted, setIsMuted] = React9.useState(muted);
|
|
1484
|
+
const [volume, setVolume] = React9.useState(1);
|
|
1485
|
+
React9.useEffect(() => {
|
|
1391
1486
|
setIsMuted(muted);
|
|
1392
1487
|
}, [muted]);
|
|
1393
|
-
const [buffering, setBuffering] =
|
|
1394
|
-
const [page, setPage] =
|
|
1395
|
-
const [jump, setJump] =
|
|
1488
|
+
const [buffering, setBuffering] = React9.useState(false);
|
|
1489
|
+
const [page, setPage] = React9.useState(0);
|
|
1490
|
+
const [jump, setJump] = React9.useState("");
|
|
1396
1491
|
const position = videoClipPosition(snapshot.clips, time, snapshot.mediaStartPtsMs);
|
|
1397
1492
|
const duration = Number(snapshot.endPtsMs - snapshot.firstPtsMs) / 1e3;
|
|
1398
1493
|
const globalTime = Math.max(0, Math.min(duration, Number(snapshot.mediaStartPtsMs - snapshot.firstPtsMs) / 1e3 + time));
|
|
1399
1494
|
const activeIndex = position?.index ?? snapshot.start;
|
|
1400
1495
|
const strings = videoPlayerMessages[sdk.i18n.locale.split("-")[0]] ?? videoPlayerMessages.en;
|
|
1401
1496
|
const text = (key, params) => sdk.i18n.t(`runtime.video.${key}`, strings[key], params);
|
|
1402
|
-
|
|
1497
|
+
React9.useEffect(() => {
|
|
1403
1498
|
const session = new ConsumerVideoSession(reader, setSnapshot);
|
|
1404
1499
|
sessionRef.current = session;
|
|
1405
1500
|
setSnapshot(initialSnapshot);
|
|
@@ -1416,16 +1511,16 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1416
1511
|
sessionRef.current = null;
|
|
1417
1512
|
};
|
|
1418
1513
|
}, [reader, startClip]);
|
|
1419
|
-
|
|
1514
|
+
React9.useEffect(() => {
|
|
1420
1515
|
if (!videoRef.current) return;
|
|
1421
|
-
const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-
|
|
1516
|
+
const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-536UQHCG.js')).default, setMediaState);
|
|
1422
1517
|
controllerRef.current = controller;
|
|
1423
1518
|
return () => {
|
|
1424
1519
|
controller.dispose();
|
|
1425
1520
|
controllerRef.current = null;
|
|
1426
1521
|
};
|
|
1427
1522
|
}, []);
|
|
1428
|
-
|
|
1523
|
+
React9.useEffect(() => {
|
|
1429
1524
|
const controller = controllerRef.current;
|
|
1430
1525
|
const session = sessionRef.current;
|
|
1431
1526
|
if (!controller || !session) return;
|
|
@@ -1444,7 +1539,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1444
1539
|
playIntent: () => playIntent.current
|
|
1445
1540
|
}, snapshot.play, snapshot.resumeAt);
|
|
1446
1541
|
}, [snapshot.sessionId, snapshot.revision, snapshot.state]);
|
|
1447
|
-
|
|
1542
|
+
React9.useEffect(() => {
|
|
1448
1543
|
setPage(Math.floor(activeIndex / VIDEO_PICKER_PAGE_SIZE));
|
|
1449
1544
|
}, [activeIndex]);
|
|
1450
1545
|
const advance = () => {
|
|
@@ -1454,7 +1549,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1454
1549
|
void sessionRef.current?.advance(current.index);
|
|
1455
1550
|
}
|
|
1456
1551
|
};
|
|
1457
|
-
|
|
1552
|
+
React9.useEffect(() => {
|
|
1458
1553
|
const video = videoRef.current;
|
|
1459
1554
|
const current = videoClipPosition(snapshot.clips, video?.currentTime ?? 0, snapshot.mediaStartPtsMs);
|
|
1460
1555
|
if (video && current && (current.index >= snapshot.start + snapshot.clips.length - 2 || video.ended)) void sessionRef.current?.advance(current.index);
|
|
@@ -1468,7 +1563,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1468
1563
|
const showVideo = state === "loading" || state === "ready";
|
|
1469
1564
|
const first = page * VIDEO_PICKER_PAGE_SIZE;
|
|
1470
1565
|
const count = Math.max(0, Math.min(VIDEO_PICKER_PAGE_SIZE, snapshot.total - first));
|
|
1471
|
-
return /* @__PURE__ */
|
|
1566
|
+
return /* @__PURE__ */ jsxs(
|
|
1472
1567
|
"div",
|
|
1473
1568
|
{
|
|
1474
1569
|
className: cn("w-full min-w-0 space-y-3", className),
|
|
@@ -1499,133 +1594,192 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1499
1594
|
event.preventDefault();
|
|
1500
1595
|
seek(Math.max(0, activeIndex - 1));
|
|
1501
1596
|
}
|
|
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
1597
|
},
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1598
|
+
children: [
|
|
1599
|
+
/* @__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: [
|
|
1600
|
+
/* @__PURE__ */ jsx(
|
|
1601
|
+
"video",
|
|
1602
|
+
{
|
|
1603
|
+
ref: videoRef,
|
|
1604
|
+
"aria-label": label,
|
|
1605
|
+
playsInline: true,
|
|
1606
|
+
disablePictureInPicture: true,
|
|
1607
|
+
disableRemotePlayback: true,
|
|
1608
|
+
preload: "metadata",
|
|
1609
|
+
muted: isMuted,
|
|
1610
|
+
tabIndex: 0,
|
|
1611
|
+
className: showVideo ? "block aspect-video w-full object-contain" : "hidden",
|
|
1612
|
+
onTimeUpdate: () => {
|
|
1613
|
+
setTime(videoRef.current?.currentTime ?? 0);
|
|
1614
|
+
advance();
|
|
1615
|
+
},
|
|
1616
|
+
onPlay: () => {
|
|
1617
|
+
playIntent.current = true;
|
|
1618
|
+
setPaused(false);
|
|
1619
|
+
},
|
|
1620
|
+
onPause: () => {
|
|
1621
|
+
setPaused(true);
|
|
1622
|
+
if (!videoRef.current?.ended && mediaState === "ready") playIntent.current = false;
|
|
1623
|
+
},
|
|
1624
|
+
onVolumeChange: () => {
|
|
1625
|
+
if (videoRef.current) {
|
|
1626
|
+
setIsMuted(videoRef.current.muted);
|
|
1627
|
+
setVolume(videoRef.current.volume);
|
|
1628
|
+
}
|
|
1629
|
+
},
|
|
1630
|
+
onEnded: () => advance(),
|
|
1631
|
+
onWaiting: () => setBuffering(true),
|
|
1632
|
+
onStalled: () => setBuffering(true),
|
|
1633
|
+
onCanPlay: () => setBuffering(false),
|
|
1634
|
+
onPlaying: () => setBuffering(false)
|
|
1635
|
+
}
|
|
1636
|
+
),
|
|
1637
|
+
(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") }),
|
|
1638
|
+
!showVideo && /* @__PURE__ */ jsx("div", { className: "p-4", children: fallback }),
|
|
1639
|
+
showVideo && snapshot.total > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t border-[#303236] bg-black p-3", children: [
|
|
1640
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1641
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text(paused ? "play" : "pause"), onClick: () => {
|
|
1642
|
+
const video = videoRef.current;
|
|
1643
|
+
if (video) {
|
|
1644
|
+
if (video.paused) void video.play().catch(() => void 0);
|
|
1645
|
+
else video.pause();
|
|
1646
|
+
}
|
|
1647
|
+
}, children: paused ? /* @__PURE__ */ jsx(Play, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Pause, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1648
|
+
/* @__PURE__ */ jsxs("span", { className: "flex-1 text-xs text-white", "aria-label": text("timeline"), "data-flap-video-time": true, children: [
|
|
1649
|
+
clock(globalTime),
|
|
1650
|
+
" / ",
|
|
1651
|
+
clock(duration)
|
|
1652
|
+
] }),
|
|
1653
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text(isMuted ? "unmute" : "mute"), onClick: () => {
|
|
1654
|
+
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
1655
|
+
}, children: isMuted ? /* @__PURE__ */ jsx(VolumeX, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Volume2, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1656
|
+
/* @__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) => {
|
|
1657
|
+
if (videoRef.current) {
|
|
1658
|
+
videoRef.current.volume = Number(event.target.value);
|
|
1659
|
+
videoRef.current.muted = Number(event.target.value) === 0;
|
|
1660
|
+
}
|
|
1661
|
+
} }),
|
|
1662
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text("fullscreen"), onClick: () => {
|
|
1663
|
+
if (document.fullscreenElement) void document.exitFullscreen().catch(() => void 0);
|
|
1664
|
+
else void frameRef.current?.requestFullscreen?.().catch(() => void 0);
|
|
1665
|
+
}, children: /* @__PURE__ */ jsx(Maximize, { "aria-hidden": "true", className: "h-4 w-4" }) })
|
|
1666
|
+
] }),
|
|
1667
|
+
/* @__PURE__ */ jsx(
|
|
1668
|
+
"input",
|
|
1669
|
+
{
|
|
1670
|
+
type: "range",
|
|
1671
|
+
min: 0,
|
|
1672
|
+
max: duration,
|
|
1673
|
+
step: 0.05,
|
|
1674
|
+
value: globalTime,
|
|
1675
|
+
disabled: state !== "ready",
|
|
1676
|
+
"aria-label": text("timelineSeek"),
|
|
1677
|
+
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1678
|
+
onChange: (event) => {
|
|
1679
|
+
const video = videoRef.current;
|
|
1680
|
+
const play = video ? !video.paused || video.ended && playIntent.current : playIntent.current;
|
|
1681
|
+
void sessionRef.current?.seekTime(Number(event.target.value), play);
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
)
|
|
1685
|
+
] })
|
|
1686
|
+
] }),
|
|
1687
|
+
snapshot.total > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1688
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs text-[#D4D4D4]", children: [
|
|
1689
|
+
/* @__PURE__ */ jsx("span", { role: "status", children: text("position", { index: activeIndex + 1, total: snapshot.total }) }),
|
|
1690
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
1691
|
+
clock(position?.time ?? 0),
|
|
1692
|
+
" / ",
|
|
1693
|
+
clock(position?.duration ?? 0)
|
|
1694
|
+
] })
|
|
1695
|
+
] }),
|
|
1696
|
+
/* @__PURE__ */ jsx(
|
|
1697
|
+
"input",
|
|
1698
|
+
{
|
|
1699
|
+
type: "range",
|
|
1700
|
+
"aria-label": text("time"),
|
|
1701
|
+
min: 0,
|
|
1702
|
+
max: position?.duration ?? 0,
|
|
1703
|
+
step: 0.05,
|
|
1704
|
+
value: position?.time ?? 0,
|
|
1705
|
+
disabled: !position || state !== "ready",
|
|
1706
|
+
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1707
|
+
onChange: (event) => {
|
|
1708
|
+
const video = videoRef.current;
|
|
1709
|
+
const clip = snapshot.clips.find((item) => item.index === activeIndex);
|
|
1710
|
+
if (video && clip) {
|
|
1711
|
+
video.currentTime = Number(clip.startPtsMs - snapshot.mediaStartPtsMs) / 1e3 + Number(event.target.value);
|
|
1712
|
+
setTime(video.currentTime);
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
),
|
|
1717
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
1718
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(0), "aria-label": text("first"), children: [
|
|
1719
|
+
/* @__PURE__ */ jsx(SkipBack, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
1720
|
+
text("first")
|
|
1721
|
+
] }),
|
|
1722
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(activeIndex - 1), "aria-label": text("previous"), children: [
|
|
1723
|
+
/* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
1724
|
+
text("previous")
|
|
1725
|
+
] }),
|
|
1726
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(activeIndex + 1), "aria-label": text("next"), children: [
|
|
1727
|
+
text("next"),
|
|
1728
|
+
/* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
1729
|
+
] }),
|
|
1730
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(-1), "aria-label": text("latest"), children: [
|
|
1731
|
+
text("latest"),
|
|
1732
|
+
/* @__PURE__ */ jsx(SkipForward, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
1733
|
+
] })
|
|
1734
|
+
] }),
|
|
1735
|
+
/* @__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(
|
|
1736
|
+
"button",
|
|
1737
|
+
{
|
|
1738
|
+
type: "button",
|
|
1739
|
+
"aria-label": text("clip", { index: index + 1 }),
|
|
1740
|
+
"aria-pressed": index === activeIndex,
|
|
1741
|
+
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]"),
|
|
1742
|
+
onClick: () => seek(index),
|
|
1743
|
+
children: index + 1
|
|
1744
|
+
},
|
|
1745
|
+
index
|
|
1746
|
+
)) }),
|
|
1747
|
+
/* @__PURE__ */ jsxs("form", { className: "flex flex-wrap items-end gap-2", onSubmit: (event) => {
|
|
1748
|
+
event.preventDefault();
|
|
1749
|
+
if (Number.isSafeInteger(Number(jump)) && Number(jump) >= 1 && Number(jump) <= snapshot.total) seek(Number(jump) - 1);
|
|
1750
|
+
}, children: [
|
|
1751
|
+
/* @__PURE__ */ jsxs("label", { className: "min-w-0 flex-1 space-y-1 text-xs text-[#84888C]", children: [
|
|
1752
|
+
/* @__PURE__ */ jsx("span", { children: text("jump") }),
|
|
1753
|
+
/* @__PURE__ */ jsx(Input, { type: "number", min: 1, max: snapshot.total, step: 1, value: jump, onChange: (event) => setJump(event.target.value) })
|
|
1754
|
+
] }),
|
|
1755
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", variant: "outline", disabled: !Number.isSafeInteger(Number(jump)) || Number(jump) < 1 || Number(jump) > snapshot.total, children: text("go") })
|
|
1756
|
+
] }),
|
|
1757
|
+
snapshot.total > VIDEO_PICKER_PAGE_SIZE && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1758
|
+
/* @__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" }) }),
|
|
1759
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-[#84888C]", children: text("page", { first: first + 1, last: first + count, total: snapshot.total }) }),
|
|
1760
|
+
/* @__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" }) })
|
|
1761
|
+
] })
|
|
1762
|
+
] }),
|
|
1763
|
+
snapshot.refreshFailed && /* @__PURE__ */ jsx("p", { className: "text-sm text-[#FFB35C]", role: "status", children: text("refreshFailed") }),
|
|
1764
|
+
(snapshot.refreshFailed || state === "error" || state === "invalid") && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
1765
|
+
if (snapshot.total) seek(activeIndex);
|
|
1766
|
+
else void sessionRef.current?.refresh(startClip, playIntent.current);
|
|
1767
|
+
}, children: text("retry") })
|
|
1768
|
+
]
|
|
1769
|
+
}
|
|
1614
1770
|
);
|
|
1615
1771
|
}
|
|
1616
|
-
|
|
1617
|
-
// src/ui/VideoSessionPlayer.tsx
|
|
1618
1772
|
function VideoSessionPlayer(props) {
|
|
1619
|
-
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */
|
|
1773
|
+
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */ jsx(ConsumerVideoSessionPlayer, { ...props }) : /* @__PURE__ */ jsx(VideoClipSessionPlayer, { ...props });
|
|
1620
1774
|
}
|
|
1621
1775
|
async function loadMpegts() {
|
|
1622
|
-
return (await import('./mpegts-
|
|
1776
|
+
return (await import('./mpegts-536UQHCG.js')).default;
|
|
1623
1777
|
}
|
|
1624
1778
|
function VideoClipSessionPlayer({ clips, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1625
|
-
const videoRef =
|
|
1626
|
-
const controllerRef =
|
|
1627
|
-
const [state, setState] =
|
|
1628
|
-
|
|
1779
|
+
const videoRef = React9.useRef(null);
|
|
1780
|
+
const controllerRef = React9.useRef(null);
|
|
1781
|
+
const [state, setState] = React9.useState("loading");
|
|
1782
|
+
React9.useEffect(() => {
|
|
1629
1783
|
if (!videoRef.current) return;
|
|
1630
1784
|
const controller = new VideoSessionController(videoRef.current, loadMpegts, setState);
|
|
1631
1785
|
controllerRef.current = controller;
|
|
@@ -1634,26 +1788,29 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
|
|
|
1634
1788
|
controllerRef.current = null;
|
|
1635
1789
|
};
|
|
1636
1790
|
}, []);
|
|
1637
|
-
|
|
1791
|
+
React9.useEffect(() => {
|
|
1638
1792
|
void controllerRef.current?.update(clips, autoPlay);
|
|
1639
1793
|
}, [clips, autoPlay]);
|
|
1640
1794
|
const showVideo = state === "loading" || state === "ready";
|
|
1641
|
-
return /* @__PURE__ */
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1795
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), "data-flap-video-session-state": state, children: [
|
|
1796
|
+
/* @__PURE__ */ jsx(
|
|
1797
|
+
"video",
|
|
1798
|
+
{
|
|
1799
|
+
ref: videoRef,
|
|
1800
|
+
"aria-label": label,
|
|
1801
|
+
className: showVideo ? "block w-full" : "hidden",
|
|
1802
|
+
controls: true,
|
|
1803
|
+
playsInline: true,
|
|
1804
|
+
disablePictureInPicture: true,
|
|
1805
|
+
disableRemotePlayback: true,
|
|
1806
|
+
preload: "metadata",
|
|
1807
|
+
muted
|
|
1808
|
+
}
|
|
1809
|
+
),
|
|
1810
|
+
!showVideo && fallback
|
|
1811
|
+
] });
|
|
1655
1812
|
}
|
|
1656
1813
|
|
|
1657
|
-
export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage,
|
|
1658
|
-
//# sourceMappingURL=chunk-
|
|
1659
|
-
//# sourceMappingURL=chunk-
|
|
1814
|
+
export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage, IpfsText, Metric, NftMetadataImage, ReviewedFrame, RuntimeContext, StatusBadge, TxButton, VaultBanner, VideoSessionPlayer, VideoSessionReadError, buttonVariants, createConsumerVideoSessionReader, readVideoSessionLength, readVideoSessionSlice, useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext };
|
|
1815
|
+
//# sourceMappingURL=chunk-3X2K7YYU.js.map
|
|
1816
|
+
//# sourceMappingURL=chunk-3X2K7YYU.js.map
|