import { TWMixin } from "./TWMixin2.js";
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.95.0/helpers/decorate.js";
import { isEFTemporal } from "../elements/EFTemporal.js";
import { focusedElementContext } from "./focusedElementContext.js";
import { ContextMixin } from "./ContextMixin.js";
import { EFTargetable } from "../elements/TargetController.js";
import { provide } from "@lit/context";
import { LitElement, css, html } from "lit";
import { customElement } from "lit/decorators.js";

//#region src/gui/EFPreview.ts
let EFPreview = class EFPreview$1 extends EFTargetable(ContextMixin(TWMixin(LitElement))) {
	static {
		this.styles = [css`
      :host {
        position: relative;
        display: block;
        cursor: crosshair;
      }
    `];
	}
	/**
	* Find the closest temporal element (timegroup, video, audio, etc.)
	*/
	findClosestTemporal(element) {
		let current = element;
		while (current && current !== this) {
			if (isEFTemporal(current)) return current;
			current = current.parentElement;
		}
		return null;
	}
	constructor() {
		super();
		this.addEventListener("pointerover", (e) => {
			const target = e.target;
			const temporal = this.findClosestTemporal(target);
			if (target !== this && temporal) this.focusedElement = target;
		});
		this.addEventListener("pointerout", (e) => {
			const relatedTarget = e.relatedTarget;
			const targetingTemporal = this.findClosestTemporal(relatedTarget);
			if (!this.contains(relatedTarget) || relatedTarget === this || !targetingTemporal) this.focusedElement = void 0;
		});
	}
	render() {
		return html`<slot></slot>`;
	}
};
__decorate([provide({ context: focusedElementContext })], EFPreview.prototype, "focusedElement", void 0);
EFPreview = __decorate([customElement("ef-preview")], EFPreview);

//#endregion
export { EFPreview };
//# sourceMappingURL=EFPreview.js.map