import s from "../../../@babel/runtime/helpers/esm/slicedToArray.mjs";
import * as t from "react";
import { PreviewGroupContext as c } from "../context.mjs";
var o = 0;
function p(i, u) {
  var n = t.useState(function() {
    return o += 1, String(o);
  }), f = s(n, 1), r = f[0], e = t.useContext(c), a = {
    data: u,
    canPreview: i
  };
  return t.useEffect(function() {
    if (e)
      return e.register(r, a);
  }, []), t.useEffect(function() {
    e && e.register(r, a);
  }, [i, u]), r;
}
export {
  p as default
};
