var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; // ../../node_modules/player.style/node_modules/media-chrome/dist/constants.js var MediaUIEvents = { MEDIA_PLAY_REQUEST: "mediaplayrequest", MEDIA_PAUSE_REQUEST: "mediapauserequest", MEDIA_MUTE_REQUEST: "mediamuterequest", MEDIA_UNMUTE_REQUEST: "mediaunmuterequest", MEDIA_VOLUME_REQUEST: "mediavolumerequest", MEDIA_SEEK_REQUEST: "mediaseekrequest", MEDIA_AIRPLAY_REQUEST: "mediaairplayrequest", MEDIA_ENTER_FULLSCREEN_REQUEST: "mediaenterfullscreenrequest", MEDIA_EXIT_FULLSCREEN_REQUEST: "mediaexitfullscreenrequest", MEDIA_PREVIEW_REQUEST: "mediapreviewrequest", MEDIA_ENTER_PIP_REQUEST: "mediaenterpiprequest", MEDIA_EXIT_PIP_REQUEST: "mediaexitpiprequest", MEDIA_ENTER_CAST_REQUEST: "mediaentercastrequest", MEDIA_EXIT_CAST_REQUEST: "mediaexitcastrequest", MEDIA_SHOW_TEXT_TRACKS_REQUEST: "mediashowtexttracksrequest", MEDIA_HIDE_TEXT_TRACKS_REQUEST: "mediahidetexttracksrequest", MEDIA_SHOW_SUBTITLES_REQUEST: "mediashowsubtitlesrequest", MEDIA_DISABLE_SUBTITLES_REQUEST: "mediadisablesubtitlesrequest", MEDIA_TOGGLE_SUBTITLES_REQUEST: "mediatogglesubtitlesrequest", MEDIA_PLAYBACK_RATE_REQUEST: "mediaplaybackraterequest", MEDIA_RENDITION_REQUEST: "mediarenditionrequest", MEDIA_AUDIO_TRACK_REQUEST: "mediaaudiotrackrequest", MEDIA_SEEK_TO_LIVE_REQUEST: "mediaseektoliverequest", REGISTER_MEDIA_STATE_RECEIVER: "registermediastatereceiver", UNREGISTER_MEDIA_STATE_RECEIVER: "unregistermediastatereceiver" }; var MediaStateReceiverAttributes = { MEDIA_CHROME_ATTRIBUTES: "mediachromeattributes", MEDIA_CONTROLLER: "mediacontroller" }; var MediaUIProps = { MEDIA_AIRPLAY_UNAVAILABLE: "mediaAirplayUnavailable", MEDIA_FULLSCREEN_UNAVAILABLE: "mediaFullscreenUnavailable", MEDIA_PIP_UNAVAILABLE: "mediaPipUnavailable", MEDIA_CAST_UNAVAILABLE: "mediaCastUnavailable", MEDIA_RENDITION_UNAVAILABLE: "mediaRenditionUnavailable", MEDIA_AUDIO_TRACK_UNAVAILABLE: "mediaAudioTrackUnavailable", MEDIA_PAUSED: "mediaPaused", MEDIA_HAS_PLAYED: "mediaHasPlayed", MEDIA_ENDED: "mediaEnded", MEDIA_MUTED: "mediaMuted", MEDIA_VOLUME_LEVEL: "mediaVolumeLevel", MEDIA_VOLUME: "mediaVolume", MEDIA_VOLUME_UNAVAILABLE: "mediaVolumeUnavailable", MEDIA_IS_PIP: "mediaIsPip", MEDIA_IS_CASTING: "mediaIsCasting", MEDIA_IS_AIRPLAYING: "mediaIsAirplaying", MEDIA_SUBTITLES_LIST: "mediaSubtitlesList", MEDIA_SUBTITLES_SHOWING: "mediaSubtitlesShowing", MEDIA_IS_FULLSCREEN: "mediaIsFullscreen", MEDIA_PLAYBACK_RATE: "mediaPlaybackRate", MEDIA_CURRENT_TIME: "mediaCurrentTime", MEDIA_DURATION: "mediaDuration", MEDIA_SEEKABLE: "mediaSeekable", MEDIA_PREVIEW_TIME: "mediaPreviewTime", MEDIA_PREVIEW_IMAGE: "mediaPreviewImage", MEDIA_PREVIEW_COORDS: "mediaPreviewCoords", MEDIA_PREVIEW_CHAPTER: "mediaPreviewChapter", MEDIA_LOADING: "mediaLoading", MEDIA_BUFFERED: "mediaBuffered", MEDIA_STREAM_TYPE: "mediaStreamType", MEDIA_TARGET_LIVE_WINDOW: "mediaTargetLiveWindow", MEDIA_TIME_IS_LIVE: "mediaTimeIsLive", MEDIA_RENDITION_LIST: "mediaRenditionList", MEDIA_RENDITION_SELECTED: "mediaRenditionSelected", MEDIA_AUDIO_TRACK_LIST: "mediaAudioTrackList", MEDIA_AUDIO_TRACK_ENABLED: "mediaAudioTrackEnabled", MEDIA_CHAPTERS_CUES: "mediaChaptersCues" }; var MediaUIPropsEntries = Object.entries( MediaUIProps ); var MediaUIAttributes = MediaUIPropsEntries.reduce( (dictObj, [key, propName]) => { dictObj[key] = propName.toLowerCase(); return dictObj; }, {} ); var AdditionalStateChangeEvents = { USER_INACTIVE: "userinactivechange", BREAKPOINTS_CHANGE: "breakpointchange", BREAKPOINTS_COMPUTED: "breakpointscomputed" }; var MediaStateChangeEvents = MediaUIPropsEntries.reduce( (dictObj, [key, propName]) => { dictObj[key] = propName.toLowerCase(); return dictObj; }, { ...AdditionalStateChangeEvents } ); var StateChangeEventToAttributeMap = Object.entries( MediaStateChangeEvents ).reduce( (mapObj, [key, eventType]) => { const attrName = MediaUIAttributes[key]; if (attrName) { mapObj[eventType] = attrName; } return mapObj; }, { userinactivechange: "userinactive" } ); var AttributeToStateChangeEventMap = Object.entries( MediaUIAttributes ).reduce( (mapObj, [key, attrName]) => { const evtType = MediaStateChangeEvents[key]; if (evtType) { mapObj[attrName] = evtType; } return mapObj; }, { userinactive: "userinactivechange" } ); var TextTrackKinds = { SUBTITLES: "subtitles", CAPTIONS: "captions", DESCRIPTIONS: "descriptions", CHAPTERS: "chapters", METADATA: "metadata" }; var TextTrackModes = { DISABLED: "disabled", HIDDEN: "hidden", SHOWING: "showing" }; var PointerTypes = { MOUSE: "mouse", PEN: "pen", TOUCH: "touch" }; var AvailabilityStates = { UNAVAILABLE: "unavailable", UNSUPPORTED: "unsupported" }; var StreamTypes = { LIVE: "live", ON_DEMAND: "on-demand", UNKNOWN: "unknown" }; var WebkitPresentationModes = { INLINE: "inline", FULLSCREEN: "fullscreen", PICTURE_IN_PICTURE: "picture-in-picture" }; // ../../node_modules/player.style/node_modules/media-chrome/dist/labels/labels.js var tooltipLabels = { ENTER_AIRPLAY: "Start airplay", EXIT_AIRPLAY: "Stop airplay", AUDIO_TRACK_MENU: "Audio", CAPTIONS: "Captions", ENABLE_CAPTIONS: "Enable captions", DISABLE_CAPTIONS: "Disable captions", START_CAST: "Start casting", STOP_CAST: "Stop casting", ENTER_FULLSCREEN: "Enter fullscreen mode", EXIT_FULLSCREEN: "Exit fullscreen mode", MUTE: "Mute", UNMUTE: "Unmute", ENTER_PIP: "Enter picture in picture mode", EXIT_PIP: "Enter picture in picture mode", PLAY: "Play", PAUSE: "Pause", PLAYBACK_RATE: "Playback rate", RENDITIONS: "Quality", SEEK_BACKWARD: "Seek backward", SEEK_FORWARD: "Seek forward", SETTINGS: "Settings" }; var nouns = { AUDIO_PLAYER: () => "audio player", VIDEO_PLAYER: () => "video player", VOLUME: () => "volume", SEEK: () => "seek", CLOSED_CAPTIONS: () => "closed captions", PLAYBACK_RATE: ({ playbackRate = 1 } = {}) => `current playback rate ${playbackRate}`, PLAYBACK_TIME: () => `playback time`, MEDIA_LOADING: () => `media loading`, SETTINGS: () => `settings`, AUDIO_TRACKS: () => `audio tracks`, QUALITY: () => `quality` }; var verbs = { PLAY: () => "play", PAUSE: () => "pause", MUTE: () => "mute", UNMUTE: () => "unmute", ENTER_AIRPLAY: () => "start airplay", EXIT_AIRPLAY: () => "stop airplay", ENTER_CAST: () => "start casting", EXIT_CAST: () => "stop casting", ENTER_FULLSCREEN: () => "enter fullscreen mode", EXIT_FULLSCREEN: () => "exit fullscreen mode", ENTER_PIP: () => "enter picture in picture mode", EXIT_PIP: () => "exit picture in picture mode", SEEK_FORWARD_N_SECS: ({ seekOffset = 30 } = {}) => `seek forward ${seekOffset} seconds`, SEEK_BACK_N_SECS: ({ seekOffset = 30 } = {}) => `seek back ${seekOffset} seconds`, SEEK_LIVE: () => "seek to live", PLAYING_LIVE: () => "playing live" }; var labels_default = { ...nouns, ...verbs }; // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/utils.js function stringifyRenditionList(renditions) { return renditions == null ? void 0 : renditions.map(stringifyRendition).join(" "); } function parseRenditionList(renditions) { return renditions == null ? void 0 : renditions.split(/\s+/).map(parseRendition); } function stringifyRendition(rendition) { if (rendition) { const { id, width, height } = rendition; return [id, width, height].filter((a) => a != null).join(":"); } } function parseRendition(rendition) { if (rendition) { const [id, width, height] = rendition.split(":"); return { id, width: +width, height: +height }; } } function stringifyAudioTrackList(audioTracks) { return audioTracks == null ? void 0 : audioTracks.map(stringifyAudioTrack).join(" "); } function parseAudioTrackList(audioTracks) { return audioTracks == null ? void 0 : audioTracks.split(/\s+/).map(parseAudioTrack); } function stringifyAudioTrack(audioTrack) { if (audioTrack) { const { id, kind, language, label } = audioTrack; return [id, kind, language, label].filter((a) => a != null).join(":"); } } function parseAudioTrack(audioTrack) { if (audioTrack) { const [id, kind, language, label] = audioTrack.split(":"); return { id, kind, language, label }; } } function camelCase(name) { return name.replace(/[-_]([a-z])/g, ($0, $1) => $1.toUpperCase()); } function isValidNumber(x) { return typeof x === "number" && !Number.isNaN(x) && Number.isFinite(x); } function isNumericString(str) { if (typeof str != "string") return false; return !isNaN(str) && !isNaN(parseFloat(str)); } var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/time.js var UnitLabels = [ { singular: "hour", plural: "hours" }, { singular: "minute", plural: "minutes" }, { singular: "second", plural: "seconds" } ]; var toTimeUnitPhrase = (timeUnitValue, unitIndex) => { const unitLabel = timeUnitValue === 1 ? UnitLabels[unitIndex].singular : UnitLabels[unitIndex].plural; return `${timeUnitValue} ${unitLabel}`; }; var formatAsTimePhrase = (seconds) => { if (!isValidNumber(seconds)) return ""; const positiveSeconds = Math.abs(seconds); const negative = positiveSeconds !== seconds; const secondsDateTime = new Date(0, 0, 0, 0, 0, positiveSeconds, 0); const timeParts = [ secondsDateTime.getHours(), secondsDateTime.getMinutes(), secondsDateTime.getSeconds() ]; const timeString = timeParts.map( (timeUnitValue, index) => timeUnitValue && toTimeUnitPhrase(timeUnitValue, index) ).filter((x) => x).join(", "); const negativeSuffix = negative ? " remaining" : ""; return `${timeString}${negativeSuffix}`; }; function formatTime(seconds, guide) { let negative = false; if (seconds < 0) { negative = true; seconds = 0 - seconds; } seconds = seconds < 0 ? 0 : seconds; let s = Math.floor(seconds % 60); let m = Math.floor(seconds / 60 % 60); let h = Math.floor(seconds / 3600); const gm = Math.floor(guide / 60 % 60); const gh = Math.floor(guide / 3600); if (isNaN(seconds) || seconds === Infinity) { h = m = s = "0"; } h = h > 0 || gh > 0 ? h + ":" : ""; m = ((h || gm >= 10) && m < 10 ? "0" + m : m) + ":"; s = s < 10 ? "0" + s : s; return (negative ? "-" : "") + h + m + s; } var emptyTimeRanges = Object.freeze({ length: 0, start(index) { const unsignedIdx = index >>> 0; if (unsignedIdx >= this.length) { throw new DOMException( `Failed to execute 'start' on 'TimeRanges': The index provided (${unsignedIdx}) is greater than or equal to the maximum bound (${this.length}).` ); } return 0; }, end(index) { const unsignedIdx = index >>> 0; if (unsignedIdx >= this.length) { throw new DOMException( `Failed to execute 'end' on 'TimeRanges': The index provided (${unsignedIdx}) is greater than or equal to the maximum bound (${this.length}).` ); } return 0; } }); // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/server-safe-globals.js var EventTarget = class { addEventListener() { } removeEventListener() { } dispatchEvent() { return true; } }; var Node = class extends EventTarget { }; var Element = class extends Node { constructor() { super(...arguments); this.role = null; } }; var ResizeObserver = class { observe() { } unobserve() { } disconnect() { } }; var documentShim = { createElement: function() { return new globalThisShim.HTMLElement(); }, createElementNS: function() { return new globalThisShim.HTMLElement(); }, addEventListener() { }, removeEventListener() { }, /** * * @param {Event} event * @returns {boolean} */ dispatchEvent(event) { return false; } }; var globalThisShim = { ResizeObserver, document: documentShim, Node, Element, HTMLElement: class HTMLElement extends Element { constructor() { super(...arguments); this.innerHTML = ""; } get content() { return new globalThisShim.DocumentFragment(); } }, DocumentFragment: class DocumentFragment extends EventTarget { }, customElements: { get: function() { }, define: function() { }, whenDefined: function() { } }, localStorage: { /** * @param {string} key * @returns {string|null} */ getItem(key) { return null; }, /** * @param {string} key * @param {string} value */ setItem(key, value) { }, // eslint-disable-line @typescript-eslint/no-unused-vars /** * @param {string} key */ removeItem(key) { } // eslint-disable-line @typescript-eslint/no-unused-vars }, CustomEvent: function CustomEvent2() { }, getComputedStyle: function() { }, navigator: { languages: [], get userAgent() { return ""; } }, /** * @param {string} media */ matchMedia(media) { return { matches: false, media }; } }; var isServer = typeof window === "undefined" || typeof window.customElements === "undefined"; var isShimmed = Object.keys(globalThisShim).every((key) => key in globalThis); var GlobalThis = isServer && !isShimmed ? globalThisShim : globalThis; var Document2 = isServer && !isShimmed ? documentShim : globalThis.document; // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/resize-observer.js var callbacksMap = /* @__PURE__ */ new WeakMap(); var getCallbacks = (element) => { let callbacks = callbacksMap.get(element); if (!callbacks) callbacksMap.set(element, callbacks = /* @__PURE__ */ new Set()); return callbacks; }; var observer = new GlobalThis.ResizeObserver( (entries) => { for (const entry of entries) { for (const callback of getCallbacks(entry.target)) { callback(entry); } } } ); function observeResize(element, callback) { getCallbacks(element).add(callback); observer.observe(element); } function unobserveResize(element, callback) { const callbacks = getCallbacks(element); callbacks.delete(callback); if (!callbacks.size) { observer.unobserve(element); } } // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/element-utils.js function getMediaController(host) { var _a3; return (_a3 = getAttributeMediaController(host)) != null ? _a3 : closestComposedNode(host, "media-controller"); } function getAttributeMediaController(host) { var _a3; const { MEDIA_CONTROLLER } = MediaStateReceiverAttributes; const mediaControllerId = host.getAttribute(MEDIA_CONTROLLER); if (mediaControllerId) { return (_a3 = getDocumentOrShadowRoot(host)) == null ? void 0 : _a3.getElementById( mediaControllerId ); } } var updateIconText = (svg, value, selector = ".value") => { const node = svg.querySelector(selector); if (!node) return; node.textContent = value; }; var getAllSlotted = (el, name) => { const slotSelector = `slot[name="${name}"]`; const slot = el.shadowRoot.querySelector(slotSelector); if (!slot) return []; return slot.children; }; var getSlotted = (el, name) => getAllSlotted(el, name)[0]; var containsComposedNode = (rootNode, childNode) => { if (!rootNode || !childNode) return false; if (rootNode == null ? void 0 : rootNode.contains(childNode)) return true; return containsComposedNode( rootNode, childNode.getRootNode().host ); }; var closestComposedNode = (childNode, selector) => { if (!childNode) return null; const closest = childNode.closest(selector); if (closest) return closest; return closestComposedNode( childNode.getRootNode().host, selector ); }; function getActiveElement(root = document) { var _a3; const activeEl = root == null ? void 0 : root.activeElement; if (!activeEl) return null; return (_a3 = getActiveElement(activeEl.shadowRoot)) != null ? _a3 : activeEl; } function getDocumentOrShadowRoot(node) { var _a3; const rootNode = (_a3 = node == null ? void 0 : node.getRootNode) == null ? void 0 : _a3.call(node); if (rootNode instanceof ShadowRoot || rootNode instanceof Document) { return rootNode; } return null; } function isElementVisible(element, depth = 3) { if (element.checkVisibility) { return element.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true }); } let el = element; while (el && depth > 0) { const style = getComputedStyle(el); if (style.opacity === "0" || style.visibility === "hidden" || style.display === "none") { return false; } el = el.parentElement; depth--; } return true; } function getPointProgressOnLine(x, y, p1, p2) { const segment = distance(p1, p2); const toStart = distance(p1, { x, y }); const toEnd = distance(p2, { x, y }); if (toStart > segment || toEnd > segment) { return toStart > toEnd ? 1 : 0; } return toStart / segment; } function distance(p1, p2) { return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); } function getOrInsertCSSRule(styleParent, selectorText) { const cssRule = getCSSRule(styleParent, (st) => st === selectorText); if (cssRule) return cssRule; return insertCSSRule(styleParent, selectorText); } function getCSSRule(styleParent, predicate) { var _a3; let style; for (style of styleParent.querySelectorAll("style")) { let cssRules; try { cssRules = (_a3 = style.sheet) == null ? void 0 : _a3.cssRules; } catch { continue; } for (const rule of cssRules != null ? cssRules : []) { if (predicate(rule.selectorText)) return rule; } } } function insertCSSRule(styleParent, selectorText) { var _a3, _b2; const styles = (_a3 = styleParent.querySelectorAll("style")) != null ? _a3 : []; const style = styles == null ? void 0 : styles[styles.length - 1]; if (!(style == null ? void 0 : style.sheet)) { console.warn( "Media Chrome: No style sheet found on style tag of", styleParent ); return { // @ts-ignore style: { setProperty: () => { }, removeProperty: () => "", getPropertyValue: () => "" } }; } style == null ? void 0 : style.sheet.insertRule(`${selectorText}{}`, style.sheet.cssRules.length); return ( /** @type {CSSStyleRule} */ (_b2 = style.sheet.cssRules) == null ? void 0 : _b2[style.sheet.cssRules.length - 1] ); } function getNumericAttr(el, attrName, defaultValue = Number.NaN) { const attrVal = el.getAttribute(attrName); return attrVal != null ? +attrVal : defaultValue; } function setNumericAttr(el, attrName, value) { const nextNumericValue = +value; if (value == null || Number.isNaN(nextNumericValue)) { if (el.hasAttribute(attrName)) { el.removeAttribute(attrName); } return; } if (getNumericAttr(el, attrName, void 0) === nextNumericValue) return; el.setAttribute(attrName, `${nextNumericValue}`); } function getBooleanAttr(el, attrName) { return el.hasAttribute(attrName); } function setBooleanAttr(el, attrName, value) { if (value == null) { if (el.hasAttribute(attrName)) { el.removeAttribute(attrName); } return; } if (getBooleanAttr(el, attrName) == value) return; el.toggleAttribute(attrName, value); } function getStringAttr(el, attrName, defaultValue = null) { var _a3; return (_a3 = el.getAttribute(attrName)) != null ? _a3 : defaultValue; } function setStringAttr(el, attrName, value) { if (value == null) { if (el.hasAttribute(attrName)) { el.removeAttribute(attrName); } return; } const nextValue = `${value}`; if (getStringAttr(el, attrName, void 0) === nextValue) return; el.setAttribute(attrName, nextValue); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-gesture-receiver.js var __accessCheck = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet = (obj, member, getter) => { __accessCheck(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet = (obj, member, value, setter) => { __accessCheck(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _mediaController; var template = Document2.createElement("template"); template.innerHTML = /*html*/ ` `; var MediaGestureReceiver = class extends GlobalThis.HTMLElement { constructor(options = {}) { super(); __privateAdd(this, _mediaController, void 0); if (!this.shadowRoot) { const shadow = this.attachShadow({ mode: "open" }); const buttonHTML = template.content.cloneNode(true); this.nativeEl = buttonHTML; let slotTemplate17 = options.slotTemplate; if (!slotTemplate17) { slotTemplate17 = Document2.createElement("template"); slotTemplate17.innerHTML = `${options.defaultContent || ""}`; } this.nativeEl.appendChild(slotTemplate17.content.cloneNode(true)); shadow.appendChild(buttonHTML); } } // NOTE: Currently "baking in" actions + attrs until we come up with // a more robust architecture (CJP) static get observedAttributes() { return [ MediaStateReceiverAttributes.MEDIA_CONTROLLER, MediaUIAttributes.MEDIA_PAUSED ]; } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d, _e; if (attrName === MediaStateReceiverAttributes.MEDIA_CONTROLLER) { if (oldValue) { (_b2 = (_a3 = __privateGet(this, _mediaController)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet(this, _mediaController, null); } if (newValue && this.isConnected) { __privateSet(this, _mediaController, (_c = this.getRootNode()) == null ? void 0 : _c.getElementById(newValue)); (_e = (_d = __privateGet(this, _mediaController)) == null ? void 0 : _d.associateElement) == null ? void 0 : _e.call(_d, this); } } } connectedCallback() { var _a3, _b2, _c, _d; this.tabIndex = -1; this.setAttribute("aria-hidden", "true"); __privateSet(this, _mediaController, getMediaControllerEl(this)); if (this.getAttribute(MediaStateReceiverAttributes.MEDIA_CONTROLLER)) { (_b2 = (_a3 = __privateGet(this, _mediaController)) == null ? void 0 : _a3.associateElement) == null ? void 0 : _b2.call(_a3, this); } (_c = __privateGet(this, _mediaController)) == null ? void 0 : _c.addEventListener("pointerdown", this); (_d = __privateGet(this, _mediaController)) == null ? void 0 : _d.addEventListener("click", this); } disconnectedCallback() { var _a3, _b2, _c, _d; if (this.getAttribute(MediaStateReceiverAttributes.MEDIA_CONTROLLER)) { (_b2 = (_a3 = __privateGet(this, _mediaController)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); } (_c = __privateGet(this, _mediaController)) == null ? void 0 : _c.removeEventListener("pointerdown", this); (_d = __privateGet(this, _mediaController)) == null ? void 0 : _d.removeEventListener("click", this); __privateSet(this, _mediaController, null); } handleEvent(event) { var _a3; const composedTarget = (_a3 = event.composedPath()) == null ? void 0 : _a3[0]; const allowList = ["video", "media-controller"]; if (!allowList.includes(composedTarget == null ? void 0 : composedTarget.localName)) return; if (event.type === "pointerdown") { this._pointerType = event.pointerType; } else if (event.type === "click") { const { clientX, clientY } = event; const { left, top, width, height } = this.getBoundingClientRect(); const x = clientX - left; const y = clientY - top; if (x < 0 || y < 0 || x > width || y > height || // In case this element has no dimensions (or display: none) return. width === 0 && height === 0) { return; } const { pointerType = this._pointerType } = event; this._pointerType = void 0; if (pointerType === PointerTypes.TOUCH) { this.handleTap(event); return; } else if (pointerType === PointerTypes.MOUSE) { this.handleMouseClick(event); return; } } } /** * @type {boolean} Is the media paused */ get mediaPaused() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED); } set mediaPaused(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED, value); } // NOTE: Currently "baking in" actions + attrs until we come up with // a more robust architecture (CJP) /** * @abstract * @argument {Event} e */ handleTap(e) { } // eslint-disable-line // eslint-disable-next-line handleMouseClick(e) { const eventName = this.mediaPaused ? MediaUIEvents.MEDIA_PLAY_REQUEST : MediaUIEvents.MEDIA_PAUSE_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); } }; _mediaController = /* @__PURE__ */ new WeakMap(); function getMediaControllerEl(controlEl) { var _a3; const mediaControllerId = controlEl.getAttribute( MediaStateReceiverAttributes.MEDIA_CONTROLLER ); if (mediaControllerId) { return (_a3 = controlEl.getRootNode()) == null ? void 0 : _a3.getElementById(mediaControllerId); } return closestComposedNode(controlEl, "media-controller"); } if (!GlobalThis.customElements.get("media-gesture-receiver")) { GlobalThis.customElements.define( "media-gesture-receiver", MediaGestureReceiver ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-container.js var __accessCheck2 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet2 = (obj, member, getter) => { __accessCheck2(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd2 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet2 = (obj, member, value, setter) => { __accessCheck2(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod = (obj, member, method) => { __accessCheck2(obj, member, "access private method"); return method; }; var _pointerDownTimeStamp; var _currentMedia; var _inactiveTimeout; var _autohide; var _handlePointerMove; var handlePointerMove_fn; var _handlePointerUp; var handlePointerUp_fn; var _setInactive; var setInactive_fn; var _setActive; var setActive_fn; var _scheduleInactive; var scheduleInactive_fn; var Attributes = { AUDIO: "audio", AUTOHIDE: "autohide", BREAKPOINTS: "breakpoints", GESTURES_DISABLED: "gesturesdisabled", KEYBOARD_CONTROL: "keyboardcontrol", NO_AUTOHIDE: "noautohide", USER_INACTIVE: "userinactive" }; var template2 = Document2.createElement("template"); template2.innerHTML = /*html*/ ` ${/* default, effectively "bottom-chrome" */ ""} `; var MEDIA_UI_ATTRIBUTE_NAMES = Object.values(MediaUIAttributes); var defaultBreakpoints = "sm:384 md:576 lg:768 xl:960"; function resizeCallback(entry) { setBreakpoints(entry.target, entry.contentRect.width); } function setBreakpoints(container, width) { var _a3; if (!container.isConnected) return; const breakpoints = (_a3 = container.getAttribute(Attributes.BREAKPOINTS)) != null ? _a3 : defaultBreakpoints; const ranges = createBreakpointMap(breakpoints); const activeBreakpoints = getBreakpoints(ranges, width); let changed = false; Object.keys(ranges).forEach((name) => { if (activeBreakpoints.includes(name)) { if (!container.hasAttribute(`breakpoint${name}`)) { container.setAttribute(`breakpoint${name}`, ""); changed = true; } return; } if (container.hasAttribute(`breakpoint${name}`)) { container.removeAttribute(`breakpoint${name}`); changed = true; } }); if (changed) { const evt = new CustomEvent(MediaStateChangeEvents.BREAKPOINTS_CHANGE, { detail: activeBreakpoints }); container.dispatchEvent(evt); } } function createBreakpointMap(breakpoints) { const pairs = breakpoints.split(/\s+/); return Object.fromEntries(pairs.map((pair) => pair.split(":"))); } function getBreakpoints(breakpoints, width) { return Object.keys(breakpoints).filter((name) => { return width >= parseInt(breakpoints[name]); }); } var MediaContainer = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd2(this, _handlePointerMove); __privateAdd2(this, _handlePointerUp); __privateAdd2(this, _setInactive); __privateAdd2(this, _setActive); __privateAdd2(this, _scheduleInactive); __privateAdd2(this, _pointerDownTimeStamp, 0); __privateAdd2(this, _currentMedia, null); __privateAdd2(this, _inactiveTimeout, null); __privateAdd2(this, _autohide, void 0); this.breakpointsComputed = false; if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template2.content.cloneNode(true)); } const mutationCallback = (mutationsList) => { const media = this.media; for (const mutation of mutationsList) { if (mutation.type === "childList") { mutation.removedNodes.forEach((node) => { if (node.slot == "media" && mutation.target == this) { let previousSibling = mutation.previousSibling && mutation.previousSibling.previousElementSibling; if (!previousSibling || !media) { this.mediaUnsetCallback(node); } else { let wasFirst = previousSibling.slot !== "media"; while ((previousSibling = previousSibling.previousSibling) !== null) { if (previousSibling.slot == "media") wasFirst = false; } if (wasFirst) this.mediaUnsetCallback(node); } } }); if (media) { mutation.addedNodes.forEach((node) => { if (node === media) { this.handleMediaUpdated(media); } }); } } } }; const mutationObserver = new MutationObserver(mutationCallback); mutationObserver.observe(this, { childList: true, subtree: true }); let pendingResizeCb = false; const deferResizeCallback = (entry) => { if (pendingResizeCb) return; setTimeout(() => { resizeCallback(entry); pendingResizeCb = false; if (!this.breakpointsComputed) { this.breakpointsComputed = true; this.dispatchEvent( new CustomEvent(MediaStateChangeEvents.BREAKPOINTS_COMPUTED, { bubbles: true, composed: true }) ); } }, 0); pendingResizeCb = true; }; observeResize(this, deferResizeCallback); const chainedSlot = this.querySelector( ":scope > slot[slot=media]" ); if (chainedSlot) { chainedSlot.addEventListener("slotchange", () => { const slotEls = chainedSlot.assignedElements({ flatten: true }); if (!slotEls.length) { if (__privateGet2(this, _currentMedia)) { this.mediaUnsetCallback(__privateGet2(this, _currentMedia)); } return; } this.handleMediaUpdated(this.media); }); } } static get observedAttributes() { return [Attributes.AUTOHIDE, Attributes.GESTURES_DISABLED].concat(MEDIA_UI_ATTRIBUTE_NAMES).filter( (name) => ![ MediaUIAttributes.MEDIA_RENDITION_LIST, MediaUIAttributes.MEDIA_AUDIO_TRACK_LIST, MediaUIAttributes.MEDIA_CHAPTERS_CUES ].includes(name) ); } // Could share this code with media-chrome-html-element instead attributeChangedCallback(attrName, oldValue, newValue) { if (attrName.toLowerCase() == Attributes.AUTOHIDE) { this.autohide = newValue; } } // First direct child with slot=media, or null /** * @returns {HTMLVideoElement & * {buffered, * webkitEnterFullscreen?, * webkitExitFullscreen?, * requestCast?, * webkitShowPlaybackTargetPicker?, * videoTracks?, * }} */ get media() { let media = this.querySelector(":scope > [slot=media]"); if ((media == null ? void 0 : media.nodeName) == "SLOT") media = media.assignedElements({ flatten: true })[0]; return media; } /** * @param {HTMLMediaElement} media */ async handleMediaUpdated(media) { if (!media) return; __privateSet2(this, _currentMedia, media); if (media.localName.includes("-")) { await GlobalThis.customElements.whenDefined(media.localName); } this.mediaSetCallback(media); } connectedCallback() { var _a3; const isAudioChrome = this.getAttribute(Attributes.AUDIO) != null; const label = isAudioChrome ? nouns.AUDIO_PLAYER() : nouns.VIDEO_PLAYER(); this.setAttribute("role", "region"); this.setAttribute("aria-label", label); this.handleMediaUpdated(this.media); this.setAttribute(Attributes.USER_INACTIVE, ""); this.addEventListener("pointerdown", this); this.addEventListener("pointermove", this); this.addEventListener("pointerup", this); this.addEventListener("mouseleave", this); this.addEventListener("keyup", this); (_a3 = GlobalThis.window) == null ? void 0 : _a3.addEventListener("mouseup", this); } disconnectedCallback() { var _a3; if (this.media) { this.mediaUnsetCallback(this.media); } (_a3 = GlobalThis.window) == null ? void 0 : _a3.removeEventListener("mouseup", this); } /** * @abstract * @param {HTMLMediaElement} media */ mediaSetCallback(media) { } // eslint-disable-line /** * @param {HTMLMediaElement} media */ mediaUnsetCallback(media) { __privateSet2(this, _currentMedia, null); } handleEvent(event) { switch (event.type) { case "pointerdown": __privateSet2(this, _pointerDownTimeStamp, event.timeStamp); break; case "pointermove": __privateMethod(this, _handlePointerMove, handlePointerMove_fn).call(this, event); break; case "pointerup": __privateMethod(this, _handlePointerUp, handlePointerUp_fn).call(this, event); break; case "mouseleave": __privateMethod(this, _setInactive, setInactive_fn).call(this); break; case "mouseup": this.removeAttribute(Attributes.KEYBOARD_CONTROL); break; case "keyup": __privateMethod(this, _scheduleInactive, scheduleInactive_fn).call(this); this.setAttribute(Attributes.KEYBOARD_CONTROL, ""); break; } } set autohide(seconds) { const parsedSeconds = Number(seconds); __privateSet2(this, _autohide, isNaN(parsedSeconds) ? 0 : parsedSeconds); } get autohide() { return (__privateGet2(this, _autohide) === void 0 ? 2 : __privateGet2(this, _autohide)).toString(); } }; _pointerDownTimeStamp = /* @__PURE__ */ new WeakMap(); _currentMedia = /* @__PURE__ */ new WeakMap(); _inactiveTimeout = /* @__PURE__ */ new WeakMap(); _autohide = /* @__PURE__ */ new WeakMap(); _handlePointerMove = /* @__PURE__ */ new WeakSet(); handlePointerMove_fn = function(event) { if (event.pointerType !== "mouse") { const MAX_TAP_DURATION = 250; if (event.timeStamp - __privateGet2(this, _pointerDownTimeStamp) < MAX_TAP_DURATION) return; } __privateMethod(this, _setActive, setActive_fn).call(this); clearTimeout(__privateGet2(this, _inactiveTimeout)); if ([this, this.media].includes(event.target)) { __privateMethod(this, _scheduleInactive, scheduleInactive_fn).call(this); } }; _handlePointerUp = /* @__PURE__ */ new WeakSet(); handlePointerUp_fn = function(event) { if (event.pointerType === "touch") { const controlsVisible = !this.hasAttribute(Attributes.USER_INACTIVE); if ([this, this.media].includes(event.target) && controlsVisible) { __privateMethod(this, _setInactive, setInactive_fn).call(this); } else { __privateMethod(this, _scheduleInactive, scheduleInactive_fn).call(this); } } else if (event.composedPath().some( (el) => ["media-play-button", "media-fullscreen-button"].includes( el == null ? void 0 : el.localName ) )) { __privateMethod(this, _scheduleInactive, scheduleInactive_fn).call(this); } }; _setInactive = /* @__PURE__ */ new WeakSet(); setInactive_fn = function() { if (__privateGet2(this, _autohide) < 0) return; if (this.hasAttribute(Attributes.USER_INACTIVE)) return; this.setAttribute(Attributes.USER_INACTIVE, ""); const evt = new GlobalThis.CustomEvent( MediaStateChangeEvents.USER_INACTIVE, { composed: true, bubbles: true, detail: true } ); this.dispatchEvent(evt); }; _setActive = /* @__PURE__ */ new WeakSet(); setActive_fn = function() { if (!this.hasAttribute(Attributes.USER_INACTIVE)) return; this.removeAttribute(Attributes.USER_INACTIVE); const evt = new GlobalThis.CustomEvent( MediaStateChangeEvents.USER_INACTIVE, { composed: true, bubbles: true, detail: false } ); this.dispatchEvent(evt); }; _scheduleInactive = /* @__PURE__ */ new WeakSet(); scheduleInactive_fn = function() { __privateMethod(this, _setActive, setActive_fn).call(this); clearTimeout(__privateGet2(this, _inactiveTimeout)); const autohide = parseInt(this.autohide); if (autohide < 0) return; __privateSet2(this, _inactiveTimeout, setTimeout(() => { __privateMethod(this, _setInactive, setInactive_fn).call(this); }, autohide * 1e3)); }; if (!GlobalThis.customElements.get("media-container")) { GlobalThis.customElements.define("media-container", MediaContainer); } // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/attribute-token-list.js var __accessCheck3 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet3 = (obj, member, getter) => { __accessCheck3(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd3 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet3 = (obj, member, value, setter) => { __accessCheck3(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _el; var _attr; var _defaultSet; var _tokenSet; var _tokens; var tokens_get; var AttributeTokenList = class { constructor(el, attr, { defaultValue } = { defaultValue: void 0 }) { __privateAdd3(this, _tokens); __privateAdd3(this, _el, void 0); __privateAdd3(this, _attr, void 0); __privateAdd3(this, _defaultSet, void 0); __privateAdd3(this, _tokenSet, /* @__PURE__ */ new Set()); __privateSet3(this, _el, el); __privateSet3(this, _attr, attr); __privateSet3(this, _defaultSet, new Set(defaultValue)); } [Symbol.iterator]() { return __privateGet3(this, _tokens, tokens_get).values(); } get length() { return __privateGet3(this, _tokens, tokens_get).size; } get value() { var _a3; return (_a3 = [...__privateGet3(this, _tokens, tokens_get)].join(" ")) != null ? _a3 : ""; } set value(val) { var _a3; if (val === this.value) return; __privateSet3(this, _tokenSet, /* @__PURE__ */ new Set()); this.add(...(_a3 = val == null ? void 0 : val.split(" ")) != null ? _a3 : []); } toString() { return this.value; } item(index) { return [...__privateGet3(this, _tokens, tokens_get)][index]; } values() { return __privateGet3(this, _tokens, tokens_get).values(); } forEach(callback, thisArg) { __privateGet3(this, _tokens, tokens_get).forEach(callback, thisArg); } add(...tokens) { var _a3, _b2; tokens.forEach((t) => __privateGet3(this, _tokenSet).add(t)); if (this.value === "" && !((_a3 = __privateGet3(this, _el)) == null ? void 0 : _a3.hasAttribute(`${__privateGet3(this, _attr)}`))) { return; } (_b2 = __privateGet3(this, _el)) == null ? void 0 : _b2.setAttribute(`${__privateGet3(this, _attr)}`, `${this.value}`); } remove(...tokens) { var _a3; tokens.forEach((t) => __privateGet3(this, _tokenSet).delete(t)); (_a3 = __privateGet3(this, _el)) == null ? void 0 : _a3.setAttribute(`${__privateGet3(this, _attr)}`, `${this.value}`); } contains(token) { return __privateGet3(this, _tokens, tokens_get).has(token); } toggle(token, force) { if (typeof force !== "undefined") { if (force) { this.add(token); return true; } else { this.remove(token); return false; } } if (this.contains(token)) { this.remove(token); return false; } this.add(token); return true; } replace(oldToken, newToken) { this.remove(oldToken); this.add(newToken); return oldToken === newToken; } }; _el = /* @__PURE__ */ new WeakMap(); _attr = /* @__PURE__ */ new WeakMap(); _defaultSet = /* @__PURE__ */ new WeakMap(); _tokenSet = /* @__PURE__ */ new WeakMap(); _tokens = /* @__PURE__ */ new WeakSet(); tokens_get = function() { return __privateGet3(this, _tokenSet).size ? __privateGet3(this, _tokenSet) : __privateGet3(this, _defaultSet); }; // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/captions.js var splitTextTracksStr = (textTracksStr = "") => textTracksStr.split(/\s+/); var parseTextTrackStr = (textTrackStr = "") => { const [kind, language, encodedLabel] = textTrackStr.split(":"); const label = encodedLabel ? decodeURIComponent(encodedLabel) : void 0; return { kind: kind === "cc" ? TextTrackKinds.CAPTIONS : TextTrackKinds.SUBTITLES, language, label }; }; var parseTextTracksStr = (textTracksStr = "", textTrackLikeObj = {}) => { return splitTextTracksStr(textTracksStr).map((textTrackStr) => { const textTrackObj = parseTextTrackStr(textTrackStr); return { ...textTrackLikeObj, ...textTrackObj }; }); }; var parseTracks = (trackOrTracks) => { if (!trackOrTracks) return []; if (Array.isArray(trackOrTracks)) { return trackOrTracks.map((trackObjOrStr) => { if (typeof trackObjOrStr === "string") { return parseTextTrackStr(trackObjOrStr); } return trackObjOrStr; }); } if (typeof trackOrTracks === "string") { return parseTextTracksStr(trackOrTracks); } return [trackOrTracks]; }; var formatTextTrackObj = ({ kind, label, language } = { kind: "subtitles" }) => { if (!label) return language; return `${kind === "captions" ? "cc" : "sb"}:${language}:${encodeURIComponent( label )}`; }; var stringifyTextTrackList = (textTracks = []) => { return Array.prototype.map.call(textTracks, formatTextTrackObj).join(" "); }; var isMatchingPropOf = (key, value) => (obj) => obj[key] === value; var textTrackObjAsPred = (filterObj) => { const preds = Object.entries(filterObj).map(([key, value]) => { return isMatchingPropOf(key, value); }); return (textTrack) => preds.every((pred) => pred(textTrack)); }; var updateTracksModeTo = (mode, tracks = [], tracksToUpdate = []) => { const preds = parseTracks(tracksToUpdate).map(textTrackObjAsPred); const isTrackToUpdate = (textTrack) => { return preds.some((pred) => pred(textTrack)); }; Array.from(tracks).filter(isTrackToUpdate).forEach((textTrack) => { textTrack.mode = mode; }); }; var getTextTracksList = (media, filterPredOrObj = () => true) => { if (!(media == null ? void 0 : media.textTracks)) return []; const filterPred = typeof filterPredOrObj === "function" ? filterPredOrObj : textTrackObjAsPred(filterPredOrObj); return Array.from(media.textTracks).filter(filterPred); }; var areSubsOn = (el) => { var _a3; const showingSubtitles = !!((_a3 = el.mediaSubtitlesShowing) == null ? void 0 : _a3.length) || el.hasAttribute(MediaUIAttributes.MEDIA_SUBTITLES_SHOWING); return showingSubtitles; }; // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/fullscreen-api.js var enterFullscreen = (stateOwners) => { var _a3; const { media, fullscreenElement } = stateOwners; const enterFullscreenKey = fullscreenElement && "requestFullscreen" in fullscreenElement ? "requestFullscreen" : fullscreenElement && "webkitRequestFullScreen" in fullscreenElement ? "webkitRequestFullScreen" : void 0; if (enterFullscreenKey) { const maybePromise = (_a3 = fullscreenElement[enterFullscreenKey]) == null ? void 0 : _a3.call(fullscreenElement); if (maybePromise instanceof Promise) { return maybePromise.catch(() => { }); } } else if (media == null ? void 0 : media.webkitEnterFullscreen) { media.webkitEnterFullscreen(); } else if (media == null ? void 0 : media.requestFullscreen) { media.requestFullscreen(); } }; var exitFullscreenKey = "exitFullscreen" in Document2 ? "exitFullscreen" : "webkitExitFullscreen" in Document2 ? "webkitExitFullscreen" : "webkitCancelFullScreen" in Document2 ? "webkitCancelFullScreen" : void 0; var exitFullscreen = (stateOwners) => { var _a3; const { documentElement } = stateOwners; if (exitFullscreenKey) { const maybePromise = (_a3 = documentElement == null ? void 0 : documentElement[exitFullscreenKey]) == null ? void 0 : _a3.call(documentElement); if (maybePromise instanceof Promise) { return maybePromise.catch(() => { }); } } }; var fullscreenElementKey = "fullscreenElement" in Document2 ? "fullscreenElement" : "webkitFullscreenElement" in Document2 ? "webkitFullscreenElement" : void 0; var getFullscreenElement = (stateOwners) => { const { documentElement, media } = stateOwners; const docFullscreenElement = documentElement == null ? void 0 : documentElement[fullscreenElementKey]; if (!docFullscreenElement && "webkitDisplayingFullscreen" in media && "webkitPresentationMode" in media && media.webkitDisplayingFullscreen && media.webkitPresentationMode === WebkitPresentationModes.FULLSCREEN) { return media; } return docFullscreenElement; }; var isFullscreen = (stateOwners) => { var _a3; const { media, documentElement, fullscreenElement = media } = stateOwners; if (!media || !documentElement) return false; const currentFullscreenElement = getFullscreenElement(stateOwners); if (!currentFullscreenElement) return false; if (currentFullscreenElement === fullscreenElement || currentFullscreenElement === media) { return true; } if (currentFullscreenElement.localName.includes("-")) { let currentRoot = currentFullscreenElement.shadowRoot; if (!(fullscreenElementKey in currentRoot)) { return containsComposedNode( currentFullscreenElement, /** @TODO clean up type assumptions (e.g. Node) (CJP) */ // @ts-ignore fullscreenElement ); } while (currentRoot == null ? void 0 : currentRoot[fullscreenElementKey]) { if (currentRoot[fullscreenElementKey] === fullscreenElement) return true; currentRoot = (_a3 = currentRoot[fullscreenElementKey]) == null ? void 0 : _a3.shadowRoot; } } return false; }; var fullscreenEnabledKey = "fullscreenEnabled" in Document2 ? "fullscreenEnabled" : "webkitFullscreenEnabled" in Document2 ? "webkitFullscreenEnabled" : void 0; var isFullscreenEnabled = (stateOwners) => { const { documentElement, media } = stateOwners; return !!(documentElement == null ? void 0 : documentElement[fullscreenEnabledKey]) || media && "webkitSupportsFullscreen" in media; }; // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/platform-tests.js var testMediaEl; var getTestMediaEl = () => { var _a3, _b2; if (testMediaEl) return testMediaEl; testMediaEl = (_b2 = (_a3 = Document2) == null ? void 0 : _a3.createElement) == null ? void 0 : _b2.call(_a3, "video"); return testMediaEl; }; var hasVolumeSupportAsync = async (mediaEl = getTestMediaEl()) => { if (!mediaEl) return false; const prevVolume = mediaEl.volume; mediaEl.volume = prevVolume / 2 + 0.1; await delay(0); return mediaEl.volume !== prevVolume; }; var isSafari = /.*Version\/.*Safari\/.*/.test( GlobalThis.navigator.userAgent ); var hasPipSupport = (mediaEl = getTestMediaEl()) => { if (GlobalThis.matchMedia("(display-mode: standalone)").matches && isSafari) return false; return typeof (mediaEl == null ? void 0 : mediaEl.requestPictureInPicture) === "function"; }; var hasFullscreenSupport = (mediaEl = getTestMediaEl()) => { return isFullscreenEnabled({ documentElement: Document2, media: mediaEl }); }; var fullscreenSupported = hasFullscreenSupport(); var pipSupported = hasPipSupport(); var airplaySupported = !!GlobalThis.WebKitPlaybackTargetAvailabilityEvent; var castSupported = !!GlobalThis.chrome; // ../../node_modules/player.style/node_modules/media-chrome/dist/media-store/util.js var getSubtitleTracks = (stateOwners) => { return getTextTracksList(stateOwners.media, (textTrack) => { return [TextTrackKinds.SUBTITLES, TextTrackKinds.CAPTIONS].includes( textTrack.kind ); }).sort((a, b) => a.kind >= b.kind ? 1 : -1); }; var getShowingSubtitleTracks = (stateOwners) => { return getTextTracksList(stateOwners.media, (textTrack) => { return textTrack.mode === TextTrackModes.SHOWING && [TextTrackKinds.SUBTITLES, TextTrackKinds.CAPTIONS].includes( textTrack.kind ); }); }; var toggleSubtitleTracks = (stateOwners, force) => { const tracks = getSubtitleTracks(stateOwners); const showingSubitleTracks = getShowingSubtitleTracks(stateOwners); const subtitlesShowing = !!showingSubitleTracks.length; if (!tracks.length) return; if (force === false || subtitlesShowing && force !== true) { updateTracksModeTo(TextTrackModes.DISABLED, tracks, showingSubitleTracks); } else if (force === true || !subtitlesShowing && force !== false) { let subTrack = tracks[0]; const { options } = stateOwners; if (!(options == null ? void 0 : options.noSubtitlesLangPref)) { const subtitlesPref = globalThis.localStorage.getItem( "media-chrome-pref-subtitles-lang" ); const userLangPrefs = subtitlesPref ? [subtitlesPref, ...globalThis.navigator.languages] : globalThis.navigator.languages; const preferredAvailableSubs = tracks.filter((textTrack) => { return userLangPrefs.some( (lang) => textTrack.language.toLowerCase().startsWith(lang.split("-")[0]) ); }).sort((textTrackA, textTrackB) => { const idxA = userLangPrefs.findIndex( (lang) => textTrackA.language.toLowerCase().startsWith(lang.split("-")[0]) ); const idxB = userLangPrefs.findIndex( (lang) => textTrackB.language.toLowerCase().startsWith(lang.split("-")[0]) ); return idxA - idxB; }); if (preferredAvailableSubs[0]) { subTrack = preferredAvailableSubs[0]; } } const { language, label, kind } = subTrack; updateTracksModeTo(TextTrackModes.DISABLED, tracks, showingSubitleTracks); updateTracksModeTo(TextTrackModes.SHOWING, tracks, [ { language, label, kind } ]); } }; var areValuesEq = (x, y) => { if (x === y) return true; if (typeof x !== typeof y) return false; if (typeof x === "number" && Number.isNaN(x) && Number.isNaN(y)) return true; if (typeof x !== "object") return false; if (Array.isArray(x)) return areArraysEq(x, y); return Object.entries(x).every( // NOTE: Checking key in y to disambiguate between between missing keys and keys whose value are undefined (CJP) ([key, value]) => key in y && areValuesEq(value, y[key]) ); }; var areArraysEq = (xs, ys) => { const xIsArray = Array.isArray(xs); const yIsArray = Array.isArray(ys); if (xIsArray !== yIsArray) return false; if (!(xIsArray || yIsArray)) return true; if (xs.length !== ys.length) return false; return xs.every((x, i) => areValuesEq(x, ys[i])); }; // ../../node_modules/player.style/node_modules/media-chrome/dist/media-store/state-mediator.js var StreamTypeValues = Object.values(StreamTypes); var volumeSupported; var volumeSupportPromise = hasVolumeSupportAsync().then((supported) => { volumeSupported = supported; return volumeSupported; }); var prepareStateOwners = async (...stateOwners) => { await Promise.all( stateOwners.filter((x) => x).map(async (stateOwner) => { if (!("localName" in stateOwner && stateOwner instanceof GlobalThis.HTMLElement)) { return; } const name = stateOwner.localName; if (!name.includes("-")) return; const classDef = GlobalThis.customElements.get(name); if (classDef && stateOwner instanceof classDef) return; await GlobalThis.customElements.whenDefined(name); GlobalThis.customElements.upgrade(stateOwner); }) ); }; var stateMediator = { mediaPaused: { get(stateOwners) { var _a3; const { media } = stateOwners; return (_a3 = media == null ? void 0 : media.paused) != null ? _a3 : true; }, set(value, stateOwners) { var _a3; const { media } = stateOwners; if (!media) return; if (value) { media.pause(); } else { (_a3 = media.play()) == null ? void 0 : _a3.catch(() => { }); } }, mediaEvents: ["play", "playing", "pause", "emptied"] }, mediaHasPlayed: { // We want to let the user know that the media started playing at any point (`media-has-played`). // Since these propagators are all called when boostrapping state, let's verify this is // a real playing event by checking that 1) there's media and 2) it isn't currently paused. get(stateOwners, event) { const { media } = stateOwners; if (!media) return false; if (!event) return !media.paused; return event.type === "playing"; }, mediaEvents: ["playing", "emptied"] }, mediaEnded: { get(stateOwners) { var _a3; const { media } = stateOwners; return (_a3 = media == null ? void 0 : media.ended) != null ? _a3 : false; }, mediaEvents: ["seeked", "ended", "emptied"] }, mediaPlaybackRate: { get(stateOwners) { var _a3; const { media } = stateOwners; return (_a3 = media == null ? void 0 : media.playbackRate) != null ? _a3 : 1; }, set(value, stateOwners) { const { media } = stateOwners; if (!media) return; if (!Number.isFinite(+value)) return; media.playbackRate = +value; }, mediaEvents: ["ratechange", "loadstart"] }, mediaMuted: { get(stateOwners) { var _a3; const { media } = stateOwners; return (_a3 = media == null ? void 0 : media.muted) != null ? _a3 : false; }, set(value, stateOwners) { const { media } = stateOwners; if (!media) return; media.muted = value; }, mediaEvents: ["volumechange"] }, mediaVolume: { get(stateOwners) { var _a3; const { media } = stateOwners; return (_a3 = media == null ? void 0 : media.volume) != null ? _a3 : 1; }, set(value, stateOwners) { const { media } = stateOwners; if (!media) return; try { if (value == null) { GlobalThis.localStorage.removeItem("media-chrome-pref-volume"); } else { GlobalThis.localStorage.setItem( "media-chrome-pref-volume", value.toString() ); } } catch (err) { } if (!Number.isFinite(+value)) return; media.volume = +value; }, mediaEvents: ["volumechange"], stateOwnersUpdateHandlers: [ (handler, stateOwners) => { const { options: { noVolumePref } } = stateOwners; if (noVolumePref) return; try { const volumePref = GlobalThis.localStorage.getItem( "media-chrome-pref-volume" ); if (volumePref == null) return; stateMediator.mediaVolume.set(+volumePref, stateOwners); handler(+volumePref); } catch (e) { console.debug("Error getting volume pref", e); } } ] }, // NOTE: Keeping this roughly equivalent to prior impl to reduce number of changes, // however we may want to model "derived" state differently from "primary" state // (in this case, derived === mediaVolumeLevel, primary === mediaMuted, mediaVolume) (CJP) mediaVolumeLevel: { get(stateOwners) { const { media } = stateOwners; if (typeof (media == null ? void 0 : media.volume) == "undefined") return "high"; if (media.muted || media.volume === 0) return "off"; if (media.volume < 0.5) return "low"; if (media.volume < 0.75) return "medium"; return "high"; }, mediaEvents: ["volumechange"] }, mediaCurrentTime: { get(stateOwners) { var _a3; const { media } = stateOwners; return (_a3 = media == null ? void 0 : media.currentTime) != null ? _a3 : 0; }, set(value, stateOwners) { const { media } = stateOwners; if (!media || media.readyState === 0) return; media.currentTime = value; }, mediaEvents: ["timeupdate", "loadedmetadata"] }, mediaDuration: { get(stateOwners) { const { media, options: { defaultDuration } = {} } = stateOwners; if (defaultDuration && (!media || !media.duration || Number.isNaN(media.duration) || !Number.isFinite(media.duration))) { return defaultDuration; } return Number.isFinite(media == null ? void 0 : media.duration) ? media.duration : Number.NaN; }, mediaEvents: ["durationchange", "loadedmetadata", "emptied"] }, mediaLoading: { get(stateOwners) { const { media } = stateOwners; return (media == null ? void 0 : media.readyState) < 3; }, mediaEvents: ["waiting", "playing", "emptied"] }, mediaSeekable: { get(stateOwners) { var _a3; const { media } = stateOwners; if (!((_a3 = media == null ? void 0 : media.seekable) == null ? void 0 : _a3.length)) return void 0; const start = media.seekable.start(0); const end = media.seekable.end(media.seekable.length - 1); if (!start && !end) return void 0; return [Number(start.toFixed(3)), Number(end.toFixed(3))]; }, mediaEvents: ["loadedmetadata", "emptied", "progress", "seekablechange"] }, mediaBuffered: { get(stateOwners) { var _a3; const { media } = stateOwners; const timeRanges = (_a3 = media == null ? void 0 : media.buffered) != null ? _a3 : []; return Array.from(timeRanges).map((_, i) => [ Number(timeRanges.start(i).toFixed(3)), Number(timeRanges.end(i).toFixed(3)) ]); }, mediaEvents: ["progress", "emptied"] }, mediaStreamType: { get(stateOwners) { const { media, options: { defaultStreamType } = {} } = stateOwners; const usedDefaultStreamType = [ StreamTypes.LIVE, StreamTypes.ON_DEMAND ].includes(defaultStreamType) ? defaultStreamType : void 0; if (!media) return usedDefaultStreamType; const { streamType } = media; if (StreamTypeValues.includes(streamType)) { if (streamType === StreamTypes.UNKNOWN) { return usedDefaultStreamType; } return streamType; } const duration = media.duration; if (duration === Infinity) { return StreamTypes.LIVE; } else if (Number.isFinite(duration)) { return StreamTypes.ON_DEMAND; } return usedDefaultStreamType; }, mediaEvents: [ "emptied", "durationchange", "loadedmetadata", "streamtypechange" ] }, mediaTargetLiveWindow: { get(stateOwners) { const { media } = stateOwners; if (!media) return Number.NaN; const { targetLiveWindow } = media; const streamType = stateMediator.mediaStreamType.get(stateOwners); if ((targetLiveWindow == null || Number.isNaN(targetLiveWindow)) && streamType === StreamTypes.LIVE) { return 0; } return targetLiveWindow; }, mediaEvents: [ "emptied", "durationchange", "loadedmetadata", "streamtypechange", "targetlivewindowchange" ] }, mediaTimeIsLive: { get(stateOwners) { const { media, // Default to 10 seconds options: { liveEdgeOffset = 10 } = {} } = stateOwners; if (!media) return false; if (typeof media.liveEdgeStart === "number") { if (Number.isNaN(media.liveEdgeStart)) return false; return media.currentTime >= media.liveEdgeStart; } const live = stateMediator.mediaStreamType.get(stateOwners) === StreamTypes.LIVE; if (!live) return false; const seekable = media.seekable; if (!seekable) return true; if (!seekable.length) return false; const liveEdgeStart = seekable.end(seekable.length - 1) - liveEdgeOffset; return media.currentTime >= liveEdgeStart; }, mediaEvents: ["playing", "timeupdate", "progress", "waiting", "emptied"] }, // Text Tracks modeling mediaSubtitlesList: { get(stateOwners) { return getSubtitleTracks(stateOwners).map( ({ kind, label, language }) => ({ kind, label, language }) ); }, mediaEvents: ["loadstart"], textTracksEvents: ["addtrack", "removetrack"] }, mediaSubtitlesShowing: { get(stateOwners) { return getShowingSubtitleTracks(stateOwners).map( ({ kind, label, language }) => ({ kind, label, language }) ); }, mediaEvents: ["loadstart"], textTracksEvents: ["addtrack", "removetrack", "change"], stateOwnersUpdateHandlers: [ (_handler, stateOwners) => { var _a3, _b2; const { media, options } = stateOwners; if (!media) return; const updateDefaultSubtitlesCallback = (event) => { var _a22; if (!options.defaultSubtitles) return; const nonSubsEvent = event && ![TextTrackKinds.CAPTIONS, TextTrackKinds.SUBTITLES].includes( // @ts-ignore (_a22 = event == null ? void 0 : event.track) == null ? void 0 : _a22.kind ); if (nonSubsEvent) return; toggleSubtitleTracks(stateOwners, true); }; (_a3 = media.textTracks) == null ? void 0 : _a3.addEventListener( "addtrack", updateDefaultSubtitlesCallback ); (_b2 = media.textTracks) == null ? void 0 : _b2.addEventListener( "removetrack", updateDefaultSubtitlesCallback ); updateDefaultSubtitlesCallback(); return () => { var _a22, _b22; (_a22 = media.textTracks) == null ? void 0 : _a22.removeEventListener( "addtrack", updateDefaultSubtitlesCallback ); (_b22 = media.textTracks) == null ? void 0 : _b22.removeEventListener( "removetrack", updateDefaultSubtitlesCallback ); }; } ] }, mediaChaptersCues: { get(stateOwners) { var _a3; const { media } = stateOwners; if (!media) return []; const [chaptersTrack] = getTextTracksList(media, { kind: TextTrackKinds.CHAPTERS }); return Array.from((_a3 = chaptersTrack == null ? void 0 : chaptersTrack.cues) != null ? _a3 : []).map( ({ text, startTime, endTime }) => ({ text, startTime, endTime }) ); }, mediaEvents: ["loadstart", "loadedmetadata"], textTracksEvents: ["addtrack", "removetrack", "change"], stateOwnersUpdateHandlers: [ (handler, stateOwners) => { const { media } = stateOwners; if (!media) return; const chaptersTrack = media.querySelector( 'track[kind="chapters"][default][src]' ); chaptersTrack == null ? void 0 : chaptersTrack.addEventListener("load", handler); return () => { chaptersTrack == null ? void 0 : chaptersTrack.removeEventListener("load", handler); }; } ] }, // Modeling state tied to root node mediaIsPip: { get(stateOwners) { var _a3, _b2; const { media, documentElement } = stateOwners; if (!media || !documentElement) return false; if (!documentElement.pictureInPictureElement) return false; if (documentElement.pictureInPictureElement === media) return true; if (documentElement.pictureInPictureElement instanceof HTMLMediaElement) { if (!((_a3 = media.localName) == null ? void 0 : _a3.includes("-"))) return false; return containsComposedNode( media, documentElement.pictureInPictureElement ); } if (documentElement.pictureInPictureElement.localName.includes("-")) { let currentRoot = documentElement.pictureInPictureElement.shadowRoot; while (currentRoot == null ? void 0 : currentRoot.pictureInPictureElement) { if (currentRoot.pictureInPictureElement === media) return true; currentRoot = (_b2 = currentRoot.pictureInPictureElement) == null ? void 0 : _b2.shadowRoot; } } return false; }, set(value, stateOwners) { const { media } = stateOwners; if (!media) return; if (value) { if (!Document2.pictureInPictureEnabled) { console.warn("MediaChrome: Picture-in-picture is not enabled"); return; } if (!media.requestPictureInPicture) { console.warn( "MediaChrome: The current media does not support picture-in-picture" ); return; } const warnNotReady = () => { console.warn( "MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0." ); }; media.requestPictureInPicture().catch((err) => { if (err.code === 11) { if (!media.src) { console.warn( "MediaChrome: The media is not ready for picture-in-picture. It must have a src set." ); return; } if (media.readyState === 0 && media.preload === "none") { const cleanup = () => { media.removeEventListener("loadedmetadata", tryPip); media.preload = "none"; }; const tryPip = () => { media.requestPictureInPicture().catch(warnNotReady); cleanup(); }; media.addEventListener("loadedmetadata", tryPip); media.preload = "metadata"; setTimeout(() => { if (media.readyState === 0) warnNotReady(); cleanup(); }, 1e3); } else { throw err; } } else { throw err; } }); } else if (Document2.pictureInPictureElement) { Document2.exitPictureInPicture(); } }, mediaEvents: ["enterpictureinpicture", "leavepictureinpicture"] }, mediaRenditionList: { get(stateOwners) { var _a3; const { media } = stateOwners; return [...(_a3 = media == null ? void 0 : media.videoRenditions) != null ? _a3 : []].map((videoRendition) => ({ ...videoRendition })); }, mediaEvents: ["emptied", "loadstart"], videoRenditionsEvents: ["addrendition", "removerendition"] }, /** @TODO Model this as a derived value? (CJP) */ mediaRenditionSelected: { get(stateOwners) { var _a3, _b2, _c; const { media } = stateOwners; return (_c = (_b2 = media == null ? void 0 : media.videoRenditions) == null ? void 0 : _b2[(_a3 = media.videoRenditions) == null ? void 0 : _a3.selectedIndex]) == null ? void 0 : _c.id; }, set(value, stateOwners) { const { media } = stateOwners; if (!(media == null ? void 0 : media.videoRenditions)) { console.warn( "MediaController: Rendition selection not supported by this media." ); return; } const renditionId = value; const index = Array.prototype.findIndex.call( media.videoRenditions, (r) => r.id == renditionId ); if (media.videoRenditions.selectedIndex != index) { media.videoRenditions.selectedIndex = index; } }, mediaEvents: ["emptied"], videoRenditionsEvents: ["addrendition", "removerendition", "change"] }, mediaAudioTrackList: { get(stateOwners) { var _a3; const { media } = stateOwners; return [...(_a3 = media == null ? void 0 : media.audioTracks) != null ? _a3 : []]; }, mediaEvents: ["emptied", "loadstart"], audioTracksEvents: ["addtrack", "removetrack"] }, mediaAudioTrackEnabled: { get(stateOwners) { var _a3, _b2; const { media } = stateOwners; return (_b2 = [...(_a3 = media == null ? void 0 : media.audioTracks) != null ? _a3 : []].find( (audioTrack) => audioTrack.enabled )) == null ? void 0 : _b2.id; }, set(value, stateOwners) { const { media } = stateOwners; if (!(media == null ? void 0 : media.audioTracks)) { console.warn( "MediaChrome: Audio track selection not supported by this media." ); return; } const audioTrackId = value; for (const track of media.audioTracks) { track.enabled = audioTrackId == track.id; } }, mediaEvents: ["emptied"], audioTracksEvents: ["addtrack", "removetrack", "change"] }, mediaIsFullscreen: { get(stateOwners) { return isFullscreen(stateOwners); }, set(value, stateOwners) { if (!value) { exitFullscreen(stateOwners); } else { enterFullscreen(stateOwners); } }, // older Safari version may require webkit-specific events rootEvents: ["fullscreenchange", "webkitfullscreenchange"], // iOS requires webkit-specific events on the video. mediaEvents: ["webkitbeginfullscreen", "webkitendfullscreen", "webkitpresentationmodechanged"] }, mediaIsCasting: { // Note this relies on a customized castable-video element. get(stateOwners) { var _a3; const { media } = stateOwners; if (!(media == null ? void 0 : media.remote) || ((_a3 = media.remote) == null ? void 0 : _a3.state) === "disconnected") return false; return !!media.remote.state; }, set(value, stateOwners) { var _a3, _b2; const { media } = stateOwners; if (!media) return; if (value && ((_a3 = media.remote) == null ? void 0 : _a3.state) !== "disconnected") return; if (!value && ((_b2 = media.remote) == null ? void 0 : _b2.state) !== "connected") return; if (typeof media.remote.prompt !== "function") { console.warn( "MediaChrome: Casting is not supported in this environment" ); return; } media.remote.prompt().catch(() => { }); }, remoteEvents: ["connect", "connecting", "disconnect"] }, // NOTE: Newly added state for tracking airplaying mediaIsAirplaying: { // NOTE: Cannot know if airplaying since Safari doesn't fully support HTMLMediaElement::remote yet (e.g. remote::state) (CJP) get() { return false; }, set(_value2, stateOwners) { const { media } = stateOwners; if (!media) return; if (!(media.webkitShowPlaybackTargetPicker && GlobalThis.WebKitPlaybackTargetAvailabilityEvent)) { console.warn( "MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment" ); return; } media.webkitShowPlaybackTargetPicker(); }, mediaEvents: ["webkitcurrentplaybacktargetiswirelesschanged"] }, mediaFullscreenUnavailable: { get(stateOwners) { const { media } = stateOwners; if (!fullscreenSupported || !hasFullscreenSupport(media)) return AvailabilityStates.UNSUPPORTED; return void 0; } }, mediaPipUnavailable: { get(stateOwners) { const { media } = stateOwners; if (!pipSupported || !hasPipSupport(media)) return AvailabilityStates.UNSUPPORTED; } }, mediaVolumeUnavailable: { get(stateOwners) { const { media } = stateOwners; if (volumeSupported === false || (media == null ? void 0 : media.volume) == void 0) { return AvailabilityStates.UNSUPPORTED; } return void 0; }, // NOTE: Slightly different impl here. Added generic support for // "stateOwnersUpdateHandlers" since the original impl had to hack around // race conditions. (CJP) stateOwnersUpdateHandlers: [ (handler) => { if (volumeSupported == null) { volumeSupportPromise.then( (supported) => handler(supported ? void 0 : AvailabilityStates.UNSUPPORTED) ); } } ] }, mediaCastUnavailable: { // @ts-ignore get(stateOwners, { availability = "not-available" } = {}) { var _a3; const { media } = stateOwners; if (!castSupported || !((_a3 = media == null ? void 0 : media.remote) == null ? void 0 : _a3.state)) { return AvailabilityStates.UNSUPPORTED; } if (availability == null || availability === "available") return void 0; return AvailabilityStates.UNAVAILABLE; }, stateOwnersUpdateHandlers: [ (handler, stateOwners) => { var _a3; const { media } = stateOwners; if (!media) return; const remotePlaybackDisabled = media.disableRemotePlayback || media.hasAttribute("disableremoteplayback"); if (!remotePlaybackDisabled) { (_a3 = media == null ? void 0 : media.remote) == null ? void 0 : _a3.watchAvailability((availabilityBool) => { const availability = availabilityBool ? "available" : "not-available"; handler({ availability }); }).catch((error) => { if (error.name === "NotSupportedError") { handler({ availability: null }); } else { handler({ availability: "not-available" }); } }); } return () => { var _a22; (_a22 = media == null ? void 0 : media.remote) == null ? void 0 : _a22.cancelWatchAvailability().catch(() => { }); }; } ] }, mediaAirplayUnavailable: { get(_stateOwners, event) { if (!airplaySupported) return AvailabilityStates.UNSUPPORTED; if ((event == null ? void 0 : event.availability) === "not-available") { return AvailabilityStates.UNAVAILABLE; } return void 0; }, // NOTE: Keeping this event, as it's still the documented way of monitoring // for AirPlay availability from Apple. // See: https://developer.apple.com/documentation/webkitjs/adding_an_airplay_button_to_your_safari_media_controls#2940021 (CJP) mediaEvents: ["webkitplaybacktargetavailabilitychanged"], stateOwnersUpdateHandlers: [ (handler, stateOwners) => { var _a3; const { media } = stateOwners; if (!media) return; const remotePlaybackDisabled = media.disableRemotePlayback || media.hasAttribute("disableremoteplayback"); if (!remotePlaybackDisabled) { (_a3 = media == null ? void 0 : media.remote) == null ? void 0 : _a3.watchAvailability((availabilityBool) => { const availability = availabilityBool ? "available" : "not-available"; handler({ availability }); }).catch((error) => { if (error.name === "NotSupportedError") { handler({ availability: null }); } else { handler({ availability: "not-available" }); } }); } return () => { var _a22; (_a22 = media == null ? void 0 : media.remote) == null ? void 0 : _a22.cancelWatchAvailability().catch(() => { }); }; } ] }, mediaRenditionUnavailable: { get(stateOwners) { var _a3; const { media } = stateOwners; if (!(media == null ? void 0 : media.videoRenditions)) { return AvailabilityStates.UNSUPPORTED; } if (!((_a3 = media.videoRenditions) == null ? void 0 : _a3.length)) { return AvailabilityStates.UNAVAILABLE; } return void 0; }, mediaEvents: ["emptied", "loadstart"], videoRenditionsEvents: ["addrendition", "removerendition"] }, mediaAudioTrackUnavailable: { get(stateOwners) { var _a3, _b2; const { media } = stateOwners; if (!(media == null ? void 0 : media.audioTracks)) { return AvailabilityStates.UNSUPPORTED; } if (((_b2 = (_a3 = media.audioTracks) == null ? void 0 : _a3.length) != null ? _b2 : 0) <= 1) { return AvailabilityStates.UNAVAILABLE; } return void 0; }, mediaEvents: ["emptied", "loadstart"], audioTracksEvents: ["addtrack", "removetrack"] } }; // ../../node_modules/player.style/node_modules/media-chrome/dist/media-store/request-map.js var requestMap = { /** * @TODO Consider adding state to `StateMediator` for e.g. `mediaThumbnailCues` and use that for derived state here (CJP) */ [MediaUIEvents.MEDIA_PREVIEW_REQUEST](stateMediator2, stateOwners, { detail }) { var _a3, _b2, _c; const { media } = stateOwners; const mediaPreviewTime = detail != null ? detail : void 0; let mediaPreviewImage = void 0; let mediaPreviewCoords = void 0; if (media && mediaPreviewTime != null) { const [track] = getTextTracksList(media, { kind: TextTrackKinds.METADATA, label: "thumbnails" }); const cue = Array.prototype.find.call((_a3 = track == null ? void 0 : track.cues) != null ? _a3 : [], (c, i, cs) => { if (i === 0) return c.endTime > mediaPreviewTime; if (i === cs.length - 1) return c.startTime <= mediaPreviewTime; return c.startTime <= mediaPreviewTime && c.endTime > mediaPreviewTime; }); if (cue) { const base = !/'^(?:[a-z]+:)?\/\//i.test(cue.text) ? (_b2 = media == null ? void 0 : media.querySelector( 'track[label="thumbnails"]' )) == null ? void 0 : _b2.src : void 0; const url = new URL(cue.text, base); const previewCoordsStr = new URLSearchParams(url.hash).get("#xywh"); mediaPreviewCoords = previewCoordsStr.split(",").map((numStr) => +numStr); mediaPreviewImage = url.href; } } const mediaDuration = stateMediator2.mediaDuration.get(stateOwners); const mediaChaptersCues = stateMediator2.mediaChaptersCues.get(stateOwners); let mediaPreviewChapter = (_c = mediaChaptersCues.find((c, i, cs) => { if (i === cs.length - 1 && mediaDuration === c.endTime) { return c.startTime <= mediaPreviewTime && c.endTime >= mediaPreviewTime; } return c.startTime <= mediaPreviewTime && c.endTime > mediaPreviewTime; })) == null ? void 0 : _c.text; if (detail != null && mediaPreviewChapter == null) { mediaPreviewChapter = ""; } return { mediaPreviewTime, mediaPreviewImage, mediaPreviewCoords, mediaPreviewChapter }; }, [MediaUIEvents.MEDIA_PAUSE_REQUEST](stateMediator2, stateOwners) { const key = "mediaPaused"; const value = true; stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_PLAY_REQUEST](stateMediator2, stateOwners) { var _a3; const key = "mediaPaused"; const value = false; const live = stateMediator2.mediaStreamType.get(stateOwners) === StreamTypes.LIVE; if (live) { const notDvr = !(stateMediator2.mediaTargetLiveWindow.get(stateOwners) > 0); const liveEdgeTime = (_a3 = stateMediator2.mediaSeekable.get(stateOwners)) == null ? void 0 : _a3[1]; if (notDvr && liveEdgeTime) { stateMediator2.mediaCurrentTime.set(liveEdgeTime, stateOwners); } } stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_PLAYBACK_RATE_REQUEST](stateMediator2, stateOwners, { detail }) { const key = "mediaPlaybackRate"; const value = detail; stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_MUTE_REQUEST](stateMediator2, stateOwners) { const key = "mediaMuted"; const value = true; stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_UNMUTE_REQUEST](stateMediator2, stateOwners) { const key = "mediaMuted"; const value = false; if (!stateMediator2.mediaVolume.get(stateOwners)) { stateMediator2.mediaVolume.set(0.25, stateOwners); } stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_VOLUME_REQUEST](stateMediator2, stateOwners, { detail }) { const key = "mediaVolume"; const value = detail; if (value && stateMediator2.mediaMuted.get(stateOwners)) { stateMediator2.mediaMuted.set(false, stateOwners); } stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_SEEK_REQUEST](stateMediator2, stateOwners, { detail }) { const key = "mediaCurrentTime"; const value = detail; stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_SEEK_TO_LIVE_REQUEST](stateMediator2, stateOwners) { var _a3; const key = "mediaCurrentTime"; const value = (_a3 = stateMediator2.mediaSeekable.get(stateOwners)) == null ? void 0 : _a3[1]; if (!Number.isNaN(Number(value))) return; stateMediator2[key].set(value, stateOwners); }, // Text Tracks state change requests [MediaUIEvents.MEDIA_SHOW_SUBTITLES_REQUEST](_stateMediator, stateOwners, { detail }) { var _a3; const { options } = stateOwners; const tracks = getSubtitleTracks(stateOwners); const tracksToUpdate = parseTracks(detail); const preferredLanguage = (_a3 = tracksToUpdate[0]) == null ? void 0 : _a3.language; if (preferredLanguage && !options.noSubtitlesLangPref) { GlobalThis.localStorage.setItem( "media-chrome-pref-subtitles-lang", preferredLanguage ); } updateTracksModeTo(TextTrackModes.SHOWING, tracks, tracksToUpdate); }, [MediaUIEvents.MEDIA_DISABLE_SUBTITLES_REQUEST](_stateMediator, stateOwners, { detail }) { const tracks = getSubtitleTracks(stateOwners); const tracksToUpdate = detail != null ? detail : []; updateTracksModeTo(TextTrackModes.DISABLED, tracks, tracksToUpdate); }, [MediaUIEvents.MEDIA_TOGGLE_SUBTITLES_REQUEST](_stateMediator, stateOwners, { detail }) { toggleSubtitleTracks(stateOwners, detail); }, // Renditions/Tracks state change requests [MediaUIEvents.MEDIA_RENDITION_REQUEST](stateMediator2, stateOwners, { detail }) { const key = "mediaRenditionSelected"; const value = detail; stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_AUDIO_TRACK_REQUEST](stateMediator2, stateOwners, { detail }) { const key = "mediaAudioTrackEnabled"; const value = detail; stateMediator2[key].set(value, stateOwners); }, // State change requests dependent on root node [MediaUIEvents.MEDIA_ENTER_PIP_REQUEST](stateMediator2, stateOwners) { const key = "mediaIsPip"; const value = true; if (stateMediator2.mediaIsFullscreen.get(stateOwners)) { stateMediator2.mediaIsFullscreen.set(false, stateOwners); } stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_EXIT_PIP_REQUEST](stateMediator2, stateOwners) { const key = "mediaIsPip"; const value = false; stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_ENTER_FULLSCREEN_REQUEST](stateMediator2, stateOwners) { const key = "mediaIsFullscreen"; const value = true; if (stateMediator2.mediaIsPip.get(stateOwners)) { stateMediator2.mediaIsPip.set(false, stateOwners); } stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_EXIT_FULLSCREEN_REQUEST](stateMediator2, stateOwners) { const key = "mediaIsFullscreen"; const value = false; stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_ENTER_CAST_REQUEST](stateMediator2, stateOwners) { const key = "mediaIsCasting"; const value = true; if (stateMediator2.mediaIsFullscreen.get(stateOwners)) { stateMediator2.mediaIsFullscreen.set(false, stateOwners); } stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_EXIT_CAST_REQUEST](stateMediator2, stateOwners) { const key = "mediaIsCasting"; const value = false; stateMediator2[key].set(value, stateOwners); }, [MediaUIEvents.MEDIA_AIRPLAY_REQUEST](stateMediator2, stateOwners) { const key = "mediaIsAirplaying"; const value = true; stateMediator2[key].set(value, stateOwners); } }; // ../../node_modules/player.style/node_modules/media-chrome/dist/media-store/media-store.js var createMediaStore = ({ media, fullscreenElement, documentElement, stateMediator: stateMediator2 = stateMediator, requestMap: requestMap2 = requestMap, options = {}, monitorStateOwnersOnlyWithSubscriptions = true }) => { const callbacks = []; const stateOwners = { // Spreading options here since folks should not rely on holding onto references // for any app-level logic wrt options. options: { ...options } }; let state = Object.freeze({ mediaPreviewTime: void 0, mediaPreviewImage: void 0, mediaPreviewCoords: void 0, mediaPreviewChapter: void 0 }); const updateState = (nextStateDelta) => { if (nextStateDelta == void 0) return; if (areValuesEq(nextStateDelta, state)) { return; } state = Object.freeze({ ...state, ...nextStateDelta }); callbacks.forEach((cb) => cb(state)); }; const updateStateFromFacade = () => { const nextState = Object.entries(stateMediator2).reduce( (nextState2, [stateName, { get }]) => { nextState2[stateName] = get(stateOwners); return nextState2; }, {} ); updateState(nextState); }; const stateUpdateHandlers = {}; let nextStateOwners = void 0; const updateStateOwners = async (nextStateOwnersDelta, nextSubscriberCount) => { var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p; const pendingUpdate = !!nextStateOwners; nextStateOwners = { ...stateOwners, ...nextStateOwners != null ? nextStateOwners : {}, ...nextStateOwnersDelta }; if (pendingUpdate) return; await prepareStateOwners(...Object.values(nextStateOwnersDelta)); const shouldTeardownFromSubscriberCount = callbacks.length > 0 && nextSubscriberCount === 0 && monitorStateOwnersOnlyWithSubscriptions; const mediaChanged = stateOwners.media !== nextStateOwners.media; const textTracksChanged = ((_a3 = stateOwners.media) == null ? void 0 : _a3.textTracks) !== ((_b2 = nextStateOwners.media) == null ? void 0 : _b2.textTracks); const videoRenditionsChanged = ((_c = stateOwners.media) == null ? void 0 : _c.videoRenditions) !== ((_d = nextStateOwners.media) == null ? void 0 : _d.videoRenditions); const audioTracksChanged = ((_e = stateOwners.media) == null ? void 0 : _e.audioTracks) !== ((_f = nextStateOwners.media) == null ? void 0 : _f.audioTracks); const remoteChanged = ((_g = stateOwners.media) == null ? void 0 : _g.remote) !== ((_h = nextStateOwners.media) == null ? void 0 : _h.remote); const rootNodeChanged = stateOwners.documentElement !== nextStateOwners.documentElement; const teardownMedia = !!stateOwners.media && (mediaChanged || shouldTeardownFromSubscriberCount); const teardownTextTracks = !!((_i = stateOwners.media) == null ? void 0 : _i.textTracks) && (textTracksChanged || shouldTeardownFromSubscriberCount); const teardownVideoRenditions = !!((_j = stateOwners.media) == null ? void 0 : _j.videoRenditions) && (videoRenditionsChanged || shouldTeardownFromSubscriberCount); const teardownAudioTracks = !!((_k = stateOwners.media) == null ? void 0 : _k.audioTracks) && (audioTracksChanged || shouldTeardownFromSubscriberCount); const teardownRemote = !!((_l = stateOwners.media) == null ? void 0 : _l.remote) && (remoteChanged || shouldTeardownFromSubscriberCount); const teardownRootNode = !!stateOwners.documentElement && (rootNodeChanged || shouldTeardownFromSubscriberCount); const teardownSomething = teardownMedia || teardownTextTracks || teardownVideoRenditions || teardownAudioTracks || teardownRemote || teardownRootNode; const shouldSetupFromSubscriberCount = callbacks.length === 0 && nextSubscriberCount === 1 && monitorStateOwnersOnlyWithSubscriptions; const setupMedia = !!nextStateOwners.media && (mediaChanged || shouldSetupFromSubscriberCount); const setupTextTracks = !!((_m = nextStateOwners.media) == null ? void 0 : _m.textTracks) && (textTracksChanged || shouldSetupFromSubscriberCount); const setupVideoRenditions = !!((_n = nextStateOwners.media) == null ? void 0 : _n.videoRenditions) && (videoRenditionsChanged || shouldSetupFromSubscriberCount); const setupAudioTracks = !!((_o = nextStateOwners.media) == null ? void 0 : _o.audioTracks) && (audioTracksChanged || shouldSetupFromSubscriberCount); const setupRemote = !!((_p = nextStateOwners.media) == null ? void 0 : _p.remote) && (remoteChanged || shouldSetupFromSubscriberCount); const setupRootNode = !!nextStateOwners.documentElement && (rootNodeChanged || shouldSetupFromSubscriberCount); const setupSomething = setupMedia || setupTextTracks || setupVideoRenditions || setupAudioTracks || setupRemote || setupRootNode; const somethingToDo = teardownSomething || setupSomething; if (!somethingToDo) { Object.entries(nextStateOwners).forEach( ([stateOwnerName, stateOwner]) => { stateOwners[stateOwnerName] = stateOwner; } ); updateStateFromFacade(); nextStateOwners = void 0; return; } Object.entries(stateMediator2).forEach( ([ stateName, { get, mediaEvents = [], textTracksEvents = [], videoRenditionsEvents = [], audioTracksEvents = [], remoteEvents = [], rootEvents = [], stateOwnersUpdateHandlers = [] } ]) => { if (!stateUpdateHandlers[stateName]) { stateUpdateHandlers[stateName] = {}; } const handler = (event) => { const nextValue = get(stateOwners, event); updateState({ [stateName]: nextValue }); }; let prevHandler; prevHandler = stateUpdateHandlers[stateName].mediaEvents; mediaEvents.forEach((eventType) => { if (prevHandler && teardownMedia) { stateOwners.media.removeEventListener(eventType, prevHandler); stateUpdateHandlers[stateName].mediaEvents = void 0; } if (setupMedia) { nextStateOwners.media.addEventListener(eventType, handler); stateUpdateHandlers[stateName].mediaEvents = handler; } }); prevHandler = stateUpdateHandlers[stateName].textTracksEvents; textTracksEvents.forEach((eventType) => { var _a22, _b22; if (prevHandler && teardownTextTracks) { (_a22 = stateOwners.media.textTracks) == null ? void 0 : _a22.removeEventListener( eventType, prevHandler ); stateUpdateHandlers[stateName].textTracksEvents = void 0; } if (setupTextTracks) { (_b22 = nextStateOwners.media.textTracks) == null ? void 0 : _b22.addEventListener( eventType, handler ); stateUpdateHandlers[stateName].textTracksEvents = handler; } }); prevHandler = stateUpdateHandlers[stateName].videoRenditionsEvents; videoRenditionsEvents.forEach((eventType) => { var _a22, _b22; if (prevHandler && teardownVideoRenditions) { (_a22 = stateOwners.media.videoRenditions) == null ? void 0 : _a22.removeEventListener( eventType, prevHandler ); stateUpdateHandlers[stateName].videoRenditionsEvents = void 0; } if (setupVideoRenditions) { (_b22 = nextStateOwners.media.videoRenditions) == null ? void 0 : _b22.addEventListener( eventType, handler ); stateUpdateHandlers[stateName].videoRenditionsEvents = handler; } }); prevHandler = stateUpdateHandlers[stateName].audioTracksEvents; audioTracksEvents.forEach((eventType) => { var _a22, _b22; if (prevHandler && teardownAudioTracks) { (_a22 = stateOwners.media.audioTracks) == null ? void 0 : _a22.removeEventListener( eventType, prevHandler ); stateUpdateHandlers[stateName].audioTracksEvents = void 0; } if (setupAudioTracks) { (_b22 = nextStateOwners.media.audioTracks) == null ? void 0 : _b22.addEventListener( eventType, handler ); stateUpdateHandlers[stateName].audioTracksEvents = handler; } }); prevHandler = stateUpdateHandlers[stateName].remoteEvents; remoteEvents.forEach((eventType) => { var _a22, _b22; if (prevHandler && teardownRemote) { (_a22 = stateOwners.media.remote) == null ? void 0 : _a22.removeEventListener( eventType, prevHandler ); stateUpdateHandlers[stateName].remoteEvents = void 0; } if (setupRemote) { (_b22 = nextStateOwners.media.remote) == null ? void 0 : _b22.addEventListener(eventType, handler); stateUpdateHandlers[stateName].remoteEvents = handler; } }); prevHandler = stateUpdateHandlers[stateName].rootEvents; rootEvents.forEach((eventType) => { if (prevHandler && teardownRootNode) { stateOwners.documentElement.removeEventListener( eventType, prevHandler ); stateUpdateHandlers[stateName].rootEvents = void 0; } if (setupRootNode) { nextStateOwners.documentElement.addEventListener( eventType, handler ); stateUpdateHandlers[stateName].rootEvents = handler; } }); const prevHandlerTeardown = stateUpdateHandlers[stateName].stateOwnersUpdateHandlers; stateOwnersUpdateHandlers.forEach((fn) => { if (prevHandlerTeardown && teardownSomething) { prevHandlerTeardown(); } if (setupSomething) { stateUpdateHandlers[stateName].stateOwnersUpdateHandlers = fn( handler, nextStateOwners ); } }); } ); Object.entries(nextStateOwners).forEach(([stateOwnerName, stateOwner]) => { stateOwners[stateOwnerName] = stateOwner; }); updateStateFromFacade(); nextStateOwners = void 0; }; updateStateOwners({ media, fullscreenElement, documentElement, options }); return { // note that none of these cases directly interact with the media element, root node, full screen element, etc. // note these "actions" could just be the events if we wanted, especially if we normalize on "detail" for // any payload-relevant values // This is roughly equivalent to our used to be in our state requests dictionary object, though much of the // "heavy lifting" is now moved into the facade `set()` dispatch(action) { const { type, detail } = action; if (requestMap2[type]) { updateState(requestMap2[type](stateMediator2, stateOwners, action)); return; } if (type === "mediaelementchangerequest") { updateStateOwners({ media: detail }); } else if (type === "fullscreenelementchangerequest") { updateStateOwners({ fullscreenElement: detail }); } else if (type === "documentelementchangerequest") { updateStateOwners({ documentElement: detail }); } else if (type === "optionschangerequest") { Object.entries(detail != null ? detail : {}).forEach(([optionName, optionValue]) => { stateOwners.options[optionName] = optionValue; }); } }, getState() { return state; }, subscribe(callback) { updateStateOwners({}, callbacks.length + 1); callbacks.push(callback); callback(state); return () => { const idx = callbacks.indexOf(callback); if (idx >= 0) { updateStateOwners({}, callbacks.length - 1); callbacks.splice(idx, 1); } }; } }; }; var media_store_default = createMediaStore; // ../../node_modules/player.style/node_modules/media-chrome/dist/media-controller.js var __accessCheck4 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet4 = (obj, member, getter) => { __accessCheck4(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd4 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet4 = (obj, member, value, setter) => { __accessCheck4(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod2 = (obj, member, method) => { __accessCheck4(obj, member, "access private method"); return method; }; var _hotKeys; var _fullscreenElement; var _mediaStore; var _mediaStateCallback; var _mediaStoreUnsubscribe; var _mediaStateEventHandler; var _setupDefaultStore; var setupDefaultStore_fn; var _keyUpHandler; var keyUpHandler_fn; var _keyDownHandler; var keyDownHandler_fn; var ButtonPressedKeys = [ "ArrowLeft", "ArrowRight", "Enter", " ", "f", "m", "k", "c" ]; var DEFAULT_SEEK_OFFSET = 10; var Attributes2 = { DEFAULT_SUBTITLES: "defaultsubtitles", DEFAULT_STREAM_TYPE: "defaultstreamtype", DEFAULT_DURATION: "defaultduration", FULLSCREEN_ELEMENT: "fullscreenelement", HOTKEYS: "hotkeys", KEYS_USED: "keysused", LIVE_EDGE_OFFSET: "liveedgeoffset", NO_AUTO_SEEK_TO_LIVE: "noautoseektolive", NO_HOTKEYS: "nohotkeys", NO_VOLUME_PREF: "novolumepref", NO_SUBTITLES_LANG_PREF: "nosubtitleslangpref", NO_DEFAULT_STORE: "nodefaultstore", KEYBOARD_FORWARD_SEEK_OFFSET: "keyboardforwardseekoffset", KEYBOARD_BACKWARD_SEEK_OFFSET: "keyboardbackwardseekoffset" }; var MediaController = class extends MediaContainer { constructor() { super(); __privateAdd4(this, _setupDefaultStore); __privateAdd4(this, _keyUpHandler); __privateAdd4(this, _keyDownHandler); this.mediaStateReceivers = []; this.associatedElementSubscriptions = /* @__PURE__ */ new Map(); __privateAdd4(this, _hotKeys, new AttributeTokenList(this, Attributes2.HOTKEYS)); __privateAdd4(this, _fullscreenElement, void 0); __privateAdd4(this, _mediaStore, void 0); __privateAdd4(this, _mediaStateCallback, void 0); __privateAdd4(this, _mediaStoreUnsubscribe, void 0); __privateAdd4(this, _mediaStateEventHandler, (event) => { var _a3; (_a3 = __privateGet4(this, _mediaStore)) == null ? void 0 : _a3.dispatch(event); }); this.associateElement(this); let prevState = {}; __privateSet4(this, _mediaStateCallback, (nextState) => { Object.entries(nextState).forEach(([stateName, stateValue]) => { if (stateName in prevState && prevState[stateName] === stateValue) return; this.propagateMediaState(stateName, stateValue); const attrName = stateName.toLowerCase(); const evt = new GlobalThis.CustomEvent( AttributeToStateChangeEventMap[attrName], { composed: true, detail: stateValue } ); this.dispatchEvent(evt); }); prevState = nextState; }); this.enableHotkeys(); } static get observedAttributes() { return super.observedAttributes.concat( Attributes2.NO_HOTKEYS, Attributes2.HOTKEYS, Attributes2.DEFAULT_STREAM_TYPE, Attributes2.DEFAULT_SUBTITLES, Attributes2.DEFAULT_DURATION ); } get mediaStore() { return __privateGet4(this, _mediaStore); } set mediaStore(value) { var _a3, _b2; if (__privateGet4(this, _mediaStore)) { (_a3 = __privateGet4(this, _mediaStoreUnsubscribe)) == null ? void 0 : _a3.call(this); __privateSet4(this, _mediaStoreUnsubscribe, void 0); } __privateSet4(this, _mediaStore, value); if (!__privateGet4(this, _mediaStore) && !this.hasAttribute(Attributes2.NO_DEFAULT_STORE)) { __privateMethod2(this, _setupDefaultStore, setupDefaultStore_fn).call(this); return; } __privateSet4(this, _mediaStoreUnsubscribe, (_b2 = __privateGet4(this, _mediaStore)) == null ? void 0 : _b2.subscribe( __privateGet4(this, _mediaStateCallback) )); } get fullscreenElement() { var _a3; return (_a3 = __privateGet4(this, _fullscreenElement)) != null ? _a3 : this; } set fullscreenElement(element) { var _a3; if (this.hasAttribute(Attributes2.FULLSCREEN_ELEMENT)) { this.removeAttribute(Attributes2.FULLSCREEN_ELEMENT); } __privateSet4(this, _fullscreenElement, element); (_a3 = __privateGet4(this, _mediaStore)) == null ? void 0 : _a3.dispatch({ type: "fullscreenelementchangerequest", detail: this.fullscreenElement }); } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d, _e, _f; super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === Attributes2.NO_HOTKEYS) { if (newValue !== oldValue && newValue === "") { if (this.hasAttribute(Attributes2.HOTKEYS)) { console.warn( "Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled." ); } this.disableHotkeys(); } else if (newValue !== oldValue && newValue === null) { this.enableHotkeys(); } } else if (attrName === Attributes2.HOTKEYS) { __privateGet4(this, _hotKeys).value = newValue; } else if (attrName === Attributes2.DEFAULT_SUBTITLES && newValue !== oldValue) { (_a3 = __privateGet4(this, _mediaStore)) == null ? void 0 : _a3.dispatch({ type: "optionschangerequest", detail: { defaultSubtitles: this.hasAttribute(Attributes2.DEFAULT_SUBTITLES) } }); } else if (attrName === Attributes2.DEFAULT_STREAM_TYPE) { (_c = __privateGet4(this, _mediaStore)) == null ? void 0 : _c.dispatch({ type: "optionschangerequest", detail: { defaultStreamType: (_b2 = this.getAttribute(Attributes2.DEFAULT_STREAM_TYPE)) != null ? _b2 : void 0 } }); } else if (attrName === Attributes2.LIVE_EDGE_OFFSET) { (_d = __privateGet4(this, _mediaStore)) == null ? void 0 : _d.dispatch({ type: "optionschangerequest", detail: { liveEdgeOffset: this.hasAttribute(Attributes2.LIVE_EDGE_OFFSET) ? +this.getAttribute(Attributes2.LIVE_EDGE_OFFSET) : void 0 } }); } else if (attrName === Attributes2.FULLSCREEN_ELEMENT) { const el = newValue ? (_e = this.getRootNode()) == null ? void 0 : _e.getElementById(newValue) : void 0; __privateSet4(this, _fullscreenElement, el); (_f = __privateGet4(this, _mediaStore)) == null ? void 0 : _f.dispatch({ type: "fullscreenelementchangerequest", detail: this.fullscreenElement }); } } connectedCallback() { var _a3, _b2; if (!__privateGet4(this, _mediaStore) && !this.hasAttribute(Attributes2.NO_DEFAULT_STORE)) { __privateMethod2(this, _setupDefaultStore, setupDefaultStore_fn).call(this); } (_a3 = __privateGet4(this, _mediaStore)) == null ? void 0 : _a3.dispatch({ type: "documentelementchangerequest", detail: Document2 }); super.connectedCallback(); if (__privateGet4(this, _mediaStore) && !__privateGet4(this, _mediaStoreUnsubscribe)) { __privateSet4(this, _mediaStoreUnsubscribe, (_b2 = __privateGet4(this, _mediaStore)) == null ? void 0 : _b2.subscribe( __privateGet4(this, _mediaStateCallback) )); } this.enableHotkeys(); } disconnectedCallback() { var _a3, _b2, _c, _d; (_a3 = super.disconnectedCallback) == null ? void 0 : _a3.call(this); if (__privateGet4(this, _mediaStore)) { (_b2 = __privateGet4(this, _mediaStore)) == null ? void 0 : _b2.dispatch({ type: "documentelementchangerequest", detail: void 0 }); (_c = __privateGet4(this, _mediaStore)) == null ? void 0 : _c.dispatch({ type: MediaUIEvents.MEDIA_TOGGLE_SUBTITLES_REQUEST, detail: false }); } if (__privateGet4(this, _mediaStoreUnsubscribe)) { (_d = __privateGet4(this, _mediaStoreUnsubscribe)) == null ? void 0 : _d.call(this); __privateSet4(this, _mediaStoreUnsubscribe, void 0); } } /** * @override * @param {HTMLMediaElement} media */ mediaSetCallback(media) { var _a3; super.mediaSetCallback(media); (_a3 = __privateGet4(this, _mediaStore)) == null ? void 0 : _a3.dispatch({ type: "mediaelementchangerequest", detail: media }); if (!media.hasAttribute("tabindex")) { media.tabIndex = -1; } } /** * @override * @param {HTMLMediaElement} media */ mediaUnsetCallback(media) { var _a3; super.mediaUnsetCallback(media); (_a3 = __privateGet4(this, _mediaStore)) == null ? void 0 : _a3.dispatch({ type: "mediaelementchangerequest", detail: void 0 }); } propagateMediaState(stateName, state) { propagateMediaState(this.mediaStateReceivers, stateName, state); } associateElement(element) { if (!element) return; const { associatedElementSubscriptions } = this; if (associatedElementSubscriptions.has(element)) return; const registerMediaStateReceiver = this.registerMediaStateReceiver.bind(this); const unregisterMediaStateReceiver = this.unregisterMediaStateReceiver.bind(this); const unsubscribe = monitorForMediaStateReceivers( element, registerMediaStateReceiver, unregisterMediaStateReceiver ); Object.values(MediaUIEvents).forEach((eventName) => { element.addEventListener(eventName, __privateGet4(this, _mediaStateEventHandler)); }); associatedElementSubscriptions.set(element, unsubscribe); } unassociateElement(element) { if (!element) return; const { associatedElementSubscriptions } = this; if (!associatedElementSubscriptions.has(element)) return; const unsubscribe = associatedElementSubscriptions.get(element); unsubscribe(); associatedElementSubscriptions.delete(element); Object.values(MediaUIEvents).forEach((eventName) => { element.removeEventListener(eventName, __privateGet4(this, _mediaStateEventHandler)); }); } registerMediaStateReceiver(el) { if (!el) return; const els = this.mediaStateReceivers; const index = els.indexOf(el); if (index > -1) return; els.push(el); if (__privateGet4(this, _mediaStore)) { Object.entries(__privateGet4(this, _mediaStore).getState()).forEach( ([stateName, stateValue]) => { propagateMediaState([el], stateName, stateValue); } ); } } unregisterMediaStateReceiver(el) { const els = this.mediaStateReceivers; const index = els.indexOf(el); if (index < 0) return; els.splice(index, 1); } enableHotkeys() { this.addEventListener("keydown", __privateMethod2(this, _keyDownHandler, keyDownHandler_fn)); } disableHotkeys() { this.removeEventListener("keydown", __privateMethod2(this, _keyDownHandler, keyDownHandler_fn)); this.removeEventListener("keyup", __privateMethod2(this, _keyUpHandler, keyUpHandler_fn)); } get hotkeys() { return __privateGet4(this, _hotKeys); } keyboardShortcutHandler(e) { var _a3, _b2, _c, _d, _e; const target = e.target; const keysUsed = ((_c = (_b2 = (_a3 = target.getAttribute(Attributes2.KEYS_USED)) == null ? void 0 : _a3.split(" ")) != null ? _b2 : target == null ? void 0 : target.keysUsed) != null ? _c : []).map((key) => key === "Space" ? " " : key).filter(Boolean); if (keysUsed.includes(e.key)) { return; } let eventName, detail, evt; if (__privateGet4(this, _hotKeys).contains(`no${e.key.toLowerCase()}`)) return; if (e.key === " " && __privateGet4(this, _hotKeys).contains(`nospace`)) return; switch (e.key) { case " ": case "k": eventName = __privateGet4(this, _mediaStore).getState().mediaPaused ? MediaUIEvents.MEDIA_PLAY_REQUEST : MediaUIEvents.MEDIA_PAUSE_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); break; case "m": eventName = this.mediaStore.getState().mediaVolumeLevel === "off" ? MediaUIEvents.MEDIA_UNMUTE_REQUEST : MediaUIEvents.MEDIA_MUTE_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); break; case "f": eventName = this.mediaStore.getState().mediaIsFullscreen ? MediaUIEvents.MEDIA_EXIT_FULLSCREEN_REQUEST : MediaUIEvents.MEDIA_ENTER_FULLSCREEN_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); break; case "c": this.dispatchEvent( new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_TOGGLE_SUBTITLES_REQUEST, { composed: true, bubbles: true } ) ); break; case "ArrowLeft": { const offsetValue = this.hasAttribute( Attributes2.KEYBOARD_BACKWARD_SEEK_OFFSET ) ? +this.getAttribute(Attributes2.KEYBOARD_BACKWARD_SEEK_OFFSET) : DEFAULT_SEEK_OFFSET; detail = Math.max( ((_d = this.mediaStore.getState().mediaCurrentTime) != null ? _d : 0) - offsetValue, 0 ); evt = new GlobalThis.CustomEvent(MediaUIEvents.MEDIA_SEEK_REQUEST, { composed: true, bubbles: true, detail }); this.dispatchEvent(evt); break; } case "ArrowRight": { const offsetValue = this.hasAttribute( Attributes2.KEYBOARD_FORWARD_SEEK_OFFSET ) ? +this.getAttribute(Attributes2.KEYBOARD_FORWARD_SEEK_OFFSET) : DEFAULT_SEEK_OFFSET; detail = Math.max( ((_e = this.mediaStore.getState().mediaCurrentTime) != null ? _e : 0) + offsetValue, 0 ); evt = new GlobalThis.CustomEvent(MediaUIEvents.MEDIA_SEEK_REQUEST, { composed: true, bubbles: true, detail }); this.dispatchEvent(evt); break; } default: break; } } }; _hotKeys = /* @__PURE__ */ new WeakMap(); _fullscreenElement = /* @__PURE__ */ new WeakMap(); _mediaStore = /* @__PURE__ */ new WeakMap(); _mediaStateCallback = /* @__PURE__ */ new WeakMap(); _mediaStoreUnsubscribe = /* @__PURE__ */ new WeakMap(); _mediaStateEventHandler = /* @__PURE__ */ new WeakMap(); _setupDefaultStore = /* @__PURE__ */ new WeakSet(); setupDefaultStore_fn = function() { var _a3; this.mediaStore = media_store_default({ media: this.media, fullscreenElement: this.fullscreenElement, options: { defaultSubtitles: this.hasAttribute(Attributes2.DEFAULT_SUBTITLES), defaultDuration: this.hasAttribute(Attributes2.DEFAULT_DURATION) ? +this.getAttribute(Attributes2.DEFAULT_DURATION) : void 0, defaultStreamType: ( /** @type {import('./media-store/state-mediator.js').StreamTypeValue} */ (_a3 = this.getAttribute( Attributes2.DEFAULT_STREAM_TYPE )) != null ? _a3 : void 0 ), liveEdgeOffset: this.hasAttribute(Attributes2.LIVE_EDGE_OFFSET) ? +this.getAttribute(Attributes2.LIVE_EDGE_OFFSET) : void 0, // NOTE: This wasn't updated if it was changed later. Should it be? (CJP) noVolumePref: this.hasAttribute(Attributes2.NO_VOLUME_PREF), noSubtitlesLangPref: this.hasAttribute( Attributes2.NO_SUBTITLES_LANG_PREF ) } }); }; _keyUpHandler = /* @__PURE__ */ new WeakSet(); keyUpHandler_fn = function(e) { const { key } = e; if (!ButtonPressedKeys.includes(key)) { this.removeEventListener("keyup", __privateMethod2(this, _keyUpHandler, keyUpHandler_fn)); return; } this.keyboardShortcutHandler(e); }; _keyDownHandler = /* @__PURE__ */ new WeakSet(); keyDownHandler_fn = function(e) { const { metaKey, altKey, key } = e; if (metaKey || altKey || !ButtonPressedKeys.includes(key)) { this.removeEventListener("keyup", __privateMethod2(this, _keyUpHandler, keyUpHandler_fn)); return; } if ([" ", "ArrowLeft", "ArrowRight"].includes(key) && !(__privateGet4(this, _hotKeys).contains(`no${key.toLowerCase()}`) || key === " " && __privateGet4(this, _hotKeys).contains("nospace"))) { e.preventDefault(); } this.addEventListener("keyup", __privateMethod2(this, _keyUpHandler, keyUpHandler_fn), { once: true }); }; var MEDIA_UI_ATTRIBUTE_NAMES2 = Object.values(MediaUIAttributes); var MEDIA_UI_PROP_NAMES = Object.values(MediaUIProps); var getMediaUIAttributesFrom = (child) => { var _a3, _b2, _c, _d; let { observedAttributes } = child.constructor; if (!observedAttributes && ((_a3 = child.nodeName) == null ? void 0 : _a3.includes("-"))) { GlobalThis.customElements.upgrade(child); ({ observedAttributes } = child.constructor); } const mediaChromeAttributesList = (_d = (_c = (_b2 = child == null ? void 0 : child.getAttribute) == null ? void 0 : _b2.call(child, MediaStateReceiverAttributes.MEDIA_CHROME_ATTRIBUTES)) == null ? void 0 : _c.split) == null ? void 0 : _d.call(_c, /\s+/); if (!Array.isArray(observedAttributes || mediaChromeAttributesList)) return []; return (observedAttributes || mediaChromeAttributesList).filter( (attrName) => MEDIA_UI_ATTRIBUTE_NAMES2.includes(attrName) ); }; var hasMediaUIProps = (mediaStateReceiverCandidate) => { var _a3, _b2; if (((_a3 = mediaStateReceiverCandidate.nodeName) == null ? void 0 : _a3.includes("-")) && !!GlobalThis.customElements.get( (_b2 = mediaStateReceiverCandidate.nodeName) == null ? void 0 : _b2.toLowerCase() ) && !(mediaStateReceiverCandidate instanceof GlobalThis.customElements.get( mediaStateReceiverCandidate.nodeName.toLowerCase() ))) { GlobalThis.customElements.upgrade(mediaStateReceiverCandidate); } return MEDIA_UI_PROP_NAMES.some( (propName) => propName in mediaStateReceiverCandidate ); }; var isMediaStateReceiver = (child) => { return hasMediaUIProps(child) || !!getMediaUIAttributesFrom(child).length; }; var serializeTuple = (tuple) => { var _a3; return (_a3 = tuple == null ? void 0 : tuple.join) == null ? void 0 : _a3.call(tuple, ":"); }; var CustomAttrSerializer = { [MediaUIAttributes.MEDIA_SUBTITLES_LIST]: stringifyTextTrackList, [MediaUIAttributes.MEDIA_SUBTITLES_SHOWING]: stringifyTextTrackList, [MediaUIAttributes.MEDIA_SEEKABLE]: serializeTuple, [MediaUIAttributes.MEDIA_BUFFERED]: (tuples) => tuples == null ? void 0 : tuples.map(serializeTuple).join(" "), [MediaUIAttributes.MEDIA_PREVIEW_COORDS]: (coords) => coords == null ? void 0 : coords.join(" "), [MediaUIAttributes.MEDIA_RENDITION_LIST]: stringifyRenditionList, [MediaUIAttributes.MEDIA_AUDIO_TRACK_LIST]: stringifyAudioTrackList }; var setAttr = async (child, attrName, attrValue) => { var _a3, _b2; if (!child.isConnected) { await delay(0); } if (typeof attrValue === "boolean" || attrValue == null) { return setBooleanAttr(child, attrName, attrValue); } if (typeof attrValue === "number") { return setNumericAttr(child, attrName, attrValue); } if (typeof attrValue === "string") { return setStringAttr(child, attrName, attrValue); } if (Array.isArray(attrValue) && !attrValue.length) { return child.removeAttribute(attrName); } const val = (_b2 = (_a3 = CustomAttrSerializer[attrName]) == null ? void 0 : _a3.call(CustomAttrSerializer, attrValue)) != null ? _b2 : attrValue; return child.setAttribute(attrName, val); }; var isMediaSlotElementDescendant = (el) => { var _a3; return !!((_a3 = el.closest) == null ? void 0 : _a3.call(el, '*[slot="media"]')); }; var traverseForMediaStateReceivers = (rootNode, mediaStateReceiverCallback) => { if (isMediaSlotElementDescendant(rootNode)) { return; } const traverseForMediaStateReceiversSync = (rootNode2, mediaStateReceiverCallback2) => { var _a3, _b2; if (isMediaStateReceiver(rootNode2)) { mediaStateReceiverCallback2(rootNode2); } const { children = [] } = rootNode2 != null ? rootNode2 : {}; const shadowChildren = (_b2 = (_a3 = rootNode2 == null ? void 0 : rootNode2.shadowRoot) == null ? void 0 : _a3.children) != null ? _b2 : []; const allChildren = [...children, ...shadowChildren]; allChildren.forEach( (child) => traverseForMediaStateReceivers( child, mediaStateReceiverCallback2 ) ); }; const name = rootNode == null ? void 0 : rootNode.nodeName.toLowerCase(); if (name.includes("-") && !isMediaStateReceiver(rootNode)) { GlobalThis.customElements.whenDefined(name).then(() => { traverseForMediaStateReceiversSync(rootNode, mediaStateReceiverCallback); }); return; } traverseForMediaStateReceiversSync(rootNode, mediaStateReceiverCallback); }; var propagateMediaState = (els, stateName, val) => { els.forEach((el) => { if (stateName in el) { el[stateName] = val; return; } const relevantAttrs = getMediaUIAttributesFrom(el); const attrName = stateName.toLowerCase(); if (!relevantAttrs.includes(attrName)) return; setAttr(el, attrName, val); }); }; var monitorForMediaStateReceivers = (rootNode, registerMediaStateReceiver, unregisterMediaStateReceiver) => { traverseForMediaStateReceivers(rootNode, registerMediaStateReceiver); const registerMediaStateReceiverHandler = (evt) => { var _a3; const el = (_a3 = evt == null ? void 0 : evt.composedPath()[0]) != null ? _a3 : evt.target; registerMediaStateReceiver(el); }; const unregisterMediaStateReceiverHandler = (evt) => { var _a3; const el = (_a3 = evt == null ? void 0 : evt.composedPath()[0]) != null ? _a3 : evt.target; unregisterMediaStateReceiver(el); }; rootNode.addEventListener( MediaUIEvents.REGISTER_MEDIA_STATE_RECEIVER, registerMediaStateReceiverHandler ); rootNode.addEventListener( MediaUIEvents.UNREGISTER_MEDIA_STATE_RECEIVER, unregisterMediaStateReceiverHandler ); const mutationCallback = (mutationsList) => { mutationsList.forEach((mutationRecord) => { const { addedNodes = [], removedNodes = [], type, target, attributeName } = mutationRecord; if (type === "childList") { Array.prototype.forEach.call( addedNodes, (node) => traverseForMediaStateReceivers( node, registerMediaStateReceiver ) ); Array.prototype.forEach.call( removedNodes, (node) => traverseForMediaStateReceivers( node, unregisterMediaStateReceiver ) ); } else if (type === "attributes" && attributeName === MediaStateReceiverAttributes.MEDIA_CHROME_ATTRIBUTES) { if (isMediaStateReceiver(target)) { registerMediaStateReceiver(target); } else { unregisterMediaStateReceiver(target); } } }); }; let prevSlotted = []; const slotChangeHandler = (event) => { const slotEl = event.target; if (slotEl.name === "media") return; prevSlotted.forEach( (node) => traverseForMediaStateReceivers(node, unregisterMediaStateReceiver) ); prevSlotted = [ ...slotEl.assignedElements({ flatten: true }) ]; prevSlotted.forEach( (node) => traverseForMediaStateReceivers(node, registerMediaStateReceiver) ); }; rootNode.addEventListener("slotchange", slotChangeHandler); const observer2 = new MutationObserver(mutationCallback); observer2.observe(rootNode, { childList: true, attributes: true, subtree: true }); const unsubscribe = () => { traverseForMediaStateReceivers(rootNode, unregisterMediaStateReceiver); rootNode.removeEventListener("slotchange", slotChangeHandler); observer2.disconnect(); rootNode.removeEventListener( MediaUIEvents.REGISTER_MEDIA_STATE_RECEIVER, registerMediaStateReceiverHandler ); rootNode.removeEventListener( MediaUIEvents.UNREGISTER_MEDIA_STATE_RECEIVER, unregisterMediaStateReceiverHandler ); }; return unsubscribe; }; if (!GlobalThis.customElements.get("media-controller")) { GlobalThis.customElements.define("media-controller", MediaController); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-chrome-button.js var __accessCheck5 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet5 = (obj, member, getter) => { __accessCheck5(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd5 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet5 = (obj, member, value, setter) => { __accessCheck5(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _mediaController2; var _clickListener; var _keyupListener; var _keydownListener; var Attributes3 = { TOOLTIP_PLACEMENT: "tooltipplacement" }; var template3 = Document2.createElement("template"); template3.innerHTML = /*html*/ ` `; var MediaChromeButton = class extends GlobalThis.HTMLElement { constructor(options = {}) { var _a3; super(); __privateAdd5(this, _mediaController2, void 0); this.preventClick = false; this.tooltipEl = null; this.tooltipContent = ""; __privateAdd5(this, _clickListener, (e) => { if (!this.preventClick) { this.handleClick(e); } setTimeout(this.tooltipEl.updateXOffset, 0); }); __privateAdd5(this, _keyupListener, (e) => { const { key } = e; if (!this.keysUsed.includes(key)) { this.removeEventListener("keyup", __privateGet5(this, _keyupListener)); return; } if (!this.preventClick) { this.handleClick(e); } }); __privateAdd5(this, _keydownListener, (e) => { const { metaKey, altKey, key } = e; if (metaKey || altKey || !this.keysUsed.includes(key)) { this.removeEventListener("keyup", __privateGet5(this, _keyupListener)); return; } this.addEventListener("keyup", __privateGet5(this, _keyupListener), { once: true }); }); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); const buttonHTML = template3.content.cloneNode(true); this.nativeEl = buttonHTML; let slotTemplate17 = options.slotTemplate; if (!slotTemplate17) { slotTemplate17 = Document2.createElement("template"); slotTemplate17.innerHTML = `${options.defaultContent || ""}`; } if (options.tooltipContent) { buttonHTML.querySelector('slot[name="tooltip-content"]').innerHTML = (_a3 = options.tooltipContent) != null ? _a3 : ""; this.tooltipContent = options.tooltipContent; } this.nativeEl.appendChild(slotTemplate17.content.cloneNode(true)); this.shadowRoot.appendChild(buttonHTML); this.tooltipEl = this.shadowRoot.querySelector("media-tooltip"); } } static get observedAttributes() { return [ "disabled", Attributes3.TOOLTIP_PLACEMENT, MediaStateReceiverAttributes.MEDIA_CONTROLLER ]; } enable() { this.addEventListener("click", __privateGet5(this, _clickListener)); this.addEventListener("keydown", __privateGet5(this, _keydownListener)); this.tabIndex = 0; } disable() { this.removeEventListener("click", __privateGet5(this, _clickListener)); this.removeEventListener("keydown", __privateGet5(this, _keydownListener)); this.removeEventListener("keyup", __privateGet5(this, _keyupListener)); this.tabIndex = -1; } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d, _e, _f, _g; if (attrName === MediaStateReceiverAttributes.MEDIA_CONTROLLER) { if (oldValue) { (_b2 = (_a3 = __privateGet5(this, _mediaController2)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet5(this, _mediaController2, null); } if (newValue && this.isConnected) { __privateSet5(this, _mediaController2, (_c = this.getRootNode()) == null ? void 0 : _c.getElementById(newValue)); (_e = (_d = __privateGet5(this, _mediaController2)) == null ? void 0 : _d.associateElement) == null ? void 0 : _e.call(_d, this); } } else if (attrName === "disabled" && newValue !== oldValue) { if (newValue == null) { this.enable(); } else { this.disable(); } } else if (attrName === Attributes3.TOOLTIP_PLACEMENT && this.tooltipEl && newValue !== oldValue) { this.tooltipEl.placement = newValue; } if (this.tooltipEl) { (_g = (_f = this.tooltipEl) == null ? void 0 : _f.updateXOffset) == null ? void 0 : _g.call(_f); } } connectedCallback() { var _a3, _b2, _c; const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); style.setProperty( "display", `var(--media-control-display, var(--${this.localName}-display, inline-flex))` ); if (!this.hasAttribute("disabled")) { this.enable(); } this.setAttribute("role", "button"); const mediaControllerId = this.getAttribute( MediaStateReceiverAttributes.MEDIA_CONTROLLER ); if (mediaControllerId) { __privateSet5( this, _mediaController2, // @ts-ignore (_a3 = this.getRootNode()) == null ? void 0 : _a3.getElementById(mediaControllerId) ); (_c = (_b2 = __privateGet5(this, _mediaController2)) == null ? void 0 : _b2.associateElement) == null ? void 0 : _c.call(_b2, this); } GlobalThis.customElements.whenDefined("media-tooltip").then(this.setupTooltip.bind(this)); } disconnectedCallback() { var _a3, _b2, _c, _d; this.disable(); (_b2 = (_a3 = __privateGet5(this, _mediaController2)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet5(this, _mediaController2, null); this.removeEventListener("mouseenter", (_c = this.tooltipEl) == null ? void 0 : _c.updateXOffset); this.removeEventListener("focus", (_d = this.tooltipEl) == null ? void 0 : _d.updateXOffset); this.removeEventListener("click", __privateGet5(this, _clickListener)); this.tooltipEl = null; } get keysUsed() { return ["Enter", " "]; } /** * Get or set tooltip placement */ get tooltipPlacement() { return getStringAttr(this, Attributes3.TOOLTIP_PLACEMENT); } set tooltipPlacement(value) { setStringAttr(this, Attributes3.TOOLTIP_PLACEMENT, value); } /** * @abstract * @argument {Event} e */ handleClick(e) { } // eslint-disable-line // Called when we know the tooltip is ready / defined setupTooltip() { this.addEventListener("mouseenter", this.tooltipEl.updateXOffset); this.addEventListener("focus", this.tooltipEl.updateXOffset); this.addEventListener("click", __privateGet5(this, _clickListener)); const initialPlacement = this.tooltipPlacement; if (initialPlacement) this.tooltipEl.placement = initialPlacement; } }; _mediaController2 = /* @__PURE__ */ new WeakMap(); _clickListener = /* @__PURE__ */ new WeakMap(); _keyupListener = /* @__PURE__ */ new WeakMap(); _keydownListener = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-chrome-button")) { GlobalThis.customElements.define("media-chrome-button", MediaChromeButton); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-airplay-button.js var airplayIcon = ` `; var slotTemplate = Document2.createElement("template"); slotTemplate.innerHTML = /*html*/ ` ${airplayIcon} ${airplayIcon} `; var tooltipContent = ( /*html*/ ` ${tooltipLabels.ENTER_AIRPLAY} ${tooltipLabels.EXIT_AIRPLAY} ` ); var updateAriaLabel = (el) => { const label = el.mediaIsAirplaying ? verbs.EXIT_AIRPLAY() : verbs.ENTER_AIRPLAY(); el.setAttribute("aria-label", label); }; var MediaAirplayButton = class extends MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_IS_AIRPLAYING, MediaUIAttributes.MEDIA_AIRPLAY_UNAVAILABLE ]; } constructor(options = {}) { super({ slotTemplate, tooltipContent, ...options }); } connectedCallback() { super.connectedCallback(); updateAriaLabel(this); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_IS_AIRPLAYING) { updateAriaLabel(this); } } /** * Are we currently airplaying */ get mediaIsAirplaying() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_IS_AIRPLAYING); } set mediaIsAirplaying(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_IS_AIRPLAYING, value); } /** * Airplay unavailability state */ get mediaAirplayUnavailable() { return getStringAttr(this, MediaUIAttributes.MEDIA_AIRPLAY_UNAVAILABLE); } set mediaAirplayUnavailable(value) { setStringAttr(this, MediaUIAttributes.MEDIA_AIRPLAY_UNAVAILABLE, value); } handleClick() { const evt = new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_AIRPLAY_REQUEST, { composed: true, bubbles: true } ); this.dispatchEvent(evt); } }; if (!GlobalThis.customElements.get("media-airplay-button")) { GlobalThis.customElements.define("media-airplay-button", MediaAirplayButton); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-captions-button.js var ccIconOn = ``; var ccIconOff = ``; var slotTemplate2 = Document2.createElement("template"); slotTemplate2.innerHTML = /*html*/ ` ${ccIconOn} ${ccIconOff} `; var tooltipContent2 = ( /*html*/ ` ${tooltipLabels.ENABLE_CAPTIONS} ${tooltipLabels.DISABLE_CAPTIONS} ` ); var updateAriaChecked = (el) => { el.setAttribute("aria-checked", areSubsOn(el).toString()); }; var MediaCaptionsButton = class extends MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_SUBTITLES_LIST, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING ]; } constructor(options = {}) { super({ slotTemplate: slotTemplate2, tooltipContent: tooltipContent2, ...options }); this._captionsReady = false; } connectedCallback() { super.connectedCallback(); this.setAttribute("role", "switch"); this.setAttribute("aria-label", nouns.CLOSED_CAPTIONS()); updateAriaChecked(this); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_SUBTITLES_SHOWING) { updateAriaChecked(this); } } /** * An array of TextTrack-like objects. * Objects must have the properties: kind, language, and label. */ get mediaSubtitlesList() { return getSubtitlesListAttr(this, MediaUIAttributes.MEDIA_SUBTITLES_LIST); } set mediaSubtitlesList(list) { setSubtitlesListAttr(this, MediaUIAttributes.MEDIA_SUBTITLES_LIST, list); } /** * An array of TextTrack-like objects. * Objects must have the properties: kind, language, and label. */ get mediaSubtitlesShowing() { return getSubtitlesListAttr( this, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING ); } set mediaSubtitlesShowing(list) { setSubtitlesListAttr(this, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING, list); } handleClick() { this.dispatchEvent( new GlobalThis.CustomEvent(MediaUIEvents.MEDIA_TOGGLE_SUBTITLES_REQUEST, { composed: true, bubbles: true }) ); } }; var getSubtitlesListAttr = (el, attrName) => { const attrVal = el.getAttribute(attrName); return attrVal ? parseTextTracksStr(attrVal) : []; }; var setSubtitlesListAttr = (el, attrName, list) => { if (!(list == null ? void 0 : list.length)) { el.removeAttribute(attrName); return; } const newValStr = stringifyTextTrackList(list); const oldVal = el.getAttribute(attrName); if (oldVal === newValStr) return; el.setAttribute(attrName, newValStr); }; if (!GlobalThis.customElements.get("media-captions-button")) { GlobalThis.customElements.define( "media-captions-button", MediaCaptionsButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-cast-button.js var enterIcon = ``; var exitIcon = ``; var slotTemplate3 = Document2.createElement("template"); slotTemplate3.innerHTML = /*html*/ ` ${enterIcon} ${exitIcon} `; var tooltipContent3 = ( /*html*/ ` ${tooltipLabels.START_CAST} ${tooltipLabels.STOP_CAST} ` ); var updateAriaLabel2 = (el) => { const label = el.mediaIsCasting ? verbs.EXIT_CAST() : verbs.ENTER_CAST(); el.setAttribute("aria-label", label); }; var MediaCastButton = class extends MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_IS_CASTING, MediaUIAttributes.MEDIA_CAST_UNAVAILABLE ]; } constructor(options = {}) { super({ slotTemplate: slotTemplate3, tooltipContent: tooltipContent3, ...options }); } connectedCallback() { super.connectedCallback(); updateAriaLabel2(this); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_IS_CASTING) { updateAriaLabel2(this); } } /** * @type {boolean} Are we currently casting */ get mediaIsCasting() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_IS_CASTING); } set mediaIsCasting(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_IS_CASTING, value); } /** * @type {string | undefined} Cast unavailability state */ get mediaCastUnavailable() { return getStringAttr(this, MediaUIAttributes.MEDIA_CAST_UNAVAILABLE); } set mediaCastUnavailable(value) { setStringAttr(this, MediaUIAttributes.MEDIA_CAST_UNAVAILABLE, value); } handleClick() { const eventName = this.mediaIsCasting ? MediaUIEvents.MEDIA_EXIT_CAST_REQUEST : MediaUIEvents.MEDIA_ENTER_CAST_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); } }; if (!GlobalThis.customElements.get("media-cast-button")) { GlobalThis.customElements.define("media-cast-button", MediaCastButton); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-chrome-dialog.js var __accessCheck6 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet6 = (obj, member, getter) => { __accessCheck6(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd6 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet6 = (obj, member, value, setter) => { __accessCheck6(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod3 = (obj, member, method) => { __accessCheck6(obj, member, "access private method"); return method; }; var _previouslyFocused; var _invokerElement; var _handleOpen; var handleOpen_fn; var _handleClosed; var handleClosed_fn; var _handleInvoke; var handleInvoke_fn; var _handleFocusOut; var handleFocusOut_fn; var _handleKeyDown; var handleKeyDown_fn; var template4 = Document2.createElement("template"); template4.innerHTML = /*html*/ ` `; var Attributes4 = { HIDDEN: "hidden", ANCHOR: "anchor" }; var MediaChromeDialog = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd6(this, _handleOpen); __privateAdd6(this, _handleClosed); __privateAdd6(this, _handleInvoke); __privateAdd6(this, _handleFocusOut); __privateAdd6(this, _handleKeyDown); __privateAdd6(this, _previouslyFocused, null); __privateAdd6(this, _invokerElement, null); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.nativeEl = this.constructor.template.content.cloneNode(true); this.shadowRoot.append(this.nativeEl); } this.addEventListener("invoke", this); this.addEventListener("focusout", this); this.addEventListener("keydown", this); } static get observedAttributes() { return [Attributes4.HIDDEN, Attributes4.ANCHOR]; } handleEvent(event) { switch (event.type) { case "invoke": __privateMethod3(this, _handleInvoke, handleInvoke_fn).call(this, event); break; case "focusout": __privateMethod3(this, _handleFocusOut, handleFocusOut_fn).call(this, event); break; case "keydown": __privateMethod3(this, _handleKeyDown, handleKeyDown_fn).call(this, event); break; } } connectedCallback() { if (!this.role) { this.role = "dialog"; } } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === Attributes4.HIDDEN && newValue !== oldValue) { if (this.hidden) { __privateMethod3(this, _handleClosed, handleClosed_fn).call(this); } else { __privateMethod3(this, _handleOpen, handleOpen_fn).call(this); } } } focus() { __privateSet6(this, _previouslyFocused, getActiveElement()); const focusable = this.querySelector( '[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]' ); focusable == null ? void 0 : focusable.focus(); } get keysUsed() { return ["Escape", "Tab"]; } }; _previouslyFocused = /* @__PURE__ */ new WeakMap(); _invokerElement = /* @__PURE__ */ new WeakMap(); _handleOpen = /* @__PURE__ */ new WeakSet(); handleOpen_fn = function() { var _a3; (_a3 = __privateGet6(this, _invokerElement)) == null ? void 0 : _a3.setAttribute("aria-expanded", "true"); this.addEventListener("transitionend", () => this.focus(), { once: true }); }; _handleClosed = /* @__PURE__ */ new WeakSet(); handleClosed_fn = function() { var _a3; (_a3 = __privateGet6(this, _invokerElement)) == null ? void 0 : _a3.setAttribute("aria-expanded", "false"); }; _handleInvoke = /* @__PURE__ */ new WeakSet(); handleInvoke_fn = function(event) { __privateSet6(this, _invokerElement, event.relatedTarget); if (!containsComposedNode(this, event.relatedTarget)) { this.hidden = !this.hidden; } }; _handleFocusOut = /* @__PURE__ */ new WeakSet(); handleFocusOut_fn = function(event) { var _a3; if (!containsComposedNode(this, event.relatedTarget)) { (_a3 = __privateGet6(this, _previouslyFocused)) == null ? void 0 : _a3.focus(); if (__privateGet6(this, _invokerElement) && __privateGet6(this, _invokerElement) !== event.relatedTarget && !this.hidden) { this.hidden = true; } } }; _handleKeyDown = /* @__PURE__ */ new WeakSet(); handleKeyDown_fn = function(event) { var _a3, _b2, _c, _d, _e; const { key, ctrlKey, altKey, metaKey } = event; if (ctrlKey || altKey || metaKey) { return; } if (!this.keysUsed.includes(key)) { return; } event.preventDefault(); event.stopPropagation(); if (key === "Tab") { if (event.shiftKey) { (_b2 = (_a3 = this.previousElementSibling) == null ? void 0 : _a3.focus) == null ? void 0 : _b2.call(_a3); } else { (_d = (_c = this.nextElementSibling) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c); } this.blur(); } else if (key === "Escape") { (_e = __privateGet6(this, _previouslyFocused)) == null ? void 0 : _e.focus(); this.hidden = true; } }; MediaChromeDialog.template = template4; if (!GlobalThis.customElements.get("media-chrome-dialog")) { GlobalThis.customElements.define("media-chrome-dialog", MediaChromeDialog); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-chrome-range.js var __accessCheck7 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet7 = (obj, member, getter) => { __accessCheck7(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd7 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet7 = (obj, member, value, setter) => { __accessCheck7(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod4 = (obj, member, method) => { __accessCheck7(obj, member, "access private method"); return method; }; var _mediaController3; var _isInputTarget; var _startpoint; var _endpoint; var _cssRules; var _segments; var _onFocusIn; var _onFocusOut; var _updateComputedStyles; var _updateActiveSegment; var updateActiveSegment_fn; var _enableUserEvents; var enableUserEvents_fn; var _disableUserEvents; var disableUserEvents_fn; var _handlePointerDown; var handlePointerDown_fn; var _handlePointerEnter; var handlePointerEnter_fn; var _handlePointerUp2; var handlePointerUp_fn2; var _handlePointerLeave; var handlePointerLeave_fn; var _handlePointerMove2; var handlePointerMove_fn2; var template5 = Document2.createElement("template"); template5.innerHTML = /*html*/ `
`; var MediaChromeRange = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd7(this, _updateActiveSegment); __privateAdd7(this, _enableUserEvents); __privateAdd7(this, _disableUserEvents); __privateAdd7(this, _handlePointerDown); __privateAdd7(this, _handlePointerEnter); __privateAdd7(this, _handlePointerUp2); __privateAdd7(this, _handlePointerLeave); __privateAdd7(this, _handlePointerMove2); __privateAdd7(this, _mediaController3, void 0); __privateAdd7(this, _isInputTarget, void 0); __privateAdd7(this, _startpoint, void 0); __privateAdd7(this, _endpoint, void 0); __privateAdd7(this, _cssRules, {}); __privateAdd7(this, _segments, []); __privateAdd7(this, _onFocusIn, () => { if (this.range.matches(":focus-visible")) { const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); style.setProperty( "--_focus-visible-box-shadow", "var(--_focus-box-shadow)" ); } }); __privateAdd7(this, _onFocusOut, () => { const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); style.removeProperty("--_focus-visible-box-shadow"); }); __privateAdd7(this, _updateComputedStyles, () => { const clipping = this.shadowRoot.querySelector("#segments-clipping"); if (clipping) clipping.parentNode.append(clipping); }); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template5.content.cloneNode(true)); } this.container = this.shadowRoot.querySelector("#container"); __privateSet7(this, _startpoint, this.shadowRoot.querySelector("#startpoint")); __privateSet7(this, _endpoint, this.shadowRoot.querySelector("#endpoint")); this.range = this.shadowRoot.querySelector("#range"); this.appearance = this.shadowRoot.querySelector("#appearance"); } static get observedAttributes() { return [ "disabled", "aria-disabled", MediaStateReceiverAttributes.MEDIA_CONTROLLER ]; } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d, _e; if (attrName === MediaStateReceiverAttributes.MEDIA_CONTROLLER) { if (oldValue) { (_b2 = (_a3 = __privateGet7(this, _mediaController3)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet7(this, _mediaController3, null); } if (newValue && this.isConnected) { __privateSet7(this, _mediaController3, (_c = this.getRootNode()) == null ? void 0 : _c.getElementById(newValue)); (_e = (_d = __privateGet7(this, _mediaController3)) == null ? void 0 : _d.associateElement) == null ? void 0 : _e.call(_d, this); } } else if (attrName === "disabled" || attrName === "aria-disabled" && oldValue !== newValue) { if (newValue == null) { this.range.removeAttribute(attrName); __privateMethod4(this, _enableUserEvents, enableUserEvents_fn).call(this); } else { this.range.setAttribute(attrName, newValue); __privateMethod4(this, _disableUserEvents, disableUserEvents_fn).call(this); } } } connectedCallback() { var _a3, _b2, _c; const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); style.setProperty( "display", `var(--media-control-display, var(--${this.localName}-display, inline-flex))` ); __privateGet7(this, _cssRules).pointer = getOrInsertCSSRule(this.shadowRoot, "#pointer"); __privateGet7(this, _cssRules).progress = getOrInsertCSSRule(this.shadowRoot, "#progress"); __privateGet7(this, _cssRules).thumb = getOrInsertCSSRule(this.shadowRoot, "#thumb"); const mediaControllerId = this.getAttribute( MediaStateReceiverAttributes.MEDIA_CONTROLLER ); if (mediaControllerId) { __privateSet7(this, _mediaController3, (_a3 = this.getRootNode()) == null ? void 0 : _a3.getElementById( mediaControllerId )); (_c = (_b2 = __privateGet7(this, _mediaController3)) == null ? void 0 : _b2.associateElement) == null ? void 0 : _c.call(_b2, this); } this.updateBar(); this.shadowRoot.addEventListener("focusin", __privateGet7(this, _onFocusIn)); this.shadowRoot.addEventListener("focusout", __privateGet7(this, _onFocusOut)); __privateMethod4(this, _enableUserEvents, enableUserEvents_fn).call(this); observeResize(this.container, __privateGet7(this, _updateComputedStyles)); } disconnectedCallback() { var _a3, _b2; __privateMethod4(this, _disableUserEvents, disableUserEvents_fn).call(this); (_b2 = (_a3 = __privateGet7(this, _mediaController3)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet7(this, _mediaController3, null); this.shadowRoot.removeEventListener("focusin", __privateGet7(this, _onFocusIn)); this.shadowRoot.removeEventListener("focusout", __privateGet7(this, _onFocusOut)); unobserveResize(this.container, __privateGet7(this, _updateComputedStyles)); } updatePointerBar(evt) { var _a3; (_a3 = __privateGet7(this, _cssRules).pointer) == null ? void 0 : _a3.style.setProperty( "width", `${this.getPointerRatio(evt) * 100}%` ); } updateBar() { var _a3, _b2; const rangePercent = this.range.valueAsNumber * 100; (_a3 = __privateGet7(this, _cssRules).progress) == null ? void 0 : _a3.style.setProperty("width", `${rangePercent}%`); (_b2 = __privateGet7(this, _cssRules).thumb) == null ? void 0 : _b2.style.setProperty("left", `${rangePercent}%`); } updateSegments(segments) { const clipping = this.shadowRoot.querySelector("#segments-clipping"); clipping.textContent = ""; this.container.classList.toggle("segments", !!(segments == null ? void 0 : segments.length)); if (!(segments == null ? void 0 : segments.length)) return; __privateGet7(this, _cssRules).activeSegment = insertCSSRule( this.shadowRoot, "#segments-clipping rect:nth-child(0)" ); const normalized = [ .../* @__PURE__ */ new Set([ +this.range.min, ...segments.flatMap((s) => [s.start, s.end]), +this.range.max ]) ]; __privateSet7(this, _segments, [...normalized]); const lastMarker = normalized.pop(); for (const [i, marker] of normalized.entries()) { const [isFirst, isLast] = [i === 0, i === normalized.length - 1]; const x = isFirst ? "calc(var(--segments-gap) / -1)" : `${marker * 100}%`; const x2 = isLast ? lastMarker : normalized[i + 1]; const width = `calc(${(x2 - marker) * 100}%${isFirst || isLast ? "" : ` - var(--segments-gap)`})`; const segmentEl = Document2.createElementNS( "http://www.w3.org/2000/svg", "rect" ); const cssRule = getOrInsertCSSRule( this.shadowRoot, `#segments-clipping rect:nth-child(${i + 1})` ); cssRule.style.setProperty("x", x); cssRule.style.setProperty("width", width); clipping.append(segmentEl); } } getPointerRatio(evt) { const pointerRatio = getPointProgressOnLine( evt.clientX, evt.clientY, __privateGet7(this, _startpoint).getBoundingClientRect(), __privateGet7(this, _endpoint).getBoundingClientRect() ); return Math.max(0, Math.min(1, pointerRatio)); } get dragging() { return this.hasAttribute("dragging"); } handleEvent(evt) { switch (evt.type) { case "pointermove": __privateMethod4(this, _handlePointerMove2, handlePointerMove_fn2).call(this, evt); break; case "input": this.updateBar(); break; case "pointerenter": __privateMethod4(this, _handlePointerEnter, handlePointerEnter_fn).call(this, evt); break; case "pointerdown": __privateMethod4(this, _handlePointerDown, handlePointerDown_fn).call(this, evt); break; case "pointerup": __privateMethod4(this, _handlePointerUp2, handlePointerUp_fn2).call(this); break; case "pointerleave": __privateMethod4(this, _handlePointerLeave, handlePointerLeave_fn).call(this); break; } } get keysUsed() { return ["ArrowUp", "ArrowRight", "ArrowDown", "ArrowLeft"]; } }; _mediaController3 = /* @__PURE__ */ new WeakMap(); _isInputTarget = /* @__PURE__ */ new WeakMap(); _startpoint = /* @__PURE__ */ new WeakMap(); _endpoint = /* @__PURE__ */ new WeakMap(); _cssRules = /* @__PURE__ */ new WeakMap(); _segments = /* @__PURE__ */ new WeakMap(); _onFocusIn = /* @__PURE__ */ new WeakMap(); _onFocusOut = /* @__PURE__ */ new WeakMap(); _updateComputedStyles = /* @__PURE__ */ new WeakMap(); _updateActiveSegment = /* @__PURE__ */ new WeakSet(); updateActiveSegment_fn = function(evt) { const rule = __privateGet7(this, _cssRules).activeSegment; if (!rule) return; const pointerRatio = this.getPointerRatio(evt); const segmentIndex = __privateGet7(this, _segments).findIndex((start, i, arr) => { const end = arr[i + 1]; return end != null && pointerRatio >= start && pointerRatio <= end; }); const selectorText = `#segments-clipping rect:nth-child(${segmentIndex + 1})`; if (rule.selectorText != selectorText || !rule.style.transform) { rule.selectorText = selectorText; rule.style.setProperty( "transform", "var(--media-range-segment-hover-transform, scaleY(2))" ); } }; _enableUserEvents = /* @__PURE__ */ new WeakSet(); enableUserEvents_fn = function() { if (this.hasAttribute("disabled")) return; this.addEventListener("input", this); this.addEventListener("pointerdown", this); this.addEventListener("pointerenter", this); }; _disableUserEvents = /* @__PURE__ */ new WeakSet(); disableUserEvents_fn = function() { var _a3, _b2; this.removeEventListener("input", this); this.removeEventListener("pointerdown", this); this.removeEventListener("pointerenter", this); (_a3 = GlobalThis.window) == null ? void 0 : _a3.removeEventListener("pointerup", this); (_b2 = GlobalThis.window) == null ? void 0 : _b2.removeEventListener("pointermove", this); }; _handlePointerDown = /* @__PURE__ */ new WeakSet(); handlePointerDown_fn = function(evt) { var _a3; __privateSet7(this, _isInputTarget, evt.composedPath().includes(this.range)); (_a3 = GlobalThis.window) == null ? void 0 : _a3.addEventListener("pointerup", this); }; _handlePointerEnter = /* @__PURE__ */ new WeakSet(); handlePointerEnter_fn = function(evt) { var _a3; if (evt.pointerType !== "mouse") __privateMethod4(this, _handlePointerDown, handlePointerDown_fn).call(this, evt); this.addEventListener("pointerleave", this); (_a3 = GlobalThis.window) == null ? void 0 : _a3.addEventListener("pointermove", this); }; _handlePointerUp2 = /* @__PURE__ */ new WeakSet(); handlePointerUp_fn2 = function() { var _a3; (_a3 = GlobalThis.window) == null ? void 0 : _a3.removeEventListener("pointerup", this); this.toggleAttribute("dragging", false); this.range.disabled = this.hasAttribute("disabled"); }; _handlePointerLeave = /* @__PURE__ */ new WeakSet(); handlePointerLeave_fn = function() { var _a3, _b2; this.removeEventListener("pointerleave", this); (_a3 = GlobalThis.window) == null ? void 0 : _a3.removeEventListener("pointermove", this); this.toggleAttribute("dragging", false); this.range.disabled = this.hasAttribute("disabled"); (_b2 = __privateGet7(this, _cssRules).activeSegment) == null ? void 0 : _b2.style.removeProperty("transform"); }; _handlePointerMove2 = /* @__PURE__ */ new WeakSet(); handlePointerMove_fn2 = function(evt) { this.toggleAttribute( "dragging", evt.buttons === 1 || evt.pointerType !== "mouse" ); this.updatePointerBar(evt); __privateMethod4(this, _updateActiveSegment, updateActiveSegment_fn).call(this, evt); if (this.dragging && (evt.pointerType !== "mouse" || !__privateGet7(this, _isInputTarget))) { this.range.disabled = true; this.range.valueAsNumber = this.getPointerRatio(evt); this.range.dispatchEvent( new Event("input", { bubbles: true, composed: true }) ); } }; if (!GlobalThis.customElements.get("media-chrome-range")) { GlobalThis.customElements.define("media-chrome-range", MediaChromeRange); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-control-bar.js var __accessCheck8 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet8 = (obj, member, getter) => { __accessCheck8(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd8 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet8 = (obj, member, value, setter) => { __accessCheck8(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _mediaController4; var template6 = Document2.createElement("template"); template6.innerHTML = /*html*/ ` `; var MediaControlBar = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd8(this, _mediaController4, void 0); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template6.content.cloneNode(true)); } } static get observedAttributes() { return [MediaStateReceiverAttributes.MEDIA_CONTROLLER]; } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d, _e; if (attrName === MediaStateReceiverAttributes.MEDIA_CONTROLLER) { if (oldValue) { (_b2 = (_a3 = __privateGet8(this, _mediaController4)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet8(this, _mediaController4, null); } if (newValue && this.isConnected) { __privateSet8(this, _mediaController4, (_c = this.getRootNode()) == null ? void 0 : _c.getElementById(newValue)); (_e = (_d = __privateGet8(this, _mediaController4)) == null ? void 0 : _d.associateElement) == null ? void 0 : _e.call(_d, this); } } } connectedCallback() { var _a3, _b2, _c; const mediaControllerId = this.getAttribute( MediaStateReceiverAttributes.MEDIA_CONTROLLER ); if (mediaControllerId) { __privateSet8(this, _mediaController4, (_a3 = this.getRootNode()) == null ? void 0 : _a3.getElementById( mediaControllerId )); (_c = (_b2 = __privateGet8(this, _mediaController4)) == null ? void 0 : _b2.associateElement) == null ? void 0 : _c.call(_b2, this); } } disconnectedCallback() { var _a3, _b2; (_b2 = (_a3 = __privateGet8(this, _mediaController4)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet8(this, _mediaController4, null); } }; _mediaController4 = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-control-bar")) { GlobalThis.customElements.define("media-control-bar", MediaControlBar); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-text-display.js var __accessCheck9 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet9 = (obj, member, getter) => { __accessCheck9(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd9 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet9 = (obj, member, value, setter) => { __accessCheck9(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _mediaController5; var template7 = Document2.createElement("template"); template7.innerHTML = /*html*/ ` `; var MediaTextDisplay = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd9(this, _mediaController5, void 0); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template7.content.cloneNode(true)); } } static get observedAttributes() { return [MediaStateReceiverAttributes.MEDIA_CONTROLLER]; } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d, _e; if (attrName === MediaStateReceiverAttributes.MEDIA_CONTROLLER) { if (oldValue) { (_b2 = (_a3 = __privateGet9(this, _mediaController5)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet9(this, _mediaController5, null); } if (newValue && this.isConnected) { __privateSet9(this, _mediaController5, (_c = this.getRootNode()) == null ? void 0 : _c.getElementById(newValue)); (_e = (_d = __privateGet9(this, _mediaController5)) == null ? void 0 : _d.associateElement) == null ? void 0 : _e.call(_d, this); } } } connectedCallback() { var _a3, _b2, _c; const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); style.setProperty( "display", `var(--media-control-display, var(--${this.localName}-display, inline-flex))` ); const mediaControllerId = this.getAttribute( MediaStateReceiverAttributes.MEDIA_CONTROLLER ); if (mediaControllerId) { __privateSet9(this, _mediaController5, (_a3 = this.getRootNode()) == null ? void 0 : _a3.getElementById( mediaControllerId )); (_c = (_b2 = __privateGet9(this, _mediaController5)) == null ? void 0 : _b2.associateElement) == null ? void 0 : _c.call(_b2, this); } } disconnectedCallback() { var _a3, _b2; (_b2 = (_a3 = __privateGet9(this, _mediaController5)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet9(this, _mediaController5, null); } }; _mediaController5 = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-text-display")) { GlobalThis.customElements.define("media-text-display", MediaTextDisplay); } var media_text_display_default = MediaTextDisplay; // ../../node_modules/player.style/node_modules/media-chrome/dist/media-duration-display.js var __accessCheck10 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet10 = (obj, member, getter) => { __accessCheck10(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd10 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet10 = (obj, member, value, setter) => { __accessCheck10(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _slot; var MediaDurationDisplay = class extends MediaTextDisplay { constructor() { super(); __privateAdd10(this, _slot, void 0); __privateSet10(this, _slot, this.shadowRoot.querySelector("slot")); __privateGet10(this, _slot).textContent = formatTime(0); } static get observedAttributes() { return [...super.observedAttributes, MediaUIAttributes.MEDIA_DURATION]; } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === MediaUIAttributes.MEDIA_DURATION) { __privateGet10(this, _slot).textContent = formatTime(+newValue); } super.attributeChangedCallback(attrName, oldValue, newValue); } /** * @type {number | undefined} In seconds */ get mediaDuration() { return getNumericAttr(this, MediaUIAttributes.MEDIA_DURATION); } set mediaDuration(time) { setNumericAttr(this, MediaUIAttributes.MEDIA_DURATION, time); } }; _slot = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-duration-display")) { GlobalThis.customElements.define( "media-duration-display", MediaDurationDisplay ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-fullscreen-button.js var enterFullscreenIcon = ``; var exitFullscreenIcon = ``; var slotTemplate4 = Document2.createElement("template"); slotTemplate4.innerHTML = /*html*/ ` ${enterFullscreenIcon} ${exitFullscreenIcon} `; var tooltipContent4 = ( /*html*/ ` ${tooltipLabels.ENTER_FULLSCREEN} ${tooltipLabels.EXIT_FULLSCREEN} ` ); var updateAriaLabel3 = (el) => { const label = el.mediaIsFullscreen ? verbs.EXIT_FULLSCREEN() : verbs.ENTER_FULLSCREEN(); el.setAttribute("aria-label", label); }; var MediaFullscreenButton = class extends MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_IS_FULLSCREEN, MediaUIAttributes.MEDIA_FULLSCREEN_UNAVAILABLE ]; } constructor(options = {}) { super({ slotTemplate: slotTemplate4, tooltipContent: tooltipContent4, ...options }); } connectedCallback() { super.connectedCallback(); updateAriaLabel3(this); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_IS_FULLSCREEN) { updateAriaLabel3(this); } } /** * @type {string | undefined} Fullscreen unavailability state */ get mediaFullscreenUnavailable() { return getStringAttr(this, MediaUIAttributes.MEDIA_FULLSCREEN_UNAVAILABLE); } set mediaFullscreenUnavailable(value) { setStringAttr(this, MediaUIAttributes.MEDIA_FULLSCREEN_UNAVAILABLE, value); } /** * @type {boolean} Whether fullscreen is available */ get mediaIsFullscreen() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_IS_FULLSCREEN); } set mediaIsFullscreen(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_IS_FULLSCREEN, value); } handleClick() { const eventName = this.mediaIsFullscreen ? MediaUIEvents.MEDIA_EXIT_FULLSCREEN_REQUEST : MediaUIEvents.MEDIA_ENTER_FULLSCREEN_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); } }; if (!GlobalThis.customElements.get("media-fullscreen-button")) { GlobalThis.customElements.define( "media-fullscreen-button", MediaFullscreenButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-live-button.js var { MEDIA_TIME_IS_LIVE, MEDIA_PAUSED } = MediaUIAttributes; var { MEDIA_SEEK_TO_LIVE_REQUEST, MEDIA_PLAY_REQUEST } = MediaUIEvents; var indicatorSVG = ''; var slotTemplate5 = Document2.createElement("template"); slotTemplate5.innerHTML = /*html*/ ` ${indicatorSVG} ${/* A new line between spacer and text creates inconsistent spacing between slotted items and default slots. */ ""}  LIVE `; var updateAriaAttributes = (el) => { const isPausedOrNotLive = el.mediaPaused || !el.mediaTimeIsLive; const label = isPausedOrNotLive ? verbs.SEEK_LIVE() : verbs.PLAYING_LIVE(); el.setAttribute("aria-label", label); isPausedOrNotLive ? el.removeAttribute("aria-disabled") : el.setAttribute("aria-disabled", "true"); }; var MediaLiveButton = class extends MediaChromeButton { static get observedAttributes() { return [...super.observedAttributes, MEDIA_PAUSED, MEDIA_TIME_IS_LIVE]; } constructor(options = {}) { super({ slotTemplate: slotTemplate5, ...options }); } connectedCallback() { updateAriaAttributes(this); super.connectedCallback(); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); updateAriaAttributes(this); } /** * @type {boolean} Is the media paused */ get mediaPaused() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED); } set mediaPaused(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED, value); } /** * @type {boolean} Is the media playback currently live */ get mediaTimeIsLive() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_TIME_IS_LIVE); } set mediaTimeIsLive(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_TIME_IS_LIVE, value); } handleClick() { if (!this.mediaPaused && this.mediaTimeIsLive) return; this.dispatchEvent( new GlobalThis.CustomEvent(MEDIA_SEEK_TO_LIVE_REQUEST, { composed: true, bubbles: true }) ); if (this.hasAttribute(MEDIA_PAUSED)) { this.dispatchEvent( new GlobalThis.CustomEvent(MEDIA_PLAY_REQUEST, { composed: true, bubbles: true }) ); } } }; if (!GlobalThis.customElements.get("media-live-button")) { GlobalThis.customElements.define("media-live-button", MediaLiveButton); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-loading-indicator.js var __accessCheck11 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet11 = (obj, member, getter) => { __accessCheck11(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd11 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet11 = (obj, member, value, setter) => { __accessCheck11(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _mediaController6; var _delay; var Attributes5 = { LOADING_DELAY: "loadingdelay" }; var DEFAULT_LOADING_DELAY = 500; var template8 = Document2.createElement("template"); var loadingIndicatorIcon = ` `; template8.innerHTML = /*html*/ ` ${loadingIndicatorIcon}
${nouns.MEDIA_LOADING()}
`; var MediaLoadingIndicator = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd11(this, _mediaController6, void 0); __privateAdd11(this, _delay, DEFAULT_LOADING_DELAY); if (!this.shadowRoot) { const shadow = this.attachShadow({ mode: "open" }); const indicatorHTML = template8.content.cloneNode(true); shadow.appendChild(indicatorHTML); } } static get observedAttributes() { return [ MediaStateReceiverAttributes.MEDIA_CONTROLLER, MediaUIAttributes.MEDIA_PAUSED, MediaUIAttributes.MEDIA_LOADING, Attributes5.LOADING_DELAY ]; } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d, _e; if (attrName === Attributes5.LOADING_DELAY && oldValue !== newValue) { this.loadingDelay = Number(newValue); } else if (attrName === MediaStateReceiverAttributes.MEDIA_CONTROLLER) { if (oldValue) { (_b2 = (_a3 = __privateGet11(this, _mediaController6)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet11(this, _mediaController6, null); } if (newValue && this.isConnected) { __privateSet11(this, _mediaController6, (_c = this.getRootNode()) == null ? void 0 : _c.getElementById(newValue)); (_e = (_d = __privateGet11(this, _mediaController6)) == null ? void 0 : _d.associateElement) == null ? void 0 : _e.call(_d, this); } } } connectedCallback() { var _a3, _b2, _c; const mediaControllerId = this.getAttribute( MediaStateReceiverAttributes.MEDIA_CONTROLLER ); if (mediaControllerId) { __privateSet11(this, _mediaController6, (_a3 = this.getRootNode()) == null ? void 0 : _a3.getElementById( mediaControllerId )); (_c = (_b2 = __privateGet11(this, _mediaController6)) == null ? void 0 : _b2.associateElement) == null ? void 0 : _c.call(_b2, this); } } disconnectedCallback() { var _a3, _b2; (_b2 = (_a3 = __privateGet11(this, _mediaController6)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet11(this, _mediaController6, null); } /** * Delay in ms */ get loadingDelay() { return __privateGet11(this, _delay); } set loadingDelay(delay2) { __privateSet11(this, _delay, delay2); const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); style.setProperty( "--_loading-indicator-delay", `var(--media-loading-indicator-transition-delay, ${delay2}ms)` ); } /** * Is the media paused */ get mediaPaused() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED); } set mediaPaused(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED, value); } /** * Is the media loading */ get mediaLoading() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_LOADING); } set mediaLoading(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_LOADING, value); } }; _mediaController6 = /* @__PURE__ */ new WeakMap(); _delay = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-loading-indicator")) { GlobalThis.customElements.define( "media-loading-indicator", MediaLoadingIndicator ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-mute-button.js var { MEDIA_VOLUME_LEVEL } = MediaUIAttributes; var offIcon = ``; var lowIcon = ``; var highIcon = ``; var slotTemplate6 = Document2.createElement("template"); slotTemplate6.innerHTML = /*html*/ ` ${offIcon} ${lowIcon} ${lowIcon} ${highIcon} `; var tooltipContent5 = ( /*html*/ ` ${tooltipLabels.MUTE} ${tooltipLabels.UNMUTE} ` ); var updateAriaLabel4 = (el) => { const muted = el.mediaVolumeLevel === "off"; const label = muted ? verbs.UNMUTE() : verbs.MUTE(); el.setAttribute("aria-label", label); }; var MediaMuteButton = class extends MediaChromeButton { static get observedAttributes() { return [...super.observedAttributes, MediaUIAttributes.MEDIA_VOLUME_LEVEL]; } constructor(options = {}) { super({ slotTemplate: slotTemplate6, tooltipContent: tooltipContent5, ...options }); } connectedCallback() { updateAriaLabel4(this); super.connectedCallback(); } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === MediaUIAttributes.MEDIA_VOLUME_LEVEL) { updateAriaLabel4(this); } super.attributeChangedCallback(attrName, oldValue, newValue); } /** * @type {string | undefined} */ get mediaVolumeLevel() { return getStringAttr(this, MediaUIAttributes.MEDIA_VOLUME_LEVEL); } set mediaVolumeLevel(value) { setStringAttr(this, MediaUIAttributes.MEDIA_VOLUME_LEVEL, value); } handleClick() { const eventName = this.mediaVolumeLevel === "off" ? MediaUIEvents.MEDIA_UNMUTE_REQUEST : MediaUIEvents.MEDIA_MUTE_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); } }; if (!GlobalThis.customElements.get("media-mute-button")) { GlobalThis.customElements.define("media-mute-button", MediaMuteButton); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-pip-button.js var pipIcon = ``; var slotTemplate7 = Document2.createElement("template"); slotTemplate7.innerHTML = /*html*/ ` ${pipIcon} ${pipIcon} `; var tooltipContent6 = ( /*html*/ ` ${tooltipLabels.ENTER_PIP} ${tooltipLabels.EXIT_PIP} ` ); var updateAriaLabel5 = (el) => { const label = el.mediaIsPip ? verbs.EXIT_PIP() : verbs.ENTER_PIP(); el.setAttribute("aria-label", label); }; var MediaPipButton = class extends MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_IS_PIP, MediaUIAttributes.MEDIA_PIP_UNAVAILABLE ]; } constructor(options = {}) { super({ slotTemplate: slotTemplate7, tooltipContent: tooltipContent6, ...options }); } connectedCallback() { updateAriaLabel5(this); super.connectedCallback(); } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === MediaUIAttributes.MEDIA_IS_PIP) { updateAriaLabel5(this); } super.attributeChangedCallback(attrName, oldValue, newValue); } /** * @type {string | undefined} Pip unavailability state */ get mediaPipUnavailable() { return getStringAttr(this, MediaUIAttributes.MEDIA_PIP_UNAVAILABLE); } set mediaPipUnavailable(value) { setStringAttr(this, MediaUIAttributes.MEDIA_PIP_UNAVAILABLE, value); } /** * @type {boolean} Is the media currently playing picture-in-picture */ get mediaIsPip() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_IS_PIP); } set mediaIsPip(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_IS_PIP, value); } handleClick() { const eventName = this.mediaIsPip ? MediaUIEvents.MEDIA_EXIT_PIP_REQUEST : MediaUIEvents.MEDIA_ENTER_PIP_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); } }; if (!GlobalThis.customElements.get("media-pip-button")) { GlobalThis.customElements.define("media-pip-button", MediaPipButton); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-playback-rate-button.js var __accessCheck12 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet12 = (obj, member, getter) => { __accessCheck12(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd12 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var _rates; var Attributes6 = { RATES: "rates" }; var DEFAULT_RATES = [1, 1.2, 1.5, 1.7, 2]; var DEFAULT_RATE = 1; var slotTemplate8 = Document2.createElement("template"); slotTemplate8.innerHTML = /*html*/ ` `; var MediaPlaybackRateButton = class extends MediaChromeButton { constructor(options = {}) { super({ slotTemplate: slotTemplate8, tooltipContent: tooltipLabels.PLAYBACK_RATE, ...options }); __privateAdd12(this, _rates, new AttributeTokenList(this, Attributes6.RATES, { defaultValue: DEFAULT_RATES })); this.container = this.shadowRoot.querySelector('slot[name="icon"]'); this.container.innerHTML = `${DEFAULT_RATE}x`; } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_PLAYBACK_RATE, Attributes6.RATES ]; } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === Attributes6.RATES) { __privateGet12(this, _rates).value = newValue; } if (attrName === MediaUIAttributes.MEDIA_PLAYBACK_RATE) { const newPlaybackRate = newValue ? +newValue : Number.NaN; const playbackRate = !Number.isNaN(newPlaybackRate) ? newPlaybackRate : DEFAULT_RATE; this.container.innerHTML = `${playbackRate}x`; this.setAttribute("aria-label", nouns.PLAYBACK_RATE({ playbackRate })); } } /** * @type { AttributeTokenList | Array | undefined} Will return a DOMTokenList. * Setting a value will accept an array of numbers. */ get rates() { return __privateGet12(this, _rates); } set rates(value) { if (!value) { __privateGet12(this, _rates).value = ""; } else if (Array.isArray(value)) { __privateGet12(this, _rates).value = value.join(" "); } } /** * @type {number} The current playback rate */ get mediaPlaybackRate() { return getNumericAttr( this, MediaUIAttributes.MEDIA_PLAYBACK_RATE, DEFAULT_RATE ); } set mediaPlaybackRate(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_PLAYBACK_RATE, value); } handleClick() { var _a3, _b2; const availableRates = Array.from(this.rates.values(), (str) => +str).sort( (a, b) => a - b ); const detail = (_b2 = (_a3 = availableRates.find((r) => r > this.mediaPlaybackRate)) != null ? _a3 : availableRates[0]) != null ? _b2 : DEFAULT_RATE; const evt = new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_PLAYBACK_RATE_REQUEST, { composed: true, bubbles: true, detail } ); this.dispatchEvent(evt); } }; _rates = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-playback-rate-button")) { GlobalThis.customElements.define( "media-playback-rate-button", MediaPlaybackRateButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-play-button.js var playIcon = ``; var pauseIcon = ``; var slotTemplate9 = Document2.createElement("template"); slotTemplate9.innerHTML = /*html*/ ` ${playIcon} ${pauseIcon} `; var tooltipContent7 = ( /*html*/ ` ${tooltipLabels.PLAY} ${tooltipLabels.PAUSE} ` ); var updateAriaLabel6 = (el) => { const label = el.mediaPaused ? verbs.PLAY() : verbs.PAUSE(); el.setAttribute("aria-label", label); }; var MediaPlayButton = class extends MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_PAUSED, MediaUIAttributes.MEDIA_ENDED ]; } constructor(options = {}) { super({ slotTemplate: slotTemplate9, tooltipContent: tooltipContent7, ...options }); } connectedCallback() { updateAriaLabel6(this); super.connectedCallback(); } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === MediaUIAttributes.MEDIA_PAUSED) { updateAriaLabel6(this); } super.attributeChangedCallback(attrName, oldValue, newValue); } /** * Is the media paused */ get mediaPaused() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED); } set mediaPaused(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED, value); } handleClick() { const eventName = this.mediaPaused ? MediaUIEvents.MEDIA_PLAY_REQUEST : MediaUIEvents.MEDIA_PAUSE_REQUEST; this.dispatchEvent( new GlobalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); } }; if (!GlobalThis.customElements.get("media-play-button")) { GlobalThis.customElements.define("media-play-button", MediaPlayButton); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-poster-image.js var Attributes7 = { PLACEHOLDER_SRC: "placeholdersrc", SRC: "src" }; var template9 = Document2.createElement("template"); template9.innerHTML = /*html*/ ` `; var unsetBackgroundImage = (el) => { el.style.removeProperty("background-image"); }; var setBackgroundImage = (el, image) => { el.style["background-image"] = `url('${image}')`; }; var MediaPosterImage = class extends GlobalThis.HTMLElement { static get observedAttributes() { return [Attributes7.PLACEHOLDER_SRC, Attributes7.SRC]; } constructor() { super(); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template9.content.cloneNode(true)); } this.image = this.shadowRoot.querySelector("#image"); } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === Attributes7.SRC) { if (newValue == null) { this.image.removeAttribute(Attributes7.SRC); } else { this.image.setAttribute(Attributes7.SRC, newValue); } } if (attrName === Attributes7.PLACEHOLDER_SRC) { if (newValue == null) { unsetBackgroundImage(this.image); } else { setBackgroundImage(this.image, newValue); } } } /** * */ get placeholderSrc() { return getStringAttr(this, Attributes7.PLACEHOLDER_SRC); } set placeholderSrc(value) { setStringAttr(this, Attributes7.SRC, value); } /** * */ get src() { return getStringAttr(this, Attributes7.SRC); } set src(value) { setStringAttr(this, Attributes7.SRC, value); } }; if (!GlobalThis.customElements.get("media-poster-image")) { GlobalThis.customElements.define("media-poster-image", MediaPosterImage); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-preview-chapter-display.js var __accessCheck13 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet13 = (obj, member, getter) => { __accessCheck13(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd13 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet12 = (obj, member, value, setter) => { __accessCheck13(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _slot2; var MediaPreviewChapterDisplay = class extends media_text_display_default { constructor() { super(); __privateAdd13(this, _slot2, void 0); __privateSet12(this, _slot2, this.shadowRoot.querySelector("slot")); } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_PREVIEW_CHAPTER ]; } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_PREVIEW_CHAPTER) { if (newValue !== oldValue && newValue != null) { __privateGet13(this, _slot2).textContent = newValue; if (newValue !== "") { this.setAttribute("aria-valuetext", `chapter: ${newValue}`); } else { this.removeAttribute("aria-valuetext"); } } } } /** * @type {string | undefined} Timeline preview chapter */ get mediaPreviewChapter() { return getStringAttr(this, MediaUIAttributes.MEDIA_PREVIEW_CHAPTER); } set mediaPreviewChapter(value) { setStringAttr(this, MediaUIAttributes.MEDIA_PREVIEW_CHAPTER, value); } }; _slot2 = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-preview-chapter-display")) { GlobalThis.customElements.define( "media-preview-chapter-display", MediaPreviewChapterDisplay ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-preview-thumbnail.js var __accessCheck14 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet14 = (obj, member, getter) => { __accessCheck14(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd14 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet13 = (obj, member, value, setter) => { __accessCheck14(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _mediaController7; var template10 = Document2.createElement("template"); template10.innerHTML = /*html*/ ` `; var MediaPreviewThumbnail = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd14(this, _mediaController7, void 0); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template10.content.cloneNode(true)); } } static get observedAttributes() { return [ MediaStateReceiverAttributes.MEDIA_CONTROLLER, MediaUIAttributes.MEDIA_PREVIEW_IMAGE, MediaUIAttributes.MEDIA_PREVIEW_COORDS ]; } connectedCallback() { var _a3, _b2, _c; const mediaControllerId = this.getAttribute( MediaStateReceiverAttributes.MEDIA_CONTROLLER ); if (mediaControllerId) { __privateSet13( this, _mediaController7, // @ts-ignore (_a3 = this.getRootNode()) == null ? void 0 : _a3.getElementById(mediaControllerId) ); (_c = (_b2 = __privateGet14(this, _mediaController7)) == null ? void 0 : _b2.associateElement) == null ? void 0 : _c.call(_b2, this); } } disconnectedCallback() { var _a3, _b2; (_b2 = (_a3 = __privateGet14(this, _mediaController7)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet13(this, _mediaController7, null); } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d, _e; if ([ MediaUIAttributes.MEDIA_PREVIEW_IMAGE, MediaUIAttributes.MEDIA_PREVIEW_COORDS ].includes(attrName)) { this.update(); } if (attrName === MediaStateReceiverAttributes.MEDIA_CONTROLLER) { if (oldValue) { (_b2 = (_a3 = __privateGet14(this, _mediaController7)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet13(this, _mediaController7, null); } if (newValue && this.isConnected) { __privateSet13(this, _mediaController7, (_c = this.getRootNode()) == null ? void 0 : _c.getElementById(newValue)); (_e = (_d = __privateGet14(this, _mediaController7)) == null ? void 0 : _d.associateElement) == null ? void 0 : _e.call(_d, this); } } } /** * @type {string | undefined} The url of the preview image */ get mediaPreviewImage() { return getStringAttr(this, MediaUIAttributes.MEDIA_PREVIEW_IMAGE); } set mediaPreviewImage(value) { setStringAttr(this, MediaUIAttributes.MEDIA_PREVIEW_IMAGE, value); } /** * @type {Array | undefined} Fixed length array [x, y, width, height] or undefined */ get mediaPreviewCoords() { const attrVal = this.getAttribute(MediaUIAttributes.MEDIA_PREVIEW_COORDS); if (!attrVal) return void 0; return attrVal.split(/\s+/).map((coord) => +coord); } set mediaPreviewCoords(value) { if (!value) { this.removeAttribute(MediaUIAttributes.MEDIA_PREVIEW_COORDS); return; } this.setAttribute(MediaUIAttributes.MEDIA_PREVIEW_COORDS, value.join(" ")); } update() { const coords = this.mediaPreviewCoords; const previewImage = this.mediaPreviewImage; if (!(coords && previewImage)) return; const [x, y, w, h] = coords; const src = previewImage.split("#")[0]; const computedStyle = getComputedStyle(this); const { maxWidth, maxHeight, minWidth, minHeight } = computedStyle; const maxRatio = Math.min(parseInt(maxWidth) / w, parseInt(maxHeight) / h); const minRatio = Math.max(parseInt(minWidth) / w, parseInt(minHeight) / h); const isScalingDown = maxRatio < 1; const scale = isScalingDown ? maxRatio : minRatio > 1 ? minRatio : 1; const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); const imgStyle = getOrInsertCSSRule(this.shadowRoot, "img").style; const img = this.shadowRoot.querySelector("img"); const extremum = isScalingDown ? "min" : "max"; style.setProperty(`${extremum}-width`, "initial", "important"); style.setProperty(`${extremum}-height`, "initial", "important"); style.width = `${w * scale}px`; style.height = `${h * scale}px`; const resize = () => { imgStyle.width = `${this.imgWidth * scale}px`; imgStyle.height = `${this.imgHeight * scale}px`; imgStyle.display = "block"; }; if (img.src !== src) { img.onload = () => { this.imgWidth = img.naturalWidth; this.imgHeight = img.naturalHeight; resize(); }; img.src = src; resize(); } resize(); imgStyle.transform = `translate(-${x * scale}px, -${y * scale}px)`; } }; _mediaController7 = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-preview-thumbnail")) { GlobalThis.customElements.define( "media-preview-thumbnail", MediaPreviewThumbnail ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-preview-time-display.js var __accessCheck15 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet15 = (obj, member, getter) => { __accessCheck15(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd15 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet14 = (obj, member, value, setter) => { __accessCheck15(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _slot3; var MediaPreviewTimeDisplay = class extends MediaTextDisplay { constructor() { super(); __privateAdd15(this, _slot3, void 0); __privateSet14(this, _slot3, this.shadowRoot.querySelector("slot")); __privateGet15(this, _slot3).textContent = formatTime(0); } static get observedAttributes() { return [...super.observedAttributes, MediaUIAttributes.MEDIA_PREVIEW_TIME]; } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_PREVIEW_TIME && newValue != null) { __privateGet15(this, _slot3).textContent = formatTime(parseFloat(newValue)); } } /** * Timeline preview time */ get mediaPreviewTime() { return getNumericAttr(this, MediaUIAttributes.MEDIA_PREVIEW_TIME); } set mediaPreviewTime(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_PREVIEW_TIME, value); } }; _slot3 = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-preview-time-display")) { GlobalThis.customElements.define( "media-preview-time-display", MediaPreviewTimeDisplay ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-seek-backward-button.js var Attributes8 = { SEEK_OFFSET: "seekoffset" }; var DEFAULT_SEEK_OFFSET2 = 30; var backwardIcon = ``; var slotTemplate10 = Document2.createElement("template"); slotTemplate10.innerHTML = ` ${backwardIcon} `; var DEFAULT_TIME = 0; var MediaSeekBackwardButton = class extends MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_CURRENT_TIME, Attributes8.SEEK_OFFSET ]; } constructor(options = {}) { super({ slotTemplate: slotTemplate10, tooltipContent: tooltipLabels.SEEK_BACKWARD, ...options }); } connectedCallback() { this.seekOffset = getNumericAttr( this, Attributes8.SEEK_OFFSET, DEFAULT_SEEK_OFFSET2 ); super.connectedCallback(); } attributeChangedCallback(attrName, _oldValue, newValue) { if (attrName === Attributes8.SEEK_OFFSET) { this.seekOffset = getNumericAttr( this, Attributes8.SEEK_OFFSET, DEFAULT_SEEK_OFFSET2 ); } super.attributeChangedCallback(attrName, _oldValue, newValue); } // Own props /** * Seek amount in seconds */ get seekOffset() { return getNumericAttr(this, Attributes8.SEEK_OFFSET, DEFAULT_SEEK_OFFSET2); } set seekOffset(value) { setNumericAttr(this, Attributes8.SEEK_OFFSET, value); this.setAttribute( "aria-label", verbs.SEEK_BACK_N_SECS({ seekOffset: this.seekOffset }) ); updateIconText(getSlotted(this, "icon"), this.seekOffset); } // Props derived from Media UI Attributes /** * The current time in seconds */ get mediaCurrentTime() { return getNumericAttr( this, MediaUIAttributes.MEDIA_CURRENT_TIME, DEFAULT_TIME ); } set mediaCurrentTime(time) { setNumericAttr(this, MediaUIAttributes.MEDIA_CURRENT_TIME, time); } handleClick() { const detail = Math.max(this.mediaCurrentTime - this.seekOffset, 0); const evt = new GlobalThis.CustomEvent(MediaUIEvents.MEDIA_SEEK_REQUEST, { composed: true, bubbles: true, detail }); this.dispatchEvent(evt); } }; if (!GlobalThis.customElements.get("media-seek-backward-button")) { GlobalThis.customElements.define( "media-seek-backward-button", MediaSeekBackwardButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-seek-forward-button.js var Attributes9 = { SEEK_OFFSET: "seekoffset" }; var DEFAULT_SEEK_OFFSET3 = 30; var forwardIcon = ``; var slotTemplate11 = Document2.createElement("template"); slotTemplate11.innerHTML = ` ${forwardIcon} `; var DEFAULT_TIME2 = 0; var MediaSeekForwardButton = class extends MediaChromeButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_CURRENT_TIME, Attributes9.SEEK_OFFSET ]; } constructor(options = {}) { super({ slotTemplate: slotTemplate11, tooltipContent: tooltipLabels.SEEK_FORWARD, ...options }); } connectedCallback() { this.seekOffset = getNumericAttr( this, Attributes9.SEEK_OFFSET, DEFAULT_SEEK_OFFSET3 ); super.connectedCallback(); } attributeChangedCallback(attrName, _oldValue, newValue) { if (attrName === Attributes9.SEEK_OFFSET) { this.seekOffset = getNumericAttr( this, Attributes9.SEEK_OFFSET, DEFAULT_SEEK_OFFSET3 ); } super.attributeChangedCallback(attrName, _oldValue, newValue); } // Own props /** * Seek amount in seconds */ get seekOffset() { return getNumericAttr(this, Attributes9.SEEK_OFFSET, DEFAULT_SEEK_OFFSET3); } set seekOffset(value) { setNumericAttr(this, Attributes9.SEEK_OFFSET, value); this.setAttribute( "aria-label", verbs.SEEK_FORWARD_N_SECS({ seekOffset: this.seekOffset }) ); updateIconText(getSlotted(this, "icon"), this.seekOffset); } // Props derived from Media UI Attributes /** * The current time in seconds */ get mediaCurrentTime() { return getNumericAttr( this, MediaUIAttributes.MEDIA_CURRENT_TIME, DEFAULT_TIME2 ); } set mediaCurrentTime(time) { setNumericAttr(this, MediaUIAttributes.MEDIA_CURRENT_TIME, time); } handleClick() { const detail = this.mediaCurrentTime + this.seekOffset; const evt = new GlobalThis.CustomEvent(MediaUIEvents.MEDIA_SEEK_REQUEST, { composed: true, bubbles: true, detail }); this.dispatchEvent(evt); } }; if (!GlobalThis.customElements.get("media-seek-forward-button")) { GlobalThis.customElements.define( "media-seek-forward-button", MediaSeekForwardButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-time-display.js var __accessCheck16 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet16 = (obj, member, getter) => { __accessCheck16(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd16 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet15 = (obj, member, value, setter) => { __accessCheck16(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _slot4; var Attributes10 = { REMAINING: "remaining", SHOW_DURATION: "showduration", NO_TOGGLE: "notoggle" }; var CombinedAttributes = [ ...Object.values(Attributes10), MediaUIAttributes.MEDIA_CURRENT_TIME, MediaUIAttributes.MEDIA_DURATION, MediaUIAttributes.MEDIA_SEEKABLE ]; var ButtonPressedKeys2 = ["Enter", " "]; var DEFAULT_TIMES_SEP = " / "; var formatTimesLabel = (el, { timesSep = DEFAULT_TIMES_SEP } = {}) => { var _a3, _b2; const showRemaining = el.hasAttribute(Attributes10.REMAINING); const showDuration = el.hasAttribute(Attributes10.SHOW_DURATION); const currentTime = (_a3 = el.mediaCurrentTime) != null ? _a3 : 0; const [, seekableEnd] = (_b2 = el.mediaSeekable) != null ? _b2 : []; let endTime = 0; if (Number.isFinite(el.mediaDuration)) { endTime = el.mediaDuration; } else if (Number.isFinite(seekableEnd)) { endTime = seekableEnd; } const timeLabel = showRemaining ? formatTime(0 - (endTime - currentTime)) : formatTime(currentTime); if (!showDuration) return timeLabel; return `${timeLabel}${timesSep}${formatTime(endTime)}`; }; var DEFAULT_MISSING_TIME_PHRASE = "video not loaded, unknown time."; var updateAriaValueText = (el) => { var _a3; const currentTime = el.mediaCurrentTime; const [, seekableEnd] = (_a3 = el.mediaSeekable) != null ? _a3 : []; let endTime = null; if (Number.isFinite(el.mediaDuration)) { endTime = el.mediaDuration; } else if (Number.isFinite(seekableEnd)) { endTime = seekableEnd; } if (currentTime == null || endTime === null) { el.setAttribute("aria-valuetext", DEFAULT_MISSING_TIME_PHRASE); return; } const showRemaining = el.hasAttribute(Attributes10.REMAINING); const showDuration = el.hasAttribute(Attributes10.SHOW_DURATION); const currentTimePhrase = showRemaining ? formatAsTimePhrase(0 - (endTime - currentTime)) : formatAsTimePhrase(currentTime); if (!showDuration) { el.setAttribute("aria-valuetext", currentTimePhrase); return; } const totalTimePhrase = formatAsTimePhrase(endTime); const fullPhrase = `${currentTimePhrase} of ${totalTimePhrase}`; el.setAttribute("aria-valuetext", fullPhrase); }; var MediaTimeDisplay = class extends MediaTextDisplay { constructor() { super(); __privateAdd16(this, _slot4, void 0); __privateSet15(this, _slot4, this.shadowRoot.querySelector("slot")); __privateGet16(this, _slot4).innerHTML = `${formatTimesLabel(this)}`; } static get observedAttributes() { return [...super.observedAttributes, ...CombinedAttributes, "disabled"]; } connectedCallback() { const { style } = getOrInsertCSSRule( this.shadowRoot, ":host(:hover:not([notoggle]))" ); style.setProperty("cursor", "pointer"); style.setProperty( "background", "var(--media-control-hover-background, rgba(50 50 70 / .7))" ); if (!this.hasAttribute("disabled")) { this.enable(); } this.setAttribute("role", "progressbar"); this.setAttribute("aria-label", nouns.PLAYBACK_TIME()); const keyUpHandler = (evt) => { const { key } = evt; if (!ButtonPressedKeys2.includes(key)) { this.removeEventListener("keyup", keyUpHandler); return; } this.toggleTimeDisplay(); }; this.addEventListener("keydown", (evt) => { const { metaKey, altKey, key } = evt; if (metaKey || altKey || !ButtonPressedKeys2.includes(key)) { this.removeEventListener("keyup", keyUpHandler); return; } this.addEventListener("keyup", keyUpHandler); }); this.addEventListener("click", this.toggleTimeDisplay); super.connectedCallback(); } toggleTimeDisplay() { if (this.noToggle) { return; } if (this.hasAttribute("remaining")) { this.removeAttribute("remaining"); } else { this.setAttribute("remaining", ""); } } disconnectedCallback() { this.disable(); super.disconnectedCallback(); } attributeChangedCallback(attrName, oldValue, newValue) { if (CombinedAttributes.includes(attrName)) { this.update(); } else if (attrName === "disabled" && newValue !== oldValue) { if (newValue == null) { this.enable(); } else { this.disable(); } } super.attributeChangedCallback(attrName, oldValue, newValue); } enable() { this.tabIndex = 0; } disable() { this.tabIndex = -1; } // Own props /** * Whether to show the remaining time */ get remaining() { return getBooleanAttr(this, Attributes10.REMAINING); } set remaining(show) { setBooleanAttr(this, Attributes10.REMAINING, show); } /** * Whether to show the duration */ get showDuration() { return getBooleanAttr(this, Attributes10.SHOW_DURATION); } set showDuration(show) { setBooleanAttr(this, Attributes10.SHOW_DURATION, show); } /** * Disable the default behavior that toggles between current and remaining time */ get noToggle() { return getBooleanAttr(this, Attributes10.NO_TOGGLE); } set noToggle(noToggle) { setBooleanAttr(this, Attributes10.NO_TOGGLE, noToggle); } // Props derived from media UI attributes /** * Get the duration */ get mediaDuration() { return getNumericAttr(this, MediaUIAttributes.MEDIA_DURATION); } set mediaDuration(time) { setNumericAttr(this, MediaUIAttributes.MEDIA_DURATION, time); } /** * The current time in seconds */ get mediaCurrentTime() { return getNumericAttr(this, MediaUIAttributes.MEDIA_CURRENT_TIME); } set mediaCurrentTime(time) { setNumericAttr(this, MediaUIAttributes.MEDIA_CURRENT_TIME, time); } /** * Range of values that can be seeked to. * An array of two numbers [start, end] */ get mediaSeekable() { const seekable = this.getAttribute(MediaUIAttributes.MEDIA_SEEKABLE); if (!seekable) return void 0; return seekable.split(":").map((time) => +time); } set mediaSeekable(range) { if (range == null) { this.removeAttribute(MediaUIAttributes.MEDIA_SEEKABLE); return; } this.setAttribute(MediaUIAttributes.MEDIA_SEEKABLE, range.join(":")); } update() { const timesLabel = formatTimesLabel(this); updateAriaValueText(this); if (timesLabel !== __privateGet16(this, _slot4).innerHTML) { __privateGet16(this, _slot4).innerHTML = timesLabel; } } }; _slot4 = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-time-display")) { GlobalThis.customElements.define("media-time-display", MediaTimeDisplay); } // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/range-animation.js var __accessCheck17 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet17 = (obj, member, getter) => { __accessCheck17(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd17 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet16 = (obj, member, value, setter) => { __accessCheck17(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateWrapper = (obj, member, setter, getter) => ({ set _(value) { __privateSet16(obj, member, value, setter); }, get _() { return __privateGet17(obj, member, getter); } }); var _range; var _startTime; var _previousTime; var _deltaTime; var _frameCount; var _updateTimestamp; var _updateStartValue; var _lastRangeIncrease; var _id; var _animate; var RangeAnimation = class { constructor(range, callback, fps) { __privateAdd17(this, _range, void 0); __privateAdd17(this, _startTime, void 0); __privateAdd17(this, _previousTime, void 0); __privateAdd17(this, _deltaTime, void 0); __privateAdd17(this, _frameCount, void 0); __privateAdd17(this, _updateTimestamp, void 0); __privateAdd17(this, _updateStartValue, void 0); __privateAdd17(this, _lastRangeIncrease, void 0); __privateAdd17(this, _id, 0); __privateAdd17(this, _animate, (now = performance.now()) => { __privateSet16(this, _id, requestAnimationFrame(__privateGet17(this, _animate))); __privateSet16(this, _deltaTime, performance.now() - __privateGet17(this, _previousTime)); const fpsInterval = 1e3 / this.fps; if (__privateGet17(this, _deltaTime) > fpsInterval) { __privateSet16(this, _previousTime, now - __privateGet17(this, _deltaTime) % fpsInterval); const fps2 = 1e3 / ((now - __privateGet17(this, _startTime)) / ++__privateWrapper(this, _frameCount)._); const delta = (now - __privateGet17(this, _updateTimestamp)) / 1e3 / this.duration; let value = __privateGet17(this, _updateStartValue) + delta * this.playbackRate; const increase = value - __privateGet17(this, _range).valueAsNumber; if (increase > 0) { __privateSet16(this, _lastRangeIncrease, this.playbackRate / this.duration / fps2); } else { __privateSet16(this, _lastRangeIncrease, 0.995 * __privateGet17(this, _lastRangeIncrease)); value = __privateGet17(this, _range).valueAsNumber + __privateGet17(this, _lastRangeIncrease); } this.callback(value); } }); __privateSet16(this, _range, range); this.callback = callback; this.fps = fps; } start() { if (__privateGet17(this, _id) !== 0) return; __privateSet16(this, _previousTime, performance.now()); __privateSet16(this, _startTime, __privateGet17(this, _previousTime)); __privateSet16(this, _frameCount, 0); __privateGet17(this, _animate).call(this); } stop() { if (__privateGet17(this, _id) === 0) return; cancelAnimationFrame(__privateGet17(this, _id)); __privateSet16(this, _id, 0); } update({ start, duration, playbackRate }) { const increase = start - __privateGet17(this, _range).valueAsNumber; const durationDelta = Math.abs(duration - this.duration); if (increase > 0 || increase < -0.03 || durationDelta >= 0.5) { this.callback(start); } __privateSet16(this, _updateStartValue, start); __privateSet16(this, _updateTimestamp, performance.now()); this.duration = duration; this.playbackRate = playbackRate; } }; _range = /* @__PURE__ */ new WeakMap(); _startTime = /* @__PURE__ */ new WeakMap(); _previousTime = /* @__PURE__ */ new WeakMap(); _deltaTime = /* @__PURE__ */ new WeakMap(); _frameCount = /* @__PURE__ */ new WeakMap(); _updateTimestamp = /* @__PURE__ */ new WeakMap(); _updateStartValue = /* @__PURE__ */ new WeakMap(); _lastRangeIncrease = /* @__PURE__ */ new WeakMap(); _id = /* @__PURE__ */ new WeakMap(); _animate = /* @__PURE__ */ new WeakMap(); // ../../node_modules/player.style/node_modules/media-chrome/dist/media-time-range.js var __accessCheck18 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet18 = (obj, member, getter) => { __accessCheck18(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd18 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet17 = (obj, member, value, setter) => { __accessCheck18(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod5 = (obj, member, method) => { __accessCheck18(obj, member, "access private method"); return method; }; var _rootNode; var _animation; var _boxes; var _previewTime; var _previewBox; var _currentBox; var _boxPaddingLeft; var _boxPaddingRight; var _mediaChaptersCues; var _toggleRangeAnimation; var toggleRangeAnimation_fn; var _shouldRangeAnimate; var shouldRangeAnimate_fn; var _updateRange; var _getElementRects; var getElementRects_fn; var _getBoxPosition; var getBoxPosition_fn; var _getBoxShiftPosition; var getBoxShiftPosition_fn; var _handlePointerMove3; var handlePointerMove_fn3; var _previewRequest; var previewRequest_fn; var _seekRequest; var seekRequest_fn; var DEFAULT_MISSING_TIME_PHRASE2 = "video not loaded, unknown time."; var updateAriaValueText2 = (el) => { const range = el.range; const currentTimePhrase = formatAsTimePhrase(+calcTimeFromRangeValue(el)); const totalTimePhrase = formatAsTimePhrase(+el.mediaSeekableEnd); const fullPhrase = !(currentTimePhrase && totalTimePhrase) ? DEFAULT_MISSING_TIME_PHRASE2 : `${currentTimePhrase} of ${totalTimePhrase}`; range.setAttribute("aria-valuetext", fullPhrase); }; var template11 = Document2.createElement("template"); template11.innerHTML = /*html*/ `
${/* Example: add the current time w/ arrow to the playhead
*/ ""}
`; var calcRangeValueFromTime = (el, time = el.mediaCurrentTime) => { const startTime = Number.isFinite(el.mediaSeekableStart) ? el.mediaSeekableStart : 0; const endTime = Number.isFinite(el.mediaDuration) ? el.mediaDuration : el.mediaSeekableEnd; if (Number.isNaN(endTime)) return 0; const value = (time - startTime) / (endTime - startTime); return Math.max(0, Math.min(value, 1)); }; var calcTimeFromRangeValue = (el, value = el.range.valueAsNumber) => { const startTime = Number.isFinite(el.mediaSeekableStart) ? el.mediaSeekableStart : 0; const endTime = Number.isFinite(el.mediaDuration) ? el.mediaDuration : el.mediaSeekableEnd; if (Number.isNaN(endTime)) return 0; return value * (endTime - startTime) + startTime; }; var MediaTimeRange = class extends MediaChromeRange { constructor() { super(); __privateAdd18(this, _toggleRangeAnimation); __privateAdd18(this, _shouldRangeAnimate); __privateAdd18(this, _getElementRects); __privateAdd18(this, _getBoxPosition); __privateAdd18(this, _getBoxShiftPosition); __privateAdd18(this, _handlePointerMove3); __privateAdd18(this, _previewRequest); __privateAdd18(this, _seekRequest); __privateAdd18(this, _rootNode, void 0); __privateAdd18(this, _animation, void 0); __privateAdd18(this, _boxes, void 0); __privateAdd18(this, _previewTime, void 0); __privateAdd18(this, _previewBox, void 0); __privateAdd18(this, _currentBox, void 0); __privateAdd18(this, _boxPaddingLeft, void 0); __privateAdd18(this, _boxPaddingRight, void 0); __privateAdd18(this, _mediaChaptersCues, void 0); __privateAdd18(this, _updateRange, (value) => { if (this.dragging) return; this.range.valueAsNumber = value; this.updateBar(); }); this.container.appendChild(template11.content.cloneNode(true)); __privateSet17(this, _boxes, this.shadowRoot.querySelectorAll('[part~="box"]')); __privateSet17(this, _previewBox, this.shadowRoot.querySelector('[part~="preview-box"]')); __privateSet17(this, _currentBox, this.shadowRoot.querySelector('[part~="current-box"]')); const computedStyle = getComputedStyle(this); __privateSet17(this, _boxPaddingLeft, parseInt( computedStyle.getPropertyValue("--media-box-padding-left") )); __privateSet17(this, _boxPaddingRight, parseInt( computedStyle.getPropertyValue("--media-box-padding-right") )); __privateSet17(this, _animation, new RangeAnimation(this.range, __privateGet18(this, _updateRange), 60)); } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_PAUSED, MediaUIAttributes.MEDIA_DURATION, MediaUIAttributes.MEDIA_SEEKABLE, MediaUIAttributes.MEDIA_CURRENT_TIME, MediaUIAttributes.MEDIA_PREVIEW_IMAGE, MediaUIAttributes.MEDIA_PREVIEW_TIME, MediaUIAttributes.MEDIA_PREVIEW_CHAPTER, MediaUIAttributes.MEDIA_BUFFERED, MediaUIAttributes.MEDIA_PLAYBACK_RATE, MediaUIAttributes.MEDIA_LOADING, MediaUIAttributes.MEDIA_ENDED ]; } connectedCallback() { var _a3; super.connectedCallback(); this.range.setAttribute("aria-label", nouns.SEEK()); __privateMethod5(this, _toggleRangeAnimation, toggleRangeAnimation_fn).call(this); __privateSet17(this, _rootNode, this.getRootNode()); (_a3 = __privateGet18(this, _rootNode)) == null ? void 0 : _a3.addEventListener("transitionstart", this); } disconnectedCallback() { var _a3; super.disconnectedCallback(); __privateMethod5(this, _toggleRangeAnimation, toggleRangeAnimation_fn).call(this); (_a3 = __privateGet18(this, _rootNode)) == null ? void 0 : _a3.removeEventListener("transitionstart", this); __privateSet17(this, _rootNode, null); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (oldValue == newValue) return; if (attrName === MediaUIAttributes.MEDIA_CURRENT_TIME || attrName === MediaUIAttributes.MEDIA_PAUSED || attrName === MediaUIAttributes.MEDIA_ENDED || attrName === MediaUIAttributes.MEDIA_LOADING || attrName === MediaUIAttributes.MEDIA_DURATION || attrName === MediaUIAttributes.MEDIA_SEEKABLE) { __privateGet18(this, _animation).update({ start: calcRangeValueFromTime(this), duration: this.mediaSeekableEnd - this.mediaSeekableStart, playbackRate: this.mediaPlaybackRate }); __privateMethod5(this, _toggleRangeAnimation, toggleRangeAnimation_fn).call(this); updateAriaValueText2(this); } else if (attrName === MediaUIAttributes.MEDIA_BUFFERED) { this.updateBufferedBar(); } if (attrName === MediaUIAttributes.MEDIA_DURATION || attrName === MediaUIAttributes.MEDIA_SEEKABLE) { this.mediaChaptersCues = __privateGet18(this, _mediaChaptersCues); this.updateBar(); } } get mediaChaptersCues() { return __privateGet18(this, _mediaChaptersCues); } set mediaChaptersCues(value) { var _a3; __privateSet17(this, _mediaChaptersCues, value); this.updateSegments( (_a3 = __privateGet18(this, _mediaChaptersCues)) == null ? void 0 : _a3.map((c) => ({ start: calcRangeValueFromTime(this, c.startTime), end: calcRangeValueFromTime(this, c.endTime) })) ); } /** * Is the media paused */ get mediaPaused() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED); } set mediaPaused(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_PAUSED, value); } /** * Is the media loading */ get mediaLoading() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_LOADING); } set mediaLoading(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_LOADING, value); } /** * */ get mediaDuration() { return getNumericAttr(this, MediaUIAttributes.MEDIA_DURATION); } set mediaDuration(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_DURATION, value); } /** * */ get mediaCurrentTime() { return getNumericAttr(this, MediaUIAttributes.MEDIA_CURRENT_TIME); } set mediaCurrentTime(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_CURRENT_TIME, value); } /** * */ get mediaPlaybackRate() { return getNumericAttr(this, MediaUIAttributes.MEDIA_PLAYBACK_RATE, 1); } set mediaPlaybackRate(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_PLAYBACK_RATE, value); } /** * An array of ranges, each range being an array of two numbers. * e.g. [[1, 2], [3, 4]] */ get mediaBuffered() { const buffered = this.getAttribute(MediaUIAttributes.MEDIA_BUFFERED); if (!buffered) return []; return buffered.split(" ").map((timePair) => timePair.split(":").map((timeStr) => +timeStr)); } set mediaBuffered(list) { if (!list) { this.removeAttribute(MediaUIAttributes.MEDIA_BUFFERED); return; } const strVal = list.map((tuple) => tuple.join(":")).join(" "); this.setAttribute(MediaUIAttributes.MEDIA_BUFFERED, strVal); } /** * Range of values that can be seeked to * An array of two numbers [start, end] */ get mediaSeekable() { const seekable = this.getAttribute(MediaUIAttributes.MEDIA_SEEKABLE); if (!seekable) return void 0; return seekable.split(":").map((time) => +time); } set mediaSeekable(range) { if (range == null) { this.removeAttribute(MediaUIAttributes.MEDIA_SEEKABLE); return; } this.setAttribute(MediaUIAttributes.MEDIA_SEEKABLE, range.join(":")); } /** * */ get mediaSeekableEnd() { var _a3; const [, end = this.mediaDuration] = (_a3 = this.mediaSeekable) != null ? _a3 : []; return end; } get mediaSeekableStart() { var _a3; const [start = 0] = (_a3 = this.mediaSeekable) != null ? _a3 : []; return start; } /** * The url of the preview image */ get mediaPreviewImage() { return getStringAttr(this, MediaUIAttributes.MEDIA_PREVIEW_IMAGE); } set mediaPreviewImage(value) { setStringAttr(this, MediaUIAttributes.MEDIA_PREVIEW_IMAGE, value); } /** * */ get mediaPreviewTime() { return getNumericAttr(this, MediaUIAttributes.MEDIA_PREVIEW_TIME); } set mediaPreviewTime(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_PREVIEW_TIME, value); } /** * */ get mediaEnded() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_ENDED); } set mediaEnded(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_ENDED, value); } /* Add a buffered progress bar */ updateBar() { super.updateBar(); this.updateBufferedBar(); this.updateCurrentBox(); } updateBufferedBar() { var _a3; const buffered = this.mediaBuffered; if (!buffered.length) { return; } let relativeBufferedEnd; if (!this.mediaEnded) { const currentTime = this.mediaCurrentTime; const [, bufferedEnd = this.mediaSeekableStart] = (_a3 = buffered.find( ([start, end]) => start <= currentTime && currentTime <= end )) != null ? _a3 : []; relativeBufferedEnd = calcRangeValueFromTime(this, bufferedEnd); } else { relativeBufferedEnd = 1; } const { style } = getOrInsertCSSRule(this.shadowRoot, "#highlight"); style.setProperty("width", `${relativeBufferedEnd * 100}%`); } updateCurrentBox() { const currentSlot = this.shadowRoot.querySelector( 'slot[name="current"]' ); if (!currentSlot.assignedElements().length) return; const currentRailRule = getOrInsertCSSRule( this.shadowRoot, "#current-rail" ); const currentBoxRule = getOrInsertCSSRule( this.shadowRoot, '[part~="current-box"]' ); const rects = __privateMethod5(this, _getElementRects, getElementRects_fn).call(this, __privateGet18(this, _currentBox)); const boxPos = __privateMethod5(this, _getBoxPosition, getBoxPosition_fn).call(this, rects, this.range.valueAsNumber); const boxShift = __privateMethod5(this, _getBoxShiftPosition, getBoxShiftPosition_fn).call(this, rects, this.range.valueAsNumber); currentRailRule.style.transform = `translateX(${boxPos})`; currentRailRule.style.setProperty("--_range-width", `${rects.range.width}`); currentBoxRule.style.setProperty("--_box-shift", `${boxShift}`); currentBoxRule.style.setProperty("--_box-width", `${rects.box.width}px`); currentBoxRule.style.setProperty("visibility", "initial"); } handleEvent(evt) { super.handleEvent(evt); switch (evt.type) { case "input": __privateMethod5(this, _seekRequest, seekRequest_fn).call(this); break; case "pointermove": __privateMethod5(this, _handlePointerMove3, handlePointerMove_fn3).call(this, evt); break; case "pointerup": case "pointerleave": __privateMethod5(this, _previewRequest, previewRequest_fn).call(this, null); break; case "transitionstart": if (containsComposedNode(evt.target, this)) { setTimeout(() => __privateMethod5(this, _toggleRangeAnimation, toggleRangeAnimation_fn).call(this), 0); } break; } } }; _rootNode = /* @__PURE__ */ new WeakMap(); _animation = /* @__PURE__ */ new WeakMap(); _boxes = /* @__PURE__ */ new WeakMap(); _previewTime = /* @__PURE__ */ new WeakMap(); _previewBox = /* @__PURE__ */ new WeakMap(); _currentBox = /* @__PURE__ */ new WeakMap(); _boxPaddingLeft = /* @__PURE__ */ new WeakMap(); _boxPaddingRight = /* @__PURE__ */ new WeakMap(); _mediaChaptersCues = /* @__PURE__ */ new WeakMap(); _toggleRangeAnimation = /* @__PURE__ */ new WeakSet(); toggleRangeAnimation_fn = function() { if (__privateMethod5(this, _shouldRangeAnimate, shouldRangeAnimate_fn).call(this)) { __privateGet18(this, _animation).start(); } else { __privateGet18(this, _animation).stop(); } }; _shouldRangeAnimate = /* @__PURE__ */ new WeakSet(); shouldRangeAnimate_fn = function() { return this.isConnected && !this.mediaPaused && !this.mediaLoading && !this.mediaEnded && this.mediaSeekableEnd > 0 && isElementVisible(this); }; _updateRange = /* @__PURE__ */ new WeakMap(); _getElementRects = /* @__PURE__ */ new WeakSet(); getElementRects_fn = function(box) { var _a3; const bounds = (_a3 = this.getAttribute("bounds") ? closestComposedNode(this, `#${this.getAttribute("bounds")}`) : this.parentElement) != null ? _a3 : this; const boundsRect = bounds.getBoundingClientRect(); const rangeRect = this.range.getBoundingClientRect(); const width = box.offsetWidth; const min = -(rangeRect.left - boundsRect.left - width / 2); const max = boundsRect.right - rangeRect.left - width / 2; return { box: { width, min, max }, bounds: boundsRect, range: rangeRect }; }; _getBoxPosition = /* @__PURE__ */ new WeakSet(); getBoxPosition_fn = function(rects, ratio) { let position = `${ratio * 100}%`; const { width, min, max } = rects.box; if (!width) return position; if (!Number.isNaN(min)) { const pad = `var(--media-box-padding-left)`; const minPos = `calc(1 / var(--_range-width) * 100 * ${min}% + ${pad})`; position = `max(${minPos}, ${position})`; } if (!Number.isNaN(max)) { const pad = `var(--media-box-padding-right)`; const maxPos = `calc(1 / var(--_range-width) * 100 * ${max}% - ${pad})`; position = `min(${position}, ${maxPos})`; } return position; }; _getBoxShiftPosition = /* @__PURE__ */ new WeakSet(); getBoxShiftPosition_fn = function(rects, ratio) { const { width, min, max } = rects.box; const pointerX = ratio * rects.range.width; if (pointerX < min + __privateGet18(this, _boxPaddingLeft)) { const offset = rects.range.left - rects.bounds.left - __privateGet18(this, _boxPaddingLeft); return `${pointerX - width / 2 + offset}px`; } if (pointerX > max - __privateGet18(this, _boxPaddingRight)) { const offset = rects.bounds.right - rects.range.right - __privateGet18(this, _boxPaddingRight); return `${pointerX + width / 2 - offset - rects.range.width}px`; } return 0; }; _handlePointerMove3 = /* @__PURE__ */ new WeakSet(); handlePointerMove_fn3 = function(evt) { const isOverBoxes = [...__privateGet18(this, _boxes)].some( (b) => evt.composedPath().includes(b) ); if (!this.dragging && (isOverBoxes || !evt.composedPath().includes(this))) { __privateMethod5(this, _previewRequest, previewRequest_fn).call(this, null); return; } const duration = this.mediaSeekableEnd; if (!duration) return; const previewRailRule = getOrInsertCSSRule( this.shadowRoot, "#preview-rail" ); const previewBoxRule = getOrInsertCSSRule( this.shadowRoot, '[part~="preview-box"]' ); const rects = __privateMethod5(this, _getElementRects, getElementRects_fn).call(this, __privateGet18(this, _previewBox)); let pointerRatio = (evt.clientX - rects.range.left) / rects.range.width; pointerRatio = Math.max(0, Math.min(1, pointerRatio)); const boxPos = __privateMethod5(this, _getBoxPosition, getBoxPosition_fn).call(this, rects, pointerRatio); const boxShift = __privateMethod5(this, _getBoxShiftPosition, getBoxShiftPosition_fn).call(this, rects, pointerRatio); previewRailRule.style.transform = `translateX(${boxPos})`; previewRailRule.style.setProperty("--_range-width", `${rects.range.width}`); previewBoxRule.style.setProperty("--_box-shift", `${boxShift}`); previewBoxRule.style.setProperty("--_box-width", `${rects.box.width}px`); const diff = Math.round(__privateGet18(this, _previewTime)) - Math.round(pointerRatio * duration); if (Math.abs(diff) < 1 && pointerRatio > 0.01 && pointerRatio < 0.99) return; __privateSet17(this, _previewTime, pointerRatio * duration); __privateMethod5(this, _previewRequest, previewRequest_fn).call(this, __privateGet18(this, _previewTime)); }; _previewRequest = /* @__PURE__ */ new WeakSet(); previewRequest_fn = function(detail) { this.dispatchEvent( new GlobalThis.CustomEvent(MediaUIEvents.MEDIA_PREVIEW_REQUEST, { composed: true, bubbles: true, detail }) ); }; _seekRequest = /* @__PURE__ */ new WeakSet(); seekRequest_fn = function() { __privateGet18(this, _animation).stop(); const detail = calcTimeFromRangeValue(this); this.dispatchEvent( new GlobalThis.CustomEvent(MediaUIEvents.MEDIA_SEEK_REQUEST, { composed: true, bubbles: true, detail }) ); }; if (!GlobalThis.customElements.get("media-time-range")) { GlobalThis.customElements.define("media-time-range", MediaTimeRange); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-tooltip.js var Attributes11 = { PLACEMENT: "placement", BOUNDS: "bounds" }; var template12 = Document2.createElement("template"); template12.innerHTML = /*html*/ `
`; var MediaTooltip = class extends GlobalThis.HTMLElement { constructor() { super(); this.updateXOffset = () => { var _a3; const placement = this.placement; if (placement === "left" || placement === "right") { this.style.removeProperty("--media-tooltip-offset-x"); return; } const tooltipStyle = getComputedStyle(this); const containingEl = (_a3 = closestComposedNode(this, "#" + this.bounds)) != null ? _a3 : getMediaController(this); if (!containingEl) return; const { x: containerX, width: containerWidth } = containingEl.getBoundingClientRect(); const { x: tooltipX, width: tooltipWidth } = this.getBoundingClientRect(); const tooltipRight = tooltipX + tooltipWidth; const containerRight = containerX + containerWidth; const offsetXVal = tooltipStyle.getPropertyValue( "--media-tooltip-offset-x" ); const currOffsetX = offsetXVal ? parseFloat(offsetXVal.replace("px", "")) : 0; const marginVal = tooltipStyle.getPropertyValue( "--media-tooltip-container-margin" ); const currMargin = marginVal ? parseFloat(marginVal.replace("px", "")) : 0; const leftDiff = tooltipX - containerX + currOffsetX - currMargin; const rightDiff = tooltipRight - containerRight + currOffsetX + currMargin; if (leftDiff < 0) { this.style.setProperty("--media-tooltip-offset-x", `${leftDiff}px`); return; } if (rightDiff > 0) { this.style.setProperty("--media-tooltip-offset-x", `${rightDiff}px`); return; } this.style.removeProperty("--media-tooltip-offset-x"); }; if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.shadowRoot.appendChild(template12.content.cloneNode(true)); } this.arrowEl = this.shadowRoot.querySelector("#arrow"); if (Object.prototype.hasOwnProperty.call(this, "placement")) { const placement = this.placement; delete this.placement; this.placement = placement; } } static get observedAttributes() { return [Attributes11.PLACEMENT, Attributes11.BOUNDS]; } /** * Get or set tooltip placement */ get placement() { return getStringAttr(this, Attributes11.PLACEMENT); } set placement(value) { setStringAttr(this, Attributes11.PLACEMENT, value); } /** * Get or set tooltip container ID selector that will constrain the tooltips * horizontal position. */ get bounds() { return getStringAttr(this, Attributes11.BOUNDS); } set bounds(value) { setStringAttr(this, Attributes11.BOUNDS, value); } }; if (!GlobalThis.customElements.get("media-tooltip")) { GlobalThis.customElements.define("media-tooltip", MediaTooltip); } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-volume-range.js var DEFAULT_VOLUME = 1; var toVolume = (el) => { if (el.mediaMuted) return 0; return el.mediaVolume; }; var formatAsPercentString = ({ value }) => `${Math.round(value * 100)}%`; var MediaVolumeRange = class extends MediaChromeRange { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_VOLUME, MediaUIAttributes.MEDIA_MUTED, MediaUIAttributes.MEDIA_VOLUME_UNAVAILABLE ]; } constructor() { super(); this.range.addEventListener("input", () => { const detail = this.range.value; const evt = new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_VOLUME_REQUEST, { composed: true, bubbles: true, detail } ); this.dispatchEvent(evt); }); } connectedCallback() { super.connectedCallback(); this.range.setAttribute("aria-label", nouns.VOLUME()); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_VOLUME || attrName === MediaUIAttributes.MEDIA_MUTED) { this.range.valueAsNumber = toVolume(this); this.range.setAttribute( "aria-valuetext", formatAsPercentString(this.range) ); this.updateBar(); } } /** * */ get mediaVolume() { return getNumericAttr(this, MediaUIAttributes.MEDIA_VOLUME, DEFAULT_VOLUME); } set mediaVolume(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_VOLUME, value); } /** * Is the media currently muted */ get mediaMuted() { return getBooleanAttr(this, MediaUIAttributes.MEDIA_MUTED); } set mediaMuted(value) { setBooleanAttr(this, MediaUIAttributes.MEDIA_MUTED, value); } /** * The volume unavailability state */ get mediaVolumeUnavailable() { return getStringAttr(this, MediaUIAttributes.MEDIA_VOLUME_UNAVAILABLE); } set mediaVolumeUnavailable(value) { setStringAttr(this, MediaUIAttributes.MEDIA_VOLUME_UNAVAILABLE, value); } }; if (!GlobalThis.customElements.get("media-volume-range")) { GlobalThis.customElements.define("media-volume-range", MediaVolumeRange); } // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/template-parts.js var __accessCheck19 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet19 = (obj, member, getter) => { __accessCheck19(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd19 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet18 = (obj, member, value, setter) => { __accessCheck19(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _parts; var _processor; var _items; var _value; var _element; var _attributeName; var _namespaceURI; var _list; var list_get; var _parentNode; var _nodes; var ELEMENT = 1; var STRING = 0; var PART = 1; var defaultProcessor = { processCallback(instance, parts, state) { if (!state) return; for (const [expression, part] of parts) { if (expression in state) { const value = state[expression]; if (typeof value === "boolean" && part instanceof AttrPart && typeof part.element[part.attributeName] === "boolean") { part.booleanValue = value; } else if (typeof value === "function" && part instanceof AttrPart) { part.element[part.attributeName] = value; } else { part.value = value; } } } } }; var TemplateInstance = class extends GlobalThis.DocumentFragment { constructor(template19, state, processor2 = defaultProcessor) { var _a3; super(); __privateAdd19(this, _parts, void 0); __privateAdd19(this, _processor, void 0); this.append(template19.content.cloneNode(true)); __privateSet18(this, _parts, parse(this)); __privateSet18(this, _processor, processor2); (_a3 = processor2.createCallback) == null ? void 0 : _a3.call(processor2, this, __privateGet19(this, _parts), state); processor2.processCallback(this, __privateGet19(this, _parts), state); } update(state) { __privateGet19(this, _processor).processCallback(this, __privateGet19(this, _parts), state); } }; _parts = /* @__PURE__ */ new WeakMap(); _processor = /* @__PURE__ */ new WeakMap(); var parse = (element, parts = []) => { let type, value; for (const attr of element.attributes || []) { if (attr.value.includes("{{")) { const list = new AttrPartList(); for ([type, value] of tokenize(attr.value)) { if (!type) list.append(value); else { const part = new AttrPart(element, attr.name, attr.namespaceURI); list.append(part); parts.push([value, part]); } } attr.value = list.toString(); } } for (const node of element.childNodes) { if (node.nodeType === ELEMENT && !(node instanceof HTMLTemplateElement)) { parse(node, parts); } else { const data = node.data; if (node.nodeType === ELEMENT || data.includes("{{")) { const items = []; if (data) { for ([type, value] of tokenize(data)) if (!type) items.push(new Text(value)); else { const part = new ChildNodePart(element); items.push(part); parts.push([value, part]); } } else if (node instanceof HTMLTemplateElement) { const part = new InnerTemplatePart(element, node); items.push(part); parts.push([part.expression, part]); } node.replaceWith( ...items.flatMap((part) => part.replacementNodes || [part]) ); } } } return parts; }; var mem = {}; var tokenize = (text) => { let value = "", open = 0, tokens = mem[text], i = 0, c; if (tokens) return tokens; else tokens = []; for (; c = text[i]; i++) { if (c === "{" && text[i + 1] === "{" && text[i - 1] !== "\\" && text[i + 2] && ++open == 1) { if (value) tokens.push([STRING, value]); value = ""; i++; } else if (c === "}" && text[i + 1] === "}" && text[i - 1] !== "\\" && !--open) { tokens.push([PART, value.trim()]); value = ""; i++; } else value += c || ""; } if (value) tokens.push([STRING, (open > 0 ? "{{" : "") + value]); return mem[text] = tokens; }; var FRAGMENT = 11; var Part = class { get value() { return ""; } set value(val) { } toString() { return this.value; } }; var attrPartToList = /* @__PURE__ */ new WeakMap(); var AttrPartList = class { constructor() { __privateAdd19(this, _items, []); } [Symbol.iterator]() { return __privateGet19(this, _items).values(); } get length() { return __privateGet19(this, _items).length; } item(index) { return __privateGet19(this, _items)[index]; } append(...items) { for (const item of items) { if (item instanceof AttrPart) { attrPartToList.set(item, this); } __privateGet19(this, _items).push(item); } } toString() { return __privateGet19(this, _items).join(""); } }; _items = /* @__PURE__ */ new WeakMap(); var AttrPart = class extends Part { constructor(element, attributeName, namespaceURI) { super(); __privateAdd19(this, _list); __privateAdd19(this, _value, ""); __privateAdd19(this, _element, void 0); __privateAdd19(this, _attributeName, void 0); __privateAdd19(this, _namespaceURI, void 0); __privateSet18(this, _element, element); __privateSet18(this, _attributeName, attributeName); __privateSet18(this, _namespaceURI, namespaceURI); } get attributeName() { return __privateGet19(this, _attributeName); } get attributeNamespace() { return __privateGet19(this, _namespaceURI); } get element() { return __privateGet19(this, _element); } get value() { return __privateGet19(this, _value); } set value(newValue) { if (__privateGet19(this, _value) === newValue) return; __privateSet18(this, _value, newValue); if (!__privateGet19(this, _list, list_get) || __privateGet19(this, _list, list_get).length === 1) { if (newValue == null) { __privateGet19(this, _element).removeAttributeNS( __privateGet19(this, _namespaceURI), __privateGet19(this, _attributeName) ); } else { __privateGet19(this, _element).setAttributeNS( __privateGet19(this, _namespaceURI), __privateGet19(this, _attributeName), newValue ); } } else { __privateGet19(this, _element).setAttributeNS( __privateGet19(this, _namespaceURI), __privateGet19(this, _attributeName), __privateGet19(this, _list, list_get).toString() ); } } get booleanValue() { return __privateGet19(this, _element).hasAttributeNS( __privateGet19(this, _namespaceURI), __privateGet19(this, _attributeName) ); } set booleanValue(value) { if (!__privateGet19(this, _list, list_get) || __privateGet19(this, _list, list_get).length === 1) this.value = value ? "" : null; else throw new DOMException("Value is not fully templatized"); } }; _value = /* @__PURE__ */ new WeakMap(); _element = /* @__PURE__ */ new WeakMap(); _attributeName = /* @__PURE__ */ new WeakMap(); _namespaceURI = /* @__PURE__ */ new WeakMap(); _list = /* @__PURE__ */ new WeakSet(); list_get = function() { return attrPartToList.get(this); }; var ChildNodePart = class extends Part { constructor(parentNode, nodes) { super(); __privateAdd19(this, _parentNode, void 0); __privateAdd19(this, _nodes, void 0); __privateSet18(this, _parentNode, parentNode); __privateSet18(this, _nodes, nodes ? [...nodes] : [new Text()]); } get replacementNodes() { return __privateGet19(this, _nodes); } get parentNode() { return __privateGet19(this, _parentNode); } get nextSibling() { return __privateGet19(this, _nodes)[__privateGet19(this, _nodes).length - 1].nextSibling; } get previousSibling() { return __privateGet19(this, _nodes)[0].previousSibling; } // FIXME: not sure why do we need string serialization here? Just because parent class has type DOMString? get value() { return __privateGet19(this, _nodes).map((node) => node.textContent).join(""); } set value(newValue) { this.replace(newValue); } replace(...nodes) { const normalisedNodes = nodes.flat().flatMap( (node) => node == null ? [new Text()] : node.forEach ? [...node] : node.nodeType === FRAGMENT ? [...node.childNodes] : node.nodeType ? [node] : [new Text(node)] ); if (!normalisedNodes.length) normalisedNodes.push(new Text()); __privateSet18(this, _nodes, swapdom( __privateGet19(this, _nodes)[0].parentNode, __privateGet19(this, _nodes), normalisedNodes, this.nextSibling )); } }; _parentNode = /* @__PURE__ */ new WeakMap(); _nodes = /* @__PURE__ */ new WeakMap(); var InnerTemplatePart = class extends ChildNodePart { constructor(parentNode, template19) { const directive = template19.getAttribute("directive") || template19.getAttribute("type"); let expression = template19.getAttribute("expression") || template19.getAttribute(directive) || ""; if (expression.startsWith("{{")) expression = expression.trim().slice(2, -2).trim(); super(parentNode); this.expression = expression; this.template = template19; this.directive = directive; } }; function swapdom(parent, a, b, end = null) { let i = 0, cur, next, bi, n = b.length, m = a.length; while (i < n && i < m && a[i] == b[i]) i++; while (i < n && i < m && b[n - 1] == a[m - 1]) end = b[--m, --n]; if (i == m) while (i < n) parent.insertBefore(b[i++], end); if (i == n) while (i < m) parent.removeChild(a[i++]); else { cur = a[i]; while (i < n) { bi = b[i++], next = cur ? cur.nextSibling : end; if (cur == bi) cur = next; else if (i < n && b[i] == next) parent.replaceChild(bi, cur), cur = next; else parent.insertBefore(bi, cur); } while (cur != end) next = cur.nextSibling, parent.removeChild(cur), cur = next; } return b; } // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/template-processor.js var pipeModifiers = { string: (value) => String(value) }; var PartialTemplate = class { constructor(template19) { this.template = template19; this.state = void 0; } }; var templates = /* @__PURE__ */ new WeakMap(); var templateInstances = /* @__PURE__ */ new WeakMap(); var Directives = { partial: (part, state) => { state[part.expression] = new PartialTemplate(part.template); }, if: (part, state) => { var _a3; if (evaluateExpression(part.expression, state)) { if (templates.get(part) !== part.template) { templates.set(part, part.template); const tpl = new TemplateInstance(part.template, state, processor); part.replace(tpl); templateInstances.set(part, tpl); } else { (_a3 = templateInstances.get(part)) == null ? void 0 : _a3.update(state); } } else { part.replace(""); templates.delete(part); templateInstances.delete(part); } } }; var DirectiveNames = Object.keys(Directives); var processor = { processCallback(instance, parts, state) { var _a3, _b2; if (!state) return; for (const [expression, part] of parts) { if (part instanceof InnerTemplatePart) { if (!part.directive) { const directive = DirectiveNames.find( (n) => part.template.hasAttribute(n) ); if (directive) { part.directive = directive; part.expression = part.template.getAttribute(directive); } } (_a3 = Directives[part.directive]) == null ? void 0 : _a3.call(Directives, part, state); continue; } let value = evaluateExpression(expression, state); if (value instanceof PartialTemplate) { if (templates.get(part) !== value.template) { templates.set(part, value.template); value = new TemplateInstance(value.template, value.state, processor); part.value = value; templateInstances.set(part, value); } else { (_b2 = templateInstances.get(part)) == null ? void 0 : _b2.update(value.state); } continue; } if (value) { if (part instanceof AttrPart) { if (part.attributeName.startsWith("aria-")) { value = String(value); } } if (part instanceof AttrPart) { if (typeof value === "boolean") { part.booleanValue = value; } else if (typeof value === "function") { part.element[part.attributeName] = value; } else { part.value = value; } } else { part.value = value; templates.delete(part); templateInstances.delete(part); } } else { if (part instanceof AttrPart) { part.value = void 0; } else { part.value = void 0; templates.delete(part); templateInstances.delete(part); } } } } }; var operators = { "!": (a) => !a, "!!": (a) => !!a, "==": (a, b) => a == b, "!=": (a, b) => a != b, ">": (a, b) => a > b, ">=": (a, b) => a >= b, "<": (a, b) => a < b, "<=": (a, b) => a <= b, "??": (a, b) => a != null ? a : b, "|": (a, b) => { var _a3; return (_a3 = pipeModifiers[b]) == null ? void 0 : _a3.call(pipeModifiers, a); } }; function tokenizeExpression(expr) { return tokenize2(expr, { boolean: /true|false/, number: /-?\d+\.?\d*/, string: /(["'])((?:\\.|[^\\])*?)\1/, operator: /[!=><][=!]?|\?\?|\|/, ws: /\s+/, param: /[$a-z_][$\w]*/i }).filter(({ type }) => type !== "ws"); } function evaluateExpression(expr, state = {}) { var _a3, _b2, _c, _d, _e, _f, _g; const tokens = tokenizeExpression(expr); if (tokens.length === 0 || tokens.some(({ type }) => !type)) { return invalidExpression(expr); } if (((_a3 = tokens[0]) == null ? void 0 : _a3.token) === ">") { const partial = state[(_b2 = tokens[1]) == null ? void 0 : _b2.token]; if (!partial) { return invalidExpression(expr); } const partialState = { ...state }; partial.state = partialState; const args = tokens.slice(2); for (let i = 0; i < args.length; i += 3) { const name = (_c = args[i]) == null ? void 0 : _c.token; const operator = (_d = args[i + 1]) == null ? void 0 : _d.token; const value = (_e = args[i + 2]) == null ? void 0 : _e.token; if (name && operator === "=") { partialState[name] = getParamValue(value, state); } } return partial; } if (tokens.length === 1) { if (!isValidParam(tokens[0])) { return invalidExpression(expr); } return getParamValue(tokens[0].token, state); } if (tokens.length === 2) { const operator = (_f = tokens[0]) == null ? void 0 : _f.token; const run = operators[operator]; if (!run || !isValidParam(tokens[1])) { return invalidExpression(expr); } const a = getParamValue(tokens[1].token, state); return run(a); } if (tokens.length === 3) { const operator = (_g = tokens[1]) == null ? void 0 : _g.token; const run = operators[operator]; if (!run || !isValidParam(tokens[0]) || !isValidParam(tokens[2])) { return invalidExpression(expr); } const a = getParamValue(tokens[0].token, state); if (operator === "|") { return run(a, tokens[2].token); } const b = getParamValue(tokens[2].token, state); return run(a, b); } } function invalidExpression(expr) { console.warn(`Warning: invalid expression \`${expr}\``); return false; } function isValidParam({ type }) { return ["number", "boolean", "string", "param"].includes(type); } function getParamValue(raw, state) { const firstChar = raw[0]; const lastChar = raw.slice(-1); if (raw === "true" || raw === "false") { return raw === "true"; } if (firstChar === lastChar && [`'`, `"`].includes(firstChar)) { return raw.slice(1, -1); } if (isNumericString(raw)) { return parseFloat(raw); } return state[raw]; } function tokenize2(str, parsers) { let len, match, token; const tokens = []; while (str) { token = null; len = str.length; for (const key in parsers) { match = parsers[key].exec(str); if (match && match.index < len) { token = { token: match[0], type: key, matches: match.slice(1) }; len = match.index; } } if (len) { tokens.push({ token: str.substr(0, len), type: void 0 }); } if (token) { tokens.push(token); } str = str.substr(len + (token ? token.token.length : 0)); } return tokens; } // ../../node_modules/player.style/node_modules/media-chrome/dist/media-theme-element.js var __accessCheck20 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet20 = (obj, member, getter) => { __accessCheck20(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd20 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet19 = (obj, member, value, setter) => { __accessCheck20(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod6 = (obj, member, method) => { __accessCheck20(obj, member, "access private method"); return method; }; var _template; var _prevTemplate; var _prevTemplateId; var _upgradeProperty; var upgradeProperty_fn; var _updateTemplate; var updateTemplate_fn; var observedMediaAttributes = { mediatargetlivewindow: "targetlivewindow", mediastreamtype: "streamtype" }; var prependTemplate = Document2.createElement("template"); prependTemplate.innerHTML = /*html*/ ` `; var MediaThemeElement = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd20(this, _upgradeProperty); __privateAdd20(this, _updateTemplate); __privateAdd20(this, _template, void 0); __privateAdd20(this, _prevTemplate, void 0); __privateAdd20(this, _prevTemplateId, void 0); if (this.shadowRoot) { this.renderRoot = this.shadowRoot; } else { this.renderRoot = this.attachShadow({ mode: "open" }); this.createRenderer(); } const observer2 = new MutationObserver((mutationList) => { var _a3; if (this.mediaController && !((_a3 = this.mediaController) == null ? void 0 : _a3.breakpointsComputed)) return; if (mutationList.some((mutation) => { const target = mutation.target; if (target === this) return true; if (target.localName !== "media-controller") return false; if (observedMediaAttributes[mutation.attributeName]) return true; if (mutation.attributeName.startsWith("breakpoint")) return true; return false; })) { this.render(); } }); observer2.observe(this, { attributes: true }); observer2.observe(this.renderRoot, { attributes: true, subtree: true }); this.addEventListener( MediaStateChangeEvents.BREAKPOINTS_COMPUTED, this.render ); __privateMethod6(this, _upgradeProperty, upgradeProperty_fn).call(this, "template"); } /** @type {HTMLElement & { breakpointsComputed?: boolean }} */ get mediaController() { return this.renderRoot.querySelector("media-controller"); } get template() { var _a3; return (_a3 = __privateGet20(this, _template)) != null ? _a3 : this.constructor.template; } set template(element) { __privateSet19(this, _prevTemplateId, null); __privateSet19(this, _template, element); this.createRenderer(); } get props() { var _a3, _b2, _c; const observedAttributes = [ ...Array.from((_b2 = (_a3 = this.mediaController) == null ? void 0 : _a3.attributes) != null ? _b2 : []).filter( ({ name }) => { return observedMediaAttributes[name] || name.startsWith("breakpoint"); } ), ...Array.from(this.attributes) ]; const props = {}; for (const attr of observedAttributes) { const name = (_c = observedMediaAttributes[attr.name]) != null ? _c : camelCase(attr.name); let { value } = attr; if (value != null) { if (isNumericString(value)) { value = parseFloat(value); } props[name] = value === "" ? true : value; } else { props[name] = false; } } return props; } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === "template" && oldValue != newValue) { __privateMethod6(this, _updateTemplate, updateTemplate_fn).call(this); } } connectedCallback() { __privateMethod6(this, _updateTemplate, updateTemplate_fn).call(this); } createRenderer() { if (this.template && this.template !== __privateGet20(this, _prevTemplate)) { __privateSet19(this, _prevTemplate, this.template); this.renderer = new TemplateInstance( this.template, this.props, // @ts-ignore this.constructor.processor ); this.renderRoot.textContent = ""; this.renderRoot.append( prependTemplate.content.cloneNode(true), this.renderer ); } } render() { var _a3; (_a3 = this.renderer) == null ? void 0 : _a3.update(this.props); const { style } = getOrInsertCSSRule(this.renderRoot, ":host"); if (style.visibility === "hidden") { style.removeProperty("visibility"); } } }; _template = /* @__PURE__ */ new WeakMap(); _prevTemplate = /* @__PURE__ */ new WeakMap(); _prevTemplateId = /* @__PURE__ */ new WeakMap(); _upgradeProperty = /* @__PURE__ */ new WeakSet(); upgradeProperty_fn = function(prop) { if (Object.prototype.hasOwnProperty.call(this, prop)) { const value = this[prop]; delete this[prop]; this[prop] = value; } }; _updateTemplate = /* @__PURE__ */ new WeakSet(); updateTemplate_fn = function() { var _a3; const templateId = this.getAttribute("template"); if (!templateId || templateId === __privateGet20(this, _prevTemplateId)) return; const rootNode = this.getRootNode(); const template19 = (_a3 = rootNode == null ? void 0 : rootNode.getElementById) == null ? void 0 : _a3.call(rootNode, templateId); if (template19) { __privateSet19(this, _prevTemplateId, templateId); __privateSet19(this, _template, template19); this.createRenderer(); return; } if (isValidUrl(templateId)) { __privateSet19(this, _prevTemplateId, templateId); request(templateId).then((data) => { const template22 = Document2.createElement("template"); template22.innerHTML = data; __privateSet19(this, _template, template22); this.createRenderer(); }).catch(console.error); } }; MediaThemeElement.observedAttributes = ["template"]; MediaThemeElement.processor = processor; function isValidUrl(url) { if (!/^(\/|\.\/|https?:\/\/)/.test(url)) return false; const base = /^https?:\/\//.test(url) ? void 0 : location.origin; try { new URL(url, base); } catch (e) { return false; } return true; } async function request(resource) { const response = await fetch(resource); if (response.status !== 200) { throw new Error( `Failed to load resource: the server responded with a status of ${response.status}` ); } return response.text(); } if (!GlobalThis.customElements.get("media-theme")) { GlobalThis.customElements.define("media-theme", MediaThemeElement); } // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/anchor-utils.js function computePosition({ anchor, floating, placement }) { const rects = getElementRects({ anchor, floating }); const { x, y } = computeCoordsFromPlacement(rects, placement); return { x, y }; } function getElementRects({ anchor, floating }) { return { anchor: getRectRelativeToOffsetParent(anchor, floating.offsetParent), floating: { x: 0, y: 0, width: floating.offsetWidth, height: floating.offsetHeight } }; } function getRectRelativeToOffsetParent(element, offsetParent) { const rect = element.getBoundingClientRect(); const offsetRect = offsetParent.getBoundingClientRect(); return { x: rect.x - offsetRect.x, y: rect.y - offsetRect.y, width: rect.width, height: rect.height }; } function computeCoordsFromPlacement({ anchor, floating }, placement) { const alignmentAxis = getSideAxis(placement) === "x" ? "y" : "x"; const alignLength = alignmentAxis === "y" ? "height" : "width"; const side = getSide(placement); const commonX = anchor.x + anchor.width / 2 - floating.width / 2; const commonY = anchor.y + anchor.height / 2 - floating.height / 2; const commonAlign = anchor[alignLength] / 2 - floating[alignLength] / 2; let coords; switch (side) { case "top": coords = { x: commonX, y: anchor.y - floating.height }; break; case "bottom": coords = { x: commonX, y: anchor.y + anchor.height }; break; case "right": coords = { x: anchor.x + anchor.width, y: commonY }; break; case "left": coords = { x: anchor.x - floating.width, y: commonY }; break; default: coords = { x: anchor.x, y: anchor.y }; } switch (placement.split("-")[1]) { case "start": coords[alignmentAxis] -= commonAlign; break; case "end": coords[alignmentAxis] += commonAlign; break; } return coords; } function getSide(placement) { return placement.split("-")[0]; } function getSideAxis(placement) { return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x"; } // ../../node_modules/player.style/node_modules/media-chrome/dist/utils/events.js var InvokeEvent = class extends Event { /** * @param init - The event options. */ constructor({ action = "auto", relatedTarget, ...options }) { super("invoke", options); this.action = action; this.relatedTarget = relatedTarget; } }; var ToggleEvent = class extends Event { /** * @param init - The event options. */ constructor({ newState, oldState, ...options }) { super("toggle", options); this.newState = newState; this.oldState = oldState; } }; // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-chrome-menu.js var __accessCheck21 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet21 = (obj, member, getter) => { __accessCheck21(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd21 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet20 = (obj, member, value, setter) => { __accessCheck21(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod7 = (obj, member, method) => { __accessCheck21(obj, member, "access private method"); return method; }; var _mediaController8; var _previouslyFocused2; var _invokerElement2; var _keysSoFar; var _clearKeysTimeout; var _previousItems; var _mutationObserver; var _isPopover; var _handleSlotChange; var handleSlotChange_fn; var _handleMenuItems; var _updateLayoutStyle; var updateLayoutStyle_fn; var _handleInvoke2; var handleInvoke_fn2; var _handleOpen2; var handleOpen_fn2; var _handleClosed2; var handleClosed_fn2; var _handleBoundsResize; var _handleMenuResize; var _positionMenu; var positionMenu_fn; var _resizeMenu; var resizeMenu_fn; var _handleClick; var handleClick_fn; var _backButtonElement; var backButtonElement_get; var _handleToggle; var handleToggle_fn; var _checkSubmenuHasExpanded; var checkSubmenuHasExpanded_fn; var _handleFocusOut2; var handleFocusOut_fn2; var _handleKeyDown2; var handleKeyDown_fn2; var _getItem; var getItem_fn; var _getTabItem; var getTabItem_fn; var _setTabItem; var setTabItem_fn; var _selectItem; var selectItem_fn; function createMenuItem({ type, text, value, checked }) { const item = Document2.createElement( "media-chrome-menu-item" ); item.type = type != null ? type : ""; item.part.add("menu-item"); if (type) item.part.add(type); item.value = value; item.checked = checked; const label = Document2.createElement("span"); label.textContent = text; item.append(label); return item; } function createIndicator(el, name) { let customIndicator = el.querySelector(`:scope > [slot="${name}"]`); if ((customIndicator == null ? void 0 : customIndicator.nodeName) == "SLOT") customIndicator = customIndicator.assignedElements({ flatten: true })[0]; if (customIndicator) { customIndicator = customIndicator.cloneNode(true); return customIndicator; } const fallbackIndicator = el.shadowRoot.querySelector( `[name="${name}"] > svg` ); if (fallbackIndicator) { return fallbackIndicator.cloneNode(true); } return ""; } var template13 = Document2.createElement("template"); template13.innerHTML = /*html*/ `
`; var Attributes12 = { STYLE: "style", HIDDEN: "hidden", DISABLED: "disabled", ANCHOR: "anchor" }; var MediaChromeMenu = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd21(this, _handleSlotChange); __privateAdd21(this, _updateLayoutStyle); __privateAdd21(this, _handleInvoke2); __privateAdd21(this, _handleOpen2); __privateAdd21(this, _handleClosed2); __privateAdd21(this, _positionMenu); __privateAdd21(this, _resizeMenu); __privateAdd21(this, _handleClick); __privateAdd21(this, _backButtonElement); __privateAdd21(this, _handleToggle); __privateAdd21(this, _checkSubmenuHasExpanded); __privateAdd21(this, _handleFocusOut2); __privateAdd21(this, _handleKeyDown2); __privateAdd21(this, _getItem); __privateAdd21(this, _getTabItem); __privateAdd21(this, _setTabItem); __privateAdd21(this, _selectItem); __privateAdd21(this, _mediaController8, null); __privateAdd21(this, _previouslyFocused2, null); __privateAdd21(this, _invokerElement2, null); __privateAdd21(this, _keysSoFar, ""); __privateAdd21(this, _clearKeysTimeout, null); __privateAdd21(this, _previousItems, /* @__PURE__ */ new Set()); __privateAdd21(this, _mutationObserver, void 0); __privateAdd21(this, _isPopover, false); __privateAdd21(this, _handleMenuItems, () => { const previousItems = __privateGet21(this, _previousItems); const currentItems = new Set(this.items); for (const item of previousItems) { if (!currentItems.has(item)) { this.dispatchEvent(new CustomEvent("removemenuitem", { detail: item })); } } for (const item of currentItems) { if (!previousItems.has(item)) { this.dispatchEvent(new CustomEvent("addmenuitem", { detail: item })); } } __privateSet20(this, _previousItems, currentItems); }); __privateAdd21(this, _handleBoundsResize, () => { __privateMethod7(this, _positionMenu, positionMenu_fn).call(this, false); __privateMethod7(this, _resizeMenu, resizeMenu_fn).call(this, false); }); __privateAdd21(this, _handleMenuResize, () => { __privateMethod7(this, _positionMenu, positionMenu_fn).call(this, false); }); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.nativeEl = this.constructor.template.content.cloneNode(true); this.shadowRoot.append(this.nativeEl); } this.container = this.shadowRoot.querySelector("#container"); this.defaultSlot = this.shadowRoot.querySelector( "slot:not([name])" ); this.shadowRoot.addEventListener("slotchange", this); __privateSet20(this, _mutationObserver, new MutationObserver(__privateGet21(this, _handleMenuItems))); __privateGet21(this, _mutationObserver).observe(this.defaultSlot, { childList: true }); } static get observedAttributes() { return [ Attributes12.DISABLED, Attributes12.HIDDEN, Attributes12.STYLE, Attributes12.ANCHOR, MediaStateReceiverAttributes.MEDIA_CONTROLLER ]; } static formatMenuItemText(text) { return text; } enable() { this.addEventListener("click", this); this.addEventListener("focusout", this); this.addEventListener("keydown", this); this.addEventListener("invoke", this); this.addEventListener("toggle", this); } disable() { this.removeEventListener("click", this); this.removeEventListener("focusout", this); this.removeEventListener("keyup", this); this.removeEventListener("invoke", this); this.removeEventListener("toggle", this); } handleEvent(event) { switch (event.type) { case "slotchange": __privateMethod7(this, _handleSlotChange, handleSlotChange_fn).call(this, event); break; case "invoke": __privateMethod7(this, _handleInvoke2, handleInvoke_fn2).call(this, event); break; case "click": __privateMethod7(this, _handleClick, handleClick_fn).call(this, event); break; case "toggle": __privateMethod7(this, _handleToggle, handleToggle_fn).call(this, event); break; case "focusout": __privateMethod7(this, _handleFocusOut2, handleFocusOut_fn2).call(this, event); break; case "keydown": __privateMethod7(this, _handleKeyDown2, handleKeyDown_fn2).call(this, event); break; } } connectedCallback() { var _a3, _b2; __privateMethod7(this, _updateLayoutStyle, updateLayoutStyle_fn).call(this); if (!this.hasAttribute("disabled")) { this.enable(); } if (!this.role) { this.role = "menu"; } __privateSet20(this, _mediaController8, getAttributeMediaController(this)); (_b2 = (_a3 = __privateGet21(this, _mediaController8)) == null ? void 0 : _a3.associateElement) == null ? void 0 : _b2.call(_a3, this); if (!this.hidden) { observeResize(getBoundsElement(this), __privateGet21(this, _handleBoundsResize)); observeResize(this, __privateGet21(this, _handleMenuResize)); } } disconnectedCallback() { var _a3, _b2; unobserveResize(getBoundsElement(this), __privateGet21(this, _handleBoundsResize)); unobserveResize(this, __privateGet21(this, _handleMenuResize)); this.disable(); (_b2 = (_a3 = __privateGet21(this, _mediaController8)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet20(this, _mediaController8, null); } attributeChangedCallback(attrName, oldValue, newValue) { var _a3, _b2, _c, _d; if (attrName === Attributes12.HIDDEN && newValue !== oldValue) { if (!__privateGet21(this, _isPopover)) __privateSet20(this, _isPopover, true); if (this.hidden) { __privateMethod7(this, _handleClosed2, handleClosed_fn2).call(this); } else { __privateMethod7(this, _handleOpen2, handleOpen_fn2).call(this); } this.dispatchEvent( new ToggleEvent({ oldState: this.hidden ? "open" : "closed", newState: this.hidden ? "closed" : "open", bubbles: true }) ); } else if (attrName === MediaStateReceiverAttributes.MEDIA_CONTROLLER) { if (oldValue) { (_b2 = (_a3 = __privateGet21(this, _mediaController8)) == null ? void 0 : _a3.unassociateElement) == null ? void 0 : _b2.call(_a3, this); __privateSet20(this, _mediaController8, null); } if (newValue && this.isConnected) { __privateSet20(this, _mediaController8, getAttributeMediaController(this)); (_d = (_c = __privateGet21(this, _mediaController8)) == null ? void 0 : _c.associateElement) == null ? void 0 : _d.call(_c, this); } } else if (attrName === Attributes12.DISABLED && newValue !== oldValue) { if (newValue == null) { this.enable(); } else { this.disable(); } } else if (attrName === Attributes12.STYLE && newValue !== oldValue) { __privateMethod7(this, _updateLayoutStyle, updateLayoutStyle_fn).call(this); } } formatMenuItemText(text, data) { return this.constructor.formatMenuItemText(text, data); } get anchor() { return this.getAttribute("anchor"); } set anchor(value) { this.setAttribute("anchor", `${value}`); } /** * Returns the anchor element when it is a floating menu. */ get anchorElement() { var _a3; if (this.anchor) { return (_a3 = getDocumentOrShadowRoot(this)) == null ? void 0 : _a3.querySelector(`#${this.anchor}`); } return null; } /** * Returns the menu items. */ get items() { return this.defaultSlot.assignedElements({ flatten: true }).filter(isMenuItem); } get radioGroupItems() { return this.items.filter((item) => item.role === "menuitemradio"); } get checkedItems() { return this.items.filter((item) => item.checked); } get value() { var _a3, _b2; return (_b2 = (_a3 = this.checkedItems[0]) == null ? void 0 : _a3.value) != null ? _b2 : ""; } set value(newValue) { const item = this.items.find((item2) => item2.value === newValue); if (!item) return; __privateMethod7(this, _selectItem, selectItem_fn).call(this, item); } focus() { __privateSet20(this, _previouslyFocused2, getActiveElement()); if (this.items.length) { __privateMethod7(this, _setTabItem, setTabItem_fn).call(this, this.items[0]); this.items[0].focus(); return; } const focusable = this.querySelector( '[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]' ); focusable == null ? void 0 : focusable.focus(); } handleSelect(event) { var _a3; const item = __privateMethod7(this, _getItem, getItem_fn).call(this, event); if (!item) return; __privateMethod7(this, _selectItem, selectItem_fn).call(this, item, item.type === "checkbox"); if (__privateGet21(this, _invokerElement2) && !this.hidden) { (_a3 = __privateGet21(this, _previouslyFocused2)) == null ? void 0 : _a3.focus(); this.hidden = true; } } get keysUsed() { return [ "Enter", "Escape", "Tab", " ", "ArrowDown", "ArrowUp", "Home", "End" ]; } handleMove(event) { var _a3, _b2; const { key } = event; const items = this.items; const currentItem = (_b2 = (_a3 = __privateMethod7(this, _getItem, getItem_fn).call(this, event)) != null ? _a3 : __privateMethod7(this, _getTabItem, getTabItem_fn).call(this)) != null ? _b2 : items[0]; const currentIndex = items.indexOf(currentItem); let index = Math.max(0, currentIndex); if (key === "ArrowDown") { index++; } else if (key === "ArrowUp") { index--; } else if (event.key === "Home") { index = 0; } else if (event.key === "End") { index = items.length - 1; } if (index < 0) { index = items.length - 1; } if (index > items.length - 1) { index = 0; } __privateMethod7(this, _setTabItem, setTabItem_fn).call(this, items[index]); items[index].focus(); } }; _mediaController8 = /* @__PURE__ */ new WeakMap(); _previouslyFocused2 = /* @__PURE__ */ new WeakMap(); _invokerElement2 = /* @__PURE__ */ new WeakMap(); _keysSoFar = /* @__PURE__ */ new WeakMap(); _clearKeysTimeout = /* @__PURE__ */ new WeakMap(); _previousItems = /* @__PURE__ */ new WeakMap(); _mutationObserver = /* @__PURE__ */ new WeakMap(); _isPopover = /* @__PURE__ */ new WeakMap(); _handleSlotChange = /* @__PURE__ */ new WeakSet(); handleSlotChange_fn = function(event) { const slot = event.target; for (const node of slot.assignedNodes({ flatten: true })) { if (node.nodeType === 3 && node.textContent.trim() === "") { node.remove(); } } if (["header", "title"].includes(slot.name)) { const header = this.shadowRoot.querySelector( 'slot[name="header"]' ); header.hidden = slot.assignedNodes().length === 0; } if (!slot.name) { __privateGet21(this, _handleMenuItems).call(this); } }; _handleMenuItems = /* @__PURE__ */ new WeakMap(); _updateLayoutStyle = /* @__PURE__ */ new WeakSet(); updateLayoutStyle_fn = function() { var _a3; const layoutRowStyle = this.shadowRoot.querySelector("#layout-row"); const menuLayout = (_a3 = getComputedStyle(this).getPropertyValue("--media-menu-layout")) == null ? void 0 : _a3.trim(); layoutRowStyle.setAttribute("media", menuLayout === "row" ? "" : "width:0"); }; _handleInvoke2 = /* @__PURE__ */ new WeakSet(); handleInvoke_fn2 = function(event) { __privateSet20(this, _invokerElement2, event.relatedTarget); if (!containsComposedNode(this, event.relatedTarget)) { this.hidden = !this.hidden; } }; _handleOpen2 = /* @__PURE__ */ new WeakSet(); handleOpen_fn2 = function() { var _a3; (_a3 = __privateGet21(this, _invokerElement2)) == null ? void 0 : _a3.setAttribute("aria-expanded", "true"); requestAnimationFrame(() => __privateMethod7(this, _positionMenu, positionMenu_fn).call(this, false)); this.addEventListener("transitionend", () => this.focus(), { once: true }); observeResize(getBoundsElement(this), __privateGet21(this, _handleBoundsResize)); observeResize(this, __privateGet21(this, _handleMenuResize)); }; _handleClosed2 = /* @__PURE__ */ new WeakSet(); handleClosed_fn2 = function() { var _a3; (_a3 = __privateGet21(this, _invokerElement2)) == null ? void 0 : _a3.setAttribute("aria-expanded", "false"); unobserveResize(getBoundsElement(this), __privateGet21(this, _handleBoundsResize)); unobserveResize(this, __privateGet21(this, _handleMenuResize)); }; _handleBoundsResize = /* @__PURE__ */ new WeakMap(); _handleMenuResize = /* @__PURE__ */ new WeakMap(); _positionMenu = /* @__PURE__ */ new WeakSet(); positionMenu_fn = function(animate, menuWidth) { if (this.hasAttribute("mediacontroller") && !this.anchor) return; if (this.hidden || !this.anchorElement) return; const { x, y } = computePosition({ anchor: this.anchorElement, floating: this, placement: "top-start" }); menuWidth != null ? menuWidth : menuWidth = this.offsetWidth; const bounds = getBoundsElement(this); const boundsRect = bounds.getBoundingClientRect(); const anchorRect = this.anchorElement.getBoundingClientRect(); const right = boundsRect.width - x - menuWidth; const bottom = boundsRect.height - y - this.offsetHeight; const maxHeight = boundsRect.height - anchorRect.height; const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); if (!animate) { style.setProperty("--media-menu-transition-in", "none"); } style.setProperty("position", "absolute"); style.setProperty("right", `${Math.max(0, right)}px`); style.setProperty("bottom", `${bottom}px`); style.setProperty("--_menu-max-height", `${maxHeight}px`); style.removeProperty("--media-menu-transition-in"); }; _resizeMenu = /* @__PURE__ */ new WeakSet(); resizeMenu_fn = function(animate) { const expandedMenuItem = this.querySelector( '[role="menuitem"][aria-haspopup][aria-expanded="true"]' ); const expandedSubmenu = expandedMenuItem == null ? void 0 : expandedMenuItem.querySelector( '[role="menu"]' ); const { style } = getOrInsertCSSRule(this.shadowRoot, ":host"); if (!animate) { style.setProperty("--media-menu-transition-in", "none"); } if (expandedSubmenu) { const height = expandedSubmenu.offsetHeight; const width = Math.max( expandedSubmenu.offsetWidth, expandedMenuItem.offsetWidth ); this.style.setProperty("min-width", `${width}px`); this.style.setProperty("min-height", `${height}px`); __privateMethod7(this, _positionMenu, positionMenu_fn).call(this, animate, width); } else { this.style.removeProperty("min-width"); this.style.removeProperty("min-height"); __privateMethod7(this, _positionMenu, positionMenu_fn).call(this, animate); } style.removeProperty("--media-menu-transition-in"); }; _handleClick = /* @__PURE__ */ new WeakSet(); handleClick_fn = function(event) { var _a3; event.stopPropagation(); if (event.composedPath().includes(__privateGet21(this, _backButtonElement, backButtonElement_get))) { (_a3 = __privateGet21(this, _previouslyFocused2)) == null ? void 0 : _a3.focus(); this.hidden = true; return; } const item = __privateMethod7(this, _getItem, getItem_fn).call(this, event); if (!item || item.hasAttribute("disabled")) return; __privateMethod7(this, _setTabItem, setTabItem_fn).call(this, item); this.handleSelect(event); }; _backButtonElement = /* @__PURE__ */ new WeakSet(); backButtonElement_get = function() { var _a3; const headerSlot = this.shadowRoot.querySelector( 'slot[name="header"]' ); return (_a3 = headerSlot.assignedElements({ flatten: true })) == null ? void 0 : _a3.find( (el) => el.part.contains("back") && el.part.contains("button") ); }; _handleToggle = /* @__PURE__ */ new WeakSet(); handleToggle_fn = function(event) { if (event.target === this) return; __privateMethod7(this, _checkSubmenuHasExpanded, checkSubmenuHasExpanded_fn).call(this); const menuItemsWithSubmenu = Array.from( this.querySelectorAll('[role="menuitem"][aria-haspopup]') ); for (const item of menuItemsWithSubmenu) { if (item.invokeTargetElement == event.target) continue; if (event.newState == "open" && item.getAttribute("aria-expanded") == "true" && !item.invokeTargetElement.hidden) { item.invokeTargetElement.dispatchEvent( new InvokeEvent({ relatedTarget: item }) ); } } for (const item of menuItemsWithSubmenu) { item.setAttribute("aria-expanded", `${!item.submenuElement.hidden}`); } __privateMethod7(this, _resizeMenu, resizeMenu_fn).call(this, true); }; _checkSubmenuHasExpanded = /* @__PURE__ */ new WeakSet(); checkSubmenuHasExpanded_fn = function() { const selector = '[role="menuitem"] > [role="menu"]:not([hidden])'; const expandedMenuItem = this.querySelector(selector); this.container.classList.toggle("has-expanded", !!expandedMenuItem); }; _handleFocusOut2 = /* @__PURE__ */ new WeakSet(); handleFocusOut_fn2 = function(event) { var _a3; if (!containsComposedNode(this, event.relatedTarget)) { if (__privateGet21(this, _isPopover)) { (_a3 = __privateGet21(this, _previouslyFocused2)) == null ? void 0 : _a3.focus(); } if (__privateGet21(this, _invokerElement2) && __privateGet21(this, _invokerElement2) !== event.relatedTarget && !this.hidden) { this.hidden = true; } } }; _handleKeyDown2 = /* @__PURE__ */ new WeakSet(); handleKeyDown_fn2 = function(event) { var _a3, _b2, _c, _d, _e; const { key, ctrlKey, altKey, metaKey } = event; if (ctrlKey || altKey || metaKey) { return; } if (!this.keysUsed.includes(key)) { return; } event.preventDefault(); event.stopPropagation(); if (key === "Tab") { if (__privateGet21(this, _isPopover)) { this.hidden = true; return; } if (event.shiftKey) { (_b2 = (_a3 = this.previousElementSibling) == null ? void 0 : _a3.focus) == null ? void 0 : _b2.call(_a3); } else { (_d = (_c = this.nextElementSibling) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c); } this.blur(); } else if (key === "Escape") { (_e = __privateGet21(this, _previouslyFocused2)) == null ? void 0 : _e.focus(); if (__privateGet21(this, _isPopover)) { this.hidden = true; } } else if (key === "Enter" || key === " ") { this.handleSelect(event); } else { this.handleMove(event); } }; _getItem = /* @__PURE__ */ new WeakSet(); getItem_fn = function(event) { return event.composedPath().find((el) => { return ["menuitemradio", "menuitemcheckbox"].includes( el.role ); }); }; _getTabItem = /* @__PURE__ */ new WeakSet(); getTabItem_fn = function() { return this.items.find((item) => item.tabIndex === 0); }; _setTabItem = /* @__PURE__ */ new WeakSet(); setTabItem_fn = function(tabItem) { for (const item of this.items) { item.tabIndex = item === tabItem ? 0 : -1; } }; _selectItem = /* @__PURE__ */ new WeakSet(); selectItem_fn = function(item, toggle) { const oldCheckedItems = [...this.checkedItems]; if (item.type === "radio") { this.radioGroupItems.forEach((el) => el.checked = false); } if (toggle) { item.checked = !item.checked; } else { item.checked = true; } if (this.checkedItems.some((opt, i) => opt != oldCheckedItems[i])) { this.dispatchEvent( new Event("change", { bubbles: true, composed: true }) ); } }; MediaChromeMenu.template = template13; function isMenuItem(element) { return ["menuitem", "menuitemradio", "menuitemcheckbox"].includes( element == null ? void 0 : element.role ); } function getBoundsElement(host) { var _a3; return (_a3 = host.getAttribute("bounds") ? closestComposedNode(host, `#${host.getAttribute("bounds")}`) : getMediaController(host) || host.parentElement) != null ? _a3 : host; } if (!GlobalThis.customElements.get("media-chrome-menu")) { GlobalThis.customElements.define("media-chrome-menu", MediaChromeMenu); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-chrome-menu-item.js var __accessCheck22 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet22 = (obj, member, getter) => { __accessCheck22(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd22 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet21 = (obj, member, value, setter) => { __accessCheck22(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod8 = (obj, member, method) => { __accessCheck22(obj, member, "access private method"); return method; }; var _dirty; var _ownerElement; var _handleSlotChange2; var handleSlotChange_fn2; var _submenuConnected; var submenuConnected_fn; var _submenuDisconnected; var submenuDisconnected_fn; var _handleMenuItem; var _handleKeyUp; var handleKeyUp_fn; var _handleKeyDown3; var handleKeyDown_fn3; var _reset; var reset_fn; var template14 = Document2.createElement("template"); template14.innerHTML = /*html*/ ` `; var Attributes13 = { TYPE: "type", VALUE: "value", CHECKED: "checked", DISABLED: "disabled" }; var MediaChromeMenuItem = class extends GlobalThis.HTMLElement { constructor() { super(); __privateAdd22(this, _handleSlotChange2); __privateAdd22(this, _submenuConnected); __privateAdd22(this, _submenuDisconnected); __privateAdd22(this, _handleKeyUp); __privateAdd22(this, _handleKeyDown3); __privateAdd22(this, _reset); __privateAdd22(this, _dirty, false); __privateAdd22(this, _ownerElement, void 0); __privateAdd22(this, _handleMenuItem, () => { var _a3, _b2; this.setAttribute("submenusize", `${this.submenuElement.items.length}`); const descriptionSlot = this.shadowRoot.querySelector( 'slot[name="description"]' ); const description = (_b2 = (_a3 = this.submenuElement.checkedItems) == null ? void 0 : _a3[0]) == null ? void 0 : _b2.text; const span = Document2.createElement("span"); span.textContent = description != null ? description : ""; descriptionSlot.replaceChildren(span); }); if (!this.shadowRoot) { this.attachShadow({ mode: "open" }); this.shadowRoot.append(this.constructor.template.content.cloneNode(true)); } this.shadowRoot.addEventListener("slotchange", this); } static get observedAttributes() { return [ Attributes13.TYPE, Attributes13.DISABLED, Attributes13.CHECKED, Attributes13.VALUE ]; } enable() { if (!this.hasAttribute("tabindex")) { this.setAttribute("tabindex", "-1"); } if (isCheckable(this) && !this.hasAttribute("aria-checked")) { this.setAttribute("aria-checked", "false"); } this.addEventListener("click", this); this.addEventListener("keydown", this); } disable() { this.removeAttribute("tabindex"); this.removeEventListener("click", this); this.removeEventListener("keydown", this); this.removeEventListener("keyup", this); } handleEvent(event) { switch (event.type) { case "slotchange": __privateMethod8(this, _handleSlotChange2, handleSlotChange_fn2).call(this, event); break; case "click": this.handleClick(event); break; case "keydown": __privateMethod8(this, _handleKeyDown3, handleKeyDown_fn3).call(this, event); break; case "keyup": __privateMethod8(this, _handleKeyUp, handleKeyUp_fn).call(this, event); break; } } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === Attributes13.CHECKED && isCheckable(this) && !__privateGet22(this, _dirty)) { this.setAttribute("aria-checked", newValue != null ? "true" : "false"); } else if (attrName === Attributes13.TYPE && newValue !== oldValue) { this.role = "menuitem" + newValue; } else if (attrName === Attributes13.DISABLED && newValue !== oldValue) { if (newValue == null) { this.enable(); } else { this.disable(); } } } connectedCallback() { if (!this.hasAttribute(Attributes13.DISABLED)) { this.enable(); } this.role = "menuitem" + this.type; __privateSet21(this, _ownerElement, closestMenuItemsContainer(this, this.parentNode)); __privateMethod8(this, _reset, reset_fn).call(this); } disconnectedCallback() { this.disable(); __privateMethod8(this, _reset, reset_fn).call(this); __privateSet21(this, _ownerElement, null); } get invokeTarget() { return this.getAttribute("invoketarget"); } set invokeTarget(value) { this.setAttribute("invoketarget", `${value}`); } /** * Returns the element with the id specified by the `invoketarget` attribute * or the slotted submenu element. */ get invokeTargetElement() { var _a3; if (this.invokeTarget) { return (_a3 = getDocumentOrShadowRoot(this)) == null ? void 0 : _a3.querySelector( `#${this.invokeTarget}` ); } return this.submenuElement; } /** * Returns the slotted submenu element. */ get submenuElement() { const submenuSlot = this.shadowRoot.querySelector( 'slot[name="submenu"]' ); return submenuSlot.assignedElements({ flatten: true })[0]; } get type() { var _a3; return (_a3 = this.getAttribute(Attributes13.TYPE)) != null ? _a3 : ""; } set type(val) { this.setAttribute(Attributes13.TYPE, `${val}`); } get value() { var _a3; return (_a3 = this.getAttribute(Attributes13.VALUE)) != null ? _a3 : this.text; } set value(val) { this.setAttribute(Attributes13.VALUE, val); } get text() { var _a3; return ((_a3 = this.textContent) != null ? _a3 : "").trim(); } get checked() { if (!isCheckable(this)) return void 0; return this.getAttribute("aria-checked") === "true"; } set checked(value) { if (!isCheckable(this)) return; __privateSet21(this, _dirty, true); this.setAttribute("aria-checked", value ? "true" : "false"); if (value) { this.part.add("checked"); } else { this.part.remove("checked"); } } handleClick(event) { if (isCheckable(this)) return; if (this.invokeTargetElement && containsComposedNode(this, event.target)) { this.invokeTargetElement.dispatchEvent( new InvokeEvent({ relatedTarget: this }) ); } } get keysUsed() { return ["Enter", " "]; } }; _dirty = /* @__PURE__ */ new WeakMap(); _ownerElement = /* @__PURE__ */ new WeakMap(); _handleSlotChange2 = /* @__PURE__ */ new WeakSet(); handleSlotChange_fn2 = function(event) { const slot = event.target; const isDefaultSlot = !(slot == null ? void 0 : slot.name); if (isDefaultSlot) { for (const node of slot.assignedNodes({ flatten: true })) { if (node instanceof Text && node.textContent.trim() === "") { node.remove(); } } } if (slot.name === "submenu") { if (this.submenuElement) { __privateMethod8(this, _submenuConnected, submenuConnected_fn).call(this); } else { __privateMethod8(this, _submenuDisconnected, submenuDisconnected_fn).call(this); } } }; _submenuConnected = /* @__PURE__ */ new WeakSet(); submenuConnected_fn = async function() { this.setAttribute("aria-haspopup", "menu"); this.setAttribute("aria-expanded", `${!this.submenuElement.hidden}`); this.submenuElement.addEventListener("change", __privateGet22(this, _handleMenuItem)); this.submenuElement.addEventListener("addmenuitem", __privateGet22(this, _handleMenuItem)); this.submenuElement.addEventListener( "removemenuitem", __privateGet22(this, _handleMenuItem) ); __privateGet22(this, _handleMenuItem).call(this); }; _submenuDisconnected = /* @__PURE__ */ new WeakSet(); submenuDisconnected_fn = function() { this.removeAttribute("aria-haspopup"); this.removeAttribute("aria-expanded"); this.submenuElement.removeEventListener("change", __privateGet22(this, _handleMenuItem)); this.submenuElement.removeEventListener( "addmenuitem", __privateGet22(this, _handleMenuItem) ); this.submenuElement.removeEventListener( "removemenuitem", __privateGet22(this, _handleMenuItem) ); __privateGet22(this, _handleMenuItem).call(this); }; _handleMenuItem = /* @__PURE__ */ new WeakMap(); _handleKeyUp = /* @__PURE__ */ new WeakSet(); handleKeyUp_fn = function(event) { const { key } = event; if (!this.keysUsed.includes(key)) { this.removeEventListener("keyup", __privateMethod8(this, _handleKeyUp, handleKeyUp_fn)); return; } this.handleClick(event); }; _handleKeyDown3 = /* @__PURE__ */ new WeakSet(); handleKeyDown_fn3 = function(event) { const { metaKey, altKey, key } = event; if (metaKey || altKey || !this.keysUsed.includes(key)) { this.removeEventListener("keyup", __privateMethod8(this, _handleKeyUp, handleKeyUp_fn)); return; } this.addEventListener("keyup", __privateMethod8(this, _handleKeyUp, handleKeyUp_fn), { once: true }); }; _reset = /* @__PURE__ */ new WeakSet(); reset_fn = function() { var _a3; const items = (_a3 = __privateGet22(this, _ownerElement)) == null ? void 0 : _a3.radioGroupItems; if (!items) return; let checkedItem = items.filter((item) => item.getAttribute("aria-checked") === "true").pop(); if (!checkedItem) checkedItem = items[0]; for (const item of items) { item.setAttribute("aria-checked", "false"); } checkedItem == null ? void 0 : checkedItem.setAttribute("aria-checked", "true"); }; MediaChromeMenuItem.template = template14; function isCheckable(item) { return item.type === "radio" || item.type === "checkbox"; } function closestMenuItemsContainer(childNode, parentNode) { if (!childNode) return null; const { host } = childNode.getRootNode(); if (!parentNode && host) return closestMenuItemsContainer(childNode, host); if (parentNode == null ? void 0 : parentNode.items) return parentNode; return closestMenuItemsContainer(parentNode, parentNode == null ? void 0 : parentNode.parentNode); } if (!GlobalThis.customElements.get("media-chrome-menu-item")) { GlobalThis.customElements.define( "media-chrome-menu-item", MediaChromeMenuItem ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-settings-menu.js var template15 = Document2.createElement("template"); template15.innerHTML = MediaChromeMenu.template.innerHTML + /*html*/ ` `; var MediaSettingsMenu = class extends MediaChromeMenu { /** * Returns the anchor element when it is a floating menu. */ get anchorElement() { if (this.anchor !== "auto") return super.anchorElement; return getMediaController(this).querySelector("media-settings-menu-button"); } }; MediaSettingsMenu.template = template15; if (!GlobalThis.customElements.get("media-settings-menu")) { GlobalThis.customElements.define("media-settings-menu", MediaSettingsMenu); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-settings-menu-item.js var _a; var template16 = Document2.createElement("template"); template16.innerHTML = MediaChromeMenuItem.template.innerHTML + /*html*/ ` `; if ((_a = template16.content) == null ? void 0 : _a.querySelector) { template16.content.querySelector('slot[name="suffix"]').innerHTML = /*html*/ ` `; } var MediaSettingsMenuItem = class extends MediaChromeMenuItem { }; MediaSettingsMenuItem.template = template16; if (!GlobalThis.customElements.get("media-settings-menu-item")) { GlobalThis.customElements.define( "media-settings-menu-item", MediaSettingsMenuItem ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-chrome-menu-button.js var MediaChromeMenuButton = class extends MediaChromeButton { connectedCallback() { super.connectedCallback(); if (this.invokeTargetElement) { this.setAttribute("aria-haspopup", "menu"); } } get invokeTarget() { return this.getAttribute("invoketarget"); } set invokeTarget(value) { this.setAttribute("invoketarget", `${value}`); } /** * Returns the element with the id specified by the `invoketarget` attribute. * @return {HTMLElement | null} */ get invokeTargetElement() { var _a3; if (this.invokeTarget) { return (_a3 = getDocumentOrShadowRoot(this)) == null ? void 0 : _a3.querySelector( `#${this.invokeTarget}` ); } return null; } handleClick() { var _a3; (_a3 = this.invokeTargetElement) == null ? void 0 : _a3.dispatchEvent( new InvokeEvent({ relatedTarget: this }) ); } }; if (!GlobalThis.customElements.get("media-chrome-menu-button")) { GlobalThis.customElements.define( "media-chrome-menu-button", MediaChromeMenuButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-settings-menu-button.js var slotTemplate12 = Document2.createElement("template"); slotTemplate12.innerHTML = /*html*/ ` `; var MediaSettingsMenuButton = class extends MediaChromeMenuButton { static get observedAttributes() { return [...super.observedAttributes, "target"]; } constructor() { super({ slotTemplate: slotTemplate12, tooltipContent: tooltipLabels.SETTINGS }); } connectedCallback() { super.connectedCallback(); this.setAttribute("aria-label", nouns.SETTINGS()); } /** * Returns the element with the id specified by the `invoketarget` attribute. * @return {HTMLElement | null} */ get invokeTargetElement() { if (this.invokeTarget != void 0) return super.invokeTargetElement; return getMediaController(this).querySelector("media-settings-menu"); } }; if (!GlobalThis.customElements.get("media-settings-menu-button")) { GlobalThis.customElements.define( "media-settings-menu-button", MediaSettingsMenuButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-audio-track-menu.js var __accessCheck23 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet23 = (obj, member, getter) => { __accessCheck23(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd23 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet22 = (obj, member, value, setter) => { __accessCheck23(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod9 = (obj, member, method) => { __accessCheck23(obj, member, "access private method"); return method; }; var _audioTrackList; var _prevState; var _render; var render_fn; var _onChange; var onChange_fn; var MediaAudioTrackMenu = class extends MediaChromeMenu { constructor() { super(...arguments); __privateAdd23(this, _render); __privateAdd23(this, _onChange); __privateAdd23(this, _audioTrackList, []); __privateAdd23(this, _prevState, void 0); } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_AUDIO_TRACK_LIST, MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED, MediaUIAttributes.MEDIA_AUDIO_TRACK_UNAVAILABLE ]; } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED && oldValue !== newValue) { this.value = newValue; } else if (attrName === MediaUIAttributes.MEDIA_AUDIO_TRACK_LIST && oldValue !== newValue) { __privateSet22(this, _audioTrackList, parseAudioTrackList(newValue != null ? newValue : "")); __privateMethod9(this, _render, render_fn).call(this); } } connectedCallback() { super.connectedCallback(); this.addEventListener("change", __privateMethod9(this, _onChange, onChange_fn)); } disconnectedCallback() { super.disconnectedCallback(); this.removeEventListener("change", __privateMethod9(this, _onChange, onChange_fn)); } /** * Returns the anchor element when it is a floating menu. */ get anchorElement() { var _a3; if (this.anchor !== "auto") return super.anchorElement; return (_a3 = getMediaController(this)) == null ? void 0 : _a3.querySelector( "media-audio-track-menu-button" ); } get mediaAudioTrackList() { return __privateGet23(this, _audioTrackList); } set mediaAudioTrackList(list) { __privateSet22(this, _audioTrackList, list); __privateMethod9(this, _render, render_fn).call(this); } /** * Get enabled audio track id. */ get mediaAudioTrackEnabled() { var _a3; return (_a3 = getStringAttr(this, MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED)) != null ? _a3 : ""; } set mediaAudioTrackEnabled(id) { setStringAttr(this, MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED, id); } }; _audioTrackList = /* @__PURE__ */ new WeakMap(); _prevState = /* @__PURE__ */ new WeakMap(); _render = /* @__PURE__ */ new WeakSet(); render_fn = function() { if (__privateGet23(this, _prevState) === JSON.stringify(this.mediaAudioTrackList)) return; __privateSet22(this, _prevState, JSON.stringify(this.mediaAudioTrackList)); const audioTrackList = this.mediaAudioTrackList; this.defaultSlot.textContent = ""; for (const audioTrack of audioTrackList) { const text = this.formatMenuItemText(audioTrack.label, audioTrack); const item = createMenuItem({ type: "radio", text, value: `${audioTrack.id}`, checked: audioTrack.enabled }); item.prepend(createIndicator(this, "checked-indicator")); this.defaultSlot.append(item); } }; _onChange = /* @__PURE__ */ new WeakSet(); onChange_fn = function() { if (this.value == null) return; const event = new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_AUDIO_TRACK_REQUEST, { composed: true, bubbles: true, detail: this.value } ); this.dispatchEvent(event); }; if (!GlobalThis.customElements.get("media-audio-track-menu")) { GlobalThis.customElements.define( "media-audio-track-menu", MediaAudioTrackMenu ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-audio-track-menu-button.js var audioTrackIcon = ( /*html*/ `` ); var slotTemplate13 = Document2.createElement("template"); slotTemplate13.innerHTML = /*html*/ ` ${audioTrackIcon} `; var MediaAudioTrackMenuButton = class extends MediaChromeMenuButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED, MediaUIAttributes.MEDIA_AUDIO_TRACK_UNAVAILABLE ]; } constructor() { super({ slotTemplate: slotTemplate13, tooltipContent: tooltipLabels.AUDIO_TRACK_MENU }); } connectedCallback() { super.connectedCallback(); this.setAttribute("aria-label", nouns.AUDIO_TRACKS()); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); } /** * Returns the element with the id specified by the `invoketarget` attribute. * @return {HTMLElement | null} */ get invokeTargetElement() { var _a3; if (this.invokeTarget != void 0) return super.invokeTargetElement; return (_a3 = getMediaController(this)) == null ? void 0 : _a3.querySelector("media-audio-track-menu"); } /** * Get enabled audio track id. * @return {string} */ get mediaAudioTrackEnabled() { var _a3; return (_a3 = getStringAttr(this, MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED)) != null ? _a3 : ""; } set mediaAudioTrackEnabled(id) { setStringAttr(this, MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED, id); } }; if (!GlobalThis.customElements.get("media-audio-track-menu-button")) { GlobalThis.customElements.define( "media-audio-track-menu-button", MediaAudioTrackMenuButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-captions-menu.js var __accessCheck24 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet24 = (obj, member, getter) => { __accessCheck24(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd24 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet23 = (obj, member, value, setter) => { __accessCheck24(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod10 = (obj, member, method) => { __accessCheck24(obj, member, "access private method"); return method; }; var _prevState2; var _render2; var render_fn2; var _onChange2; var onChange_fn2; var ccIcon = ( /*html*/ ` ` ); var template17 = Document2.createElement("template"); template17.innerHTML = MediaChromeMenu.template.innerHTML + /*html*/ ` `; var MediaCaptionsMenu = class extends MediaChromeMenu { constructor() { super(...arguments); __privateAdd24(this, _render2); __privateAdd24(this, _onChange2); __privateAdd24(this, _prevState2, void 0); } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_SUBTITLES_LIST, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING ]; } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_SUBTITLES_LIST && oldValue !== newValue) { __privateMethod10(this, _render2, render_fn2).call(this); } else if (attrName === MediaUIAttributes.MEDIA_SUBTITLES_SHOWING && oldValue !== newValue) { this.value = newValue; } } connectedCallback() { super.connectedCallback(); this.addEventListener("change", __privateMethod10(this, _onChange2, onChange_fn2)); } disconnectedCallback() { super.disconnectedCallback(); this.removeEventListener("change", __privateMethod10(this, _onChange2, onChange_fn2)); } /** * Returns the anchor element when it is a floating menu. */ get anchorElement() { if (this.anchor !== "auto") return super.anchorElement; return getMediaController(this).querySelector("media-captions-menu-button"); } /** * @type {Array} An array of TextTrack-like objects. * Objects must have the properties: kind, language, and label. */ get mediaSubtitlesList() { return getSubtitlesListAttr2(this, MediaUIAttributes.MEDIA_SUBTITLES_LIST); } set mediaSubtitlesList(list) { setSubtitlesListAttr2(this, MediaUIAttributes.MEDIA_SUBTITLES_LIST, list); } /** * An array of TextTrack-like objects. * Objects must have the properties: kind, language, and label. */ get mediaSubtitlesShowing() { return getSubtitlesListAttr2( this, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING ); } set mediaSubtitlesShowing(list) { setSubtitlesListAttr2(this, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING, list); } }; _prevState2 = /* @__PURE__ */ new WeakMap(); _render2 = /* @__PURE__ */ new WeakSet(); render_fn2 = function() { var _a3; if (__privateGet24(this, _prevState2) === JSON.stringify(this.mediaSubtitlesList)) return; __privateSet23(this, _prevState2, JSON.stringify(this.mediaSubtitlesList)); this.defaultSlot.textContent = ""; const isOff = !this.value; const item = createMenuItem({ type: "radio", text: this.formatMenuItemText("Off"), value: "off", checked: isOff }); item.prepend(createIndicator(this, "checked-indicator")); this.defaultSlot.append(item); const subtitlesList = this.mediaSubtitlesList; for (const subs of subtitlesList) { const item2 = createMenuItem({ type: "radio", text: this.formatMenuItemText(subs.label, subs), value: formatTextTrackObj(subs), checked: this.value == formatTextTrackObj(subs) }); item2.prepend(createIndicator(this, "checked-indicator")); const type = (_a3 = subs.kind) != null ? _a3 : "subs"; if (type === "captions") { item2.append(createIndicator(this, "captions-indicator")); } this.defaultSlot.append(item2); } }; _onChange2 = /* @__PURE__ */ new WeakSet(); onChange_fn2 = function() { const showingSubs = this.mediaSubtitlesShowing; const showingSubsStr = this.getAttribute( MediaUIAttributes.MEDIA_SUBTITLES_SHOWING ); const localStateChange = this.value !== showingSubsStr; if ((showingSubs == null ? void 0 : showingSubs.length) && localStateChange) { this.dispatchEvent( new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_DISABLE_SUBTITLES_REQUEST, { composed: true, bubbles: true, detail: showingSubs } ) ); } if (!this.value || !localStateChange) return; const event = new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_SHOW_SUBTITLES_REQUEST, { composed: true, bubbles: true, detail: this.value } ); this.dispatchEvent(event); }; MediaCaptionsMenu.template = template17; var getSubtitlesListAttr2 = (el, attrName) => { const attrVal = el.getAttribute(attrName); return attrVal ? parseTextTracksStr(attrVal) : []; }; var setSubtitlesListAttr2 = (el, attrName, list) => { if (!(list == null ? void 0 : list.length)) { el.removeAttribute(attrName); return; } const newValStr = stringifyTextTrackList(list); const oldVal = el.getAttribute(attrName); if (oldVal === newValStr) return; el.setAttribute(attrName, newValStr); }; if (!GlobalThis.customElements.get("media-captions-menu")) { GlobalThis.customElements.define("media-captions-menu", MediaCaptionsMenu); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-captions-menu-button.js var __accessCheck25 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateAdd25 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet24 = (obj, member, value, setter) => { __accessCheck25(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var _captionsReady; var ccIconOn2 = ``; var ccIconOff2 = ``; var slotTemplate14 = Document2.createElement("template"); slotTemplate14.innerHTML = /*html*/ ` ${ccIconOn2} ${ccIconOff2} `; var updateAriaChecked2 = (el) => { el.setAttribute("aria-checked", areSubsOn(el).toString()); }; var MediaCaptionsMenuButton = class extends MediaChromeMenuButton { constructor(options = {}) { super({ slotTemplate: slotTemplate14, tooltipContent: tooltipLabels.CAPTIONS, ...options }); __privateAdd25(this, _captionsReady, void 0); __privateSet24(this, _captionsReady, false); } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_SUBTITLES_LIST, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING ]; } connectedCallback() { super.connectedCallback(); this.setAttribute("aria-label", nouns.CLOSED_CAPTIONS()); updateAriaChecked2(this); } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_SUBTITLES_SHOWING) { updateAriaChecked2(this); } } /** * Returns the element with the id specified by the `invoketarget` attribute. * @return {HTMLElement | null} */ get invokeTargetElement() { var _a3; if (this.invokeTarget != void 0) return super.invokeTargetElement; return (_a3 = getMediaController(this)) == null ? void 0 : _a3.querySelector("media-captions-menu"); } /** * An array of TextTrack-like objects. * Objects must have the properties: kind, language, and label. */ get mediaSubtitlesList() { return getSubtitlesListAttr3(this, MediaUIAttributes.MEDIA_SUBTITLES_LIST); } set mediaSubtitlesList(list) { setSubtitlesListAttr3(this, MediaUIAttributes.MEDIA_SUBTITLES_LIST, list); } /** * An array of TextTrack-like objects. * Objects must have the properties: kind, language, and label. */ get mediaSubtitlesShowing() { return getSubtitlesListAttr3( this, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING ); } set mediaSubtitlesShowing(list) { setSubtitlesListAttr3(this, MediaUIAttributes.MEDIA_SUBTITLES_SHOWING, list); } }; _captionsReady = /* @__PURE__ */ new WeakMap(); var getSubtitlesListAttr3 = (el, attrName) => { const attrVal = el.getAttribute(attrName); return attrVal ? parseTextTracksStr(attrVal) : []; }; var setSubtitlesListAttr3 = (el, attrName, list) => { if (!(list == null ? void 0 : list.length)) { el.removeAttribute(attrName); return; } const newValStr = stringifyTextTrackList(list); const oldVal = el.getAttribute(attrName); if (oldVal === newValStr) return; el.setAttribute(attrName, newValStr); }; if (!GlobalThis.customElements.get("media-captions-menu-button")) { GlobalThis.customElements.define( "media-captions-menu-button", MediaCaptionsMenuButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-playback-rate-menu.js var __accessCheck26 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet25 = (obj, member, getter) => { __accessCheck26(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd26 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateMethod11 = (obj, member, method) => { __accessCheck26(obj, member, "access private method"); return method; }; var _rates2; var _render3; var render_fn3; var _onChange3; var onChange_fn3; var Attributes14 = { RATES: "rates" }; var MediaPlaybackRateMenu = class extends MediaChromeMenu { constructor() { super(); __privateAdd26(this, _render3); __privateAdd26(this, _onChange3); __privateAdd26(this, _rates2, new AttributeTokenList(this, Attributes14.RATES, { defaultValue: DEFAULT_RATES })); __privateMethod11(this, _render3, render_fn3).call(this); } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_PLAYBACK_RATE, Attributes14.RATES ]; } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_PLAYBACK_RATE && oldValue != newValue) { this.value = newValue; } else if (attrName === Attributes14.RATES && oldValue != newValue) { __privateGet25(this, _rates2).value = newValue; __privateMethod11(this, _render3, render_fn3).call(this); } } connectedCallback() { super.connectedCallback(); this.addEventListener("change", __privateMethod11(this, _onChange3, onChange_fn3)); } disconnectedCallback() { super.disconnectedCallback(); this.removeEventListener("change", __privateMethod11(this, _onChange3, onChange_fn3)); } /** * Returns the anchor element when it is a floating menu. */ get anchorElement() { if (this.anchor !== "auto") return super.anchorElement; return getMediaController(this).querySelector( "media-playback-rate-menu-button" ); } /** * Will return a DOMTokenList. * Setting a value will accept an array of numbers. */ get rates() { return __privateGet25(this, _rates2); } set rates(value) { if (!value) { __privateGet25(this, _rates2).value = ""; } else if (Array.isArray(value)) { __privateGet25(this, _rates2).value = value.join(" "); } __privateMethod11(this, _render3, render_fn3).call(this); } /** * The current playback rate */ get mediaPlaybackRate() { return getNumericAttr( this, MediaUIAttributes.MEDIA_PLAYBACK_RATE, DEFAULT_RATE ); } set mediaPlaybackRate(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_PLAYBACK_RATE, value); } }; _rates2 = /* @__PURE__ */ new WeakMap(); _render3 = /* @__PURE__ */ new WeakSet(); render_fn3 = function() { this.defaultSlot.textContent = ""; for (const rate of this.rates) { const item = createMenuItem({ type: "radio", text: this.formatMenuItemText(`${rate}x`, rate), value: rate, checked: this.mediaPlaybackRate == rate }); item.prepend(createIndicator(this, "checked-indicator")); this.defaultSlot.append(item); } }; _onChange3 = /* @__PURE__ */ new WeakSet(); onChange_fn3 = function() { if (!this.value) return; const event = new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_PLAYBACK_RATE_REQUEST, { composed: true, bubbles: true, detail: this.value } ); this.dispatchEvent(event); }; if (!GlobalThis.customElements.get("media-playback-rate-menu")) { GlobalThis.customElements.define( "media-playback-rate-menu", MediaPlaybackRateMenu ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-playback-rate-menu-button.js var __accessCheck27 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet26 = (obj, member, getter) => { __accessCheck27(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd27 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var _rates3; var Attributes15 = { RATES: "rates" }; var DEFAULT_RATES2 = [1, 1.2, 1.5, 1.7, 2]; var DEFAULT_RATE2 = 1; var slotTemplate15 = Document2.createElement("template"); slotTemplate15.innerHTML = /*html*/ ` `; var MediaPlaybackRateMenuButton = class extends MediaChromeMenuButton { constructor(options = {}) { super({ slotTemplate: slotTemplate15, tooltipContent: tooltipLabels.PLAYBACK_RATE, ...options }); __privateAdd27(this, _rates3, new AttributeTokenList(this, Attributes15.RATES, { defaultValue: DEFAULT_RATES2 })); this.container = this.shadowRoot.querySelector('slot[name="icon"]'); this.container.innerHTML = `${DEFAULT_RATE2}x`; } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_PLAYBACK_RATE, Attributes15.RATES ]; } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === Attributes15.RATES) { __privateGet26(this, _rates3).value = newValue; } if (attrName === MediaUIAttributes.MEDIA_PLAYBACK_RATE) { const newPlaybackRate = newValue ? +newValue : Number.NaN; const playbackRate = !Number.isNaN(newPlaybackRate) ? newPlaybackRate : DEFAULT_RATE2; this.container.innerHTML = `${playbackRate}x`; this.setAttribute("aria-label", nouns.PLAYBACK_RATE({ playbackRate })); } } /** * Returns the element with the id specified by the `invoketarget` attribute. */ get invokeTargetElement() { if (this.invokeTarget != void 0) return super.invokeTargetElement; return getMediaController(this).querySelector("media-playback-rate-menu"); } /** * Will return a DOMTokenList. * Setting a value will accept an array of numbers. */ get rates() { return __privateGet26(this, _rates3); } set rates(value) { if (!value) { __privateGet26(this, _rates3).value = ""; } else if (Array.isArray(value)) { __privateGet26(this, _rates3).value = value.join(" "); } } /** * The current playback rate */ get mediaPlaybackRate() { return getNumericAttr( this, MediaUIAttributes.MEDIA_PLAYBACK_RATE, DEFAULT_RATE2 ); } set mediaPlaybackRate(value) { setNumericAttr(this, MediaUIAttributes.MEDIA_PLAYBACK_RATE, value); } }; _rates3 = /* @__PURE__ */ new WeakMap(); if (!GlobalThis.customElements.get("media-playback-rate-menu-button")) { GlobalThis.customElements.define( "media-playback-rate-menu-button", MediaPlaybackRateMenuButton ); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-rendition-menu.js var __accessCheck28 = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet27 = (obj, member, getter) => { __accessCheck28(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd28 = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet25 = (obj, member, value, setter) => { __accessCheck28(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateMethod12 = (obj, member, method) => { __accessCheck28(obj, member, "access private method"); return method; }; var _renditionList; var _prevState3; var _render4; var render_fn4; var _onChange4; var onChange_fn4; var MediaRenditionMenu = class extends MediaChromeMenu { constructor() { super(...arguments); __privateAdd28(this, _render4); __privateAdd28(this, _onChange4); __privateAdd28(this, _renditionList, []); __privateAdd28(this, _prevState3, void 0); } static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_RENDITION_LIST, MediaUIAttributes.MEDIA_RENDITION_SELECTED, MediaUIAttributes.MEDIA_RENDITION_UNAVAILABLE ]; } attributeChangedCallback(attrName, oldValue, newValue) { super.attributeChangedCallback(attrName, oldValue, newValue); if (attrName === MediaUIAttributes.MEDIA_RENDITION_SELECTED && oldValue !== newValue) { this.value = newValue != null ? newValue : "auto"; } else if (attrName === MediaUIAttributes.MEDIA_RENDITION_LIST && oldValue !== newValue) { __privateSet25(this, _renditionList, parseRenditionList(newValue)); __privateMethod12(this, _render4, render_fn4).call(this); } } connectedCallback() { super.connectedCallback(); this.addEventListener("change", __privateMethod12(this, _onChange4, onChange_fn4)); } disconnectedCallback() { super.disconnectedCallback(); this.removeEventListener("change", __privateMethod12(this, _onChange4, onChange_fn4)); } /** * Returns the anchor element when it is a floating menu. */ get anchorElement() { if (this.anchor !== "auto") return super.anchorElement; return getMediaController(this).querySelector( "media-rendition-menu-button" ); } get mediaRenditionList() { return __privateGet27(this, _renditionList); } set mediaRenditionList(list) { __privateSet25(this, _renditionList, list); __privateMethod12(this, _render4, render_fn4).call(this); } /** * Get selected rendition id. */ get mediaRenditionSelected() { return getStringAttr(this, MediaUIAttributes.MEDIA_RENDITION_SELECTED); } set mediaRenditionSelected(id) { setStringAttr(this, MediaUIAttributes.MEDIA_RENDITION_SELECTED, id); } }; _renditionList = /* @__PURE__ */ new WeakMap(); _prevState3 = /* @__PURE__ */ new WeakMap(); _render4 = /* @__PURE__ */ new WeakSet(); render_fn4 = function() { if (__privateGet27(this, _prevState3) === JSON.stringify(this.mediaRenditionList)) return; __privateSet25(this, _prevState3, JSON.stringify(this.mediaRenditionList)); const renditionList = this.mediaRenditionList.sort( (a, b) => b.height - a.height ); this.defaultSlot.textContent = ""; const isAuto = !this.mediaRenditionSelected; for (const rendition of renditionList) { const text = this.formatMenuItemText( `${Math.min(rendition.width, rendition.height)}p`, rendition ); const item2 = createMenuItem({ type: "radio", text, value: `${rendition.id}`, checked: rendition.selected && !isAuto }); item2.prepend(createIndicator(this, "checked-indicator")); this.defaultSlot.append(item2); } const item = createMenuItem({ type: "radio", text: this.formatMenuItemText("Auto"), value: "auto", checked: isAuto }); item.prepend(createIndicator(this, "checked-indicator")); this.defaultSlot.append(item); }; _onChange4 = /* @__PURE__ */ new WeakSet(); onChange_fn4 = function() { if (this.value == null) return; const event = new GlobalThis.CustomEvent( MediaUIEvents.MEDIA_RENDITION_REQUEST, { composed: true, bubbles: true, detail: this.value } ); this.dispatchEvent(event); }; if (!GlobalThis.customElements.get("media-rendition-menu")) { GlobalThis.customElements.define("media-rendition-menu", MediaRenditionMenu); } // ../../node_modules/player.style/node_modules/media-chrome/dist/menu/media-rendition-menu-button.js var renditionIcon = ( /*html*/ `` ); var slotTemplate16 = Document2.createElement("template"); slotTemplate16.innerHTML = /*html*/ ` ${renditionIcon} `; var MediaRenditionMenuButton = class extends MediaChromeMenuButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_RENDITION_SELECTED, MediaUIAttributes.MEDIA_RENDITION_UNAVAILABLE ]; } constructor() { super({ slotTemplate: slotTemplate16, tooltipContent: tooltipLabels.RENDITIONS }); } connectedCallback() { super.connectedCallback(); this.setAttribute("aria-label", nouns.QUALITY()); } /** * Returns the element with the id specified by the `invoketarget` attribute. */ get invokeTargetElement() { if (this.invokeTarget != void 0) return super.invokeTargetElement; return getMediaController(this).querySelector("media-rendition-menu"); } /** * Get selected rendition id. */ get mediaRenditionSelected() { return getStringAttr(this, MediaUIAttributes.MEDIA_RENDITION_SELECTED); } set mediaRenditionSelected(id) { setStringAttr(this, MediaUIAttributes.MEDIA_RENDITION_SELECTED, id); } }; if (!GlobalThis.customElements.get("media-rendition-menu-button")) { GlobalThis.customElements.define( "media-rendition-menu-button", MediaRenditionMenuButton ); } // ../../node_modules/player.style/themes/microvideo/dist/media-theme.js var _a2, _b; var template18 = (_b = (_a2 = GlobalThis.document) == null ? void 0 : _a2.createElement) == null ? void 0 : _b.call(_a2, "template"); if (template18) { template18.innerHTML = /*html*/ ` `; } var MediaThemeMicrovideoElement = class extends MediaThemeElement { }; __publicField(MediaThemeMicrovideoElement, "template", template18); if (GlobalThis.customElements && !GlobalThis.customElements.get("media-theme-microvideo")) { GlobalThis.customElements.define("media-theme-microvideo", MediaThemeMicrovideoElement); }