import { useCallback as s } from "react";
import { changeErrorIndices as c } from "../../lists/change-error-indices.mjs";
import { reorderErrors as d } from "../../lists/reorder-errors.mjs";
import { reorderPath as V } from "../../paths/reorder-path.mjs";
import { insertPath as p } from "../../paths/insert-path.mjs";
import { removePath as E } from "../../paths/remove-path.mjs";
import { replacePath as F } from "../../paths/replace-path.mjs";
function g({
  $values: t,
  $errors: m,
  $status: i
}) {
  const u = s((r, e) => {
    i.clearFieldDirty(r), m.setErrors((o) => d(r, e, o)), t.setValues({
      values: V(r, e, t.refValues.current),
      updateState: !0
    });
  }, []), l = s((r, e) => {
    i.clearFieldDirty(r), m.setErrors((o) => c(r, e, o, -1)), t.setValues({
      values: E(r, e, t.refValues.current),
      updateState: !0
    });
  }, []), a = s((r, e, o) => {
    i.clearFieldDirty(r), m.setErrors((f) => c(r, o, f, 1)), t.setValues({
      values: p(r, e, o, t.refValues.current),
      updateState: !0
    });
  }, []), n = s((r, e, o) => {
    i.clearFieldDirty(r), t.setValues({
      values: F(r, o, e, t.refValues.current),
      updateState: !0
    });
  }, []);
  return { reorderListItem: u, removeListItem: l, insertListItem: a, replaceListItem: n };
}
export {
  g as useFormList
};
//# sourceMappingURL=use-form-list.mjs.map
