/**
 * filter-tree.ts — FilterTree types + helpers + evaluator
 *
 * 抽自 data-table-filter-panel.tsx 為了 file-size budget(panel 拆分)。
 * 純資料結構 + pure functions,無 UI dep。
 *
 * 詳:./filter-operators.spec.md
 */
export type Conjunction = 'and' | 'or';
export interface FilterCondition {
    kind: 'cond';
    /** 唯一 row id(stable across renders) */
    id: string;
    /** 對應 column id;空字串 = 尚未選 field(operator/value picker disabled) */
    field: string;
    /** OperatorSpec.op key — 對齊 OPERATOR_REGISTRY */
    op: string;
    /** 依 ValueShape 解讀的值 */
    value: unknown;
}
export interface FilterGroup {
    kind: 'group';
    id: string;
    /** group 內 children 共用的 join(全 AND 或全 OR;不允許混) */
    conjunction: Conjunction;
    /** ⚠️ 型別鎖死:children 只能 condition,不可再 nested group(1-level cap) */
    children: FilterCondition[];
}
export type FilterTreeFlat = {
    mode: 'flat';
    conjunction: Conjunction;
    children: FilterCondition[];
};
export type FilterTreeNested = {
    mode: 'nested';
    conjunction: Conjunction;
    children: FilterGroup[];
};
export type FilterTree = FilterTreeFlat | FilterTreeNested;
/** Empty FilterTree — consumer 用來 init useState */
export declare function createEmptyFilterTree(mode: 'flat'): FilterTreeFlat;
export declare function createEmptyFilterTree(mode: 'nested'): FilterTreeNested;
/** 是否有任何 active filter — DataTable trigger button checked state 用 */
export declare function isFilterTreeActive(tree: FilterTree): boolean;
/** Compare two FilterTrees structurally — 忽略內部 row id(refresh-detect 不該被內部 id 干擾)*/
export declare function isFilterTreeEqual(a: FilterTree, b: FilterTree): boolean;
/**
 * 整棵 FilterTree 對 row 求 boolean。
 * 配合 useReactTable `globalFilterFn`:
 *
 *   const tree = useState<FilterTree>(createEmptyFilterTree('flat'))
 *   useReactTable({
 *     state: { globalFilter: tree },
 *     onGlobalFilterChange: setTree,
 *     globalFilterFn: (row, _, t: FilterTree) => evaluateTree(t, row.original),
 *     getFilteredRowModel: getFilteredRowModel(),
 *   })
 */
export declare function evaluateTree(tree: FilterTree, row: any): boolean;
/**
 * @deprecated v0.x — old per-column filterFn integration。
 * 新版用 `evaluateTree` 配 TanStack `globalFilter`。
 * 保留為了過渡期 backward-compat,新 consumer 不要用。
 */
export declare function dataTableFilterMatch(cellValue: unknown, filterValue: unknown): boolean;
//# sourceMappingURL=filter-tree.d.ts.map