import { o as c } from "./rolldown-runtime.js";
import { i as f } from "./vendor/react.js";
import { t as g } from "./useRenderElement.js";
import { a as v } from "./useTransitionStatus.js";
import { r as y, t } from "./popupStateMapping.js";
import { l as O, m as C } from "./DialogTrigger.js";
var M = /* @__PURE__ */ c(f()), d = (function(e) {
  return e[e.open = t.open] = "open", e[e.closed = t.closed] = "closed", e[e.startingStyle = t.startingStyle] = "startingStyle", e[e.endingStyle = t.endingStyle] = "endingStyle", e.nested = "data-nested", e.nestedDialogOpen = "data-nested-dialog-open", e;
})({}), E = {
  ...y,
  ...v,
  nested(e) {
    return e ? { [d.nested]: "" } : null;
  },
  nestedDialogOpen(e) {
    return e ? { [d.nestedDialogOpen]: "" } : null;
  }
}, z = /* @__PURE__ */ M.forwardRef(function(o, a) {
  const { className: _, render: x, children: p, style: R, ...l } = o, i = O(), { store: n } = C(), s = n.useState("open"), m = n.useState("nested"), u = n.useState("transitionStatus"), S = n.useState("nestedOpenDialogCount"), r = n.useState("mounted");
  return g("div", o, {
    enabled: i || r,
    state: {
      open: s,
      nested: m,
      transitionStatus: u,
      nestedDialogOpen: S > 0
    },
    ref: [a, n.useStateSetter("viewportElement")],
    stateAttributesMapping: E,
    props: [{
      role: "presentation",
      hidden: !r,
      style: { pointerEvents: s ? void 0 : "none" },
      children: p
    }, l]
  });
});
export {
  z as t
};

//# sourceMappingURL=DialogViewport.js.map