{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_custom_basicfit/cartridge/client/default/js/personalTrainerPhysio.js"],"names":["maxNumberOfTiles","currentPage","personalTrainerPhysio","tiles","$","length","addClass","searchParams","URLSearchParams","window","location","search","page","get","parseInt","hide","applyFilter","selectedGender","val","selectedAmbition","totalNumOfMatches","numOfShown","each","_","t","tile","show","gender","data","ambition","indexOf","setDropdownFilter","change","updatePath","currentPath","URL","href","set","history","pushState","document","title","loadMoreTiles","on","e","preventDefault","init","slice"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA,GAAI,CAAAA,gBAAgB,CAAG,EAAE,CACzB,GAAI,CAAAC,WAAW,CAAG,CAAC,CAEnB,KAAM,CAAAC,qBAAqB,CAAG,CAAC,IAAM,CACjC,KAAM,CAAAC,KAAK,CAAGC,CAAC,CAAC,kBAAkB,CAAC,CAEnC,GAAIA,CAAC,CAAC,yBAAyB,CAAC,CAACC,MAAM,EAAI,CAAC,CAAE,CAC1CD,CAAC,CAAC,2BAA2B,CAAC,CAACE,QAAQ,CAAC,UAAU,CAAC,CACvD,CACA,GAAIF,CAAC,CAAC,2BAA2B,CAA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AAC,CAACC,cAAc,CAAC,CAAC,CAClB7C,gBAAgB,EAAI,EAAE,CACtBC,WAAW,EAAI,CAAC,CAChBe,WAAW,CAAC,CAAC,CACbiB,UAAU,CAAC,CAAC,CAChB,CAAC,CAAC,CACN,CAAC,CAED,MAAO,CACHa,IAAIA,CAAA,CAAG,CACH1C,CAAC,CAAC,kBAAkB,CAAC,CAAC2C,KAAK,CAAC,CAAC,CAAE/C,gBAAgB,CAAC,CAAC0B,IAAI,CAAC,CAAC,CACvDgB,aAAa,CAAC,CAAC,CACfX,iBAAiB,CAAC,CAAC,CACvB,CACJ,CAAC,CACL,CAAC,EAAE,CAAC,CAEW,gEAAC,IAAM,CAClB3B,CAAC,CAACF,qBAAqB,CAAC4C,IAAI,CAAC,CACjC,CAAC,EAAE,CAAC,E","file":"default/js/personalTrainerPhysio.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/app_custom_basicfit/cartridge/client/default/js/personalTrainerPhysio.js\");\n","let maxNumberOfTiles = 16;\nlet currentPage = 1;\n\nconst personalTrainerPhysio = (() => {\n const tiles = $('.js-trainer-tile');\n\n if ($('#select-gender > option').length <= 2) {\n $('.select-gender__container').addClass('disabled');\n }\n if ($('#select-ambition > option').length <= 1) {\n $('.select-ambition__container').addClass('disabled');\n }\n\n // set current page\n const searchParams = new URLSearchParams(window.location.search);\n const page = searchParams.get('page');\n\n if (page) {\n currentPage = parseInt(page, 10) ? parseInt(page, 10) : 1;\n maxNumberOfTiles *= currentPage;\n }\n\n if (tiles.length < maxNumberOfTiles) {\n $('#loadMore').hide();\n }\n\n\n const applyFilter = () => {\n const selectedGender = $('#select-gender option:selected').val();\n const selectedAmbition = $('#select-ambition option:selected').val();\n\n tiles.hide();\n\n let totalNumOfMatches = 0;\n let numOfShown = 0;\n $.each(tiles, (_, t) => {\n const tile = $(t);\n let show = false;\n\n const gender = tile.data('gender');\n show = (selectedGender === gender || !selectedGender || selectedGender === 'all');\n\n const ambition = tile.data('ambition');\n show = show && (ambition.indexOf(selectedAmbition) > -1 || !selectedAmbition || selectedAmbition === 'all');\n\n if (show) {\n totalNumOfMatches++;\n if (numOfShown < maxNumberOfTiles) {\n tile.show();\n numOfShown++;\n }\n }\n });\n\n if (numOfShown < totalNumOfMatches) {\n $('#loadMore').show();\n } else {\n $('#loadMore').hide();\n }\n };\n\n const setDropdownFilter = () => {\n $('#select-ambition, #select-gender').change(() => {\n maxNumberOfTiles = 16;\n applyFilter();\n });\n };\n\n const updatePath = () => {\n const currentPath = new URL(window.location.href);\n currentPath.searchParams.set('page', currentPage);\n window.history.pushState({}, document.title, currentPath);\n };\n\n const loadMoreTiles = () => {\n $('#loadMore').on('click', (e) => {\n e.preventDefault();\n maxNumberOfTiles += 16;\n currentPage += 1;\n applyFilter();\n updatePath();\n });\n };\n\n return {\n init() {\n $('.js-trainer-tile').slice(0, maxNumberOfTiles).show();\n loadMoreTiles();\n setDropdownFilter();\n },\n };\n})();\n\nexport default (() => {\n $(personalTrainerPhysio.init);\n})();\n"],"sourceRoot":""}