import { defineComponent as S, computed as o, createBlock as v, openBlock as t, unref as c, withCtx as g, renderSlot as B, ref as A, resolveComponent as I, createElementBlock as a, createElementVNode as m, createCommentVNode as b, Fragment as f, renderList as C, toDisplayString as d, withModifiers as F } from "vue";
import { useI18n as V } from "@feedmepos/mf-common";
import { _ as M } from "./MenuSelector.vue_vue_type_script_setup_true_lang-K6Z0QJBl.js";
import { u as D } from "./index.vue_vue_type_script_setup_true_lang-BMVa5UfU.js";
import { useBreakpoints as E } from "@feedmepos/ui-library";
import { _ as y } from "./TextChip.vue_vue_type_script_setup_true_lang-8frWuZFL.js";
const X = /* @__PURE__ */ S({
  __name: "SchedulerSelector",
  setup(k) {
    const s = D(), { t: n } = V(), l = o({
      get: () => s.state.currentSchedulerId || "",
      set: (e) => s.selectScheduler(e)
    }), _ = o(() => [
      { label: n("menu.common.labels.summary"), value: "" },
      ...s.schedulers.map((e) => ({
        label: e.name,
        value: e._id
      }))
    ]), h = o(() => {
      var e;
      return ((e = _.value.find((r) => r.value === l.value)) == null ? void 0 : e.label) || n("menu.common.labels.summary");
    });
    return (e, r) => (t(), v(M, {
      modelValue: l.value,
      "onUpdate:modelValue": r[0] || (r[0] = (u) => l.value = u),
      items: _.value,
      placeholder: c(n)("menu.common.labels.summary"),
      "search-placeholder": c(n)("menu.common.actions.search"),
      title: c(n)("menu.common.labels.scheduler_title", { label: h.value })
    }, {
      append: g(() => [
        B(e.$slots, "append")
      ]),
      _: 3
    }, 8, ["modelValue", "items", "placeholder", "search-placeholder", "title"]));
  }
}), L = { class: "flex flex-wrap gap-8" }, N = { class: "py-12 px-16 space-y-12" }, O = { class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-600" }, T = { class: "flex flex-wrap gap-8" }, z = {
  key: 0,
  class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
}, U = { key: 0 }, q = {
  key: 1,
  class: "inline-block w-8"
}, G = { key: 0 }, H = { key: 1 }, Y = /* @__PURE__ */ S({
  __name: "CustomAttributeChip",
  props: {
    customAttributes: {},
    ellipsis: { type: Boolean, default: !0 }
  },
  setup(k) {
    const s = k, { t: n } = V(), l = o(() => Object.values(s.customAttributes || {})), _ = E(), h = o(() => _.breakpoints.value.xs), e = o(() => s.ellipsis ? h.value ? 1 : 2 : 1 / 0), r = o(() => l.value.length <= e.value ? l.value : l.value.slice(0, e.value)), u = A(!0), $ = o(() => {
      if (u.value) {
        const i = r.value.join(", ");
        return i.length > 20 ? i.slice(0, 20) + "..." : i;
      }
      return l.value.join(", ");
    });
    return (j, i) => {
      const w = I("FmTooltip");
      return h.value ? (t(), a(f, { key: 1 }, [
        l.value.length > 0 ? (t(), a("p", z, [
          m("span", null, d(c(n)("menu.product.table.columns.tagging")) + ": ", 1),
          m("span", null, d($.value), 1),
          u.value ? (t(), a("span", q)) : (t(), a("br", U)),
          l.value.length > e.value ? (t(), a("span", {
            key: 2,
            class: "fm-typo-en-body-md-400 text-fm-color-primary cursor-pointer",
            onClick: i[0] || (i[0] = F((p) => u.value = !u.value, ["stop", "prevent"]))
          }, [
            u.value ? (t(), a("span", G, d(c(n)("menu.product.table.tagging.expand", { count: l.value.length - e.value })), 1)) : (t(), a("span", H, d(c(n)("menu.product.table.tagging.collapse")), 1))
          ])) : b("", !0)
        ])) : b("", !0)
      ], 64)) : (t(), v(w, {
        key: 0,
        class: "flex",
        variant: "rich",
        placement: "top",
        "z-index": 50
      }, {
        content: g(() => [
          m("div", N, [
            m("p", O, d(c(n)("menu.product.table.tagging.all")), 1),
            m("div", T, [
              (t(!0), a(f, null, C(Object.entries(s.customAttributes || {}), ([p, x]) => (t(), v(y, {
                key: x,
                label: `${p}: ${x}`,
                variant: "neutral"
              }, null, 8, ["label"]))), 128))
            ])
          ])
        ]),
        default: g(() => [
          m("div", L, [
            (t(!0), a(f, null, C(r.value, (p) => (t(), v(y, {
              key: p,
              label: p,
              variant: "neutral"
            }, null, 8, ["label"]))), 128)),
            l.value.length > e.value ? (t(), v(y, {
              key: 0,
              label: "...",
              variant: "neutral"
            })) : b("", !0)
          ])
        ]),
        _: 1
      }));
    };
  }
});
export {
  Y as _,
  X as a
};
