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AAA,CAAAH,OAAA,ECzGY,YAEEA,CAAAA,QAAAsL,OAAA,CAAA9L,KAAA8L,OAAA,CACftL,QAAAuL,OAAA,CAAgB/L,KAAA+L,OAAA,CAChBvL,QAAAwL,QAAa,CAAAhM,KAAAgM,QAAA,CAAAxL,QAAAQ,KAAA,CAAAhB,KAAAgB,KAAA,CAEb","sources":["webpack://_N_E/./node_modules/core-js/internals/is-integer.js","webpack://_N_E/./node_modules/core-js/modules/es.number.is-integer.js","webpack://_N_E/./node_modules/isomorphic-fetch/fetch-npm-browserify.js","webpack://_N_E/./adapters/helpers/Path.js","webpack://_N_E/./adapters/helpers/functions.js","webpack://_N_E/./components/RecentlyViewedProductsBlock/RecentlyViewedProductsBlock.js","webpack://_N_E/./persistence/localStorage.js","webpack://_N_E/./persistence/recentlyViewed.js","webpack://_N_E/./node_modules/next/dist/build/polyfills/fetch/whatwg-fetch.js","webpack://_N_E/"],"sourcesContent":["var isObject = require('../internals/is-object');\n\nvar floor = Math.floor;\n\n// `Number.isInteger` method implementation\n// https://tc39.github.io/ecma262/#sec-number.isinteger\nmodule.exports = function isInteger(it) {\n return !isObject(it) && isFinite(it) && floor(it) === it;\n};\n","var $ = require('../internals/export');\nvar isInteger = require('../internals/is-integer');\n\n// `Number.isInteger` method\n// https://tc39.github.io/ecma262/#sec-number.isinteger\n$({ target: 'Number', stat: true }, {\n isInteger: isInteger\n});\n","// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\nrequire('whatwg-fetch');\nmodule.exports = self.fetch.bind(self);\n","function standardizePath(path) {\n if (typeof path === 'string') {\n return path.replace(/\\/{1,}/g, '/')\n .replace(/\\/{1,}$/g, '');\n }\n}\nconst customJsonstringify = str => JSON.stringify(str) && JSON.stringify(str).replace(/([&\"'<>])/g, (char) => {\n switch (char) {\n case '&':\n return '\\u0026'\n case '<':\n return '\\u003c'\n case '>':\n return '\\u003e'\n case '\"':\n return '\\u0022'\n case \"'\":\n return '\\u0027'\n default:\n return char\n }\n})\n\nmodule.exports = {\n customJsonstringify,\n standardizePath,\n};","export function chunk(items, size) {\n if(!Array.isArray(items)\n || items.length === 0\n || !Number.isInteger(size)\n || size === 0) {\n return [];\n }\n\n const chunks = [];\n let chunk = [];\n\n for(let i = 0; i < items.length; i++) {\n chunk.push(items[i]);\n if((i + 1) % size === 0) {\n chunks.push(chunk);\n chunk = [];\n }\n }\n\n if(chunk.length > 0) {\n chunks.push(chunk);\n }\n\n return chunks;\n}\n\nexport function flatten(array) {\n if (!Array.isArray(array)) {\n return [];\n }\n\n return array.reduce((previous, current) => {\n if (Array.isArray(current)){\n return previous.concat(current);\n } else {\n previous.push(current);\n return previous;\n }\n }, []);\n}\n\nexport function minimum(array) {\n if (!Array.isArray(array)) {\n return undefined;\n }\n\n let minimum = undefined;\n\n for(let i = 0; i < array.length; i++) {\n const value = array[i];\n if(typeof value === 'number') {\n if(minimum === undefined || value < minimum) {\n minimum = value;\n }\n }\n }\n\n return minimum;\n}\n\n// function to return N given of items in an Array\nexport function first(array, n) {\n // if passed array is not an array, return empty array\n if (!Array.isArray(array)\n || n <= 0) {\n return [];\n }\n\n //if N number is bigger or equal slice up the entire thing\n if(n >= array.length) {\n return array.slice();\n } else {\n // otherwise return only N numbers of array items\n return array.slice(0, n);\n }\n}\n\nexport function isLater(value) {\n // Return true if today is after the value date\n let result = false\n\n if (value && value instanceof Date) {\n result = new Date() > value;\n } else if (value) {\n result = new Date() > new Date(value)\n }\n\n return result;\n}\n\nexport function isObject(value) {\n return (!!value) && (value.constructor === Object);\n}\n\nexport function findIndex(array, fn) {\n if (!Array.isArray(array)\n || !(typeof fn === 'function')) {\n return undefined;\n }\n for(let i = 0; i < array.length; i++) {\n const element = array[i];\n\n if(fn(element)) {\n return i;\n }\n }\n\n return undefined;\n}\n\nexport function escapeHtml(unsafe) {\n return unsafe\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n","import React, { useState, useEffect, useRef, useMemo, Suspense } from 'react';\nimport dynamic from 'next/dynamic';\nimport Block from '../../adapters/helpers/Block';\nimport { getProducts, removeProduct } from '../../persistence/recentlyViewed';\nimport { RecentlyViewedProductsBlockConstants } from '../../adapters/helpers/Constants';\nimport { Waypoint } from 'react-waypoint';\nimport 'isomorphic-fetch';\nconst Heading = dynamic(() => import('../Heading/Heading'));\nconst ProductsOverview = dynamic(() => import('../ProductsOverview/ProductsOverview'));\nimport Loader from '../../adapters/helpers/Loader';\n\nexport default function RecentlyViewedProductsBlock(props) {\n\n const standardizePath = require('../../adapters/helpers/Path').standardizePath;\n\n const block = new Block(props);\n const {document, extraAttributes} = props;\n\n const productsToLoad = useRef(\n getProducts()\n .map(({id}) => id)\n .filter(id => id !== extraAttributes?.slug)\n );\n\n const [products, setProducts] = useState(\n productsToLoad.current.map(() => undefined)\n );\n\n const [isShown, setIsShown] = useState(false);\n\n const anchorId = block.getAnchorId();\n\n const title = document?.fields?.title;\n const seeLessLabel = document?.fields?.seeLessLabel?.fields?.text;\n const seeMoreLabel = document?.fields?.seeMoreLabel?.fields?.text;\n\n const _handleWaypointEnter = () => {\n // Trigger by waypoint enter\n setIsShown(true);\n }\n\n const propsClassnames = document?.fields?.classNames;\n\n const classNames = useMemo(() => {\n const _classNames = [\n 'ob-recently-viewed-block',\n ];\n\n if(propsClassnames) {\n _classNames.push(propsClassnames);\n }\n\n if(isShown) {\n _classNames.push(RecentlyViewedProductsBlockConstants.show);\n }\n\n return _classNames;\n\n }, [propsClassnames, isShown])\n\n useEffect(() => {\n if(isShown) {\n for(let i = 0; i < productsToLoad.current.length; i++) {\n const productId = productsToLoad.current[i];\n (async () => {\n try {\n const loadedProduct = await (\n await (fetch(RecentlyViewedProductsBlockConstants.fetch + btoa(standardizePath(productId)) + RecentlyViewedProductsBlockConstants.json).then((response) => {\n const statusCategory = response.status.toString()[0];\n if(statusCategory === RecentlyViewedProductsBlockConstants.four) {\n removeProduct(productId);\n }\n return response;\n }))\n ).json();\n\n setProducts(prevState => {\n const products = prevState.slice();\n products[i] = loadedProduct;\n return products;\n });\n } catch(e) {\n //Log error or do something\n }\n })();\n }\n }\n }, [isShown]);\n\n return (\n }>\n {products.length > 0 &&
\n
\n {!!title && {title}}\n
\n }>\n \n \n \n
\n
\n
}\n
\n );\n}\n","\nconst LOCAL_STORAGE_KEYS = {\n RECENTLY_VIEWED_PRODUCTS: 'RECENTLY_VIEWED_PRODUCTS',\n}\nexport function localStorageRemoveItem(item) {\n return localStorage.removeItem(item)\n}\n\nexport function localStorageGetItem(item) {\n return localStorage.getItem(item)\n}\n\nexport function localStorageSetItem(item,itemType) {\n return localStorage.setItem(item, itemType);\n}\n\nexport { LOCAL_STORAGE_KEYS };","import { LOCAL_STORAGE_KEYS } from './localStorage';\nimport { first } from '../adapters/helpers/functions';\nimport { customJsonstringify, customSuperJsonParse, customSuperJsonStringify } from '../adapters/helpers/Utils';\n\nconst PRODUCT_PERSISTENCE_LIFESPAN_MILLISECONDS = 30 * 24 * 60 * 60 * 1000;\n\nfunction findProductIndex(products, id) {\n for(let i = 0; i < products.length; i++) {\n const product = products[i];\n\n if(product.id === id) {\n return i;\n }\n }\n\n return undefined;\n}\n\nfunction filterExpiredProducts(products) {\n return products.filter(({expiral}) =>\n new Date(expiral).getTime() > new Date().getTime())\n}\n\n\n// TODO: Remove in prod (Used for data consistency between changes)\nfunction isProductsDataValid(products) {\n if(!Array.isArray(products)) { return false; }\n\n for(let i = 0; i < products.length; i++) {\n const product = products[i];\n\n if(!product) { return false; }\n\n if(!product.hasOwnProperty('id')) { return false; }\n if(!product.hasOwnProperty('expiral')) { return false; }\n\n if(!(typeof product.id === 'string')) { return false; }\n if(!(typeof product.expiral === 'number')) { return false; }\n }\n return true;\n}\n\nexport function setViewed(id) {\n if((typeof localStorage !== 'undefined') && localStorage.setItem) {\n const products = getProducts();\n\n // Remove already viewed product\n const productsWithoutCurrentProduct = products.slice();\n const currentProductIndex = findProductIndex(products, id);\n\n if(currentProductIndex !== undefined) {\n productsWithoutCurrentProduct.splice(currentProductIndex, 1);\n }\n\n // Filter expirered products\n const expiralFilteredProduct = filterExpiredProducts(productsWithoutCurrentProduct);\n\n // Add id to first place\n const nextProducts = first([\n { id, expiral: (new Date().getTime() + PRODUCT_PERSISTENCE_LIFESPAN_MILLISECONDS)},\n ...expiralFilteredProduct\n ], 3);\n\n localStorage.setItem(LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS, customSuperJsonStringify(nextProducts));\n }\n}\n\nexport function getProducts() {\n if((typeof localStorage !== 'undefined') && localStorage.getItem) {\n const json = localStorage.getItem(LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS);\n\n if(json !== null) {\n try {\n const products = customSuperJsonParse(json);\n\n // TODO: Remove in prod\n if(!isProductsDataValid(products)) { return [];}\n\n return filterExpiredProducts(products);\n } catch(_e) {\n // Do nothing or log error\n }\n }\n }\n\n return [];\n}\n\nexport function removeProduct(id) {\n if((typeof localStorage !== 'undefined') && localStorage.setItem) {\n const products = getProducts();\n\n // Remove product\n const productsWithoutCurrentProduct = products.slice();\n const currentProductIndex = findProductIndex(products, id);\n\n if(currentProductIndex !== undefined) {\n productsWithoutCurrentProduct.splice(currentProductIndex, 1);\n }\n\n // Filter expirered products\n const expiralFilteredProduct = filterExpiredProducts(productsWithoutCurrentProduct);\n\n localStorage.setItem(LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS, customSuperJsonStringify(expiralFilteredProduct));\n }\n}\n","\"use strict\";\n/* globals self */ exports.Headers = self.Headers;\nexports.Request = self.Request;\nexports.Response = self.Response;\nexports.fetch = self.fetch;\n\n//# sourceMappingURL=whatwg-fetch.js.map","(self[\"webpackChunk_N_E\"] = self[\"webpackChunk_N_E\"] || []).push([[5205],{\n\n/***/ 18730:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar isObject = __webpack_require__(70111);\n\nvar floor = Math.floor;\n\n// `Number.isInteger` method implementation\n// https://tc39.github.io/ecma262/#sec-number.isinteger\nmodule.exports = function isInteger(it) {\n return !isObject(it) && isFinite(it) && floor(it) === it;\n};\n\n\n/***/ }),\n\n/***/ 33161:\n/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {\n\nvar $ = __webpack_require__(82109);\nvar isInteger = __webpack_require__(18730);\n\n// `Number.isInteger` method\n// https://tc39.github.io/ecma262/#sec-number.isinteger\n$({ target: 'Number', stat: true }, {\n isInteger: isInteger\n});\n\n\n/***/ }),\n\n/***/ 94301:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\n// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\n__webpack_require__(66477);\nmodule.exports = self.fetch.bind(self);\n\n\n/***/ }),\n\n/***/ 57646:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\n__webpack_require__(74916);\n\n__webpack_require__(15306);\n\n__webpack_require__(38862);\n\nfunction standardizePath(path) {\n if (typeof path === 'string') {\n return path.replace(/\\/{1,}/g, '/').replace(/\\/{1,}$/g, '');\n }\n}\n\nvar customJsonstringify = function customJsonstringify(str) {\n return JSON.stringify(str) && JSON.stringify(str).replace(/([&\"'<>])/g, function (char) {\n switch (char) {\n case '&':\n return \"&\";\n\n case '<':\n return \"<\";\n\n case '>':\n return \">\";\n\n case '\"':\n return \"\\\"\";\n\n case \"'\":\n return \"'\";\n\n default:\n return char;\n }\n });\n};\n\nmodule.exports = {\n customJsonstringify: customJsonstringify,\n standardizePath: standardizePath\n};\n\n/***/ }),\n\n/***/ 61986:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Kn\": function() { return /* binding */ isObject; },\n/* harmony export */ \"LT\": function() { return /* binding */ minimum; },\n/* harmony export */ \"Ps\": function() { return /* binding */ first; },\n/* harmony export */ \"Xv\": function() { return /* binding */ escapeHtml; },\n/* harmony export */ \"cx\": function() { return /* binding */ findIndex; },\n/* harmony export */ \"en\": function() { return /* binding */ isLater; },\n/* harmony export */ \"yo\": function() { return /* binding */ chunk; }\n/* harmony export */ });\n/* unused harmony export flatten */\n/* harmony import */ var core_js_modules_es_number_is_integer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33161);\n/* harmony import */ var core_js_modules_es_number_is_integer_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_is_integer_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9653);\n/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(85827);\n/* harmony import */ var core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(41539);\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(92222);\n/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(47042);\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(74916);\n/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(15306);\n/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_7__);\n\n\n\n\n\n\n\n\nfunction chunk(items, size) {\n if (!Array.isArray(items) || items.length === 0 || !Number.isInteger(size) || size === 0) {\n return [];\n }\n\n var chunks = [];\n var chunk = [];\n\n for (var i = 0; i < items.length; i++) {\n chunk.push(items[i]);\n\n if ((i + 1) % size === 0) {\n chunks.push(chunk);\n chunk = [];\n }\n }\n\n if (chunk.length > 0) {\n chunks.push(chunk);\n }\n\n return chunks;\n}\nfunction flatten(array) {\n if (!Array.isArray(array)) {\n return [];\n }\n\n return array.reduce(function (previous, current) {\n if (Array.isArray(current)) {\n return previous.concat(current);\n } else {\n previous.push(current);\n return previous;\n }\n }, []);\n}\nfunction minimum(array) {\n if (!Array.isArray(array)) {\n return undefined;\n }\n\n var minimum = undefined;\n\n for (var i = 0; i < array.length; i++) {\n var value = array[i];\n\n if (typeof value === 'number') {\n if (minimum === undefined || value < minimum) {\n minimum = value;\n }\n }\n }\n\n return minimum;\n} // function to return N given of items in an Array\n\nfunction first(array, n) {\n // if passed array is not an array, return empty array\n if (!Array.isArray(array) || n <= 0) {\n return [];\n } //if N number is bigger or equal slice up the entire thing\n\n\n if (n >= array.length) {\n return array.slice();\n } else {\n // otherwise return only N numbers of array items\n return array.slice(0, n);\n }\n}\nfunction isLater(value) {\n // Return true if today is after the value date\n var result = false;\n\n if (value && value instanceof Date) {\n result = new Date() > value;\n } else if (value) {\n result = new Date() > new Date(value);\n }\n\n return result;\n}\nfunction isObject(value) {\n return !!value && value.constructor === Object;\n}\nfunction findIndex(array, fn) {\n if (!Array.isArray(array) || !(typeof fn === 'function')) {\n return undefined;\n }\n\n for (var i = 0; i < array.length; i++) {\n var element = array[i];\n\n if (fn(element)) {\n return i;\n }\n }\n\n return undefined;\n}\nfunction escapeHtml(unsafe) {\n return unsafe.replace(/&/g, '&').replace(//g, '>').replace(/\"/g, '"').replace(/'/g, ''');\n}\n\n/***/ }),\n\n/***/ 15205:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ RecentlyViewedProductsBlock; }\n/* harmony export */ });\n/* harmony import */ var _home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49376);\n/* harmony import */ var _home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87794);\n/* harmony import */ var _home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(41539);\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(88674);\n/* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57327);\n/* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(21249);\n/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(39714);\n/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(47042);\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(69600);\n/* harmony import */ var core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(67294);\n/* harmony import */ var next_dynamic__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(5152);\n/* harmony import */ var next_dynamic__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(next_dynamic__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var _adapters_helpers_Block__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(40483);\n/* harmony import */ var _persistence_recentlyViewed__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(88755);\n/* harmony import */ var _adapters_helpers_Constants__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(24036);\n/* harmony import */ var react_waypoint__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(83824);\n/* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(94301);\n/* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(isomorphic_fetch__WEBPACK_IMPORTED_MODULE_15__);\n/* harmony import */ var _adapters_helpers_Loader__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(47322);\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(85893);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar Heading = next_dynamic__WEBPACK_IMPORTED_MODULE_10___default()(function () {\n return __webpack_require__.e(/* import() */ 2116).then(__webpack_require__.bind(__webpack_require__, 92116));\n}, {\n loadableGenerated: {\n webpack: function webpack() {\n return [/*require.resolve*/(92116)];\n }\n }\n});\nvar ProductsOverview = next_dynamic__WEBPACK_IMPORTED_MODULE_10___default()(function () {\n return __webpack_require__.e(/* import() */ 9899).then(__webpack_require__.bind(__webpack_require__, 79899));\n}, {\n loadableGenerated: {\n webpack: function webpack() {\n return [/*require.resolve*/(79899)];\n }\n }\n});\n\n\n\nfunction RecentlyViewedProductsBlock(props) {\n var _document$fields, _document$fields2, _document$fields2$see, _document$fields2$see2, _document$fields3, _document$fields3$see, _document$fields3$see2, _document$fields4;\n\n var standardizePath = (__webpack_require__(57646).standardizePath);\n\n var block = new _adapters_helpers_Block__WEBPACK_IMPORTED_MODULE_11__/* [\"default\"] */ .Z(props);\n var document = props.document,\n extraAttributes = props.extraAttributes;\n var productsToLoad = (0,react__WEBPACK_IMPORTED_MODULE_9__.useRef)((0,_persistence_recentlyViewed__WEBPACK_IMPORTED_MODULE_12__/* .getProducts */ .Xp)().map(function (_ref) {\n var id = _ref.id;\n return id;\n }).filter(function (id) {\n return id !== (extraAttributes == null ? void 0 : extraAttributes.slug);\n }));\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_9__.useState)(productsToLoad.current.map(function () {\n return undefined;\n })),\n products = _useState[0],\n setProducts = _useState[1];\n\n var _useState2 = (0,react__WEBPACK_IMPORTED_MODULE_9__.useState)(false),\n isShown = _useState2[0],\n setIsShown = _useState2[1];\n\n var anchorId = block.getAnchorId();\n var title = document == null ? void 0 : (_document$fields = document.fields) == null ? void 0 : _document$fields.title;\n var seeLessLabel = document == null ? void 0 : (_document$fields2 = document.fields) == null ? void 0 : (_document$fields2$see = _document$fields2.seeLessLabel) == null ? void 0 : (_document$fields2$see2 = _document$fields2$see.fields) == null ? void 0 : _document$fields2$see2.text;\n var seeMoreLabel = document == null ? void 0 : (_document$fields3 = document.fields) == null ? void 0 : (_document$fields3$see = _document$fields3.seeMoreLabel) == null ? void 0 : (_document$fields3$see2 = _document$fields3$see.fields) == null ? void 0 : _document$fields3$see2.text;\n\n var _handleWaypointEnter = function _handleWaypointEnter() {\n // Trigger by waypoint enter\n setIsShown(true);\n };\n\n var propsClassnames = document == null ? void 0 : (_document$fields4 = document.fields) == null ? void 0 : _document$fields4.classNames;\n var classNames = (0,react__WEBPACK_IMPORTED_MODULE_9__.useMemo)(function () {\n var _classNames = ['ob-recently-viewed-block'];\n\n if (propsClassnames) {\n _classNames.push(propsClassnames);\n }\n\n if (isShown) {\n _classNames.push(_adapters_helpers_Constants__WEBPACK_IMPORTED_MODULE_13__/* .RecentlyViewedProductsBlockConstants.show */ .dx.show);\n }\n\n return _classNames;\n }, [propsClassnames, isShown]);\n (0,react__WEBPACK_IMPORTED_MODULE_9__.useEffect)(function () {\n if (isShown) {\n var _loop = function _loop(i) {\n var productId = productsToLoad.current[i];\n\n _home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0___default()( /*#__PURE__*/_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_1___default().mark(function _callee() {\n var loadedProduct;\n return _home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_1___default().wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n _context.next = 3;\n return fetch(_adapters_helpers_Constants__WEBPACK_IMPORTED_MODULE_13__/* .RecentlyViewedProductsBlockConstants.fetch */ .dx.fetch + btoa(standardizePath(productId)) + _adapters_helpers_Constants__WEBPACK_IMPORTED_MODULE_13__/* .RecentlyViewedProductsBlockConstants.json */ .dx.json).then(function (response) {\n var statusCategory = response.status.toString()[0];\n\n if (statusCategory === _adapters_helpers_Constants__WEBPACK_IMPORTED_MODULE_13__/* .RecentlyViewedProductsBlockConstants.four */ .dx.four) {\n (0,_persistence_recentlyViewed__WEBPACK_IMPORTED_MODULE_12__/* .removeProduct */ .kh)(productId);\n }\n\n return response;\n });\n\n case 3:\n _context.next = 5;\n return _context.sent.json();\n\n case 5:\n loadedProduct = _context.sent;\n setProducts(function (prevState) {\n var products = prevState.slice();\n products[i] = loadedProduct;\n return products;\n });\n _context.next = 11;\n break;\n\n case 9:\n _context.prev = 9;\n _context.t0 = _context[\"catch\"](0);\n\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0, 9]]);\n }))();\n };\n\n for (var i = 0; i < productsToLoad.current.length; i++) {\n _loop(i);\n }\n }\n }, [isShown]);\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(react__WEBPACK_IMPORTED_MODULE_9__.Suspense, {\n fallback: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_adapters_helpers_Loader__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {}),\n children: products.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(\"div\", {\n className: classNames.join(' '),\n id: anchorId,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsxs)(\"div\", {\n className: \"ob-recently-viewed-block-wrapper\",\n children: [!!title && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(Heading, {\n tag: _adapters_helpers_Constants__WEBPACK_IMPORTED_MODULE_13__/* .RecentlyViewedProductsBlockConstants.titleLevel */ .dx.titleLevel,\n className: \"ob-recently-viewed-block__heading\",\n children: title\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(\"div\", {\n className: \"ob-recently-viewed-block__product-grid-wrapper\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsxs)(react__WEBPACK_IMPORTED_MODULE_9__.Suspense, {\n fallback: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(_adapters_helpers_Loader__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {}),\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(react_waypoint__WEBPACK_IMPORTED_MODULE_14__/* .Waypoint */ .h, {\n onEnter: _handleWaypointEnter\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__.jsx)(ProductsOverview, {\n seeMoreProductsText: seeMoreLabel,\n seeLessProductsText: seeLessLabel,\n products: products,\n isRecentlyViewed: true,\n isCarrousel: true,\n onClickCallback: props.onClickCallback\n })]\n })\n })]\n })\n })\n });\n}\n\n/***/ }),\n\n/***/ 77005:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"A6\": function() { return /* binding */ localStorageSetItem; },\n/* harmony export */ \"GQ\": function() { return /* binding */ localStorageGetItem; },\n/* harmony export */ \"dA\": function() { return /* binding */ LOCAL_STORAGE_KEYS; },\n/* harmony export */ \"q\": function() { return /* binding */ localStorageRemoveItem; }\n/* harmony export */ });\nvar LOCAL_STORAGE_KEYS = {\n RECENTLY_VIEWED_PRODUCTS: 'RECENTLY_VIEWED_PRODUCTS'\n};\nfunction localStorageRemoveItem(item) {\n return localStorage.removeItem(item);\n}\nfunction localStorageGetItem(item) {\n return localStorage.getItem(item);\n}\nfunction localStorageSetItem(item, itemType) {\n return localStorage.setItem(item, itemType);\n}\n\n\n/***/ }),\n\n/***/ 88755:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"OS\": function() { return /* binding */ setViewed; },\n/* harmony export */ \"Xp\": function() { return /* binding */ getProducts; },\n/* harmony export */ \"kh\": function() { return /* binding */ removeProduct; }\n/* harmony export */ });\n/* harmony import */ var _home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7980);\n/* harmony import */ var _home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57327);\n/* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(41539);\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(47042);\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(40561);\n/* harmony import */ var core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(92222);\n/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _localStorage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77005);\n/* harmony import */ var _adapters_helpers_functions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(61986);\n/* harmony import */ var _adapters_helpers_Utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(8996);\n\n\n\n\n\n\n\n\n\nvar PRODUCT_PERSISTENCE_LIFESPAN_MILLISECONDS = 30 * 24 * 60 * 60 * 1000;\n\nfunction findProductIndex(products, id) {\n for (var i = 0; i < products.length; i++) {\n var product = products[i];\n\n if (product.id === id) {\n return i;\n }\n }\n\n return undefined;\n}\n\nfunction filterExpiredProducts(products) {\n return products.filter(function (_ref) {\n var expiral = _ref.expiral;\n return new Date(expiral).getTime() > new Date().getTime();\n });\n} // TODO: Remove in prod (Used for data consistency between changes)\n\n\nfunction isProductsDataValid(products) {\n if (!Array.isArray(products)) {\n return false;\n }\n\n for (var i = 0; i < products.length; i++) {\n var product = products[i];\n\n if (!product) {\n return false;\n }\n\n if (!product.hasOwnProperty('id')) {\n return false;\n }\n\n if (!product.hasOwnProperty('expiral')) {\n return false;\n }\n\n if (!(typeof product.id === 'string')) {\n return false;\n }\n\n if (!(typeof product.expiral === 'number')) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction setViewed(id) {\n if (typeof localStorage !== 'undefined' && localStorage.setItem) {\n var products = getProducts(); // Remove already viewed product\n\n var productsWithoutCurrentProduct = products.slice();\n var currentProductIndex = findProductIndex(products, id);\n\n if (currentProductIndex !== undefined) {\n productsWithoutCurrentProduct.splice(currentProductIndex, 1);\n } // Filter expirered products\n\n\n var expiralFilteredProduct = filterExpiredProducts(productsWithoutCurrentProduct); // Add id to first place\n\n var nextProducts = (0,_adapters_helpers_functions__WEBPACK_IMPORTED_MODULE_7__/* .first */ .Ps)([{\n id: id,\n expiral: new Date().getTime() + PRODUCT_PERSISTENCE_LIFESPAN_MILLISECONDS\n }].concat(_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0___default()(expiralFilteredProduct)), 3);\n localStorage.setItem(_localStorage__WEBPACK_IMPORTED_MODULE_6__/* .LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS */ .dA.RECENTLY_VIEWED_PRODUCTS, (0,_adapters_helpers_Utils__WEBPACK_IMPORTED_MODULE_8__/* .customSuperJsonStringify */ .hD)(nextProducts));\n }\n}\nfunction getProducts() {\n if (typeof localStorage !== 'undefined' && localStorage.getItem) {\n var json = localStorage.getItem(_localStorage__WEBPACK_IMPORTED_MODULE_6__/* .LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS */ .dA.RECENTLY_VIEWED_PRODUCTS);\n\n if (json !== null) {\n try {\n var products = (0,_adapters_helpers_Utils__WEBPACK_IMPORTED_MODULE_8__/* .customSuperJsonParse */ .Cp)(json); // TODO: Remove in prod\n\n if (!isProductsDataValid(products)) {\n return [];\n }\n\n return filterExpiredProducts(products);\n } catch (_e) {// Do nothing or log error\n }\n }\n }\n\n return [];\n}\nfunction removeProduct(id) {\n if (typeof localStorage !== 'undefined' && localStorage.setItem) {\n var products = getProducts(); // Remove product\n\n var productsWithoutCurrentProduct = products.slice();\n var currentProductIndex = findProductIndex(products, id);\n\n if (currentProductIndex !== undefined) {\n productsWithoutCurrentProduct.splice(currentProductIndex, 1);\n } // Filter expirered products\n\n\n var expiralFilteredProduct = filterExpiredProducts(productsWithoutCurrentProduct);\n localStorage.setItem(_localStorage__WEBPACK_IMPORTED_MODULE_6__/* .LOCAL_STORAGE_KEYS.RECENTLY_VIEWED_PRODUCTS */ .dA.RECENTLY_VIEWED_PRODUCTS, (0,_adapters_helpers_Utils__WEBPACK_IMPORTED_MODULE_8__/* .customSuperJsonStringify */ .hD)(expiralFilteredProduct));\n }\n}\n\n/***/ }),\n\n/***/ 66477:\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n/* globals self */ exports.Headers = self.Headers;\nexports.Request = self.Request;\nexports.Response = self.Response;\nexports.fetch = self.fetch;\n\n//# sourceMappingURL=whatwg-fetch.js.map\n\n/***/ })\n\n}]);"],"names":["self","push","module","__unused_webpack_exports","__webpack_require__","isObject","floor","Math","exports","it","isFinite","__unused_webpack_module","$","target","stat","isInteger","fetch","bind","customJsonstringify","str","JSON","stringify","replace","char","standardizePath","path","__webpack_exports__","chunk","items","size","Array","isArray","length","Number","chunks","i","minimum","array","undefined","value","first","n","slice","isLater","result","Date","constructor","Object","findIndex","fn","escapeHtml","unsafe","d","r","RecentlyViewedProductsBlock","_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__","_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0___default","_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_1__","_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_regenerator_index_js__WEBPACK_IMPORTED_MODULE_1___default","react__WEBPACK_IMPORTED_MODULE_9__","next_dynamic__WEBPACK_IMPORTED_MODULE_10__","next_dynamic__WEBPACK_IMPORTED_MODULE_10___default","_adapters_helpers_Block__WEBPACK_IMPORTED_MODULE_11__","_persistence_recentlyViewed__WEBPACK_IMPORTED_MODULE_12__","_adapters_helpers_Constants__WEBPACK_IMPORTED_MODULE_13__","react_waypoint__WEBPACK_IMPORTED_MODULE_14__","_adapters_helpers_Loader__WEBPACK_IMPORTED_MODULE_16__","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_17__","Heading","e","then","loadableGenerated","webpack","ProductsOverview","props","_document$fields","_document$fields2","_document$fields2$see","_document$fields2$see2","_document$fields3","_document$fields3$see","_document$fields3$see2","_document$fields4","block","Z","document","extraAttributes","productsToLoad","useRef","Xp","map","_ref","id","filter","slug","_useState","useState","current","products","setProducts","_useState2","isShown","setIsShown","anchorId","getAnchorId","title","fields","seeLessLabel","text","seeMoreLabel","propsClassnames","classNames","useMemo","_classNames","dx","show","useEffect","_loop","productId","mark","_callee","loadedProduct","wrap","_context","prev","next","btoa","json","response","status","toString","four","kh","sent","prevState","t0","stop","jsx","Suspense","fallback","children","className","join","jsxs","tag","titleLevel","h","onEnter","seeMoreProductsText","seeLessProductsText","isRecentlyViewed","isCarrousel","onClickCallback","localStorageSetItem","localStorageGetItem","LOCAL_STORAGE_KEYS","localStorageRemoveItem","RECENTLY_VIEWED_PRODUCTS","item","localStorage","removeItem","getItem","itemType","setItem","setViewed","getProducts","removeProduct","_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0__","_home_runner_work_mw_mt_oralb_com_cs_cz_mw_mt_oralb_com_cs_cz_node_modules_next_dist_compiled_babel_runtime_helpers_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_0___default","_localStorage__WEBPACK_IMPORTED_MODULE_6__","_adapters_helpers_functions__WEBPACK_IMPORTED_MODULE_7__","_adapters_helpers_Utils__WEBPACK_IMPORTED_MODULE_8__","findProductIndex","product","filterExpiredProducts","expiral","getTime","productsWithoutCurrentProduct","currentProductIndex","splice","expiralFilteredProduct","nextProducts","Ps","concat","dA","hD","Cp","isProductsDataValid","hasOwnProperty","_e","Headers","Request","Response"],"sourceRoot":""}