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