@tomplum/react-git-log
Version:
A flexible, themable, React component for visualising Git commit history, branch and tag metadata.
1,429 lines (1,428 loc) • 157 kB
JavaScript
import * as Y from "react";
import ve, { createContext as Je, useContext as Ke, useMemo as H, useCallback as K, useState as Ce, useRef as ut, useEffect as Ie, cloneElement as wr, Children as _r, isValidElement as br } from "react";
import xr from "react-dom";
import './index.css';function Ee(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
var We = { exports: {} }, Me = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var $t;
function yr() {
if ($t) return Me;
$t = 1;
var r = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
function t(n, s, o) {
var i = null;
if (o !== void 0 && (i = "" + o), s.key !== void 0 && (i = "" + s.key), "key" in s) {
o = {};
for (var a in s)
a !== "key" && (o[a] = s[a]);
} else o = s;
return s = o.ref, {
$$typeof: r,
type: n,
key: i,
ref: s !== void 0 ? s : null,
props: o
};
}
return Me.Fragment = e, Me.jsx = t, Me.jsxs = t, Me;
}
var Ne = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var St;
function $r() {
return St || (St = 1, process.env.NODE_ENV !== "production" && function() {
function r(f) {
if (f == null) return null;
if (typeof f == "function")
return f.$$typeof === E ? null : f.displayName || f.name || null;
if (typeof f == "string") return f;
switch (f) {
case C:
return "Fragment";
case R:
return "Profiler";
case b:
return "StrictMode";
case z:
return "Suspense";
case B:
return "SuspenseList";
case k:
return "Activity";
}
if (typeof f == "object")
switch (typeof f.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), f.$$typeof) {
case p:
return "Portal";
case D:
return f.displayName || "Context";
case N:
return (f._context.displayName || "Context") + ".Consumer";
case T:
var y = f.render;
return f = f.displayName, f || (f = y.displayName || y.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
case I:
return y = f.displayName || null, y !== null ? y : r(f.type) || "Memo";
case O:
y = f._payload, f = f._init;
try {
return r(f(y));
} catch {
}
}
return null;
}
function e(f) {
return "" + f;
}
function t(f) {
try {
e(f);
var y = !1;
} catch {
y = !0;
}
if (y) {
y = console;
var L = y.error, j = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
return L.call(
y,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
j
), e(f);
}
}
function n(f) {
if (f === C) return "<>";
if (typeof f == "object" && f !== null && f.$$typeof === O)
return "<...>";
try {
var y = r(f);
return y ? "<" + y + ">" : "<...>";
} catch {
return "<...>";
}
}
function s() {
var f = W.A;
return f === null ? null : f.getOwner();
}
function o() {
return Error("react-stack-top-frame");
}
function i(f) {
if (q.call(f, "key")) {
var y = Object.getOwnPropertyDescriptor(f, "key").get;
if (y && y.isReactWarning) return !1;
}
return f.key !== void 0;
}
function a(f, y) {
function L() {
w || (w = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
y
));
}
L.isReactWarning = !0, Object.defineProperty(f, "key", {
get: L,
configurable: !0
});
}
function l() {
var f = r(this.type);
return $[f] || ($[f] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), f = this.props.ref, f !== void 0 ? f : null;
}
function c(f, y, L, j, Z, U) {
var G = L.ref;
return f = {
$$typeof: v,
type: f,
key: y,
props: L,
_owner: j
}, (G !== void 0 ? G : null) !== null ? Object.defineProperty(f, "ref", {
enumerable: !1,
get: l
}) : Object.defineProperty(f, "ref", { enumerable: !1, value: null }), f._store = {}, Object.defineProperty(f._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(f, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(f, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: Z
}), Object.defineProperty(f, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: U
}), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
}
function d(f, y, L, j, Z, U) {
var G = y.children;
if (G !== void 0)
if (j)
if (S(G)) {
for (j = 0; j < G.length; j++)
g(G[j]);
Object.freeze && Object.freeze(G);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else g(G);
if (q.call(y, "key")) {
G = r(f);
var V = Object.keys(y).filter(function(A) {
return A !== "key";
});
j = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", M[G + j] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
j,
G,
V,
G
), M[G + j] = !0);
}
if (G = null, L !== void 0 && (t(L), G = "" + L), i(y) && (t(y.key), G = "" + y.key), "key" in y) {
L = {};
for (var X in y)
X !== "key" && (L[X] = y[X]);
} else L = y;
return G && a(
L,
typeof f == "function" ? f.displayName || f.name || "Unknown" : f
), c(
f,
G,
L,
s(),
Z,
U
);
}
function g(f) {
u(f) ? f._store && (f._store.validated = 1) : typeof f == "object" && f !== null && f.$$typeof === O && (f._payload.status === "fulfilled" ? u(f._payload.value) && f._payload.value._store && (f._payload.value._store.validated = 1) : f._store && (f._store.validated = 1));
}
function u(f) {
return typeof f == "object" && f !== null && f.$$typeof === v;
}
var m = ve, v = Symbol.for("react.transitional.element"), p = Symbol.for("react.portal"), C = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), N = Symbol.for("react.consumer"), D = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), k = Symbol.for("react.activity"), E = Symbol.for("react.client.reference"), W = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, S = Array.isArray, x = console.createTask ? console.createTask : function() {
return null;
};
m = {
react_stack_bottom_frame: function(f) {
return f();
}
};
var w, $ = {}, _ = m.react_stack_bottom_frame.bind(
m,
o
)(), P = x(n(o)), M = {};
Ne.Fragment = C, Ne.jsx = function(f, y, L) {
var j = 1e4 > W.recentlyCreatedOwnerStacks++;
return d(
f,
y,
L,
!1,
j ? Error("react-stack-top-frame") : _,
j ? x(n(f)) : P
);
}, Ne.jsxs = function(f, y, L) {
var j = 1e4 > W.recentlyCreatedOwnerStacks++;
return d(
f,
y,
L,
!0,
j ? Error("react-stack-top-frame") : _,
j ? x(n(f)) : P
);
};
}()), Ne;
}
var kt;
function mt() {
return kt || (kt = 1, process.env.NODE_ENV === "production" ? We.exports = yr() : We.exports = $r()), We.exports;
}
var h = mt();
const Sr = "_container_132e7_1", Rt = {
container: Sr
}, kr = "_tooltip_6a7sr_1", Rr = {
tooltip: kr
}, rr = [
"rgb(0, 255, 128)",
// Neon green
"rgb(41, 121, 255)",
// Electric blue
"rgb(201, 81, 238)",
// Pink
"rgb(255, 160, 0)",
// Amber
"rgb(0, 184, 212)",
// Dark cyan
"rgb(103, 58, 183)",
// Royal violet
"rgb(224,33,70)",
// Red
"rgb(0, 121, 107)",
// Teal storm
"rgb(255, 193, 7)"
// Solar gold
], Tr = [
"rgb(0, 200, 83)",
// Bright green
"rgb(25, 118, 210)",
// Medium blue
"rgb(244, 143, 177)",
// Soft pink
"rgb(255, 193, 7)",
// Golden amber
"rgb(3, 169, 244)",
// Sky blue
"rgb(156, 39, 176)",
// Vibrant violet
"rgb(229, 57, 53)",
// Warm red
"rgb(0, 137, 123)",
// Ocean teal
"rgb(255, 160, 0)"
// Deep yellow-orange
], re = 40, ft = 20, ze = 2, nr = 16, Te = 24, Tt = {
hash: "defaultCommit",
branch: "unknown",
parents: [],
children: [],
authorDate: (/* @__PURE__ */ new Date()).toString(),
message: "Working tree index",
committerDate: (/* @__PURE__ */ new Date()).toString(),
isBranchTip: !1
}, or = Je({
headCommit: Tt,
indexCommit: Tt,
currentBranch: "master",
showTable: !0,
showBranchesTags: !0,
selectedCommit: void 0,
setSelectedCommit: (r) => {
console.debug(`Tried to invoke setSelectedCommit(${JSON.stringify(r)}) before the GitContext was initialised.`);
},
previewedCommit: void 0,
setPreviewedCommit: (r) => {
console.debug(`Tried to invoke setPreviewedCommit(${JSON.stringify(r)}) before the GitContext was initialised.`);
},
graphOrientation: "normal",
setGraphOrientation: (r) => {
console.debug(`Tried to invoke setGraphOrientation(${r}) before the GitContext was initialised.`);
},
graphData: {
children: /* @__PURE__ */ new Map(),
edges: [],
graphWidth: 0,
commits: [],
positions: /* @__PURE__ */ new Map(),
parents: /* @__PURE__ */ new Map(),
hashToCommit: /* @__PURE__ */ new Map()
},
rowSpacing: 0,
graphWidth: 300,
nodeSize: ft,
setNodeSize: (r) => {
console.debug(`Tried to invoke setNodeSize(${r}) before the GitContext was initialised.`);
},
setGraphWidth: (r) => {
console.debug(`Tried to invoke setGraphWidth(${r}) before the GitContext was initialised.`);
},
isServerSidePaginated: !1,
paging: {
endIndex: 0,
startIndex: 0
},
isIndexVisible: !0
}), J = () => Ke(or), sr = Je({
colours: rr,
theme: "light"
}), Er = () => Ke(sr), Et = (r) => {
if (r < 1)
return [];
const e = [];
if (r === 1)
e.push("rgb(54,229,234)");
else
for (let t = 0; t < r; t++) {
const n = t / (r - 1) * 360, s = t === r - 1 ? 359 : n, i = Mr(t === 0 ? 0 : s, 100, 50);
e.push(`rgb(${i[0]}, ${i[1]}, ${i[2]})`);
}
return e;
}, Mr = (r, e, t) => {
e /= 100, t /= 100;
const n = (i) => (i + r / 30) % 12, s = e * Math.min(t, 1 - t), o = (i) => Math.round((t - s * Math.max(-1, Math.min(n(i) - 3, Math.min(9 - n(i), 1)))) * 255);
return [o(0), o(8), o(4)];
}, Nr = ({ children: r, theme: e, colours: t, graphWidth: n }) => {
const { shiftAlphaChannel: s } = oe(), o = H(() => {
switch (t) {
case "rainbow-light":
return Et(n + 1);
case "rainbow-dark":
return Et(n + 1).map((a) => s(a, 0.6));
case "neon-aurora-dark":
return rr;
case "neon-aurora-light":
return Tr;
default:
return e === "light" ? t : t.map((a) => s(a, 0.6));
}
}, [t, n, s, e]), i = H(() => ({
colours: o,
theme: e
}), [e, o]);
return /* @__PURE__ */ h.jsx(sr.Provider, { value: i, children: r });
}, oe = () => {
const { graphData: r } = J(), { theme: e, colours: t } = Er(), n = H(() => e === "dark" ? "rgba(70,70,70,0.8)" : "rgba(231, 231, 231, 0.5)", [e]), s = H(() => e === "dark" ? "rgb(255, 255, 255)" : "rgb(0, 0, 0)", [e]), o = K((u, m) => {
const v = u?.match(/\d+/g);
if (u && v != null) {
const [p, C, b] = v.map(Number), R = e === "dark" ? "rgb(0, 0, 0)" : "rgb(255, 255, 255)", [N, D, T] = R.match(/\d+/g).map(Number), z = Math.round(p * m + N * (1 - m)), B = Math.round(C * m + D * (1 - m)), I = Math.round(b * m + T * (1 - m));
return `rgb(${z}, ${B}, ${I})`;
}
return u;
}, [e]), i = K((u, m) => `rgba(${u?.replace("rgb(", "").replace(")", "")}, ${m})`, []), a = K((u) => {
const m = t[u];
return m || t[u % t.length];
}, [t]), l = K((u) => {
if (u.hash === "index")
return a(0);
const m = r.positions.get(u.hash);
if (m) {
const v = m[1];
return a(v);
}
return console.warn(`Commit ${u.hash} did not have a mapped graph position`), "rgb(0, 0, 0)";
}, [a, r.positions]), c = K((u) => ({
backgroundColour: o(u.columnColour, 0.15),
borderColour: u.columnColour
}), [o]), d = K((u) => i(a(u), 0.15), [a, i]), g = K((u) => e === "dark" ? o(l(u), 0.2) : o(l(u), 0.1), [l, o, e]);
return {
theme: e,
hoverColour: n,
textColour: s,
getTooltipBackground: g,
reduceOpacity: i,
getCommitColour: l,
shiftAlphaChannel: o,
getGraphColumnColour: a,
getCommitNodeColours: c,
getGraphColumnSelectedBackgroundColour: d,
hoverTransitionDuration: 0.3
};
}, Pr = ({ id: r, commit: e }) => {
const { textColour: t, getTooltipBackground: n, getCommitColour: s } = oe(), o = n(e);
return /* @__PURE__ */ h.jsx(
"div",
{
className: Rr.tooltip,
id: `tag-${r}-tooltip`,
"data-testid": `tag-${r}-tooltip`,
style: {
color: t,
background: o,
border: `2px solid ${s(e)}`
},
children: e.branch
}
);
}, Lr = "_tagContainer_16coc_1", Dr = "_tag_16coc_1", jr = "_tagLine_16coc_24", nt = {
tagContainer: Lr,
tag: Dr,
tagLine: jr
};
var Pe = {}, Le = {}, Mt;
function Or() {
if (Mt) return Le;
Mt = 1, Object.defineProperty(Le, "__esModule", { value: !0 }), Le.PopoverPortal = void 0;
var r = ve, e = xr, t = function(n) {
var s = n.container, o = n.element, i = n.scoutElement, a = n.children;
return (0, r.useLayoutEffect)(function() {
return s.appendChild(o), s.appendChild(i), function() {
s.removeChild(o), s.removeChild(i);
};
}, [s, o, i]), (0, e.createPortal)(a, o);
};
return Le.PopoverPortal = t, Le;
}
var De = {}, Nt;
function gt() {
return Nt || (Nt = 1, function(r) {
var e = De && De.__assign || function() {
return e = Object.assign || function(l) {
for (var c, d = 1, g = arguments.length; d < g; d++) {
c = arguments[d];
for (var u in c) Object.prototype.hasOwnProperty.call(c, u) && (l[u] = c[u]);
}
return l;
}, e.apply(this, arguments);
};
Object.defineProperty(r, "__esModule", { value: !0 }), r.getNudgedPopoverRect = r.getNewPopoverRect = r.popoverRectForPosition = r.createContainer = r.rectsAreEqual = r.createRect = r.EMPTY_RECT = void 0, r.EMPTY_RECT = {
top: 0,
left: 0,
right: 0,
bottom: 0,
width: 0,
height: 0
};
var t = function(l) {
var c = l.top, d = l.left, g = l.width, u = l.height;
return {
top: c,
left: d,
width: g,
height: u,
right: d + g,
bottom: c + u
};
};
r.createRect = t;
var n = function(l, c) {
return l === c || l?.bottom === c?.bottom && l?.height === c?.height && l?.left === c?.left && l?.right === c?.right && l?.top === c?.top && l?.width === c?.width;
};
r.rectsAreEqual = n;
var s = function(l) {
var c = l.containerStyle, d = l.containerClassName, g = window.document.createElement("div");
return d && (g.className = d), Object.assign(g.style, c), g;
};
r.createContainer = s;
var o = function(l, c, d, g, u) {
var m = c.left + c.width / 2, v = c.top + c.height / 2, p = d.width, C = d.height, b, R;
switch (l) {
case "left":
b = v - C / 2, R = c.left - g - p, u === "start" && (b = c.top), u === "end" && (b = c.bottom - C);
break;
case "bottom":
b = c.bottom + g, R = m - p / 2, u === "start" && (R = c.left), u === "end" && (R = c.right - p);
break;
case "right":
b = v - C / 2, R = c.right + g, u === "start" && (b = c.top), u === "end" && (b = c.bottom - C);
break;
default:
b = c.top - C - g, R = m - p / 2, u === "start" && (R = c.left), u === "end" && (R = c.right - p);
break;
}
return (0, r.createRect)({ left: R, top: b, width: p, height: C });
};
r.popoverRectForPosition = o;
var i = function(l, c) {
var d = l.position, g = l.align, u = l.childRect, m = l.popoverRect, v = l.boundaryRect, p = l.padding, C = l.reposition, b = (0, r.popoverRectForPosition)(d, u, m, p, g), R = C && (d === "top" && b.top < v.top + c || d === "left" && b.left < v.left + c || d === "right" && b.right > v.right - c || d === "bottom" && b.bottom > v.bottom - c);
return {
rect: b,
boundaryViolation: R
};
};
r.getNewPopoverRect = i;
var a = function(l, c, d) {
var g = c.top + d, u = c.left + d, m = c.right - d, v = c.bottom - d, p = l.top < g ? g : l.top;
p = p + l.height > v ? v - l.height : p;
var C = l.left < u ? u : l.left;
return C = C + l.width > m ? m - l.width : C, (0, r.createRect)(e(e({}, l), { top: p, left: C }));
};
r.getNudgedPopoverRect = a;
}(De)), De;
}
var je = {}, Oe = {}, Pt;
function Br() {
if (Pt) return Oe;
Pt = 1, Object.defineProperty(Oe, "__esModule", { value: !0 }), Oe.useElementRef = void 0;
var r = ve, e = gt(), t = function(n) {
var s = n.containerClassName, o = n.containerStyle, i = (0, r.useRef)(), a = (0, r.useState)(function() {
return (0, e.createContainer)({ containerStyle: o, containerClassName: s });
})[0];
return (0, r.useLayoutEffect)(function() {
a.className = s;
}, [s, a]), (0, r.useLayoutEffect)(function() {
Object.assign(a.style, o);
}, [o, a]), i.current = a, i;
};
return Oe.useElementRef = t, Oe;
}
var Lt;
function Hr() {
if (Lt) return je;
Lt = 1, Object.defineProperty(je, "__esModule", { value: !0 }), je.usePopover = void 0;
var r = ve, e = gt(), t = Br(), n = {
position: "fixed",
overflow: "visible",
top: "0px",
left: "0px"
}, s = {
position: "fixed",
top: "0px",
left: "0px",
width: "0px",
height: "0px",
visibility: "hidden"
}, o = function(i) {
var a = i.isOpen, l = i.childRef, c = i.positions, d = i.containerClassName, g = i.parentElement, u = i.transform, m = i.transformMode, v = i.align, p = i.padding, C = i.reposition, b = i.boundaryInset, R = i.boundaryElement, N = i.onPositionPopover, D = (0, t.useElementRef)({
containerClassName: "react-tiny-popover-scout",
containerStyle: s
}), T = (0, t.useElementRef)({
containerClassName: d != null && d.length > 0 && d !== "react-tiny-popover-container" ? "react-tiny-popover-container ".concat(d) : "react-tiny-popover-container",
containerStyle: n
}), z = (0, r.useCallback)(function(B) {
var I, O, k = B === void 0 ? {} : B, E = k.positionIndex, W = E === void 0 ? 0 : E, q = k.parentRect, S = q === void 0 ? g.getBoundingClientRect() : q, x = k.childRect, w = x === void 0 ? (I = l?.current) === null || I === void 0 ? void 0 : I.getBoundingClientRect() : x, $ = k.scoutRect, _ = $ === void 0 ? (O = D?.current) === null || O === void 0 ? void 0 : O.getBoundingClientRect() : $, P = k.popoverRect, M = P === void 0 ? T.current.getBoundingClientRect() : P, f = k.boundaryRect, y = f === void 0 ? R === g ? S : R.getBoundingClientRect() : f;
if (!(!w || !S || !a)) {
if (u && m === "absolute") {
var L = typeof u == "function" ? u({
childRect: w,
popoverRect: M,
parentRect: S,
boundaryRect: y,
padding: p,
align: v,
nudgedTop: 0,
nudgedLeft: 0,
boundaryInset: b,
violations: e.EMPTY_RECT,
hasViolations: !1
}) : u, j = L.top, Z = L.left, U = Math.round(S.left + Z - _.left), G = Math.round(S.top + j - _.top);
T.current.style.transform = "translate(".concat(U, "px, ").concat(G, "px)"), N({
childRect: w,
popoverRect: (0, e.createRect)({
left: U,
top: G,
width: M.width,
height: M.height
}),
parentRect: S,
boundaryRect: y,
padding: p,
align: v,
transform: { top: j, left: Z },
nudgedTop: 0,
nudgedLeft: 0,
boundaryInset: b,
violations: e.EMPTY_RECT,
hasViolations: !1
});
return;
}
var V = W === c.length, X = V ? c[0] : c[W], A = (0, e.getNewPopoverRect)({
childRect: w,
popoverRect: M,
boundaryRect: y,
position: X,
align: v,
padding: p,
reposition: C
}, b), Q = A.rect, ue = A.boundaryViolation;
if (ue && C && !V) {
z({
positionIndex: W + 1,
childRect: w,
popoverRect: M,
parentRect: S,
boundaryRect: y
});
return;
}
var ce = Q.top, ge = Q.left, se = Q.width, ye = Q.height, _e = C && !V, $e = (0, e.getNudgedPopoverRect)(Q, y, b), Ae = $e.left, Ge = $e.top, me = ce, F = ge;
_e && (me = Ge, F = Ae), me = Math.round(me - _.top), F = Math.round(F - _.left), T.current.style.transform = "translate(".concat(F, "px, ").concat(me, "px)");
var ee = {
top: y.top + b - me,
left: y.left + b - F,
right: F + se - y.right + b,
bottom: me + ye - y.bottom + b
}, ie = {
childRect: w,
popoverRect: (0, e.createRect)({ left: F, top: me, width: se, height: ye }),
parentRect: S,
boundaryRect: y,
position: X,
align: v,
padding: p,
nudgedTop: Ge - ce,
nudgedLeft: Ae - ge,
boundaryInset: b,
violations: {
top: ee.top <= 0 ? 0 : ee.top,
left: ee.left <= 0 ? 0 : ee.left,
right: ee.right <= 0 ? 0 : ee.right,
bottom: ee.bottom <= 0 ? 0 : ee.bottom
},
hasViolations: ee.top > 0 || ee.left > 0 || ee.right > 0 || ee.bottom > 0
};
if (u) {
N(ie);
var Se = typeof u == "function" ? u(ie) : u, fe = Se.top, he = Se.left;
T.current.style.transform = "translate(".concat(Math.round(F + (he ?? 0)), "px, ").concat(Math.round(me + (fe ?? 0)), "px)"), ie.nudgedLeft += he ?? 0, ie.nudgedTop += fe ?? 0, ie.transform = { top: fe, left: he };
}
N(ie);
}
}, [
g,
l,
D,
T,
R,
a,
u,
m,
c,
v,
p,
C,
b,
N
]);
return { positionPopover: z, popoverRef: T, scoutRef: D };
};
return je.usePopover = o, je;
}
var Be = {}, Dt;
function zr() {
if (Dt) return Be;
Dt = 1, Object.defineProperty(Be, "__esModule", { value: !0 }), Be.useMemoizedArray = void 0;
var r = ve, e = function(t) {
var n = (0, r.useRef)(t), s = (0, r.useMemo)(function() {
if (n.current === t)
return n.current;
if (n.current.length !== t.length)
return n.current = t, t;
for (var o = 0; o < t.length; o += 1)
if (t[o] !== n.current[o])
return n.current = t, t;
return n.current;
}, [t]);
return s;
};
return Be.useMemoizedArray = e, Be;
}
var He = {}, jt;
function Vr() {
if (jt) return He;
jt = 1, Object.defineProperty(He, "__esModule", { value: !0 }), He.useHandlePrevValues = void 0;
var r = ve, e = function(t) {
var n = (0, r.useRef)(t.positions), s = (0, r.useRef)(t.reposition), o = (0, r.useRef)(t.transformMode), i = (0, r.useRef)(t.transform), a = (0, r.useRef)(t.boundaryElement), l = (0, r.useRef)(t.boundaryInset), c = (0, r.useCallback)(function() {
n.current = t.positions, s.current = t.reposition, o.current = t.transformMode, i.current = t.transform, a.current = t.boundaryElement, l.current = t.boundaryInset;
}, [
t.boundaryElement,
t.boundaryInset,
t.positions,
t.reposition,
t.transform,
t.transformMode
]);
return {
prev: {
positions: n.current,
reposition: s.current,
transformMode: o.current,
transform: i.current,
boundaryElement: a.current,
boundaryInset: l.current
},
updatePrevValues: c
};
};
return He.useHandlePrevValues = e, He;
}
var be = {}, Ot;
function ir() {
if (Ot) return be;
Ot = 1;
var r = be && be.__assign || function() {
return r = Object.assign || function(n) {
for (var s, o = 1, i = arguments.length; o < i; o++) {
s = arguments[o];
for (var a in s) Object.prototype.hasOwnProperty.call(s, a) && (n[a] = s[a]);
}
return n;
}, r.apply(this, arguments);
};
Object.defineProperty(be, "__esModule", { value: !0 }), be.useArrowContainer = void 0;
var e = ve, t = function(n) {
var s = n.childRect, o = n.popoverRect, i = n.position, a = n.arrowSize, l = n.arrowColor, c = (0, e.useMemo)(function() {
return {
padding: a
};
}, [a]), d = (0, e.useMemo)(function() {
return r({ position: "absolute" }, function() {
var g = a * 2, u = s.top - o.top + s.height / 2 - g / 2, m = s.left - o.left + s.width / 2 - g / 2, v = a, p = o.width - a, C = o.height - a;
switch (m = m < v ? v : m, m = m + g > p ? p - g : m, u = u < v ? v : u, u = u + g > C ? C - g : u, u = Number.isNaN(u) ? 0 : u, m = Number.isNaN(m) ? 0 : m, i) {
case "right":
return {
borderTop: "".concat(a, "px solid transparent"),
borderBottom: "".concat(a, "px solid transparent"),
borderRight: "".concat(a, "px solid ").concat(l),
left: 0,
top: u
};
case "left":
return {
borderTop: "".concat(a, "px solid transparent"),
borderBottom: "".concat(a, "px solid transparent"),
borderLeft: "".concat(a, "px solid ").concat(l),
right: 0,
top: u
};
case "bottom":
return {
borderLeft: "".concat(a, "px solid transparent"),
borderRight: "".concat(a, "px solid transparent"),
borderBottom: "".concat(a, "px solid ").concat(l),
top: 0,
left: m
};
case "top":
return {
borderLeft: "".concat(a, "px solid transparent"),
borderRight: "".concat(a, "px solid transparent"),
borderTop: "".concat(a, "px solid ").concat(l),
bottom: 0,
left: m
};
default:
return {
display: "hidden"
};
}
}());
}, [
l,
a,
s.height,
s.left,
s.top,
s.width,
o.height,
o.left,
o.top,
o.width,
i
]);
return {
arrowContainerStyle: c,
arrowStyle: d
};
};
return be.useArrowContainer = t, be;
}
var xe = {}, Bt;
function Ir() {
if (Bt) return xe;
Bt = 1;
var r = xe && xe.__assign || function() {
return r = Object.assign || function(o) {
for (var i, a = 1, l = arguments.length; a < l; a++) {
i = arguments[a];
for (var c in i) Object.prototype.hasOwnProperty.call(i, c) && (o[c] = i[c]);
}
return o;
}, r.apply(this, arguments);
};
Object.defineProperty(xe, "__esModule", { value: !0 }), xe.ArrowContainer = void 0;
var e = mt(), t = ve, n = ir(), s = function(o) {
var i = o.childRect, a = o.popoverRect, l = o.position, c = o.arrowColor, d = o.arrowSize, g = o.arrowClassName, u = o.arrowStyle, m = o.className, v = o.children, p = o.style, C = (0, n.useArrowContainer)({
childRect: i,
popoverRect: a,
position: l,
arrowColor: c,
arrowSize: d
}), b = C.arrowContainerStyle, R = C.arrowStyle, N = (0, t.useMemo)(function() {
return r(r({}, b), p);
}, [b, p]), D = (0, t.useMemo)(function() {
return r(r({}, R), u);
}, [R, u]);
return (0, e.jsxs)("div", { className: m, style: N, children: [(0, e.jsx)("div", { style: D, className: g }), v] });
};
return xe.ArrowContainer = s, xe;
}
var Ht;
function Ar() {
return Ht || (Ht = 1, function(r) {
var e = Pe && Pe.__assign || function() {
return e = Object.assign || function(m) {
for (var v, p = 1, C = arguments.length; p < C; p++) {
v = arguments[p];
for (var b in v) Object.prototype.hasOwnProperty.call(v, b) && (m[b] = v[b]);
}
return m;
}, e.apply(this, arguments);
};
Object.defineProperty(r, "__esModule", { value: !0 }), r.Popover = r.usePopover = r.ArrowContainer = r.useArrowContainer = void 0;
var t = mt(), n = ve, s = Or(), o = gt(), i = Hr();
Object.defineProperty(r, "usePopover", { enumerable: !0, get: function() {
return i.usePopover;
} });
var a = zr(), l = Vr(), c = ir();
Object.defineProperty(r, "useArrowContainer", { enumerable: !0, get: function() {
return c.useArrowContainer;
} });
var d = Ir();
Object.defineProperty(r, "ArrowContainer", { enumerable: !0, get: function() {
return d.ArrowContainer;
} });
var g = ["top", "left", "right", "bottom"], u = (0, n.forwardRef)(function(m, v) {
var p = m.isOpen, C = m.children, b = m.content, R = m.positions, N = R === void 0 ? g : R, D = m.align, T = D === void 0 ? "center" : D, z = m.padding, B = z === void 0 ? 0 : z, I = m.reposition, O = I === void 0 ? !0 : I, k = m.parentElement, E = k === void 0 ? window.document.body : k, W = m.boundaryElement, q = W === void 0 ? E : W, S = m.containerClassName, x = m.containerStyle, w = m.transform, $ = m.transformMode, _ = $ === void 0 ? "absolute" : $, P = m.boundaryInset, M = P === void 0 ? 0 : P, f = m.onClickOutside, y = m.clickOutsideCapture, L = y === void 0 ? !1 : y, j = (0, a.useMemoizedArray)(Array.isArray(N) ? N : [N]), Z = (0, l.useHandlePrevValues)({
positions: j,
reposition: O,
transformMode: _,
transform: w,
boundaryElement: q,
boundaryInset: M
}), U = Z.prev, G = Z.updatePrevValues, V = (0, n.useRef)(), X = (0, n.useState)({
align: T,
nudgedLeft: 0,
nudgedTop: 0,
position: j[0],
padding: B,
childRect: o.EMPTY_RECT,
popoverRect: o.EMPTY_RECT,
parentRect: o.EMPTY_RECT,
boundaryRect: o.EMPTY_RECT,
boundaryInset: M,
violations: o.EMPTY_RECT,
hasViolations: !1
}), A = X[0], Q = X[1], ue = (0, n.useCallback)(function(F) {
return Q(F);
}, []), ce = (0, i.usePopover)({
isOpen: p,
childRef: V,
containerClassName: S,
parentElement: E,
boundaryElement: q,
transform: w,
transformMode: _,
positions: j,
align: T,
padding: B,
boundaryInset: M,
reposition: O,
onPositionPopover: ue
}), ge = ce.positionPopover, se = ce.popoverRef, ye = ce.scoutRef;
(0, n.useLayoutEffect)(function() {
var F = !0, ee = function() {
var ie, Se;
if (p && F) {
var fe = (ie = V?.current) === null || ie === void 0 ? void 0 : ie.getBoundingClientRect(), he = (Se = se?.current) === null || Se === void 0 ? void 0 : Se.getBoundingClientRect();
fe != null && he != null && (!(0, o.rectsAreEqual)(fe, A.childRect) || he.width !== A.popoverRect.width || he.height !== A.popoverRect.height || A.padding !== B || A.align !== T || j !== U.positions || O !== U.reposition || _ !== U.transformMode || w !== U.transform || q !== U.boundaryElement || M !== U.boundaryInset) && ge(), G(), F && window.requestAnimationFrame(ee);
}
};
return ee(), function() {
F = !1;
};
}, [
T,
q,
M,
p,
B,
se,
A.align,
A.childRect,
A.padding,
A.popoverRect.height,
A.popoverRect.width,
ge,
j,
U.boundaryElement,
U.boundaryInset,
U.positions,
U.reposition,
U.transform,
U.transformMode,
O,
w,
_,
G
]), (0, n.useEffect)(function() {
var F = se.current;
return Object.assign(F.style, x), function() {
Object.keys(x ?? {}).forEach(function(ee) {
return delete F.style[ee];
});
};
}, [x, p, se]);
var _e = (0, n.useCallback)(function(F) {
var ee, ie;
p && !(!((ee = se.current) === null || ee === void 0) && ee.contains(F.target)) && !(!((ie = V.current) === null || ie === void 0) && ie.contains(F.target)) && f?.(F);
}, [p, f, se]), $e = (0, n.useCallback)(function() {
V.current && p && window.requestAnimationFrame(function() {
return ge();
});
}, [ge, p]);
(0, n.useEffect)(function() {
var F = E.ownerDocument.body;
return F.addEventListener("click", _e, L), F.addEventListener("contextmenu", _e, L), window.addEventListener("resize", $e), function() {
F.removeEventListener("click", _e, L), F.removeEventListener("contextmenu", _e, L), window.removeEventListener("resize", $e);
};
}, [L, _e, $e, E]);
var Ae = (0, n.useCallback)(function(F) {
V.current = F, v != null && (typeof v == "object" ? v.current = F : typeof v == "function" && v(F));
}, [v]), Ge = function() {
return (0, n.cloneElement)(C, { ref: Ae });
}, me = function() {
return p ? (0, t.jsx)(s.PopoverPortal, { element: se.current, scoutElement: ye.current, container: E, children: typeof b == "function" ? b(A) : b }) : null;
};
return (0, t.jsxs)(t.Fragment, { children: [Ge(), me()] });
});
r.Popover = (0, n.forwardRef)(function(m, v) {
return typeof window > "u" ? m.children : (0, t.jsx)(u, e({}, m, { ref: v }));
});
}(Pe)), Pe;
}
var Qe = Ar();
const Gr = "_branchName_f49hs_1", Fe = {
branchName: Gr
}, ar = (r) => r.replace("refs/heads/", "").replace("refs/remotes/origin/", "").replace("refs/tags/", "");
var ot = { exports: {} };
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
var zt;
function Wr() {
return zt || (zt = 1, function(r) {
(function() {
var e = {}.hasOwnProperty;
function t() {
for (var o = "", i = 0; i < arguments.length; i++) {
var a = arguments[i];
a && (o = s(o, n(a)));
}
return o;
}
function n(o) {
if (typeof o == "string" || typeof o == "number")
return o;
if (typeof o != "object")
return "";
if (Array.isArray(o))
return t.apply(null, o);
if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]"))
return o.toString();
var i = "";
for (var a in o)
e.call(o, a) && o[a] && (i = s(i, a));
return i;
}
function s(o, i) {
return i ? o ? o + " " + i : o + i : o;
}
r.exports ? (t.default = t, r.exports = t) : window.classNames = t;
})();
}(ot)), ot.exports;
}
var Fr = Wr();
const te = /* @__PURE__ */ Ee(Fr), Yr = "_link_12aao_1", Ur = {
link: Yr
}, lr = ({ href: r, text: e, className: t, ...n }) => {
const { textColour: s } = oe();
return /* @__PURE__ */ h.jsx(
"a",
{
href: r,
target: "_blank",
rel: "noopener noreferrer",
style: { color: s },
className: te(Ur.link, t),
...n,
children: e
}
);
}, qr = (r) => /* @__PURE__ */ Y.createElement("svg", { fill: "currentColor", viewBox: "0 0 512 512", xmlns: "http://www.w3.org/2000/svg", ...r }, /* @__PURE__ */ Y.createElement("title", null, "ionicons-v5-d"), /* @__PURE__ */ Y.createElement("path", { d: "M416,160a64,64,0,1,0-96.27,55.24c-2.29,29.08-20.08,37-75,48.42-17.76,3.68-35.93,7.45-52.71,13.93V151.39a64,64,0,1,0-64,0V360.61a64,64,0,1,0,64.42.24c2.39-18,16-24.33,65.26-34.52,27.43-5.67,55.78-11.54,79.78-26.95,29-18.58,44.53-46.78,46.36-83.89A64,64,0,0,0,416,160ZM160,64a32,32,0,1,1-32,32A32,32,0,0,1,160,64Zm0,384a32,32,0,1,1,32-32A32,32,0,0,1,160,448ZM352,192a32,32,0,1,1,32-32A32,32,0,0,1,352,192Z" })), Zr = "_icon_1i1k4_1", Xr = {
icon: Zr
}, Vt = ({ className: r, ...e }) => {
const { textColour: t } = oe();
return /* @__PURE__ */ h.jsx(
qr,
{
...e,
id: "branch-icon",
"data-testid": "branch-icon",
style: { fill: t },
className: te(Xr.icon, r)
}
);
}, Qr = ({ commit: r }) => {
const { remoteProviderUrlBuilder: e } = J(), t = ar(r.branch), n = H(() => {
const s = e?.({ commit: r }).branch;
if (s)
return s;
}, [r, e]);
return n ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
/* @__PURE__ */ h.jsx(
lr,
{
href: n,
text: t,
className: Fe.branchName
}
),
/* @__PURE__ */ h.jsx(
Vt,
{
className: Fe.icon
}
)
] }) : /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
/* @__PURE__ */ h.jsx("span", { className: Fe.branchName, children: t }),
/* @__PURE__ */ h.jsx(
Vt,
{
className: Fe.icon
}
)
] });
}, Jr = "_tagName_hkrka_1", It = {
tagName: Jr
}, Kr = (r) => /* @__PURE__ */ Y.createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", className: "feather feather-tag", ...r }, /* @__PURE__ */ Y.createElement("path", { d: "M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z" }), /* @__PURE__ */ Y.createElement("line", { x1: 7, y1: 7, x2: 7.01, y2: 7 })), en = "_icon_1is4o_1", tn = {
icon: en
}, At = ({ className: r }) => {
const { textColour: e } = oe();
return /* @__PURE__ */ h.jsx(
Kr,
{
id: "tag-icon",
"data-testid": "tag-icon",
style: { stroke: e },
className: te(tn.icon, r)
}
);
}, rn = ({ commit: r }) => {
const { remoteProviderUrlBuilder: e } = J(), t = ar(r.branch), n = H(() => {
if (e)
return e({ commit: r }).branch;
}, [r, e]);
return n ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
/* @__PURE__ */ h.jsx(
lr,
{
href: n,
text: t,
className: It.tagName
}
),
/* @__PURE__ */ h.jsx(At, {})
] }) : /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
/* @__PURE__ */ h.jsx("span", { className: It.tagName, children: t }),
/* @__PURE__ */ h.jsx(At, {})
] });
}, Gt = {}, nn = "_icon_zawmh_1", on = {
icon: nn
}, sn = (r) => /* @__PURE__ */ Y.createElement("svg", { viewBox: "0 0 256 256", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMinYMin meet", ...r }, /* @__PURE__ */ Y.createElement("path", { d: "M251.172 116.594L139.4 4.828c-6.433-6.437-16.873-6.437-23.314 0l-23.21 23.21 29.443 29.443c6.842-2.312 14.688-.761 20.142 4.693 5.48 5.489 7.02 13.402 4.652 20.266l28.375 28.376c6.865-2.365 14.786-.835 20.269 4.657 7.663 7.66 7.663 20.075 0 27.74-7.665 7.666-20.08 7.666-27.749 0-5.764-5.77-7.188-14.235-4.27-21.336l-26.462-26.462-.003 69.637a19.82 19.82 0 0 1 5.188 3.71c7.663 7.66 7.663 20.076 0 27.747-7.665 7.662-20.086 7.662-27.74 0-7.663-7.671-7.663-20.086 0-27.746a19.654 19.654 0 0 1 6.421-4.281V94.196a19.378 19.378 0 0 1-6.421-4.281c-5.806-5.798-7.202-14.317-4.227-21.446L81.47 39.442l-76.64 76.635c-6.44 6.443-6.44 16.884 0 23.322l111.774 111.768c6.435 6.438 16.873 6.438 23.316 0l111.251-111.249c6.438-6.44 6.438-16.887 0-23.324" })), an = ({ className: r }) => {
const { textColour: e, shiftAlphaChannel: t } = oe();
return /* @__PURE__ */ h.jsx(
sn,
{
id: "git-icon",
"data-testid": "git-icon",
style: { fill: t(e, 0.8) },
className: te(on.icon, r)
}
);
}, ln = () => /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
/* @__PURE__ */ h.jsx("span", { className: Gt.indexLabel, children: "index" }),
/* @__PURE__ */ h.jsx(an, { className: Gt.icon })
] }), cn = ({ id: r, commit: e, height: t, lineRight: n, lineWidth: s }) => {
const { textColour: o, shiftAlphaChannel: i, getCommitColour: a } = oe(), { selectedCommit: l, previewedCommit: c, enablePreviewedCommitStyling: d, enableSelectedCommitStyling: g } = J(), u = a(e), [m, v] = Ce(!1), p = K(() => {
v(!0);
}, []), C = K(() => {
v(!1);
}, []), b = H(() => {
const T = e.hash === c?.hash && d;
return {
opacity: e.hash === l?.hash && g ? 1 : T ? 0.8 : 0.4,
right: n,
width: s,
borderTop: `2px dotted ${u}`,
animationDuration: T ? "0s" : "0.3s"
};
}, [u, e.hash, d, g, n, s, c?.hash, l?.hash]), R = H(() => e.hash === "index" ? {
color: o,
border: `2px dashed ${i(u, 0.5)}`,
background: i(u, 0.05)
} : {
color: o,
border: `2px solid ${u}`,
background: i(u, 0.3)
}, [u, e.hash, i, o]), N = H(() => e.hash === "index" ? /* @__PURE__ */ h.jsx(ln, {}) : e.branch.includes("tags/") ? /* @__PURE__ */ h.jsx(rn, { commit: e }) : /* @__PURE__ */ h.jsx(Qr, { commit: e }), [e]), D = K(({ position: T, childRect: z, popoverRect: B }) => /* @__PURE__ */ h.jsx(
Qe.ArrowContainer,
{
arrowSize: 6,
position: T,
childRect: z,
arrowColor: u,
popoverRect: B,
children: /* @__PURE__ */ h.jsx(
Pr,
{
id: r,
commit: e
}
)
}
), [u, e, r]);
return /* @__PURE__ */ h.jsx(
Qe.Popover,
{
positions: "right",
isOpen: m,
content: D,
containerStyle: { zIndex: "20" },
children: /* @__PURE__ */ h.jsxs(
"button",
{
id: `tag-${r}`,
style: { height: t },
"data-testid": `tag-${r}`,
onBlur: C,
onFocus: p,
onMouseOut: C,
onMouseOver: p,
className: nt.tagContainer,
children: [
/* @__PURE__ */ h.jsx(
"span",
{
id: `tag-label-${r}`,
className: nt.tag,
"data-testid": `tag-label-${r}`,
style: R,
children: N
},
`tag-label-${r}`
),
/* @__PURE__ */ h.jsx(
"span",
{
style: b,
id: `tag-line-${r}`,
className: nt.tagLine,
"data-testid": `tag-line-${r}`
},
`tag-line-${e.branch}`
)
]
}
)
}
);
}, un = (r) => {
const e = /* @__PURE__ */ new Map();
return r.map((t) => {
const n = t.branch.includes("tags/"), s = e.has(t.branch), o = n && !s;
return o && e.set(t.branch, !0), {
...t,
isMostRecentTagInstance: o
};
});
}, pt = () => {
const {
previewedCommit: r,
selectedCommit: e,
indexCommit: t,
graphData: n,
paging: s,
graphWidth: o,
rowSpacing: i,
isIndexVisible: a,
graphOrientation: l,
filter: c
} = J(), d = H(() => {
let u = n.commits.slice(s?.startIndex, s?.endIndex);
return c && (u = c(u)), a && t && u.unshift(t), un(u);
}, [n.commits, s?.startIndex, s?.endIndex, c, a, t]), g = K((u) => {
const m = l === "normal", v = n.graphWidth, p = o / v;
if (u.hash === "index")
return m ? p / 2 : (v - 1) * p + p / 2;
const C = n.positions.get(u.hash)[1], b = m ? C : v - 1 - C;
return p * b + p / 2;
}, [o, n.graphWidth, n.positions, l]);
return /* @__PURE__ */ h.jsx("div", { className: Rt.container, children: d.map((u, m) => {
const v = r && u.hash === r.hash, p = e && u.hash === e.hash, C = u.hash === t?.hash;
return u.isBranchTip || v || p || u.isMostRecentTagInstance || C ? /* @__PURE__ */ h.jsx(
cn,
{
commit: u,
id: m.toString(),
height: re + i,
lineWidth: g(u),
lineRight: -g(u)
},
`tag-${u.hash}`
) : /* @__PURE__ */ h.jsx(
"div",
{
className: Rt.tag,
"data-testid": `empty-tag-${m}`,
id: `empty-tag-${u.hash}`,
style: { height: re + i }
},
`empty-tag-${u.hash}`
);
}) });
}, hn = "_container_1jflq_1", dn = "_graph_1jflq_5", mn = "_dragHandle_1jflq_11", ht = {
container: hn,
graph: dn,
dragHandle: mn
};
class fn {
_columns;
_sourceColumn;
_targetColumn;
_currentRow;
_targetRow;
_rerouted;
constructor(e) {
this._columns = e.columns, this._sourceColumn = e.sourceColumn, this._targetColumn = e.targetColumn, this._rerouted = e.rerouted, this._currentRow = e.currentRow, this._targetRow = e.targetRow;
}
drawLeftHorizontalLineAndCurve() {
const e = [];
this._columns.update(this._sourceColumn, {
isLeftUpCurve: !0
}), this._rerouted && e.push({
location: [this._currentRow, this._sourceColumn],
position: "top",
check: (t) => !t.hasCommitNodeAt(
this._currentRow - 1,
this._sourceColumn
)
});
for (let t = this._sourceColumn - 1; t >= this._targetColumn; t--)
this._columns.update(t, {
isHorizontalLine: !0,
mergeSourceColumns: [
...this._columns.columns[t]?.mergeSourceColumns ?? [],
this._sourceColumn
]
});
return {
breakPointChecks: e
};
}
drawRightHorizontalLineAndCurve() {
for (let n = this._sourceColumn; n < this._targetColumn; n++)
this._columns.update(n, {
isHorizontalLine: !0,
mergeSourceColumns: [
...this._columns.columns[n]?.mergeSourceColumns ?? [],
this._targetColumn
]
});
const e = this._currentRow === this._targetRow, t = this._rerouted && e && this._columns.hasCommitNode(this._sourceColumn);
this._columns.update(this._targetColumn, {
isLeftDownCurve: !0,
isBottomBreakPoint: t
});
}
}
class gn {
_matrix;
_columnBreakPointChecks = [];
constructor(e) {
this._matrix = e;
}
drawEdge(e, t, n) {
const [s, o] = e, [i, a] = t;
o === a ? this.drawCommitEdges(s, i, o, n) : this.drawBranchingAndMergingEdges(e, t, n);
}
drawCommitEdges(e, t, n, s) {
for (let o = e; o <= t; o++) {
const i = this._matrix.getColumns(o), a = o === t - 1 && s;
i.update(n, {
isVerticalLine: !0,
isBottomBreakPoint: a
}), this._matrix.setColumns(o, i);
}
}
drawBranchingAndMergingEdges(e, t, n) {
const [s, o] = e, [i, a] = t;
for (let l = s; l <= i; l++) {
const c = this._matrix.getColumns(l), d = new fn({
columns: c,
rerouted: n,
currentRow: l,
targetRow: i,
targetColumn: a,
sourceColumn: o
}), g = i > s, u = a < o;
if (g && u)
if (l === s)
c.update(o, {
isVerticalLine: !0
});
else if (l === i) {
const { breakPointChecks: v } = d.drawLeftHorizontalLineAndCurve();
this._columnBreakPointChecks.push(...v);
} else
c.update(o, {
isVerticalLine: !0,
isBottomBreakPoint: n && l === i - 1
});
else l === s ? d.drawRightHorizontalLineAndCurve() : c.update(a, {
isVerticalLine: !0,
isBottomBreakPoint: n && l === i - 1
});
this._matrix.setColumns(l, c);
}
}
get columnBreakPointChecks() {
return this._columnBreakPointChecks;
}
}
const pn = [
"isFirstRow",
"isLastRow"
], dt = (r) => r ? Object.entries(r).filter(([e]) => !pn.includes(e)).every(([, e]) => !e) : !0, vt = ({ columns: r }) => new Array(r).fill({});
class Ct {
_columns;
constructor(e) {
this._columns = e;
}
static empty(e) {
return new Ct(vt({
columns: e
}));
}
update(e, t) {
this._columns[e] = {
...this._columns[e],
...t
};
}
hasCommitNode(e) {