export function mutationErrorMessage(message, cause) {
    return cause instanceof Error && cause.message.length > 0 ? cause.message : message;
}
export function canEvaluateInitialDirectRuntimeFormula(formula) {
    return (formula !== undefined &&
        !formula.compiled.volatile &&
        !formula.compiled.producesSpill &&
        (formula.directAggregate !== undefined ||
            formula.directCriteria !== undefined ||
            formula.directLookup !== undefined ||
            formula.directScalar !== undefined ||
            formula.inlineScalarFastPlanKind !== undefined));
}
export function compiledFormulaRequiresWorkbookMetadataBinding(compiled) {
    return compiled.symbolicNames.length > 0 || compiled.symbolicTables.length > 0 || compiled.symbolicSpills.length > 0;
}
export function hasPendingFormulaDependency(formula, pendingFormulaCells, getRangeMembers) {
    const dependencies = formula.dependencyIndices;
    for (let index = 0; index < dependencies.length; index += 1) {
        if (pendingFormulaCells.has(dependencies[index])) {
            return true;
        }
    }
    if (getRangeMembers === undefined) {
        return false;
    }
    const ranges = formula.graphRangeDependencies;
    for (let rangeIndexCursor = 0; rangeIndexCursor < ranges.length; rangeIndexCursor += 1) {
        const members = getRangeMembers(ranges[rangeIndexCursor]);
        for (let memberIndex = 0; memberIndex < members.length; memberIndex += 1) {
            if (pendingFormulaCells.has(members[memberIndex])) {
                return true;
            }
        }
    }
    return false;
}
//# sourceMappingURL=formula-initialization-predicates.js.map