import { defineComponent as y, computed as m, resolveDirective as x, openBlock as l, createElementBlock as i, normalizeClass as a, createElementVNode as s, unref as h, withDirectives as p, Fragment as N, createTextVNode as I, toDisplayString as E, createCommentVNode as B } from "vue";
/* empty css               */
import { C as o } from "./base-PQGakkrl.js";
import { tooltipDirectives as D } from "../Web/__directive__/Tooltip.js";
const M = ["id", "name", "checked", "disabled"], F = ["for"], q = /* @__PURE__ */ y({
  name: "ClCheckboxOne",
  directives: {
    cltooltip: D
  },
  __name: "One",
  props: {
    className: {},
    forId: {},
    name: {},
    label: {},
    value: { type: Boolean },
    disabled: { type: Boolean },
    indeterminate: { type: Boolean },
    icon: {},
    tipMsg: {},
    tipIcon: {}
  },
  emits: ["update:value", "onChange"],
  setup(e, { emit: b }) {
    const c = e, r = b, d = o.isEmpty(c.forId) ? `cb_${c.name || ""}_${o.getRandom(8)}` : c.forId, f = m(() => {
      const t = {
        checkbox: !0,
        "checkbox-default": !0,
        "checkbox-inline": !0
      };
      return c.className && !o.isEmpty(c.className) && c.className.split(" ").forEach((n) => {
        o.isEmpty(n) || (t[n] = !0);
      }), t;
    }), k = m(() => {
      const { tipIcon: t } = c, n = {
        "checkbox-icon-tip": !0
      };
      return !o.isEmpty(t) && t ? n[t] = !0 : n["clIconFont clIcon-question-circle"] = !0, n;
    }), g = m(() => ({
      indeterminate: c.indeterminate
    })), v = (t, n) => {
      r("update:value", n), r("onChange", { event: t, value: n });
    }, C = (t) => {
      v(t, t.currentTarget.checked);
    };
    return (t, n) => {
      const u = x("cltooltip");
      return l(), i("div", {
        class: a(f.value)
      }, [
        s("span", null, [
          s("span", null, [
            s("input", {
              type: "checkbox",
              id: h(d),
              name: e.name,
              class: a(g.value),
              checked: e.value,
              disabled: e.disabled,
              onClick: C
            }, null, 10, M),
            s("label", { for: h(d) }, [
              e.icon && e.icon.length > 0 ? p((l(), i("i", {
                key: 0,
                class: a(e.icon)
              }, null, 2)), [
                [u, { html: e.label, className: "tooltip-modal" }]
              ]) : (l(), i(N, { key: 1 }, [
                I(E(e.label), 1)
              ], 64))
            ], 8, F)
          ]),
          e.tipMsg && e.tipMsg.length > 0 ? p((l(), i("i", {
            key: 0,
            class: a(k.value)
          }, null, 2)), [
            [u, { html: e.tipMsg, className: "tooltip-modal" }]
          ]) : B("", !0)
        ])
      ], 2);
    };
  }
});
export {
  q as _
};
//# sourceMappingURL=One.vue_vue_type_script_setup_true_lang-BuNRS-9u.js.map
