@layers-app/shared 0.4.8 → 0.4.9

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 (128) hide show
  1. package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.d.ts +2 -0
  2. package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.d.ts.map +1 -1
  3. package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.js +22 -17
  4. package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.d.ts +15 -0
  5. package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.d.ts.map +1 -0
  6. package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.js +36 -0
  7. package/dist/components/AttachmentsGalleryModal/components/GallerySlide.js +22 -22
  8. package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.d.ts +14 -0
  9. package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.d.ts.map +1 -0
  10. package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.js +31 -0
  11. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
  12. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +179 -120
  13. package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.d.ts +18 -0
  14. package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.d.ts.map +1 -0
  15. package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.js +35 -0
  16. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts +34 -0
  17. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts.map +1 -0
  18. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.js +71 -0
  19. package/dist/components/AttachmentsGalleryModal/styles.module.css.js +31 -27
  20. package/dist/components/CommentComposer/CommentComposer.module.css.js +13 -9
  21. package/dist/components/CommentComposer/index.d.ts +2 -1
  22. package/dist/components/CommentComposer/index.d.ts.map +1 -1
  23. package/dist/components/CommentComposer/index.js +343 -325
  24. package/dist/components/CommentComposer/types.d.ts +4 -0
  25. package/dist/components/CommentComposer/types.d.ts.map +1 -1
  26. package/dist/components/VideoPlayer/VideoPlayer.d.ts +24 -0
  27. package/dist/components/VideoPlayer/VideoPlayer.d.ts.map +1 -0
  28. package/dist/components/VideoPlayer/VideoPlayer.js +727 -0
  29. package/dist/components/VideoPlayer/components/MobileDrawer/index.d.ts +8 -0
  30. package/dist/components/VideoPlayer/components/MobileDrawer/index.d.ts.map +1 -0
  31. package/dist/components/VideoPlayer/components/MobileDrawer/index.js +67 -0
  32. package/dist/components/VideoPlayer/components/SelectListOptionButton.d.ts +7 -0
  33. package/dist/components/VideoPlayer/components/SelectListOptionButton.d.ts.map +1 -0
  34. package/dist/components/VideoPlayer/components/SelectListOptionButton.js +44 -0
  35. package/dist/components/VideoPlayer/components/StoryboardPreview.d.ts +9 -0
  36. package/dist/components/VideoPlayer/components/StoryboardPreview.d.ts.map +1 -0
  37. package/dist/components/VideoPlayer/components/StoryboardPreview.js +38 -0
  38. package/dist/components/VideoPlayer/components/VideoCustomControls.d.ts +33 -0
  39. package/dist/components/VideoPlayer/components/VideoCustomControls.d.ts.map +1 -0
  40. package/dist/components/VideoPlayer/components/VideoCustomControls.js +601 -0
  41. package/dist/components/VideoPlayer/components/VideoIcons.d.ts +25 -0
  42. package/dist/components/VideoPlayer/components/VideoIcons.d.ts.map +1 -0
  43. package/dist/components/VideoPlayer/components/VideoIcons.js +145 -0
  44. package/dist/components/VideoPlayer/components/VideoMenu.d.ts +27 -0
  45. package/dist/components/VideoPlayer/components/VideoMenu.d.ts.map +1 -0
  46. package/dist/components/VideoPlayer/components/VideoMenu.js +77 -0
  47. package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.d.ts +17 -0
  48. package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.d.ts.map +1 -0
  49. package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.js +289 -0
  50. package/dist/components/VideoPlayer/components/VideoQualityMenu/index.d.ts +10 -0
  51. package/dist/components/VideoPlayer/components/VideoQualityMenu/index.d.ts.map +1 -0
  52. package/dist/components/VideoPlayer/components/VideoQualityMenu/index.js +55 -0
  53. package/dist/components/VideoPlayer/components/VideoSelect.d.ts +10 -0
  54. package/dist/components/VideoPlayer/components/VideoSelect.d.ts.map +1 -0
  55. package/dist/components/VideoPlayer/components/VideoSelect.js +168 -0
  56. package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.d.ts +12 -0
  57. package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.d.ts.map +1 -0
  58. package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.js +48 -0
  59. package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.d.ts +25 -0
  60. package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.d.ts.map +1 -0
  61. package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.js +384 -0
  62. package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.d.ts +21 -0
  63. package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.d.ts.map +1 -0
  64. package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.js +264 -0
  65. package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.d.ts +10 -0
  66. package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.d.ts.map +1 -0
  67. package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.js +39 -0
  68. package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.d.ts +14 -0
  69. package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.d.ts.map +1 -0
  70. package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.js +360 -0
  71. package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitleTrackRow.d.ts +16 -0
  72. package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitleTrackRow.d.ts.map +1 -0
  73. package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitlesSection.d.ts +14 -0
  74. package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitlesSection.d.ts.map +1 -0
  75. package/dist/components/VideoPlayer/components/VideoSettingsModal/context.d.ts +4 -0
  76. package/dist/components/VideoPlayer/components/VideoSettingsModal/context.d.ts.map +1 -0
  77. package/dist/components/VideoPlayer/components/VideoSettingsModal/context.js +14 -0
  78. package/dist/components/VideoPlayer/components/VideoSettingsModal/index.d.ts +22 -0
  79. package/dist/components/VideoPlayer/components/VideoSettingsModal/index.d.ts.map +1 -0
  80. package/dist/components/VideoPlayer/components/VideoSettingsModal/index.js +211 -0
  81. package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.d.ts +11 -0
  82. package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.d.ts.map +1 -0
  83. package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.js +41 -0
  84. package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.d.ts +10 -0
  85. package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.d.ts.map +1 -0
  86. package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.js +69 -0
  87. package/dist/components/VideoPlayer/hooks/useStoryboard.d.ts +21 -0
  88. package/dist/components/VideoPlayer/hooks/useStoryboard.d.ts.map +1 -0
  89. package/dist/components/VideoPlayer/hooks/useStoryboard.js +91 -0
  90. package/dist/components/VideoPlayer/index.d.ts +11 -0
  91. package/dist/components/VideoPlayer/index.d.ts.map +1 -0
  92. package/dist/components/VideoPlayer/types.d.ts +101 -0
  93. package/dist/components/VideoPlayer/types.d.ts.map +1 -0
  94. package/dist/components/VideoPlayer/utils/chapters.d.ts +8 -0
  95. package/dist/components/VideoPlayer/utils/chapters.d.ts.map +1 -0
  96. package/dist/components/VideoPlayer/utils/chapters.js +38 -0
  97. package/dist/components/VideoPlayer/utils/storyboard.d.ts +5 -0
  98. package/dist/components/VideoPlayer/utils/storyboard.d.ts.map +1 -0
  99. package/dist/components/VideoPlayer/utils/storyboard.js +47 -0
  100. package/dist/components/VideoPlayer/utils/subtitles.d.ts +18 -0
  101. package/dist/components/VideoPlayer/utils/subtitles.d.ts.map +1 -0
  102. package/dist/components/VideoPlayer/utils/subtitles.js +23 -0
  103. package/dist/components/VideoPlayer/utils/touch.d.ts +3 -0
  104. package/dist/components/VideoPlayer/utils/touch.d.ts.map +1 -0
  105. package/dist/components/VideoPlayer/utils/touch.js +5 -0
  106. package/dist/components/VideoPlayer/utils/videoPlayerUtils.d.ts +10 -0
  107. package/dist/components/VideoPlayer/utils/videoPlayerUtils.d.ts.map +1 -0
  108. package/dist/components/VideoPlayer/utils/videoPlayerUtils.js +22 -0
  109. package/dist/components/VideoPlayer/utils/videoSettings.d.ts +69 -0
  110. package/dist/components/VideoPlayer/utils/videoSettings.d.ts.map +1 -0
  111. package/dist/components/VideoPlayer/utils/videoSettings.js +90 -0
  112. package/dist/helpers/getFileType.d.ts +1 -1
  113. package/dist/helpers/getFileType.d.ts.map +1 -1
  114. package/dist/helpers/getFileType.js +3 -2
  115. package/dist/hooks/useDateUtils.d.ts +3 -1
  116. package/dist/hooks/useDateUtils.d.ts.map +1 -1
  117. package/dist/hooks/useDateUtils.js +23 -18
  118. package/dist/index.css +1 -1
  119. package/dist/index.d.ts +2 -0
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +585 -567
  122. package/dist/lang/locales/ui_en.json.js +9 -7
  123. package/dist/lang/locales/ui_es.json.js +6 -4
  124. package/dist/lang/locales/ui_ru.json.js +8 -6
  125. package/dist/videoSettings/createVideoSettingsDataSource.d.ts +19 -0
  126. package/dist/videoSettings/createVideoSettingsDataSource.d.ts.map +1 -0
  127. package/dist/videoSettings/createVideoSettingsDataSource.js +127 -0
  128. package/package.json +2 -1
@@ -0,0 +1,168 @@
1
+ import { jsxs as p, Fragment as H, jsx as e } from "react/jsx-runtime";
2
+ import { useState as V, useMemo as W } from "react";
3
+ import { useTranslation as M } from "react-i18next";
4
+ import { ArrowDown01Icon as y, Tick02Icon as F } from "@hugeicons/core-free-icons";
5
+ import { HugeiconsIcon as u } from "@hugeicons/react";
6
+ import { useCombobox as G, InputBase as I, Stack as L, Combobox as s, Group as U } from "@mantine/core";
7
+ import { useDisclosure as Y } from "@mantine/hooks";
8
+ import { IS_TOUCH_DEVICE as q } from "../utils/touch.js";
9
+ import { MobileDrawer as J } from "./MobileDrawer/index.js";
10
+ import { SelectListOptionButton as K } from "./SelectListOptionButton.js";
11
+ /* empty css */
12
+ function ho({
13
+ size: d = "sm",
14
+ w: m = 150,
15
+ comboboxProps: _,
16
+ rightSection: h,
17
+ renderOption: f,
18
+ data: i,
19
+ value: x,
20
+ defaultValue: N,
21
+ onChange: b,
22
+ inputClassName: O,
23
+ ...k
24
+ }) {
25
+ const {
26
+ onClick: w,
27
+ type: Q,
28
+ onCopy: R,
29
+ onCut: X,
30
+ onPaste: Z,
31
+ classNames: t,
32
+ allowDeselect: $,
33
+ ...v
34
+ } = k, C = [typeof t == "object" && t && "input" in t ? t.input : void 0, O].filter(Boolean).join(" ") || void 0, g = C ? {
35
+ ...typeof t == "object" && t ? t : {},
36
+ input: C
37
+ } : t, [, P] = V(""), n = G({
38
+ onDropdownClose: () => {
39
+ n.resetSelectedOption(), n.focusTarget(), P("");
40
+ },
41
+ onDropdownOpen: () => {
42
+ n.focusSearchInput();
43
+ }
44
+ }), l = W(
45
+ () => (Array.isArray(i) ? i : []).map(
46
+ (o) => typeof o == "string" ? { value: o, label: o } : o
47
+ ),
48
+ [i]
49
+ ), a = x ?? N ?? null, D = l.find((o) => o.value === a)?.label ?? "", { t: T } = M(), [j, { open: E, close: S }] = Y(!1);
50
+ if (q)
51
+ return /* @__PURE__ */ p(H, { children: [
52
+ /* @__PURE__ */ e(
53
+ I,
54
+ {
55
+ component: "button",
56
+ size: d,
57
+ w: m,
58
+ classNames: g,
59
+ pointer: !0,
60
+ rightSection: h ?? /* @__PURE__ */ e(
61
+ u,
62
+ {
63
+ icon: y,
64
+ size: 16,
65
+ className: "editor-select__chevron"
66
+ }
67
+ ),
68
+ rightSectionPointerEvents: "none",
69
+ onClick: (o) => {
70
+ w?.(o), E();
71
+ },
72
+ ...v,
73
+ children: D
74
+ }
75
+ ),
76
+ /* @__PURE__ */ e(
77
+ J,
78
+ {
79
+ opened: j,
80
+ onClose: S,
81
+ title: T("editor.video.source.drawerTitle", "Source"),
82
+ children: /* @__PURE__ */ e(L, { gap: 4, p: 0, children: l.map((o) => /* @__PURE__ */ e(
83
+ K,
84
+ {
85
+ label: o.label,
86
+ checked: o.value === a,
87
+ onSelect: () => {
88
+ b?.(o.value, o), S();
89
+ }
90
+ },
91
+ o.value
92
+ )) })
93
+ }
94
+ )
95
+ ] });
96
+ const z = (o, r, c) => f ? f({
97
+ option: { value: o, label: r },
98
+ checked: c
99
+ }) : /* @__PURE__ */ p(U, { justify: "space-between", wrap: "nowrap", w: "100%", children: [
100
+ r,
101
+ c && /* @__PURE__ */ e(
102
+ u,
103
+ {
104
+ icon: F,
105
+ size: 16,
106
+ color: "var(--mantine-primary-color-text)"
107
+ }
108
+ )
109
+ ] }), { width: A, ...B } = _ || {};
110
+ return /* @__PURE__ */ p(
111
+ s,
112
+ {
113
+ store: n,
114
+ withinPortal: !0,
115
+ onOptionSubmit: (o) => {
116
+ const r = l.find((c) => c.value === o) ?? {
117
+ value: o,
118
+ label: o
119
+ };
120
+ b?.(o, r), n.closeDropdown();
121
+ },
122
+ width: A ?? "target",
123
+ ...B,
124
+ children: [
125
+ /* @__PURE__ */ e(s.Target, { children: /* @__PURE__ */ e(
126
+ I,
127
+ {
128
+ component: "button",
129
+ size: d,
130
+ w: m,
131
+ classNames: g,
132
+ pointer: !0,
133
+ rightSection: h ?? /* @__PURE__ */ e(
134
+ u,
135
+ {
136
+ icon: y,
137
+ size: 16,
138
+ className: "editor-select__chevron"
139
+ }
140
+ ),
141
+ rightSectionPointerEvents: "none",
142
+ onClick: (o) => {
143
+ w?.(o), n.toggleDropdown();
144
+ },
145
+ ...v,
146
+ children: D
147
+ }
148
+ ) }),
149
+ /* @__PURE__ */ e(s.Dropdown, { children: /* @__PURE__ */ e(
150
+ s.Options,
151
+ {
152
+ style: {
153
+ maxHeight: 396,
154
+ overflowY: "auto"
155
+ },
156
+ children: l.length > 0 ? l.map((o) => {
157
+ const r = o.value === a;
158
+ return /* @__PURE__ */ e(s.Option, { value: o.value, children: z(o.value, o.label, r) }, o.value);
159
+ }) : /* @__PURE__ */ e(s.Empty, { children: "Nothing found" })
160
+ }
161
+ ) })
162
+ ]
163
+ }
164
+ );
165
+ }
166
+ export {
167
+ ho as default
168
+ };
@@ -0,0 +1,12 @@
1
+ import type { PlayerSettingsSnapshot } from '../../utils/videoSettings';
2
+ type VideoSettingsMenuProps = {
3
+ isOpen?: boolean;
4
+ disabled?: boolean;
5
+ settings: PlayerSettingsSnapshot;
6
+ onSpeedClick: () => void;
7
+ onQualityClick: () => void;
8
+ onSubtitlesClick: () => void;
9
+ };
10
+ export declare function VideoSettingsMenu({ disabled, settings, onSpeedClick, onQualityClick, onSubtitlesClick, }: VideoSettingsMenuProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/VideoPlayer/components/VideoSettingsMenu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AASxE,KAAK,sBAAsB,GAAG;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,gBAAgB,GACjB,EAAE,sBAAsB,2CA+CxB"}
@@ -0,0 +1,48 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useTranslation as f } from "react-i18next";
3
+ import { ChevronRightIcon as n, SubtitleIcon as m, SpeedIcon as p, QualityIcon as S } from "../VideoIcons.js";
4
+ import { VideoMenu as I } from "../VideoMenu.js";
5
+ function g({
6
+ disabled: o,
7
+ settings: e,
8
+ onSpeedClick: r,
9
+ onQualityClick: s,
10
+ onSubtitlesClick: d
11
+ }) {
12
+ const { t: i } = f(), u = e.currentSpeed === 1 ? i("editor.video.settings.normal") : `${e.currentSpeed}x`, a = e.qualities.find((l) => l.id === e.currentQualityId)?.label || i("editor.video.settings.auto"), c = e.subtitles.find((l) => l.id === e.currentSubtitleId)?.label || i("editor.video.settings.off"), b = [
13
+ {
14
+ key: "subtitles",
15
+ testId: "video-settings-menu-subtitles",
16
+ onClick: d,
17
+ disabled: o || !e.hasRealSubtitles,
18
+ leftIcon: /* @__PURE__ */ t(m, { size: 16 }),
19
+ leftLabel: i("editor.video.settings.subtitlesCc"),
20
+ centerLabel: c,
21
+ rightSection: /* @__PURE__ */ t(n, { size: 16 })
22
+ },
23
+ {
24
+ key: "speed",
25
+ testId: "video-settings-menu-speed",
26
+ onClick: r,
27
+ disabled: o || !e.hasRealSpeeds,
28
+ leftIcon: /* @__PURE__ */ t(p, { size: 16 }),
29
+ leftLabel: i("editor.video.settings.speed"),
30
+ centerLabel: u,
31
+ rightSection: /* @__PURE__ */ t(n, { size: 16 })
32
+ },
33
+ {
34
+ key: "quality",
35
+ testId: "video-settings-menu-quality",
36
+ onClick: s,
37
+ disabled: o || !e.hasRealQualities,
38
+ leftIcon: /* @__PURE__ */ t(S, { size: 16 }),
39
+ leftLabel: i("editor.video.settings.quality"),
40
+ centerLabel: a,
41
+ rightSection: /* @__PURE__ */ t(n, { size: 16 })
42
+ }
43
+ ];
44
+ return /* @__PURE__ */ t(I, { width: 300, items: b });
45
+ }
46
+ export {
47
+ g as VideoSettingsMenu
48
+ };
@@ -0,0 +1,25 @@
1
+ import type { Chapter } from '../../types';
2
+ import { type ChapterInput } from '../../utils/chapters';
3
+ type ChaptersSectionProps = {
4
+ videoId?: string | null;
5
+ initialChapters?: Chapter[];
6
+ nativeVideo?: HTMLVideoElement | null;
7
+ shakaPlayer?: any | null;
8
+ videoDuration?: number | null;
9
+ title: string;
10
+ toggleLabel: string;
11
+ chaptersDisabled: boolean;
12
+ onChaptersDisabledChange: (value: boolean) => void;
13
+ onSave?: (saveHandler: () => Promise<ChapterInput[] | null>) => void;
14
+ timePlaceholder: string;
15
+ endTimePlaceholder: string;
16
+ titlePlaceholder: string;
17
+ addChapterLabel: string;
18
+ deleteChapterLabel: string;
19
+ emptyLabel: string;
20
+ errorLabel: string;
21
+ invalidRangeLabel: string;
22
+ };
23
+ export declare function ChaptersSection({ videoId, initialChapters, nativeVideo, shakaPlayer, videoDuration: videoDurationProp, title, toggleLabel, chaptersDisabled, onChaptersDisabledChange, onSave, timePlaceholder, endTimePlaceholder, titlePlaceholder, addChapterLabel, deleteChapterLabel, emptyLabel, errorLabel, }: ChaptersSectionProps): import("react/jsx-runtime").JSX.Element;
24
+ export {};
25
+ //# sourceMappingURL=ChaptersSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChaptersSection.d.ts","sourceRoot":"","sources":["../../../../../src/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAM9B,KAAK,oBAAoB,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,wBAAwB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;IACrE,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AA0PF,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,eAAe,EACf,WAAW,EACX,WAAW,EACX,aAAa,EAAE,iBAAiB,EAChC,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,UAAU,GACX,EAAE,oBAAoB,2CA4StB"}
@@ -0,0 +1,384 @@
1
+ import { jsxs as B, jsx as r, Fragment as St } from "react/jsx-runtime";
2
+ import { useState as g, useRef as it, useCallback as T, useEffect as j } from "react";
3
+ import { Stack as st, Text as R, Flex as at, Switch as xt, Divider as Tt, Group as yt, TextInput as ut, Textarea as Mt, Menu as Q, ActionIcon as Ct } from "@mantine/core";
4
+ import { secondsToTimestamp as D, parseTimestampToSec as dt } from "../../utils/chapters.js";
5
+ import { MoreVerticalIcon as wt } from "../VideoIcons.js";
6
+ import { useVideoSettingsDataSource as Et } from "./context.js";
7
+ function ht() {
8
+ try {
9
+ return crypto.randomUUID();
10
+ } catch {
11
+ return `${Date.now()}-${Math.random().toString(16).slice(2)}`;
12
+ }
13
+ }
14
+ function vt(x) {
15
+ return x.map((i) => ({
16
+ id: ht(),
17
+ startSec: i.startSec ?? 0,
18
+ title: (i.title ?? "").trim()
19
+ })).sort((i, m) => i.startSec - m.startSec);
20
+ }
21
+ function Nt({
22
+ chapter: x,
23
+ index: i,
24
+ startSec: m,
25
+ endSec: p,
26
+ isLast: y,
27
+ disabled: N,
28
+ startTimePlaceholder: X,
29
+ endTimePlaceholder: U,
30
+ titlePlaceholder: Y,
31
+ deleteChapterLabel: $,
32
+ startMin: G,
33
+ startMax: b,
34
+ endMin: Z,
35
+ endMax: V,
36
+ onStartSecChange: W,
37
+ onEndSecChange: P,
38
+ onTitleChange: _,
39
+ onRemove: z
40
+ }) {
41
+ const [S, L] = g(
42
+ () => D(m)
43
+ ), [H, k] = g(
44
+ () => p == null ? "" : D(p)
45
+ ), [M, C] = g(!1), [q, a] = g(!1), [I, h] = g(!1), [w, A] = g(!1);
46
+ j(() => {
47
+ I || L(D(m));
48
+ }, [m, I]), j(() => {
49
+ w || k(p == null ? "" : D(p));
50
+ }, [p, w]);
51
+ const J = (c) => {
52
+ L(c);
53
+ const E = dt(c);
54
+ if (E !== null) {
55
+ const f = Math.floor(Number(E) || 0), F = f < G, v = b != null && f > b;
56
+ if (F || v) {
57
+ C(!0);
58
+ return;
59
+ }
60
+ C(!1), W(i, f);
61
+ } else if (c.trim() === "") {
62
+ const F = 0 < G, v = b != null && 0 > b;
63
+ if (F || v) {
64
+ C(!0);
65
+ return;
66
+ }
67
+ C(!1), W(i, 0);
68
+ } else
69
+ C(!0);
70
+ }, tt = (c) => {
71
+ if (k(c), y) return;
72
+ const E = dt(c);
73
+ if (E !== null) {
74
+ const f = Math.floor(Number(E) || 0), v = f < (Z ?? -1 / 0), et = V != null && f > V;
75
+ if (v || et) {
76
+ a(!0);
77
+ return;
78
+ }
79
+ a(!1), P(i, f);
80
+ } else c.trim() === "" ? a(!1) : a(!0);
81
+ };
82
+ return /* @__PURE__ */ B(
83
+ yt,
84
+ {
85
+ gap: 10,
86
+ align: "flex-start",
87
+ wrap: "nowrap",
88
+ className: "video-settings-modal-chapter-row",
89
+ style: { maxWidth: "100%" },
90
+ children: [
91
+ /* @__PURE__ */ B(st, { className: "video-settings-modal-chapter-times", children: [
92
+ /* @__PURE__ */ r(
93
+ ut,
94
+ {
95
+ size: "sm",
96
+ radius: 8,
97
+ variant: "default",
98
+ placeholder: X,
99
+ value: S,
100
+ onChange: (c) => J(c.currentTarget.value),
101
+ style: { width: "100%" },
102
+ styles: {
103
+ input: {
104
+ height: 36,
105
+ paddingTop: 6,
106
+ paddingBottom: 6,
107
+ paddingLeft: 12,
108
+ paddingRight: 12,
109
+ lineHeight: 1.45
110
+ }
111
+ },
112
+ error: M,
113
+ disabled: N,
114
+ onFocus: () => h(!0),
115
+ onBlur: () => h(!1)
116
+ }
117
+ ),
118
+ /* @__PURE__ */ r(
119
+ ut,
120
+ {
121
+ size: "sm",
122
+ radius: 8,
123
+ variant: "default",
124
+ placeholder: U,
125
+ value: H,
126
+ onChange: (c) => tt(c.currentTarget.value),
127
+ style: { width: "100%" },
128
+ styles: {
129
+ input: {
130
+ height: 36,
131
+ paddingTop: 6,
132
+ paddingBottom: 6,
133
+ paddingLeft: 12,
134
+ paddingRight: 12,
135
+ lineHeight: 1.45
136
+ }
137
+ },
138
+ error: q,
139
+ disabled: N || y || p == null,
140
+ onFocus: () => A(!0),
141
+ onBlur: () => A(!1)
142
+ }
143
+ )
144
+ ] }),
145
+ /* @__PURE__ */ r(at, { className: "video-settings-modal-chapter-title", children: /* @__PURE__ */ r(
146
+ Mt,
147
+ {
148
+ size: "sm",
149
+ radius: 8,
150
+ variant: "default",
151
+ placeholder: Y,
152
+ value: x.title,
153
+ onChange: (c) => _(i, c.currentTarget.value),
154
+ styles: {
155
+ root: {
156
+ width: "100%",
157
+ height: "100%"
158
+ },
159
+ wrapper: {
160
+ height: "100%"
161
+ },
162
+ input: {
163
+ height: "100%",
164
+ paddingTop: 8,
165
+ paddingBottom: 8,
166
+ paddingLeft: 12,
167
+ paddingRight: 12,
168
+ lineHeight: 1.45,
169
+ resize: "none"
170
+ }
171
+ },
172
+ style: { width: "100%", height: "100%" },
173
+ disabled: N
174
+ }
175
+ ) }),
176
+ /* @__PURE__ */ r(at, { className: "video-settings-modal-chapter-actions", children: /* @__PURE__ */ B(Q, { position: "bottom-end", children: [
177
+ /* @__PURE__ */ r(Q.Target, { children: /* @__PURE__ */ r(
178
+ Ct,
179
+ {
180
+ size: 36,
181
+ variant: "subtle",
182
+ color: "gray",
183
+ "aria-label": "Chapter actions",
184
+ disabled: N,
185
+ radius: 8,
186
+ "data-test-id": "video-settings-chapters-row-menu",
187
+ children: /* @__PURE__ */ r(wt, { size: 20 })
188
+ }
189
+ ) }),
190
+ /* @__PURE__ */ r(Q.Dropdown, { children: /* @__PURE__ */ r(
191
+ Q.Item,
192
+ {
193
+ color: "red",
194
+ onClick: () => z(i),
195
+ "data-test-id": "video-settings-chapters-delete",
196
+ children: $
197
+ }
198
+ ) })
199
+ ] }) })
200
+ ]
201
+ }
202
+ );
203
+ }
204
+ function Lt({
205
+ videoId: x,
206
+ initialChapters: i,
207
+ nativeVideo: m,
208
+ shakaPlayer: p,
209
+ videoDuration: y,
210
+ title: N,
211
+ toggleLabel: X,
212
+ chaptersDisabled: U,
213
+ onChaptersDisabledChange: Y,
214
+ onSave: $,
215
+ timePlaceholder: G,
216
+ endTimePlaceholder: b,
217
+ titlePlaceholder: Z,
218
+ addChapterLabel: V,
219
+ deleteChapterLabel: W,
220
+ emptyLabel: P,
221
+ errorLabel: _
222
+ }) {
223
+ const [z, S] = g(
224
+ []
225
+ ), [L, H] = g(null), [k, M] = g(null), [C] = g(!1), [, q] = g(!1), [a, I] = g(null), h = it(!1), w = it(!1), A = Et(), J = T((t) => {
226
+ w.current || h.current || S(vt(t));
227
+ }, []);
228
+ j(() => {
229
+ if (y != null && y > 0) {
230
+ I(y);
231
+ return;
232
+ }
233
+ try {
234
+ const t = p?.seekRange?.();
235
+ if (t && Number.isFinite(t.end) && t.end > 0) {
236
+ I(t.end);
237
+ return;
238
+ }
239
+ } catch {
240
+ }
241
+ if (m) {
242
+ const t = m.duration;
243
+ if (Number.isFinite(t) && t > 0) {
244
+ I(t);
245
+ return;
246
+ }
247
+ }
248
+ }, [y, p, m]);
249
+ const tt = T(() => a == null ? null : Math.floor(a), [a]), c = T(async () => {
250
+ if (!x) return null;
251
+ M(null), q(!0), w.current = !0, H(null);
252
+ try {
253
+ const t = z.filter((e) => e.title.trim()).filter((e) => a == null || e.startSec < a).sort((e, n) => e.startSec - n.startSec).map(({ startSec: e, title: n }) => ({ startSec: e, title: n }));
254
+ return await A.saveChapters(t), h.current = !1, t;
255
+ } catch (t) {
256
+ const e = t instanceof Error ? t.message : _;
257
+ return /exceeds/i.test(e) || H(e), null;
258
+ } finally {
259
+ q(!1), w.current = !1;
260
+ }
261
+ }, [x, A, z, _, tt]);
262
+ j(() => {
263
+ $?.(c);
264
+ }, [c, $]);
265
+ const E = T(() => {
266
+ h.current = !0, M(null), S((t) => {
267
+ const e = a != null ? Math.floor(a) : null, n = [...t].sort((d, u) => d.startSec - u.startSec), l = n.length > 0 ? Math.floor(n[n.length - 1].startSec) : -1, s = Math.max(0, l + 1), o = e != null ? Math.min(s, Math.max(0, e - 1)) : s;
268
+ return [
269
+ ...n,
270
+ {
271
+ id: ht(),
272
+ startSec: o,
273
+ title: ""
274
+ }
275
+ ];
276
+ });
277
+ }, [a]), f = T((t, e) => {
278
+ h.current = !0, S((n) => {
279
+ const s = [...[...n].sort((d, u) => d.startSec - u.startSec)], o = s[t];
280
+ return o ? (s[t] = { ...o, title: e }, s) : n;
281
+ });
282
+ }, []), F = T((t, e) => {
283
+ h.current = !0, M(null), S((n) => {
284
+ const l = [...n].sort((d, u) => d.startSec - u.startSec), s = l[t];
285
+ if (!s) return n;
286
+ const o = [...l];
287
+ return o[t] = { ...s, startSec: e }, o.sort((d, u) => d.startSec - u.startSec);
288
+ });
289
+ }, []), v = T((t, e) => {
290
+ h.current = !0, M(null), S((n) => {
291
+ const l = [...n].sort((d, u) => d.startSec - u.startSec);
292
+ if (t >= l.length - 1) return n;
293
+ const s = l[t + 1];
294
+ if (!s) return n;
295
+ const o = [...l];
296
+ return o[t + 1] = { ...s, startSec: e }, o.sort((d, u) => d.startSec - u.startSec);
297
+ });
298
+ }, []), et = T((t) => {
299
+ h.current = !0, M(null), S((e) => [...e].sort((l, s) => l.startSec - s.startSec).filter((l, s) => s !== t));
300
+ }, []);
301
+ return j(() => {
302
+ if (!x) {
303
+ S([]), H(null), h.current = !1;
304
+ return;
305
+ }
306
+ w.current || h.current || Array.isArray(i) && J(i);
307
+ }, [x, i, J]), /* @__PURE__ */ B(st, { gap: "xs", "data-test-id": "video-settings-chapters-section", children: [
308
+ /* @__PURE__ */ r(
309
+ R,
310
+ {
311
+ className: "video-settings-modal-section-title",
312
+ "data-test-id": "video-settings-chapters-title",
313
+ children: N
314
+ }
315
+ ),
316
+ /* @__PURE__ */ B(
317
+ at,
318
+ {
319
+ align: "center",
320
+ gap: "md",
321
+ className: "video-settings-modal-subtitles-auto-toggle",
322
+ children: [
323
+ /* @__PURE__ */ r(R, { size: "sm", fw: 500, c: "var(--mantine-color-bright)", flex: 1, children: X }),
324
+ /* @__PURE__ */ r(
325
+ xt,
326
+ {
327
+ size: "sm",
328
+ checked: !U,
329
+ onChange: (t) => Y(!t.currentTarget.checked),
330
+ "data-test-id": "video-settings-chapters-toggle"
331
+ }
332
+ )
333
+ ]
334
+ }
335
+ ),
336
+ !U && /* @__PURE__ */ B(St, { children: [
337
+ /* @__PURE__ */ r(Tt, { my: 4 }),
338
+ L && /* @__PURE__ */ r(R, { size: "sm", c: "red", mb: "xs", children: L }),
339
+ k && /* @__PURE__ */ r(R, { size: "sm", c: "red", mb: "xs", children: k }),
340
+ /* @__PURE__ */ r(st, { gap: 12, children: [...z].sort((t, e) => t.startSec - e.startSec).map((t, e, n) => {
341
+ const l = n[e + 1] || null, s = n[e + 2] || null, o = a != null ? Math.floor(a) : null, d = l != null ? Math.floor(l.startSec) : o ?? null, u = Math.floor(t.startSec), lt = e > 0 ? Math.floor(n[e - 1].startSec) : null, ot = l != null ? Math.floor(l.startSec) : null, gt = lt != null ? lt + 1 : 0, K = ot != null ? ot - 1 : null, nt = o != null ? o - 1 : null, ft = K != null && nt != null ? Math.min(K, nt) : K ?? nt, mt = e < n.length - 1 ? u + 1 : null, ct = s != null ? Math.floor(s.startSec) : null, O = ct != null ? ct - 1 : null, rt = o ?? null, pt = O != null && rt != null ? Math.min(O, rt) : O ?? rt;
342
+ return /* @__PURE__ */ r(
343
+ Nt,
344
+ {
345
+ chapter: t,
346
+ index: e,
347
+ startSec: u,
348
+ endSec: d,
349
+ isLast: e === n.length - 1,
350
+ startMin: gt,
351
+ startMax: ft,
352
+ endMin: mt,
353
+ endMax: pt,
354
+ disabled: !1,
355
+ startTimePlaceholder: G,
356
+ endTimePlaceholder: a != null ? D(Math.floor(a)) : b,
357
+ titlePlaceholder: Z,
358
+ deleteChapterLabel: W,
359
+ onStartSecChange: F,
360
+ onEndSecChange: v,
361
+ onTitleChange: f,
362
+ onRemove: et
363
+ },
364
+ t.id
365
+ );
366
+ }) }),
367
+ /* @__PURE__ */ r(
368
+ R,
369
+ {
370
+ component: "button",
371
+ type: "button",
372
+ className: "video-settings-modal-link",
373
+ onClick: E,
374
+ "data-test-id": "video-settings-chapters-add",
375
+ children: V
376
+ }
377
+ ),
378
+ z.length === 0 && !C && /* @__PURE__ */ r(R, { size: "xs", c: "dimmed", children: P })
379
+ ] })
380
+ ] });
381
+ }
382
+ export {
383
+ Lt as ChaptersSection
384
+ };
@@ -0,0 +1,21 @@
1
+ import { FileWithPath } from '@mantine/dropzone';
2
+ import type { VideoSettingsData } from '../../types';
3
+ type CoverSectionProps = {
4
+ opened: boolean;
5
+ videoId?: string | null;
6
+ initialData?: VideoSettingsData | null;
7
+ title: string;
8
+ uploadLabel: string;
9
+ cropLabel: string;
10
+ emptyCoverLabel: string;
11
+ loadErrorLabel?: string;
12
+ retryLabel?: string;
13
+ onCoverUpload?: (file: FileWithPath) => void | Promise<VideoSettingsData | undefined>;
14
+ onCropCover?: () => void;
15
+ onPosterChange?: (posterUrl: string | null) => void;
16
+ onSelectedPosterChange?: (url: string | null) => void;
17
+ selectedPosterUrl?: string | null;
18
+ };
19
+ export declare function CoverSection({ opened, videoId, initialData, title, uploadLabel, loadErrorLabel, retryLabel, onCoverUpload, onPosterChange: _onPosterChange, onSelectedPosterChange, selectedPosterUrl, }: CoverSectionProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=CoverSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoverSection.d.ts","sourceRoot":"","sources":["../../../../../src/components/VideoPlayer/components/VideoSettingsModal/CoverSection.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAY,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAE5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIrD,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,CACd,IAAI,EAAE,YAAY,KACf,IAAI,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACpD,sBAAsB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,EACL,WAAW,EACX,cAAc,EACd,UAAU,EACV,aAAa,EACb,cAAc,EAAE,eAAe,EAC/B,sBAAsB,EACtB,iBAAiB,GAClB,EAAE,iBAAiB,2CA6VnB"}