@m3ui-vue/m3ui-vue 1.2.2 → 1.3.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.
Files changed (235) hide show
  1. package/dist/API.md +2776 -351
  2. package/dist/MButton-CuNzpoxm.js +172 -0
  3. package/dist/MButton-CuNzpoxm.js.map +1 -0
  4. package/dist/MDialog-HxEL-m58.js +173 -0
  5. package/dist/MDialog-HxEL-m58.js.map +1 -0
  6. package/dist/MIconButton-DoNotQ9v.js +282 -0
  7. package/dist/MIconButton-DoNotQ9v.js.map +1 -0
  8. package/dist/MListItem-DnPtv-hY.js +824 -0
  9. package/dist/MListItem-DnPtv-hY.js.map +1 -0
  10. package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
  11. package/dist/MLoadingIndicator-BQMNX6Dx.js.map +1 -0
  12. package/dist/MMenuItem-Bih0h4-n.js +604 -0
  13. package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
  14. package/dist/MProgressBar-BCoruxA-.js +184 -0
  15. package/dist/MProgressBar-BCoruxA-.js.map +1 -0
  16. package/dist/MSeekBar-LURE1Ah7.js +435 -0
  17. package/dist/MSeekBar-LURE1Ah7.js.map +1 -0
  18. package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
  19. package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
  20. package/dist/MSlider-_J4IS2_z.js +691 -0
  21. package/dist/MSlider-_J4IS2_z.js.map +1 -0
  22. package/dist/MSpinner-BhkMYKOM.js +65 -0
  23. package/dist/MSpinner-BhkMYKOM.js.map +1 -0
  24. package/dist/MTextField-CkzwNBWS.js +296 -0
  25. package/dist/MTextField-CkzwNBWS.js.map +1 -0
  26. package/dist/MTooltip-B67ZDSGp.js +756 -0
  27. package/dist/MTooltip-B67ZDSGp.js.map +1 -0
  28. package/dist/_storageKeys-CYXsUBwK.js +18 -0
  29. package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
  30. package/dist/_useEscapeStack-CjndQhqg.js +19 -0
  31. package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
  32. package/dist/api.json +1 -1
  33. package/dist/chart.js +1 -1
  34. package/dist/code-editor.js +1 -1
  35. package/dist/components/MAudioPlayer.vue.d.ts +115 -0
  36. package/dist/components/MBadge.vue.d.ts +1 -1
  37. package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
  38. package/dist/components/MBox.vue.d.ts +1 -1
  39. package/dist/components/MButton.vue.d.ts +1 -1
  40. package/dist/components/MConfirmDialog.vue.d.ts +1 -1
  41. package/dist/components/MCopyButton.vue.d.ts +2 -2
  42. package/dist/components/MDataTable.vue.d.ts +2 -2
  43. package/dist/components/MDialog.vue.d.ts +2 -2
  44. package/dist/components/MDivider.vue.d.ts +1 -1
  45. package/dist/components/MDragHandle.vue.d.ts +1 -1
  46. package/dist/components/MDrawCanvas.vue.d.ts +148 -0
  47. package/dist/components/MDrawLayers.vue.d.ts +3 -0
  48. package/dist/components/MDrawToolbar.vue.d.ts +34 -0
  49. package/dist/components/MExportButton.vue.d.ts +1 -1
  50. package/dist/components/MFab.vue.d.ts +2 -2
  51. package/dist/components/MFabMenu.vue.d.ts +2 -2
  52. package/dist/components/MFixed.vue.d.ts +1 -1
  53. package/dist/components/MFlex.vue.d.ts +2 -2
  54. package/dist/components/MFloorPlan.vue.d.ts +160 -0
  55. package/dist/components/MFlow.vue.d.ts +305 -0
  56. package/dist/components/MFlowControls.vue.d.ts +33 -0
  57. package/dist/components/MFlowHandle.vue.d.ts +16 -0
  58. package/dist/components/MFlowMinimap.vue.d.ts +22 -0
  59. package/dist/components/MFlowNode.vue.d.ts +35 -0
  60. package/dist/components/MGantt.vue.d.ts +141 -0
  61. package/dist/components/MGanttControls.vue.d.ts +32 -0
  62. package/dist/components/MIconButton.vue.d.ts +3 -1
  63. package/dist/components/MImageCropper.vue.d.ts +110 -0
  64. package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
  65. package/dist/components/MLightbox.vue.d.ts +2 -2
  66. package/dist/components/MList.vue.d.ts +1 -1
  67. package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
  68. package/dist/components/MMapControl.vue.d.ts +1 -1
  69. package/dist/components/MMapSearch.vue.d.ts +1 -1
  70. package/dist/components/MMaskField.vue.d.ts +12 -1
  71. package/dist/components/MMenu.vue.d.ts +1 -1
  72. package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
  73. package/dist/components/MNumberField.vue.d.ts +11 -2
  74. package/dist/components/MPdfViewer.vue.d.ts +174 -0
  75. package/dist/components/MPullToRefresh.vue.d.ts +1 -1
  76. package/dist/components/MResourceTimeline.vue.d.ts +149 -0
  77. package/dist/components/MScheduler.vue.d.ts +3 -3
  78. package/dist/components/MScheme.vue.d.ts +1 -1
  79. package/dist/components/MSearchField.vue.d.ts +1 -1
  80. package/dist/components/MSeekBar.vue.d.ts +1 -1
  81. package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
  82. package/dist/components/MSkeleton.vue.d.ts +1 -1
  83. package/dist/components/MSlider.vue.d.ts +2 -2
  84. package/dist/components/MSparkline.vue.d.ts +1 -1
  85. package/dist/components/MSplitter.vue.d.ts +1 -1
  86. package/dist/components/MStack.vue.d.ts +2 -2
  87. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  88. package/dist/components/MSwitch.vue.d.ts +1 -1
  89. package/dist/components/MTable.vue.d.ts +1 -1
  90. package/dist/components/MTagInput.vue.d.ts +12 -1
  91. package/dist/components/MTextField.vue.d.ts +13 -2
  92. package/dist/components/MToolbar.vue.d.ts +1 -1
  93. package/dist/components/MTree.vue.d.ts +2 -2
  94. package/dist/components/MVideoPlayer.vue.d.ts +253 -0
  95. package/dist/components/MVirtualTable.vue.d.ts +1 -1
  96. package/dist/components/MWindow.vue.d.ts +3 -3
  97. package/dist/components/_MFlowEdge.vue.d.ts +9 -0
  98. package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
  99. package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
  100. package/dist/components/_MPdfPage.vue.d.ts +76 -0
  101. package/dist/components/_MTimeBackground.vue.d.ts +14 -0
  102. package/dist/components/_MTimeHeader.vue.d.ts +20 -0
  103. package/dist/composables/_flowPanel.d.ts +2 -0
  104. package/dist/composables/_flowSlot.d.ts +5 -0
  105. package/dist/composables/_ganttTime.d.ts +41 -0
  106. package/dist/composables/_useTimeAxis.d.ts +90 -0
  107. package/dist/composables/drawGeometry.d.ts +119 -0
  108. package/dist/composables/flowFormats.d.ts +79 -0
  109. package/dist/composables/flowLayout.d.ts +45 -0
  110. package/dist/composables/flowPaths.d.ts +53 -0
  111. package/dist/composables/ganttFormats.d.ts +52 -0
  112. package/dist/composables/ganttSchedule.d.ts +99 -0
  113. package/dist/composables/useDrawing.d.ts +44 -0
  114. package/dist/composables/useFlow.d.ts +266 -0
  115. package/dist/composables/useGantt.d.ts +87 -0
  116. package/dist/composables/useLocale.d.ts +163 -0
  117. package/dist/composables/useMediaPlayer.d.ts +101 -0
  118. package/dist/composables/usePdf.d.ts +119 -0
  119. package/dist/composables/useResourceTimeline.d.ts +70 -0
  120. package/dist/draw.d.ts +7 -0
  121. package/dist/draw.js +1700 -0
  122. package/dist/draw.js.map +1 -0
  123. package/dist/flow.d.ts +14 -0
  124. package/dist/flow.js +3542 -0
  125. package/dist/flow.js.map +1 -0
  126. package/dist/flowPaths-CUc6X373.js +161 -0
  127. package/dist/flowPaths-CUc6X373.js.map +1 -0
  128. package/dist/gantt.d.ts +12 -0
  129. package/dist/gantt.js +3575 -0
  130. package/dist/gantt.js.map +1 -0
  131. package/dist/index.d.ts +4 -0
  132. package/dist/locales/index.js +1148 -7
  133. package/dist/locales/index.js.map +1 -1
  134. package/dist/m3ui-vue.css +1 -1
  135. package/dist/m3ui.js +7286 -7654
  136. package/dist/m3ui.js.map +1 -1
  137. package/dist/map.js +113 -108
  138. package/dist/map.js.map +1 -1
  139. package/dist/media.d.ts +5 -0
  140. package/dist/media.js +1311 -0
  141. package/dist/media.js.map +1 -0
  142. package/dist/pdf.d.ts +4 -0
  143. package/dist/pdf.js +1871 -0
  144. package/dist/pdf.js.map +1 -0
  145. package/dist/rich-text-editor.js +28 -26
  146. package/dist/rich-text-editor.js.map +1 -1
  147. package/dist/styles.css +1 -1
  148. package/dist/{useLocale-JYxDDeXC.js → useLocale-BpGxplLV.js} +165 -2
  149. package/dist/useLocale-BpGxplLV.js.map +1 -0
  150. package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
  151. package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
  152. package/package.json +29 -5
  153. package/src/__tests__/MAudioPlayer.test.ts +75 -0
  154. package/src/__tests__/MDrawCanvas.test.ts +110 -0
  155. package/src/__tests__/MFloorPlan.test.ts +97 -0
  156. package/src/__tests__/MFlow.test.ts +575 -0
  157. package/src/__tests__/MGantt.test.ts +130 -0
  158. package/src/__tests__/MImageCropper.test.ts +89 -0
  159. package/src/__tests__/MPdfViewer.test.ts +235 -0
  160. package/src/__tests__/MResourceTimeline.test.ts +102 -0
  161. package/src/__tests__/MVideoPlayer.test.ts +201 -0
  162. package/src/__tests__/drawGeometry.test.ts +58 -0
  163. package/src/__tests__/fieldExpose.test.ts +30 -0
  164. package/src/__tests__/flowFormats.test.ts +185 -0
  165. package/src/__tests__/flowLayout.test.ts +113 -0
  166. package/src/__tests__/ganttFormats.test.ts +76 -0
  167. package/src/__tests__/ganttSchedule.test.ts +136 -0
  168. package/src/__tests__/pdfMock.ts +83 -0
  169. package/src/__tests__/useMediaPlayer.test.ts +182 -0
  170. package/src/__tests__/usePdf.test.ts +102 -0
  171. package/src/components/MAudioPlayer.vue +319 -0
  172. package/src/components/MDrawCanvas.vue +813 -0
  173. package/src/components/MDrawLayers.vue +114 -0
  174. package/src/components/MDrawToolbar.vue +171 -0
  175. package/src/components/MFloorPlan.vue +581 -0
  176. package/src/components/MFlow.vue +2049 -0
  177. package/src/components/MFlowControls.vue +110 -0
  178. package/src/components/MFlowHandle.vue +60 -0
  179. package/src/components/MFlowMinimap.vue +134 -0
  180. package/src/components/MFlowNode.vue +98 -0
  181. package/src/components/MGantt.vue +1609 -0
  182. package/src/components/MGanttControls.vue +77 -0
  183. package/src/components/MIconButton.vue +3 -1
  184. package/src/components/MImageCropper.vue +507 -0
  185. package/src/components/MMaskField.vue +13 -0
  186. package/src/components/MNumberField.vue +13 -0
  187. package/src/components/MPdfViewer.vue +1269 -0
  188. package/src/components/MResourceTimeline.vue +1020 -0
  189. package/src/components/MTagInput.vue +13 -0
  190. package/src/components/MTextField.vue +16 -0
  191. package/src/components/MVideoPlayer.vue +839 -0
  192. package/src/components/_MFlowEdge.vue +100 -0
  193. package/src/components/_MFlowEdgeLabel.vue +56 -0
  194. package/src/components/_MFlowNodeShell.vue +111 -0
  195. package/src/components/_MPdfPage.vue +456 -0
  196. package/src/components/_MTimeBackground.vue +16 -0
  197. package/src/components/_MTimeHeader.vue +31 -0
  198. package/src/composables/_flowPanel.ts +13 -0
  199. package/src/composables/_flowSlot.ts +6 -0
  200. package/src/composables/_ganttTime.ts +200 -0
  201. package/src/composables/_useTimeAxis.ts +224 -0
  202. package/src/composables/drawGeometry.ts +405 -0
  203. package/src/composables/flowFormats.ts +916 -0
  204. package/src/composables/flowLayout.ts +297 -0
  205. package/src/composables/flowPaths.ts +239 -0
  206. package/src/composables/ganttFormats.ts +366 -0
  207. package/src/composables/ganttSchedule.ts +403 -0
  208. package/src/composables/useDrawing.ts +53 -0
  209. package/src/composables/useFlow.ts +250 -0
  210. package/src/composables/useGantt.ts +92 -0
  211. package/src/composables/useLocale.ts +328 -0
  212. package/src/composables/useMediaPlayer.ts +406 -0
  213. package/src/composables/usePdf.ts +456 -0
  214. package/src/composables/useResourceTimeline.ts +76 -0
  215. package/src/draw.ts +25 -0
  216. package/src/flow.ts +26 -0
  217. package/src/gantt.ts +12 -0
  218. package/src/index.ts +4 -0
  219. package/src/locales/de.ts +163 -0
  220. package/src/locales/es.ts +163 -0
  221. package/src/locales/fr.ts +163 -0
  222. package/src/locales/ja.ts +163 -0
  223. package/src/locales/ko.ts +163 -0
  224. package/src/locales/pt.ts +163 -0
  225. package/src/locales/zh.ts +163 -0
  226. package/src/media.ts +5 -0
  227. package/src/pdf.ts +15 -0
  228. package/dist/MMenuItem-D4Gx_l3F.js +0 -929
  229. package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
  230. package/dist/MSlider-Dx_S3vJ9.js +0 -1506
  231. package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
  232. package/dist/MTextField-Bz8JIsnl.js +0 -633
  233. package/dist/MTextField-Bz8JIsnl.js.map +0 -1
  234. package/dist/useLocale-JYxDDeXC.js.map +0 -1
  235. package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","names":["$attrs"],"sources":["../src/composables/useMediaPlayer.ts","../src/components/MVideoPlayer.vue","../src/components/MVideoPlayer.vue","../src/components/MAudioPlayer.vue","../src/components/MAudioPlayer.vue"],"sourcesContent":["import { computed, getCurrentScope, onScopeDispose, ref, shallowRef, toValue, watch, type MaybeRefOrGetter, type Ref, type WritableComputedRef } from 'vue'\n\n/** What the lock screen and the system's media notification show (the Media Session API's metadata) */\nexport interface MediaPlayerMetadata {\n title?: string\n artist?: string\n album?: string\n /** Cover images, largest last is fine: `[{ src, sizes: '512x512', type: 'image/png' }]` or plain URLs */\n artwork?: (string | { src: string; sizes?: string; type?: string })[]\n}\n\nexport interface MediaPlayerOptions {\n /**\n * The `<audio>` or `<video>` element to drive (a ref or a getter; it may come and go). Without one the player\n * runs its own clock over `duration`: for anything that isn't a media file (a canvas, a shader, generated audio)\n * that should still play, pause, seek and change speed like one.\n */\n media?: MaybeRefOrGetter<HTMLMediaElement | null | undefined>\n /** The length in seconds, for the clock (without `media`) */\n duration?: MaybeRefOrGetter<number | undefined>\n /** Shown on the lock screen and the system's media notification while this player plays (Media Session API) */\n metadata?: MaybeRefOrGetter<MediaPlayerMetadata | null | undefined>\n /** The previous button (and the lock screen's); without it there is none */\n onPrevious?: () => void\n /** The next button (and the lock screen's); without it there is none */\n onNext?: () => void\n /** Whether there is a previous item right now (the first of a playlist has none). Default: `onPrevious` was given */\n hasPrevious?: MaybeRefOrGetter<boolean>\n /** Whether there is a next item right now. Default: `onNext` was given */\n hasNext?: MaybeRefOrGetter<boolean>\n /** Seconds `skip()` and the lock screen's seek buttons move by default. Default 10 */\n seekStep?: number\n /** The clock starts over at the end instead of stopping (with `media`, set the element's `loop`) */\n loop?: MaybeRefOrGetter<boolean | undefined>\n}\n\nexport interface MediaPlayer {\n /** The media element being driven, or null (clock, or not mounted yet) */\n media: Readonly<Ref<HTMLMediaElement | null>>\n /** Playing or paused; writing it plays or pauses */\n playing: WritableComputedRef<boolean>\n /** Position in seconds; writing it seeks */\n currentTime: WritableComputedRef<number>\n /** Length in seconds: 0 until known, Infinity for a live stream */\n duration: Readonly<Ref<number>>\n /** Loaded time ranges, `[[start, end], …]` (the clock reports all of it) */\n buffered: Readonly<Ref<[number, number][]>>\n /** Playback speed; writing it changes it */\n rate: WritableComputedRef<number>\n /** Volume, 0 to 1; writing it changes it */\n volume: WritableComputedRef<number>\n /** Muted; writing it mutes or unmutes */\n muted: WritableComputedRef<boolean>\n /** Stalled for data (a spinner's moment). Writable for the clock, to simulate buffering: it stops advancing meanwhile */\n waiting: Ref<boolean>\n /** Reached the end; `play()` or `toggle()` start over */\n ended: Readonly<Ref<boolean>>\n /** A live stream (infinite duration): no seeking */\n live: Readonly<Ref<boolean>>\n /** The media element's error, if loading or decoding failed */\n error: Readonly<Ref<MediaError | null>>\n /** The browser refused to start playing (autoplay with sound before any user gesture) */\n blocked: Readonly<Ref<boolean>>\n /** Whether there is a previous / next item (see the options of the same names) */\n hasPrevious: Readonly<Ref<boolean>>\n hasNext: Readonly<Ref<boolean>>\n play: () => Promise<void>\n pause: () => void\n toggle: () => Promise<void>\n /** Seeks to a time in seconds (clamped to the media) */\n seek: (time: number) => void\n /** Seeks by an offset in seconds, `seekStep` by default (negative goes back) */\n skip: (seconds?: number) => void\n /** Pauses and goes back to the start */\n stop: () => void\n previous: () => void\n next: () => void\n /**\n * Drives this element instead of the `media` option (null: the clock; undefined: back to `media`). What\n * `MVideoPlayer`/`MAudioPlayer` call with their own element when given a `player`: rate, volume and mute carry over\n */\n attach: (el: HTMLMediaElement | null | undefined) => void\n}\n\nconst hasWindow = typeof window !== 'undefined'\nconst now = () => (typeof performance !== 'undefined' ? performance.now() : Date.now())\n\n// The player that last started playing owns the Media Session (there is one per page)\nlet sessionOwner: object | null = null\n\n/**\n * The state and controls of something that plays: an `<audio>`/`<video>` element, or a clock of its own for\n * anything else. Everything is reactive, the writable parts (`playing`, `currentTime`, `rate`, `volume`, `muted`)\n * act on the media when written, and the player takes the Media Session while it plays (lock screen and\n * notification controls, with `metadata`). `MVideoPlayer` and `MAudioPlayer` are built on it; pass one to their\n * `player` prop to keep playing across pages, or build a player UI of your own on it.\n *\n * ```ts\n * const audio = ref<HTMLAudioElement>()\n * const player = useMediaPlayer({ media: audio, metadata: () => ({ title: track.value.title }) })\n * // <audio ref=\"audio\" :src=\"track.src\" /> … <button @click=\"player.toggle()\">\n *\n * // A shader \"video\" 90 seconds long: its time is player.currentTime\n * const clock = useMediaPlayer({ duration: 90 })\n * ```\n */\nexport function useMediaPlayer(options: MediaPlayerOptions = {}): MediaPlayer {\n const owner = {}\n const step = options.seekStep ?? 10\n const media = shallowRef<HTMLMediaElement | null>(null)\n const attached = shallowRef<HTMLMediaElement | null | undefined>(undefined)\n\n const playingState = ref(false)\n const time = ref(0)\n const durationState = ref(0)\n const buffered = ref<[number, number][]>([])\n const rateState = ref(1)\n const volumeState = ref(1)\n const mutedState = ref(false)\n const waiting = ref(false)\n const ended = ref(false)\n const error = shallowRef<MediaError | null>(null)\n const blocked = ref(false)\n const live = computed(() => durationState.value === Infinity)\n\n // ── Clock (no media element) ──────────────────────────────────────────────────────────────────────────\n let raf = 0\n let lastFrame = 0\n const clockDuration = () => {\n const d = toValue(options.duration)\n return d !== undefined && Number.isFinite(d) && d > 0 ? d : 0\n }\n\n function tick(t: number) {\n raf = 0\n if (media.value || !playingState.value) {\n lastFrame = 0\n return\n }\n const dt = lastFrame ? Math.min(0.25, (t - lastFrame) / 1000) : 0\n lastFrame = t\n if (!waiting.value) {\n const d = durationState.value\n let next = time.value + dt * rateState.value\n if (d && next >= d) {\n if (toValue(options.loop)) next %= d\n else {\n next = d\n playingState.value = false\n ended.value = true\n }\n }\n time.value = next\n }\n if (playingState.value) raf = requestAnimationFrame(tick)\n else lastFrame = 0\n }\n function runClock() {\n if (raf || !hasWindow || media.value || !playingState.value) return\n lastFrame = 0\n raf = requestAnimationFrame(tick)\n }\n watch(() => (media.value ? null : clockDuration()), (d) => {\n if (d === null) return\n durationState.value = d\n buffered.value = d ? [[0, d]] : []\n if (d && time.value > d) time.value = d\n }, { immediate: true })\n\n // ── Media element ─────────────────────────────────────────────────────────────────────────────────────\n function readRanges(el: HTMLMediaElement) {\n const out: [number, number][] = []\n const r = el.buffered\n for (let i = 0; i < (r?.length ?? 0); i++) out.push([r.start(i), r.end(i)])\n buffered.value = out\n }\n function readAll(el: HTMLMediaElement) {\n playingState.value = !el.paused && !el.ended\n time.value = el.currentTime || 0\n durationState.value = Number.isNaN(el.duration) ? 0 : el.duration\n rateState.value = el.playbackRate || 1\n volumeState.value = el.volume\n mutedState.value = el.muted\n ended.value = el.ended\n error.value = el.error\n readRanges(el)\n }\n\n const handlers: Record<string, (el: HTMLMediaElement) => void> = {\n play: () => { playingState.value = true; ended.value = false; blocked.value = false; claimSession() },\n playing: () => { playingState.value = true; waiting.value = false },\n pause: () => { playingState.value = false },\n waiting: () => { waiting.value = true },\n canplay: () => { waiting.value = false },\n seeked: (el) => { time.value = el.currentTime; waiting.value = false; syncPosition() },\n timeupdate: (el) => { time.value = el.currentTime },\n durationchange: (el) => { durationState.value = Number.isNaN(el.duration) ? 0 : el.duration; syncPosition() },\n loadedmetadata: (el) => readAll(el),\n progress: (el) => readRanges(el),\n ratechange: (el) => { rateState.value = el.playbackRate; syncPosition() },\n volumechange: (el) => { volumeState.value = el.volume; mutedState.value = el.muted },\n ended: () => { ended.value = true; playingState.value = false },\n error: (el) => { error.value = el.error; waiting.value = false; playingState.value = false },\n emptied: (el) => { readAll(el); waiting.value = false },\n }\n const listeners = new Map<string, EventListener>()\n\n watch(() => (attached.value !== undefined ? attached.value : toValue(options.media)) ?? null, (el, old) => {\n if (old) for (const [type, fn] of listeners) old.removeEventListener(type, fn)\n listeners.clear()\n media.value = el\n if (!el) {\n ended.value = false\n waiting.value = false\n return\n }\n cancelAnimationFrame(raf)\n raf = 0\n // A volume, rate or mute set before the element came keeps applying to it\n el.playbackRate = rateState.value\n el.volume = volumeState.value\n if (mutedState.value) el.muted = true\n // So does a position set before it (a start time): a fresh element starts there\n if (time.value > 0 && !el.currentTime) el.currentTime = time.value\n for (const [type, fn] of Object.entries(handlers)) {\n const l = () => fn(el)\n listeners.set(type, l)\n el.addEventListener(type, l)\n }\n readAll(el)\n }, { immediate: true })\n\n // ── Actions ───────────────────────────────────────────────────────────────────────────────────────────\n async function play() {\n const el = media.value\n if (ended.value) seek(0)\n ended.value = false\n if (!el) {\n playingState.value = true\n claimSession()\n runClock()\n return\n }\n try {\n await el.play()\n } catch (e) {\n // Autoplay with sound before a user gesture; a newer load() or pause() interrupting play() is no failure\n if ((e as DOMException)?.name === 'NotAllowedError') blocked.value = true\n playingState.value = !el.paused\n }\n }\n function pause() {\n if (media.value) media.value.pause()\n else playingState.value = false\n }\n const toggle = () => (playingState.value ? (pause(), Promise.resolve()) : play())\n\n function seek(t: number) {\n if (live.value) return\n const d = durationState.value\n const target = Math.max(0, d ? Math.min(d, t) : t)\n if (target < d) ended.value = false\n time.value = target\n const el = media.value\n if (el) {\n // fastSeek is cheaper but lands on a keyframe: only worth it mid-scrub, so seek precisely\n el.currentTime = target\n }\n syncPosition()\n }\n const skip = (s: number = step) => seek(time.value + s)\n function stop() {\n pause()\n seek(0)\n }\n\n watch(playingState, (on) => {\n if (on) runClock()\n if (sessionOwner === owner && hasWindow && 'mediaSession' in navigator) {\n navigator.mediaSession.playbackState = on ? 'playing' : 'paused'\n }\n })\n\n // ── Media Session ─────────────────────────────────────────────────────────────────────────────────────\n const session = () => (hasWindow && 'mediaSession' in navigator ? navigator.mediaSession : null)\n\n function setMetadata() {\n const s = session()\n const m = toValue(options.metadata)\n if (!s || sessionOwner !== owner || typeof MediaMetadata === 'undefined') return\n s.metadata = m\n ? new MediaMetadata({\n title: m.title ?? '',\n artist: m.artist ?? '',\n album: m.album ?? '',\n artwork: (m.artwork ?? []).map((a) => (typeof a === 'string' ? { src: a } : a)),\n })\n : null\n }\n\n function syncPosition() {\n const s = session()\n const d = durationState.value\n if (!s || sessionOwner !== owner || !s.setPositionState) return\n try {\n if (d && Number.isFinite(d)) s.setPositionState({ duration: d, playbackRate: rateState.value, position: Math.min(d, time.value) })\n else s.setPositionState()\n } catch { /* a rate the browser rejects, say */ }\n }\n\n function setAction(s: MediaSession, action: MediaSessionAction, fn: MediaSessionActionHandler | null) {\n try { s.setActionHandler(action, fn) } catch { /* an action this browser doesn't know */ }\n }\n\n function claimSession() {\n const s = session()\n if (!s || options.metadata === undefined) return\n sessionOwner = owner\n setMetadata()\n setAction(s, 'play', () => { play() })\n setAction(s, 'pause', () => pause())\n setAction(s, 'stop', () => stop())\n setAction(s, 'seekbackward', (d) => skip(-(d.seekOffset ?? step)))\n setAction(s, 'seekforward', (d) => skip(d.seekOffset ?? step))\n setAction(s, 'seekto', (d) => { if (d.seekTime !== undefined) seek(d.seekTime) })\n setAction(s, 'previoustrack', options.onPrevious ? () => options.onPrevious!() : null)\n setAction(s, 'nexttrack', options.onNext ? () => options.onNext!() : null)\n s.playbackState = playingState.value ? 'playing' : 'paused'\n syncPosition()\n }\n if (options.metadata !== undefined) watch(() => toValue(options.metadata), setMetadata, { deep: true })\n\n function releaseSession() {\n const s = session()\n if (!s || sessionOwner !== owner) return\n sessionOwner = null\n s.metadata = null\n s.playbackState = 'none'\n for (const a of ['play', 'pause', 'stop', 'seekbackward', 'seekforward', 'seekto', 'previoustrack', 'nexttrack'] as MediaSessionAction[]) setAction(s, a, null)\n }\n\n if (getCurrentScope()) {\n onScopeDispose(() => {\n cancelAnimationFrame(raf)\n const el = media.value\n if (el) for (const [type, fn] of listeners) el.removeEventListener(type, fn)\n releaseSession()\n })\n }\n\n // ── Writable state ────────────────────────────────────────────────────────────────────────────────────\n const playing = computed({\n get: () => playingState.value,\n set: (v) => { if (v !== playingState.value) v ? play() : pause() },\n })\n const currentTime = computed({ get: () => time.value, set: (t) => seek(t) })\n const rate = computed({\n get: () => rateState.value,\n set: (r) => {\n rateState.value = r\n if (media.value) media.value.playbackRate = r\n syncPosition()\n },\n })\n const volume = computed({\n get: () => volumeState.value,\n set: (v) => {\n volumeState.value = Math.min(1, Math.max(0, v))\n if (media.value) media.value.volume = volumeState.value\n },\n })\n const muted = computed({\n get: () => mutedState.value,\n set: (m) => {\n mutedState.value = m\n if (media.value) media.value.muted = m\n },\n })\n\n return {\n media,\n playing,\n currentTime,\n duration: durationState,\n buffered,\n rate,\n volume,\n muted,\n waiting,\n ended,\n live,\n error,\n blocked,\n hasPrevious: computed(() => !!options.onPrevious && (toValue(options.hasPrevious) ?? true)),\n hasNext: computed(() => !!options.onNext && (toValue(options.hasNext) ?? true)),\n play,\n pause,\n toggle,\n seek,\n skip,\n stop,\n previous: () => options.onPrevious?.(),\n next: () => options.onNext?.(),\n attach: (el) => { attached.value = el },\n }\n}\n","<script lang=\"ts\">\nimport type { MediaPlayer } from '../composables/useMediaPlayer'\n\nexport interface VideoSource {\n src: string\n /** MIME type, e.g. `video/webm` or `application/vnd.apple.mpegurl` (HLS) */\n type?: string\n}\n\nexport interface VideoTrack {\n /** WebVTT file */\n src: string\n /** Language code, e.g. `es` */\n srclang: string\n /** Shown in the subtitles menu */\n label: string\n /** Shown from the start */\n default?: boolean\n /** Default `subtitles` */\n kind?: 'subtitles' | 'captions'\n}\n\n/** The bits of hls.js the player uses, so the library doesn't depend on it */\nexport interface HlsLike {\n loadSource(src: string): void\n attachMedia(el: HTMLMediaElement): void\n destroy(): void\n on(event: string, fn: (...args: any[]) => void): void\n levels: { height?: number; bitrate?: number }[]\n currentLevel: number\n}\nexport interface HlsModule {\n default: { new (config?: Record<string, unknown>): HlsLike; isSupported(): boolean; Events: Record<string, string> }\n}\n\n/** What the control slots receive */\nexport interface VideoPlayerSlotProps {\n player: MediaPlayer\n /** The controls are showing (slots usually fade with them) */\n shown: boolean\n fullscreen: boolean\n /** The player is narrower than 480px (a phone in portrait) */\n compact: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\n/**\n * A video player (not an M3 spec component: a port of Media3's Compose Material3 `Player`, androidx/media\n * `ui_compose_material3`): controls in three slots like Media3's, top (empty, the title in full screen), center\n * (previous, back, a large play/pause, forward, next, centered on the picture) and bottom (an `MSeekBar`, the time\n * and chapter, volume, subtitles, settings, picture in picture and full screen). Unlike Media3's they keep a dark\n * scrim and white content in both themes, as they sit on the picture; the play button is primary-container, a\n * circle while paused that squares off while playing. Controls hide while playing after `hideDelay`.\n * A click plays/pauses and a double click goes full screen; on touch a tap shows or hides the controls, a double\n * tap on either side skips (taps add up), and a long press plays at 2× while held. Keys (with the player\n * focused): Space/K, J/L, arrows, F, M, C, 0–9, Home/End, `<`/`>`.\n *\n * Plays `src`/`sources` in a `<video>`, or anything else through `#media` over a clock of `duration` seconds.\n * HLS (`.m3u8`) plays natively where the browser can; elsewhere pass `:hls=\"() => import(\"hls.js\")\"`.\n *\n * @slot media Replaces the `<video>` (a canvas, a shader, a 3D scene). Props: `{ time, playing, rate, duration }`\n * @slot top Top controls. Props: `VideoPlayerSlotProps`\n * @slot center Replaces the center controls. Props: `VideoPlayerSlotProps`\n * @slot bottom Replaces the bottom controls. Props: `VideoPlayerSlotProps`\n * @slot settings Extra `MMenuItem`s at the end of the settings menu. Props: `{ player }`\n * @slot end Shown over the video when it ends (an \"up next\", say). Props: `{ player, replay }`\n * @slot error Replaces the error message. Props: `{ error }`\n * @event previous The previous button (or the lock screen's) was pressed\n * @event next The next button (or the lock screen's) was pressed\n * @event ended The video reached its end\n * @event error The video failed to load or play, with the media element's error\n * @event fullscreen Full screen was entered (true) or left (false)\n */\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, useSlots, watch } from 'vue'\nimport { useMediaPlayer } from '../composables/useMediaPlayer'\nimport { useLocale } from '../composables/useLocale'\nimport MSeekBar, { type SeekBarChapter } from './MSeekBar.vue'\nimport MIconButton from './MIconButton.vue'\nimport MIcon from './MIcon.vue'\nimport MSlider from './MSlider.vue'\nimport MMenu from './MMenu.vue'\nimport MMenuItem from './MMenuItem.vue'\nimport MLoadingIndicator from './MLoadingIndicator.vue'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<{\n /** Video URL */\n src?: string\n /** Several formats of the video; the browser plays the first it can */\n sources?: VideoSource[]\n /** Image shown before playing */\n poster?: string\n /** Subtitle tracks (WebVTT) */\n tracks?: VideoTrack[]\n /** Chapters, drawn on the seek bar */\n chapters?: SeekBarChapter[]\n /** Shown at the top in full screen, and on the lock screen while playing */\n title?: string\n /** Length in seconds, for `#media` content (with a `<video>` it comes from the file) */\n duration?: number\n /** Drive this player instead of one of its own (from `useMediaPlayer()`, kept outside to survive page changes). Read once */\n player?: MediaPlayer\n /** Playing (v-model) */\n playing?: boolean\n /** Position in seconds (v-model) */\n currentTime?: number\n /** Playback speed (v-model) */\n rate?: number\n /** Volume, 0 to 1 (v-model) */\n volume?: number\n /** Muted (v-model) */\n muted?: boolean\n /** Starts playing when mounted; muted if the browser blocks sound before a user gesture */\n autoplay?: boolean\n /** Starts over at the end */\n loop?: boolean\n /** Shows the controls. Off: just the video and its gestures */\n controls?: boolean\n /** Adds previous and next buttons (emits `previous`); with only one of the two, the other shows disabled */\n hasPrevious?: boolean\n /** Adds previous and next buttons (emits `next`); with only one of the two, the other shows disabled */\n hasNext?: boolean\n /** Seconds the skip buttons, J/L and double taps move */\n seekStep?: number\n /** Speeds offered in the settings menu */\n speeds?: number[]\n /** Box ratio, as CSS `aspect-ratio`; `auto` follows the video */\n aspectRatio?: string\n /** How the video fills the box */\n fit?: 'contain' | 'cover'\n /** Milliseconds without activity before the controls hide while playing */\n hideDelay?: number\n /** Played part of the seek bar: an M3 role or any CSS color */\n color?: string\n /**\n * The video's CORS mode. Subtitles from another origin need `anonymous` (and a video host that allows it, as\n * the `<track>` is fetched in the video's mode)\n */\n crossorigin?: 'anonymous' | 'use-credentials'\n /** Loads hls.js for `.m3u8` where the browser can't play HLS: `() => import(\"hls.js\")` */\n hls?: () => Promise<HlsModule>\n}>(), {\n playing: undefined,\n currentTime: undefined,\n rate: undefined,\n volume: undefined,\n muted: undefined,\n autoplay: false,\n loop: false,\n controls: true,\n hasPrevious: false,\n hasNext: false,\n seekStep: 10,\n speeds: () => [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],\n aspectRatio: '16/9',\n fit: 'contain',\n hideDelay: 3000,\n color: 'primary',\n})\n\nconst emit = defineEmits<{\n 'update:playing': [boolean]\n 'update:currentTime': [number]\n 'update:rate': [number]\n 'update:volume': [number]\n 'update:muted': [boolean]\n previous: []\n next: []\n ended: []\n error: [MediaError | null]\n fullscreen: [boolean]\n}>()\n\nconst slots = useSlots()\nconst locale = useLocale()\nconst root = ref<HTMLElement>()\nconst videoEl = ref<HTMLVideoElement>()\nconst custom = !!slots.media\n\nconst player: MediaPlayer = props.player ?? useMediaPlayer({\n media: () => (custom ? null : videoEl.value),\n duration: () => props.duration,\n loop: () => props.loop,\n metadata: () => (props.title ? { title: props.title, artwork: props.poster ? [props.poster] : [] } : null),\n seekStep: props.seekStep,\n onPrevious: () => emit('previous'),\n onNext: () => emit('next'),\n hasPrevious: () => props.hasPrevious,\n hasNext: () => props.hasNext,\n})\nconst external = !!props.player\nconst hasPrevious = computed(() => (external ? player.hasPrevious.value : props.hasPrevious))\nconst hasNext = computed(() => (external ? player.hasNext.value : props.hasNext))\nfunction previous() {\n if (external) player.previous()\n else emit('previous')\n}\nfunction next() {\n if (external) player.next()\n else emit('next')\n}\n\n// ── v-model ─────────────────────────────────────────────────────────────────────────────────────────────\nwatch(() => props.playing, (v) => { if (v !== undefined) player.playing.value = v })\nwatch(() => props.currentTime, (v) => { if (v !== undefined && Math.abs(v - player.currentTime.value) > 0.5) player.seek(v) }, { immediate: true })\nwatch(() => props.rate, (v) => { if (v !== undefined) player.rate.value = v }, { immediate: true })\nwatch(() => props.volume, (v) => { if (v !== undefined) player.volume.value = v }, { immediate: true })\nwatch(() => props.muted, (v) => { if (v !== undefined) player.muted.value = v }, { immediate: true })\nwatch(player.playing, (v) => emit('update:playing', v))\nwatch(player.currentTime, (v) => emit('update:currentTime', v))\nwatch(player.rate, (v) => emit('update:rate', v))\nwatch(player.volume, (v) => emit('update:volume', v))\nwatch(player.muted, (v) => emit('update:muted', v))\nwatch(player.ended, (v) => { if (v) emit('ended') })\nwatch(player.error, (e) => { if (e) emit('error', e) })\n\n// ── Size ────────────────────────────────────────────────────────────────────────────────────────────────\nconst width = ref(640)\nconst compact = computed(() => width.value < 480)\nlet ro: ResizeObserver | undefined\n\n// ── Controls visibility ─────────────────────────────────────────────────────────────────────────────────\nconst shown = ref(true)\nconst overControls = ref(false)\nconst menu = ref<InstanceType<typeof MMenu>>()\nconst menuOpen = computed(() => !!(menu.value as { open?: boolean } | undefined)?.open)\nlet hideTimer: ReturnType<typeof setTimeout> | undefined\nfunction poke() {\n shown.value = true\n clearTimeout(hideTimer)\n hideTimer = setTimeout(() => {\n if (player.playing.value && !menuOpen.value && !overControls.value) shown.value = false\n }, props.hideDelay)\n}\nwatch(player.playing, (on) => (on ? poke() : (shown.value = true)))\nwatch(menuOpen, (open) => { if (!open) poke() })\nconst visible = computed(() => props.controls && (shown.value || !player.playing.value || player.ended.value))\n\n// ── Flash: a big icon for what you can't see happen (a click on the picture, a double tap, a key) ───────\nconst flash = ref<{ icon: string; text?: string; side?: 'left' | 'right'; n: number } | null>(null)\nlet flashTimer: ReturnType<typeof setTimeout> | undefined\nfunction show(icon: string, text?: string, side?: 'left' | 'right') {\n flash.value = { icon, text, side, n: (flash.value?.n ?? 0) + 1 }\n clearTimeout(flashTimer)\n flashTimer = setTimeout(() => (flash.value = null), 650)\n}\nconst seconds = (n: number) => locale.mediaSeconds.replace('{seconds}', String(n))\n\nfunction toggle(flashIt = false) {\n const wasPlaying = player.playing.value\n player.toggle()\n if (flashIt) show(wasPlaying ? 'pause' : 'play_arrow')\n}\n// Double taps add up while they keep coming: \"30 seconds\"\nlet skipRun = { side: '' as '' | 'left' | 'right', total: 0, at: 0 }\nfunction skip(s: number, flashIt = false) {\n player.skip(s)\n if (!flashIt) return\n const side = s > 0 ? 'right' : 'left'\n const t = performance.now()\n skipRun = skipRun.side === side && t - skipRun.at < 1000 ? { side, total: skipRun.total + Math.abs(s), at: t } : { side, total: Math.abs(s), at: t }\n show(s > 0 ? 'fast_forward' : 'fast_rewind', seconds(skipRun.total), side)\n}\n\n// ── Pointer on the picture ──────────────────────────────────────────────────────────────────────────────\nlet lastTap = -Infinity\nlet tapTimer: ReturnType<typeof setTimeout> | undefined\nlet pressTimer: ReturnType<typeof setTimeout> | undefined\nlet fastFrom: number | null = null\nconst fast = ref(false)\n\nfunction onSurfaceDown(e: PointerEvent) {\n if (e.button !== 0) return\n root.value?.focus({ preventScroll: true })\n // Long press: 2× while held (touch and mouse alike, as YouTube)\n clearTimeout(pressTimer)\n pressTimer = setTimeout(() => {\n if (!player.playing.value) return\n fastFrom = player.rate.value\n player.rate.value = 2\n fast.value = true\n }, 500)\n}\nfunction endFast() {\n clearTimeout(pressTimer)\n if (fastFrom === null) return false\n player.rate.value = fastFrom\n fastFrom = null\n fast.value = false\n return true\n}\nfunction onSurfaceUp(e: PointerEvent) {\n if (e.button !== 0) return\n if (endFast()) return\n if (e.pointerType === 'mouse') {\n toggle(true)\n return\n }\n const r = (e.currentTarget as HTMLElement).getBoundingClientRect()\n const x = (e.clientX - r.left) / (r.width || 1)\n const t = performance.now()\n const sideTap = x < 0.35 || x > 0.65\n // A double tap on a side skips; while skips keep coming, single taps on that side do too\n if (sideTap && (t - lastTap < 300 || (skipRun.side && t - skipRun.at < 1000 && skipRun.side === (x < 0.5 ? 'left' : 'right')))) {\n clearTimeout(tapTimer)\n lastTap = t\n skip(x < 0.5 ? -props.seekStep : props.seekStep, true)\n return\n }\n lastTap = t\n clearTimeout(tapTimer)\n tapTimer = setTimeout(() => (shown.value ? (shown.value = false) : poke()), 260)\n}\n\n// ── Full screen: the player covers the page (fixed) and the document goes full screen, so menus teleported\n// to <body> still show over it. iPhones have no Fullscreen API for elements: their video's own player then ──\nconst fullscreen = ref(false)\nasync function toggleFullscreen() {\n if (fullscreen.value) {\n fullscreen.value = false\n if (document.fullscreenElement) await document.exitFullscreen().catch(() => {})\n return\n }\n const doc = document.documentElement\n if (!doc.requestFullscreen && videoEl.value && 'webkitEnterFullscreen' in videoEl.value) {\n ;(videoEl.value as HTMLVideoElement & { webkitEnterFullscreen(): void }).webkitEnterFullscreen()\n return\n }\n fullscreen.value = true\n await doc.requestFullscreen?.().catch(() => {})\n // Phones turn to landscape where the browser allows it\n ;(screen.orientation as ScreenOrientation & { lock?: (o: string) => Promise<void> } | undefined)?.lock?.('landscape').catch(() => {})\n}\nfunction onFullscreenChange() {\n if (!document.fullscreenElement && fullscreen.value) fullscreen.value = false\n}\nwatch(fullscreen, (v) => emit('fullscreen', v))\n\n// ── Picture in picture ──────────────────────────────────────────────────────────────────────────────────\nconst pipAvailable = ref(false)\nasync function togglePip() {\n const el = videoEl.value\n if (!el) return\n if (document.pictureInPictureElement) await document.exitPictureInPicture().catch(() => {})\n else await el.requestPictureInPicture().catch(() => {})\n}\n\n// ── Volume ──────────────────────────────────────────────────────────────────────────────────────────────\nconst volumeIcon = computed(() => {\n const v = player.volume.value\n return player.muted.value || v === 0 ? 'volume_off' : v < 0.5 ? 'volume_down' : 'volume_up'\n})\nconst volumePercent = computed({\n get: () => (player.muted.value ? 0 : Math.round(player.volume.value * 100)),\n set: (v: number) => {\n player.volume.value = v / 100\n player.muted.value = v === 0\n },\n})\nfunction toggleMute() {\n if (player.muted.value && player.volume.value === 0) player.volume.value = 1\n player.muted.value = !player.muted.value\n}\n\n// ── Subtitles ───────────────────────────────────────────────────────────────────────────────────────────\nconst subtitle = ref<number>(props.tracks?.findIndex((t) => t.default) ?? -1)\nlet lastSubtitle = Math.max(0, subtitle.value)\n// The browser may turn tracks on by itself (one matching the user's language, say): ours wins whenever they change\nfunction applySubtitles() {\n const list = videoEl.value?.textTracks\n if (!list) return\n for (let i = 0; i < list.length; i++) {\n const mode = i === subtitle.value ? 'showing' : 'disabled'\n if (list[i]!.mode !== mode) list[i]!.mode = mode\n }\n}\nwatch(subtitle, (i) => {\n if (i >= 0) lastSubtitle = i\n applySubtitles()\n})\nconst toggleSubtitles = () => (subtitle.value = subtitle.value >= 0 ? -1 : lastSubtitle)\n\n// ── HLS ─────────────────────────────────────────────────────────────────────────────────────────────────\nlet hls: HlsLike | null = null\nconst levels = ref<{ height?: number; bitrate?: number }[]>([])\nconst level = ref(-1)\nwatch(level, (l) => { if (hls) hls.currentLevel = l })\nconst allSources = computed<VideoSource[]>(() => props.sources ?? (props.src ? [{ src: props.src }] : []))\nconst isHls = (s: VideoSource) => /\\.m3u8(\\?|#|$)/i.test(s.src) || /mpegurl/i.test(s.type ?? '')\n// A source the browser plays itself goes in <source>; an HLS one it can't goes to hls.js\nconst hlsSource = ref<string | null>(null)\n\nasync function setupSource() {\n hls?.destroy()\n hls = null\n levels.value = []\n level.value = -1\n hlsSource.value = null\n const el = videoEl.value\n if (!el || custom) return\n const h = allSources.value.find(isHls)\n if (!h || el.canPlayType('application/vnd.apple.mpegurl') || !props.hls) return\n hlsSource.value = h.src\n const { default: Hls } = await props.hls()\n if (!Hls.isSupported() || hlsSource.value !== h.src) return\n hls = new Hls()\n hls.on(Hls.Events.MANIFEST_PARSED ?? 'hlsManifestParsed', () => { levels.value = hls?.levels ?? [] })\n hls.loadSource(h.src)\n hls.attachMedia(el)\n}\nconst nativeSources = computed(() => allSources.value.filter((s) => !hlsSource.value || s.src !== hlsSource.value))\nwatch(allSources, async () => {\n // A new video keeps playing if the last one was (or just ended into it)\n const resume = player.playing.value || player.ended.value\n await setupSource()\n await nextTick()\n if (!hls) videoEl.value?.load()\n if (resume) player.play()\n})\nconst levelLabel = (l: { height?: number; bitrate?: number }) => (l.height ? `${l.height}p` : `${Math.round((l.bitrate ?? 0) / 1000)} kbps`)\nconst qualityLabel = computed(() => (level.value < 0 ? locale.mediaQualityAuto : levelLabel(levels.value[level.value] ?? {})))\n\nconst speedLabel = (s: number) => (s === 1 ? locale.mediaSpeedNormal : `${s}×`)\n\n// ── Keyboard (YouTube's keys) ───────────────────────────────────────────────────────────────────────────\nfunction onKey(e: KeyboardEvent) {\n const t = e.target as HTMLElement\n if (e.ctrlKey || e.metaKey || e.altKey || t.closest('input, textarea, select, [contenteditable]')) return\n const onControl = t !== root.value && !!t.closest('button, a, [role=\"slider\"], [role=\"menuitem\"]')\n const k = e.key.length === 1 ? e.key.toLowerCase() : e.key\n const d = player.duration.value\n const actions: Record<string, () => void> = {\n k: () => toggle(true),\n j: () => skip(-props.seekStep, true),\n l: () => skip(props.seekStep, true),\n f: toggleFullscreen,\n m: toggleMute,\n '<': () => setSpeed(-1),\n '>': () => setSpeed(1),\n }\n if (props.tracks?.length) actions.c = toggleSubtitles\n if (!onControl) {\n actions[' '] = () => toggle(true)\n actions.ArrowLeft = () => skip(-5, true)\n actions.ArrowRight = () => skip(5, true)\n actions.ArrowUp = () => { volumePercent.value = Math.min(100, volumePercent.value + 5) }\n actions.ArrowDown = () => { volumePercent.value = Math.max(0, volumePercent.value - 5) }\n actions.Home = () => player.seek(0)\n actions.End = () => player.seek(d)\n }\n if (/^[0-9]$/.test(k) && Number.isFinite(d)) actions[k] = () => player.seek((d * Number(k)) / 10)\n if (k === 'Escape' && fullscreen.value) actions.Escape = toggleFullscreen\n const run = actions[k]\n if (!run) return\n e.preventDefault()\n e.stopPropagation()\n run()\n poke()\n}\nfunction setSpeed(dir: number) {\n const list = props.speeds\n const i = list.indexOf(player.rate.value)\n const nextRate = list[Math.min(list.length - 1, Math.max(0, (i < 0 ? list.indexOf(1) : i) + dir))]\n if (nextRate === undefined) return\n player.rate.value = nextRate\n show('speed', speedLabel(nextRate))\n}\n\n// ── Lifecycle ───────────────────────────────────────────────────────────────────────────────────────────\nonMounted(async () => {\n ro = new ResizeObserver(([entry]) => { width.value = entry!.contentRect.width })\n ro.observe(root.value!)\n width.value = root.value!.clientWidth || width.value\n document.addEventListener('fullscreenchange', onFullscreenChange)\n pipAvailable.value = !custom && !!document.pictureInPictureEnabled\n if (external && !custom) player.attach(videoEl.value ?? null)\n else if (external) player.attach(null)\n await setupSource()\n applySubtitles()\n videoEl.value?.textTracks?.addEventListener?.('change', applySubtitles)\n videoEl.value?.textTracks?.addEventListener?.('addtrack', applySubtitles)\n poke()\n if (props.autoplay || props.playing) {\n await player.play()\n if (player.blocked.value) {\n player.muted.value = true\n await player.play()\n }\n }\n})\nonBeforeUnmount(() => {\n ro?.disconnect()\n hls?.destroy()\n videoEl.value?.textTracks?.removeEventListener?.('change', applySubtitles)\n videoEl.value?.textTracks?.removeEventListener?.('addtrack', applySubtitles)\n document.removeEventListener('fullscreenchange', onFullscreenChange)\n if (fullscreen.value && document.fullscreenElement) document.exitFullscreen().catch(() => {})\n ;[hideTimer, flashTimer, tapTimer, pressTimer].forEach(clearTimeout)\n if (external) player.attach(undefined)\n})\n\nconst slotProps = computed<VideoPlayerSlotProps>(() => ({ player, shown: visible.value, fullscreen: fullscreen.value, compact: compact.value }))\nconst errorText = computed(() => (player.error.value ? locale.mediaError : ''))\nconst playIcon = computed(() => (player.ended.value ? 'replay' : player.playing.value ? 'pause' : 'play_arrow'))\nconst playLabel = computed(() => (player.ended.value ? locale.mediaReplay : player.playing.value ? locale.mediaPause : locale.mediaPlay))\nconst seekBackLabel = computed(() => locale.mediaSeekBack.replace('{seconds}', String(props.seekStep)))\nconst seekForwardLabel = computed(() => locale.mediaSeekForward.replace('{seconds}', String(props.seekStep)))\nconst skipIcon = (dir: 'back' | 'forward') => ([5, 10, 30].includes(props.seekStep) ? `${dir === 'back' ? 'replay' : 'forward'}_${props.seekStep}` : dir === 'back' ? 'fast_rewind' : 'fast_forward')\n\n// Controls sit on the picture, so they keep a dark scrim and white content in both themes (as Google Photos' and\n// YouTube's do; Media3's gradient to the theme's background washes a light theme's picture out). The play button\n// carries the color: primary-container, a circle while paused that squares off while playing\nconst GLASS = 'rgb(0 0 0 / 0.38)'\nconst sizes = computed(() => (compact.value ? { play: 64, skip: 48, track: 40, gap: 'gap-5' } : { play: 80, skip: 56, track: 48, gap: 'gap-8' }))\nconst playRadius = computed(() => (player.playing.value ? `${Math.round(sizes.value.play * 0.3)}px` : `${sizes.value.play / 2}px`))\nconst showTrackButtons = computed(() => hasPrevious.value || hasNext.value)\n\nconst pad2 = (n: number) => String(n).padStart(2, '0')\nfunction fmt(t: number) {\n const sec = Math.max(0, Math.floor(t || 0))\n const h = Math.floor(sec / 3600)\n const m = Math.floor((sec % 3600) / 60)\n return (h ? `${h}:${pad2(m)}` : String(m)) + ':' + pad2(sec % 60)\n}\nconst timeText = computed(() => `${fmt(player.currentTime.value)} / ${player.duration.value ? fmt(player.duration.value) : '--:--'}`)\nconst chapterTitle = computed(() => {\n let found: SeekBarChapter | null = null\n for (const c of props.chapters ?? []) if (c.start <= player.currentTime.value && (!found || c.start >= found.start)) found = c\n return found?.title\n})\n\n// A video a hair off the box's ratio (854×481 in 16:9) would leave sub-pixel bars of the black shutter on two\n// edges, which also show through the rounded corners' antialiasing: within 2%, fill the box instead\nconst naturalRatio = ref(0)\nfunction onMetadata() {\n const el = videoEl.value\n naturalRatio.value = el && el.videoHeight ? el.videoWidth / el.videoHeight : 0\n}\nconst fitClass = computed(() => {\n if (props.fit === 'cover') return 'object-cover'\n const el = root.value\n const box = el && el.clientHeight ? el.clientWidth / el.clientHeight : 0\n void width.value\n return naturalRatio.value && box && Math.abs(naturalRatio.value / box - 1) < 0.02 ? 'object-cover' : 'object-contain'\n})\n</script>\n\n<template>\n <div\n ref=\"root\"\n v-bind=\"$attrs\"\n role=\"region\"\n :aria-label=\"title || locale.mediaPlayer\"\n tabindex=\"-1\"\n class=\"m3-video-player group/player isolate overflow-hidden bg-black text-white outline-none select-none transform-gpu\"\n :class=\"[fullscreen && 'fixed inset-0 z-400', !visible && player.playing.value && 'cursor-none']\"\n :style=\"fullscreen ? undefined : { aspectRatio: aspectRatio === 'auto' ? undefined : aspectRatio }\"\n @pointermove=\"(e: PointerEvent) => e.pointerType !== 'touch' && poke()\"\n @keydown=\"onKey\"\n @focusin=\"poke\"\n >\n <div class=\"absolute inset-0 flex items-center justify-center\">\n <slot\n v-if=\"custom\"\n name=\"media\"\n :time=\"player.currentTime.value\"\n :playing=\"player.playing.value\"\n :rate=\"player.rate.value\"\n :duration=\"player.duration.value\"\n />\n <video\n v-else\n ref=\"videoEl\"\n class=\"h-full w-full\"\n :class=\"fitClass\"\n :poster=\"poster\"\n :loop=\"loop\"\n playsinline\n preload=\"metadata\"\n :crossorigin=\"crossorigin\"\n @loadedmetadata=\"onMetadata\"\n >\n <source v-for=\"s in nativeSources\" :key=\"s.src\" :src=\"s.src\" :type=\"s.type\" />\n <track\n v-for=\"(t, i) in tracks\"\n :key=\"t.src\"\n :kind=\"t.kind ?? 'subtitles'\"\n :src=\"t.src\"\n :srclang=\"t.srclang\"\n :label=\"t.label\"\n :default=\"i === subtitle\"\n />\n </video>\n </div>\n\n <!-- Scrims behind the top and bottom controls, fading with them -->\n <Transition name=\"m3-video-fade\">\n <div v-if=\"visible\" class=\"pointer-events-none absolute inset-0\" aria-hidden=\"true\">\n <div v-if=\"fullscreen || slots.top\" class=\"absolute inset-x-0 top-0 h-28 bg-linear-to-b from-black/60 to-transparent\" />\n <div class=\"absolute inset-x-0 bottom-0 h-36 bg-linear-to-t from-black/75 via-black/35 to-transparent\" />\n </div>\n </Transition>\n\n <!-- Taps and clicks land here, under the controls -->\n <div class=\"absolute inset-0\" @pointerdown=\"onSurfaceDown\" @pointerup=\"onSurfaceUp\" @pointercancel=\"endFast\" @pointerleave=\"endFast\" @dblclick=\"toggleFullscreen\" @contextmenu.prevent />\n\n <div v-if=\"player.waiting.value && !player.error.value\" class=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <MLoadingIndicator :size=\"compact ? 56 : 72\" contained :label=\"locale.loading\" />\n </div>\n\n <!-- 2× while held -->\n <Transition name=\"m3-video-fade\">\n <div v-if=\"fast\" class=\"pointer-events-none absolute inset-x-0 top-4 flex justify-center\">\n <span class=\"flex items-center gap-1 rounded-full bg-black/45 px-3.5 py-1.5 text-label-large backdrop-blur-md\">\n 2× <MIcon name=\"fast_forward\" :size=\"18\" filled />\n </span>\n </div>\n </Transition>\n\n <Transition name=\"m3-video-flash\">\n <div\n v-if=\"flash\"\n :key=\"flash.n\"\n class=\"pointer-events-none absolute inset-y-0 flex items-center justify-center\"\n :class=\"flash.side === 'left' ? 'left-0 w-2/5' : flash.side === 'right' ? 'right-0 w-2/5' : 'inset-x-0'\"\n aria-hidden=\"true\"\n >\n <div class=\"flex flex-col items-center gap-2\">\n <span class=\"flex size-16 items-center justify-center rounded-full bg-black/45 backdrop-blur-md\"><MIcon :name=\"flash.icon\" :size=\"34\" filled /></span>\n <span v-if=\"flash.text\" class=\"rounded-full bg-black/45 px-3 py-0.5 text-label-large backdrop-blur-md\">{{ flash.text }}</span>\n </div>\n </div>\n </Transition>\n\n <div v-if=\"player.error.value\" class=\"absolute inset-0 flex items-center justify-center bg-black/60 p-4 text-center\">\n <slot name=\"error\" :error=\"player.error.value\">\n <p class=\"flex flex-col items-center gap-2 text-title-medium\">\n <MIcon name=\"error\" :size=\"32\" />\n {{ errorText }}\n </p>\n </slot>\n </div>\n\n <div v-if=\"player.ended.value && slots.end\" class=\"absolute inset-0\">\n <slot name=\"end\" :player=\"player\" :replay=\"() => player.play()\" />\n </div>\n\n <Transition name=\"m3-video-fade\">\n <div v-if=\"visible && !(player.ended.value && slots.end)\" class=\"pointer-events-none absolute inset-0\">\n <!-- Top -->\n <div class=\"pointer-events-auto absolute inset-x-0 top-0\" @pointerenter=\"overControls = true\" @pointerleave=\"overControls = false\">\n <slot name=\"top\" v-bind=\"slotProps\">\n <div v-if=\"fullscreen\" class=\"flex items-center gap-2 px-2 pt-2\">\n <MIconButton icon=\"arrow_back\" :label=\"locale.mediaExitFullscreen\" color=\"#fff\" @click=\"toggleFullscreen\" />\n <p v-if=\"title\" class=\"min-w-0 flex-1 truncate text-title-medium\">{{ title }}</p>\n </div>\n </slot>\n </div>\n\n <!-- Center: on the picture's center, whatever the top and bottom hold -->\n <div v-if=\"!player.waiting.value && !player.error.value\" class=\"absolute inset-0 flex items-center justify-center\" :class=\"sizes.gap\">\n <slot name=\"center\" v-bind=\"slotProps\">\n <MIconButton\n v-if=\"showTrackButtons\"\n icon=\"skip_previous\"\n :label=\"locale.previous\"\n :size=\"sizes.track\"\n :icon-size=\"compact ? 24 : 28\"\n :aria-disabled=\"!hasPrevious || undefined\"\n :tabindex=\"hasPrevious ? undefined : -1\"\n variant=\"filled\"\n :color=\"GLASS\"\n icon-filled\n class=\"backdrop-blur-md\" :class=\"hasPrevious ? 'pointer-events-auto' : 'opacity-40'\"\n @click=\"previous\"\n />\n <MIconButton\n v-if=\"!player.live.value\"\n :icon=\"skipIcon('back')\"\n :label=\"seekBackLabel\"\n :size=\"sizes.skip\"\n :icon-size=\"compact ? 26 : 30\"\n variant=\"filled\"\n :color=\"GLASS\"\n class=\"pointer-events-auto backdrop-blur-md\"\n @click=\"skip(-seekStep)\"\n />\n <MIconButton\n :icon=\"playIcon\"\n :label=\"playLabel\"\n :size=\"sizes.play\"\n :icon-size=\"compact ? 32 : 40\"\n variant=\"filled\"\n color=\"var(--color-primary-container)\"\n content-color=\"on-primary-container\"\n icon-filled\n class=\"m3-video-play pointer-events-auto shadow-elevation-2\"\n :style=\"{ borderRadius: playRadius }\"\n @click=\"toggle()\"\n />\n <MIconButton\n v-if=\"!player.live.value\"\n :icon=\"skipIcon('forward')\"\n :label=\"seekForwardLabel\"\n :size=\"sizes.skip\"\n :icon-size=\"compact ? 26 : 30\"\n variant=\"filled\"\n :color=\"GLASS\"\n class=\"pointer-events-auto backdrop-blur-md\"\n @click=\"skip(seekStep)\"\n />\n <MIconButton\n v-if=\"showTrackButtons\"\n icon=\"skip_next\"\n :label=\"locale.next\"\n :size=\"sizes.track\"\n :icon-size=\"compact ? 24 : 28\"\n :aria-disabled=\"!hasNext || undefined\"\n :tabindex=\"hasNext ? undefined : -1\"\n variant=\"filled\"\n :color=\"GLASS\"\n icon-filled\n class=\"backdrop-blur-md\" :class=\"hasNext ? 'pointer-events-auto' : 'opacity-40'\"\n @click=\"next\"\n />\n </slot>\n </div>\n\n <!-- Bottom -->\n <div class=\"pointer-events-auto absolute inset-x-0 bottom-0\" @pointerenter=\"overControls = true\" @pointerleave=\"overControls = false\">\n <slot name=\"bottom\" v-bind=\"slotProps\">\n <div :class=\"compact ? 'px-2 pb-1' : 'px-4 pb-2'\">\n <MSeekBar\n v-if=\"!player.live.value\"\n v-model=\"player.currentTime.value\"\n :duration=\"player.duration.value\"\n :buffered=\"player.buffered.value\"\n :chapters=\"chapters\"\n :playing=\"player.playing.value && !player.waiting.value\"\n :playback-rate=\"player.rate.value\"\n :color=\"color\"\n track-color=\"rgb(255 255 255 / 0.28)\"\n variant=\"line\"\n :size=\"compact ? 'xs' : 'sm'\"\n time=\"none\"\n class=\"px-1\"\n />\n <div class=\"flex items-center gap-1\">\n <span v-if=\"player.live.value\" class=\"ml-2 flex items-center gap-1.5 rounded-full bg-error px-2.5 py-0.5 text-label-medium text-on-error\">\n <span class=\"size-1.5 rounded-full bg-on-error\" />{{ locale.mediaLive }}\n </span>\n <p v-else class=\"ml-1 min-w-0 truncate text-label-large tabular-nums\">\n {{ timeText }}<span v-if=\"chapterTitle && !compact\" class=\"text-white/75\"> · {{ chapterTitle }}</span>\n </p>\n <span class=\"flex-1\" />\n <div class=\"group/vol flex items-center\">\n <div v-if=\"!compact\" class=\"w-0 overflow-hidden transition-[width] duration-300 ease-[cubic-bezier(.2,0,0,1)] group-focus-within/vol:w-24 group-hover/vol:w-24\">\n <MSlider v-model=\"volumePercent\" :min=\"0\" :max=\"100\" size=\"xs\" class=\"w-22 px-1\" />\n </div>\n <MIconButton :icon=\"volumeIcon\" :label=\"player.muted.value ? locale.mediaUnmute : locale.mediaMute\" color=\"#fff\" :size=\"compact ? 'xs' : 'sm'\" @click=\"toggleMute\" />\n </div>\n <MIconButton\n v-if=\"tracks?.length\"\n :icon=\"subtitle >= 0 ? 'subtitles' : 'subtitles_off'\"\n :label=\"locale.mediaSubtitles\"\n color=\"#fff\"\n :size=\"compact ? 'xs' : 'sm'\"\n :icon-filled=\"subtitle >= 0\"\n @click=\"toggleSubtitles\"\n />\n <MMenu ref=\"menu\" submenu-mode=\"push\" align=\"right\">\n <template #trigger>\n <MIconButton icon=\"settings\" :label=\"locale.mediaSettings\" color=\"#fff\" :size=\"compact ? 'xs' : 'sm'\" />\n </template>\n <MMenuItem icon=\"slow_motion_video\">\n {{ locale.mediaSpeed }} · {{ speedLabel(player.rate.value) }}\n <template #children>\n <MMenuItem v-for=\"s in speeds\" :key=\"s\" :selected=\"player.rate.value === s\" @click=\"player.rate.value = s\">{{ speedLabel(s) }}</MMenuItem>\n </template>\n </MMenuItem>\n <MMenuItem v-if=\"tracks?.length\" icon=\"subtitles\">\n {{ locale.mediaSubtitles }} · {{ subtitle >= 0 ? tracks[subtitle]?.label : locale.mediaSubtitlesOff }}\n <template #children>\n <MMenuItem :selected=\"subtitle < 0\" @click=\"subtitle = -1\">{{ locale.mediaSubtitlesOff }}</MMenuItem>\n <MMenuItem v-for=\"(t, i) in tracks\" :key=\"t.src\" :selected=\"subtitle === i\" @click=\"subtitle = i\">{{ t.label }}</MMenuItem>\n </template>\n </MMenuItem>\n <MMenuItem v-if=\"levels.length > 1\" icon=\"tune\">\n {{ locale.mediaQuality }} · {{ qualityLabel }}\n <template #children>\n <MMenuItem :selected=\"level < 0\" @click=\"level = -1\">{{ locale.mediaQualityAuto }}</MMenuItem>\n <MMenuItem v-for=\"(l, i) in levels\" :key=\"i\" :selected=\"level === i\" @click=\"level = i\">{{ levelLabel(l) }}</MMenuItem>\n </template>\n </MMenuItem>\n <slot name=\"settings\" :player=\"player\" />\n </MMenu>\n <MIconButton\n v-if=\"pipAvailable && !compact\"\n icon=\"picture_in_picture_alt\"\n :label=\"locale.mediaPictureInPicture\"\n color=\"#fff\"\n size=\"sm\"\n @click=\"togglePip\"\n />\n <MIconButton\n :icon=\"fullscreen ? 'fullscreen_exit' : 'fullscreen'\"\n :label=\"fullscreen ? locale.mediaExitFullscreen : locale.mediaFullscreen\"\n color=\"#fff\"\n :size=\"compact ? 'xs' : 'sm'\"\n @click=\"toggleFullscreen\"\n />\n </div>\n </div>\n </slot>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<style>\n/* Root default in the base layer, so a consumer's position class (absolute…) wins */\n@layer base {\n .m3-video-player { position: relative; }\n}\n.m3-video-player video::cue {\n background: color-mix(in srgb, var(--color-scrim) 75%, transparent);\n color: #fff;\n}\n.m3-video-play { transition: border-radius 350ms cubic-bezier(0.2, 0, 0, 1); }\n.m3-video-fade-enter-active,\n.m3-video-fade-leave-active { transition: opacity 250ms cubic-bezier(0.2, 0, 0, 1); }\n.m3-video-fade-enter-from,\n.m3-video-fade-leave-to { opacity: 0; }\n.m3-video-flash-leave-active { transition: opacity 400ms ease, transform 400ms ease; }\n.m3-video-flash-leave-to { opacity: 0; transform: scale(1.3); }\n</style>\n","<script lang=\"ts\">\nimport type { MediaPlayer } from '../composables/useMediaPlayer'\n\nexport interface VideoSource {\n src: string\n /** MIME type, e.g. `video/webm` or `application/vnd.apple.mpegurl` (HLS) */\n type?: string\n}\n\nexport interface VideoTrack {\n /** WebVTT file */\n src: string\n /** Language code, e.g. `es` */\n srclang: string\n /** Shown in the subtitles menu */\n label: string\n /** Shown from the start */\n default?: boolean\n /** Default `subtitles` */\n kind?: 'subtitles' | 'captions'\n}\n\n/** The bits of hls.js the player uses, so the library doesn't depend on it */\nexport interface HlsLike {\n loadSource(src: string): void\n attachMedia(el: HTMLMediaElement): void\n destroy(): void\n on(event: string, fn: (...args: any[]) => void): void\n levels: { height?: number; bitrate?: number }[]\n currentLevel: number\n}\nexport interface HlsModule {\n default: { new (config?: Record<string, unknown>): HlsLike; isSupported(): boolean; Events: Record<string, string> }\n}\n\n/** What the control slots receive */\nexport interface VideoPlayerSlotProps {\n player: MediaPlayer\n /** The controls are showing (slots usually fade with them) */\n shown: boolean\n fullscreen: boolean\n /** The player is narrower than 480px (a phone in portrait) */\n compact: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\n/**\n * A video player (not an M3 spec component: a port of Media3's Compose Material3 `Player`, androidx/media\n * `ui_compose_material3`): controls in three slots like Media3's, top (empty, the title in full screen), center\n * (previous, back, a large play/pause, forward, next, centered on the picture) and bottom (an `MSeekBar`, the time\n * and chapter, volume, subtitles, settings, picture in picture and full screen). Unlike Media3's they keep a dark\n * scrim and white content in both themes, as they sit on the picture; the play button is primary-container, a\n * circle while paused that squares off while playing. Controls hide while playing after `hideDelay`.\n * A click plays/pauses and a double click goes full screen; on touch a tap shows or hides the controls, a double\n * tap on either side skips (taps add up), and a long press plays at 2× while held. Keys (with the player\n * focused): Space/K, J/L, arrows, F, M, C, 0–9, Home/End, `<`/`>`.\n *\n * Plays `src`/`sources` in a `<video>`, or anything else through `#media` over a clock of `duration` seconds.\n * HLS (`.m3u8`) plays natively where the browser can; elsewhere pass `:hls=\"() => import(\"hls.js\")\"`.\n *\n * @slot media Replaces the `<video>` (a canvas, a shader, a 3D scene). Props: `{ time, playing, rate, duration }`\n * @slot top Top controls. Props: `VideoPlayerSlotProps`\n * @slot center Replaces the center controls. Props: `VideoPlayerSlotProps`\n * @slot bottom Replaces the bottom controls. Props: `VideoPlayerSlotProps`\n * @slot settings Extra `MMenuItem`s at the end of the settings menu. Props: `{ player }`\n * @slot end Shown over the video when it ends (an \"up next\", say). Props: `{ player, replay }`\n * @slot error Replaces the error message. Props: `{ error }`\n * @event previous The previous button (or the lock screen's) was pressed\n * @event next The next button (or the lock screen's) was pressed\n * @event ended The video reached its end\n * @event error The video failed to load or play, with the media element's error\n * @event fullscreen Full screen was entered (true) or left (false)\n */\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, useSlots, watch } from 'vue'\nimport { useMediaPlayer } from '../composables/useMediaPlayer'\nimport { useLocale } from '../composables/useLocale'\nimport MSeekBar, { type SeekBarChapter } from './MSeekBar.vue'\nimport MIconButton from './MIconButton.vue'\nimport MIcon from './MIcon.vue'\nimport MSlider from './MSlider.vue'\nimport MMenu from './MMenu.vue'\nimport MMenuItem from './MMenuItem.vue'\nimport MLoadingIndicator from './MLoadingIndicator.vue'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<{\n /** Video URL */\n src?: string\n /** Several formats of the video; the browser plays the first it can */\n sources?: VideoSource[]\n /** Image shown before playing */\n poster?: string\n /** Subtitle tracks (WebVTT) */\n tracks?: VideoTrack[]\n /** Chapters, drawn on the seek bar */\n chapters?: SeekBarChapter[]\n /** Shown at the top in full screen, and on the lock screen while playing */\n title?: string\n /** Length in seconds, for `#media` content (with a `<video>` it comes from the file) */\n duration?: number\n /** Drive this player instead of one of its own (from `useMediaPlayer()`, kept outside to survive page changes). Read once */\n player?: MediaPlayer\n /** Playing (v-model) */\n playing?: boolean\n /** Position in seconds (v-model) */\n currentTime?: number\n /** Playback speed (v-model) */\n rate?: number\n /** Volume, 0 to 1 (v-model) */\n volume?: number\n /** Muted (v-model) */\n muted?: boolean\n /** Starts playing when mounted; muted if the browser blocks sound before a user gesture */\n autoplay?: boolean\n /** Starts over at the end */\n loop?: boolean\n /** Shows the controls. Off: just the video and its gestures */\n controls?: boolean\n /** Adds previous and next buttons (emits `previous`); with only one of the two, the other shows disabled */\n hasPrevious?: boolean\n /** Adds previous and next buttons (emits `next`); with only one of the two, the other shows disabled */\n hasNext?: boolean\n /** Seconds the skip buttons, J/L and double taps move */\n seekStep?: number\n /** Speeds offered in the settings menu */\n speeds?: number[]\n /** Box ratio, as CSS `aspect-ratio`; `auto` follows the video */\n aspectRatio?: string\n /** How the video fills the box */\n fit?: 'contain' | 'cover'\n /** Milliseconds without activity before the controls hide while playing */\n hideDelay?: number\n /** Played part of the seek bar: an M3 role or any CSS color */\n color?: string\n /**\n * The video's CORS mode. Subtitles from another origin need `anonymous` (and a video host that allows it, as\n * the `<track>` is fetched in the video's mode)\n */\n crossorigin?: 'anonymous' | 'use-credentials'\n /** Loads hls.js for `.m3u8` where the browser can't play HLS: `() => import(\"hls.js\")` */\n hls?: () => Promise<HlsModule>\n}>(), {\n playing: undefined,\n currentTime: undefined,\n rate: undefined,\n volume: undefined,\n muted: undefined,\n autoplay: false,\n loop: false,\n controls: true,\n hasPrevious: false,\n hasNext: false,\n seekStep: 10,\n speeds: () => [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],\n aspectRatio: '16/9',\n fit: 'contain',\n hideDelay: 3000,\n color: 'primary',\n})\n\nconst emit = defineEmits<{\n 'update:playing': [boolean]\n 'update:currentTime': [number]\n 'update:rate': [number]\n 'update:volume': [number]\n 'update:muted': [boolean]\n previous: []\n next: []\n ended: []\n error: [MediaError | null]\n fullscreen: [boolean]\n}>()\n\nconst slots = useSlots()\nconst locale = useLocale()\nconst root = ref<HTMLElement>()\nconst videoEl = ref<HTMLVideoElement>()\nconst custom = !!slots.media\n\nconst player: MediaPlayer = props.player ?? useMediaPlayer({\n media: () => (custom ? null : videoEl.value),\n duration: () => props.duration,\n loop: () => props.loop,\n metadata: () => (props.title ? { title: props.title, artwork: props.poster ? [props.poster] : [] } : null),\n seekStep: props.seekStep,\n onPrevious: () => emit('previous'),\n onNext: () => emit('next'),\n hasPrevious: () => props.hasPrevious,\n hasNext: () => props.hasNext,\n})\nconst external = !!props.player\nconst hasPrevious = computed(() => (external ? player.hasPrevious.value : props.hasPrevious))\nconst hasNext = computed(() => (external ? player.hasNext.value : props.hasNext))\nfunction previous() {\n if (external) player.previous()\n else emit('previous')\n}\nfunction next() {\n if (external) player.next()\n else emit('next')\n}\n\n// ── v-model ─────────────────────────────────────────────────────────────────────────────────────────────\nwatch(() => props.playing, (v) => { if (v !== undefined) player.playing.value = v })\nwatch(() => props.currentTime, (v) => { if (v !== undefined && Math.abs(v - player.currentTime.value) > 0.5) player.seek(v) }, { immediate: true })\nwatch(() => props.rate, (v) => { if (v !== undefined) player.rate.value = v }, { immediate: true })\nwatch(() => props.volume, (v) => { if (v !== undefined) player.volume.value = v }, { immediate: true })\nwatch(() => props.muted, (v) => { if (v !== undefined) player.muted.value = v }, { immediate: true })\nwatch(player.playing, (v) => emit('update:playing', v))\nwatch(player.currentTime, (v) => emit('update:currentTime', v))\nwatch(player.rate, (v) => emit('update:rate', v))\nwatch(player.volume, (v) => emit('update:volume', v))\nwatch(player.muted, (v) => emit('update:muted', v))\nwatch(player.ended, (v) => { if (v) emit('ended') })\nwatch(player.error, (e) => { if (e) emit('error', e) })\n\n// ── Size ────────────────────────────────────────────────────────────────────────────────────────────────\nconst width = ref(640)\nconst compact = computed(() => width.value < 480)\nlet ro: ResizeObserver | undefined\n\n// ── Controls visibility ─────────────────────────────────────────────────────────────────────────────────\nconst shown = ref(true)\nconst overControls = ref(false)\nconst menu = ref<InstanceType<typeof MMenu>>()\nconst menuOpen = computed(() => !!(menu.value as { open?: boolean } | undefined)?.open)\nlet hideTimer: ReturnType<typeof setTimeout> | undefined\nfunction poke() {\n shown.value = true\n clearTimeout(hideTimer)\n hideTimer = setTimeout(() => {\n if (player.playing.value && !menuOpen.value && !overControls.value) shown.value = false\n }, props.hideDelay)\n}\nwatch(player.playing, (on) => (on ? poke() : (shown.value = true)))\nwatch(menuOpen, (open) => { if (!open) poke() })\nconst visible = computed(() => props.controls && (shown.value || !player.playing.value || player.ended.value))\n\n// ── Flash: a big icon for what you can't see happen (a click on the picture, a double tap, a key) ───────\nconst flash = ref<{ icon: string; text?: string; side?: 'left' | 'right'; n: number } | null>(null)\nlet flashTimer: ReturnType<typeof setTimeout> | undefined\nfunction show(icon: string, text?: string, side?: 'left' | 'right') {\n flash.value = { icon, text, side, n: (flash.value?.n ?? 0) + 1 }\n clearTimeout(flashTimer)\n flashTimer = setTimeout(() => (flash.value = null), 650)\n}\nconst seconds = (n: number) => locale.mediaSeconds.replace('{seconds}', String(n))\n\nfunction toggle(flashIt = false) {\n const wasPlaying = player.playing.value\n player.toggle()\n if (flashIt) show(wasPlaying ? 'pause' : 'play_arrow')\n}\n// Double taps add up while they keep coming: \"30 seconds\"\nlet skipRun = { side: '' as '' | 'left' | 'right', total: 0, at: 0 }\nfunction skip(s: number, flashIt = false) {\n player.skip(s)\n if (!flashIt) return\n const side = s > 0 ? 'right' : 'left'\n const t = performance.now()\n skipRun = skipRun.side === side && t - skipRun.at < 1000 ? { side, total: skipRun.total + Math.abs(s), at: t } : { side, total: Math.abs(s), at: t }\n show(s > 0 ? 'fast_forward' : 'fast_rewind', seconds(skipRun.total), side)\n}\n\n// ── Pointer on the picture ──────────────────────────────────────────────────────────────────────────────\nlet lastTap = -Infinity\nlet tapTimer: ReturnType<typeof setTimeout> | undefined\nlet pressTimer: ReturnType<typeof setTimeout> | undefined\nlet fastFrom: number | null = null\nconst fast = ref(false)\n\nfunction onSurfaceDown(e: PointerEvent) {\n if (e.button !== 0) return\n root.value?.focus({ preventScroll: true })\n // Long press: 2× while held (touch and mouse alike, as YouTube)\n clearTimeout(pressTimer)\n pressTimer = setTimeout(() => {\n if (!player.playing.value) return\n fastFrom = player.rate.value\n player.rate.value = 2\n fast.value = true\n }, 500)\n}\nfunction endFast() {\n clearTimeout(pressTimer)\n if (fastFrom === null) return false\n player.rate.value = fastFrom\n fastFrom = null\n fast.value = false\n return true\n}\nfunction onSurfaceUp(e: PointerEvent) {\n if (e.button !== 0) return\n if (endFast()) return\n if (e.pointerType === 'mouse') {\n toggle(true)\n return\n }\n const r = (e.currentTarget as HTMLElement).getBoundingClientRect()\n const x = (e.clientX - r.left) / (r.width || 1)\n const t = performance.now()\n const sideTap = x < 0.35 || x > 0.65\n // A double tap on a side skips; while skips keep coming, single taps on that side do too\n if (sideTap && (t - lastTap < 300 || (skipRun.side && t - skipRun.at < 1000 && skipRun.side === (x < 0.5 ? 'left' : 'right')))) {\n clearTimeout(tapTimer)\n lastTap = t\n skip(x < 0.5 ? -props.seekStep : props.seekStep, true)\n return\n }\n lastTap = t\n clearTimeout(tapTimer)\n tapTimer = setTimeout(() => (shown.value ? (shown.value = false) : poke()), 260)\n}\n\n// ── Full screen: the player covers the page (fixed) and the document goes full screen, so menus teleported\n// to <body> still show over it. iPhones have no Fullscreen API for elements: their video's own player then ──\nconst fullscreen = ref(false)\nasync function toggleFullscreen() {\n if (fullscreen.value) {\n fullscreen.value = false\n if (document.fullscreenElement) await document.exitFullscreen().catch(() => {})\n return\n }\n const doc = document.documentElement\n if (!doc.requestFullscreen && videoEl.value && 'webkitEnterFullscreen' in videoEl.value) {\n ;(videoEl.value as HTMLVideoElement & { webkitEnterFullscreen(): void }).webkitEnterFullscreen()\n return\n }\n fullscreen.value = true\n await doc.requestFullscreen?.().catch(() => {})\n // Phones turn to landscape where the browser allows it\n ;(screen.orientation as ScreenOrientation & { lock?: (o: string) => Promise<void> } | undefined)?.lock?.('landscape').catch(() => {})\n}\nfunction onFullscreenChange() {\n if (!document.fullscreenElement && fullscreen.value) fullscreen.value = false\n}\nwatch(fullscreen, (v) => emit('fullscreen', v))\n\n// ── Picture in picture ──────────────────────────────────────────────────────────────────────────────────\nconst pipAvailable = ref(false)\nasync function togglePip() {\n const el = videoEl.value\n if (!el) return\n if (document.pictureInPictureElement) await document.exitPictureInPicture().catch(() => {})\n else await el.requestPictureInPicture().catch(() => {})\n}\n\n// ── Volume ──────────────────────────────────────────────────────────────────────────────────────────────\nconst volumeIcon = computed(() => {\n const v = player.volume.value\n return player.muted.value || v === 0 ? 'volume_off' : v < 0.5 ? 'volume_down' : 'volume_up'\n})\nconst volumePercent = computed({\n get: () => (player.muted.value ? 0 : Math.round(player.volume.value * 100)),\n set: (v: number) => {\n player.volume.value = v / 100\n player.muted.value = v === 0\n },\n})\nfunction toggleMute() {\n if (player.muted.value && player.volume.value === 0) player.volume.value = 1\n player.muted.value = !player.muted.value\n}\n\n// ── Subtitles ───────────────────────────────────────────────────────────────────────────────────────────\nconst subtitle = ref<number>(props.tracks?.findIndex((t) => t.default) ?? -1)\nlet lastSubtitle = Math.max(0, subtitle.value)\n// The browser may turn tracks on by itself (one matching the user's language, say): ours wins whenever they change\nfunction applySubtitles() {\n const list = videoEl.value?.textTracks\n if (!list) return\n for (let i = 0; i < list.length; i++) {\n const mode = i === subtitle.value ? 'showing' : 'disabled'\n if (list[i]!.mode !== mode) list[i]!.mode = mode\n }\n}\nwatch(subtitle, (i) => {\n if (i >= 0) lastSubtitle = i\n applySubtitles()\n})\nconst toggleSubtitles = () => (subtitle.value = subtitle.value >= 0 ? -1 : lastSubtitle)\n\n// ── HLS ─────────────────────────────────────────────────────────────────────────────────────────────────\nlet hls: HlsLike | null = null\nconst levels = ref<{ height?: number; bitrate?: number }[]>([])\nconst level = ref(-1)\nwatch(level, (l) => { if (hls) hls.currentLevel = l })\nconst allSources = computed<VideoSource[]>(() => props.sources ?? (props.src ? [{ src: props.src }] : []))\nconst isHls = (s: VideoSource) => /\\.m3u8(\\?|#|$)/i.test(s.src) || /mpegurl/i.test(s.type ?? '')\n// A source the browser plays itself goes in <source>; an HLS one it can't goes to hls.js\nconst hlsSource = ref<string | null>(null)\n\nasync function setupSource() {\n hls?.destroy()\n hls = null\n levels.value = []\n level.value = -1\n hlsSource.value = null\n const el = videoEl.value\n if (!el || custom) return\n const h = allSources.value.find(isHls)\n if (!h || el.canPlayType('application/vnd.apple.mpegurl') || !props.hls) return\n hlsSource.value = h.src\n const { default: Hls } = await props.hls()\n if (!Hls.isSupported() || hlsSource.value !== h.src) return\n hls = new Hls()\n hls.on(Hls.Events.MANIFEST_PARSED ?? 'hlsManifestParsed', () => { levels.value = hls?.levels ?? [] })\n hls.loadSource(h.src)\n hls.attachMedia(el)\n}\nconst nativeSources = computed(() => allSources.value.filter((s) => !hlsSource.value || s.src !== hlsSource.value))\nwatch(allSources, async () => {\n // A new video keeps playing if the last one was (or just ended into it)\n const resume = player.playing.value || player.ended.value\n await setupSource()\n await nextTick()\n if (!hls) videoEl.value?.load()\n if (resume) player.play()\n})\nconst levelLabel = (l: { height?: number; bitrate?: number }) => (l.height ? `${l.height}p` : `${Math.round((l.bitrate ?? 0) / 1000)} kbps`)\nconst qualityLabel = computed(() => (level.value < 0 ? locale.mediaQualityAuto : levelLabel(levels.value[level.value] ?? {})))\n\nconst speedLabel = (s: number) => (s === 1 ? locale.mediaSpeedNormal : `${s}×`)\n\n// ── Keyboard (YouTube's keys) ───────────────────────────────────────────────────────────────────────────\nfunction onKey(e: KeyboardEvent) {\n const t = e.target as HTMLElement\n if (e.ctrlKey || e.metaKey || e.altKey || t.closest('input, textarea, select, [contenteditable]')) return\n const onControl = t !== root.value && !!t.closest('button, a, [role=\"slider\"], [role=\"menuitem\"]')\n const k = e.key.length === 1 ? e.key.toLowerCase() : e.key\n const d = player.duration.value\n const actions: Record<string, () => void> = {\n k: () => toggle(true),\n j: () => skip(-props.seekStep, true),\n l: () => skip(props.seekStep, true),\n f: toggleFullscreen,\n m: toggleMute,\n '<': () => setSpeed(-1),\n '>': () => setSpeed(1),\n }\n if (props.tracks?.length) actions.c = toggleSubtitles\n if (!onControl) {\n actions[' '] = () => toggle(true)\n actions.ArrowLeft = () => skip(-5, true)\n actions.ArrowRight = () => skip(5, true)\n actions.ArrowUp = () => { volumePercent.value = Math.min(100, volumePercent.value + 5) }\n actions.ArrowDown = () => { volumePercent.value = Math.max(0, volumePercent.value - 5) }\n actions.Home = () => player.seek(0)\n actions.End = () => player.seek(d)\n }\n if (/^[0-9]$/.test(k) && Number.isFinite(d)) actions[k] = () => player.seek((d * Number(k)) / 10)\n if (k === 'Escape' && fullscreen.value) actions.Escape = toggleFullscreen\n const run = actions[k]\n if (!run) return\n e.preventDefault()\n e.stopPropagation()\n run()\n poke()\n}\nfunction setSpeed(dir: number) {\n const list = props.speeds\n const i = list.indexOf(player.rate.value)\n const nextRate = list[Math.min(list.length - 1, Math.max(0, (i < 0 ? list.indexOf(1) : i) + dir))]\n if (nextRate === undefined) return\n player.rate.value = nextRate\n show('speed', speedLabel(nextRate))\n}\n\n// ── Lifecycle ───────────────────────────────────────────────────────────────────────────────────────────\nonMounted(async () => {\n ro = new ResizeObserver(([entry]) => { width.value = entry!.contentRect.width })\n ro.observe(root.value!)\n width.value = root.value!.clientWidth || width.value\n document.addEventListener('fullscreenchange', onFullscreenChange)\n pipAvailable.value = !custom && !!document.pictureInPictureEnabled\n if (external && !custom) player.attach(videoEl.value ?? null)\n else if (external) player.attach(null)\n await setupSource()\n applySubtitles()\n videoEl.value?.textTracks?.addEventListener?.('change', applySubtitles)\n videoEl.value?.textTracks?.addEventListener?.('addtrack', applySubtitles)\n poke()\n if (props.autoplay || props.playing) {\n await player.play()\n if (player.blocked.value) {\n player.muted.value = true\n await player.play()\n }\n }\n})\nonBeforeUnmount(() => {\n ro?.disconnect()\n hls?.destroy()\n videoEl.value?.textTracks?.removeEventListener?.('change', applySubtitles)\n videoEl.value?.textTracks?.removeEventListener?.('addtrack', applySubtitles)\n document.removeEventListener('fullscreenchange', onFullscreenChange)\n if (fullscreen.value && document.fullscreenElement) document.exitFullscreen().catch(() => {})\n ;[hideTimer, flashTimer, tapTimer, pressTimer].forEach(clearTimeout)\n if (external) player.attach(undefined)\n})\n\nconst slotProps = computed<VideoPlayerSlotProps>(() => ({ player, shown: visible.value, fullscreen: fullscreen.value, compact: compact.value }))\nconst errorText = computed(() => (player.error.value ? locale.mediaError : ''))\nconst playIcon = computed(() => (player.ended.value ? 'replay' : player.playing.value ? 'pause' : 'play_arrow'))\nconst playLabel = computed(() => (player.ended.value ? locale.mediaReplay : player.playing.value ? locale.mediaPause : locale.mediaPlay))\nconst seekBackLabel = computed(() => locale.mediaSeekBack.replace('{seconds}', String(props.seekStep)))\nconst seekForwardLabel = computed(() => locale.mediaSeekForward.replace('{seconds}', String(props.seekStep)))\nconst skipIcon = (dir: 'back' | 'forward') => ([5, 10, 30].includes(props.seekStep) ? `${dir === 'back' ? 'replay' : 'forward'}_${props.seekStep}` : dir === 'back' ? 'fast_rewind' : 'fast_forward')\n\n// Controls sit on the picture, so they keep a dark scrim and white content in both themes (as Google Photos' and\n// YouTube's do; Media3's gradient to the theme's background washes a light theme's picture out). The play button\n// carries the color: primary-container, a circle while paused that squares off while playing\nconst GLASS = 'rgb(0 0 0 / 0.38)'\nconst sizes = computed(() => (compact.value ? { play: 64, skip: 48, track: 40, gap: 'gap-5' } : { play: 80, skip: 56, track: 48, gap: 'gap-8' }))\nconst playRadius = computed(() => (player.playing.value ? `${Math.round(sizes.value.play * 0.3)}px` : `${sizes.value.play / 2}px`))\nconst showTrackButtons = computed(() => hasPrevious.value || hasNext.value)\n\nconst pad2 = (n: number) => String(n).padStart(2, '0')\nfunction fmt(t: number) {\n const sec = Math.max(0, Math.floor(t || 0))\n const h = Math.floor(sec / 3600)\n const m = Math.floor((sec % 3600) / 60)\n return (h ? `${h}:${pad2(m)}` : String(m)) + ':' + pad2(sec % 60)\n}\nconst timeText = computed(() => `${fmt(player.currentTime.value)} / ${player.duration.value ? fmt(player.duration.value) : '--:--'}`)\nconst chapterTitle = computed(() => {\n let found: SeekBarChapter | null = null\n for (const c of props.chapters ?? []) if (c.start <= player.currentTime.value && (!found || c.start >= found.start)) found = c\n return found?.title\n})\n\n// A video a hair off the box's ratio (854×481 in 16:9) would leave sub-pixel bars of the black shutter on two\n// edges, which also show through the rounded corners' antialiasing: within 2%, fill the box instead\nconst naturalRatio = ref(0)\nfunction onMetadata() {\n const el = videoEl.value\n naturalRatio.value = el && el.videoHeight ? el.videoWidth / el.videoHeight : 0\n}\nconst fitClass = computed(() => {\n if (props.fit === 'cover') return 'object-cover'\n const el = root.value\n const box = el && el.clientHeight ? el.clientWidth / el.clientHeight : 0\n void width.value\n return naturalRatio.value && box && Math.abs(naturalRatio.value / box - 1) < 0.02 ? 'object-cover' : 'object-contain'\n})\n</script>\n\n<template>\n <div\n ref=\"root\"\n v-bind=\"$attrs\"\n role=\"region\"\n :aria-label=\"title || locale.mediaPlayer\"\n tabindex=\"-1\"\n class=\"m3-video-player group/player isolate overflow-hidden bg-black text-white outline-none select-none transform-gpu\"\n :class=\"[fullscreen && 'fixed inset-0 z-400', !visible && player.playing.value && 'cursor-none']\"\n :style=\"fullscreen ? undefined : { aspectRatio: aspectRatio === 'auto' ? undefined : aspectRatio }\"\n @pointermove=\"(e: PointerEvent) => e.pointerType !== 'touch' && poke()\"\n @keydown=\"onKey\"\n @focusin=\"poke\"\n >\n <div class=\"absolute inset-0 flex items-center justify-center\">\n <slot\n v-if=\"custom\"\n name=\"media\"\n :time=\"player.currentTime.value\"\n :playing=\"player.playing.value\"\n :rate=\"player.rate.value\"\n :duration=\"player.duration.value\"\n />\n <video\n v-else\n ref=\"videoEl\"\n class=\"h-full w-full\"\n :class=\"fitClass\"\n :poster=\"poster\"\n :loop=\"loop\"\n playsinline\n preload=\"metadata\"\n :crossorigin=\"crossorigin\"\n @loadedmetadata=\"onMetadata\"\n >\n <source v-for=\"s in nativeSources\" :key=\"s.src\" :src=\"s.src\" :type=\"s.type\" />\n <track\n v-for=\"(t, i) in tracks\"\n :key=\"t.src\"\n :kind=\"t.kind ?? 'subtitles'\"\n :src=\"t.src\"\n :srclang=\"t.srclang\"\n :label=\"t.label\"\n :default=\"i === subtitle\"\n />\n </video>\n </div>\n\n <!-- Scrims behind the top and bottom controls, fading with them -->\n <Transition name=\"m3-video-fade\">\n <div v-if=\"visible\" class=\"pointer-events-none absolute inset-0\" aria-hidden=\"true\">\n <div v-if=\"fullscreen || slots.top\" class=\"absolute inset-x-0 top-0 h-28 bg-linear-to-b from-black/60 to-transparent\" />\n <div class=\"absolute inset-x-0 bottom-0 h-36 bg-linear-to-t from-black/75 via-black/35 to-transparent\" />\n </div>\n </Transition>\n\n <!-- Taps and clicks land here, under the controls -->\n <div class=\"absolute inset-0\" @pointerdown=\"onSurfaceDown\" @pointerup=\"onSurfaceUp\" @pointercancel=\"endFast\" @pointerleave=\"endFast\" @dblclick=\"toggleFullscreen\" @contextmenu.prevent />\n\n <div v-if=\"player.waiting.value && !player.error.value\" class=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <MLoadingIndicator :size=\"compact ? 56 : 72\" contained :label=\"locale.loading\" />\n </div>\n\n <!-- 2× while held -->\n <Transition name=\"m3-video-fade\">\n <div v-if=\"fast\" class=\"pointer-events-none absolute inset-x-0 top-4 flex justify-center\">\n <span class=\"flex items-center gap-1 rounded-full bg-black/45 px-3.5 py-1.5 text-label-large backdrop-blur-md\">\n 2× <MIcon name=\"fast_forward\" :size=\"18\" filled />\n </span>\n </div>\n </Transition>\n\n <Transition name=\"m3-video-flash\">\n <div\n v-if=\"flash\"\n :key=\"flash.n\"\n class=\"pointer-events-none absolute inset-y-0 flex items-center justify-center\"\n :class=\"flash.side === 'left' ? 'left-0 w-2/5' : flash.side === 'right' ? 'right-0 w-2/5' : 'inset-x-0'\"\n aria-hidden=\"true\"\n >\n <div class=\"flex flex-col items-center gap-2\">\n <span class=\"flex size-16 items-center justify-center rounded-full bg-black/45 backdrop-blur-md\"><MIcon :name=\"flash.icon\" :size=\"34\" filled /></span>\n <span v-if=\"flash.text\" class=\"rounded-full bg-black/45 px-3 py-0.5 text-label-large backdrop-blur-md\">{{ flash.text }}</span>\n </div>\n </div>\n </Transition>\n\n <div v-if=\"player.error.value\" class=\"absolute inset-0 flex items-center justify-center bg-black/60 p-4 text-center\">\n <slot name=\"error\" :error=\"player.error.value\">\n <p class=\"flex flex-col items-center gap-2 text-title-medium\">\n <MIcon name=\"error\" :size=\"32\" />\n {{ errorText }}\n </p>\n </slot>\n </div>\n\n <div v-if=\"player.ended.value && slots.end\" class=\"absolute inset-0\">\n <slot name=\"end\" :player=\"player\" :replay=\"() => player.play()\" />\n </div>\n\n <Transition name=\"m3-video-fade\">\n <div v-if=\"visible && !(player.ended.value && slots.end)\" class=\"pointer-events-none absolute inset-0\">\n <!-- Top -->\n <div class=\"pointer-events-auto absolute inset-x-0 top-0\" @pointerenter=\"overControls = true\" @pointerleave=\"overControls = false\">\n <slot name=\"top\" v-bind=\"slotProps\">\n <div v-if=\"fullscreen\" class=\"flex items-center gap-2 px-2 pt-2\">\n <MIconButton icon=\"arrow_back\" :label=\"locale.mediaExitFullscreen\" color=\"#fff\" @click=\"toggleFullscreen\" />\n <p v-if=\"title\" class=\"min-w-0 flex-1 truncate text-title-medium\">{{ title }}</p>\n </div>\n </slot>\n </div>\n\n <!-- Center: on the picture's center, whatever the top and bottom hold -->\n <div v-if=\"!player.waiting.value && !player.error.value\" class=\"absolute inset-0 flex items-center justify-center\" :class=\"sizes.gap\">\n <slot name=\"center\" v-bind=\"slotProps\">\n <MIconButton\n v-if=\"showTrackButtons\"\n icon=\"skip_previous\"\n :label=\"locale.previous\"\n :size=\"sizes.track\"\n :icon-size=\"compact ? 24 : 28\"\n :aria-disabled=\"!hasPrevious || undefined\"\n :tabindex=\"hasPrevious ? undefined : -1\"\n variant=\"filled\"\n :color=\"GLASS\"\n icon-filled\n class=\"backdrop-blur-md\" :class=\"hasPrevious ? 'pointer-events-auto' : 'opacity-40'\"\n @click=\"previous\"\n />\n <MIconButton\n v-if=\"!player.live.value\"\n :icon=\"skipIcon('back')\"\n :label=\"seekBackLabel\"\n :size=\"sizes.skip\"\n :icon-size=\"compact ? 26 : 30\"\n variant=\"filled\"\n :color=\"GLASS\"\n class=\"pointer-events-auto backdrop-blur-md\"\n @click=\"skip(-seekStep)\"\n />\n <MIconButton\n :icon=\"playIcon\"\n :label=\"playLabel\"\n :size=\"sizes.play\"\n :icon-size=\"compact ? 32 : 40\"\n variant=\"filled\"\n color=\"var(--color-primary-container)\"\n content-color=\"on-primary-container\"\n icon-filled\n class=\"m3-video-play pointer-events-auto shadow-elevation-2\"\n :style=\"{ borderRadius: playRadius }\"\n @click=\"toggle()\"\n />\n <MIconButton\n v-if=\"!player.live.value\"\n :icon=\"skipIcon('forward')\"\n :label=\"seekForwardLabel\"\n :size=\"sizes.skip\"\n :icon-size=\"compact ? 26 : 30\"\n variant=\"filled\"\n :color=\"GLASS\"\n class=\"pointer-events-auto backdrop-blur-md\"\n @click=\"skip(seekStep)\"\n />\n <MIconButton\n v-if=\"showTrackButtons\"\n icon=\"skip_next\"\n :label=\"locale.next\"\n :size=\"sizes.track\"\n :icon-size=\"compact ? 24 : 28\"\n :aria-disabled=\"!hasNext || undefined\"\n :tabindex=\"hasNext ? undefined : -1\"\n variant=\"filled\"\n :color=\"GLASS\"\n icon-filled\n class=\"backdrop-blur-md\" :class=\"hasNext ? 'pointer-events-auto' : 'opacity-40'\"\n @click=\"next\"\n />\n </slot>\n </div>\n\n <!-- Bottom -->\n <div class=\"pointer-events-auto absolute inset-x-0 bottom-0\" @pointerenter=\"overControls = true\" @pointerleave=\"overControls = false\">\n <slot name=\"bottom\" v-bind=\"slotProps\">\n <div :class=\"compact ? 'px-2 pb-1' : 'px-4 pb-2'\">\n <MSeekBar\n v-if=\"!player.live.value\"\n v-model=\"player.currentTime.value\"\n :duration=\"player.duration.value\"\n :buffered=\"player.buffered.value\"\n :chapters=\"chapters\"\n :playing=\"player.playing.value && !player.waiting.value\"\n :playback-rate=\"player.rate.value\"\n :color=\"color\"\n track-color=\"rgb(255 255 255 / 0.28)\"\n variant=\"line\"\n :size=\"compact ? 'xs' : 'sm'\"\n time=\"none\"\n class=\"px-1\"\n />\n <div class=\"flex items-center gap-1\">\n <span v-if=\"player.live.value\" class=\"ml-2 flex items-center gap-1.5 rounded-full bg-error px-2.5 py-0.5 text-label-medium text-on-error\">\n <span class=\"size-1.5 rounded-full bg-on-error\" />{{ locale.mediaLive }}\n </span>\n <p v-else class=\"ml-1 min-w-0 truncate text-label-large tabular-nums\">\n {{ timeText }}<span v-if=\"chapterTitle && !compact\" class=\"text-white/75\"> · {{ chapterTitle }}</span>\n </p>\n <span class=\"flex-1\" />\n <div class=\"group/vol flex items-center\">\n <div v-if=\"!compact\" class=\"w-0 overflow-hidden transition-[width] duration-300 ease-[cubic-bezier(.2,0,0,1)] group-focus-within/vol:w-24 group-hover/vol:w-24\">\n <MSlider v-model=\"volumePercent\" :min=\"0\" :max=\"100\" size=\"xs\" class=\"w-22 px-1\" />\n </div>\n <MIconButton :icon=\"volumeIcon\" :label=\"player.muted.value ? locale.mediaUnmute : locale.mediaMute\" color=\"#fff\" :size=\"compact ? 'xs' : 'sm'\" @click=\"toggleMute\" />\n </div>\n <MIconButton\n v-if=\"tracks?.length\"\n :icon=\"subtitle >= 0 ? 'subtitles' : 'subtitles_off'\"\n :label=\"locale.mediaSubtitles\"\n color=\"#fff\"\n :size=\"compact ? 'xs' : 'sm'\"\n :icon-filled=\"subtitle >= 0\"\n @click=\"toggleSubtitles\"\n />\n <MMenu ref=\"menu\" submenu-mode=\"push\" align=\"right\">\n <template #trigger>\n <MIconButton icon=\"settings\" :label=\"locale.mediaSettings\" color=\"#fff\" :size=\"compact ? 'xs' : 'sm'\" />\n </template>\n <MMenuItem icon=\"slow_motion_video\">\n {{ locale.mediaSpeed }} · {{ speedLabel(player.rate.value) }}\n <template #children>\n <MMenuItem v-for=\"s in speeds\" :key=\"s\" :selected=\"player.rate.value === s\" @click=\"player.rate.value = s\">{{ speedLabel(s) }}</MMenuItem>\n </template>\n </MMenuItem>\n <MMenuItem v-if=\"tracks?.length\" icon=\"subtitles\">\n {{ locale.mediaSubtitles }} · {{ subtitle >= 0 ? tracks[subtitle]?.label : locale.mediaSubtitlesOff }}\n <template #children>\n <MMenuItem :selected=\"subtitle < 0\" @click=\"subtitle = -1\">{{ locale.mediaSubtitlesOff }}</MMenuItem>\n <MMenuItem v-for=\"(t, i) in tracks\" :key=\"t.src\" :selected=\"subtitle === i\" @click=\"subtitle = i\">{{ t.label }}</MMenuItem>\n </template>\n </MMenuItem>\n <MMenuItem v-if=\"levels.length > 1\" icon=\"tune\">\n {{ locale.mediaQuality }} · {{ qualityLabel }}\n <template #children>\n <MMenuItem :selected=\"level < 0\" @click=\"level = -1\">{{ locale.mediaQualityAuto }}</MMenuItem>\n <MMenuItem v-for=\"(l, i) in levels\" :key=\"i\" :selected=\"level === i\" @click=\"level = i\">{{ levelLabel(l) }}</MMenuItem>\n </template>\n </MMenuItem>\n <slot name=\"settings\" :player=\"player\" />\n </MMenu>\n <MIconButton\n v-if=\"pipAvailable && !compact\"\n icon=\"picture_in_picture_alt\"\n :label=\"locale.mediaPictureInPicture\"\n color=\"#fff\"\n size=\"sm\"\n @click=\"togglePip\"\n />\n <MIconButton\n :icon=\"fullscreen ? 'fullscreen_exit' : 'fullscreen'\"\n :label=\"fullscreen ? locale.mediaExitFullscreen : locale.mediaFullscreen\"\n color=\"#fff\"\n :size=\"compact ? 'xs' : 'sm'\"\n @click=\"toggleFullscreen\"\n />\n </div>\n </div>\n </slot>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<style>\n/* Root default in the base layer, so a consumer's position class (absolute…) wins */\n@layer base {\n .m3-video-player { position: relative; }\n}\n.m3-video-player video::cue {\n background: color-mix(in srgb, var(--color-scrim) 75%, transparent);\n color: #fff;\n}\n.m3-video-play { transition: border-radius 350ms cubic-bezier(0.2, 0, 0, 1); }\n.m3-video-fade-enter-active,\n.m3-video-fade-leave-active { transition: opacity 250ms cubic-bezier(0.2, 0, 0, 1); }\n.m3-video-fade-enter-from,\n.m3-video-fade-leave-to { opacity: 0; }\n.m3-video-flash-leave-active { transition: opacity 400ms ease, transform 400ms ease; }\n.m3-video-flash-leave-to { opacity: 0; transform: scale(1.3); }\n</style>\n","<script setup lang=\"ts\">\n/**\n * An audio player (not an M3 spec component). `mini` is a port of Media3's Compose Material3 `MiniController`\n * (androidx/media `ui_compose_material3`): artwork, title and artist, previous / play-pause / next and a thin\n * progress line, on an elevated card; a click on it emits `click` (open your full player). `standard` is a full\n * player bar: artwork and text, an `MSeekBar`, shuffle / previous / play / next / repeat, and volume.\n *\n * Plays `src`/`sources` in a hidden `<audio>`, or drives a `player` from `useMediaPlayer()` (keep it outside a\n * page to play on while the app navigates, or give it a clock for generated audio). The queue is yours: the\n * buttons emit `previous`/`next`, and stay in place, disabled, without `hasPrevious`/`hasNext` (as Media3's).\n *\n * @slot artwork Replaces the artwork. Props: `{ player }`\n * @slot actions Extra buttons at the end of the controls (a like, a queue button). Props: `{ player }`\n * @event previous The previous button (or the lock screen's) was pressed\n * @event next The next button (or the lock screen's) was pressed\n * @event ended The track reached its end\n * @event error The audio failed to load or play, with the media element's error\n * @event click The mini player was clicked (outside its buttons)\n */\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useMediaPlayer, type MediaPlayer } from '../composables/useMediaPlayer'\nimport { useLocale } from '../composables/useLocale'\nimport type { VideoSource } from './MVideoPlayer.vue'\nimport MSeekBar from './MSeekBar.vue'\nimport MIconButton from './MIconButton.vue'\nimport MIcon from './MIcon.vue'\nimport MSlider from './MSlider.vue'\nimport MMenu from './MMenu.vue'\nimport MMenuItem from './MMenuItem.vue'\n\nconst props = withDefaults(defineProps<{\n /** `mini`: Media3's MiniController (a compact card). `standard`: a full player bar */\n variant?: 'mini' | 'standard'\n /** Audio URL */\n src?: string\n /** Several formats of the audio; the browser plays the first it can */\n sources?: VideoSource[]\n /** Track title (also shown on the lock screen) */\n title?: string\n /** Artist (also shown on the lock screen) */\n artist?: string\n /** Album, for the lock screen */\n album?: string\n /** Cover image URL */\n artwork?: string\n /** Length in seconds, for a clock without `src` (with a file it comes from the file) */\n duration?: number\n /** Drive this player instead of one of its own (from `useMediaPlayer()`). Read once */\n player?: MediaPlayer\n /** Playing (v-model) */\n playing?: boolean\n /** Position in seconds (v-model) */\n currentTime?: number\n /** Playback speed (v-model) */\n rate?: number\n /** Volume, 0 to 1 (v-model) */\n volume?: number\n /** Muted (v-model) */\n muted?: boolean\n /** Shuffle (v-model); unset hides the button */\n shuffle?: boolean\n /** Repeat mode (v-model); unset hides the button */\n repeat?: 'off' | 'all' | 'one'\n /** Starts playing when mounted (browsers block it with sound before a user gesture) */\n autoplay?: boolean\n /** There is a previous track: enables the previous button (emits `previous`) */\n hasPrevious?: boolean\n /** There is a next track: enables the next button (emits `next`) */\n hasNext?: boolean\n /** Speeds offered in a speed menu (`standard`); unset hides it */\n speeds?: number[]\n /** The seek bar's look (`standard`) */\n seekBar?: 'slider' | 'line' | 'wavy'\n /** Played part and play button: an M3 role or any CSS color */\n color?: string\n}>(), {\n variant: 'standard',\n playing: undefined,\n currentTime: undefined,\n rate: undefined,\n volume: undefined,\n muted: undefined,\n shuffle: undefined,\n repeat: undefined,\n autoplay: false,\n hasPrevious: false,\n hasNext: false,\n seekBar: 'slider',\n color: 'primary',\n})\n\nconst emit = defineEmits<{\n 'update:playing': [boolean]\n 'update:currentTime': [number]\n 'update:rate': [number]\n 'update:volume': [number]\n 'update:muted': [boolean]\n 'update:shuffle': [boolean]\n 'update:repeat': ['off' | 'all' | 'one']\n previous: []\n next: []\n ended: []\n error: [MediaError | null]\n click: [MouseEvent]\n}>()\n\nconst locale = useLocale()\nconst audioEl = ref<HTMLAudioElement>()\nconst hasFile = computed(() => !!(props.src || props.sources?.length))\n\nconst player: MediaPlayer = props.player ?? useMediaPlayer({\n media: () => (hasFile.value ? audioEl.value : null),\n duration: () => props.duration,\n loop: () => props.repeat === 'one',\n metadata: () => (props.title ? { title: props.title, artist: props.artist, album: props.album, artwork: props.artwork ? [props.artwork] : [] } : null),\n onPrevious: () => emit('previous'),\n onNext: () => emit('next'),\n hasPrevious: () => props.hasPrevious,\n hasNext: () => props.hasNext,\n})\nconst external = !!props.player\nconst hasPrevious = computed(() => (external ? player.hasPrevious.value : props.hasPrevious))\nconst hasNext = computed(() => (external ? player.hasNext.value : props.hasNext))\nfunction previous() {\n if (external) player.previous()\n else emit('previous')\n}\nfunction next() {\n if (external) player.next()\n else emit('next')\n}\n\n// ── v-model ─────────────────────────────────────────────────────────────────────────────────────────────\nwatch(() => props.playing, (v) => { if (v !== undefined) player.playing.value = v })\nwatch(() => props.currentTime, (v) => { if (v !== undefined && Math.abs(v - player.currentTime.value) > 0.5) player.seek(v) }, { immediate: true })\nwatch(() => props.rate, (v) => { if (v !== undefined) player.rate.value = v }, { immediate: true })\nwatch(() => props.volume, (v) => { if (v !== undefined) player.volume.value = v }, { immediate: true })\nwatch(() => props.muted, (v) => { if (v !== undefined) player.muted.value = v }, { immediate: true })\nwatch(player.playing, (v) => emit('update:playing', v))\nwatch(player.currentTime, (v) => emit('update:currentTime', v))\nwatch(player.rate, (v) => emit('update:rate', v))\nwatch(player.volume, (v) => emit('update:volume', v))\nwatch(player.muted, (v) => emit('update:muted', v))\nwatch(player.ended, (v) => { if (v) emit('ended') })\nwatch(player.error, (e) => { if (e) emit('error', e) })\n\nconst allSources = computed<VideoSource[]>(() => props.sources ?? (props.src ? [{ src: props.src }] : []))\nwatch(allSources, () => {\n const wasPlaying = player.playing.value\n audioEl.value?.load()\n // A new track keeps playing if the last one was (or just ended into it)\n if (wasPlaying || player.ended.value) player.play()\n}, { flush: 'post' })\n\nonMounted(() => {\n if (external) player.attach(hasFile.value ? audioEl.value ?? null : null)\n if (props.autoplay || props.playing) player.play()\n})\nonBeforeUnmount(() => {\n if (external) player.attach(undefined)\n})\n\n// ── Controls ────────────────────────────────────────────────────────────────────────────────────────────\nconst playIcon = computed(() => (player.playing.value ? 'pause' : 'play_arrow'))\nconst playLabel = computed(() => (player.playing.value ? locale.mediaPause : locale.mediaPlay))\nconst progress = computed(() => {\n const d = player.duration.value\n return d && Number.isFinite(d) ? Math.min(1, player.currentTime.value / d) : 0\n})\n\nconst repeatIcon = computed(() => (props.repeat === 'one' ? 'repeat_one' : 'repeat'))\nconst repeatLabel = computed(() => (props.repeat === 'one' ? locale.mediaRepeatOne : locale.mediaRepeat))\nfunction cycleRepeat() {\n const order = ['off', 'all', 'one'] as const\n emit('update:repeat', order[(order.indexOf(props.repeat ?? 'off') + 1) % 3]!)\n}\n\nconst volumeIcon = computed(() => {\n const v = player.volume.value\n return player.muted.value || v === 0 ? 'volume_off' : v < 0.5 ? 'volume_down' : 'volume_up'\n})\nconst volumePercent = computed({\n get: () => (player.muted.value ? 0 : Math.round(player.volume.value * 100)),\n set: (v: number) => {\n player.volume.value = v / 100\n player.muted.value = v === 0\n },\n})\nfunction toggleMute() {\n if (player.muted.value && player.volume.value === 0) player.volume.value = 1\n player.muted.value = !player.muted.value\n}\nconst speedLabel = (s: number) => (s === 1 ? locale.mediaSpeedNormal : `${s}×`)\n\nconst ROLES = ['primary', 'secondary', 'tertiary', 'error']\nconst activeColor = computed(() => (ROLES.includes(props.color) ? `var(--color-${props.color})` : props.color))\n\nfunction onMiniClick(e: MouseEvent) {\n if ((e.target as HTMLElement).closest('button, a, [role=\"slider\"]')) return\n emit('click', e)\n}\n</script>\n\n<template>\n <!-- MiniController: MiniControllerTokens (56dp artwork, 48dp controls, 8/4dp padding, 4dp card elevation) -->\n <div\n v-if=\"variant === 'mini'\"\n role=\"region\"\n :aria-label=\"title || locale.mediaPlayer\"\n class=\"m3-audio-mini cursor-pointer items-center gap-2 rounded-md bg-surface-container-low px-2 py-1 text-on-surface shadow-elevation-2\"\n @click=\"onMiniClick\"\n >\n <slot name=\"artwork\" :player=\"player\">\n <img v-if=\"artwork\" :src=\"artwork\" alt=\"\" class=\"size-14 shrink-0 rounded-sm object-cover\" />\n <div v-else class=\"flex size-14 shrink-0 items-center justify-center rounded-sm bg-surface-container-highest text-on-surface-variant\">\n <MIcon name=\"music_note\" />\n </div>\n </slot>\n <div class=\"min-w-0 flex-1\">\n <p class=\"truncate text-title-small\">{{ title }}</p>\n <p v-if=\"artist\" class=\"truncate text-body-medium text-on-surface-variant\">{{ artist }}</p>\n </div>\n <MIconButton icon=\"skip_previous\" :label=\"locale.previous\" :size=\"48\" :icon-size=\"24\" :disabled=\"!hasPrevious\" icon-filled @click=\"previous\" />\n <MIconButton :icon=\"playIcon\" :label=\"playLabel\" :size=\"48\" :icon-size=\"24\" icon-filled @click=\"player.toggle()\" />\n <MIconButton icon=\"skip_next\" :label=\"locale.next\" :size=\"48\" :icon-size=\"24\" :disabled=\"!hasNext\" icon-filled @click=\"next\" />\n <slot name=\"actions\" :player=\"player\" />\n <div class=\"pointer-events-none absolute inset-x-0 bottom-0 h-0.5 bg-secondary-container\" aria-hidden=\"true\">\n <div class=\"h-full origin-left\" :style=\"{ transform: `scaleX(${progress})`, backgroundColor: activeColor }\" />\n </div>\n <audio v-if=\"hasFile\" ref=\"audioEl\" preload=\"metadata\" :loop=\"repeat === 'one'\" class=\"hidden\">\n <source v-for=\"s in allSources\" :key=\"s.src\" :src=\"s.src\" :type=\"s.type\" />\n </audio>\n </div>\n\n <div\n v-else\n role=\"region\"\n :aria-label=\"title || locale.mediaPlayer\"\n class=\"@container flex flex-col gap-1 text-on-surface\"\n >\n <div class=\"flex items-center gap-3\">\n <slot name=\"artwork\" :player=\"player\">\n <img v-if=\"artwork\" :src=\"artwork\" alt=\"\" class=\"size-14 shrink-0 rounded-md object-cover\" />\n </slot>\n <div class=\"min-w-0 flex-1\">\n <p v-if=\"title\" class=\"truncate text-title-medium\">{{ title }}</p>\n <p v-if=\"artist\" class=\"truncate text-body-medium text-on-surface-variant\">{{ artist }}</p>\n </div>\n <slot name=\"actions\" :player=\"player\" />\n </div>\n\n <MSeekBar\n v-if=\"!player.live.value\"\n v-model=\"player.currentTime.value\"\n :duration=\"player.duration.value\"\n :buffered=\"player.buffered.value\"\n :playing=\"player.playing.value && !player.waiting.value\"\n :playback-rate=\"player.rate.value\"\n :variant=\"seekBar\"\n :color=\"color\"\n size=\"sm\"\n />\n\n <div class=\"flex items-center gap-1\">\n <div class=\"flex flex-1 items-center\">\n <MIconButton\n v-if=\"shuffle !== undefined\"\n icon=\"shuffle\"\n :label=\"locale.mediaShuffle\"\n :checked=\"shuffle\"\n @update:checked=\"(v: boolean) => emit('update:shuffle', v)\"\n />\n </div>\n <MIconButton icon=\"skip_previous\" :label=\"locale.previous\" size=\"md\" :disabled=\"!hasPrevious\" icon-filled @click=\"previous\" />\n <MIconButton\n :icon=\"playIcon\"\n :label=\"playLabel\"\n size=\"md\"\n variant=\"filled\"\n :color=\"color\"\n icon-filled\n @click=\"player.toggle()\"\n />\n <MIconButton icon=\"skip_next\" :label=\"locale.next\" size=\"md\" :disabled=\"!hasNext\" icon-filled @click=\"next\" />\n <div class=\"flex flex-1 items-center justify-end\">\n <MIconButton v-if=\"repeat !== undefined\" :icon=\"repeatIcon\" :label=\"repeatLabel\" :checked=\"repeat !== 'off'\" @update:checked=\"cycleRepeat\" />\n </div>\n </div>\n\n <div class=\"flex items-center justify-end gap-1\">\n <MMenu v-if=\"speeds?.length\" align=\"right\">\n <template #trigger>\n <button type=\"button\" class=\"h-8 cursor-pointer rounded-full px-3 text-label-large text-on-surface-variant hover:bg-on-surface/8\" :aria-label=\"locale.mediaSpeed\">\n {{ speedLabel(player.rate.value) }}\n </button>\n </template>\n <MMenuItem v-for=\"s in speeds\" :key=\"s\" :selected=\"player.rate.value === s\" @click=\"player.rate.value = s\">{{ speedLabel(s) }}</MMenuItem>\n </MMenu>\n <span class=\"flex-1\" />\n <MIconButton :icon=\"volumeIcon\" :label=\"player.muted.value ? locale.mediaUnmute : locale.mediaMute\" size=\"xs\" @click=\"toggleMute\" />\n <MSlider v-model=\"volumePercent\" :min=\"0\" :max=\"100\" size=\"xs\" class=\"hidden w-28 @sm:block\" />\n </div>\n\n <audio v-if=\"hasFile\" ref=\"audioEl\" preload=\"metadata\" :loop=\"repeat === 'one'\" class=\"hidden\">\n <source v-for=\"s in allSources\" :key=\"s.src\" :src=\"s.src\" :type=\"s.type\" />\n </audio>\n </div>\n</template>\n\n<style>\n/* Root defaults in the base layer, so a consumer's position or display class wins */\n@layer base {\n .m3-audio-mini {\n position: relative;\n display: flex;\n overflow: hidden;\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * An audio player (not an M3 spec component). `mini` is a port of Media3's Compose Material3 `MiniController`\n * (androidx/media `ui_compose_material3`): artwork, title and artist, previous / play-pause / next and a thin\n * progress line, on an elevated card; a click on it emits `click` (open your full player). `standard` is a full\n * player bar: artwork and text, an `MSeekBar`, shuffle / previous / play / next / repeat, and volume.\n *\n * Plays `src`/`sources` in a hidden `<audio>`, or drives a `player` from `useMediaPlayer()` (keep it outside a\n * page to play on while the app navigates, or give it a clock for generated audio). The queue is yours: the\n * buttons emit `previous`/`next`, and stay in place, disabled, without `hasPrevious`/`hasNext` (as Media3's).\n *\n * @slot artwork Replaces the artwork. Props: `{ player }`\n * @slot actions Extra buttons at the end of the controls (a like, a queue button). Props: `{ player }`\n * @event previous The previous button (or the lock screen's) was pressed\n * @event next The next button (or the lock screen's) was pressed\n * @event ended The track reached its end\n * @event error The audio failed to load or play, with the media element's error\n * @event click The mini player was clicked (outside its buttons)\n */\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useMediaPlayer, type MediaPlayer } from '../composables/useMediaPlayer'\nimport { useLocale } from '../composables/useLocale'\nimport type { VideoSource } from './MVideoPlayer.vue'\nimport MSeekBar from './MSeekBar.vue'\nimport MIconButton from './MIconButton.vue'\nimport MIcon from './MIcon.vue'\nimport MSlider from './MSlider.vue'\nimport MMenu from './MMenu.vue'\nimport MMenuItem from './MMenuItem.vue'\n\nconst props = withDefaults(defineProps<{\n /** `mini`: Media3's MiniController (a compact card). `standard`: a full player bar */\n variant?: 'mini' | 'standard'\n /** Audio URL */\n src?: string\n /** Several formats of the audio; the browser plays the first it can */\n sources?: VideoSource[]\n /** Track title (also shown on the lock screen) */\n title?: string\n /** Artist (also shown on the lock screen) */\n artist?: string\n /** Album, for the lock screen */\n album?: string\n /** Cover image URL */\n artwork?: string\n /** Length in seconds, for a clock without `src` (with a file it comes from the file) */\n duration?: number\n /** Drive this player instead of one of its own (from `useMediaPlayer()`). Read once */\n player?: MediaPlayer\n /** Playing (v-model) */\n playing?: boolean\n /** Position in seconds (v-model) */\n currentTime?: number\n /** Playback speed (v-model) */\n rate?: number\n /** Volume, 0 to 1 (v-model) */\n volume?: number\n /** Muted (v-model) */\n muted?: boolean\n /** Shuffle (v-model); unset hides the button */\n shuffle?: boolean\n /** Repeat mode (v-model); unset hides the button */\n repeat?: 'off' | 'all' | 'one'\n /** Starts playing when mounted (browsers block it with sound before a user gesture) */\n autoplay?: boolean\n /** There is a previous track: enables the previous button (emits `previous`) */\n hasPrevious?: boolean\n /** There is a next track: enables the next button (emits `next`) */\n hasNext?: boolean\n /** Speeds offered in a speed menu (`standard`); unset hides it */\n speeds?: number[]\n /** The seek bar's look (`standard`) */\n seekBar?: 'slider' | 'line' | 'wavy'\n /** Played part and play button: an M3 role or any CSS color */\n color?: string\n}>(), {\n variant: 'standard',\n playing: undefined,\n currentTime: undefined,\n rate: undefined,\n volume: undefined,\n muted: undefined,\n shuffle: undefined,\n repeat: undefined,\n autoplay: false,\n hasPrevious: false,\n hasNext: false,\n seekBar: 'slider',\n color: 'primary',\n})\n\nconst emit = defineEmits<{\n 'update:playing': [boolean]\n 'update:currentTime': [number]\n 'update:rate': [number]\n 'update:volume': [number]\n 'update:muted': [boolean]\n 'update:shuffle': [boolean]\n 'update:repeat': ['off' | 'all' | 'one']\n previous: []\n next: []\n ended: []\n error: [MediaError | null]\n click: [MouseEvent]\n}>()\n\nconst locale = useLocale()\nconst audioEl = ref<HTMLAudioElement>()\nconst hasFile = computed(() => !!(props.src || props.sources?.length))\n\nconst player: MediaPlayer = props.player ?? useMediaPlayer({\n media: () => (hasFile.value ? audioEl.value : null),\n duration: () => props.duration,\n loop: () => props.repeat === 'one',\n metadata: () => (props.title ? { title: props.title, artist: props.artist, album: props.album, artwork: props.artwork ? [props.artwork] : [] } : null),\n onPrevious: () => emit('previous'),\n onNext: () => emit('next'),\n hasPrevious: () => props.hasPrevious,\n hasNext: () => props.hasNext,\n})\nconst external = !!props.player\nconst hasPrevious = computed(() => (external ? player.hasPrevious.value : props.hasPrevious))\nconst hasNext = computed(() => (external ? player.hasNext.value : props.hasNext))\nfunction previous() {\n if (external) player.previous()\n else emit('previous')\n}\nfunction next() {\n if (external) player.next()\n else emit('next')\n}\n\n// ── v-model ─────────────────────────────────────────────────────────────────────────────────────────────\nwatch(() => props.playing, (v) => { if (v !== undefined) player.playing.value = v })\nwatch(() => props.currentTime, (v) => { if (v !== undefined && Math.abs(v - player.currentTime.value) > 0.5) player.seek(v) }, { immediate: true })\nwatch(() => props.rate, (v) => { if (v !== undefined) player.rate.value = v }, { immediate: true })\nwatch(() => props.volume, (v) => { if (v !== undefined) player.volume.value = v }, { immediate: true })\nwatch(() => props.muted, (v) => { if (v !== undefined) player.muted.value = v }, { immediate: true })\nwatch(player.playing, (v) => emit('update:playing', v))\nwatch(player.currentTime, (v) => emit('update:currentTime', v))\nwatch(player.rate, (v) => emit('update:rate', v))\nwatch(player.volume, (v) => emit('update:volume', v))\nwatch(player.muted, (v) => emit('update:muted', v))\nwatch(player.ended, (v) => { if (v) emit('ended') })\nwatch(player.error, (e) => { if (e) emit('error', e) })\n\nconst allSources = computed<VideoSource[]>(() => props.sources ?? (props.src ? [{ src: props.src }] : []))\nwatch(allSources, () => {\n const wasPlaying = player.playing.value\n audioEl.value?.load()\n // A new track keeps playing if the last one was (or just ended into it)\n if (wasPlaying || player.ended.value) player.play()\n}, { flush: 'post' })\n\nonMounted(() => {\n if (external) player.attach(hasFile.value ? audioEl.value ?? null : null)\n if (props.autoplay || props.playing) player.play()\n})\nonBeforeUnmount(() => {\n if (external) player.attach(undefined)\n})\n\n// ── Controls ────────────────────────────────────────────────────────────────────────────────────────────\nconst playIcon = computed(() => (player.playing.value ? 'pause' : 'play_arrow'))\nconst playLabel = computed(() => (player.playing.value ? locale.mediaPause : locale.mediaPlay))\nconst progress = computed(() => {\n const d = player.duration.value\n return d && Number.isFinite(d) ? Math.min(1, player.currentTime.value / d) : 0\n})\n\nconst repeatIcon = computed(() => (props.repeat === 'one' ? 'repeat_one' : 'repeat'))\nconst repeatLabel = computed(() => (props.repeat === 'one' ? locale.mediaRepeatOne : locale.mediaRepeat))\nfunction cycleRepeat() {\n const order = ['off', 'all', 'one'] as const\n emit('update:repeat', order[(order.indexOf(props.repeat ?? 'off') + 1) % 3]!)\n}\n\nconst volumeIcon = computed(() => {\n const v = player.volume.value\n return player.muted.value || v === 0 ? 'volume_off' : v < 0.5 ? 'volume_down' : 'volume_up'\n})\nconst volumePercent = computed({\n get: () => (player.muted.value ? 0 : Math.round(player.volume.value * 100)),\n set: (v: number) => {\n player.volume.value = v / 100\n player.muted.value = v === 0\n },\n})\nfunction toggleMute() {\n if (player.muted.value && player.volume.value === 0) player.volume.value = 1\n player.muted.value = !player.muted.value\n}\nconst speedLabel = (s: number) => (s === 1 ? locale.mediaSpeedNormal : `${s}×`)\n\nconst ROLES = ['primary', 'secondary', 'tertiary', 'error']\nconst activeColor = computed(() => (ROLES.includes(props.color) ? `var(--color-${props.color})` : props.color))\n\nfunction onMiniClick(e: MouseEvent) {\n if ((e.target as HTMLElement).closest('button, a, [role=\"slider\"]')) return\n emit('click', e)\n}\n</script>\n\n<template>\n <!-- MiniController: MiniControllerTokens (56dp artwork, 48dp controls, 8/4dp padding, 4dp card elevation) -->\n <div\n v-if=\"variant === 'mini'\"\n role=\"region\"\n :aria-label=\"title || locale.mediaPlayer\"\n class=\"m3-audio-mini cursor-pointer items-center gap-2 rounded-md bg-surface-container-low px-2 py-1 text-on-surface shadow-elevation-2\"\n @click=\"onMiniClick\"\n >\n <slot name=\"artwork\" :player=\"player\">\n <img v-if=\"artwork\" :src=\"artwork\" alt=\"\" class=\"size-14 shrink-0 rounded-sm object-cover\" />\n <div v-else class=\"flex size-14 shrink-0 items-center justify-center rounded-sm bg-surface-container-highest text-on-surface-variant\">\n <MIcon name=\"music_note\" />\n </div>\n </slot>\n <div class=\"min-w-0 flex-1\">\n <p class=\"truncate text-title-small\">{{ title }}</p>\n <p v-if=\"artist\" class=\"truncate text-body-medium text-on-surface-variant\">{{ artist }}</p>\n </div>\n <MIconButton icon=\"skip_previous\" :label=\"locale.previous\" :size=\"48\" :icon-size=\"24\" :disabled=\"!hasPrevious\" icon-filled @click=\"previous\" />\n <MIconButton :icon=\"playIcon\" :label=\"playLabel\" :size=\"48\" :icon-size=\"24\" icon-filled @click=\"player.toggle()\" />\n <MIconButton icon=\"skip_next\" :label=\"locale.next\" :size=\"48\" :icon-size=\"24\" :disabled=\"!hasNext\" icon-filled @click=\"next\" />\n <slot name=\"actions\" :player=\"player\" />\n <div class=\"pointer-events-none absolute inset-x-0 bottom-0 h-0.5 bg-secondary-container\" aria-hidden=\"true\">\n <div class=\"h-full origin-left\" :style=\"{ transform: `scaleX(${progress})`, backgroundColor: activeColor }\" />\n </div>\n <audio v-if=\"hasFile\" ref=\"audioEl\" preload=\"metadata\" :loop=\"repeat === 'one'\" class=\"hidden\">\n <source v-for=\"s in allSources\" :key=\"s.src\" :src=\"s.src\" :type=\"s.type\" />\n </audio>\n </div>\n\n <div\n v-else\n role=\"region\"\n :aria-label=\"title || locale.mediaPlayer\"\n class=\"@container flex flex-col gap-1 text-on-surface\"\n >\n <div class=\"flex items-center gap-3\">\n <slot name=\"artwork\" :player=\"player\">\n <img v-if=\"artwork\" :src=\"artwork\" alt=\"\" class=\"size-14 shrink-0 rounded-md object-cover\" />\n </slot>\n <div class=\"min-w-0 flex-1\">\n <p v-if=\"title\" class=\"truncate text-title-medium\">{{ title }}</p>\n <p v-if=\"artist\" class=\"truncate text-body-medium text-on-surface-variant\">{{ artist }}</p>\n </div>\n <slot name=\"actions\" :player=\"player\" />\n </div>\n\n <MSeekBar\n v-if=\"!player.live.value\"\n v-model=\"player.currentTime.value\"\n :duration=\"player.duration.value\"\n :buffered=\"player.buffered.value\"\n :playing=\"player.playing.value && !player.waiting.value\"\n :playback-rate=\"player.rate.value\"\n :variant=\"seekBar\"\n :color=\"color\"\n size=\"sm\"\n />\n\n <div class=\"flex items-center gap-1\">\n <div class=\"flex flex-1 items-center\">\n <MIconButton\n v-if=\"shuffle !== undefined\"\n icon=\"shuffle\"\n :label=\"locale.mediaShuffle\"\n :checked=\"shuffle\"\n @update:checked=\"(v: boolean) => emit('update:shuffle', v)\"\n />\n </div>\n <MIconButton icon=\"skip_previous\" :label=\"locale.previous\" size=\"md\" :disabled=\"!hasPrevious\" icon-filled @click=\"previous\" />\n <MIconButton\n :icon=\"playIcon\"\n :label=\"playLabel\"\n size=\"md\"\n variant=\"filled\"\n :color=\"color\"\n icon-filled\n @click=\"player.toggle()\"\n />\n <MIconButton icon=\"skip_next\" :label=\"locale.next\" size=\"md\" :disabled=\"!hasNext\" icon-filled @click=\"next\" />\n <div class=\"flex flex-1 items-center justify-end\">\n <MIconButton v-if=\"repeat !== undefined\" :icon=\"repeatIcon\" :label=\"repeatLabel\" :checked=\"repeat !== 'off'\" @update:checked=\"cycleRepeat\" />\n </div>\n </div>\n\n <div class=\"flex items-center justify-end gap-1\">\n <MMenu v-if=\"speeds?.length\" align=\"right\">\n <template #trigger>\n <button type=\"button\" class=\"h-8 cursor-pointer rounded-full px-3 text-label-large text-on-surface-variant hover:bg-on-surface/8\" :aria-label=\"locale.mediaSpeed\">\n {{ speedLabel(player.rate.value) }}\n </button>\n </template>\n <MMenuItem v-for=\"s in speeds\" :key=\"s\" :selected=\"player.rate.value === s\" @click=\"player.rate.value = s\">{{ speedLabel(s) }}</MMenuItem>\n </MMenu>\n <span class=\"flex-1\" />\n <MIconButton :icon=\"volumeIcon\" :label=\"player.muted.value ? locale.mediaUnmute : locale.mediaMute\" size=\"xs\" @click=\"toggleMute\" />\n <MSlider v-model=\"volumePercent\" :min=\"0\" :max=\"100\" size=\"xs\" class=\"hidden w-28 @sm:block\" />\n </div>\n\n <audio v-if=\"hasFile\" ref=\"audioEl\" preload=\"metadata\" :loop=\"repeat === 'one'\" class=\"hidden\">\n <source v-for=\"s in allSources\" :key=\"s.src\" :src=\"s.src\" :type=\"s.type\" />\n </audio>\n </div>\n</template>\n\n<style>\n/* Root defaults in the base layer, so a consumer's position or display class wins */\n@layer base {\n .m3-audio-mini {\n position: relative;\n display: flex;\n overflow: hidden;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;AAoFA,IAAM,IAAY,OAAO,SAAW,KAIhC,IAA8B;AAkBlC,SAAgB,GAAe,IAA8B,CAAC,GAAgB;CAC5E,IAAM,IAAQ,CAAC,GACT,IAAO,EAAQ,YAAY,IAC3B,IAAQ,EAAoC,IAAI,GAChD,IAAW,EAAgD,KAAA,CAAS,GAEpE,IAAe,EAAI,EAAK,GACxB,IAAO,EAAI,CAAC,GACZ,IAAgB,EAAI,CAAC,GACrB,IAAW,EAAwB,CAAC,CAAC,GACrC,IAAY,EAAI,CAAC,GACjB,IAAc,EAAI,CAAC,GACnB,IAAa,EAAI,EAAK,GACtB,IAAU,EAAI,EAAK,GACnB,IAAQ,EAAI,EAAK,GACjB,IAAQ,EAA8B,IAAI,GAC1C,IAAU,EAAI,EAAK,GACnB,IAAO,QAAe,EAAc,UAAU,QAAQ,GAGxD,IAAM,GACN,IAAY,GACV,WAAsB;EAC1B,IAAM,IAAI,EAAQ,EAAQ,QAAQ;EAClC,OAAO,MAAM,KAAA,KAAa,OAAO,SAAS,CAAC,KAAK,IAAI,IAAI,IAAI;CAC9D;CAEA,SAAS,EAAK,GAAW;EAEvB,IADA,IAAM,GACF,EAAM,SAAS,CAAC,EAAa,OAAO;GACtC,IAAY;GACZ;EACF;EACA,IAAM,IAAK,IAAY,KAAK,IAAI,MAAO,IAAI,KAAa,GAAI,IAAI;EAEhE,IADA,IAAY,GACR,CAAC,EAAQ,OAAO;GAClB,IAAM,IAAI,EAAc,OACpB,IAAO,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AAA,EAA2E,UAAA;IAA1C,KAAK,EAAE;IAAM,KAAK,EAAE;IAAM,MAAM,EAAE"}
package/dist/pdf.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { default as MPdfViewer } from './components/MPdfViewer.vue';
2
+ export type { PdfAnnotation, PdfTool, PdfZoom } from './components/MPdfViewer.vue';
3
+ export { usePdf, setPdfWorker } from './composables/usePdf';
4
+ export type { PdfDocument, PdfMetadata, PdfOptions, PdfOutlineItem, PdfPage, PdfPageText, PdfSearchMatch, PdfSource, PdfState, PdfjsModule, } from './composables/usePdf';