import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { s as state, d as defineCustomElement$4 } from './pn-marketweb-siteheader-login-linklist2.js';
import { d as defineCustomElement$5 } from './pn-marketweb-siteheader-login-button2.js';
import { d as defineCustomElement$3 } from './pn-marketweb-siteheader-login-links2.js';
import { d as defineCustomElement$2 } from './pn-marketweb-siteheader-login-profileselection2.js';
import { d as defineCustomElement$1 } from './pn-marketweb-siteheader-unified-login2.js';

const icon = '<svg class="pn-icon-svg" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M7.5 7.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0M12 5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M4.928 20.372a1 1 0 0 1-1.856-.743l.883.353a82 82 0 0 1-.883-.354v-.002l.001-.002.003-.007.008-.018a4 4 0 0 1 .114-.25c.078-.161.193-.383.35-.645.315-.523.8-1.217 1.495-1.911C6.444 15.39 8.688 14 12 14s5.556 1.391 6.957 2.793a10 10 0 0 1 1.494 1.911 8 8 0 0 1 .44.837q.016.036.025.058l.008.018.003.007.001.004-.883.354.883-.353a1 1 0 0 1-1.856.744v.001l.001.001v-.002a2 2 0 0 0-.07-.15 6 6 0 0 0-.267-.49 8 8 0 0 0-1.193-1.526C16.444 17.11 14.688 16 12 16s-4.444 1.109-5.543 2.207a8 8 0 0 0-1.193 1.526 6 6 0 0 0-.336.64m0 0-.001.003zm14.144.001" clip-rule="evenodd"/></svg>';
const user = icon;

class MarketWebLoginManager {
    eventTarget = window ?? document?.body;
    endpoint = '';
    storagePrefix = 'pn-user';
    checkUserLoggedInStateInterval = 0;
    baseUrls = {
        at: 'https://atportal.postnord.com/api/unified-login/backend',
        prod: 'https://portal.postnord.com/api/unified-login/backend',
    };
    events = {
        loginstatechange: 'loginstatechange',
    };
    endpoints = {
        authorizationEndpoint: `/authorization`,
        tokenExchangeEndpoint: `/token`,
        userInfoEndpoint: `/user`,
        logoutEndpoint: `/logout`,
    };
    keys = {
        tokensource: 'tokensource',
        token: 'token',
        accessToken: 'accessToken',
        user: 'user',
        expire: 'expire',
        expireDate: 'expiredate',
    };
    overridetokenValue = 'overridetokenValue';
    siteUrl = window.location.origin;
    abortSignalForLoginCheck = null;
    loginCheckInProgress = false;
    loginCheckTimer = null;
    constructor(options = null) {
        if (!options) {
            return;
        }
        this.eventTarget = options.eventTarget ? options.eventTarget : this.eventTarget;
        this.endpoint = options.endpoint ? options.endpoint : `${window.location.protocol}//${window.location.host}`;
        this.storagePrefix ??= options.storagePrefix;
        this.checkUserLoggedInStateInterval =
            options.checkUserLoggedInStateInterval && options.checkUserLoggedInStateInterval > 0 ? parseInt(options.checkUserLoggedInStateInterval + '', 10) : 0;
        if (options.userInfo) {
            this.store.set(this.keys.user, options.userInfo);
            this.registerToken(this.overridetokenValue, 'override');
        }
    }
    init(checkParameters = true) {
        if (checkParameters) {
            this.checkParameters();
            this.checkPNTopbar();
            this.checkExpireTime();
            if (this.store.get(this.keys.token) && !this.store.get(this.keys.user)) {
                this.fetchUserInfo();
            }
            this.loginStateChange();
            if (this.checkUserLoggedInStateInterval > 0) {
                this.initiateLoggedInCheck();
            }
        }
    }
    setSiteUrl(siteUrl) {
        if (siteUrl) {
            this.siteUrl = siteUrl;
        }
    }
    initiateLoggedInCheck() {
        if (this.isLoggedIn()) {
            if (window && window['AbortController']) {
                this.abortSignalForLoginCheck = new AbortController();
            }
            this.loginCheckTimer = window.setInterval(() => {
                this.doExternalLoggedInCheck()
                    .then(() => { })
                    .catch(() => { });
            }, this.checkUserLoggedInStateInterval);
        }
    }
    async doExternalLoggedInCheck() {
        if (!window.navigator.onLine) {
            // Don't check if the user is not online
            return;
        }
        if (!this.getToken()) {
            window.clearInterval(this.checkUserLoggedInStateInterval);
            return;
        }
        if (this.loginCheckInProgress && this.abortSignalForLoginCheck) {
            this.abortSignalForLoginCheck.abort();
            this.abortSignalForLoginCheck = new AbortController();
        }
        this.loginCheckInProgress = true;
        const reqConfig = {
            method: 'GET',
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'Authorization': this.getToken(),
            },
        };
        if (this.abortSignalForLoginCheck && this.abortSignalForLoginCheck['signal']) {
            reqConfig['signal'] = this.abortSignalForLoginCheck['signal'];
        }
        const response = await fetch(`${this.getBaseUrl()}${this.endpoints.userInfoEndpoint}`, reqConfig);
        if (response.status === 409) {
            // This is a status the API returns if a user has been logged out
            window.clearInterval(this.checkUserLoggedInStateInterval);
            console.log('Cleared out user data due to bad response from authentication endpoint');
            this.LogoutUser();
            return;
        }
        if (!response.ok) {
            // The response was "bad". This could be due to bad connectivity or something else.
            // We'll ignore it so we don't unecessarily log users out or have them loose state if they're switching connection
            return;
        }
        const data = await response.json();
        if (!data || !data['accessToken']) {
            window.clearInterval(this.checkUserLoggedInStateInterval);
            console.log('Cleared out user data due to bad response from authentication endpoint');
            this.LogoutUser();
        }
        this.loginCheckInProgress = false;
    }
    LogoutUser() {
        this.clearUserData();
        // Log out user
        if (this.eventTarget) {
            const logoutLink = this.eventTarget.querySelector('#pn-marketweb-header-logoutlink');
            if (logoutLink) {
                logoutLink.click();
                return;
            }
        }
        this.loginStateChange();
        // If no logout link was found, attempt to change URL to redirect link
        const currentPageHref = window.location.href;
        window.location.href = this.getLogoutUrl(currentPageHref);
    }
    isLoggedIn(override = false) {
        if (override) {
            return override;
        }
        let isLoggedIn = this.store.get(this.keys.token) && this.store.get(this.keys.user) ? true : false;
        if (!isLoggedIn && this.store.get(this.keys.token) === this.overridetokenValue) {
            isLoggedIn = true;
        }
        return isLoggedIn;
    }
    registerToken(token = '', tokenSource = 'frontend') {
        if (!token || token === this.getToken()) {
            return;
        }
        this.clearUserData();
        this.store.set(this.keys.tokensource, tokenSource);
        this.store.set(this.keys.token, token);
        this.fetchUserInfo();
    }
    invalidateTokenOfType(tokenSource = 'frontend') {
        const currentToken = this.store.get(this.keys.token);
        if (!currentToken) {
            return;
        }
        const currentTokenSource = this.store.get(this.keys.tokensource);
        if (currentTokenSource !== tokenSource) {
            return;
        }
        // If we have a token and the source is set then we will invalidate the user data
        this.clearUserData();
    }
    getLoginUrl(redirectPage = '') {
        const currentPage = window.location.href;
        redirectPage = redirectPage ? redirectPage : currentPage;
        return `${this.getBaseUrl()}${this.endpoints.authorizationEndpoint}?redirectionUrl=${redirectPage}`;
    }
    getLogoutUrl(linkHref = '') {
        if (linkHref.indexOf('logout?logoutUrl') !== -1) {
            // Link has already been formatted.
            return linkHref;
        }
        let redirectPage = linkHref
            .replace('logout', '')
            .replace('http://window.location.href/?', window.location.href)
            .replace('https://window.location.href/?', window.location.href);
        let rootUrl = this.siteUrl;
        try {
            const url = new URL(this.siteUrl + '');
            rootUrl = url.origin;
        }
        catch (e) { }
        const addSlash = rootUrl.lastIndexOf('/') !== rootUrl.length - 1;
        const siteUrl = rootUrl + (addSlash ? '/' : '') + 'logout';
        const secondLogoutUrl = `${this.getBaseUrl()}${this.endpoints.logoutEndpoint}?authorization=${this.store.get(this.keys.token)}%26redirectionUrl=${redirectPage}`;
        const logoutUrl = `${siteUrl}?logoutUrl=${secondLogoutUrl}`;
        return logoutUrl;
    }
    getUserInfo() {
        if (this.isLoggedIn()) {
            return this.store.get(this.keys.user);
        }
    }
    getEventTarget() {
        return this.eventTarget;
    }
    checkExpireTime() {
        const expire = this.store.get(this.keys.expire);
        if (!expire) {
            return;
        }
        const now = new Date();
        const expireDate = new Date(Math.floor(parseInt(expire, 10) * 1000));
        if (now > expireDate) {
            console.info('Login time has expired');
            this.clearUserData();
            this.loginStateChange();
        }
    }
    checkPNTopbar() {
        if (this.isLoggedIn() || !window['pnTopbar'] || !window['pnTopbar']['session_id']) {
            return;
        }
        this.store.set(this.keys.token, window['pnTopbar']['session_id']);
        this.fetchUserInfo();
    }
    checkParameters() {
        if (!window?.location) {
            return;
        }
        const params = new URLSearchParams(window.location.search);
        if (params.get('oneTimeCode')) {
            const oneTimeCode = params.get('oneTimeCode');
            this.exchangeToken(oneTimeCode).then(() => {
                const currentHref = window.location.href;
                const paramPrefix = currentHref.indexOf('?oneTimeCode') !== -1 ? '?' : '&';
                const newUrl = currentHref.replace(`${paramPrefix}oneTimeCode=${oneTimeCode}`, '');
                history.replaceState({}, document.querySelector('title').innerText, newUrl);
            });
        }
    }
    async fetchUserInfo() {
        const token = this.store.get(this.keys.token);
        if (this.store.get(this.keys.token) === this.overridetokenValue) {
            console.info('Did not fetch user data since it was set by an override');
            return;
        }
        const reqConfig = {
            method: 'GET',
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'Authorization': token,
            },
        };
        const response = await fetch(`${this.getBaseUrl()}${this.endpoints.userInfoEndpoint}`, reqConfig);
        const data = await response.json();
        if (data && data['idToken']) {
            try {
                const { idToken, expiryTime, accessToken } = data;
                const userInfo = this.parseUserInfo(idToken);
                if (!userInfo) {
                    console.error('Userdata is not valid');
                    this.clearUserData();
                    return;
                }
                this.store.set(this.keys.user, userInfo);
                // 10 Min early expire
                this.store.set(this.keys.accessToken, accessToken);
                this.store.set(this.keys.expire, expiryTime);
                this.store.set(this.keys.expireDate, new Date(Math.floor(parseInt(expiryTime, 10) * 1000)));
                this.loginStateChange();
            }
            catch (e) {
                console.error('Unable to get user information', e);
            }
        }
        else {
            console.error('Unable to get user information. Clearing login state');
            this.clearUserData();
        }
    }
    clearUserData() {
        this.store.remove(this.keys.user);
        this.store.remove(this.keys.tokensource);
        this.store.remove(this.keys.accessToken);
        this.store.remove(this.keys.token);
        this.store.remove(this.keys.expire);
        this.store.remove(this.keys.expireDate);
    }
    getToken() {
        return this.store.get(this.keys.token);
    }
    getAccessToken() {
        return this.store.get(this.keys.accessToken);
    }
    async exchangeToken(oneTimeCode) {
        this.clearUserData();
        const response = await fetch(`${this.getBaseUrl()}${this.endpoints.tokenExchangeEndpoint}?oneTimeCode=${oneTimeCode}`);
        const { token } = await response.json();
        if (typeof token === 'string' && token) {
            this.store.set(this.keys.token, token);
        }
        this.fetchUserInfo();
    }
    loginStateChange() {
        if (!this.eventTarget) {
            return;
        }
        this.eventTarget.dispatchEvent(new CustomEvent(this.events.loginstatechange, {
            detail: this.isLoggedIn(),
        }));
    }
    getBaseUrl() {
        const atEnvironments = ['localhost', 'integration.', 'inte.', 'local.', 'prep.'];
        let useATEnv = atEnvironments.filter(x => this.endpoint.indexOf(x) !== -1).length > 0;
        if (['devportal.postnord.com', 'atportal.postnord.com'].indexOf(window.location.hostname) !== -1) {
            useATEnv = true;
        }
        if (useATEnv) {
            return this.baseUrls.at;
        }
        return this.baseUrls.prod;
    }
    parseUserInfo(idToken) {
        if (!idToken) {
            return null;
        }
        var base64Url = idToken.split('.')[1];
        var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
        var jsonPayload = decodeURIComponent(atob(base64)
            .split('')
            .map(function (c) {
            return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
        })
            .join(''));
        return JSON.parse(jsonPayload);
    }
    store = {
        get: (key) => {
            const value = window.localStorage.getItem(`${this.storagePrefix}-${key}`);
            if (!value) {
                return value;
            }
            if (value.indexOf('{') === 0) {
                try {
                    return JSON.parse(value);
                }
                catch (e) { }
            }
            if (value.indexOf(',') !== -1) {
                return value.split(',');
            }
            return value;
        },
        set: (key, value) => {
            if (typeof value === 'object' && typeof value.length === 'undefined') {
                window.localStorage.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
                return;
            }
            window.localStorage.setItem(`${this.storagePrefix}-${key}`, value);
        },
        remove: (key) => {
            window.localStorage.removeItem(`${this.storagePrefix}-${key}`);
        },
    };
}

const pnMarketwebSiteheaderLoginCss = "pn-button-dropdown .pn-button-dropdown>pn-button>.pn-button{min-height:initial}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}@media screen and (max-width: 767px){.sr-only-mobile{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}}pn-marketweb-siteheader-login{--login-dropdown-divider-background:var(--siteheader-login-dropdown-divider-background,\n    #f9f8f8);--login-dropdown-text-color:var(--siteheader-login-dropdown-text-color,\n    #2d2013);--login-dropdown-link-color:var(--siteheader-login-dropdown-link-color,\n    #005d92);--login-dropdown-link-hover-decoration:var(--siteheader-login-dropdown-link-hover-decoration,\n      underline);--login-dark-icon-hover-fill:var(--siteheader-login-dark-icon-hover-fill,\n    #000000);padding:1rem 0;max-height:5.2rem;position:relative}pn-marketweb-siteheader-login pn-button-dropdown{display:none}pn-marketweb-siteheader-login pn-button-dropdown .pn-button-dropdown-container .pn-button-dropdown-content{max-width:350px;display:flex;flex-direction:column;gap:2.4rem;padding:4rem}pn-marketweb-siteheader-login pn-button-dropdown .pn-button-dropdown-container .pn-button-dropdown-content pn-button{width:100%}pn-marketweb-siteheader-login pn-button-dropdown .pn-button-dropdown-container .pn-button-dropdown-content pn-marketweb-siteheader-unified-login::after{display:block;content:\"\";width:100%;height:2px;margin-top:2.4rem;background:var(--login-dropdown-divider-background)}pn-marketweb-siteheader-login pn-button-dropdown .pn-button-dropdown-container .pn-button-dropdown-content span{font-size:1.4rem;color:var(--login-dropdown-text-color)}pn-marketweb-siteheader-login pn-button-dropdown .pn-button-dropdown-container .pn-button-dropdown-content span::before{display:block;content:\"\";width:100%;height:2px;background:var(--login-dropdown-divider-background)}pn-marketweb-siteheader-login pn-button-dropdown .pn-button-dropdown-container .pn-button-dropdown-content span a{text-decoration:none;color:var(--login-dropdown-link-color)}pn-marketweb-siteheader-login pn-button-dropdown .pn-button-dropdown-container .pn-button-dropdown-content span a:hover{text-decoration:var(--login-dropdown-link-hover-decoration)}pn-marketweb-siteheader-login pn-button-dropdown .pn-button-dropdown-container .pn-button-dropdown-content span *{margin-bottom:0}pn-marketweb-siteheader-login.hydrated pn-button-dropdown{display:block}pn-marketweb-siteheader-login[appearance=dark] button:hover pn-icon svg path{fill:var(--login-dark-icon-hover-fill)}";
const PnMarketwebSiteheaderLoginStyle0 = pnMarketwebSiteheaderLoginCss;

const PnMarketwebSiteheaderLogin = /*@__PURE__*/ proxyCustomElement(class PnMarketwebSiteheaderLogin extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        this.loginStateChange = createEvent(this, "loginStateChange", 7);
        this.endpoint = '';
        this.token = '';
        this.i18n = {
            searchlabel: '',
            searchplaceholder: '',
            searchbuttontext: '',
            menuHomeButton: '',
            menuGoBackButton: '',
            mainMenuButton: '',
            menuStartButton: '',
            profileSelectionFlyoutHeading: '',
            unifiedLoginButton: '',
            unifiedMyPagesButton: '',
        };
        this.siteUrl = '';
        this.emitEvents = true;
        this.loginDialog = null;
        this.fullname = '';
        this.loggedin = false;
        this.showProfileSelection = false;
        this.showUnifiedLogin = false;
        this.checkUserLoggedInStateInterval = 0;
        this.environment = undefined;
        this.appearance = 'light';
        this.loginLinks = undefined;
        this.toggleButtonText = this.loginDialog?.loginMenuLinkText ? this.loginDialog.loginMenuLinkText : '';
        this.username = this.fullname;
        this.useMarketwebLogin = undefined;
    }
    get hostElement() { return this; }
    // Events
    loginStateChange;
    componentWillLoad() {
        const userInfo = this.loggedin && this.fullname ? { given_name: this.fullname } : null;
        state.loginManager = new MarketWebLoginManager({
            endpoint: this.endpoint,
            eventTarget: this.hostElement,
            checkUserLoggedInStateInterval: this.checkUserLoggedInStateInterval,
            userInfo,
        });
        state.loginManager.setSiteUrl(this.siteUrl);
        this.hostElement['loginmanager'] = state.loginManager;
        if (this.token) {
            state.loginManager.registerToken(this.token, 'backend');
        }
        else if (this.emitEvents) {
            // The primary login instance
            state.loginManager.invalidateTokenOfType('backend');
        }
        this.hostElement.addEventListener(state.loginManager.events.loginstatechange, this.onLoginStateChange.bind(this));
        this.init();
        this.setUserName();
        this.setToggleButtonText();
    }
    async init() {
        state.loginManager.init(this.emitEvents);
        this.setToggleButtonText();
        this.adjustLoginLinks();
    }
    adjustLoginLinks() {
        if (!this.loginDialog?.loginMenuLinks) {
            return;
        }
        const adjustLink = (link, i) => {
            if (!link.isLogoutLink) {
                link.isLogoutLink = link.pageLink.indexOf('location.href') !== -1 && link.pageLink.indexOf('logout') !== -1;
            }
            if (link.isLogoutLink) {
                link.href = state.loginManager.getLogoutUrl(link.pageLink);
            }
            if (i === 0 && !link.href) {
                link.href = state.loginManager.getLoginUrl();
                link.linkType = 'primary';
            }
            if (link.primaryLinkApperance && !link.linkType) {
                link.linkType = 'primary';
            }
            return link;
        };
        if (this.loginDialog) {
            this.loginDialog.loginMenuLinks = this.loginDialog.loginMenuLinks.map(adjustLink);
            this.loginDialog.loggedInLinks = this.loginDialog.loggedInLinks.map(adjustLink);
        }
        this.loginDialog.legacyLoginLinks = [
            {
                href: state.loginManager.getLoginUrl(this.loginDialog.loginUrl),
                linkText: this.loginDialog.loginLinkText,
                openInNewWindow: false,
                isLogoutLink: false,
                pageLink: null,
                linkType: 'primary',
                primaryLinkApperance: true,
            },
            {
                href: state.loginManager.getLoginUrl(this.loginDialog.registerUrl),
                linkText: this.loginDialog.createLoginLinkText,
                openInNewWindow: false,
                isLogoutLink: false,
                pageLink: null,
                primaryLinkApperance: false,
            },
        ];
    }
    setUserName() {
        const userInfo = state.loginManager.getUserInfo();
        let name = '';
        if (!this.loggedin || !userInfo) {
            this.username = name;
        }
        if (userInfo && userInfo.given_name) {
            name = userInfo.given_name + (userInfo?.family_name ? ` ${userInfo?.family_name}` : '');
        }
        if (!name && userInfo && userInfo.email) {
            name = userInfo.email;
        }
        if (!name && this.fullname) {
            name = this.fullname;
        }
        this.username = name;
        this.adjustLoginLinks();
    }
    setToggleButtonText() {
        if (this.loggedin) {
            this.toggleButtonText = this.username;
            if (!this.toggleButtonText) {
                this.toggleButtonText = this.loginDialog.loggedInButtonText;
            }
        }
        else {
            this.toggleButtonText = this.loginDialog.loginMenuLinkText;
        }
    }
    onLoginStateChange(e) {
        if (this.loggedin !== e.detail && this.emitEvents) {
            this.loggedin = e.detail;
            this.loginStateChange.emit({ loggedIn: this.loggedin, token: state.loginManager.getToken() });
            this.setUserName();
            this.setToggleButtonText();
        }
    }
    render() {
        if (!this.loginDialog) {
            return;
        }
        let hostElementAttribute = {
            username: null,
            loggedin: 'false',
        };
        if (this.username) {
            hostElementAttribute.username = this.username;
            hostElementAttribute.loggedin = this.loggedin + '';
        }
        return (h(Host, { ...hostElementAttribute }, h("pn-button-dropdown", { label: this.toggleButtonText, icon: user, appearance: this.appearance, variant: "borderless", class: "siteheader-logindialog" }, this.showUnifiedLogin && !this.loggedin && (h("pn-marketweb-siteheader-unified-login", { loggedIn: this.loggedin, logInLabel: this.i18n.unifiedLoginButton, useMarketwebLogin: this.useMarketwebLogin, environment: this.environment })), this.loggedin && this.showProfileSelection ? (h("pn-marketweb-siteheader-login-profileselection", { loginDialog: this.loginDialog, loggedin: this.loggedin, i18n: this.i18n, idNamespace: this.emitEvents ? '1' : '2', endpoint: this.endpoint })) : (h("pn-marketweb-siteheader-login-links", { loginDialog: this.loginDialog, loggedin: this.loggedin, idNamespace: this.emitEvents ? '1' : '2', username: this.username, showUnifiedLogin: this.showUnifiedLogin })), !this.loggedin && this.loginDialog?.loginInfo && (h("span", { innerHTML: `${this.loginDialog.loginInfo}` })))));
    }
    static get watchers() { return {
        "i18n": ["init"],
        "loginDialog": ["init"]
    }; }
    static get style() { return PnMarketwebSiteheaderLoginStyle0; }
}, [0, "pn-marketweb-siteheader-login", {
        "endpoint": [1],
        "token": [1],
        "i18n": [16],
        "siteUrl": [1, "site-url"],
        "emitEvents": [4, "emit-events"],
        "loginDialog": [1040],
        "fullname": [1],
        "loggedin": [4],
        "showProfileSelection": [1028, "show-profile-selection"],
        "showUnifiedLogin": [4, "show-unified-login"],
        "checkUserLoggedInStateInterval": [2, "check-user-logged-in-state-interval"],
        "environment": [1],
        "appearance": [1537],
        "useMarketwebLogin": [4, "use-marketweb-login"],
        "loginLinks": [32],
        "toggleButtonText": [32],
        "username": [32]
    }, undefined, {
        "i18n": ["init"],
        "loginDialog": ["init"]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["pn-marketweb-siteheader-login", "pn-marketweb-siteheader-login-button", "pn-marketweb-siteheader-login-linklist", "pn-marketweb-siteheader-login-links", "pn-marketweb-siteheader-login-profileselection", "pn-marketweb-siteheader-unified-login"];
    components.forEach(tagName => { switch (tagName) {
        case "pn-marketweb-siteheader-login":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, PnMarketwebSiteheaderLogin);
            }
            break;
        case "pn-marketweb-siteheader-login-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$5();
            }
            break;
        case "pn-marketweb-siteheader-login-linklist":
            if (!customElements.get(tagName)) {
                defineCustomElement$4();
            }
            break;
        case "pn-marketweb-siteheader-login-links":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "pn-marketweb-siteheader-login-profileselection":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
        case "pn-marketweb-siteheader-unified-login":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}

export { PnMarketwebSiteheaderLogin as P, defineCustomElement as d };

//# sourceMappingURL=pn-marketweb-siteheader-login2.js.map