{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/packs/ApplicationBase.js","webpack:///./app/javascript/packs/wizard/GoogleAutocomplete.js","webpack:///./app/javascript/packs/wizard/CourseTypeSelect.js","webpack:///./app/javascript/packs/wizard/DateRange.js","webpack:///./app/javascript/packs/wizard/FindCourse.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","ApplicationBase","_createClass","jQuery","_classCallCheck","this","_this$constructor$sel","constructor","selectors","selector","GoogleAutocomplete","_ApplicationBase","google","options","_this","_callSuper","_inherits","_this2","_this$options$testEnv","testEnv","autocomplete","Autocomplete","maps","places","addressInput","types","componentRestrictions","country","setFields","addListener","place","getPlace","geometry","addressComponents","address_components","location","addressExtractor","AddressComponentExtractor","latInput","val","lat","longInput","lng","stateInput","state","suburbInput","suburb","window","alert","NO_ADDRESS_MESSAGE","on","findComponent","STATE_IDENTIFIER","SUBURB_IDENTIFIER","identifier","_this$addressComponen3","_slicedToArray","filter","_ref","includes","CourseTypeSelect","_this$options","_this$options$data","data","selected","placeholder","width","courseTypeSelect","select2","trigger","DateRange","today","Date","startInput","datepicker","dateFormat","DATE_FORMAT","endInput","defaultStartDate","defaultEndDate","startDate","setDate","getDate","TOMORROW","endDate","NEXT_MONTH","FindCourse","form","submit","long","e","keyCode","which","preventDefault","Wizard","_objectSpread"],"mappings":"aACE,IAAIA,EAAmB,CAAC,EAGxB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,CAAC,GAUX,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,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EAAaN,CACnC,CAAC,O,qRAAAE,CAAAsE,EAAA3E,G,EAAA2E,E,EAAA,EAAA9F,IAAA,OAAAN,MAED,WAAQ,IAAD+B,EAAA,KACAZ,KAAKe,eAEVf,KAAKkF,KAAKC,QAAO,WACf,IAAMhD,EAAMvB,EAAKqB,SAASC,MACpBkD,EAAOxE,EAAKwB,UAAUF,MAE5B,IAAMC,IAAOiD,EAEX,OADA1C,OAAOC,MAAMtC,UAAmBuC,qBACzB,CAEX,IAEA5C,KAAKkF,KAAKrC,GAAG,kBAAkB,SAACwC,GAG9B,GAAgB,MAFAA,EAAEC,SAAWD,EAAEE,OAK7B,OAFAF,EAAEG,kBAEK,CAEX,IACF,I,4FAAC,CA5Ba,CAAS5F,WA+BzBqF,EAAW9E,UAAY,CACrB+E,KAAM,oBACNjD,SAAU,4BACVG,UAAW,8BAGbM,OAAO+C,OAAMC,IAAA,GACRhD,OAAO+C,QAAM,IAChBR,aACA1B,2BACAlD,6BACA4D,qB","file":"js/wizard/FindCourse-d6b0bd7a6cefcbe69d0d.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 = \"https://pres.trainingdesk.com.au/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 746);\n","class ApplicationBase {\n constructor(jQuery) {\n this.jQuery = jQuery;\n\n const { selectors = {} } = this.constructor;\n\n for (const selector in selectors) {\n this[selector] = this.jQuery(selectors[selector]);\n }\n }\n}\n\nexport default ApplicationBase;\n","import ApplicationBase from '../ApplicationBase';\n\nclass GoogleAutocomplete extends ApplicationBase {\n static NO_ADDRESS_MESSAGE = 'Please select address below';\n\n constructor(jQuery, google, options) {\n super(jQuery);\n this.google = google,\n this.options = options;\n }\n\n init() {\n const { testEnv = false } = this.options;\n\n if (testEnv) return;\n if (!this.google) return;\n\n const { Autocomplete } = this.google.maps.places;\n const options = { types: [], componentRestrictions: { country: 'au' } };\n const autocomplete = new Autocomplete(this.addressInput[0], options);\n\n autocomplete.setFields(['geometry', 'address_component']);\n autocomplete.addListener('place_changed', () => {\n const place = autocomplete.getPlace();\n const { geometry, address_components: addressComponents } = place;\n\n if (!geometry) {\n window.alert(GoogleAutocomplete.NO_ADDRESS_MESSAGE);\n return;\n }\n\n const { location } = geometry;\n const addressExtractor = new AddressComponentExtractor(addressComponents);\n\n this.latInput.val(location.lat());\n this.longInput.val(location.lng());\n this.stateInput.val(addressExtractor.state());\n this.suburbInput.val(addressExtractor.suburb());\n });\n\n this.addressInput.on('keydown', () => {\n this.latInput.val('');\n this.longInput.val('');\n });\n\n return autocomplete;\n }\n}\n\nclass AddressComponentExtractor {\n static STATE_IDENTIFIER = 'administrative_area_level_1';\n static SUBURB_IDENTIFIER = 'locality';\n\n constructor(addressComponents) {\n this.addressComponents = addressComponents;\n }\n\n state() {\n return this.findComponent(AddressComponentExtractor.STATE_IDENTIFIER)['long_name'];\n }\n\n suburb() {\n return this.findComponent(AddressComponentExtractor.SUBURB_IDENTIFIER)['long_name']\n }\n\n findComponent(identifier) {\n const [component = {}] = this.addressComponents.filter(({ types }) => types.includes(identifier));\n\n return component;\n }\n}\n\nGoogleAutocomplete.selectors = {\n addressInput: '.google-place',\n latInput: 'input[name=\"wizard[lat]\"]',\n longInput: 'input[name=\"wizard[long]\"]',\n stateInput: 'input[name=\"wizard[state]\"]',\n suburbInput: 'input[name=\"wizard[suburb]\"]',\n};\n\nexport default GoogleAutocomplete;\n","import ApplicationBase from '../ApplicationBase';\n\nclass CourseTypeSelect extends ApplicationBase {\n constructor(jQuery, options) {\n super(jQuery);\n this.options = options;\n }\n\n init() {\n const { data = [], selected } = this.options;\n const options = {\n placeholder: 'Pick a course type...',\n width: '100%',\n data,\n };\n\n this.courseTypeSelect.select2(options);\n\n if (selected) this.courseTypeSelect.val(selected).trigger('change');\n }\n}\n\nCourseTypeSelect.selectors = {\n courseTypeSelect: 'select[name=\"wizard[unit_id]\"]',\n};\n\nexport default CourseTypeSelect;\n","import ApplicationBase from '../ApplicationBase';\n\nclass DateRange extends ApplicationBase {\n static DATE_FORMAT = 'dd/mm/yy';\n static TOMORROW = 1;\n static NEXT_MONTH = 31;\n\n constructor(jQuery) {\n super(jQuery);\n this.today = new Date();\n }\n\n init() {\n this.startInput.datepicker({ dateFormat: DateRange.DATE_FORMAT });\n this.endInput.datepicker({ dateFormat: DateRange.DATE_FORMAT });\n\n if (this.startInput.val() == '') this.startInput.datepicker('setDate', this.defaultStartDate());\n if (this.endInput.val() == '') this.endInput.datepicker('setDate', this.defaultEndDate());\n }\n\n defaultStartDate() {\n const startDate = new Date();\n startDate.setDate(this.today.getDate() + DateRange.TOMORROW);\n return startDate;\n }\n\n defaultEndDate() {\n const endDate = new Date();\n endDate.setDate(this.today.getDate() + DateRange.NEXT_MONTH);\n return endDate;\n }\n}\n\nDateRange.selectors = {\n startInput: 'input[name=\"wizard[start_date]\"]',\n endInput: 'input[name=\"wizard[end_date]\"]',\n};\n\nexport default DateRange;\n","import ApplicationBase from '../ApplicationBase';\nimport GoogleAutocomplete from './GoogleAutocomplete';\nimport DateRange from './DateRange';\nimport CourseTypeSelect from './CourseTypeSelect';\n\nclass FindCourse extends ApplicationBase {\n constructor(jQuery, autocomplete) {\n super(jQuery);\n this.autocomplete = autocomplete;\n }\n\n init() {\n if (!this.autocomplete) return;\n\n this.form.submit(() => {\n const lat = this.latInput.val();\n const long = this.longInput.val();\n\n if (!(lat && long)) {\n window.alert(GoogleAutocomplete.NO_ADDRESS_MESSAGE);\n return false;\n }\n });\n\n this.form.on('keyup keypress', (e) => {\n const keyCode = e.keyCode || e.which;\n\n if (keyCode === 13) {\n e.preventDefault();\n\n return false;\n }\n });\n }\n}\n\nFindCourse.selectors = {\n form: '.find-course-form',\n latInput: 'input[name=\"wizard[lat]\"]',\n longInput: 'input[name=\"wizard[long]\"]',\n};\n\nwindow.Wizard = {\n ...window.Wizard,\n FindCourse,\n CourseTypeSelect,\n GoogleAutocomplete,\n DateRange,\n};\n"],"sourceRoot":""}