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./assets/src/scripts/utilities/freeze.ts","webpack:///./assets/src/scripts/constants/customMessages.ts","webpack:///./assets/src/scripts/constants/whatInput.ts","webpack:///./assets/src/scripts/utilities/whatInput.ts","webpack:///./assets/src/scripts/base/commonInterface.ts","webpack:///./assets/src/scripts/base/baseComponent.ts","webpack:///./assets/src/scripts/base/productSearchComponent.ts","webpack:///./assets/src/scripts/components/sorting.ts","webpack:///./assets/src/scripts/utilities/focusableElementUtils.ts"],"sourcesContent":["export default function deepFreeze(o) {\n    Object.freeze(o);\n    Object.getOwnPropertyNames(o).forEach(function (prop) {\n        if (Object.hasOwnProperty.call(o, prop) && o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) {\n            deepFreeze(o[prop]);\n        }\n    });\n    return o;\n}\n","import deepFreeze from '../utilities/freeze';\nexport default deepFreeze({\n    WINDOW: {\n        CLICK_EVENT: 'body:click:event',\n    },\n    BODY: {\n        TOGGLE_OVERLAY: 'toggle:overlay',\n        ON_OVERLAY: 'on:overlay',\n        OFF_OVERLAY: 'off:overlay',\n    },\n    HEADER: {\n        UPDATE_TRAP: 'header:trap:update',\n        IN_PDP: 'header:inPdp',\n    },\n    BURGER: {\n        TOGGLE_MENU: 'menu:toggle',\n    },\n    BREAKPOINTER: {\n        BREAKPOINT_CHANGE: 'breakpoint:change',\n    },\n    DROP_DOWN: {\n        OPEN: 'dropdown:open',\n        CLOSE: 'dropdown:close',\n    },\n    PRODUCT_CAROUSEL: {\n        UPDATE_IMAGES: 'product:carousel:update_images',\n        UPDATE_ZOOM_IMAGES: 'product:carousel:update_zoom_images',\n    },\n    BRANDS: {\n        UPDATE_GRID: 'brands:update:grid',\n        UPDATE_STORES: 'brands:update:stores',\n        SEARCH_BY_STORE: 'brands:search:bystore',\n    },\n    MODAL_EVENTS: {\n        show: 'modal:show',\n        close: 'modal:close',\n    },\n});\n","import deepFreeze from '../utilities/freeze';\nexport default deepFreeze({\n    INPUT: {\n        KEYBOARD: 'keyboard',\n        MOUSE: 'mouse'\n    }\n});\n","import whatInput from 'what-input';\nexport const ask = (strategy = 'input') => {\n    return whatInput.ask(strategy);\n};\n","import { getAllFocusableElements, getFirstFocusable } from '../utilities/focusableElementUtils';\nimport CustomMessages from '../constants/customMessages';\nimport EventBus from '../libs/eventBus';\nimport WHAT_INPUT from '../constants/whatInput';\nimport { ask } from '../utilities/whatInput';\nimport config from 'gia/config';\nexport default class CommonInterface {\n    constructor() {\n        config.set('log', true);\n        window.EventBus = EventBus;\n        window.CUSTOM_MESSAGES = this.CUSTOM_MESSAGES;\n        this._grabMessages();\n    }\n    get CUSTOM_MESSAGES() {\n        return CustomMessages;\n    }\n    get Messages() {\n        return {};\n    }\n    get isKeyboard() {\n        return this._isKeyboard();\n    }\n    get isMouse() {\n        return this._isMouse();\n    }\n    get whatInput() {\n        return this._whatInput();\n    }\n    _checkMessages() {\n        for (const message in this.Messages) {\n            if (window.eventQueue.get(message)) {\n                const ref = this.Messages[message].bind(this);\n                window.eventQueue.get(message).map((payload) => {\n                    ref(payload);\n                });\n                window.eventQueue.delete(message);\n            }\n        }\n    }\n    _grabMessages() {\n        this._messages = {};\n        for (const message in this.Messages) {\n            if (this.Messages[message]) {\n                const __ref__ = this.Messages[message].bind(this);\n                this._messages[message] = __ref__;\n                this.GRAB(message, __ref__);\n            }\n        }\n    }\n    _ungrabMessages() {\n        for (const message in this._messages) {\n            this.UNGRAB(message, this._messages[message]);\n        }\n    }\n    objectIsEmpty(object) {\n        for (let key in object) {\n            if (object.hasOwnProperty(key))\n                return false;\n        }\n        return true;\n    }\n    /**\n     *\n     * EMIT\n     *\n     * @param {string} message\n     * @param {Object} payload\n     */\n    EMIT(message, payload) {\n        return EventBus.emit(message, payload);\n    }\n    /**\n     *\n     * GRAB\n     *\n     * @param {string} message\n     * @param {Function} callBack\n     */\n    GRAB(message, callBack) {\n        if (!callBack)\n            return;\n        EventBus.on(message, callBack);\n    }\n    /**\n     *\n     * UNGRAB\n     *\n     * @param {string} message\n     * @param {Function} callBack\n     */\n    UNGRAB(message, callBack) {\n        if (!callBack)\n            return;\n        EventBus.off(message, callBack);\n    }\n    getFirstFocusable(parent) {\n        return getFirstFocusable(parent);\n    }\n    getFocusableElements(parent) {\n        return getAllFocusableElements(parent);\n    }\n    _isMouse() {\n        return ask() === WHAT_INPUT.INPUT.MOUSE;\n    }\n    _isKeyboard() {\n        return ask() === WHAT_INPUT.INPUT.KEYBOARD;\n    }\n    _whatInput() {\n        return ask();\n    }\n    _destroy() {\n        this._ungrabMessages();\n    }\n}\n","import Bean from 'bean';\nimport CommonInterface from './commonInterface';\nimport deepFreeze from '../utilities/freeze';\nexport default class BaseComponent extends CommonInterface {\n    /**\n     *\n     * constructor\n     *\n     * @param {Element} element\n     */\n    constructor(element) {\n        super();\n        this._componentElement = element;\n        this._componentElement.setAttribute('data-component-init', 'true');\n        this._checkMessages();\n        //console.log(`%c[${this.COMPONENT_NAME}]%c initialized`, 'color:orange;', 'color:white;');\n    }\n    /**\n     * @returns {ComponentElement}\n     */\n    get _el() {\n        return this._componentElement;\n    }\n    get _options() {\n        const compOptions = {};\n        const options = Object.assign({}, this._el.dataset);\n        const optionsEntires = Object.keys(options).filter((entry) => entry.includes('option'));\n        optionsEntires.forEach((entry) => {\n            const cleanEntry = BaseComponent.cleanOptionKey(entry);\n            let optionValue;\n            if (options[entry].includes('{') && options[entry].includes('}')) {\n                optionValue = JSON.parse(options[entry].replace(/'/g, '\"'));\n            }\n            else {\n                optionValue = BaseComponent.convertType(options[entry]);\n            }\n            compOptions[cleanEntry] = optionValue;\n        });\n        return deepFreeze(compOptions);\n    }\n    get COMPONENT_NAME() {\n        return this._el.getAttribute('data-component');\n    }\n    static convertType(option) {\n        let optionReturn;\n        switch (option) {\n            case 'false':\n                optionReturn = false;\n                break;\n            case 'true':\n                optionReturn = true;\n                break;\n            case 'null':\n                optionReturn = null;\n                break;\n            default:\n                optionReturn = option;\n                break;\n        }\n        return optionReturn;\n    }\n    static cleanOptionKey(key) {\n        const str = key.replace('option', '');\n        return `${str.charAt(0).toLocaleLowerCase()}${str.slice(1)}`;\n    }\n    /**\n     *\n     * $on\n     *\n     * @param {String} events\n     * @param {Function} cb\n     * @param {Element} [element = this._el]\n     * @param {Array|String|Element} [elements = null]\n     */\n    $on(events, cb, element = this._el, elements = null) {\n        if (!element || !events || !cb)\n            return;\n        if (!elements) {\n            Bean.on(element, events, (e) => {\n                if (e)\n                    e.stopPropagation();\n                cb(e);\n            });\n        }\n        else {\n            Bean.on(element, events, elements, (e) => {\n                if (e)\n                    e.stopPropagation();\n                cb(e);\n            });\n        }\n    }\n    /**\n     *\n     * $one\n     *\n     * @param {String} events\n     * @param {Function} cb\n     * @param {Element} [element = this._el]\n     */\n    $one(events, cb, element = this._el) {\n        Bean.one(element, events, cb);\n    }\n    /**\n     *\n     * $off\n     *\n     * @param {String} events\n     * @param {Element} [element = this._el]\n     */\n    $off(events, element = this._el) {\n        Bean.off(element, events);\n    }\n    /**\n     *\n     * $fire\n     *\n     * @param {String} events\n     * @param {Element} [element = this._el]\n     */\n    $fire(events, element = this._el) {\n        Bean.fire(element, events);\n    }\n    updateAriaAttributes(element) {\n        const attributes = [...element.attributes]\n            .filter((attr) => {\n            return attr.nodeName.indexOf('has') === -1;\n        })\n            .filter((attr) => {\n            return attr.nodeName.indexOf('aria') > -1 && (attr.nodeValue === 'true' || attr.nodeValue === 'false');\n        })\n            .map((attr) => {\n            return attr.nodeName;\n        });\n        attributes.forEach((attr) => {\n            element.setAttribute(attr, element.getAttribute(attr) === 'true' ? 'false' : 'true');\n        });\n    }\n}\n","// import spinner from '../components/spinner'; // used in extended components\n// import scrollUtils from '../utils/scrollUtils'; // used in extended components\nimport customEventBus from '../libs/eventBus'; // used in extended components\nimport queryString from 'query-string';\nimport analyticsUtils from '../utilities/analyticsUtils';\nimport BaseComponent from '../base/baseComponent';\nimport buildAddToCartButton from '../utilities/buildAddToCartButton';\nimport fillWishlistHeart from '../utilities/fillWishlistHeart';\nexport default class ProductSearchComponent extends BaseComponent {\n    constructor(element) {\n        super(element);\n        /* class vars */\n        // spinner = spinner;\n        // scroll = scrollUtils;\n        this.customEventBus = customEventBus;\n        // analytics = analyticsUtils;\n        this.qs = queryString;\n        this.selectors = {\n            productListWrapper: '.product-grid',\n            product: '.product-tile',\n            siblingsTotal: '.combo-toolbarsiblings-counter',\n            pagination: '.productgrid-pagination',\n            paginationCounter: '.productgrid-pagination-counter-part',\n            paginationProgress: '.productgrid-pagination-progressbar-value',\n            paginationTotal: '.productgrid-pagination-counter-count',\n            refinmentProductsTotal: '.search-results-info-counter',\n        };\n        this.waiting = false;\n        this.endpoint = '';\n        this.categoryurl = document.querySelector(this.selectors.productListWrapper).getAttribute('data-categoryurl') || '';\n        if (!window.productSearchData) {\n            throw Error(`ProductSearchComponent: window.productSearchData not declared in static.ts`);\n        }\n        if (!document.querySelector(this.selectors.productListWrapper)) {\n            throw Error(`ProductSearchComponent: ${this.selectors.productlistWrapper} not found`);\n        }\n        //  \n        this.setInitCount();\n        this.setInitParameters();\n        this.reviewPaginationCta();\n    }\n    setInitCount() {\n        window.productSearchData.counter = document.querySelector(this.selectors.productListWrapper).querySelectorAll(this.selectors.product).length || 0;\n        window.productSearchData.increment = parseInt(document.body.querySelector(this.selectors.productListWrapper).getAttribute('data-paginationsize')) || 12;\n        window.productSearchData.total = parseInt(document.querySelector(this.selectors.productListWrapper).getAttribute('data-productcount'));\n        window.productSearchData.datalayerOffset = 1;\n    }\n    setInitParameters() {\n        window.productSearchData.searchParams = window.productSearchData.searchParams || this.qs.parse(document.querySelector(this.selectors.productListWrapper).getAttribute('data-querystring')) || {};\n        window.productSearchData.searchParams.sz = window.productSearchData.searchParams.sz || window.productSearchData.increment;\n        window.productSearchData.searchQs = window.productSearchData.searchQs || {};\n    }\n    async getPage(targetEvent) {\n        if (this.waiting === false) {\n            this.waiting = true;\n            targetEvent.classList.add('loading');\n            try {\n                const data = await this.getFetchedDom(`${this.endpoint}?${this.qs.stringify(window.productSearchData.searchParams)}`);\n                this.parseResults(data);\n                targetEvent.classList.remove('loading');\n            }\n            catch (ev) {\n                console.error(ev);\n                targetEvent.classList.remove('loading');\n            }\n            finally {\n                this.waiting = false;\n                targetEvent.classList.remove('loading');\n            }\n        }\n    }\n    async getFetchedDom(url) {\n        return fetch(url, {\n            headers: {\n                'X-Requested-With': 'XMLHttpRequest',\n            },\n        }).then(function (response) {\n            return response.text();\n        });\n    }\n    parseResults(data) {\n        const parser = new DOMParser();\n        const html = parser.parseFromString(data, 'text/html');\n        if (this.printMethod === 'replace') {\n            // refinements - sorting\n            this.reviewDomElements(html);\n            document.body.querySelector(this.selectors.productListWrapper).innerHTML = html.querySelector(this.selectors.productListWrapper).innerHTML;\n            // scrollUtils.toTop();\n        }\n        else {\n            // pagination\n            document.body.querySelector(this.selectors.productListWrapper).insertAdjacentHTML('beforeend', html.body.querySelector(this.selectors.productListWrapper).innerHTML);\n        }\n        this.updateData(html);\n        buildAddToCartButton();\n        fillWishlistHeart();\n        this.updatePageCounter();\n        this.reviewPaginationCta();\n        this.pushUrlState();\n        if (this.printMethod === 'replace') {\n            this.updatePageCounter();\n            this.reviewPaginationCta();\n        }\n        // analytics\n        this.prepareDatalayer(html.body.querySelector(this.selectors.productListWrapper));\n    }\n    reviewDomElements(html) {\n        // to override in child class - refinements\n    }\n    updatePageCounter() {\n        const refinementsTotals = document.body.querySelectorAll(this.selectors.refinmentProductsTotal);\n        if (refinementsTotals) {\n            refinementsTotals.forEach(function (refinementsTotal) {\n                let singleLabel = refinementsTotal.querySelector('.label-single');\n                let multipleLabel = refinementsTotal.querySelector('.label-multiple');\n                if (window.productSearchData.total === 1) {\n                    multipleLabel.classList.add('d-none');\n                    singleLabel.classList.remove('d-none');\n                }\n                else {\n                    singleLabel.classList.add('d-none');\n                    multipleLabel.classList.remove('d-none');\n                }\n                refinementsTotal.querySelector('.counter').innerHTML = window.productSearchData.total.toString();\n                const refinmentProductsItems = refinementsTotal.parentElement.querySelector('.search-results-info-counter-items');\n                if (refinmentProductsItems && refinmentProductsItems.dataset.item && refinmentProductsItems.dataset.items) {\n                    refinmentProductsItems.innerHTML = window.productSearchData.total == 1 ? refinmentProductsItems.dataset.item : refinmentProductsItems.dataset.items;\n                }\n            });\n        }\n        document.body.querySelector(this.selectors.productListWrapper).setAttribute('data-productcount', window.productSearchData.total.toString());\n    }\n    updateData(html) {\n        // to override in child class\n    }\n    reviewPaginationCta() {\n        let paginationHTML = document.body.querySelector(this.selectors.pagination);\n        if (window.productSearchData.counter >= window.productSearchData.total) {\n            paginationHTML.style.display = 'none';\n        }\n        else {\n            paginationHTML.removeAttribute('style');\n        }\n    }\n    pushUrlState() {\n        window.history.replaceState('', '', `${this.categoryurl && this.categoryurl !== '' && this.categoryurl !== 'null' ? this.categoryurl : (window.location.origin + window.location.pathname)}?${this.qs.stringify(window.productSearchData.searchQs)}`);\n    }\n    async prepareDatalayer(context) {\n        let tile = context.querySelector(this.selectors.product);\n        let data = {\n            'forcedPipeline': 'ProductImpressions',\n            'pids': analyticsUtils.getListPids(context),\n            'item_list_name': analyticsUtils.getTileListName(tile),\n            'offset': (window.productSearchData.datalayerOffset).toString(),\n        };\n        analyticsUtils.passThroughProcessor(data);\n    }\n}\n","import ProductSearchComponent from '../base/productSearchComponent';\nexport default class Sorting extends ProductSearchComponent {\n    constructor(element) {\n        super(element);\n        this.refinementsCount = 0;\n        this.endpoint = document.body.querySelector(this.selectors.productListWrapper).getAttribute('data-endpoint').split('?')[0] || '';\n        this.listenForChanges();\n    }\n    get SELECTORS() {\n        return {\n            productListWrapper: '.product-grid',\n            selectableItems: '.sorting--input'\n        };\n    }\n    listenForChanges() {\n        const sortingInputs = [...this._el.querySelectorAll(this.SELECTORS.selectableItems)];\n        sortingInputs.forEach((trigger) => {\n            trigger.addEventListener('change', async (e) => {\n                this.printMethod = 'replace';\n                window.productSearchData.searchParams.start = 0;\n                window.productSearchData.searchParams.sz = window.productSearchData.increment;\n                window.productSearchData.searchParams.srule = e.currentTarget.getAttribute('value') || '';\n                this.getPage(e.currentTarget);\n            });\n        });\n    }\n    updateData() {\n        window.productSearchData.currentPage = 1;\n        window.productSearchData.counter = window.productSearchData.increment;\n        window.productSearchData.datalayerOffset = 1;\n        let excludedKeys = ['cgid', 'start'];\n        let sortingKeys = Object.assign({}, window.productSearchData.searchParams);\n        excludedKeys.forEach((key) => {\n            delete sortingKeys[key];\n        });\n        window.productSearchData.searchQs = sortingKeys;\n    }\n}\n","const focusableSelectors = 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"]), [role=\"button\"]';\nexport const getFirstFocusable = (parent) => parent.querySelector(focusableSelectors);\nexport const getAllFocusableElements = (parent) => parent.querySelectorAll(focusableSelectors);\n"],"names":["deepFreeze","o","Object","freeze","getOwnPropertyNames","forEach","prop","hasOwnProperty","call","isFrozen","WINDOW","CLICK_EVENT","BODY","TOGGLE_OVERLAY","ON_OVERLAY","OFF_OVERLAY","HEADER","UPDATE_TRAP","IN_PDP","BURGER","TOGGLE_MENU","BREAKPOINTER","BREAKPOINT_CHANGE","DROP_DOWN","OPEN","CLOSE","PRODUCT_CAROUSEL","UPDATE_IMAGES","UPDATE_ZOOM_IMAGES","BRANDS","UPDATE_GRID","UPDATE_STORES","SEARCH_BY_STORE","MODAL_EVENTS","show","close","INPUT","KEYBOARD","MOUSE","ask","strategy","CommonInterface","constructor","config","window","EventBus","CUSTOM_MESSAGES","this","_grabMessages","Messages","isKeyboard","_isKeyboard","isMouse","_isMouse","whatInput","_whatInput","_checkMessages","message","eventQueue","get","ref","bind","map","payload","delete","_messages","__ref__","GRAB","_ungrabMessages","UNGRAB","objectIsEmpty","object","key","EMIT","callBack","getFirstFocusable","parent","getFocusableElements","_destroy","BaseComponent","element","super","_componentElement","setAttribute","_el","_options","compOptions","options","assign","dataset","keys","filter","entry","includes","cleanEntry","cleanOptionKey","optionValue","JSON","parse","replace","convertType","COMPONENT_NAME","getAttribute","static","option","optionReturn","str","charAt","toLocaleLowerCase","slice","$on","events","cb","elements","e","stopPropagation","$one","$off","$fire","updateAriaAttributes","attributes","attr","nodeName","indexOf","nodeValue","ProductSearchComponent","customEventBus","qs","selectors","productListWrapper","product","siblingsTotal","pagination","paginationCounter","paginationProgress","paginationTotal","refinmentProductsTotal","waiting","endpoint","categoryurl","document","querySelector","productSearchData","Error","productlistWrapper","setInitCount","setInitParameters","reviewPaginationCta","counter","querySelectorAll","length","increment","parseInt","body","total","datalayerOffset","searchParams","sz","searchQs","async","targetEvent","classList","add","data","getFetchedDom","stringify","parseResults","remove","ev","console","error","url","fetch","headers","then","response","text","html","DOMParser","parseFromString","printMethod","reviewDomElements","innerHTML","insertAdjacentHTML","updateData","updatePageCounter","pushUrlState","prepareDatalayer","refinementsTotals","refinementsTotal","singleLabel","multipleLabel","toString","refinmentProductsItems","parentElement","item","items","paginationHTML","style","display","removeAttribute","history","replaceState","location","origin","pathname","context","tile","Sorting","refinementsCount","split","listenForChanges","SELECTORS","selectableItems","trigger","addEventListener","start","srule","currentTarget","getPage","currentPage","sortingKeys","focusableSelectors","getAllFocusableElements"],"sourceRoot":""}