'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-9a9efa1c.js');
const FetchHelper = require('./FetchHelper-2d4c697c.js');
const MarketWebContextService = require('./MarketWebContextService-0fdc43c8.js');
const pnMarketwebSiteheaderStore = require('./pn-marketweb-siteheader-store-7548aafe.js');
const translations = require('./translations-9510f11c.js');
require('./index-a8de2b09.js');

const pnMarketwebSiteheaderCss = "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}}body[data-siteheader-menuopen=true]{max-height:100vh;overflow:hidden}@media screen and (min-width: 60em){body[data-siteheader-menuopen=true]{max-height:initial;overflow:initial}}pn-marketweb-siteheader{display:block;background:#ffffff}pn-marketweb-siteheader header{position:relative;z-index:1000;display:flex;flex-flow:column;box-shadow:0 0.06rem 0.18rem rgba(0, 0, 0, 0.1), 0 0.32rem 0.72rem rgba(0, 0, 0, 0.13);flex-direction:row;justify-content:space-between}@media screen and (min-width: 48em){pn-marketweb-siteheader header{flex-direction:column;justify-content:initial}}pn-marketweb-siteheader .siteheader-row{display:flex;flex-flow:row;align-items:center;width:100%;padding:0 1.6rem;min-height:2em}pn-marketweb-siteheader .siteheader-row:not(:last-child){border-bottom:0.1rem solid #f3f2f2}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-row{justify-content:space-between;min-height:3.2em}}@media screen and (max-width: 48em){pn-marketweb-siteheader .siteheader-row:last-child{justify-content:flex-end}}pn-marketweb-siteheader .siteheader-topright{display:flex;flex-direction:row}pn-marketweb-siteheader .siteheader-logocontainer{display:flex;align-items:center;position:relative;min-height:3em;background:#ffffff;z-index:1}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-logocontainer{position:absolute;left:50%;transform:translateX(-50%)}}pn-marketweb-siteheader .siteheader-logolink{height:100%;max-height:6.4rem;display:flex;align-items:center}pn-marketweb-siteheader .siteheader-logolink:hover,pn-marketweb-siteheader .siteheader-logolink:focus,pn-marketweb-siteheader .siteheader-logolink:active{box-shadow:none}pn-marketweb-siteheader .siteheader-row>pn-marketweb-siteheader-search{display:none}@media screen and (min-width: 48em){pn-marketweb-siteheader .siteheader-row>pn-marketweb-siteheader-search{display:block;max-width:30rem;min-width:23.3rem;width:100%}}pn-marketweb-siteheader .siteheader-row pn-button button:hover .pn-button-bg,pn-marketweb-siteheader .siteheader-row pn-button button:hover .pn-button-bg::after{background-color:#e0f8ff}pn-marketweb-siteheader pn-spinner{display:none}pn-marketweb-siteheader pn-button-dropdown:not(.hydrated) .pn-button-dropdown-container{display:none}pn-marketweb-siteheader pn-button button{font-weight:400 !important;padding:0.5rem !important}pn-marketweb-siteheader pn-button button .pn-button-bg:after{border-radius:0.8rem !important}.siteheader-topleft pn-site-selector{padding:1rem 0;display:none}@media screen and (min-width: 48em){.siteheader-topleft pn-site-selector{display:block}}@media screen and (min-width: 60em){.siteheader-topleft pn-site-selector{margin-left:1.3rem}}.siteheader-topleft pn-site-selector .pn-button-dropdown-label,.siteheader-topleft pn-site-selector:is(a){font-size:0}.siteheader-topleft pn-site-selector .pn-button-dropdown-label pn-icon,.siteheader-topleft pn-site-selector:is(a) pn-icon{font-size:initial;margin-left:0}@media screen and (min-width: 60em){.siteheader-topleft pn-site-selector .pn-button-dropdown-label,.siteheader-topleft pn-site-selector:is(a){font-size:initial}.siteheader-topleft pn-site-selector .pn-button-dropdown-label pn-icon,.siteheader-topleft pn-site-selector:is(a) pn-icon{margin-left:0.4em}}@media screen and (min-width: 60em){.siteheader-topright{margin-right:1.6rem}}.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{padding:1rem 0;display:none;align-self:center}@media screen and (min-width: 48em){.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{display:block;margin-left:1rem}}@media screen and (min-width: 60em){.siteheader-topright>pn-language-selector,.siteheader-topright>pn-marketweb-siteheader-login,.siteheader-topright>a{margin-left:1.6rem}}.siteheader-topright>pn-language-selector .pn-button-dropdown-label,.siteheader-topright>pn-language-selector:is(a),.siteheader-topright>pn-marketweb-siteheader-login .pn-button-dropdown-label,.siteheader-topright>pn-marketweb-siteheader-login:is(a),.siteheader-topright>a .pn-button-dropdown-label,.siteheader-topright>a:is(a){font-size:0}.siteheader-topright>pn-language-selector .pn-button-dropdown-label pn-icon,.siteheader-topright>pn-language-selector:is(a) pn-icon,.siteheader-topright>pn-marketweb-siteheader-login .pn-button-dropdown-label pn-icon,.siteheader-topright>pn-marketweb-siteheader-login:is(a) pn-icon,.siteheader-topright>a .pn-button-dropdown-label pn-icon,.siteheader-topright>a:is(a) pn-icon{font-size:initial;margin-left:0}@media screen and (min-width: 60em){.siteheader-topright>pn-language-selector .pn-button-dropdown-label,.siteheader-topright>pn-language-selector:is(a),.siteheader-topright>pn-marketweb-siteheader-login .pn-button-dropdown-label,.siteheader-topright>pn-marketweb-siteheader-login:is(a),.siteheader-topright>a .pn-button-dropdown-label,.siteheader-topright>a:is(a){font-size:initial}.siteheader-topright>pn-language-selector .pn-button-dropdown-label pn-icon,.siteheader-topright>pn-language-selector:is(a) pn-icon,.siteheader-topright>pn-marketweb-siteheader-login .pn-button-dropdown-label pn-icon,.siteheader-topright>pn-marketweb-siteheader-login:is(a) pn-icon,.siteheader-topright>a .pn-button-dropdown-label pn-icon,.siteheader-topright>a:is(a) pn-icon{margin-left:0.4em}}.siteheader-menu{max-width:100%;overflow:visible;overflow-x:clip}@media screen and (min-width: 60em){.siteheader-menu{margin-top:auto;overflow:visible}}.siteheader-menu pn-mainnav-link a[target]::after{content:none}.siteheader-menu pn-marketweb-siteheader-search{padding:0.3rem 1.6rem;width:100%}.siteheader-menu [slot=top] pn-search-field{width:100%}.siteheader-menu-footer{display:flex;flex-direction:column;align-items:center}.siteheader-menu-footer>*{margin:1.6rem}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader pn-button a{text-decoration:none}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader pn-button a:hover{text-decoration:none}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header{background-color:#0d234b;box-shadow:none}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-row:not(:last-child){border-bottom:0.1rem solid #0d234b}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-row pn-button button:hover .pn-button-bg,.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-row pn-button button:hover .pn-button-bg::after{background-color:#005d92 !important}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topleft pn-site-selector .pn-button-dropdown-label{color:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topleft pn-site-selector .pn-button-dropdown-label pn-icon svg>path{fill:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topleft button.pn-button-dropdown-label:hover{background-color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topleft button.pn-button-dropdown-label:active{background-color:#00a0d6}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topleft button.pn-button-dropdown-label:focus{background-color:#00a0d6}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-logocontainer{background-color:#0d234b}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-logocontainer svg.siteheader-logo>path{fill:#00a0d6}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topright .siteheader-logindialog svg>path{fill:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topright pn-language-selector pn-icon svg>path{fill:#ffffff !important}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topright button{color:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topright button:hover{background-color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topright button:active{background-color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topright button:focus{background-color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topright [slot=toprightend]{align-self:center;margin-left:1rem}@media screen and (max-width: 48em){.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-topright [slot=toprightend]{display:none}}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-menu .mainnav-toggle button{background-color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-menu .first-level_icon svg>path{fill:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-search form pn-search-field input{background-color:#ffffff;color:#0d234b;border:0.1rem solid #ffffff;padding:0.65rem 1.5rem}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-search form pn-search-field input:hover{border-color:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-search form pn-search-field input::placeholder{color:#0d234b}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav{background-color:#0d234b}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav{top:6.4em}}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level [slot=top].siteheader-menu-top pn-marketweb-siteheader-search{padding-bottom:0.5rem;background-color:#0d234b}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level [slot=top].siteheader-menu-top pn-marketweb-siteheader-search .button-container{border-top:1px solid #ffffff;border-bottom:1px solid #ffffff;border-right:1px solid #ffffff;border-top-right-radius:50%;border-bottom-right-radius:50%}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level [slot=top].siteheader-menu-top pn-marketweb-siteheader-search .button-container button.clear{border:2px solid #ffffff;border-radius:50%;padding:0.5rem}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level .mainnav-level-header .secondlevel-backbtn pn-icon svg>path{fill:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level pn-mainnav-level[data-level=\"2\"] .mainnav-level-header pn-mainnav-link>a:hover{background-color:#00a0d6}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level pn-mainnav-list>pn-mainnav-link button,.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level pn-mainnav-list>pn-mainnav-link a{background-color:#0d234b;border-bottom:0.1rem solid rgba(0, 93, 146, 0.5)}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level pn-mainnav-list>pn-mainnav-link button:hover,.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level pn-mainnav-list>pn-mainnav-link a:hover{text-decoration:none}@media screen and (min-width: 1024px){.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level pn-mainnav-list>pn-mainnav-link button,.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level pn-mainnav-list>pn-mainnav-link a{border-bottom:none}}@media screen and (max-width: 1023px){.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level[data-level=\"1\"] pn-mainnav-list>pn-mainnav-link:first-child{border-top:0.1rem solid rgba(0, 93, 146, 0.5)}}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level[data-level=\"1\"] pn-mainnav-list>pn-mainnav-link a,.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level[data-level=\"1\"] pn-mainnav-list>pn-mainnav-link button{color:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level[data-level=\"1\"] pn-mainnav-list>pn-mainnav-link a:focus,.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level[data-level=\"1\"] pn-mainnav-list>pn-mainnav-link button:focus{outline:none}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level:not([data-level=\"1\"]){background-color:#0d234b}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level:not([data-level=\"1\"]) pn-mainnav-list{color:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-mainnav-level:not([data-level=\"1\"]) pn-mainnav-list pn-mainnav-link>a:hover{background-color:#00a0d6;text-decoration:none}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-marketweb-siteheader-login-linklist ul li a:not(.pn-button){color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header nav.mainnav pn-marketweb-siteheader-login-linklist ul li a:hover{color:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header [data-level=\"1\"] pn-mainnav-link pn-icon.first-level_arrow svg>path{fill:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-menu-footer button{color:#ffffff}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-menu-footer button:hover{background-color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-menu-footer button:active{background-color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-menu-footer button:focus{background-color:#005d92}.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-menu-footer button svg>path{fill:#ffffff}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=dotcom]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta]{display:none}}.siteheader-menu-top-search{display:none}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=tpl] pn-site-selector .pn-button-dropdown-label,.header-wrapper[data-header-theme=dotcom] pn-site-selector .pn-button-dropdown-label{border-radius:48px}}.header-wrapper[data-header-theme=tpl] .siteheader-row pn-button.pn-button-dropdown-label .pn-button[data-variant=borderless][data-appearance=light] .pn-button-bg::after,.header-wrapper[data-header-theme=dotcom] .siteheader-row pn-button.pn-button-dropdown-label .pn-button[data-variant=borderless][data-appearance=light] .pn-button-bg::after{background-color:#005d92 !important}.header-wrapper[data-header-theme=tpl] .siteheader-row pn-button.pn-button-dropdown-label .pn-button[data-appearance=light] pn-icon .pn-icon-svg path,.header-wrapper[data-header-theme=dotcom] .siteheader-row pn-button.pn-button-dropdown-label .pn-button[data-appearance=light] pn-icon .pn-icon-svg path{fill:#ffffff !important}.header-wrapper[data-header-theme=tpl] .siteheader-row pn-button.pn-button-dropdown-label button .pn-button-text,.header-wrapper[data-header-theme=dotcom] .siteheader-row pn-button.pn-button-dropdown-label button .pn-button-text{color:#ffffff !important}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader pn-button a{text-decoration:none}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader pn-button a:hover{text-decoration:none}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button]{display:flex;gap:1rem;align-items:center}@media screen and (max-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button]{display:none}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button] a{color:#0d234b;font-weight:500;font-size:1.6rem;padding:0.8rem 2.4rem}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button] a .pn-button-bg{background-color:#fbc2c1}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button] a .pn-button-content pn-icon svg>path{fill:#0d234b}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button] a .pn-button-content pn-icon svg>path{fill:#ffffff}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button] a:hover{color:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button] a:hover .pn-button-bg{background-color:#0d234b;transition:backgrond-color linear 1s}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader [slot=header-bottom-button] a:hover .pn-button-content pn-icon svg>path{fill:#ffffff}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader .siteheader-row pn-button button:hover .pn-button-bg,.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader .siteheader-row pn-button button:hover .pn-button-bg::after{background-color:#0d234b;transition:initial}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-row:not(:last-child){background-color:#0d234b;border-bottom:0.1rem solid #0d234b}@media screen and (max-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-row:last-child{background-color:#0d234b}}@media screen and (min-width: 60em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [data-level=\"1\"] pn-mainnav-link>button::before,.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [data-level=\"1\"] pn-mainnav-link>a::before{background-color:#fbc2c1}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button]{background:#0d234b;display:flex;align-items:center}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button]{display:none}}@media screen and (max-width: 415px){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button]{display:none}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button] a{color:#0d234b;font-weight:500}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button] a .pn-button-bg{background-color:#fbc2c1}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button] a .pn-button-content pn-icon svg>path{fill:#0d234b}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button] a .pn-button-content pn-icon svg>path{fill:#ffffff}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button] a:hover{color:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button] a:hover .pn-button-bg{background-color:#0d234b;transition:backgrond-color linear 1s}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header [slot=siteheader-menu-top-button] a:hover .pn-button-content pn-icon svg>path{fill:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header a{color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header pn-mainnav-link button{color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header pn-mainnav-link button pn-icon svg path{fill:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topleft pn-site-selector .pn-button-dropdown-label{color:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topleft pn-site-selector .pn-button-dropdown-label pn-icon svg>path{fill:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topleft pn-site-selector .pn-button-dropdown-label:hover{background:#00a0d6}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header button.pn-button-dropdown-label:hover{background-color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header button.pn-button-dropdown-label:active{background-color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header button.pn-button-dropdown-label:focus{background-color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-logocontainer{background-color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-logocontainer svg.siteheader-logo>path{fill:#00a0d6}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topright{margin-right:0;align-self:center;margin-left:1rem}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topright .siteheader-logindialog svg>path{fill:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topright pn-language-selector pn-icon svg>path{fill:#ffffff !important}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topright button{color:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topright button:hover{background-color:#00a0d6}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topright button:active,.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-topright button:focus{background-color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search{display:inline-block;margin-top:auto;margin-bottom:auto;width:fit-content}@media screen and (max-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search{display:none}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search pn-search-field{justify-content:flex-end;min-width:inherit}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search form{margin-right:0}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search form:not(:focus-within) .input-container{position:absolute;width:100%}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search form:not(:focus-within) .input-container input{cursor:pointer;background-color:transparent;color:transparent;border:none;position:relative;z-index:3;border-radius:0}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search form:not(:focus-within) .input-container input::placeholder{color:transparent}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search .input-container:focus-within{margin-left:2rem}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search .input-container:focus-within input{background-color:#ffffff;color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search .siteheader-search pn-button button{width:fit-content;padding:1rem 1.9rem}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header div.siteheader-menu-top-search .siteheader-search pn-button button .pn-button-bg{background:#0d234b}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-row:last-child pn-marketweb-siteheader-search{display:none}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-search form pn-search-field input{background-color:#ffffff;color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-search form pn-search-field input:hover{border-color:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-search form pn-search-field input::placeholder{color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta]{display:none}@media screen and (max-width: 768px){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta]{display:flex;color:#0d234b;flex-direction:column;gap:0.5rem}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta] .pn-button-bg{background-color:#fbc2c1}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta] .pn-button-content{font-weight:500;color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta] .pn-button-content pn-icon svg>path{fill:#0d234b}}@media screen and (max-width: 768px) and (min-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta] .pn-button-content pn-icon svg>path{fill:#ffffff}}@media screen and (max-width: 768px){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta] a:hover{color:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta] a:hover .pn-button-bg{background-color:#0d234b;transition:backgrond-color linear 1s}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta] a:hover .pn-button-content pn-icon svg>path{fill:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta] a:hover .pn-button-text{color:#ffffff}}@media screen and (max-width: 1024px){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer pn-button-dropdown button:focus,.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer pn-button-dropdown button:hover{color:#ffffff;background-color:#00a0d6;box-shadow:0 0 0 0.2rem #ffffff, 0 0 0 0.4rem #00a0d6}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer pn-button-dropdown button:focus svg>path,.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer pn-button-dropdown button:hover svg>path{fill:#ffffff}}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer button{color:#ffffff}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer button:hover{background-color:#005d92}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer button:active{background-color:#00a0d6}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer button:focus{background-color:#00a0d6}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer button svg>path{fill:#ffffff}@media screen and (max-width: 1024px){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer button{color:#0d234b}.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer button pn-icon svg>path{fill:#0d234b}}@media screen and (min-width: 48em){.header-wrapper[data-header-theme=tpl]>pn-marketweb-siteheader>header .siteheader-menu-footer [slot=menu-footer-cta]{display:none}}";
const PnMarketwebSiteheaderStyle0 = pnMarketwebSiteheaderCss;

const PnMarketwebSiteheader = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.changeLanguage = index.createEvent(this, "changeLanguage", 7);
        this.changeMarket = index.createEvent(this, "changeMarket", 7);
        this.market = null;
        this.language = null;
        this.siteid = null;
        this.environment = null;
        this.userToken = '';
        this.userFullname = '';
        this.userLoggedin = false;
        this.endpoint = null;
        this.hideSiteSelector = false;
        this.hideHomeMenuItem = false;
        this.hideLanguageSelector = false;
        this.hideSearch = false;
        this.hideLogin = false;
        this.showProfileSelection = false;
        this.showUnifiedLogin = false;
        this.siteDomainInUrls = false;
        this.AutocompleteEndpoint = '';
        this.sessionForward = false;
        this.cache = false;
        this.searchPlaceholder = '';
        this.spaMode = false;
        this.checkUserLoggedInStateInterval = 0;
        this.useMarketwebLogin = false;
        this.pageId = '';
        this.i18n = {
            searchlabel: '',
            searchplaceholder: '',
            searchbuttontext: '',
            menuHomeButton: '',
            menuGoBackButton: '',
            mainMenuButton: '',
            menuStartButton: '',
            profileSelectionFlyoutHeading: '',
            unifiedLoginButton: '',
            unifiedMyPagesButton: '',
            home: 'Home'
        };
        this.gotData = false;
        this.fetchingData = false;
        this.homePageLink = '/';
        this.menuItems = [];
        this.siteDefinition = undefined;
        this.search = { AutocompleteEndpoint: this.AutocompleteEndpoint };
        this.siteSelector = null;
        this.languageSelector = null;
        this.languageOptions = [];
        this.loginDialog = null;
        this.minimizeSearch = false;
        this.loggedIn = false;
    }
    get hostElement() { return index.getElement(this); }
    endpointPath = '/api/navigation/header';
    // FetchHelper
    fetchHelper = new FetchHelper.FetchHelper('siteheader');
    // // Login manager
    // @State() loginManager: MarketWebLoginManager = null;
    // Events
    changeLanguage;
    // Events
    changeMarket;
    componentWillLoad() {
        this.setInitialValues().then(() => {
            this.init();
        });
    }
    async setInitialValues(href = window.location.href) {
        const marketWebContextService = new MarketWebContextService.MarketWebContextService(href);
        if (!this.market) {
            const resolvedMarket = await marketWebContextService.getMarket();
            this.market = resolvedMarket;
        }
        if (!this.language) {
            const resolvedMarket = await marketWebContextService.getLanguage();
            this.language = resolvedMarket;
        }
        if (!this.environment) {
            this.environment = await marketWebContextService.getEnvironmentName();
        }
        if (!this.endpoint && this.environment?.indexOf('local') === -1) {
            this.endpoint = await marketWebContextService.getEndpoint(this.environment, this.market);
        }
        if (!this.endpoint) {
            this.endpoint = '';
        }
    }
    async init() {
        this.setTranslations();
        await this.fetchData();
        window.setTimeout(() => {
            this.checkMenuOverflow();
        }, 50);
    }
    setTranslations() {
        if (this.language && translations.translations[this.language]) {
            this.i18n = translations.translations[this.language];
        }
        if (this.searchPlaceholder) {
            this.i18n.searchplaceholder = this.searchPlaceholder;
        }
    }
    onLanguageSelectorChange(e) {
        this.language = e.detail;
        window.dispatchEvent(new CustomEvent('marketweb-languagechange', { detail: this.language }));
    }
    onLanguageChange() {
        this.setTranslations();
        this.changeLanguage.emit(this.language);
        this.fetchData();
    }
    onMarketChange() {
        this.changeMarket.emit(this.market);
        this.fetchData();
    }
    async fetchData() {
        if (this.endpoint === null || !this.market || !this.language) {
            // console.warn(`One or more values where not specified.\nEndpoint: ${this.endpoint}\nMarket: ${this.market}\nLanguage: ${this.language}`)
            return;
        }
        this.fetchingData = true;
        const endpointBase = this.endpoint.lastIndexOf('/') === this.endpoint.length - 1 ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
        const fetchUrl = `${endpointBase}${this.endpointPath}?market=${this.market}&language=${this.language}&currentPage=${this.pageId}`;
        const data = (await this.fetchHelper.fetchJson(fetchUrl, {
            mode: 'cors',
        }, this.cache));
        // const data2 = JSON.parse('{"query":{"market":"se","language":"sv","currentPage":""},"sitedefinition":{"name":"Postnord Sweden","url":"https://localhost:51547/"},"search":{"formActionUrl":"https://localhost:51547/sok/","useAutocompleteInHeaderSearch":true,"hideSearchFromHeader":false,"preferredSiteId":"06bb4e57-cf10-4374-9e4d-34ae987eff2e"},"languageSelectorViewModel":{"currentLanguageNativeName ":"Svenska","languages":[{"twoLetterISOLanguageName":"en","nativeName":"English","isCurrent":false},{"twoLetterISOLanguageName":"sv","nativeName":"Svenska","isCurrent":true},{"twoLetterISOLanguageName":"da","nativeName":"Dansk","isCurrent":false},{"twoLetterISOLanguageName":"tr","nativeName":"Türkçe","isCurrent":false}],"hideLanguageSelectorFromHeader":false},"siteSelectorViewModel":{"siteSelectorButtonText":"postnord.se","siteSelectorTitle":"PostNord","currentSiteTitle":"postnord.se","currentSiteDescription":"Tjänster och verktyg för att skicka och ta emot din post","siteSelections":[{"linkText":"Portal","linkDescription":"Hantera dina försändelser","pageLink":"https://portal.postnord.com/","openInNewWindow":false,"href":"https://portal.postnord.com/"},{"linkText":"postnord.com","linkDescription":"Information om PostNord Koncernen","pageLink":"/link/7d10839b295946bbb54bebcb289f3aff.aspx","openInNewWindow":false,"href":"https://com-inte.postnord.com/sv/"}],"hideSiteSelectorFromHeader":false},"loginViewModel":{"loginMenuLinks":[{"linkText":"Handla online","pageLink":"/login?language=sv&returnUrl=https://se-inte.postnord.com/handla-online","openInNewWindow":false,"primaryLinkApperance":false,"linkType":"regularlink","href":"/login?language=sv&returnUrl=https://se-inte.postnord.com/handla-online"},{"linkText":"Business portal","pageLink":"https://atportal.postnord.com/api/unified-login/backend/authorization?redirectionUrl=https://se-inte.postnord.com","openInNewWindow":false,"primaryLinkApperance":false,"linkType":"regularlink","href":"https://atportal.postnord.com/api/unified-login/backend/authorization?redirectionUrl=https://se-inte.postnord.com"},{"linkText":"Ombudsbutiken","pageLink":"https://se-inte.postnord.com/login?returnUrl=https://se-inte.postnord.com/handla-online&type=agent","openInNewWindow":false,"primaryLinkApperance":false,"linkType":"regularlink","href":"https://se-inte.postnord.com/login?returnUrl=https://se-inte.postnord.com/handla-online&type=agent"}],"loggedInLinks":[{"linkText":"Logga ut","pageLink":"http://window.location.href/?logout","openInNewWindow":false,"primaryLinkApperance":false,"linkType":null,"href":"http://window.location.href/?logout"}],"overrideLoginMenu":false,"loginMenuLinkText":"Logga in","countryCode":"SE","locale":"sv","loginUrl":"https://portal.postnord.com/login?language=sv","registerUrl":"https://portal.postnord.com/createaccount?market=SE","loggedInButtonText":"My PostNord","loginTitle":"Logga in direkt på:","loginLinkText":"Logga in","createLoginLinkText":"Skapa nytt konto","hideLoginFromHeader":false,"showProfileSelection":true,"checkUserLoginStateInterval":20000,"showUnifiedLogin":true,"loginInfo":"","eshopStartPageUrl":"/handla-online/"},"mainMenu":{"menuItems":[{"name":"Privat","href":"/privat2/","id":"102118","selected":false,"open":false,"children":[{"name":"Skicka","href":"/privat2/skicka/","id":"102119","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"skicka102119","level":2},{"name":"Ta emot","href":"/privat2/ta-emot/","id":"102135","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"taemot102135","level":2},{"name":"Priser och villkor","href":"/privat2/priser-och-villkor/","id":"102162","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"priserochvillkor102162","level":2},{"name":"Förberedelser","href":"/privat2/forberedelser/","id":"102173","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"frberedelser102173","level":2}],"navigationHeading":"","promotedMenuItemsHeader":"Populärt","promotedMenuItems":[{"linkText":"PostNord App","pageLink":"/link/05dcebb0c20b4b56806f4736d83b773d.aspx","href":"https://localhost:51547/vara-verktyg/postnord-app/","openInNewWindow":false},{"linkText":"Digitalt frimärke","pageLink":"https://portal.postnord.com/skickadirekt/m/?productId=800","href":"https://portal.postnord.com/skickadirekt/m/?productId=800","openInNewWindow":false},{"linkText":"Köp frakt","pageLink":"https://portal.postnord.com/skickadirekt/m/","href":"https://portal.postnord.com/skickadirekt/m/","openInNewWindow":false},{"linkText":"Sök utdelningsdag","pageLink":"/link/701d85d2a8924b7a8da0dd86f049debe.aspx","href":"https://localhost:51547/vara-verktyg/sok-utdelningsdag/","openInNewWindow":false},{"linkText":"Paketbox","pageLink":"/link/aca5b66a6f6c45ae97ecd7d5f176d512.aspx","href":"https://localhost:51547/privat/ta-emot/hamta/hamta-paket-i-paketbox/","openInNewWindow":false},{"linkText":"Skicka brev och paket","pageLink":"/link/8b60c612e9824ccb905fc260c50f69f5.aspx","href":"https://localhost:51547/privat/skicka/brev-och-paket/","openInNewWindow":false}],"hasChildren":true,"linkTarget":"","trackingId":"privat102118","level":1},{"name":"Företag","href":"/foretag2/","id":"102743","selected":false,"open":false,"children":[{"name":"Skicka","href":"/foretag2/skicka/","id":"102744","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"skicka102744","level":2},{"name":"Ta emot","href":"/foretag2/ta-emot/","id":"102826","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"taemot102826","level":2},{"name":"Priser och villkor","href":"/foretag2/priser-och-villkor/","id":"102845","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"priserochvillkor102845","level":2},{"name":"Förberedelser","href":"/foretag2/forberedelser/","id":"102855","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"frberedelser102855","level":2},{"name":"Företagslösningar","href":"/foretag2/foretagslosningar/","id":"102883","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"fretagslsningar102883","level":2}],"navigationHeading":"","promotedMenuItemsHeader":"Populärt","promotedMenuItems":[{"linkText":"Bli avtalskund","pageLink":"/link/1fb879eb737747f2afc442df11ff99b5.aspx","href":"https://localhost:51547/kundservice/bli-avtalskund/","openInNewWindow":false},{"linkText":"PEX Bud","pageLink":"/link/b1209ba46788420a8e9b5c7f06e570ad.aspx?productId=800","href":"https://localhost:51547/foretag/skicka-forsandelser/pex-bud/?productId=800","openInNewWindow":false},{"linkText":"Köp frakt","pageLink":"https://portal.postnord.com/shippingtoolpro","href":"https://portal.postnord.com/shippingtoolpro","openInNewWindow":true},{"linkText":"Portal Business","pageLink":"/link/c97df117dc9c427f90b1e95c1fa8caae.aspx","href":"https://localhost:51547/vara-verktyg/postnord-portal/","openInNewWindow":false},{"linkText":"Skicka brev och paket","pageLink":"/link/a65c6b42681f4230b927f776bfc8662a.aspx","href":"https://localhost:51547/foretag/skicka-forsandelser/brev-och-vykort/","openInNewWindow":false}],"hasChildren":true,"linkTarget":"","trackingId":"fretag102743","level":1},{"name":"Handla online","href":"/handla-online/","id":"57674","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"handlaonline57674","level":1},{"name":"Kundservice","href":"/kundservice-faq/","id":"167","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"kundservice167","level":1},{"name":"Handla online temp redirect","href":"/handla-online-new/","id":"74849","selected":false,"open":false,"children":[],"navigationHeading":"","promotedMenuItemsHeader":"","promotedMenuItems":[],"hasChildren":false,"linkTarget":"","trackingId":"handlaonlinetempredirect74849","level":1}]}}');
        // console.log(data2);
        await this.setStateFromData(data);
    }
    getLanguageVersionUrl(item) {
        if (this.spaMode) {
            return null;
        }
        const alternativeTag = document.querySelector(`link[rel="alternate"][hreflang="${item.twoLetterISOLanguageName}"]`);
        if (alternativeTag) {
            return alternativeTag.getAttribute('href');
        }
        const siteUrl = this.siteDefinition.url;
        // Add trailing slash to domain if it's missing
        return siteUrl + (siteUrl.lastIndexOf('/') !== siteUrl.length - 1 ? '/' : '') + item.twoLetterISOLanguageName;
    }
    async setStateFromData(data) {
        if (typeof data !== 'object') {
            console.warn('Data was not valid', data);
        }
        // Set site definition
        this.siteDefinition = data.sitedefinition;
        if (pnMarketwebSiteheaderStore.state.loginManager) {
            pnMarketwebSiteheaderStore.state.loginManager.setSiteUrl(this.siteDefinition.url);
        }
        let updatedMenuItems = [];
        // Set navigation information
        if (this.siteDomainInUrls) {
            updatedMenuItems = data.mainMenu.menuItems.map(item => {
                return this.adjustMenuItemUrls(item);
            });
        }
        else {
            updatedMenuItems = data.mainMenu.menuItems;
        }
        // Create the "Home" link
        if ((!updatedMenuItems[0] || updatedMenuItems[0]?.name !== this.i18n.menuHomeButton) && !this.hideHomeMenuItem) {
            updatedMenuItems.unshift({
                href: this.siteDefinition.url,
                name: this.i18n.menuHomeButton,
                id: 'homelink',
                open: false,
                selected: false,
                children: [],
            });
        }
        this.menuItems = updatedMenuItems;
        // Set search
        this.search = { ...data.search, ...{ AutocompleteEndpoint: this.AutocompleteEndpoint } };
        // Set site selector
        this.siteSelector = data.siteSelectorViewModel;
        // Set language selector
        this.languageSelector = data.languageSelectorViewModel;
        this.setLanguageOptions();
        let loginDialog = data.loginViewModel;
        if (loginDialog && this.siteDomainInUrls) {
            loginDialog.loggedInLinks = loginDialog.loggedInLinks.map(item => {
                item.href = this.adjustHref(item.href);
                return item;
            });
            loginDialog.loginMenuLinks = loginDialog.loginMenuLinks.map(item => {
                item.href = this.adjustHref(item.href);
                return item;
            });
        }
        this.loginDialog = loginDialog;
        await this.spaModeAdjustments();
        this.gotData = true;
        this.fetchingData = true;
        this.homePageLink = this.siteDefinition?.url ?? document.location.hostname;
        window.setTimeout(() => {
            this.checkMenuOverflow();
        }, 100);
    }
    adjustMenuItemUrls(item) {
        item.href = this.adjustHref(item.href);
        if (item.children && item.children.length > 0) {
            let adjustedItems = item.children.map(item => {
                return this.adjustMenuItemUrls(item);
            });
            item.children = adjustedItems;
        }
        return item;
    }
    adjustHref(href) {
        if (href.indexOf('http') === 0) {
            return href;
        }
        const domainUrl = this.siteDefinition.url.lastIndexOf('/') === this.siteDefinition.url.length - 1
            ? this.siteDefinition.url.substring(0, this.siteDefinition.url.length - 1)
            : this.siteDefinition.url;
        return this.removeDoubleLanguage(domainUrl + href);
    }
    removeDoubleLanguage(url) {
        let languageSegment = this.language.toLocaleLowerCase() + "/";
        let doubleLanguageSegment = "/" + languageSegment + languageSegment;
        if (url.includes(doubleLanguageSegment)) {
            return url.replace(doubleLanguageSegment, "/" + languageSegment);
        }
        return url;
    }
    setLanguageOptions() {
        if (!this.languageSelector || !this.languageSelector.languages) {
            return;
        }
        const hrefLangsTags = Array.prototype.slice.call(document.querySelectorAll('link[rel="alternate"][hreflang]')) ?? [];
        const hrefLangs = hrefLangsTags.map(tag => {
            let hrefLangValue = tag.getAttribute('hreflang');
            if (hrefLangValue.indexOf('en-') !== -1 || hrefLangValue.indexOf('en_') !== -1) {
                hrefLangValue = hrefLangValue.substring(0, 2);
            }
            return hrefLangValue;
        });
        let languageOptions = []; // Reset language options
        this.languageSelector.languages.map((languageOption) => {
            // In case there are language links present on the page we only show languages that have those tags
            if (hrefLangs && hrefLangs.length > 0) {
                if (hrefLangs.includes(languageOption.twoLetterISOLanguageName)) {
                    languageOptions.push(languageOption);
                }
            }
            else {
                languageOptions.push(languageOption);
            }
        });
        this.languageOptions = languageOptions; // Replace existing language options so we don't trigger a event change on every push.
    }
    async spaModeAdjustments() {
        if (!this.spaMode) {
            return;
        }
        return;
    }
    onLoginStateChange(e) {
        if (e.detail?.loggedIn && e.detail?.token) {
            this.loggedIn = e.detail?.loggedIn === true;
        }
    }
    promotedItemId(item) {
        return 'promo-' + item.linkText.replace(/[^A-Za-z0-9.\\\/]/gim, '');
    }
    handleResize() {
        requestAnimationFrame(() => {
            this.checkMenuOverflow();
        });
    }
    checkMenuOverflow() {
        const row = this.hostElement.querySelectorAll('.siteheader-row')[1];
        if (!row) {
            return;
        }
        const firstMenuLevel = row.querySelector('pn-mainnav-level');
        if (!firstMenuLevel) {
            return;
        }
        const parent = firstMenuLevel.parentElement;
        if (parent.tagName.toLocaleLowerCase() !== 'nav') {
            return;
        }
        const parentWidth = parent.scrollWidth;
        const elmWidth = firstMenuLevel.clientWidth;
        const isOverFlowed = parentWidth < elmWidth;
        if (isOverFlowed && this.minimizeSearch === false) {
            this.minimizeSearch = true;
        }
    }
    adjustSiteSelectorUrl(href) {
        if (!this.loggedIn) {
            return href;
        }
        const loginDomains = ['portal.postnord.com'];
        const matchedHref = loginDomains.filter(domain => {
            return href.indexOf(domain) !== -1;
        });
        if (matchedHref.length === 0) {
            return href;
        }
        if (pnMarketwebSiteheaderStore.state.loginManager) {
            return pnMarketwebSiteheaderStore.state.loginManager.getLoginUrl(href);
        }
        return href;
    }
    getFallbackValue(value, fallback) {
        return value && value.trim() !== '' ? value : fallback;
    }
    render() {
        const i18n = {
            ...this.i18n,
            home: this.getFallbackValue(this.i18n.home, 'Home')
        };
        return (index.h(index.Host, { key: '4dbc8b4f6ebc9b88d32a13ea049634102db18aa9', language: this.language, market: this.market, environment: this.environment }, index.h("header", { key: '54ff0d3ec7ba8cf53be40bd618c52f0afbcd14af' }, index.h("div", { key: '6e94c37ea02cd37b6e22aa3aad75f491db15a0b1', class: "siteheader-row" }, index.h("div", { key: '37e15b37ee1ba498ef461dee9a98eb2c1d7083c8', class: "siteheader-topleft" }, index.h("slot", { key: 'a7bff14d795adeda2bffedcbe3079bf829f83636', name: "topleft" }), this.gotData && this.siteSelector && !this.hideSiteSelector && (index.h("pn-site-selector", { key: '1ceb79e1cbd0879d42e62b51a9c4093420428c2e', language: this.language, buttontext: this.siteSelector?.currentSiteTitle ?? 'postnord' }, this.gotData && this.siteSelector?.currentSiteTitle && (index.h("pn-site-selector-item", { key: '029d93ca69e47f30f0925535ae6dd160ac5d1efb', heading: this.siteSelector.currentSiteTitle + ' ', description: this.siteSelector.currentSiteDescription })), this.gotData &&
            this.siteSelector?.siteSelections &&
            this.siteSelector.siteSelections.map(site => (index.h("pn-site-selector-item", { heading: site.linkText + ' ', description: site.linkDescription, url: this.adjustSiteSelectorUrl(site.href), newwindow: site.openInNewWindow })))))), index.h("div", { key: 'af65a947739e929885aa8e4d11ed354fdb8aa686', class: "siteheader-logocontainer" }, index.h("a", { key: '0afed48d2b7a7cb5118576626b56423c6d060b62', href: this.homePageLink, title: i18n.home, "aria-label": i18n.home, class: "siteheader-logolink" }, index.h("slot", { key: 'b74a01e3a624c170b3ebc68e1e3feeede5e8a886', name: "logo" }, index.h("svg", { key: 'dac6467faf89d4d78108d8b04f495219bec3773d', class: "siteheader-logo", xmlns: "http://www.w3.org/2000/svg", width: "12.7rem", height: "2.4rem", viewBox: "0 0 141.73 26.65", role: "img", "aria-label": "PostNord" }, index.h("path", { key: 'eabc5a6f31e85cd5fa112dca7052739af8edd495', d: "M108.84,13.35c0,6.34-5.17,9-10,9S89,19.76,89,13.63c0-6.28,5.08-9,10-9S108.84,7.25,108.84,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.29,3.29,0,0,0,3.42,3.41A3.24,3.24,0,0,0,102.28,13.54Zm-83,0c0,4.83-3.32,8.82-8.49,8.82a6.54,6.54,0,0,1-4.65-1.57v5.86H0V5.16H6.17V6.8a6.43,6.43,0,0,1,5.11-2.18C16.41,4.62,19.31,8.58,19.31,13.54Zm-6.53,0A3.27,3.27,0,0,0,9.4,10,3.28,3.28,0,0,0,6,13.54,3.29,3.29,0,0,0,9.4,16.95,3.24,3.24,0,0,0,12.78,13.54Zm103.69,0.27c0-2.54,1.54-3.32,3.6-3.32a6.56,6.56,0,0,1,2.08.3L122.3,5.1a3.92,3.92,0,0,0-1.45-.18c-3.45,0-4.38,2.18-4.38,2.18V5.16H110.3V21.84h6.17v-8ZM141.73,0V21.84h-6.16V20.21a6.43,6.43,0,0,1-5.11,2.18c-5.14,0-8-4-8-8.91s3.32-8.82,8.49-8.82a6.54,6.54,0,0,1,4.65,1.57v-5Zm-6,13.48a3.28,3.28,0,0,0-3.41-3.41A3.24,3.24,0,0,0,129,13.47,3.4,3.4,0,1,0,135.75,13.47ZM81.35,4.62c-3.6,0-4.9,2.18-4.9,2.18V5.16H70.29V21.84h6.16V13.29c0-2.11.79-3.08,2.69-3.08s2.18,1.57,2.18,3.57v8.07h6.22V11.6C87.55,7,85.34,4.62,81.35,4.62ZM64.07,1.42H57.9V21.84h6.16V10.36H67l2.81-5.2H64.07V1.42ZM50.26,11.21c-2-.3-2.87-0.3-2.87-1.09s0.81-.94,2.42-0.94a16.15,16.15,0,0,1,5.11.91L56,5.41a24.56,24.56,0,0,0-6.13-.75c-5.89,0-9,2.27-9,5.89,0,2.81,1.66,4.47,6.53,5.11,2.06,0.27,2.81.39,2.81,1.15s-0.82,1-2.24,1a16.67,16.67,0,0,1-6-1.3L40.77,21.3a22.14,22.14,0,0,0,6.68,1c6.35,0,9.28-2.24,9.28-5.89C56.72,13.54,55.15,12,50.26,11.21ZM40.19,13.35c0,6.34-5.17,9-10,9s-9.82-2.6-9.82-8.73c0-6.28,5.08-9,10-9S40.19,7.25,40.19,13.35Zm-6.56.18a3.4,3.4,0,1,0-6.8,0,3.28,3.28,0,0,0,3.41,3.41A3.24,3.24,0,0,0,33.63,13.54Z", fill: "#00A0D6", transform: "translate(0 0)" }))))), index.h("div", { key: '5a1797b2d053f57533720a86260bf6753459820a', class: "siteheader-topright" }, index.h("slot", { key: '32c6e37f5f7a053f6006a0d7ee800dd75d56af7e', name: "toprightstart" }), this.gotData && this.loginDialog && !this.hideLogin && (index.h("pn-marketweb-siteheader-login", { key: '2ba7f32275f005e6093e68ce509b46fe626e5270', token: this.userToken, siteUrl: this.siteDefinition.url, fullname: this.userFullname, loggedin: this.userLoggedin, loginDialog: this.loginDialog, endpoint: this.endpoint, i18n: this.i18n, showProfileSelection: this.showProfileSelection, showUnifiedLogin: this.showUnifiedLogin, "check-user-logged-in-state-interval": this.checkUserLoggedInStateInterval, useMarketwebLogin: this.useMarketwebLogin, environment: this.environment })), this.gotData && this.languageOptions && this.languageOptions.length && !this.hideLanguageSelector && (index.h("pn-language-selector", { key: '6b78edccaa3b588f10f34369faffccbe76e6a447', value: this.language }, this.languageOptions.map(language => (index.h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))))), index.h("slot", { key: '6cf88ca335d133dc6b1b1d154af1e21a94f858c6', name: "toprightend" }), index.h("div", { key: '44a1201e8286c5fe9005a12bf1d0ddf5c403853d', class: "siteheader-menu-top-search" }, index.h("pn-marketweb-siteheader-search", { key: '4253cba910de7490b57b2979d52415a62f297046', language: this.language, siteid: this.siteid, search: this.search, "hide-search": this.hideSearch, i18n: this.i18n, icononly: true })))), index.h("slot", { key: 'ed811eff451199a26337d21522c1cc551219ba9f', name: "siteheader-menu-top-button" }), index.h("div", { key: '9bbbfd43251c6a7204ccd7ecc0a964cd1e7e56ee', class: "siteheader-row" }, index.h("div", { key: 'bea362557ce1eba32baeb084dccb803ebde28753', class: "siteheader-menu" }, this.gotData && this.menuItems && (index.h("pn-mainnav", { key: 'ec2cc997ddf61a3e00878788e0e74d9205136e29', market: this.market, language: this.language, onMenuOpenChange: e => {
                document.body.setAttribute('data-siteheader-menuopen', e.detail + '');
            } }, index.h("pn-mainnav-level", { key: '8fe758a817428e24a9d71aae6e461d720e26186f' }, index.h("pn-mainnav-list", { key: '1e9709adbe2a8dfb585516ded4639ed280ccab32' }, this.menuItems.map(item => (index.h("pn-mainnav-link", { name: item.name, href: item.href, itemid: item.id, target: item.linkTarget ?? '_self', linkid: item.trackingId }, ((item.promotedMenuItems && item.promotedMenuItems.length > 0) || (item.children && item.children.length > 0)) && (index.h("pn-mainnav-level", { label: item.name }, item.children.length > 0 && (index.h("pn-mainnav-list", { heading: item.navigationHeading ?? '' }, item.children.map(childitem => (index.h("pn-mainnav-link", { name: childitem.name, href: childitem.href, target: childitem.linkTarget ?? '_self', linkid: childitem.trackingId }))))), item.promotedMenuItems && item.promotedMenuItems.length > 0 && (index.h("pn-mainnav-list", { heading: item.promotedMenuItemsHeader }, item.promotedMenuItems.map(childitem => (index.h("pn-mainnav-link", { href: childitem.href, name: childitem.linkText, target: childitem.openInNewWindow ? '_blank' : '_self', linkid: this.promotedItemId(childitem) + item.id }))))))))))), index.h("div", { key: '11717d2fa356f9592d6d3b71e2bbbc20b6a7d904', slot: "footer", class: "siteheader-menu-footer" }, index.h("slot", { key: '71b2a52803a8e0789e1a3df1bc4fb1ee8eebdf50', name: "menu-footer-cta" }), this.gotData && this.loginDialog && !this.hideLogin && (index.h("pn-marketweb-siteheader-login", { key: '6c7d438166d192447e43c4bd36dfc851115c0a03', token: this.userToken, siteUrl: this.siteDefinition.url, loginDialog: this.loginDialog, endpoint: this.endpoint, fullname: this.userFullname, loggedin: this.userLoggedin, i18n: this.i18n, showProfileSelection: this.showProfileSelection, showUnifiedLogin: this.showUnifiedLogin, environment: this.environment, "check-user-logged-in-state-interval": this.checkUserLoggedInStateInterval, useMarketwebLogin: this.useMarketwebLogin })), this.gotData && this.languageOptions && this.languageOptions.length && !this.hideLanguageSelector && (index.h("pn-language-selector", { key: '11a1a7d881541ecbab6fedbfe1f4ba7fa833538e', value: this.language }, this.languageOptions.map(language => (index.h("pn-language-selector-option", { name: language.nativeName, code: language.twoLetterISOLanguageName, selected: language.isCurrent, url: this.getLanguageVersionUrl(language) }))))), !this.hideSiteSelector && (index.h("pn-site-selector", { key: 'ffc1aafc17a626e459bd5c02b432af60e5d4bde5', language: this.language }, this.gotData && this.siteSelector?.currentSiteTitle && (index.h("pn-site-selector-item", { key: '6bbf6bee34ed07db3e89a6f8f8bb72ef189d3227', heading: this.siteSelector.currentSiteTitle, description: this.siteSelector.currentSiteDescription })), this.gotData &&
            this.siteSelector?.siteSelections &&
            this.siteSelector.siteSelections.map(site => (index.h("pn-site-selector-item", { heading: site.linkText, description: site.linkDescription, url: site.pageLink, newwindow: site.openInNewWindow })))))), index.h("div", { key: '1e4836bdc8ae8ad1e1b5d014ee6ac078ac4b1bdf', slot: "top", class: "siteheader-menu-top" }, index.h("pn-marketweb-siteheader-search", { key: 'a423b1dfe80b2baa2875abd764b2aa3c43866f3c', language: this.language, siteid: this.siteid, search: this.search, "hide-search": this.hideSearch, i18n: this.i18n })))))), index.h("pn-marketweb-siteheader-search", { key: '82e455c1c11b476cad6c13a69bddccc6051be51e', language: this.language, siteid: this.siteid, primary: true, search: this.search, "hide-search": this.hideSearch, "show-only-link": this.minimizeSearch, i18n: this.i18n }), index.h("slot", { key: '06eac1b150538bf75079ed50d7dd0a1aeabe5e88', name: "header-bottom-button" })))));
    }
    static get watchers() { return {
        "language": ["onLanguageChange"],
        "market": ["onMarketChange"]
    }; }
};
PnMarketwebSiteheader.style = PnMarketwebSiteheaderStyle0;

exports.pn_marketweb_siteheader = PnMarketwebSiteheader;

//# sourceMappingURL=pn-marketweb-siteheader.cjs.entry.js.map