{"version":3,"sources":["webpack:///./modules/contact/contact_form_library.js","webpack:///./modules/contact/contact_form_corporate.js"],"names":["VALUES","input","document","getElementById","facilities","includes","value","facilitiesShow","show","style","display","setAttribute","hideShow","facilityTypes","addEventListener","e","form","selectChange","select","filters","toLowerCase","key","hasOwnProperty","forEach","filter","className","replace","querySelectorAll","ip","disabled","hideAllFilters","showFilter","formId","config","selects","options","init","element","method","event","classNames","assignFilters","filterClasses","undefined","length","querySelector","assignSelects","selectClasses","type","bind"],"mappings":"2GAAMA,EAAS,CAAC,2BAA4B,uBAS7B,qBACb,IAAMC,EAAQC,SAASC,eAAe,2BAChCC,EAAaF,SAASC,eAAe,sBAC3C,GAAKF,GAAUG,GAEXJ,EAAOK,SAASJ,EAAMK,OAAQ,CAChC,IAAMC,EAXO,SAAAH,GAAU,OAAI,SAAAI,GAC7BJ,EAAWK,MAAMC,QAAUF,EAAO,QAAU,OAC5CJ,EAAWO,aAAa,eAAgBH,IASfI,CAASR,GAC1BS,EAAgBX,SAASC,eAAe,kBAC9CI,GAAe,GAEfM,EAAcC,iBAAiB,UAAU,SAAAC,GACvCR,EAAgBQ,S,kECjBlBC,E,oCA+CEC,EAAe,SAACC,EAAQC,GAC5B,IAAMb,EAAQY,EAAOZ,MAAMc,eAlBN,SAAAD,GACrB,IAAK,IAAME,KAAOF,EAAS,CACzB,GAAIA,EAAQG,eAAeD,GACRF,EAAQE,GAEhBE,SAAQ,SAAAC,GAAW,IAClBC,EAAcD,EAAdC,UACRD,EAAOC,UAAYA,EAAUC,QAAQ,sBAAuB,IAE5DF,EAAOG,iBAAiB,gBAAgBJ,SAAQ,SAAAK,GAC9CA,EAAGC,UAAW,SAUtBC,CAAeX,GACfY,EAAWzB,EAAOa,IAGdY,EAAa,SAACzB,EAAOa,GACzB,IAAIM,EAEJN,EAAQb,GAAOiB,SAAQ,SAAAC,GACrBC,EAAYD,EAAOC,UAEf,IAASA,EAAW,YACtBD,EAAOC,UAAP,UAAsBA,EAAtB,SACAD,EAAOG,iBAAiB,gBAAgBJ,SAAQ,SAAAK,GAC9CA,EAAGC,UAAW,UAMP,mBAASG,GACtB,IAAIC,EACAd,EAEAe,EAIJ,GAFAlB,EAAOd,SAASC,eAAe6B,GAE1B,IAAUhB,GAcf,MAZS,CACPiB,OAAQ,WAAmB,IAAlBE,EAAiB,uDAAP,GACjBF,EAASE,GAEXC,KAAM,WAjFU,IAACC,EAASC,EAAQC,EAkFhCpB,EA5EgB,SAAAqB,GACpB,IAAMrB,EAAU,GAMhB,OAJAqB,EAAWjB,SAAQ,SAAAE,GACjBN,EAAQM,GAAaT,EAAKW,iBAAL,WAA0BF,OAG1CN,EAqEOsB,CAAcR,EAAOS,eAC/BR,EAnEgB,SAAAM,GACpB,QAAoBG,KAAfH,GAA4BA,EAAWI,OAAS,EAAG,CACtD,IAAMV,EAAU,GAMhB,OAJAM,EAAWjB,SAAQ,SAAAE,GACjBS,EAAQT,GAAaT,EAAK6B,cAAL,WAAuBpB,EAAvB,eAGhBS,GA2DKY,CAAcb,EAAOc,eAnFhBV,EAoFHH,EAAQc,KApFIV,EAoFE,SApFMC,EAoFItB,EAAagC,KAAK,KAAMf,EAAQc,KAAM7B,GAnF7D,QAAZkB,QAAiCM,KAAZN,GACxBA,EAAQvB,iBAAiBwB,EAAQC,GAAO,GAmFtCR,EAAWG,EAAQc,KAAK1C,MAAMc,cAAeD","file":"contact_form-7a47f6c3.chunk.js","sourcesContent":["const VALUES = ['Customer Service Enquiry', 'Head Office Enquiry'];\n\nconst checker = e => e.target.value === 'Libraries';\n\nconst hideShow = facilities => show => {\n facilities.style.display = show ? 'block' : 'none';\n facilities.setAttribute('aria-hidden', !show);\n};\n\nexport default () => {\n const input = document.getElementById('contact_form_query_type');\n const facilities = document.getElementById('contact_facilities');\n if (!input || !facilities) return;\n\n if (VALUES.includes(input.value)) {\n const facilitiesShow = hideShow(facilities);\n const facilityTypes = document.getElementById('facility-types');\n facilitiesShow(false);\n\n facilityTypes.addEventListener('change', e => {\n facilitiesShow((e));\n });\n }\n};\n","/* eslint-disable max-len, no-use-before-define */\nimport _, { isElement, includes } from 'lodash';\n\nlet form;\n\nconst addListener = (element, method, event) => {\n if (!element === null && !element === undefined) {\n element.addEventListener(method, event, false);\n }\n};\n\nconst assignFilters = classNames => {\n const filters = {};\n\n classNames.forEach(className => {\n filters[className] = form.querySelectorAll(`.${className}`);\n });\n\n return filters;\n};\n\nconst assignSelects = classNames => {\n if (!classNames === undefined && classNames.length > 0) {\n const selects = {};\n\n classNames.forEach(className => {\n selects[className] = form.querySelector(`.${className}-select`);\n });\n\n return selects;\n }\n};\n\nconst hideAllFilters = filters => {\n for (const key in filters) {\n if (filters.hasOwnProperty(key)) {\n const nodeList = filters[key];\n\n nodeList.forEach(filter => {\n const { className } = filter;\n filter.className = className.replace(/(?:^|\\s)open(?!\\S)/g, '');\n\n filter.querySelectorAll('input,select').forEach(ip => {\n ip.disabled = true;\n });\n });\n }\n }\n};\n\nconst selectChange = (select, filters) => {\n const value = select.value.toLowerCase();\n\n hideAllFilters(filters);\n showFilter(value, filters);\n};\n\nconst showFilter = (value, filters) => {\n let className;\n\n filters[value].forEach(filter => {\n className = filter.className;\n\n if (includes(className, 'filter')) {\n filter.className = `${className} open`;\n filter.querySelectorAll('input,select').forEach(ip => {\n ip.disabled = false;\n });\n }\n });\n};\n\nexport default function(formId) {\n let config;\n let filters;\n let object;\n let selects;\n\n form = document.getElementById(formId);\n\n if (!isElement(form)) return;\n\n object = {\n config: (options = {}) => {\n config = options;\n },\n init: () => {\n filters = assignFilters(config.filterClasses);\n selects = assignSelects(config.selectClasses);\n addListener(selects.type, 'change', selectChange.bind(null, selects.type, filters));\n showFilter(selects.type.value.toLowerCase(), filters);\n },\n };\n\n return object;\n}\n/* eslint-enable */\n"],"sourceRoot":""}