import { MediaUIAttributes } from "../constants.js"; import { MediaChromeMenuButton } from "./media-chrome-menu-button.js"; import { globalThis, document } from "../utils/server-safe-globals.js"; import { nouns, tooltipLabels } from "../labels/labels.js"; import { getStringAttr, setStringAttr, getMediaController } from "../utils/element-utils.js"; const audioTrackIcon = ( /*html*/ `` ); const slotTemplate = document.createElement("template"); slotTemplate.innerHTML = /*html*/ ` ${audioTrackIcon} `; class MediaAudioTrackMenuButton extends MediaChromeMenuButton { static get observedAttributes() { return [ ...super.observedAttributes, MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED, MediaUIAttributes.MEDIA_AUDIO_TRACK_UNAVAILABLE ]; } constructor() { super({ slotTemplate, 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 _a; if (this.invokeTarget != void 0) return super.invokeTargetElement; return (_a = getMediaController(this)) == null ? void 0 : _a.querySelector("media-audio-track-menu"); } /** * Get enabled audio track id. * @return {string} */ get mediaAudioTrackEnabled() { var _a; return (_a = getStringAttr(this, MediaUIAttributes.MEDIA_AUDIO_TRACK_ENABLED)) != null ? _a : ""; } 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 ); } var media_audio_track_menu_button_default = MediaAudioTrackMenuButton; export { MediaAudioTrackMenuButton, media_audio_track_menu_button_default as default };