import { j as m } from "./index.es36.js";
import { useState as y, useCallback as s, useEffect as c } from "react";
import i from "./index.es67.js";
const o = {
  accepted: "accepted",
  notSet: "not_set",
  rejected: "rejected"
}, K = (l) => (t) => {
  const [e, a] = y(), g = (n) => localStorage.getItem(n) || o.notSet, r = (n, f) => localStorage.setItem(n, f), d = s(() => a(o.accepted), []), u = s(() => a(o.rejected), []);
  return c(() => {
    a(g(t.storageKey));
  }, [t.storageKey]), c(() => {
    r(t.storageKey, e || "");
  }, [e, t.storageKey]), c(() => {
    t.location && e === o.accepted && i.send("pageview");
  }, [e, t.location]), c(() => {
    e === o.accepted && i.initialize(t.id);
  }, [e]), !t.id || !t.storageKey || e !== o.notSet ? null : /* @__PURE__ */ m.jsx(
    l,
    {
      ...t,
      onAccept: d,
      onDecline: u
    }
  );
};
export {
  K as default
};
//# sourceMappingURL=index.es4.js.map
