export const ENGINE_COUNTER_KEYS = [
    'cellsRemapped',
    'rangesMaterialized',
    'rangeMembersExpanded',
    'formulasParsed',
    'formulasBound',
    'columnSliceBuilds',
    'exactIndexBuilds',
    'approxIndexBuilds',
    'topoRebuilds',
    'changedCellPayloadsBuilt',
    'snapshotOpsReplayed',
    'wasmFullUploads',
    'directAggregateScanEvaluations',
    'directAggregateScanCells',
    'directAggregatePageEvaluations',
    'directAggregatePageFullHits',
    'directAggregatePageEdgeCells',
    'directAggregatePrefixEvaluations',
    'nativeDirectAggregatePrefixEvaluations',
    'directAggregateDeltaApplications',
    'directAggregateDeltaOnlyRecalcSkips',
    'directScalarDeltaApplications',
    'directScalarDeltaOnlyRecalcSkips',
    'kernelSyncOnlyRecalcSkips',
    'directFormulaKernelSyncOnlyRecalcSkips',
    'directFormulaInitialEvaluations',
    'nativeDirectScalarInitialEvaluations',
    'nativeDirectScalarRecalcEvaluations',
    'nativeDirectLookupInitialEvaluations',
    'nativeDirectLookupRecalcEvaluations',
    'nativeDirectCriteriaAggregateEvaluations',
    'nativeDirectCriteriaPredicateAggregateEvaluations',
    'directCriteriaMatchCacheHits',
    'directCriteriaAggregateCacheHits',
    'formulaFamilyRuntimeRunsRestored',
    'formulaFamilyRuntimeRunMembersRestored',
    'formulaFamilyRuntimeRunFallbacks',
    'freshDirectScalarBulkRunBindings',
    'freshDirectScalarBulkMembers',
    'freshDirectScalarBulkFallbacks',
    'freshDirectScalarBulkReverseEdgeSlices',
    'freshDirectScalarFormulaObjectsMaterialized',
    'initialFreshDirectScalarFastBindings',
    'initialFreshDirectAggregateFastBindings',
    'runtimeHydratedDirectAggregateFastBindings',
    'runtimeHydratedDirectScalarFastBindings',
    'structuralTransactions',
    'structuralPlannedCells',
    'structuralSurvivorCellsRemapped',
    'structuralRemovedCells',
    'structuralUndoCapturedCells',
    'structuralUndoCapturedFormulas',
    'structuralUndoFormulaDependencyScans',
    'structuralFormulaImpactCandidates',
    'structuralFormulaRebindInputs',
    'structuralRangeRetargets',
    'sheetGridBlockScans',
    'axisMapSplices',
    'axisMapMoves',
    'regionQueryIndexBuilds',
    'columnOwnerBuilds',
    'lookupOwnerBuilds',
    'calcChainFullScans',
    'cycleFormulaScans',
    'topoRepairs',
    'topoRepairFailures',
    'topoRepairAffectedFormulas',
];
export function createEngineCounters() {
    return {
        cellsRemapped: 0,
        rangesMaterialized: 0,
        rangeMembersExpanded: 0,
        formulasParsed: 0,
        formulasBound: 0,
        columnSliceBuilds: 0,
        exactIndexBuilds: 0,
        approxIndexBuilds: 0,
        topoRebuilds: 0,
        changedCellPayloadsBuilt: 0,
        snapshotOpsReplayed: 0,
        wasmFullUploads: 0,
        directAggregateScanEvaluations: 0,
        directAggregateScanCells: 0,
        directAggregatePageEvaluations: 0,
        directAggregatePageFullHits: 0,
        directAggregatePageEdgeCells: 0,
        directAggregatePrefixEvaluations: 0,
        nativeDirectAggregatePrefixEvaluations: 0,
        directAggregateDeltaApplications: 0,
        directAggregateDeltaOnlyRecalcSkips: 0,
        directScalarDeltaApplications: 0,
        directScalarDeltaOnlyRecalcSkips: 0,
        kernelSyncOnlyRecalcSkips: 0,
        directFormulaKernelSyncOnlyRecalcSkips: 0,
        directFormulaInitialEvaluations: 0,
        nativeDirectScalarInitialEvaluations: 0,
        nativeDirectScalarRecalcEvaluations: 0,
        nativeDirectLookupInitialEvaluations: 0,
        nativeDirectLookupRecalcEvaluations: 0,
        nativeDirectCriteriaAggregateEvaluations: 0,
        nativeDirectCriteriaPredicateAggregateEvaluations: 0,
        directCriteriaMatchCacheHits: 0,
        directCriteriaAggregateCacheHits: 0,
        formulaFamilyRuntimeRunsRestored: 0,
        formulaFamilyRuntimeRunMembersRestored: 0,
        formulaFamilyRuntimeRunFallbacks: 0,
        freshDirectScalarBulkRunBindings: 0,
        freshDirectScalarBulkMembers: 0,
        freshDirectScalarBulkFallbacks: 0,
        freshDirectScalarBulkReverseEdgeSlices: 0,
        freshDirectScalarFormulaObjectsMaterialized: 0,
        initialFreshDirectScalarFastBindings: 0,
        initialFreshDirectAggregateFastBindings: 0,
        runtimeHydratedDirectAggregateFastBindings: 0,
        runtimeHydratedDirectScalarFastBindings: 0,
        structuralTransactions: 0,
        structuralPlannedCells: 0,
        structuralSurvivorCellsRemapped: 0,
        structuralRemovedCells: 0,
        structuralUndoCapturedCells: 0,
        structuralUndoCapturedFormulas: 0,
        structuralUndoFormulaDependencyScans: 0,
        structuralFormulaImpactCandidates: 0,
        structuralFormulaRebindInputs: 0,
        structuralRangeRetargets: 0,
        sheetGridBlockScans: 0,
        axisMapSplices: 0,
        axisMapMoves: 0,
        regionQueryIndexBuilds: 0,
        columnOwnerBuilds: 0,
        lookupOwnerBuilds: 0,
        calcChainFullScans: 0,
        cycleFormulaScans: 0,
        topoRepairs: 0,
        topoRepairFailures: 0,
        topoRepairAffectedFormulas: 0,
    };
}
const ZERO_ENGINE_COUNTERS = createEngineCounters();
export function createRuntimeEngineCounters() {
    const counters = Object.create(ZERO_ENGINE_COUNTERS);
    return counters;
}
export function cloneEngineCounters(counters) {
    const clone = createRuntimeEngineCounters();
    for (const key of ENGINE_COUNTER_KEYS) {
        clone[key] = counters[key];
    }
    return clone;
}
export function addEngineCounter(counters, key, delta = 1) {
    const nextValue = counters[key] + delta;
    counters[key] = nextValue;
    return nextValue;
}
export function addEngineCounters(target, delta) {
    for (const key of ENGINE_COUNTER_KEYS) {
        const deltaValue = delta[key] ?? 0;
        if (deltaValue !== 0) {
            target[key] += deltaValue;
        }
    }
    return target;
}
export function resetEngineCounters(counters) {
    if (Object.getPrototypeOf(counters) === ZERO_ENGINE_COUNTERS) {
        for (const key of ENGINE_COUNTER_KEYS) {
            delete counters[key];
        }
        return counters;
    }
    for (const key of ENGINE_COUNTER_KEYS) {
        counters[key] = 0;
    }
    return counters;
}
//# sourceMappingURL=engine-counters.js.map