import { defineComponent as r, openBlock as w, createElementBlock as E, normalizeStyle as S, unref as b, withModifiers as a, ref as I } from "vue";
import { autoInstallFont as s, jsonToCssStyle as l } from "../../utils/json2css.mjs";
const _ = ["type", "value", "placeholder"], g = r({ name: "zv-interaction-input" }), B = /* @__PURE__ */ r({
  ...g,
  props: {
    basicOption: {},
    useEvents: {}
  },
  emits: ["on-blur", "on-focus", "on-input", "on-change"],
  setup(i, { emit: p }) {
    const o = p, v = () => {
      const e = I();
      return {
        rendererDomStyle: (t) => {
          if (s(t.fontFamily), s(t.focus.fontFamily), e.value)
            return {
              ...l(t),
              ...l(t.focus, "focus"),
              ...l(t.placeholder, "placeholder")
            };
        },
        inputRef: e
      };
    }, u = i, c = (e) => {
      n.value && (o("on-blur", e, n.value.value), window.SHJParseEvent(u.useEvents, "on-blur", {
        data: n.value.value,
        event: e
      }));
    }, f = (e) => {
      n.value && (o("on-focus", e, n.value.value), window.SHJParseEvent(u.useEvents, "on-focus", {
        data: n.value.value,
        event: e
      }));
    }, d = (e) => {
      n.value && (o("on-input", e, n.value.value), window.SHJParseEvent(u.useEvents, "on-input", {
        data: n.value.value,
        event: e
      }));
    }, m = (e) => {
      n.value && (o("on-change", e, n.value.value), window.SHJParseEvent(u.useEvents, "on-change", {
        data: n.value.value,
        event: e
      }));
    }, { rendererDomStyle: h, inputRef: n } = v();
    return (e, y) => (w(), E("input", {
      ref_key: "inputRef",
      ref: n,
      type: e.basicOption.css.type || "text",
      class: "zerov-widget-input",
      value: e.basicOption.value,
      placeholder: e.basicOption.placeholderValue,
      style: S(b(h)(e.basicOption.css)),
      onBlur: a(c, ["stop"]),
      onFocus: a(f, ["stop"]),
      onInput: a(d, ["stop"]),
      onChange: a(m, ["stop"])
    }, null, 44, _));
  }
});
export {
  B as default
};
