{"version":3,"file":"index.es.min.js","sources":["../../../packages/helpers/src/props.helpers.js","../../../packages/helpers/src/assets/js/eventDispatch.js","../../../packages/components/src/constants.mjs","../../../packages/helpers/src/viewport.helpers.ts","../../../packages/helpers/src/assets/js/scopedKeyboardNav.js","../../../packages/components/src/dropdown/dropdown.js"],"sourcesContent":["const getData = attributes => attributes.find(attribute => attribute.nodeName === 'data')\n\nconst createProps = attributes => {\n    const data = getData([...attributes])\n    const props = [...attributes]\n        .filter(attribute => attribute.nodeName !== 'data')\n        .reduce((all, attr) => {\n            return { ...all, [attr.nodeName]: attr.nodeValue }\n        }, {})\n\n    if (isNil(data)) {\n        return props\n    }\n\n    try {\n        return { ...props, ...JSON.parse(data.nodeValue) }\n    } catch (error) {\n        console.log('ERROR: No data', error, data?.nodeValue)\n    }\n}\n\nconst isNil = obj => obj === undefined || obj === null\n\nexport const parseBool = value => (!value || value === 'false' ? false : true)\n\nexport default createProps\n","export const dispatchEvent = ({ eventName, args, element }) => {\n    // Use the provided element or fallback to window if available\n    if (!element) {\n        if (typeof window !== 'undefined') {\n            element = window\n        } else {\n            throw new Error(\n                '`element` is not provided and `window` is unavailable. Provide a valid element to dispatch the event.'\n            )\n        }\n    }\n\n    let event\n    if (args) {\n        event = new CustomEvent(eventName, { detail: args, bubbles: true })\n    } else {\n        if (typeof Event === 'function') {\n            event = new Event(eventName)\n        } else {\n            event = document.createEvent('Event')\n            event.initEvent(eventName, true, true)\n        }\n    }\n    element.dispatchEvent(event)\n}\n\nexport const readEvent = e => {\n    if (!e.detail) {\n        return\n    }\n    return e.detail\n}\n","export const MAX_WIDTH_CONTAINER = 1160\n\nexport const BREAKPOINT_XL = 1920\nexport const BREAKPOINT_TABLET = 1024\nexport const BREAKPOINT_L = 996\nexport const BREAKPOINT_M = 768\nexport const BREAKPOINT_S = 750\nexport const BREAKPOINT_XS = 375\n\nexport const CTA_PRIMARY = 'primary'\nexport const CTA_PRIMARY_TRANSPARENT = 'primary_transparent'\nexport const CTA_SUBTLE = 'subtle'\nexport const CTA_LINK = 'link'\nexport const CTA_LINK_UNDERLINE = 'link-underline'\nexport const CTA_LINK_GOLD = 'link-gold'\nexport const CTA_LINK_ADD_TO_CART_SMALL = 'AddToCart_small'\nexport const CTA_LINK_ADD_TO_CART_LARGE = 'AddToCart_large'\n\nexport const EVENT_TAB_CHANGE = 'EVENT_TAB_CHANGE'\n\nexport const EVENT_VIDEO = 'WEB_COMPONENT_VIDEO'\nexport const EVENT_POPIN_OPEN = 'WEB_COMPONENT_POPIN_OPEN'\nexport const EVENT_POPIN_OPENED = 'WEB_COMPONENT_POPIN_OPENED'\nexport const EVENT_POPIN_CLOSE = 'WEB_COMPONENT_POPIN_CLOSE'\nexport const EVENT_POPIN_CLOSED = 'WEB_COMPONENT_POPIN_CLOSED'\nexport const EVENT_POPIN_CLOSE_CLICK = 'WEB_COMPONENT_POPIN_CLOSE_CLICK'\nexport const EVENT_POPIN_KEY_DOWN = 'keydown'\nexport const EVENT_POPIN_FORM_TOGGLE_TITLE = 'WEB_COMPONENT_POPIN_FORM_TOGGLE_TITLE'\nexport const EVENT_CTA_CLICK = 'WEB_COMPONENT_CTA_CLICK'\nexport const EVENT_HERO_REORDER_OPEN = 'WEB_COMPONENT_HERO_REORDER_OPEN'\nexport const EVENT_HERO_REORDER_CLOSE = 'WEB_COMPONENT_HERO_REORDER_CLOSE'\nexport const EVENT_QUICKVIEW_OPEN = 'WEB_COMPONENT_QUICKVIEW_OPEN'\nexport const EVENT_QS_OPEN = 'WEB_COMPONENT_QS_OPEN'\nexport const EVENT_QS_OPENED = 'WEB_COMPONENT_QS_OPENED'\nexport const EVENT_QS_CLOSE = 'WEB_COMPONENT_QS_CLOSE'\nexport const EVENT_QS_CLOSED = 'WEB_COMPONENT_QS_CLOSED'\nexport const EVENT_QS_CLOSE_CLICK = 'WEB_COMPONENT_QS_CLOSE_CLICK'\nexport const EVENT_QS_KEY_DOWN = 'keydown'\nexport const EVENT_ADD_TO_CART = 'WEB_COMPONENT_ADD_TO_CART'\nexport const EVENT_CART_UPDATED = 'WEB_COMPONENT_CART_UPDATED'\nexport const EVENT_VIDEO_TOGGLE = 'WEB_COMPONENT_VIDEO_TOGGLE'\nexport const VIDEO_ON_HOVER = 'VIDEO_ON_HOVER'\nexport const VIDEO_ON_OUT = 'VIDEO_ON_OUT'\nexport const EVENT_DETAIL_OPEN = 'WEB_COMPONENT_DETAIL_OPEN'\nexport const EVENT_SLIDER_READY = 'WEB_COMPONENT_SLIDER_READY'\nexport const EVENT_SLIDE_CHANGE = 'WEB_COMPONENT_SLIDE_CHANGE'\nexport const EVENT_OVERLAY_OPEN = 'WEB_COMPONENT_OVERLAY_OPEN'\nexport const EVENT_OVERLAY_CLOSE = 'WEB_COMPONENT_OVERLAY_CLOSE'\nexport const EVENT_OVERLAY_CLICKED = 'WEB_COMPONENT_OVERLAY_CLICKED'\nexport const EVENT_OPEN_PRODUCT_AR_CLICKED = 'OPEN_PRODUCT_AR_CLICKED'\nexport const EVENT_SORT_BY_CHANGE = 'WEB_COMPONENT_SORT_BY_CHANGE'\n\nexport const EVENT_BUBBLE_SELECTED = 'EVENT_BUBBLE_SELECTED'\nexport const EVENT_RECO_TOOL_OPTION_CLICKED = 'EVENT_RECO_TOOL_OPTION_CLICKED'\nexport const WEB_COMPONENT_PROJECTS_LOADED = 'WEB_COMPONENT_PROJECTS_LOADED'\nexport const WEB_COMPONENT_ANCHOR_LOADED = 'WEB_COMPONENT_ANCHOR_LOADED'\n\nexport const EVENT_SWIPED_UP = 'swiped-up'\nexport const EVENT_SWIPED_DOWN = 'swiped-down'\nexport const EVENT_SWIPED_LEFT = 'swiped-left'\nexport const EVENT_SWIPED_RIGHT = 'swiped-right'\n\nexport const EVENT_HEADER_POSITION_CHANGED = 'EVENT_HEADER_POSITION_CHANGED'\n\nexport const keys = { ESC: 'Escape' }\n\nexport const ADD_TO_CART_MODIFIER_MINI = 'mini'\nexport const ADD_TO_CART_MODIFIER_DEFAULT = ADD_TO_CART_MODIFIER_MINI\n\nexport const COFFEE_ORIGINAL = 'original'\nexport const COFFEE_VERTUO = 'vertuo'\nexport const COFFEE_PRO = 'pro'\nexport const COFFEE_OL = 'OL'\nexport const COFFEE_VL = 'VL'\nexport const INTENSITY_MAX_OL = 14\nexport const INTENSITY_MAX_VL = 12\nexport const DEFAULT_BUBBLE_ICON = ''\n\nexport const NUMBER_PRODUCTS_SLIDER = 8\nexport const NUMBER_FEATURES_PDP = 8\n\nexport const ALIGNMENT = ['center', 'left', 'right']\nexport const POSITION = ['top', 'right', 'bottom', 'left']\nexport const TRANSLATION_ADD_TO_CART = 'Add to cart'\nexport const TRANSLATION_UPDATE_BASKET = 'Update basket'\n\nexport const TIME_INSTANT = 1\nexport const TIME_FAST = 300\nexport const TIME_MEDIUM = 600\nexport const TIME_SLOW = 1200\n\nexport const APP_APPLE_LINK = {\n    default: 'https://apps.apple.com/us/app/nespresso/id342879434',\n    us: 'https://apps.apple.com/us/app/nespresso-new/id1609639566',\n    uk: 'https://apps.apple.com/gb/app/nespresso-new/id1609639566',\n    kr: 'https://apps.apple.com/kr/app/%EB%84%A4%EC%8A%A4%ED%94%84%EB%A0%88%EC%86%8C-%EB%B6%80%ED%8B%B0%ED%81%AC/id1609639566'\n}\nexport const APP_ANDROID_LINK =\n    'https://play.google.com/store/apps/details?id=com.nespresso.activities'\nexport const APP_HUAWEI_LINK = 'https://appgallery.huawei.com/app/C102571517'\n\nexport const SRC_PAGE_PLP = 'plp'\nexport const SRC_PAGE_PDP = 'pdp'\n\nexport const PLP_TYPE_COFFEE = 'coffee'\nexport const PLP_TYPE_MACHINE = 'machine'\nexport const PLP_TYPE_ACCESSORY = 'accessory'\nexport const CALLEO_API_DOMAIN = 'https://www.contact.nespresso.com/'\n\n// SCSS RELATED\n// Todo : should be shared by JS and SCSS\nexport const BROWSER_CONTEXT = 16 // 1rem = 16px\nexport const COLOR_WHITE_1000 = '#FFFFFF' // Do not change for #FFF shortcut, it will break slider-natural gradients !\n\nexport const CONTRAST_DARK = 'dark'\nexport const CONTRAST_LIGHT = 'light'\n\nexport const B2B_CONTACT_FORM_POPIN_ID = 'b2b-contact-form-popin-id'\nexport const B2B_CONTACT_FORM_POPIN_SRC_SEARCH = 'coveo-search'\n\nexport const B2B_CONTACT_FORM_POPIN_SRC_SKU_MAIN_INFO = 'sku-main-info'\n\nexport const B2B_CONTACT_FORM_POPIN_SRC_SKU_MAIN_INFO_AUTO = 'sku-main-info-auto'\n\nexport const ASPECT_RATIO_16_9 = '16/9'\nexport const ASPECT_RATIO_1_1 = '1/1'\n\nexport const NESPRESSO_PRODUCTION_DOMAIN = 'https://www.nespresso.com'\nexport const NESPRESSO_ROLLOUT_DOMAIN = 'https://nc2-env-rollout.nespresso.com'\n\nexport const EVENT_QUIZ_ON_GO_BACK = 'WEB_COMPONENT_EVENT_QUIZ_ON_GO_BACK'\nexport const EVENT_QUIZ_SUBMIT = 'WEB_COMPONENT_EVENT_QUIZ_SUBMIT'\n","import { BREAKPOINT_M, BREAKPOINT_TABLET } from '@kissui/components'\n\nconst viewport = () => {\n    const lt = (ref: number) => {\n        return window.innerWidth < ref\n    }\n\n    return {\n        get is() {\n            const { innerWidth: vw, devicePixelRatio } = window\n            return {\n                mobile: vw < BREAKPOINT_M,\n                mobile_tablet: vw < BREAKPOINT_TABLET,\n                tablet: vw >= BREAKPOINT_M && vw < BREAKPOINT_TABLET,\n                desktop: vw >= BREAKPOINT_TABLET && devicePixelRatio <= 1,\n                retina: vw >= BREAKPOINT_TABLET && devicePixelRatio > 1\n            }\n        },\n        lt\n    }\n}\n\nconst helper = viewport()\n\nexport default helper\n","export function recursiveSwitchAriaHidden(elem, componentOpenState) {\n    const parent = elem.parentNode\n    const body = document.getElementsByTagName('body')[0]\n\n    if (parent === body) {\n        return\n    }\n\n    const brothers = parent.children\n    for (const brother of brothers) {\n        if (brother !== elem) {\n            componentOpenState\n                ? brother.setAttribute('aria-hidden', componentOpenState)\n                : brother.removeAttribute('aria-hidden')\n        }\n    }\n    recursiveSwitchAriaHidden(parent, componentOpenState)\n}\n\nexport function focusin(e, el, loop) {\n    if (!el.contains(e.target)) {\n        if (el.lastFocused === el.firstFocusable) {\n            loop ? el.lastFocusable.focus() : el.firstFocusable.focus()\n        } else {\n            loop ? el.firstFocusable.focus() : el.lastFocusable.focus()\n        }\n    } else {\n        el.lastFocused = e.target\n    }\n}\n\nexport function setFirstAndLastFocusable(el) {\n    const focusable = el.querySelectorAll('button, [href], input, select, textarea, [tabindex=\"0\"]')\n    el.firstFocusable = focusable[0]\n    el.lastFocusable = focusable[focusable.length - 1]\n    el.lastFocused = el.firstFocusable\n}\n","import createProps from '@kissui/helpers/src/props.helpers'\nimport { dispatchEvent } from '@kissui/helpers/src/assets/js/eventDispatch'\nimport viewportHelper from '@kissui/helpers/src/viewport.helpers'\nimport {\n    recursiveSwitchAriaHidden,\n    setFirstAndLastFocusable,\n    focusin\n} from '@kissui/helpers/src/assets/js/scopedKeyboardNav'\nimport { EVENT_SORT_BY_CHANGE, EVENT_POPIN_KEY_DOWN } from '@kissui/components'\n\nclass Dropdown extends HTMLElement {\n    constructor() {\n        super()\n        this.isOpen = false\n        this.selected = null\n        this.buttonElement = null\n        this.onClickOutside = this.onClickOutside.bind(this)\n    }\n\n    connectedCallback() {\n        this.props = createProps(this.attributes)\n        this.classList.add('nb-dropdown')\n        this.render()\n    }\n\n    render() {\n        this.buttonElement = null\n        const { label = '', aa_description } = this.props\n        let { options = [], element_id, element_name } = this.props\n\n        // Accept Selected and Checked as option setter\n        options = options.map(option => {\n            const payload = { ...option }\n            payload.checked = payload.checked || payload.selected\n\n            return payload\n        })\n\n        this.unbindEvent()\n\n        this.innerHTML = `\n            <button\n                class='nb-dropdown__button'\n                aria-haspopup=\"listbox\"\n                aria-expanded=\"${this.isOpen}\"\n                aria-label=\"${label} ${options && this.renderSelected()}\"\n                ${aa_description !== '' ? `aria-description=\"${aa_description}\"` : ''}>\n                    <span class=\"nb-dropdown__button__label t-sm-700-sl\">${label}</span>\n                    <span class=\"nb-dropdown__button__value t-xs-500-sl\"\n                    ${element_id ? `name=\"${element_id}\"` : ''}\n                    value=\"${options && this.renderSelected()}\">\n                    </span>\n                </button>\n            <div class=\"nb-dropdown__menu\" ${element_name ? `id=\"${element_name}\"` : ''}>\n                <div role=\"listbox\">\n                    <ul>\n                        ${options && options.length > 0 && this.renderOptions()}\n                    </ul>\n                </div>\n            </div>\n        `\n        this.buttonElement = this.querySelector('.nb-dropdown__button')\n        this.buttonElementValue = this.querySelector('.nb-dropdown__button__value')\n        this.dropdownMenu = this.querySelector('.nb-dropdown__menu > div')\n        this.selectedOption = this.querySelector('button[aria-selected=true]')\n        if (!this.selected) {\n            this.selected = options[0]\n        }\n        setFirstAndLastFocusable(this.dropdownMenu)\n        this.bindEvent()\n    }\n\n    // Render <BUTTON> tags for the custom select, <BUTTON> is better than <RADIOBUTTONS> for keyboard navigation users in this case\n    renderOptions() {\n        const {\n            label,\n            aa_listbox_description,\n            aa_select_description,\n            icon_option,\n            options = []\n        } = this.props\n        return options\n            .map(option => {\n                return `<li>\n                    <button\n                        data-id=\"${option.id}\"\n                        data-selectedlabel=\"${option.label}\"\n                        class=\"${viewportHelper.is.mobile ? 't-sm-400-sl' : 't-xs-500-sl'}\"\n                        role=\"option\"\n                        aria-label='${label + ' ' + option.label}'\n                        value='${option.id ?? option.label}'\n                        aria-selected='${option.checked}'\n                        ${option.link ? `data-link='${option.link}'` : ''}\n                        ${\n                            option.checked\n                                ? aa_listbox_description !== undefined &&\n                                  `aria-description=\"${aa_listbox_description}\"`\n                                : aa_select_description !== undefined &&\n                                  `aria-description=\"${aa_select_description}\"`\n                        }>\n                    ${icon_option && `<nb-icon icon='${icon_option}'></nb-icon>`} ${option.label}\n                    </button>\n                </li>`\n            })\n            .join('')\n    }\n\n    // Render the selected option to display in the main button of the PLP Filter Bar\n    renderSelected() {\n        const { options = [] } = this.props\n        const currentOption = options.find(\n            option => option.checked === true || option.selected === true\n        )\n        return `${currentOption?.label || options[0]?.label}`\n    }\n\n    bindEvent() {\n        this.boundHandleClick = this.handleClick.bind(this)\n        this.boundHandleLabelClick = this.handleLabelClick.bind(this)\n        this.boundHandleMobileClose = this.handleMobileClose.bind(this)\n        this.boundFocus = this.focus.bind(this)\n        this.boundFocusin = this.focusin.bind(this)\n        this.boundKeyNav = this.keyNav.bind(this)\n\n        this.buttonElement.addEventListener('click', this.boundHandleClick)\n        this.querySelectorAll('.nb-dropdown__menu button').forEach(item => {\n            item.addEventListener('click', this.boundHandleLabelClick)\n        })\n        this.dropdownMenu.addEventListener('click', this.boundHandleMobileClose)\n        window.addEventListener('click', this.onClickOutside)\n    }\n\n    unbindEvent() {\n        if (!this.buttonElement) {\n            return\n        }\n        this.buttonElement.removeEventListener('click', this.boundHandleClick)\n        this.querySelectorAll('.nb-dropdown__menu button').forEach(item => {\n            item.removeEventListener('click', this.boundHandleLabelClick)\n        })\n        this.dropdownMenu.removeEventListener('click', this.boundHandleMobileClose)\n        window.removeEventListener('click', this.onClickOutside)\n        document.removeEventListener(EVENT_POPIN_KEY_DOWN, this.boundKeyNav)\n    }\n\n    handleClick() {\n        this.toogleDropdown(!this.isOpen)\n    }\n\n    handleMobileClose() {\n        this.toogleDropdown(false)\n    }\n\n    onClickOutside(e) {\n        if (this.isOpen && !this.contains(e.target)) {\n            this.toogleDropdown(false)\n        }\n    }\n\n    handleLabelClick(e) {\n        this.isOpen = false\n\n        // Unpress active button\n        if (this.selectedOption) {\n            this.selectedOption.setAttribute('aria-selected', 'false')\n        }\n\n        /*\n        * TODO CHECK WITH THOMAS\n        const activeButton = this.querySelector('button[aria-pressed=true]')\n        const activeLink = activeButton.getAttribute('data-link')\n        if (activeLink) {\n            window.location.href = activeLink\n            return null\n        }\n        activeButton.setAttribute('aria-pressed', 'false')\n        * */\n\n        // Activate pressed option\n        this.selectedOption = e.target\n        this.selectedOption.setAttribute('aria-selected', 'true')\n\n        // Reset all checked attributes to false / Destroy the object and build it again\n        this.props.options = this.props.options.map(option => ({ ...option, checked: false }))\n\n        // Get the id from the clicked button's data-id attribute\n        const selectedOptionId = this.selectedOption.dataset?.id\n\n        if (selectedOptionId && selectedOptionId !== 'undefined') {\n            // Find the option using the selected button's data-id\n            this.selected = this.props.options.find(option => option.id === selectedOptionId)\n\n            if (!this.selected) {\n                // Handle the error as needed maybe set the first item as checked.\n                this.selected = this.props.options[0]\n            }\n        } else {\n            // Search the option to be updated and assign the new value\n            this.selected = this.props.options.find(\n                option => option.label === this.selectedOption.value\n            )\n        }\n\n        this.selected.checked = true\n        e.target.closest('.nb-dropdown').classList.add('nb-dropdown--is-filled')\n\n        this.reRender()\n\n        this.toogleDropdown(false)\n\n        dispatchEvent({\n            eventName: EVENT_SORT_BY_CHANGE,\n            args: { options: this.props.options, selected: this.selected },\n            element: this\n        })\n    }\n\n    reRender() {\n        const { label, aa_listbox_description, aa_select_description } = this.props\n        if (\n            this.selectedOption.dataset.selectedlabel &&\n            this.selectedOption.dataset.selectedlabel !== 'undefined'\n        ) {\n            this.buttonElementValue.setAttribute('value', this.selectedOption.dataset.selectedlabel)\n        } else {\n            this.buttonElementValue.setAttribute('value', this.selectedOption.value)\n        }\n        this.buttonElement.setAttribute('aria-label', label + ' ' + this.renderSelected())\n        this.dropdownMenu.querySelectorAll('button').forEach(item => {\n            item.setAttribute('aria-description', aa_select_description)\n        })\n        this.selectedOption.setAttribute('aria-description', aa_listbox_description)\n    }\n\n    setSelected(value, dispatchChange = false) {\n        const { options = [] } = this.props\n        const tmpSelected = options.find(option => option.value === value)\n        if (tmpSelected) {\n            this.selected.checked = false\n            this.selected = tmpSelected\n            this.selected.checked = true\n        }\n\n        if (this.selectedOption) {\n            this.selectedOption.setAttribute('aria-selected', 'false')\n        }\n\n        this.dropdownMenu.querySelectorAll('button').forEach(item => {\n            if (item.value === this.selected.label) {\n                this.selectedOption = item\n                this.selectedOption.setAttribute('aria-selected', 'true')\n            }\n        })\n\n        this.classList.add('nb-dropdown--is-filled')\n\n        if (this.selectedOption) {\n            this.reRender()\n        }\n\n        if (dispatchChange) {\n            dispatchEvent({\n                eventName: EVENT_SORT_BY_CHANGE,\n                args: { options, selected: this.selected },\n                element: this\n            })\n        }\n    }\n\n    toogleDropdown(value) {\n        value ? this.open() : this.close()\n        this.isOpen = !this.isOpen\n\n        // Open and Close shared actions\n        this.switchAriaModal()\n        this.buttonElement.setAttribute('aria-expanded', this.isOpen)\n    }\n\n    switchAriaModal() {\n        // This is the future way to scope the SR focus to a modal, but it's not supported yet by all SR\n        this.dropdownMenu.setAttribute('aria-modal', this.isOpen)\n        // So we need to set aria-hidden=false to all brothers and brothers of parent until body\n        recursiveSwitchAriaHidden(this.dropdownMenu, this.isOpen)\n    }\n\n    open() {\n        // Transitionend listener is fired multiple times (fore each css property)\n        // so we need to instanciate it only when we open or close and then we remove it on focusin\n        this.dropdownMenu.addEventListener('transitionend', this.boundFocus)\n        document.addEventListener('focusin', this.boundFocusin)\n        document.addEventListener(EVENT_POPIN_KEY_DOWN, this.boundKeyNav)\n        this.buttonElement.classList.add('isOpen')\n        this.openingSource = document.activeElement\n    }\n\n    close() {\n        // Transitionend listener is fired multiple times (fore each css property)\n        // so we need to instantiate it only when we open or close and then we remove it on focusin\n        this.dropdownMenu.addEventListener('transitionend', this.boundFocus)\n        document.removeEventListener('focusin', this.boundFocusin)\n        document.removeEventListener(EVENT_POPIN_KEY_DOWN, this.boundKeyNav)\n        this.buttonElement.classList.remove('isOpen')\n        this.buttonElement.setAttribute('aria-expanded', false)\n    }\n\n    focus() {\n        this.dropdownMenu.removeEventListener('transitionend', this.boundFocus)\n        if (this.isOpen && this.selectedOption) {\n            this.selectedOption.focus()\n            this.dropdownMenu.lastFocused = this.selectedOption\n        } else {\n            this.buttonElement.focus()\n        }\n    }\n\n    focusin(e) {\n        const loop = false\n        focusin(e, this.dropdownMenu, loop)\n    }\n\n    keyNav(e) {\n        switch (e.key) {\n            case 'Escape':\n                this.toogleDropdown(false)\n                break\n            case 'ArrowUp':\n                e.preventDefault()\n                this.prevOption()\n                break\n            case 'ArrowDown':\n                e.preventDefault()\n                this.nextOption()\n                break\n            case 'Home':\n            case 'PageUp':\n                e.preventDefault()\n                this.firstOption()\n                break\n            case 'End':\n            case 'PageDown':\n                e.preventDefault()\n                this.lastOption()\n                break\n            default:\n                break\n        }\n    }\n\n    prevOption() {\n        if (this.dropdownMenu.lastFocused !== this.dropdownMenu.firstFocusable) {\n            const prevSibling = this.dropdownMenu.lastFocused.previousElementSibling\n            prevSibling.focus()\n            this.dropdownMenu.lastFocused = prevSibling\n        }\n    }\n\n    nextOption() {\n        if (this.dropdownMenu.lastFocused !== this.dropdownMenu.lastFocusable) {\n            const nextSibling = this.dropdownMenu.lastFocused.nextElementSibling\n            nextSibling.focus()\n            this.dropdownMenu.lastFocused = nextSibling\n        }\n    }\n\n    firstOption() {\n        if (this.dropdownMenu.lastFocused !== this.dropdownMenu.firstFocusable) {\n            this.dropdownMenu.firstFocusable.focus()\n            this.dropdownMenu.lastFocused = this.dropdownMenu.firstFocusable\n        }\n    }\n\n    lastOption() {\n        if (this.dropdownMenu.lastFocused !== this.dropdownMenu.lastFocusable) {\n            this.dropdownMenu.lastFocusable.focus()\n            this.dropdownMenu.lastFocused = this.dropdownMenu.lastFocusable\n        }\n    }\n\n    disconnectedCallback() {\n        this.unbindEvent()\n    }\n}\n\ncustomElements.get('nb-dropdown') || customElements.define('nb-dropdown', Dropdown)\n\nexport default Dropdown\n"],"names":["isNil","obj","dispatchEvent","eventName","args","element","window","Error","event","CustomEvent","detail","bubbles","Event","document","createEvent","initEvent","EVENT_POPIN_KEY_DOWN","EVENT_SORT_BY_CHANGE","helper","is","innerWidth","vw","devicePixelRatio","mobile","BREAKPOINT_M","mobile_tablet","BREAKPOINT_TABLET","tablet","desktop","retina","lt","ref","recursiveSwitchAriaHidden","elem","componentOpenState","parent","parentNode","getElementsByTagName","brothers","children","brother","setAttribute","removeAttribute","Dropdown","HTMLElement","constructor","super","this","isOpen","selected","buttonElement","onClickOutside","bind","connectedCallback","props","attributes","data","find","attribute","nodeName","getData","filter","reduce","all","attr","nodeValue","JSON","parse","error","console","log","createProps","classList","add","render","label","aa_description","options","element_id","element_name","map","option","payload","checked","unbindEvent","innerHTML","renderSelected","length","renderOptions","querySelector","buttonElementValue","dropdownMenu","selectedOption","el","focusable","querySelectorAll","firstFocusable","lastFocusable","lastFocused","setFirstAndLastFocusable","bindEvent","aa_listbox_description","aa_select_description","icon_option","id","viewportHelper","link","undefined","join","boundHandleClick","handleClick","boundHandleLabelClick","handleLabelClick","boundHandleMobileClose","handleMobileClose","boundFocus","focus","boundFocusin","focusin","boundKeyNav","keyNav","addEventListener","forEach","item","removeEventListener","toogleDropdown","e","contains","target","selectedOptionId","dataset","value","closest","reRender","selectedlabel","setSelected","dispatchChange","tmpSelected","open","close","switchAriaModal","openingSource","activeElement","remove","loop","key","preventDefault","prevOption","nextOption","firstOption","lastOption","prevSibling","previousElementSibling","nextSibling","nextElementSibling","disconnectedCallback","customElements","get","define"],"mappings":"AAAA,MAqBMA,EAAQC,GAAoC,MAARA,ECrB7BC,EAAgBA,EAAGC,UAAAA,EAAWC,KAAAA,EAAMC,QAAAA,MAE7C,IAAKA,EACD,aAAWC,OAAW,KAGZ,MAAA,IAAIC,MACN,yGAHJF,EAAUC,MAIV,CAIJE,IAAAA,EACAJ,EACAI,EAAQ,IAAIC,YAAYN,EAAW,CAAEO,OAAQN,EAAMO,SAAS,IAEvC,mBAAVC,MACPJ,EAAQ,IAAII,MAAMT,IAElBK,EAAQK,SAASC,YAAY,SAC7BN,EAAMO,UAAUZ,GAAW,GAAM,IAGzCE,EAAQH,cAAcM,EAAK,ECGlBQ,EAAuB,UAwBvBC,EAAuB,+BC5B9BC,EAfK,CACH,MAAIC,GACM,MAAEC,WAAYC,EAAIC,iBAAAA,GAAqBhB,OACtC,MAAA,CACHiB,OAAQF,EAAKG,IACbC,cAAeJ,EAAKK,KACpBC,OAAQN,GAAMG,KAAgBH,EAAKK,KACnCE,QAASP,G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