import { defineComponent as y, ref as k, computed as F, createElementBlock as c, openBlock as i, normalizeClass as V, createCommentVNode as b, createElementVNode as E, renderSlot as h, createTextVNode as $, toDisplayString as f, createVNode as z, withKeys as I, withModifiers as g, createBlock as v, createSlots as T, withCtx as p, watch as K, mergeProps as M, mergeModels as A, useModel as C, Fragment as G, renderList as S, unref as L } from "vue";
import { g as N, e as B, _ as U, h as q, j as D } from "../.chunks/forms-BAUgA7Ct.es.js";
import { c as ne, I as re, a as ue, _ as de, b as ce } from "../.chunks/policy.vue_vue_type_style_index_0_lang-LkyBILW6.es.js";
const O = { class: "top-editArea_footer" }, _ = /* @__PURE__ */ y({
  __name: "editArea",
  props: {
    defaultValue: { default: "" },
    title: {},
    cancelText: { default: "Cancel" },
    submitText: { default: "Send" },
    closeText: { default: "Close" },
    isFocused: { type: Boolean },
    forceShowCloseBtn: { type: Boolean },
    attachToKeyboard: { type: Boolean },
    modelValue: {},
    name: {},
    placeholder: {},
    styling: {},
    rows: {},
    minHeight: {},
    expandable: { type: Boolean, default: !0 },
    disabled: { type: Boolean },
    readonly: { type: Boolean },
    isError: { type: Boolean },
    hint: {},
    maxLength: {}
  },
  emits: ["submit", "close", "clickOnTitle"],
  setup(e, { emit: o }) {
    const t = e, a = o, s = k(t.defaultValue), r = k(t.isFocused), n = F(() => s.value !== t.defaultValue), l = (m) => {
      a("submit", m), s.value = t.defaultValue;
    }, d = () => {
      if (t.forceShowCloseBtn && !n.value) {
        a("close");
        return;
      }
      s.value = t.defaultValue;
    }, x = () => {
      t.attachToKeyboard && a("clickOnTitle");
    };
    return (m, u) => (i(), c("div", {
      class: V({
        "top-editArea": !0,
        "top-editArea-attachedToKeyboard": e.attachToKeyboard
      })
    }, [
      e.title || m.$slots.caption ? (i(), c("div", {
        key: 0,
        class: "top-editArea_caption",
        onClick: u[0] || (u[0] = (w) => x())
      }, [
        h(m.$slots, "caption", {}, () => [
          $(f(e.title), 1)
        ])
      ])) : b("", !0),
      E("div", {
        class: V({
          "top-editArea_form": !0,
          "top-forms-focusable": !0,
          "top-as-input": !0,
          "top-error": e.isError,
          "top-focus": r.value
        })
      }, [
        z(N, {
          modelValue: s.value,
          "onUpdate:modelValue": u[1] || (u[1] = (w) => s.value = w),
          name: e.name,
          placeholder: e.placeholder,
          rows: e.rows,
          minHeight: e.minHeight,
          expandable: e.expandable,
          disabled: e.disabled,
          readonly: e.readonly,
          isError: e.isError,
          hint: e.hint,
          class: "top-editArea_element",
          onFocus: u[2] || (u[2] = () => r.value = !0),
          onBlur: u[3] || (u[3] = () => r.value = !1),
          onKeyup: [
            I(d, ["esc"]),
            u[4] || (u[4] = I(g((w) => l(s.value), ["ctrl"]), ["enter"]))
          ]
        }, null, 8, ["modelValue", "name", "placeholder", "rows", "minHeight", "expandable", "disabled", "readonly", "isError", "hint"]),
        E("div", O, [
          n.value || e.forceShowCloseBtn ? (i(), v(B, {
            key: 0,
            icon: m.$core.state.isMobile ? "" : "",
            class: "top-editArea_button",
            color: "theme",
            styling: "soft",
            onClick: d
          }, T({ _: 2 }, [
            m.$core.state.isMobile ? void 0 : {
              name: "default",
              fn: p(() => [
                $(f(e.cancelText), 1)
              ]),
              key: "0"
            }
          ]), 1032, ["icon"])) : b("", !0),
          n.value ? (i(), v(B, {
            key: 1,
            class: "top-editArea_button",
            icon: m.$core.state.isMobile ? "" : "",
            onClick: u[5] || (u[5] = (w) => l(s.value))
          }, T({ _: 2 }, [
            m.$core.state.isMobile ? void 0 : {
              name: "default",
              fn: p(() => [
                $(f(e.submitText), 1)
              ]),
              key: "0"
            }
          ]), 1032, ["icon"])) : b("", !0)
        ])
      ], 2)
    ], 2));
  }
}), P = { class: "top-editInput" }, ee = /* @__PURE__ */ y({
  __name: "editInput",
  props: {
    modelValue: {},
    input: {},
    button: {}
  },
  emits: ["update:modelValue"],
  setup(e, { emit: o }) {
    const t = e, a = k(t.modelValue);
    K(() => t.modelValue, () => {
      a.value = t.modelValue;
    });
    const s = o, r = () => {
      s("update:modelValue", a.value);
    };
    return (n, l) => (i(), c("div", P, [
      z(U, M(e.input, {
        onKeydownCapture: l[0] || (l[0] = I(g((d) => a.value = e.modelValue, ["stop"]), ["esc"])),
        onKeydown: I(g(r, ["stop"]), ["enter"]),
        modelValue: a.value,
        "onUpdate:modelValue": l[1] || (l[1] = (d) => a.value = d)
      }), T({ _: 2 }, [
        n.$slots.caption ? {
          name: "caption",
          fn: p(() => [
            h(n.$slots, "caption")
          ]),
          key: "0"
        } : void 0
      ]), 1040, ["onKeydown", "modelValue"]),
      a.value !== e.modelValue ? (i(), v(B, M({
        key: 0,
        icon: "",
        styling: "soft"
      }, e.button, { onClick: r }), null, 16)) : b("", !0)
    ]));
  }
}), H = /* @__PURE__ */ y({
  __name: "optionGroup",
  props: /* @__PURE__ */ A({
    modelValue: {},
    items: {},
    size: { default: "s" },
    showIndicator: { type: Boolean },
    isError: { type: Boolean }
  }, {
    modelValue: {
      required: !0
    },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(e) {
    const o = C(e, "modelValue"), t = e, a = k(null);
    K(o, () => {
      const r = t.items.map((n) => n.value);
      Array.isArray(o.value) ? o.value.find((l) => !r.includes(l)) && (o.value = o.value.filter((l) => r.includes(l))) : r.includes(o.value) || (o.value = r[0] ?? ""), a.value?.querySelector(".radioGroup_item-selected")?.scrollIntoView();
    }, { immediate: !0 });
    const s = "optionGroup-" + Math.random();
    return (r, n) => (i(), c("div", {
      ref_key: "elRef",
      ref: a,
      class: V({
        "top-optionGroup": !0,
        ["top-optionGroup-showIndicator_" + Number(e.showIndicator)]: !0,
        "top-scrollBarXHidding": !0,
        ["top-size_" + e.size]: !!e.size,
        "top-error": e.isError
      })
    }, [
      Array.isArray(o.value) ? (i(!0), c(G, { key: 0 }, S(e.items, (l) => (i(), v(q, {
        class: V({
          "top-optionGroup_item-selected": o.value.includes(l.value),
          "top-optionGroup_item": !0
        }),
        modelValue: o.value,
        "onUpdate:modelValue": n[0] || (n[0] = (d) => o.value = d),
        value: l.value,
        title: l.title,
        disabled: l.disabled,
        isError: e.isError,
        "data-top-icon": l.icon
      }, T({ _: 2 }, [
        l.label ? {
          name: "default",
          fn: p(() => [
            $(f(l.label), 1)
          ]),
          key: "0"
        } : void 0
      ]), 1032, ["class", "modelValue", "value", "title", "disabled", "isError", "data-top-icon"]))), 256)) : (i(!0), c(G, { key: 1 }, S(e.items, (l) => (i(), v(D, {
        class: V({
          "top-optionGroup_item-selected": l.value === o.value,
          "top-optionGroup_item": !0
        }),
        modelValue: o.value,
        "onUpdate:modelValue": n[1] || (n[1] = (d) => o.value = d),
        name: s,
        value: l.value,
        title: l.title,
        disabled: l.disabled,
        isError: e.isError,
        "data-top-icon": l.icon
      }, T({ _: 2 }, [
        l.label ? {
          name: "default",
          fn: p(() => [
            $(f(l.label), 1)
          ]),
          key: "0"
        } : void 0
      ]), 1032, ["class", "modelValue", "value", "title", "disabled", "isError", "data-top-icon"]))), 256))
    ], 2));
  }
}), oe = /* @__PURE__ */ y({
  __name: "radioGroup",
  props: /* @__PURE__ */ A({
    modelValue: {},
    items: {},
    size: {},
    showIndicator: { type: Boolean },
    isError: { type: Boolean }
  }, {
    modelValue: {
      required: !0
    },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(e) {
    const o = C(e, "modelValue");
    return (t, a) => (i(), v(H, {
      class: "top-radioGroup",
      modelValue: o.value,
      "onUpdate:modelValue": a[0] || (a[0] = (s) => o.value = s),
      items: t.$props.items,
      size: t.$props.size,
      showIndicator: t.$props.showIndicator,
      isError: t.$props.isError
    }, {
      default: p(() => [
        h(t.$slots, "default")
      ]),
      _: 3
    }, 8, ["modelValue", "items", "size", "showIndicator", "isError"]));
  }
}), te = /* @__PURE__ */ y({
  __name: "checkboxGroup",
  props: /* @__PURE__ */ A({
    modelValue: {},
    items: {},
    size: {},
    showIndicator: { type: Boolean },
    isError: { type: Boolean }
  }, {
    modelValue: {
      required: !0
    },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(e) {
    const o = C(e, "modelValue");
    return (t, a) => (i(), v(H, {
      class: "top-checkboxGroup",
      modelValue: o.value,
      "onUpdate:modelValue": a[0] || (a[0] = (s) => o.value = s),
      items: t.$props.items,
      size: t.$props.size,
      showIndicator: t.$props.showIndicator,
      isError: t.$props.isError
    }, {
      default: p(() => [
        h(t.$slots, "default")
      ]),
      _: 3
    }, 8, ["modelValue", "items", "size", "showIndicator", "isError"]));
  }
}), R = ["data-top-icon"], W = { class: "top-info_text" }, j = {
  key: 0,
  class: "top-info_value"
}, le = /* @__PURE__ */ y({
  __name: "info",
  props: {
    icon: {},
    styling: { default: "default" },
    size: { default: "default" }
  },
  setup(e) {
    return (o, t) => (i(), c("div", {
      class: V({
        "top-info": !0,
        ["top-size_" + e.size]: !0,
        ["top-info-styling_" + e.styling]: !0
      }),
      "data-top-icon": e.icon
    }, [
      E("div", W, [
        h(o.$slots, "default")
      ]),
      o.$slots.additional ? (i(), c("span", j, [
        h(o.$slots, "additional")
      ])) : b("", !0)
    ], 10, R));
  }
}), X = {
  key: 0,
  class: "top-policy"
}, J = { class: "top-policy_title" }, Q = ["innerHTML"], ae = /* @__PURE__ */ y({
  __name: "policy",
  props: {
    title: {},
    description: {},
    acceptText: {}
  },
  emits: ["accept"],
  setup(e, { emit: o }) {
    const t = o, a = k(!0), s = () => {
      a.value = !1, t("accept");
    };
    return (r, n) => a.value ? (i(), c("div", X, [
      E("div", J, f(e.title), 1),
      E("div", {
        class: "top-policy_description",
        innerHTML: e.description
      }, null, 8, Q),
      z(L(B), {
        size: "m",
        onClick: s
      }, {
        default: p(() => [
          $(f(e.acceptText), 1)
        ]),
        _: 1
      })
    ])) : b("", !0);
  }
});
export {
  ne as ITEM_ID_ALL,
  re as ITEM_ID_NEW,
  te as TopCheckboxGroup,
  _ as TopEditArea,
  ee as TopEditInput,
  le as TopInfo,
  ue as TopMenu,
  ae as TopPolicy,
  oe as TopRadioGroup,
  de as TopSelector2,
  ce as apiSetSearchParamsFilter
};
//# sourceMappingURL=formsExt.js.map
