import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
import { t } from "./debounce-Bp3jy7S5.js";
import { t as n } from "./useValidation-DGl2otXJ.js";
import { computed as r, createBlock as i, createCommentVNode as a, createElementVNode as o, createSlots as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, openBlock as f, renderSlot as p, resolveComponent as m, resolveDirective as h, toDisplayString as g, toRefs as _, unref as v, withCtx as y, withDirectives as b } from "vue";
//#region src/components/wt-search-bar/wt-search-bar.vue?vue&type=script&setup=true&lang.ts
var x = { class: "wt-search-bar__icon-controls" }, S = /*#__PURE__*/ e(/* @__PURE__ */ u({
	__name: "wt-search-bar",
	props: {
		v: { type: Object },
		customValidators: {
			type: Array,
			default: () => []
		},
		value: {
			type: String,
			default: ""
		},
		placeholder: { type: String },
		hint: {
			type: String,
			description: "Adds hint icon + tooltip with text, passed as \"hint\" prop"
		},
		searchMode: { type: [String, Object] },
		searchModeOptions: {
			type: Array,
			default: () => []
		},
		fullWidth: {
			type: Boolean,
			default: !1
		}
	},
	emits: [
		"input",
		"search",
		"enter",
		"update:search-mode",
		"change:search-mode"
	],
	setup(e, { emit: u }) {
		let S = e, C = u, { v: w, customValidators: T } = _(S), { invalid: E } = n({
			v: w,
			customValidators: T
		}), D = r(() => E.value ? "error" : "default"), O = r(() => S.value || S.searchMode || S.hint), k = t((e) => {
			C("search", e);
		}, 1e3);
		function A(e) {
			C("input", e), k(e);
		}
		function j(e) {
			e.key === "Enter" ? (k(e.target.value), e.preventDefault()) : e.key === "Esc" && (A(""), e.preventDefault());
		}
		function M({ option: e }) {
			C("update:search-mode", e), C("change:search-mode", e);
		}
		return (t, n) => {
			let r = m("wt-icon"), u = m("wt-icon-btn"), _ = m("wt-hint"), S = m("wt-radio"), C = m("wt-context-menu"), k = m("wt-input-text"), N = h("tooltip");
			return f(), i(k, {
				"model-value": e.value,
				placeholder: e.placeholder || t.$t("webitelUI.searchBar.placeholder"),
				invalid: v(E),
				class: d(["wt-search-bar", { "wt-search-bar--full-width": e.fullWidth }]),
				type: "search",
				v: v(w),
				"custom-validators": v(T),
				"onUpdate:modelValue": A,
				onKeyup: j
			}, s({
				prefix: y(() => [l(r, {
					color: D.value,
					icon: e.searchMode?.icon || "search"
				}, null, 8, ["color", "icon"])]),
				_: 2
			}, [O.value ? {
				name: "suffix",
				fn: y(() => [o("div", x, [
					e.value ? (f(), i(u, {
						key: 0,
						color: D.value,
						class: "wt-search-bar__reset-icon-btn",
						icon: "close",
						onClick: n[0] ||= (e) => A("")
					}, null, 8, ["color"])) : a("", !0),
					e.hint ? (f(), i(_, {
						key: 1,
						"icon-color": D.value
					}, {
						default: y(() => [c(g(e.hint), 1)], void 0, !0),
						_: 1
					}, 8, ["icon-color"])) : a("", !0),
					e.searchMode ? (f(), i(C, {
						key: 2,
						options: e.searchModeOptions,
						onClick: M
					}, {
						activator: y(({ toggle: e }) => [b(l(u, {
							color: v(E) ? "error" : "default",
							icon: "filter",
							onClick: e
						}, null, 8, ["color", "onClick"]), [[N, t.$t("webitelUI.searchBar.settingsHint")]])]),
						option: y(({ value: t, text: n }) => [l(S, {
							label: n,
							selected: (typeof e.searchMode == "string" ? e.searchMode : e.searchMode.value) === t,
							value: !0
						}, null, 8, ["label", "selected"])]),
						_: 1
					}, 8, ["options"])) : a("", !0),
					p(t.$slots, "additional-actions", { invalid: v(E) }, void 0, !0)
				])]),
				key: "0"
			} : void 0]), 1032, [
				"model-value",
				"placeholder",
				"invalid",
				"class",
				"v",
				"custom-validators"
			]);
		};
	}
}), [["__scopeId", "data-v-0b6f18a7"]]);
//#endregion
export { S as default };
