/** * @license * Copyright (c) 2025 Handsoncode. All rights reserved. */ import { ArraySize } from '../../ArraySize'; import { ProcedureAst } from '../../parser'; import { InterpreterState } from '../InterpreterState'; import { InterpreterValue } from '../InterpreterValue'; import { FunctionPlugin, FunctionPluginTypecheck, ImplementedFunctions } from './FunctionPlugin'; /** * Plugin implementing the SORT spreadsheet function. * * SORT(array, [sort_index], [sort_order], [by_col]) returns the elements of * `array` sorted along one dimension. The returned array has the same shape as * the input. By default it reorders rows using the first column as the key, * ascending. Ordering is delegated to {@link ArithmeticHelper} so that mixed * types, empty cells, and locale collation behave exactly as elsewhere in the * engine. */ export declare class SortPlugin extends FunctionPlugin implements FunctionPluginTypecheck { static implementedFunctions: ImplementedFunctions; /** * Corresponds to SORT(array, [sort_index], [sort_order], [by_col]). * * `sort_order` is validated strictly to {1, -1} (the documented contract); * any other value yields #VALUE!. `sort_index` is a 1-based index into the sort * dimension (columns when sorting rows, rows when `by_col` is TRUE). Errors found * anywhere in the input range are propagated. * * @param {ProcedureAst} ast - the parsed function-call AST node. * @param {InterpreterState} state - current interpreter evaluation state. */ sort(ast: ProcedureAst, state: InterpreterState): InterpreterValue; /** * Predicts the output array size for SORT at parse time. * The result is always the same shape as the input array. * * @param {ProcedureAst} ast - the parsed function-call AST node. * @param {InterpreterState} state - current interpreter evaluation state. */ sortArraySize(ast: ProcedureAst, state: InterpreterState): ArraySize; /** Returns the first {@link CellError} found in a 2-D array, or undefined. */ private static findFirstError; }