@linktr.ee/messaging-react 1.26.1 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Creator-B6M8dB0U.js +87 -0
- package/dist/Creator-B6M8dB0U.js.map +1 -0
- package/dist/MediaPlayer-DsjlYGGH.js +539 -0
- package/dist/MediaPlayer-DsjlYGGH.js.map +1 -0
- package/dist/Preview-DqAv16NS.js +87 -0
- package/dist/Preview-DqAv16NS.js.map +1 -0
- package/dist/Visitor-CpmFZRGO.js +175 -0
- package/dist/Visitor-CpmFZRGO.js.map +1 -0
- package/dist/dash.all.min-Duv4lvGS.js +18858 -0
- package/dist/dash.all.min-Duv4lvGS.js.map +1 -0
- package/dist/hls-Bogc7CBn.js +21710 -0
- package/dist/hls-Bogc7CBn.js.map +1 -0
- package/dist/index-Da-xN4Yq.js +16142 -0
- package/dist/index-Da-xN4Yq.js.map +1 -0
- package/dist/index-Dj9rqWcU.js +69 -0
- package/dist/index-Dj9rqWcU.js.map +1 -0
- package/dist/index.d.ts +73 -10
- package/dist/index.js +979 -934
- package/dist/index.js.map +1 -1
- package/dist/mixin-B6jYfIcp.js +808 -0
- package/dist/mixin-B6jYfIcp.js.map +1 -0
- package/dist/react-BxlQMOfz.js +419 -0
- package/dist/react-BxlQMOfz.js.map +1 -0
- package/dist/react-COAP-MIW.js +377 -0
- package/dist/react-COAP-MIW.js.map +1 -0
- package/dist/react-Cn4WlMcl.js +3108 -0
- package/dist/react-Cn4WlMcl.js.map +1 -0
- package/dist/react-CwTJArKY.js +459 -0
- package/dist/react-CwTJArKY.js.map +1 -0
- package/dist/react-DkfS_atT.js +373 -0
- package/dist/react-DkfS_atT.js.map +1 -0
- package/dist/react-Pea5fum1.js +286 -0
- package/dist/react-Pea5fum1.js.map +1 -0
- package/dist/react-RiBbsUDd.js +534 -0
- package/dist/react-RiBbsUDd.js.map +1 -0
- package/dist/react-dS1WBxxz.js +238 -0
- package/dist/react-dS1WBxxz.js.map +1 -0
- package/package.json +2 -1
- package/src/components/ChannelView.tsx +12 -2
- package/src/components/CustomMessage/CustomMessage.stories.tsx +173 -41
- package/src/components/CustomMessage/MessageTag.tsx +5 -0
- package/src/components/CustomMessage/index.tsx +43 -4
- package/src/components/LockedAttachment/LockedAttachment.stories.tsx +249 -0
- package/src/components/LockedAttachment/components/Creator.tsx +171 -0
- package/src/components/LockedAttachment/components/MediaPlayer.tsx +299 -0
- package/src/components/LockedAttachment/components/Visitor.tsx +293 -0
- package/src/components/LockedAttachment/index.tsx +39 -0
- package/src/components/LockedAttachment/types.ts +18 -0
- package/src/components/LockedAttachment/utils/icons.ts +52 -0
- package/src/components/LockedAttachment/utils/mimeType.test.ts +97 -0
- package/src/components/LockedAttachment/utils/mimeType.ts +35 -0
- package/src/components/ParticipantPicker/index.tsx +8 -1
- package/src/hooks/useParticipants.ts +3 -2
- package/src/index.ts +4 -0
- package/src/stories/decorators/storyUser.tsx +37 -0
- package/src/stream-custom-data.ts +9 -3
- package/src/types.ts +21 -1
- package/src/utils/isDevBuild.ts +10 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { CheckCircleIcon as N, EyeSlashIcon as v, EyeIcon as k } from "@phosphor-icons/react";
|
|
3
|
+
import o from "classnames";
|
|
4
|
+
import { useState as w } from "react";
|
|
5
|
+
import { g as C, r as f, M as _ } from "./MediaPlayer-DsjlYGGH.js";
|
|
6
|
+
const b = ({ onClose: a }) => /* @__PURE__ */ e(
|
|
7
|
+
"button",
|
|
8
|
+
{
|
|
9
|
+
type: "button",
|
|
10
|
+
onClick: a,
|
|
11
|
+
className: "absolute right-3 top-3 z-40 flex size-8 items-center justify-center rounded-full bg-black/60 text-white",
|
|
12
|
+
"aria-label": "Close preview",
|
|
13
|
+
children: /* @__PURE__ */ e(k, { className: "size-4", weight: "fill" })
|
|
14
|
+
}
|
|
15
|
+
), y = ({ thumbnail: a, mimeType: s, canExpand: t, onExpand: l }) => /* @__PURE__ */ n(
|
|
16
|
+
"button",
|
|
17
|
+
{
|
|
18
|
+
type: "button",
|
|
19
|
+
disabled: !t,
|
|
20
|
+
className: o("relative aspect-video block w-full overflow-hidden border-0 bg-black/5 p-0 text-left appearance-none", { "cursor-pointer": t, "cursor-default": !t }),
|
|
21
|
+
onClick: l,
|
|
22
|
+
"aria-label": t ? "Expand attachment preview" : void 0,
|
|
23
|
+
children: [
|
|
24
|
+
a ? /* @__PURE__ */ e("img", { src: a, alt: "", className: "absolute inset-0 h-full w-full object-cover" }) : /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: f(s, { className: "size-12 text-black/20", weight: "regular" }) }),
|
|
25
|
+
t && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute right-3 top-3 flex size-8 items-center justify-center rounded-full bg-black/60 text-white", children: /* @__PURE__ */ e(v, { className: "size-4", weight: "fill" }) })
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
), z = (a, s, t, l) => a === "document" ? t ?? l : s, j = ({ source: a, mimeType: s, sourceType: t, poster: l, thumbnail: c, title: i, onCollapse: r }) => {
|
|
29
|
+
if (t === "video" || t === "audio")
|
|
30
|
+
return /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
31
|
+
/* @__PURE__ */ e(
|
|
32
|
+
_,
|
|
33
|
+
{
|
|
34
|
+
source: a,
|
|
35
|
+
mimeType: s,
|
|
36
|
+
poster: l ?? c,
|
|
37
|
+
autoPlay: !0,
|
|
38
|
+
loop: !0,
|
|
39
|
+
controls: !1,
|
|
40
|
+
showProgress: !0,
|
|
41
|
+
onContainerClick: r,
|
|
42
|
+
muted: t === "video"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ e(b, { onClose: r })
|
|
46
|
+
] });
|
|
47
|
+
const d = z(t, a, l, c);
|
|
48
|
+
return /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
49
|
+
/* @__PURE__ */ e("button", { type: "button", className: "block w-full cursor-pointer border-0 p-0 text-left appearance-none", onClick: r, "aria-label": "Close preview", children: /* @__PURE__ */ e("img", { src: d, alt: i ?? "", className: "block w-full" }) }),
|
|
50
|
+
/* @__PURE__ */ e(b, { onClose: r })
|
|
51
|
+
] });
|
|
52
|
+
}, E = ({ title: a, placeholderTitle: s, mimeType: t, detail: l, paymentStatus: c, displayAmountText: i, isPlaceholderAmount: r }) => /* @__PURE__ */ n("div", { className: "px-4 pb-3 pt-3", children: [
|
|
53
|
+
/* @__PURE__ */ e("p", { className: o("mb-1.5 truncate text-base font-medium", { "text-black/30": !a, "text-black": !!a }), children: a || s }),
|
|
54
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
|
|
55
|
+
f(t, { className: "size-5 shrink-0 text-black/55", weight: "regular" }),
|
|
56
|
+
l && /* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: l }),
|
|
57
|
+
c === "paid" ? /* @__PURE__ */ n(u, { children: [
|
|
58
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-medium text-black/55", children: "•" }),
|
|
59
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-medium text-[#008236]", children: "Purchased" }),
|
|
60
|
+
/* @__PURE__ */ e(N, { className: "size-4 text-[#008236]", weight: "bold" })
|
|
61
|
+
] }) : i && /* @__PURE__ */ n(u, { children: [
|
|
62
|
+
/* @__PURE__ */ e("span", { className: o("text-xs font-medium", { "text-black/30": r, "text-black/55": !r }), children: "•" }),
|
|
63
|
+
/* @__PURE__ */ e("span", { className: o("text-xs font-medium", { "text-black/30": r, "text-black/55": !r }), children: i })
|
|
64
|
+
] })
|
|
65
|
+
] })
|
|
66
|
+
] }), H = ({
|
|
67
|
+
title: a,
|
|
68
|
+
mimeType: s = "application/octet-stream",
|
|
69
|
+
thumbnail: t,
|
|
70
|
+
poster: l,
|
|
71
|
+
source: c,
|
|
72
|
+
detail: i,
|
|
73
|
+
amountText: r,
|
|
74
|
+
placeholderTitle: d = "Attachment title",
|
|
75
|
+
placeholderAmountText: m,
|
|
76
|
+
paymentStatus: h
|
|
77
|
+
}) => {
|
|
78
|
+
const x = C(s), [g, p] = w(!1);
|
|
79
|
+
return /* @__PURE__ */ n("div", { className: "w-[280px] overflow-hidden rounded-3xl bg-white shadow-[0px_0px_0px_1px_rgba(0,0,0,0.04),0px_1px_2px_0px_rgba(0,0,0,0.04),0px_8px_32px_0px_rgba(0,0,0,0.1)]", children: [
|
|
80
|
+
g && c ? /* @__PURE__ */ e(j, { source: c, mimeType: s, sourceType: x, poster: l, thumbnail: t, title: a, onCollapse: () => p(!1) }) : /* @__PURE__ */ e(y, { thumbnail: t, mimeType: s, canExpand: x === "document" ? !!(c && (l || t)) : !!c, onExpand: () => p(!0) }),
|
|
81
|
+
/* @__PURE__ */ e(E, { title: a, placeholderTitle: d, mimeType: s, detail: i, paymentStatus: h, displayAmountText: m ?? r, isPlaceholderAmount: !!m })
|
|
82
|
+
] });
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
H as default
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=Creator-B6M8dB0U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Creator-B6M8dB0U.js","sources":["../src/components/LockedAttachment/components/Creator.tsx"],"sourcesContent":["import { CheckCircleIcon, EyeIcon, EyeSlashIcon } from '@phosphor-icons/react'\nimport classNames from 'classnames'\nimport React, { useState } from 'react'\n\nimport type { LockedAttachmentBaseProps, PaymentStatus } from '../types'\nimport { renderTypeIcon } from '../utils/icons'\nimport { getSourceType, type AttachmentSourceType } from '../utils/mimeType'\n\nimport MediaPlayer from './MediaPlayer'\n\nexport interface CreatorCardProps extends LockedAttachmentBaseProps {\n title?: string\n placeholderTitle?: string\n placeholderAmountText?: string\n}\n\nconst CloseButton = ({ onClose }: { onClose: () => void }) => (\n <button\n type=\"button\"\n onClick={onClose}\n className=\"absolute right-3 top-3 z-40 flex size-8 items-center justify-center rounded-full bg-black/60 text-white\"\n aria-label=\"Close preview\"\n >\n <EyeIcon className=\"size-4\" weight=\"fill\" />\n </button>\n)\n\ninterface CollapsedThumbnailProps {\n thumbnail?: string\n mimeType: string\n canExpand: boolean\n onExpand: () => void\n}\n\nconst CollapsedThumbnail: React.FC<CollapsedThumbnailProps> = ({ thumbnail, mimeType, canExpand, onExpand }) => {\n return (\n <button\n type=\"button\"\n disabled={!canExpand}\n className={classNames('relative aspect-video block w-full overflow-hidden border-0 bg-black/5 p-0 text-left appearance-none', { 'cursor-pointer': canExpand, 'cursor-default': !canExpand })}\n onClick={onExpand}\n aria-label={canExpand ? 'Expand attachment preview' : undefined}\n >\n {thumbnail\n ? <img src={thumbnail} alt=\"\" className=\"absolute inset-0 h-full w-full object-cover\" />\n : <div className=\"absolute inset-0 flex items-center justify-center\">{renderTypeIcon(mimeType, { className: 'size-12 text-black/20', weight: 'regular' })}</div>\n }\n {canExpand && (\n <div className=\"pointer-events-none absolute right-3 top-3 flex size-8 items-center justify-center rounded-full bg-black/60 text-white\">\n <EyeSlashIcon className=\"size-4\" weight=\"fill\" />\n </div>\n )}\n </button>\n )\n}\n\ninterface ExpandedMediaProps {\n source: string\n mimeType: string\n sourceType: AttachmentSourceType\n poster?: string\n thumbnail?: string\n title?: string\n onCollapse: () => void\n}\n\nconst getExpandedImgSrc = (sourceType: AttachmentSourceType, source: string, poster?: string, thumbnail?: string) =>\n sourceType === 'document' ? (poster ?? thumbnail) : source\n\nconst ExpandedMedia: React.FC<ExpandedMediaProps> = ({ source, mimeType, sourceType, poster, thumbnail, title, onCollapse }) => {\n if (sourceType === 'video' || sourceType === 'audio') {\n return (\n <div className=\"relative\">\n <MediaPlayer\n source={source}\n mimeType={mimeType}\n poster={poster ?? thumbnail}\n autoPlay\n loop\n controls={false}\n showProgress\n onContainerClick={onCollapse}\n muted={sourceType === 'video'}\n />\n <CloseButton onClose={onCollapse} />\n </div>\n )\n }\n const imgSrc = getExpandedImgSrc(sourceType, source, poster, thumbnail)\n return (\n <div className=\"relative\">\n <button type=\"button\" className=\"block w-full cursor-pointer border-0 p-0 text-left appearance-none\" onClick={onCollapse} aria-label=\"Close preview\">\n <img src={imgSrc} alt={title ?? ''} className=\"block w-full\" />\n </button>\n <CloseButton onClose={onCollapse} />\n </div>\n )\n}\n\ninterface CreatorCardMetaProps {\n title?: string\n placeholderTitle: string\n mimeType: string\n detail?: string\n paymentStatus?: PaymentStatus\n displayAmountText?: string\n isPlaceholderAmount: boolean\n}\n\nconst CreatorCardMeta: React.FC<CreatorCardMetaProps> = ({ title, placeholderTitle, mimeType, detail, paymentStatus, displayAmountText, isPlaceholderAmount }) => {\n return (\n <div className=\"px-4 pb-3 pt-3\">\n <p className={classNames('mb-1.5 truncate text-base font-medium', { 'text-black/30': !title, 'text-black': !!title })}>\n {title || placeholderTitle}\n </p>\n <div className=\"flex items-center gap-1\">\n {renderTypeIcon(mimeType, { className: 'size-5 shrink-0 text-black/55', weight: 'regular' })}\n {detail && <span className=\"text-xs font-medium text-black/55\">{detail}</span>}\n {paymentStatus === 'paid' ? (\n <>\n <span className=\"text-xs font-medium text-black/55\">•</span>\n <span className=\"text-xs font-medium text-[#008236]\">Purchased</span>\n <CheckCircleIcon className=\"size-4 text-[#008236]\" weight=\"bold\" />\n </>\n ) : displayAmountText && (\n <>\n <span className={classNames('text-xs font-medium', { 'text-black/30': isPlaceholderAmount, 'text-black/55': !isPlaceholderAmount })}>•</span>\n <span className={classNames('text-xs font-medium', { 'text-black/30': isPlaceholderAmount, 'text-black/55': !isPlaceholderAmount })}>{displayAmountText}</span>\n </>\n )}\n </div>\n </div>\n )\n}\n\nconst CreatorCard: React.FC<CreatorCardProps> = ({\n title,\n mimeType = 'application/octet-stream',\n thumbnail,\n poster,\n source,\n detail,\n amountText,\n placeholderTitle = 'Attachment title',\n placeholderAmountText,\n paymentStatus,\n}) => {\n const sourceType = getSourceType(mimeType)\n const [expanded, setExpanded] = useState(false)\n\n const displayAmountText = placeholderAmountText ?? amountText\n const isPlaceholderAmount = !!placeholderAmountText\n const canExpand = sourceType === 'document'\n ? !!(source && (poster || thumbnail))\n : !!source\n\n const collapse = () => setExpanded(false)\n\n const mediaPreview = expanded && source\n ? <ExpandedMedia source={source} mimeType={mimeType} sourceType={sourceType} poster={poster} thumbnail={thumbnail} title={title} onCollapse={collapse} />\n : <CollapsedThumbnail thumbnail={thumbnail} mimeType={mimeType} canExpand={canExpand} onExpand={() => setExpanded(true)} />\n\n return (\n <div className=\"w-[280px] overflow-hidden rounded-3xl bg-white shadow-[0px_0px_0px_1px_rgba(0,0,0,0.04),0px_1px_2px_0px_rgba(0,0,0,0.04),0px_8px_32px_0px_rgba(0,0,0,0.1)]\">\n {mediaPreview}\n <CreatorCardMeta title={title} placeholderTitle={placeholderTitle} mimeType={mimeType} detail={detail} paymentStatus={paymentStatus} displayAmountText={displayAmountText} isPlaceholderAmount={isPlaceholderAmount} />\n </div>\n )\n}\n\nexport default CreatorCard\n"],"names":["CloseButton","onClose","jsx","EyeIcon","CollapsedThumbnail","thumbnail","mimeType","canExpand","onExpand","jsxs","classNames","EyeSlashIcon","getExpandedImgSrc","sourceType","source","poster","ExpandedMedia","title","onCollapse","MediaPlayer","imgSrc","CreatorCardMeta","placeholderTitle","detail","paymentStatus","displayAmountText","isPlaceholderAmount","renderTypeIcon","Fragment","CheckCircleIcon","CreatorCard","amountText","placeholderAmountText","getSourceType","expanded","setExpanded","useState"],"mappings":";;;;;AAgBA,MAAMA,IAAc,CAAC,EAAE,SAAAC,EAAA,MACrB,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAASD;AAAA,IACT,WAAU;AAAA,IACV,cAAW;AAAA,IAEX,UAAA,gBAAAC,EAACC,GAAA,EAAQ,WAAU,UAAS,QAAO,OAAA,CAAO;AAAA,EAAA;AAC5C,GAUIC,IAAwD,CAAC,EAAE,WAAAC,GAAW,UAAAC,GAAU,WAAAC,GAAW,UAA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 @@
|
|
|
1
|
+
import { jsxs as q, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { FileIcon as G, ImageIcon as ne, SpeakerHighIcon as re, VideoCameraIcon as le, FileMdIcon as ie, FileTextIcon as oe, FileZipIcon as ce, FilePptIcon as se, FileCsvIcon as ue, FileXlsIcon as de, FileDocIcon as me, FilePdfIcon as fe, CircleNotchIcon as ye, PlayIcon as V, PauseIcon as he } from "@phosphor-icons/react";
|
|
3
|
+
import g, { lazy as b, useRef as H, useEffect as R, useCallback as W, useState as _, Suspense as ve } from "react";
|
|
4
|
+
const Pe = [
|
|
5
|
+
[/pdf/, "pdf"],
|
|
6
|
+
[/wordprocessingml|msword|\.doc/, "doc"],
|
|
7
|
+
[/spreadsheetml|ms-excel|\.xls/, "xls"],
|
|
8
|
+
[/csv/, "csv"],
|
|
9
|
+
[/presentationml|ms-powerpoint|\.ppt/, "ppt"],
|
|
10
|
+
[/zip|x-rar|x-7z|x-tar|x-gzip/, "zip"],
|
|
11
|
+
[/plain|rtf/, "text"],
|
|
12
|
+
[/markdown/, "markdown"]
|
|
13
|
+
];
|
|
14
|
+
function J(e) {
|
|
15
|
+
return e.startsWith("video/") ? "video" : e.startsWith("audio/") ? "audio" : e.startsWith("image/") ? "image" : "document";
|
|
16
|
+
}
|
|
17
|
+
function we(e) {
|
|
18
|
+
const a = Pe.find(([i]) => i.test(e));
|
|
19
|
+
return a ? a[1] : "generic";
|
|
20
|
+
}
|
|
21
|
+
const pe = {
|
|
22
|
+
video: le,
|
|
23
|
+
audio: re,
|
|
24
|
+
image: ne,
|
|
25
|
+
document: G
|
|
26
|
+
}, be = {
|
|
27
|
+
pdf: fe,
|
|
28
|
+
doc: me,
|
|
29
|
+
xls: de,
|
|
30
|
+
csv: ue,
|
|
31
|
+
ppt: se,
|
|
32
|
+
zip: ce,
|
|
33
|
+
text: oe,
|
|
34
|
+
markdown: ie,
|
|
35
|
+
generic: G
|
|
36
|
+
};
|
|
37
|
+
function ge(e) {
|
|
38
|
+
const a = J(e);
|
|
39
|
+
return a !== "document" ? pe[a] : be[we(e)];
|
|
40
|
+
}
|
|
41
|
+
function ke(e, a) {
|
|
42
|
+
return g.createElement(ge(e), a);
|
|
43
|
+
}
|
|
44
|
+
const Q = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i, B = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i, Y = /\.(m3u8)($|\?)/i, Ie = /\.(mpd)($|\?)/i, Ee = /stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/, xe = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//, _e = /vimeo\.com\/(?!progressive_redirect).+/, Ne = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/, Te = /open\.spotify\.com\/(\w+)\/(\w+)/i, Re = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+|(videos?\/|\?video=)\d+)($|\?)/, Se = /tiktok\.com\/(?:player\/v1\/|share\/video\/|@[^/]+\/video\/)([0-9]+)/, U = (e, a) => {
|
|
45
|
+
if (Array.isArray(e)) {
|
|
46
|
+
for (const i of e)
|
|
47
|
+
if (typeof i == "string" && U(i, a) || U(i.src, a))
|
|
48
|
+
return !0;
|
|
49
|
+
return !1;
|
|
50
|
+
}
|
|
51
|
+
return a(e);
|
|
52
|
+
}, p = {
|
|
53
|
+
html: (e) => U(e, (a) => Q.test(a) || B.test(a)),
|
|
54
|
+
hls: (e) => U(e, (a) => Y.test(a)),
|
|
55
|
+
dash: (e) => U(e, (a) => Ie.test(a)),
|
|
56
|
+
mux: (e) => Ee.test(e),
|
|
57
|
+
youtube: (e) => xe.test(e),
|
|
58
|
+
vimeo: (e) => _e.test(e) && !B.test(e) && !Y.test(e),
|
|
59
|
+
wistia: (e) => Ne.test(e),
|
|
60
|
+
spotify: (e) => Te.test(e),
|
|
61
|
+
twitch: (e) => Re.test(e),
|
|
62
|
+
tiktok: (e) => Se.test(e)
|
|
63
|
+
}, Me = g.forwardRef((e, a) => {
|
|
64
|
+
const i = Q.test(`${e.src}`) ? "audio" : "video";
|
|
65
|
+
return /* @__PURE__ */ g.createElement(i, { ...e, ref: a }, e.children);
|
|
66
|
+
});
|
|
67
|
+
var Ae = Me;
|
|
68
|
+
const Ce = [
|
|
69
|
+
{
|
|
70
|
+
key: "hls",
|
|
71
|
+
name: "hls.js",
|
|
72
|
+
canPlay: p.hls,
|
|
73
|
+
canEnablePIP: () => !0,
|
|
74
|
+
player: b(
|
|
75
|
+
() => import(
|
|
76
|
+
/* webpackChunkName: 'reactPlayerHls' */
|
|
77
|
+
"./react-Pea5fum1.js"
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: "dash",
|
|
83
|
+
name: "dash.js",
|
|
84
|
+
canPlay: p.dash,
|
|
85
|
+
canEnablePIP: () => !0,
|
|
86
|
+
player: b(
|
|
87
|
+
() => import(
|
|
88
|
+
/* webpackChunkName: 'reactPlayerDash' */
|
|
89
|
+
"./react-dS1WBxxz.js"
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: "mux",
|
|
95
|
+
name: "Mux",
|
|
96
|
+
canPlay: p.mux,
|
|
97
|
+
canEnablePIP: () => !0,
|
|
98
|
+
player: b(
|
|
99
|
+
() => import(
|
|
100
|
+
/* webpackChunkName: 'reactPlayerMux' */
|
|
101
|
+
"./index-Da-xN4Yq.js"
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "youtube",
|
|
107
|
+
name: "YouTube",
|
|
108
|
+
canPlay: p.youtube,
|
|
109
|
+
player: b(
|
|
110
|
+
() => import(
|
|
111
|
+
/* webpackChunkName: 'reactPlayerYouTube' */
|
|
112
|
+
"./react-RiBbsUDd.js"
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: "vimeo",
|
|
118
|
+
name: "Vimeo",
|
|
119
|
+
canPlay: p.vimeo,
|
|
120
|
+
player: b(
|
|
121
|
+
() => import(
|
|
122
|
+
/* webpackChunkName: 'reactPlayerVimeo' */
|
|
123
|
+
"./react-Cn4WlMcl.js"
|
|
124
|
+
)
|
|
125
|
+
)
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
key: "wistia",
|
|
129
|
+
name: "Wistia",
|
|
130
|
+
canPlay: p.wistia,
|
|
131
|
+
canEnablePIP: () => !0,
|
|
132
|
+
player: b(
|
|
133
|
+
() => import(
|
|
134
|
+
/* webpackChunkName: 'reactPlayerWistia' */
|
|
135
|
+
"./react-CwTJArKY.js"
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
key: "spotify",
|
|
141
|
+
name: "Spotify",
|
|
142
|
+
canPlay: p.spotify,
|
|
143
|
+
canEnablePIP: () => !1,
|
|
144
|
+
player: b(
|
|
145
|
+
() => import(
|
|
146
|
+
/* webpackChunkName: 'reactPlayerSpotify' */
|
|
147
|
+
"./react-COAP-MIW.js"
|
|
148
|
+
)
|
|
149
|
+
)
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
key: "twitch",
|
|
153
|
+
name: "Twitch",
|
|
154
|
+
canPlay: p.twitch,
|
|
155
|
+
canEnablePIP: () => !1,
|
|
156
|
+
player: b(
|
|
157
|
+
() => import(
|
|
158
|
+
/* webpackChunkName: 'reactPlayerTwitch' */
|
|
159
|
+
"./react-BxlQMOfz.js"
|
|
160
|
+
)
|
|
161
|
+
)
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
key: "tiktok",
|
|
165
|
+
name: "TikTok",
|
|
166
|
+
canPlay: p.tiktok,
|
|
167
|
+
canEnablePIP: () => !1,
|
|
168
|
+
player: b(
|
|
169
|
+
() => import(
|
|
170
|
+
/* webpackChunkName: 'reactPlayerTiktok' */
|
|
171
|
+
"./react-DkfS_atT.js"
|
|
172
|
+
)
|
|
173
|
+
)
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
key: "html",
|
|
177
|
+
name: "html",
|
|
178
|
+
canPlay: p.html,
|
|
179
|
+
canEnablePIP: () => !0,
|
|
180
|
+
player: Ae
|
|
181
|
+
}
|
|
182
|
+
];
|
|
183
|
+
var K = Ce;
|
|
184
|
+
const Le = {
|
|
185
|
+
// Falsy values don't need to be defined
|
|
186
|
+
//
|
|
187
|
+
// native video attrs
|
|
188
|
+
// src: undefined,
|
|
189
|
+
// preload: undefined,
|
|
190
|
+
// crossOrigin: undefined,
|
|
191
|
+
// autoPlay: false,
|
|
192
|
+
// muted: false,
|
|
193
|
+
// loop: false,
|
|
194
|
+
// controls: false,
|
|
195
|
+
// playsInline: false,
|
|
196
|
+
// disableRemotePlayback: false,
|
|
197
|
+
width: "320px",
|
|
198
|
+
height: "180px",
|
|
199
|
+
// native video props
|
|
200
|
+
volume: 1,
|
|
201
|
+
playbackRate: 1,
|
|
202
|
+
// custom props
|
|
203
|
+
// playing: undefined,
|
|
204
|
+
// pip: false,
|
|
205
|
+
// light: false,
|
|
206
|
+
// fallback: null,
|
|
207
|
+
previewTabIndex: 0,
|
|
208
|
+
previewAriaLabel: "",
|
|
209
|
+
oEmbedUrl: "https://noembed.com/embed?url={url}"
|
|
210
|
+
}, ee = g.forwardRef((e, a) => {
|
|
211
|
+
const { playing: i, pip: m } = e, c = e.activePlayer, r = H(null), o = H(!0);
|
|
212
|
+
R(() => {
|
|
213
|
+
var n, u;
|
|
214
|
+
r.current && (r.current.paused && i === !0 && r.current.play(), !r.current.paused && i === !1 && r.current.pause(), r.current.playbackRate = (n = e.playbackRate) != null ? n : 1, r.current.volume = (u = e.volume) != null ? u : 1);
|
|
215
|
+
}), R(() => {
|
|
216
|
+
var n, u, d, f, T;
|
|
217
|
+
if (!(!r.current || !globalThis.document)) {
|
|
218
|
+
if (m && !document.pictureInPictureElement)
|
|
219
|
+
try {
|
|
220
|
+
(u = (n = r.current).requestPictureInPicture) == null || u.call(n);
|
|
221
|
+
} catch {
|
|
222
|
+
}
|
|
223
|
+
if (!m && document.pictureInPictureElement)
|
|
224
|
+
try {
|
|
225
|
+
(f = (d = r.current).exitPictureInPicture) == null || f.call(d), (T = document.exitPictureInPicture) == null || T.call(document);
|
|
226
|
+
} catch {
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}, [m]);
|
|
230
|
+
const k = (n) => {
|
|
231
|
+
var u, d;
|
|
232
|
+
o.current = !0, (u = e.onReady) == null || u.call(e), (d = e.onLoadStart) == null || d.call(e, n);
|
|
233
|
+
}, S = (n) => {
|
|
234
|
+
var u, d;
|
|
235
|
+
o.current && (o.current = !1, (u = e.onStart) == null || u.call(e, n)), (d = e.onPlay) == null || d.call(e, n);
|
|
236
|
+
};
|
|
237
|
+
if (!c)
|
|
238
|
+
return null;
|
|
239
|
+
const N = {}, P = ["onReady", "onStart"];
|
|
240
|
+
for (const n in e)
|
|
241
|
+
n.startsWith("on") && !P.includes(n) && (N[n] = e[n]);
|
|
242
|
+
return /* @__PURE__ */ g.createElement(
|
|
243
|
+
c,
|
|
244
|
+
{
|
|
245
|
+
...N,
|
|
246
|
+
style: e.style,
|
|
247
|
+
className: e.className,
|
|
248
|
+
slot: e.slot,
|
|
249
|
+
ref: W(
|
|
250
|
+
(n) => {
|
|
251
|
+
r.current = n, typeof a == "function" ? a(n) : a !== null && (a.current = n);
|
|
252
|
+
},
|
|
253
|
+
[a]
|
|
254
|
+
),
|
|
255
|
+
src: e.src,
|
|
256
|
+
crossOrigin: e.crossOrigin,
|
|
257
|
+
preload: e.preload,
|
|
258
|
+
controls: e.controls,
|
|
259
|
+
muted: e.muted,
|
|
260
|
+
autoPlay: e.autoPlay,
|
|
261
|
+
loop: e.loop,
|
|
262
|
+
playsInline: e.playsInline,
|
|
263
|
+
disableRemotePlayback: e.disableRemotePlayback,
|
|
264
|
+
config: e.config,
|
|
265
|
+
onLoadStart: k,
|
|
266
|
+
onPlay: S
|
|
267
|
+
},
|
|
268
|
+
e.children
|
|
269
|
+
);
|
|
270
|
+
});
|
|
271
|
+
ee.displayName = "Player";
|
|
272
|
+
var Oe = ee;
|
|
273
|
+
const Fe = b(() => import(
|
|
274
|
+
/* webpackChunkName: 'reactPlayerPreview' */
|
|
275
|
+
"./Preview-DqAv16NS.js"
|
|
276
|
+
)), F = [], He = (e, a) => {
|
|
277
|
+
const i = (c) => {
|
|
278
|
+
for (const r of [...F, ...e])
|
|
279
|
+
if (c && r.canPlay(c))
|
|
280
|
+
return r;
|
|
281
|
+
return a || null;
|
|
282
|
+
}, m = g.forwardRef((c, r) => {
|
|
283
|
+
const o = { ...Le, ...c }, { src: k, slot: S, className: N, style: P, width: n, height: u, fallback: d, wrapper: f } = o, [T, x] = _(!!o.light);
|
|
284
|
+
R(() => {
|
|
285
|
+
o.light ? x(!0) : x(!1);
|
|
286
|
+
}, [o.light]);
|
|
287
|
+
const z = (h) => {
|
|
288
|
+
var y;
|
|
289
|
+
x(!1), (y = o.onClickPreview) == null || y.call(o, h);
|
|
290
|
+
}, L = (h) => {
|
|
291
|
+
if (!h) return null;
|
|
292
|
+
const { light: y, playIcon: w, previewTabIndex: I, oEmbedUrl: v, previewAriaLabel: M } = o;
|
|
293
|
+
return /* @__PURE__ */ g.createElement(
|
|
294
|
+
Fe,
|
|
295
|
+
{
|
|
296
|
+
src: h,
|
|
297
|
+
light: y,
|
|
298
|
+
playIcon: w,
|
|
299
|
+
previewTabIndex: I,
|
|
300
|
+
previewAriaLabel: M,
|
|
301
|
+
oEmbedUrl: v,
|
|
302
|
+
onClickPreview: z
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}, X = (h) => {
|
|
306
|
+
var y, w;
|
|
307
|
+
const I = i(h);
|
|
308
|
+
if (!I) return null;
|
|
309
|
+
const { style: v, width: M, height: A, wrapper: E } = o, D = (y = o.config) == null ? void 0 : y[I.key];
|
|
310
|
+
return /* @__PURE__ */ g.createElement(
|
|
311
|
+
Oe,
|
|
312
|
+
{
|
|
313
|
+
...o,
|
|
314
|
+
ref: r,
|
|
315
|
+
activePlayer: (w = I.player) != null ? w : I,
|
|
316
|
+
slot: E ? void 0 : S,
|
|
317
|
+
className: E ? void 0 : N,
|
|
318
|
+
style: E ? { display: "block", width: "100%", height: "100%" } : { display: "block", width: M, height: A, ...v },
|
|
319
|
+
config: D
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
}, j = f ?? Z, O = d === !1 ? Z : ve;
|
|
323
|
+
return /* @__PURE__ */ g.createElement(j, { slot: S, className: N, style: { width: n, height: u, ...P } }, /* @__PURE__ */ g.createElement(O, { fallback: d }, T ? L(k) : X(k)));
|
|
324
|
+
});
|
|
325
|
+
return m.displayName = "ReactPlayer", m.addCustomPlayer = (c) => {
|
|
326
|
+
F.push(c);
|
|
327
|
+
}, m.removeCustomPlayers = () => {
|
|
328
|
+
F.length = 0;
|
|
329
|
+
}, m.canPlay = (c) => {
|
|
330
|
+
if (c) {
|
|
331
|
+
for (const r of [...F, ...e])
|
|
332
|
+
if (r.canPlay(c))
|
|
333
|
+
return !0;
|
|
334
|
+
}
|
|
335
|
+
return !1;
|
|
336
|
+
}, m.canEnablePIP = (c) => {
|
|
337
|
+
var r;
|
|
338
|
+
if (c) {
|
|
339
|
+
for (const o of [...F, ...e])
|
|
340
|
+
if (o.canPlay(c) && ((r = o.canEnablePIP) != null && r.call(o)))
|
|
341
|
+
return !0;
|
|
342
|
+
}
|
|
343
|
+
return !1;
|
|
344
|
+
}, m;
|
|
345
|
+
}, Z = ({ children: e }) => e, Ue = K[K.length - 1];
|
|
346
|
+
var ze = He(K, Ue);
|
|
347
|
+
const De = (e, a) => e === "audio" && !a ? "bg-black/5" : "bg-black";
|
|
348
|
+
function $e(e) {
|
|
349
|
+
var a, i;
|
|
350
|
+
return "touches" in e ? ((a = e.touches[0]) == null ? void 0 : a.clientX) ?? ((i = e.changedTouches[0]) == null ? void 0 : i.clientX) ?? 0 : e.clientX;
|
|
351
|
+
}
|
|
352
|
+
const qe = ({
|
|
353
|
+
source: e,
|
|
354
|
+
mimeType: a,
|
|
355
|
+
poster: i,
|
|
356
|
+
autoPlay: m = !1,
|
|
357
|
+
loop: c = !1,
|
|
358
|
+
controls: r = !0,
|
|
359
|
+
showProgress: o = !1,
|
|
360
|
+
onContainerClick: k,
|
|
361
|
+
muted: S = !1
|
|
362
|
+
}) => {
|
|
363
|
+
const N = J(a), [P, n] = _(m), [u, d] = _(0), [f, T] = _(!1), [x, z] = _(!1), [L, X] = _(null), [j, O] = _(!1), [h, y] = _(!1), w = H(null), I = H(null), v = H(null);
|
|
364
|
+
R(() => {
|
|
365
|
+
y(!1);
|
|
366
|
+
}, [e]), R(() => {
|
|
367
|
+
if (!P) {
|
|
368
|
+
v.current !== null && (cancelAnimationFrame(v.current), v.current = null);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const t = () => {
|
|
372
|
+
const l = w.current;
|
|
373
|
+
l && l.duration && !f && d(l.currentTime / l.duration), v.current = requestAnimationFrame(t);
|
|
374
|
+
};
|
|
375
|
+
return v.current = requestAnimationFrame(t), () => {
|
|
376
|
+
v.current !== null && cancelAnimationFrame(v.current);
|
|
377
|
+
};
|
|
378
|
+
}, [P, f]), R(() => {
|
|
379
|
+
const t = w.current;
|
|
380
|
+
t && (P ? t.play().catch((l) => {
|
|
381
|
+
n(!1), y(!0);
|
|
382
|
+
}) : t.pause());
|
|
383
|
+
}, [P]);
|
|
384
|
+
const M = W(() => {
|
|
385
|
+
y(!1), n(!0);
|
|
386
|
+
}, []), A = W(
|
|
387
|
+
(t) => {
|
|
388
|
+
const l = I.current;
|
|
389
|
+
if (!l) return 0;
|
|
390
|
+
const C = l.getBoundingClientRect();
|
|
391
|
+
return Math.max(
|
|
392
|
+
0,
|
|
393
|
+
Math.min(1, ($e(t) - C.left) / C.width)
|
|
394
|
+
);
|
|
395
|
+
},
|
|
396
|
+
[]
|
|
397
|
+
), E = W((t) => {
|
|
398
|
+
const l = w.current;
|
|
399
|
+
l && l.duration && (l.currentTime = t * l.duration);
|
|
400
|
+
}, []), D = (t) => {
|
|
401
|
+
t.stopPropagation(), T(!0);
|
|
402
|
+
const l = A(t);
|
|
403
|
+
d(l), E(l);
|
|
404
|
+
};
|
|
405
|
+
R(() => {
|
|
406
|
+
if (!f) return;
|
|
407
|
+
const t = (C) => d(A(C)), l = (C) => {
|
|
408
|
+
T(!1), E(A(C));
|
|
409
|
+
};
|
|
410
|
+
return window.addEventListener("mousemove", t), window.addEventListener("mouseup", l), window.addEventListener("touchmove", t, { passive: !0 }), window.addEventListener("touchend", l), () => {
|
|
411
|
+
window.removeEventListener("mousemove", t), window.removeEventListener("mouseup", l), window.removeEventListener("touchmove", t), window.removeEventListener("touchend", l);
|
|
412
|
+
};
|
|
413
|
+
}, [f, A, E]);
|
|
414
|
+
const te = L ? { aspectRatio: String(L) } : void 0, ae = L ? "" : " aspect-video", $ = Math.round(u * 100);
|
|
415
|
+
return /* @__PURE__ */ q(
|
|
416
|
+
"div",
|
|
417
|
+
{
|
|
418
|
+
role: "button",
|
|
419
|
+
tabIndex: 0,
|
|
420
|
+
className: `relative cursor-pointer overflow-hidden ${De(N, i)}${ae}`,
|
|
421
|
+
style: te,
|
|
422
|
+
onClick: () => {
|
|
423
|
+
if (!h) {
|
|
424
|
+
if (k) {
|
|
425
|
+
k();
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
r && n((t) => !t);
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
onKeyDown: (t) => {
|
|
432
|
+
if (!(t.key !== "Enter" && t.key !== " ") && (t.preventDefault(), !h)) {
|
|
433
|
+
if (k) {
|
|
434
|
+
k();
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
r && n((l) => !l);
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
children: [
|
|
441
|
+
i && /* @__PURE__ */ s("img", { src: i, alt: "", className: "absolute inset-0 h-full w-full object-cover" }),
|
|
442
|
+
!i && /* @__PURE__ */ s("div", { className: "absolute inset-0 flex items-center justify-center", children: ke(a, { className: "size-12 text-black/20", weight: "regular" }) }),
|
|
443
|
+
/* @__PURE__ */ s("div", { className: "absolute inset-0", children: /* @__PURE__ */ s(
|
|
444
|
+
ze,
|
|
445
|
+
{
|
|
446
|
+
ref: w,
|
|
447
|
+
src: e,
|
|
448
|
+
poster: i,
|
|
449
|
+
loop: c,
|
|
450
|
+
muted: S,
|
|
451
|
+
playsInline: !0,
|
|
452
|
+
width: "100%",
|
|
453
|
+
height: "100%",
|
|
454
|
+
onLoadStart: () => O(!0),
|
|
455
|
+
onCanPlay: () => O(!1),
|
|
456
|
+
onWaiting: () => O(!0),
|
|
457
|
+
onPlay: () => y(!1),
|
|
458
|
+
onLoadedMetadata: () => {
|
|
459
|
+
const t = w.current;
|
|
460
|
+
t && t.videoWidth && t.videoHeight && X(t.videoWidth / t.videoHeight);
|
|
461
|
+
},
|
|
462
|
+
onEnded: () => {
|
|
463
|
+
c || (n(!1), d(0));
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
) }),
|
|
467
|
+
j && !h && /* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 flex items-center justify-center", children: /* @__PURE__ */ s(ye, { className: "size-8 animate-spin text-white/80", weight: "bold" }) }),
|
|
468
|
+
h && !r && /* @__PURE__ */ s(
|
|
469
|
+
"div",
|
|
470
|
+
{
|
|
471
|
+
className: "absolute inset-0 z-30 flex cursor-pointer items-center justify-center bg-black/35",
|
|
472
|
+
role: "button",
|
|
473
|
+
tabIndex: 0,
|
|
474
|
+
"aria-label": "Play preview",
|
|
475
|
+
onClick: (t) => {
|
|
476
|
+
t.stopPropagation(), M();
|
|
477
|
+
},
|
|
478
|
+
onKeyDown: (t) => {
|
|
479
|
+
t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), M());
|
|
480
|
+
},
|
|
481
|
+
children: /* @__PURE__ */ s("span", { className: "flex size-16 items-center justify-center rounded-full bg-white/20 text-white backdrop-blur-sm", children: /* @__PURE__ */ s(V, { className: "size-9 translate-x-0.5", weight: "fill" }) })
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
o && !r && /* @__PURE__ */ s("div", { className: "absolute inset-x-0 bottom-0 px-3 pb-2.5 pt-6 bg-gradient-to-t from-black/40 to-transparent pointer-events-none", children: /* @__PURE__ */ s("div", { className: "h-1 w-full overflow-hidden rounded-full bg-white/30", children: /* @__PURE__ */ s("div", { className: "h-full rounded-full bg-white", style: { width: `${$}%` } }) }) }),
|
|
485
|
+
r && /* @__PURE__ */ q("div", { className: "absolute inset-x-0 bottom-0 flex items-center gap-2 bg-gradient-to-t from-black/60 to-transparent px-3 pb-2.5 pt-6 transition-all duration-200", children: [
|
|
486
|
+
/* @__PURE__ */ s(
|
|
487
|
+
"button",
|
|
488
|
+
{
|
|
489
|
+
type: "button",
|
|
490
|
+
onClick: (t) => {
|
|
491
|
+
t.stopPropagation(), n((l) => !l);
|
|
492
|
+
},
|
|
493
|
+
className: "shrink-0 text-white",
|
|
494
|
+
"aria-label": P ? "Pause" : "Play",
|
|
495
|
+
children: P ? /* @__PURE__ */ s(he, { className: "size-5", weight: "fill" }) : /* @__PURE__ */ s(V, { className: "size-5 translate-x-px", weight: "fill" })
|
|
496
|
+
}
|
|
497
|
+
),
|
|
498
|
+
/* @__PURE__ */ q(
|
|
499
|
+
"div",
|
|
500
|
+
{
|
|
501
|
+
role: "slider",
|
|
502
|
+
"aria-label": "Playback position",
|
|
503
|
+
"aria-valuenow": $,
|
|
504
|
+
"aria-valuemin": 0,
|
|
505
|
+
"aria-valuemax": 100,
|
|
506
|
+
tabIndex: 0,
|
|
507
|
+
ref: I,
|
|
508
|
+
className: "relative flex h-4 w-full cursor-pointer items-center",
|
|
509
|
+
onMouseDown: D,
|
|
510
|
+
onTouchStart: D,
|
|
511
|
+
onClick: (t) => t.stopPropagation(),
|
|
512
|
+
onMouseEnter: () => z(!0),
|
|
513
|
+
onMouseLeave: () => z(!1),
|
|
514
|
+
onKeyDown: (t) => {
|
|
515
|
+
t.key === "ArrowRight" && E(Math.min(1, u + 0.05)), t.key === "ArrowLeft" && E(Math.max(0, u - 0.05));
|
|
516
|
+
},
|
|
517
|
+
children: [
|
|
518
|
+
/* @__PURE__ */ s("div", { className: `w-full overflow-hidden rounded-full bg-white/30 transition-all duration-200 ${x || f ? "h-1.5" : "h-1"}`, children: /* @__PURE__ */ s("div", { className: "h-full rounded-full bg-white", style: { width: `${$}%` } }) }),
|
|
519
|
+
/* @__PURE__ */ s(
|
|
520
|
+
"div",
|
|
521
|
+
{
|
|
522
|
+
className: `absolute size-3 -translate-x-1/2 rounded-full bg-white shadow transition-[opacity,transform] duration-200 ${x || f ? "scale-100 opacity-100" : "scale-0 opacity-0"}`,
|
|
523
|
+
style: { left: `${$}%` }
|
|
524
|
+
}
|
|
525
|
+
)
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] })
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
};
|
|
534
|
+
export {
|
|
535
|
+
qe as M,
|
|
536
|
+
J as g,
|
|
537
|
+
ke as r
|
|
538
|
+
};
|
|
539
|
+
//# sourceMappingURL=MediaPlayer-DsjlYGGH.js.map
|