{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:////app/vapid/www/assets/scripts/site.pack.js"],"names":[],"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;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA,0BAA0B,aAAa;AACvC,yCAAyC,WAAW;AACpD;AACA;AACA;;AAEA;AACA;AACA;AACA,0BAA0B,uBAAuB;AACjD,uBAAuB,cAAc;AACrC;AACA;;AAEA;AACA;AACA;AACA,wBAAwB;AACxB,SAAS;AACT;AACA;AACA,4BAA4B;AAC5B;AACA,SAAS;AACT,yBAAyB;AACzB;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK,EAAE;;;AAGP;;AAEA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK,EAAE;;;AAGP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK,EAAE;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK,EAAE;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,CAAC","file":"assets/scripts/site.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 = 0);\n","'use strict';\r\n\r\n// This is a main JavaScript file that will ll be compiled into /javascripts/site.js\r\n//\r\n// Any JavaScript file in your site folder can be referenced here by using import or require statements.\r\n// Additionally, you can import modules installed via your package.json file.\r\n//\r\n// For example:\r\n// import './fileName'\r\n//\r\n// To learn more, visit https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import\r\n\r\n$(function () {\r\n /// navigation ///\r\n var $breakpoint = 992;\r\n var $trigger = $('#menu_trigger');\r\n var $menu = $('#menu');\r\n var $wrapper = $('#page_wrapper');\r\n var $menuHeight = 0;\r\n var $submenu = $('#sub_menu');\r\n var $dropdown = $('#menu_dropdown');\r\n var $triggerRight = 5;\r\n\r\n var courseUrl = window.location.host == 'justathought.co.nz' ? 'https://course.justathought.co.nz' : 'https://course.justathought.co.nz';\r\n var redirectUrl = window.location.host == 'justathought.co.nz' ? 'https://www.justathought.co.nz' : 'https://www.justathought.co.nz';\r\n var redirects = new Map([\r\n // ['/login' , '/users/login'],\r\n ['/register', '/users/patientRegistration?site=' + redirectUrl], ['/register-clinician', '/users/clinicianRegistration?site=' + redirectUrl + '/clinicians']]);\r\n\r\n // -----------\r\n // Debug mode\r\n // If debug is set to true in json, redirect all traffic to /maintenance\r\n // Add ?debug to url to locally disable maintenance redirect\r\n // -----------\r\n\r\n /* Disabled: breaks on safari 1\r\n var urlParams = new URLSearchParams(window.location.search);\r\n var d = { 'debug': urlParams.get('debug') };\r\n var debugMode = (d.debug !== null )? true : false;\r\n $.getJSON(\"maintenance.json\", function(json) {\r\n if(json.maintenance && !debugMode) {\r\n window.location = '/maintenance';\r\n }\r\n // console.log(json.maintenance, 'debugMode', debugMode);\r\n });\r\n // Add '?debug' to all links to keep it in debug mode\r\n if(debugMode){\r\n $(\"a\").attr('href', function(i, h) {\r\n return h + \"?debug\";\r\n });\r\n }\r\n */\r\n\r\n // -----------\r\n // Redirects to course site\r\n // -----------\r\n /*\r\n function setRedirects(){\r\n const currentPathname = window.location.pathname;\r\n let needToRedirect = false;\r\n\r\n // check if pathname is in the redirectds array, then redirect the page\r\n for (let [pathname, redirectPathname] of redirects) {\r\n if(currentPathname === pathname){\r\n const redirectUrl = new URL(redirects.get(currentPathname), courseUrl);\r\n window.location = redirectUrl.href;\r\n }\r\n }\r\n }\r\n\r\n setRedirects();\r\n */\r\n if ($(window).width() < $breakpoint && $(window).width() >= 768) {\r\n $triggerRight = ($(window).width() - 750) / 2 + 5;\r\n } else {\r\n $triggerRight = 5;\r\n }\r\n\r\n $trigger.css('right', $triggerRight);\r\n\r\n function openMenu() {\r\n $trigger.addClass('is-open').removeClass('is-closed');\r\n $trigger.animate({ right: 260 }, 100);\r\n $menu.show().delay(200).animate({ right: 0 }, 400);\r\n $menuHeight = $menu.outerHeight();\r\n $wrapper.addClass('hide-overflow').height($menuHeight);\r\n }\r\n\r\n function closeMenu() {\r\n $trigger.removeClass('is-open').addClass('is-closed');\r\n $trigger.removeAttr('style');\r\n $trigger.animate({ right: $triggerRight }, 100);\r\n $menu.animate({ right: -260 }, 200).delay(200).hide(100);\r\n $wrapper.removeClass('hide-overflow').height('auto');\r\n }\r\n\r\n //Click or Enter key or Space key click for use with a 'click keydown' event listener\r\n function accessebilityClick(event){\r\n if(event.type === 'click'){\r\n return true; //if the event was a click return true, all clicks should trigger\r\n }else if(event.type === 'keypress'){\r\n var code = event.charCode || event.keyCode;\r\n if((code === 32) || (code === 13)){\r\n return true; //if the event was a keydown AND the key pressed was space or enter return true\r\n }\r\n }else{\r\n return false; //if anything but a click or enter/space keydown then return false, no action\r\n }\r\n }\r\n\r\n\r\n //SUBMENU KEYBOARD NAVIGATION IE11\r\n //Toggle sub menu open and closed when using the tab key\r\n //Necessary for IE11 to work as it does not have :focus-within css class\r\n $('#sub_menu').on('focusin', function(){\r\n $('#sub_menu > ul').addClass(\"open-sub-menu\");\r\n });\r\n\r\n $('#sub_menu').on('focusout', function(){\r\n $('#sub_menu > ul').removeClass(\"open-sub-menu\");\r\n });\r\n\r\n //hide bottom border on 'Our Courses' text when the submenu is being hovered.\r\n $('#sub_menu').hover( function(){\r\n $('#sub_menu > a').css(\"border-bottom\", \"none\");\r\n }, function(){\r\n //Check if the current page is the courses page or one of the course pages\r\n //Remove the border if it isn't\r\n var pageWrapper = document.getElementById(\"page_wrapper\");\r\n if(pageWrapper.classList.contains(\"course-page\") || pageWrapper.classList.contains(\"course\")){\r\n if(window.innerWidth > $breakpoint){\r\n $('#sub_menu > a').css(\"border-bottom\", \"3px solid #606eb0\");\r\n }\r\n }\r\n });\r\n\r\n //-------------------------------------------------------\r\n\r\n $trigger.on('click keypress', function () {\r\n if(accessebilityClick(event) === true){\r\n // only expand navigation if less than breakpoint\r\n if ($(window).width() < $breakpoint) {\r\n\r\n // if it is not open already\r\n if (!$(this).hasClass('is-open')) {\r\n openMenu();\r\n } else {\r\n closeMenu();\r\n }\r\n\r\n // close with click or touch outside\r\n $(document).on('click touchend', function () {\r\n if (!$(event.target).closest('nav').length) {\r\n if ($('#menu_trigger').hasClass('is-open')) {\r\n closeMenu();\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }); // end click\r\n\r\n\r\n //DROPDOWN NAV\r\n\r\n var delayedClose = void 0; //keep track of menu timeout\r\n //the div containing course links\r\n var $menuDrop = $('#sub_menu > ul');\r\n //on either links div hover or anchor link hover\r\n $menuDrop.hover(function () {\r\n clearTimeout(delayedClose); //the last timeout is now irrelevant\r\n // if it is not open already\r\n if (!$submenu.hasClass('open')) {\r\n $submenu.addClass('open');\r\n }\r\n }, function () {\r\n //this is onmouseout\r\n //set dropdown to close in 0.4 seconds (allows time for user error)\r\n delayedClose = setTimeout(function () {\r\n $submenu.removeClass('open');\r\n }, 400);\r\n });\r\n /// navigation dropdown ///\r\n $dropdown.hover(function () {\r\n // event.preventDefault();\r\n clearTimeout(delayedClose); //the last timeout is now irrelevant\r\n // if it is not open already\r\n if (!$submenu.hasClass('open')) {\r\n $submenu.addClass('open');\r\n }\r\n }, function () {\r\n //this is onmouseout\r\n //set dropdown to close in 0.4 seconds (allows time for user error)\r\n delayedClose = setTimeout(function () {\r\n $submenu.removeClass('open');\r\n }, 400);\r\n }); // end click\r\n\r\n\r\n // reset navigation if wider than breakpoint\r\n $(window).resize(function () {\r\n if ($(window).width() >= $breakpoint) {\r\n $menu.removeAttr('style');\r\n $trigger.removeClass('is-open is-closed').removeAttr('style');\r\n $wrapper.removeClass('hide-overflow').height('auto');\r\n $('#sub_menu > a').css(\"border-bottom\", \"none\");\r\n // adjust trigger position\r\n } else if ($(window).width() < $breakpoint && $(window).width() >= 768) {\r\n $triggerRight = ($(window).width() - 750) / 2 + 5;\r\n $trigger.removeAttr('style');\r\n $trigger.css('right', $triggerRight);\r\n } else {\r\n $triggerRight = 5;\r\n }\r\n }); // end resize\r\n\r\n // faq accordion\r\n // based on a pen by @kathykato - https://codepen.io/kathykato/pen/MoZJom\r\n var $accordion_trigger = $('.accordion_container .accordion a');\r\n\r\n $accordion_trigger.on('click keypress', function (event) {\r\n if(accessebilityClick(event) === true){\r\n $(this).toggleClass('active');\r\n $(this).next('.content').toggleClass('active');\r\n }\r\n }); // end accordion\r\n\r\n // Validate fields\r\n // Return error messages\r\n function validateForm() {\r\n\r\n //FORM INPUTS\r\n var from_name = document.querySelector('#name');\r\n var from_email = document.querySelector('#email');\r\n var from_message = document.querySelector('#message');\r\n\r\n\r\n var error_name = document.querySelector('.error_name');\r\n var error_email = document.querySelector('.error_email');\r\n var error_message = document.querySelector('.error_message');\r\n\r\n //Error message container\r\n var error_message_box = document.getElementById(\"error-message\");\r\n\r\n //Form input status icons (tick/exclamation)\r\n var status_icon_name = document.getElementById(\"nameStatusIcon\");\r\n var status_icon_email = document.getElementById(\"emailStatusIcon\");\r\n var status_icon_message = document.getElementById(\"messageStatusIcon\");\r\n\r\n //Array to hold error messages as incorrect form values are found\r\n var error_messages = [];\r\n\r\n //Whether the form inputs are valid or not\r\n var valid = true;\r\n\r\n // Check name\r\n if (from_name.value) {\r\n status_icon_name.classList.remove('badValue');\r\n status_icon_name.classList.add(\"goodValue\");\r\n from_name.setAttribute('aria-invalid', 'false');\r\n } else {\r\n //name is empty\r\n status_icon_name.classList.remove('goodValue');\r\n status_icon_name.classList.add(\"badValue\");\r\n valid = false;\r\n //notify screenreader of error\r\n from_name.setAttribute('aria-invalid', 'true');\r\n from_name.setAttribute('aria-describedby', 'name-empty');\r\n //add error message to array of errors\r\n error_messages.push(\"* Name field is required. Please enter your name.\");\r\n }\r\n\r\n // Check email entered\r\n if (from_email.value) {\r\n status_icon_email.classList.remove('badValue');\r\n status_icon_email.classList.add(\"goodValue\");\r\n from_email.setAttribute('aria-invalid', 'false');\r\n\r\n //check email pattern\r\n if (/(^\\w.*@\\w+\\.\\w)/.test(from_email.value)) {\r\n // error_email.classList.remove('error_show');\r\n status_icon_email.classList.remove('badValue');\r\n status_icon_email.classList.add(\"goodValue\");\r\n from_email.setAttribute('aria-invalid', 'false');\r\n } else {\r\n //invalid email format\r\n status_icon_email.classList.remove('goodValue');\r\n status_icon_email.classList.add(\"badValue\");\r\n //notify screenreader of error\r\n from_email.setAttribute('aria-invalid', 'true');\r\n from_email.setAttribute('aria-describedby', 'email-format');\r\n valid = false;\r\n //add error message to array of errors\r\n error_messages.push(\"* The format of your email is invalid. Please enter a valid email address.\");\r\n }\r\n\r\n } else {\r\n //NO EMAIL ENTRY\r\n status_icon_email.classList.remove('goodValue');\r\n status_icon_email.classList.add(\"badValue\");\r\n //notify screenreader of error\r\n from_email.setAttribute('aria-invalid', 'true');\r\n from_email.setAttribute('aria-describedby', 'email-empty');\r\n valid = false;\r\n //add error message to array of errors\r\n error_messages.push(\"* Email field is required. Please enter your email.\");\r\n }\r\n\r\n\r\n // Check mesage\r\n if (from_message.value) {\r\n status_icon_message.classList.remove('badValue');\r\n status_icon_message.classList.add(\"goodValue\");\r\n from_message.setAttribute('aria-invalid', 'false');\r\n } else {\r\n //empty message\r\n status_icon_message.classList.remove('goodValue');\r\n status_icon_message.classList.add(\"badValue\");\r\n //notify screenreader of error\r\n from_message.setAttribute('aria-invalid', 'true');\r\n from_message.setAttribute('aria-describedby', 'message-empty');\r\n valid = false;\r\n //add error message to array of errors\r\n error_messages.push(\"* Message field is required. Please enter your message.\");\r\n }\r\n\r\n\r\n if (valid) {\r\n //remove status icons from the inputs\r\n status_icon_name.classList.remove('goodValue');\r\n status_icon_name.classList.remove('badValue');\r\n status_icon_email.classList.remove('goodValue');\r\n status_icon_email.classList.remove('badValue');\r\n status_icon_message.classList.remove('goodValue');\r\n status_icon_message.classList.remove('badValue');\r\n //send the message\r\n sendMail();\r\n //reset screenreader attributes\r\n from_message.removeAttribute('aria-invalid');\r\n from_email.removeAttribute('aria-invalid');\r\n from_name.removeAttribute('aria-invalid');\r\n from_message.removeAttribute('aria-describedby');\r\n from_email.removeAttribute('aria-describedby');\r\n from_name.removeAttribute('aria-describedby');\r\n //remove error messages from page\r\n error_message_box.innerHTML = '';\r\n } else {\r\n //Determine which field the first error occured in so it can be focused.\r\n var firstError = document.querySelector('.message-form > input[aria-invalid=true]');\r\n if(!firstError){\r\n firstError = document.querySelector('.message-form > textarea[aria-invalid=true]');\r\n }\r\n //Concat all error messages together and put them into the error message container\r\n error_message_box.innerHTML = error_messages.join('\\n');\r\n //focus the input that had the first error\r\n firstError.focus();\r\n }\r\n }\r\n\r\n\r\n\r\n function showThankYou() {\r\n var message_form = document.querySelector('.message-form');\r\n var thank_you = document.querySelector('.thank-you');\r\n\r\n var from_name = document.querySelector('#name');\r\n var from_email = document.querySelector('#email');\r\n var from_message = document.querySelector('#message');\r\n\r\n from_name.value = '';\r\n from_email.value = '';\r\n from_message.value = '';\r\n\r\n message_form.style.display = 'none';\r\n thank_you.style.display = 'block';\r\n }\r\n\r\n function showMessageForm() {\r\n var message_form = document.querySelector('.message-form');\r\n var thank_you = document.querySelector('.thank-you');\r\n\r\n message_form.style.display = 'block';\r\n thank_you.style.display = 'none';\r\n }\r\n\r\n function NOW() {\r\n\r\n var date = new Date();\r\n var aaaa = date.getFullYear();\r\n var gg = date.getDate();\r\n var mm = date.getMonth() + 1;\r\n\r\n if (gg < 10) gg = \"0\" + gg;\r\n\r\n if (mm < 10) mm = \"0\" + mm;\r\n\r\n var cur_day = aaaa + \"-\" + mm + \"-\" + gg;\r\n\r\n var hours = date.getHours();\r\n var minutes = date.getMinutes() - 1;\r\n var seconds = date.getSeconds();\r\n\r\n if (hours < 10) hours = \"0\" + hours;\r\n\r\n if (minutes < 10) minutes = \"0\" + minutes;\r\n\r\n if (seconds < 10) seconds = \"0\" + seconds;\r\n\r\n return cur_day + \" \" + hours + \":\" + minutes + \":\" + seconds;\r\n }\r\n\r\n $('#submit_contact').on('click', function () {\r\n validateForm();\r\n });\r\n $('#btn_back').on('click', function () {\r\n showMessageForm();\r\n });\r\n});\r\n"],"sourceRoot":""}