import { defineComponent as d, ref as s, createVNode as l, Fragment as f, resolveComponent as n } from "vue";
import { ElButton as C, ElInput as v, ElEmpty as E, ElIcon as y } from "element-plus";
import "@klweb/compose-app-engine";
import { T as u, A as g } from "./main-Blxobku2.js";
import { u as h } from "./basics.comp.data-D5b3884D.js";
import { e as x } from "./index-BbdVezoQ.js";
import { C as p } from "./index-6txV8xZU.js";
const {
  IconSearch: k,
  IconSelected: A
} = x, D = /* @__PURE__ */ d({
  name: "KlBasicsCompRep",
  components: {
    ElButton: C,
    ElInput: v,
    ElEmpty: E,
    ElIcon: y,
    IconSelected: A
  },
  emits: ["handleNodeClick"],
  setup(N, {
    emit: i
  }) {
    const o = s(""), c = s(h()), t = s(c.value), a = s(""), r = () => {
      if (!o.value) {
        t.value = c.value;
        return;
      }
      t.value = c.value.filter((e) => e.name.includes(o.value));
    }, m = (e) => {
      if (a.value === e.component) {
        a.value = "", i("handleNodeClick", null);
        return;
      }
      a.value = e.component, i("handleNodeClick", e);
    };
    return () => l(f, null, [l("section", {
      class: p["filter-text"]
    }, [l(n("el-input"), {
      modelValue: o.value,
      "onUpdate:modelValue": (e) => o.value = e,
      "prefix-icon": k,
      placeholder: u.COMP_SEARCH_PLACEHOLDER,
      onKeydown: (e) => {
        e.key === "Enter" && r();
      },
      onClear: r,
      clearable: !0
    }, null), l(n("el-button"), {
      type: "primary",
      style: "margin-left: 10px",
      onClick: r
    }, {
      default: () => [g.SEARCH]
    })]), t.value.length ? l("ul", {
      class: p["comp-grid-container"]
    }, [t.value.map((e) => l("li", {
      class: a.value === e.component && "active",
      key: e.name,
      onClick: () => m(e)
    }, [l("img", {
      src: e.imgUrl,
      style: "object-fit: cover"
    }, null), l("span", {
      class: "label"
    }, [e.name]), l(n("el-icon"), null, {
      default: () => [l(n("icon-selected"), null, null)]
    })]))]) : l(n("el-empty"), {
      "image-size": 90,
      description: u.DATA_NULL,
      style: "--el-empty-padding: 50px 0; --el-font-size-base: 12px"
    }, null)]);
  }
});
export {
  D as default
};
