import e from "../DropdownListItem.js";
import t from "../../utils/DropdownOverlay/DropdownOverlay.js";
import "../../utils/DropdownOverlay/index.js";
import n from "../../utils/TextLabel.js";
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, normalizeClass as f, openBlock as p, renderList as m, toDisplayString as h, unref as g, useTemplateRef as _, withCtx as v, withModifiers as y } from "vue";
var b = {
	key: 1,
	class: "nothing-found"
}, x = /* @__PURE__ */ d({
	__name: "OptionList",
	props: {
		rootRef: {},
		groups: {},
		rest: {},
		optionSize: {},
		selectOption: { type: Function }
	},
	setup(d, { expose: x }) {
		let S = d, C = _("overlay"), w = i(() => C.value?.listRef), T = i(() => S.groups.size > 0), E = i(() => {
			let e = 0;
			for (let t of S.groups.values()) e += t.length;
			return e + S.rest.length;
		});
		return x({
			scrollIntoActive: () => {
				C.value?.scrollIntoActive();
			},
			listRef: w
		}), (i, _) => (p(), a(g(t), {
			ref_key: "overlay",
			ref: C,
			root: d.rootRef,
			class: "pl-dropdown__options",
			tabindex: "-1",
			gap: 3
		}, {
			default: v(() => [
				(p(!0), s(r, null, m(d.groups.entries(), ([t, i]) => (p(), s("div", {
					key: t,
					class: f({ "group-container": T.value })
				}, [u(n, null, {
					default: v(() => [l(h(t), 1)]),
					_: 2
				}, 1024), c("div", null, [(p(!0), s(r, null, m(i, (t, n) => (p(), a(e, {
					key: n,
					option: t,
					"is-selected": t.isSelected,
					"is-hovered": t.isActive,
					size: d.optionSize,
					onClick: y((e) => d.selectOption(t.value), ["stop"])
				}, null, 8, [
					"option",
					"is-selected",
					"is-hovered",
					"size",
					"onClick"
				]))), 128))])], 2))), 128)),
				d.rest.length ? (p(), s("div", {
					key: 0,
					class: f({ "group-container": T.value })
				}, [u(n), c("div", null, [(p(!0), s(r, null, m(d.rest, (t, n) => (p(), a(e, {
					key: n,
					option: t,
					"is-selected": t.isSelected,
					"is-hovered": t.isActive,
					size: d.optionSize,
					onClick: y((e) => d.selectOption(t.value), ["stop"])
				}, null, 8, [
					"option",
					"is-selected",
					"is-hovered",
					"size",
					"onClick"
				]))), 128))])], 2)) : o("", !0),
				E.value ? o("", !0) : (p(), s("div", b, "Nothing found"))
			]),
			_: 1
		}, 8, ["root"]));
	}
});
export { x as default };

//# sourceMappingURL=OptionList.vue2.js.map