import { applyTargetMetadataWithNative, applyTargetToSubjectWithNative, extractTargetModelIdWithNative } from '../../../router/virtual-router/engine-selection/native-hub-pipeline-target-semantics.js';
function replaceRecord(target, source) {
    for (const key of Object.keys(target)) {
        if (!Object.prototype.hasOwnProperty.call(source, key)) {
            delete target[key];
        }
    }
    Object.assign(target, source);
}
export function applyTargetMetadata(metadata, target, routeName, originalModel) {
    if (!metadata || typeof metadata !== 'object') {
        return;
    }
    const updated = applyTargetMetadataWithNative(metadata, target, routeName, originalModel);
    replaceRecord(metadata, updated);
}
export function applyTargetToSubject(subject, target, originalModel) {
    if (!subject || typeof subject !== 'object') {
        return;
    }
    const updated = applyTargetToSubjectWithNative(subject, target, originalModel);
    replaceRecord(subject, updated);
}
export function extractModelFromTarget(target) {
    return extractTargetModelIdWithNative(target);
}
