import { P as s, a as p, m as $ } from "./index2.js";
import { defineComponent as S, shallowRef as O, createVNode as h, ref as m, watch as M, computed as b } from "vue";
var K = function(t, a) {
  var o = {};
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && a.indexOf(n) < 0 && (o[n] = t[n]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, n = Object.getOwnPropertySymbols(t); l < n.length; l++)
    a.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[l]) && (o[n[l]] = t[n[l]]);
  return o;
};
const z = S({
  compatConfig: {
    MODE: 3
  },
  // inheritAttrs: false,
  props: {
    disabled: s.looseBool,
    type: s.string,
    value: s.any,
    tag: {
      type: String,
      default: "input"
    },
    size: s.string,
    onChange: Function,
    onInput: Function,
    onBlur: Function,
    onFocus: Function,
    onKeydown: Function,
    onCompositionstart: Function,
    onCompositionend: Function,
    onKeyup: Function,
    onPaste: Function,
    onMousedown: Function
  },
  emits: ["change", "input", "blur", "keydown", "focus", "compositionstart", "compositionend", "keyup", "paste", "mousedown"],
  setup(t, a) {
    let {
      expose: o
    } = a;
    const n = O(null);
    return o({
      focus: () => {
        n.value && n.value.focus();
      },
      blur: () => {
        n.value && n.value.blur();
      },
      input: n,
      setSelectionRange: (u, c, d) => {
        var v;
        (v = n.value) === null || v === void 0 || v.setSelectionRange(u, c, d);
      },
      select: () => {
        var u;
        (u = n.value) === null || u === void 0 || u.select();
      },
      getSelectionStart: () => {
        var u;
        return (u = n.value) === null || u === void 0 ? void 0 : u.selectionStart;
      },
      getSelectionEnd: () => {
        var u;
        return (u = n.value) === null || u === void 0 ? void 0 : u.selectionEnd;
      },
      getScrollTop: () => {
        var u;
        return (u = n.value) === null || u === void 0 ? void 0 : u.scrollTop;
      }
    }), () => {
      const {
        tag: u,
        value: c
      } = t, d = K(t, ["tag", "value"]);
      return h(u, p(p({}, d), {}, {
        ref: n,
        value: c
      }), null);
    };
  }
});
function x(t) {
  return Object.keys(t).reduce((a, o) => {
    const n = t[o];
    return typeof n == "undefined" || n === null || (a += `${o}: ${t[o]};`), a;
  }, "");
}
var D = function(t, a) {
  var o = {};
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && a.indexOf(n) < 0 && (o[n] = t[n]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, n = Object.getOwnPropertySymbols(t); l < n.length; l++)
    a.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[l]) && (o[n[l]] = t[n[l]]);
  return o;
};
const A = S({
  compatConfig: {
    MODE: 3
  },
  inheritAttrs: !1,
  props: {
    disabled: s.looseBool,
    type: s.string,
    value: s.any,
    lazy: s.bool.def(!0),
    tag: {
      type: String,
      default: "input"
    },
    size: s.string,
    style: s.oneOfType([String, Object]),
    class: s.string
  },
  emits: ["change", "input", "blur", "keydown", "focus", "compositionstart", "compositionend", "keyup", "paste", "mousedown"],
  setup(t, a) {
    let {
      emit: o,
      attrs: n,
      expose: l
    } = a;
    const r = O(null), f = m(), i = m(!1);
    M([() => t.value, i], () => {
      i.value || (f.value = t.value);
    }, {
      immediate: !0
    });
    const u = (e) => {
      o("change", e);
    }, c = (e) => {
      i.value = !0, e.target.composing = !0, o("compositionstart", e);
    }, d = (e) => {
      i.value = !1, e.target.composing = !1, o("compositionend", e);
      const g = document.createEvent("HTMLEvents");
      g.initEvent("input", !0, !0), e.target.dispatchEvent(g), u(e);
    }, v = (e) => {
      if (i.value && t.lazy) {
        f.value = e.target.value;
        return;
      }
      o("input", e);
    }, w = (e) => {
      o("blur", e);
    }, _ = (e) => {
      o("focus", e);
    }, F = () => {
      r.value && r.value.focus();
    }, P = () => {
      r.value && r.value.blur();
    }, j = (e) => {
      o("keydown", e);
    }, E = (e) => {
      o("keyup", e);
    }, C = (e, g, R) => {
      var y;
      (y = r.value) === null || y === void 0 || y.setSelectionRange(e, g, R);
    }, T = () => {
      var e;
      (e = r.value) === null || e === void 0 || e.select();
    };
    l({
      focus: F,
      blur: P,
      input: b(() => {
        var e;
        return (e = r.value) === null || e === void 0 ? void 0 : e.input;
      }),
      setSelectionRange: C,
      select: T,
      getSelectionStart: () => {
        var e;
        return (e = r.value) === null || e === void 0 ? void 0 : e.getSelectionStart();
      },
      getSelectionEnd: () => {
        var e;
        return (e = r.value) === null || e === void 0 ? void 0 : e.getSelectionEnd();
      },
      getScrollTop: () => {
        var e;
        return (e = r.value) === null || e === void 0 ? void 0 : e.getScrollTop();
      }
    });
    const k = (e) => {
      o("mousedown", e);
    }, B = (e) => {
      o("paste", e);
    }, I = b(() => t.style && typeof t.style != "string" ? x(t.style) : t.style);
    return () => {
      const e = D(t, ["style", "lazy"]);
      return h(z, p(p(p({}, e), n), {}, {
        style: I.value,
        onInput: v,
        onChange: u,
        onBlur: w,
        onFocus: _,
        ref: r,
        value: f.value,
        onCompositionstart: c,
        onCompositionend: d,
        onKeyup: E,
        onKeydown: j,
        onPaste: B,
        onMousedown: k
      }), null);
    };
  }
});
function H(t, a, o) {
  return $({
    [`${t}-status-success`]: a === "success",
    [`${t}-status-warning`]: a === "warning",
    [`${t}-status-error`]: a === "error",
    [`${t}-status-validating`]: a === "validating",
    [`${t}-has-feedback`]: o
  });
}
const L = (t, a) => a || t;
export {
  A as B,
  H as a,
  L as g
};
