import { useCallback as m } from "react";
function b(n, l, c, a) {
  const A = m(
    (f) => {
      if (!n) return;
      const { term: p } = f;
      n.commands.setSearchTerm(p), l(p), c(n.storage.searchAndReplace.results.length), a(n.storage.searchAndReplace.resultIndex);
    },
    [n, l, c, a]
  ), g = m(
    (f) => {
      if (!n) return;
      const { term: p } = f;
      n.commands.setReplaceTerm(p);
    },
    [n]
  ), u = m(() => {
    n && (n.commands.nextSearchResult(), a(n.storage.searchAndReplace.resultIndex));
  }, [n, a]), r = m(() => {
    n && (n.commands.previousSearchResult(), a(n.storage.searchAndReplace.resultIndex));
  }, [n, a]), s = m(() => {
    n && (n.commands.replace(), c(n.storage.searchAndReplace.results.length), a(n.storage.searchAndReplace.resultIndex));
  }, [n, c, a]), o = m(() => {
    n && (n.commands.replaceAll(), c(0), a(0), l(""), n.commands.setSearchTerm(""));
  }, [n, l, c, a]), h = m(() => {
    n && (n.commands.setSearchTerm(""), n.commands.resetIndex(), l(""), c(0), a(0));
  }, [n, l, c, a]);
  return {
    handleSetSearchTerm: A,
    handleSetReplaceTerm: g,
    handleNextSearchResult: u,
    handlePreviousSearchResult: r,
    handleReplace: s,
    handleReplaceAll: o,
    handleResetSearch: h
  };
}
export {
  b as default
};
//# sourceMappingURL=useHtmlEditorSearchAction.js.map
