import { FormulaMode } from '@bilig/protocol';
import { hasDirectApproximateLookupCandidate, hasIndexedExactLookupCandidate } from './formula-binding-lookup-candidates.js';
export function normalizeFormulaBindingLookupCompileMode(compiled) {
    if (compiled.mode !== FormulaMode.WasmFastPath) {
        return compiled;
    }
    if (!hasIndexedExactLookupCandidate(compiled.optimizedAst) && !hasDirectApproximateLookupCandidate(compiled.optimizedAst)) {
        return compiled;
    }
    return {
        ...compiled,
        mode: FormulaMode.JsOnly,
    };
}
//# sourceMappingURL=formula-binding-lookup-mode.js.map