/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { o as objects } from './bundle-DLfw87TV.js';
import { d as defaultEventConfig } from './events-CPk-nchx.js';
import './streamAttributes-B6xi3kRV.js';
import './entities-BAhfr1Nx.js';

const DEFAULT_ANIMATION_DURATION = 500;
const defaultAnimationConfig = {
    durationMs: DEFAULT_ANIMATION_DURATION,
};

const defaultFlags = {
    throttleFrameDelivery: true,
    adaptiveRendering: true,
    logWsMessages: false,
    logFrameRate: false,
    letterboxFrames: false,
    grpcUseStreamingWebSocketTransport: true,
};

const defaultInteractionConfig = {
    finePointerThreshold: 1,
    coarsePointerThreshold: 3,
    interactionDelay: 75,
    useMinimumPerspectiveZoomDistance: true,
    mouseWheelInteractionEndDebounce: 400,
    reverseMouseWheelDirection: false,
};

const config = {
    network: {
        apiHost: 'https://platform.platprod.vertexvis.io',
        renderingHost: 'wss://stream.platprod.vertexvis.io',
        sceneTreeHost: 'https://scene-trees.platprod.vertexvis.io',
        sceneViewHost: 'https://scenes.platprod.vertexvis.io',
    },
    flags: defaultFlags,
    events: defaultEventConfig,
    animation: defaultAnimationConfig,
    interactions: defaultInteractionConfig,
    EXPERIMENTAL_frameDelivery: {},
    EXPERIMENTAL_adaptiveRendering: {},
    EXPERIMENTAL_qualityOfService: {},
    EXPERIMENTAL_annotationPollingIntervalInMs: undefined,
};
const platdevConfig = {
    ...config,
    network: {
        apiHost: 'https://platform.platdev.vertexvis.io',
        renderingHost: 'wss://stream.platdev.vertexvis.io',
        sceneTreeHost: 'https://scene-trees.platdev.vertexvis.io',
        sceneViewHost: 'https://scenes.platdev.vertexvis.io',
    },
};
const platstagingConfig = {
    ...config,
    network: {
        apiHost: 'https://platform.platstaging.vertexvis.io',
        renderingHost: 'wss://stream.platstaging.vertexvis.io',
        sceneTreeHost: 'https://scene-trees.platstaging.vertexvis.io',
        sceneViewHost: 'https://scenes.platstaging.vertexvis.io',
    },
};
function getEnvironmentConfig(environment) {
    switch (environment) {
        case 'platdev':
            return platdevConfig;
        case 'platstaging':
            return platstagingConfig;
        default:
            return config;
    }
}
function parseAndValidateConfig(environment = 'platprod', config) {
    const parsed = parseConfig(environment, config);
    return validateConfig(sanitizeConfig(parsed));
}
function parseConfig(environment = 'platprod', config) {
    if (typeof config === 'string') {
        config = JSON.parse(config);
    }
    const envConfig = getEnvironmentConfig(environment);
    if (config == null) {
        return envConfig;
    }
    else {
        return objects.defaults({ ...config }, envConfig);
    }
}
function sanitizeConfig(config) {
    const sanitizedApiHost = config.network.apiHost.trim();
    const sanitizedRenderingHost = config.network.renderingHost.trim();
    const sanitizedSceneTreeHost = config.network.sceneTreeHost.trim();
    const sanitizedSceneViewHost = config.network.sceneViewHost.trim();
    return {
        ...config,
        network: {
            ...config.network,
            apiHost: sanitizedApiHost,
            renderingHost: sanitizedRenderingHost,
            sceneTreeHost: sanitizedSceneTreeHost,
            sceneViewHost: sanitizedSceneViewHost,
        },
    };
}
function validateConfig(config) {
    validateUrlScheme(config.network, 'apiHost', 'https://');
    validateUrlScheme(config.network, 'renderingHost', 'wss://');
    validateUrlScheme(config.network, 'sceneTreeHost', 'https://');
    validateUrlScheme(config.network, 'sceneViewHost', 'https://');
    return config;
}
function validateUrlScheme(networkConfig, field, expectedScheme) {
    if (!networkConfig[field].startsWith(expectedScheme)) {
        throw new Error(`Invalid ${field} "${networkConfig[field]}" specified. The URL must start with the ${expectedScheme} scheme.`);
    }
}

export { parseAndValidateConfig as p };
//# sourceMappingURL=config-CfTifCEz.js.map

//# sourceMappingURL=config-CfTifCEz.js.map