@mattebox/player 0.10.0 → 0.11.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 (67) hide show
  1. package/dist/cdn/mattebox-player.min.js +3 -3
  2. package/dist/controls/icons.d.ts +1 -1
  3. package/dist/controls/icons.d.ts.map +1 -1
  4. package/dist/controls/icons.js +1 -0
  5. package/dist/controls/icons.js.map +1 -1
  6. package/dist/controls/native-tracks.d.ts +8 -7
  7. package/dist/controls/native-tracks.d.ts.map +1 -1
  8. package/dist/controls/native-tracks.js.map +1 -1
  9. package/dist/element.d.ts +46 -1
  10. package/dist/element.d.ts.map +1 -1
  11. package/dist/element.js +142 -13
  12. package/dist/element.js.map +1 -1
  13. package/dist/elements/control-bar.d.ts.map +1 -1
  14. package/dist/elements/control-bar.js +8 -6
  15. package/dist/elements/control-bar.js.map +1 -1
  16. package/dist/elements/error-screen.d.ts.map +1 -1
  17. package/dist/elements/error-screen.js +1 -3
  18. package/dist/elements/error-screen.js.map +1 -1
  19. package/dist/elements/play-button.d.ts.map +1 -1
  20. package/dist/elements/play-button.js +7 -9
  21. package/dist/elements/play-button.js.map +1 -1
  22. package/dist/elements/shared.d.ts +18 -0
  23. package/dist/elements/shared.d.ts.map +1 -1
  24. package/dist/elements/shared.js +16 -9
  25. package/dist/elements/shared.js.map +1 -1
  26. package/dist/elements/start-button.d.ts.map +1 -1
  27. package/dist/elements/start-button.js +3 -3
  28. package/dist/elements/start-button.js.map +1 -1
  29. package/dist/elements/title.d.ts.map +1 -1
  30. package/dist/elements/title.js +5 -2
  31. package/dist/elements/title.js.map +1 -1
  32. package/dist/elements/video-menu.d.ts +23 -0
  33. package/dist/elements/video-menu.d.ts.map +1 -0
  34. package/dist/elements/video-menu.js +146 -0
  35. package/dist/elements/video-menu.js.map +1 -0
  36. package/dist/entries/video-menu.d.ts +5 -0
  37. package/dist/entries/video-menu.d.ts.map +1 -0
  38. package/dist/entries/video-menu.js +9 -0
  39. package/dist/entries/video-menu.js.map +1 -0
  40. package/dist/es2015/controls/icons.js +1 -0
  41. package/dist/es2015/element.js +187 -60
  42. package/dist/es2015/elements/control-bar.js +8 -6
  43. package/dist/es2015/elements/error-screen.js +2 -3
  44. package/dist/es2015/elements/play-button.js +8 -10
  45. package/dist/es2015/elements/shared.js +16 -9
  46. package/dist/es2015/elements/start-button.js +3 -3
  47. package/dist/es2015/elements/title.js +5 -2
  48. package/dist/es2015/elements/video-menu.js +152 -0
  49. package/dist/es2015/entries/video-menu.js +7 -0
  50. package/dist/es2015/index.js +3 -1
  51. package/dist/es2015/tags.js +2 -1
  52. package/dist/es2015/video-sources.js +128 -0
  53. package/dist/host.d.ts +10 -1
  54. package/dist/host.d.ts.map +1 -1
  55. package/dist/host.js.map +1 -1
  56. package/dist/index.d.ts +3 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +3 -1
  59. package/dist/tags.d.ts +1 -0
  60. package/dist/tags.d.ts.map +1 -1
  61. package/dist/tags.js +2 -1
  62. package/dist/tags.js.map +1 -1
  63. package/dist/video-sources.d.ts +48 -0
  64. package/dist/video-sources.d.ts.map +1 -0
  65. package/dist/video-sources.js +134 -0
  66. package/dist/video-sources.js.map +1 -0
  67. package/package.json +3 -3
@@ -0,0 +1,152 @@
1
+ import { trackNames } from "../controls/track-names.js";
2
+ import { show } from "./shared.js";
3
+ import { nativeTracks, onNativeTracks } from "../controls/native-tracks.js";
4
+ import { MenuElement, single } from "./menu-element.js";
5
+ import { onTracks } from "./audio-menu.js";
6
+ import { videoKind } from "mattebox";
7
+ //#region src/elements/video-menu.ts
8
+ /** The default name of each kind of HTML's `VideoTrack.kind`. */
9
+ const KINDS = {
10
+ main: "Main",
11
+ alternative: "Alternative",
12
+ sign: "Sign language",
13
+ captions: "Captions",
14
+ subtitles: "Subtitles",
15
+ commentary: "Commentary"
16
+ };
17
+ /** The value of a version at its own URL, by its place; the source itself is `source:`. */
18
+ const SOURCE = "source:";
19
+ var MbxVideoMenu = class extends MenuElement {
20
+ static get observedAttributes() {
21
+ return [
22
+ "label",
23
+ "label-back",
24
+ "label-track",
25
+ ...Object.keys(KINDS).map((k) => `label-${k}`)
26
+ ];
27
+ }
28
+ constructor() {
29
+ super(...single("video"));
30
+ this.engine = null;
31
+ show(this.slots, "default");
32
+ }
33
+ name() {
34
+ return "Video";
35
+ }
36
+ attach(player) {
37
+ this.listen(player, ["videosourcechange"], () => {
38
+ this.render();
39
+ });
40
+ this.follow(player, (engine) => {
41
+ this.engine = engine;
42
+ this.render();
43
+ const tick = () => {
44
+ this.render();
45
+ };
46
+ return engine === null ? onNativeTracks(player.video, "videoTracks", tick) : onTracks(engine, tick);
47
+ });
48
+ }
49
+ /** The name of `kind`, from its attribute; an empty kind is the main picture. */
50
+ kindName(kind) {
51
+ var _this$getAttribute;
52
+ const key = kind === "" ? "main" : kind;
53
+ return (_this$getAttribute = this.getAttribute(`label-${key}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : KINDS[key];
54
+ }
55
+ /**
56
+ * The engine's video tracks as entries, one per version: the same version
57
+ * in another codec (an AVC and an HEVC set) is one entry, the active one
58
+ * when it is among them.
59
+ */
60
+ tracks(engine) {
61
+ var _engine$tracks$active, _engine$tracks$active2;
62
+ const active = (_engine$tracks$active = (_engine$tracks$active2 = engine.tracks.active("video")) === null || _engine$tracks$active2 === void 0 ? void 0 : _engine$tracks$active2.id) !== null && _engine$tracks$active !== void 0 ? _engine$tracks$active : null;
63
+ const versions = /* @__PURE__ */ new Map();
64
+ for (const track of engine.tracks.available) {
65
+ if (track.contentType !== "video" || track.role === "trick") continue;
66
+ if (!engine.tracks.selectable(track.id)) continue;
67
+ const key = [
68
+ videoKind(track),
69
+ track.lang,
70
+ track.name
71
+ ].join("|");
72
+ if (versions.get(key) === void 0 || track.id === active) versions.set(key, track);
73
+ }
74
+ const entries = [...versions.values()].map((track) => {
75
+ var _track$name;
76
+ return [
77
+ track.id,
78
+ (_track$name = track.name) !== null && _track$name !== void 0 ? _track$name : this.kindName(videoKind(track)),
79
+ track.lang,
80
+ [],
81
+ []
82
+ ];
83
+ });
84
+ return [entries, entries.some(([id]) => id === active) ? active : null];
85
+ }
86
+ /** The native session's video tracks as entries, and the selected one's. */
87
+ native(tracks) {
88
+ const entries = tracks.map((track, index) => [
89
+ String(index),
90
+ track.label || this.kindName(track.kind),
91
+ track.language,
92
+ [],
93
+ []
94
+ ]);
95
+ const on = tracks.findIndex((track) => track.selected);
96
+ return [entries, on === -1 ? null : String(on)];
97
+ }
98
+ /** The versions at their own URLs as entries, after the ones of the stream. */
99
+ sources(versions) {
100
+ return versions.map((version, index) => {
101
+ var _version$label;
102
+ return [
103
+ `${SOURCE}${index}`,
104
+ (_version$label = version.label) !== null && _version$label !== void 0 ? _version$label : this.kindName(version.kind),
105
+ version.language,
106
+ [],
107
+ []
108
+ ];
109
+ });
110
+ }
111
+ render() {
112
+ super.render();
113
+ const player = this.player;
114
+ if (player === null) {
115
+ this.hidden = true;
116
+ return;
117
+ }
118
+ const engine = this.engine;
119
+ const versions = player.videoSources;
120
+ const playing = player.videoSource;
121
+ const tracks = engine === null ? nativeTracks(player, "videoTracks") : void 0;
122
+ const [own, active] = playing !== null ? [[[
123
+ SOURCE,
124
+ this.kindName("main"),
125
+ void 0,
126
+ [],
127
+ []
128
+ ]], null] : tracks !== void 0 ? this.native(tracks) : engine !== null ? this.tracks(engine) : [[], null];
129
+ const entries = [...own, ...this.sources(versions)];
130
+ const value = playing !== null ? `${SOURCE}${versions.indexOf(playing)}` : active;
131
+ const items = trackNames(entries, this.getAttribute("label-track"));
132
+ this.menu.fill([{
133
+ name: "track",
134
+ items,
135
+ value: value !== null && value !== void 0 ? value : "",
136
+ onSelect: (picked) => {
137
+ if (picked === SOURCE) player.selectVideoSource(null);
138
+ else if (picked.startsWith(SOURCE)) {
139
+ const version = versions[Number(picked.slice(7))];
140
+ if (version !== void 0) player.selectVideoSource(version);
141
+ } else if (tracks !== void 0) {
142
+ const track = tracks[Number(picked)];
143
+ if (track !== void 0) track.selected = true;
144
+ } else engine === null || engine === void 0 || engine.tracks.select(picked);
145
+ this.render();
146
+ }
147
+ }]);
148
+ this.hidden = items.length < 2;
149
+ }
150
+ };
151
+ //#endregion
152
+ export { MbxVideoMenu };
@@ -0,0 +1,7 @@
1
+ import { VIDEO_MENU } from "../tags.js";
2
+ import "../element-entry.js";
3
+ import { MbxVideoMenu } from "../elements/video-menu.js";
4
+ //#region src/entries/video-menu.ts
5
+ if (customElements.get("mbx-video-menu") === void 0) customElements.define(VIDEO_MENU, MbxVideoMenu);
6
+ //#endregion
7
+ export { MbxVideoMenu };
@@ -50,8 +50,10 @@ import { MbxSubtitlesMenu } from "./elements/subtitles-menu.js";
50
50
  import "./entries/subtitles-menu.js";
51
51
  import { MbxTitle } from "./elements/title.js";
52
52
  import "./entries/title.js";
53
+ import { MbxVideoMenu } from "./elements/video-menu.js";
54
+ import "./entries/video-menu.js";
53
55
  import { MbxVolumeSlider } from "./elements/volume-slider.js";
54
56
  import "./entries/volume-slider.js";
55
57
  import { MbxVolume } from "./elements/volume.js";
56
58
  import "./entries/volume.js";
57
- export { MatteboxPlayerElement, MbxAirplayButton, MbxAudioMenu, MbxChaptersMenu, MbxControlBar, MbxCurrentTime, MbxDrmBadge, MbxDuration, MbxErrorScreen, MbxFullscreenButton, MbxLiveButton, MbxMarkerButton, MbxMuteButton, MbxPipButton, MbxPlayButton, MbxQualityMenu, MbxRemainingTime, MbxScanButton, MbxSeekBar, MbxSkipButton, MbxSpacer, MbxSpeedMenu, MbxSpinner, MbxStartButton, MbxSubtitlesMenu, MbxTitle, MbxVolume, MbxVolumeSlider };
59
+ export { MatteboxPlayerElement, MbxAirplayButton, MbxAudioMenu, MbxChaptersMenu, MbxControlBar, MbxCurrentTime, MbxDrmBadge, MbxDuration, MbxErrorScreen, MbxFullscreenButton, MbxLiveButton, MbxMarkerButton, MbxMuteButton, MbxPipButton, MbxPlayButton, MbxQualityMenu, MbxRemainingTime, MbxScanButton, MbxSeekBar, MbxSkipButton, MbxSpacer, MbxSpeedMenu, MbxSpinner, MbxStartButton, MbxSubtitlesMenu, MbxTitle, MbxVideoMenu, MbxVolume, MbxVolumeSlider };
@@ -24,9 +24,10 @@ const LIVE_BUTTON = "mbx-live-button";
24
24
  const SPEED_MENU = "mbx-speed-menu";
25
25
  const QUALITY_MENU = "mbx-quality-menu";
26
26
  const AUDIO_MENU = "mbx-audio-menu";
27
+ const VIDEO_MENU = "mbx-video-menu";
27
28
  const SUBTITLES_MENU = "mbx-subtitles-menu";
28
29
  const DRM_BADGE = "mbx-drm-badge";
29
30
  const VOLUME = "mbx-volume";
30
31
  const CHAPTERS_MENU = "mbx-chapters-menu";
31
32
  //#endregion
32
- export { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, CONTROL_BAR, CURRENT_TIME, DRM_BADGE, DURATION, ERROR_SCREEN, FULLSCREEN_BUTTON, LIVE_BUTTON, MARKER_BUTTON, MUTE_BUTTON, PIP_BUTTON, PLAYER, PLAY_BUTTON, QUALITY_MENU, REMAINING_TIME, SCAN_BUTTON, SEEK_BAR, SKIP_BUTTON, SPACER, SPEED_MENU, SPINNER, START_BUTTON, SUBTITLES_MENU, TITLE, VOLUME, VOLUME_SLIDER };
33
+ export { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, CONTROL_BAR, CURRENT_TIME, DRM_BADGE, DURATION, ERROR_SCREEN, FULLSCREEN_BUTTON, LIVE_BUTTON, MARKER_BUTTON, MUTE_BUTTON, PIP_BUTTON, PLAYER, PLAY_BUTTON, QUALITY_MENU, REMAINING_TIME, SCAN_BUTTON, SEEK_BAR, SKIP_BUTTON, SPACER, SPEED_MENU, SPINNER, START_BUTTON, SUBTITLES_MENU, TITLE, VIDEO_MENU, VOLUME, VOLUME_SLIDER };
@@ -0,0 +1,128 @@
1
+ import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
+ import { isAudioDescription, isSdh } from "mattebox";
3
+ //#region src/video-sources.ts
4
+ /** The child element that declares a version in markup, as `<track>` declares text. */
5
+ const VIDEO_TRACK = "mbx-video-track";
6
+ /** The versions the `<mbx-video-track>` children of `element` declare, in their order. */
7
+ function markupVideoTracks(element) {
8
+ const found = [];
9
+ for (const child of Array.from(element.children)) {
10
+ var _child$getAttribute;
11
+ const url = child.localName === "mbx-video-track" ? child.getAttribute("src") : null;
12
+ if (url === null) continue;
13
+ const type = child.getAttribute("type");
14
+ const label = child.getAttribute("label");
15
+ const language = child.getAttribute("srclang");
16
+ found.push(_objectSpread2(_objectSpread2(_objectSpread2({
17
+ url,
18
+ kind: (_child$getAttribute = child.getAttribute("kind")) !== null && _child$getAttribute !== void 0 ? _child$getAttribute : "alternative"
19
+ }, type === null ? {} : { type }), label === null ? {} : { label }), language === null ? {} : { language }));
20
+ }
21
+ return found;
22
+ }
23
+ /** The source a version loads as. Without EME it brings no DRM, as a source does not. */
24
+ function versionSource(track, eme) {
25
+ return _objectSpread2(_objectSpread2({ url: track.url }, track.type === void 0 ? {} : { type: track.type }), eme && track.drm !== void 0 ? { drm: track.drm } : {});
26
+ }
27
+ /**
28
+ * Puts the new load where the old one was: the same position, and playing
29
+ * when it played. A position on a live source means nothing on another
30
+ * stream's timeline, so `at` is null there and the load joins at its edge.
31
+ * A load that empties the video before its metadata drops the wait.
32
+ */
33
+ function resume(media, at, playing) {
34
+ const go = () => {
35
+ media.removeEventListener("emptied", drop);
36
+ if (at !== null) media.currentTime = at;
37
+ if (playing) media.play().catch(() => void 0);
38
+ };
39
+ const drop = () => {
40
+ media.removeEventListener("loadedmetadata", go);
41
+ };
42
+ if (media.readyState >= 1) {
43
+ go();
44
+ return;
45
+ }
46
+ media.addEventListener("loadedmetadata", go, { once: true });
47
+ media.addEventListener("emptied", drop, { once: true });
48
+ }
49
+ function chosen(engine) {
50
+ if (engine === null) return null;
51
+ return {
52
+ audio: engine.tracks.active("audio"),
53
+ text: engine.tracks.active("text")
54
+ };
55
+ }
56
+ /** The same language, and the same audio description or SDH flag. */
57
+ function same(a, b) {
58
+ return a.lang === b.lang && isAudioDescription(a) === isAudioDescription(b) && isSdh(a) === isSdh(b) && a.forced === b.forced;
59
+ }
60
+ /**
61
+ * Selects on `engine` the tracks that match what the viewer had, once its
62
+ * manifest lists them. A track with no match keeps the engine's default.
63
+ */
64
+ function restore(engine, had) {
65
+ if (engine === null || had === null) return;
66
+ const apply = () => {
67
+ const { available } = engine.tracks;
68
+ for (const [contentType, track] of [["audio", had.audio], ["text", had.text]]) {
69
+ if (track === null) {
70
+ if (contentType === "text") engine.tracks.deselect("text");
71
+ continue;
72
+ }
73
+ const match = available.find((t) => t.contentType === contentType && engine.tracks.selectable(t.id) && same(t, track));
74
+ if (match !== void 0) engine.tracks.select(match.id);
75
+ }
76
+ };
77
+ if (engine.tracks.available.length > 0) {
78
+ apply();
79
+ return;
80
+ }
81
+ const off = engine.on("tracks:changed", () => {
82
+ off();
83
+ apply();
84
+ });
85
+ }
86
+ /**
87
+ * Shows the frame on screen as the poster of `media` while the next load has
88
+ * none: a new load empties the video, which then shows its poster, so the
89
+ * picture would flash to the poster and back. Returns the function that puts
90
+ * the poster back, or null when there is no frame to hold or the canvas
91
+ * cannot export it, as for a video from another origin without CORS.
92
+ */
93
+ function holdFrame(media) {
94
+ if (media.readyState < 2 || media.videoWidth === 0) return null;
95
+ const canvas = document.createElement("canvas");
96
+ canvas.width = media.videoWidth;
97
+ canvas.height = media.videoHeight;
98
+ let frame;
99
+ try {
100
+ var _canvas$getContext;
101
+ (_canvas$getContext = canvas.getContext("2d")) === null || _canvas$getContext === void 0 || _canvas$getContext.drawImage(media, 0, 0);
102
+ frame = canvas.toDataURL("image/jpeg", .9);
103
+ } catch (_unused) {
104
+ return null;
105
+ }
106
+ const poster = media.getAttribute("poster");
107
+ media.setAttribute("poster", frame);
108
+ return () => {
109
+ if (media.getAttribute("poster") !== frame) return;
110
+ if (poster === null) media.removeAttribute("poster");
111
+ else media.setAttribute("poster", poster);
112
+ };
113
+ }
114
+ /**
115
+ * Calls `release` once the new load shows a frame where `resume` put it:
116
+ * after the seek to `at`, or on the first frame when it joins a live edge,
117
+ * or when playback starts.
118
+ */
119
+ function onNextFrame(media, at, release) {
120
+ const events = ["playing", at === null ? "loadeddata" : "seeked"];
121
+ const done = () => {
122
+ for (const type of events) media.removeEventListener(type, done);
123
+ release();
124
+ };
125
+ for (const type of events) media.addEventListener(type, done);
126
+ }
127
+ //#endregion
128
+ export { VIDEO_TRACK, chosen, holdFrame, markupVideoTracks, onNextFrame, restore, resume, versionSource };
package/dist/host.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * This is the whole surface a control gets. A control that needs more
9
9
  * has found a gap in the player's public API, and the gap is the bug.
10
10
  */
11
- import type { Player, PlayerError } from '@mattebox/player-core';
11
+ import type { Player, PlayerError, Source, SourceVideoTrack } from '@mattebox/player-core';
12
12
  import type { Mattebox } from 'mattebox';
13
13
  import type { Markers } from './controls/markers.js';
14
14
  export interface PlayerHost extends HTMLElement {
@@ -19,6 +19,15 @@ export interface PlayerHost extends HTMLElement {
19
19
  readonly error: PlayerError | null;
20
20
  /** The ranges the page named: credits to skip, parts that must not play. */
21
21
  readonly markers: Markers;
22
+ /** Loads the sources again, in the order a load reads them. */
23
+ retry(): void;
24
+ /** The other versions of the picture the source names at their own URLs. */
25
+ readonly videoSources: readonly SourceVideoTrack[];
26
+ /** The version of `videoSources` that plays, or null for the source itself. */
27
+ readonly videoSource: SourceVideoTrack | null;
28
+ selectVideoSource(track: SourceVideoTrack | null): void;
29
+ /** Loads another source of the same programme in place, holding the frame and the controls. */
30
+ switchSource(source: Source): void;
22
31
  }
23
32
  /**
24
33
  * The nearest player above `node`, through shadow hosts, or null outside
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE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EAA4E;IAC5E,QAAQ,CAAC,YAAY,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnD,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC9C,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;IACxD,+FAA+F;IAC/F,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AASD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,GAAG,IAAI,CAOzD"}
package/dist/host.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["/**\n * What a control sees of the player it sits in: the video, the engine, the\n * core, and the element itself for its events and attributes. Declared\n * here and not imported from the element, because the element registers\n * the controls and a control that imported the element would close a cycle.\n * `MatteboxPlayerElement` implements it.\n *\n * This is the whole surface a control gets. A control that needs more\n * has found a gap in the player's public API, and the gap is the bug.\n */\nimport type { Player, PlayerError } from '@mattebox/player-core';\nimport type { Mattebox } from 'mattebox';\nimport type { Markers } from './controls/markers.js';\nimport { PLAYER } from './tags.js';\n\nexport interface PlayerHost extends HTMLElement {\n readonly video: HTMLVideoElement;\n readonly engine: Mattebox | null;\n readonly player: Player | null;\n /** The fatal error of the current load, or null: a control attached after the event still sees it. */\n readonly error: PlayerError | null;\n /** The ranges the page named: credits to skip, parts that must not play. */\n readonly markers: Markers;\n}\n\n/** The parent, or the host of the shadow root `node` sits in, or null at the document. */\nfunction above(node: Node): Node | null {\n const parent = node.parentNode;\n if (parent !== null) return parent;\n return node instanceof ShadowRoot ? node.host : null;\n}\n\n/**\n * The nearest player above `node`, through shadow hosts, or null outside\n * one. The element found may not be upgraded yet; the caller waits for the\n * definition before reading it.\n */\nexport function findPlayer(node: Node): HTMLElement | null {\n let current: Node | null = node;\n while (current !== null) {\n if (current instanceof HTMLElement && current.localName === PLAYER) return current;\n current = above(current);\n }\n return null;\n}\n"],"mappings":";;;AA0BA,SAAS,MAAM,MAAyB;CACtC,MAAM,SAAS,KAAK;CACpB,IAAI,WAAW,MAAM,OAAO;CAC5B,OAAO,gBAAgB,aAAa,KAAK,OAAO;AAClD;;;;;;AAOA,SAAgB,WAAW,MAAgC;CACzD,IAAI,UAAuB;CAC3B,OAAO,YAAY,MAAM;EACvB,IAAI,mBAAmB,eAAe,QAAQ,cAAA,mBAAsB,OAAO;EAC3E,UAAU,MAAM,OAAO;CACzB;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["/**\n * What a control sees of the player it sits in: the video, the engine, the\n * core, and the element itself for its events and attributes. Declared\n * here and not imported from the element, because the element registers\n * the controls and a control that imported the element would close a cycle.\n * `MatteboxPlayerElement` implements it.\n *\n * This is the whole surface a control gets. A control that needs more\n * has found a gap in the player's public API, and the gap is the bug.\n */\nimport type { Player, PlayerError, Source, SourceVideoTrack } from '@mattebox/player-core';\nimport type { Mattebox } from 'mattebox';\nimport type { Markers } from './controls/markers.js';\nimport { PLAYER } from './tags.js';\n\nexport interface PlayerHost extends HTMLElement {\n readonly video: HTMLVideoElement;\n readonly engine: Mattebox | null;\n readonly player: Player | null;\n /** The fatal error of the current load, or null: a control attached after the event still sees it. */\n readonly error: PlayerError | null;\n /** The ranges the page named: credits to skip, parts that must not play. */\n readonly markers: Markers;\n /** Loads the sources again, in the order a load reads them. */\n retry(): void;\n /** The other versions of the picture the source names at their own URLs. */\n readonly videoSources: readonly SourceVideoTrack[];\n /** The version of `videoSources` that plays, or null for the source itself. */\n readonly videoSource: SourceVideoTrack | null;\n selectVideoSource(track: SourceVideoTrack | null): void;\n /** Loads another source of the same programme in place, holding the frame and the controls. */\n switchSource(source: Source): void;\n}\n\n/** The parent, or the host of the shadow root `node` sits in, or null at the document. */\nfunction above(node: Node): Node | null {\n const parent = node.parentNode;\n if (parent !== null) return parent;\n return node instanceof ShadowRoot ? node.host : null;\n}\n\n/**\n * The nearest player above `node`, through shadow hosts, or null outside\n * one. The element found may not be upgraded yet; the caller waits for the\n * definition before reading it.\n */\nexport function findPlayer(node: Node): HTMLElement | null {\n let current: Node | null = node;\n while (current !== null) {\n if (current instanceof HTMLElement && current.localName === PLAYER) return current;\n current = above(current);\n }\n return null;\n}\n"],"mappings":";;;AAmCA,SAAS,MAAM,MAAyB;CACtC,MAAM,SAAS,KAAK;CACpB,IAAI,WAAW,MAAM,OAAO;CAC5B,OAAO,gBAAgB,aAAa,KAAK,OAAO;AAClD;;;;;;AAOA,SAAgB,WAAW,MAAgC;CACzD,IAAI,UAAuB;CAC3B,OAAO,YAAY,MAAM;EACvB,IAAI,mBAAmB,eAAe,QAAQ,cAAA,mBAAsB,OAAO;EAC3E,UAAU,MAAM,OAAO;CACzB;CACA,OAAO;AACT"}
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ import type { MbxSpinner } from './entries/spinner.js';
30
30
  import type { MbxStartButton } from './entries/start-button.js';
31
31
  import type { MbxSubtitlesMenu } from './entries/subtitles-menu.js';
32
32
  import type { MbxTitle } from './entries/title.js';
33
+ import type { MbxVideoMenu } from './entries/video-menu.js';
33
34
  import type { MbxVolume } from './entries/volume.js';
34
35
  import type { MbxVolumeSlider } from './entries/volume-slider.js';
35
36
  export type { Marker, Markers } from './controls/markers.js';
@@ -60,6 +61,7 @@ export { MbxSpinner } from './entries/spinner.js';
60
61
  export { MbxStartButton } from './entries/start-button.js';
61
62
  export { MbxSubtitlesMenu } from './entries/subtitles-menu.js';
62
63
  export { MbxTitle } from './entries/title.js';
64
+ export { MbxVideoMenu } from './entries/video-menu.js';
63
65
  export { MbxVolume } from './entries/volume.js';
64
66
  export { MbxVolumeSlider } from './entries/volume-slider.js';
65
67
  export type { PlayerHost } from './host.js';
@@ -90,6 +92,7 @@ declare global {
90
92
  'mbx-quality-menu': MbxQualityMenu;
91
93
  'mbx-airplay-button': MbxAirplayButton;
92
94
  'mbx-audio-menu': MbxAudioMenu;
95
+ 'mbx-video-menu': MbxVideoMenu;
93
96
  'mbx-subtitles-menu': MbxSubtitlesMenu;
94
97
  'mbx-drm-badge': MbxDrmBadge;
95
98
  'mbx-chapters-menu': MbxChaptersMenu;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B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AAC;QAC/B,kBAAkB,EAAE,cAAc,CAAC;QACnC,oBAAoB,EAAE,gBAAgB,CAAC;QACvC,gBAAgB,EAAE,YAAY,CAAC;QAC/B,gBAAgB,EAAE,YAAY,CAAC;QAC/B,oBAAoB,EAAE,gBAAgB,CAAC;QACvC,eAAe,EAAE,WAAW,CAAC;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
package/dist/index.js CHANGED
@@ -50,8 +50,10 @@ import { MbxSubtitlesMenu } from "./elements/subtitles-menu.js";
50
50
  import "./entries/subtitles-menu.js";
51
51
  import { MbxTitle } from "./elements/title.js";
52
52
  import "./entries/title.js";
53
+ import { MbxVideoMenu } from "./elements/video-menu.js";
54
+ import "./entries/video-menu.js";
53
55
  import { MbxVolumeSlider } from "./elements/volume-slider.js";
54
56
  import "./entries/volume-slider.js";
55
57
  import { MbxVolume } from "./elements/volume.js";
56
58
  import "./entries/volume.js";
57
- export { MatteboxPlayerElement, MbxAirplayButton, MbxAudioMenu, MbxChaptersMenu, MbxControlBar, MbxCurrentTime, MbxDrmBadge, MbxDuration, MbxErrorScreen, MbxFullscreenButton, MbxLiveButton, MbxMarkerButton, MbxMuteButton, MbxPipButton, MbxPlayButton, MbxQualityMenu, MbxRemainingTime, MbxScanButton, MbxSeekBar, MbxSkipButton, MbxSpacer, MbxSpeedMenu, MbxSpinner, MbxStartButton, MbxSubtitlesMenu, MbxTitle, MbxVolume, MbxVolumeSlider };
59
+ export { MatteboxPlayerElement, MbxAirplayButton, MbxAudioMenu, MbxChaptersMenu, MbxControlBar, MbxCurrentTime, MbxDrmBadge, MbxDuration, MbxErrorScreen, MbxFullscreenButton, MbxLiveButton, MbxMarkerButton, MbxMuteButton, MbxPipButton, MbxPlayButton, MbxQualityMenu, MbxRemainingTime, MbxScanButton, MbxSeekBar, MbxSkipButton, MbxSpacer, MbxSpeedMenu, MbxSpinner, MbxStartButton, MbxSubtitlesMenu, MbxTitle, MbxVideoMenu, MbxVolume, MbxVolumeSlider };
package/dist/tags.d.ts CHANGED
@@ -23,6 +23,7 @@ export declare const LIVE_BUTTON = "mbx-live-button";
23
23
  export declare const SPEED_MENU = "mbx-speed-menu";
24
24
  export declare const QUALITY_MENU = "mbx-quality-menu";
25
25
  export declare const AUDIO_MENU = "mbx-audio-menu";
26
+ export declare const VIDEO_MENU = "mbx-video-menu";
26
27
  export declare const SUBTITLES_MENU = "mbx-subtitles-menu";
27
28
  export declare const DRM_BADGE = "mbx-drm-badge";
28
29
  export declare const VOLUME = "mbx-volume";
@@ -1 +1 @@
1
- {"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../src/tags.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,eAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,MAAM,eAAe,CAAC;AACnC,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,cAAc,uBAAuB,CAAC;AACnD,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AACzD,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,OAAO,gBAAgB,CAAC;AACrC,eAAO,MAAM,KAAK,cAAc,CAAC;AACjC,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,QAAQ,iBAAiB,CAAC;AACvC,eAAO,MAAM,cAAc,uBAAuB,CAAC;AACnD,eAAO,MAAM,QAAQ,iBAAiB,CAAC;AACvC,eAAO,MAAM,WAAW,oBA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,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,cAAc,uBAAuB,CAAC;AACnD,eAAO,MAAM,SAAS,kBAAkB,CAAC;AACzC,eAAO,MAAM,MAAM,eAAe,CAAC;AACnC,eAAO,MAAM,aAAa,sBAAsB,CAAC"}
package/dist/tags.js CHANGED
@@ -24,11 +24,12 @@ const LIVE_BUTTON = "mbx-live-button";
24
24
  const SPEED_MENU = "mbx-speed-menu";
25
25
  const QUALITY_MENU = "mbx-quality-menu";
26
26
  const AUDIO_MENU = "mbx-audio-menu";
27
+ const VIDEO_MENU = "mbx-video-menu";
27
28
  const SUBTITLES_MENU = "mbx-subtitles-menu";
28
29
  const DRM_BADGE = "mbx-drm-badge";
29
30
  const VOLUME = "mbx-volume";
30
31
  const CHAPTERS_MENU = "mbx-chapters-menu";
31
32
  //#endregion
32
- export { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, CONTROL_BAR, CURRENT_TIME, DRM_BADGE, DURATION, ERROR_SCREEN, FULLSCREEN_BUTTON, LIVE_BUTTON, MARKER_BUTTON, MUTE_BUTTON, PIP_BUTTON, PLAYER, PLAY_BUTTON, QUALITY_MENU, REMAINING_TIME, SCAN_BUTTON, SEEK_BAR, SKIP_BUTTON, SPACER, SPEED_MENU, SPINNER, START_BUTTON, SUBTITLES_MENU, TITLE, VOLUME, VOLUME_SLIDER };
33
+ export { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, CONTROL_BAR, CURRENT_TIME, DRM_BADGE, DURATION, ERROR_SCREEN, FULLSCREEN_BUTTON, LIVE_BUTTON, MARKER_BUTTON, MUTE_BUTTON, PIP_BUTTON, PLAYER, PLAY_BUTTON, QUALITY_MENU, REMAINING_TIME, SCAN_BUTTON, SEEK_BAR, SKIP_BUTTON, SPACER, SPEED_MENU, SPINNER, START_BUTTON, SUBTITLES_MENU, TITLE, VIDEO_MENU, VOLUME, VOLUME_SLIDER };
33
34
 
34
35
  //# sourceMappingURL=tags.js.map
package/dist/tags.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tags.js","names":[],"sources":["../src/tags.ts"],"sourcesContent":["/** The tag names, in one place, so the composition and the lookup agree with the registration. */\nexport const PLAYER = 'mattebox-player';\nexport const CONTROL_BAR = 'mbx-control-bar';\nexport const SPACER = 'mbx-spacer';\nexport const PLAY_BUTTON = 'mbx-play-button';\nexport const MUTE_BUTTON = 'mbx-mute-button';\nexport const VOLUME_SLIDER = 'mbx-volume-slider';\nexport const SKIP_BUTTON = 'mbx-skip-button';\nexport const SCAN_BUTTON = 'mbx-scan-button';\nexport const PIP_BUTTON = 'mbx-pip-button';\nexport const AIRPLAY_BUTTON = 'mbx-airplay-button';\nexport const FULLSCREEN_BUTTON = 'mbx-fullscreen-button';\nexport const START_BUTTON = 'mbx-start-button';\nexport const MARKER_BUTTON = 'mbx-marker-button';\nexport const ERROR_SCREEN = 'mbx-error-screen';\nexport const SPINNER = 'mbx-spinner';\nexport const TITLE = 'mbx-title';\nexport const CURRENT_TIME = 'mbx-current-time';\nexport const DURATION = 'mbx-duration';\nexport const REMAINING_TIME = 'mbx-remaining-time';\nexport const SEEK_BAR = 'mbx-seek-bar';\nexport const LIVE_BUTTON = 'mbx-live-button';\nexport const SPEED_MENU = 'mbx-speed-menu';\nexport const QUALITY_MENU = 'mbx-quality-menu';\nexport const AUDIO_MENU = 'mbx-audio-menu';\nexport const SUBTITLES_MENU = 'mbx-subtitles-menu';\nexport const DRM_BADGE = 'mbx-drm-badge';\nexport const VOLUME = 'mbx-volume';\nexport const CHAPTERS_MENU = 'mbx-chapters-menu';\n"],"mappings":";;AACA,MAAa,SAAS;AACtB,MAAa,cAAc;AAC3B,MAAa,SAAS;AACtB,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,gBAAgB;AAC7B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;AACjC,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAC7B,MAAa,eAAe;AAC5B,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,eAAe;AAC5B,MAAa,WAAW;AACxB,MAAa,iBAAiB;AAC9B,MAAa,WAAW;AACxB,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,eAAe;AAC5B,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,YAAY;AACzB,MAAa,SAAS;AACtB,MAAa,gBAAgB"}
1
+ {"version":3,"file":"tags.js","names":[],"sources":["../src/tags.ts"],"sourcesContent":["/** The tag names, in one place, so the composition and the lookup agree with the registration. */\nexport const PLAYER = 'mattebox-player';\nexport const CONTROL_BAR = 'mbx-control-bar';\nexport const SPACER = 'mbx-spacer';\nexport const PLAY_BUTTON = 'mbx-play-button';\nexport const MUTE_BUTTON = 'mbx-mute-button';\nexport const VOLUME_SLIDER = 'mbx-volume-slider';\nexport const SKIP_BUTTON = 'mbx-skip-button';\nexport const SCAN_BUTTON = 'mbx-scan-button';\nexport const PIP_BUTTON = 'mbx-pip-button';\nexport const AIRPLAY_BUTTON = 'mbx-airplay-button';\nexport const FULLSCREEN_BUTTON = 'mbx-fullscreen-button';\nexport const START_BUTTON = 'mbx-start-button';\nexport const MARKER_BUTTON = 'mbx-marker-button';\nexport const ERROR_SCREEN = 'mbx-error-screen';\nexport const SPINNER = 'mbx-spinner';\nexport const TITLE = 'mbx-title';\nexport const CURRENT_TIME = 'mbx-current-time';\nexport const DURATION = 'mbx-duration';\nexport const REMAINING_TIME = 'mbx-remaining-time';\nexport const SEEK_BAR = 'mbx-seek-bar';\nexport const LIVE_BUTTON = 'mbx-live-button';\nexport const SPEED_MENU = 'mbx-speed-menu';\nexport const QUALITY_MENU = 'mbx-quality-menu';\nexport const AUDIO_MENU = 'mbx-audio-menu';\nexport const VIDEO_MENU = 'mbx-video-menu';\nexport const SUBTITLES_MENU = 'mbx-subtitles-menu';\nexport const DRM_BADGE = 'mbx-drm-badge';\nexport const VOLUME = 'mbx-volume';\nexport const CHAPTERS_MENU = 'mbx-chapters-menu';\n"],"mappings":";;AACA,MAAa,SAAS;AACtB,MAAa,cAAc;AAC3B,MAAa,SAAS;AACtB,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,gBAAgB;AAC7B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;AACjC,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAC7B,MAAa,eAAe;AAC5B,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,eAAe;AAC5B,MAAa,WAAW;AACxB,MAAa,iBAAiB;AAC9B,MAAa,WAAW;AACxB,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,eAAe;AAC5B,MAAa,aAAa;AAC1B,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,YAAY;AACzB,MAAa,SAAS;AACtB,MAAa,gBAAgB"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Versions of the picture at their own URLs, such as a sign-language
3
+ * version. A switch is a new load, so the element carries over what the
4
+ * viewer had: the position, the play state, and the audio and subtitle
5
+ * choice. A track inside the manifest needs none of this: the engine
6
+ * switches it in the same session.
7
+ */
8
+ import type { Source, SourceVideoTrack } from '@mattebox/player-core';
9
+ import type { Mattebox, Track } from 'mattebox';
10
+ /** The child element that declares a version in markup, as `<track>` declares text. */
11
+ export declare const VIDEO_TRACK = "mbx-video-track";
12
+ /** The versions the `<mbx-video-track>` children of `element` declare, in their order. */
13
+ export declare function markupVideoTracks(element: Element): SourceVideoTrack[];
14
+ /** The source a version loads as. Without EME it brings no DRM, as a source does not. */
15
+ export declare function versionSource(track: SourceVideoTrack, eme: boolean): Source;
16
+ /**
17
+ * Puts the new load where the old one was: the same position, and playing
18
+ * when it played. A position on a live source means nothing on another
19
+ * stream's timeline, so `at` is null there and the load joins at its edge.
20
+ * A load that empties the video before its metadata drops the wait.
21
+ */
22
+ export declare function resume(media: HTMLMediaElement, at: number | null, playing: boolean): void;
23
+ /** The audio and subtitle tracks a viewer had; text is null when subtitles were off. */
24
+ export interface Chosen {
25
+ readonly audio: Track | null;
26
+ readonly text: Track | null;
27
+ }
28
+ export declare function chosen(engine: Mattebox | null): Chosen | null;
29
+ /**
30
+ * Selects on `engine` the tracks that match what the viewer had, once its
31
+ * manifest lists them. A track with no match keeps the engine's default.
32
+ */
33
+ export declare function restore(engine: Mattebox | null, had: Chosen | null): void;
34
+ /**
35
+ * Shows the frame on screen as the poster of `media` while the next load has
36
+ * none: a new load empties the video, which then shows its poster, so the
37
+ * picture would flash to the poster and back. Returns the function that puts
38
+ * the poster back, or null when there is no frame to hold or the canvas
39
+ * cannot export it, as for a video from another origin without CORS.
40
+ */
41
+ export declare function holdFrame(media: HTMLVideoElement): (() => void) | null;
42
+ /**
43
+ * Calls `release` once the new load shows a frame where `resume` put it:
44
+ * after the seek to `at`, or on the first frame when it joins a live edge,
45
+ * or when playback starts.
46
+ */
47
+ export declare function onNextFrame(media: HTMLMediaElement, at: number | null, release: () => void): void;
48
+ //# sourceMappingURL=video-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-sources.d.ts","sourceRoot":"","sources":["../src/video-sources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGhD,uFAAuF;AACvF,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAE7C,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAiBt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