"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractAddMergeEventData = extractAddMergeEventData;
exports.stringifyAddMergeEventData = stringifyAddMergeEventData;
exports.watchGraphAddMergeEvent = watchGraphAddMergeEvent;
function extractAddMergeEventData(...[mergeId, mergeSpec, merge, path]) {
    return {
        mergeId,
        mergeSpec,
        path,
    };
}
function stringifyAddMergeEventData(data) {
    return data;
}
function watchGraphAddMergeEvent(event, graph, callback) {
    const listener = (...args) => {
        const data = stringifyAddMergeEventData(extractAddMergeEventData(...args));
        callback({
            type: 'graph',
            event,
            data,
        });
    };
    graph.prependListener(event, listener);
    return () => {
        graph.removeListener(event, listener);
    };
}
//# sourceMappingURL=watchGraphAddMergeEvent.js.map