@locpd/vidstack 1.12.14

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 (242) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/analyze.json.d.ts +8 -0
  4. package/bundle.d.ts +1 -0
  5. package/cdn/chunks/vidstack-2f5gzOW6.js +1 -0
  6. package/cdn/chunks/vidstack-BYgY9wmd.js +1 -0
  7. package/cdn/chunks/vidstack-BfBBPhXV.js +1 -0
  8. package/cdn/chunks/vidstack-Bjo5esRp.js +1 -0
  9. package/cdn/chunks/vidstack-BuL67v3q.js +1 -0
  10. package/cdn/chunks/vidstack-C0msPRTd.js +3 -0
  11. package/cdn/chunks/vidstack-CJNLoJPa.js +1 -0
  12. package/cdn/chunks/vidstack-CQSpZ7X8.js +16 -0
  13. package/cdn/chunks/vidstack-C_AxqLKV.js +1 -0
  14. package/cdn/chunks/vidstack-CioT3Yw2.js +1 -0
  15. package/cdn/chunks/vidstack-CrqkytHl.js +1 -0
  16. package/cdn/chunks/vidstack-D0M8R0ZU.js +1 -0
  17. package/cdn/chunks/vidstack-D40FSa5B.js +3 -0
  18. package/cdn/chunks/vidstack-DD2JwFVU.js +1 -0
  19. package/cdn/chunks/vidstack-DRH_1tFW.js +1 -0
  20. package/cdn/chunks/vidstack-DfDZuHNP.js +1 -0
  21. package/cdn/chunks/vidstack-DiNS2Vx5.js +1 -0
  22. package/cdn/chunks/vidstack-xjJ-ui_l.js +1 -0
  23. package/cdn/providers/vidstack-audio-2Dt_Ivbp.js +1 -0
  24. package/cdn/providers/vidstack-dash-CUtD4e6q.js +1 -0
  25. package/cdn/providers/vidstack-google-cast-BdORATUX.js +1 -0
  26. package/cdn/providers/vidstack-hls-R25Kb6DP.js +1 -0
  27. package/cdn/providers/vidstack-html-DaAUJYsD.js +1 -0
  28. package/cdn/providers/vidstack-video-Csvox7SO.js +1 -0
  29. package/cdn/providers/vidstack-vimeo-D4Z96kg2.js +1 -0
  30. package/cdn/providers/vidstack-youtube-DiND6h3s.js +1 -0
  31. package/cdn/vidstack.js +1 -0
  32. package/cdn/with-layouts/chunks/vidstack-2f5gzOW6.js +1 -0
  33. package/cdn/with-layouts/chunks/vidstack-45yH5los.js +1 -0
  34. package/cdn/with-layouts/chunks/vidstack-BBVMdOnf.js +1 -0
  35. package/cdn/with-layouts/chunks/vidstack-BB_ulI_T.js +1 -0
  36. package/cdn/with-layouts/chunks/vidstack-BcAewM33.js +1 -0
  37. package/cdn/with-layouts/chunks/vidstack-BfBBPhXV.js +1 -0
  38. package/cdn/with-layouts/chunks/vidstack-Bxv1Qnxe.js +1 -0
  39. package/cdn/with-layouts/chunks/vidstack-C2ZbG62f.js +3 -0
  40. package/cdn/with-layouts/chunks/vidstack-CCYIOKgL.js +1 -0
  41. package/cdn/with-layouts/chunks/vidstack-CL6PeIO1.js +1 -0
  42. package/cdn/with-layouts/chunks/vidstack-C_AxqLKV.js +1 -0
  43. package/cdn/with-layouts/chunks/vidstack-CifDkwDH.js +795 -0
  44. package/cdn/with-layouts/chunks/vidstack-Cry7aD59.js +3 -0
  45. package/cdn/with-layouts/chunks/vidstack-D065okCn.js +1 -0
  46. package/cdn/with-layouts/chunks/vidstack-DGuMoXmI.js +1 -0
  47. package/cdn/with-layouts/chunks/vidstack-DRH_1tFW.js +1 -0
  48. package/cdn/with-layouts/chunks/vidstack-DVBs1XoQ.js +1 -0
  49. package/cdn/with-layouts/chunks/vidstack-Dge3KT8k.js +1 -0
  50. package/cdn/with-layouts/chunks/vidstack-DiNS2Vx5.js +1 -0
  51. package/cdn/with-layouts/chunks/vidstack-HvYfJoen.js +1 -0
  52. package/cdn/with-layouts/providers/vidstack-audio-DE5vKIzW.js +1 -0
  53. package/cdn/with-layouts/providers/vidstack-dash-CA2agUuZ.js +1 -0
  54. package/cdn/with-layouts/providers/vidstack-google-cast-CGs-t8HM.js +1 -0
  55. package/cdn/with-layouts/providers/vidstack-hls-BHMbMFFR.js +1 -0
  56. package/cdn/with-layouts/providers/vidstack-html-Dm9gmNk6.js +1 -0
  57. package/cdn/with-layouts/providers/vidstack-video-C5it_Lbl.js +1 -0
  58. package/cdn/with-layouts/providers/vidstack-vimeo-BabLn9sy.js +1 -0
  59. package/cdn/with-layouts/providers/vidstack-youtube-D8UlccUL.js +1 -0
  60. package/cdn/with-layouts/vidstack.js +1 -0
  61. package/dev/chunks/vidstack-B7Zi3v_O.js +104 -0
  62. package/dev/chunks/vidstack-BFg1ZqiG.js +91 -0
  63. package/dev/chunks/vidstack-BGB2pa9s.js +58 -0
  64. package/dev/chunks/vidstack-BaIbHZE3.js +1519 -0
  65. package/dev/chunks/vidstack-Bb2rASIc.js +5188 -0
  66. package/dev/chunks/vidstack-Bcmx8pmK.js +224 -0
  67. package/dev/chunks/vidstack-Bl4b0Nen.js +29 -0
  68. package/dev/chunks/vidstack-Bo5OTJ06.js +58 -0
  69. package/dev/chunks/vidstack-BoAGnlRt.js +58 -0
  70. package/dev/chunks/vidstack-Bpr4fI4n.js +7 -0
  71. package/dev/chunks/vidstack-Bt8MP2DK.js +204 -0
  72. package/dev/chunks/vidstack-Bu2kfzUd.js +1637 -0
  73. package/dev/chunks/vidstack-C-ffXlSV.js +2995 -0
  74. package/dev/chunks/vidstack-C-ztJq-f.js +109 -0
  75. package/dev/chunks/vidstack-CFNlaVTR.js +55 -0
  76. package/dev/chunks/vidstack-C_l97D5j.js +254 -0
  77. package/dev/chunks/vidstack-CjhKISI0.js +114 -0
  78. package/dev/chunks/vidstack-CofXIJAy.js +57 -0
  79. package/dev/chunks/vidstack-CwTj4H1w.js +18 -0
  80. package/dev/chunks/vidstack-DDwbYVHV.js +66 -0
  81. package/dev/chunks/vidstack-DFImIcIL.js +11 -0
  82. package/dev/chunks/vidstack-DGDvUbvO.js +33 -0
  83. package/dev/chunks/vidstack-DO0kqA99.js +107 -0
  84. package/dev/chunks/vidstack-DXxIKXmd.js +50 -0
  85. package/dev/chunks/vidstack-DajrMUR0.js +297 -0
  86. package/dev/chunks/vidstack-DbBJlz7I.js +10 -0
  87. package/dev/chunks/vidstack-Dihypf8P.js +11 -0
  88. package/dev/chunks/vidstack-DlAhl87f.js +1193 -0
  89. package/dev/chunks/vidstack-Dm1xEU9Q.js +34 -0
  90. package/dev/chunks/vidstack-Dv_LIPFu.js +14 -0
  91. package/dev/chunks/vidstack-igYn0Apa.js +254 -0
  92. package/dev/chunks/vidstack-krOAtKMi.js +32 -0
  93. package/dev/chunks/vidstack-qh1N5_f_.js +26 -0
  94. package/dev/chunks/vidstack-rB-wqXw1.js +107 -0
  95. package/dev/chunks/vidstack-zG6PIeGg.js +66 -0
  96. package/dev/define/plyr-layout.js +51 -0
  97. package/dev/define/templates/plyr-layout.js +571 -0
  98. package/dev/define/templates/vidstack-audio-layout.js +167 -0
  99. package/dev/define/templates/vidstack-video-layout.js +390 -0
  100. package/dev/define/vidstack-icons.js +1 -0
  101. package/dev/define/vidstack-player-default-layout.js +21 -0
  102. package/dev/define/vidstack-player-layouts.js +25 -0
  103. package/dev/define/vidstack-player-ui.js +70 -0
  104. package/dev/define/vidstack-player.js +19 -0
  105. package/dev/global/plyr.js +501 -0
  106. package/dev/global/vidstack-player.js +129 -0
  107. package/dev/providers/vidstack-audio.js +35 -0
  108. package/dev/providers/vidstack-dash.js +516 -0
  109. package/dev/providers/vidstack-google-cast.js +474 -0
  110. package/dev/providers/vidstack-hls.js +408 -0
  111. package/dev/providers/vidstack-html.js +567 -0
  112. package/dev/providers/vidstack-video.js +207 -0
  113. package/dev/providers/vidstack-vimeo.js +554 -0
  114. package/dev/providers/vidstack-youtube.js +286 -0
  115. package/dev/vidstack-elements.js +36 -0
  116. package/dev/vidstack.js +91 -0
  117. package/dom.d.ts +91 -0
  118. package/elements.d.ts +1433 -0
  119. package/empty.vtt +1 -0
  120. package/global/player.d.ts +52 -0
  121. package/global/plyr.d.ts +343 -0
  122. package/google-cast.d.ts +1422 -0
  123. package/icons.d.ts +1 -0
  124. package/index.d.ts +402 -0
  125. package/package.json +199 -0
  126. package/player/index.d.ts +3 -0
  127. package/player/layouts/default.d.ts +3 -0
  128. package/player/layouts/index.d.ts +3 -0
  129. package/player/layouts/plyr.d.ts +3 -0
  130. package/player/styles/base.css +153 -0
  131. package/player/styles/default/buffering.css +55 -0
  132. package/player/styles/default/buttons.css +175 -0
  133. package/player/styles/default/captions.css +181 -0
  134. package/player/styles/default/chapter-title.css +26 -0
  135. package/player/styles/default/controls.css +56 -0
  136. package/player/styles/default/gestures.css +19 -0
  137. package/player/styles/default/icons.css +6 -0
  138. package/player/styles/default/keyboard.css +148 -0
  139. package/player/styles/default/layouts/audio.css +417 -0
  140. package/player/styles/default/layouts/video.css +590 -0
  141. package/player/styles/default/menus.css +959 -0
  142. package/player/styles/default/poster.css +52 -0
  143. package/player/styles/default/sliders.css +391 -0
  144. package/player/styles/default/theme.css +2461 -0
  145. package/player/styles/default/thumbnail.css +40 -0
  146. package/player/styles/default/time.css +45 -0
  147. package/player/styles/default/tooltips.css +141 -0
  148. package/player/styles/plyr/theme.css +1237 -0
  149. package/player/ui.d.ts +3 -0
  150. package/plugins.d.ts +19 -0
  151. package/plugins.js +13 -0
  152. package/prod/chunks/vidstack-B01xzxC4.js +7 -0
  153. package/prod/chunks/vidstack-BCeb7ryV.js +201 -0
  154. package/prod/chunks/vidstack-BGSTndAW.js +1590 -0
  155. package/prod/chunks/vidstack-BPitBBjh.js +1519 -0
  156. package/prod/chunks/vidstack-BQlOPwOu.js +45 -0
  157. package/prod/chunks/vidstack-BSDzlwxO.js +4778 -0
  158. package/prod/chunks/vidstack-BT0m6zEi.js +109 -0
  159. package/prod/chunks/vidstack-BTigPj2h.js +55 -0
  160. package/prod/chunks/vidstack-BiyXcJ_M.js +107 -0
  161. package/prod/chunks/vidstack-BoVf5n1M.js +2985 -0
  162. package/prod/chunks/vidstack-Bq6c3Bam.js +58 -0
  163. package/prod/chunks/vidstack-ByLCIBtB.js +297 -0
  164. package/prod/chunks/vidstack-C2US-gSO.js +248 -0
  165. package/prod/chunks/vidstack-C9vIqaYT.js +10 -0
  166. package/prod/chunks/vidstack-CF6fixCQ.js +1193 -0
  167. package/prod/chunks/vidstack-CTojmhKq.js +66 -0
  168. package/prod/chunks/vidstack-ChQTHmIQ.js +77 -0
  169. package/prod/chunks/vidstack-Cm6_unwd.js +246 -0
  170. package/prod/chunks/vidstack-CwTj4H1w.js +18 -0
  171. package/prod/chunks/vidstack-D3ltXc3a.js +33 -0
  172. package/prod/chunks/vidstack-D5EzK014.js +14 -0
  173. package/prod/chunks/vidstack-DDXt6fpN.js +58 -0
  174. package/prod/chunks/vidstack-DJDnh4xT.js +11 -0
  175. package/prod/chunks/vidstack-DXxIKXmd.js +50 -0
  176. package/prod/chunks/vidstack-D_-9AA6_.js +29 -0
  177. package/prod/chunks/vidstack-DbkZGjSn.js +107 -0
  178. package/prod/chunks/vidstack-Dihypf8P.js +11 -0
  179. package/prod/chunks/vidstack-Dm1xEU9Q.js +34 -0
  180. package/prod/chunks/vidstack-Dq5Yu0Vr.js +205 -0
  181. package/prod/chunks/vidstack-DqAw8m9J.js +26 -0
  182. package/prod/chunks/vidstack-DsPOyKtl.js +57 -0
  183. package/prod/chunks/vidstack-krOAtKMi.js +32 -0
  184. package/prod/chunks/vidstack-nLyr4NEP.js +58 -0
  185. package/prod/chunks/vidstack-xMS8dnYq.js +114 -0
  186. package/prod/chunks/vidstack-yEGTpgeA.js +104 -0
  187. package/prod/define/plyr-layout.js +51 -0
  188. package/prod/define/templates/plyr-layout.js +571 -0
  189. package/prod/define/templates/vidstack-audio-layout.js +167 -0
  190. package/prod/define/templates/vidstack-video-layout.js +390 -0
  191. package/prod/define/vidstack-icons.js +1 -0
  192. package/prod/define/vidstack-player-default-layout.js +21 -0
  193. package/prod/define/vidstack-player-layouts.js +25 -0
  194. package/prod/define/vidstack-player-ui.js +70 -0
  195. package/prod/define/vidstack-player.js +19 -0
  196. package/prod/global/plyr.js +493 -0
  197. package/prod/global/vidstack-player.js +129 -0
  198. package/prod/providers/vidstack-audio.js +35 -0
  199. package/prod/providers/vidstack-dash.js +501 -0
  200. package/prod/providers/vidstack-google-cast.js +468 -0
  201. package/prod/providers/vidstack-hls.js +393 -0
  202. package/prod/providers/vidstack-html.js +555 -0
  203. package/prod/providers/vidstack-video.js +204 -0
  204. package/prod/providers/vidstack-vimeo.js +548 -0
  205. package/prod/providers/vidstack-youtube.js +286 -0
  206. package/prod/vidstack-elements.js +36 -0
  207. package/prod/vidstack.js +158 -0
  208. package/server/chunks/vidstack-6juFdkKy.js +29 -0
  209. package/server/chunks/vidstack-B7iHmv7_.js +307 -0
  210. package/server/chunks/vidstack-BmxyML9v.js +1619 -0
  211. package/server/chunks/vidstack-BskfxwD3.js +566 -0
  212. package/server/chunks/vidstack-BvLV0SMz.js +4642 -0
  213. package/server/chunks/vidstack-BvWwluXZ.js +205 -0
  214. package/server/chunks/vidstack-C-413dj2.js +8 -0
  215. package/server/chunks/vidstack-C26K8z_-.js +55 -0
  216. package/server/chunks/vidstack-CJJiksDz.js +107 -0
  217. package/server/chunks/vidstack-CUNv52x1.js +141 -0
  218. package/server/chunks/vidstack-CqyBCODe.js +295 -0
  219. package/server/chunks/vidstack-CwTj4H1w.js +18 -0
  220. package/server/chunks/vidstack-DHAyGSOl.js +1502 -0
  221. package/server/chunks/vidstack-DLU3cjcp.js +381 -0
  222. package/server/chunks/vidstack-DXxIKXmd.js +50 -0
  223. package/server/chunks/vidstack-DbtDXDS2.js +104 -0
  224. package/server/chunks/vidstack-Dm1xEU9Q.js +34 -0
  225. package/server/chunks/vidstack-DzTHw_bw.js +207 -0
  226. package/server/chunks/vidstack-Wn3NH5Sg.js +1566 -0
  227. package/server/chunks/vidstack-krOAtKMi.js +32 -0
  228. package/server/chunks/vidstack-wNViAkr4.js +3045 -0
  229. package/server/define/plyr-layout.js +16 -0
  230. package/server/define/vidstack-icons.js +1 -0
  231. package/server/define/vidstack-player-default-layout.js +13 -0
  232. package/server/define/vidstack-player-layouts.js +16 -0
  233. package/server/define/vidstack-player-ui.js +11 -0
  234. package/server/define/vidstack-player.js +6 -0
  235. package/server/global/plyr.js +322 -0
  236. package/server/global/vidstack-player.js +58 -0
  237. package/server/vidstack-elements.js +46 -0
  238. package/server/vidstack.js +148 -0
  239. package/tailwind.cjs +101 -0
  240. package/tailwind.d.cts +15 -0
  241. package/types/vidstack-BOvzfZjK.d.ts +1269 -0
  242. package/types/vidstack-Cttpg6GU.d.ts +7474 -0
@@ -0,0 +1,1193 @@
1
+ import { createContext, useContext, prop, Component, computed, provideContext, signal, isBoolean, effect, setAttribute, uppercaseFirstChar, isNil, isString, noop, isFunction, unwrap, camelToKebabCase, onDispose, scoped, keysOf, peek, isKeyboardClick, isArray, tick } from './vidstack-Bu2kfzUd.js';
2
+ import { useMediaContext, useMediaState } from './vidstack-DFImIcIL.js';
3
+ import { watchColorScheme, $ariaBool, useResizeObserver, useActive } from './vidstack-C_l97D5j.js';
4
+ import { html } from 'lit-html';
5
+ import { $signal, LayoutIconsLoader, Icon } from './vidstack-Bcmx8pmK.js';
6
+ import { watchActiveTextTrack } from './vidstack-BGB2pa9s.js';
7
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
8
+ import { ref } from 'lit-html/directives/ref.js';
9
+ import { getDownloadFile, appendParamsToURL } from './vidstack-zG6PIeGg.js';
10
+
11
+ const defaultLayoutContext = createContext();
12
+ function useDefaultLayoutContext() {
13
+ return useContext(defaultLayoutContext);
14
+ }
15
+
16
+ const defaultLayoutProps = {
17
+ colorScheme: "system",
18
+ download: null,
19
+ customIcons: false,
20
+ disableTimeSlider: false,
21
+ menuContainer: null,
22
+ menuGroup: "bottom",
23
+ noAudioGain: false,
24
+ noGestures: false,
25
+ noKeyboardAnimations: false,
26
+ noModal: false,
27
+ noScrubGesture: false,
28
+ playbackRates: { min: 0, max: 2, step: 0.25 },
29
+ audioGains: { min: 0, max: 300, step: 25 },
30
+ seekStep: 10,
31
+ sliderChaptersMinWidth: 325,
32
+ hideQualityBitrate: false,
33
+ smallWhen: false,
34
+ thumbnails: null,
35
+ translations: null,
36
+ when: false
37
+ };
38
+
39
+ class DefaultLayout extends Component {
40
+ static props = defaultLayoutProps;
41
+ #media;
42
+ #when = computed(() => {
43
+ const when = this.$props.when();
44
+ return this.#matches(when);
45
+ });
46
+ #smallWhen = computed(() => {
47
+ const when = this.$props.smallWhen();
48
+ return this.#matches(when);
49
+ });
50
+ get isMatch() {
51
+ return this.#when();
52
+ }
53
+ get isSmallLayout() {
54
+ return this.#smallWhen();
55
+ }
56
+ onSetup() {
57
+ this.#media = useMediaContext();
58
+ this.setAttributes({
59
+ "data-match": this.#when,
60
+ "data-sm": () => this.#smallWhen() ? "" : null,
61
+ "data-lg": () => !this.#smallWhen() ? "" : null,
62
+ "data-size": () => this.#smallWhen() ? "sm" : "lg",
63
+ "data-no-scrub-gesture": this.$props.noScrubGesture
64
+ });
65
+ provideContext(defaultLayoutContext, {
66
+ ...this.$props,
67
+ when: this.#when,
68
+ smallWhen: this.#smallWhen,
69
+ userPrefersAnnouncements: signal(true),
70
+ userPrefersKeyboardAnimations: signal(true),
71
+ menuPortal: signal(null)
72
+ });
73
+ }
74
+ onAttach(el) {
75
+ watchColorScheme(el, this.$props.colorScheme);
76
+ }
77
+ #matches(query) {
78
+ return query !== "never" && (isBoolean(query) ? query : computed(() => query(this.#media.player.state))());
79
+ }
80
+ }
81
+ const defaultlayout__proto = DefaultLayout.prototype;
82
+ prop(defaultlayout__proto, "isMatch");
83
+ prop(defaultlayout__proto, "isSmallLayout");
84
+
85
+ function setLayoutName(name, isMatch) {
86
+ effect(() => {
87
+ const { player } = useMediaContext(), el = player.el;
88
+ el && setAttribute(el, "data-layout", isMatch() && name);
89
+ return () => el?.removeAttribute("data-layout");
90
+ });
91
+ }
92
+
93
+ function i18n(translations, word) {
94
+ return translations()?.[word] ?? word;
95
+ }
96
+
97
+ function DefaultAnnouncer() {
98
+ return $signal(() => {
99
+ const { translations, userPrefersAnnouncements } = useDefaultLayoutContext();
100
+ if (!userPrefersAnnouncements()) return null;
101
+ return html`<media-announcer .translations=${$signal(translations)}></media-announcer>`;
102
+ });
103
+ }
104
+
105
+ function IconSlot(name, classes = "") {
106
+ return html`<slot
107
+ name=${`${name}-icon`}
108
+ data-class=${`vds-icon vds-${name}-icon${classes ? ` ${classes}` : ""}`}
109
+ ></slot>`;
110
+ }
111
+ function IconSlots(names) {
112
+ return names.map((name) => IconSlot(name));
113
+ }
114
+
115
+ function $i18n(translations, word) {
116
+ return $signal(() => i18n(translations, word));
117
+ }
118
+
119
+ function DefaultAirPlayButton({ tooltip }) {
120
+ const { translations } = useDefaultLayoutContext(), { remotePlaybackState } = useMediaState(), $label = $signal(() => {
121
+ const airPlayText = i18n(translations, "AirPlay"), stateText = uppercaseFirstChar(remotePlaybackState());
122
+ return `${airPlayText} ${stateText}`;
123
+ }), $airPlayText = $i18n(translations, "AirPlay");
124
+ return html`
125
+ <media-tooltip class="vds-airplay-tooltip vds-tooltip">
126
+ <media-tooltip-trigger>
127
+ <media-airplay-button class="vds-airplay-button vds-button" aria-label=${$label}>
128
+ ${IconSlot("airplay")}
129
+ </media-airplay-button>
130
+ </media-tooltip-trigger>
131
+ <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
132
+ <span class="vds-airplay-tooltip-text">${$airPlayText}</span>
133
+ </media-tooltip-content>
134
+ </media-tooltip>
135
+ `;
136
+ }
137
+ function DefaultPlayButton({ tooltip }) {
138
+ const { translations } = useDefaultLayoutContext(), $playText = $i18n(translations, "Play"), $pauseText = $i18n(translations, "Pause");
139
+ return html`
140
+ <media-tooltip class="vds-play-tooltip vds-tooltip">
141
+ <media-tooltip-trigger>
142
+ <media-play-button
143
+ class="vds-play-button vds-button"
144
+ aria-label=${$i18n(translations, "Play")}
145
+ >
146
+ ${IconSlots(["play", "pause", "replay"])}
147
+ </media-play-button>
148
+ </media-tooltip-trigger>
149
+ <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
150
+ <span class="vds-play-tooltip-text">${$playText}</span>
151
+ <span class="vds-pause-tooltip-text">${$pauseText}</span>
152
+ </media-tooltip-content>
153
+ </media-tooltip>
154
+ `;
155
+ }
156
+ function DefaultMuteButton({
157
+ tooltip,
158
+ ref: ref$1 = noop
159
+ }) {
160
+ const { translations } = useDefaultLayoutContext(), $muteText = $i18n(translations, "Mute"), $unmuteText = $i18n(translations, "Unmute");
161
+ return html`
162
+ <media-tooltip class="vds-mute-tooltip vds-tooltip">
163
+ <media-tooltip-trigger>
164
+ <media-mute-button
165
+ class="vds-mute-button vds-button"
166
+ aria-label=${$i18n(translations, "Mute")}
167
+ ${ref(ref$1)}
168
+ >
169
+ ${IconSlots(["mute", "volume-low", "volume-high"])}
170
+ </media-mute-button>
171
+ </media-tooltip-trigger>
172
+ <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
173
+ <span class="vds-mute-tooltip-text">${$unmuteText}</span>
174
+ <span class="vds-unmute-tooltip-text">${$muteText}</span>
175
+ </media-tooltip-content>
176
+ </media-tooltip>
177
+ `;
178
+ }
179
+ function DefaultCaptionButton({ tooltip }) {
180
+ const { translations } = useDefaultLayoutContext(), $ccOnText = $i18n(translations, "Closed-Captions On"), $ccOffText = $i18n(translations, "Closed-Captions Off");
181
+ return html`
182
+ <media-tooltip class="vds-caption-tooltip vds-tooltip">
183
+ <media-tooltip-trigger>
184
+ <media-caption-button
185
+ class="vds-caption-button vds-button"
186
+ aria-label=${$i18n(translations, "Captions")}
187
+ >
188
+ ${IconSlots(["cc-on", "cc-off"])}
189
+ </media-caption-button>
190
+ </media-tooltip-trigger>
191
+ <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
192
+ <span class="vds-cc-on-tooltip-text">${$ccOffText}</span>
193
+ <span class="vds-cc-off-tooltip-text">${$ccOnText}</span>
194
+ </media-tooltip-content>
195
+ </media-tooltip>
196
+ `;
197
+ }
198
+ function DefaultPIPButton() {
199
+ const { translations } = useDefaultLayoutContext(), $enterText = $i18n(translations, "Enter PiP"), $exitText = $i18n(translations, "Exit PiP");
200
+ return html`
201
+ <media-tooltip class="vds-pip-tooltip vds-tooltip">
202
+ <media-tooltip-trigger>
203
+ <media-pip-button
204
+ class="vds-pip-button vds-button"
205
+ aria-label=${$i18n(translations, "PiP")}
206
+ >
207
+ ${IconSlots(["pip-enter", "pip-exit"])}
208
+ </media-pip-button>
209
+ </media-tooltip-trigger>
210
+ <media-tooltip-content class="vds-tooltip-content">
211
+ <span class="vds-pip-enter-tooltip-text">${$enterText}</span>
212
+ <span class="vds-pip-exit-tooltip-text">${$exitText}</span>
213
+ </media-tooltip-content>
214
+ </media-tooltip>
215
+ `;
216
+ }
217
+ function DefaultFullscreenButton({ tooltip }) {
218
+ const { translations } = useDefaultLayoutContext(), $enterText = $i18n(translations, "Enter Fullscreen"), $exitText = $i18n(translations, "Exit Fullscreen");
219
+ return html`
220
+ <media-tooltip class="vds-fullscreen-tooltip vds-tooltip">
221
+ <media-tooltip-trigger>
222
+ <media-fullscreen-button
223
+ class="vds-fullscreen-button vds-button"
224
+ aria-label=${$i18n(translations, "Fullscreen")}
225
+ >
226
+ ${IconSlots(["fs-enter", "fs-exit"])}
227
+ </media-fullscreen-button>
228
+ </media-tooltip-trigger>
229
+ <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
230
+ <span class="vds-fs-enter-tooltip-text">${$enterText}</span>
231
+ <span class="vds-fs-exit-tooltip-text">${$exitText}</span>
232
+ </media-tooltip-content>
233
+ </media-tooltip>
234
+ `;
235
+ }
236
+ function DefaultSeekButton({
237
+ backward,
238
+ tooltip
239
+ }) {
240
+ const { translations, seekStep } = useDefaultLayoutContext(), seekText = !backward ? "Seek Forward" : "Seek Backward", $label = $i18n(translations, seekText), $seconds = () => (backward ? -1 : 1) * seekStep();
241
+ return html`
242
+ <media-tooltip class="vds-seek-tooltip vds-tooltip">
243
+ <media-tooltip-trigger>
244
+ <media-seek-button
245
+ class="vds-seek-button vds-button"
246
+ seconds=${$signal($seconds)}
247
+ aria-label=${$label}
248
+ >
249
+ ${!backward ? IconSlot("seek-forward") : IconSlot("seek-backward")}
250
+ </media-seek-button>
251
+ </media-tooltip-trigger>
252
+ <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
253
+ ${$i18n(translations, seekText)}
254
+ </media-tooltip-content>
255
+ </media-tooltip>
256
+ `;
257
+ }
258
+ function DefaultLiveButton() {
259
+ const { translations } = useDefaultLayoutContext(), { live } = useMediaState(), $label = $i18n(translations, "Skip To Live"), $liveText = $i18n(translations, "LIVE");
260
+ return live() ? html`
261
+ <media-live-button class="vds-live-button" aria-label=${$label}>
262
+ <span class="vds-live-button-text">${$liveText}</span>
263
+ </media-live-button>
264
+ ` : null;
265
+ }
266
+ function DefaultDownloadButton() {
267
+ return $signal(() => {
268
+ const { download, translations } = useDefaultLayoutContext(), $download = download();
269
+ if (isNil($download)) return null;
270
+ const { source, title } = useMediaState(), $src = source(), file = getDownloadFile({
271
+ title: title(),
272
+ src: $src,
273
+ download: $download
274
+ });
275
+ return isString(file?.url) ? html`
276
+ <media-tooltip class="vds-download-tooltip vds-tooltip">
277
+ <media-tooltip-trigger>
278
+ <a
279
+ role="button"
280
+ class="vds-download-button vds-button"
281
+ aria-label=${$i18n(translations, "Download")}
282
+ href=${appendParamsToURL(file.url, { download: file.name })}
283
+ download=${file.name}
284
+ target="_blank"
285
+ >
286
+ <slot name="download-icon" data-class="vds-icon" />
287
+ </a>
288
+ </media-tooltip-trigger>
289
+ <media-tooltip-content class="vds-tooltip-content" placement="top">
290
+ ${$i18n(translations, "Download")}
291
+ </media-tooltip-content>
292
+ </media-tooltip>
293
+ ` : null;
294
+ });
295
+ }
296
+
297
+ function DefaultCaptions() {
298
+ const { translations } = useDefaultLayoutContext();
299
+ return html`
300
+ <media-captions
301
+ class="vds-captions"
302
+ .exampleText=${$i18n(translations, "Captions look like this")}
303
+ ></media-captions>
304
+ `;
305
+ }
306
+
307
+ function DefaultControlsSpacer() {
308
+ return html`<div class="vds-controls-spacer"></div>`;
309
+ }
310
+
311
+ function MenuPortal(container, template) {
312
+ return html`
313
+ <media-menu-portal .container=${$signal(container)} disabled="fullscreen">
314
+ ${template}
315
+ </media-menu-portal>
316
+ `;
317
+ }
318
+ function createMenuContainer(layoutEl, rootSelector, className, isSmallLayout) {
319
+ let root = isString(rootSelector) ? document.querySelector(rootSelector) : rootSelector;
320
+ if (!root) root = layoutEl?.closest("dialog");
321
+ if (!root) root = document.body;
322
+ const container = document.createElement("div");
323
+ container.style.display = "contents";
324
+ container.classList.add(className);
325
+ root.append(container);
326
+ effect(() => {
327
+ if (!container) return;
328
+ const { viewType } = useMediaState(), isSmall = isSmallLayout();
329
+ setAttribute(container, "data-view-type", viewType());
330
+ setAttribute(container, "data-sm", isSmall);
331
+ setAttribute(container, "data-lg", !isSmall);
332
+ setAttribute(container, "data-size", isSmall ? "sm" : "lg");
333
+ });
334
+ const { colorScheme } = useDefaultLayoutContext();
335
+ watchColorScheme(container, colorScheme);
336
+ return container;
337
+ }
338
+
339
+ function DefaultChaptersMenu({
340
+ placement,
341
+ tooltip,
342
+ portal
343
+ }) {
344
+ const { textTracks } = useMediaContext(), { viewType, seekableStart, seekableEnd } = useMediaState(), {
345
+ translations,
346
+ thumbnails,
347
+ menuPortal,
348
+ noModal,
349
+ menuGroup,
350
+ smallWhen: smWhen
351
+ } = useDefaultLayoutContext(), $disabled = computed(() => {
352
+ const $startTime = seekableStart(), $endTime = seekableEnd(), $track = signal(null);
353
+ watchActiveTextTrack(textTracks, "chapters", $track.set);
354
+ const cues = $track()?.cues.filter(
355
+ (cue) => cue.startTime <= $endTime && cue.endTime >= $startTime
356
+ );
357
+ return !cues?.length;
358
+ });
359
+ if ($disabled()) return null;
360
+ const $placement = computed(
361
+ () => noModal() ? unwrap(placement) : !smWhen() ? unwrap(placement) : null
362
+ ), $offset = computed(
363
+ () => !smWhen() && menuGroup() === "bottom" && viewType() === "video" ? 26 : 0
364
+ ), $isOpen = signal(false);
365
+ function onOpen() {
366
+ $isOpen.set(true);
367
+ }
368
+ function onClose() {
369
+ $isOpen.set(false);
370
+ }
371
+ const items = html`
372
+ <media-menu-items
373
+ class="vds-chapters-menu-items vds-menu-items"
374
+ placement=${$signal($placement)}
375
+ offset=${$signal($offset)}
376
+ >
377
+ ${$signal(() => {
378
+ if (!$isOpen()) return null;
379
+ return html`
380
+ <media-chapters-radio-group
381
+ class="vds-chapters-radio-group vds-radio-group"
382
+ .thumbnails=${$signal(thumbnails)}
383
+ >
384
+ <template>
385
+ <media-radio class="vds-chapter-radio vds-radio">
386
+ <media-thumbnail class="vds-thumbnail"></media-thumbnail>
387
+ <div class="vds-chapter-radio-content">
388
+ <span class="vds-chapter-radio-label" data-part="label"></span>
389
+ <span class="vds-chapter-radio-start-time" data-part="start-time"></span>
390
+ <span class="vds-chapter-radio-duration" data-part="duration"></span>
391
+ </div>
392
+ </media-radio>
393
+ </template>
394
+ </media-chapters-radio-group>
395
+ `;
396
+ })}
397
+ </media-menu-items>
398
+ `;
399
+ return html`
400
+ <media-menu class="vds-chapters-menu vds-menu" @open=${onOpen} @close=${onClose}>
401
+ <media-tooltip class="vds-tooltip">
402
+ <media-tooltip-trigger>
403
+ <media-menu-button
404
+ class="vds-menu-button vds-button"
405
+ aria-label=${$i18n(translations, "Chapters")}
406
+ >
407
+ ${IconSlot("menu-chapters")}
408
+ </media-menu-button>
409
+ </media-tooltip-trigger>
410
+ <media-tooltip-content
411
+ class="vds-tooltip-content"
412
+ placement=${isFunction(tooltip) ? $signal(tooltip) : tooltip}
413
+ >
414
+ ${$i18n(translations, "Chapters")}
415
+ </media-tooltip-content>
416
+ </media-tooltip>
417
+ ${MenuPortal(menuPortal, items) }
418
+ </media-menu>
419
+ `;
420
+ }
421
+
422
+ function hexToRgb(hex) {
423
+ const { style } = new Option();
424
+ style.color = hex;
425
+ return style.color.match(/\((.*?)\)/)[1].replace(/,/g, " ");
426
+ }
427
+
428
+ const FONT_COLOR_OPTION = {
429
+ type: "color"
430
+ };
431
+ const FONT_FAMILY_OPTION = {
432
+ type: "radio",
433
+ values: {
434
+ "Monospaced Serif": "mono-serif",
435
+ "Proportional Serif": "pro-serif",
436
+ "Monospaced Sans-Serif": "mono-sans",
437
+ "Proportional Sans-Serif": "pro-sans",
438
+ Casual: "casual",
439
+ Cursive: "cursive",
440
+ "Small Capitals": "capitals"
441
+ }
442
+ };
443
+ const FONT_SIZE_OPTION = {
444
+ type: "slider",
445
+ min: 0,
446
+ max: 400,
447
+ step: 25,
448
+ upIcon: null,
449
+ downIcon: null
450
+ };
451
+ const FONT_OPACITY_OPTION = {
452
+ type: "slider",
453
+ min: 0,
454
+ max: 100,
455
+ step: 5,
456
+ upIcon: null,
457
+ downIcon: null
458
+ };
459
+ const FONT_TEXT_SHADOW_OPTION = {
460
+ type: "radio",
461
+ values: ["None", "Drop Shadow", "Raised", "Depressed", "Outline"]
462
+ };
463
+ const FONT_DEFAULTS = {
464
+ fontFamily: "pro-sans",
465
+ fontSize: "100%",
466
+ textColor: "#ffffff",
467
+ textOpacity: "100%",
468
+ textShadow: "none",
469
+ textBg: "#000000",
470
+ textBgOpacity: "100%",
471
+ displayBg: "#000000",
472
+ displayBgOpacity: "0%"
473
+ };
474
+ const FONT_SIGNALS = Object.keys(FONT_DEFAULTS).reduce(
475
+ (prev, type) => ({
476
+ ...prev,
477
+ [type]: signal(FONT_DEFAULTS[type])
478
+ }),
479
+ {}
480
+ );
481
+ {
482
+ for (const type of Object.keys(FONT_SIGNALS)) {
483
+ const value = localStorage.getItem(`vds-player:${camelToKebabCase(type)}`);
484
+ if (isString(value)) FONT_SIGNALS[type].set(value);
485
+ }
486
+ }
487
+ function onFontReset() {
488
+ for (const type of Object.keys(FONT_SIGNALS)) {
489
+ const defaultValue = FONT_DEFAULTS[type];
490
+ FONT_SIGNALS[type].set(defaultValue);
491
+ }
492
+ }
493
+
494
+ let isWatchingVars = false, players = /* @__PURE__ */ new Set();
495
+ function updateFontCssVars() {
496
+ const { player } = useMediaContext();
497
+ players.add(player);
498
+ onDispose(() => players.delete(player));
499
+ if (!isWatchingVars) {
500
+ scoped(() => {
501
+ for (const type of keysOf(FONT_SIGNALS)) {
502
+ const $value = FONT_SIGNALS[type], defaultValue = FONT_DEFAULTS[type], varName = `--media-user-${camelToKebabCase(type)}`, storageKey = `vds-player:${camelToKebabCase(type)}`;
503
+ effect(() => {
504
+ const value = $value(), isDefaultVarValue = value === defaultValue, varValue = !isDefaultVarValue ? getCssVarValue(player, type, value) : null;
505
+ for (const player2 of players) {
506
+ player2.el?.style.setProperty(varName, varValue);
507
+ }
508
+ if (isDefaultVarValue) {
509
+ localStorage.removeItem(storageKey);
510
+ } else {
511
+ localStorage.setItem(storageKey, value);
512
+ }
513
+ });
514
+ }
515
+ }, null);
516
+ isWatchingVars = true;
517
+ }
518
+ }
519
+ function getCssVarValue(player, type, value) {
520
+ switch (type) {
521
+ case "fontFamily":
522
+ const fontVariant = value === "capitals" ? "small-caps" : "";
523
+ player.el?.style.setProperty("--media-user-font-variant", fontVariant);
524
+ return getFontFamilyCSSVarValue(value);
525
+ case "fontSize":
526
+ case "textOpacity":
527
+ case "textBgOpacity":
528
+ case "displayBgOpacity":
529
+ return percentToRatio(value);
530
+ case "textColor":
531
+ return `rgb(${hexToRgb(value)} / var(--media-user-text-opacity, 1))`;
532
+ case "textShadow":
533
+ return getTextShadowCssVarValue(value);
534
+ case "textBg":
535
+ return `rgb(${hexToRgb(value)} / var(--media-user-text-bg-opacity, 1))`;
536
+ case "displayBg":
537
+ return `rgb(${hexToRgb(value)} / var(--media-user-display-bg-opacity, 1))`;
538
+ }
539
+ }
540
+ function percentToRatio(value) {
541
+ return (parseInt(value) / 100).toString();
542
+ }
543
+ function getFontFamilyCSSVarValue(value) {
544
+ switch (value) {
545
+ case "mono-serif":
546
+ return '"Courier New", Courier, "Nimbus Mono L", "Cutive Mono", monospace';
547
+ case "mono-sans":
548
+ return '"Deja Vu Sans Mono", "Lucida Console", Monaco, Consolas, "PT Mono", monospace';
549
+ case "pro-sans":
550
+ return 'Roboto, "Arial Unicode Ms", Arial, Helvetica, Verdana, "PT Sans Caption", sans-serif';
551
+ case "casual":
552
+ return '"Comic Sans MS", Impact, Handlee, fantasy';
553
+ case "cursive":
554
+ return '"Monotype Corsiva", "URW Chancery L", "Apple Chancery", "Dancing Script", cursive';
555
+ case "capitals":
556
+ return '"Arial Unicode Ms", Arial, Helvetica, Verdana, "Marcellus SC", sans-serif + font-variant=small-caps';
557
+ default:
558
+ return '"Times New Roman", Times, Georgia, Cambria, "PT Serif Caption", serif';
559
+ }
560
+ }
561
+ function getTextShadowCssVarValue(value) {
562
+ switch (value) {
563
+ case "drop shadow":
564
+ return "rgb(34, 34, 34) 1.86389px 1.86389px 2.79583px, rgb(34, 34, 34) 1.86389px 1.86389px 3.72778px, rgb(34, 34, 34) 1.86389px 1.86389px 4.65972px";
565
+ case "raised":
566
+ return "rgb(34, 34, 34) 1px 1px, rgb(34, 34, 34) 2px 2px";
567
+ case "depressed":
568
+ return "rgb(204, 204, 204) 1px 1px, rgb(34, 34, 34) -1px -1px";
569
+ case "outline":
570
+ return "rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px";
571
+ default:
572
+ return "";
573
+ }
574
+ }
575
+
576
+ function DefaultMenuCheckbox({
577
+ label,
578
+ checked,
579
+ defaultChecked = false,
580
+ storageKey,
581
+ onChange
582
+ }) {
583
+ const { translations } = useDefaultLayoutContext(), savedValue = localStorage.getItem(storageKey) , $checked = signal(!!(savedValue ?? defaultChecked)), $active = signal(false), $ariaChecked = $signal($ariaBool($checked)), $label = $i18n(translations, label);
584
+ onChange(peek($checked));
585
+ if (checked) {
586
+ effect(() => void $checked.set(checked()));
587
+ }
588
+ function onPress(event) {
589
+ if (event?.button === 1) return;
590
+ $checked.set((checked2) => !checked2);
591
+ localStorage.setItem(storageKey, $checked() ? "1" : "");
592
+ onChange($checked(), event);
593
+ $active.set(false);
594
+ }
595
+ function onKeyDown(event) {
596
+ if (isKeyboardClick(event)) onPress();
597
+ }
598
+ function onActive(event) {
599
+ if (event.button !== 0) return;
600
+ $active.set(true);
601
+ }
602
+ return html`
603
+ <div
604
+ class="vds-menu-checkbox"
605
+ role="menuitemcheckbox"
606
+ tabindex="0"
607
+ aria-label=${$label}
608
+ aria-checked=${$ariaChecked}
609
+ data-active=${$signal(() => $active() ? "" : null)}
610
+ @pointerup=${onPress}
611
+ @pointerdown=${onActive}
612
+ @keydown=${onKeyDown}
613
+ ></div>
614
+ `;
615
+ }
616
+
617
+ let sectionId = 0;
618
+ function DefaultMenuSection({ label = "", value = "", children }) {
619
+ if (!label) {
620
+ return html`
621
+ <div class="vds-menu-section">
622
+ <div class="vds-menu-section-body">${children}</div>
623
+ </div>
624
+ `;
625
+ }
626
+ const id = `vds-menu-section-${++sectionId}`;
627
+ return html`
628
+ <section class="vds-menu-section" role="group" aria-labelledby=${id}>
629
+ <div class="vds-menu-section-title">
630
+ <header id=${id}>${label}</header>
631
+ ${value ? html`<div class="vds-menu-section-value">${value}</div>` : null}
632
+ </div>
633
+ <div class="vds-menu-section-body">${children}</div>
634
+ </section>
635
+ `;
636
+ }
637
+ function DefaultMenuItem({ label, children }) {
638
+ return html`
639
+ <div class="vds-menu-item">
640
+ <div class="vds-menu-item-label">${label}</div>
641
+ ${children}
642
+ </div>
643
+ `;
644
+ }
645
+ function DefaultMenuButton({
646
+ label,
647
+ icon,
648
+ hint
649
+ }) {
650
+ return html`
651
+ <media-menu-button class="vds-menu-item">
652
+ ${IconSlot("menu-arrow-left", "vds-menu-close-icon")}
653
+ ${icon ? IconSlot(icon, "vds-menu-item-icon") : null}
654
+ <span class="vds-menu-item-label">${$signal(label)}</span>
655
+ <span class="vds-menu-item-hint" data-part="hint">${hint ? $signal(hint) : null} </span>
656
+ ${IconSlot("menu-arrow-right", "vds-menu-open-icon")}
657
+ </media-menu-button>
658
+ `;
659
+ }
660
+ function DefaultRadioGroup({
661
+ value = null,
662
+ options,
663
+ hideLabel = false,
664
+ children = null,
665
+ onChange = null
666
+ }) {
667
+ function renderRadio(option) {
668
+ const { value: value2, label: content } = option;
669
+ return html`
670
+ <media-radio class="vds-radio" value=${value2}>
671
+ ${IconSlot("menu-radio-check")}
672
+ ${!hideLabel ? html`
673
+ <span class="vds-radio-label" data-part="label">
674
+ ${isString(content) ? content : $signal(content)}
675
+ </span>
676
+ ` : null}
677
+ ${isFunction(children) ? children(option) : children}
678
+ </media-radio>
679
+ `;
680
+ }
681
+ return html`
682
+ <media-radio-group
683
+ class="vds-radio-group"
684
+ value=${isString(value) ? value : value ? $signal(value) : ""}
685
+ @change=${onChange}
686
+ >
687
+ ${isArray(options) ? options.map(renderRadio) : $signal(() => options().map(renderRadio))}
688
+ </media-radio-group>
689
+ `;
690
+ }
691
+ function createRadioOptions(entries) {
692
+ return isArray(entries) ? entries.map((entry) => ({ label: entry, value: entry.toLowerCase() })) : Object.keys(entries).map((label) => ({ label, value: entries[label] }));
693
+ }
694
+
695
+ function DefaultDualCaptionsMenuCheckbox() {
696
+ const { remote } = useMediaContext(), { translations } = useDefaultLayoutContext(), label = "Dual Captions Separation";
697
+ return DefaultMenuItem({
698
+ label: $i18n(translations, label),
699
+ children: DefaultMenuCheckbox({
700
+ label,
701
+ storageKey: "vds-player::user-dual-captions-separation",
702
+ onChange(checked, trigger) {
703
+ remote.userDualCaptionChange(checked, trigger);
704
+ }
705
+ })
706
+ });
707
+ }
708
+
709
+ function DefaultSliderParts() {
710
+ return html`
711
+ <div class="vds-slider-track"></div>
712
+ <div class="vds-slider-track-fill vds-slider-track"></div>
713
+ <div class="vds-slider-thumb"></div>
714
+ `;
715
+ }
716
+ function DefaultSliderSteps() {
717
+ return html`
718
+ <media-slider-steps class="vds-slider-steps">
719
+ <template>
720
+ <div class="vds-slider-step"></div>
721
+ </template>
722
+ </media-slider-steps>
723
+ `;
724
+ }
725
+ function DefaultMenuSliderItem({
726
+ label = null,
727
+ value = null,
728
+ upIcon = "",
729
+ downIcon = "",
730
+ children,
731
+ isMin,
732
+ isMax
733
+ }) {
734
+ const hasTitle = label || value, content = [
735
+ downIcon ? IconSlot(downIcon, "down") : null,
736
+ children,
737
+ upIcon ? IconSlot(upIcon, "up") : null
738
+ ];
739
+ return html`
740
+ <div
741
+ class=${`vds-menu-item vds-menu-slider-item${hasTitle ? " group" : ""}`}
742
+ data-min=${$signal(() => isMin() ? "" : null)}
743
+ data-max=${$signal(() => isMax() ? "" : null)}
744
+ >
745
+ ${hasTitle ? html`
746
+ <div class="vds-menu-slider-title">
747
+ ${[
748
+ label ? html`<div>${label}</div>` : null,
749
+ value ? html`<div>${value}</div>` : null
750
+ ]}
751
+ </div>
752
+ <div class="vds-menu-slider-body">${content}</div>
753
+ ` : content}
754
+ </div>
755
+ `;
756
+ }
757
+
758
+ const FONT_SIZE_OPTION_WITH_ICONS = {
759
+ ...FONT_SIZE_OPTION,
760
+ upIcon: "menu-opacity-up",
761
+ downIcon: "menu-opacity-down"
762
+ };
763
+ const FONT_OPACITY_OPTION_WITH_ICONS = {
764
+ ...FONT_OPACITY_OPTION,
765
+ upIcon: "menu-opacity-up",
766
+ downIcon: "menu-opacity-down"
767
+ };
768
+ function DefaultFontMenu() {
769
+ return $signal(() => {
770
+ const { hasCaptions } = useMediaState(), { translations } = useDefaultLayoutContext();
771
+ if (!hasCaptions()) return null;
772
+ return html`
773
+ <media-menu class="vds-font-menu vds-menu">
774
+ ${DefaultMenuButton({
775
+ label: () => i18n(translations, "Caption Styles")
776
+ })}
777
+ <media-menu-items class="vds-menu-items">
778
+ ${[
779
+ DefaultMenuSection({
780
+ label: $i18n(translations, "Font"),
781
+ children: [DefaultFontFamilyMenu(), DefaultFontSizeSlider()]
782
+ }),
783
+ DefaultMenuSection({
784
+ label: $i18n(translations, "Text"),
785
+ children: [
786
+ DefaultTextColorInput(),
787
+ DefaultTextShadowMenu(),
788
+ DefaultTextOpacitySlider()
789
+ ]
790
+ }),
791
+ DefaultMenuSection({
792
+ label: $i18n(translations, "Text Background"),
793
+ children: [DefaultTextBgInput(), DefaultTextBgOpacitySlider()]
794
+ }),
795
+ DefaultMenuSection({
796
+ label: $i18n(translations, "Display Background"),
797
+ children: [DefaultDisplayBgInput(), DefaultDisplayOpacitySlider()]
798
+ }),
799
+ DefaultMenuSection({
800
+ children: [DefaultResetMenuItem()]
801
+ })
802
+ ]}
803
+ </media-menu-items>
804
+ </media-menu>
805
+ `;
806
+ });
807
+ }
808
+ function DefaultFontFamilyMenu() {
809
+ return DefaultFontSetting({
810
+ label: "Family",
811
+ option: FONT_FAMILY_OPTION,
812
+ type: "fontFamily"
813
+ });
814
+ }
815
+ function DefaultFontSizeSlider() {
816
+ return DefaultFontSetting({
817
+ label: "Size",
818
+ option: FONT_SIZE_OPTION_WITH_ICONS,
819
+ type: "fontSize"
820
+ });
821
+ }
822
+ function DefaultTextColorInput() {
823
+ return DefaultFontSetting({
824
+ label: "Color",
825
+ option: FONT_COLOR_OPTION,
826
+ type: "textColor"
827
+ });
828
+ }
829
+ function DefaultTextOpacitySlider() {
830
+ return DefaultFontSetting({
831
+ label: "Opacity",
832
+ option: FONT_OPACITY_OPTION_WITH_ICONS,
833
+ type: "textOpacity"
834
+ });
835
+ }
836
+ function DefaultTextShadowMenu() {
837
+ return DefaultFontSetting({
838
+ label: "Shadow",
839
+ option: FONT_TEXT_SHADOW_OPTION,
840
+ type: "textShadow"
841
+ });
842
+ }
843
+ function DefaultTextBgInput() {
844
+ return DefaultFontSetting({
845
+ label: "Color",
846
+ option: FONT_COLOR_OPTION,
847
+ type: "textBg"
848
+ });
849
+ }
850
+ function DefaultTextBgOpacitySlider() {
851
+ return DefaultFontSetting({
852
+ label: "Opacity",
853
+ option: FONT_OPACITY_OPTION_WITH_ICONS,
854
+ type: "textBgOpacity"
855
+ });
856
+ }
857
+ function DefaultDisplayBgInput() {
858
+ return DefaultFontSetting({
859
+ label: "Color",
860
+ option: FONT_COLOR_OPTION,
861
+ type: "displayBg"
862
+ });
863
+ }
864
+ function DefaultDisplayOpacitySlider() {
865
+ return DefaultFontSetting({
866
+ label: "Opacity",
867
+ option: FONT_OPACITY_OPTION_WITH_ICONS,
868
+ type: "displayBgOpacity"
869
+ });
870
+ }
871
+ function DefaultResetMenuItem() {
872
+ const { translations } = useDefaultLayoutContext(), $label = () => i18n(translations, "Reset");
873
+ return html`
874
+ <button class="vds-menu-item" role="menuitem" @click=${onFontReset}>
875
+ <span class="vds-menu-item-label">${$signal($label)}</span>
876
+ </button>
877
+ `;
878
+ }
879
+ function DefaultFontSetting({ label, option, type }) {
880
+ const { player } = useMediaContext(), { translations } = useDefaultLayoutContext(), $currentValue = FONT_SIGNALS[type], $label = () => i18n(translations, label);
881
+ function notify() {
882
+ tick();
883
+ player.dispatchEvent(new Event("vds-font-change"));
884
+ }
885
+ if (option.type === "color") {
886
+ let onColorChange2 = function(event) {
887
+ $currentValue.set(event.target.value);
888
+ notify();
889
+ };
890
+ return DefaultMenuItem({
891
+ label: $signal($label),
892
+ children: html`
893
+ <input
894
+ class="vds-color-picker"
895
+ type="color"
896
+ .value=${$signal($currentValue)}
897
+ @input=${onColorChange2}
898
+ />
899
+ `
900
+ });
901
+ }
902
+ if (option.type === "slider") {
903
+ let onSliderValueChange2 = function(event) {
904
+ $currentValue.set(event.detail + "%");
905
+ notify();
906
+ };
907
+ const { min, max, step, upIcon, downIcon } = option;
908
+ return DefaultMenuSliderItem({
909
+ label: $signal($label),
910
+ value: $signal($currentValue),
911
+ upIcon,
912
+ downIcon,
913
+ isMin: () => $currentValue() === min + "%",
914
+ isMax: () => $currentValue() === max + "%",
915
+ children: html`
916
+ <media-slider
917
+ class="vds-slider"
918
+ min=${min}
919
+ max=${max}
920
+ step=${step}
921
+ key-step=${step}
922
+ .value=${$signal(() => parseInt($currentValue()))}
923
+ aria-label=${$signal($label)}
924
+ @value-change=${onSliderValueChange2}
925
+ @drag-value-change=${onSliderValueChange2}
926
+ >
927
+ ${DefaultSliderParts()}${DefaultSliderSteps()}
928
+ </media-slider>
929
+ `
930
+ });
931
+ }
932
+ const radioOptions = createRadioOptions(option.values), $hint = () => {
933
+ const value = $currentValue(), label2 = radioOptions.find((radio) => radio.value === value)?.label || "";
934
+ return i18n(translations, isString(label2) ? label2 : label2());
935
+ };
936
+ return html`
937
+ <media-menu class=${`vds-${camelToKebabCase(type)}-menu vds-menu`}>
938
+ ${DefaultMenuButton({ label: $label, hint: $hint })}
939
+ <media-menu-items class="vds-menu-items">
940
+ ${DefaultRadioGroup({
941
+ value: $currentValue,
942
+ options: radioOptions,
943
+ onChange({ detail: value }) {
944
+ $currentValue.set(value);
945
+ notify();
946
+ }
947
+ })}
948
+ </media-menu-items>
949
+ </media-menu>
950
+ `;
951
+ }
952
+
953
+ function DefaultSpeedMenuSection() {
954
+ return $signal(() => {
955
+ const { translations } = useDefaultLayoutContext(), { canSetPlaybackRate, playbackRate } = useMediaState();
956
+ if (!canSetPlaybackRate()) return null;
957
+ return DefaultMenuSection({
958
+ label: $i18n(translations, "Speed"),
959
+ value: $signal(
960
+ () => playbackRate() === 1 ? i18n(translations, "Normal") : playbackRate() + "x"
961
+ ),
962
+ children: [
963
+ DefaultMenuSliderItem({
964
+ upIcon: "menu-speed-up",
965
+ downIcon: "menu-speed-down",
966
+ children: DefaultSpeedSlider(),
967
+ isMin: () => playbackRate() === getSpeedMin(),
968
+ isMax: () => playbackRate() === getSpeedMax()
969
+ })
970
+ ]
971
+ });
972
+ });
973
+ }
974
+ function getSpeedMin() {
975
+ const { playbackRates } = useDefaultLayoutContext(), rates = playbackRates();
976
+ return isArray(rates) ? rates[0] ?? 0 : rates.min;
977
+ }
978
+ function getSpeedMax() {
979
+ const { playbackRates } = useDefaultLayoutContext(), rates = playbackRates();
980
+ return isArray(rates) ? rates[rates.length - 1] ?? 2 : rates.max;
981
+ }
982
+ function getSpeedStep() {
983
+ const { playbackRates } = useDefaultLayoutContext(), rates = playbackRates();
984
+ return isArray(rates) ? rates[1] - rates[0] || 0.25 : rates.step;
985
+ }
986
+ function DefaultSpeedSlider() {
987
+ const { translations } = useDefaultLayoutContext(), $label = $i18n(translations, "Speed"), $min = getSpeedMin, $max = getSpeedMax, $step = getSpeedStep;
988
+ return html`
989
+ <media-speed-slider
990
+ class="vds-speed-slider vds-slider"
991
+ aria-label=${$label}
992
+ min=${$signal($min)}
993
+ max=${$signal($max)}
994
+ step=${$signal($step)}
995
+ key-step=${$signal($step)}
996
+ >
997
+ ${DefaultSliderParts()}${DefaultSliderSteps()}
998
+ </media-speed-slider>
999
+ `;
1000
+ }
1001
+
1002
+ function DefaultSettingsMenu({
1003
+ placement,
1004
+ portal,
1005
+ tooltip
1006
+ }) {
1007
+ return $signal(() => {
1008
+ const { viewType } = useMediaState(), {
1009
+ translations,
1010
+ menuPortal,
1011
+ noModal,
1012
+ menuGroup,
1013
+ smallWhen: smWhen
1014
+ } = useDefaultLayoutContext(), $placement = computed(
1015
+ () => noModal() ? unwrap(placement) : !smWhen() ? unwrap(placement) : null
1016
+ ), $offset = computed(
1017
+ () => !smWhen() && menuGroup() === "bottom" && viewType() === "video" ? 26 : 0
1018
+ ), $isOpen = signal(false);
1019
+ updateFontCssVars();
1020
+ function onOpen() {
1021
+ $isOpen.set(true);
1022
+ }
1023
+ function onClose() {
1024
+ $isOpen.set(false);
1025
+ }
1026
+ const items = html`
1027
+ <media-menu-items
1028
+ class="vds-settings-menu-items vds-menu-items"
1029
+ placement=${$signal($placement)}
1030
+ offset=${$signal($offset)}
1031
+ >
1032
+ ${$signal(() => {
1033
+ if (!$isOpen()) {
1034
+ return null;
1035
+ }
1036
+ return [DefaultSpeedMenuSection(), DefaultFontMenu(), DefaultDualCaptionsMenuCheckbox()];
1037
+ })}
1038
+ </media-menu-items>
1039
+ `;
1040
+ return html`
1041
+ <media-menu class="vds-settings-menu vds-menu" @open=${onOpen} @close=${onClose}>
1042
+ <media-tooltip class="vds-tooltip">
1043
+ <media-tooltip-trigger>
1044
+ <media-menu-button
1045
+ class="vds-menu-button vds-button"
1046
+ aria-label=${$i18n(translations, "Settings")}
1047
+ >
1048
+ ${IconSlot("menu-settings", "vds-rotate-icon")}
1049
+ </media-menu-button>
1050
+ </media-tooltip-trigger>
1051
+ <media-tooltip-content
1052
+ class="vds-tooltip-content"
1053
+ placement=${isFunction(tooltip) ? $signal(tooltip) : tooltip}
1054
+ >
1055
+ ${$i18n(translations, "Settings")}
1056
+ </media-tooltip-content>
1057
+ </media-tooltip>
1058
+ ${MenuPortal(menuPortal, items) }
1059
+ </media-menu>
1060
+ `;
1061
+ });
1062
+ }
1063
+
1064
+ function DefaultVolumePopup({
1065
+ orientation,
1066
+ tooltip
1067
+ }) {
1068
+ return $signal(() => {
1069
+ const { pointer, muted, canSetVolume } = useMediaState();
1070
+ if (pointer() === "coarse" && !muted()) return null;
1071
+ if (!canSetVolume()) {
1072
+ return DefaultMuteButton({ tooltip });
1073
+ }
1074
+ const $rootRef = signal(void 0), $isRootActive = useActive($rootRef);
1075
+ return html`
1076
+ <div class="vds-volume" ?data-active=${$signal($isRootActive)} ${ref($rootRef.set)}>
1077
+ ${DefaultMuteButton({ tooltip })}
1078
+ <div class="vds-volume-popup">${DefaultVolumeSlider({ orientation })}</div>
1079
+ </div>
1080
+ `;
1081
+ });
1082
+ }
1083
+ function DefaultVolumeSlider({ orientation } = {}) {
1084
+ const { translations } = useDefaultLayoutContext(), $label = $i18n(translations, "Volume");
1085
+ return html`
1086
+ <media-volume-slider
1087
+ class="vds-volume-slider vds-slider"
1088
+ aria-label=${$label}
1089
+ orientation=${ifDefined(orientation)}
1090
+ >
1091
+ <div class="vds-slider-track"></div>
1092
+ <div class="vds-slider-track-fill vds-slider-track"></div>
1093
+ <media-slider-preview class="vds-slider-preview" no-clamp>
1094
+ <media-slider-value class="vds-slider-value"></media-slider-value>
1095
+ </media-slider-preview>
1096
+ <div class="vds-slider-thumb"></div>
1097
+ </media-volume-slider>
1098
+ `;
1099
+ }
1100
+ function DefaultTimeSlider() {
1101
+ const $ref = signal(void 0), $width = signal(0), {
1102
+ thumbnails,
1103
+ translations,
1104
+ sliderChaptersMinWidth,
1105
+ disableTimeSlider,
1106
+ seekStep,
1107
+ noScrubGesture
1108
+ } = useDefaultLayoutContext(), $label = $i18n(translations, "Seek"), $isDisabled = $signal(disableTimeSlider), $isChaptersDisabled = $signal(() => $width() < sliderChaptersMinWidth()), $thumbnails = $signal(thumbnails);
1109
+ useResizeObserver($ref, () => {
1110
+ const el = $ref();
1111
+ el && $width.set(el.clientWidth);
1112
+ });
1113
+ return html`
1114
+ <media-time-slider
1115
+ class="vds-time-slider vds-slider"
1116
+ aria-label=${$label}
1117
+ key-step=${$signal(seekStep)}
1118
+ ?disabled=${$isDisabled}
1119
+ ?no-swipe-gesture=${$signal(noScrubGesture)}
1120
+ ${ref($ref.set)}
1121
+ >
1122
+ <media-slider-chapters class="vds-slider-chapters" ?disabled=${$isChaptersDisabled}>
1123
+ <template>
1124
+ <div class="vds-slider-chapter">
1125
+ <div class="vds-slider-track"></div>
1126
+ <div class="vds-slider-track-fill vds-slider-track"></div>
1127
+ <div class="vds-slider-progress vds-slider-track"></div>
1128
+ </div>
1129
+ </template>
1130
+ </media-slider-chapters>
1131
+ <div class="vds-slider-thumb"></div>
1132
+ <media-slider-preview class="vds-slider-preview">
1133
+ <media-slider-thumbnail
1134
+ class="vds-slider-thumbnail vds-thumbnail"
1135
+ .src=${$thumbnails}
1136
+ ></media-slider-thumbnail>
1137
+ <div class="vds-slider-chapter-title" data-part="chapter-title"></div>
1138
+ <media-slider-value class="vds-slider-value"></media-slider-value>
1139
+ </media-slider-preview>
1140
+ </media-time-slider>
1141
+ `;
1142
+ }
1143
+
1144
+ function DefaultTimeGroup() {
1145
+ return html`
1146
+ <div class="vds-time-group">
1147
+ ${$signal(() => {
1148
+ const { duration } = useMediaState();
1149
+ if (!duration()) return null;
1150
+ return [
1151
+ html`<media-time class="vds-time" type="current"></media-time>`,
1152
+ html`<div class="vds-time-divider">/</div>`,
1153
+ html`<media-time class="vds-time" type="duration"></media-time>`
1154
+ ];
1155
+ })}
1156
+ </div>
1157
+ `;
1158
+ }
1159
+ function DefaultTimeInvert() {
1160
+ return $signal(() => {
1161
+ const { live, duration } = useMediaState();
1162
+ return live() ? DefaultLiveButton() : duration() ? html`<media-time class="vds-time" type="current" toggle remainder></media-time>` : null;
1163
+ });
1164
+ }
1165
+ function DefaultTimeInfo() {
1166
+ return $signal(() => {
1167
+ const { live } = useMediaState();
1168
+ return live() ? DefaultLiveButton() : DefaultTimeGroup();
1169
+ });
1170
+ }
1171
+
1172
+ function DefaultTitle() {
1173
+ return $signal(() => {
1174
+ const { textTracks } = useMediaContext(), { title, started } = useMediaState(), $hasChapters = signal(null);
1175
+ watchActiveTextTrack(textTracks, "chapters", $hasChapters.set);
1176
+ return $hasChapters() && (started() || !title()) ? DefaultChapterTitle() : html`<media-title class="vds-chapter-title"></media-title>`;
1177
+ });
1178
+ }
1179
+ function DefaultChapterTitle() {
1180
+ return html`<media-chapter-title class="vds-chapter-title"></media-chapter-title>`;
1181
+ }
1182
+
1183
+ class DefaultLayoutIconsLoader extends LayoutIconsLoader {
1184
+ async loadIcons() {
1185
+ const paths = (await import('./vidstack-CFNlaVTR.js')).icons, icons = {};
1186
+ for (const iconName of Object.keys(paths)) {
1187
+ icons[iconName] = Icon({ name: iconName, paths: paths[iconName] });
1188
+ }
1189
+ return icons;
1190
+ }
1191
+ }
1192
+
1193
+ export { $i18n, DefaultAirPlayButton, DefaultAnnouncer, DefaultCaptionButton, DefaultCaptions, DefaultChapterTitle, DefaultChaptersMenu, DefaultControlsSpacer, DefaultDownloadButton, DefaultFullscreenButton, DefaultLayout, DefaultLayoutIconsLoader, DefaultPIPButton, DefaultPlayButton, DefaultSeekButton, DefaultSettingsMenu, DefaultTimeInfo, DefaultTimeInvert, DefaultTimeSlider, DefaultTitle, DefaultVolumePopup, IconSlot, MenuPortal, createMenuContainer, i18n, setLayoutName, useDefaultLayoutContext };