import { jsx as t } from "@emotion/react/jsx-runtime";
import u, { createContext as c, useRef as l } from "react";
import { createPopupsStore as a } from "./store.js";
const d = c(null);
function x(r) {
  const { children: o, initialPopups: n, baseZindex: p = 0, storeId: i, storeDevtoolsEnabled: s } = r, e = l(null);
  return e.current || (e.current = a({
    baseZindex: p,
    storeId: i
  }, s), e.current?.getState().popupsActions.init(n || [])), /* @__PURE__ */ t(d.Provider, { value: e.current, children: /* @__PURE__ */ t(u.Fragment, { children: o }) });
}
export {
  d as PopupsContext,
  x as PopupsProvider
};
