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_seek_forward_button_exports = {};
__export(media_seek_forward_button_exports, {
Attributes: () => Attributes,
default: () => media_seek_forward_button_default
});
module.exports = __toCommonJS(media_seek_forward_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_element_utils = require("./utils/element-utils.js");
var import_labels = require("./labels/labels.js");
var import_element_utils2 = require("./utils/element-utils.js");
const Attributes = {
SEEK_OFFSET: "seekoffset"
};
const DEFAULT_SEEK_OFFSET = 30;
const forwardIcon = ``;
const slotTemplate = import_server_safe_globals.document.createElement("template");
slotTemplate.innerHTML = `
${forwardIcon}
`;
const DEFAULT_TIME = 0;
class MediaSeekForwardButton extends import_media_chrome_button.MediaChromeButton {
static get observedAttributes() {
return [
...super.observedAttributes,
import_constants.MediaUIAttributes.MEDIA_CURRENT_TIME,
Attributes.SEEK_OFFSET
];
}
constructor(options = {}) {
super({
slotTemplate,
tooltipContent: import_labels.tooltipLabels.SEEK_FORWARD,
...options
});
}
connectedCallback() {
this.seekOffset = (0, import_element_utils.getNumericAttr)(
this,
Attributes.SEEK_OFFSET,
DEFAULT_SEEK_OFFSET
);
super.connectedCallback();
}
attributeChangedCallback(attrName, _oldValue, newValue) {
if (attrName === Attributes.SEEK_OFFSET) {
this.seekOffset = (0, import_element_utils.getNumericAttr)(
this,
Attributes.SEEK_OFFSET,
DEFAULT_SEEK_OFFSET
);
}
super.attributeChangedCallback(attrName, _oldValue, newValue);
}
// Own props
/**
* Seek amount in seconds
*/
get seekOffset() {
return (0, import_element_utils.getNumericAttr)(this, Attributes.SEEK_OFFSET, DEFAULT_SEEK_OFFSET);
}
set seekOffset(value) {
(0, import_element_utils.setNumericAttr)(this, Attributes.SEEK_OFFSET, value);
this.setAttribute(
"aria-label",
import_labels.verbs.SEEK_FORWARD_N_SECS({ seekOffset: this.seekOffset })
);
(0, import_element_utils2.updateIconText)((0, import_element_utils2.getSlotted)(this, "icon"), this.seekOffset);
}
// Props derived from Media UI Attributes
/**
* The current time in seconds
*/
get mediaCurrentTime() {
return (0, import_element_utils.getNumericAttr)(
this,
import_constants.MediaUIAttributes.MEDIA_CURRENT_TIME,
DEFAULT_TIME
);
}
set mediaCurrentTime(time) {
(0, import_element_utils.setNumericAttr)(this, import_constants.MediaUIAttributes.MEDIA_CURRENT_TIME, time);
}
handleClick() {
const detail = this.mediaCurrentTime + this.seekOffset;
const evt = new import_server_safe_globals.globalThis.CustomEvent(import_constants.MediaUIEvents.MEDIA_SEEK_REQUEST, {
composed: true,
bubbles: true,
detail
});
this.dispatchEvent(evt);
}
}
if (!import_server_safe_globals.globalThis.customElements.get("media-seek-forward-button")) {
import_server_safe_globals.globalThis.customElements.define(
"media-seek-forward-button",
MediaSeekForwardButton
);
}
var media_seek_forward_button_default = MediaSeekForwardButton;