@flapsdk/vault-runtime 0.1.37 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +13 -2
  2. package/{chunk-HYBZWS6U.js → chunk-DY34U27M.js} +90 -252
  3. package/chunk-DY34U27M.js.map +1 -0
  4. package/{chunk-22KTLOYH.js → chunk-FWYBGHBX.js} +17 -4
  5. package/chunk-FWYBGHBX.js.map +1 -0
  6. package/chunk-GY7YY67I.js +78 -0
  7. package/chunk-GY7YY67I.js.map +1 -0
  8. package/{chunk-SDCB3RJS.js → chunk-JJJSK6HF.js} +3 -3
  9. package/{chunk-SDCB3RJS.js.map → chunk-JJJSK6HF.js.map} +1 -1
  10. package/{chunk-3X2K7YYU.js → chunk-NWBIKFHH.js} +218 -76
  11. package/chunk-NWBIKFHH.js.map +1 -0
  12. package/chunk-QS475ZC7.js +583 -0
  13. package/chunk-QS475ZC7.js.map +1 -0
  14. package/{chunk-SRZFHGSO.js → chunk-WN4MIMCY.js} +3 -3
  15. package/{chunk-SRZFHGSO.js.map → chunk-WN4MIMCY.js.map} +1 -1
  16. package/host-client.d.mts +9 -2
  17. package/host-client.js +5 -6
  18. package/host.d.mts +5 -5
  19. package/host.js +7 -7
  20. package/{hostRuntimeConfig-DM6JjbeO.d.mts → hostRuntimeConfig-CKjug1-9.d.mts} +1 -1
  21. package/{mpegts-536UQHCG.js → mpegts-J2J6JTD7.js} +6 -6
  22. package/{mpegts-536UQHCG.js.map → mpegts-J2J6JTD7.js.map} +1 -1
  23. package/package.json +4 -3
  24. package/runtime-contract.json +5 -1
  25. package/sdk.d.mts +42 -4
  26. package/sdk.js +41 -9
  27. package/sdk.js.map +1 -1
  28. package/server.d.mts +3 -3
  29. package/server.js +4 -5
  30. package/server.js.map +1 -1
  31. package/{txError-vvvBIsa-.d.mts → txError-BTuW38It.d.mts} +15 -2
  32. package/{types-cyAEoeXa.d.mts → types-BolUPLIE.d.mts} +101 -2
  33. package/ui.d.mts +13 -2
  34. package/ui.js +2 -3
  35. package/chunk-22KTLOYH.js.map +0 -1
  36. package/chunk-27VBKY3J.js +0 -36
  37. package/chunk-27VBKY3J.js.map +0 -1
  38. package/chunk-3X2K7YYU.js.map +0 -1
  39. package/chunk-AGLB72HK.js +0 -61
  40. package/chunk-AGLB72HK.js.map +0 -1
  41. package/chunk-FUOBTZMQ.js +0 -47
  42. package/chunk-FUOBTZMQ.js.map +0 -1
  43. package/chunk-HYBZWS6U.js.map +0 -1
@@ -1,9 +1,8 @@
1
1
  import { shortenAddress, isValidAddress, ZERO_ADDRESS } from './chunk-B4WKI3EW.js';
2
- import { isIpfsImageCid, resolveIpfsImageUrls, resolveIpfsImageUrl } from './chunk-27VBKY3J.js';
3
- import { getTaxVaultHostChainConfig } from './chunk-FUOBTZMQ.js';
4
- import * as React9 from 'react';
2
+ import { isIpfsImageCid, resolveIpfsImageUrls, getTaxVaultHostChainConfig, resolveIpfsImageUrl } from './chunk-GY7YY67I.js';
3
+ import * as React10 from 'react';
5
4
  import { createContext, useContext, useState, useEffect, useMemo, createElement } from 'react';
6
- import { Loader2, ExternalLink, AlertTriangle, CheckCircle2, Info, X, ShieldCheck, Play, Pause, VolumeX, Volume2, Maximize, SkipBack, ChevronLeft, ChevronRight, SkipForward } from 'lucide-react';
5
+ import { Loader2, ExternalLink, AlertTriangle, CheckCircle2, Info, Check, AlertCircle, Copy, X, ShieldCheck, Play, Pause, VolumeX, Volume2, Maximize, SkipBack, ChevronLeft, ChevronRight, SkipForward } from 'lucide-react';
7
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
7
  import { clsx } from 'clsx';
9
8
  import { twMerge } from 'tailwind-merge';
@@ -11,6 +10,45 @@ import { Slot } from '@radix-ui/react-slot';
11
10
  import { cva } from 'class-variance-authority';
12
11
  import { createPortal } from 'react-dom';
13
12
 
13
+ var RuntimeContext = createContext(null);
14
+ var MiniAppContext = createContext(null);
15
+ function useFlapSdk(options) {
16
+ const vault = useContext(RuntimeContext);
17
+ const app = useContext(MiniAppContext);
18
+ if (options) {
19
+ const runtime = app ?? vault;
20
+ if (!runtime) throw new Error("useFlapSdk requires a Flap runtime provider.");
21
+ return runtime.forChain(options.chainId);
22
+ }
23
+ if (vault && !app) return vault;
24
+ if (app) throw new Error("Independent Apps must select a network: useFlapSdk({ chainId }).");
25
+ throw new Error("useFlapSdk requires a Flap runtime provider.");
26
+ }
27
+ function useVaultContext() {
28
+ return useFlapSdk().context;
29
+ }
30
+ function useFlapI18n() {
31
+ const vault = useContext(RuntimeContext);
32
+ const app = useContext(MiniAppContext);
33
+ const runtime = app ?? vault;
34
+ if (!runtime) throw new Error("A Flap runtime provider is required.");
35
+ return runtime.i18n;
36
+ }
37
+ function useFlapNotify() {
38
+ const vault = useContext(RuntimeContext);
39
+ const app = useContext(MiniAppContext);
40
+ const runtime = app ?? vault;
41
+ if (!runtime) throw new Error("A Flap runtime provider is required.");
42
+ return runtime.notify;
43
+ }
44
+ function useFlapIpfsTextReader() {
45
+ const vault = useContext(RuntimeContext);
46
+ const app = useContext(MiniAppContext);
47
+ const runtime = app ?? vault;
48
+ if (!runtime) throw new Error("IPFS content requires a Flap runtime provider.");
49
+ return runtime.readIpfsText;
50
+ }
51
+
14
52
  // src/sdk/videoSession.ts
15
53
  var videoProviderAbi = [
16
54
  { type: "function", name: "getVideoSessionLength", stateMutability: "view", inputs: [{ name: "user", type: "address" }], outputs: [{ type: "uint256" }] },
@@ -66,21 +104,6 @@ async function readVideoSessionSlice(sdk, consumer, start, count) {
66
104
  function createConsumerVideoSessionReader(sdk, consumer) {
67
105
  return { readLength: () => readVideoSessionLength(sdk, consumer), readSlice: (start, count) => readVideoSessionSlice(sdk, consumer, start, count) };
68
106
  }
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
- }
84
107
  function AddressLink({ address, explorerBaseUrl, label }) {
85
108
  if (!address) return /* @__PURE__ */ jsx("span", { children: "-" });
86
109
  const href = explorerBaseUrl ? `${explorerBaseUrl.replace(/\/$/, "")}/address/${address}` : void 0;
@@ -136,7 +159,7 @@ var buttonVariants = cva(
136
159
  }
137
160
  }
138
161
  );
139
- var Button = React9.forwardRef(
162
+ var Button = React10.forwardRef(
140
163
  ({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
141
164
  const Comp = asChild ? Slot : "button";
142
165
  if (asChild) {
@@ -178,8 +201,8 @@ function normalizeBinanceImageUrl(value) {
178
201
  }
179
202
  }
180
203
  function BinanceImage({ alt, src, fallback = null, className, onError, ...props }) {
181
- const safeSrc = React9.useMemo(() => normalizeBinanceImageUrl(src), [src]);
182
- const [failedSrc, setFailedSrc] = React9.useState(null);
204
+ const safeSrc = React10.useMemo(() => normalizeBinanceImageUrl(src), [src]);
205
+ const [failedSrc, setFailedSrc] = React10.useState(null);
183
206
  const {
184
207
  alt: _unsafeAlt,
185
208
  decoding: _unsafeDecoding,
@@ -213,7 +236,7 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
213
236
  )
214
237
  );
215
238
  }
216
- var Card = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
239
+ var Card = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
217
240
  "div",
218
241
  {
219
242
  "data-flap-ui": "card",
@@ -226,19 +249,19 @@ var Card = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ j
226
249
  }
227
250
  ));
228
251
  Card.displayName = "Card";
229
- var CardHeader = React9.forwardRef(
252
+ var CardHeader = React10.forwardRef(
230
253
  ({ 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 })
231
254
  );
232
255
  CardHeader.displayName = "CardHeader";
233
- var CardTitle = React9.forwardRef(
256
+ var CardTitle = React10.forwardRef(
234
257
  ({ 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 })
235
258
  );
236
259
  CardTitle.displayName = "CardTitle";
237
- var CardDescription = React9.forwardRef(
260
+ var CardDescription = React10.forwardRef(
238
261
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { "data-flap-ui": "card-description", ref, className: cn("text-sm leading-6 text-[#84888C]", className), ...props })
239
262
  );
240
263
  CardDescription.displayName = "CardDescription";
241
- var CardContent = React9.forwardRef(
264
+ var CardContent = React10.forwardRef(
242
265
  ({ 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 })
243
266
  );
244
267
  CardContent.displayName = "CardContent";
@@ -265,6 +288,125 @@ function Countdown({ targetTimeMs, fallback = "-" }) {
265
288
  }, [fallback, now, targetTimeMs]);
266
289
  return /* @__PURE__ */ jsx("span", { children: text });
267
290
  }
291
+
292
+ // src/ui/copyButtonMessages.ts
293
+ var copyButtonMessages = {
294
+ en: { copy: "Copy", copying: "Copying\u2026", copied: "Copied", failed: "Could not copy. Select the text and copy it manually." },
295
+ zh: { copy: "\u590D\u5236", copying: "\u6B63\u5728\u590D\u5236\u2026", copied: "\u5DF2\u590D\u5236", failed: "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u4E2D\u6587\u672C\u540E\u624B\u52A8\u590D\u5236\u3002" },
296
+ ko: { copy: "\uBCF5\uC0AC", copying: "\uBCF5\uC0AC \uC911\u2026", copied: "\uBCF5\uC0AC\uB428", failed: "\uBCF5\uC0AC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uD14D\uC2A4\uD2B8\uB97C \uC120\uD0DD\uD558\uC5EC \uC9C1\uC811 \uBCF5\uC0AC\uD574 \uC8FC\uC138\uC694." }
297
+ };
298
+ function getCopyButtonMessages(locale) {
299
+ const language = locale.toLowerCase().split(/[-_]/)[0];
300
+ return copyButtonMessages[language === "zh" || language === "ko" ? language : "en"];
301
+ }
302
+
303
+ // src/ui/copyText.ts
304
+ var MAX_COPY_TEXT_LENGTH = 1048576;
305
+ function isCopyableText(value) {
306
+ return typeof value === "string" && value.length <= MAX_COPY_TEXT_LENGTH && value.trim().length > 0 && !value.includes("\0");
307
+ }
308
+ async function writeCopyText(value) {
309
+ if (!isCopyableText(value) || typeof document === "undefined") return false;
310
+ if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
311
+ try {
312
+ await navigator.clipboard.writeText(value);
313
+ return true;
314
+ } catch {
315
+ }
316
+ }
317
+ const parent = document.fullscreenElement ?? document.body;
318
+ if (!parent || typeof document.execCommand !== "function") return false;
319
+ const active = document.activeElement;
320
+ const selection = document.getSelection();
321
+ const ranges = selection ? Array.from({ length: selection.rangeCount }, (_, i) => selection.getRangeAt(i).cloneRange()) : [];
322
+ const input = document.createElement("textarea");
323
+ input.value = value;
324
+ input.readOnly = true;
325
+ input.setAttribute("aria-hidden", "true");
326
+ Object.assign(input.style, { position: "fixed", left: "0", top: "0", width: "1px", height: "1px", opacity: "0", fontSize: "16px" });
327
+ parent.appendChild(input);
328
+ try {
329
+ input.focus({ preventScroll: true });
330
+ input.select();
331
+ input.setSelectionRange(0, value.length);
332
+ return document.execCommand("copy");
333
+ } catch {
334
+ return false;
335
+ } finally {
336
+ input.remove();
337
+ if (active instanceof HTMLElement && active.isConnected) active.focus({ preventScroll: true });
338
+ if (selection && ranges.length) {
339
+ selection.removeAllRanges();
340
+ for (const range of ranges) selection.addRange(range);
341
+ }
342
+ }
343
+ }
344
+ function CopyButton({ value, label, disabled = false, className }) {
345
+ const i18n = useFlapI18n();
346
+ const notify = useFlapNotify();
347
+ const defaults = getCopyButtonMessages(i18n.locale);
348
+ const text = Object.fromEntries(Object.entries(defaults).map(([key, fallback]) => [key, i18n.t(`flap.copy.${key}`, fallback)]));
349
+ const [result, setResult] = React10.useState({ value, status: "idle" });
350
+ const pending = React10.useRef(false);
351
+ const mounted = React10.useRef(false);
352
+ const timer = React10.useRef(void 0);
353
+ React10.useEffect(() => {
354
+ mounted.current = true;
355
+ return () => {
356
+ mounted.current = false;
357
+ clearTimeout(timer.current);
358
+ };
359
+ }, []);
360
+ const status = result.value === value ? result.status : "idle";
361
+ const accessibleLabel = status === "idle" ? label || text.copy : text[status === "failed" ? "failed" : status];
362
+ async function copy(event) {
363
+ event.preventDefault();
364
+ event.stopPropagation();
365
+ if (!(event.nativeEvent instanceof MouseEvent) || !event.nativeEvent.isTrusted || disabled || pending.current || !isCopyableText(value)) return;
366
+ pending.current = true;
367
+ clearTimeout(timer.current);
368
+ setResult({ value, status: "copying" });
369
+ let copied = false;
370
+ try {
371
+ copied = await writeCopyText(value);
372
+ } catch {
373
+ }
374
+ pending.current = false;
375
+ if (!mounted.current) return;
376
+ setResult({ value, status: copied ? "copied" : "failed" });
377
+ try {
378
+ if (copied) notify.success(text.copied);
379
+ else notify.error(text.failed);
380
+ } catch {
381
+ }
382
+ timer.current = setTimeout(() => {
383
+ if (mounted.current) setResult({ value, status: "idle" });
384
+ }, 2e3);
385
+ }
386
+ const Icon = status === "copying" ? Loader2 : status === "copied" ? Check : status === "failed" ? AlertCircle : Copy;
387
+ return /* @__PURE__ */ jsxs(
388
+ Button,
389
+ {
390
+ type: "button",
391
+ variant: "ghost",
392
+ size: label ? "sm" : "icon",
393
+ className: cn(!label && "h-8 w-8", className),
394
+ disabled: disabled || !isCopyableText(value),
395
+ "aria-disabled": disabled || pending.current || !isCopyableText(value),
396
+ "aria-label": accessibleLabel,
397
+ "aria-busy": status === "copying",
398
+ title: accessibleLabel,
399
+ onClick: copy,
400
+ "data-flap-ui": "copy-button",
401
+ "data-flap-copy-state": status,
402
+ children: [
403
+ /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", className: cn("h-4 w-4 shrink-0", status === "copying" && "animate-spin") }),
404
+ label ? /* @__PURE__ */ jsx("span", { children: status === "copied" ? text.copied : label }) : null,
405
+ /* @__PURE__ */ jsx("span", { className: "sr-only", role: "status", "aria-live": "polite", children: status === "idle" ? "" : accessibleLabel })
406
+ ]
407
+ }
408
+ );
409
+ }
268
410
  function DataRow({ label, value, detail, className }) {
269
411
  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
412
  /* @__PURE__ */ jsx("div", { className: "min-w-0 text-sm text-white/54", children: label }),
@@ -363,20 +505,20 @@ function WarningIcon({ className }) {
363
505
  ] });
364
506
  }
365
507
  function ExternalLink2({ url, children, locale, className, copy }) {
366
- const [open, setOpen] = React9.useState(false);
367
- const [acknowledged, setAcknowledged] = React9.useState(false);
368
- const [mounted, setMounted] = React9.useState(false);
508
+ const [open, setOpen] = React10.useState(false);
509
+ const [acknowledged, setAcknowledged] = React10.useState(false);
510
+ const [mounted, setMounted] = React10.useState(false);
369
511
  const text = { ...COPY[resolveLocale(locale)], ...copy };
370
- const safeUrl = React9.useMemo(() => normalizeExternalUrl(url), [url]);
512
+ const safeUrl = React10.useMemo(() => normalizeExternalUrl(url), [url]);
371
513
  const canProceed = acknowledged && Boolean(safeUrl);
372
- React9.useEffect(() => {
514
+ React10.useEffect(() => {
373
515
  setMounted(true);
374
516
  }, []);
375
- const close = React9.useCallback(() => {
517
+ const close = React10.useCallback(() => {
376
518
  setOpen(false);
377
519
  setAcknowledged(false);
378
520
  }, []);
379
- React9.useEffect(() => {
521
+ React10.useEffect(() => {
380
522
  if (!open) return;
381
523
  const onKey = (event) => {
382
524
  if (event.key === "Escape") close();
@@ -526,7 +668,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
526
668
  ) : null
527
669
  ] });
528
670
  }
529
- var Input = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
671
+ var Input = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
530
672
  "input",
531
673
  {
532
674
  "data-flap-ui": "input",
@@ -540,9 +682,9 @@ var Input = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
540
682
  ));
541
683
  Input.displayName = "Input";
542
684
  function IpfsImage({ alt, cid, path, validationPath, className, decoding = "async", loading = "lazy", onError, ...props }) {
543
- const urls = React9.useMemo(() => resolveIpfsImageUrls(cid, 56, path), [cid, path]);
685
+ const urls = React10.useMemo(() => resolveIpfsImageUrls(cid, 56, path), [cid, path]);
544
686
  const resourceKey = urls.join("\n");
545
- const [fallbackState, setFallbackState] = React9.useState({ key: resourceKey, index: 0 });
687
+ const [fallbackState, setFallbackState] = React10.useState({ key: resourceKey, index: 0 });
546
688
  const urlIndex = fallbackState.key === resourceKey ? fallbackState.index : 0;
547
689
  const src = urls[urlIndex];
548
690
  const { src: ignoredSrc, srcSet: ignoredSrcSet, dangerouslySetInnerHTML: ignoredHtml, ...safeProps } = props;
@@ -578,10 +720,10 @@ function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...p
578
720
  ] });
579
721
  }
580
722
  function IpfsText({ cid, path, fallback = null, className, ...props }) {
581
- const { readIpfsText } = useFlapSdk();
723
+ const readIpfsText = useFlapIpfsTextReader();
582
724
  const key = JSON.stringify([typeof cid === "string" ? cid : null, typeof path === "string" ? path : null]);
583
- const [result, setResult] = React9.useState();
584
- React9.useEffect(() => {
725
+ const [result, setResult] = React10.useState();
726
+ React10.useEffect(() => {
585
727
  let cancelled = false;
586
728
  readIpfsText(cid, path).then(
587
729
  (text) => {
@@ -601,9 +743,9 @@ function IpfsText({ cid, path, fallback = null, className, ...props }) {
601
743
  }
602
744
  function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding = "async", loading = "lazy", onError, ...props }) {
603
745
  const sdk = useFlapSdk();
604
- const [metadata, setMetadata] = React9.useState(null);
605
- const [state, setState] = React9.useState("loading");
606
- React9.useEffect(() => {
746
+ const [metadata, setMetadata] = React10.useState(null);
747
+ const [state, setState] = React10.useState("loading");
748
+ React10.useEffect(() => {
607
749
  let cancelled = false;
608
750
  setState("loading");
609
751
  setMetadata(null);
@@ -1463,38 +1605,38 @@ var clock = (seconds) => `${Math.floor(seconds / 60)}:${Math.floor(seconds % 60)
1463
1605
  function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback = null, className, autoPlay = false, muted = false }) {
1464
1606
  const sdk = useFlapSdk();
1465
1607
  const { chainId } = sdk.context;
1466
- const readContractRef = React9.useRef(sdk.readContract);
1608
+ const readContractRef = React10.useRef(sdk.readContract);
1467
1609
  readContractRef.current = sdk.readContract;
1468
- const reader = React9.useMemo(() => createConsumerVideoSessionReader({
1610
+ const reader = React10.useMemo(() => createConsumerVideoSessionReader({
1469
1611
  context: { chainId },
1470
1612
  readContract: (request) => readContractRef.current(request)
1471
1613
  }, consumer), [chainId, consumer]);
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);
1614
+ const sessionRef = React10.useRef(null);
1615
+ const controllerRef = React10.useRef(null);
1616
+ const videoRef = React10.useRef(null);
1617
+ const frameRef = React10.useRef(null);
1618
+ const playIntent = React10.useRef(autoPlay);
1619
+ const autoPlayRef = React10.useRef(autoPlay);
1478
1620
  autoPlayRef.current = autoPlay;
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(() => {
1621
+ const [snapshot, setSnapshot] = React10.useState(initialSnapshot);
1622
+ const [mediaState, setMediaState] = React10.useState("loading");
1623
+ const [time, setTime] = React10.useState(0);
1624
+ const [paused, setPaused] = React10.useState(true);
1625
+ const [isMuted, setIsMuted] = React10.useState(muted);
1626
+ const [volume, setVolume] = React10.useState(1);
1627
+ React10.useEffect(() => {
1486
1628
  setIsMuted(muted);
1487
1629
  }, [muted]);
1488
- const [buffering, setBuffering] = React9.useState(false);
1489
- const [page, setPage] = React9.useState(0);
1490
- const [jump, setJump] = React9.useState("");
1630
+ const [buffering, setBuffering] = React10.useState(false);
1631
+ const [page, setPage] = React10.useState(0);
1632
+ const [jump, setJump] = React10.useState("");
1491
1633
  const position = videoClipPosition(snapshot.clips, time, snapshot.mediaStartPtsMs);
1492
1634
  const duration = Number(snapshot.endPtsMs - snapshot.firstPtsMs) / 1e3;
1493
1635
  const globalTime = Math.max(0, Math.min(duration, Number(snapshot.mediaStartPtsMs - snapshot.firstPtsMs) / 1e3 + time));
1494
1636
  const activeIndex = position?.index ?? snapshot.start;
1495
1637
  const strings = videoPlayerMessages[sdk.i18n.locale.split("-")[0]] ?? videoPlayerMessages.en;
1496
1638
  const text = (key, params) => sdk.i18n.t(`runtime.video.${key}`, strings[key], params);
1497
- React9.useEffect(() => {
1639
+ React10.useEffect(() => {
1498
1640
  const session = new ConsumerVideoSession(reader, setSnapshot);
1499
1641
  sessionRef.current = session;
1500
1642
  setSnapshot(initialSnapshot);
@@ -1511,16 +1653,16 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
1511
1653
  sessionRef.current = null;
1512
1654
  };
1513
1655
  }, [reader, startClip]);
1514
- React9.useEffect(() => {
1656
+ React10.useEffect(() => {
1515
1657
  if (!videoRef.current) return;
1516
- const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-536UQHCG.js')).default, setMediaState);
1658
+ const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-J2J6JTD7.js')).default, setMediaState);
1517
1659
  controllerRef.current = controller;
1518
1660
  return () => {
1519
1661
  controller.dispose();
1520
1662
  controllerRef.current = null;
1521
1663
  };
1522
1664
  }, []);
1523
- React9.useEffect(() => {
1665
+ React10.useEffect(() => {
1524
1666
  const controller = controllerRef.current;
1525
1667
  const session = sessionRef.current;
1526
1668
  if (!controller || !session) return;
@@ -1539,7 +1681,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
1539
1681
  playIntent: () => playIntent.current
1540
1682
  }, snapshot.play, snapshot.resumeAt);
1541
1683
  }, [snapshot.sessionId, snapshot.revision, snapshot.state]);
1542
- React9.useEffect(() => {
1684
+ React10.useEffect(() => {
1543
1685
  setPage(Math.floor(activeIndex / VIDEO_PICKER_PAGE_SIZE));
1544
1686
  }, [activeIndex]);
1545
1687
  const advance = () => {
@@ -1549,7 +1691,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
1549
1691
  void sessionRef.current?.advance(current.index);
1550
1692
  }
1551
1693
  };
1552
- React9.useEffect(() => {
1694
+ React10.useEffect(() => {
1553
1695
  const video = videoRef.current;
1554
1696
  const current = videoClipPosition(snapshot.clips, video?.currentTime ?? 0, snapshot.mediaStartPtsMs);
1555
1697
  if (video && current && (current.index >= snapshot.start + snapshot.clips.length - 2 || video.ended)) void sessionRef.current?.advance(current.index);
@@ -1773,13 +1915,13 @@ function VideoSessionPlayer(props) {
1773
1915
  return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */ jsx(ConsumerVideoSessionPlayer, { ...props }) : /* @__PURE__ */ jsx(VideoClipSessionPlayer, { ...props });
1774
1916
  }
1775
1917
  async function loadMpegts() {
1776
- return (await import('./mpegts-536UQHCG.js')).default;
1918
+ return (await import('./mpegts-J2J6JTD7.js')).default;
1777
1919
  }
1778
1920
  function VideoClipSessionPlayer({ clips, label, fallback = null, className, autoPlay = false, muted = false }) {
1779
- const videoRef = React9.useRef(null);
1780
- const controllerRef = React9.useRef(null);
1781
- const [state, setState] = React9.useState("loading");
1782
- React9.useEffect(() => {
1921
+ const videoRef = React10.useRef(null);
1922
+ const controllerRef = React10.useRef(null);
1923
+ const [state, setState] = React10.useState("loading");
1924
+ React10.useEffect(() => {
1783
1925
  if (!videoRef.current) return;
1784
1926
  const controller = new VideoSessionController(videoRef.current, loadMpegts, setState);
1785
1927
  controllerRef.current = controller;
@@ -1788,7 +1930,7 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
1788
1930
  controllerRef.current = null;
1789
1931
  };
1790
1932
  }, []);
1791
- React9.useEffect(() => {
1933
+ React10.useEffect(() => {
1792
1934
  void controllerRef.current?.update(clips, autoPlay);
1793
1935
  }, [clips, autoPlay]);
1794
1936
  const showVideo = state === "loading" || state === "ready";
@@ -1811,6 +1953,6 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
1811
1953
  ] });
1812
1954
  }
1813
1955
 
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
1956
+ export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, CopyButton, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage, IpfsText, Metric, MiniAppContext, NftMetadataImage, ReviewedFrame, RuntimeContext, StatusBadge, TxButton, VaultBanner, VideoSessionPlayer, VideoSessionReadError, buttonVariants, createConsumerVideoSessionReader, readVideoSessionLength, readVideoSessionSlice, useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext };
1957
+ //# sourceMappingURL=chunk-NWBIKFHH.js.map
1958
+ //# sourceMappingURL=chunk-NWBIKFHH.js.map