@factorialco/f0-react 12.12.0 → 12.14.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/{ArchiveThumbnail-b34U-zTc.js → ArchiveThumbnail-CgaNJ6v9.js} +1 -1
- package/dist/{ArchiveViewer-BpmryW7A.js → ArchiveViewer-Uohl6wf1.js} +2 -2
- package/dist/{ChatPostComposerDialog-Cr207fXs.js → ChatPostComposerDialog-Cr6Ci2dz.js} +2 -2
- package/dist/{CoachmarkProvider-CsytVD-X.js → CoachmarkProvider-Cfb6WvLp.js} +17551 -17550
- package/dist/{CodeThumbnail-8NiQ3uzU.js → CodeThumbnail-CFNKh12S.js} +1 -1
- package/dist/{CodeViewer-BNZqt-5s.js → CodeViewer-C4XxNdq4.js} +3 -3
- package/dist/{DocumentToolbar-DUe9R1rU.js → DocumentToolbar-CcEggNyX.js} +1 -1
- package/dist/{DocxViewer-BUMy2iL7.js → DocxViewer-DIiFGMl7.js} +1 -1
- package/dist/Ellipsis-CBouJQYY.js +34 -0
- package/dist/{F0AiProcessingOverlay-CiUTeBwG.js → F0AiProcessingOverlay-wFS85Arm.js} +1539 -1485
- package/dist/{F0Alert-Ca8sBfXN.js → F0Alert-DRK5Na7T.js} +10 -10
- package/dist/F0AudioPlayer-Ds4txTh4.js +2 -0
- package/dist/{F0CanvasPanel-BOo_mxBl.js → F0CanvasPanel-CbJxX6Qv.js} +8681 -7494
- package/dist/{F0DocumentViewer-CaYAO9ok.js → F0DocumentViewer-B2_6INMo.js} +1 -1
- package/dist/{F0DocumentViewer-h0XY5tgT.js → F0DocumentViewer-B6ccmcTZ.js} +2 -2
- package/dist/{F0Map-b1uYlF_H.js → F0Map-BkrkSniz.js} +15 -15
- package/dist/F0Text-CXHuzMbj.js +14 -0
- package/dist/F0VideoPlayer-5bnm6ryg.js +1 -0
- package/dist/{F0VideoPlayer-D85XCpqh.js → F0VideoPlayer-BkRdc58E.js} +312 -312
- package/dist/{HtmlViewer-DxOnMV30.js → HtmlViewer-qkAWMkJy.js} +3 -3
- package/dist/{Map-BOMgctnS.js → Map-CZcZoNEa.js} +26 -25
- package/dist/{PdfThumbnail-98PDy4ud.js → PdfThumbnail-RTw1aKm_.js} +1 -1
- package/dist/{PdfViewer-nBnKrTYD.js → PdfViewer-m56GqoJt.js} +5 -5
- package/dist/{SheetViewer-CD9SHbXJ.js → SheetViewer-C80n4nta.js} +12 -12
- package/dist/{TextViewer-DxRBCXzV.js → TextViewer-BINEouL8.js} +1 -1
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +3 -3
- package/dist/component-status.js +1 -1
- package/dist/experimental.d.ts +15 -3
- package/dist/experimental.js +5782 -5775
- package/dist/{exports-cxvNeHfV.d.ts → exports-BGemf1WM.d.ts} +13 -11
- package/dist/f0.d.ts +8 -129
- package/dist/f0.js +382 -382
- package/dist/{highlight-CqFL-_MG.js → highlight-BNASV9vz.js} +7 -7
- package/dist/{index-DF8ubeg6.d.ts → index-BkCnaiJG.d.ts} +326 -10
- package/dist/localized-CnKvEJya.js +73 -0
- package/dist/{maplibre-Ip4Qe9dM.js → maplibre-DTAAiC-N.js} +1 -1
- package/dist/{pdfWorker-DMjHHAyP.js → pdfWorker-D16_euGm.js} +1 -1
- package/dist/{types-geibVrTM.d.ts → types-C2gKTwyT.d.ts} +2 -179
- package/package.json +1 -1
- package/dist/F0AudioPlayer-BefDLQA2.js +0 -1083
- package/dist/F0AudioPlayer-CNb4kXOk.js +0 -3
- package/dist/F0SegmentedControl-DXoAzTmH.js +0 -103
- package/dist/F0VideoPlayer-_zLFiEIp.js +0 -1
- package/dist/localized-BrUgGMzm.js +0 -46
|
@@ -1,1083 +0,0 @@
|
|
|
1
|
-
import { a as e, r as t } from "./i18n-provider-Bdgo-LeP.js";
|
|
2
|
-
import { n } from "./skeleton-AC0Fb8zj.js";
|
|
3
|
-
import { L as r, R as i } from "./tooltip-BX4dSfeL.js";
|
|
4
|
-
import { U as a, h as o, t as s } from "./F0Button-d91IgOnc.js";
|
|
5
|
-
import { As as c, Pa as l, go as u, ho as d } from "./F0CanvasPanel-BOo_mxBl.js";
|
|
6
|
-
import { o as f, t as p } from "./F0Icon-DmCBV0gK.js";
|
|
7
|
-
import { t as m } from "./Check-DAp9gCRh.js";
|
|
8
|
-
import { a as h, i as g, r as _ } from "./dist-CFY0KELA.js";
|
|
9
|
-
import { A as v, H as y, L as b, M as x, N as S, a as C, ct as w, ft as ee, gt as T, ht as E, i as D, k as O, lt as k, mt as te, st as A, t as ne, tt as re } from "./popover-ics24JxK.js";
|
|
10
|
-
import { n as ie } from "./scrollarea-cxaFAWG5.js";
|
|
11
|
-
import { n as j, t as ae } from "./F0SegmentedControl-DXoAzTmH.js";
|
|
12
|
-
import { i as oe, n as se, r as M, t as ce } from "./localized-BrUgGMzm.js";
|
|
13
|
-
import * as N from "react";
|
|
14
|
-
import { forwardRef as le, memo as P, useCallback as F, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
|
|
15
|
-
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
16
|
-
//#region src/blocks/F0AudioPlayer/utils.ts
|
|
17
|
-
var ue = (e) => Object.fromEntries(Object.entries(e).filter(([e]) => e.startsWith("data-"))), U = (e) => {
|
|
18
|
-
(!Number.isFinite(e) || e < 0) && (e = 0);
|
|
19
|
-
let t = Math.floor(e), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60, a = (e) => String(e).padStart(2, "0");
|
|
20
|
-
return n > 0 ? `${n}:${a(r)}:${a(i)}` : `${r}:${a(i)}`;
|
|
21
|
-
}, de = (e) => e.map((e, t) => ({
|
|
22
|
-
start: e.startTime,
|
|
23
|
-
cueIndex: t
|
|
24
|
-
})).filter((e) => typeof e.start == "number" && Number.isFinite(e.start)).sort((e, t) => e.start - t.start), fe = (e, t) => {
|
|
25
|
-
let n = 0, r = e.length - 1, i = -1;
|
|
26
|
-
for (; n <= r;) {
|
|
27
|
-
let a = n + r >> 1, o = e[a];
|
|
28
|
-
if (o === void 0) break;
|
|
29
|
-
o.start <= t ? (i = o.cueIndex, n = a + 1) : r = a - 1;
|
|
30
|
-
}
|
|
31
|
-
return i;
|
|
32
|
-
}, W = /* @__PURE__ */ new Set([
|
|
33
|
-
"captions",
|
|
34
|
-
"subtitles",
|
|
35
|
-
"descriptions",
|
|
36
|
-
"metadata"
|
|
37
|
-
]), pe = (e) => W.has(e), G = (e, t) => {
|
|
38
|
-
let n = e.querySelectorAll("track");
|
|
39
|
-
for (let e of Array.from(n)) if (e.track === t) return !1;
|
|
40
|
-
return !0;
|
|
41
|
-
}, me = (e) => {
|
|
42
|
-
let t = e.cues;
|
|
43
|
-
if (!t || t.length === 0) return "";
|
|
44
|
-
let n = [];
|
|
45
|
-
for (let e of Array.from(t)) {
|
|
46
|
-
let t = e.text;
|
|
47
|
-
typeof t == "string" && t.trim() && n.push(t.trim());
|
|
48
|
-
}
|
|
49
|
-
return n.join("\n");
|
|
50
|
-
}, he = (e, t, n) => {
|
|
51
|
-
let [r, i] = z();
|
|
52
|
-
return I(() => {
|
|
53
|
-
if (!n) {
|
|
54
|
-
i(void 0);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
let t = e.current;
|
|
58
|
-
if (!t) return;
|
|
59
|
-
let r = t.textTracks, a = () => {
|
|
60
|
-
let e = Array.from(r).filter((e) => pe(e.kind));
|
|
61
|
-
e.sort((e, n) => Number(G(t, n)) - Number(G(t, e)));
|
|
62
|
-
for (let t of e) {
|
|
63
|
-
t.mode === "disabled" && (t.mode = "hidden");
|
|
64
|
-
let e = me(t);
|
|
65
|
-
if (e) {
|
|
66
|
-
i(e);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
a();
|
|
72
|
-
let o = [], s = (e) => {
|
|
73
|
-
if (typeof e.addEventListener != "function") return;
|
|
74
|
-
let t = () => a();
|
|
75
|
-
e.addEventListener("cuechange", t), o.push(() => e.removeEventListener("cuechange", t));
|
|
76
|
-
};
|
|
77
|
-
Array.from(r).forEach(s);
|
|
78
|
-
let c = (e) => {
|
|
79
|
-
e.track && s(e.track), a();
|
|
80
|
-
}, l = typeof r.addEventListener == "function";
|
|
81
|
-
return l && r.addEventListener("addtrack", c), () => {
|
|
82
|
-
l && r.removeEventListener("addtrack", c), o.forEach((e) => e());
|
|
83
|
-
};
|
|
84
|
-
}, [
|
|
85
|
-
e,
|
|
86
|
-
n,
|
|
87
|
-
t
|
|
88
|
-
]), r;
|
|
89
|
-
}, K = ["PageUp", "PageDown"], q = [
|
|
90
|
-
"ArrowUp",
|
|
91
|
-
"ArrowDown",
|
|
92
|
-
"ArrowLeft",
|
|
93
|
-
"ArrowRight"
|
|
94
|
-
], ge = {
|
|
95
|
-
"from-left": [
|
|
96
|
-
"Home",
|
|
97
|
-
"PageDown",
|
|
98
|
-
"ArrowDown",
|
|
99
|
-
"ArrowLeft"
|
|
100
|
-
],
|
|
101
|
-
"from-right": [
|
|
102
|
-
"Home",
|
|
103
|
-
"PageDown",
|
|
104
|
-
"ArrowDown",
|
|
105
|
-
"ArrowRight"
|
|
106
|
-
],
|
|
107
|
-
"from-bottom": [
|
|
108
|
-
"Home",
|
|
109
|
-
"PageDown",
|
|
110
|
-
"ArrowDown",
|
|
111
|
-
"ArrowLeft"
|
|
112
|
-
],
|
|
113
|
-
"from-top": [
|
|
114
|
-
"Home",
|
|
115
|
-
"PageDown",
|
|
116
|
-
"ArrowUp",
|
|
117
|
-
"ArrowLeft"
|
|
118
|
-
]
|
|
119
|
-
}, J = "Slider", [Y, X, _e] = w(J), [Z, Q] = te(J, [_e]), [ve, $] = Z(J), ye = N.forwardRef((e, t) => {
|
|
120
|
-
let { name: n, min: r = 0, max: i = 100, step: a = 1, orientation: o = "horizontal", disabled: s = !1, minStepsBetweenThumbs: c = 0, defaultValue: l = [r], value: u, onValueChange: d = () => {}, onValueCommit: f = () => {}, inverted: p = !1, form: m, ...h } = e, g = N.useRef(/* @__PURE__ */ new Set()), v = N.useRef(0), y = o === "horizontal" ? Se : Ce, [b = [], x] = ee({
|
|
121
|
-
prop: u,
|
|
122
|
-
defaultProp: l,
|
|
123
|
-
onChange: (e) => {
|
|
124
|
-
[...g.current][v.current]?.focus(), d(e);
|
|
125
|
-
}
|
|
126
|
-
}), S = N.useRef(b);
|
|
127
|
-
function C(e) {
|
|
128
|
-
D(e, Le(b, e));
|
|
129
|
-
}
|
|
130
|
-
function w(e) {
|
|
131
|
-
D(e, v.current);
|
|
132
|
-
}
|
|
133
|
-
function T() {
|
|
134
|
-
let e = S.current[v.current];
|
|
135
|
-
b[v.current] !== e && f(b);
|
|
136
|
-
}
|
|
137
|
-
function D(e, t, { commit: n } = { commit: !1 }) {
|
|
138
|
-
let o = He(a), s = Ue(Math.round((e - r) / a) * a + r, o), l = _(s, [r, i]);
|
|
139
|
-
x((e = []) => {
|
|
140
|
-
let r = Pe(e, l, t);
|
|
141
|
-
if (Be(r, c * a)) {
|
|
142
|
-
v.current = r.indexOf(l);
|
|
143
|
-
let t = String(r) !== String(e);
|
|
144
|
-
return t && n && f(r), t ? r : e;
|
|
145
|
-
}
|
|
146
|
-
return e;
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
return /* @__PURE__ */ V(ve, {
|
|
150
|
-
scope: e.__scopeSlider,
|
|
151
|
-
name: n,
|
|
152
|
-
disabled: s,
|
|
153
|
-
min: r,
|
|
154
|
-
max: i,
|
|
155
|
-
valueIndexToChangeRef: v,
|
|
156
|
-
thumbs: g.current,
|
|
157
|
-
values: b,
|
|
158
|
-
orientation: o,
|
|
159
|
-
form: m,
|
|
160
|
-
children: /* @__PURE__ */ V(Y.Provider, {
|
|
161
|
-
scope: e.__scopeSlider,
|
|
162
|
-
children: /* @__PURE__ */ V(Y.Slot, {
|
|
163
|
-
scope: e.__scopeSlider,
|
|
164
|
-
children: /* @__PURE__ */ V(y, {
|
|
165
|
-
"aria-disabled": s,
|
|
166
|
-
"data-disabled": s ? "" : void 0,
|
|
167
|
-
...h,
|
|
168
|
-
ref: t,
|
|
169
|
-
onPointerDown: E(h.onPointerDown, () => {
|
|
170
|
-
s || (S.current = b);
|
|
171
|
-
}),
|
|
172
|
-
min: r,
|
|
173
|
-
max: i,
|
|
174
|
-
inverted: p,
|
|
175
|
-
onSlideStart: s ? void 0 : C,
|
|
176
|
-
onSlideMove: s ? void 0 : w,
|
|
177
|
-
onSlideEnd: s ? void 0 : T,
|
|
178
|
-
onHomeKeyDown: () => !s && D(r, 0, { commit: !0 }),
|
|
179
|
-
onEndKeyDown: () => !s && D(i, b.length - 1, { commit: !0 }),
|
|
180
|
-
onStepKeyDown: ({ event: e, direction: t }) => {
|
|
181
|
-
if (!s) {
|
|
182
|
-
let n = K.includes(e.key) || e.shiftKey && q.includes(e.key) ? 10 : 1, r = v.current, i = b[r];
|
|
183
|
-
D(i + a * n * t, r, { commit: !0 });
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
})
|
|
187
|
-
})
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
ye.displayName = J;
|
|
192
|
-
var [be, xe] = Z(J, {
|
|
193
|
-
startEdge: "left",
|
|
194
|
-
endEdge: "right",
|
|
195
|
-
size: "width",
|
|
196
|
-
direction: 1
|
|
197
|
-
}), Se = N.forwardRef((e, t) => {
|
|
198
|
-
let { min: n, max: r, dir: i, inverted: a, onSlideStart: o, onSlideMove: s, onSlideEnd: c, onStepKeyDown: l, ...u } = e, [d, f] = N.useState(null), p = T(t, (e) => f(e)), m = N.useRef(void 0), h = A(i), g = h === "ltr", _ = g && !a || !g && a;
|
|
199
|
-
function v(e) {
|
|
200
|
-
let t = m.current || d.getBoundingClientRect(), i = Ve([0, t.width], _ ? [n, r] : [r, n]);
|
|
201
|
-
return m.current = t, i(e - t.left);
|
|
202
|
-
}
|
|
203
|
-
return /* @__PURE__ */ V(be, {
|
|
204
|
-
scope: e.__scopeSlider,
|
|
205
|
-
startEdge: _ ? "left" : "right",
|
|
206
|
-
endEdge: _ ? "right" : "left",
|
|
207
|
-
direction: _ ? 1 : -1,
|
|
208
|
-
size: "width",
|
|
209
|
-
children: /* @__PURE__ */ V(we, {
|
|
210
|
-
dir: h,
|
|
211
|
-
"data-orientation": "horizontal",
|
|
212
|
-
...u,
|
|
213
|
-
ref: p,
|
|
214
|
-
style: {
|
|
215
|
-
...u.style,
|
|
216
|
-
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
217
|
-
},
|
|
218
|
-
onSlideStart: (e) => {
|
|
219
|
-
let t = v(e.clientX);
|
|
220
|
-
o?.(t);
|
|
221
|
-
},
|
|
222
|
-
onSlideMove: (e) => {
|
|
223
|
-
let t = v(e.clientX);
|
|
224
|
-
s?.(t);
|
|
225
|
-
},
|
|
226
|
-
onSlideEnd: () => {
|
|
227
|
-
m.current = void 0, c?.();
|
|
228
|
-
},
|
|
229
|
-
onStepKeyDown: (e) => {
|
|
230
|
-
let t = ge[_ ? "from-left" : "from-right"].includes(e.key);
|
|
231
|
-
l?.({
|
|
232
|
-
event: e,
|
|
233
|
-
direction: t ? -1 : 1
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
})
|
|
237
|
-
});
|
|
238
|
-
}), Ce = N.forwardRef((e, t) => {
|
|
239
|
-
let { min: n, max: r, inverted: i, onSlideStart: a, onSlideMove: o, onSlideEnd: s, onStepKeyDown: c, ...l } = e, u = N.useRef(null), d = T(t, u), f = N.useRef(void 0), p = !i;
|
|
240
|
-
function m(e) {
|
|
241
|
-
let t = f.current || u.current.getBoundingClientRect(), i = Ve([0, t.height], p ? [r, n] : [n, r]);
|
|
242
|
-
return f.current = t, i(e - t.top);
|
|
243
|
-
}
|
|
244
|
-
return /* @__PURE__ */ V(be, {
|
|
245
|
-
scope: e.__scopeSlider,
|
|
246
|
-
startEdge: p ? "bottom" : "top",
|
|
247
|
-
endEdge: p ? "top" : "bottom",
|
|
248
|
-
size: "height",
|
|
249
|
-
direction: p ? 1 : -1,
|
|
250
|
-
children: /* @__PURE__ */ V(we, {
|
|
251
|
-
"data-orientation": "vertical",
|
|
252
|
-
...l,
|
|
253
|
-
ref: d,
|
|
254
|
-
style: {
|
|
255
|
-
...l.style,
|
|
256
|
-
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
257
|
-
},
|
|
258
|
-
onSlideStart: (e) => {
|
|
259
|
-
let t = m(e.clientY);
|
|
260
|
-
a?.(t);
|
|
261
|
-
},
|
|
262
|
-
onSlideMove: (e) => {
|
|
263
|
-
let t = m(e.clientY);
|
|
264
|
-
o?.(t);
|
|
265
|
-
},
|
|
266
|
-
onSlideEnd: () => {
|
|
267
|
-
f.current = void 0, s?.();
|
|
268
|
-
},
|
|
269
|
-
onStepKeyDown: (e) => {
|
|
270
|
-
let t = ge[p ? "from-bottom" : "from-top"].includes(e.key);
|
|
271
|
-
c?.({
|
|
272
|
-
event: e,
|
|
273
|
-
direction: t ? -1 : 1
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
})
|
|
277
|
-
});
|
|
278
|
-
}), we = N.forwardRef((e, t) => {
|
|
279
|
-
let { __scopeSlider: n, onSlideStart: r, onSlideMove: i, onSlideEnd: a, onHomeKeyDown: o, onEndKeyDown: s, onStepKeyDown: c, ...l } = e, u = $(J, n);
|
|
280
|
-
return /* @__PURE__ */ V(k.span, {
|
|
281
|
-
...l,
|
|
282
|
-
ref: t,
|
|
283
|
-
onKeyDown: E(e.onKeyDown, (e) => {
|
|
284
|
-
e.key === "Home" ? (o(e), e.preventDefault()) : e.key === "End" ? (s(e), e.preventDefault()) : K.concat(q).includes(e.key) && (c(e), e.preventDefault());
|
|
285
|
-
}),
|
|
286
|
-
onPointerDown: E(e.onPointerDown, (e) => {
|
|
287
|
-
let t = e.target;
|
|
288
|
-
t.setPointerCapture(e.pointerId), e.preventDefault(), u.thumbs.has(t) ? t.focus() : r(e);
|
|
289
|
-
}),
|
|
290
|
-
onPointerMove: E(e.onPointerMove, (e) => {
|
|
291
|
-
e.target.hasPointerCapture(e.pointerId) && i(e);
|
|
292
|
-
}),
|
|
293
|
-
onPointerUp: E(e.onPointerUp, (e) => {
|
|
294
|
-
let t = e.target;
|
|
295
|
-
t.hasPointerCapture(e.pointerId) && (t.releasePointerCapture(e.pointerId), a(e));
|
|
296
|
-
})
|
|
297
|
-
});
|
|
298
|
-
}), Te = "SliderTrack", Ee = N.forwardRef((e, t) => {
|
|
299
|
-
let { __scopeSlider: n, ...r } = e, i = $(Te, n);
|
|
300
|
-
return /* @__PURE__ */ V(k.span, {
|
|
301
|
-
"data-disabled": i.disabled ? "" : void 0,
|
|
302
|
-
"data-orientation": i.orientation,
|
|
303
|
-
...r,
|
|
304
|
-
ref: t
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
Ee.displayName = Te;
|
|
308
|
-
var De = "SliderRange", Oe = N.forwardRef((e, t) => {
|
|
309
|
-
let { __scopeSlider: n, ...r } = e, i = $(De, n), a = xe(De, n), o = N.useRef(null), s = T(t, o), c = i.values.length, l = i.values.map((e) => Fe(e, i.min, i.max)), u = c > 1 ? Math.min(...l) : 0, d = 100 - Math.max(...l);
|
|
310
|
-
return /* @__PURE__ */ V(k.span, {
|
|
311
|
-
"data-orientation": i.orientation,
|
|
312
|
-
"data-disabled": i.disabled ? "" : void 0,
|
|
313
|
-
...r,
|
|
314
|
-
ref: s,
|
|
315
|
-
style: {
|
|
316
|
-
...e.style,
|
|
317
|
-
[a.startEdge]: u + "%",
|
|
318
|
-
[a.endEdge]: d + "%"
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
Oe.displayName = De;
|
|
323
|
-
var ke = "SliderThumb", Ae = N.forwardRef((e, t) => {
|
|
324
|
-
let n = X(e.__scopeSlider), [r, i] = N.useState(null), a = T(t, (e) => i(e)), o = N.useMemo(() => r ? n().findIndex((e) => e.ref.current === r) : -1, [n, r]);
|
|
325
|
-
return /* @__PURE__ */ V(je, {
|
|
326
|
-
...e,
|
|
327
|
-
ref: a,
|
|
328
|
-
index: o
|
|
329
|
-
});
|
|
330
|
-
}), je = N.forwardRef((e, t) => {
|
|
331
|
-
let { __scopeSlider: n, index: r, name: i, ...a } = e, o = $(ke, n), s = xe(ke, n), [c, l] = N.useState(null), u = T(t, (e) => l(e)), d = !c || o.form || !!c.closest("form"), f = re(c), p = o.values[r], m = p === void 0 ? 0 : Fe(p, o.min, o.max), h = Ie(r, o.values.length), g = f?.[s.size], _ = g ? Re(g, m, s.direction) : 0;
|
|
332
|
-
return N.useEffect(() => {
|
|
333
|
-
if (c) return o.thumbs.add(c), () => {
|
|
334
|
-
o.thumbs.delete(c);
|
|
335
|
-
};
|
|
336
|
-
}, [c, o.thumbs]), /* @__PURE__ */ H("span", {
|
|
337
|
-
style: {
|
|
338
|
-
transform: "var(--radix-slider-thumb-transform)",
|
|
339
|
-
position: "absolute",
|
|
340
|
-
[s.startEdge]: `calc(${m}% + ${_}px)`
|
|
341
|
-
},
|
|
342
|
-
children: [/* @__PURE__ */ V(Y.ItemSlot, {
|
|
343
|
-
scope: e.__scopeSlider,
|
|
344
|
-
children: /* @__PURE__ */ V(k.span, {
|
|
345
|
-
role: "slider",
|
|
346
|
-
"aria-label": e["aria-label"] || h,
|
|
347
|
-
"aria-valuemin": o.min,
|
|
348
|
-
"aria-valuenow": p,
|
|
349
|
-
"aria-valuemax": o.max,
|
|
350
|
-
"aria-orientation": o.orientation,
|
|
351
|
-
"data-orientation": o.orientation,
|
|
352
|
-
"data-disabled": o.disabled ? "" : void 0,
|
|
353
|
-
tabIndex: o.disabled ? void 0 : 0,
|
|
354
|
-
...a,
|
|
355
|
-
ref: u,
|
|
356
|
-
style: p === void 0 ? { display: "none" } : e.style,
|
|
357
|
-
onFocus: E(e.onFocus, () => {
|
|
358
|
-
o.valueIndexToChangeRef.current = r;
|
|
359
|
-
})
|
|
360
|
-
})
|
|
361
|
-
}), d && /* @__PURE__ */ V(Ne, {
|
|
362
|
-
name: i ?? (o.name ? o.name + (o.values.length > 1 ? "[]" : "") : void 0),
|
|
363
|
-
form: o.form,
|
|
364
|
-
value: p
|
|
365
|
-
}, r)]
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
Ae.displayName = ke;
|
|
369
|
-
var Me = "RadioBubbleInput", Ne = N.forwardRef(({ __scopeSlider: e, value: t, ...n }, r) => {
|
|
370
|
-
let i = N.useRef(null), a = T(i, r), o = g(t);
|
|
371
|
-
return N.useEffect(() => {
|
|
372
|
-
let e = i.current;
|
|
373
|
-
if (!e) return;
|
|
374
|
-
let n = window.HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(n, "value").set;
|
|
375
|
-
if (o !== t && r) {
|
|
376
|
-
let n = new Event("input", { bubbles: !0 });
|
|
377
|
-
r.call(e, t), e.dispatchEvent(n);
|
|
378
|
-
}
|
|
379
|
-
}, [o, t]), /* @__PURE__ */ V(k.input, {
|
|
380
|
-
style: { display: "none" },
|
|
381
|
-
...n,
|
|
382
|
-
ref: a,
|
|
383
|
-
defaultValue: t
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
Ne.displayName = Me;
|
|
387
|
-
function Pe(e = [], t, n) {
|
|
388
|
-
let r = [...e];
|
|
389
|
-
return r[n] = t, r.sort((e, t) => e - t);
|
|
390
|
-
}
|
|
391
|
-
function Fe(e, t, n) {
|
|
392
|
-
let r = 100 / (n - t) * (e - t);
|
|
393
|
-
return _(r, [0, 100]);
|
|
394
|
-
}
|
|
395
|
-
function Ie(e, t) {
|
|
396
|
-
if (t > 2) return `Value ${e + 1} of ${t}`;
|
|
397
|
-
if (t === 2) return ["Minimum", "Maximum"][e];
|
|
398
|
-
}
|
|
399
|
-
function Le(e, t) {
|
|
400
|
-
if (e.length === 1) return 0;
|
|
401
|
-
let n = e.map((e) => Math.abs(e - t)), r = Math.min(...n);
|
|
402
|
-
return n.indexOf(r);
|
|
403
|
-
}
|
|
404
|
-
function Re(e, t, n) {
|
|
405
|
-
let r = e / 2;
|
|
406
|
-
return (r - Ve([0, 50], [0, r])(t) * n) * n;
|
|
407
|
-
}
|
|
408
|
-
function ze(e) {
|
|
409
|
-
return e.slice(0, -1).map((t, n) => e[n + 1] - t);
|
|
410
|
-
}
|
|
411
|
-
function Be(e, t) {
|
|
412
|
-
if (t > 0) {
|
|
413
|
-
let n = ze(e);
|
|
414
|
-
return Math.min(...n) >= t;
|
|
415
|
-
}
|
|
416
|
-
return !0;
|
|
417
|
-
}
|
|
418
|
-
function Ve(e, t) {
|
|
419
|
-
return (n) => {
|
|
420
|
-
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
421
|
-
let r = (t[1] - t[0]) / (e[1] - e[0]);
|
|
422
|
-
return t[0] + r * (n - e[0]);
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
function He(e) {
|
|
426
|
-
return (String(e).split(".")[1] || "").length;
|
|
427
|
-
}
|
|
428
|
-
function Ue(e, t) {
|
|
429
|
-
let n = 10 ** t;
|
|
430
|
-
return Math.round(e * n) / n;
|
|
431
|
-
}
|
|
432
|
-
var We = ye, Ge = Ee, Ke = Oe, qe = Ae, Je = We, Ye = Ge, Xe = Ke, Ze = qe, Qe = ({ currentTime: e, duration: n, buffered: i = 0, disabled: a, onSeek: o }) => {
|
|
433
|
-
let s = t(), [c, l] = z(null), u = R(!1), d = n > 0 ? n : 0, f = c ?? e, p = d > 0 ? Math.min(Math.max(f, 0), d) / d * 100 : 0, m = d > 0 ? Math.min(i / d * 100, 100) : 0, h = a || d === 0, g = R(null), [_, v] = z(0);
|
|
434
|
-
I(() => {
|
|
435
|
-
let e = g.current;
|
|
436
|
-
if (!e) return;
|
|
437
|
-
let t = () => v(e.clientWidth);
|
|
438
|
-
t();
|
|
439
|
-
let n = new ResizeObserver(t);
|
|
440
|
-
return n.observe(e), () => n.disconnect();
|
|
441
|
-
}, []);
|
|
442
|
-
let y = _ > 0 ? `${Math.round(_ * p / 100)}px` : `${p}%`, b = F((e) => {
|
|
443
|
-
let [t] = e;
|
|
444
|
-
t !== void 0 && u.current && l(t);
|
|
445
|
-
}, []), x = F((e) => {
|
|
446
|
-
let [t] = e;
|
|
447
|
-
t === void 0 || u.current || o(t);
|
|
448
|
-
}, [o]), S = F(() => {
|
|
449
|
-
u.current = !0;
|
|
450
|
-
}, []), C = F(() => {
|
|
451
|
-
u.current = !1, l(null);
|
|
452
|
-
}, []), w = F(() => {
|
|
453
|
-
u.current && (u.current = !1, l(null), c !== null && o(c));
|
|
454
|
-
}, [c, o]);
|
|
455
|
-
return /* @__PURE__ */ H(Je, {
|
|
456
|
-
value: [f],
|
|
457
|
-
onValueChange: b,
|
|
458
|
-
onValueCommit: x,
|
|
459
|
-
onPointerDown: S,
|
|
460
|
-
onPointerCancel: C,
|
|
461
|
-
onLostPointerCapture: w,
|
|
462
|
-
min: 0,
|
|
463
|
-
max: d || 1,
|
|
464
|
-
step: 1,
|
|
465
|
-
disabled: h,
|
|
466
|
-
className: r("group relative flex w-full touch-none select-none items-center py-2", a && "opacity-50"),
|
|
467
|
-
children: [
|
|
468
|
-
/* @__PURE__ */ H(Ye, {
|
|
469
|
-
ref: g,
|
|
470
|
-
className: "relative h-2 grow overflow-hidden rounded bg-f1-background-tertiary",
|
|
471
|
-
children: [/* @__PURE__ */ V("span", {
|
|
472
|
-
"aria-hidden": !0,
|
|
473
|
-
className: "absolute h-full bg-f1-background-secondary",
|
|
474
|
-
style: { width: `${m}%` }
|
|
475
|
-
}), /* @__PURE__ */ V("span", {
|
|
476
|
-
"aria-hidden": !0,
|
|
477
|
-
className: "absolute h-full bg-f1-background-selected-bold",
|
|
478
|
-
style: { width: `${p}%` }
|
|
479
|
-
})]
|
|
480
|
-
}),
|
|
481
|
-
h ? null : /* @__PURE__ */ V("span", {
|
|
482
|
-
"aria-hidden": !0,
|
|
483
|
-
style: { left: y },
|
|
484
|
-
className: r("pointer-events-none absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full bg-f1-background-selected-bold opacity-0 transition-opacity", "group-hover:opacity-100 group-has-[:focus-visible]:opacity-100", "group-has-[:focus-visible]:ring-1 group-has-[:focus-visible]:ring-f1-special-ring group-has-[:focus-visible]:ring-offset-1")
|
|
485
|
-
}),
|
|
486
|
-
/* @__PURE__ */ V(Ze, {
|
|
487
|
-
"aria-label": s.audioPlayer.seek,
|
|
488
|
-
"aria-valuetext": s.t("audioPlayer.position", {
|
|
489
|
-
current: U(f),
|
|
490
|
-
total: U(d)
|
|
491
|
-
}),
|
|
492
|
-
className: "block size-3 opacity-0 focus-visible:outline-none"
|
|
493
|
-
})
|
|
494
|
-
]
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
|
-
//#endregion
|
|
498
|
-
//#region src/blocks/F0AudioPlayer/components/LanguageSelect.tsx
|
|
499
|
-
function $e({ value: e, options: t, onChange: n, kind: i }) {
|
|
500
|
-
let [a, o] = z(!1), c = t.find((t) => t.locale === e), l = c ? M(c) : e;
|
|
501
|
-
return /* @__PURE__ */ H(ne, {
|
|
502
|
-
open: a,
|
|
503
|
-
onOpenChange: o,
|
|
504
|
-
children: [/* @__PURE__ */ V(C, {
|
|
505
|
-
asChild: !0,
|
|
506
|
-
children: /* @__PURE__ */ V(s, {
|
|
507
|
-
variant: "outline",
|
|
508
|
-
size: "sm",
|
|
509
|
-
label: l,
|
|
510
|
-
"aria-label": `${i}: ${l}`,
|
|
511
|
-
tooltip: i
|
|
512
|
-
})
|
|
513
|
-
}), /* @__PURE__ */ V(D, {
|
|
514
|
-
align: "end",
|
|
515
|
-
sideOffset: 4,
|
|
516
|
-
className: r("flex w-auto min-w-[8rem] flex-col gap-0.5 rounded-md border", "border-solid border-f1-border-secondary bg-f1-background p-1 shadow-md"),
|
|
517
|
-
role: "menu",
|
|
518
|
-
"aria-label": i,
|
|
519
|
-
onKeyDown: (e) => {
|
|
520
|
-
let t = Array.from(e.currentTarget.querySelectorAll("[role=\"menuitemradio\"]"));
|
|
521
|
-
if (t.length === 0) return;
|
|
522
|
-
let n = t.indexOf(document.activeElement), r;
|
|
523
|
-
switch (e.key) {
|
|
524
|
-
case "ArrowDown":
|
|
525
|
-
r = n < 0 ? 0 : (n + 1) % t.length;
|
|
526
|
-
break;
|
|
527
|
-
case "ArrowUp":
|
|
528
|
-
r = n <= 0 ? t.length - 1 : n - 1;
|
|
529
|
-
break;
|
|
530
|
-
case "Home":
|
|
531
|
-
r = 0;
|
|
532
|
-
break;
|
|
533
|
-
case "End":
|
|
534
|
-
r = t.length - 1;
|
|
535
|
-
break;
|
|
536
|
-
default: return;
|
|
537
|
-
}
|
|
538
|
-
e.preventDefault(), t[r]?.focus();
|
|
539
|
-
},
|
|
540
|
-
children: t.map((t) => {
|
|
541
|
-
let i = t.locale === e;
|
|
542
|
-
return /* @__PURE__ */ H("button", {
|
|
543
|
-
type: "button",
|
|
544
|
-
role: "menuitemradio",
|
|
545
|
-
"aria-checked": i,
|
|
546
|
-
className: r("relative flex items-center rounded-xs py-1.5 pl-8 pr-3", "cursor-pointer border-none bg-transparent text-left text-sm font-medium", "text-f1-foreground transition-colors hover:bg-f1-background-secondary", "focus-visible:bg-f1-background-secondary focus-visible:outline-none", "[&_svg]:h-3.5 [&_svg]:w-3.5"),
|
|
547
|
-
onClick: () => {
|
|
548
|
-
n(t.locale), o(!1);
|
|
549
|
-
},
|
|
550
|
-
children: [i ? /* @__PURE__ */ V("span", {
|
|
551
|
-
className: "absolute left-2.5 inline-flex items-center",
|
|
552
|
-
children: /* @__PURE__ */ V(m, {})
|
|
553
|
-
}) : null, M(t)]
|
|
554
|
-
}, t.locale);
|
|
555
|
-
})
|
|
556
|
-
})]
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
//#endregion
|
|
560
|
-
//#region src/blocks/F0AudioPlayer/components/PlaybackTime.tsx
|
|
561
|
-
var et = f({
|
|
562
|
-
base: "shrink-0 font-medium tabular-nums text-f1-foreground-secondary",
|
|
563
|
-
variants: { size: {
|
|
564
|
-
sm: "text-xs",
|
|
565
|
-
md: "text-sm"
|
|
566
|
-
} }
|
|
567
|
-
}), tt = ({ currentTime: e, duration: t, size: n = "md" }) => /* @__PURE__ */ H("span", {
|
|
568
|
-
className: et({ size: n }),
|
|
569
|
-
children: [
|
|
570
|
-
U(e),
|
|
571
|
-
" / ",
|
|
572
|
-
U(t)
|
|
573
|
-
]
|
|
574
|
-
}), nt = ({ isPlaying: e, disabled: n, size: a = "md", onToggle: o }) => {
|
|
575
|
-
let s = t(), c = e ? u : d;
|
|
576
|
-
return /* @__PURE__ */ V("button", {
|
|
577
|
-
type: "button",
|
|
578
|
-
"aria-label": e ? s.audioPlayer.pause : s.audioPlayer.play,
|
|
579
|
-
disabled: n,
|
|
580
|
-
onClick: o,
|
|
581
|
-
className: r("flex shrink-0 items-center justify-center rounded-xl border border-solid border-f1-border-secondary bg-f1-background-inverse-secondary text-f1-foreground-secondary transition-colors dark:bg-f1-background-tertiary", "hover:bg-f1-background-secondary disabled:cursor-not-allowed disabled:opacity-50", a === "sm" ? "size-8" : "size-10", i()),
|
|
582
|
-
children: /* @__PURE__ */ V(c, { className: a === "sm" ? "size-5" : "size-6" })
|
|
583
|
-
});
|
|
584
|
-
}, rt = ({ playbackRate: e, playbackRates: n, onRateChange: i, disabled: a, extraItems: o = [], audioLanguages: l = [], audioLanguage: u, onAudioLanguageChange: d }) => {
|
|
585
|
-
let f = t(), m = n.length > 0, g = l.length > 1;
|
|
586
|
-
return /* @__PURE__ */ H(O, { children: [/* @__PURE__ */ V(y, {
|
|
587
|
-
asChild: !0,
|
|
588
|
-
children: /* @__PURE__ */ V(s, {
|
|
589
|
-
variant: "ghost",
|
|
590
|
-
size: "sm",
|
|
591
|
-
icon: c,
|
|
592
|
-
label: f.audioPlayer.options,
|
|
593
|
-
hideLabel: !0,
|
|
594
|
-
disabled: a
|
|
595
|
-
})
|
|
596
|
-
}), /* @__PURE__ */ H(v, {
|
|
597
|
-
align: "end",
|
|
598
|
-
className: "flex min-w-44 flex-col gap-0.5",
|
|
599
|
-
children: [
|
|
600
|
-
m ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(S, {
|
|
601
|
-
className: "text-f1-foreground-secondary",
|
|
602
|
-
children: f.audioPlayer.playbackSpeed
|
|
603
|
-
}), n.map((t) => {
|
|
604
|
-
let n = t === e;
|
|
605
|
-
return /* @__PURE__ */ H(x, {
|
|
606
|
-
onSelect: () => i(t),
|
|
607
|
-
className: r("justify-between gap-3 px-3 text-sm text-f1-foreground", n && "before:absolute before:inset-x-1 before:inset-y-0 before:rounded before:bg-f1-background-selected-bold/10 before:content-[''] dark:before:bg-f1-background-selected-bold/20"),
|
|
608
|
-
children: [/* @__PURE__ */ H("span", {
|
|
609
|
-
className: "relative",
|
|
610
|
-
children: [t, "x"]
|
|
611
|
-
}), n ? /* @__PURE__ */ V("span", {
|
|
612
|
-
className: "relative flex text-f1-icon-selected",
|
|
613
|
-
children: /* @__PURE__ */ V(p, {
|
|
614
|
-
icon: h,
|
|
615
|
-
size: "md"
|
|
616
|
-
})
|
|
617
|
-
}) : null]
|
|
618
|
-
}, t);
|
|
619
|
-
})] }) : null,
|
|
620
|
-
g ? /* @__PURE__ */ H(B, { children: [
|
|
621
|
-
m ? /* @__PURE__ */ V(b, {}) : null,
|
|
622
|
-
/* @__PURE__ */ V(S, {
|
|
623
|
-
className: "text-f1-foreground-secondary",
|
|
624
|
-
children: f.audioPlayer.audio
|
|
625
|
-
}),
|
|
626
|
-
l.map((e) => {
|
|
627
|
-
let t = e.locale === u;
|
|
628
|
-
return /* @__PURE__ */ H(x, {
|
|
629
|
-
onSelect: () => d?.(e.locale),
|
|
630
|
-
className: r("justify-between gap-3 px-3 text-sm text-f1-foreground", t && "before:absolute before:inset-x-1 before:inset-y-0 before:rounded before:bg-f1-background-selected-bold/10 before:content-[''] dark:before:bg-f1-background-selected-bold/20"),
|
|
631
|
-
children: [/* @__PURE__ */ V("span", {
|
|
632
|
-
className: "relative",
|
|
633
|
-
children: M(e)
|
|
634
|
-
}), t ? /* @__PURE__ */ V("span", {
|
|
635
|
-
className: "relative flex text-f1-icon-selected",
|
|
636
|
-
children: /* @__PURE__ */ V(p, {
|
|
637
|
-
icon: h,
|
|
638
|
-
size: "md"
|
|
639
|
-
})
|
|
640
|
-
}) : null]
|
|
641
|
-
}, e.locale);
|
|
642
|
-
})
|
|
643
|
-
] }) : null,
|
|
644
|
-
o.length > 0 ? /* @__PURE__ */ H(B, { children: [m || g ? /* @__PURE__ */ V(b, {}) : null, o.map((e) => /* @__PURE__ */ H(x, {
|
|
645
|
-
onSelect: () => e.onClick(),
|
|
646
|
-
className: r("gap-2 px-3 text-sm", e.critical ? "text-f1-foreground-critical" : "text-f1-foreground"),
|
|
647
|
-
children: [e.icon ? /* @__PURE__ */ V("span", {
|
|
648
|
-
className: r("relative flex", e.critical ? "text-f1-icon-critical" : "text-f1-icon"),
|
|
649
|
-
children: /* @__PURE__ */ V(p, {
|
|
650
|
-
icon: e.icon,
|
|
651
|
-
size: "md"
|
|
652
|
-
})
|
|
653
|
-
}) : null, /* @__PURE__ */ V("span", {
|
|
654
|
-
className: "relative",
|
|
655
|
-
children: e.label
|
|
656
|
-
})]
|
|
657
|
-
}, e.label))] }) : null
|
|
658
|
-
]
|
|
659
|
-
})] });
|
|
660
|
-
}, it = (e) => r("block w-full rounded px-2 py-1 text-left transition-colors", e ? "bg-f1-background-selected-secondary font-medium" : "bg-transparent"), at = P(function({ cue: e, index: n, isActive: a, onSeek: o, cueRefs: s }) {
|
|
661
|
-
let c = t(), { startTime: u } = e, d = o && u !== void 0, f = F((e) => {
|
|
662
|
-
s?.current && (s.current[n] = e);
|
|
663
|
-
}, [s, n]), p = F(() => {
|
|
664
|
-
u !== void 0 && o?.(u);
|
|
665
|
-
}, [o, u]);
|
|
666
|
-
return /* @__PURE__ */ V("li", {
|
|
667
|
-
ref: f,
|
|
668
|
-
children: d ? /* @__PURE__ */ V("button", {
|
|
669
|
-
type: "button",
|
|
670
|
-
onClick: p,
|
|
671
|
-
"aria-current": a || void 0,
|
|
672
|
-
title: c.t("audioPlayer.jumpTo", { time: U(u) }),
|
|
673
|
-
className: r(it(a), i(), !a && "hover:bg-f1-background-secondary"),
|
|
674
|
-
children: /* @__PURE__ */ V(l, {
|
|
675
|
-
as: "span",
|
|
676
|
-
variant: "body",
|
|
677
|
-
content: e.text
|
|
678
|
-
})
|
|
679
|
-
}) : /* @__PURE__ */ V("div", {
|
|
680
|
-
className: it(a),
|
|
681
|
-
children: /* @__PURE__ */ V(l, {
|
|
682
|
-
as: "span",
|
|
683
|
-
variant: "body",
|
|
684
|
-
content: e.text
|
|
685
|
-
})
|
|
686
|
-
})
|
|
687
|
-
});
|
|
688
|
-
}), ot = P(function({ cues: e, activeIndex: n, onSeek: r, cueRefs: i }) {
|
|
689
|
-
let a = t();
|
|
690
|
-
return /* @__PURE__ */ H(B, { children: [r ? /* @__PURE__ */ V("p", {
|
|
691
|
-
className: "sr-only",
|
|
692
|
-
children: a.audioPlayer.transcriptHint
|
|
693
|
-
}) : null, /* @__PURE__ */ V("ol", {
|
|
694
|
-
className: "flex list-none flex-col gap-1 p-0",
|
|
695
|
-
children: e.map((e, t) => /* @__PURE__ */ V(at, {
|
|
696
|
-
cue: e,
|
|
697
|
-
index: t,
|
|
698
|
-
isActive: t === n,
|
|
699
|
-
onSeek: r,
|
|
700
|
-
cueRefs: i
|
|
701
|
-
}, t))
|
|
702
|
-
})] });
|
|
703
|
-
});
|
|
704
|
-
//#endregion
|
|
705
|
-
//#region src/blocks/F0AudioPlayer/useAudioLanguage.ts
|
|
706
|
-
function st(e, t) {
|
|
707
|
-
let n = L(() => ce(e), [e]), [r, i] = z(() => se(n, t)), a = n.some((e) => e.locale === r) ? r : se(n, t);
|
|
708
|
-
return {
|
|
709
|
-
languages: n,
|
|
710
|
-
activeLocale: a,
|
|
711
|
-
resolvedSrc: oe(e, a) ?? "",
|
|
712
|
-
setLocale: i
|
|
713
|
-
};
|
|
714
|
-
}
|
|
715
|
-
function ct(e) {
|
|
716
|
-
if (!e) return;
|
|
717
|
-
let t = e.currentTime, n = !e.paused, r = () => {
|
|
718
|
-
e.currentTime = t, n && e.play().catch(() => {}), e.removeEventListener("loadedmetadata", r);
|
|
719
|
-
};
|
|
720
|
-
e.addEventListener("loadedmetadata", r);
|
|
721
|
-
}
|
|
722
|
-
//#endregion
|
|
723
|
-
//#region src/blocks/F0AudioPlayer/usePlayerController.ts
|
|
724
|
-
var lt = (e) => {
|
|
725
|
-
let { src: t, duration: n, playing: r, onPlayingChange: i, playbackRates: a = [
|
|
726
|
-
1,
|
|
727
|
-
1.5,
|
|
728
|
-
2
|
|
729
|
-
], onPlay: o, onPause: s, onSeek: c, onTimeUpdate: l, onEnded: u, onError: d } = e, f = typeof t == "function" ? t : void 0, p = typeof t == "function" ? void 0 : t, m = R(null), [h, g] = z(p), _ = R(null), [v, y] = z(null), b = R(!1), x = R(!1), S = R(!1), C = F(async () => {
|
|
730
|
-
if (f && !b.current) {
|
|
731
|
-
b.current = !0;
|
|
732
|
-
try {
|
|
733
|
-
g(await f());
|
|
734
|
-
} catch {
|
|
735
|
-
x.current = !1, d?.(null);
|
|
736
|
-
} finally {
|
|
737
|
-
b.current = !1;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}, [f, d]), w = F(() => {
|
|
741
|
-
S.current = !1, o?.();
|
|
742
|
-
}, [o]), ee = F((e) => {
|
|
743
|
-
d?.(e), f && !S.current && (S.current = !0, x.current = !0, g(void 0), C());
|
|
744
|
-
}, [
|
|
745
|
-
d,
|
|
746
|
-
f,
|
|
747
|
-
C
|
|
748
|
-
]), T = j(m, {
|
|
749
|
-
onPlay: w,
|
|
750
|
-
onPause: s,
|
|
751
|
-
onSeek: c,
|
|
752
|
-
onTimeUpdate: l,
|
|
753
|
-
onEnded: u,
|
|
754
|
-
onError: ee
|
|
755
|
-
}, n ?? 0), E = T.seek, D = F((e) => {
|
|
756
|
-
let t = m.current, n = Math.max(e, 0);
|
|
757
|
-
t && h && t.readyState >= t.HAVE_METADATA ? E(n) : (_.current = n, y(n));
|
|
758
|
-
}, [E, h]);
|
|
759
|
-
I(() => {
|
|
760
|
-
let e = m.current;
|
|
761
|
-
if (!e) return;
|
|
762
|
-
let t = () => {
|
|
763
|
-
let e = _.current;
|
|
764
|
-
e !== null && (_.current = null, y(null), E(e));
|
|
765
|
-
};
|
|
766
|
-
return e.addEventListener("loadedmetadata", t), () => e.removeEventListener("loadedmetadata", t);
|
|
767
|
-
}, [E]), I(() => {
|
|
768
|
-
p !== void 0 && g(p);
|
|
769
|
-
}, [p]), I(() => {
|
|
770
|
-
h && x.current && (x.current = !1, T.play());
|
|
771
|
-
}, [h, T]);
|
|
772
|
-
let O = F(() => {
|
|
773
|
-
!T.isPlaying && !h && f ? (x.current = !0, C()) : T.toggle();
|
|
774
|
-
}, [
|
|
775
|
-
T,
|
|
776
|
-
h,
|
|
777
|
-
f,
|
|
778
|
-
C
|
|
779
|
-
]);
|
|
780
|
-
I(() => {
|
|
781
|
-
r !== void 0 && (r && !T.isPlaying ? !h && f ? (x.current = !0, C()) : T.play() : !r && T.isPlaying && T.pause());
|
|
782
|
-
}, [
|
|
783
|
-
r,
|
|
784
|
-
T,
|
|
785
|
-
h,
|
|
786
|
-
f,
|
|
787
|
-
C
|
|
788
|
-
]);
|
|
789
|
-
let k = R(T.isPlaying);
|
|
790
|
-
I(() => {
|
|
791
|
-
k.current !== T.isPlaying && (k.current = T.isPlaying, i?.(T.isPlaying));
|
|
792
|
-
}, [T.isPlaying, i]);
|
|
793
|
-
let te = v !== null && T.duration > 0 ? Math.min(v, T.duration) : null;
|
|
794
|
-
return {
|
|
795
|
-
audioRef: m,
|
|
796
|
-
currentSrc: h,
|
|
797
|
-
pendingTime: v,
|
|
798
|
-
isPlaying: T.isPlaying,
|
|
799
|
-
currentTime: te ?? T.currentTime,
|
|
800
|
-
duration: T.duration,
|
|
801
|
-
buffered: T.buffered,
|
|
802
|
-
playbackRate: T.playbackRate,
|
|
803
|
-
isLoading: T.isLoading,
|
|
804
|
-
error: T.error,
|
|
805
|
-
toggle: O,
|
|
806
|
-
seek: D,
|
|
807
|
-
setPlaybackRate: T.setPlaybackRate,
|
|
808
|
-
playbackRates: a
|
|
809
|
-
};
|
|
810
|
-
}, ut = /* @__PURE__ */ new Set([
|
|
811
|
-
"ArrowUp",
|
|
812
|
-
"ArrowDown",
|
|
813
|
-
"PageUp",
|
|
814
|
-
"PageDown",
|
|
815
|
-
"Home",
|
|
816
|
-
"End",
|
|
817
|
-
" "
|
|
818
|
-
]), dt = le((e, n) => {
|
|
819
|
-
let { title: i, subtitle: c, actions: l, className: u, src: d, preload: f, autoPlay: p = !1, disabled: m = !1, ariaLabel: h, size: g = "md", content: _, defaultLanguage: v, details: y, expanded: b, defaultExpanded: x = !1, onExpandedChange: S, detailsMaxHeight: C = 200 } = e, w = t(), T = st(d, v), E = lt({
|
|
820
|
-
...e,
|
|
821
|
-
src: T.resolvedSrc
|
|
822
|
-
}), D = ue(e), O = o(), k = (e) => {
|
|
823
|
-
ct(E.audioRef.current), T.setLocale(e);
|
|
824
|
-
}, te = !_ && !!(y && y.length > 0), A = L(() => ce(_?.summary, _?.transcription), [_?.summary, _?.transcription]), [ne, re] = z(() => se(A, v)), j = A.some((e) => e.locale === ne) ? ne : se(A, v), M = oe(_?.summary, j), N = oe(_?.transcription, j), le = he(E.audioRef, E.currentSrc, !N), P = N ?? le, B = Array.isArray(P) ? P : void 0, U = typeof P == "string" ? P : void 0, W = !!(U || B?.length), pe = L(() => B ? de(B) : [], [B]), G = pe.length > 0, me = E.pendingTime ?? E.currentTime, K = L(() => G ? fe(pe, me) : -1, [
|
|
825
|
-
G,
|
|
826
|
-
pe,
|
|
827
|
-
me
|
|
828
|
-
]), q = R(null), ge = R([]), J = R(!1), Y = F((e) => {
|
|
829
|
-
J.current = !1, E.seek(e);
|
|
830
|
-
}, [E.seek]);
|
|
831
|
-
I(() => {
|
|
832
|
-
let e = q.current;
|
|
833
|
-
if (!e) return;
|
|
834
|
-
let t = () => {
|
|
835
|
-
J.current = !0;
|
|
836
|
-
}, n = (e) => {
|
|
837
|
-
ut.has(e.key) && t();
|
|
838
|
-
}, r = (n) => {
|
|
839
|
-
e.contains(n.target) || t();
|
|
840
|
-
}, i = e.parentElement;
|
|
841
|
-
return e.addEventListener("wheel", t, { passive: !0 }), e.addEventListener("touchmove", t, { passive: !0 }), e.addEventListener("keydown", n), i?.addEventListener("pointerdown", r), () => {
|
|
842
|
-
e.removeEventListener("wheel", t), e.removeEventListener("touchmove", t), e.removeEventListener("keydown", n), i?.removeEventListener("pointerdown", r);
|
|
843
|
-
};
|
|
844
|
-
}, [W]);
|
|
845
|
-
let X = L(() => {
|
|
846
|
-
if (te) return y ?? [];
|
|
847
|
-
let e = [];
|
|
848
|
-
return M && e.push({
|
|
849
|
-
value: "summary",
|
|
850
|
-
label: w.audioPlayer.summary,
|
|
851
|
-
content: /* @__PURE__ */ V("p", {
|
|
852
|
-
className: "whitespace-pre-line",
|
|
853
|
-
children: M
|
|
854
|
-
})
|
|
855
|
-
}), W && e.push({
|
|
856
|
-
value: "transcription",
|
|
857
|
-
label: w.audioPlayer.transcription,
|
|
858
|
-
content: B ? /* @__PURE__ */ V(ot, {
|
|
859
|
-
cues: B,
|
|
860
|
-
activeIndex: K,
|
|
861
|
-
onSeek: G ? Y : void 0,
|
|
862
|
-
cueRefs: ge
|
|
863
|
-
}) : /* @__PURE__ */ V("p", {
|
|
864
|
-
className: "whitespace-pre-line",
|
|
865
|
-
children: U
|
|
866
|
-
})
|
|
867
|
-
}), e;
|
|
868
|
-
}, [
|
|
869
|
-
te,
|
|
870
|
-
y,
|
|
871
|
-
M,
|
|
872
|
-
W,
|
|
873
|
-
B,
|
|
874
|
-
U,
|
|
875
|
-
K,
|
|
876
|
-
G,
|
|
877
|
-
Y,
|
|
878
|
-
w.audioPlayer.summary,
|
|
879
|
-
w.audioPlayer.transcription
|
|
880
|
-
]), _e = W ? "available" : "missing", Z = X.length > 0, Q = X.length === 1 ? X[0] : void 0, ve = (e) => Q?.value === "transcription" ? e ? w.audioPlayer.hideTranscription : w.audioPlayer.viewTranscription : Q?.value === "summary" ? e ? w.audioPlayer.hideSummary : w.audioPlayer.viewSummary : e ? w.audioPlayer.hideDetail : w.audioPlayer.viewDetail, [$ = !1, ye] = ee({
|
|
881
|
-
prop: b,
|
|
882
|
-
defaultProp: x,
|
|
883
|
-
onChange: S
|
|
884
|
-
});
|
|
885
|
-
I(() => {
|
|
886
|
-
if (!$ || K < 0 || J.current) return;
|
|
887
|
-
let e = q.current, t = ge.current[K];
|
|
888
|
-
if (!e || !t) return;
|
|
889
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = r.top - n.top, a = r.bottom - n.bottom;
|
|
890
|
-
i >= 0 && a <= 0 || e.scrollTo({
|
|
891
|
-
top: e.scrollTop + (i < 0 ? i : a),
|
|
892
|
-
behavior: O ? "auto" : "smooth"
|
|
893
|
-
});
|
|
894
|
-
}, [
|
|
895
|
-
K,
|
|
896
|
-
$,
|
|
897
|
-
O
|
|
898
|
-
]);
|
|
899
|
-
let [be, xe] = z(X[0]?.value), Se = X.some((e) => e.value === be) ? be : X[0]?.value, Ce = X.find((e) => e.value === Se)?.content;
|
|
900
|
-
return /* @__PURE__ */ H("div", {
|
|
901
|
-
ref: n,
|
|
902
|
-
role: "group",
|
|
903
|
-
"aria-label": h ?? i,
|
|
904
|
-
"data-audio-transcription": _e,
|
|
905
|
-
className: r("flex flex-col gap-2.5 rounded-2xl border border-solid border-f1-border-secondary bg-f1-background p-3", u),
|
|
906
|
-
...D,
|
|
907
|
-
children: [
|
|
908
|
-
/* @__PURE__ */ V("audio", {
|
|
909
|
-
ref: E.audioRef,
|
|
910
|
-
src: E.currentSrc,
|
|
911
|
-
preload: f ?? (typeof T.resolvedSrc == "function" ? "none" : "metadata"),
|
|
912
|
-
autoPlay: p
|
|
913
|
-
}),
|
|
914
|
-
/* @__PURE__ */ H("div", {
|
|
915
|
-
className: "flex items-start justify-between gap-2",
|
|
916
|
-
children: [/* @__PURE__ */ H("div", {
|
|
917
|
-
className: "flex min-w-0 flex-1 items-center gap-2.5",
|
|
918
|
-
children: [/* @__PURE__ */ V(nt, {
|
|
919
|
-
isPlaying: E.isPlaying,
|
|
920
|
-
disabled: m,
|
|
921
|
-
size: g,
|
|
922
|
-
onToggle: E.toggle
|
|
923
|
-
}), /* @__PURE__ */ H("div", {
|
|
924
|
-
className: "flex min-w-0 flex-col",
|
|
925
|
-
children: [/* @__PURE__ */ V("span", {
|
|
926
|
-
className: "truncate text-base font-medium text-f1-foreground",
|
|
927
|
-
children: i
|
|
928
|
-
}), c ? /* @__PURE__ */ V("span", {
|
|
929
|
-
className: "truncate text-base text-f1-foreground-secondary",
|
|
930
|
-
children: c
|
|
931
|
-
}) : null]
|
|
932
|
-
})]
|
|
933
|
-
}), Z || E.playbackRates.length > 0 || T.languages.length > 1 || l ? /* @__PURE__ */ H("div", {
|
|
934
|
-
className: "flex shrink-0 items-center gap-2",
|
|
935
|
-
children: [Z ? /* @__PURE__ */ V(s, {
|
|
936
|
-
variant: "outline",
|
|
937
|
-
size: "sm",
|
|
938
|
-
label: ve($),
|
|
939
|
-
onClick: () => ye(!$),
|
|
940
|
-
"aria-expanded": $
|
|
941
|
-
}) : null, E.playbackRates.length > 0 || T.languages.length > 1 || l ? /* @__PURE__ */ V(rt, {
|
|
942
|
-
playbackRate: E.playbackRate,
|
|
943
|
-
playbackRates: E.playbackRates,
|
|
944
|
-
onRateChange: E.setPlaybackRate,
|
|
945
|
-
disabled: m,
|
|
946
|
-
extraItems: l,
|
|
947
|
-
audioLanguages: T.languages,
|
|
948
|
-
audioLanguage: T.activeLocale,
|
|
949
|
-
onAudioLanguageChange: k
|
|
950
|
-
}) : null]
|
|
951
|
-
}) : null]
|
|
952
|
-
}),
|
|
953
|
-
/* @__PURE__ */ H("div", {
|
|
954
|
-
className: "flex w-full items-center gap-2",
|
|
955
|
-
children: [/* @__PURE__ */ V(Qe, {
|
|
956
|
-
currentTime: E.currentTime,
|
|
957
|
-
duration: E.duration,
|
|
958
|
-
buffered: E.buffered,
|
|
959
|
-
disabled: m,
|
|
960
|
-
onSeek: Y
|
|
961
|
-
}), /* @__PURE__ */ V(tt, {
|
|
962
|
-
currentTime: E.currentTime,
|
|
963
|
-
duration: E.duration,
|
|
964
|
-
size: g
|
|
965
|
-
})]
|
|
966
|
-
}),
|
|
967
|
-
Z ? /* @__PURE__ */ H(a.div, {
|
|
968
|
-
role: "region",
|
|
969
|
-
"aria-label": Q ? Q.label : w.audioPlayer.details,
|
|
970
|
-
initial: !1,
|
|
971
|
-
animate: {
|
|
972
|
-
height: $ ? "auto" : 0,
|
|
973
|
-
marginTop: $ ? 0 : "-0.625rem",
|
|
974
|
-
opacity: +!!$,
|
|
975
|
-
visibility: $ ? "visible" : "hidden"
|
|
976
|
-
},
|
|
977
|
-
transition: {
|
|
978
|
-
duration: O ? 0 : .15,
|
|
979
|
-
ease: [
|
|
980
|
-
.165,
|
|
981
|
-
.84,
|
|
982
|
-
.44,
|
|
983
|
-
1
|
|
984
|
-
]
|
|
985
|
-
},
|
|
986
|
-
className: "overflow-hidden",
|
|
987
|
-
children: [
|
|
988
|
-
A.length > 1 && j ? /* @__PURE__ */ V("div", {
|
|
989
|
-
className: "flex justify-end pb-2.5",
|
|
990
|
-
children: /* @__PURE__ */ V($e, {
|
|
991
|
-
value: j,
|
|
992
|
-
options: A,
|
|
993
|
-
onChange: re,
|
|
994
|
-
kind: w.audioPlayer.language
|
|
995
|
-
})
|
|
996
|
-
}) : null,
|
|
997
|
-
Q ? null : /* @__PURE__ */ V(ae, {
|
|
998
|
-
fullWidth: !0,
|
|
999
|
-
ariaLabel: w.audioPlayer.details,
|
|
1000
|
-
value: Se,
|
|
1001
|
-
onChange: xe,
|
|
1002
|
-
items: X.map((e) => ({
|
|
1003
|
-
value: e.value,
|
|
1004
|
-
label: e.label
|
|
1005
|
-
}))
|
|
1006
|
-
}),
|
|
1007
|
-
/* @__PURE__ */ V("div", {
|
|
1008
|
-
className: Q ? void 0 : "pt-2.5",
|
|
1009
|
-
children: /* @__PURE__ */ V(ie, {
|
|
1010
|
-
viewportRef: q,
|
|
1011
|
-
style: { "--audio-details-max-h": `${C}px` },
|
|
1012
|
-
className: "[&_[data-scroll-container]]:max-h-[var(--audio-details-max-h)]",
|
|
1013
|
-
children: /* @__PURE__ */ V("div", {
|
|
1014
|
-
className: "break-words pr-1 text-base text-f1-foreground",
|
|
1015
|
-
children: Ce
|
|
1016
|
-
})
|
|
1017
|
-
})
|
|
1018
|
-
})
|
|
1019
|
-
]
|
|
1020
|
-
}) : null
|
|
1021
|
-
]
|
|
1022
|
-
});
|
|
1023
|
-
});
|
|
1024
|
-
dt.displayName = "F0AudioPlayerCard";
|
|
1025
|
-
//#endregion
|
|
1026
|
-
//#region src/blocks/F0AudioPlayer/F0AudioPlayer.tsx
|
|
1027
|
-
var ft = f({
|
|
1028
|
-
base: "flex w-full items-center",
|
|
1029
|
-
variants: { size: {
|
|
1030
|
-
sm: "gap-2",
|
|
1031
|
-
md: "gap-3"
|
|
1032
|
-
} }
|
|
1033
|
-
}), pt = le((e, n) => {
|
|
1034
|
-
let { src: i, preload: a, autoPlay: o = !1, disabled: s = !1, ariaLabel: c, size: l = "md", defaultLanguage: u, className: d } = e, f = t(), p = st(i, u), m = lt({
|
|
1035
|
-
...e,
|
|
1036
|
-
src: p.resolvedSrc
|
|
1037
|
-
}), h = ue(e), g = (e) => {
|
|
1038
|
-
ct(m.audioRef.current), p.setLocale(e);
|
|
1039
|
-
};
|
|
1040
|
-
return /* @__PURE__ */ H("div", {
|
|
1041
|
-
ref: n,
|
|
1042
|
-
role: "group",
|
|
1043
|
-
"aria-label": c ?? f.audioPlayer.label,
|
|
1044
|
-
className: r(ft({ size: l }), d),
|
|
1045
|
-
...h,
|
|
1046
|
-
children: [
|
|
1047
|
-
/* @__PURE__ */ V("audio", {
|
|
1048
|
-
ref: m.audioRef,
|
|
1049
|
-
src: m.currentSrc,
|
|
1050
|
-
preload: a ?? (typeof p.resolvedSrc == "function" ? "none" : "metadata"),
|
|
1051
|
-
autoPlay: o
|
|
1052
|
-
}),
|
|
1053
|
-
/* @__PURE__ */ V(nt, {
|
|
1054
|
-
isPlaying: m.isPlaying,
|
|
1055
|
-
disabled: s,
|
|
1056
|
-
size: l,
|
|
1057
|
-
onToggle: m.toggle
|
|
1058
|
-
}),
|
|
1059
|
-
/* @__PURE__ */ V(Qe, {
|
|
1060
|
-
currentTime: m.currentTime,
|
|
1061
|
-
duration: m.duration,
|
|
1062
|
-
buffered: m.buffered,
|
|
1063
|
-
disabled: s,
|
|
1064
|
-
onSeek: m.seek
|
|
1065
|
-
}),
|
|
1066
|
-
/* @__PURE__ */ V(tt, {
|
|
1067
|
-
currentTime: m.currentTime,
|
|
1068
|
-
duration: m.duration,
|
|
1069
|
-
size: l
|
|
1070
|
-
}),
|
|
1071
|
-
p.languages.length > 1 && p.activeLocale ? /* @__PURE__ */ V($e, {
|
|
1072
|
-
value: p.activeLocale,
|
|
1073
|
-
options: p.languages,
|
|
1074
|
-
onChange: g,
|
|
1075
|
-
kind: f.audioPlayer.audio
|
|
1076
|
-
}) : null
|
|
1077
|
-
]
|
|
1078
|
-
});
|
|
1079
|
-
});
|
|
1080
|
-
pt.displayName = "F0AudioPlayer";
|
|
1081
|
-
var mt = n("F0AudioPlayer", e(pt)), ht = n("F0AudioPlayerCard", e(dt));
|
|
1082
|
-
//#endregion
|
|
1083
|
-
export { Ze as a, U as c, Xe as i, ht as n, Ye as o, Je as r, he as s, mt as t };
|