{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/coveo/components/ShareCommunitiesSlider/ShareCommunitiesSliderCard.jsx","webpack://@verndale/toolkit/./src/js/coveo/components/ShareCommunitiesSlider/index.jsx","webpack://@verndale/toolkit/./src/js/components/share-communities-headless-form.js","webpack://@verndale/toolkit/./src/js/coveo/modules/ShareCommunities/index.jsx","webpack://@verndale/toolkit/./node_modules/pristinejs/dist/pristine.js"],"names":["props","onShareClick","result","distanceUnit","sharedCommunities","useContext","SearchContext","React","community","unitConversion","SwiperCore","Navigation","Pagination","ShareCommunitiesSlider","controller","coveoUnit","showPagination","shareCommunitiesLabel","shareCommunityLabel","onShareModalClick","currentIndex","setCurrentIndex","useState","state","setState","swiperInstance","setSwiperInstance","displayedResults","setDisplayedResults","useEffect","originalResults","sortedResults","sortResultsByDistance","getPaginationString","Swiper","swiper","EffectCoverflow","index","SwiperSlide","ShareCommunitiesSliderCard","Module","Component","Pristine","selected","postHeaders","fetchURL","results","el","communityObj","items","item","x","id","locationCookieName","coveoOrganizationId","coveoAccessToken","coveoSearchHub","coveoPipeline","coveoAutocompleteFields","coveoSource","coveoContextLanguage","countryOptions","careTypeOptions","distanceOptions","careTypePlaceholder","distancePlaceholder","searchButtonLabel","searchBoxPlaceholder","module","waitingForGeolocation","setWaitingForGeolocation","geolocationData","setGeolocationData","setSharedCommunities","formInstance","setFormInstance","modalCloseRef","useRef","modalRef","elementRef","listenerRef","isSearching","searchSource","option","searchDistance","searchCareType","engine","useMemo","buildEngine","resultsListController","buildResultList","getCoveoFindACommunityFieldsToInclude","resultsPerPageController","buildResultsPerPage","handleCountryChange","handleShareClick","title","distance","communityObject","communityIndex","newsharedCommunities","checkCommunities","selectedInput","selectedCommunitiesIds","newSelectedCommunities","communityId","handleModalOpen","modal","useLayoutEffect","modalContent","ShareCommunitiesHeadlessForm","closeButton","handleLocationSelectorSubmit","searchInputValue","selectedCountry","selectedCareType","selectedDistance","dispatch","sendQuery","cookieData","getLocationCookie","sendCoveoGeolocationQuery","useEventBus","payload","LocationSelector","global","factory","lang","findAncestor","cls","tmpl","_arguments","a","b","groupedElemCount","input","mergeConfig","obj1","obj2","attr","defaultConfig","PRISTINE_ERROR","SELECTOR","ALLOWED_ATTRIBUTES","EMAIL_REGEX","MESSAGE_REGEX","currentLocale","validators","_","name","validator","val","length","limit","pattern","m","otherFieldSelector","other","form","config","live","self","init","fns","params","messages","messageMatch","locale","_addValidatorToField","e","value","valueParams","silent","fields","valid","i","field","_validateField","_showSuccess","_showError","erroneousFields","errors","elem","fn","msg","priority","halt","_getErrorElements","errorClassElement","errorTextParent","errorTextElement","errorElements","inputId","errorId","error","_removeError","langObj","key"],"mappings":"iPAwFA,EApFmCA,GAAS,CAC1C,KAAM,CAAE,aAAAC,EAAc,OAAAC,EAAQ,aAAAC,CAAa,EAAIH,EAEzC,CAAE,kBAAAI,CAAkB,G,EAAIC,cAAWC,GAAa,EAEtD,OACEC,2BAAA,KACEA,gBAAC,OAAI,UAAU,kCAAkC,EAC/CA,gBAAC,OAAI,UAAU,kDAAkD,EAC/DA,gBAAC,OACC,IAAKL,EAAO,IAAI,qBAChB,UAAU,oCACV,IAAKA,EAAO,KAAK,CACnB,EAEAK,gBAAC,QAAK,UAAU,4CAA4C,EAC1DA,gBAAC,OAAI,UAAU,gBAAgB,EAC7BA,gBAAC,SACC,UAAU,kBACV,KAAK,SACL,KAAK,WACL,QAASH,EAAkB,KACzBI,GAAaA,EAAU,KAAON,EAAO,IAAI,eAC3C,EACA,SAAU,GACZ,EACAK,gBAAC,UACC,UAAU,sEACV,QAAS,IAAM,CACbN,EACEC,EAAO,IAAI,gBACXA,EAAO,IAAI,kBACX,I,EAAGO,MACDP,EAAO,IAAI,SACXC,CACF,KAAKA,GACP,CACF,CAAC,EAEDI,gBAAC,QAAK,UAAU,sBAAsB,CAAC,EACvCA,gBAAC,SAAM,UAAU,cAAc,EAAC,OAAK,CACvC,CACF,CACF,CACF,EACAA,gBAAC,OAAI,UAAU,qCAAqC,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d,EAAK,KAAK,iBAAiB,IAAMpB,CAAc,CAAC,EAAE,IAAI,SAAUyC,EAAM,CAC7EA,EAAK,WAAW,YAAYA,CAAI,CACpC,CAAC,EACD,MAAM,KAAKrB,EAAK,KAAK,iBAAiB,IAAMA,EAAK,OAAO,OAAO,CAAC,EAAE,IAAI,SAAUqB,EAAM,CAClFA,EAAK,UAAU,OAAOrB,EAAK,OAAO,YAAY,EAC9CqB,EAAK,UAAU,OAAOrB,EAAK,OAAO,UAAU,CAChD,CAAC,CACL,EAKAA,EAAK,QAAU,UAAY,CACvBA,EAAK,MAAM,EACXA,EAAK,OAAO,QAAQ,SAAUe,EAAO,CACjC,OAAOA,EAAM,MAAM,QACvB,CAAC,EACDf,EAAK,OAAS,CAAC,CACnB,EAEAA,EAAK,gBAAkB,SAAUF,EAAQ,CACrCnB,EAAgBmB,CACpB,EAEOE,CACX,CAWA,OAAAvH,EAAS,aAAe,SAAU2G,EAAMkC,EAAIC,EAAKC,EAAUC,EAAM,CAC7DtC,EAAEC,EAAM,CAAE,GAAIkC,EAAI,IAAKC,EAAK,SAAUC,EAAU,KAAMC,CAAK,CAAC,CAChE,EAEAhJ,EAAS,YAAc,SAAU6H,EAAQF,EAAU,CAC/C,IAAI+B,EAAUrE,EAAK,eAAewC,CAAM,EAAIxC,EAAKwC,GAAUxC,EAAKwC,GAAU,CAAC,EAE3E,OAAO,KAAKF,CAAQ,EAAE,QAAQ,SAAUgC,EAAKhK,EAAO,CAChD+J,EAAQC,GAAOhC,EAASgC,EAC5B,CAAC,CACL,EAEA3J,EAAS,UAAY,SAAU6H,EAAQ,CACnCrB,EAAgBqB,CACpB,EAEO7H,CAEX,CAAE,C","file":"Areas/SunriseSeniorLiving/Scripts/5793.f8f71d1d8f8d7a517e1c.bundle.js","sourcesContent":["import React, { useContext } from 'react';\nimport { unitConversion } from '../../helpers';\nimport SearchContext from '../../state/context';\n\nconst ShareCommunitiesSliderCard = props => {\n const { onShareClick, result, distanceUnit } = props;\n\n const { sharedCommunities } = useContext(SearchContext);\n\n return (\n <>\n
\n
\n \n\n \n
\n community.id === result.raw.ssl_communityid\n )}\n readOnly={true}\n />\n {\n onShareClick(\n result.raw.ssl_communityid,\n result.raw.ssl_communityname,\n `${unitConversion(\n result.raw.distance,\n distanceUnit\n )} ${distanceUnit}`\n );\n }}\n >\n \n \n \n
\n
\n
\n
\n

\n \n {result.raw.ssl_communityname}\n \n

\n

\n {[result.raw.ssl_city, result.raw.ssl_stateabbreviation]\n .filter(Boolean)\n .join(', ')}\n  | {`${result.raw.ssl_zipcode} | `}\n \n {unitConversion(result.raw.distance, distanceUnit)} {distanceUnit}\n \n

\n\n

\n Levels of care\n

\n

\n Assisted Living, Memory Care, Terrace Club, Short-Term Stays,\n Hospice Coordination\n

\n\n \n\n \n
\n
\n \n );\n};\n\nexport default ShareCommunitiesSliderCard;\n","import React, { useEffect, useState, useContext } from 'react';\nimport SearchContext from '../../state/context';\nimport { Swiper, SwiperSlide } from 'swiper/react';\nimport SwiperCore, { Navigation, Pagination, EffectCoverflow } from 'swiper';\nimport ShareCommunitiesSliderCard from './ShareCommunitiesSliderCard';\nimport 'swiper/css';\nimport 'swiper/css/effect-coverflow';\nimport 'swiper/css/pagination';\nimport 'swiper/css/navigation';\nimport { sortResultsByDistance } from '../../helpers';\n\nSwiperCore.use([Navigation, Pagination]);\n\nexport const ShareCommunitiesSlider = ({\n controller,\n coveoUnit = 'mi',\n showPagination = true,\n onShareClick,\n shareCommunitiesLabel = 'Shared Communities',\n shareCommunityLabel = 'Share Community'\n}) => {\n const { sharedCommunities, onShareModalClick } = useContext(SearchContext);\n const [currentIndex, setCurrentIndex] = useState(1);\n const [state, setState] = useState(controller.state);\n const [swiperInstance, setSwiperInstance] = useState(null);\n const [displayedResults, setDisplayedResults] = useState([]);\n\n useEffect(() => {\n controller.subscribe(() => {\n setState(controller.state);\n if (controller.state.results) {\n const originalResults = [...controller.state.results];\n const sortedResults = sortResultsByDistance(originalResults);\n setDisplayedResults(sortedResults);\n }\n });\n }, []);\n\n const getPaginationString = () => {\n if (!swiperInstance) return '';\n const paginationString = `${swiperInstance.realIndex + 1} - ${\n swiperInstance.realIndex + swiperInstance.params.slidesPerView\n } of ${state.results.length}`;\n\n return paginationString;\n };\n\n return (\n <>\n
\n {state && state.results.length > 0 && (\n <>\n {\n setCurrentIndex(swiper.realIndex + 1);\n }}\n onSwiper={setSwiperInstance}\n slideToClickedSlide={true}\n modules={[EffectCoverflow, Pagination, Navigation]}\n navigation={{\n nextEl: '.communities-slider__arrow--next',\n prevEl: '.communities-slider__arrow--prev'\n }}\n >\n {displayedResults.map((result, index) => (\n \n \n \n ))}\n \n
\n {!swiperInstance?.isBeginning && (\n swiperInstance.slidePrev()}\n >\n \n \n \n \n \n \n \n \n \n )}\n {!swiperInstance?.isEnd && (\n swiperInstance.slideNext()}\n >\n \n \n \n \n \n \n \n \n \n )}\n
\n {showPagination && (\n
\n {getPaginationString()}\n
\n )}\n onShareModalClick()}\n >\n \n \n \n \n {sharedCommunities.length > 1\n ? shareCommunitiesLabel.replace(\n '{number}',\n sharedCommunities.length\n )\n : shareCommunityLabel.replace(\n '{number}',\n sharedCommunities.length\n )}\n \n \n \n )}\n
\n \n );\n};\n","import { Component } from '@verndale/core';\nimport Pristine from 'pristinejs';\n\nclass Module extends Component {\n setupDefaults() {\n this.dom = {\n $items: this.el._$('.share-communities-headless-modal__items'),\n $selected: this.el._$('.share-communities-headless-modal__selected'),\n $shareForm: this.el._$('.share-communities-headless__form'),\n $inputName: this.el._$('.share-communities-headless__form-name input'),\n $recipientEmail: this.el._$(\n '.share-communities-headless__form-recipient-email input'\n ),\n $userEmail: this.el._$(\n '.share-communities-headless__form-user-email input'\n ),\n $successModal: this.el._$('.share-communities-headless-modal__success'),\n $recaptcha: this.el._$('.g-recaptcha')\n };\n this.pristine = new Pristine(this.dom.$shareForm);\n this.selected = [];\n\n this.dom.$successModal.classList.toggle(\n 'share-communities-headless__modal-content-active'\n );\n }\n\n addListeners() {\n this.dom.$shareForm._on('submit', this.handleShareSubmit.bind(this));\n }\n\n setSelected(selected) {\n this.selected = selected;\n }\n\n async postResults() {\n // eslint-disable-next-line no-undef\n if (grecaptcha && grecaptcha.getResponse() !== '') {\n const postHeaders = new Headers();\n postHeaders.append('Accept', 'application/json');\n postHeaders.append('Content-Type', 'application/json');\n const fetchURL = `${this.el.dataset.postEndpoint}`;\n const response = await fetch(fetchURL, {\n method: 'POST',\n headers: postHeaders,\n body: JSON.stringify(this.results)\n });\n\n if (response.status === 200) {\n this.dom.$shareForm.classList.toggle(\n 'share-communities__modal-content-active'\n );\n this.dom.$successModal.classList.toggle(\n 'share-communities__modal-content-active'\n );\n } else {\n window.location.href = this.el.dataset.redirectUrl;\n }\n }\n }\n\n listenToShareRemove() {\n this.dom.$items\n ._$$('.share-communities-headless-modal__remove-item')\n ._on('click', this.removeSelected.bind(this));\n }\n\n handleShareSubmit(e) {\n e.preventDefault();\n if (this.pristine.validate()) {\n const results = {\n Name: this.dom.$inputName.value,\n To: this.dom.$recipientEmail.value,\n From: this.dom.$userEmail.value,\n Communities: []\n };\n this.selected.map(el => {\n const communityObj = {\n Id: el.id,\n Distance: el.distance\n };\n results.Communities.push(communityObj);\n });\n this.results = results;\n this.postResults();\n }\n }\n\n renderShareItems() {\n const items = this.selected\n .map(\n item => `\n
  • \n ${item.title}\n \n
  • \n `\n )\n .join('');\n\n this.dom.$items.innerHTML = items;\n this.dom.$selected.value = this.selected.map(x => x.id).join(',');\n this.listenToShareRemove();\n }\n\n removeSelected(e) {\n const id = e.currentTarget.dataset.id;\n this.selected = this.selected.filter(x => x.id !== id);\n this.renderShareItems();\n }\n}\n\nexport default Module;\n","import React, {\n useEffect,\n useMemo,\n useState,\n useRef,\n useLayoutEffect\n} from 'react';\nimport SearchContext from '../../state/context';\nimport { buildEngine } from '../../engine/Engine';\nimport { ShareCommunitiesSlider } from '../../components/ShareCommunitiesSlider';\nimport LocationSelector from '../LocationSelector';\nimport ShareCommunitiesHeadlessForm from '../../../components/share-communities-headless-form';\nimport {\n getLocationCookie,\n getCoveoFindACommunityFieldsToInclude,\n sendCoveoGeolocationQuery\n} from '../../helpers';\nimport { buildResultList, buildResultsPerPage } from '@coveo/headless';\nimport useEventBus, { dispatch } from '../../../hooks/useEventBus';\n\nconst ShareCommunities = ({\n locationCookieName,\n coveoOrganizationId,\n coveoAccessToken,\n coveoSearchHub,\n coveoPipeline,\n coveoAutocompleteFields,\n coveoSource = 'Production US - English',\n coveoContextLanguage = 'en',\n countryOptions = [],\n careTypeOptions = [],\n distanceOptions = [],\n careTypePlaceholder,\n distancePlaceholder,\n searchButtonLabel,\n searchBoxPlaceholder = 'Enter a zip code',\n shareCommunityLabel = 'Share {number} Community',\n shareCommunitiesLabel = 'Share {number} Communities',\n module\n}) => {\n const [waitingForGeolocation, setWaitingForGeolocation] = useState(true);\n const [geolocationData, setGeolocationData] = useState(null);\n const [sharedCommunities, setSharedCommunities] = useState([]);\n const [formInstance, setFormInstance] = useState(null);\n const modalCloseRef = useRef(null);\n const modalRef = useRef(null);\n const elementRef = useRef(null);\n const listenerRef = useRef(null);\n const isSearching = useRef(false);\n const searchSource = useRef(\n countryOptions && countryOptions.length > 0\n ? JSON.parse(countryOptions).find(\n option => option.defaultValue === 'true'\n ).source\n : coveoSource\n );\n const searchDistance = useRef(null);\n const searchCareType = useRef(null);\n\n const engine = useMemo(() => {\n return buildEngine({\n organizationId: coveoOrganizationId,\n accessToken: coveoAccessToken,\n searchHub: coveoSearchHub,\n pipeline: coveoPipeline\n });\n }, []);\n\n const resultsListController = useMemo(\n () =>\n buildResultList(engine, {\n options: {\n fieldsToInclude: getCoveoFindACommunityFieldsToInclude()\n }\n }),\n []\n );\n\n const resultsPerPageController = useMemo(\n () =>\n buildResultsPerPage(engine, {\n initialState: {\n numberOfResults: 100\n }\n }),\n []\n );\n\n const handleCountryChange = selected => {\n searchSource.current = JSON.parse(countryOptions).find(\n option => option.value === selected.value\n ).source;\n };\n\n const handleShareClick = (id, title, distance) => {\n const communityObject = { id: id, title: title, distance: distance };\n const communityIndex = sharedCommunities.findIndex(\n community => community.id === id\n );\n if (communityIndex === -1) {\n setSharedCommunities([...sharedCommunities, communityObject]);\n } else {\n const newsharedCommunities = [...sharedCommunities];\n newsharedCommunities.splice(communityIndex, 1);\n setSharedCommunities(newsharedCommunities);\n }\n };\n\n const checkCommunities = () => {\n const selectedInput = modalRef.current.querySelector(\n '.share-communities-headless-modal__selected'\n );\n if (selectedInput.value && selectedInput.value.length > 0) {\n const selectedCommunitiesIds = selectedInput.value.split(',');\n const newSelectedCommunities = [];\n selectedCommunitiesIds.forEach(communityId => {\n const communityObject = sharedCommunities.find(\n item => item.id === communityId\n );\n if (communityObject) {\n newSelectedCommunities.push(communityObject);\n }\n });\n setSharedCommunities(newSelectedCommunities);\n } else {\n setSharedCommunities([]);\n }\n };\n\n useEffect(() => {\n if (!formInstance) return;\n formInstance.setSelected(sharedCommunities);\n }, [sharedCommunities]);\n\n const handleModalOpen = () => {\n const modal = modalRef.current;\n if (!modal) return;\n if (modal.hasAttribute('aria-hidden')) {\n modal.removeAttribute('aria-hidden');\n formInstance.renderShareItems();\n modalCloseRef.current.removeEventListener('click', listenerRef.current);\n listenerRef.current = checkCommunities;\n modalCloseRef.current.addEventListener('click', checkCommunities);\n }\n };\n\n useLayoutEffect(() => {\n const modal = elementRef.current\n .closest('.share-communities-headless')\n .querySelector('.share-communities-headless-modal');\n modalRef.current = modal;\n if (modalRef.current) {\n const modalContent = modalRef.current.querySelector(\n '.share-communities-headless-modal__content'\n );\n const formInstance = new ShareCommunitiesHeadlessForm(modalContent);\n setFormInstance(formInstance);\n const closeButton = modalRef.current.querySelector(\n '.modal__close-button'\n );\n modalCloseRef.current = closeButton;\n }\n }, []);\n\n const handleLocationSelectorSubmit = (\n searchInputValue,\n selectedCountry,\n selectedCareType,\n selectedDistance\n ) => {\n isSearching.current = true;\n if (selectedCareType) searchCareType.current = selectedCareType;\n if (selectedDistance) searchDistance.current = selectedDistance;\n dispatch({\n type: 'get-zip-geolocation',\n payload: {\n value: searchInputValue,\n country: `${selectedCountry.value === 'us' ? 'USA' : 'CANADA'}`,\n firstSearch: true,\n moduleName: module\n }\n });\n setWaitingForGeolocation(true);\n };\n\n const sendQuery = () => {\n let cookieData = getLocationCookie(locationCookieName);\n if (cookieData) {\n setGeolocationData(cookieData);\n sendCoveoGeolocationQuery({\n engine: engine,\n latitude: cookieData.Latitude,\n longitude: cookieData.Longitude,\n source: searchSource.current,\n radiusInMiles: searchDistance.current\n ? searchDistance.current.value\n : 100,\n careType: searchCareType.current ? searchCareType.current.value : null,\n state: cookieData.State,\n language: coveoContextLanguage,\n pipeline: coveoPipeline\n });\n }\n setWaitingForGeolocation(false);\n };\n\n useEventBus(\n 'geolocation-received',\n ({ payload }) => {\n if (payload.Module === module) {\n sendQuery();\n setWaitingForGeolocation(false);\n } else {\n return;\n }\n },\n []\n );\n\n return (\n <>\n
    \n \n
    \n \n
    \n {\n \n }\n \n
    \n \n );\n};\n\nexport default ShareCommunities;\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Pristine = factory());\n}(this, (function () { 'use strict';\n\n var lang = {\n en: {\n required: \"This field is required\",\n email: \"This field requires a valid e-mail address\",\n number: \"This field requires a number\",\n integer: \"This field requires an integer value\",\n url: \"This field requires a valid website URL\",\n tel: \"This field requires a valid telephone number\",\n maxlength: \"This fields length must be < ${1}\",\n minlength: \"This fields length must be > ${1}\",\n min: \"Minimum value for this field is ${1}\",\n max: \"Maximum value for this field is ${1}\",\n pattern: \"Please match the requested format\",\n equals: \"The two fields do not match\",\n default: \"Please enter a correct value\"\n }\n };\n\n function findAncestor(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls)) {}\n return el;\n }\n\n function tmpl(o) {\n var _arguments = arguments;\n\n return this.replace(/\\${([^{}]*)}/g, function (a, b) {\n return _arguments[b];\n });\n }\n\n function groupedElemCount(input) {\n return input.pristine.self.form.querySelectorAll('input[name=\"' + input.getAttribute('name') + '\"]:checked').length;\n }\n\n function mergeConfig(obj1, obj2) {\n for (var attr in obj2) {\n if (!(attr in obj1)) {\n obj1[attr] = obj2[attr];\n }\n }\n return obj1;\n }\n\n var defaultConfig = {\n classTo: 'form-group',\n errorClass: 'has-danger',\n successClass: 'has-success',\n errorTextParent: 'form-group',\n errorTextTag: 'div',\n errorTextClass: 'text-help'\n };\n\n var PRISTINE_ERROR = 'pristine-error';\n var SELECTOR = \"input:not([type^=hidden]):not([type^=submit]), select, textarea\";\n var ALLOWED_ATTRIBUTES = [\"required\", \"min\", \"max\", 'minlength', 'maxlength', 'pattern'];\n var EMAIL_REGEX = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n\n var MESSAGE_REGEX = /-message(?:-([a-z]{2}(?:_[A-Z]{2})?))?/; // matches, -message, -message-en, -message-en_US\n var currentLocale = 'en';\n var validators = {};\n\n var _ = function _(name, validator) {\n validator.name = name;\n if (validator.priority === undefined) validator.priority = 1;\n validators[name] = validator;\n };\n\n _('text', { fn: function fn(val) {\n return true;\n }, priority: 0 });\n _('required', { fn: function fn(val) {\n return this.type === 'radio' || this.type === 'checkbox' ? groupedElemCount(this) : val !== undefined && val.trim() !== '';\n }, priority: 99, halt: true });\n _('email', { fn: function fn(val) {\n return !val || EMAIL_REGEX.test(val);\n } });\n _('number', { fn: function fn(val) {\n return !val || !isNaN(parseFloat(val));\n }, priority: 2 });\n _('integer', { fn: function fn(val) {\n return !val || /^\\d+$/.test(val);\n } });\n _('minlength', { fn: function fn(val, length) {\n return !val || val.length >= parseInt(length);\n } });\n _('maxlength', { fn: function fn(val, length) {\n return !val || val.length <= parseInt(length);\n } });\n _('min', { fn: function fn(val, limit) {\n return !val || (this.type === 'checkbox' ? groupedElemCount(this) >= parseInt(limit) : parseFloat(val) >= parseFloat(limit));\n } });\n _('max', { fn: function fn(val, limit) {\n return !val || (this.type === 'checkbox' ? groupedElemCount(this) <= parseInt(limit) : parseFloat(val) <= parseFloat(limit));\n } });\n _('pattern', { fn: function fn(val, pattern) {\n var m = pattern.match(new RegExp('^/(.*?)/([gimy]*)$'));return !val || new RegExp(m[1], m[2]).test(val);\n } });\n _('equals', { fn: function fn(val, otherFieldSelector) {\n var other = document.querySelector(otherFieldSelector);return other && (!val && !other.value || other.value === val);\n } });\n\n function Pristine(form, config, live) {\n\n var self = this;\n\n init(form, config, live);\n\n function init(form, config, live) {\n\n form.setAttribute(\"novalidate\", \"true\");\n\n self.form = form;\n self.config = mergeConfig(config || {}, defaultConfig);\n self.live = !(live === false);\n self.fields = Array.from(form.querySelectorAll(SELECTOR)).map(function (input) {\n\n var fns = [];\n var params = {};\n var messages = {};\n\n [].forEach.call(input.attributes, function (attr) {\n if (/^data-pristine-/.test(attr.name)) {\n var name = attr.name.substr(14);\n var messageMatch = name.match(MESSAGE_REGEX);\n if (messageMatch !== null) {\n var locale = messageMatch[1] === undefined ? 'en' : messageMatch[1];\n if (!messages.hasOwnProperty(locale)) messages[locale] = {};\n messages[locale][name.slice(0, name.length - messageMatch[0].length)] = attr.value;\n return;\n }\n if (name === 'type') name = attr.value;\n _addValidatorToField(fns, params, name, attr.value);\n } else if (~ALLOWED_ATTRIBUTES.indexOf(attr.name)) {\n _addValidatorToField(fns, params, attr.name, attr.value);\n } else if (attr.name === 'type') {\n _addValidatorToField(fns, params, attr.value);\n }\n });\n\n fns.sort(function (a, b) {\n return b.priority - a.priority;\n });\n\n self.live && input.addEventListener(!~['radio', 'checkbox'].indexOf(input.getAttribute('type')) ? 'input' : 'change', function (e) {\n self.validate(e.target);\n }.bind(self));\n\n return input.pristine = { input: input, validators: fns, params: params, messages: messages, self: self };\n }.bind(self));\n }\n\n function _addValidatorToField(fns, params, name, value) {\n var validator = validators[name];\n if (validator) {\n fns.push(validator);\n if (value) {\n var valueParams = name === \"pattern\" ? [value] : value.split(',');\n valueParams.unshift(null); // placeholder for input's value\n params[name] = valueParams;\n }\n }\n }\n\n /***\n * Checks whether the form/input elements are valid\n * @param input => input element(s) or a jquery selector, null for full form validation\n * @param silent => do not show error messages, just return true/false\n * @returns {boolean} return true when valid false otherwise\n */\n self.validate = function (input, silent) {\n silent = input && silent === true || input === true;\n var fields = self.fields;\n if (input !== true && input !== false) {\n if (input instanceof HTMLElement) {\n fields = [input.pristine];\n } else if (input instanceof NodeList || input instanceof (window.$ || Array) || input instanceof Array) {\n fields = Array.from(input).map(function (el) {\n return el.pristine;\n });\n }\n }\n\n var valid = true;\n\n for (var i = 0; fields[i]; i++) {\n var field = fields[i];\n if (_validateField(field)) {\n !silent && _showSuccess(field);\n } else {\n valid = false;\n !silent && _showError(field);\n }\n }\n return valid;\n };\n\n /***\n * Get errors of a specific field or the whole form\n * @param input\n * @returns {Array|*}\n */\n self.getErrors = function (input) {\n if (!input) {\n var erroneousFields = [];\n for (var i = 0; i < self.fields.length; i++) {\n var field = self.fields[i];\n if (field.errors.length) {\n erroneousFields.push({ input: field.input, errors: field.errors });\n }\n }\n return erroneousFields;\n }\n if (input.tagName && input.tagName.toLowerCase() === \"select\") {\n return input.pristine.errors;\n }\n return input.length ? input[0].pristine.errors : input.pristine.errors;\n };\n\n /***\n * Validates a single field, all validator functions are called and error messages are generated\n * when a validator fails\n * @param field\n * @returns {boolean}\n * @private\n */\n function _validateField(field) {\n var errors = [];\n var valid = true;\n for (var i = 0; field.validators[i]; i++) {\n var validator = field.validators[i];\n var params = field.params[validator.name] ? field.params[validator.name] : [];\n params[0] = field.input.value;\n if (!validator.fn.apply(field.input, params)) {\n valid = false;\n\n if (typeof validator.msg === \"function\") {\n errors.push(validator.msg(field.input.value, params));\n } else if (typeof validator.msg === \"string\") {\n errors.push(tmpl.apply(validator.msg, params));\n } else if (validator.msg === Object(validator.msg) && validator.msg[currentLocale]) {\n // typeof generates unnecessary babel code\n errors.push(tmpl.apply(validator.msg[currentLocale], params));\n } else if (field.messages[currentLocale] && field.messages[currentLocale][validator.name]) {\n errors.push(tmpl.apply(field.messages[currentLocale][validator.name], params));\n } else if (lang[currentLocale] && lang[currentLocale][validator.name]) {\n errors.push(tmpl.apply(lang[currentLocale][validator.name], params));\n } else {\n errors.push(tmpl.apply(lang[currentLocale].default, params));\n }\n\n if (validator.halt === true) {\n break;\n }\n }\n }\n field.errors = errors;\n return valid;\n }\n\n /***\n * Add a validator to a specific dom element in a form\n * @param elem => The dom element where the validator is applied to\n * @param fn => validator function\n * @param msg => message to show when validation fails. Supports templating. ${0} for the input's value, ${1} and\n * so on are for the attribute values\n * @param priority => priority of the validator function, higher valued function gets called first.\n * @param halt => whether validation should stop for this field after current validation function\n */\n self.addValidator = function (elem, fn, msg, priority, halt) {\n if (elem instanceof HTMLElement) {\n elem.pristine.validators.push({ fn: fn, msg: msg, priority: priority, halt: halt });\n elem.pristine.validators.sort(function (a, b) {\n return b.priority - a.priority;\n });\n } else {\n console.warn(\"The parameter elem must be a dom element\");\n }\n };\n\n /***\n * An utility function that returns a 2-element array, first one is the element where error/success class is\n * applied. 2nd one is the element where error message is displayed. 2nd element is created if doesn't exist and cached.\n * @param field\n * @returns {*}\n * @private\n */\n function _getErrorElements(field) {\n if (field.errorElements) {\n return field.errorElements;\n }\n var errorClassElement = findAncestor(field.input, self.config.classTo);\n var errorTextParent = null,\n errorTextElement = null;\n if (self.config.classTo === self.config.errorTextParent) {\n errorTextParent = errorClassElement;\n } else {\n errorTextParent = errorClassElement.querySelector('.' + self.config.errorTextParent);\n }\n if (errorTextParent) {\n errorTextElement = errorTextParent.querySelector('.' + PRISTINE_ERROR);\n if (!errorTextElement) {\n errorTextElement = document.createElement(self.config.errorTextTag);\n errorTextElement.className = PRISTINE_ERROR + ' ' + self.config.errorTextClass;\n errorTextParent.appendChild(errorTextElement);\n errorTextElement.pristineDisplay = errorTextElement.style.display;\n }\n }\n return field.errorElements = [errorClassElement, errorTextElement];\n }\n\n function _showError(field) {\n var errorElements = _getErrorElements(field);\n var errorClassElement = errorElements[0],\n errorTextElement = errorElements[1];\n\n var input = field.input;\n\n var inputId = input.id || Math.floor(new Date().valueOf() * Math.random());\n var errorId = 'error-' + inputId;\n\n if (errorClassElement) {\n errorClassElement.classList.remove(self.config.successClass);\n errorClassElement.classList.add(self.config.errorClass);\n input.setAttribute('aria-describedby', errorId);\n input.setAttribute('aria-invalid', 'true');\n }\n if (errorTextElement) {\n errorTextElement.setAttribute('id', errorId);\n errorTextElement.setAttribute('role', 'alert');\n errorTextElement.innerHTML = field.errors.join('
    ');\n errorTextElement.style.display = errorTextElement.pristineDisplay || '';\n }\n }\n\n /***\n * Adds error to a specific field\n * @param input\n * @param error\n */\n self.addError = function (input, error) {\n input = input.length ? input[0] : input;\n input.pristine.errors.push(error);\n _showError(input.pristine);\n };\n\n function _removeError(field) {\n var errorElements = _getErrorElements(field);\n var errorClassElement = errorElements[0],\n errorTextElement = errorElements[1];\n var input = field.input;\n\n\n if (errorClassElement) {\n // IE > 9 doesn't support multiple class removal\n errorClassElement.classList.remove(self.config.errorClass);\n errorClassElement.classList.remove(self.config.successClass);\n input.removeAttribute('aria-describedby');\n input.removeAttribute('aria-invalid');\n }\n if (errorTextElement) {\n errorTextElement.removeAttribute('id');\n errorTextElement.removeAttribute('role');\n errorTextElement.innerHTML = '';\n errorTextElement.style.display = 'none';\n }\n return errorElements;\n }\n\n function _showSuccess(field) {\n var errorClassElement = _removeError(field)[0];\n errorClassElement && errorClassElement.classList.add(self.config.successClass);\n }\n\n /***\n * Resets the errors\n */\n self.reset = function () {\n for (var i = 0; self.fields[i]; i++) {\n self.fields[i].errorElements = null;\n }\n Array.from(self.form.querySelectorAll('.' + PRISTINE_ERROR)).map(function (elem) {\n elem.parentNode.removeChild(elem);\n });\n Array.from(self.form.querySelectorAll('.' + self.config.classTo)).map(function (elem) {\n elem.classList.remove(self.config.successClass);\n elem.classList.remove(self.config.errorClass);\n });\n };\n\n /***\n * Resets the errors and deletes all pristine fields\n */\n self.destroy = function () {\n self.reset();\n self.fields.forEach(function (field) {\n delete field.input.pristine;\n });\n self.fields = [];\n };\n\n self.setGlobalConfig = function (config) {\n defaultConfig = config;\n };\n\n return self;\n }\n\n /***\n *\n * @param name => Name of the global validator\n * @param fn => validator function\n * @param msg => message to show when validation fails. Supports templating. ${0} for the input's value, ${1} and\n * so on are for the attribute values\n * @param priority => priority of the validator function, higher valued function gets called first.\n * @param halt => whether validation should stop for this field after current validation function\n */\n Pristine.addValidator = function (name, fn, msg, priority, halt) {\n _(name, { fn: fn, msg: msg, priority: priority, halt: halt });\n };\n\n Pristine.addMessages = function (locale, messages) {\n var langObj = lang.hasOwnProperty(locale) ? lang[locale] : lang[locale] = {};\n\n Object.keys(messages).forEach(function (key, index) {\n langObj[key] = messages[key];\n });\n };\n\n Pristine.setLocale = function (locale) {\n currentLocale = locale;\n };\n\n return Pristine;\n\n})));\n"],"sourceRoot":""}