import { assert } from "../../../../../shared/src/asserts.js";
import { versionFromLexi, versionToLexi, } from "../../../types/lexi-version.js";
export function toBigInt(lsn) {
    const parts = lsn.split('/');
    assert(parts.length === 2, `Malformed LSN: "${lsn}"`);
    const high = BigInt(`0x${parts[0]}`);
    const low = BigInt(`0x${parts[1]}`);
    const val = (high << 32n) + low;
    return val;
}
export function toLexiVersion(lsn) {
    return versionToLexi(toBigInt(lsn));
}
export function fromLexiVersion(lexi) {
    const val = versionFromLexi(lexi);
    return fromBigInt(val);
}
export function fromBigInt(val) {
    const high = val >> 32n;
    const low = val & 0xffffffffn;
    return `${high.toString(16).toUpperCase()}/${low.toString(16).toUpperCase()}`;
}
//# sourceMappingURL=lsn.js.map