import { audit as e } from "../internal/controllers/audit.controller.js";
import { I18nController as t } from "../internal/controllers/i18n.controller.js";
import { isFocusable as n } from "../internal/utils/focus.js";
import { generateId as r } from "../internal/utils/dom.js";
import { attachInternals as i } from "../internal/utils/a11y.js";
import { stateExpanded as a } from "../internal/controllers/state-expanded.controller.js";
import { TypeExpandableController as o } from "../internal/controllers/type-expandable.controller.js";
import { hostAttr as s } from "../internal/decorators/host-attr.js";
import { scopedRegistry as c } from "../internal/decorators/scoped-registry.js";
import { useStyles as l } from "../internal/styles/index.js";
import { __decorate as u } from "../_virtual/_@oxc-project_runtime@0.130.0/helpers/decorate.js";
import { IconButton as d } from "../icon-button/icon-button2.js";
import f from "./accordion.js";
import p from "./accordion-header.js";
import m from "./accordion-content.js";
import h from "./accordion-group.js";
import { LitElement as g, html as _ } from "lit";
import { property as v } from "lit/decorators/property.js";
import { queryAssignedElements as y } from "lit/decorators/query-assigned-elements.js";
//#region src/accordion/accordion.ts
var b = class extends g {
	constructor(...e) {
		super(...e), this.slot = "header";
	}
	static {
		this.styles = l([p]);
	}
	static {
		this.metadata = {
			tag: "nve-accordion-header",
			version: "0.2.3"
		};
	}
	render() {
		return _`<div internal-host><slot name="prefix"></slot><div id="titles"><slot name="title"></slot><slot name="subtitle"></slot></div><slot></slot><div id="actions"><slot name="actions"></slot></div><slot name="suffix"></slot></div>`;
	}
	connectedCallback() {
		super.connectedCallback(), i(this), this._internals.role = "heading", this._internals.ariaLevel = "2";
	}
};
u([s()], b.prototype, "slot", void 0);
var x = class extends g {
	static {
		this.styles = l([m]);
	}
	static {
		this.metadata = {
			tag: "nve-accordion-content",
			version: "0.2.3"
		};
	}
	render() {
		return _`<slot></slot>`;
	}
}, S = class extends g {
	constructor(...e) {
		super(...e), this.#e = new t(this), this.#t = new o(this), this.i18n = this.#e.i18n, this.expanded = !1, this.disabled = !1, this.behaviorExpand = !1;
	}
	static {
		this.styles = l([f]);
	}
	static {
		this.metadata = {
			tag: "nve-accordion",
			version: "0.2.3",
			children: [
				b.metadata.tag,
				x.metadata.tag,
				d.metadata.tag
			]
		};
	}
	static {
		this.elementDefinitions = { [d.metadata.tag]: d };
	}
	#e;
	#t;
	get #n() {
		return !!(this?.querySelectorAll ? Array.from(this?.querySelectorAll("[slot=\"actions\"]")) : []).length;
	}
	get #r() {
		return this.shadowRoot?.querySelector("slot[name=header]")?.assignedElements()[0];
	}
	#i(e) {
		!this.disabled && (!n(e) || e.id === "internal-trigger") && this.#t.toggle();
	}
	render() {
		return _`<div internal-host class="${this.#n ? "has-action" : ""}"><div id="header" @click="${(e) => this.#i(e.target)}" .ariaLabel="${this.expanded ? this.i18n.close : this.i18n.expand}" .ariaControls="${"content"}"><slot name="header"></slot><slot name="icon-button"><nve-icon-button part="icon-button" exportparts="icon:icon-button-icon" id="internal-trigger" container="inline" icon-name="caret" direction="${this.expanded ? this.#n ? "down" : "up" : this.#n ? "right" : "down"}" ?disabled="${this.disabled}" ?pressed="${this.expanded}" .expanded="${this.expanded}" .ariaLabel="${this.expanded ? this.i18n.close : this.i18n.expand}"></nve-icon-button></slot></div><div id="content" .ariaHidden="${!this.expanded}"><slot></slot></div></div>`;
	}
	connectedCallback() {
		super.connectedCallback(), i(this), this._internals.role = "region";
	}
	async firstUpdated(e) {
		super.firstUpdated(e), this.#r && (this.#r.id ||= r(), this.setAttribute("aria-labelledby", this.#r.id));
	}
};
u([v({ type: Object })], S.prototype, "i18n", void 0), u([v({
	type: String,
	reflect: !0
})], S.prototype, "container", void 0), u([v({
	type: Boolean,
	reflect: !0
})], S.prototype, "expanded", void 0), u([v({
	type: Boolean,
	reflect: !0
})], S.prototype, "disabled", void 0), u([v({
	type: Boolean,
	attribute: "behavior-expand"
})], S.prototype, "behaviorExpand", void 0), S = u([
	e(),
	c(),
	a()
], S);
var C = class extends g {
	constructor(...e) {
		super(...e), this.behaviorExpand = !1, this.behaviorExpandSingle = !1, this.#e = (e) => {
			this.behaviorExpandSingle && this.accordions.find((t) => t === e.target) && this.accordions.filter((t) => t !== e.target).forEach((e) => e.expanded = !1);
		};
	}
	static {
		this.styles = l([h]);
	}
	static {
		this.metadata = {
			tag: "nve-accordion-group",
			version: "0.2.3",
			children: [S.metadata.tag]
		};
	}
	render() {
		return _`<div internal-host><slot @slotchange="${() => this.#t()}"></slot></div>`;
	}
	connectedCallback() {
		super.connectedCallback(), i(this), this._internals.role = "group", this.addEventListener("open", this.#e);
	}
	disconnectedCallback() {
		super.disconnectedCallback(), this.removeEventListener("open", this.#e);
	}
	#e;
	updated(e) {
		super.updated(e), this.#t();
	}
	#t() {
		this.accordions.forEach((e) => e.container = this.container), this.accordions.forEach((e) => e.behaviorExpand = this.behaviorExpand || this.behaviorExpandSingle);
	}
};
u([v({
	type: Boolean,
	attribute: "behavior-expand"
})], C.prototype, "behaviorExpand", void 0), u([v({
	type: Boolean,
	attribute: "behavior-expand-single"
})], C.prototype, "behaviorExpandSingle", void 0), u([v({
	type: String,
	reflect: !0
})], C.prototype, "container", void 0), u([y()], C.prototype, "accordions", void 0), C = u([e()], C);
//#endregion
export { S as Accordion, x as AccordionContent, C as AccordionGroup, b as AccordionHeader };

//# sourceMappingURL=accordion2.js.map