import s from "../../../@babel/runtime/helpers/esm/slicedToArray.mjs";
import i from "../../../rc-util/es/hooks/useEvent.mjs";
import * as u from "react";
import { r as p } from "../../../react-dom/index.mjs";
import l from "./channelUpdate.mjs";
function v() {
  var t = u.useRef(null), r = function(e) {
    t.current || (t.current = [], l(function() {
      p.unstable_batchedUpdates(function() {
        t.current.forEach(function(a) {
          a();
        }), t.current = null;
      });
    })), t.current.push(e);
  };
  return r;
}
function R(t, r) {
  var n = u.useState(r), e = s(n, 2), a = e[0], f = e[1], c = i(function(o) {
    t(function() {
      f(o);
    });
  });
  return [a, c];
}
export {
  R as default,
  v as useBatcher
};
