import { A as selectFullscreen, M as selectPlayback, a as MediaElement, c as ContextConsumer, i as MediaContainerElement, j as selectPiP, k as selectControls, l as applyStateDataAttrs, n as PlayerController, s as ContextProvider, t as createPlayer, u as logMissingFeature, z as videoFeatures } from "./create-player-Dv7K1Ezk.js";
import { a as PiPButtonDataAttrs, c as FullscreenButtonCore, i as PosterCore, l as ControlsDataAttrs, m as BufferingIndicatorCore, n as MediaButtonElement, o as PiPButtonCore, p as BufferingIndicatorDataAttrs, r as PosterDataAttrs, s as FullscreenButtonDataAttrs, t as ContextPartElement, u as ControlsCore } from "./volume-slider-CfhOO9RM.js";
import { i as createContext, r as playerContext } from "./context-DTY0nOpS.js";
import { t as safeDefine } from "./safe-define-B8lHgj_K.js";

//#region src/define/video/player.ts
const { ProviderMixin } = createPlayer({ features: videoFeatures });
var VideoPlayerElement = class extends ProviderMixin(MediaElement) {
	static {
		this.tagName = "video-player";
	}
};
safeDefine(VideoPlayerElement);
safeDefine(MediaContainerElement);

//#endregion
//#region src/ui/buffering-indicator/buffering-indicator-element.ts
var BufferingIndicatorElement = class extends MediaElement {
	constructor(..._args) {
		super(..._args);
		this.delay = BufferingIndicatorCore.defaultProps.delay;
	}
	static {
		this.tagName = "media-buffering-indicator";
	}
	static {
		this.properties = { delay: { type: Number } };
	}
	#core = new BufferingIndicatorCore();
	#state = new PlayerController(this, playerContext, selectPlayback);
	#disconnect = null;
	connectedCallback() {
		super.connectedCallback();
		this.#disconnect = new AbortController();
		this.#core.state.subscribe(() => this.requestUpdate(), { signal: this.#disconnect.signal });
		if (!this.#state.value) logMissingFeature(this.localName, this.#state.displayName);
	}
	disconnectedCallback() {
		super.disconnectedCallback();
		this.#disconnect?.abort();
		this.#disconnect = null;
	}
	willUpdate(changed) {
		super.willUpdate(changed);
		this.#core.setProps(this);
	}
	update(changed) {
		super.update(changed);
		const media = this.#state.value;
		if (!media) return;
		this.#core.update(media);
		applyStateDataAttrs(this, this.#core.state.current, BufferingIndicatorDataAttrs);
	}
};

//#endregion
//#region src/define/ui/buffering-indicator.ts
safeDefine(BufferingIndicatorElement);

//#endregion
//#region src/ui/controls/context.ts
const CONTROLS_CONTEXT_KEY = Symbol("@videojs/controls");
const controlsContext = createContext(CONTROLS_CONTEXT_KEY);

//#endregion
//#region src/ui/controls/controls-element.ts
var ControlsElement = class extends MediaElement {
	static {
		this.tagName = "media-controls";
	}
	#core = new ControlsCore();
	#mediaState = new PlayerController(this, playerContext, selectControls);
	#provider = new ContextProvider(this, { context: controlsContext });
	connectedCallback() {
		super.connectedCallback();
		if (!this.#mediaState.value && this.#mediaState.displayName) logMissingFeature(this.localName, this.#mediaState.displayName);
	}
	update(_changed) {
		super.update(_changed);
		const media = this.#mediaState.value;
		if (!media) return;
		this.#core.setMedia(media);
		const state = this.#core.getState();
		applyStateDataAttrs(this, state, ControlsDataAttrs);
		this.#provider.setValue({
			state,
			stateAttrMap: ControlsDataAttrs
		});
	}
};

//#endregion
//#region src/ui/controls/controls-group-element.ts
var ControlsGroupElement = class extends ContextPartElement {
	constructor(..._args) {
		super(..._args);
		this.consumer = new ContextConsumer(this, {
			context: controlsContext,
			subscribe: true
		});
	}
	static {
		this.tagName = "media-controls-group";
	}
	connectedCallback() {
		super.connectedCallback();
		if (this.hasAttribute("aria-label") || this.hasAttribute("aria-labelledby")) this.setAttribute("role", "group");
	}
};

//#endregion
//#region src/define/ui/controls.ts
safeDefine(ControlsElement);
safeDefine(ControlsGroupElement);

//#endregion
//#region src/ui/fullscreen-button/fullscreen-button-element.ts
var FullscreenButtonElement = class extends MediaButtonElement {
	constructor(..._args) {
		super(..._args);
		this.core = new FullscreenButtonCore();
		this.stateAttrMap = FullscreenButtonDataAttrs;
		this.mediaState = new PlayerController(this, playerContext, selectFullscreen);
	}
	static {
		this.tagName = "media-fullscreen-button";
	}
	activate(state) {
		this.core.toggle(state);
	}
};

//#endregion
//#region src/define/ui/fullscreen-button.ts
safeDefine(FullscreenButtonElement);

//#endregion
//#region src/ui/pip-button/pip-button-element.ts
var PiPButtonElement = class extends MediaButtonElement {
	constructor(..._args) {
		super(..._args);
		this.core = new PiPButtonCore();
		this.stateAttrMap = PiPButtonDataAttrs;
		this.mediaState = new PlayerController(this, playerContext, selectPiP);
	}
	static {
		this.tagName = "media-pip-button";
	}
	activate(state) {
		this.core.toggle(state);
	}
};

//#endregion
//#region src/define/ui/pip-button.ts
safeDefine(PiPButtonElement);

//#endregion
//#region src/ui/media-ui-element.ts
/** Abstract base for HTML custom elements that display media state with data attributes. */
var MediaUIElement = class extends MediaElement {
	connectedCallback() {
		super.connectedCallback();
		if (!this.mediaState.value && this.mediaState.displayName) logMissingFeature(this.localName, this.mediaState.displayName);
	}
	update(changed) {
		super.update(changed);
		const media = this.mediaState.value;
		if (!media) return;
		this.core.setMedia(media);
		const state = this.core.getState();
		applyStateDataAttrs(this, state, this.stateAttrMap);
	}
};

//#endregion
//#region src/ui/poster/poster-element.ts
var PosterElement = class extends MediaUIElement {
	constructor(..._args) {
		super(..._args);
		this.core = new PosterCore();
		this.stateAttrMap = PosterDataAttrs;
		this.mediaState = new PlayerController(this, playerContext, selectPlayback);
	}
	static {
		this.tagName = "media-poster";
	}
};

//#endregion
//#region src/define/ui/poster.ts
safeDefine(PosterElement);

//#endregion
//# sourceMappingURL=poster-O0SI05LC.js.map