/**
 * Abstract base for per-op-type dispatch strategies.
 *
 * Subclasses override the five methods below. The registry
 * `OP_STRATEGIES` pins one instance per canonical op type.
 */
export default class OpStrategy {
    /** Shared mutate logic for NodePropSet / EdgePropSet / legacy PropSet. */
    static _mutateProp(state, mutation) {
        state.mutatePropLWW(mutation.propKey, mutation.eventId, mutation.value);
    }
    /** Shared pre-op snapshot for property strategies. */
    static _snapshotProp(state, propKey) {
        const reg = state.getEncodedProp(propKey);
        return { prevPropValue: reg !== undefined ? reg.value : undefined, propKey };
    }
    /** Shared diff accumulator for property strategies. */
    static _accumulatePropDiff(diff, state, change) {
        const reg = change.before.propKey !== undefined ? state.getEncodedProp(change.before.propKey) : undefined;
        const newVal = reg !== undefined ? reg.value : undefined;
        if (newVal !== change.before.prevPropValue) {
            diff.propsChanged.push({
                nodeId: change.nodeId,
                key: change.key,
                value: newVal,
                prevValue: change.before.prevPropValue,
            });
        }
    }
}
