import { useCallback as p, useEffect as b } from "react";
import { a4 as i } from "./index-CsBCemCF.js";
import { i as m } from "./inputUtils-DCYiajnz.js";
function a({
  formId: r,
  maxChars: n,
  setDirty: f,
  setUiValue: e,
  setValueWithSource: u,
  additionalAction: s
}) {
  return p((t) => {
    const {
      value: o
    } = t.target;
    n !== 0 && o.length > n || (f(!0), e(o), i({
      formId: r
    }) && u({
      value: o,
      fromUi: !0
    }), s && s());
  }, [r, n, f, e, u, s]);
}
function c(r, n, f, e, u, s = !1) {
  return p((t) => {
    const o = s ? t.metaKey || t.ctrlKey : !0;
    !m(t) || !o || (t.preventDefault(), f && n(), e.allowFormEnterToSubmit(r) && e.submitForm(r, u));
  }, [r, u, f, n, e, s]);
}
function v(r, n, f, e) {
  b(() => {
    e || r !== n && f(r);
  }, [r, n, e, f]);
}
export {
  a,
  c as b,
  v as u
};
//# sourceMappingURL=useUpdateUiValue-DoEkLcX2.js.map
