import { MAX_COLS } from '@bilig/protocol';
const ENTITY_KIND_MASK = 0xc000_0000 >>> 0;
const CELL_KIND = 0x0000_0000 >>> 0;
const EXACT_LOOKUP_COLUMN_KIND = 0x4000_0000 >>> 0;
const RANGE_KIND = 0x8000_0000 >>> 0;
const SORTED_LOOKUP_COLUMN_KIND = 0xc000_0000 >>> 0;
export function makeCellEntity(cellIndex) {
    return (CELL_KIND | cellIndex) >>> 0;
}
export function makeRangeEntity(rangeIndex) {
    return (RANGE_KIND | rangeIndex) >>> 0;
}
export function makeExactLookupColumnEntity(sheetId, col) {
    return (EXACT_LOOKUP_COLUMN_KIND | encodeLookupColumnPayload(sheetId, col)) >>> 0;
}
export function makeSortedLookupColumnEntity(sheetId, col) {
    return (SORTED_LOOKUP_COLUMN_KIND | encodeLookupColumnPayload(sheetId, col)) >>> 0;
}
export function isRangeEntity(entityId) {
    return (entityId & ENTITY_KIND_MASK) >>> 0 === RANGE_KIND;
}
export function isExactLookupColumnEntity(entityId) {
    return (entityId & ENTITY_KIND_MASK) >>> 0 === EXACT_LOOKUP_COLUMN_KIND;
}
export function isSortedLookupColumnEntity(entityId) {
    return (entityId & ENTITY_KIND_MASK) >>> 0 === SORTED_LOOKUP_COLUMN_KIND;
}
export function isCellEntity(entityId) {
    return (entityId & ENTITY_KIND_MASK) >>> 0 === CELL_KIND;
}
export function entityPayload(entityId) {
    return (entityId & ~ENTITY_KIND_MASK) >>> 0;
}
function encodeLookupColumnPayload(sheetId, col) {
    return sheetId * MAX_COLS + col;
}
//# sourceMappingURL=entity-ids.js.map