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ADlB,OALArB,GAAAA,EACAoB,EAAAA,UASJtB,EAAAA,SAAsBjD,IACbA,EAAL,WAEJmD,GAAAA,EACAoB,EAAAA,OAAAA,MACU,IAAMrB,EADhBqB,IAAAA,OAEYlG,GAAMmG,QAAAA,MAFlBD,UAsBR,MAAME,EAAqB/F,SAAAA,cAA3B,yBACMgG,EAAmBhG,SAAAA,cAAzB,uBACIgG,MAAAA,GAAJ,MAAgCD,GAC5B5F,OAAAA,iBAAAA,oBAA4C,KACxC,MACM8F,EADiBC,iBAAvB,GACqBC,iBAArB,WACIF,UAAAA,GAAJ,iBAAgCA,EAC5BD,EAAAA,UAAAA,IAAAA,UAGAA,EAAAA,UAAAA,OAAAA,e","sources":["webpack://sage/./resources/scripts/app.ts"],"sourcesContent":["\"use strict\";\n/**\n * External Dependencies\n */\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\n/**\n * NAV\n */\n// Grab HTML Elements\nconst body = document.body;\nconst hamburger = document.querySelector('button.nav-hamburger');\nlet wpkTimeOut;\nwindow.addEventListener('resize', () => {\n    body.classList.add('resize');\n    if (!wpkTimeOut) {\n        wpkTimeOut = setTimeout(function () {\n            body.classList.remove('resize');\n            wpkTimeOut = null;\n        }, 500);\n    }\n}, { passive: true });\n// Add Event Listeners\nhamburger === null || hamburger === void 0 ? void 0 : hamburger.addEventListener('click', () => {\n    body.classList.toggle('open');\n});\n/**\n* BUY NOW BUTTON\n*/\nconst observer = new IntersectionObserver(([e]) => {\n    e.target.classList.toggle('stuck', e.intersectionRatio < 1);\n    if (e.boundingClientRect.top < 0) {\n        e.target.classList.remove('stuck'); //Remove class when button is above viewport\n    }\n}, { threshold: [1] });\nconst sticky = document.querySelector('#woocommerce.single div.buy-now');\nsticky ? observer.observe(sticky) : false;\n/**\n* HEADER NAV\n*/\nconst headerNavButtons = document.querySelectorAll('nav#nav-main li.menu-item-has-children > a');\nheaderNavButtons.forEach((button) => {\n    button.addEventListener('click', (event) => {\n        const target = event.target;\n        if (target.className === 'dropdown') {\n            event.preventDefault();\n            button.classList.toggle('active');\n        }\n    });\n});\n/**\n* FOOTER NAV\n*/\nconst footerNavButtons = document.querySelectorAll('footer .widget_nav_menu');\nfooterNavButtons.forEach((button) => {\n    button.addEventListener('click', () => {\n        button.classList.toggle('active');\n    });\n});\n/**\n* VIDEO BLOCK\n*/\nconst videos = document.querySelectorAll('.wp-block-karopharma-video');\nvideos.forEach((video) => {\n    const trigger = video.querySelector('.video-trigger');\n    trigger && trigger.addEventListener('click', () => {\n        const iframe = video.querySelector('iframe');\n        const img = video.querySelector('picture');\n        if (iframe != null && typeof iframe.getAttribute == 'function' && iframe.getAttribute('data-src') != null && typeof iframe.getAttribute('data-src') == 'string') {\n            iframe.setAttribute('src', iframe.getAttribute('data-src') || '');\n        }\n        trigger.remove();\n        img && img.remove();\n    });\n});\n/**\n* Find out if element is in viewport\n*/\nfunction isElementInViewport(el) {\n    const rect = el.getBoundingClientRect();\n    return (rect.top >= 0 &&\n        rect.left >= 0 &&\n        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\n        rect.right <= (window.innerWidth || document.documentElement.clientWidth));\n}\n/**\n* Remove lazy load on images in viewport\n*/\nconst lazyImages = document.querySelectorAll('main img');\nif (lazyImages) {\n    lazyImages.forEach(lazyImage => {\n        const visible = isElementInViewport(lazyImage);\n        if (visible === true) {\n            lazyImage.loading = 'eager';\n        }\n    });\n}\n/**\n* Style footer navs\n*/\nconst footerNavs = document.querySelectorAll('#footer-main .post-nav-list, #footer-main .menu-nav-list');\nif (footerNavs) {\n    footerNavs.forEach((footerNav, index) => {\n        var _a;\n        if (index === 0)\n            return;\n        (_a = footerNav.parentElement) === null || _a === void 0 ? void 0 : _a.classList.add('widget_block_nav_list');\n    });\n}\n/**\n* Set HCP modal cookie\n*/\nconst karoModal = document.getElementById('karo-modal');\nif (karoModal != null) {\n    document.cookie.indexOf('karo_hcp') == -1 ? karoModal.style.display = 'block' : karoModal.remove(); //Run JS double check because of CloudFlare chache on php file\n    karoModal === null || karoModal === void 0 ? void 0 : karoModal.addEventListener('click', (event) => {\n        var _a;\n        if (((_a = event.target) === null || _a === void 0 ? void 0 : _a.id) === 'karo-hcp-true') {\n            if (karoModal.dataset.type === 'page') {\n                document.cookie = 'karo_hcp=true; path=' + window.location.href + '; SameSite=Strict;'; //No expire = session cookie\n            }\n            else {\n                document.cookie = 'karo_hcp=true; path=/; SameSite=Strict;'; //No expire = session cookie\n            }\n            karoModal.remove();\n        }\n    });\n}\n/**\n* Plikttext\n*/\nconst karoPlikttext = document.getElementById('plikttext');\nconst karoPlikttextLabel = karoPlikttext === null || karoPlikttext === void 0 ? void 0 : karoPlikttext.querySelector('#plikttext-checkbox_label');\nconst karoPlikttextCheckbox = karoPlikttext === null || karoPlikttext === void 0 ? void 0 : karoPlikttext.querySelector('#plikttext-checkbox');\nconst karoPlikttextDescription = karoPlikttext === null || karoPlikttext === void 0 ? void 0 : karoPlikttext.querySelector('#plikttext-description');\nconst plikttextPlus = karoPlikttext === null || karoPlikttext === void 0 ? void 0 : karoPlikttext.querySelector(\"#plikttext-checkbox_label .fa-plus\");\nconst plikttextMinus = karoPlikttext === null || karoPlikttext === void 0 ? void 0 : karoPlikttext.querySelector(\"#plikttext-checkbox_label .fa-minus\");\nkaroPlikttextLabel === null || karoPlikttextLabel === void 0 ? void 0 : karoPlikttextLabel.addEventListener('click', () => {\n    const checkboxValue = karoPlikttextCheckbox.checked === false ? true : false;\n    sessionStorage.setItem('plikttext', new Boolean(checkboxValue).toString());\n    karoPlikttextDescription === null || karoPlikttextDescription === void 0 ? void 0 : karoPlikttextDescription.classList.toggle('hidden');\n    plikttextPlus === null || plikttextPlus === void 0 ? void 0 : plikttextPlus.classList.toggle('hidden');\n    plikttextMinus === null || plikttextMinus === void 0 ? void 0 : plikttextMinus.classList.toggle('hidden');\n});\nconst plikttextValue = sessionStorage.getItem('plikttext');\nif (plikttextValue !== null && plikttextValue == 'false') {\n    karoPlikttextCheckbox.checked = false;\n    plikttextPlus === null || plikttextPlus === void 0 ? void 0 : plikttextPlus.classList.remove('hidden');\n    plikttextMinus === null || plikttextMinus === void 0 ? void 0 : plikttextMinus.classList.add('hidden');\n    karoPlikttextDescription === null || karoPlikttextDescription === void 0 ? void 0 : karoPlikttextDescription.classList.add('hidden');\n}\nconst printMaterialForm = document.querySelector('.print-material-container');\nconst sendMaterialRequestEmail = () => __awaiter(void 0, void 0, void 0, function* () {\n    const mailDetails = getMailDetails();\n    if (mailDetails) {\n        const result = yield fetch(\"/wp-admin/admin-ajax.php?action=print_material_form_send\", {\n            method: 'POST',\n            body: JSON.stringify(getMailDetails()),\n            headers: {\n                \"Content-Type\": \"application/json\",\n            },\n        });\n        return yield result.json()\n            .then(data => data);\n    }\n    else {\n        throw new Error(\"Validation error\");\n    }\n});\nif (printMaterialForm) {\n    const submitButton = printMaterialForm.querySelector('.print-material_order-form_submit');\n    submitButton === null || submitButton === void 0 ? void 0 : submitButton.addEventListener('click', () => {\n        sendMaterialRequestEmail().then(result => {\n            var _a, _b, _c, _d;\n            if (result.success) {\n                (_a = printMaterialForm.querySelector('#print-material_order-form_message-success')) === null || _a === void 0 ? void 0 : _a.classList.remove('hidden');\n                (_b = printMaterialForm.querySelector('#print-material_order-form_message-error')) === null || _b === void 0 ? void 0 : _b.classList.add('hidden');\n            }\n            else {\n                (_c = printMaterialForm.querySelector('#print-material_order-form_message-success')) === null || _c === void 0 ? void 0 : _c.classList.add('hidden');\n                (_d = printMaterialForm.querySelector('#print-material_order-form_message-error')) === null || _d === void 0 ? void 0 : _d.classList.remove('hidden');\n            }\n        }).catch(() => {\n            var _a, _b;\n            (_a = printMaterialForm.querySelector('#print-material_order-form_message-success')) === null || _a === void 0 ? void 0 : _a.classList.add('hidden');\n            (_b = printMaterialForm.querySelector('#print-material_order-form_message-error')) === null || _b === void 0 ? void 0 : _b.classList.remove('hidden');\n        });\n    });\n}\nconst getMailDetails = () => {\n    let valid = true;\n    const body = {\n        name: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print-material_order-form_name')).value,\n        email: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print-material_order-form_email')).value,\n        employer: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print-material_order-form_employer')).value,\n        adress: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print-material_order-form_address')).value,\n        zipcode: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print-material_order-form_zipcode')).value,\n        city: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print-material_order-form_city')).value,\n        nonce: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print_material_form_nonce_field')).value,\n        r: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print-material_order-form_r')).value,\n        s: (printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelector('#print-material_order-form_s')).value,\n        material: [],\n    };\n    const materialBlocks = printMaterialForm === null || printMaterialForm === void 0 ? void 0 : printMaterialForm.querySelectorAll('.print-material-block');\n    materialBlocks === null || materialBlocks === void 0 ? void 0 : materialBlocks.forEach(el => {\n        var _a, _b;\n        const select = el.querySelector('select');\n        if (select) {\n            const materialBlock = {\n                amount: select.options[select.selectedIndex].value,\n                title: (_b = (_a = el.querySelector('.print-material-title')) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : '',\n            };\n            body.material.push(materialBlock);\n        }\n    });\n    // Validates that the form is filled out\n    for (const [key, value] of Object.entries(body)) {\n        if (!value) {\n            valid = false;\n            throw new Error(`${key} is required `);\n        }\n    }\n    if (valid) {\n        return body;\n    }\n    else {\n        return null;\n    }\n};\n/**\n * Sound block functions\n */\nconst audioPlayers = document.querySelectorAll('.sound-block-player');\nlet currentlyPlayingAudioPlayer;\nlet soundBlocksPaused = true;\nconst getTimerText = (timerLength) => {\n    const minutes = Math.floor(timerLength / 60);\n    const seconds = timerLength % 60;\n    function str_pad_left(string, pad, length) {\n        return (new Array(Number(length) + 1).join(String(pad)) + string).slice(-length);\n    }\n    return (str_pad_left(String(minutes), '0', 2) + ':' + str_pad_left(String(seconds), '0', 2));\n};\nconst createSoundsBlockInterval = () => {\n    const soundsTimer = document.querySelector('#sounds-timer');\n    const timerCompletionText = document.querySelector('#sounds-completed');\n    if (soundsTimer) {\n        const timerLength = Number(soundsTimer.getAttribute('data-timer-length'));\n        let newTimerLength = timerLength;\n        const soundBlocksTimer = setInterval(() => {\n            var _a;\n            if (newTimerLength <= 0) {\n                clearInterval(soundBlocksTimer);\n                soundsTimer.innerHTML = (_a = timerCompletionText === null || timerCompletionText === void 0 ? void 0 : timerCompletionText.innerHTML) !== null && _a !== void 0 ? _a : \"Completed\";\n            }\n            else {\n                soundsTimer.innerHTML = getTimerText(newTimerLength);\n            }\n            if (!soundBlocksPaused) {\n                newTimerLength -= 1;\n            }\n        }, 1000);\n        return soundBlocksTimer;\n    }\n};\nconst playAudio = (player) => {\n    // Checks if the used is pausing the actively playing\n    // music or starts a different audio player\n    if (player === currentlyPlayingAudioPlayer) {\n        if (!player.paused) {\n            soundBlocksPaused = true;\n            player.pause();\n        }\n        else {\n            soundBlocksPaused = false;\n            void player.play()\n                .catch((e) => console.error(e));\n        }\n    }\n    else {\n        audioPlayers.forEach((el) => {\n            void el.pause();\n        });\n        soundBlocksPaused = false;\n        player.play()\n            .then(() => currentlyPlayingAudioPlayer = player)\n            .catch((e) => console.error(e));\n    }\n};\n/**\n * Sound block\n */\nif (audioPlayers) {\n    // Generates a timer\n    createSoundsBlockInterval();\n    for (let i = 0; i < audioPlayers.length; i++) {\n        const audioPlayer = audioPlayers[i];\n        const playButton = audioPlayers[i].nextElementSibling;\n        if (playButton) {\n            playButton.addEventListener('click', () => playAudio(audioPlayer));\n        }\n    }\n}\n/**\n* Hide default pwd template\n*/\nconst modalPasswordBlock = document.querySelector('.modal-password-block');\nconst postPasswordForm = document.querySelector('.post-password-form');\nif (postPasswordForm != null && modalPasswordBlock != null) {\n    window.addEventListener('DOMContentLoaded', () => {\n        const computedStyles = getComputedStyle(modalPasswordBlock);\n        const displayValue = computedStyles.getPropertyValue('display');\n        if (displayValue === 'block' || displayValue === 'inline-block') {\n            postPasswordForm.classList.add('hidden');\n        }\n        else {\n            postPasswordForm.classList.remove('hidden');\n        }\n    });\n}\n"],"names":["__awaiter","this","thisArg","_arguments","P","generator","resolve","reject","step","e","result","adopt","value","body","document","hamburger","wpkTimeOut","window","setTimeout","passive","observer","IntersectionObserver","threshold","sticky","headerNavButtons","button","event","target","footerNavButtons","videos","video","trigger","iframe","img","lazyImages","lazyImage","el","rect","isElementInViewport","footerNavs","footerNav","index","_a","karoModal","karoPlikttext","karoPlikttextLabel","karoPlikttextCheckbox","karoPlikttextDescription","plikttextPlus","plikttextMinus","checkboxValue","sessionStorage","Boolean","plikttextValue","printMaterialForm","submitButton","getMailDetails","fetch","method","JSON","headers","data","Error","sendMaterialRequestEmail","_b","_c","_d","valid","name","email","employer","adress","zipcode","city","nonce","r","s","material","materialBlocks","select","materialBlock","amount","title","key","Object","audioPlayers","currentlyPlayingAudioPlayer","soundBlocksPaused","soundsTimer","timerCompletionText","newTimerLength","Number","soundBlocksTimer","setInterval","clearInterval","timerLength","minutes","Math","seconds","Array","String","str_pad_left","getTimerText","createSoundsBlockInterval","i","audioPlayer","playButton","player","console","modalPasswordBlock","postPasswordForm","displayValue","getComputedStyle","computedStyles"],"sourceRoot":""}