!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("../../../../common/v1/src")):"function"==typeof def&&def.amd?def("pcs-lead-form-v1",["vue","../../../../common/v1/src"],t):((e=e||self).phw=e.phw||{},e.phw.PcsLeadFormV1=t(e.Vue,e.PcsCommon))}(this,function(p,i){"use strict";p=p&&p.hasOwnProperty("default")?p.default:p,i=i&&i.hasOwnProperty("default")?i.default:i;var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};var h="undefined"!=typeof Reflect&&Reflect.defineMetadata&&Reflect.getOwnMetadataKeys;function f(i,o,a){(a?Reflect.getOwnMetadataKeys(o,a):Reflect.getOwnMetadataKeys(o)).forEach(function(e){var t=a?Reflect.getOwnMetadata(e,o,a):Reflect.getOwnMetadata(e,o);a?Reflect.defineMetadata(e,t,i,a):Reflect.defineMetadata(e,t,i)})}var g={__proto__:[]}instanceof Array;function m(e){"undefined"!=typeof console&&console.warn("[vue-class-component] "+e)}var y=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render","errorCaptured","serverPrefetch"];function a(e,o){void 0===o&&(o={}),o.name=o.name||e._componentTag||e.name;var a=e.prototype;Object.getOwnPropertyNames(a).forEach(function(t){if("constructor"!==t)if(-1()\[\]\\.,;:\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,}))$/,P=/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/,_="pcslead",b="lead_form_submit_click";function N(){this.constructor=r}function D(){var e=null!==l&&l.apply(this,arguments)||this;return e.elementTag=O,e.bindableModel=new d,e.error=new u,e.leadFormService=new t,e.searchFilter=i.SearchFilter,e.resultUpdated=!1,e.isLoggedIn=!1,e.profileDetails={},e.profile={},e.cachedLoactions=[],e.tempLanguagesList=[],e.piModel={firstName:{value:""},email:{value:""},lastName:{value:""},location:{value:"",locationsList:[]},languages:{value:"",languagesList:[],selectedLanguages:[],highlightLangs:[]},phone:{value:""}},e.isDirty={firstName:!1,email:!1,lastName:!1,location:!1,phone:!1,languages:!1},e.formFields=new M,e.validateFields=[],e}return{component:(l=i.BaseComponent,o(r=D,c=l),r.prototype=null===c?Object.create(c):(N.prototype=c.prototype,new N),D.prototype.widgetViewLoaded=function(){var t=this;this.element=this.$el,Object.keys(this.formFields).forEach(function(e){t.formFields[e]&&t.formFields[e].mandatory&&t.validateFields.push(e)}),this.fetchValidateJwtToken(),this.fetchLanguages()},D.prototype.fetchValidateJwtToken=function(){var t=this;this.leadFormService.makeDDORequest(n.v1.ddoKeyValidateJwtToken,{}).then(function(e){e&&e.data?(t.isLoggedIn=e.data.isValidToken&&!e.data.isAnonymous,t.isLoggedIn?t.fetchProfileData():(e.data.isAnonymous||e.data.isSocialLogin)&&t.fetchProfileData()):t.hideLoader()},function(e){t.hideLoader()})},D.prototype.fetchProfileData=function(){var t=this;return this.leadFormService.makeDDORequest(n.v1.ddoKeyMergedProfile,{flowType:"candidateProfile"}).then(function(e){e&&Object.keys(e).length&&"success"==e.status?(t.profileDetails.profile=JSON.parse(JSON.stringify(e))||[],t.isLoggedIn=!0):t.isLoggedIn=!1,t.hideLoader(),t.getProfileData(t.profileDetails)},function(e){return t.hideLoader(),!1})},D.prototype.getProfileData=function(e){var t=this;e.profile&&Object.keys(e.profile).length&&(this.profile=e.profile||{},this.piModel.firstName.value=this.profile.firstName,this.piModel.lastName.value=this.profile.lastName,this.piModel.email.value=this.profile.email,this.piModel.phone.value=this.profile.phone,this.profile.preferredLocation&&this.profile.preferredLocation[0]&&Object.keys(this.profile.preferredLocation[0]).length&&(this.piModel.location.selectedLocation=this.profile.preferredLocation[0],this.piModel.location.value=this.profile.preferredLocation[0].location_display),this.profile.languages.length&&(this.piModel.languages.selectedLanguages=[],this.piModel.languages.selectedLanguages.forEach(function(e){t.piModel.languages.selectedLanguages.push({location_html:e,location_display:e})})))},D.prototype.checkValidation=function(){var i=this,o="",a=!0;return this.validateFields.forEach(function(e){var t=i.checkFieldValidation(e,!0);o=o||t.focusField,a=t.isFormSubmitEnabled}),o&&setTimeout(function(){i.focusToField(o)},100),a},D.prototype.checkFieldValidation=function(e,t){var i="",o=!0;if(t||(this.isDirty[e]=!0),-1===this.validateFields.indexOf(e))return!0;"firstName"===e&&(this.piModel.firstName.value?(this.error.firstName=!1,this.error.isValidFirstName=!1):(this.error.firstName=!0,this.error.isValidFirstName=!1,i="#firstName")),"lastName"===e&&(this.piModel.lastName.value?(this.error.lastName=!1,this.error.isValidLastName=!1):(this.error.lastName=!0,this.error.isValidLastName=!1,i="#lastName")),"email"===e&&(this.piModel.email.value?w.test(this.piModel.email.value)?(this.error.isValidEmail=!1,this.error.email=!1):(this.error.email=!1,i="#email",this.error.isValidEmail=!0):(this.error.email=!0,i="#email",this.error.isValidEmail=!1)),"phone"===e&&(this.piModel.phone.value?P.test(this.piModel.phone.value)?(this.error.phone=!1,this.error.isValidPhone=!1):(this.error.phone=!1,i="#phone",this.error.isValidPhone=!0):(this.error.phone=!0,this.error.isValidPhone=!1,i="#phone")),"location"===e&&(this.piModel.location.selectedLocation&&this.piModel.location.value&&this.piModel.location.selectedLocation.location_display===this.piModel.location.value?this.error.location=!1:(this.error.location=!0,i="#location")),"languages"===e&&(this.piModel.languages.selectedLanguages.length?this.error.languages=!1:(this.error.languages=!0,i="#languages"));for(var a=["location","languages","firstName","lastName","email","isValidEmail","phone","isValidPhone"],n=0;n