import init from './custom-element/registry';
const getDevicePixelRatio = () => {
    const isMSMobileDevice = /iemobile/i.test(navigator.userAgent);
    if (isMSMobileDevice) {
        return Math.round(window.screen.availWidth /
            (window.screen.width || window.document.documentElement.clientWidth));
    }
    return window.devicePixelRatio;
};
const getIsImagesLazyLoadingDisabled = () => {
    try {
        return new URL(window.location.href).searchParams.get('disableLazyLoading') === 'true';
    }
    catch {
        return false;
    }
};
const STATIC_MEDIA_URL = 'https://static.wixstatic.com/media';
const MEDIA_ROOT_URL = 'https://static.wixstatic.com';
function initCustomElement(services = {}, contextWindow = null, envConsts = {}) {
    if (typeof window === 'undefined') {
        return;
    }
    const env = {
        staticMediaUrl: STATIC_MEDIA_URL,
        mediaRootUrl: MEDIA_ROOT_URL,
        experiments: {},
        devicePixelRatio: getDevicePixelRatio(),
        disableImagesLazyLoading: getIsImagesLazyLoadingDisabled(),
        ...envConsts,
    };
    const define = init(contextWindow, services);
    if (define) {
        define(env);
    }
}
export { initCustomElement };
//# sourceMappingURL=customElementInit.js.map