import { defineComponent as z, resolveComponent as i, openBlock as c, createBlock as x, withCtx as s, createElementVNode as f, createVNode as p, toDisplayString as v, createElementBlock as _, inject as C, ref as w, computed as F, unref as V, Fragment as b, renderList as B } from "vue";
import { t as E, h as I } from "./index-e250a75e.mjs";
const N = { class: "pallet-item" }, P = { class: "text" }, S = {
  key: 1,
  class: "pallet-item"
}, q = { class: "text" }, K = /* @__PURE__ */ z({
  __name: "PalletItem",
  props: {
    config: {
      type: Object,
      required: !0,
      default() {
        return {};
      }
    }
  },
  setup(n) {
    return (m, r) => {
      const u = i("lc-icon"), a = i("el-tooltip");
      return n.config.description ? (c(), x(a, {
        key: 0,
        effect: "light",
        content: n.config.description,
        placement: "bottom-start"
      }, {
        default: s(() => [
          f("span", N, [
            p(u, {
              icon: n.config.icon,
              size: "x-large"
            }, null, 8, ["icon"]),
            f("span", P, v(n.config.name), 1)
          ])
        ]),
        _: 1
      }, 8, ["content"])) : (c(), _("span", S, [
        p(u, {
          icon: n.config.icon,
          size: "x-large"
        }, null, 8, ["icon"]),
        f("span", q, v(n.config.name), 1)
      ]));
    };
  }
}), L = { style: { "font-size": "1.1em" } }, A = /* @__PURE__ */ z({
  __name: "index",
  setup(n) {
    const m = C("globalContext"), r = C("context"), u = r.appContext.getCode().components || [], a = w(""), y = F(() => r.appContext.getCode().customizeComponent ? u.filter((e) => e.type == "folder").map((e) => m.componentRepository.folderByKey(e.key)) : m.componentRepository.componentFolders()), D = y.value.length > 0 ? y.value[0].key : void 0, h = F(() => function(e) {
      let t = m.componentRepository.componentsByFolder(e);
      return a.value && (t = t.filter((o) => g(o.key) || g(o.name) || g(o.description))), r.appContext.getCode().customizeComponent && (t = t.filter((o) => !!u.find((d) => d.type == "component" && d.key == o.key))), t;
    });
    function g(e) {
      return e ? e.indexOf(a.value) >= 0 : !1;
    }
    function O(e, t) {
      e.setData("text/plain", t.dataset.pallet);
    }
    function R(e) {
      return I(r, e);
    }
    return (e, t) => {
      const o = i("el-input"), d = i("el-col"), $ = i("el-collapse-item"), j = i("el-collapse");
      return c(), _("div", null, [
        p(o, {
          modelValue: a.value,
          "onUpdate:modelValue": t[0] || (t[0] = (l) => a.value = l),
          placeholder: e.$t("_.builtIn.plugin.pallet.filter"),
          style: { "margin-bottom": "8px" }
        }, null, 8, ["modelValue", "placeholder"]),
        p(j, {
          accordion: "",
          "model-value": V(D)
        }, {
          default: s(() => [
            (c(!0), _(b, null, B(y.value, (l) => (c(), x($, {
              key: l.key,
              name: l.key
            }, {
              title: s(() => [
                f("span", L, v(l.name), 1)
              ]),
              default: s(() => [
                p(V(E), {
                  modelValue: h.value(l.key),
                  group: { name: "components", pull: "clone", put: !1 },
                  "empty-insert-threshold": 1e3,
                  "item-key": "key",
                  clone: R,
                  class: "el-row",
                  setData: O
                }, {
                  default: s(() => [
                    (c(!0), _(b, null, B(h.value(l.key), (k) => (c(), x(d, {
                      key: k.key,
                      span: 8,
                      style: { margin: "0.8em 0" },
                      "data-pallet": k.key
                    }, {
                      default: s(() => [
                        p(K, { config: k }, null, 8, ["config"])
                      ]),
                      _: 2
                    }, 1032, ["data-pallet"]))), 128))
                  ]),
                  _: 2
                }, 1032, ["modelValue"])
              ]),
              _: 2
            }, 1032, ["name"]))), 128))
          ]),
          _: 1
        }, 8, ["model-value"])
      ]);
    };
  }
});
export {
  A as default
};
