var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var media_mute_button_exports = {}; __export(media_mute_button_exports, { default: () => media_mute_button_default }); module.exports = __toCommonJS(media_mute_button_exports); var import_media_chrome_button = require("./media-chrome-button.js"); var import_server_safe_globals = require("./utils/server-safe-globals.js"); var import_constants = require("./constants.js"); var import_labels = require("./labels/labels.js"); var import_element_utils = require("./utils/element-utils.js"); const { MEDIA_VOLUME_LEVEL } = import_constants.MediaUIAttributes; const offIcon = ``; const lowIcon = ``; const highIcon = ``; const slotTemplate = import_server_safe_globals.document.createElement("template"); slotTemplate.innerHTML = /*html*/ ` ${offIcon} ${lowIcon} ${lowIcon} ${highIcon} `; const tooltipContent = ( /*html*/ ` ${import_labels.tooltipLabels.MUTE} ${import_labels.tooltipLabels.UNMUTE} ` ); const updateAriaLabel = (el) => { const muted = el.mediaVolumeLevel === "off"; const label = muted ? import_labels.verbs.UNMUTE() : import_labels.verbs.MUTE(); el.setAttribute("aria-label", label); }; class MediaMuteButton extends import_media_chrome_button.MediaChromeButton { static get observedAttributes() { return [...super.observedAttributes, import_constants.MediaUIAttributes.MEDIA_VOLUME_LEVEL]; } constructor(options = {}) { super({ slotTemplate, tooltipContent, ...options }); } connectedCallback() { updateAriaLabel(this); super.connectedCallback(); } attributeChangedCallback(attrName, oldValue, newValue) { if (attrName === import_constants.MediaUIAttributes.MEDIA_VOLUME_LEVEL) { updateAriaLabel(this); } super.attributeChangedCallback(attrName, oldValue, newValue); } /** * @type {string | undefined} */ get mediaVolumeLevel() { return (0, import_element_utils.getStringAttr)(this, import_constants.MediaUIAttributes.MEDIA_VOLUME_LEVEL); } set mediaVolumeLevel(value) { (0, import_element_utils.setStringAttr)(this, import_constants.MediaUIAttributes.MEDIA_VOLUME_LEVEL, value); } handleClick() { const eventName = this.mediaVolumeLevel === "off" ? import_constants.MediaUIEvents.MEDIA_UNMUTE_REQUEST : import_constants.MediaUIEvents.MEDIA_MUTE_REQUEST; this.dispatchEvent( new import_server_safe_globals.globalThis.CustomEvent(eventName, { composed: true, bubbles: true }) ); } } if (!import_server_safe_globals.globalThis.customElements.get("media-mute-button")) { import_server_safe_globals.globalThis.customElements.define("media-mute-button", MediaMuteButton); } var media_mute_button_default = MediaMuteButton;