import { unreachable } from "../../../shared/src/asserts.js";
import { maybeSplitAndPushEditChange } from "./maybe-split-and-push-edit-change.js";
export function filterPush(change, output, pusher, predicate) {
    if (!predicate) {
        output.push(change, pusher);
        return;
    }
    switch (change.type) {
        case 'add':
        case 'remove':
            if (predicate(change.node.row)) {
                output.push(change, pusher);
            }
            break;
        case 'child':
            if (predicate(change.node.row)) {
                output.push(change, pusher);
            }
            break;
        case 'edit':
            maybeSplitAndPushEditChange(change, predicate, output, pusher);
            break;
        default:
            unreachable(change);
    }
}
//# sourceMappingURL=filter-push.js.map