import { jsx as s } from "react/jsx-runtime";
import "react";
import { a as m } from "./index-react-spring_web.modern.js";
import { useModalContext as y } from "./index-ModalContext.js";
import { useTransition as n } from "./index-react-spring_core.modern.js";
const O = (c) => {
  const {
    modalsList: r,
    animation: d
  } = c, {
    getModal: p,
    getModalOrder: f
  } = y();
  let a, t;
  switch (d) {
    case "slide":
      t = 400, a = n(r, {
        from: {
          transform: "translate3d(100vw, 0, 0)",
          opacity: 1,
          bgOpacity: 0
        },
        enter: [{
          opacity: 1,
          transform: "translate3d(0vw, 0, 0)",
          bgOpacity: 1
        }, {
          transform: "none",
          immediate: !0
        }],
        leave: [{
          opacity: 1,
          transform: "translate3d(0vw, 0, 0)",
          immediate: !0
        }, {
          opacity: 1,
          transform: "translate3d(100vw, 0, 0)",
          bgOpacity: 0
        }],
        config: {
          duration: t,
          mass: 1,
          tension: 120,
          friction: 20
        }
      });
      break;
    case "pop":
      t = 250, a = n(r, {
        from: {
          opacity: 0.5,
          transform: "translate3d(0, +15vh, 0)",
          bgOpacity: 0
        },
        enter: [{
          opacity: 1,
          transform: "translate3d(0, 0vh, 0)",
          bgOpacity: 1
        }, {
          transform: "none",
          immediate: !0
        }],
        leave: [{
          opacity: 1,
          transform: "translate3d(0, 0vh, 0)",
          immediate: !0
        }, {
          opacity: 0,
          transform: "translate3d(0, -15vh, 0)",
          bgOpacity: 0
        }],
        config: {
          duration: t,
          mass: 1,
          tension: 120,
          friction: 20
        }
      });
      break;
    default:
    case "grow":
      t = 250, a = n(r, {
        from: {
          opacity: 0.5,
          transform: "translate3d(0, -15vh, 0)",
          bgOpacity: 0
        },
        enter: [{
          opacity: 1,
          transform: "translate3d(0, 0vh, 0)",
          bgOpacity: 1
        }, {
          transform: "none",
          immediate: !0
        }],
        leave: [{
          opacity: 1,
          transform: "translate3d(0, 0vh, 0)",
          immediate: !0
        }, {
          opacity: 0,
          transform: "translate3d(0, -15vh, 0)",
          bgOpacity: 0
        }],
        config: {
          duration: t,
          mass: 1,
          tension: 120,
          friction: 20
        }
      });
  }
  return a((o, e) => {
    const i = p(e), l = f(e);
    return e && i && s(m.div, {
      style: {
        opacity: o.bgOpacity,
        zIndex: 1100 + l
      },
      className: "modalRoot",
      children: s(m.div, {
        style: {
          transform: o.transform,
          opacity: o.opacity
        },
        className: "modalRoot-container",
        children: i
      })
    });
  });
};
export {
  O as ModalTransition
};
