const m = ["top", "right", "bottom", "left"], f = ["start", "end"], M = /* @__PURE__ */ m.reduce((t, n) => t.concat(n, n + "-" + f[0], n + "-" + f[1]), []), p = Math.min, a = Math.max, h = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
}, b = {
  start: "end",
  end: "start"
};
function S(t, n, o) {
  return a(t, p(n, o));
}
function w(t, n) {
  return typeof t == "function" ? t(n) : t;
}
function g(t) {
  return t.split("-")[0];
}
function l(t) {
  return t.split("-")[1];
}
function x(t) {
  return t === "x" ? "y" : "x";
}
function d(t) {
  return t === "y" ? "height" : "width";
}
function A(t) {
  return ["top", "bottom"].includes(g(t)) ? "y" : "x";
}
function y(t) {
  return x(A(t));
}
function j(t, n, o) {
  o === void 0 && (o = !1);
  const c = l(t), i = y(t), e = d(i);
  let r = i === "x" ? c === (o ? "end" : "start") ? "right" : "left" : c === "start" ? "bottom" : "top";
  return n.reference[e] > n.floating[e] && (r = u(r)), [r, u(r)];
}
function L(t) {
  const n = u(t);
  return [s(t), n, s(n)];
}
function s(t) {
  return t.replace(/start|end/g, (n) => b[n]);
}
function P(t, n, o) {
  const c = ["left", "right"], i = ["right", "left"], e = ["top", "bottom"], r = ["bottom", "top"];
  switch (t) {
    case "top":
    case "bottom":
      return o ? n ? i : c : n ? c : i;
    case "left":
    case "right":
      return n ? e : r;
    default:
      return [];
  }
}
function C(t, n, o, c) {
  const i = l(t);
  let e = P(g(t), o === "start", c);
  return i && (e = e.map((r) => r + "-" + i), n && (e = e.concat(e.map(s)))), e;
}
function u(t) {
  return t.replace(/left|right|bottom|top/g, (n) => h[n]);
}
function O(t) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...t
  };
}
function E(t) {
  return typeof t != "number" ? O(t) : {
    top: t,
    right: t,
    bottom: t,
    left: t
  };
}
function R(t) {
  return {
    ...t,
    top: t.y,
    left: t.x,
    right: t.x + t.width,
    bottom: t.y + t.height
  };
}
export {
  f as alignments,
  S as clamp,
  w as evaluate,
  O as expandPaddingObject,
  l as getAlignment,
  y as getAlignmentAxis,
  j as getAlignmentSides,
  d as getAxisLength,
  L as getExpandedPlacements,
  s as getOppositeAlignmentPlacement,
  x as getOppositeAxis,
  C as getOppositeAxisPlacements,
  u as getOppositePlacement,
  E as getPaddingObject,
  g as getSide,
  A as getSideAxis,
  a as max,
  p as min,
  M as placements,
  R as rectToClientRect,
  m as sides
};
