import { I18nController as e } from "../internal/controllers/i18n.controller.js";
import { appendRootNodeStyle as t, generateId as n } from "../internal/utils/dom.js";
import { attachInternals as r } from "../internal/utils/a11y.js";
import { TypeClosableController as i } from "../internal/controllers/type-closable.controller.js";
import { typeSSR as a } from "../internal/controllers/type-ssr.controller.js";
import { scopedRegistry as o } from "../internal/decorators/scoped-registry.js";
import { useStyles as s } from "../internal/styles/index.js";
import { __decorate as c } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/decorate.js";
import { IconButton as l } from "../icon-button/icon-button2.js";
import { Input as u } from "../input/input2.js";
import { Select as d } from "../select/select2.js";
import { Date as f } from "../date/date2.js";
import p from "./progressive-filter-chip.global.js";
import m from "./progressive-filter-chip.js";
import { LitElement as h, html as g, nothing as _ } from "lit";
import { property as v } from "lit/decorators/property.js";
import { state as y } from "lit/decorators/state.js";
//#region src/progressive-filter-chip/progressive-filter-chip.ts
var b = class extends h {
	constructor(...t) {
		super(...t), this.#e = new e(this), this.i18n = this.#e.i18n, this.inputs = [], this.#t = new i(this);
	}
	static {
		this.metadata = {
			tag: "nve-progressive-filter-chip",
			version: "2.0.2"
		};
	}
	static {
		this.elementDefinitions = {
			[u.metadata.tag]: u,
			[d.metadata.tag]: d,
			[f.metadata.tag]: f,
			[l.metadata.tag]: l
		};
	}
	#e;
	static {
		this.styles = s([m]);
	}
	#t;
	#n(e) {
		let t = g`<slot name="${e.slot}" @slotchange="${this.#r}"></slot>`;
		return e.tagName === "SELECT" ? g`<nve-select part="select" multiple-overflow ?fit-text="${!e.multiple}">${t}</nve-select>` : e.tagName === "INPUT" && e.type === "date" ? g`<nve-date part="date">${t}</nve-date>` : e.tagName === "INPUT" ? g`<nve-input part="input">${t}</nve-input>` : t;
	}
	render() {
		return g`<div internal-host>${this.inputs.map((e) => this.#n(e))} ${this.closable ? g`<nve-icon-button part="icon-button" exportparts="icon:icon-button-icon" @click="${() => this.#t.close()}" .ariaLabel="${this.i18n.close}" icon-name="cancel"></nve-icon-button>` : _}</div><slot hidden-slot @slotchange="${this.#i}"></slot>`;
	}
	connectedCallback() {
		super.connectedCallback(), r(this), this._internals.role = "toolbar", this.setAttribute("nve-control", ""), t(this, p);
	}
	#r(e) {
		e.target.assignedElements().length || this.#a();
	}
	#i(e) {
		if (e.target && e.target.assignedElements().length) {
			this.#a();
			let e = Array.from(this.shadowRoot.querySelector("slot:not([name])").assignedElements()).filter((e) => e.matches("input, select, nve-button, [nve-control]"));
			e.forEach((e) => e.slot = n()), this.inputs = e.length ? e : this.inputs;
		}
	}
	#a() {
		Array.from(this.shadowRoot.querySelectorAll("slot")).flatMap((e) => e.assignedElements()).forEach((e) => e.slot = "");
	}
};
c([v({ type: Boolean })], b.prototype, "closable", void 0), c([v({ type: Object })], b.prototype, "i18n", void 0), c([y()], b.prototype, "inputs", void 0), b = c([a(), o()], b);
//#endregion
export { b as ProgressiveFilterChip };

//# sourceMappingURL=progressive-filter-chip2.js.map