158 lines
3.6 KiB
JavaScript
158 lines
3.6 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 20293dbce215808d.10cf9e27a9.js
|
|
* Module id: 425017
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
let t = ["top", "right", "bottom", "left"],
|
|
n = t.reduce((e, t) => e.concat(t, t + "-start", t + "-end"), []),
|
|
r = Math.min,
|
|
o = Math.max,
|
|
i = Math.round,
|
|
l = Math.floor,
|
|
a = (e) => ({ x: e, y: e }),
|
|
u = { left: "right", right: "left", bottom: "top", top: "bottom" },
|
|
s = { start: "end", end: "start" };
|
|
function c(e, t, n) {
|
|
return o(e, r(t, n));
|
|
}
|
|
function d(e, t) {
|
|
return "function" == typeof e ? e(t) : e;
|
|
}
|
|
function f(e) {
|
|
return e.split("-")[0];
|
|
}
|
|
function m(e) {
|
|
return e.split("-")[1];
|
|
}
|
|
function p(e) {
|
|
return "x" === e ? "y" : "x";
|
|
}
|
|
function v(e) {
|
|
return "y" === e ? "height" : "width";
|
|
}
|
|
let g = new Set(["top", "bottom"]);
|
|
function h(e) {
|
|
return g.has(f(e)) ? "y" : "x";
|
|
}
|
|
function y(e) {
|
|
return p(h(e));
|
|
}
|
|
function w(e, t, n) {
|
|
void 0 === n && (n = !1);
|
|
let r = m(e),
|
|
o = y(e),
|
|
i = v(o),
|
|
l =
|
|
"x" === o
|
|
? r === (n ? "end" : "start")
|
|
? "right"
|
|
: "left"
|
|
: "start" === r
|
|
? "bottom"
|
|
: "top";
|
|
return t.reference[i] > t.floating[i] && (l = M(l)), [l, M(l)];
|
|
}
|
|
function b(e) {
|
|
let t = M(e);
|
|
return [x(e), t, x(t)];
|
|
}
|
|
function x(e) {
|
|
return e.replace(/start|end/g, (e) => s[e]);
|
|
}
|
|
let E = ["left", "right"],
|
|
S = ["right", "left"],
|
|
C = ["top", "bottom"],
|
|
R = ["bottom", "top"];
|
|
function T(e, t, n, r) {
|
|
let o = m(e),
|
|
i = (function (e, t, n) {
|
|
switch (e) {
|
|
case "top":
|
|
case "bottom":
|
|
if (n) return t ? S : E;
|
|
return t ? E : S;
|
|
case "left":
|
|
case "right":
|
|
return t ? C : R;
|
|
default:
|
|
return [];
|
|
}
|
|
})(f(e), "start" === n, r);
|
|
return (
|
|
o && ((i = i.map((e) => e + "-" + o)), t && (i = i.concat(i.map(x)))), i
|
|
);
|
|
}
|
|
function M(e) {
|
|
return e.replace(/left|right|bottom|top/g, (e) => u[e]);
|
|
}
|
|
function A(e) {
|
|
return "number" != typeof e
|
|
? { top: 0, right: 0, bottom: 0, left: 0, ...e }
|
|
: { top: e, right: e, bottom: e, left: e };
|
|
}
|
|
function L(e) {
|
|
let { x: t, y: n, width: r, height: o } = e;
|
|
return {
|
|
width: r,
|
|
height: o,
|
|
top: n,
|
|
left: t,
|
|
right: t + r,
|
|
bottom: n + o,
|
|
x: t,
|
|
y: n,
|
|
};
|
|
}
|
|
e.s([
|
|
"clamp",
|
|
() => c,
|
|
"createCoords",
|
|
() => a,
|
|
"evaluate",
|
|
() => d,
|
|
"floor",
|
|
() => l,
|
|
"getAlignment",
|
|
() => m,
|
|
"getAlignmentAxis",
|
|
() => y,
|
|
"getAlignmentSides",
|
|
() => w,
|
|
"getAxisLength",
|
|
() => v,
|
|
"getExpandedPlacements",
|
|
() => b,
|
|
"getOppositeAlignmentPlacement",
|
|
() => x,
|
|
"getOppositeAxis",
|
|
() => p,
|
|
"getOppositeAxisPlacements",
|
|
() => T,
|
|
"getOppositePlacement",
|
|
() => M,
|
|
"getPaddingObject",
|
|
() => A,
|
|
"getSide",
|
|
() => f,
|
|
"getSideAxis",
|
|
() => h,
|
|
"max",
|
|
() => o,
|
|
"min",
|
|
() => r,
|
|
"placements",
|
|
() => n,
|
|
"rectToClientRect",
|
|
() => L,
|
|
"round",
|
|
() => i,
|
|
"sides",
|
|
() => t,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|