import { attachInternals as e } from "../utils/a11y.js";
//#region src/internal/controllers/type-selectable.controller.ts
var t = class {
	#e = !1;
	constructor(e) {
		this.host = e, this.host.addController(this);
	}
	hostConnected() {
		e(this.host), this.host.addEventListener("command", ((e) => {
			this.#e = !0, e.command === "--toggle-select" && this.toggle(), e.command === "--select" && this.select(), e.command === "--deselect" && (this.host.selected = !1), this.#e = !1;
		}));
	}
	hostUpdated() {
		this.host.selectable === "single" ? this.host._internals.states.add("selectable-single") : this.host._internals.states.delete("selectable-single"), this.host.selectable === "multi" ? this.host._internals.states.add("selectable-multi") : this.host._internals.states.delete("selectable-multi");
	}
	select() {
		(this.host.behaviorSelect || this.#e) && (this.host.selected = !0), this.host.dispatchEvent(new CustomEvent("select", {
			bubbles: !0,
			composed: !0,
			detail: this.host
		}));
	}
	deselect() {
		(this.host.behaviorSelect || this.#e) && (this.host.selected = !1), this.host.dispatchEvent(new CustomEvent("select", {
			bubbles: !0,
			composed: !0,
			detail: this.host
		}));
	}
	toggle() {
		this.host.selected ? this.deselect() : this.select();
	}
};
//#endregion
export { t as TypeSelectableController };

//# sourceMappingURL=type-selectable.controller.js.map