(function( blueConic, undefined ) {var ps='https://plugins.blueconic.net/';var pf='/gallery/';(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.BCClass=function(){};BCClass.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=typeof g[d]=="function"&&typeof f[d]=="function"&&b.test(g[d])?(function(h,i){return function(){var k=this._super;this._super=f[h];var j=i.apply(this,arguments);this._super=k;return j}})(d,g[d]):g[d]}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.extend=arguments.callee;return c}})();var InteractionType=BCClass.extend({init:function(a){},getPreloadProperties:function(){return[]},getContent:function(){},onEvent:function(){},importLibraries:function(c){var e=[];var a=[];if(!c||c.length===0){return}for(var b=0;b<c.length;b++){var d=c[b];if(d&&d.sharing==="none"){e.push(d.url)}else{a.push(d.url)}}blueConic.fn.importLibraries.call(this,e);blueConic.fn.importAndCacheLibraries.call(this,a)}});(function(){ var InteractionTypeImpl=InteractionType.extend({PF_PROPERTY_PREFIX:"aapf",PUSH_FREQUENCY_PLC:"plc",ALL_VISITORS_SEGMENT:"allvisitors",ADOBE_EVENT_VARIABLE:"events",init:function(t,e){this.blueConicClient=t,this.context=e,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.segments=this.blueConicClient.getSegments(),this.preloadProperties=[],this.rsid=this._getValues("rsid",this.parameters),this.rsid=this.rsid.length?this.rsid.join(","):null;var i=this._parseGoals();this.goal=i.length?i[0]:null,this.goal&&(this.connectionContext={LAST_PUSH_PROPERTY:this.PF_PROPERTY_PREFIX+"lt"+this.context.getInteractionId(),VARIABLE_STATE_PUSH_PROPERTY:this.PF_PROPERTY_PREFIX+"st"+this.context.getInteractionId(),push_frequency:this.goal.pushFrequency,profile:this.profile,variables:[],SENT_TO_SYSTEM_PROPERTY:"sent_to_system",SENT_TO_CONNECTION_PROPERTY:"sent_to_connection"},this.preloadProperties.push(this.connectionContext.LAST_PUSH_PROPERTY,this.connectionContext.VARIABLE_STATE_PUSH_PROPERTY,this.connectionContext.SENT_TO_SYSTEM_PROPERTY,this.connectionContext.SENT_TO_CONNECTION_PROPERTY))},getPreloadProperties:function(){return this.goal?this.preloadProperties:[]},onLoad:function(){if(this.goal){var t=this,e=0;(function aaReady(){if(window.s||window.s_gi)t._doCall();else{if(e>20)return;e++,window.setTimeout(aaReady,250)}}).call(this)}},_doCall:function(){for(var t=0;t<this.goal.events.length;t++)this.blueConicClient.event.subscribe(this.goal.events[t],this,(function(){this._doPush()}));this.bcConnectionUtil.doPush(this.connectionContext)&&this._doPush()},_doPush:function(){if(this.goal.linkName&&this.goal.mappingRules.length){var t=window.s;if(this.rsid&&window.s_gi&&(t=window.s_gi(this.rsid)),!t||!t.tl)return;t.linkTrackEvents="None";for(var e=!1,i=[],n=0;n<this.goal.mappingRules.length;n++){var s=this.goal.mappingRules[n],o=this._getIdFromMapping(s.to);i.push(o);var r=this.bcConnectionUtil.getVariableValue(s.from,this.connectionContext);o===this.ADOBE_EVENT_VARIABLE&&(r=this._sanitizeEventValue(r),t.linkTrackEvents=this._sanitizeEventValue(r)),r&&(e=!0,t[o]=r)}if(i=i.concat(this.goal.pageVariables),t.linkTrackVars=i.join(","),e){t.tl(!0,"o",this.goal.linkName),t.linkTrackVars="None",t.linkTrackEvents="None";for(var a=0;a<this.goal.mappingRules.length;a++){var l=this._getIdFromMapping(this.goal.mappingRules[a].to);l&&(t[l]="")}this.bcConnectionUtil.setSyncProperties(this.context,this.profile,[this.connectionContext.SENT_TO_SYSTEM_PROPERTY,this.connectionContext.SENT_TO_CONNECTION_PROPERTY])}}},_getValue:function(t,e){return e[t]&&e[t][0]?e[t][0]:null},_getValues:function(t,e){return e[t]?e[t]:[]},_parseGoals:function(){for(var t=[],e=this._getValues("goalParameters",this.parameters),i=0;i<e.length;i++){var n=this._parseGoal(blueConicClient.json.parse(e[i]));n&&t.push(n)}return t},_parseGoal:function(t){var e=null,i=t.parameters;return t.active&&this._validSegment(this._getValue("exportSegment",i))&&((e={pushFrequency:this._getValue("push_frequency",i),linkName:this._getValue("linkname",i),pageVariables:this._getValues("page_variables",i),mappingRules:this._parseMappingParameters(this._getValue("exportMapping",i)),triggerEvent:this._getValue("triggerEvent",i),events:[]}).triggerEvent&&e.events.push(e.triggerEvent),e.pushFrequency===this.PUSH_FREQUENCY_PLC&&e.events.push(this.blueConicClient.event.onProfilePermissionChange)),e},_validSegment:function(t){if(t===this.ALL_VISITORS_SEGMENT)return!0;for(var e=0;e<this.segments.length;e++)if(this.segments[e].id===t)return!0;return!1},_parseMappingParameters:function(t){var e=[];if(t&&(t=this.blueConicClient.json.parse(t),Array.isArray(t)))for(var i=0;i<t.length;i++){var n=t[i];this._isMappingRuleValid(n)&&(e.push(n),"property"===n.from.typeId&&this._getIdFromMapping(n.from)&&this.preloadProperties.push(this._getIdFromMapping(n.from)))}return e},_isMappingRuleValid:function(t){return t.to&&this._getIdFromMapping(t.to)&&t.from&&t.from.typeId},_getIdFromMapping:function(t){return t.values&&t.values[0]&&t.values[0].id?t.values[0].id:null},_sanitizeEventValue:function(t){return t&&(t=t.replace(/:/g,"_")),t}});var a = [];var i='adobeanalyticsconnection';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.2.2/frontend/src/node_modules/@blueconic/connection_lib/connection_lib.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.2.2/'}]);})();(function(){ var InteractionTypeImpl;(()=>{"use strict";var t,e,i,o,a,r={d:(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},n={};r.d(n,{default:()=>E}),(a=t||(t={})).SEGMENT="segment",a.LIFECYCLE="lifecycle",a.PROPERTY="property",a.TEXT="text",a.STORE="store",a.EMPTY="empty",a.GROUP="group",a.TIMELINE_EVENT="timelineEvent",a.EXPORT_DATA_PROCESSOR="exportDataPreprocessor",a.GROUP_PROPERTY="groupProperty",(o=e||(e={})).FIXED="fixed",o.SEGMENT="segment",o.SEGMENTS="segments",o.LIFECYCLES="lifecycles",o.PROPERTY="property",o.UNIQUE_PROPERTY="uniqueproperty",o.GROUP_PROPERTY="groupProperty",o.PROPERTY_SOURCE_TENANT="propertySourceTenant",o.GROUP_ID="groupId",o.TEXT="text",o.STORE="store",o.PROFILE_ID="profileid",o.PERMISSION="permission",o.ALL_INTERACTIONS="allInteractions",o.PAGEVIEW_INTERACTIONS="pageviewInteractions",o.TIMELINE_EVENT_TYPE="timeline_event_type",o.TIMELINE_EVENT="timelineEvent",o.TIMELINE_EVENT_CLEANROOM="timelineEventCleanroom",o.TIMELINE_DATE_ID="timelineDateId",o.TIMELINE_EVENT_ID="timelineEventId",o.TIMELINE_PROPERTY="timelineProperty",o.PLUGIN="plugin",o.EXPORT_DATA_PROCESSOR="exportDataPreprocessor",function(t){t.SET_OR_CLEAR="setOrClear",t.ADD="add",t.SUM="sum",t.SET_IF_EMPTY="setIfEmpty",t.SET="set"}(i||(i={}));const s=Object.freeze({SETUP:"setup",IMPORT:"import",EXPORT:"export"}),l=(Object.freeze({SINGLE:"single",MULTIPLE:"multiple"}),"dlpf");class E extends InteractionType{init(t,e){this.blueConicClient=t,this.context=e||null,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.interactionId=this.context.getInteractionId(),this.objectName=this.getObjectName(this.parameters.goalParameters),this.createDatalayer=this.getDatalayerCreateOption(this.parameters.goalParameters),this._goals=[];const i=e.getGoals().reduce((function(t,e){return t[e.getId()]=!0,t}),{});if(this.parameters.goalParameters)for(const e of this.parameters.goalParameters){const o=t.json.parse(e);o.active&&i[o.id]&&this._goals.push(o)}this.connectionContext={LAST_PUSH_PROPERTY:l+"lt"+this.context.getInteractionId(),VARIABLE_STATE_PUSH_PROPERTY:l+"st"+this.context.getInteractionId(),profile:this.profile,variables:[],SENT_TO_SYSTEM_PROPERTY:"sent_to_system",SENT_TO_CONNECTION_PROPERTY:"sent_to_connection",RECEIVED_FROM_SYSTEM_PROPERTY:"received_from_system",RECEIVED_FROM_CONNECTION_PROPERTY:"received_from_connection"}}getObjectName(t){var e;const i=this.getSetupGoal(t);return(null===(e=null==i?void 0:i.state)||void 0===e?void 0:e.objectname)||"dataLayer"}getDatalayerCreateOption(t){var e;const i=this.getSetupGoal(t);return Boolean(null===(e=null==i?void 0:i.state)||void 0===e?void 0:e.createDatalayer)}getSetupGoal(t){var e;return null===(e=t.map((t=>JSON.parse(t))).filter((t=>t.categoryId===s.SETUP)))||void 0===e?void 0:e[0]}initDataLayerUtil(){this.bcConnectionUtil.md5Lib=this.md5,this._bcDatalayerUtil=new this.BlueConicDataLayerUtility(this.objectName,this.blueConicClient,this.bcConnectionUtil,this.context,this.connectionContext,this.profile),this._bcDatalayerUtil.LAST_PUSH_PROPERTY=l+"lt"+this.context.getInteractionId(),this._bcDatalayerUtil.VARIABLE_STATE_PUSH_PROPERTY=l+"st"+this.context.getInteractionId();const t=this;this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,(function(){t._bcDatalayerUtil.stopDataLayerInspection()}))}onLoad(){return new Promise((t=>{this.initDataLayerUtil();let e=0;this.createDatalayer&&this._bcDatalayerUtil.createDatalayer();const i=async()=>{if(this._bcDatalayerUtil.getDataLayer())await this._handleGoals(),t();else{if(e>20)return void t();e++,window.setTimeout(i,250)}};i.call(this)}))}async loadTimelineEventTypes(){var t;const e=[],i=this.blueConicClient.getRestEndpoint(this.context.getInteractionTypeId())+"/timelineEventTypePropertyTypes";for(const i of this._goals)i.categoryId===s.IMPORT&&(null===(t=i.state.importEventMapping)||void 0===t?void 0:t.length)&&e.push(...i.state.importEventMapping.map((t=>t.eventTypeId)));await this._bcDatalayerUtil.loadTimelineEventTypeProperties(e,i)}async _handleGoals(){var t;await this.loadTimelineEventTypes();for(const e of this._goals){const i=null===(t=null==e?void 0:e.state)||void 0===t?void 0:t.segment;this._bcDatalayerUtil.visitorInSegment(i)&&(e.categoryId===s.EXPORT&&this._handleExportGoal(e.state,e.id),e.categoryId===s.IMPORT&&this._handleImportGoal(e.state,e.id))}}_handleImportGoal(t,e){this._bcDatalayerUtil.getDataLayer()&&this._bcDatalayerUtil.doImport(t,e)}_handleExportGoal(t,e){this._bcDatalayerUtil.doExport(t,e)}_addPreloadPropertiesFromGoal(t,e){if(t.categoryId===s.EXPORT){e.push(`${l}st${this.context.getInteractionId()}_${t.id}`,`${l}lt${this.context.getInteractionId()}_${t.id}`);for(const i of t.state.exportMapping)this._addPreloadPropertiesFromExportMapping(i,e)}else if(t.categoryId===s.IMPORT)for(const i of t.state.importMapping)this._addPreloadPropertiesFromImportMapping(i,e)}_addPreloadPropertiesFromImportMapping(t,e){t.to.values.length>0&&e.push(t.to.values[0].id)}_addPreloadPropertiesFromExportMapping(e,i){e.from.dataType===t.PROPERTY&&e.from.values.length>0&&i.push(e.from.values[0].id)}getPreloadProperties(){const t=[this.connectionContext.SENT_TO_SYSTEM_PROPERTY,this.connectionContext.SENT_TO_CONNECTION_PROPERTY,this.connectionContext.RECEIVED_FROM_SYSTEM_PROPERTY,this.connectionContext.RECEIVED_FROM_CONNECTION_PROPERTY];for(const e of this._goals)this._addPreloadPropertiesFromGoal(e,t);return t}}InteractionTypeImpl=n.default})();var a = [];var i='connection_datalayer';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/3.1.5/web/node_modules/@blueconic/connection_lib/connection_lib.js', sharing: 'local'});a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/3.1.5/web/node_modules/@blueconic/datalayer-library/dist/index.js', sharing: 'local'});a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/3.1.5/web/src/web/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/3.1.5/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({blueConicClient:null,context:null,profile:null,parameters:null,objectName:null,DEFAULT_EVENT_NAME:"BlueConic",SENT_TO_SYSTEM_PROPERTY:"sent_to_system",SENT_TO_CONNECTION_PROPERTY:"sent_to_connection",PF_PROPERTY_PREFIX:"dypf",_LAST_PUSH_PROPERTY:null,_VARIABLE_STATE_PUSH_PROPERTY:null,_goalParams:null,_preloadProperties:null,_hasSynchronized:!1,_visitorSegmentIds:[],init:function(t,e){this.blueConicClient=t,this.context=e,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this._LAST_PUSH_PROPERTY=this.PF_PROPERTY_PREFIX+"lt"+this.context.getInteractionId(),this._VARIABLE_STATE_PUSH_PROPERTY=this.PF_PROPERTY_PREFIX+"st"+this.context.getInteractionId(),this._visitorSegmentIds=this._getVisitorSegmentIds(),this._goalParams=this._parseGoalParams(this.parameters.goalParameters),this._fillPreloadProperties()},_getVisitorSegmentIds:function(){return this.blueConicClient.getSegments().map(function(t){return t.id})||[]},_parseGoalParams:function(t){return t.map(function(t){return t&&this.blueConicClient.json.parse(t)},this).filter(function(t){return t&&t.active&&t.parameters}).map(function(t){return t.parameters.id=t.id,t.parameters.exportMapping=this._parseExportMapping(t.parameters.exportMapping),t.parameters},this)},_parseExportMapping:function(t){return(t&&this.blueConicClient.json.parse(t[0])||[]).filter(function(t){return this._isValidExportMapping(t)},this)},_isValidExportMapping:function(t){var e=t&&t.from&&t.to&&t.to.values&&t.to.values[0]&&t.to.values[0].id&&("property"!==t.from.typeId||t.from.values&&t.from.values[0]&&t.from.values[0].id);return Boolean(e)},_fillPreloadProperties:function(){this._preloadProperties=[this.SENT_TO_SYSTEM_PROPERTY,this.SENT_TO_CONNECTION_PROPERTY],this._goalParams.forEach(function(t){this._preloadProperties.push(this._LAST_PUSH_PROPERTY+"_"+t.id),this._preloadProperties.push(this._VARIABLE_STATE_PUSH_PROPERTY+"_"+t.id),t.exportMapping.forEach(function(t){var e=t.from&&"property"===t.from.typeId&&t.from.values&&t.from.values[0]&&t.from.values[0].id;e&&-1===this._preloadProperties.indexOf(e)&&this._preloadProperties.push(t.from.values[0].id)},this)},this)},getPreloadProperties:function(){return this._preloadProperties},onLoad:function(){this.bcConnectionUtil.md5Lib=window.md5;var t=this,e=0;(function i(){if(window.DY&&window.DY.API)t._handleGoals();else{if(e>20)return;e++,window.setTimeout(i,250)}}).call(this)},_handleGoals:function(){this._goalParams.forEach(function(t){this._isSegmentValid(t.segment)&&this._applyGoal(t)},this)},_isSegmentValid:function(t){var e=!t||0===t.length,i=t&&t[0]&&-1!==this._visitorSegmentIds.indexOf(t[0]);return e||i},_applyGoal:function(t){var e=this._createConnectionContext(t);this._pushProfileValues(t,e),t.triggerEvent&&t.triggerEvent[0]&&this.blueConicClient.event.subscribe(t.triggerEvent[0],this,function(){this._doPush(t,e)})},_pushProfileValues:function(t,e){this.bcConnectionUtil.doPush(e)?this._doPush(t,e):"plc"===e.push_frequency&&this.blueConicClient.event.subscribe(this.blueConicClient.event.onProfilePermissionChange,this,function(){this._doPush(t,e)})},_doPush:function(t,e){var i=t.exportMapping,r={separator:t.exportSeparator&&t.exportSeparator[0]?t.exportSeparator[0]:"|"};if(0===i.length)return!1;var n={},o=!1;if(i.forEach(function(t){var i=this.bcConnectionUtil.getVariableValue(t.from,e,!1,r);if(i){var s=parseInt(i).toString()===i;n[t.to.values[0].id]=s?parseInt(i):i,o=!0}},this),o){var s=this._getEventNameForGoal(t);window.DY.API("event",{name:s,properties:n}),this._syncProperties()}return o},_createConnectionContext:function(t){var e={LAST_PUSH_PROPERTY:this._LAST_PUSH_PROPERTY+"_"+t.id,VARIABLE_STATE_PUSH_PROPERTY:this._VARIABLE_STATE_PUSH_PROPERTY+"_"+t.id,profile:this.profile,push_frequency:t.push_frequency&&t.push_frequency[0]?t.push_frequency[0]:null,variables:r,SENT_TO_SYSTEM_PROPERTY:this.SENT_TO_SYSTEM_PROPERTY,SENT_TO_CONNECTION_PROPERTY:this.SENT_TO_CONNECTION_PROPERTY},i={separator:t.exportSeparator&&t.exportSeparator[0]?t.exportSeparator[0]:"|"},r=[];return t.exportMapping.forEach(function(t){var n=t.from;this.bcConnectionUtil.getVariableValue(n,e,!1,i)&&(n.key=t.to.values[0].id,r.push(n))}),e.variables=r,e},_getEventNameForGoal:function(t){return t.eventname&&t.eventname[0]||this.DEFAULT_EVENT_NAME},_syncProperties:function(){this._hasSynchronized||(this.bcConnectionUtil.setSyncProperties(this.context,this.profile,[this.SENT_TO_SYSTEM_PROPERTY,this.SENT_TO_CONNECTION_PROPERTY]),this._hasSynchronized=!0)}});var a = [];var i='connection_dynamic_yield';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.0.6/frontend/src/node_modules/@blueconic/connection_lib/connection_lib.js', sharing: 'local'});a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.0.6/frontend/src/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.0.6/'}]);})();(function(){ var inactivityConnection={init:function(t,e){this.blueConicClient=t,this.context=e,this.profile=this.blueConicClient.profile.getProfile(),this.parameters=this.context.getParameters()},getPreloadProperties:function(){return(this.parameters.goalParameters?this.parameters.goalParameters:[]).map(function(t){return this.blueConicClient.json.parse(t)},this).filter(function(t){return t.active}).reduce(function(t,e){return e.parameters.mapping.forEach(function(e){t.push(e.inactivityProperty),t.push(e.lastModifiedProperty)}),t},[]).filter(function(t){return t})},onLoad:function(){var t=this.blueConicClient.getChannelId(),e=this.parameters.goalParameters?this.parameters.goalParameters:[];e=e.map(function(t){return this.blueConicClient.json.parse(t)},this).filter(function(t){return t.active}).filter(function(e){return 0===e.parameters.channels.length||-1!==e.parameters.channels.indexOf(t)});var i=!1;e.forEach(function(t){t.parameters.mapping.forEach(function(t){t.inactivityProperty&&t.lastModifiedProperty&&(parseInt(this.profile.getValue(t.lastModifiedProperty))>parseInt(this.profile.getValue(t.inactivityProperty))&&(this.profile.setValues(t.inactivityProperty,[]),i=!0))},this)},this),i&&this.blueConicClient.profile.updateProfile()}};try{var InteractionTypeImpl=InteractionType.extend(inactivityConnection)}catch(t){try{module.exports=inactivityConnection}catch(t){}};var a = [];var i='connection_inactivity';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/2.0.1/'}]);})();(function(){ var contentSpecial={html:{nl:{content:'<div class="bcCSContent">Plaats hier uw content</div>'},default:{content:'<div class="bcCSContent">Place your content here</div>'}},init:function(t,e){this.blueConicClient=t,this.context=e||null,this.profile=t.profile.getProfile(),this.element=this.context.getDOMElement(),this.identifier="bc_"+this.context.getInteractionId(),this.parameters=this.context.getParameters(),this.currentInsertType=this.parameters.inserttype&&this.parameters.inserttype[0]?this.parameters.inserttype[0]:"replace","replacecontainer"!==this.currentInsertType||document.getElementById(this.identifier)||this._hidePosition();var i=this.parameters.content+"";this.htmlFragment=this._createElement(i);try{this.htmlFragment&&this.htmlFragment.childNodes&&Array.from(this.htmlFragment.childNodes).forEach(function(t){t.nodeType===window.Node.ELEMENT_NODE&&t.classList.add("bcContentDialogue")})}catch(t){console.error("Error adding class to child nodes: ",t)}this._lastEvent=null,this._inlineCss=null,this._lastCheckDate=null,this._timeoutID=null},getPreloadProperties:function(){return this.htmlFragment?this._getPropertiesFromPlaceholders(this.htmlFragment.innerHTML):[]},getContent:function(){return this._handleStyling(),this.htmlFragment?(this.element||(this.element=this.context.getDOMElement()),"replace"===this.currentInsertType?(this._emptyElementsWithAttribute(this.htmlFragment,"div","data-bc-external"),this.htmlFragment.innerHTML):void 0):null},onUpdate:function(){this.currentInsertType!==this.context.getParameters().inserttype[0]&&document.location.reload()},onLoad:function(){window.bc=window.bc||{},window.bc.jQuery=this.jQuery,window.bc.$=this.jQuery,this.currentInsertType&&this._placeContent(),this.blueConicClient.isInEditMode()&&this.blueConicClient.event.publish("contentinteractiontypespecial.interactionLoaded",{interaction:this})},onMessageReceived:function(t){this.blueConicClient.event.publish("contentinteractiontypespecial.messageReceived",t)},_hidePosition:function(){this.styleIdentifier="bcCS"+this.context.getInteractionId();var t=this.context.getPosition()+" {opacity: 0 !important}",e=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0],i=document.createElement("style");i.type="text/css",i.id=this.styleIdentifier,i.styleSheet?i.styleSheet.cssText=t:i.innerHTML=t,e.appendChild(i)},_showPosition:function(){this.jQuery("#"+this.styleIdentifier).remove()},_placeContent:function(){var t=this.element||this.context.getDOMElement();if(t&&(this._handleStyling(),this.blueConicClient.isInEditMode()||this._handleURLs(this.htmlFragment),"replace"!==this.currentInsertType?this.htmlFragment&&(this._emptyElementsWithAttribute(this.htmlFragment,"div","data-bc-external"),this._setContent()):this._replaceContent(t),!this.blueConicClient.isInEditMode())){var e=this.parameters.clickselector&&this.parameters.clickselector[0]?this.parameters.clickselector[0]:"";if(e){this.jQuery("body").one("click",e,function(t){this._lastEvent&&this._lastEvent.originalEvent===t.originalEvent||this._logClickEvent(t)}.bind(this));try{this.jQuery(e).one("click",function(t){this.lastEvent=t,this._logClickEvent(t)}.bind(this))}catch(t){}}!!this.parameters.forceclick&&("true"===this.parameters.forceclick[0]||!0===this.parameters.forceclick[0])&&this.blueConicClient.createEvent("CLICK",this.context.getInteractionId());var i=this.parameters.javascript&&this.parameters.javascript[0]?this.parameters.javascript[0]:"";if(i)try{i=i.replace(/(^|\W)blueConicVariantId(\W|$)/g,'$1"'+this.context.getInteractionId()+'"$2'),this.jQuery("<script>"+i+"<\/script>").appendTo(this.jQuery("body"))}catch(t){console.error(t)}}},_replaceContent:function(t){this._assureVisibilty(t);var e=this.getContent();if(e){var i=t.nodeName?t.nodeName.toLowerCase():t.nodeName;if(-1===this.blueConicClient.util.array.indexOfArray(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],i))if(this.blueConicClient.isInEditMode&&this.blueConicClient.isInEditMode())t.innerHTML!==e&&(t.innerHTML=e);else try{this.jQuery(t).html(e)}catch(t){console.error(t)}else if(t.parentNode){var n=t.parentNode.innerHTML,r=document.createElement("div");r.appendChild(t.cloneNode(!0));var s=r.innerHTML,o=n.replace(s,e);t.parentNode.innerHTML!==o&&(t.parentNode.innerHTML=o)}this._handleComplexObjects(t),this._trackView(t)}},_setContent:function(){var t=this._getElementByPosition(this.context.getPosition());if(t){var e=t.parent().get(0),i=this.jQuery('[data-bc-id="'+this.identifier+'"],#'+this.identifier);if(i.length>0)return this.blueConicClient.isInEditMode&&this.blueConicClient.isInEditMode()?null:(i.replaceWith(this.htmlFragment.innerHTML),this._handleComplexObjects(e),void("prepend"===this.currentInsertType?(t.prev().attr("data-bc-id",this.identifier),this._trackView(t.prev().get(0))):"append"===this.currentInsertType&&(t.next().attr("data-bc-id",this.identifier),this._trackView(t.next().get(0)))));if("prepend"===this.currentInsertType){var n=t.prev();if(n.length>0&&n.attr("data-bc-id")===this.identifier)return;if(this.blueConicClient.isInEditMode&&this.blueConicClient.isInEditMode())t.get(0).parentNode.insertBefore(this.htmlFragment,t.get(0)),this.blueConicClient.functions.setEditableNode("#bc_"+this.context.getInteractionId(),{positionName:"prepend",lockPosition:!0,redrawPosition:!0});else{try{t.before(this.htmlFragment.innerHTML)}catch(t){console.error(t)}var r=t.prev();r.attr("data-bc-id",this.identifier),this._trackView(r.get(0))}}if("append"===this.currentInsertType){var s=t.next();if(s.length>0&&s.attr("data-bc-id")===this.identifier)return;if(this.blueConicClient.isInEditMode&&this.blueConicClient.isInEditMode())t.get(0).parentNode.insertBefore(this.htmlFragment,t.get(0).nextSibling),this.blueConicClient.functions.setEditableNode("#bc_"+this.context.getInteractionId(),{positionName:"append",lockPosition:!0,redrawPosition:!0});else{try{t.after(this.htmlFragment.innerHTML)}catch(t){console.error(t)}var o=t.next();o.attr("data-bc-id",this.identifier),this._trackView(o.get(0))}}if("replacecontainer"===this.currentInsertType){if(this.blueConicClient.isInEditMode&&this.blueConicClient.isInEditMode())t.get(0).parentNode.replaceChild(this.htmlFragment,t.get(0)),this.blueConicClient.functions.setEditableNode("#bc_"+this.context.getInteractionId(),{positionName:"replace container",lockPosition:!0,redrawPosition:!0});else{var a=this.jQuery(this.htmlFragment.innerHTML).replaceAll(t);this._trackView(a.get(0))}this._showPosition()}this.blueConicClient.isInEditMode()&&null===this.context.getInteractionId()&&setTimeout(function(){window.blueConicClient.fn.postMessage("onOpenEditMode",window.blueConicClient.positionHandlers[0])},500),this._handleComplexObjects(e)}},_trackView:function(t){this.blueConicClient.isInEditMode()||(!(!this.parameters.trackviewwhenvisible||!this.parameters.trackviewwhenvisible[0])&&"true"===this.parameters.trackviewwhenvisible[0]?this._isVisible(t)?this.blueConicClient.createEvent("VIEW",this.context.getInteractionId()):(this._lastCheckDate=(new Date).getTime(),this.jQuery(document).on("scroll.bcCSP"+this.identifier,function(){this._checkVisibility(t)}.bind(this)),this.jQuery(window).on("resize.bcCSP"+this.identifier,function(){this._checkVisibility(t)}.bind(this)),this._checkVisibility(t)):this.blueConicClient.createEvent("VIEW",this.context.getInteractionId()))},_checkVisibility:function(t){if((new Date).getTime()-this._lastCheckDate>=500&&(this._lastCheckDate=(new Date).getTime(),this._isVisible(t)))return this.blueConicClient.createEvent("VIEW",this.context.getInteractionId()),this.jQuery(document).off("scroll.bcCSP"+this.identifier),this.jQuery(window).off("resize.bcCSP"+this.identifier),void clearTimeout(this._timeoutID);clearTimeout(this._timeoutID),this._timeoutID=setTimeout(function(){this._checkVisibility(t)}.bind(this),1500)},_isVisible:function(t){var e=t.getBoundingClientRect();return e.top>=0&&e.top<window.innerHeight&&this.jQuery(t).is(":visible")},_logClickEvent:function(t){t&&t.originalEvent&&t.originalEvent._blueConicLoggedClickEvent===this.context.getInteractionId()||(t&&t.target&&t.target.pathname&&t.target.hostname&&0===t.target.pathname.indexOf("/s/")&&-1!==t.target.hostname.indexOf("blueconic")||(t.originalEvent&&(t.originalEvent._blueConicLoggedClickEvent=this.context.getInteractionId()),this.blueConicClient.createEvent("CLICK",this.context.getInteractionId())))},_getElementByPosition:function(t){var e=document.getElementById(t);return e=e?this.jQuery(e):this.jQuery(t)},_createElement:function(t){var e;if(!t){if(!this.blueConicClient.isInEditMode()||"prepend"!==this.currentInsertType&&"append"!==this.currentInsertType)return null;var i="nl"===this.context.getLocale()?"nl":"default";t=this.html[i].content}try{(e=document.createElement("div")).id=this.identifier,e.innerHTML=t}catch(t){return null}return e},_handleURLs:function(t){if(!(!this.parameters.newwindow||!this.parameters.newwindow[0])&&"true"===this.parameters.newwindow[0])for(var e=t.getElementsByTagName("a"),i=0,n=e.length;i<n;i++){var r=e[i];r.getAttribute("target")||r.setAttribute("target","_blank")}this._handlePlaceholders(t)},_assureVisibilty:function(t){this.blueConicClient.isInEditMode&&this.blueConicClient.isInEditMode()&&(t.style.minWidth="10px",t.style.minHeight="10px")},_handlePlaceholders:function(t){for(var e=this._getPropertiesFromPlaceholders(t.innerHTML),i=0;i<e.length;i++){var n=e[i],r=this.profile.getValue(n)||"",s=new RegExp("\\$\\{"+n+"\\}","g");t.innerHTML=t.innerHTML.replace(s,encodeURI(r))}},_getPropertiesFromPlaceholders:function(t){for(var e,i=/\$\{([a-zA-Z\-_0-9]+)\}/g,n=[];null!==(e=i.exec(t));)n.push(e[1]);for(var r=/data-bc-preload="([^"]*)"/g,s=[];null!==(e=r.exec(t));)for(var o=e[1].split(","),a=0;a<o.length;a++)s.push(o[a]);return n.concat(s)},_emptyElementsWithAttribute:function(t,e,i){for(var n=this.getElementsWithAttribute(t,e,i),r=0,s=n.length;r<s;r++){n[r].innerHTML=""}},getElementsWithAttribute:function(t,e,i){for(var n=[],r=t.getElementsByTagName(e),s=0,o=r.length;s<o;s++){var a=r[s];a.getAttribute(i)&&n.push(a)}return n},_handleComplexObjects:function(t){for(var e=this.getElementsWithAttribute(t,"div","data-bc-pluginid"),i=0;i<e.length;i++){var n=e[i],r=n.getAttribute("data-bc-pluginid"),s=n.getAttribute("data-bc-config");if(s)try{var o=s.replace(/\n/g,"\\\\n").replace(/\r/g,"\\\\r").replace(/\t/g,"\\\\t");s=this.blueConicClient.json.parse(o)}catch(t){s=null}this.blueConicClient.event.publish("bcComplexObject",{plugin:r,config:s,node:n,interactionId:this.context.getInteractionId()}),this.blueConicClient.isInEditMode()||(n.removeAttribute("data-bc-pluginid"),n.removeAttribute("data-bc-config"))}},_handleStyling:function(){var t="bcIS"+this.context.getInteractionId(),e=this.parameters.styling_css_inline&&this.parameters.styling_css_inline[0]?this.parameters.styling_css_inline[0]:"";e&&(this.inlineCss=document.getElementById(t),this.inlineCss||(this.inlineCss=document.createElement("style"),this.inlineCss.id=t,this.inlineCss.innerHTML=e.replace(/&#xd;/gi,""),document.head.appendChild(this.inlineCss)))}};try{var InteractionTypeImpl=InteractionType.extend(contentSpecial)}catch(t){try{module.exports=contentSpecial}catch(t){}};var a = [];var i='contentinteractiontypespecial';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/4.2.0/frontend/src/node_modules/@blueconic/jquery-x-jquerymigrate/load_jQuery3_7_X_jQueryMigrate.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/4.2.0/'},{ id : 'boolean', baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + 'boolean/1.0.1/'},{ id : 'html', baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + 'html/1.0.10/'},{ id : 'string', baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + 'string/1.0.1/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(e,r){this.blueConicClient=e,this.context=r},getPreloadProperties:function(){return this.preloadProperties=[],this.context&&(this.preloadProperties=this.getProfilePropertiesFromParameters(this.context.getParameters())),this.preloadProperties},onLoad:function(){var e=this.context.getProfile(),r=this.context.getParameters(),t=this.jQuery,i=r.listener_rules?r.listener_rules[0]:r.listener_rules;if(i){i=this.blueConicClient.json.parse(i);var s=new this.RuleService(this.blueConicClient,e,t);s.applyRules(i),s.save()}},getProfilePropertiesFromParameters:function(e){var r=[],t=e.listener_rules?e.listener_rules[0]:e.listener_rules;if(!t)return r;t=this.blueConicClient.json.parse(t);for(var i=0;i<t.rules.length;i++){var s=t.rules[i];!s.profileproperty||"set_if_empty"!==s.addset&&"merge"!==s.addset||r.push(s.profileproperty[0].profileproperty)}return r}});var a = [];var i='enrichprofilebyvisitorbehavior';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + 'enrichProfileByVisitorBehavior/5.4.9/frontend/src/node_modules/@blueconic/jquery-x-jquerymigrate/load_jQuery3_7_X_jQueryMigrate.min.js', sharing: 'local'});a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + 'enrichProfileByVisitorBehavior/5.4.9/frontend/src/js/ruleService.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + 'enrichProfileByVisitorBehavior/5.4.9/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(e,r){this.blueConicClient=e,this.context=r,this.parameters=this.context.getParameters(),this.rules=this._migrate(this.parameters.version||1)},getPreloadProperties:function(){return this.preloadProperties=[],this.context&&(this.preloadProperties=this.getProfilePropertiesFromParameters()),this.preloadProperties},onLoad:function(){if(this.rules){var e=this.context.getProfile();new window.FormRuleService(this.blueConicClient,e,this.jQuery).applyRules(this.rules)}},getProfilePropertiesFromParameters:function(){if(this.rules){for(var e=[],r=0;r<this.rules.length;r++){var t=this.rules[r];t.profileProperty&&"set_if_empty"===t.addset&&e.push(t.profileProperty)}return e}},_migrate:function(e){var r=this.parameters.form_listener_rules?this.parameters.form_listener_rules[0]:this.parameters.form_listener_rules;return r=this.blueConicClient.json.parse(r),1===e&&(e=2,r=this._migrateToVersion2(r)),r},_migrateToVersion2:function(e){if(!e)return e;e=e.rules||e;for(var r=0;r<e.length;r++){e[r].id=e[r].id||e[r].identifier,delete e[r].identifier,e[r].profileproperty&&!e[r].profileProperty&&(e[r].profileProperty=e[r].profileproperty[0]&&e[r].profileproperty[0].profileproperty||"",delete e[r].profileproperty);var t=this._migrateConverterMappingsToVersion2(e[r]);t&&(e[r].converter.mappings=t)}return e},_migrateConverterMappingsToVersion2:function(e){if(e&&e.converter&&e.converter.mappings){for(var r=[],t=0;t<e.converter.mappings.length;t++){var i=e.converter.mappings[t];i&&i.original&&i.converted?r.push(i):r.push({id:i.identifier||i.id,original:i.o,converted:i.c})}return r}}});var a = [];var i='enrichprofilewithvisitorinput';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/4.4.6/frontend/src/node_modules/@blueconic/jquery-x-jquerymigrate/load_jQuery3_7_X_jQueryMigrate.min.js', sharing: 'local'});a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/4.4.6/frontend/src/node_modules/@blueconic/frontend-form-rule-service/formRuleService.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/4.4.6/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(t,n){this.blueConicClient=t,this.rules=[],this.timeouts=[];try{this.rules=this.blueConicClient.json.parse(n.getParameters().rules[0])}catch(i){}this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,(function(){this._unsubscribePositionListeners(),this._resetTimeouts(),this.onLoad()})),this._positionListeners=[]},onLoad:function(){for(var t=0;t<this.rules.length;t++){var n=this.rules[t];"click"===n.type?this._setClickBindings(n,!0):this._createEvent(n)}},_resetTimeouts:function(){this.timeouts.forEach((function(t){clearTimeout(t)})),this.timeouts=[]},_createEvent:function(t){var n=t.area.selectedoption,i=!1;if("selector"===n&&t.area.selector?(t.words&&this._contentMatchesWords(this._getContentForSelector(t),t.containsmatches,t.words)||t.anyWord&&this._getContentForSelector(t))&&(i=!0):"variable"===n&&t.area.variable?(t.words&&this._contentMatchesWords(this._getVariableValue(t.area.variable),t.containsmatches,t.words)||t.anyWord&&this._getVariableValue(t.area.variable))&&(i=!0):"customjs"===n&&t.area.customjs&&(t.words&&this._contentMatchesWords(this._getCustomJsValue(t.area.customjs),t.containsmatches,t.words)||t.anyWord&&this._getCustomJsValue(t.area.customjs))&&(i=!0),i){var s=0;t.delay&&!isNaN(parseInt(t.delay))&&(s=parseInt(t.delay));var r=setTimeout(function(){this.blueConicClient.createEvent(t.event.id)}.bind(this),s);this.timeouts.push(r)}},_setClickBindings:function(t,n){if(t.clickarea.selector){var i=this.jQuery,s=null;try{s=i(t.clickarea.selector)}catch(r){return void this.blueConicClient.util.log("Invalid click selector: "+r)}0===s.length?this.blueConicClient.position.subscribe(t.clickarea.selector,this,(function(){this._setClickBindings(t,!1)})):s.off("click."+t.id).on("click."+t.id,{clickRule:t},function(t){this.lastEvent=t;try{this._createEvent(t.data.clickRule)}catch(r){}}.bind(this)),n&&i(document).on("click",t.clickarea.selector,{clickRule:t},function(t){if(!this.lastEvent||this.lastEvent.originalEvent!==t.originalEvent)try{this._createEvent(t.data.clickRule)}catch(r){}}.bind(this))}},_contentMatchesWords:function(t,n,i){if(!t)return!1;for(var s=0;s<i.length;s++)if("contains"===n){if(-1!==t.indexOf(i[s].toLowerCase()))return!0}else if(t===i[s].toLowerCase())return!0;return!1},_getContentForSelector:function(rule){var selector=rule.area.selector,contentAreas=null;if(-1!==selector.indexOf("jQuery("))contentAreas=function(selector,jQuery){return eval("var jQuery = arguments[1]"),eval(selector)}(selector,this.jQuery);else try{contentAreas=this.jQuery(selector)}catch(e){this.blueConicClient.util.log("Invalid content selector: "+e)}if(contentAreas&&contentAreas instanceof this.jQuery&&contentAreas.length>0){var contentArr=[];return this.jQuery.each(contentAreas,function(t,n){var i=this.jQuery(n);i.attr("content")?contentArr.push(this._normalizeText(i.attr("content"))):i.attr("src")?contentArr.push(this._normalizeText(i.attr("src"))):contentArr.push(this._normalizeText(i.text()))}.bind(this)),contentArr.join().toLowerCase()}if("content"===rule.type){var subscription=this.blueConicClient.position.subscribe(selector,this,(function(){this._createEvent(rule)}));this._positionListeners.push(subscription)}},_unsubscribePositionListeners:function(){this._positionListeners&&this._positionListeners.forEach((function(t){this.blueConicClient.position.unsubscribe(t)})),this._positionListeners=[]},_getVariableValue:function(t){try{for(var n=t.split("."),i=window[n.shift()];n.length>0;)i=i[n.shift()];return i instanceof Array?i.join().toLowerCase():"object"==typeof i||"function"==typeof i?this.blueConicClient.json.stringify(i):i?(""+i).toLowerCase():null}catch(s){return null}},_getCustomJsValue:function(customjs){try{var value=function(customjs,jQuery){return eval("var jQuery = arguments[1]"),eval("var $ = arguments[1]"),eval(customjs)}(customjs,this.jQuery);return value&&value instanceof Object&&(value=this._stringify(value)),value?(""+value).toLowerCase():null}catch(e){return null}},_stringify:function(t){try{return this.blueConicClient.json.stringify(t)}catch(i){var n=[];return JSON.stringify(obj,(function(t,i){if("object"==typeof i&&null!==i){if(-1!==n.indexOf(i))return;n.push(i)}return i}))}},_normalizeText:function(t){return t?t.replace(/^\s+|\s+$/g,"").replace(/\r\n+|\r+|\n+/gi,"").replace(/\s+/gi," "):t}});var a = [];var i='eventtrigger';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.2.4/frontend/src/node_modules/@blueconic/jquery-x-jquerymigrate/load_jQuery3_7_X_jQueryMigrate.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.2.4/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b,this.parameters=this.context.getParameters()},_ouibounce:function(){var a=this,b="sensitivity",c="delay";this.ouibounce({aggressive:!0,timer:0,sensitivity:this.parameters[b]?parseInt(this.parameters[b][0]):20,delay:this.parameters[c]?parseInt(this.parameters[c][0]):0,callback:function(){window.blueConicClient&&window.blueConicClient.exitIntentThrown||a.blueConicClient.createEvent("exitintent"),window.blueConicClient&&(window.blueConicClient.exitIntentThrown=!0)}})},onLoad:function(){this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,function(){window.blueConicClient&&window.blueConicClient.exitIntentThrown&&(window.blueConicClient.exitIntentThrown=!1,this._ouibounce())}),this._ouibounce()}});var a = [];var i='exitintent';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/2.0.5/js/ouibounce.js', sharing: 'none'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/2.0.5/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({_timeout:null,_timestamp:null,_interval:200,init:function(t,e){this.blueConicClient=t,this.context=e||null},onLoad:function(){var t=this;this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,(function(e,i){this._setTimestamp(),clearTimeout(t._timeoutID),t._timeoutID=setTimeout((function(){t._checkTimeout()}),t._interval)})),this._setTimestamp();var e,i=this.context.getParameters(),n="true"===i.clicks[0],o="true"===i.inputs[0];if(e=!i.scrolling||"true"===i.scrolling[0],this._timeout=i.timeout[0],this._timeout?isNaN(parseInt(this._timeout))||(this._timeout=1e3*parseInt(this._timeout)):this._timeout=6e4,n||o||e){if(n&&document.addEventListener("click",(function(){t._setTimestamp()})),o){var c=document.querySelectorAll("input"),s=document.querySelectorAll("textarea"),u=document.querySelectorAll("select");Array.prototype.forEach.call(c,(function(e){e.addEventListener("keyup",(function(){t._setTimestamp()}))})),Array.prototype.forEach.call(c,(function(e){e.addEventListener("change",(function(){t._setTimestamp()}))})),Array.prototype.forEach.call(s,(function(e){e.addEventListener("keyup",(function(){t._setTimestamp()}))})),Array.prototype.forEach.call(u,(function(e){e.addEventListener("change",(function(){t._setTimestamp()}))}))}e&&window.addEventListener("scroll",(function(){t._setTimestamp()})),this._timeoutID=setTimeout((function(){t._checkTimeout()}),t._interval)}},_handleInactivity:function(){this.blueConicClient.createEvent("inactivity")},_checkTimeout:function(){var t=(new Date).getTime(),e=this;t-this._timestamp>this._timeout?this._handleInactivity():e._timeoutID=setTimeout((function(){e._checkTimeout()}),e._interval)},_setTimestamp:function(){this._timestamp=(new Date).getTime()}});var a = [];var i='inactivitylistener';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.2.0/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({EVENT_NAME:"adblock_detected",init:function(e,t){this.blueConicClient=e,this.context=t},getPreloadProperties:function(){var e=this.context.getParameters(),t=e.property?e.property[0]:e.property;return t?[t]:[]},onLoad:function(){var e=this,t=this.context.getProfile(),n=this.context.getParameters(),o=n.property?n.property[0]:n.property;o||(o=this.EVENT_NAME);var adBlockNotDetected=function(){"no"!==t.getValue(o)&&(t.setValue(o,"no"),e.blueConicClient.profile.updateProfile())},r=window.navigator.userAgent;/MSIE|Trident/.test(r)?adBlockNotDetected():justDetectAdblock.detectAnyAdblocker().then((function(n){n?("yes"!==t.getValue(o)&&(t.setValue(o,"yes"),e.blueConicClient.profile.updateProfile()),e.blueConicClient.createEvent(e.EVENT_NAME)):adBlockNotDetected()}))}});var a = [];var i='listener_adblock';a.push({url: blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.1.1/frontend/src/lib/just-detect-adblock.min.js', sharing: 'none'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.1.1/'}]);})();(function(){ var MARKETING_ET="marketing_data_layer",APPLICATION_ET="application_data_layer",APPLICATION_ATTRS=["ClientName","Country_Language","Device","PageFunction","PageKind","PageSubFunction","PNL","Product","Result","SiteIdentifier","Token","URL","DateTimestamp","ACORID","Application_ID","MerchantID","PageName","PageSubFlow","sitecode","ApprovalCode","CreditLimit"],MARKETING_ATTRS=["ClientName","Country_Language","Device","PageFunction","PageKind","PageSubFunction","PNL","Product","Result","SiteIdentifier","Token","URL","DateTimestamp","PageName","offerIds"],CLIENT_NAME_ATTR="ClientName",CALCULATED_CLIENT_NAME_ATTR="Calculated_ClientName",PAGE_KIND_ATTR="PageKind",PAGE_KIND_PREQUAL="prequal",PAGE_KIND_APPLY="apply",PAGE_KIND_SECURED_INSTALLMENT="secured_installment",PAGE_KIND_PREQUAL_SECURED_INSTALLMENT="prequal_secured_installment",PAGE_KIND_APPLY_LOAN="applyloan",PAGE_KIND_OFFER_PERSIST="offerPersist",ACTION_ATTR="action",APP_TYPE_ATTR="appType",DATE_STAMP_ATTR="DateTimestamp",URL_ATTR="URL",PAGE_NAME_ATTR="PageName",PAGE_FUNCTION_ATTR="PageFunction",PAGE_SUB_FUNCTION_ATTR="PageSubFunction",DSA_TOKEN_ATTR="dsaToken",CREDIT_LIMIT_ATTR="CreditLimit",OFFER_EXPIRATION_DATE_ATTR="OfferExpirationDate",CLIENT_MID_ATTR="ClientMID",REASON_CODE_ATTR="ReasonCode",REASON_CODE_A_ATTR="Reason_Code_A",RESPONSE_CODE_ATTR="ResponseCode",APPROVAL_CODE_ATTR="ApprovalCode",OFFER_PERSIST_DL_ATTR=["ABTestname","ACORID","Application_ID","ClientMID","CustomerType","DeclineReason","JSID","Market","MerchantId","OfferExpirationDate","OrgChannel","OrgFlow","PageSubFunction","PrefillType","Program","ReasonCode","ResponseCode","Result","SiteIdentifier","Token","dsaToken","platformToken","promo","sitecode","ApprovalCode","ClientName","Country_Language","CreditLimit","PNL","PageFunction","PageKind","PageName","PageSubFlow","Product"],FIRST_NAME_ATTR="FirstName",LAST_NAME_ATTR="LastName",EMAIL_ADDRESS_ATTR="EmailAddress",IS_BAD_EMAIL_ATTR="IsBadEmail",PREFILL_ATTR="Prefill",APPLICATION_SESSION_ID_ATTR="ApplicationSessionID",DUMMY_PROFILE_KEY_ATTR="DummyProfileKey",ADDRESS1_ATTR="Address1",ADDRESS2_ATTR="Address2",CITY_ATTR="City",STATE_ATTR="State",ZIP_CODE_ATTR="ZipCode",PHONE_NUMBER_ATTR="PhoneNumber",OFFER_EXPIRES_ATTR="OfferExpires",CAL_OFFER_EXPIRES_ATTR="CAL_OfferExpires",VEHICLE_TYPE_ATTR="VehicleType",VEHICLE_MAKE_ATTR="VehicleMake",VEHICLE_YEAR_ATTR="VehicleYear",VEHICLE_MODEL_ATTR="VehicleModel",LANDING_PAGE_NAMES=["auto_fill_invitation"],START_PAGE_NAMES=["prequal_offer","apply options","Termsandconditions","your information"],PREQUAL_START_PAGE_NAMES=["your information"],PREQUAL_DECLINED_PAGE_NAMES=["prequal_offer_declined"],PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES=["your information"],COMPLETE_PAGE_NAMES=["complete approve"],PENDING_PAGE_NAMES=["complete pending"],DECLINED_PAGE_NAMES=["complete decline"],PREQUAL_COMPLETE_PAGE_NAMES=["complete approve","complete pending","complete decline","dApply_start_error"],PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES=["prequal_offer"],PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES=["prequal_offer_declined"],YOUR_INFORMATION_PAGE_NAME="your information",INFORMATION_REVIEW_PAGE_NAME="review",PREQUAL_OFFER_PAGE_NAME="prequal_offer",PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAME="prequal_offer_declined",COMPLETE_PAGE_NAME="complete approve",PENDING_PAGE_NAME="complete pending",DECLINED_PAGE_NAME="complete decline",DAPPLY_START_ERROR_PAGE_NAME="dApply_start_error",VEHICHLE_PAGE_NAME="product info",OFFER_PERSIST_REVIEW_OFFER_PAGE_NAME="review_prequalified_offer",OFFER_PERSIST_ELIGIBILITY_FAILURE_PAGE_NAME="eligibility_failure",PREFILLED_PAGE_SUB_FUNCTION="prefilled",PII_INTERNAL_PROPERY="_dll_pii",VEHICHLE_INFO_INTERNAL_PROPERTY="_vehichle_info",TIME_MILLS_DAY=864e5,MINUTES_TO_MILLS=6e4,APPLICATION_SESSION_ID_COOKIE_NAME="_bcasid",APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME="_bcasid_ts";window._dataLayerListenerEventsCache=window._dataLayerListenerEventsCache||{};var InteractionTypeImpl=InteractionType.extend({init:function(e,r){this.blueConicClient=e,this.context=r,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.dataLayerName=this.parameters.dataLayerName?this.parameters.dataLayerName[0]:"_SFDDL",this.timelineEventType=this.parameters.timelineEventType?this.parameters.timelineEventType[0]:MARKETING_ET,this.clientNames=this.parameters.clientName?this.parameters.clientName:[],this.calculatedClientNames=this.parameters.calculatedClientNames?JSON.parse(this.parameters.calculatedClientNames[0]):{},this.selectedPageKind=this.parameters.selectedPageKind?this.parameters.selectedPageKind:[],this.lastUpdateTimeProperty=this.parameters.lastUpdateTimeProperty?this.parameters.lastUpdateTimeProperty[0]:null,this.emailProperty=this.parameters.emailProperty?this.parameters.emailProperty[0]:null,this.approvalCodeProperty=this.parameters.approvalCodeProperty?this.parameters.approvalCodeProperty[0]:null,this.appStartProperty=this.parameters.appStartProperty?this.parameters.appStartProperty[0]:null,this.appPendingProperty=this.parameters.appPendingProperty?this.parameters.appPendingProperty[0]:null,this.appCompleteProperty=this.parameters.appCompleteProperty?this.parameters.appCompleteProperty[0]:null,this.appDeclinedProperty=this.parameters.appDeclinedProperty?this.parameters.appDeclinedProperty[0]:null,this.appFraudProperty=this.parameters.appFraudProperty?this.parameters.appFraudProperty[0]:null,this.appErrorProperty=this.parameters.appErrorProperty?this.parameters.appErrorProperty[0]:null,this.agreeAndAcceptProperty=this.parameters.agreeAndAcceptProperty?this.parameters.agreeAndAcceptProperty[0]:null,this.prequalAppStartProperty=this.parameters.prequalAppStartProperty?this.parameters.prequalAppStartProperty[0]:null,this.prequalAppPendingProperty=this.parameters.prequalAppPendingProperty?this.parameters.prequalAppPendingProperty[0]:null,this.prequalAppCompleteProperty=this.parameters.prequalAppCompleteProperty?this.parameters.prequalAppCompleteProperty[0]:null,this.prequalAppPendingProperty=this.parameters.prequalAppPendingProperty?this.parameters.prequalAppPendingProperty[0]:null,this.prequalAppDeclinedProperty=this.parameters.prequalAppDeclinedProperty?this.parameters.prequalAppDeclinedProperty[0]:null,this.prequalAppErrorProperty=this.parameters.prequalAppErrorProperty?this.parameters.prequalAppErrorProperty[0]:null,this.prequalNotInterestedProperty=this.parameters.prequalNotInterestedProperty?this.parameters.prequalNotInterestedProperty[0]:null,this.prequalSecuredInstallmentAppStartProperty=this.parameters.prequalSecuredInstallmentAppStartProperty?this.parameters.prequalSecuredInstallmentAppStartProperty[0]:null,this.prequalSecuredInstallmentAppPendingProperty=this.parameters.prequalSecuredInstallmentAppPendingProperty?this.parameters.prequalSecuredInstallmentAppPendingProperty[0]:null,this.prequalSecuredInstallmentAppCompleteProperty=this.parameters.prequalSecuredInstallmentAppCompleteProperty?this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]:null,this.prequalSecuredInstallmentAppDeclinedProperty=this.parameters.prequalSecuredInstallmentAppDeclinedProperty?this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]:null,this.prequalSecuredInstallmentAppErrorProperty=this.parameters.prequalSecuredInstallmentAppErrorProperty?this.parameters.prequalSecuredInstallmentAppErrorProperty[0]:null,this.securedInstallmentAppStartProperty=this.parameters.securedInstallmentAppStartProperty?this.parameters.securedInstallmentAppStartProperty[0]:null,this.securedInstallmentAppPendingProperty=this.parameters.securedInstallmentAppPendingProperty?this.parameters.securedInstallmentAppPendingProperty[0]:null,this.securedInstallmentAppCompleteProperty=this.parameters.securedInstallmentAppCompleteProperty?this.parameters.securedInstallmentAppCompleteProperty[0]:null,this.securedInstallmentAppDeclinedProperty=this.parameters.securedInstallmentAppDeclinedProperty?this.parameters.securedInstallmentAppDeclinedProperty[0]:null,this.securedInstallmentAppFraudProperty=this.parameters.securedInstallmentAppFraudProperty?this.parameters.securedInstallmentAppFraudProperty[0]:null,this.securedInstallmentAppErrorProperty=this.parameters.securedInstallmentAppErrorProperty?this.parameters.securedInstallmentAppErrorProperty[0]:null,this.applyLoanAppStartProperty=this.parameters.applyLoanAppStartProperty?this.parameters.applyLoanAppStartProperty[0]:null,this.applyLoanAppPendingProperty=this.parameters.applyLoanAppPendingProperty?this.parameters.applyLoanAppPendingProperty[0]:null,this.applyLoanAppCompleteProperty=this.parameters.applyLoanAppCompleteProperty?this.parameters.applyLoanAppCompleteProperty[0]:null,this.applyLoanAppDeclinedProperty=this.parameters.applyLoanAppDeclinedProperty?this.parameters.applyLoanAppDeclinedProperty[0]:null,this.applyLoanAppFraudProperty=this.parameters.applyLoanAppFraudProperty?this.parameters.applyLoanAppFraudProperty[0]:null,this.applyLoanAppErrorProperty=this.parameters.applyLoanAppErrorProperty?this.parameters.applyLoanAppErrorProperty[0]:null,this.offerPersistReviewOfferProperty=this.parameters.offerPersistReviewOfferProperty?this.parameters.offerPersistReviewOfferProperty[0]:null,this.offerPersistNotFoundExpProperty=this.parameters.offerPersistNotFoundExpProperty?this.parameters.offerPersistNotFoundExpProperty[0]:null,this.offerPersistEligibilityFailureProperty=this.parameters.offerPersistEligibilityFailureProperty?this.parameters.offerPersistEligibilityFailureProperty[0]:null,this.offerPersistPrequalOfferProperty=this.parameters.offerPersistPrequalOfferProperty?this.parameters.offerPersistPrequalOfferProperty[0]:null,this.offerPersistPrequalOfferDeclineProperty=this.parameters.offerPersistPrequalOfferDeclineProperty?this.parameters.offerPersistPrequalOfferDeclineProperty[0]:null,this.offerPersistCompleteApproveProperty=this.parameters.offerPersistCompleteApproveProperty?this.parameters.offerPersistCompleteApproveProperty[0]:null,this.offerPersistCompletePendingProperty=this.parameters.offerPersistCompletePendingProperty?this.parameters.offerPersistCompletePendingProperty[0]:null,this.offerPersistCompleteDeclineProperty=this.parameters.offerPersistCompleteDeclineProperty?this.parameters.offerPersistCompleteDeclineProperty[0]:null,this.offerPersistDapplyStartErrorProperty=this.parameters.offerPersistDapplyStartErrorProperty?this.parameters.offerPersistDapplyStartErrorProperty[0]:null,this.prequalEmailOfferClickProperty=this.parameters.prequalEmailOfferClickProperty?this.parameters.prequalEmailOfferClickProperty[0]:null,this.offerPersistNotInterestedClickProperty=this.parameters.offerPersistNotInterestedClickProperty?this.parameters.offerPersistNotInterestedClickProperty[0]:null,this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,function(){this.onLoad()})},getPreloadProperties:function(){return[PII_INTERNAL_PROPERY,VEHICHLE_INFO_INTERNAL_PROPERTY,this.parameters.appCompleteProperty?this.parameters.appCompleteProperty[0]:"",this.parameters.appPendingProperty?this.parameters.appPendingProperty[0]:"",this.parameters.appDeclinedProperty?this.parameters.appDeclinedProperty[0]:"",this.parameters.appFraudProperty?this.parameters.appFraudProperty[0]:"",this.parameters.appErrorProperty?this.parameters.appErrorProperty[0]:"",this.parameters.prequalSecuredInstallmentAppCompleteProperty?this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]:"",this.parameters.prequalSecuredInstallmentAppDeclinedProperty?this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]:"",this.parameters.prequalSecuredInstallmentAppErrorProperty?this.parameters.prequalSecuredInstallmentAppErrorProperty[0]:"",this.parameters.prequalAppCompleteProperty?this.parameters.prequalAppCompleteProperty[0]:"",this.parameters.prequalAppDeclinedProperty?this.parameters.prequalAppDeclinedProperty[0]:"",this.parameters.prequalAppErrorProperty?this.parameters.prequalAppErrorProperty[0]:"",this.parameters.securedInstallmentAppCompleteProperty?this.parameters.securedInstallmentAppCompleteProperty[0]:"",this.parameters.securedInstallmentAppPendingProperty?this.parameters.securedInstallmentAppPendingProperty[0]:"",this.parameters.securedInstallmentAppDeclinedProperty?this.parameters.securedInstallmentAppDeclinedProperty[0]:"",this.parameters.securedInstallmentAppFraudProperty?this.parameters.securedInstallmentAppFraudProperty[0]:"",this.parameters.securedInstallmentAppErrorProperty?this.parameters.securedInstallmentAppErrorProperty[0]:"",this.parameters.applyLoanAppCompleteProperty?this.parameters.applyLoanAppCompleteProperty[0]:"",this.parameters.applyLoanAppPendingProperty?this.parameters.applyLoanAppPendingProperty[0]:"",this.parameters.applyLoanAppDeclinedProperty?this.parameters.applyLoanAppDeclinedProperty[0]:"",this.parameters.applyLoanAppFraudProperty?this.parameters.applyLoanAppFraudProperty[0]:"",this.parameters.applyLoanAppErrorProperty?this.parameters.applyLoanAppErrorProperty[0]:"",this.parameters.offerPersistReviewOfferProperty?this.parameters.offerPersistReviewOfferProperty[0]:"",this.parameters.offerPersistNotFoundExpProperty?this.parameters.offerPersistNotFoundExpProperty[0]:"",this.parameters.offerPersistEligibilityFailureProperty?this.parameters.offerPersistEligibilityFailureProperty[0]:"",this.parameters.offerPersistPrequalOfferDeclineProperty?this.parameters.offerPersistPrequalOfferDeclineProperty[0]:"",this.parameters.offerPersistCompleteApproveProperty?this.parameters.offerPersistCompleteApproveProperty[0]:"",this.parameters.offerPersistCompletePendingProperty?this.parameters.offerPersistCompletePendingProperty[0]:"",this.parameters.offerPersistCompleteDeclineProperty?this.parameters.offerPersistCompleteDeclineProperty[0]:"",this.parameters.offerPersistDapplyStartErrorProperty?this.parameters.offerPersistDapplyStartErrorProperty[0]:"",this.parameters.prequalEmailOfferClickProperty?this.parameters.prequalEmailOfferClickProperty[0]:"",this.parameters.offerPersistNotInterestedClickProperty?this.parameters.offerPersistNotInterestedClickProperty[0]:""].filter(function(e){return""!==e})},onLoad:function(){if(this.dataLayerName&&this.timelineEventType){var e=this,r=0;(function t(){if(window[e.dataLayerName])setTimeout(function(){e._importFromDataLayer(window[e.dataLayerName])},2e3);else{if(r>20)return;r++,window.setTimeout(t,500)}}).call(this)}},_addDaysToTimestamp:function(e,r){return isNaN(parseInt(e))||isNaN(parseInt(r))||e&&13!==e.toString().length?e:parseInt(e)+TIME_MILLS_DAY*parseInt(r)},_formatDateMMDDYYYY:function(e){var r=e.getFullYear();return(e.getMonth()+1).toString().padStart(2,"0")+"/"+e.getDate().toString().padStart(2,"0")+"/"+r},_importFromDataLayer:function(e){if(e.pageInfo){var r=e.pageInfo[CLIENT_NAME_ATTR];if(this.clientNames.length>0&&-1===this.clientNames.indexOf(r))console.info("Listener ID: "+this.context.getInteractionId()+" -- Client name mismatch, skipping. Client: "+e.pageInfo[CLIENT_NAME_ATTR]);else{var t=e.pageInfo[CLIENT_MID_ATTR],s=r&&t&&this.calculatedClientNames[r]&&this.calculatedClientNames[r][t]?this.calculatedClientNames[r][t]:r,p=new Date,o=p.getTime();this._currentMills=o;var a={};if(a[CALCULATED_CLIENT_NAME_ATTR]=s,this.timelineEventType===MARKETING_ET)for(i=0;i<MARKETING_ATTRS.length;i++)e.pageInfo[MARKETING_ATTRS[i]]&&(a[MARKETING_ATTRS[i]]=e.pageInfo[MARKETING_ATTRS[i]]);if(this.timelineEventType===APPLICATION_ET){for(i=0;i<APPLICATION_ATTRS.length;i++)e.pageInfo[APPLICATION_ATTRS[i]]&&(a[APPLICATION_ATTRS[i]]=e.pageInfo[APPLICATION_ATTRS[i]]);if(e.formAction){var l=e.formAction[ACTION_ATTR];l&&(a[ACTION_ATTR]=l),e.formAction[APP_TYPE_ATTR]&&(a[APP_TYPE_ATTR]=e.formAction[APP_TYPE_ATTR])}var n=e.pageInfo[REASON_CODE_ATTR],P=n&&n.startsWith("A");n&&(a[REASON_CODE_A_ATTR]=P);var h=e.pageInfo[PAGE_KIND_ATTR];this._currentPageKind=h;var f=e.pageInfo[PAGE_NAME_ATTR];this._currentPageName=f;var u=e.pageInfo[PAGE_FUNCTION_ATTR],m=e.pageInfo[PAGE_SUB_FUNCTION_ATTR],y=e.pageInfo[DSA_TOKEN_ATTR]?e.pageInfo[DSA_TOKEN_ATTR]:null,d=e.pageInfo[APPROVAL_CODE_ATTR]?e.pageInfo[APPROVAL_CODE_ATTR]:null;this.approvalCodeProperty&&d&&this.profile.addValue(this.approvalCodeProperty,d);var A=this._getSessionIdTimestamp();if(LANDING_PAGE_NAMES.indexOf(f)>-1&&A&&this._currentMills-A>=1e4?this._setSessionId():LANDING_PAGE_NAMES.indexOf(f)>-1&&!A?this._setSessionId():this._getSessionId()||this._setSessionId(),h===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT)&&f===PREQUAL_OFFER_PAGE_NAME||h===PAGE_KIND_OFFER_PERSIST&&this.selectedPageKind.includes(PAGE_KIND_OFFER_PERSIST)&&f===PREQUAL_OFFER_PAGE_NAME||h===PAGE_KIND_PREQUAL&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL)&&f===PREQUAL_OFFER_PAGE_NAME){var c=this._addDaysToTimestamp(o,30),_=new Date(c);a[OFFER_EXPIRES_ATTR]=_,a[CAL_OFFER_EXPIRES_ATTR]=this._formatDateMMDDYYYY(_)}if(h===PAGE_KIND_PREQUAL&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL)){for(this.prequalEmailOfferClickProperty&&this._prequalEmailOfferClickListener(s),this.prequalNotInterestedProperty&&this._prequalNotInterestedListener(s,f),i=0;i<OFFER_PERSIST_DL_ATTR.length;i++)e.pageInfo[OFFER_PERSIST_DL_ATTR[i]]&&(a[OFFER_PERSIST_DL_ATTR[i]]=e.pageInfo[OFFER_PERSIST_DL_ATTR[i]]);this._handlePrequal(s,f)}else if(h===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT))this._handlePrequalSecuredInstallment(s,f),VEHICHLE_PAGE_NAME===f&&this._captureVehicleAttr(s,h),this._addVehicleAttr(s,h,a);else if(h===PAGE_KIND_APPLY&&this.selectedPageKind.includes(PAGE_KIND_APPLY))this._handleApply(s,f);else if(h===PAGE_KIND_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_SECURED_INSTALLMENT))this._handleSecuredInstallment(s,f);else if(h===PAGE_KIND_APPLY_LOAN&&this.selectedPageKind.includes(PAGE_KIND_APPLY_LOAN))this._handleApplyLoan(s,f);else if(h===PAGE_KIND_OFFER_PERSIST&&this.selectedPageKind.includes(PAGE_KIND_OFFER_PERSIST)){for(this.offerPersistNotInterestedClickProperty&&this._prequalEmailOfferClickListener(s),i=0;i<OFFER_PERSIST_DL_ATTR.length;i++)e.pageInfo[OFFER_PERSIST_DL_ATTR[i]]&&(a[OFFER_PERSIST_DL_ATTR[i]]=e.pageInfo[OFFER_PERSIST_DL_ATTR[i]]);this._handleOfferPersist(s,f,y,d,m)}f===YOUR_INFORMATION_PAGE_NAME&&this._capturePII(s,h,u,m),f===INFORMATION_REVIEW_PAGE_NAME&&this._capturePiiChanges(s,h),this._addPII(s,h,a)}a[DATE_STAMP_ATTR]=p,a[URL_ATTR]=window.location.href;try{this._getSessionId()&&(a[APPLICATION_SESSION_ID_ATTR]=this._getSessionId())}catch(e){this.blueConicClient.util.log(e)}this.lastUpdateTimeProperty&&this.profile.setValue(this.lastUpdateTimeProperty,o),this._updateProfile(p,a)}}},_updateProfile:function(e,r){this.blueConicClient.profile.updateProfile(this,function(){this.blueConicClient.createEvent("BC_DATALAYER_UPDATED")}),e&&r&&this._createTimelineEvent(e,r)},_createTimelineEvent:function(e,r){var t=this._getTimelineCreated();window._dataLayerListenerEventsCache&&window._dataLayerListenerEventsCache[r.PageName]&&Object.keys(window._dataLayerListenerEventsCache[r.PageName]).includes(this._currentPageName)&&this._currentMills-window._dataLayerListenerEventsCache[r.PageName]<=1e4||t&&t[r.PageName]&&this._currentMills-t[r.PageName]<=1e4||(window._dataLayerListenerEventsCache[r.PageName]=this._currentMills,this._setTimelineCreated(),this.blueConicClient.profile.getProfile().timeline.createEvent(this.timelineEventType,e,r))},_handleApply:function(e,r){if(START_PAGE_NAMES.indexOf(r)>-1){if(this.appStartProperty&&this.profile.addValue(this.appStartProperty,e),this.appCompleteProperty){var t=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.appCompleteProperty,t)}if(this.appPendingProperty){var i=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.appPendingProperty,i)}if(this.appDeclinedProperty){var s=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.appDeclinedProperty,s)}if(this.appFraudProperty){var p=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.appFraudProperty,p)}if(this.appErrorProperty){var o=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.appErrorProperty,o)}}if(PENDING_PAGE_NAMES.indexOf(r)>-1){if(this.appPendingProperty&&this.profile.addValue(this.appPendingProperty,e),this.appCompleteProperty){var a=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.appCompleteProperty,a)}if(this.appDeclinedProperty){var l=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.appDeclinedProperty,l)}if(this.appErrorProperty){var n=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.appErrorProperty,n)}if(this.appFraudProperty){var P=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.appFraudProperty,P)}}if(COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.appCompleteProperty&&this.profile.addValue(this.appCompleteProperty,e),this.appPendingProperty){var h=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.appPendingProperty,h)}if(this.appDeclinedProperty){var f=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.appDeclinedProperty,f)}if(this.appErrorProperty){var u=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.appErrorProperty,u)}if(this.appFraudProperty){var m=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.appFraudProperty,m)}}if(DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.appDeclinedProperty&&this.profile.addValue(this.appDeclinedProperty,e),this.appPendingProperty){var y=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.appPendingProperty,y)}if(this.appCompleteProperty){var d=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.appCompleteProperty,d)}if(this.appFraudProperty){var A=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.appFraudProperty,A)}if(this.appErrorProperty){var c=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(c,e),this.profile.setValues(this.appErrorProperty,c)}}if(r.toLowerCase().indexOf("fraud")>-1){if(this.appFraudProperty&&this.profile.addValue(this.appFraudProperty,e),this.appPendingProperty){var _=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(_,e),this.profile.setValues(this.appPendingProperty,_)}if(this.appCompleteProperty){var E=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(E,e),this.profile.setValues(this.appCompleteProperty,E)}if(this.appDeclinedProperty){var I=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(I,e),this.profile.setValues(this.appDeclinedProperty,I)}if(this.appErrorProperty){var g=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(g,e),this.profile.setValues(this.appErrorProperty,g)}}if(r.toLowerCase().indexOf("error")>-1){if(this.appErrorProperty&&this.profile.addValue(this.appErrorProperty,e),this.appPendingProperty){var v=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(v,e),this.profile.setValues(this.appPendingProperty,v)}if(this.appCompleteProperty){var C=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(C,e),this.profile.setValues(this.appCompleteProperty,C)}if(this.appFraudProperty){var S=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(S,e),this.profile.setValues(this.appFraudProperty,S)}if(this.appDeclinedProperty){var T=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(T,e),this.profile.setValues(this.appDeclinedProperty,T)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handlePrequal:function(e,r){if(PREQUAL_START_PAGE_NAMES.indexOf(r)>-1){if(this.prequalAppStartProperty&&this.profile.addValue(this.prequalAppStartProperty,e),this.prequalAppPendingProperty){var t=this.profile.getValues(this.prequalAppPendingProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.prequalAppPendingProperty,t)}if(this.prequalAppCompleteProperty){var i=this.profile.getValues(this.prequalAppCompleteProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.prequalAppCompleteProperty,i)}if(this.prequalAppDeclinedProperty){var s=this.profile.getValues(this.prequalAppDeclinedProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.prequalAppDeclinedProperty,s)}if(this.prequalAppErrorProperty){var p=this.profile.getValues(this.prequalAppErrorProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.prequalAppErrorProperty,p)}}if(PENDING_PAGE_NAMES.indexOf(r)>-1){if(this.prequalAppPendingProperty&&this.profile.addValue(this.prequalAppPendingProperty,e),this.prequalAppCompleteProperty){var o=this.profile.getValues(this.prequalAppCompleteProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.prequalAppCompleteProperty,o)}if(this.prequalAppDeclinedProperty){var a=this.profile.getValues(this.prequalAppDeclinedProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.prequalAppDeclinedProperty,a)}if(this.prequalAppErrorProperty){var l=this.profile.getValues(this.prequalAppErrorProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.prequalAppErrorProperty,l)}}if(COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.prequalAppCompleteProperty&&this.profile.addValue(this.prequalAppCompleteProperty,e),this.prequalAppPendingProperty){var n=this.profile.getValues(this.prequalAppPendingProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.prequalAppPendingProperty,n)}if(this.prequalAppDeclinedProperty){var P=this.profile.getValues(this.prequalAppDeclinedProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.prequalAppDeclinedProperty,P)}if(this.prequalAppErrorProperty){var h=this.profile.getValues(this.prequalAppErrorProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.prequalAppErrorProperty,h)}}if(PREQUAL_DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.prequalAppDeclinedProperty&&this.profile.addValue(this.prequalAppDeclinedProperty,e),this.prequalAppPendingProperty){var f=this.profile.getValues(this.prequalAppPendingProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.prequalAppPendingProperty,f)}if(this.prequalAppCompleteProperty){var u=this.profile.getValues(this.prequalAppCompleteProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.prequalAppCompleteProperty,u)}if(this.prequalAppErrorProperty){var m=this.profile.getValues(this.prequalAppErrorProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.prequalAppErrorProperty,m)}}if(r.toLowerCase().indexOf("error")>-1){if(this.prequalAppErrorProperty&&this.profile.addValue(this.prequalAppErrorProperty,e),this.prequalAppPendingProperty){var y=this.profile.getValues(this.prequalAppPendingProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.prequalAppPendingProperty,y)}if(this.prequalAppCompleteProperty){var d=this.profile.getValues(this.prequalAppCompleteProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.prequalAppCompleteProperty,d)}if(this.prequalAppDeclinedProperty){var A=this.profile.getValues(this.prequalAppDeclinedProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.prequalAppDeclinedProperty,A)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handlePrequalSecuredInstallment:function(e,r){if(PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES.indexOf(r)>-1){if(this.prequalSecuredInstallmentAppStartProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppStartProperty,e),this.prequalSecuredInstallmentAppCompleteProperty){var t=this.profile.getValues(this.prequalSecuredInstallmentAppCompleteProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty,t)}if(this.prequalSecuredInstallmentAppDeclinedProperty){var i=this.profile.getValues(this.prequalSecuredInstallmentAppDeclinedProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty,i)}if(this.prequalSecuredInstallmentAppFraudProperty){var s=this.profile.getValues(this.prequalSecuredInstallmentAppFraudProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.prequalSecuredInstallmentAppFraudProperty,s)}if(this.prequalSecuredInstallmentAppErrorProperty){var p=this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty,p)}}if(PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.prequalSecuredInstallmentAppCompleteProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppCompleteProperty,e),this.prequalSecuredInstallmentAppDeclinedProperty){var o=this.profile.getValues(this.prequalSecuredInstallmentAppDeclinedProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty,o)}if(this.prequalSecuredInstallmentAppErrorProperty){var a=this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty,a)}}if(PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.prequalSecuredInstallmentAppDeclinedProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppDeclinedProperty,e),this.prequalSecuredInstallmentAppCompleteProperty){var l=this.profile.getValues(this.prequalSecuredInstallmentAppCompleteProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty,l)}if(this.prequalSecuredInstallmentAppErrorProperty){var n=this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty,n)}}if(r.toLowerCase().indexOf("error")>-1){if(this.prequalSecuredInstallmentAppErrorProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppErrorProperty,e),this.prequalSecuredInstallmentAppCompleteProperty){var P=this.profile.getValues(this.prequalSecuredInstallmentAppCompleteProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty,P)}if(this.prequalSecuredInstallmentAppDeclinedProperty){var h=this.profile.getValues(this.prequalSecuredInstallmentAppDeclinedProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty,h)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_prequalNotInterestedListener:function(e){var r=document.querySelectorAll('a[data-reason="not_interested"]');r.length>0?r.forEach(function(r,t){r.addEventListener("click",function(){this.profile.addValue(this.prequalNotInterestedProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1)}.bind(this)):this.blueConicClient.position.subscribe('a[data-reason="not_interested"]',this,function(){this._prequalNotInterestedListener(e)})},_handleSecuredInstallment:function(e,r){if(START_PAGE_NAMES.indexOf(r)>-1){if(this.securedInstallmentAppStartProperty&&this.profile.addValue(this.securedInstallmentAppStartProperty,e),this.securedInstallmentAppPendingProperty){var t=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,t)}if(this.securedInstallmentAppCompleteProperty){var i=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,i)}if(this.securedInstallmentAppDeclinedProperty){var s=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,s)}if(this.securedInstallmentAppFraudProperty){var p=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,p)}if(this.securedInstallmentAppErrorProperty){var o=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,o)}}if(r.toLowerCase().indexOf("pending")>-1){if(this.securedInstallmentAppPendingProperty&&this.profile.addValue(this.securedInstallmentAppPendingProperty,e),this.securedInstallmentAppCompleteProperty){var a=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,a)}if(this.securedInstallmentAppDeclinedProperty){var l=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,l)}if(this.securedInstallmentAppErrorProperty){var n=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,n)}if(this.securedInstallmentAppFraudProperty){var P=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,P)}}if(COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.securedInstallmentAppCompleteProperty&&this.profile.addValue(this.securedInstallmentAppCompleteProperty,e),this.securedInstallmentAppPendingProperty){var h=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,h)}if(this.securedInstallmentAppDeclinedProperty){var f=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,f)}if(this.securedInstallmentAppErrorProperty){var u=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,u)}if(this.securedInstallmentAppFraudProperty){var m=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,m)}}if(DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.securedInstallmentAppDeclinedProperty&&this.profile.addValue(this.securedInstallmentAppDeclinedProperty,e),this.securedInstallmentAppPendingProperty){var y=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,y)}if(this.securedInstallmentAppCompleteProperty){var d=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,d)}if(this.securedInstallmentAppFraudProperty){var A=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,A)}if(this.securedInstallmentAppErrorProperty){var c=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(c,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,c)}}if(r.toLowerCase().indexOf("fraud")>-1){if(this.securedInstallmentAppFraudProperty&&this.profile.addValue(this.securedInstallmentAppFraudProperty,e),this.securedInstallmentAppPendingProperty){var _=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(_,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,_)}if(this.securedInstallmentAppCompleteProperty){var E=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(E,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,E)}if(this.securedInstallmentAppDeclinedProperty){var I=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(I,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,I)}if(this.securedInstallmentAppErrorProperty){var g=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(g,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,g)}}if(r.toLowerCase().indexOf("error")>-1){if(this.securedInstallmentAppErrorProperty&&this.profile.addValue(this.securedInstallmentAppErrorProperty,e),this.securedInstallmentAppPendingProperty){var v=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(v,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,v)}if(this.securedInstallmentAppCompleteProperty){var C=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(C,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,C)}if(this.securedInstallmentAppFraudProperty){var S=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(S,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,S)}if(this.securedInstallmentAppDeclinedProperty){var T=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(T,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,T)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handleApplyLoan:function(e,r){if(START_PAGE_NAMES.indexOf(r)>-1){if(this.applyLoanAppStartProperty&&this.profile.addValue(this.applyLoanAppStartProperty,e),this.applyLoanAppPendingProperty){var t=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.applyLoanAppPendingProperty,t)}if(this.applyLoanAppCompleteProperty){var i=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.applyLoanAppCompleteProperty,i)}if(this.applyLoanAppDeclinedProperty){var s=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,s)}if(this.applyLoanAppFraudProperty){var p=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.applyLoanAppFraudProperty,p)}if(this.applyLoanAppErrorProperty){var o=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.applyLoanAppErrorProperty,o)}}if(r.toLowerCase().indexOf("pending")>-1){if(this.applyLoanAppPendingProperty&&this.profile.addValue(this.applyLoanAppPendingProperty,e),this.applyLoanAppCompleteProperty){var a=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.applyLoanAppCompleteProperty,a)}if(this.applyLoanAppDeclinedProperty){var l=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,l)}if(this.applyLoanAppErrorProperty){var n=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.applyLoanAppErrorProperty,n)}if(this.applyLoanAppFraudProperty){var P=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.applyLoanAppFraudProperty,P)}}if(COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.applyLoanAppCompleteProperty&&this.profile.addValue(this.applyLoanAppCompleteProperty,e),this.applyLoanAppPendingProperty){var h=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.applyLoanAppPendingProperty,h)}if(this.applyLoanAppDeclinedProperty){var f=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,f)}if(this.applyLoanAppErrorProperty){var u=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.applyLoanAppErrorProperty,u)}if(this.applyLoanAppFraudProperty){var m=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.applyLoanAppFraudProperty,m)}}if(DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.applyLoanAppDeclinedProperty&&this.profile.addValue(this.applyLoanAppDeclinedProperty,e),this.applyLoanAppPendingProperty){var y=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.applyLoanAppPendingProperty,y)}if(this.applyLoanAppCompleteProperty){var d=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.applyLoanAppCompleteProperty,d)}if(this.applyLoanAppFraudProperty){var A=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.applyLoanAppFraudProperty,A)}if(this.applyLoanAppErrorProperty){var c=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(c,e),this.profile.setValues(this.applyLoanAppErrorProperty,c)}}if(r.toLowerCase().indexOf("fraud")>-1){if(this.applyLoanAppFraudProperty&&this.profile.addValue(this.applyLoanAppFraudProperty,e),this.applyLoanAppPendingProperty){var _=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(_,e),this.profile.setValues(this.applyLoanAppPendingProperty,_)}if(this.applyLoanAppCompleteProperty){var E=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(E,e),this.profile.setValues(this.applyLoanAppCompleteProperty,E)}if(this.applyLoanAppDeclinedProperty){var I=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(I,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,I)}if(this.applyLoanAppErrorProperty){var g=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(g,e),this.profile.setValues(this.applyLoanAppErrorProperty,g)}}if(r.toLowerCase().indexOf("error")>-1){if(this.applyLoanAppErrorProperty&&this.profile.addValue(this.applyLoanAppErrorProperty,e),this.applyLoanAppPendingProperty){var v=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(v,e),this.profile.setValues(this.applyLoanAppPendingProperty,v)}if(this.applyLoanAppCompleteProperty){var C=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(C,e),this.profile.setValues(this.applyLoanAppCompleteProperty,C)}if(this.applyLoanAppFraudProperty){var S=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(S,e),this.profile.setValues(this.applyLoanAppFraudProperty,S)}if(this.applyLoanAppDeclinedProperty){var T=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(T,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,T)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handleOfferPersist:function(e,r,t,i,s){if(r.toLowerCase().indexOf(OFFER_PERSIST_REVIEW_OFFER_PAGE_NAME)>-1&&t){if(this.offerPersistReviewOfferProperty&&this.profile.addValue(this.offerPersistReviewOfferProperty,e),this.offerPersistNotFoundExpProperty){var p=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,p)}if(this.offerPersistEligibilityFailureProperty){var o=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,o)}if(this.offerPersistPrequalOfferDeclineProperty){var a=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,a)}if(this.offerPersistCompleteApproveProperty){var l=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,l)}if(this.offerPersistCompletePendingProperty){var n=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.offerPersistCompletePendingProperty,n)}if(this.offerPersistCompleteDeclineProperty){var P=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,P)}if(this.offerPersistDapplyStartErrorProperty){var h=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,h)}if(this.offerPersistPrequalOfferProperty){var f=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,f)}}if(r===YOUR_INFORMATION_PAGE_NAME&&s===PREFILLED_PAGE_SUB_FUNCTION&&(t||i)){if(this.offerPersistNotFoundExpProperty&&this.profile.addValue(this.offerPersistNotFoundExpProperty,e),this.offerPersistEligibilityFailureProperty){var u=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,u)}if(this.offerPersistPrequalOfferDeclineProperty){var m=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,m)}if(this.offerPersistCompleteApproveProperty){var y=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,y)}if(this.offerPersistCompletePendingProperty){var d=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.offerPersistCompletePendingProperty,d)}if(this.offerPersistCompleteDeclineProperty){var A=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,A)}if(this.offerPersistDapplyStartErrorProperty){var c=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(c,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,c)}if(this.offerPersistPrequalOfferProperty){var _=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(_,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,_)}}if(r.toLowerCase().indexOf(OFFER_PERSIST_ELIGIBILITY_FAILURE_PAGE_NAME)>-1&&t){if(this.offerPersistEligibilityFailureProperty&&this.profile.addValue(this.offerPersistEligibilityFailureProperty,e),this.offerPersistNotFoundExpProperty){var E=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(E,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,E)}if(this.offerPersistPrequalOfferDeclineProperty){var I=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(I,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,I)}if(this.offerPersistCompleteApproveProperty){var g=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(g,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,g)}if(this.offerPersistCompletePendingProperty){var v=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(v,e),this.profile.setValues(this.offerPersistCompletePendingProperty,v)}if(this.offerPersistCompleteDeclineProperty){var C=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(C,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,C)}if(this.offerPersistDapplyStartErrorProperty){var S=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(S,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,S)}if(this.offerPersistPrequalOfferProperty){var T=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(T,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,T)}}if(r===PREQUAL_OFFER_PAGE_NAME){if(this.offerPersistPrequalOfferProperty&&this.profile.addValue(this.offerPersistPrequalOfferProperty,e),this.offerPersistNotFoundExpProperty){var N=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(N,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,N)}if(this.offerPersistPrequalOfferDeclineProperty){var V=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(V,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,V)}if(this.offerPersistCompleteApproveProperty){var L=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(L,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,L)}if(this.offerPersistCompletePendingProperty){var F=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(F,e),this.profile.setValues(this.offerPersistCompletePendingProperty,F)}if(this.offerPersistCompleteDeclineProperty){var D=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(D,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,D)}if(this.offerPersistDapplyStartErrorProperty){var O=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(O,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,O)}if(this.offerPersistEligibilityFailureProperty){var R=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(R,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,R)}}if(r===PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAME){if(this.offerPersistPrequalOfferDeclineProperty&&this.profile.addValue(this.offerPersistPrequalOfferDeclineProperty,e),this.offerPersistNotFoundExpProperty){var q=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(q,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,q)}if(this.offerPersistPrequalOfferProperty){var M=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(M,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,M)}if(this.offerPersistCompleteApproveProperty){var b=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(b,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,b)}if(this.offerPersistCompletePendingProperty){var G=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(G,e),this.profile.setValues(this.offerPersistCompletePendingProperty,G)}if(this.offerPersistCompleteDeclineProperty){var x=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(x,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,x)}if(this.offerPersistDapplyStartErrorProperty){var K=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(K,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,K)}if(this.offerPersistEligibilityFailureProperty){var w=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(w,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,w)}}if(r===COMPLETE_PAGE_NAME){if(this.offerPersistCompleteApproveProperty&&this.profile.addValue(this.offerPersistCompleteApproveProperty,e),this.offerPersistNotFoundExpProperty){var U=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(U,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,U)}if(this.offerPersistPrequalOfferProperty){var k=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(k,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,k)}if(this.offerPersistPrequalOfferDeclineProperty){var Y=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(Y,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,Y)}if(this.offerPersistCompletePendingProperty){var H=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(H,e),this.profile.setValues(this.offerPersistCompletePendingProperty,H)}if(this.offerPersistCompleteDeclineProperty){var Q=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(Q,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,Q)}if(this.offerPersistDapplyStartErrorProperty){var B=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(B,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,B)}if(this.offerPersistEligibilityFailureProperty){var z=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(z,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,z)}}if(r===PENDING_PAGE_NAME){if(this.offerPersistCompletePendingProperty&&this.profile.addValue(this.offerPersistCompletePendingProperty,e),this.offerPersistNotFoundExpProperty){var X=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(X,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,X)}if(this.offerPersistPrequalOfferProperty){var j=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(j,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,j)}if(this.offerPersistPrequalOfferDeclineProperty){var J=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(J,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,J)}if(this.offerPersistCompleteApproveProperty){var W=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(W,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,W)}if(this.offerPersistCompleteDeclineProperty){var Z=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(Z,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,Z)}if(this.offerPersistDapplyStartErrorProperty){var $=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray($,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,$)}if(this.offerPersistEligibilityFailureProperty){var ee=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(ee,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,ee)}}if(r===DECLINED_PAGE_NAME){if(this.offerPersistCompleteDeclineProperty&&this.profile.addValue(this.offerPersistCompleteDeclineProperty,e),this.offerPersistNotFoundExpProperty){var re=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(re,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,re)}if(this.offerPersistPrequalOfferProperty){var te=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(te,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,te)}if(this.offerPersistPrequalOfferDeclineProperty){var ie=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(ie,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,ie)}if(this.offerPersistCompleteApproveProperty){var se=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(se,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,se)}if(this.offerPersistCompletePendingProperty){var pe=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(pe,e),this.profile.setValues(this.offerPersistCompletePendingProperty,pe)}if(this.offerPersistDapplyStartErrorProperty){var oe=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(oe,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,oe)}if(this.offerPersistEligibilityFailureProperty){var ae=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(ae,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,ae)}}if(r===DAPPLY_START_ERROR_PAGE_NAME){if(this.offerPersistDapplyStartErrorProperty&&this.profile.addValue(this.offerPersistDapplyStartErrorProperty,e),this.offerPersistNotFoundExpProperty){var le=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(le,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,le)}if(this.offerPersistPrequalOfferProperty){var ne=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(ne,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,ne)}if(this.offerPersistPrequalOfferDeclineProperty){var Pe=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(Pe,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,Pe)}if(this.offerPersistCompleteApproveProperty){var he=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(he,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,he)}if(this.offerPersistCompletePendingProperty){var fe=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(fe,e),this.profile.setValues(this.offerPersistCompletePendingProperty,fe)}if(this.offerPersistCompleteDeclineProperty){var ue=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(ue,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,ue)}if(this.offerPersistEligibilityFailureProperty){var me=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(me,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,me)}}},_prequalEmailOfferClickListener:function(e){var r=document.querySelectorAll("a#emailOffer");r.length>0?r.forEach(function(r,t){r.addEventListener("click",function(){this.profile.addValue(this.prequalEmailOfferClickProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1)}.bind(this)):this.blueConicClient.position.subscribe("a#emailOffer",this,function(){this._prequalEmailOfferClickListener(e)})},_offerPersistNotInterestedClickListener:function(e){var r=document.querySelectorAll("a#notIntersted");r.length>0?r.forEach(function(r,t){r.addEventListener("click",function(){this.profile.addValue(this.offerPersistNotInterestedClickProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1)}.bind(this)):this.blueConicClient.position.subscribe("a#notIntersted",this,function(){this._offerPersistNotInterestedClickListener(e)})},_aggreeAcceptClickListener:function(e){var r=document.querySelector("button#acptbtn")||null;r?r.addEventListener("click",function(){this.profile.addValue(this.agreeAndAcceptProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1):this.blueConicClient.position.subscribe("button#acptbtn",this,function(){this._aggreeAcceptClickListener(e)})},_generateProfileKey:function(e){if(!e)return null;try{return this.md5((new Date).getTime().toString()+"_"+e.toLowerCase()).substring(6,26)}catch(e){return console.error("[BC ERROR] Error generating dummyProfileKey key: "+e),null}},_captureVehicleAttr:function(e,r){var t=document.querySelector('button[data-reason="residence"]')||null;null!==t?t.addEventListener("click",function(){var t=document.querySelector("#native-select-vehicleType-native"),i=t?t.options[t.selectedIndex].text:null,s=document.querySelector("#native-select-manufacturerOptions-native"),p=s?s.options[s.selectedIndex].text:null,o=document.querySelector("#native-select-modelYear-native"),a=o?o.options[o.selectedIndex].text:null,l=document.querySelector("#native-select-modelDesc-native"),n=l?l.options[l.selectedIndex].text:null;this.profile.setValue(VEHICHLE_INFO_INTERNAL_PROPERTY,JSON.stringify({currentClient:e,currentPageKind:r,vehicleType:i,vehicleMake:p,vehicleYear:a,vehicleModel:n})),this.blueConicClient.profile.updateProfile()}.bind(this)):this.blueConicClient.position.subscribe('button[data-reason="residence"]',this,function(){this._captureVehicleAttr(e,r)})},_addVehicleAttr:function(e,r,t){var i=this.profile.getValue(VEHICHLE_INFO_INTERNAL_PROPERTY);if(i)try{var s=JSON.parse(i);e===s.currentClient&&r===s.currentPageKind&&(s.vehicleType&&(t[VEHICLE_TYPE_ATTR]=s.vehicleType),s.vehicleYear&&(t[VEHICLE_YEAR_ATTR]=s.vehicleYear),s.vehicleMake&&(t[VEHICLE_MAKE_ATTR]=s.vehicleMake),s.vehicleModel&&(t[VEHICLE_MODEL_ATTR]=s.vehicleModel))}catch(e){}},_capturePiiChanges:function(e,r){var t=document.querySelector('button[data-test="save1-button"]')?document.querySelector('button[data-test="save1-button"]'):null;null!==t?t.addEventListener("click",function(){var t=document.querySelector("#firstName-primary")?document.querySelector("#firstName-primary").value:null,i=document.querySelector("#lastName-primary")?document.querySelector("#lastName-primary").value:null,s=document.querySelector("#emailAddress-primary")?document.querySelector("#emailAddress-primary").value:null,p=null,o=null;s&&(p=this._generateProfileKey(s),o=this._validateEmail(s),this.emailProperty&&this.profile.setValue(this.emailProperty,s)),this.profile.setValue(PII_INTERNAL_PROPERY,JSON.stringify({firstName:t,lastName:i,email:s,currentClient:e,currentPageKind:r,isBadEmail:o,dummyProfileKey:p})),this.blueConicClient.profile.updateProfile()}.bind(this)):this.blueConicClient.position.subscribe('button[data-test="save1-button"]',this,function(){this._capturePiiChanges(e,r)})},_capturePII:function(e,r,t,i){submitButton=document.querySelector('button[data-reason="productinfo"]')?document.querySelector('button[data-reason="productinfo"]'):document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]')?document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]'):document.querySelector('button[data-reason="Productinfo"]')?document.querySelector('button[data-reason="Productinfo"]'):document.querySelector('button[title="NEXT: VEHICLE INFO"]')?document.querySelector('button[title="NEXT: VEHICLE INFO"]'):document.querySelector("button#submitButton")?document.querySelector("button#submitButton"):document.querySelector('button[data-reason="see-if-I-prequalify"]')?document.querySelector('button[data-reason="see-if-I-prequalify"]'):null,null!==submitButton?submitButton.addEventListener("click",function(){var s=document.querySelector("#firstName")?document.querySelector("#firstName").value:null,p=document.querySelector("#lastName")?document.querySelector("#lastName").value:null;if(!s&&!p&&document.querySelector("#fullName")||!s&&!p&&document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")){var o=document.querySelector("#fullName")?document.querySelector("#fullName").innerText:document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")?document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm").innerText:null;o&&(s=-1!==o.indexOf(" ")?o.substring(0,o.indexOf(" ")):o,p=-1!==o.indexOf(" ")?o.substring(o.indexOf(" ")+1):null)}s||p||(s=(s=document.querySelector('div.prefill-details label[for="firstName"]')?document.querySelector('div.prefill-details label[for="firstName"]').innerText:null)?s.replace(/\s$/g,""):null,p=(p=document.querySelector('div.prefill-details label[for="lastName"]')?document.querySelector('div.prefill-details label[for="lastName"]').innerText:null)?p.replace(/\s$/g,""):null);var a=document.querySelector("#confirmEmailAddress")?document.querySelector("#confirmEmailAddress").value:document.querySelector("#confirmEmailCheck")?document.querySelector("#confirmEmailCheck").value:null;a||(a=document.querySelector('div.prefill-details label[for="email"]')?document.querySelector('div.prefill-details label[for="email"]').innerText:null);var l=null,n=null;a&&(l=this._generateProfileKey(a),n=this._validateEmail(a),this.emailProperty&&this.profile.setValue(this.emailProperty,a));var P=document.querySelector("#mailingAddress")?document.querySelector("#mailingAddress").value:document.querySelector("div#prefillstreetaddress label[for='streetAddressDapply']")?document.querySelector("div#prefillstreetaddress label[for='streetAddressDapply']").innerText:null,h=document.querySelector("#appAptmtNumber")?document.querySelector("#appAptmtNumber").value:null,f=document.querySelector("#applyVTO_applicantVO_city_id")?document.querySelector("#applyVTO_applicantVO_city_id").value:document.querySelector("div#prefillstreetaddress label[for='cityAndStateDapply']")?document.querySelector("div#prefillstreetaddress label[for='cityAndStateDapply']").innerText:null,u=null,m=null;f&&(u=f.substring(0,f.indexOf(",")),m=f.substring(f.indexOf(",")+2));var y=document.querySelector("#applyVTO_applicantVO_zip_id")?document.querySelector("#applyVTO_applicantVO_zip_id").value:document.querySelector("div#prefillstreetaddress label[for='zip']")?document.querySelector("div#prefillstreetaddress label[for='zip']").innerText:null,d=document.querySelector("#appPrimaryPhone")?document.querySelector("#appPrimaryPhone").value:document.querySelector("div#prefillblock label[for='primaryPhoneDapply']")?document.querySelector("div#prefillblock label[for='primaryPhoneDapply']").innerText:null;this.profile.setValue(PII_INTERNAL_PROPERY,JSON.stringify({firstName:s,lastName:p,email:a,currentClient:e,currentPageKind:r,isBadEmail:n,dummyProfileKey:l,address1:P,address2:h,city:u,state:m,zipCode:y,phoneNumber:d,prefill:"payfone"===t&&("prefilled"===i||"no_user_data_in_payfone"===i)})),this.blueConicClient.profile.updateProfile()}.bind(this)):(this.blueConicClient.position.subscribe("button#submitButton",this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[data-reason="productinfo"]',this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[data-reason="Productinfo"]',this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[data-reason="NEXT: VEHICLE INFO"]',this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[title="NEXT: VEHICLE INFO"]',this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[data-reason="see-if-I-prequalify"]',this,function(){this._capturePII(e,r,t,i)}))},_addPII:function(e,r,t){var i=this.profile.getValue(PII_INTERNAL_PROPERY);if(i)try{var s=JSON.parse(i);e===s.currentClient&&r===s.currentPageKind&&(t[FIRST_NAME_ATTR]=s.firstName,t[LAST_NAME_ATTR]=s.lastName,s.email&&(t[EMAIL_ADDRESS_ATTR]=s.email,t[IS_BAD_EMAIL_ATTR]=s.isBadEmail?s.isBadEmail:this._validateEmail(s.email)),s.dummyProfileKey&&(t[DUMMY_PROFILE_KEY_ATTR]=s.dummyProfileKey),t[PREFILL_ATTR]=s.prefill,s.address1&&(t[ADDRESS1_ATTR]=s.address1),s.address2&&(t[ADDRESS2_ATTR]=s.address2),s.city&&(t[CITY_ATTR]=s.city),s.state&&(t[STATE_ATTR]=s.state),s.zipCode&&(t[ZIP_CODE_ATTR]=s.zipCode),s.phoneNumber&&(t[PHONE_NUMBER_ATTR]=s.phoneNumber))}catch(e){}},_validateEmail:function(e){var r=!1;(e.length<5||null===e.match(/@/g)||1!==e.match(/@/g).length||null!==e.match(/\s/g))&&(r=!0);var t=e.split("@")[1];null!==t.match(/\./g)&&1===t.match(/\./g).length&&null===t.match(/,/g)||(r=!0);var i=e.substr(0,1);["@",".",","," ","/","\\","!","#","$","%","^","&","*","(",")","+","-","~"].indexOf(i)>-1&&(r=!0);var s=e.substring(e.lastIndexOf(".")+1);return-1===["COM","NET","EDU","ORG","MIL","GOV","US","BIZ"].indexOf(s.toUpperCase())&&(r=!0),r},_indexOf:function(e,r){return Array.isArray(e)?e.indexOf(r):-1},_removeItemFromArray:function(e,r){if(Array.isArray(e))for(var t;-1!==(t=this._indexOf(e,r));)e.splice(t,1)},_encodeCookieValue:function(e){return"string"!=typeof e&&(e=JSON.stringify(e)),encodeURIComponent(e.replace(/[\n\r]/g,""))},_decodeCookieValue:function(e){return decodeURIComponent(e)},_setCookie:function(e,r,t){if(t){var i=new Date,s=t*MINUTES_TO_MILLS;i.setTime(i.getTime()+s),document.cookie=e+"="+this._encodeCookieValue(r)+(null==t?"":"; expires="+i.toUTCString())+"; path=/; SameSite=None; Secure"}else document.cookie=e+"="+this._encodeCookieValue(r)+"; path=/; SameSite=None; Secure"},_getCookie:function(e){var r,t,i=e+"=",s="";return document.cookie.length>0&&-1!==(r=document.cookie.indexOf(i))&&(r+=i.length,-1===(t=document.cookie.indexOf(";",r))&&(t=document.cookie.length),s=this._decodeCookieValue(document.cookie.substring(r,t))),s},_checkSessionStorageSupport:function(){var e="__storageTest";try{return window.sessionStorage.setItem(e,e),window.sessionStorage.removeItem(e),!0}catch(e){return!1}},_getSessionId:function(){return window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME)?window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME):this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME)?this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME):null},_getSessionIdTimestamp:function(){return window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)?window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME):this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)?this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME):null},_setSessionId:function(){var e=this._uuid();return this._checkSessionStorageSupport()&&(window.sessionStorage.setItem(APPLICATION_SESSION_ID_COOKIE_NAME,e),window.sessionStorage.setItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME,this._currentMills)),this._setCookie(APPLICATION_SESSION_ID_COOKIE_NAME,e,null),this._setCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME,this._currentMills,null),e},_getTimelineCreated:function(){var e=window.sessionStorage.getItem(this._currentPageKind)?window.sessionStorage.getItem(this._currentPageKind):this._getCookie(this._currentPageKind)?this._getCookie(this._currentPageKind):null;return e?JSON.parse(e):null},_setTimelineCreated:function(){var e={};e[this._currentPageName]=this._currentMills,e=JSON.stringify(e),this._checkSessionStorageSupport()?window.sessionStorage.setItem(this._currentPageKind,e):this._setCookie(this._currentPageKind,e,null)},_uuid:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,function(e){return(e^window.crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})}});var a = [];var i='listener_app_abandon_scaling_syf';a.push({url: '/plugins/listener_app_abandon_scaling_syf/frontend/src/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwareLocalPluginsUrl() + '/plugins/listener_app_abandon_scaling_syf/ts_193979ea91b2a6b9408336574c7fd6eb/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(e,t){this.blueConicClient=e,this.context=t},getPreloadProperties:function(){var e=this.context.getParameters(),t=e.responseProperty?e.responseProperty[0]:e.responseProperty;return t?(this.campaignIdentifierProperty=t,[t]):(this.campaignIdentifierProperty="responded_to_campaigns",["responded_to_campaigns"])},onLoad:function(){var e=this.context.getProfile(),t=this.context.getParameters(),r=this.blueConicClient,n=!1,i=!1,o=t.config?t.config[0]:t.config;if(o){for(var a=this.blueConicClient.json.parse(o),c=0;c<a.length;c++){var p=a[c],l=this.getParameterByName(p.parameter);l&&p.profileProperty&&(e.addValue(p.profileProperty,l),n=!0,p.isCampaignIdentifier&&!i&&(this._bindHandlers(l),i=!0))}n&&r.profile.updateProfile()}},_bindHandlers:function(e){var t=this,r=this.context.getProfile(),n=this.blueConicClient,i=document.querySelectorAll("a");Array.prototype.forEach.call(i,(function(i){i.addEventListener("click",(function(){r.addValue(t.campaignIdentifierProperty,e),n.profile.updateProfile()}))}));i=document.querySelectorAll("form");Array.prototype.forEach.call(i,(function(i){i.addEventListener("submit",(function(){r.addValue(t.campaignIdentifierProperty,e),n.profile.updateProfile()}))}))},getParameterByName:function(e){if(!e)return"";e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&#]"+e+"=([^&#]*)").exec(this.getLocationHref());return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},getLocationHref:function(){return window.location.href}});var a = [];var i='listener_campaign_tracker';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.1.0/'}]);})();(function(){ var MARKETING_ET="marketing_data_layer",APPLICATION_ET="application_data_layer",APPLICATION_ATTRS=["ClientName","Country_Language","Device","PageFunction","PageKind","PageSubFunction","PNL","Product","Result","SiteIdentifier","Token","URL","DateTimestamp","ACORID","Application_ID","MerchantID","PageName","PageSubFlow","sitecode","ApprovalCode","CreditLimit"],MARKETING_ATTRS=["ClientName","Country_Language","Device","PageFunction","PageKind","PageSubFunction","PNL","Product","Result","SiteIdentifier","Token","URL","DateTimestamp","PageName","offerIds"],CLIENT_NAME_ATTR="ClientName",PAGE_KIND_ATTR="PageKind",PAGE_KIND_PREQUAL="prequal",PAGE_KIND_APPLY="apply",PAGE_KIND_SECURED_INSTALLMENT="secured_installment",PAGE_KIND_PREQUAL_SECURED_INSTALLMENT="prequal_secured_installment",PAGE_KIND_APPLY_LOAN="applyloan",ACTION_ATTR="action",APP_TYPE_ATTR="appType",DATE_STAMP_ATTR="DateTimestamp",URL_ATTR="URL",PAGE_NAME_ATTR="PageName",PAGE_FUNCTION_ATTR="PageFunction",PAGE_SUB_FUNCTION_ATTR="PageSubFunction",FIRST_NAME_ATTR="FirstName",LAST_NAME_ATTR="LastName",EMAIL_ADDRESS_ATTR="EmailAddress",IS_BAD_EMAIL_ATTR="IsBadEmail",PREFILL_ATTR="Prefill",APPLICATION_SESSION_ID_ATTR="ApplicationSessionID",DUMMY_PROFILE_KEY_ATTR="DummyProfileKey",ZIP_CODE_ATTR="ZipCode",OFFER_EXPIRES_ATTR="OfferExpires",VEHICLE_TYPE_ATTR="VehicleType",VEHICLE_MAKE_ATTR="VehicleMake",VEHICLE_YEAR_ATTR="VehicleYear",VEHICLE_MODEL_ATTR="VehicleModel",LANDING_PAGE_NAMES=["auto_fill_invitation"],START_PAGE_NAMES=["prequal_offer","apply options","Termsandconditions","your information"],PREQUAL_START_PAGE_NAMES=["your information"],PREQUAL_DECLINED_PAGE_NAMES=["prequal_offer_declined"],PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES=["your information"],COMPLETE_PAGE_NAMES=["complete approve"],PENDING_PAGE_NAMES=["complete pending"],DECLINED_PAGE_NAMES=["complete decline"],PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES=["prequal_offer"],PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES=["prequal_offer_declined"],YOUR_INFORMATION_PAGE_NAME="your information",INFORMATION_REVIEW_PAGE_NAME="review",PREQUAL_OFFER_PAGE_NAME="prequal_offer",VEHICHLE_PAGE_NAME="product info",PII_INTERNAL_PROPERY="_dll_pii",VEHICHLE_INFO_INTERNAL_PROPERTY="_vehichle_info",TIME_MILLS_DAY=864e5,MINUTES_TO_MILLS=6e4,APPLICATION_SESSION_ID_COOKIE_NAME="_bcasid",APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME="_bcasid_ts";window._dataLayerListenerEventsCache=window._dataLayerListenerEventsCache||{};var InteractionTypeImpl=InteractionType.extend({init:function(e,t){this.blueConicClient=e,this.context=t,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.dataLayerName=this.parameters.dataLayerName?this.parameters.dataLayerName[0]:"_SFDDL",this.timelineEventType=this.parameters.timelineEventType?this.parameters.timelineEventType[0]:MARKETING_ET,this.clientNames=this.parameters.clientName?this.parameters.clientName:[],this.selectedPageKind=this.parameters.selectedPageKind?this.parameters.selectedPageKind:[],this.lastUpdateTimeProperty=this.parameters.lastUpdateTimeProperty?this.parameters.lastUpdateTimeProperty[0]:null,this.emailProperty=this.parameters.emailProperty?this.parameters.emailProperty[0]:null,this.appStartProperty=this.parameters.appStartProperty?this.parameters.appStartProperty[0]:null,this.appPendingProperty=this.parameters.appPendingProperty?this.parameters.appPendingProperty[0]:null,this.appCompleteProperty=this.parameters.appCompleteProperty?this.parameters.appCompleteProperty[0]:null,this.appDeclinedProperty=this.parameters.appDeclinedProperty?this.parameters.appDeclinedProperty[0]:null,this.appFraudProperty=this.parameters.appFraudProperty?this.parameters.appFraudProperty[0]:null,this.appErrorProperty=this.parameters.appErrorProperty?this.parameters.appErrorProperty[0]:null,this.agreeAndAcceptProperty=this.parameters.agreeAndAcceptProperty?this.parameters.agreeAndAcceptProperty[0]:null,this.prequalAppStartProperty=this.parameters.prequalAppStartProperty?this.parameters.prequalAppStartProperty[0]:null,this.prequalAppPendingProperty=this.parameters.prequalAppPendingProperty?this.parameters.prequalAppPendingProperty[0]:null,this.prequalAppCompleteProperty=this.parameters.prequalAppCompleteProperty?this.parameters.prequalAppCompleteProperty[0]:null,this.prequalAppDeclinedProperty=this.parameters.prequalAppDeclinedProperty?this.parameters.prequalAppDeclinedProperty[0]:null,this.prequalAppErrorProperty=this.parameters.prequalAppErrorProperty?this.parameters.prequalAppErrorProperty[0]:null,this.prequalNotInterestedProperty=this.parameters.prequalNotInterestedProperty?this.parameters.prequalNotInterestedProperty[0]:null,this.prequalSecuredInstallmentAppStartProperty=this.parameters.prequalSecuredInstallmentAppStartProperty?this.parameters.prequalSecuredInstallmentAppStartProperty[0]:null,this.prequalSecuredInstallmentAppPendingProperty=this.parameters.prequalSecuredInstallmentAppPendingProperty?this.parameters.prequalSecuredInstallmentAppPendingProperty[0]:null,this.prequalSecuredInstallmentAppCompleteProperty=this.parameters.prequalSecuredInstallmentAppCompleteProperty?this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]:null,this.prequalSecuredInstallmentAppDeclinedProperty=this.parameters.prequalSecuredInstallmentAppDeclinedProperty?this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]:null,this.prequalSecuredInstallmentAppErrorProperty=this.parameters.prequalSecuredInstallmentAppErrorProperty?this.parameters.prequalSecuredInstallmentAppErrorProperty[0]:null,this.securedInstallmentAppStartProperty=this.parameters.securedInstallmentAppStartProperty?this.parameters.securedInstallmentAppStartProperty[0]:null,this.securedInstallmentAppPendingProperty=this.parameters.securedInstallmentAppPendingProperty?this.parameters.securedInstallmentAppPendingProperty[0]:null,this.securedInstallmentAppCompleteProperty=this.parameters.securedInstallmentAppCompleteProperty?this.parameters.securedInstallmentAppCompleteProperty[0]:null,this.securedInstallmentAppDeclinedProperty=this.parameters.securedInstallmentAppDeclinedProperty?this.parameters.securedInstallmentAppDeclinedProperty[0]:null,this.securedInstallmentAppFraudProperty=this.parameters.securedInstallmentAppFraudProperty?this.parameters.securedInstallmentAppFraudProperty[0]:null,this.securedInstallmentAppErrorProperty=this.parameters.securedInstallmentAppErrorProperty?this.parameters.securedInstallmentAppErrorProperty[0]:null,this.applyLoanAppStartProperty=this.parameters.applyLoanAppStartProperty?this.parameters.applyLoanAppStartProperty[0]:null,this.applyLoanAppPendingProperty=this.parameters.applyLoanAppPendingProperty?this.parameters.applyLoanAppPendingProperty[0]:null,this.applyLoanAppCompleteProperty=this.parameters.applyLoanAppCompleteProperty?this.parameters.applyLoanAppCompleteProperty[0]:null,this.applyLoanAppDeclinedProperty=this.parameters.applyLoanAppDeclinedProperty?this.parameters.applyLoanAppDeclinedProperty[0]:null,this.applyLoanAppFraudProperty=this.parameters.applyLoanAppFraudProperty?this.parameters.applyLoanAppFraudProperty[0]:null,this.applyLoanAppErrorProperty=this.parameters.applyLoanAppErrorProperty?this.parameters.applyLoanAppErrorProperty[0]:null,this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,function(){this.onLoad()})},getPreloadProperties:function(){return[PII_INTERNAL_PROPERY,VEHICHLE_INFO_INTERNAL_PROPERTY,this.parameters.appCompleteProperty?this.parameters.appCompleteProperty[0]:"",this.parameters.appPendingProperty?this.parameters.appPendingProperty[0]:"",this.parameters.appDeclinedProperty?this.parameters.appDeclinedProperty[0]:"",this.parameters.appFraudProperty?this.parameters.appFraudProperty[0]:"",this.parameters.appErrorProperty?this.parameters.appErrorProperty[0]:"",this.parameters.prequalSecuredInstallmentAppCompleteProperty?this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]:"",this.parameters.prequalSecuredInstallmentAppDeclinedProperty?this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]:"",this.parameters.prequalSecuredInstallmentAppErrorProperty?this.parameters.prequalSecuredInstallmentAppErrorProperty[0]:"",this.parameters.prequalAppCompleteProperty?this.parameters.prequalAppCompleteProperty[0]:"",this.parameters.prequalAppDeclinedProperty?this.parameters.prequalAppDeclinedProperty[0]:"",this.parameters.prequalAppErrorProperty?this.parameters.prequalAppErrorProperty[0]:"",this.parameters.securedInstallmentAppCompleteProperty?this.parameters.securedInstallmentAppCompleteProperty[0]:"",this.parameters.securedInstallmentAppPendingProperty?this.parameters.securedInstallmentAppPendingProperty[0]:"",this.parameters.securedInstallmentAppDeclinedProperty?this.parameters.securedInstallmentAppDeclinedProperty[0]:"",this.parameters.securedInstallmentAppFraudProperty?this.parameters.securedInstallmentAppFraudProperty[0]:"",this.parameters.securedInstallmentAppErrorProperty?this.parameters.securedInstallmentAppErrorProperty[0]:"",this.parameters.applyLoanAppCompleteProperty?this.parameters.applyLoanAppCompleteProperty[0]:"",this.parameters.applyLoanAppPendingProperty?this.parameters.applyLoanAppPendingProperty[0]:"",this.parameters.applyLoanAppDeclinedProperty?this.parameters.applyLoanAppDeclinedProperty[0]:"",this.parameters.applyLoanAppFraudProperty?this.parameters.applyLoanAppFraudProperty[0]:"",this.parameters.applyLoanAppErrorProperty?this.parameters.applyLoanAppErrorProperty[0]:""].filter(function(e){return""!==e})},onLoad:function(){if(this.dataLayerName&&this.timelineEventType){var e=this,t=0;(function r(){if(window[e.dataLayerName])setTimeout(function(){e._importFromDataLayer(window[e.dataLayerName])},2e3);else{if(t>20)return;t++,window.setTimeout(r,250)}}).call(this)}},_addDaysToTimestamp:function(e,t){return isNaN(parseInt(e))||isNaN(parseInt(t))||e&&13!==e.toString().length?e:parseInt(e)+TIME_MILLS_DAY*parseInt(t)},_importFromDataLayer:function(e){if(e.pageInfo){var t=e.pageInfo[CLIENT_NAME_ATTR];if(this.clientNames.length>0&&-1===this.clientNames.indexOf(t))console.info("Listener ID: "+this.context.getInteractionId()+" -- Client name mismatch, skipping. Client: "+e.pageInfo[CLIENT_NAME_ATTR]);else{var r=new Date,a=r.getTime();this._currentMills=a;var n={};if(this.timelineEventType===MARKETING_ET)for(i=0;i<MARKETING_ATTRS.length;i++)e.pageInfo[MARKETING_ATTRS[i]]&&(n[MARKETING_ATTRS[i]]=e.pageInfo[MARKETING_ATTRS[i]]);if(this.timelineEventType===APPLICATION_ET){for(i=0;i<APPLICATION_ATTRS.length;i++)e.pageInfo[APPLICATION_ATTRS[i]]&&(n[APPLICATION_ATTRS[i]]=e.pageInfo[APPLICATION_ATTRS[i]]);if(e.formAction){var p=e.formAction[ACTION_ATTR];p&&(n[ACTION_ATTR]=p),e.formAction[APP_TYPE_ATTR]&&(n[APP_TYPE_ATTR]=e.formAction[APP_TYPE_ATTR])}var l=e.pageInfo[PAGE_KIND_ATTR];this._currentPageKind=l;var s=e.pageInfo[PAGE_NAME_ATTR];this._currentPageName=s;var o=e.pageInfo[PAGE_FUNCTION_ATTR],u=e.pageInfo[PAGE_SUB_FUNCTION_ATTR],d=this._getSessionIdTimestamp();if(LANDING_PAGE_NAMES.indexOf(s)>-1&&d&&this._currentMills-d>=1e4?this._setSessionId():LANDING_PAGE_NAMES.indexOf(s)>-1&&!d?this._setSessionId():this._getSessionId()||this._setSessionId(),l===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT)&&s===PREQUAL_OFFER_PAGE_NAME){var c=this._addDaysToTimestamp(a,30);n[OFFER_EXPIRES_ATTR]=new Date(c)}l===PAGE_KIND_PREQUAL&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL)?(this.prequalNotInterestedProperty&&this._prequalNotInterestedListener(t,s),this._handlePrequal(t,s)):l===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT)?(this._handlePrequalSecuredInstallment(t,s),VEHICHLE_PAGE_NAME===s&&this._captureVehicleAttr(t,l),this._addVehicleAttr(t,l,n)):l===PAGE_KIND_APPLY&&this.selectedPageKind.includes(PAGE_KIND_APPLY)?this._handleApply(t,s):l===PAGE_KIND_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_SECURED_INSTALLMENT)?this._handleSecuredInstallment(t,s):l===PAGE_KIND_APPLY_LOAN&&this.selectedPageKind.includes(PAGE_KIND_APPLY_LOAN)&&this._handleApplyLoan(t,s),s===YOUR_INFORMATION_PAGE_NAME&&this._capturePII(t,l,o,u),s===INFORMATION_REVIEW_PAGE_NAME&&this._capturePiiChanges(t,l),this._addPII(t,l,n)}n[DATE_STAMP_ATTR]=r,n[URL_ATTR]=window.location.href;try{this._getSessionId()&&(n[APPLICATION_SESSION_ID_ATTR]=this._getSessionId())}catch(e){this.blueConicClient.util.log(e)}this.lastUpdateTimeProperty&&this.profile.setValue(this.lastUpdateTimeProperty,a),this._updateProfile(r,n)}}},_updateProfile:function(e,t){this.blueConicClient.profile.updateProfile(this,function(){e&&t&&this._createTimelineEvent(e,t)})},_createTimelineEvent:function(e,t){var r=this._getTimelineCreated();window._dataLayerListenerEventsCache&&window._dataLayerListenerEventsCache[t.PageName]&&Object.keys(window._dataLayerListenerEventsCache[t.PageName]).includes(this._currentPageName)&&this._currentMills-window._dataLayerListenerEventsCache[t.PageName]<=1e4||r&&r[t.PageName]&&this._currentMills-r[t.PageName]<=1e4||(window._dataLayerListenerEventsCache[t.PageName]=this._currentMills,this._setTimelineCreated(),this.blueConicClient.profile.getProfile().timeline.createEvent(this.timelineEventType,e,t),this.blueConicClient.createEvent("BC_DATALAYER_UPDATED"))},_handleApply:function(e,t){START_PAGE_NAMES.indexOf(t)>-1&&this.appStartProperty&&this.profile.addValue(this.appStartProperty,e),PENDING_PAGE_NAMES.indexOf(t)>-1&&this.appPendingProperty&&this.profile.addValue(this.appPendingProperty,e),COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.appCompleteProperty&&this.profile.addValue(this.appCompleteProperty,e),(DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.appDeclinedProperty&&this.profile.addValue(this.appDeclinedProperty,e),t.toLowerCase().indexOf("fraud")>-1&&this.appFraudProperty&&this.profile.addValue(this.appFraudProperty,e),t.toLowerCase().indexOf("error")>-1&&this.appErrorProperty&&this.profile.addValue(this.appErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handlePrequal:function(e,t){PREQUAL_START_PAGE_NAMES.indexOf(t)>-1&&this.prequalAppStartProperty&&this.profile.addValue(this.prequalAppStartProperty,e),COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.prequalAppCompleteProperty&&this.profile.addValue(this.prequalAppCompleteProperty,e),(PREQUAL_DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.prequalAppDeclinedProperty&&this.profile.addValue(this.prequalAppDeclinedProperty,e),t.toLowerCase().indexOf("error")>-1&&this.prequalAppErrorProperty&&this.profile.addValue(this.prequalAppErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handlePrequalSecuredInstallment:function(e,t){PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES.indexOf(t)>-1&&this.prequalSecuredInstallmentAppStartProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppStartProperty,e),PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.prequalSecuredInstallmentAppCompleteProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppCompleteProperty,e),(PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.prequalSecuredInstallmentAppDeclinedProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppDeclinedProperty,e),t.toLowerCase().indexOf("error")>-1&&this.prequalSecuredInstallmentAppErrorProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_prequalNotInterestedListener:function(e){var t=document.querySelectorAll('a[data-reason="not_interested"]');t.length>0?t.forEach(function(t,r){t.addEventListener("click",function(){this.profile.addValue(this.prequalNotInterestedProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1)}.bind(this)):this.blueConicClient.position.subscribe('a[data-reason="not_interested"]',this,function(){this._prequalNotInterestedListener(e)})},_handleSecuredInstallment:function(e,t){START_PAGE_NAMES.indexOf(t)>-1&&this.securedInstallmentAppStartProperty&&this.profile.addValue(this.securedInstallmentAppStartProperty,e),t.toLowerCase().indexOf("pending")>-1&&this.securedInstallmentAppPendingProperty&&this.profile.addValue(this.securedInstallmentAppPendingProperty,e),COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.securedInstallmentAppCompleteProperty&&this.profile.addValue(this.securedInstallmentAppCompleteProperty,e),(DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.securedInstallmentAppDeclinedProperty&&this.profile.addValue(this.securedInstallmentAppDeclinedProperty,e),t.toLowerCase().indexOf("fraud")>-1&&this.securedInstallmentAppFraudProperty&&this.profile.addValue(this.securedInstallmentAppFraudProperty,e),t.toLowerCase().indexOf("error")>-1&&this.securedInstallmentAppErrorProperty&&this.profile.addValue(this.securedInstallmentAppErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handleApplyLoan:function(e,t){START_PAGE_NAMES.indexOf(t)>-1&&this.applyLoanAppStartProperty&&this.profile.addValue(this.applyLoanAppStartProperty,e),t.toLowerCase().indexOf("pending")>-1&&this.applyLoanAppPendingProperty&&this.profile.addValue(this.applyLoanAppPendingProperty,e),COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.applyLoanAppCompleteProperty&&this.profile.addValue(this.applyLoanAppCompleteProperty,e),(DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.applyLoanAppDeclinedProperty&&this.profile.addValue(this.applyLoanAppDeclinedProperty,e),t.toLowerCase().indexOf("fraud")>-1&&this.applyLoanAppFraudProperty&&this.profile.addValue(this.applyLoanAppFraudProperty,e),t.toLowerCase().indexOf("error")>-1&&this.applyLoanAppErrorProperty&&this.profile.addValue(this.applyLoanAppErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_aggreeAcceptClickListener:function(e){var t=document.querySelector("button#acptbtn")||null;t?t.addEventListener("click",function(){this.profile.addValue(this.agreeAndAcceptProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1):this.blueConicClient.position.subscribe("button#acptbtn",this,function(){this._aggreeAcceptClickListener(e)})},_generateProfileKey:function(e){if(!e)return null;try{return md5((new Date).getTime().toString()+"_"+e.toLowerCase()).substring(6,26)}catch(e){return null}},_captureVehicleAttr:function(e,t){var r=document.querySelector('button[data-reason="residence"]')||null;null!==r?r.addEventListener("click",function(){var r=document.querySelector("#native-select-vehicleType-native"),i=r?r.options[r.selectedIndex].text:null,a=document.querySelector("#native-select-manufacturerOptions-native"),n=a?a.options[a.selectedIndex].text:null,p=document.querySelector("#native-select-modelYear-native"),l=p?p.options[p.selectedIndex].text:null,s=document.querySelector("#native-select-modelDesc-native"),o=s?s.options[s.selectedIndex].text:null;this.profile.setValue(VEHICHLE_INFO_INTERNAL_PROPERTY,JSON.stringify({currentClient:e,currentPageKind:t,vehicleType:i,vehicleMake:n,vehicleYear:l,vehicleModel:o})),this.blueConicClient.profile.updateProfile()}.bind(this)):this.blueConicClient.position.subscribe('button[data-reason="residence"]',this,function(){this._captureVehicleAttr(e,t)})},_addVehicleAttr:function(e,t,r){var i=this.profile.getValue(VEHICHLE_INFO_INTERNAL_PROPERTY);if(i)try{var a=JSON.parse(i);e===a.currentClient&&t===a.currentPageKind&&(a.vehicleType&&(r[VEHICLE_TYPE_ATTR]=a.vehicleType),a.vehicleYear&&(r[VEHICLE_YEAR_ATTR]=a.vehicleYear),a.vehicleMake&&(r[VEHICLE_MAKE_ATTR]=a.vehicleMake),a.vehicleModel&&(r[VEHICLE_MODEL_ATTR]=a.vehicleModel))}catch(e){}},_capturePiiChanges:function(e,t){var r=document.querySelector('button[data-test="save1-button"]')?document.querySelector('button[data-test="save1-button"]'):null;null!==r?r.addEventListener("click",function(){var r=document.querySelector("#firstName-primary")?document.querySelector("#firstName-primary").value:null,i=document.querySelector("#lastName-primary")?document.querySelector("#lastName-primary").value:null,a=document.querySelector("#emailAddress-primary")?document.querySelector("#emailAddress-primary").value:null,n=null,p=null;a&&(t===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&(n=this._generateProfileKey(a)),p=this._validateEmail(a),this.emailProperty&&this.profile.setValue(this.emailProperty,a)),this.profile.setValue(PII_INTERNAL_PROPERY,JSON.stringify({firstName:r,lastName:i,email:a,currentClient:e,currentPageKind:t,isBadEmail:p,dummyProfileKey:n})),this.blueConicClient.profile.updateProfile()}.bind(this)):this.blueConicClient.position.subscribe('button[data-test="save1-button"]',this,function(){this._capturePiiChanges(e,t)})},_capturePII:function(e,t,r,i){submitButton=document.querySelector('button[data-reason="productinfo"]')?document.querySelector('button[data-reason="productinfo"]'):document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]')?document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]'):document.querySelector('button[data-reason="Productinfo"]')?document.querySelector('button[data-reason="Productinfo"]'):document.querySelector('button[title="NEXT: VEHICLE INFO"]')?document.querySelector('button[title="NEXT: VEHICLE INFO"]'):document.querySelector("button#submitButton")?document.querySelector("button#submitButton"):null,null!==submitButton?submitButton.addEventListener("click",function(){var a=document.querySelector("#firstName")?document.querySelector("#firstName").value:null,n=document.querySelector("#lastName")?document.querySelector("#lastName").value:null;if(!a&&!n&&document.querySelector("#fullName")||!a&&!n&&document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")){var p=document.querySelector("#fullName")?document.querySelector("#fullName").innerText:document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")?document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm").innerText:null;p&&(a=-1!==p.indexOf(" ")?p.substring(0,p.indexOf(" ")):p,n=-1!==p.indexOf(" ")?p.substring(p.indexOf(" ")+1):null)}a||n||(a=(a=document.querySelector('div.prefill-details label[for="firstName"]')?document.querySelector('div.prefill-details label[for="firstName"]').innerText:null)?a.replace(/\s$/g,""):null,n=(n=document.querySelector('div.prefill-details label[for="lastName"]')?document.querySelector('div.prefill-details label[for="lastName"]').innerText:null)?n.replace(/\s$/g,""):null);var l=document.querySelector("#confirmEmailAddress")?document.querySelector("#confirmEmailAddress").value:document.querySelector("#confirmEmailCheck")?document.querySelector("#confirmEmailCheck").value:null,s=null,o=null;l&&(s=this._generateProfileKey(l),o=this._validateEmail(l),this.emailProperty&&this.profile.setValue(this.emailProperty,l));var u=document.querySelector("#applyVTO_applicantVO_zip_id")?document.querySelector("#applyVTO_applicantVO_zip_id").value:document.querySelector("#zipCode-primary")?document.querySelector("#zipCode-primary").value:null;if(!u){var d=document.querySelector("#address")?document.querySelector("#address").innerText:document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(2) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")?document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(2) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm").innerText:null;d&&(u=d.substring(d.lastIndexOf(", ")+2))}this.profile.setValue(PII_INTERNAL_PROPERY,JSON.stringify({firstName:a,lastName:n,email:l,currentClient:e,currentPageKind:t,isBadEmail:o,dummyProfileKey:s,zipCode:u,prefill:"payfone"===r&&("prefilled"===i||"no_user_data_in_payfone"===i)})),this.blueConicClient.profile.updateProfile()}.bind(this)):(this.blueConicClient.position.subscribe("button#submitButton",this,function(){this._capturePII(e,t,r,i)}),this.blueConicClient.position.subscribe('button[data-reason="productinfo"]',this,function(){this._capturePII(e,t,r,i)}),this.blueConicClient.position.subscribe('button[data-reason="Productinfo"]',this,function(){this._capturePII(e,t,r,i)}),this.blueConicClient.position.subscribe('button[data-reason="NEXT: VEHICLE INFO"]',this,function(){this._capturePII(e,t,r,i)}),this.blueConicClient.position.subscribe('button[title="NEXT: VEHICLE INFO"]',this,function(){this._capturePII(e,t,r,i)}))},_addPII:function(e,t,r){var i=this.profile.getValue(PII_INTERNAL_PROPERY);if(i)try{var a=JSON.parse(i);e===a.currentClient&&t===a.currentPageKind&&(r[FIRST_NAME_ATTR]=a.firstName,r[LAST_NAME_ATTR]=a.lastName,a.email&&(r[EMAIL_ADDRESS_ATTR]=a.email,r[IS_BAD_EMAIL_ATTR]=a.isBadEmail?a.isBadEmail:this._validateEmail(a.email)),a.dummyProfileKey&&(r[DUMMY_PROFILE_KEY_ATTR]=a.dummyProfileKey),r[PREFILL_ATTR]=a.prefill,a.zipCode&&(r[ZIP_CODE_ATTR]=a.zipCode))}catch(e){}},_validateEmail:function(e){var t=!1;(e.length<5||null===e.match(/@/g)||1!==e.match(/@/g).length||null!==e.match(/\s/g))&&(t=!0);var r=e.split("@")[1];null!==r.match(/\./g)&&1===r.match(/\./g).length&&null===r.match(/,/g)||(t=!0);var i=e.substr(0,1);["@",".",","," ","/","\\","!","#","$","%","^","&","*","(",")","+","-","~"].indexOf(i)>-1&&(t=!0);var a=e.substring(e.lastIndexOf(".")+1);return-1===["COM","NET","EDU","ORG","MIL","GOV","US","BIZ"].indexOf(a.toUpperCase())&&(t=!0),t},_indexOf:function(e,t){return Array.isArray(e)?e.indexOf(t):-1},_removeItemFromArray:function(e,t){if(Array.isArray(e))for(var r;-1!==(r=this._indexOf(e,t));)e.splice(r,1)},_encodeCookieValue:function(e){return"string"!=typeof e&&(e=JSON.stringify(e)),encodeURIComponent(e.replace(/[\n\r]/g,""))},_decodeCookieValue:function(e){return decodeURIComponent(e)},_setCookie:function(e,t,r){if(r){var i=new Date,a=r*MINUTES_TO_MILLS;i.setTime(i.getTime()+a),document.cookie=e+"="+this._encodeCookieValue(t)+(null==r?"":"; expires="+i.toUTCString())+"; path=/; SameSite=None; Secure"}else document.cookie=e+"="+this._encodeCookieValue(t)+"; path=/; SameSite=None; Secure"},_getCookie:function(e){var t,r,i=e+"=",a="";return document.cookie.length>0&&-1!==(t=document.cookie.indexOf(i))&&(t+=i.length,-1===(r=document.cookie.indexOf(";",t))&&(r=document.cookie.length),a=this._decodeCookieValue(document.cookie.substring(t,r))),a},_checkSessionStorageSupport:function(){var e="__storageTest";try{return window.sessionStorage.setItem(e,e),window.sessionStorage.removeItem(e),!0}catch(e){return!1}},_getSessionId:function(){return window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME)?window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME):this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME)?this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME):null},_getSessionIdTimestamp:function(){return window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)?window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME):this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)?this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME):null},_setSessionId:function(){var e=this._uuid();return this._checkSessionStorageSupport()&&(window.sessionStorage.setItem(APPLICATION_SESSION_ID_COOKIE_NAME,e),window.sessionStorage.setItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME,this._currentMills)),this._setCookie(APPLICATION_SESSION_ID_COOKIE_NAME,e,null),this._setCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME,this._currentMills,null),e},_getTimelineCreated:function(){var e=window.sessionStorage.getItem(this._currentPageKind)?window.sessionStorage.getItem(this._currentPageKind):this._getCookie(this._currentPageKind)?this._getCookie(this._currentPageKind):null;return e?JSON.parse(e):null},_setTimelineCreated:function(){var e={};e[this._currentPageName]=this._currentMills,e=JSON.stringify(e),this._checkSessionStorageSupport()?window.sessionStorage.setItem(this._currentPageKind,e):this._setCookie(this._currentPageKind,e,null)},_uuid:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,function(e){return(e^window.crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})}});var a = [];var i='listener_carte_barrel_datalayer_syf';a.push({url: '/plugins/listener_carte_barrel_datalayer_syf/frontend/src/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwareLocalPluginsUrl() + '/plugins/listener_carte_barrel_datalayer_syf/ts_04b9e4a6ed937a91018d7eca7f2c79f4/'}]);})();(function(){ /* eslint-disable max-statements */
/* eslint-disable complexity */
/* eslint-disable object-shorthand */
/* eslint-disable no-var */
/* eslint-disable camelcase, require-jsdoc */
// @ts-nocheck

// EVENT TYPES
var MARKETING_ET = "marketing_data_layer";
var APPLICATION_ET = "application_data_layer";

// TO-DO: Update 'ApprovalCode' & 'ApprovalAmount' with actual keys
// from dataLayer once implemented by Synchrony team.
// DL ATTRIBUTES
var APPLICATION_ATTRS = [
  "ClientName",
  "Country_Language",
  "Device",
  "PageFunction",
  "PageKind",
  "PageSubFunction",
  "PNL",
  "Product",
  "Result",
  "SiteIdentifier",
  "Token",
  "URL",
  "DateTimestamp",
  "ACORID",
  "Application_ID",
  "MerchantID",
  "PageName",
  "PageSubFlow",
  "sitecode",
  "ApprovalCode",
  "CreditLimit"
];
var MARKETING_ATTRS = [
  "ClientName",
  "Country_Language",
  "Device",
  "PageFunction",
  "PageKind",
  "PageSubFunction",
  "PNL",
  "Product",
  "Result",
  "SiteIdentifier",
  "Token",
  "URL",
  "DateTimestamp",
  "PageName",
  "offerIds"
];

var CLIENT_NAME_ATTR = "ClientName";
var PAGE_KIND_ATTR = "PageKind";

var PAGE_KIND_PREQUAL = "prequal";
var PAGE_KIND_APPLY = "apply";
var PAGE_KIND_SECURED_INSTALLMENT = "secured_installment";
var PAGE_KIND_PREQUAL_SECURED_INSTALLMENT = "prequal_secured_installment";
var PAGE_KIND_APPLY_LOAN = "applyloan";

var ACTION_ATTR = "action";
var APP_TYPE_ATTR = "appType";
var DATE_STAMP_ATTR = "DateTimestamp";
var URL_ATTR = "URL";
var PAGE_NAME_ATTR = "PageName";
var PAGE_FUNCTION_ATTR = "PageFunction";
var PAGE_SUB_FUNCTION_ATTR = "PageSubFunction";

var FIRST_NAME_ATTR = "FirstName";
var LAST_NAME_ATTR = "LastName";
var EMAIL_ADDRESS_ATTR = "EmailAddress";
var IS_BAD_EMAIL_ATTR = "IsBadEmail";
var PREFILL_ATTR = "Prefill";
var APPLICATION_SESSION_ID_ATTR = "ApplicationSessionID";

var DUMMY_PROFILE_KEY_ATTR = "DummyProfileKey";
var ZIP_CODE_ATTR = "ZipCode";

// TO-DO: Update 'OfferExpires' with actual key
// from dataLayer once implemented by Synchrony team.
var OFFER_EXPIRES_ATTR = "OfferExpires";
var VEHICLE_TYPE_ATTR = "VehicleType";
var VEHICLE_MAKE_ATTR = "VehicleMake";
var VEHICLE_YEAR_ATTR = "VehicleYear";
var VEHICLE_MODEL_ATTR = "VehicleModel";

var LANDING_PAGE_NAMES = ["auto_fill_invitation"];
var START_PAGE_NAMES = ["prequal_offer", "apply options", "Termsandconditions", "your information"];
var PREQUAL_START_PAGE_NAMES = ["your information"];
var PREQUAL_DECLINED_PAGE_NAMES = ["prequal_offer_declined"];
var PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES = ["your information"];
var COMPLETE_PAGE_NAMES = ["complete approve"];
var PENDING_PAGE_NAMES = ["complete pending"];
var DECLINED_PAGE_NAMES = ["complete decline"];
var PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES = ["prequal_offer"];
var PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES = ["prequal_offer_declined"];
var YOUR_INFORMATION_PAGE_NAME = "your information";
var INFORMATION_REVIEW_PAGE_NAME = "review";
var PREQUAL_OFFER_PAGE_NAME = "prequal_offer";
var VEHICHLE_PAGE_NAME = "product info";

var PII_INTERNAL_PROPERY = "_dll_pii";
var VEHICHLE_INFO_INTERNAL_PROPERTY = "_vehichle_info";

var TIME_MILLS_DAY = 24 * 60 * 60 * 1000;
var MINUTES_TO_MILLS = 60 * 1000;

var APPLICATION_SESSION_ID_COOKIE_NAME = "_bcasid";
var APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME = "_bcasid_ts";

window._dataLayerListenerEventsCache = window._dataLayerListenerEventsCache || {};

var InteractionTypeImpl = InteractionType.extend({
  // eslint-disable-next-line complexity, max-statements
  init: function(blueConicClient, context) {
    this.blueConicClient = blueConicClient;
    this.context = context;
    this.profile = this.context.getProfile();
    this.parameters = this.context.getParameters();

    this.dataLayerName = this.parameters.dataLayerName ? this.parameters.dataLayerName[0] : "_SFDDL";
    this.timelineEventType = this.parameters.timelineEventType ? this.parameters.timelineEventType[0] : MARKETING_ET;
    this.clientNames = this.parameters.clientName ? this.parameters.clientName : [];

    this.selectedPageKind = this.parameters.selectedPageKind ? this.parameters.selectedPageKind : [];

    this.lastUpdateTimeProperty = this.parameters.lastUpdateTimeProperty
      ? this.parameters.lastUpdateTimeProperty[0]
      : null;
    this.emailProperty = this.parameters.emailProperty ? this.parameters.emailProperty[0] : null;

    this.appStartProperty = this.parameters.appStartProperty ? this.parameters.appStartProperty[0] : null;
    this.appPendingProperty = this.parameters.appPendingProperty ? this.parameters.appPendingProperty[0] : null;
    this.appCompleteProperty = this.parameters.appCompleteProperty ? this.parameters.appCompleteProperty[0] : null;
    this.appDeclinedProperty = this.parameters.appDeclinedProperty ? this.parameters.appDeclinedProperty[0] : null;
    this.appFraudProperty = this.parameters.appFraudProperty ? this.parameters.appFraudProperty[0] : null;
    this.appErrorProperty = this.parameters.appErrorProperty ? this.parameters.appErrorProperty[0] : null;

    this.prequalAppStartProperty = this.parameters.prequalAppStartProperty
      ? this.parameters.prequalAppStartProperty[0]
      : null;
    this.prequalAppPendingProperty = this.parameters.prequalAppPendingProperty
      ? this.parameters.prequalAppPendingProperty[0]
      : null;
    this.prequalAppCompleteProperty = this.parameters.prequalAppCompleteProperty
      ? this.parameters.prequalAppCompleteProperty[0]
      : null;
    this.prequalAppDeclinedProperty = this.parameters.prequalAppDeclinedProperty
      ? this.parameters.prequalAppDeclinedProperty[0]
      : null;
    this.prequalAppErrorProperty = this.parameters.prequalAppErrorProperty
      ? this.parameters.prequalAppErrorProperty[0]
      : null;
    this.prequalNotInterestedProperty = this.parameters.prequalNotInterestedProperty
      ? this.parameters.prequalNotInterestedProperty[0]
      : null;
    this.prequalSecuredInstallmentAppStartProperty = this.parameters.prequalSecuredInstallmentAppStartProperty
      ? this.parameters.prequalSecuredInstallmentAppStartProperty[0]
      : null;
    this.prequalSecuredInstallmentAppPendingProperty = this.parameters.prequalSecuredInstallmentAppPendingProperty
      ? this.parameters.prequalSecuredInstallmentAppPendingProperty[0]
      : null;
    this.prequalSecuredInstallmentAppCompleteProperty = this.parameters.prequalSecuredInstallmentAppCompleteProperty
      ? this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]
      : null;
    this.prequalSecuredInstallmentAppDeclinedProperty = this.parameters.prequalSecuredInstallmentAppDeclinedProperty
      ? this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]
      : null;
    this.prequalSecuredInstallmentAppErrorProperty = this.parameters.prequalSecuredInstallmentAppErrorProperty
      ? this.parameters.prequalSecuredInstallmentAppErrorProperty[0]
      : null;
    this.securedInstallmentAppStartProperty = this.parameters.securedInstallmentAppStartProperty
      ? this.parameters.securedInstallmentAppStartProperty[0]
      : null;
    this.securedInstallmentAppPendingProperty = this.parameters.securedInstallmentAppPendingProperty
      ? this.parameters.securedInstallmentAppPendingProperty[0]
      : null;
    this.securedInstallmentAppCompleteProperty = this.parameters.securedInstallmentAppCompleteProperty
      ? this.parameters.securedInstallmentAppCompleteProperty[0]
      : null;
    this.securedInstallmentAppDeclinedProperty = this.parameters.securedInstallmentAppDeclinedProperty
      ? this.parameters.securedInstallmentAppDeclinedProperty[0]
      : null;
    this.securedInstallmentAppFraudProperty = this.parameters.securedInstallmentAppFraudProperty
      ? this.parameters.securedInstallmentAppFraudProperty[0]
      : null;
    this.securedInstallmentAppErrorProperty = this.parameters.securedInstallmentAppErrorProperty
      ? this.parameters.securedInstallmentAppErrorProperty[0]
      : null;
    this.applyLoanAppStartProperty = this.parameters.applyLoanAppStartProperty
      ? this.parameters.applyLoanAppStartProperty[0]
      : null;
    this.applyLoanAppPendingProperty = this.parameters.applyLoanAppPendingProperty
      ? this.parameters.applyLoanAppPendingProperty[0]
      : null;
    this.applyLoanAppCompleteProperty = this.parameters.applyLoanAppCompleteProperty
      ? this.parameters.applyLoanAppCompleteProperty[0]
      : null;
    this.applyLoanAppDeclinedProperty = this.parameters.applyLoanAppDeclinedProperty
      ? this.parameters.applyLoanAppDeclinedProperty[0]
      : null;
    this.applyLoanAppFraudProperty = this.parameters.applyLoanAppFraudProperty
      ? this.parameters.applyLoanAppFraudProperty[0]
      : null;
    this.applyLoanAppErrorProperty = this.parameters.applyLoanAppErrorProperty
      ? this.parameters.applyLoanAppErrorProperty[0]
      : null;

    this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange, this, function() {
      this.onLoad();
    });
  },

  // eslint-disable-next-line complexity
  getPreloadProperties: function() {
    var preloadProperties = [
      PII_INTERNAL_PROPERY,
      VEHICHLE_INFO_INTERNAL_PROPERTY,
      this.parameters.appCompleteProperty ? this.parameters.appCompleteProperty[0] : "",
      this.parameters.appPendingProperty ? this.parameters.appPendingProperty[0] : "",
      this.parameters.appDeclinedProperty ? this.parameters.appDeclinedProperty[0] : "",
      this.parameters.appFraudProperty ? this.parameters.appFraudProperty[0] : "",
      this.parameters.appErrorProperty ? this.parameters.appErrorProperty[0] : "",
      this.parameters.prequalSecuredInstallmentAppCompleteProperty
        ? this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]
        : "",
      this.parameters.prequalSecuredInstallmentAppDeclinedProperty
        ? this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]
        : "",
      this.parameters.prequalSecuredInstallmentAppErrorProperty
        ? this.parameters.prequalSecuredInstallmentAppErrorProperty[0]
        : "",
      this.parameters.prequalAppCompleteProperty ? this.parameters.prequalAppCompleteProperty[0] : "",
      this.parameters.prequalAppDeclinedProperty ? this.parameters.prequalAppDeclinedProperty[0] : "",
      this.parameters.prequalAppErrorProperty ? this.parameters.prequalAppErrorProperty[0] : "",
      this.parameters.securedInstallmentAppCompleteProperty
        ? this.parameters.securedInstallmentAppCompleteProperty[0]
        : "",
      this.parameters.securedInstallmentAppPendingProperty
        ? this.parameters.securedInstallmentAppPendingProperty[0]
        : "",
      this.parameters.securedInstallmentAppDeclinedProperty
        ? this.parameters.securedInstallmentAppDeclinedProperty[0]
        : "",
      this.parameters.securedInstallmentAppFraudProperty ? this.parameters.securedInstallmentAppFraudProperty[0] : "",
      this.parameters.securedInstallmentAppErrorProperty ? this.parameters.securedInstallmentAppErrorProperty[0] : "",
      this.parameters.applyLoanAppCompleteProperty ? this.parameters.applyLoanAppCompleteProperty[0] : "",
      this.parameters.applyLoanAppPendingProperty ? this.parameters.applyLoanAppPendingProperty[0] : "",
      this.parameters.applyLoanAppDeclinedProperty ? this.parameters.applyLoanAppDeclinedProperty[0] : "",
      this.parameters.applyLoanAppFraudProperty ? this.parameters.applyLoanAppFraudProperty[0] : "",
      this.parameters.applyLoanAppErrorProperty ? this.parameters.applyLoanAppErrorProperty[0] : ""
    ];

    return preloadProperties.filter(function(propertyId) {
      return propertyId !== "";
    });
  },

  onLoad: function() {
    if (!this.dataLayerName || !this.timelineEventType) {
      return;
    }

    var me = this;
    var recursionCounter = 0;
    function dataLayerReady() {
      if (!window[me.dataLayerName]) {
        // wait max 5 seconds for data layer to load
        if (recursionCounter > 20) {
          return;
        }
        recursionCounter++;
        window.setTimeout(dataLayerReady, 250);
      } else {
        setTimeout(function() {
          me._importFromDataLayer(window[me.dataLayerName]);
        }, 2000);
      }
    }
    dataLayerReady.call(this);
  },

  /*
   * Adds passed number of days to passed UNIX timestamp and returns new timestamp
   */
  _addDaysToTimestamp: function(currentTimestamp, addDays) {
    if (
      isNaN(parseInt(currentTimestamp)) ||
      isNaN(parseInt(addDays)) ||
      (currentTimestamp && currentTimestamp.toString().length !== 13)
    ) {
      return currentTimestamp;
    }
    var currentMills = parseInt(currentTimestamp);
    var additionalMills = TIME_MILLS_DAY * parseInt(addDays);
    return currentMills + additionalMills;
  },

  // eslint-disable-next-line complexity, max-statements
  _importFromDataLayer: function(dataLayer) {
    if (!dataLayer.pageInfo) {
      // Nothing to track
      return;
    }

    // Filter on ClientName
    var currentClient = dataLayer.pageInfo[CLIENT_NAME_ATTR];
    if (this.clientNames.length > 0 && this.clientNames.indexOf(currentClient) === -1) {
      console.info(
        "Listener ID: " +
          this.context.getInteractionId() +
          " -- Client name mismatch, skipping. Client: " +
          dataLayer.pageInfo[CLIENT_NAME_ATTR]
      );
      return;
    }

    // Add Timeline Event
    var currentDate = new Date();
    var currentMills = currentDate.getTime();
    this._currentMills = currentMills;
    var eventPayLoad = {};

    // Marketing specific attributes
    if (this.timelineEventType === MARKETING_ET) {
      for (i = 0; i < MARKETING_ATTRS.length; i++) {
        if (dataLayer.pageInfo[MARKETING_ATTRS[i]]) {
          eventPayLoad[MARKETING_ATTRS[i]] = dataLayer.pageInfo[MARKETING_ATTRS[i]];
        }
      }
    }

    // Application specific attributes
    if (this.timelineEventType === APPLICATION_ET) {
      for (i = 0; i < APPLICATION_ATTRS.length; i++) {
        if (dataLayer.pageInfo[APPLICATION_ATTRS[i]]) {
          eventPayLoad[APPLICATION_ATTRS[i]] = dataLayer.pageInfo[APPLICATION_ATTRS[i]];
        }
      }

      if (dataLayer.formAction) {
        var action = dataLayer.formAction[ACTION_ATTR];
        if (action) {
          eventPayLoad[ACTION_ATTR] = action;
        }
        if (dataLayer.formAction[APP_TYPE_ATTR]) {
          eventPayLoad[APP_TYPE_ATTR] = dataLayer.formAction[APP_TYPE_ATTR];
        }
      }

      var currentPageKind = dataLayer.pageInfo[PAGE_KIND_ATTR];
      this._currentPageKind = currentPageKind;
      var currentPageName = dataLayer.pageInfo[PAGE_NAME_ATTR];
      this._currentPageName = currentPageName;
      var currentPageFunction = dataLayer.pageInfo[PAGE_FUNCTION_ATTR];
      var currentPageSubFunction = dataLayer.pageInfo[PAGE_SUB_FUNCTION_ATTR];

      var sessionIdLatestTimestamp = this._getSessionIdTimestamp();

      if (
        LANDING_PAGE_NAMES.indexOf(currentPageName) > -1 &&
        sessionIdLatestTimestamp &&
        this._currentMills - sessionIdLatestTimestamp >= 10000
      ) {
        this._setSessionId();
      } else if (LANDING_PAGE_NAMES.indexOf(currentPageName) > -1 && !sessionIdLatestTimestamp) {
        this._setSessionId();
      } else if (!this._getSessionId()) {
        this._setSessionId();
      }

      if (
        currentPageKind === PAGE_KIND_PREQUAL_SECURED_INSTALLMENT &&
        this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT) &&
        currentPageName === PREQUAL_OFFER_PAGE_NAME
      ) {
        var next30DaysTimestamp = this._addDaysToTimestamp(currentMills, 30);
        eventPayLoad[OFFER_EXPIRES_ATTR] = new Date(next30DaysTimestamp);
      }

      if (currentPageKind === PAGE_KIND_PREQUAL && this.selectedPageKind.includes(PAGE_KIND_PREQUAL)) {
        // Prequal flow
        if (this.prequalNotInterestedProperty) {
          this._prequalNotInterestedListener(currentClient, currentPageName);
        }

        this._handlePrequal(currentClient, currentPageName);
      } else if (
        currentPageKind === PAGE_KIND_PREQUAL_SECURED_INSTALLMENT &&
        this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT)
      ) {
        // Prequal secured installment flow
        this._handlePrequalSecuredInstallment(currentClient, currentPageName);

        if (VEHICHLE_PAGE_NAME === currentPageName) {
          this._captureVehicleAttr(currentClient, currentPageKind);
        }

        this._addVehicleAttr(currentClient, currentPageKind, eventPayLoad);
      } else if (currentPageKind === PAGE_KIND_APPLY && this.selectedPageKind.includes(PAGE_KIND_APPLY)) {
        // Multi-client apply flow
        this._handleApply(currentClient, currentPageName);
      } else if (
        currentPageKind === PAGE_KIND_SECURED_INSTALLMENT &&
        this.selectedPageKind.includes(PAGE_KIND_SECURED_INSTALLMENT)
      ) {
        // Secured installment apply flow
        this._handleSecuredInstallment(currentClient, currentPageName);
      } else if (currentPageKind === PAGE_KIND_APPLY_LOAN && this.selectedPageKind.includes(PAGE_KIND_APPLY_LOAN)) {
        // Apply loan apply flow
        this._handleApplyLoan(currentClient, currentPageName);
      }

      if (currentPageName === YOUR_INFORMATION_PAGE_NAME) {
        this._capturePII(currentClient, currentPageKind, currentPageFunction, currentPageSubFunction);
      }

      if (currentPageName === INFORMATION_REVIEW_PAGE_NAME) {
        this._capturePiiChanges(currentClient, currentPageKind);
      }

      this._addPII(currentClient, currentPageKind, eventPayLoad);
    }

    // Generic pageInfo attributes
    eventPayLoad[DATE_STAMP_ATTR] = currentDate;
    eventPayLoad[URL_ATTR] = window.location.href;

    try {
      if (this._getSessionId()) {
        eventPayLoad[APPLICATION_SESSION_ID_ATTR] = this._getSessionId();
      }
    } catch (e) {
      this.blueConicClient.util.log(e);
    }

    // Set latest DL update time property
    if (this.lastUpdateTimeProperty) {
      this.profile.setValue(this.lastUpdateTimeProperty, currentMills);
    }

    this._updateProfile(currentDate, eventPayLoad);
  },

  _updateProfile: function(currentDate, eventPayLoad) {
    this.blueConicClient.profile.updateProfile(this, function() {
      if (currentDate && eventPayLoad) {
        this._createTimelineEvent(currentDate, eventPayLoad);
      }
    });
  },

  _createTimelineEvent: function(currentDate, eventPayLoad) {
    var lastTimelineCreated = this._getTimelineCreated();
    // If an event with the same PageName was created within the last 10 seconds skip creating the event again
    if (
      (window._dataLayerListenerEventsCache &&
        window._dataLayerListenerEventsCache[eventPayLoad.PageName] &&
        Object.keys(window._dataLayerListenerEventsCache[eventPayLoad.PageName]).includes(this._currentPageName) &&
        this._currentMills - window._dataLayerListenerEventsCache[eventPayLoad.PageName] <= 10000) ||
      (lastTimelineCreated &&
        lastTimelineCreated[eventPayLoad.PageName] &&
        this._currentMills - lastTimelineCreated[eventPayLoad.PageName] <= 10000)
    ) {
      return;
    }

    window._dataLayerListenerEventsCache[eventPayLoad.PageName] = this._currentMills;
    this._setTimelineCreated();

    // Create the Timeline event
    this.blueConicClient.profile.getProfile().timeline.createEvent(this.timelineEventType, currentDate, eventPayLoad);

    // notification that the profile was updated succesfully
    this.blueConicClient.createEvent("BC_DATALAYER_UPDATED");
  },

  /*
   * Handle the regular apply flow
   */
  _handleApply: function(currentClient, currentPageName) {
    if (START_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.appStartProperty) {
        this.profile.addValue(this.appStartProperty, currentClient);
      }

      if (this.appCompleteProperty) {
        var currentCompleteValuesAppComplete = this.profile.getValues(this.appCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppComplete, currentClient);
        this.profile.setValues(this.appCompleteProperty, currentCompleteValuesAppComplete);
      }

      if (this.appPendingProperty) {
        var currentPendingValuesAppComplete = this.profile.getValues(this.appPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppComplete, currentClient);
        this.profile.setValues(this.appPendingProperty, currentPendingValuesAppComplete);
      }

      if (this.appDeclinedProperty) {
        var currentDeclinedValuesAppComplete = this.profile.getValues(this.appDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppComplete, currentClient);
        this.profile.setValues(this.appDeclinedProperty, currentDeclinedValuesAppComplete);
      }

      if (this.appFraudProperty) {
        var currentAppFraudPropertyValues = this.profile.getValues(this.appFraudProperty);
        this._removeItemFromArray(currentAppFraudPropertyValues, currentClient);
        this.profile.setValues(this.appFraudProperty, currentAppFraudPropertyValues);
      }

      if (this.appErrorProperty) {
        var currentErrorValuesAppComplete = this.profile.getValues(this.appErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppComplete, currentClient);
        this.profile.setValues(this.appErrorProperty, currentErrorValuesAppComplete);
      }
    }

    if (PENDING_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.appPendingProperty) {
        this.profile.addValue(this.appPendingProperty, currentClient);
      }

      if (this.appCompleteProperty) {
        var currentCompleteValuesAppPending = this.profile.getValues(this.appCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppPending, currentClient);
        this.profile.setValues(this.appCompleteProperty, currentCompleteValuesAppPending);
      }

      if (this.appDeclinedProperty) {
        var currentDeclinedValuesPending = this.profile.getValues(this.appDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesPending, currentClient);
        this.profile.setValues(this.appDeclinedProperty, currentDeclinedValuesPending);
      }

      if (this.appErrorProperty) {
        var currentErrorValuesPending = this.profile.getValues(this.appErrorProperty);
        this._removeItemFromArray(currentErrorValuesPending, currentClient);
        this.profile.setValues(this.appErrorProperty, currentErrorValuesPending);
      }

      if (this.appFraudProperty) {
        var currentFraudValuesPending = this.profile.getValues(this.appFraudProperty);
        this._removeItemFromArray(currentFraudValuesPending, currentClient);
        this.profile.setValues(this.appFraudProperty, currentFraudValuesPending);
      }
    }

    if (COMPLETE_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.appCompleteProperty) {
        this.profile.addValue(this.appCompleteProperty, currentClient);
      }

      if (this.appPendingProperty) {
        var currentPendingValuesComplete = this.profile.getValues(this.appPendingProperty);
        this._removeItemFromArray(currentPendingValuesComplete, currentClient);
        this.profile.setValues(this.appPendingProperty, currentPendingValuesComplete);
      }

      if (this.appDeclinedProperty) {
        var currentDeclinedValuesComplete = this.profile.getValues(this.appDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesComplete, currentClient);
        this.profile.setValues(this.appDeclinedProperty, currentDeclinedValuesComplete);
      }

      if (this.appErrorProperty) {
        var currentErrorValuesComplete = this.profile.getValues(this.appErrorProperty);
        this._removeItemFromArray(currentErrorValuesComplete, currentClient);
        this.profile.setValues(this.appErrorProperty, currentErrorValuesComplete);
      }

      if (this.appFraudProperty) {
        var currentFraudValuesComplete = this.profile.getValues(this.appFraudProperty);
        this._removeItemFromArray(currentFraudValuesComplete, currentClient);
        this.profile.setValues(this.appFraudProperty, currentFraudValuesComplete);
      }
    }

    if (DECLINED_PAGE_NAMES.indexOf(currentPageName) > -1 || currentPageName.toLowerCase().indexOf("decline") > -1) {
      if (this.appDeclinedProperty) {
        this.profile.addValue(this.appDeclinedProperty, currentClient);
      }

      if (this.appPendingProperty) {
        var currentPendingValuesAppDeclined = this.profile.getValues(this.appPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppDeclined, currentClient);
        this.profile.setValues(this.appPendingProperty, currentPendingValuesAppDeclined);
      }

      if (this.appCompleteProperty) {
        var currentCompleteValuesAppDeclined = this.profile.getValues(this.appCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppDeclined, currentClient);
        this.profile.setValues(this.appCompleteProperty, currentCompleteValuesAppDeclined);
      }

      if (this.appFraudProperty) {
        var currentFraudValuesAppComplete = this.profile.getValues(this.appFraudProperty);
        this._removeItemFromArray(currentFraudValuesAppComplete, currentClient);
        this.profile.setValues(this.appFraudProperty, currentFraudValuesAppComplete);
      }

      if (this.appErrorProperty) {
        var currentErrorValuesAppDeclined = this.profile.getValues(this.appErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppDeclined, currentClient);
        this.profile.setValues(this.appErrorProperty, currentErrorValuesAppDeclined);
      }
    }

    if (currentPageName.toLowerCase().indexOf("fraud") > -1) {
      if (this.appFraudProperty) {
        this.profile.addValue(this.appFraudProperty, currentClient);
      }

      if (this.appPendingProperty) {
        var currentPendingPropertyValuesAppComplete = this.profile.getValues(this.appPendingProperty);
        this._removeItemFromArray(currentPendingPropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.appPendingProperty, currentPendingPropertyValuesAppComplete);
      }

      if (this.appCompleteProperty) {
        var currentCompletePropertyValuesAppComplete = this.profile.getValues(this.appCompleteProperty);
        this._removeItemFromArray(currentCompletePropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.appCompleteProperty, currentCompletePropertyValuesAppComplete);
      }

      if (this.appDeclinedProperty) {
        var currentDeclinedPropertyValuesAppComplete = this.profile.getValues(this.appDeclinedProperty);
        this._removeItemFromArray(currentDeclinedPropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.appDeclinedProperty, currentDeclinedPropertyValuesAppComplete);
      }

      if (this.appErrorProperty) {
        var currentErrorValuesPrequalDeclined = this.profile.getValues(this.appErrorProperty);
        this._removeItemFromArray(currentErrorValuesPrequalDeclined, currentClient);
        this.profile.setValues(this.appErrorProperty, currentErrorValuesPrequalDeclined);
      }
    }

    if (currentPageName.toLowerCase().indexOf("error") > -1) {
      if (this.appErrorProperty) {
        this.profile.addValue(this.appErrorProperty, currentClient);
      }

      if (this.appPendingProperty) {
        var currentPendingValuesAppError = this.profile.getValues(this.appPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppError, currentClient);
        this.profile.setValues(this.appPendingProperty, currentPendingValuesAppError);
      }

      if (this.appCompleteProperty) {
        var currentCompleteValuesAppError = this.profile.getValues(this.appCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppError, currentClient);
        this.profile.setValues(this.appCompleteProperty, currentCompleteValuesAppError);
      }

      if (this.appFraudProperty) {
        var currentFraudValuesAppError = this.profile.getValues(this.appFraudProperty);
        this._removeItemFromArray(currentFraudValuesAppError, currentClient);
        this.profile.setValues(this.appFraudProperty, currentFraudValuesAppError);
      }

      if (this.appDeclinedProperty) {
        var currentDeclinedValuesAppError = this.profile.getValues(this.appDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppError, currentClient);
        this.profile.setValues(this.appDeclinedProperty, currentDeclinedValuesAppError);
      }
    }
  },

  /*
   * Handle the prequal apply flow
   */
  // eslint-disable-next-line complexity, max-statements
  _handlePrequal: function(currentClient, currentPageName) {
    if (PREQUAL_START_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.prequalAppStartProperty) {
        this.profile.addValue(this.prequalAppStartProperty, currentClient);
      }

      if (this.prequalAppCompleteProperty) {
        var currentCompleteValuesAppComplete = this.profile.getValues(this.prequalAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppComplete, currentClient);
        this.profile.setValues(this.prequalAppCompleteProperty, currentCompleteValuesAppComplete);
      }

      if (this.prequalAppDeclinedProperty) {
        var currentDeclinedValuesAppComplete = this.profile.getValues(this.prequalAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppComplete, currentClient);
        this.profile.setValues(this.prequalAppDeclinedProperty, currentDeclinedValuesAppComplete);
      }

      if (this.prequalAppErrorProperty) {
        var currentErrorValuesAppComplete = this.profile.getValues(this.prequalAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppComplete, currentClient);
        this.profile.setValues(this.prequalAppErrorProperty, currentErrorValuesAppComplete);
      }
    }

    if (COMPLETE_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.prequalAppCompleteProperty) {
        this.profile.addValue(this.prequalAppCompleteProperty, currentClient);
      }

      if (this.prequalAppDeclinedProperty) {
        var currentDeclinedValuesComplete = this.profile.getValues(this.prequalAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesComplete, currentClient);
        this.profile.setValues(this.prequalAppDeclinedProperty, currentDeclinedValuesComplete);
      }

      if (this.prequalAppErrorProperty) {
        var currentErrorValuesComplete = this.profile.getValues(this.prequalAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesComplete, currentClient);
        this.profile.setValues(this.prequalAppErrorProperty, currentErrorValuesComplete);
      }
    }

    if (
      PREQUAL_DECLINED_PAGE_NAMES.indexOf(currentPageName) > -1 ||
      currentPageName.toLowerCase().indexOf("decline") > -1
    ) {
      if (this.prequalAppDeclinedProperty) {
        this.profile.addValue(this.prequalAppDeclinedProperty, currentClient);
      }

      if (this.prequalAppCompleteProperty) {
        var currentCompleteValuesAppDeclined = this.profile.getValues(this.prequalAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppDeclined, currentClient);
        this.profile.setValues(this.prequalAppCompleteProperty, currentCompleteValuesAppDeclined);
      }

      if (this.prequalAppErrorProperty) {
        var currentErrorValuesAppDeclined = this.profile.getValues(this.prequalAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppDeclined, currentClient);
        this.profile.setValues(this.prequalAppErrorProperty, currentErrorValuesAppDeclined);
      }
    }

    if (currentPageName.toLowerCase().indexOf("error") > -1) {
      if (this.prequalAppErrorProperty) {
        this.profile.addValue(this.prequalAppErrorProperty, currentClient);
      }

      if (this.prequalAppCompleteProperty) {
        var currentCompleteValuesAppError = this.profile.getValues(this.prequalAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppError, currentClient);
        this.profile.setValues(this.prequalAppCompleteProperty, currentCompleteValuesAppError);
      }

      if (this.prequalAppDeclinedProperty) {
        var currentDeclinedValuesAppError = this.profile.getValues(this.prequalAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppError, currentClient);
        this.profile.setValues(this.prequalAppDeclinedProperty, currentDeclinedValuesAppError);
      }
    }
  },

  /*
   * Handle the prequal secured installment apply flow
   */
  // eslint-disable-next-line complexity, max-statements
  _handlePrequalSecuredInstallment: function(currentClient, currentPageName) {
    if (PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.prequalSecuredInstallmentAppStartProperty) {
        this.profile.addValue(this.prequalSecuredInstallmentAppStartProperty, currentClient);
      }

      if (this.prequalSecuredInstallmentAppCompleteProperty) {
        var currentCompleteValuesAppComplete = this.profile.getValues(
          this.prequalSecuredInstallmentAppCompleteProperty
        );
        this._removeItemFromArray(currentCompleteValuesAppComplete, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty, currentCompleteValuesAppComplete);
      }

      if (this.prequalSecuredInstallmentAppDeclinedProperty) {
        var currentDeclinedValuesAppComplete = this.profile.getValues(
          this.prequalSecuredInstallmentAppDeclinedProperty
        );
        this._removeItemFromArray(currentDeclinedValuesAppComplete, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty, currentDeclinedValuesAppComplete);
      }

      if (this.prequalSecuredInstallmentAppFraudProperty) {
        var currentAppFraudPropertyValues = this.profile.getValues(this.prequalSecuredInstallmentAppFraudProperty);
        this._removeItemFromArray(currentAppFraudPropertyValues, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppFraudProperty, currentAppFraudPropertyValues);
      }

      if (this.prequalSecuredInstallmentAppErrorProperty) {
        var currentErrorValuesAppComplete = this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppComplete, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty, currentErrorValuesAppComplete);
      }
    }

    if (PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.prequalSecuredInstallmentAppCompleteProperty) {
        this.profile.addValue(this.prequalSecuredInstallmentAppCompleteProperty, currentClient);
      }

      if (this.prequalSecuredInstallmentAppDeclinedProperty) {
        var currentDeclinedValuesComplete = this.profile.getValues(this.prequalSecuredInstallmentAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesComplete, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty, currentDeclinedValuesComplete);
      }

      if (this.prequalSecuredInstallmentAppErrorProperty) {
        var currentErrorValuesComplete = this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesComplete, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty, currentErrorValuesComplete);
      }
    }

    if (
      PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES.indexOf(currentPageName) > -1 ||
      currentPageName.toLowerCase().indexOf("decline") > -1
    ) {
      if (this.prequalSecuredInstallmentAppDeclinedProperty) {
        this.profile.addValue(this.prequalSecuredInstallmentAppDeclinedProperty, currentClient);
      }

      if (this.prequalSecuredInstallmentAppCompleteProperty) {
        var currentCompleteValuesAppDeclined = this.profile.getValues(
          this.prequalSecuredInstallmentAppCompleteProperty
        );
        this._removeItemFromArray(currentCompleteValuesAppDeclined, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty, currentCompleteValuesAppDeclined);
      }

      if (this.prequalSecuredInstallmentAppErrorProperty) {
        var currentErrorValuesAppDeclined = this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppDeclined, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty, currentErrorValuesAppDeclined);
      }
    }

    if (currentPageName.toLowerCase().indexOf("error") > -1) {
      if (this.prequalSecuredInstallmentAppErrorProperty) {
        this.profile.addValue(this.prequalSecuredInstallmentAppErrorProperty, currentClient);
      }

      if (this.prequalSecuredInstallmentAppCompleteProperty) {
        var currentCompleteValuesAppError = this.profile.getValues(this.prequalSecuredInstallmentAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppError, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty, currentCompleteValuesAppError);
      }

      if (this.prequalSecuredInstallmentAppDeclinedProperty) {
        var currentDeclinedValuesAppError = this.profile.getValues(this.prequalSecuredInstallmentAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppError, currentClient);
        this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty, currentDeclinedValuesAppError);
      }
    }
  },

  /*
   * Watch for not interested link click and capture client name
   */
  _prequalNotInterestedListener: function(currentClient) {
    var notInterestedLinks = document.querySelectorAll('a[data-reason="not_interested"]');

    if (notInterestedLinks.length > 0) {
      notInterestedLinks.forEach(
        function(element, index) {
          element.addEventListener(
            "click",
            function() {
              this.profile.addValue(this.prequalNotInterestedProperty, currentClient);
              this.blueConicClient.profile.updateProfile();
            }.bind(this),
            false
          );
        }.bind(this)
      );
    } else {
      this.blueConicClient.position.subscribe('a[data-reason="not_interested"]', this, function() {
        this._prequalNotInterestedListener(currentClient);
      });
    }
  },

  /*
   * Handle the secured installment apply flow
   */
  _handleSecuredInstallment: function(currentClient, currentPageName) {
    if (START_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.securedInstallmentAppStartProperty) {
        this.profile.addValue(this.securedInstallmentAppStartProperty, currentClient);
      }

      if (this.securedInstallmentAppPendingProperty) {
        var currentPendingValuesAppComplete = this.profile.getValues(this.securedInstallmentAppPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppPendingProperty, currentPendingValuesAppComplete);
      }

      if (this.securedInstallmentAppCompleteProperty) {
        var currentCompleteValuesAppComplete = this.profile.getValues(this.securedInstallmentAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppCompleteProperty, currentCompleteValuesAppComplete);
      }

      if (this.securedInstallmentAppDeclinedProperty) {
        var currentDeclinedValuesAppComplete = this.profile.getValues(this.securedInstallmentAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppDeclinedProperty, currentDeclinedValuesAppComplete);
      }

      if (this.securedInstallmentAppFraudProperty) {
        var currentAppFraudPropertyValues = this.profile.getValues(this.securedInstallmentAppFraudProperty);
        this._removeItemFromArray(currentAppFraudPropertyValues, currentClient);
        this.profile.setValues(this.securedInstallmentAppFraudProperty, currentAppFraudPropertyValues);
      }

      if (this.securedInstallmentAppErrorProperty) {
        var currentErrorValuesAppComplete = this.profile.getValues(this.securedInstallmentAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppErrorProperty, currentErrorValuesAppComplete);
      }
    }

    if (currentPageName.toLowerCase().indexOf("pending") > -1) {
      if (this.securedInstallmentAppPendingProperty) {
        this.profile.addValue(this.securedInstallmentAppPendingProperty, currentClient);
      }

      if (this.securedInstallmentAppCompleteProperty) {
        var currentCompleteValuesPending = this.profile.getValues(this.securedInstallmentAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesPending, currentClient);
        this.profile.setValues(this.securedInstallmentAppCompleteProperty, currentCompleteValuesPending);
      }

      if (this.securedInstallmentAppDeclinedProperty) {
        var currentDeclinedValuesPending = this.profile.getValues(this.securedInstallmentAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesPending, currentClient);
        this.profile.setValues(this.securedInstallmentAppDeclinedProperty, currentDeclinedValuesPending);
      }

      if (this.securedInstallmentAppErrorProperty) {
        var currentErrorValuesPending = this.profile.getValues(this.securedInstallmentAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesPending, currentClient);
        this.profile.setValues(this.securedInstallmentAppErrorProperty, currentErrorValuesPending);
      }

      if (this.securedInstallmentAppFraudProperty) {
        var currentFraudValuesPending = this.profile.getValues(this.securedInstallmentAppFraudProperty);
        this._removeItemFromArray(currentFraudValuesPending, currentClient);
        this.profile.setValues(this.securedInstallmentAppFraudProperty, currentFraudValuesPending);
      }
    }

    if (COMPLETE_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.securedInstallmentAppCompleteProperty) {
        this.profile.addValue(this.securedInstallmentAppCompleteProperty, currentClient);
      }

      if (this.securedInstallmentAppPendingProperty) {
        var currentPendingValuesComplete = this.profile.getValues(this.securedInstallmentAppPendingProperty);
        this._removeItemFromArray(currentPendingValuesComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppPendingProperty, currentPendingValuesComplete);
      }

      if (this.securedInstallmentAppDeclinedProperty) {
        var currentDeclinedValuesComplete = this.profile.getValues(this.securedInstallmentAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppDeclinedProperty, currentDeclinedValuesComplete);
      }

      if (this.securedInstallmentAppErrorProperty) {
        var currentErrorValuesComplete = this.profile.getValues(this.securedInstallmentAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppErrorProperty, currentErrorValuesComplete);
      }

      if (this.securedInstallmentAppFraudProperty) {
        var currentFraudValuesComplete = this.profile.getValues(this.securedInstallmentAppFraudProperty);
        this._removeItemFromArray(currentFraudValuesComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppFraudProperty, currentFraudValuesComplete);
      }
    }

    if (DECLINED_PAGE_NAMES.indexOf(currentPageName) > -1 || currentPageName.toLowerCase().indexOf("decline") > -1) {
      if (this.securedInstallmentAppDeclinedProperty) {
        this.profile.addValue(this.securedInstallmentAppDeclinedProperty, currentClient);
      }

      if (this.securedInstallmentAppPendingProperty) {
        var currentPendingValuesAppDeclined = this.profile.getValues(this.securedInstallmentAppPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppDeclined, currentClient);
        this.profile.setValues(this.securedInstallmentAppPendingProperty, currentPendingValuesAppDeclined);
      }

      if (this.securedInstallmentAppCompleteProperty) {
        var currentCompleteValuesAppDeclined = this.profile.getValues(this.securedInstallmentAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppDeclined, currentClient);
        this.profile.setValues(this.securedInstallmentAppCompleteProperty, currentCompleteValuesAppDeclined);
      }

      if (this.securedInstallmentAppFraudProperty) {
        var currentFraudValuesAppComplete = this.profile.getValues(this.securedInstallmentAppFraudProperty);
        this._removeItemFromArray(currentFraudValuesAppComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppFraudProperty, currentFraudValuesAppComplete);
      }

      if (this.securedInstallmentAppErrorProperty) {
        var currentErrorValuesAppDeclined = this.profile.getValues(this.securedInstallmentAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppDeclined, currentClient);
        this.profile.setValues(this.securedInstallmentAppErrorProperty, currentErrorValuesAppDeclined);
      }
    }

    if (currentPageName.toLowerCase().indexOf("fraud") > -1) {
      if (this.securedInstallmentAppFraudProperty) {
        this.profile.addValue(this.securedInstallmentAppFraudProperty, currentClient);
      }

      if (this.securedInstallmentAppPendingProperty) {
        var currentPendingPropertyValuesAppComplete = this.profile.getValues(this.securedInstallmentAppPendingProperty);
        this._removeItemFromArray(currentPendingPropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppPendingProperty, currentPendingPropertyValuesAppComplete);
      }

      if (this.securedInstallmentAppCompleteProperty) {
        var currentCompletePropertyValuesAppComplete = this.profile.getValues(
          this.securedInstallmentAppCompleteProperty
        );
        this._removeItemFromArray(currentCompletePropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppCompleteProperty, currentCompletePropertyValuesAppComplete);
      }

      if (this.securedInstallmentAppDeclinedProperty) {
        var currentDeclinedPropertyValuesAppComplete = this.profile.getValues(
          this.securedInstallmentAppDeclinedProperty
        );
        this._removeItemFromArray(currentDeclinedPropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.securedInstallmentAppDeclinedProperty, currentDeclinedPropertyValuesAppComplete);
      }

      if (this.securedInstallmentAppErrorProperty) {
        var currentErrorValuesPrequalDeclined = this.profile.getValues(this.securedInstallmentAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesPrequalDeclined, currentClient);
        this.profile.setValues(this.securedInstallmentAppErrorProperty, currentErrorValuesPrequalDeclined);
      }
    }

    if (currentPageName.toLowerCase().indexOf("error") > -1) {
      if (this.securedInstallmentAppErrorProperty) {
        this.profile.addValue(this.securedInstallmentAppErrorProperty, currentClient);
      }

      if (this.securedInstallmentAppPendingProperty) {
        var currentPendingValuesAppError = this.profile.getValues(this.securedInstallmentAppPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppError, currentClient);
        this.profile.setValues(this.securedInstallmentAppPendingProperty, currentPendingValuesAppError);
      }

      if (this.securedInstallmentAppCompleteProperty) {
        var currentCompleteValuesAppError = this.profile.getValues(this.securedInstallmentAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppError, currentClient);
        this.profile.setValues(this.securedInstallmentAppCompleteProperty, currentCompleteValuesAppError);
      }

      if (this.securedInstallmentAppFraudProperty) {
        var currentFraudValuesAppError = this.profile.getValues(this.securedInstallmentAppFraudProperty);
        this._removeItemFromArray(currentFraudValuesAppError, currentClient);
        this.profile.setValues(this.securedInstallmentAppFraudProperty, currentFraudValuesAppError);
      }

      if (this.securedInstallmentAppDeclinedProperty) {
        var currentDeclinedValuesAppError = this.profile.getValues(this.securedInstallmentAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppError, currentClient);
        this.profile.setValues(this.securedInstallmentAppDeclinedProperty, currentDeclinedValuesAppError);
      }
    }
  },

  /*
   * Handle the applyloan apply flow
   */
  _handleApplyLoan: function(currentClient, currentPageName) {
    if (START_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.applyLoanAppStartProperty) {
        this.profile.addValue(this.applyLoanAppStartProperty, currentClient);
      }

      if (this.applyLoanAppPendingProperty) {
        var currentPendingValuesAppComplete = this.profile.getValues(this.applyLoanAppPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppComplete, currentClient);
        this.profile.setValues(this.applyLoanAppPendingProperty, currentPendingValuesAppComplete);
      }

      if (this.applyLoanAppCompleteProperty) {
        var currentCompleteValuesAppComplete = this.profile.getValues(this.applyLoanAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppComplete, currentClient);
        this.profile.setValues(this.applyLoanAppCompleteProperty, currentCompleteValuesAppComplete);
      }

      if (this.applyLoanAppDeclinedProperty) {
        var currentDeclinedValuesAppComplete = this.profile.getValues(this.applyLoanAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppComplete, currentClient);
        this.profile.setValues(this.applyLoanAppDeclinedProperty, currentDeclinedValuesAppComplete);
      }

      if (this.applyLoanAppFraudProperty) {
        var currentAppFraudPropertyValues = this.profile.getValues(this.applyLoanAppFraudProperty);
        this._removeItemFromArray(currentAppFraudPropertyValues, currentClient);
        this.profile.setValues(this.applyLoanAppFraudProperty, currentAppFraudPropertyValues);
      }

      if (this.applyLoanAppErrorProperty) {
        var currentErrorValuesAppComplete = this.profile.getValues(this.applyLoanAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppComplete, currentClient);
        this.profile.setValues(this.applyLoanAppErrorProperty, currentErrorValuesAppComplete);
      }
    }

    if (currentPageName.toLowerCase().indexOf("pending") > -1) {
      if (this.applyLoanAppPendingProperty) {
        this.profile.addValue(this.applyLoanAppPendingProperty, currentClient);
      }

      if (this.applyLoanAppCompleteProperty) {
        var currentCompleteValuesPending = this.profile.getValues(this.applyLoanAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesPending, currentClient);
        this.profile.setValues(this.applyLoanAppCompleteProperty, currentCompleteValuesPending);
      }

      if (this.applyLoanAppDeclinedProperty) {
        var currentDeclinedValuesPending = this.profile.getValues(this.applyLoanAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesPending, currentClient);
        this.profile.setValues(this.applyLoanAppDeclinedProperty, currentDeclinedValuesPending);
      }

      if (this.applyLoanAppErrorProperty) {
        var currentErrorValuesPending = this.profile.getValues(this.applyLoanAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesPending, currentClient);
        this.profile.setValues(this.applyLoanAppErrorProperty, currentErrorValuesPending);
      }

      if (this.applyLoanAppFraudProperty) {
        var currentFraudValuesPending = this.profile.getValues(this.applyLoanAppFraudProperty);
        this._removeItemFromArray(currentFraudValuesPending, currentClient);
        this.profile.setValues(this.applyLoanAppFraudProperty, currentFraudValuesPending);
      }
    }

    if (COMPLETE_PAGE_NAMES.indexOf(currentPageName) > -1) {
      if (this.applyLoanAppCompleteProperty) {
        this.profile.addValue(this.applyLoanAppCompleteProperty, currentClient);
      }

      if (this.applyLoanAppPendingProperty) {
        var currentPendingValuesComplete = this.profile.getValues(this.applyLoanAppPendingProperty);
        this._removeItemFromArray(currentPendingValuesComplete, currentClient);
        this.profile.setValues(this.applyLoanAppPendingProperty, currentPendingValuesComplete);
      }

      if (this.applyLoanAppDeclinedProperty) {
        var currentDeclinedValuesComplete = this.profile.getValues(this.applyLoanAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesComplete, currentClient);
        this.profile.setValues(this.applyLoanAppDeclinedProperty, currentDeclinedValuesComplete);
      }

      if (this.applyLoanAppErrorProperty) {
        var currentErrorValuesComplete = this.profile.getValues(this.applyLoanAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesComplete, currentClient);
        this.profile.setValues(this.applyLoanAppErrorProperty, currentErrorValuesComplete);
      }

      if (this.applyLoanAppFraudProperty) {
        var currentFraudValuesComplete = this.profile.getValues(this.applyLoanAppFraudProperty);
        this._removeItemFromArray(currentFraudValuesComplete, currentClient);
        this.profile.setValues(this.applyLoanAppFraudProperty, currentFraudValuesComplete);
      }
    }

    if (DECLINED_PAGE_NAMES.indexOf(currentPageName) > -1 || currentPageName.toLowerCase().indexOf("decline") > -1) {
      if (this.applyLoanAppDeclinedProperty) {
        this.profile.addValue(this.applyLoanAppDeclinedProperty, currentClient);
      }

      if (this.applyLoanAppPendingProperty) {
        var currentPendingValuesAppDeclined = this.profile.getValues(this.applyLoanAppPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppDeclined, currentClient);
        this.profile.setValues(this.applyLoanAppPendingProperty, currentPendingValuesAppDeclined);
      }

      if (this.applyLoanAppCompleteProperty) {
        var currentCompleteValuesAppDeclined = this.profile.getValues(this.applyLoanAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppDeclined, currentClient);
        this.profile.setValues(this.applyLoanAppCompleteProperty, currentCompleteValuesAppDeclined);
      }

      if (this.applyLoanAppFraudProperty) {
        var currentFraudValuesAppComplete = this.profile.getValues(this.applyLoanAppFraudProperty);
        this._removeItemFromArray(currentFraudValuesAppComplete, currentClient);
        this.profile.setValues(this.applyLoanAppFraudProperty, currentFraudValuesAppComplete);
      }

      if (this.applyLoanAppErrorProperty) {
        var currentErrorValuesAppDeclined = this.profile.getValues(this.applyLoanAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesAppDeclined, currentClient);
        this.profile.setValues(this.applyLoanAppErrorProperty, currentErrorValuesAppDeclined);
      }
    }

    if (currentPageName.toLowerCase().indexOf("fraud") > -1) {
      if (this.applyLoanAppFraudProperty) {
        this.profile.addValue(this.applyLoanAppFraudProperty, currentClient);
      }

      if (this.applyLoanAppPendingProperty) {
        var currentPendingPropertyValuesAppComplete = this.profile.getValues(this.applyLoanAppPendingProperty);
        this._removeItemFromArray(currentPendingPropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.applyLoanAppPendingProperty, currentPendingPropertyValuesAppComplete);
      }

      if (this.applyLoanAppCompleteProperty) {
        var currentCompletePropertyValuesAppComplete = this.profile.getValues(this.applyLoanAppCompleteProperty);
        this._removeItemFromArray(currentCompletePropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.applyLoanAppCompleteProperty, currentCompletePropertyValuesAppComplete);
      }

      if (this.applyLoanAppDeclinedProperty) {
        var currentDeclinedPropertyValuesAppComplete = this.profile.getValues(this.applyLoanAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedPropertyValuesAppComplete, currentClient);
        this.profile.setValues(this.applyLoanAppDeclinedProperty, currentDeclinedPropertyValuesAppComplete);
      }

      if (this.applyLoanAppErrorProperty) {
        var currentErrorValuesPrequalDeclined = this.profile.getValues(this.applyLoanAppErrorProperty);
        this._removeItemFromArray(currentErrorValuesPrequalDeclined, currentClient);
        this.profile.setValues(this.applyLoanAppErrorProperty, currentErrorValuesPrequalDeclined);
      }
    }

    if (currentPageName.toLowerCase().indexOf("error") > -1) {
      if (this.applyLoanAppErrorProperty) {
        this.profile.addValue(this.applyLoanAppErrorProperty, currentClient);
      }

      if (this.applyLoanAppPendingProperty) {
        var currentPendingValuesAppError = this.profile.getValues(this.applyLoanAppPendingProperty);
        this._removeItemFromArray(currentPendingValuesAppError, currentClient);
        this.profile.setValues(this.applyLoanAppPendingProperty, currentPendingValuesAppError);
      }

      if (this.applyLoanAppCompleteProperty) {
        var currentCompleteValuesAppError = this.profile.getValues(this.applyLoanAppCompleteProperty);
        this._removeItemFromArray(currentCompleteValuesAppError, currentClient);
        this.profile.setValues(this.applyLoanAppCompleteProperty, currentCompleteValuesAppError);
      }

      if (this.applyLoanAppFraudProperty) {
        var currentFraudValuesAppError = this.profile.getValues(this.applyLoanAppFraudProperty);
        this._removeItemFromArray(currentFraudValuesAppError, currentClient);
        this.profile.setValues(this.applyLoanAppFraudProperty, currentFraudValuesAppError);
      }

      if (this.applyLoanAppDeclinedProperty) {
        var currentDeclinedValuesAppError = this.profile.getValues(this.applyLoanAppDeclinedProperty);
        this._removeItemFromArray(currentDeclinedValuesAppError, currentClient);
        this.profile.setValues(this.applyLoanAppDeclinedProperty, currentDeclinedValuesAppError);
      }
    }
  },

  /*
   * Creates a profile key based on the current timestamp
   */
  _generateProfileKey: function(email) {
    if (!email) {
      return null;
    }
    try {
      return md5(new Date().getTime().toString() + "_" + email.toLowerCase()).substring(6, 26);
    } catch (e) {
      return null;
    }
  },

  _captureVehicleAttr: function(currentClient, currentPageKind) {
    var submitButton = document.querySelector('button[data-reason="residence"]') || null;

    if (submitButton !== null) {
      submitButton.addEventListener(
        "click",
        function() {
          var vehicleTypeElement = document.querySelector("#native-select-vehicleType-native");
          var vehicleType = vehicleTypeElement
            ? vehicleTypeElement.options[vehicleTypeElement.selectedIndex].text
            : null;
          var vehicleMakeElement = document.querySelector("#native-select-manufacturerOptions-native");
          var vehicleMake = vehicleMakeElement
            ? vehicleMakeElement.options[vehicleMakeElement.selectedIndex].text
            : null;
          var vehicleYearElement = document.querySelector("#native-select-modelYear-native");
          var vehicleYear = vehicleYearElement
            ? vehicleYearElement.options[vehicleYearElement.selectedIndex].text
            : null;
          var vehicleModelElement = document.querySelector("#native-select-modelDesc-native");
          var vehicleModel = vehicleModelElement
            ? vehicleModelElement.options[vehicleModelElement.selectedIndex].text
            : null;

          this.profile.setValue(
            VEHICHLE_INFO_INTERNAL_PROPERTY,
            JSON.stringify({
              currentClient: currentClient,
              currentPageKind: currentPageKind,
              vehicleType: vehicleType,
              vehicleMake: vehicleMake,
              vehicleYear: vehicleYear,
              vehicleModel: vehicleModel
            })
          );

          this.blueConicClient.profile.updateProfile();
        }.bind(this)
      );
    } else {
      this.blueConicClient.position.subscribe('button[data-reason="residence"]', this, function() {
        this._captureVehicleAttr(currentClient, currentPageKind);
      });
    }
  },

  // eslint-disable-next-line complexity, max-statements
  _addVehicleAttr: function(currentClient, currentPageKind, eventPayLoad) {
    var vehicleInfo = this.profile.getValue(VEHICHLE_INFO_INTERNAL_PROPERTY);

    if (vehicleInfo) {
      try {
        var vehicleObj = JSON.parse(vehicleInfo);
        if (currentClient === vehicleObj.currentClient && currentPageKind === vehicleObj.currentPageKind) {
          if (vehicleObj.vehicleType) {
            eventPayLoad[VEHICLE_TYPE_ATTR] = vehicleObj.vehicleType;
          }
          if (vehicleObj.vehicleYear) {
            eventPayLoad[VEHICLE_YEAR_ATTR] = vehicleObj.vehicleYear;
          }
          if (vehicleObj.vehicleMake) {
            eventPayLoad[VEHICLE_MAKE_ATTR] = vehicleObj.vehicleMake;
          }
          if (vehicleObj.vehicleModel) {
            eventPayLoad[VEHICLE_MODEL_ATTR] = vehicleObj.vehicleModel;
          }
        }
      } catch (e) {
        // error parsing PII
      }
    }
  },

  _capturePiiChanges: function(currentClient, currentPageKind) {
    var submitButton = document.querySelector('button[data-test="save1-button"]')
      ? document.querySelector('button[data-test="save1-button"]')
      : null;

    if (submitButton !== null) {
      submitButton.addEventListener(
        "click",
        // eslint-disable-next-line complexity
        function() {
          var firstName = document.querySelector("#firstName-primary")
            ? document.querySelector("#firstName-primary").value
            : null;
          var lastName = document.querySelector("#lastName-primary")
            ? document.querySelector("#lastName-primary").value
            : null;

          var email = document.querySelector("#emailAddress-primary")
            ? document.querySelector("#emailAddress-primary").value
            : null;
          var dummyProfileKey = null;

          var isBadEmail = null;
          if (email) {
            if (currentPageKind === PAGE_KIND_PREQUAL_SECURED_INSTALLMENT) {
              dummyProfileKey = this._generateProfileKey(email);
            }
            // validate the email
            isBadEmail = this._validateEmail(email);
            if (this.emailProperty) {
              this.profile.setValue(this.emailProperty, email);
            }
          }

          this.profile.setValue(
            PII_INTERNAL_PROPERY,
            JSON.stringify({
              firstName: firstName,
              lastName: lastName,
              email: email,
              currentClient: currentClient,
              currentPageKind: currentPageKind,
              isBadEmail: isBadEmail,
              dummyProfileKey: dummyProfileKey
            })
          );

          this.blueConicClient.profile.updateProfile();
        }.bind(this)
      );
    } else {
      // button not available yet, subscribe to the position
      this.blueConicClient.position.subscribe('button[data-test="save1-button"]', this, function() {
        this._capturePiiChanges(currentClient, currentPageKind);
      });
    }
  },

  /*
   * Capture PII for the current client/page name
   */
  _capturePII: function(currentClient, currentPageKind, currentPageFunction, currentPageSubFunction) {
    // capture the PII by adding a click binding on the submit button
    submitButton = document.querySelector('button[data-reason="productinfo"]')
      ? document.querySelector('button[data-reason="productinfo"]')
      : document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]')
      ? document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]')
      : document.querySelector('button[data-reason="Productinfo"]')
      ? document.querySelector('button[data-reason="Productinfo"]')
      : document.querySelector('button[title="NEXT: VEHICLE INFO"]')
      ? document.querySelector('button[title="NEXT: VEHICLE INFO"]')
      : document.querySelector("button#submitButton")
      ? document.querySelector("button#submitButton")
      : null;

    if (submitButton !== null) {
      submitButton.addEventListener(
        "click",
        // eslint-disable-next-line complexity, max-statements
        function() {
          var firstName = document.querySelector("#firstName") ? document.querySelector("#firstName").value : null;
          var lastName = document.querySelector("#lastName") ? document.querySelector("#lastName").value : null;

          if (
            (!firstName && !lastName && document.querySelector("#fullName")) ||
            (!firstName &&
              !lastName &&
              document.querySelector(
                "#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm"
              ))
          ) {
            var fullName = document.querySelector("#fullName")
              ? document.querySelector("#fullName").innerText
              : document.querySelector(
                  "#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm"
                )
              ? document.querySelector(
                  "#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm"
                ).innerText
              : null;

            if (fullName) {
              firstName = fullName.indexOf(" ") !== -1 ? fullName.substring(0, fullName.indexOf(" ")) : fullName;

              lastName = fullName.indexOf(" ") !== -1 ? fullName.substring(fullName.indexOf(" ") + 1) : null;
            }
          }

          if (!firstName && !lastName) {
            firstName = document.querySelector('div.prefill-details label[for="firstName"]')
              ? document.querySelector('div.prefill-details label[for="firstName"]').innerText
              : null;
            firstName = firstName ? firstName.replace(/\s$/g, "") : null;

            lastName = document.querySelector('div.prefill-details label[for="lastName"]')
              ? document.querySelector('div.prefill-details label[for="lastName"]').innerText
              : null;
            lastName = lastName ? lastName.replace(/\s$/g, "") : null;
          }

          var email = document.querySelector("#confirmEmailAddress")
            ? document.querySelector("#confirmEmailAddress").value
            : document.querySelector("#confirmEmailCheck")
            ? document.querySelector("#confirmEmailCheck").value
            : null;
          var dummyProfileKey = null;
          var isBadEmail = null;
          if (email) {
            dummyProfileKey = this._generateProfileKey(email);

            // validate the email
            isBadEmail = this._validateEmail(email);
            if (this.emailProperty) {
              this.profile.setValue(this.emailProperty, email);
            }
          }

          var zipCode = document.querySelector("#applyVTO_applicantVO_zip_id")
            ? document.querySelector("#applyVTO_applicantVO_zip_id").value
            : document.querySelector("#zipCode-primary")
            ? document.querySelector("#zipCode-primary").value
            : null;

          if (!zipCode) {
            var address = document.querySelector("#address")
              ? document.querySelector("#address").innerText
              : document.querySelector(
                  "#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(2) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm"
                )
              ? document.querySelector(
                  "#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(2) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm"
                ).innerText
              : null;
            if (address) {
              zipCode = address.substring(address.lastIndexOf(", ") + 2);
            }
          }

          this.profile.setValue(
            PII_INTERNAL_PROPERY,
            JSON.stringify({
              firstName: firstName,
              lastName: lastName,
              email: email,
              currentClient: currentClient,
              currentPageKind: currentPageKind,
              isBadEmail: isBadEmail,
              dummyProfileKey: dummyProfileKey,
              zipCode: zipCode,
              prefill:
                currentPageFunction === "payfone" &&
                (currentPageSubFunction === "prefilled" || currentPageSubFunction === "no_user_data_in_payfone")
              /*prefill: currentPageFunction === "payfone" && currentPageSubFunction === "prefilled"*/
              /*prefill: currentPageFunction === "payfone" && currentPageSubFunction === "no_user_data_in_payfone"*/
            })
          );

          this.blueConicClient.profile.updateProfile();
        }.bind(this)
      );
    } else {
      // button not available yet, subscribe to the position
      this.blueConicClient.position.subscribe("button#submitButton", this, function() {
        this._capturePII(currentClient, currentPageKind, currentPageFunction, currentPageSubFunction);
      });
      this.blueConicClient.position.subscribe('button[data-reason="productinfo"]', this, function() {
        this._capturePII(currentClient, currentPageKind, currentPageFunction, currentPageSubFunction);
      });
      this.blueConicClient.position.subscribe('button[data-reason="Productinfo"]', this, function() {
        this._capturePII(currentClient, currentPageKind, currentPageFunction, currentPageSubFunction);
      });
      this.blueConicClient.position.subscribe('button[data-reason="NEXT: VEHICLE INFO"]', this, function() {
        this._capturePII(currentClient, currentPageKind, currentPageFunction, currentPageSubFunction);
      });
      this.blueConicClient.position.subscribe('button[title="NEXT: VEHICLE INFO"]', this, function() {
        this._capturePII(currentClient, currentPageKind, currentPageFunction, currentPageSubFunction);
      });
    }
  },

  /*
   * Append the PII to the event payload when the client and page kind match
   */
  _addPII: function(currentClient, currentPageKind, eventPayLoad) {
    var pii = this.profile.getValue(PII_INTERNAL_PROPERY);
    if (pii) {
      try {
        var piiObj = JSON.parse(pii);
        if (currentClient === piiObj.currentClient && currentPageKind === piiObj.currentPageKind) {
          eventPayLoad[FIRST_NAME_ATTR] = piiObj.firstName;
          eventPayLoad[LAST_NAME_ATTR] = piiObj.lastName;
          if (piiObj.email) {
            eventPayLoad[EMAIL_ADDRESS_ATTR] = piiObj.email;
            eventPayLoad[IS_BAD_EMAIL_ATTR] = piiObj.isBadEmail ? piiObj.isBadEmail : this._validateEmail(piiObj.email);
          }
          if (piiObj.dummyProfileKey) {
            eventPayLoad[DUMMY_PROFILE_KEY_ATTR] = piiObj.dummyProfileKey;
          }
          eventPayLoad[PREFILL_ATTR] = piiObj.prefill;
          if (piiObj.zipCode) {
            eventPayLoad[ZIP_CODE_ATTR] = piiObj.zipCode;
          }
        }
      } catch (e) {
        // error parsing PII
      }
    }
  },

  /*
   * Flag bad email addresses
   */
  _validateEmail: function(email) {
    var isBadEmail = false;

    // Email address
    // - Minimum length 5
    // - Has to contain exactly 1 "@"
    if (
      email.length < 5 ||
      email.match(/@/g) === null ||
      email.match(/@/g).length !== 1 ||
      email.match(/\s/g) !== null
    ) {
      isBadEmail = true;
    }

    // Email domain
    // - Has to contain one dot
    // - Can not contain a comma
    var emailDomain = email.split("@")[1];
    if (
      emailDomain.match(/\./g) === null ||
      emailDomain.match(/\./g).length !== 1 ||
      emailDomain.match(/,/g) !== null
    ) {
      isBadEmail = true;
    }

    // Email address can not start with a special character
    var firstChar = email.substr(0, 1);
    if (
      ["@", ".", ",", " ", "/", "\\", "!", "#", "$", "%", "^", "&", "*", "(", ")", "+", "-", "~"].indexOf(firstChar) >
      -1
    ) {
      isBadEmail = true;
    }

    // TLD has to match list of allowed TLD's
    var tld = email.substring(email.lastIndexOf(".") + 1);
    if (["COM", "NET", "EDU", "ORG", "MIL", "GOV", "US", "BIZ"].indexOf(tld.toUpperCase()) === -1) {
      isBadEmail = true;
    }

    return isBadEmail;
  },

  _indexOf: function(array, value) {
    if (!Array.isArray(array)) {
      return -1;
    }
    return array.indexOf(value);
  },

  _removeItemFromArray: function(array, item) {
    if (!Array.isArray(array)) {
      return;
    }

    var index;
    while ((index = this._indexOf(array, item)) !== -1) {
      array.splice(index, 1);
    }
  },

  _encodeCookieValue: function(value) {
    if (typeof value !== "string") {
      value = JSON.stringify(value);
    }
    return encodeURIComponent(value.replace(/[\n\r]/g, ""));
  },

  _decodeCookieValue: function(value) {
    return decodeURIComponent(value);
  },

  _setCookie: function(name, value, expire) {
    if (!expire) {
      document.cookie = name + "=" + this._encodeCookieValue(value) + "; path=/; SameSite=None; Secure";
    } else {
      var expires = new Date();
      var expireMills = expire * MINUTES_TO_MILLS;

      expires.setTime(expires.getTime() + expireMills);

      document.cookie =
        name +
        "=" +
        this._encodeCookieValue(value) +
        (expire == null ? "" : "; expires=" + expires.toUTCString()) +
        "; path=/; SameSite=None; Secure";
    }
  },

  _getCookie: function(name) {
    var search = name + "=";
    var val = "";
    var offset, end;

    if (document.cookie.length > 0) {
      // if there are any cookies
      offset = document.cookie.indexOf(search);

      if (offset !== -1) {
        // if cookie exists
        offset += search.length;

        // set index of beginning of value
        end = document.cookie.indexOf(";", offset);

        // set index of end of cookie value
        if (end === -1) {
          end = document.cookie.length;
        }

        val = this._decodeCookieValue(document.cookie.substring(offset, end));
      }
    }

    return val;
  },

  _checkSessionStorageSupport: function() {
    var mod = "__storageTest";
    try {
      window.sessionStorage.setItem(mod, mod);
      window.sessionStorage.removeItem(mod);
      return true;
    } catch (e) {
      return false;
    }
  },

  _getSessionId: function() {
    return window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME)
      ? window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME)
      : this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME)
      ? this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME)
      : null;
  },

  _getSessionIdTimestamp: function() {
    return window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)
      ? window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)
      : this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)
      ? this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)
      : null;
  },

  _setSessionId: function() {
    var sessionId = this._uuid();

    if (this._checkSessionStorageSupport()) {
      window.sessionStorage.setItem(APPLICATION_SESSION_ID_COOKIE_NAME, sessionId);
      window.sessionStorage.setItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME, this._currentMills);
    }
    this._setCookie(APPLICATION_SESSION_ID_COOKIE_NAME, sessionId, null);
    this._setCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME, this._currentMills, null);

    return sessionId;
  },

  _getTimelineCreated: function() {
    var pageData = window.sessionStorage.getItem(this._currentPageKind)
      ? window.sessionStorage.getItem(this._currentPageKind)
      : this._getCookie(this._currentPageKind)
      ? this._getCookie(this._currentPageKind)
      : null;

    if (pageData) {
      return JSON.parse(pageData);
    }
    return null;
  },

  _setTimelineCreated: function() {
    var pageData = {};
    pageData[this._currentPageName] = this._currentMills;

    pageData = JSON.stringify(pageData);

    if (this._checkSessionStorageSupport()) {
      window.sessionStorage.setItem(this._currentPageKind, pageData);
    } else {
      this._setCookie(this._currentPageKind, pageData, null);
    }
  },

  _uuid: function() {
    return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function uuidReplacer(c) {
      // eslint-disable-next-line compat/compat
      return (c ^ (window.crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16);
    });
  }
});

//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlcyI6W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W50TmFtZXMubGVuZ3RoID4gMCAmJiB0aGlzLmNsaWVudE5hbWVzLmluZGV4T2YoY3VycmVudENsaWVudCkgPT09IC0xKSB7XG4gICAgICBjb25zb2xlLmluZm8oXG4gICAgICAgIFwiTGlzdGVuZXIgSUQ6IFwiICtcbiAgICAgICAgICB0aGlzLmNvbnRleHQuZ2V0SW50ZXJhY3Rpb25JZCgpICtcbiAgICAgICAgICBcIiAtLSBDbGllbnQgbmFtZSBtaXNtYXRjaCwgc2tpcHBpbmcuIENsaWVudDogXCIgK1xuICAgICAgICAgIGRhdGFMYXllci5wYWdlSW5mb1tDTElFTlRfTkFNRV9BVFRSXVxuICAgICAgKTtcbiAgICAgIHJldHVybjtcbiAgICB9XG5cbiAgICAvLyBBZGQgVGltZWxpbmUgRXZlbnRcbiAgICB2YXIgY3VycmVudERhdGUgPSBuZXcgRGF0ZSgpO1xuICAgIHZhciBjdXJyZW50TWlsbHMgPSBjdXJyZW50RGF0ZS5nZXRUaW1lKCk7XG4gICAgdGhpcy5fY3VycmVudE1pbGxzID0gY3VycmVudE1pbGxzO1xuICAgIHZhciBldmVudFBheUxvYWQgPSB7fTtcblxuICAgIC8vIE1hcmtldGluZyBzcGVjaWZpYyBhdHRyaWJ1dGVzXG4gICAgaWYgKHRoaXMudGltZWxpbmVFdmVudFR5cGUgPT09IE1BUktFVElOR19FVCkge1xuICAgICAgZm9yIChpID0gMDsgaSA8IE1BUktFVElOR19BVFRSUy5sZW5ndGg7IGkrKykge1xuICAgICAgICBpZiAoZGF0YUxheWVyLnBhZ2VJbmZvW01BUktFVElOR19BVFRSU1tpXV0pIHtcbiAgICAgICAgICBldmVudFBheUxvYWRbTUFSS0VUSU5HX0FUVFJTW2ldXSA9IGRhdGFMYXllci5wYWdlSW5mb1tNQVJLRVRJTkdfQVRUUlNbaV1dO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgLy8gQXBwbGljYXRpb24gc3BlY2lmaWMgYXR0cmlidXRlc1xu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B9XG4gICAgICAgICAgICAvLyB2YWxpZGF0ZSB0aGUgZW1haWxcbiAgICAgICAgICAgIGlzQmFkRW1haWwgPSB0aGlzLl92YWxpZGF0ZUVtYWlsKGVtYWlsKTtcbiAgICAgICAgICAgIGlmICh0aGlzLmVtYWlsUHJvcGVydHkpIHtcbiAgICAgICAgICAgICAgdGhpcy5wcm9maWxlLnNldFZhbHVlKHRoaXMuZW1haWxQcm9wZXJ0eSwgZW1haWwpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIHRoaXMucHJvZmlsZS5zZXRWYWx1ZShcbiAgICAgICAgICAgIFBJSV9JTlRFUk5BTF9QUk9QRVJZLFxuICAgICAgICAgICAgSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgICAgICAgICBmaXJzdE5hbWU6IGZpcnN0TmFtZSxcbiAgICAgICAgICAgICAgbGFzdE5hbWU6IGxhc3ROYW1lLFxuICAgICAgICAgICAgICBlbWFpbDogZW1haWwsXG4gICAgICAgICAgICAgIGN1cnJlbnRDbGllbnQ6IGN1cnJlbnRDbGllbnQsXG4gICAgICAgICAgICAgIGN1cnJlbnRQYWdlS2luZDogY3VycmVudFBhZ2VLaW5kLFxuICAgICAgICAgICAgICBpc0JhZEVtYWlsOiBpc0JhZEVtYWlsLFxuICAgICAgICAgICAgICBkdW1teVByb2ZpbGVLZXk6IGR1bW15UHJvZmlsZUtleVxuICAgICAgICAgICAgfSlcbiAgICAgICAgICApO1xuXG4gICAgICAgICAgdGhpcy5ibHVlQ29uaWNDbGllbnQucHJvZmlsZS51cGRhdGVQcm9maWxlKCk7XG4gICAgICAgIH0uYmluZCh0aGlzKVxuICAgICAgKTtcbiAgICB9IGVsc2Uge1xuICAgICAgLy8gYnV0dG9uIG5vdCBhdmFpbGFibGUgeWV0LCBzdWJzY3JpYmUgdG8gdGhlIHBvc2l0aW9uXG4gICAgICB0aGlzLmJsdWVDb25pY0NsaWVudC5wb3NpdGlvbi5zdWJzY3JpYm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Gxhc3ROYW1lLFxuICAgICAgICAgICAgICBlbWFpbDogZW1haWwsXG4gICAgICAgICAgICAgIGN1cnJlbnRDbGllbnQ6IGN1cnJlbnRDbGllbnQsXG4gICAgICAgICAgICAgIGN1cnJlbnRQYWdlS2luZDogY3VycmVudFBhZ2VLaW5kLFxuICAgICAgICAgICAgICBpc0JhZEVtYWlsOiBpc0JhZEVtYWlsLFxuICAgICAgICAgICAgICBkdW1teVByb2ZpbGVLZXk6IGR1bW15UHJvZmlsZUtleSxcbiAgICAgICAgICAgICAgemlwQ29kZTogemlwQ29kZSxcbiAgICAgICAgICAgICAgcHJlZmlsbDpcbiAgICAgICAgICAgICAgICBjdXJyZW50UGFnZUZ1bmN0aW9uID09PSBcInBheWZvbmVcIiAmJlxuICAgICAgICAgICAgICAgIChjdXJyZW50UGFnZVN1YkZ1bmN0aW9uID09PSBcInByZWZpbGxlZFwiIHx8IGN1cnJlbnRQYWdlU3ViRnVuY3Rpb24gPT09IFwibm9fdXNlcl9kYXRhX2luX3BheWZvbmVcIilcbiAgICAgICAgICAgICAgLypwcmVmaWxsOiBjdXJyZW50UGFnZUZ1bmN0aW9uID09PSBcInBheWZvbmVcIiAmJiBjdXJyZW50UGFnZVN1YkZ1bmN0aW9uID09PSBcInByZWZpbGxlZFwiKi9cbiAgICAgICAgICAgICAgLypwcmVmaWxsOiBjdXJyZW50UGFnZUZ1bmN0aW9uID09PSBcInBheWZvbmVcIiAmJiBjdXJyZW50UGFnZVN1YkZ1bmN0aW9uID09PSBcIm5vX3VzZXJfZGF0YV9pbl9wYXlmb25lXCIqL1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICApO1xuXG4gICAgICAgICAgdGhpcy5ibHVlQ29uaWNDbGllbnQucHJvZmlsZS51cGRhdGVQcm9maWxlKCk7XG4gICAgICAgIH0uYmluZCh0aGlzKVxuICAgICAgKTtcbiAgICB9IGVsc2Uge1xuICAgICAgLy8gYnV0dG9uIG5vdCBhdmFpbGFibGUgeWV0LCBzd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SA9IHt9O1xuICAgIHBhZ2VEYXRhW3RoaXMuX2N1cnJlbnRQYWdlTmFtZV0gPSB0aGlzLl9jdXJyZW50TWlsbHM7XG5cbiAgICBwYWdlRGF0YSA9IEpTT04uc3RyaW5naWZ5KHBhZ2VEYXRhKTtcblxuICAgIGlmICh0aGlzLl9jaGVja1Nlc3Npb25TdG9yYWdlU3VwcG9ydCgpKSB7XG4gICAgICB3aW5kb3cuc2Vzc2lvblN0b3JhZ2Uuc2V0SXRlbSh0aGlzLl9jdXJyZW50UGFnZUtpbmQsIHBhZ2VEYXRhKTtcbiAgICB9IGVsc2Uge1xuICAgICAgdGhpcy5fc2V0Q29va2llKHRoaXMuX2N1cnJlbnRQYWdlS2luZCwgcGFnZURhdGEsIG51bGwpO1xuICAgIH1cbiAgfSxcblxuICBfdXVpZDogZnVuY3Rpb24oKSB7XG4gICAgcmV0dXJuIFwiMTAwMDAwMDAtMTAwMC00MDAwLTgwMDAtMTAwMDAwMDAwMDAwXCIucmVwbGFjZSgvWzAxOF0vZywgZnVuY3Rpb24gdXVpZFJlcGxhY2VyKGMpIHtcbiAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBjb21wYXQvY29tcGF0XG4gICAgICByZXR1cm4gKGMgXiAod2luZG93LmNyeXB0by5nZXRSYW5kb21WYWx1ZXMobmV3IFVpbnQ4QXJyYXkoMSkpWzBdICYgKDE1ID4+IChjIC8gNCkpKSkudG9TdHJpbmcoMTYpO1xuICAgIH0pO1xuICB9XG59KTtcbiJdLCJmaWxlIjoiZnJvbnRlbmQvc3JjL2xpc3RlbmVyX2RhdGFsYXllcl9zeWYuanMifQ==
;var a = [];var i='listener_datalayer_syf';a.push({url: '/plugins/listener_datalayer_syf/frontend/src/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwareLocalPluginsUrl() + '/plugins/listener_datalayer_syf/ts_3d6673d699b57b1ea2de44fb3ef8d228/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({PARAMETERS:{ENGAGEMENT_PROPERTY:"engagementProperty",ENGAGEMENT_SCORE_PROPERTY:"engagementScoreProperty",DECAY:"decay",ENGAGEMENT_ON_CHANNEL:"engagementOnChannel"},DEFAULTS:{ENGAGEMENT:"engagement",ENGAGEMENT_SCORE:"engagement_score",VISITS:"visits",CLICKCOUNT:"clickcount"},SCORES:{LOW:"low",MEDIUM:"medium",HIGH:"high"},DEFAULT_DECAY:50,init:function(e,t){this.blueConicClient=e,this.context=t,this.parameters=t.getParameters(),this._channelId=e.getChannelId();var i="true"===this.getParameterValue(this.PARAMETERS.ENGAGEMENT_ON_CHANNEL)&&this._channelId;this.properties={engagement:this.getParameterValue(this.PARAMETERS.ENGAGEMENT_PROPERTY,this.DEFAULTS.ENGAGEMENT),engagementScore:this.getParameterValue(this.PARAMETERS.ENGAGEMENT_SCORE_PROPERTY,this.DEFAULTS.ENGAGEMENT_SCORE),engagementObject:"_"+this.getParameterValue(this.PARAMETERS.ENGAGEMENT_PROPERTY,this.DEFAULTS.ENGAGEMENT),visits:this.DEFAULTS.VISITS+(i?"_"+this._channelId:""),clickcount:this.DEFAULTS.CLICKCOUNT+(i?"_"+this._channelId:"")};var r=new Date(2015,0,1,0,0,0,0),n=(new Date).getTime()-r.getTime();this.days=Math.floor(n/864e5),this.weekNr=Math.floor(this.days/7),this.decay=parseInt(this.getParameterValue(this.PARAMETERS.DECAY))||this.DEFAULT_DECAY},getPreloadProperties:function(){return[this.properties.engagementObject,this.properties.visits,this.properties.clickcount]},onLoad:function(){var e=this.context.getProfile(),t=e.getValue(this.properties.clickcount)?parseInt(e.getValue(this.properties.clickcount)):0,i=e.getValue(this.properties.visits)?parseInt(e.getValue(this.properties.visits)):0,r=e.getValues(this.properties.engagementObject).map(function(e){return this.blueConicClient.json.parse(e)||{}}.bind(this)),n=this._clearInvalidValues(r,i),s=n.cleanedValues,a=this._sumInternalValues(s),h=this._addCurrentWeek(a,t,i),o=this._getCalculated(a,i,t),c=this._calculateScore(o);isNaN(c)||((h||s.length>1||n.removedValues)&&e.setValue(this.properties.engagementObject,JSON.stringify(a)),this._setEngagement(e,c))},getParameterValue:function(e,t){return this.parameters&&this.parameters[e]&&this.parameters[e][0]?this.parameters[e][0]:t},_clearInvalidValues:function(e,t){var i=!1;return e.forEach(function(e){var r=Object.keys(e).filter(function(e){return-1!==e.indexOf("v")}).map(function(e){return parseInt(e.substring(1))});r.sort(function(e,t){return t-e}),r.forEach(function(r){(i||e["v"+r]>t||e["v"+r]<0)&&(delete e["v"+r],delete e["c"+r],i=!0)})},this),{removedValues:i,cleanedValues:e}},_sumInternalValues:function(e){var t={};return e.forEach(function(e){Object.keys(e).forEach(function(i){t[i]=(t[i]||0)+e[i]})}),t},_setEngagement:function(e,t){var i=this.context.getParameters(),r=parseInt(i.lowTreshold?i.lowTreshold[0]:i.lowTreshold),n=parseInt(i.highTreshold?i.highTreshold[0]:i.highTreshold),s=this.SCORES.MEDIUM;t<r?s=this.SCORES.LOW:t>n&&(s=this.SCORES.HIGH),e.setValue(this.properties.engagementScore,t),e.setValue(this.properties.engagement,s),this.blueConicClient.profile.updateProfile()},_addCurrentWeek:function(e,t,i){var r=!1;return e["v"+this.weekNr]||(e["v"+this.weekNr]=i,r=!0),e["c"+this.weekNr]||(e["c"+this.weekNr]=t,r=!0),r},_calculateScore:function(e){for(var t=0,i=0;i<e.length;i++){var r=this._getWeight(i+1,this.decay),n=e[i];t+=(n.clickCount+5*n.visits)*r}return t=Math.floor(t)},_getWeight:function(e,t){return e<=.1*t?1:e<=.2*t?.8:e<=.4*t?.5:e<=t?.3:.1},_getCalculated:function(e,t,i){for(var r=[],n=this.weekNr;n>0;n--){var s=0;e["v"+n]&&(t-=s=Math.max(t-e["v"+n],0));var a=0;e["c"+n]&&(i-=a=Math.max(i-e["c"+n],0)),r.push({week:n,visits:s,clickCount:a})}return r}});var a = [];var i='listener_engagement';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.1.0/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(n,t){this.blueConicClient=n,this.context=t},getPreloadProperties:function(){return[]},onLoad:function(){}});var a = [];var i='listener_geolocation';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.1.1/'}]);})();(function(){ var frontendListener={init:function(e,t){this.blueConicClient=e,this.context=t,this.profile=this.context.getProfile(),this.profileId=this.profile.getId(),this.ineractionId=this.context.getInteractionId(),this.parameters=this.context.getParameters(),this.isNewProfile=!1,this._getParameters(),this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,function(){this.onLoad()}),this.blueConicClient.event.subscribe("server_side_profile_ready",this,function(){this.profileId=this.profile.getId(),this.hasServerSideProfile=!0})},_getParameters:function(){this.internalProperty="_LL_"+this.ineractionId,this._setSelectorParameters(),this._setDataLayerParameters(),this._setPageParameters(),this._setProfileParameters()},_setSelectorParameters:function(){this.usernameSelector=this.parameters.usernameSelector?this.parameters.usernameSelector[0]:null,this.submitSelector=this.parameters.submitSelector?this.parameters.submitSelector[0]:null,this.correlationIdKey=this.parameters.correlationIdKey?this.parameters.correlationIdKey[0]:null,this.correlationIdProperty=this.parameters.correlationIdProperty?this.parameters.correlationIdProperty[0]:null},_setDataLayerParameters:function(){this.dataLayerName=this.parameters.dataLayerName?this.parameters.dataLayerName[0]:"_SFDDL"},_setPageParameters:function(){this.loginPageKind=this.parameters.loginPageKind?this.parameters.loginPageKind[0]:null,this.loginPageName=this.parameters.loginPageName?this.parameters.loginPageName:[],this.successPageKind=this.parameters.successPageKind?this.parameters.successPageKind[0]:null,this.successPageName=this.parameters.successPageName?this.parameters.successPageName:[]},_setProfileParameters:function(){this.mergeProperty=this.parameters.mergeProperty?this.parameters.mergeProperty[0]:null,this.latestLoginDateProperty=this.parameters.latestLoginDateProperty?this.parameters.latestLoginDateProperty[0]:null,this.standardizeValues=this.parameters.standardizeValues?this.parameters.standardizeValues[0]:"none",this.algorithm=this.parameters.algorithm?this.parameters.algorithm[0]:"sha256",this.executionMethod=this.parameters.executionMethod?this.parameters.executionMethod[0]:"serverSide"},getPreloadProperties:function(){return[this.internalProperty,this.mergeProperty,this.latestLoginDateProperty,this.correlationIdProperty]},onLoad:function(){if(this.usernameSelector&&this.submitSelector&&this.dataLayerName&&this.loginPageKind&&0!==this.loginPageName.length&&this.successPageKind&&0!==this.successPageName.length&&this.mergeProperty){var e=this,t=0;(function i(){if(window[e.dataLayerName]&&window[e.dataLayerName].pageInfo&&window[e.dataLayerName].pageInfo.pagekind&&window[e.dataLayerName].pageInfo.pagename)e._bindListener();else{if(t>40)return;t++,window.setTimeout(i,250)}}).call(this)}},_bindListener:function(){const e=this._getPageInfo();this._handleCorrelationId(e.correlationId),this._handlePageType(e.pageKind,e.pageName),this.blueConicClient.profile.updateProfile()},_getPageInfo:function(){const e=window[this.dataLayerName],t=e&&e.pageInfo;return{pageKind:t&&t.pagekind?t.pagekind:null,pageName:t&&t.pagename?t.pagename:null,correlationId:this.correlationIdKey&&t&&t[this.correlationIdKey]?t[this.correlationIdKey]:null}},_handleCorrelationId:function(e){e&&this.correlationIdProperty&&this._setCorrelationId(e)},_handlePageType:function(e,t){e===this.loginPageKind&&this.loginPageName.includes(t)&&(this._checkProfileExists(),this._startFormListener()),e===this.successPageKind&&this.successPageName.includes(t)&&this._setMergeProperty()},_checkProfileExists:function(){"serverSide"===this.executionMethod?this.profileId?(this._splitCheck(),this.hasServerSideProfile=!0):this._setServersideProperty():this._splitCheck()},_setServersideProperty:function(){this._setServerSideHashDate()},_setServerSideHashDate:function(){this.isNewProfile=!0,this.profile.setValue("ss_login_profile_create_date",this.blueConicClient.getCurrentDate().getTime()),this.blueConicClient.profile.updateProfile(this,function(){this.blueConicClient.createEvent("server_side_profile_ready",[this.ineractionId])})},_startFormListener:function(){var e=document.querySelector(this.submitSelector)||null;null!==e&&e.addEventListener("click",function(){var e=document.querySelector(this.usernameSelector)?document.querySelector(this.usernameSelector).value:null;e&&(e=this._normalizeValueCasing(e),"serverSide"===this.executionMethod&&void 0!==this.profileId&&e?this._createServerSideHash(e):e&&this._createClientSideHash(e))}.bind(this))},_splitCheck:function(){this._hasValueCheck()},_splitProfile:function(){this.blueConicClient.profile.createProfile(),this.profile=this.blueConicClient.profile.getProfile(),this.profileId=this.profile.getId(),this._setServerSideHashDate()},_hasValueCheck:function(){var e=this,t=this.blueConicClient.getRestEndpoint("listener_login_syf/exists")+"?itemId="+this.ineractionId+"&profileId="+this.profileId,i=new XMLHttpRequest;i.withCredentials=!0,i.addEventListener("load",function(){try{if(200!==this.status)return void e.blueConicClient.util.log("[ERROR] Unexpected response status code from exists endpoint: "+this.status);"true"===i.responseText&&e._splitProfile()}catch(t){e.blueConicClient.util.log("[ERROR] "+t.message)}}),i.open("GET",t),i.send()},_normalizeValueCasing:function(e){try{return e?this.standardizeValues&&"lower"===this.standardizeValues?e.toString().toLowerCase():this.standardizeValues&&"upper"===this.standardizeValues?e.toString().toUpperCase():e:null}catch(t){return e}},_createServerSideHash:function(e){var t=this.blueConicClient.getRestEndpoint("listener_login_syf/hash")+"?itemId="+this.ineractionId+"&profileId="+this.profileId,i=JSON.stringify({value:e}),r=new Blob([i],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(t,r)},_createClientSideHash:function(e){try{"md5"===this.algorithm?this._saveHash(this.md5(e)):"sha1"===this.algorithm?this._saveHash(this.sha1(e)):"sha256"===this.algorithm?this._saveHash(this.sha256(e)):"sha512"===this.algorithm&&this._saveHash(this.sha512(e))}catch(e){this.blueConicClient.util.log("[ERROR] The login listener was unable to create a hash of the captured username vlaue.",e)}},_setCorrelationId:function(e){this.profile.getValue(this.correlationIdProperty)&&e===this.profile.getValue(this.correlationIdProperty)||this.profile.setValue(this.correlationIdProperty,e)},_saveHash:function(e){this.profile.setValue(this.internalProperty,e),this.blueConicClient.profile.updateProfile()},_setMergeProperty:function(){var e=this.profile.getValue(this.internalProperty);e&&(this.mergeProperty&&this.profile.setValue(this.mergeProperty,e),this.internalProperty&&this.profile.setValues(this.internalProperty,[])),this.latestLoginDateProperty&&this.profile.setValue(this.latestLoginDateProperty,Date.now().toString())}};try{var InteractionTypeImpl=InteractionType.extend(frontendListener)}catch(e){try{module.exports=frontendListener}catch(e){}};var a = [];var i='listener_login_syf';a.push({url: '/plugins/listener_login_syf/frontend/src/lib/md5.min.js', sharing: 'local'});a.push({url: '/plugins/listener_login_syf/frontend/src/lib/sha1.min.js', sharing: 'local'});a.push({url: '/plugins/listener_login_syf/frontend/src/lib/sha256.min.js', sharing: 'local'});a.push({url: '/plugins/listener_login_syf/frontend/src/lib/sha512.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwareLocalPluginsUrl() + '/plugins/listener_login_syf/ts_9ae8a663745cb949fc40092097b8e5fb/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(e,t){this.blueConicClient=e,this.context=t;var n=new Date(2017,8,1,0,0,0,0),r=this.blueConicClient.getCurrentDate().getTime()-n.getTime();this.days=Math.floor(r/864e5)},getPreloadProperties:function(){return[]},onLoad:function(){var e=this.context.getProfile(),t=this.context.getParameters(),n=t.property?t.property[0]:t.property;if(n){var r=this.blueConicClient.util.array.ensureArray(t.excludedKeywords),i=this.blueConicClient.json.parse(n)[0].profileproperty,o=[],s=document.getElementsByTagName("meta");if(s)for(var a=!1,l=0,u=s.length;l<u;l++)if("news_keywords"===s[l].name.toLowerCase()&&"string"==typeof s[l].content){var c=s[l].content.split(",");0===c.length||1===c.length&&""===c[0]||(o=c,a=!0)}else a||0!==o.length||"keywords"!==s[l].name.toLowerCase()||"string"!=typeof s[l].content||(o=s[l].content.split(","));if(o.length>0){for(var h={TIME:(new Date).getTime(),days:this.days,points:1,keywords:[]},p=0;p<o.length;p++){var y=this._trim(o[p]);""!==y&&-1===this.blueConicClient.util.array.indexOfArray(r,y)&&h.keywords.push(y)}h.keywords.length>0&&(e.addValue("_hl_"+i,this.blueConicClient.json.stringify(h)),this.blueConicClient.profile.updateProfile())}}},_trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}});var a = [];var i='listener_meta_keywords_ranker';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.2.7/'}]);})();(function(){ var MARKETING_ET="marketing_data_layer",APPLICATION_ET="application_data_layer",APPLICATION_ATTRS=["ClientName","Country_Language","Device","PageFunction","PageKind","PageSubFunction","PNL","Product","Result","SiteIdentifier","Token","URL","DateTimestamp","ACORID","Application_ID","MerchantID","PageName","PageSubFlow","sitecode","ApprovalCode","CreditLimit"],MARKETING_ATTRS=["ClientName","Country_Language","Device","PageFunction","PageKind","PageSubFunction","PNL","Product","Result","SiteIdentifier","Token","URL","DateTimestamp","PageName","offerIds"],CLIENT_NAME_ATTR="ClientName",PAGE_KIND_ATTR="PageKind",PAGE_KIND_PREQUAL="prequal",PAGE_KIND_APPLY="apply",PAGE_KIND_SECURED_INSTALLMENT="secured_installment",PAGE_KIND_PREQUAL_SECURED_INSTALLMENT="prequal_secured_installment",PAGE_KIND_APPLY_LOAN="applyloan",PAGE_KIND_OFFER_PERSIST="offerPersist",ACTION_ATTR="action",APP_TYPE_ATTR="appType",DATE_STAMP_ATTR="DateTimestamp",URL_ATTR="URL",PAGE_NAME_ATTR="PageName",PAGE_FUNCTION_ATTR="PageFunction",PAGE_SUB_FUNCTION_ATTR="PageSubFunction",DSA_TOKEN_ATTR="dsaToken",CREDIT_LIMIT_ATTR="CreditLimit",OFFER_EXPIRATION_DATE_ATTR="OfferExpirationDate",CLIENT_MID_ATTR="ClientMID",REASON_CODE_ATTR="ReasonCode",RESPONSE_CODE_ATTR="ResponseCode",APPROVAL_CODE_ATTR="ApprovalCode",OFFER_PERSIST_DL_ATTR=["ABTestname","ACORID","Application_ID","ClientMID","CustomerType","DeclineReason","JSID","Market","MerchantId","OfferExpirationDate","OrgChannel","OrgFlow","PageSubFunction","PrefillType","Program","ReasonCode","ResponseCode","Result","SiteIdentifier","Token","dsaToken","platformToken","promo","sitecode","ApprovalCode","ClientName","Country_Language","CreditLimit","PNL","PageFunction","PageKind","PageName","PageSubFlow","Product"],FIRST_NAME_ATTR="FirstName",LAST_NAME_ATTR="LastName",EMAIL_ADDRESS_ATTR="EmailAddress",IS_BAD_EMAIL_ATTR="IsBadEmail",PREFILL_ATTR="Prefill",APPLICATION_SESSION_ID_ATTR="ApplicationSessionID",DUMMY_PROFILE_KEY_ATTR="DummyProfileKey",ADDRESS1_ATTR="Address1",ADDRESS2_ATTR="Address2",CITY_ATTR="City",STATE_ATTR="State",ZIP_CODE_ATTR="ZipCode",OFFER_EXPIRES_ATTR="OfferExpires",CAL_OFFER_EXPIRES_ATTR="CAL_OfferExpires",VEHICLE_TYPE_ATTR="VehicleType",VEHICLE_MAKE_ATTR="VehicleMake",VEHICLE_YEAR_ATTR="VehicleYear",VEHICLE_MODEL_ATTR="VehicleModel",LANDING_PAGE_NAMES=["auto_fill_invitation"],START_PAGE_NAMES=["prequal_offer","apply options","Termsandconditions","your information"],PREQUAL_START_PAGE_NAMES=["your information"],PREQUAL_DECLINED_PAGE_NAMES=["prequal_offer_declined"],PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES=["your information"],COMPLETE_PAGE_NAMES=["complete approve"],PENDING_PAGE_NAMES=["complete pending"],DECLINED_PAGE_NAMES=["complete decline"],PREQUAL_COMPLETE_PAGE_NAMES=["complete approve","complete pending","complete decline","dApply_start_error"],PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES=["prequal_offer"],PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES=["prequal_offer_declined"],YOUR_INFORMATION_PAGE_NAME="your information",INFORMATION_REVIEW_PAGE_NAME="review",PREQUAL_OFFER_PAGE_NAME="prequal_offer",PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAME="prequal_offer_declined",COMPLETE_PAGE_NAME="complete approve",PENDING_PAGE_NAME="complete pending",DECLINED_PAGE_NAME="complete decline",DAPPLY_START_ERROR_PAGE_NAME="dApply_start_error",VEHICHLE_PAGE_NAME="product info",OFFER_PERSIST_REVIEW_OFFER_PAGE_NAME="review_prequalified_offer",OFFER_PERSIST_ELIGIBILITY_FAILURE_PAGE_NAME="eligibility_failure",PREFILLED_PAGE_SUB_FUNCTION="prefilled",PII_INTERNAL_PROPERY="_dll_pii",VEHICHLE_INFO_INTERNAL_PROPERTY="_vehichle_info",TIME_MILLS_DAY=864e5,MINUTES_TO_MILLS=6e4,APPLICATION_SESSION_ID_COOKIE_NAME="_bcasid",APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME="_bcasid_ts";window._dataLayerListenerEventsCache=window._dataLayerListenerEventsCache||{};var frontendListener={init:function(e,r){this.blueConicClient=e,this.context=r,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.dataLayerName=this.parameters.dataLayerName?this.parameters.dataLayerName[0]:"_SFDDL",this.timelineEventType=this.parameters.timelineEventType?this.parameters.timelineEventType[0]:MARKETING_ET,this.clientNames=this.parameters.clientName?this.parameters.clientName:[],this.selectedPageKind=this.parameters.selectedPageKind?this.parameters.selectedPageKind:[],this.lastUpdateTimeProperty=this.parameters.lastUpdateTimeProperty?this.parameters.lastUpdateTimeProperty[0]:null,this.emailProperty=this.parameters.emailProperty?this.parameters.emailProperty[0]:null,this.approvalCodeProperty=this.parameters.approvalCodeProperty?this.parameters.approvalCodeProperty[0]:null,this.appStartProperty=this.parameters.appStartProperty?this.parameters.appStartProperty[0]:null,this.appPendingProperty=this.parameters.appPendingProperty?this.parameters.appPendingProperty[0]:null,this.appCompleteProperty=this.parameters.appCompleteProperty?this.parameters.appCompleteProperty[0]:null,this.appDeclinedProperty=this.parameters.appDeclinedProperty?this.parameters.appDeclinedProperty[0]:null,this.appFraudProperty=this.parameters.appFraudProperty?this.parameters.appFraudProperty[0]:null,this.appErrorProperty=this.parameters.appErrorProperty?this.parameters.appErrorProperty[0]:null,this.agreeAndAcceptProperty=this.parameters.agreeAndAcceptProperty?this.parameters.agreeAndAcceptProperty[0]:null,this.prequalAppStartProperty=this.parameters.prequalAppStartProperty?this.parameters.prequalAppStartProperty[0]:null,this.prequalAppPendingProperty=this.parameters.prequalAppPendingProperty?this.parameters.prequalAppPendingProperty[0]:null,this.prequalAppCompleteProperty=this.parameters.prequalAppCompleteProperty?this.parameters.prequalAppCompleteProperty[0]:null,this.prequalAppDeclinedProperty=this.parameters.prequalAppDeclinedProperty?this.parameters.prequalAppDeclinedProperty[0]:null,this.prequalAppErrorProperty=this.parameters.prequalAppErrorProperty?this.parameters.prequalAppErrorProperty[0]:null,this.prequalNotInterestedProperty=this.parameters.prequalNotInterestedProperty?this.parameters.prequalNotInterestedProperty[0]:null,this.prequalSecuredInstallmentAppStartProperty=this.parameters.prequalSecuredInstallmentAppStartProperty?this.parameters.prequalSecuredInstallmentAppStartProperty[0]:null,this.prequalSecuredInstallmentAppPendingProperty=this.parameters.prequalSecuredInstallmentAppPendingProperty?this.parameters.prequalSecuredInstallmentAppPendingProperty[0]:null,this.prequalSecuredInstallmentAppCompleteProperty=this.parameters.prequalSecuredInstallmentAppCompleteProperty?this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]:null,this.prequalSecuredInstallmentAppDeclinedProperty=this.parameters.prequalSecuredInstallmentAppDeclinedProperty?this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]:null,this.prequalSecuredInstallmentAppErrorProperty=this.parameters.prequalSecuredInstallmentAppErrorProperty?this.parameters.prequalSecuredInstallmentAppErrorProperty[0]:null,this.securedInstallmentAppStartProperty=this.parameters.securedInstallmentAppStartProperty?this.parameters.securedInstallmentAppStartProperty[0]:null,this.securedInstallmentAppPendingProperty=this.parameters.securedInstallmentAppPendingProperty?this.parameters.securedInstallmentAppPendingProperty[0]:null,this.securedInstallmentAppCompleteProperty=this.parameters.securedInstallmentAppCompleteProperty?this.parameters.securedInstallmentAppCompleteProperty[0]:null,this.securedInstallmentAppDeclinedProperty=this.parameters.securedInstallmentAppDeclinedProperty?this.parameters.securedInstallmentAppDeclinedProperty[0]:null,this.securedInstallmentAppFraudProperty=this.parameters.securedInstallmentAppFraudProperty?this.parameters.securedInstallmentAppFraudProperty[0]:null,this.securedInstallmentAppErrorProperty=this.parameters.securedInstallmentAppErrorProperty?this.parameters.securedInstallmentAppErrorProperty[0]:null,this.applyLoanAppStartProperty=this.parameters.applyLoanAppStartProperty?this.parameters.applyLoanAppStartProperty[0]:null,this.applyLoanAppPendingProperty=this.parameters.applyLoanAppPendingProperty?this.parameters.applyLoanAppPendingProperty[0]:null,this.applyLoanAppCompleteProperty=this.parameters.applyLoanAppCompleteProperty?this.parameters.applyLoanAppCompleteProperty[0]:null,this.applyLoanAppDeclinedProperty=this.parameters.applyLoanAppDeclinedProperty?this.parameters.applyLoanAppDeclinedProperty[0]:null,this.applyLoanAppFraudProperty=this.parameters.applyLoanAppFraudProperty?this.parameters.applyLoanAppFraudProperty[0]:null,this.applyLoanAppErrorProperty=this.parameters.applyLoanAppErrorProperty?this.parameters.applyLoanAppErrorProperty[0]:null,this.offerPersistReviewOfferProperty=this.parameters.offerPersistReviewOfferProperty?this.parameters.offerPersistReviewOfferProperty[0]:null,this.offerPersistNotFoundExpProperty=this.parameters.offerPersistNotFoundExpProperty?this.parameters.offerPersistNotFoundExpProperty[0]:null,this.offerPersistEligibilityFailureProperty=this.parameters.offerPersistEligibilityFailureProperty?this.parameters.offerPersistEligibilityFailureProperty[0]:null,this.offerPersistPrequalOfferProperty=this.parameters.offerPersistPrequalOfferProperty?this.parameters.offerPersistPrequalOfferProperty[0]:null,this.offerPersistPrequalOfferDeclineProperty=this.parameters.offerPersistPrequalOfferDeclineProperty?this.parameters.offerPersistPrequalOfferDeclineProperty[0]:null,this.offerPersistCompleteApproveProperty=this.parameters.offerPersistCompleteApproveProperty?this.parameters.offerPersistCompleteApproveProperty[0]:null,this.offerPersistCompletePendingProperty=this.parameters.offerPersistCompletePendingProperty?this.parameters.offerPersistCompletePendingProperty[0]:null,this.offerPersistCompleteDeclineProperty=this.parameters.offerPersistCompleteDeclineProperty?this.parameters.offerPersistCompleteDeclineProperty[0]:null,this.offerPersistDapplyStartErrorProperty=this.parameters.offerPersistDapplyStartErrorProperty?this.parameters.offerPersistDapplyStartErrorProperty[0]:null,this.prequalEmailOfferClickProperty=this.parameters.prequalEmailOfferClickProperty?this.parameters.prequalEmailOfferClickProperty[0]:null,this.offerPersistNotInterestedClickProperty=this.parameters.offerPersistNotInterestedClickProperty?this.parameters.offerPersistNotInterestedClickProperty[0]:null,this.timeline={results:{events:[]}}},getPreloadProperties:function(){return[PII_INTERNAL_PROPERY,VEHICHLE_INFO_INTERNAL_PROPERTY,this.parameters.appCompleteProperty?this.parameters.appCompleteProperty[0]:"",this.parameters.appPendingProperty?this.parameters.appPendingProperty[0]:"",this.parameters.appDeclinedProperty?this.parameters.appDeclinedProperty[0]:"",this.parameters.appFraudProperty?this.parameters.appFraudProperty[0]:"",this.parameters.appErrorProperty?this.parameters.appErrorProperty[0]:"",this.parameters.prequalSecuredInstallmentAppCompleteProperty?this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]:"",this.parameters.prequalSecuredInstallmentAppDeclinedProperty?this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]:"",this.parameters.prequalSecuredInstallmentAppErrorProperty?this.parameters.prequalSecuredInstallmentAppErrorProperty[0]:"",this.parameters.prequalAppCompleteProperty?this.parameters.prequalAppCompleteProperty[0]:"",this.parameters.prequalAppDeclinedProperty?this.parameters.prequalAppDeclinedProperty[0]:"",this.parameters.prequalAppErrorProperty?this.parameters.prequalAppErrorProperty[0]:"",this.parameters.securedInstallmentAppCompleteProperty?this.parameters.securedInstallmentAppCompleteProperty[0]:"",this.parameters.securedInstallmentAppPendingProperty?this.parameters.securedInstallmentAppPendingProperty[0]:"",this.parameters.securedInstallmentAppDeclinedProperty?this.parameters.securedInstallmentAppDeclinedProperty[0]:"",this.parameters.securedInstallmentAppFraudProperty?this.parameters.securedInstallmentAppFraudProperty[0]:"",this.parameters.securedInstallmentAppErrorProperty?this.parameters.securedInstallmentAppErrorProperty[0]:"",this.parameters.applyLoanAppCompleteProperty?this.parameters.applyLoanAppCompleteProperty[0]:"",this.parameters.applyLoanAppPendingProperty?this.parameters.applyLoanAppPendingProperty[0]:"",this.parameters.applyLoanAppDeclinedProperty?this.parameters.applyLoanAppDeclinedProperty[0]:"",this.parameters.applyLoanAppFraudProperty?this.parameters.applyLoanAppFraudProperty[0]:"",this.parameters.applyLoanAppErrorProperty?this.parameters.applyLoanAppErrorProperty[0]:"",this.parameters.offerPersistReviewOfferProperty?this.parameters.offerPersistReviewOfferProperty[0]:"",this.parameters.offerPersistNotFoundExpProperty?this.parameters.offerPersistNotFoundExpProperty[0]:"",this.parameters.offerPersistEligibilityFailureProperty?this.parameters.offerPersistEligibilityFailureProperty[0]:"",this.parameters.offerPersistPrequalOfferDeclineProperty?this.parameters.offerPersistPrequalOfferDeclineProperty[0]:"",this.parameters.offerPersistCompleteApproveProperty?this.parameters.offerPersistCompleteApproveProperty[0]:"",this.parameters.offerPersistCompletePendingProperty?this.parameters.offerPersistCompletePendingProperty[0]:"",this.parameters.offerPersistCompleteDeclineProperty?this.parameters.offerPersistCompleteDeclineProperty[0]:"",this.parameters.offerPersistDapplyStartErrorProperty?this.parameters.offerPersistDapplyStartErrorProperty[0]:"",this.parameters.prequalEmailOfferClickProperty?this.parameters.prequalEmailOfferClickProperty[0]:"",this.parameters.offerPersistNotInterestedClickProperty?this.parameters.offerPersistNotInterestedClickProperty[0]:""].filter(function(e){return""!==e})},onLoad:function(){if(this.dataLayerName&&this.timelineEventType){var e=this,r=0;(function t(){if(e._getDataLayer())e._monitorDataLayerUpdates();else{if(r>20)return;r++,window.setTimeout(t,250)}}).call(this)}},_monitorDataLayerUpdates:function(){var e=this._getDataLayer(),r=(e.length,this._getDataHash(e)),t=this;this.pollingInterval=window.setInterval(function(){var e=t._getDataLayer(),i=t._getDataHash(e);r!==i&&(t._importFromDataLayer(e),e.length,r=i)},1e3),this._importFromDataLayer(e)},_getDataLayer:function(){if(!this._dataLayer){for(var e=this.dataLayerName.split("."),r=window,t=0;t<e.length;t++)r=r&&r[e[t]]?r[e[t]]:null;this._dataLayer=r}return this._dataLayer},_getDataHash:function(e){var r=this._getDataString(e);return r?this.md5(r):null},_getDataString:function(e){var r=null;try{r=JSON.stringify(e)}catch(t){r=this._stringify(e)}return r},_stringify:function(e){var r=[],t=JSON.stringify(e,function(e,t){if("object"==typeof t&&null!==t){if(-1!==r.indexOf(t))return;r.push(t)}return t});return r=null,t},_addDaysToTimestamp:function(e,r){return isNaN(parseInt(e))||isNaN(parseInt(r))||e&&13!==e.toString().length?e:parseInt(e)+TIME_MILLS_DAY*parseInt(r)},_formatDateMMDDYYYY:function(e){var r=e.getFullYear();return(e.getMonth()+1).toString().padStart(2,"0")+"/"+e.getDate().toString().padStart(2,"0")+"/"+r},_importFromDataLayer:function(e){if(e.pageInfo){var r=e.pageInfo[CLIENT_NAME_ATTR];if(this.clientNames.length>0&&-1===this.clientNames.indexOf(r))console.info("Listener ID: "+this.context.getInteractionId()+" -- Client name mismatch, skipping. Client: "+e.pageInfo[CLIENT_NAME_ATTR]);else{var t=new Date,s=t.getTime();this._currentMills=s;var p={};if(this.timelineEventType===MARKETING_ET)for(i=0;i<MARKETING_ATTRS.length;i++)e.pageInfo[MARKETING_ATTRS[i]]&&(p[MARKETING_ATTRS[i]]=e.pageInfo[MARKETING_ATTRS[i]]);if(this.timelineEventType===APPLICATION_ET){for(i=0;i<APPLICATION_ATTRS.length;i++)e.pageInfo[APPLICATION_ATTRS[i]]&&(p[APPLICATION_ATTRS[i]]=e.pageInfo[APPLICATION_ATTRS[i]]);if(e.formAction){var o=e.formAction[ACTION_ATTR];o&&(p[ACTION_ATTR]=o),e.formAction[APP_TYPE_ATTR]&&(p[APP_TYPE_ATTR]=e.formAction[APP_TYPE_ATTR])}var a=e.pageInfo[PAGE_KIND_ATTR];this._currentPageKind=a;var l=e.pageInfo[PAGE_NAME_ATTR];this._currentPageName=l;var n=e.pageInfo[PAGE_FUNCTION_ATTR],f=e.pageInfo[PAGE_SUB_FUNCTION_ATTR],h=e.pageInfo[DSA_TOKEN_ATTR]?e.pageInfo[DSA_TOKEN_ATTR]:null,P=e.pageInfo[APPROVAL_CODE_ATTR]?e.pageInfo[APPROVAL_CODE_ATTR]:null;this.approvalCodeProperty&&P&&this.profile.addValue(this.approvalCodeProperty,P);var u=this._getSessionIdTimestamp();if(LANDING_PAGE_NAMES.indexOf(l)>-1&&u&&this._currentMills-u>=1e4?this._setSessionId():LANDING_PAGE_NAMES.indexOf(l)>-1&&!u?this._setSessionId():this._getSessionId()||this._setSessionId(),a===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT)&&l===PREQUAL_OFFER_PAGE_NAME||a===PAGE_KIND_OFFER_PERSIST&&this.selectedPageKind.includes(PAGE_KIND_OFFER_PERSIST)&&l===PREQUAL_OFFER_PAGE_NAME||a===PAGE_KIND_PREQUAL&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL)&&l===PREQUAL_OFFER_PAGE_NAME){var m=this._addDaysToTimestamp(s,30),y=new Date(m);p[OFFER_EXPIRES_ATTR]=y,p[CAL_OFFER_EXPIRES_ATTR]=this._formatDateMMDDYYYY(y)}if(a===PAGE_KIND_PREQUAL&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL)){for(this.prequalEmailOfferClickProperty&&this._prequalEmailOfferClickListener(r),this.prequalNotInterestedProperty&&this._prequalNotInterestedListener(r,l),i=0;i<OFFER_PERSIST_DL_ATTR.length;i++)e.pageInfo[OFFER_PERSIST_DL_ATTR[i]]&&(p[OFFER_PERSIST_DL_ATTR[i]]=e.pageInfo[OFFER_PERSIST_DL_ATTR[i]]);this._handlePrequal(r,l)}else if(a===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT))this._handlePrequalSecuredInstallment(r,l),VEHICHLE_PAGE_NAME===l&&this._captureVehicleAttr(r,a),this._addVehicleAttr(r,a,p);else if(a===PAGE_KIND_APPLY&&this.selectedPageKind.includes(PAGE_KIND_APPLY))this._handleApply(r,l);else if(a===PAGE_KIND_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_SECURED_INSTALLMENT))this._handleSecuredInstallment(r,l);else if(a===PAGE_KIND_APPLY_LOAN&&this.selectedPageKind.includes(PAGE_KIND_APPLY_LOAN))this._handleApplyLoan(r,l);else if(a===PAGE_KIND_OFFER_PERSIST&&this.selectedPageKind.includes(PAGE_KIND_OFFER_PERSIST)){for(this.offerPersistNotInterestedClickProperty&&this._offerPersistNotInterestedClickListener(r),i=0;i<OFFER_PERSIST_DL_ATTR.length;i++)e.pageInfo[OFFER_PERSIST_DL_ATTR[i]]&&(p[OFFER_PERSIST_DL_ATTR[i]]=e.pageInfo[OFFER_PERSIST_DL_ATTR[i]]);this._handleOfferPersist(r,l,h,P,f)}l===YOUR_INFORMATION_PAGE_NAME&&this._capturePII(r,a,n,f),l===INFORMATION_REVIEW_PAGE_NAME&&this._capturePiiChanges(r,a),this._addPII(r,a,p)}p[DATE_STAMP_ATTR]=t,p[URL_ATTR]=window.location.href;try{this._getSessionId()&&(p[APPLICATION_SESSION_ID_ATTR]=this._getSessionId())}catch(e){this.blueConicClient.util.log(e)}this.lastUpdateTimeProperty&&this.profile.setValue(this.lastUpdateTimeProperty,s),this._updateProfile(t,p)}}},_updateProfile:function(e,r){this.blueConicClient.profile.updateProfile(this,function(){this.blueConicClient.createEvent("BC_DATALAYER_UPDATED")}),e&&r&&this._createTimelineEvent(e,r)},_createTimelineEvent:function(e,r){var t=JSON.parse(JSON.stringify(r));delete t.DateTimestamp,delete t.Token;var i=this._getDataHash(t),s=this._getTimelineCreated(i);window._dataLayerListenerEventsCache&&window._dataLayerListenerEventsCache[i]&&this._currentMills-window._dataLayerListenerEventsCache[i]<=1e4||s&&this._currentMills-s<=1e4||(window._dataLayerListenerEventsCache[i]=this._currentMills,this._setTimelineCreated(i),this.blueConicClient.profile.getProfile().timeline.createEvent(this.timelineEventType,e,r,this,function(){this.timeline.results.events.push({eventType:this.timelineEventType,eventDate:e,eventData:r})}))},_handleApply:function(e,r){if(START_PAGE_NAMES.indexOf(r)>-1){if(this.appStartProperty&&this.profile.addValue(this.appStartProperty,e),this.appCompleteProperty){var t=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.appCompleteProperty,t)}if(this.appPendingProperty){var i=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.appPendingProperty,i)}if(this.appDeclinedProperty){var s=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.appDeclinedProperty,s)}if(this.appFraudProperty){var p=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.appFraudProperty,p)}if(this.appErrorProperty){var o=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.appErrorProperty,o)}}if(PENDING_PAGE_NAMES.indexOf(r)>-1){if(this.appPendingProperty&&this.profile.addValue(this.appPendingProperty,e),this.appCompleteProperty){var a=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.appCompleteProperty,a)}if(this.appDeclinedProperty){var l=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.appDeclinedProperty,l)}if(this.appErrorProperty){var n=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.appErrorProperty,n)}if(this.appFraudProperty){var f=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.appFraudProperty,f)}}if(COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.appCompleteProperty&&this.profile.addValue(this.appCompleteProperty,e),this.appPendingProperty){var h=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.appPendingProperty,h)}if(this.appDeclinedProperty){var P=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.appDeclinedProperty,P)}if(this.appErrorProperty){var u=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.appErrorProperty,u)}if(this.appFraudProperty){var m=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.appFraudProperty,m)}}if(DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.appDeclinedProperty&&this.profile.addValue(this.appDeclinedProperty,e),this.appPendingProperty){var y=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.appPendingProperty,y)}if(this.appCompleteProperty){var d=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.appCompleteProperty,d)}if(this.appFraudProperty){var A=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.appFraudProperty,A)}if(this.appErrorProperty){var c=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(c,e),this.profile.setValues(this.appErrorProperty,c)}}if(r.toLowerCase().indexOf("fraud")>-1){if(this.appFraudProperty&&this.profile.addValue(this.appFraudProperty,e),this.appPendingProperty){var _=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(_,e),this.profile.setValues(this.appPendingProperty,_)}if(this.appCompleteProperty){var E=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(E,e),this.profile.setValues(this.appCompleteProperty,E)}if(this.appDeclinedProperty){var I=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(I,e),this.profile.setValues(this.appDeclinedProperty,I)}if(this.appErrorProperty){var g=this.profile.getValues(this.appErrorProperty);this._removeItemFromArray(g,e),this.profile.setValues(this.appErrorProperty,g)}}if(r.toLowerCase().indexOf("error")>-1){if(this.appErrorProperty&&this.profile.addValue(this.appErrorProperty,e),this.appPendingProperty){var v=this.profile.getValues(this.appPendingProperty);this._removeItemFromArray(v,e),this.profile.setValues(this.appPendingProperty,v)}if(this.appCompleteProperty){var C=this.profile.getValues(this.appCompleteProperty);this._removeItemFromArray(C,e),this.profile.setValues(this.appCompleteProperty,C)}if(this.appFraudProperty){var S=this.profile.getValues(this.appFraudProperty);this._removeItemFromArray(S,e),this.profile.setValues(this.appFraudProperty,S)}if(this.appDeclinedProperty){var T=this.profile.getValues(this.appDeclinedProperty);this._removeItemFromArray(T,e),this.profile.setValues(this.appDeclinedProperty,T)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handlePrequal:function(e,r){if(PREQUAL_START_PAGE_NAMES.indexOf(r)>-1){if(this.prequalAppStartProperty&&this.profile.addValue(this.prequalAppStartProperty,e),this.prequalAppCompleteProperty){var t=this.profile.getValues(this.prequalAppCompleteProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.prequalAppCompleteProperty,t)}if(this.prequalAppDeclinedProperty){var i=this.profile.getValues(this.prequalAppDeclinedProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.prequalAppDeclinedProperty,i)}if(this.prequalAppErrorProperty){var s=this.profile.getValues(this.prequalAppErrorProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.prequalAppErrorProperty,s)}}if(COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.prequalAppCompleteProperty&&this.profile.addValue(this.prequalAppCompleteProperty,e),this.prequalAppDeclinedProperty){var p=this.profile.getValues(this.prequalAppDeclinedProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.prequalAppDeclinedProperty,p)}if(this.prequalAppErrorProperty){var o=this.profile.getValues(this.prequalAppErrorProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.prequalAppErrorProperty,o)}}if(PREQUAL_DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.prequalAppDeclinedProperty&&this.profile.addValue(this.prequalAppDeclinedProperty,e),this.prequalAppCompleteProperty){var a=this.profile.getValues(this.prequalAppCompleteProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.prequalAppCompleteProperty,a)}if(this.prequalAppErrorProperty){var l=this.profile.getValues(this.prequalAppErrorProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.prequalAppErrorProperty,l)}}if(r.toLowerCase().indexOf("error")>-1){if(this.prequalAppErrorProperty&&this.profile.addValue(this.prequalAppErrorProperty,e),this.prequalAppCompleteProperty){var n=this.profile.getValues(this.prequalAppCompleteProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.prequalAppCompleteProperty,n)}if(this.prequalAppDeclinedProperty){var f=this.profile.getValues(this.prequalAppDeclinedProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.prequalAppDeclinedProperty,f)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handlePrequalSecuredInstallment:function(e,r){if(PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES.indexOf(r)>-1){if(this.prequalSecuredInstallmentAppStartProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppStartProperty,e),this.prequalSecuredInstallmentAppCompleteProperty){var t=this.profile.getValues(this.prequalSecuredInstallmentAppCompleteProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty,t)}if(this.prequalSecuredInstallmentAppDeclinedProperty){var i=this.profile.getValues(this.prequalSecuredInstallmentAppDeclinedProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty,i)}if(this.prequalSecuredInstallmentAppFraudProperty){var s=this.profile.getValues(this.prequalSecuredInstallmentAppFraudProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.prequalSecuredInstallmentAppFraudProperty,s)}if(this.prequalSecuredInstallmentAppErrorProperty){var p=this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty,p)}}if(PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.prequalSecuredInstallmentAppCompleteProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppCompleteProperty,e),this.prequalSecuredInstallmentAppDeclinedProperty){var o=this.profile.getValues(this.prequalSecuredInstallmentAppDeclinedProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty,o)}if(this.prequalSecuredInstallmentAppErrorProperty){var a=this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty,a)}}if(PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.prequalSecuredInstallmentAppDeclinedProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppDeclinedProperty,e),this.prequalSecuredInstallmentAppCompleteProperty){var l=this.profile.getValues(this.prequalSecuredInstallmentAppCompleteProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty,l)}if(this.prequalSecuredInstallmentAppErrorProperty){var n=this.profile.getValues(this.prequalSecuredInstallmentAppErrorProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.prequalSecuredInstallmentAppErrorProperty,n)}}if(r.toLowerCase().indexOf("error")>-1){if(this.prequalSecuredInstallmentAppErrorProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppErrorProperty,e),this.prequalSecuredInstallmentAppCompleteProperty){var f=this.profile.getValues(this.prequalSecuredInstallmentAppCompleteProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.prequalSecuredInstallmentAppCompleteProperty,f)}if(this.prequalSecuredInstallmentAppDeclinedProperty){var h=this.profile.getValues(this.prequalSecuredInstallmentAppDeclinedProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.prequalSecuredInstallmentAppDeclinedProperty,h)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_prequalNotInterestedListener:function(e){var r=document.querySelectorAll('[data-reason="not_interested"]');r.length>0?r.forEach(function(r,t){r.addEventListener("click",function(){this.profile.addValue(this.prequalNotInterestedProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1)}.bind(this)):this.blueConicClient.position.subscribe('[data-reason="not_interested"]',this,function(){this._prequalNotInterestedListener(e)})},_handleSecuredInstallment:function(e,r){if(START_PAGE_NAMES.indexOf(r)>-1){if(this.securedInstallmentAppStartProperty&&this.profile.addValue(this.securedInstallmentAppStartProperty,e),this.securedInstallmentAppPendingProperty){var t=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,t)}if(this.securedInstallmentAppCompleteProperty){var i=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,i)}if(this.securedInstallmentAppDeclinedProperty){var s=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,s)}if(this.securedInstallmentAppFraudProperty){var p=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,p)}if(this.securedInstallmentAppErrorProperty){var o=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,o)}}if(r.toLowerCase().indexOf("pending")>-1){if(this.securedInstallmentAppPendingProperty&&this.profile.addValue(this.securedInstallmentAppPendingProperty,e),this.securedInstallmentAppCompleteProperty){var a=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,a)}if(this.securedInstallmentAppDeclinedProperty){var l=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,l)}if(this.securedInstallmentAppErrorProperty){var n=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,n)}if(this.securedInstallmentAppFraudProperty){var f=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,f)}}if(COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.securedInstallmentAppCompleteProperty&&this.profile.addValue(this.securedInstallmentAppCompleteProperty,e),this.securedInstallmentAppPendingProperty){var h=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,h)}if(this.securedInstallmentAppDeclinedProperty){var P=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,P)}if(this.securedInstallmentAppErrorProperty){var u=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,u)}if(this.securedInstallmentAppFraudProperty){var m=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,m)}}if(DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.securedInstallmentAppDeclinedProperty&&this.profile.addValue(this.securedInstallmentAppDeclinedProperty,e),this.securedInstallmentAppPendingProperty){var y=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,y)}if(this.securedInstallmentAppCompleteProperty){var d=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,d)}if(this.securedInstallmentAppFraudProperty){var A=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,A)}if(this.securedInstallmentAppErrorProperty){var c=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(c,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,c)}}if(r.toLowerCase().indexOf("fraud")>-1){if(this.securedInstallmentAppFraudProperty&&this.profile.addValue(this.securedInstallmentAppFraudProperty,e),this.securedInstallmentAppPendingProperty){var _=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(_,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,_)}if(this.securedInstallmentAppCompleteProperty){var E=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(E,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,E)}if(this.securedInstallmentAppDeclinedProperty){var I=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(I,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,I)}if(this.securedInstallmentAppErrorProperty){var g=this.profile.getValues(this.securedInstallmentAppErrorProperty);this._removeItemFromArray(g,e),this.profile.setValues(this.securedInstallmentAppErrorProperty,g)}}if(r.toLowerCase().indexOf("error")>-1){if(this.securedInstallmentAppErrorProperty&&this.profile.addValue(this.securedInstallmentAppErrorProperty,e),this.securedInstallmentAppPendingProperty){var v=this.profile.getValues(this.securedInstallmentAppPendingProperty);this._removeItemFromArray(v,e),this.profile.setValues(this.securedInstallmentAppPendingProperty,v)}if(this.securedInstallmentAppCompleteProperty){var C=this.profile.getValues(this.securedInstallmentAppCompleteProperty);this._removeItemFromArray(C,e),this.profile.setValues(this.securedInstallmentAppCompleteProperty,C)}if(this.securedInstallmentAppFraudProperty){var S=this.profile.getValues(this.securedInstallmentAppFraudProperty);this._removeItemFromArray(S,e),this.profile.setValues(this.securedInstallmentAppFraudProperty,S)}if(this.securedInstallmentAppDeclinedProperty){var T=this.profile.getValues(this.securedInstallmentAppDeclinedProperty);this._removeItemFromArray(T,e),this.profile.setValues(this.securedInstallmentAppDeclinedProperty,T)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handleApplyLoan:function(e,r){if(START_PAGE_NAMES.indexOf(r)>-1){if(this.applyLoanAppStartProperty&&this.profile.addValue(this.applyLoanAppStartProperty,e),this.applyLoanAppPendingProperty){var t=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(t,e),this.profile.setValues(this.applyLoanAppPendingProperty,t)}if(this.applyLoanAppCompleteProperty){var i=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(i,e),this.profile.setValues(this.applyLoanAppCompleteProperty,i)}if(this.applyLoanAppDeclinedProperty){var s=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(s,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,s)}if(this.applyLoanAppFraudProperty){var p=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.applyLoanAppFraudProperty,p)}if(this.applyLoanAppErrorProperty){var o=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.applyLoanAppErrorProperty,o)}}if(r.toLowerCase().indexOf("pending")>-1){if(this.applyLoanAppPendingProperty&&this.profile.addValue(this.applyLoanAppPendingProperty,e),this.applyLoanAppCompleteProperty){var a=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.applyLoanAppCompleteProperty,a)}if(this.applyLoanAppDeclinedProperty){var l=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,l)}if(this.applyLoanAppErrorProperty){var n=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.applyLoanAppErrorProperty,n)}if(this.applyLoanAppFraudProperty){var f=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.applyLoanAppFraudProperty,f)}}if(COMPLETE_PAGE_NAMES.indexOf(r)>-1){if(this.applyLoanAppCompleteProperty&&this.profile.addValue(this.applyLoanAppCompleteProperty,e),this.applyLoanAppPendingProperty){var h=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.applyLoanAppPendingProperty,h)}if(this.applyLoanAppDeclinedProperty){var P=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,P)}if(this.applyLoanAppErrorProperty){var u=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.applyLoanAppErrorProperty,u)}if(this.applyLoanAppFraudProperty){var m=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.applyLoanAppFraudProperty,m)}}if(DECLINED_PAGE_NAMES.indexOf(r)>-1||r.toLowerCase().indexOf("decline")>-1){if(this.applyLoanAppDeclinedProperty&&this.profile.addValue(this.applyLoanAppDeclinedProperty,e),this.applyLoanAppPendingProperty){var y=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.applyLoanAppPendingProperty,y)}if(this.applyLoanAppCompleteProperty){var d=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.applyLoanAppCompleteProperty,d)}if(this.applyLoanAppFraudProperty){var A=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.applyLoanAppFraudProperty,A)}if(this.applyLoanAppErrorProperty){var c=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(c,e),this.profile.setValues(this.applyLoanAppErrorProperty,c)}}if(r.toLowerCase().indexOf("fraud")>-1){if(this.applyLoanAppFraudProperty&&this.profile.addValue(this.applyLoanAppFraudProperty,e),this.applyLoanAppPendingProperty){var _=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(_,e),this.profile.setValues(this.applyLoanAppPendingProperty,_)}if(this.applyLoanAppCompleteProperty){var E=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(E,e),this.profile.setValues(this.applyLoanAppCompleteProperty,E)}if(this.applyLoanAppDeclinedProperty){var I=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(I,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,I)}if(this.applyLoanAppErrorProperty){var g=this.profile.getValues(this.applyLoanAppErrorProperty);this._removeItemFromArray(g,e),this.profile.setValues(this.applyLoanAppErrorProperty,g)}}if(r.toLowerCase().indexOf("error")>-1){if(this.applyLoanAppErrorProperty&&this.profile.addValue(this.applyLoanAppErrorProperty,e),this.applyLoanAppPendingProperty){var v=this.profile.getValues(this.applyLoanAppPendingProperty);this._removeItemFromArray(v,e),this.profile.setValues(this.applyLoanAppPendingProperty,v)}if(this.applyLoanAppCompleteProperty){var C=this.profile.getValues(this.applyLoanAppCompleteProperty);this._removeItemFromArray(C,e),this.profile.setValues(this.applyLoanAppCompleteProperty,C)}if(this.applyLoanAppFraudProperty){var S=this.profile.getValues(this.applyLoanAppFraudProperty);this._removeItemFromArray(S,e),this.profile.setValues(this.applyLoanAppFraudProperty,S)}if(this.applyLoanAppDeclinedProperty){var T=this.profile.getValues(this.applyLoanAppDeclinedProperty);this._removeItemFromArray(T,e),this.profile.setValues(this.applyLoanAppDeclinedProperty,T)}}this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handleOfferPersist:function(e,r,t,i,s){if(r.toLowerCase().indexOf(OFFER_PERSIST_REVIEW_OFFER_PAGE_NAME)>-1&&t){if(this.offerPersistReviewOfferProperty&&this.profile.addValue(this.offerPersistReviewOfferProperty,e),this.offerPersistNotFoundExpProperty){var p=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(p,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,p)}if(this.offerPersistEligibilityFailureProperty){var o=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(o,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,o)}if(this.offerPersistPrequalOfferDeclineProperty){var a=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(a,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,a)}if(this.offerPersistCompleteApproveProperty){var l=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(l,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,l)}if(this.offerPersistCompletePendingProperty){var n=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(n,e),this.profile.setValues(this.offerPersistCompletePendingProperty,n)}if(this.offerPersistCompleteDeclineProperty){var f=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(f,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,f)}if(this.offerPersistDapplyStartErrorProperty){var h=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(h,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,h)}if(this.offerPersistPrequalOfferProperty){var P=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(P,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,P)}}if(r===YOUR_INFORMATION_PAGE_NAME&&s===PREFILLED_PAGE_SUB_FUNCTION&&(t||i)){if(this.offerPersistNotFoundExpProperty&&this.profile.addValue(this.offerPersistNotFoundExpProperty,e),this.offerPersistEligibilityFailureProperty){var u=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(u,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,u)}if(this.offerPersistPrequalOfferDeclineProperty){var m=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(m,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,m)}if(this.offerPersistCompleteApproveProperty){var y=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(y,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,y)}if(this.offerPersistCompletePendingProperty){var d=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(d,e),this.profile.setValues(this.offerPersistCompletePendingProperty,d)}if(this.offerPersistCompleteDeclineProperty){var A=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(A,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,A)}if(this.offerPersistDapplyStartErrorProperty){var c=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(c,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,c)}if(this.offerPersistPrequalOfferProperty){var _=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(_,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,_)}}if(r.toLowerCase().indexOf(OFFER_PERSIST_ELIGIBILITY_FAILURE_PAGE_NAME)>-1&&t){if(this.offerPersistEligibilityFailureProperty&&this.profile.addValue(this.offerPersistEligibilityFailureProperty,e),this.offerPersistNotFoundExpProperty){var E=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(E,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,E)}if(this.offerPersistPrequalOfferDeclineProperty){var I=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(I,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,I)}if(this.offerPersistCompleteApproveProperty){var g=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(g,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,g)}if(this.offerPersistCompletePendingProperty){var v=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(v,e),this.profile.setValues(this.offerPersistCompletePendingProperty,v)}if(this.offerPersistCompleteDeclineProperty){var C=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(C,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,C)}if(this.offerPersistDapplyStartErrorProperty){var S=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(S,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,S)}if(this.offerPersistPrequalOfferProperty){var T=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(T,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,T)}}if(r===PREQUAL_OFFER_PAGE_NAME){if(this.offerPersistPrequalOfferProperty&&this.profile.addValue(this.offerPersistPrequalOfferProperty,e),this.offerPersistNotFoundExpProperty){var V=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(V,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,V)}if(this.offerPersistPrequalOfferDeclineProperty){var L=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(L,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,L)}if(this.offerPersistCompleteApproveProperty){var F=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(F,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,F)}if(this.offerPersistCompletePendingProperty){var N=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(N,e),this.profile.setValues(this.offerPersistCompletePendingProperty,N)}if(this.offerPersistCompleteDeclineProperty){var D=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(D,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,D)}if(this.offerPersistDapplyStartErrorProperty){var O=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(O,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,O)}if(this.offerPersistEligibilityFailureProperty){var R=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(R,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,R)}}if(r===PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAME){if(this.offerPersistPrequalOfferDeclineProperty&&this.profile.addValue(this.offerPersistPrequalOfferDeclineProperty,e),this.offerPersistNotFoundExpProperty){var q=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(q,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,q)}if(this.offerPersistPrequalOfferProperty){var M=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(M,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,M)}if(this.offerPersistCompleteApproveProperty){var b=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(b,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,b)}if(this.offerPersistCompletePendingProperty){var x=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(x,e),this.profile.setValues(this.offerPersistCompletePendingProperty,x)}if(this.offerPersistCompleteDeclineProperty){var G=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(G,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,G)}if(this.offerPersistDapplyStartErrorProperty){var K=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(K,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,K)}if(this.offerPersistEligibilityFailureProperty){var w=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(w,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,w)}}if(r===COMPLETE_PAGE_NAME){if(this.offerPersistCompleteApproveProperty&&this.profile.addValue(this.offerPersistCompleteApproveProperty,e),this.offerPersistNotFoundExpProperty){var U=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(U,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,U)}if(this.offerPersistPrequalOfferProperty){var k=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(k,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,k)}if(this.offerPersistPrequalOfferDeclineProperty){var Y=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(Y,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,Y)}if(this.offerPersistCompletePendingProperty){var H=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(H,e),this.profile.setValues(this.offerPersistCompletePendingProperty,H)}if(this.offerPersistCompleteDeclineProperty){var Q=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(Q,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,Q)}if(this.offerPersistDapplyStartErrorProperty){var B=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(B,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,B)}if(this.offerPersistEligibilityFailureProperty){var z=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(z,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,z)}}if(r===PENDING_PAGE_NAME){if(this.offerPersistCompletePendingProperty&&this.profile.addValue(this.offerPersistCompletePendingProperty,e),this.offerPersistNotFoundExpProperty){var J=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(J,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,J)}if(this.offerPersistPrequalOfferProperty){var X=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(X,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,X)}if(this.offerPersistPrequalOfferDeclineProperty){var j=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(j,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,j)}if(this.offerPersistCompleteApproveProperty){var W=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(W,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,W)}if(this.offerPersistCompleteDeclineProperty){var Z=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(Z,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,Z)}if(this.offerPersistDapplyStartErrorProperty){var $=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray($,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,$)}if(this.offerPersistEligibilityFailureProperty){var ee=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(ee,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,ee)}}if(r===DECLINED_PAGE_NAME){if(this.offerPersistCompleteDeclineProperty&&this.profile.addValue(this.offerPersistCompleteDeclineProperty,e),this.offerPersistNotFoundExpProperty){var re=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(re,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,re)}if(this.offerPersistPrequalOfferProperty){var te=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(te,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,te)}if(this.offerPersistPrequalOfferDeclineProperty){var ie=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(ie,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,ie)}if(this.offerPersistCompleteApproveProperty){var se=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(se,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,se)}if(this.offerPersistCompletePendingProperty){var pe=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(pe,e),this.profile.setValues(this.offerPersistCompletePendingProperty,pe)}if(this.offerPersistDapplyStartErrorProperty){var oe=this.profile.getValues(this.offerPersistDapplyStartErrorProperty);this._removeItemFromArray(oe,e),this.profile.setValues(this.offerPersistDapplyStartErrorProperty,oe)}if(this.offerPersistEligibilityFailureProperty){var ae=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(ae,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,ae)}}if(r===DAPPLY_START_ERROR_PAGE_NAME){if(this.offerPersistDapplyStartErrorProperty&&this.profile.addValue(this.offerPersistDapplyStartErrorProperty,e),this.offerPersistNotFoundExpProperty){var le=this.profile.getValues(this.offerPersistNotFoundExpProperty);this._removeItemFromArray(le,e),this.profile.setValues(this.offerPersistNotFoundExpProperty,le)}if(this.offerPersistPrequalOfferProperty){var ne=this.profile.getValues(this.offerPersistPrequalOfferProperty);this._removeItemFromArray(ne,e),this.profile.setValues(this.offerPersistPrequalOfferProperty,ne)}if(this.offerPersistPrequalOfferDeclineProperty){var fe=this.profile.getValues(this.offerPersistPrequalOfferDeclineProperty);this._removeItemFromArray(fe,e),this.profile.setValues(this.offerPersistPrequalOfferDeclineProperty,fe)}if(this.offerPersistCompleteApproveProperty){var he=this.profile.getValues(this.offerPersistCompleteApproveProperty);this._removeItemFromArray(he,e),this.profile.setValues(this.offerPersistCompleteApproveProperty,he)}if(this.offerPersistCompletePendingProperty){var Pe=this.profile.getValues(this.offerPersistCompletePendingProperty);this._removeItemFromArray(Pe,e),this.profile.setValues(this.offerPersistCompletePendingProperty,Pe)}if(this.offerPersistCompleteDeclineProperty){var ue=this.profile.getValues(this.offerPersistCompleteDeclineProperty);this._removeItemFromArray(ue,e),this.profile.setValues(this.offerPersistCompleteDeclineProperty,ue)}if(this.offerPersistEligibilityFailureProperty){var me=this.profile.getValues(this.offerPersistEligibilityFailureProperty);this._removeItemFromArray(me,e),this.profile.setValues(this.offerPersistEligibilityFailureProperty,me)}}},_prequalEmailOfferClickListener:function(e){var r=document.querySelectorAll("#emailOffer");r.length>0?r.forEach(function(r,t){r.addEventListener("click",function(){this.profile.addValue(this.prequalEmailOfferClickProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1)}.bind(this)):this.blueConicClient.position.subscribe("#emailOffer",this,function(){this._prequalEmailOfferClickListener(e)})},_offerPersistNotInterestedClickListener:function(e){var r=document.querySelectorAll("#notIntersted");r.length>0?r.forEach(function(r,t){r.addEventListener("click",function(){this.profile.addValue(this.offerPersistNotInterestedClickProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1)}.bind(this)):this.blueConicClient.position.subscribe("#notIntersted",this,function(){this._offerPersistNotInterestedClickListener(e)})},_aggreeAcceptClickListener:function(e){var r=document.querySelector("button#acptbtn")||null;r?r.addEventListener("click",function(){this.profile.addValue(this.agreeAndAcceptProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1):this.blueConicClient.position.subscribe("button#acptbtn",this,function(){this._aggreeAcceptClickListener(e)})},_generateProfileKey:function(e){if(!e)return null;try{return this.md5((new Date).getTime().toString()+"_"+e.toLowerCase()).substring(6,26)}catch(e){return console.error("[BC ERROR] Error generating dummyProfileKey key: "+e),null}},_captureVehicleAttr:function(e,r){var t=document.querySelector('button[data-reason="residence"]')||null;null!==t?t.addEventListener("click",function(){var t=document.querySelector("#native-select-vehicleType-native"),i=t?t.options[t.selectedIndex].text:null,s=document.querySelector("#native-select-manufacturerOptions-native"),p=s?s.options[s.selectedIndex].text:null,o=document.querySelector("#native-select-modelYear-native"),a=o?o.options[o.selectedIndex].text:null,l=document.querySelector("#native-select-modelDesc-native"),n=l?l.options[l.selectedIndex].text:null;this.profile.setValue(VEHICHLE_INFO_INTERNAL_PROPERTY,JSON.stringify({currentClient:e,currentPageKind:r,vehicleType:i,vehicleMake:p,vehicleYear:a,vehicleModel:n})),this.blueConicClient.profile.updateProfile()}.bind(this)):this.blueConicClient.position.subscribe('button[data-reason="residence"]',this,function(){this._captureVehicleAttr(e,r)})},_addVehicleAttr:function(e,r,t){var i=this.profile.getValue(VEHICHLE_INFO_INTERNAL_PROPERTY);if(i)try{var s=JSON.parse(i);e===s.currentClient&&r===s.currentPageKind&&(s.vehicleType&&(t[VEHICLE_TYPE_ATTR]=s.vehicleType),s.vehicleYear&&(t[VEHICLE_YEAR_ATTR]=s.vehicleYear),s.vehicleMake&&(t[VEHICLE_MAKE_ATTR]=s.vehicleMake),s.vehicleModel&&(t[VEHICLE_MODEL_ATTR]=s.vehicleModel))}catch(e){}},_capturePiiChanges:function(e,r){var t=document.querySelector('button[data-test="save1-button"]')?document.querySelector('button[data-test="save1-button"]'):null;null!==t?t.addEventListener("click",function(){var t=document.querySelector("#firstName-primary")?document.querySelector("#firstName-primary").value:null,i=document.querySelector("#lastName-primary")?document.querySelector("#lastName-primary").value:null,s=document.querySelector("#emailAddress-primary")?document.querySelector("#emailAddress-primary").value:null,p=null,o=null;s&&(p=this._generateProfileKey(s),o=this._validateEmail(s),this.emailProperty&&this.profile.setValue(this.emailProperty,s)),this.profile.setValue(PII_INTERNAL_PROPERY,JSON.stringify({firstName:t,lastName:i,email:s,currentClient:e,currentPageKind:r,isBadEmail:o,dummyProfileKey:p})),this.blueConicClient.profile.updateProfile()}.bind(this)):this.blueConicClient.position.subscribe('button[data-test="save1-button"]',this,function(){this._capturePiiChanges(e,r)})},_capturePII:function(e,r,t,i){submitButton=document.querySelector('button[data-reason="productinfo"]')?document.querySelector('button[data-reason="productinfo"]'):document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]')?document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]'):document.querySelector('button[data-reason="Productinfo"]')?document.querySelector('button[data-reason="Productinfo"]'):document.querySelector('button[title="NEXT: VEHICLE INFO"]')?document.querySelector('button[title="NEXT: VEHICLE INFO"]'):document.querySelector("button#submitButton")?document.querySelector("button#submitButton"):document.querySelector('button[data-reason="see-if-I-prequalify"]')?document.querySelector('button[data-reason="see-if-I-prequalify"]'):null,null!==submitButton?submitButton.addEventListener("click",function(){var s=document.querySelector("#firstName")?document.querySelector("#firstName").value:null,p=document.querySelector("#lastName")?document.querySelector("#lastName").value:null;if(!s&&!p&&document.querySelector("#fullName")||!s&&!p&&document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")){var o=document.querySelector("#fullName")?document.querySelector("#fullName").innerText:document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")?document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm").innerText:null;o&&(s=-1!==o.indexOf(" ")?o.substring(0,o.indexOf(" ")):o,p=-1!==o.indexOf(" ")?o.substring(o.indexOf(" ")+1):null)}s||p||(s=(s=document.querySelector('div.prefill-details label[for="firstName"]')?document.querySelector('div.prefill-details label[for="firstName"]').innerText:null)?s.replace(/\s$/g,""):null,p=(p=document.querySelector('div.prefill-details label[for="lastName"]')?document.querySelector('div.prefill-details label[for="lastName"]').innerText:null)?p.replace(/\s$/g,""):null);var a=document.querySelector("#confirmEmailAddress")?document.querySelector("#confirmEmailAddress").value:document.querySelector("#confirmEmailCheck")?document.querySelector("#confirmEmailCheck").value:null;a||(a=document.querySelector('div.prefill-details label[for="email"]')?document.querySelector('div.prefill-details label[for="email"]').innerText:null);var l=null,n=null;a&&(l=this._generateProfileKey(a),n=this._validateEmail(a),this.emailProperty&&this.profile.setValue(this.emailProperty,a));var f=document.querySelector("#mailingAddress")?document.querySelector("#mailingAddress").value:document.querySelector("div#prefillstreetaddress label[for='streetAddressDapply']")?document.querySelector("div#prefillstreetaddress label[for='streetAddressDapply']").innerText:null,h=document.querySelector("#appAptmtNumber")?document.querySelector("#appAptmtNumber").value:null,P=document.querySelector("#applyVTO_applicantVO_city_id")?document.querySelector("#applyVTO_applicantVO_city_id").value:document.querySelector("div#prefillstreetaddress label[for='cityAndStateDapply']")?document.querySelector("div#prefillstreetaddress label[for='cityAndStateDapply']").innerText:null,u=null,m=null;P&&(u=P.substring(0,P.indexOf(",")),m=P.substring(P.indexOf(",")+2));var y=document.querySelector("#applyVTO_applicantVO_zip_id")?document.querySelector("#applyVTO_applicantVO_zip_id").value:document.querySelector("div#prefillstreetaddress label[for='zip']")?document.querySelector("div#prefillstreetaddress label[for='zip']").innerText:null;this.profile.setValue(PII_INTERNAL_PROPERY,JSON.stringify({firstName:s,lastName:p,email:a,currentClient:e,currentPageKind:r,isBadEmail:n,dummyProfileKey:l,address1:f,address2:h,city:u,state:m,zipCode:y,prefill:"payfone"===t&&("prefilled"===i||"no_user_data_in_payfone"===i)})),this.blueConicClient.profile.updateProfile()}.bind(this)):(this.blueConicClient.position.subscribe("button#submitButton",this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[data-reason="productinfo"]',this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[data-reason="Productinfo"]',this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[data-reason="NEXT: VEHICLE INFO"]',this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[title="NEXT: VEHICLE INFO"]',this,function(){this._capturePII(e,r,t,i)}),this.blueConicClient.position.subscribe('button[data-reason="see-if-I-prequalify"]',this,function(){this._capturePII(e,r,t,i)}))},_addPII:function(e,r,t){var i=this.profile.getValue(PII_INTERNAL_PROPERY);if(i)try{var s=JSON.parse(i);e===s.currentClient&&r===s.currentPageKind&&(t[FIRST_NAME_ATTR]=s.firstName,t[LAST_NAME_ATTR]=s.lastName,s.email&&(t[EMAIL_ADDRESS_ATTR]=s.email,t[IS_BAD_EMAIL_ATTR]=s.isBadEmail?s.isBadEmail:this._validateEmail(s.email)),s.dummyProfileKey&&(t[DUMMY_PROFILE_KEY_ATTR]=s.dummyProfileKey),t[PREFILL_ATTR]=s.prefill,s.address1&&(t[ADDRESS1_ATTR]=s.address1),s.address2&&(t[ADDRESS2_ATTR]=s.address2),s.city&&(t[CITY_ATTR]=s.city),s.state&&(t[STATE_ATTR]=s.state),s.zipCode&&(t[ZIP_CODE_ATTR]=s.zipCode))}catch(e){}},_validateEmail:function(e){var r=!1;(e.length<5||null===e.match(/@/g)||1!==e.match(/@/g).length||null!==e.match(/\s/g))&&(r=!0);var t=e.split("@")[1];null!==t.match(/\./g)&&1===t.match(/\./g).length&&null===t.match(/,/g)||(r=!0);var i=e.substr(0,1);["@",".",","," ","/","\\","!","#","$","%","^","&","*","(",")","+","-","~"].indexOf(i)>-1&&(r=!0);var s=e.substring(e.lastIndexOf(".")+1);return-1===["COM","NET","EDU","ORG","MIL","GOV","US","BIZ"].indexOf(s.toUpperCase())&&(r=!0),r},_indexOf:function(e,r){return Array.isArray(e)?e.indexOf(r):-1},_removeItemFromArray:function(e,r){if(Array.isArray(e))for(var t;-1!==(t=this._indexOf(e,r));)e.splice(t,1)},_encodeCookieValue:function(e){return"string"!=typeof e&&(e=JSON.stringify(e)),encodeURIComponent(e.replace(/[\n\r]/g,""))},_decodeCookieValue:function(e){return decodeURIComponent(e)},_setCookie:function(e,r,t){if(t){var i=new Date,s=t*MINUTES_TO_MILLS;i.setTime(i.getTime()+s),document.cookie=e+"="+this._encodeCookieValue(r)+(null==t?"":"; expires="+i.toUTCString())+"; path=/; SameSite=None; Secure"}else document.cookie=e+"="+this._encodeCookieValue(r)+"; path=/; SameSite=None; Secure"},_getCookie:function(e){var r,t,i=e+"=",s="";return document.cookie.length>0&&-1!==(r=document.cookie.indexOf(i))&&(r+=i.length,-1===(t=document.cookie.indexOf(";",r))&&(t=document.cookie.length),s=this._decodeCookieValue(document.cookie.substring(r,t))),s},_checkSessionStorageSupport:function(){var e="__storageTest";try{return window.sessionStorage.setItem(e,e),window.sessionStorage.removeItem(e),!0}catch(e){return!1}},_getSessionId:function(){return window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME)?window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME):this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME)?this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME):null},_getSessionIdTimestamp:function(){return window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)?window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME):this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)?this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME):null},_setSessionId:function(){var e=this._uuid();return this._checkSessionStorageSupport()&&(window.sessionStorage.setItem(APPLICATION_SESSION_ID_COOKIE_NAME,e),window.sessionStorage.setItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME,this._currentMills)),this._setCookie(APPLICATION_SESSION_ID_COOKIE_NAME,e,null),this._setCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME,this._currentMills,null),e},_getTimelineCreated:function(e){return this._checkSessionStorageSupport()?window.sessionStorage.getItem(e)?window.sessionStorage.getItem(e):null:this._getCookie(e)?this._getCookie(e):null},_setTimelineCreated:function(e){this._checkSessionStorageSupport()?window.sessionStorage.setItem(e,this._currentMills):this._setCookie(e,this._currentMills,null)},_uuid:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,function(e){return(e^window.crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})}};try{var InteractionTypeImpl=InteractionType.extend(frontendListener)}catch(e){try{module.exports=frontendListener}catch(e){}};var a = [];var i='listener_offer_persist_datalayer_syf';a.push({url: '/plugins/listener_offer_persist_datalayer_syf/frontend/src/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwareLocalPluginsUrl() + '/plugins/listener_offer_persist_datalayer_syf/ts_6865a2d99389032eb2f99c14986da46d/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(e,n){this.blueConicClient=e,this.context=n||null,this.changePermissionLevel=!1,this.OBJECTIVE_ID="purpose_",this.COOKIE_NAME="OptanonConsent",this.COOKIE_GROUP="groups"},onPrepare:function(){this._handleConsentCookie(!0)},onLoad:function(){this._subscribeConsentOnChanged()},_subscribeConsentOnChanged:function(){var e=this,n=0;(function oneTrustReady(){if(window.OneTrust&&window.OneTrust.OnConsentChanged)window.OneTrust.OnConsentChanged((function(){e._handleConsentCookie()}));else{if(n>20)return;n++,window.setTimeout(oneTrustReady,250)}}).call(this)},_handleConsentCookie:function(e){try{var n=this.blueConicClient.util.cookie.getCookie(this.COOKIE_NAME);if(!n)return;var t=this._consentCookieToObject(n),i=this._getIABPurposes(t);this._setObjectives(i,e)}catch(o){}},_consentCookieToObject:function(e){var n={};if(e)for(var t=e.split("&"),i=0;i<t.length;i++){var o=t[i].split("=");o[0]&&o[1]&&(n[o[0]]=o[1])}return n},_getIABPurposes:function(e){var n={};if(!e||!e[this.COOKIE_GROUP])return n;for(var t=e[this.COOKIE_GROUP].split(","),i=0;i<t.length;i++){var o=t[i];if(o&&(0===o.indexOf("C000")||3===o.length)){var s=(o=o.replace("C000","")).split(":");null!==s[0]&&null!==s[1]&&n[s[0]]===undefined&&(n[s[0]]=1===parseInt(s[1]))}}return n},_setObjectives:function(e,n){var t=this.blueConicClient.profile.getProfile();for(var i in e){var o=this.OBJECTIVE_ID+"c000"+i.toLowerCase();e[i]?t.addConsentedObjective(o):t.addRefusedObjective(o)}n||this.blueConicClient.profile.updateProfile()}});var a = [];var i='listener_onetrust';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwareLocalPluginsUrl() + '/plugins/listener_onetrust/ts_7f171d1b1190945a5b3dbfe6e65a833f/'}]);})();(function(){ var InteractionTypeImpl;(()=>{"use strict";var e={d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};(()=>{var i;e.d(t,{default:()=>n}),function(e){e.HASH_CHANGE="hashChange",e.POP_STATE="popState",e.PUSH_STATE="pushState",e.REPLACE_STATE="replaceState"}(i||(i={}));class n extends InteractionType{init(e,t){this.blueConicClient=e,this.context=t}onLoad(){const{events:e}=this.context.getParameters();e.forEach((e=>{switch(JSON.parse(e).id){case i.HASH_CHANGE:window.bcUrlHashListenerActive||"onhashchange"in window&&window.addEventListener&&(window.bcUrlHashListenerActive=!0,window.addEventListener("hashchange",(function(){window.blueConicClient.handlePageView()})));break;case i.POP_STATE:window.bcUrlPopstateListenerActive||"onpopstate"in window&&window.addEventListener&&(window.bcUrlPopstateListenerActive=!0,window.addEventListener("popstate",(function(){window.blueConicClient.handlePageView()})));break;case i.PUSH_STATE:window.bcUrlHistoryPushStateListenerActive||(window.bcUrlHistoryPushStateListenerActive=!0,(null===(t=null===window||void 0===window?void 0:window.history)||void 0===t?void 0:t.pushState)&&(window.history.pushState=o(window.history.pushState)));break;case i.REPLACE_STATE:window.bcUrlHistoryReplaceStateListenerActive||function(){var e;window.bcUrlHistoryReplaceStateListenerActive=!0,(null===(e=null===window||void 0===window?void 0:window.history)||void 0===e?void 0:e.replaceState)&&(window.history.replaceState=o(window.history.replaceState))}()}var t}))}}function o(e){return function(...t){window.blueConicClient.handlePageView(),e.apply(this,t)}}})(),InteractionTypeImpl=t.default})();var a = [];var i='listener_page_change';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.0.1/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(e,i){this.blueConicClient=e,this.bcHostName=this.blueConicClient.getHostname(),this.context=i,this.ineractionId=this.context.getInteractionId(),this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.profileId=this.profile.getId(),this.videoSelectors=this.parameters.selector?this.parameters.selector:[],this.audioSelectors=this.parameters.audioSelector?this.parameters.audioSelector:[],this.minPageSeconds=this.parameters.minSeconds&&this.parameters.minSeconds.length>=1?this.parameters.minSeconds[0]:0,this.dataLayerName=this.parameters.dataLayerName&&this.parameters.dataLayerName.length>=1?this.parameters.dataLayerName[0]:null,this.restEndpoint="https://"+this.bcHostName+"/rest/custom/frontend/listener_page_time_counter_synchrony/pingback?itemId="+this.ineractionId+"&profileId="+this.profileId},onLoad:function(){this._getPageInfo(),this._getDataLayer(),this._handlePageView(),this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,this._handlePageView)},_getPageInfo:function(){var e=this.blueConicClient.getCurrentDate(),i=window.location.hostname,t=window.location.pathname,a=window.location.protocol+"//"+i+t,o=window.location.href,n=md5(a+"_"+e.getTime().toString());return this.pageInfo=this.pageInfo||{domain:i,path:t,url:a,fullUrl:o,title:document.title,type:"PAGEVIEW",seconds:0,startDate:e,eventId:n},this._sendFirstPageView(),this.initialPageViewSent=!0,this.pageInfo},_sendFirstPageView:function(){this.profile.timeline.createEventById(this.pageInfo.eventId,"page_time",this.pageInfo.startDate,{domain:this.pageInfo.domain,path:this.pageInfo.path,url:this.pageInfo.fullUrl,title:this.pageInfo.title,type:this.pageInfo.type,seconds:this.pageInfo.seconds})},_getDataLayer:function(){if(this.dataLayerName){var e=this,i=0;(function t(){if(window[e.dataLayerName])e._dynamicData=window[e.dataLayerName],e.pageInfo?e.pageInfo.dynamicData=window[e.dataLayerName]:e.pageInfo={dynamicData:window[e.dataLayerName]},e._pageViewBeacon(),e.initialPageViewSent=!0;else{if(i>20)return;i++,window.setTimeout(t,250)}}).call(this)}},_handlePageView:function(){this._startPageInterval(),this._addPageViewUnloadListener(),this._pageViewBeacon(),this.videoSelectors&&this.videoSelectors.length>0&&this._videoListener(),this.audioSelectors&&this.audioSelectors.length>0&&this._audioListener()},_startPageInterval:function(){this.pageInterval&&clearInterval(this.pageInterval),this.pageInterval=setInterval(function(){this.pageInfo.seconds=parseInt(this.pageInfo.seconds)+1}.bind(this),1e3)},_addPageViewUnloadListener:function(){var e=this;document.addEventListener("visibilitychange",function(i){"hidden"===document.visibilityState?(e._pageViewBeacon(),clearInterval(e.pageInterval)):"visible"===document.visibilityState&&e._startPageInterval()},{capture:!0})},_pageViewBeacon:function(){if(!(this.pageInfo.seconds<this.minPageSeconds)){var e=this.pageInfo.title.replace(/!/g,""),i={eventDate:this.pageInfo.startDate,eventId:this.pageInfo.eventId,path:this.pageInfo.path,seconds:this.pageInfo.seconds,domain:this.pageInfo.domain,title:e,type:this.pageInfo.type,url:this.pageInfo.url,fullUrl:this.pageInfo.fullUrl,dynamicData:this.pageInfo.dynamicData},t=JSON.stringify(i),a=new Blob([t],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(this.restEndpoint,a)}},_addMediaUnloadListener:function(e,i){var t=this;document.addEventListener("visibilitychange",function(a){"hidden"===document.visibilityState?(clearInterval(t.videoProgressInterval),t._videoBeacon(i)):(t._videoPlayFired[i].sent=!1,t.videoProgressInterval=setInterval(t._checkVimeoProgress.bind(t),1e3,e,i))},{capture:!0}),window.addEventListener("pagehide",function(e){t._videoBeacon(i),clearInterval(t.videoProgressInterval)})},_addAudioUnloadListener:function(e,i){var t=this;document.addEventListener("visibilitychange",function(a){"hidden"===document.visibilityState?(clearInterval(t.audioProgressInterval),t._audioBeacon(i)):(t._audioPlayFired[i].sent=!1,t.audioProgressInterval=setInterval(t._checkAudioProgress.bind(t),1e3,e,i))},{capture:!0}),window.addEventListener("pagehide",function(e){t._audioBeacon(i),clearInterval(t.audioProgressInterval)})},_videoBeacon:function(e){if(!this._videoPlayFired[e].sent){var i=this._videoPlayFired[e].videoInfo.title.replace(/!/g,""),t=this._videoPlayFired[e].videoInfo.mediaTitle.replace(/!/g,""),a=JSON.stringify({eventId:this._videoPlayFired[e].videoInfo.eventId,eventDate:this._videoPlayFired[e].videoInfo.startDate,path:this._videoPlayFired[e].videoInfo.path,duration:Math.floor(this._videoPlayFired[e].duration),seconds:Math.floor(this._videoPlayFired[e].videoInfo.seconds),playerTime:Math.floor(this._videoPlayFired[e].videoInfo.playerTime),percentPlayed:this._videoPlayFired[e].videoPlayedPercentage,domain:this._videoPlayFired[e].videoInfo.domain,title:i,mediaTitle:t,type:this._videoPlayFired[e].videoInfo.type,url:this._videoPlayFired[e].videoInfo.url,fullUrl:this._videoPlayFired[e].videoInfo.url,mediaUrl:this._videoPlayFired[e].videoInfo.mediaUrl}),o=new Blob([a],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(this.restEndpoint,o),this._videoPlayFired[e].sent=!0}},_audioBeacon:function(e){if(!this._audioPlayFired[e].sent){var i=this._audioPlayFired[e].audioInfo.title.replace(/!/g,""),t=this._audioPlayFired[e].audioInfo.mediaTitle.replace(/!/g,""),a=JSON.stringify({eventId:this._audioPlayFired[e].audioInfo.eventId,eventDate:this._audioPlayFired[e].audioInfo.startDate,path:this._audioPlayFired[e].audioInfo.path,duration:Math.floor(this._audioPlayFired[e].duration),seconds:Math.floor(this._audioPlayFired[e].audioInfo.seconds),playerTime:Math.floor(this._audioPlayFired[e].audioInfo.playerTime),percentPlayed:this._audioPlayFired[e].audioPlayedPercentage,domain:this._audioPlayFired[e].audioInfo.domain,title:i,mediaTitle:t,type:this._audioPlayFired[e].audioInfo.type,url:this._audioPlayFired[e].audioInfo.url,fullUrl:this._audioPlayFired[e].audioInfo.url,mediaUrl:this._audioPlayFired[e].audioInfo.mediaUrl}),o=new Blob([a],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(this.restEndpoint,o),this._audioPlayFired[e].sent=!0}},_videoListener:function(){var e=this;this._videoPlayFired={},this.videoSelectors.forEach(function(i){document.querySelectorAll(i).length>0?e._videoPositionFound(i):e.blueConicClient.position.subscribe(i,e,function(){e._videoPositionFound(i)})}),this.videoProgressInterval&&clearInterval(this.videoProgressInterval),this.videoPlayedPercentage=0},_audioListener:function(){var e=this;this._audioPlayFired={},this.audioSelectors.forEach(function(i){document.querySelectorAll(i).length>0?e._audioPositionFound(i):e.blueConicClient.position.subscribe(i,e,function(){e._audioPositionFound(i)})}),this.audioProgressInterval&&clearInterval(this.audioProgressInterval),this.audioPlayedPercentage=0},_getVideoLocation:function(e){var i=document.createElement("a");i.href=e;var t=e.includes("player.vimeo.com")?"VIDEO":"LIVESTREAM",a=i.hostname,o=i.pathname,n=i.protocol+"//"+a+o,d=this._videoPlayFired[e].title,r=this.blueConicClient.getCurrentDate(),s=md5(n+"_"+r.getTime().toString());return{domain:this.pageInfo.domain,path:this.pageInfo.path,url:this.pageInfo.fullUrl,mediaUrl:n,title:this.pageInfo.title,mediaTitle:d,type:t,seconds:0,playerTime:0,startDate:r,eventId:s}},_getAudioLocation:function(e){var i=document.createElement("a");i.href=e.uri;var t=i.hostname,a=i.pathname,o=i.protocol+"//"+t+a,n=e.title,d=this.blueConicClient.getCurrentDate(),r=md5(o+"_"+d.getTime().toString());return{domain:this.pageInfo.domain,path:this.pageInfo.path,url:this.pageInfo.fullUrl,mediaUrl:o,title:this.pageInfo.title,mediaTitle:n,type:"AUDIO",seconds:0,playerTime:0,startDate:d,eventId:r}},_videoPositionFound:function(e){try{for(var i=document.querySelectorAll(e),t=!1,a=0;a<i.length;a++)if("true"!==i[a].getAttribute("data-blueconic-media-listener")&&"IFRAME"===i[a].tagName&&i[a].src.includes("vimeo.com")){t=!0;var o=i[a],n=new Vimeo.Player(o);this._bindVimeoEvents(o,n)}if(!t){var d=this;this.blueConicClient.position.subscribe(e,this,function(){d._videoPositionFound(e)})}}catch(e){this.blueConicClient.util.log("[BC][ERROR] Failed to establish media listener on video player: "+e)}},_audioPositionFound:function(e){try{for(var i=document.querySelectorAll(e),t=!1,a=0;a<i.length;a++)if("true"!==i[a].getAttribute("data-blueconic-media-listener")&&"IFRAME"===i[a].tagName&&i[a].src.includes("soundcloud.com")){t=!0;var o=i[a],n=SC.Widget(o);this._bindSoundCloudEvents(o,n)}t||this.blueConicClient.position.subscribe(e,this,function(){this._audioPositionFound(e)})}catch(e){this.blueConicClient.util.log("[BC][ERROR] Failed to establish media listener on video player: "+e)}},_bindVimeoEvents:function(e,i){var t=this;e&&!e.getAttribute(i)&&(this.videoPaying=!1,i.on("ended",function(){t._onEndedVimeo(e,i)}),i.on("pause",function(){t._onPauseVimeo(e,i)}),i.on("play",function(){t._onPlayVimeo(e,i)}),i.on("playing",function(){t._onPlayVimeo(e,i)}),e.setAttribute("data-blueconic-media-listener","true"))},_bindSoundCloudEvents:function(e,i){var t=this;e&&!e.getAttribute(i)&&(i.bind(SC.Widget.Events.READY,function(){i.bind(SC.Widget.Events.FINISH,function(){t._onEndedSC(i)}),i.bind(SC.Widget.Events.PAUSE,function(){t._onPauseSC(i)}),i.bind(SC.Widget.Events.PLAY,function(){t._onPlaySC(i)})}),e.setAttribute("data-blueconic-media-listener","true"))},_onPlayVimeo:function(e,i){var t=this,a=e.getAttribute("src");a&&(this._videoPlayFired[a]||(this._addMediaUnloadListener(i,a),this.blueConicClient.createEvent("media:play",[a]),this.blueConicClient.createEvent("media:video:play",[a]),this._videoPlayFired[a]=this._videoPlayFired[a]||{},this._videoPlayFired[a].played=!0,this._videoPlayFired[a].startTime=t.blueConicClient.getCurrentDate(),i.getDuration().then(function(e){0===e||a.includes("vimeo.com/event")?(t._videoPlayFired[a].liveStream=!0,i.getCurrentTime().then(function(i){e=i})):t._videoPlayFired[a].liveStream=!1,t._videoPlayFired[a].duration=e,i.getVideoTitle().then(function(e){t._videoPlayFired[a].title=e,t._videoPlayFired[a].videoInfo=t._getVideoLocation(a),t.videoProgressInterval=setInterval(t._checkVimeoProgress.bind(t),1e3,i,a)})})))},_onPauseVimeo:function(e,i){var t=e.getAttribute("src");this._videoPlayFired[t]&&(this._checkVimeoProgress(i,t),this.blueConicClient.event.publish("media:paused",[t]),this.blueConicClient.event.publish("media:video:paused",[t]),this._videoBeacon(t),clearInterval(this.videoProgressInterval))},_onPlaySC:function(e){var i=this;e.getCurrentSound(function(t){var a=t.uri;a&&(i._audioPlayFired[a]||(i._addAudioUnloadListener(e,a),i.blueConicClient.createEvent("media:play",[a]),i.blueConicClient.createEvent("media:audio:play",[a]),i._audioPlayFired[a]=i._audioPlayFired[a]||{},i._audioPlayFired[a].played=!0,i._audioPlayFired[a].startTime=i.blueConicClient.getCurrentDate(),i._audioPlayFired[a].duration=Math.floor(parseInt(t.duration)/1e3),i._audioPlayFired[a].title=t.title,i._audioPlayFired[a].audioInfo=i._getAudioLocation(t),i.audioProgressInterval=setInterval(i._checkAudioProgress.bind(i),1e3,e,a)))})},_onPauseSC:function(e){var i=this;e.getCurrentSound(function(t){var a=t.uri;a&&(i._audioPlayFired[a]||(i._checkAudioProgress(e,a),i.blueConicClient.event.publish("media:paused",[a]),i.blueConicClient.event.publish("media:audio:paused",[a]),i._audioBeacon(a),clearInterval(i.audioProgressInterval)))})},_onEndedVimeo:function(e,i){var t=e.getAttribute("src");this._videoPlayFired[t]&&(this._checkVimeoProgress(i,t),this.blueConicClient.createEvent("media:ended",[t]),this.blueConicClient.createEvent("media:video:ended",[t]),this._videoBeacon(t),this._videoPlayFired[t].videoInfo=this._getVideoLocation(t),this._videoPlayFired[t].videoPlayedPercentage=0,clearInterval(this.videoProgressInterval))},_onEndedSC:function(e){var i=this;e.getCurrentSound(function(t){var a=t.uri;a&&(i._audioPlayFired[a]||(i._checkAudioProgress(e,a),i.blueConicClient.createEvent("media:ended",[a]),i.blueConicClient.createEvent("media:audio:ended",[a]),i._audioBeacon(a),i._audioPlayFired[a].audioInfo=i._getAudioLocation(a),i._audioPlayFired[a].audioPlayedPercentage=0,clearInterval(i.audioProgressInterval)))})},_checkVimeoProgress:function(e,i){var t=this;this._videoPlayFired[i].videoInfo.seconds=this._videoPlayFired[i].videoInfo.seconds+1;var a=0;e.getCurrentTime().then(function(e){t._videoPlayFired[i].videoInfo.playerTime=e,t._videoPlayFired[i].liveStream?(t._videoPlayFired[i].duration=e,a=t._videoPlayFired[i].videoInfo.seconds):a=e;var o=parseFloat((Math.floor(a)/Math.floor(t._videoPlayFired[i].duration)*100).toFixed(2));if(0!==o){for(var n=t.videoPlayedPercentage+1;n<=o;n++)n%10!=0&&n%25!=0||(t.blueConicClient.event.publish("media:played_"+n+"%",[i]),t.blueConicClient.event.publish("media:video:played_"+n+"%",[i]));t._videoPlayFired[i].videoPlayedPercentage=o,t.videoPlayedPercentage=o}})},_checkAudioProgress:function(e,i){var t=this;this._audioPlayFired[i].audioInfo.seconds=this._audioPlayFired[i].audioInfo.seconds+1,e.getPosition(function(e){var a=Math.floor(e/1e3);t._audioPlayFired[i].audioInfo.playerTime=a;var o=parseFloat((Math.floor(t._audioPlayFired[i].audioInfo.playerTime)/Math.floor(t._audioPlayFired[i].duration)*100).toFixed(2));if(0!==o){for(var n=t.audioPlayedPercentage+1;n<=o;n++)n%10!=0&&n%25!=0||(t.blueConicClient.event.publish("media:played_"+n+"%",[i]),t.blueConicClient.event.publish("media:audio:played_"+n+"%",[i]));t._audioPlayFired[i].audioPlayedPercentage=o,t.audioPlayedPercentage=o}})}});var a = [];var i='listener_page_time_counter_synchrony';a.push({url: 'https://player.vimeo.com/api/player.js', sharing: 'local'});a.push({url: '/plugins/listener_page_time_counter_synchrony/frontend/src/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwareLocalPluginsUrl() + '/plugins/listener_page_time_counter_synchrony/ts_b9092b169276d8330fb03a9d4c6a25c2/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b;var c=new Date(2017,8,1,0,0,0,0),d=this.blueConicClient.getCurrentDate().getTime(),e=d-c.getTime();this.days=Math.floor(e/86400000)},getPreloadProperties:function(){return[]},onLoad:function(){var a=this.context.getProfile(),b=this.context.getParameters(),c=b.property?b.property[0]:b.property;if(c){var d=this.blueConicClient.json.parse(c)[0].profileproperty,e=this.blueConicClient.getCurrentDate(),f=this._getTimeFrame(e.getHours(),b.locale[0]),g={TIME:new Date().getTime(),data:[]};g.data.push({n:f,p:1,d:this.days}),a.addValue("_hl_"+d,this.blueConicClient.json.stringify(g)),this.blueConicClient.profile.updateProfile()}},_getTimeFrame:function(a,b){return this._getHour(a,b)+" - "+this._getHour(a+1,b)},_getHour:function(a,b){if("en-us"===b){var c=12<=a?"PM":"AM";return a%=12,a=0===a?12:a,a+" "+c}return a=10>a?"0"+a:a,a+":00"}});var a = [];var i='listener_preferred_hour';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.2.7/'}]);})();(function(){ var MARKETING_ET="marketing_data_layer",APPLICATION_ET="application_data_layer",APPLICATION_ATTRS=["ClientName","Country_Language","Device","PageFunction","PageKind","PageSubFunction","PNL","Product","Result","SiteIdentifier","Token","URL","DateTimestamp","ACORID","Application_ID","MerchantID","PageName","PageSubFlow","sitecode","ApprovalCode","CreditLimit"],MARKETING_ATTRS=["ClientName","Country_Language","Device","PageFunction","PageKind","PageSubFunction","PNL","Product","Result","SiteIdentifier","Token","URL","DateTimestamp","PageName","offerIds"],CLIENT_NAME_ATTR="ClientName",PAGE_KIND_ATTR="PageKind",PAGE_KIND_PREQUAL="prequal",PAGE_KIND_APPLY="apply",PAGE_KIND_SECURED_INSTALLMENT="secured_installment",PAGE_KIND_PREQUAL_SECURED_INSTALLMENT="prequal_secured_installment",PAGE_KIND_APPLY_LOAN="applyloan",ACTION_ATTR="action",APP_TYPE_ATTR="appType",DATE_STAMP_ATTR="DateTimestamp",URL_ATTR="URL",PAGE_NAME_ATTR="PageName",PAGE_FUNCTION_ATTR="PageFunction",PAGE_SUB_FUNCTION_ATTR="PageSubFunction",FIRST_NAME_ATTR="FirstName",LAST_NAME_ATTR="LastName",EMAIL_ADDRESS_ATTR="EmailAddress",IS_BAD_EMAIL_ATTR="IsBadEmail",PREFILL_ATTR="Prefill",APPLICATION_SESSION_ID_ATTR="ApplicationSessionID",DUMMY_PROFILE_KEY_ATTR="DummyProfileKey",ZIP_CODE_ATTR="ZipCode",OFFER_EXPIRES_ATTR="OfferExpires",VEHICLE_TYPE_ATTR="VehicleType",VEHICLE_MAKE_ATTR="VehicleMake",VEHICLE_YEAR_ATTR="VehicleYear",VEHICLE_MODEL_ATTR="VehicleModel",LANDING_PAGE_NAMES=["auto_fill_invitation"],START_PAGE_NAMES=["prequal_offer","apply options","Termsandconditions","your information"],PREQUAL_START_PAGE_NAMES=["your information"],PREQUAL_DECLINED_PAGE_NAMES=["prequal_offer_declined"],PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES=["your information"],COMPLETE_PAGE_NAMES=["complete approve"],PENDING_PAGE_NAMES=["complete pending"],DECLINED_PAGE_NAMES=["complete decline"],PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES=["prequal_offer"],PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES=["prequal_offer_declined"],YOUR_INFORMATION_PAGE_NAME="your information",INFORMATION_REVIEW_PAGE_NAME="review",PREQUAL_OFFER_PAGE_NAME="prequal_offer",VEHICHLE_PAGE_NAME="product info",PII_INTERNAL_PROPERY="_dll_pii",VEHICHLE_INFO_INTERNAL_PROPERTY="_vehichle_info",TIME_MILLS_DAY=864e5,MINUTES_TO_MILLS=6e4,APPLICATION_SESSION_ID_COOKIE_NAME="_bcasid",APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME="_bcasid_ts";window._dataLayerListenerEventsCache=window._dataLayerListenerEventsCache||{};var InteractionTypeImpl=InteractionType.extend({init:function(e,t){this.blueConicClient=e,this.context=t,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.dataLayerName=this.parameters.dataLayerName?this.parameters.dataLayerName[0]:"_SFDDL",this.timelineEventType=this.parameters.timelineEventType?this.parameters.timelineEventType[0]:MARKETING_ET,this.clientNames=this.parameters.clientName?this.parameters.clientName:[],this.selectedPageKind=this.parameters.selectedPageKind?this.parameters.selectedPageKind:[],this.lastUpdateTimeProperty=this.parameters.lastUpdateTimeProperty?this.parameters.lastUpdateTimeProperty[0]:null,this.emailProperty=this.parameters.emailProperty?this.parameters.emailProperty[0]:null,this.appStartProperty=this.parameters.appStartProperty?this.parameters.appStartProperty[0]:null,this.appPendingProperty=this.parameters.appPendingProperty?this.parameters.appPendingProperty[0]:null,this.appCompleteProperty=this.parameters.appCompleteProperty?this.parameters.appCompleteProperty[0]:null,this.appDeclinedProperty=this.parameters.appDeclinedProperty?this.parameters.appDeclinedProperty[0]:null,this.appFraudProperty=this.parameters.appFraudProperty?this.parameters.appFraudProperty[0]:null,this.appErrorProperty=this.parameters.appErrorProperty?this.parameters.appErrorProperty[0]:null,this.agreeAndAcceptProperty=this.parameters.agreeAndAcceptProperty?this.parameters.agreeAndAcceptProperty[0]:null,this.prequalAppStartProperty=this.parameters.prequalAppStartProperty?this.parameters.prequalAppStartProperty[0]:null,this.prequalAppPendingProperty=this.parameters.prequalAppPendingProperty?this.parameters.prequalAppPendingProperty[0]:null,this.prequalAppCompleteProperty=this.parameters.prequalAppCompleteProperty?this.parameters.prequalAppCompleteProperty[0]:null,this.prequalAppDeclinedProperty=this.parameters.prequalAppDeclinedProperty?this.parameters.prequalAppDeclinedProperty[0]:null,this.prequalAppErrorProperty=this.parameters.prequalAppErrorProperty?this.parameters.prequalAppErrorProperty[0]:null,this.prequalNotInterestedProperty=this.parameters.prequalNotInterestedProperty?this.parameters.prequalNotInterestedProperty[0]:null,this.prequalSecuredInstallmentAppStartProperty=this.parameters.prequalSecuredInstallmentAppStartProperty?this.parameters.prequalSecuredInstallmentAppStartProperty[0]:null,this.prequalSecuredInstallmentAppPendingProperty=this.parameters.prequalSecuredInstallmentAppPendingProperty?this.parameters.prequalSecuredInstallmentAppPendingProperty[0]:null,this.prequalSecuredInstallmentAppCompleteProperty=this.parameters.prequalSecuredInstallmentAppCompleteProperty?this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]:null,this.prequalSecuredInstallmentAppDeclinedProperty=this.parameters.prequalSecuredInstallmentAppDeclinedProperty?this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]:null,this.prequalSecuredInstallmentAppErrorProperty=this.parameters.prequalSecuredInstallmentAppErrorProperty?this.parameters.prequalSecuredInstallmentAppErrorProperty[0]:null,this.securedInstallmentAppStartProperty=this.parameters.securedInstallmentAppStartProperty?this.parameters.securedInstallmentAppStartProperty[0]:null,this.securedInstallmentAppPendingProperty=this.parameters.securedInstallmentAppPendingProperty?this.parameters.securedInstallmentAppPendingProperty[0]:null,this.securedInstallmentAppCompleteProperty=this.parameters.securedInstallmentAppCompleteProperty?this.parameters.securedInstallmentAppCompleteProperty[0]:null,this.securedInstallmentAppDeclinedProperty=this.parameters.securedInstallmentAppDeclinedProperty?this.parameters.securedInstallmentAppDeclinedProperty[0]:null,this.securedInstallmentAppFraudProperty=this.parameters.securedInstallmentAppFraudProperty?this.parameters.securedInstallmentAppFraudProperty[0]:null,this.securedInstallmentAppErrorProperty=this.parameters.securedInstallmentAppErrorProperty?this.parameters.securedInstallmentAppErrorProperty[0]:null,this.applyLoanAppStartProperty=this.parameters.applyLoanAppStartProperty?this.parameters.applyLoanAppStartProperty[0]:null,this.applyLoanAppPendingProperty=this.parameters.applyLoanAppPendingProperty?this.parameters.applyLoanAppPendingProperty[0]:null,this.applyLoanAppCompleteProperty=this.parameters.applyLoanAppCompleteProperty?this.parameters.applyLoanAppCompleteProperty[0]:null,this.applyLoanAppDeclinedProperty=this.parameters.applyLoanAppDeclinedProperty?this.parameters.applyLoanAppDeclinedProperty[0]:null,this.applyLoanAppFraudProperty=this.parameters.applyLoanAppFraudProperty?this.parameters.applyLoanAppFraudProperty[0]:null,this.applyLoanAppErrorProperty=this.parameters.applyLoanAppErrorProperty?this.parameters.applyLoanAppErrorProperty[0]:null,this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,function(){this.onLoad()})},getPreloadProperties:function(){return[PII_INTERNAL_PROPERY,VEHICHLE_INFO_INTERNAL_PROPERTY,this.parameters.appCompleteProperty?this.parameters.appCompleteProperty[0]:"",this.parameters.appPendingProperty?this.parameters.appPendingProperty[0]:"",this.parameters.appDeclinedProperty?this.parameters.appDeclinedProperty[0]:"",this.parameters.appFraudProperty?this.parameters.appFraudProperty[0]:"",this.parameters.appErrorProperty?this.parameters.appErrorProperty[0]:"",this.parameters.prequalSecuredInstallmentAppCompleteProperty?this.parameters.prequalSecuredInstallmentAppCompleteProperty[0]:"",this.parameters.prequalSecuredInstallmentAppDeclinedProperty?this.parameters.prequalSecuredInstallmentAppDeclinedProperty[0]:"",this.parameters.prequalSecuredInstallmentAppErrorProperty?this.parameters.prequalSecuredInstallmentAppErrorProperty[0]:"",this.parameters.prequalAppCompleteProperty?this.parameters.prequalAppCompleteProperty[0]:"",this.parameters.prequalAppDeclinedProperty?this.parameters.prequalAppDeclinedProperty[0]:"",this.parameters.prequalAppErrorProperty?this.parameters.prequalAppErrorProperty[0]:"",this.parameters.securedInstallmentAppCompleteProperty?this.parameters.securedInstallmentAppCompleteProperty[0]:"",this.parameters.securedInstallmentAppPendingProperty?this.parameters.securedInstallmentAppPendingProperty[0]:"",this.parameters.securedInstallmentAppDeclinedProperty?this.parameters.securedInstallmentAppDeclinedProperty[0]:"",this.parameters.securedInstallmentAppFraudProperty?this.parameters.securedInstallmentAppFraudProperty[0]:"",this.parameters.securedInstallmentAppErrorProperty?this.parameters.securedInstallmentAppErrorProperty[0]:"",this.parameters.applyLoanAppCompleteProperty?this.parameters.applyLoanAppCompleteProperty[0]:"",this.parameters.applyLoanAppPendingProperty?this.parameters.applyLoanAppPendingProperty[0]:"",this.parameters.applyLoanAppDeclinedProperty?this.parameters.applyLoanAppDeclinedProperty[0]:"",this.parameters.applyLoanAppFraudProperty?this.parameters.applyLoanAppFraudProperty[0]:"",this.parameters.applyLoanAppErrorProperty?this.parameters.applyLoanAppErrorProperty[0]:""].filter(function(e){return""!==e})},onLoad:function(){if(this.dataLayerName&&this.timelineEventType){var e=this,t=0;(function r(){if(window[e.dataLayerName])setTimeout(function(){e._importFromDataLayer(window[e.dataLayerName])},2e3);else{if(t>20)return;t++,window.setTimeout(r,250)}}).call(this)}},_addDaysToTimestamp:function(e,t){return isNaN(parseInt(e))||isNaN(parseInt(t))||e&&13!==e.toString().length?e:parseInt(e)+TIME_MILLS_DAY*parseInt(t)},_importFromDataLayer:function(e){if(e.pageInfo){var t=e.pageInfo[CLIENT_NAME_ATTR];if(this.clientNames.length>0&&-1===this.clientNames.indexOf(t))console.info("Listener ID: "+this.context.getInteractionId()+" -- Client name mismatch, skipping. Client: "+e.pageInfo[CLIENT_NAME_ATTR]);else{var r=new Date,a=r.getTime();this._currentMills=a;var n={};if(this.timelineEventType===MARKETING_ET)for(i=0;i<MARKETING_ATTRS.length;i++)e.pageInfo[MARKETING_ATTRS[i]]&&(n[MARKETING_ATTRS[i]]=e.pageInfo[MARKETING_ATTRS[i]]);if(this.timelineEventType===APPLICATION_ET){for(i=0;i<APPLICATION_ATTRS.length;i++)e.pageInfo[APPLICATION_ATTRS[i]]&&(n[APPLICATION_ATTRS[i]]=e.pageInfo[APPLICATION_ATTRS[i]]);if(e.formAction){var p=e.formAction[ACTION_ATTR];p&&(n[ACTION_ATTR]=p),e.formAction[APP_TYPE_ATTR]&&(n[APP_TYPE_ATTR]=e.formAction[APP_TYPE_ATTR])}var l=e.pageInfo[PAGE_KIND_ATTR];this._currentPageKind=l;var s=e.pageInfo[PAGE_NAME_ATTR];this._currentPageName=s;var o=e.pageInfo[PAGE_FUNCTION_ATTR],u=e.pageInfo[PAGE_SUB_FUNCTION_ATTR],d=this._getSessionIdTimestamp();if(LANDING_PAGE_NAMES.indexOf(s)>-1&&d&&this._currentMills-d>=1e4?this._setSessionId():LANDING_PAGE_NAMES.indexOf(s)>-1&&!d?this._setSessionId():this._getSessionId()||this._setSessionId(),l===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT)&&s===PREQUAL_OFFER_PAGE_NAME){var c=this._addDaysToTimestamp(a,30);n[OFFER_EXPIRES_ATTR]=new Date(c)}l===PAGE_KIND_PREQUAL&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL)?(this.prequalNotInterestedProperty&&this._prequalNotInterestedListener(t,s),this._handlePrequal(t,s)):l===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_PREQUAL_SECURED_INSTALLMENT)?(this._handlePrequalSecuredInstallment(t,s),VEHICHLE_PAGE_NAME===s&&this._captureVehicleAttr(t,l),this._addVehicleAttr(t,l,n)):l===PAGE_KIND_APPLY&&this.selectedPageKind.includes(PAGE_KIND_APPLY)?this._handleApply(t,s):l===PAGE_KIND_SECURED_INSTALLMENT&&this.selectedPageKind.includes(PAGE_KIND_SECURED_INSTALLMENT)?this._handleSecuredInstallment(t,s):l===PAGE_KIND_APPLY_LOAN&&this.selectedPageKind.includes(PAGE_KIND_APPLY_LOAN)&&this._handleApplyLoan(t,s),s===YOUR_INFORMATION_PAGE_NAME&&this._capturePII(t,l,o,u),s===INFORMATION_REVIEW_PAGE_NAME&&this._capturePiiChanges(t,l),this._addPII(t,l,n)}n[DATE_STAMP_ATTR]=r,n[URL_ATTR]=window.location.href;try{this._getSessionId()&&(n[APPLICATION_SESSION_ID_ATTR]=this._getSessionId())}catch(e){this.blueConicClient.util.log(e)}this.lastUpdateTimeProperty&&this.profile.setValue(this.lastUpdateTimeProperty,a),this._updateProfile(r,n)}}},_updateProfile:function(e,t){this.blueConicClient.profile.updateProfile(this,function(){e&&t&&this._createTimelineEvent(e,t)})},_createTimelineEvent:function(e,t){var r=this._getTimelineCreated();window._dataLayerListenerEventsCache&&window._dataLayerListenerEventsCache[t.PageName]&&Object.keys(window._dataLayerListenerEventsCache[t.PageName]).includes(this._currentPageName)&&this._currentMills-window._dataLayerListenerEventsCache[t.PageName]<=1e4||r&&r[t.PageName]&&this._currentMills-r[t.PageName]<=1e4||(window._dataLayerListenerEventsCache[t.PageName]=this._currentMills,this._setTimelineCreated(),this.blueConicClient.profile.getProfile().timeline.createEvent(this.timelineEventType,e,t),this.blueConicClient.createEvent("BC_DATALAYER_UPDATED"))},_handleApply:function(e,t){START_PAGE_NAMES.indexOf(t)>-1&&this.appStartProperty&&this.profile.addValue(this.appStartProperty,e),PENDING_PAGE_NAMES.indexOf(t)>-1&&this.appPendingProperty&&this.profile.addValue(this.appPendingProperty,e),COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.appCompleteProperty&&this.profile.addValue(this.appCompleteProperty,e),(DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.appDeclinedProperty&&this.profile.addValue(this.appDeclinedProperty,e),t.toLowerCase().indexOf("fraud")>-1&&this.appFraudProperty&&this.profile.addValue(this.appFraudProperty,e),t.toLowerCase().indexOf("error")>-1&&this.appErrorProperty&&this.profile.addValue(this.appErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handlePrequal:function(e,t){PREQUAL_START_PAGE_NAMES.indexOf(t)>-1&&this.prequalAppStartProperty&&this.profile.addValue(this.prequalAppStartProperty,e),COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.prequalAppCompleteProperty&&this.profile.addValue(this.prequalAppCompleteProperty,e),(PREQUAL_DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.prequalAppDeclinedProperty&&this.profile.addValue(this.prequalAppDeclinedProperty,e),t.toLowerCase().indexOf("error")>-1&&this.prequalAppErrorProperty&&this.profile.addValue(this.prequalAppErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handlePrequalSecuredInstallment:function(e,t){PREQUAL_SECURED_INSTALLMENT_START_PAGE_NAMES.indexOf(t)>-1&&this.prequalSecuredInstallmentAppStartProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppStartProperty,e),PREQUAL_SECURED_INSTALLMENT_COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.prequalSecuredInstallmentAppCompleteProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppCompleteProperty,e),(PREQUAL_SECURED_INSTALLMENT_DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.prequalSecuredInstallmentAppDeclinedProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppDeclinedProperty,e),t.toLowerCase().indexOf("error")>-1&&this.prequalSecuredInstallmentAppErrorProperty&&this.profile.addValue(this.prequalSecuredInstallmentAppErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_prequalNotInterestedListener:function(e){var t=document.querySelectorAll('a[data-reason="not_interested"]');t.length>0?t.forEach(function(t,r){t.addEventListener("click",function(){this.profile.addValue(this.prequalNotInterestedProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1)}.bind(this)):this.blueConicClient.position.subscribe('a[data-reason="not_interested"]',this,function(){this._prequalNotInterestedListener(e)})},_handleSecuredInstallment:function(e,t){START_PAGE_NAMES.indexOf(t)>-1&&this.securedInstallmentAppStartProperty&&this.profile.addValue(this.securedInstallmentAppStartProperty,e),t.toLowerCase().indexOf("pending")>-1&&this.securedInstallmentAppPendingProperty&&this.profile.addValue(this.securedInstallmentAppPendingProperty,e),COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.securedInstallmentAppCompleteProperty&&this.profile.addValue(this.securedInstallmentAppCompleteProperty,e),(DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.securedInstallmentAppDeclinedProperty&&this.profile.addValue(this.securedInstallmentAppDeclinedProperty,e),t.toLowerCase().indexOf("fraud")>-1&&this.securedInstallmentAppFraudProperty&&this.profile.addValue(this.securedInstallmentAppFraudProperty,e),t.toLowerCase().indexOf("error")>-1&&this.securedInstallmentAppErrorProperty&&this.profile.addValue(this.securedInstallmentAppErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_handleApplyLoan:function(e,t){START_PAGE_NAMES.indexOf(t)>-1&&this.applyLoanAppStartProperty&&this.profile.addValue(this.applyLoanAppStartProperty,e),t.toLowerCase().indexOf("pending")>-1&&this.applyLoanAppPendingProperty&&this.profile.addValue(this.applyLoanAppPendingProperty,e),COMPLETE_PAGE_NAMES.indexOf(t)>-1&&this.applyLoanAppCompleteProperty&&this.profile.addValue(this.applyLoanAppCompleteProperty,e),(DECLINED_PAGE_NAMES.indexOf(t)>-1||t.toLowerCase().indexOf("decline")>-1)&&this.applyLoanAppDeclinedProperty&&this.profile.addValue(this.applyLoanAppDeclinedProperty,e),t.toLowerCase().indexOf("fraud")>-1&&this.applyLoanAppFraudProperty&&this.profile.addValue(this.applyLoanAppFraudProperty,e),t.toLowerCase().indexOf("error")>-1&&this.applyLoanAppErrorProperty&&this.profile.addValue(this.applyLoanAppErrorProperty,e),this.agreeAndAcceptProperty&&this._aggreeAcceptClickListener(e)},_aggreeAcceptClickListener:function(e){var t=document.querySelector("button#acptbtn")||null;t?t.addEventListener("click",function(){this.profile.addValue(this.agreeAndAcceptProperty,e),this.blueConicClient.profile.updateProfile()}.bind(this),!1):this.blueConicClient.position.subscribe("button#acptbtn",this,function(){this._aggreeAcceptClickListener(e)})},_generateProfileKey:function(e){if(!e)return null;try{return md5((new Date).getTime().toString()+"_"+e.toLowerCase()).substring(6,26)}catch(e){return null}},_captureVehicleAttr:function(e,t){var r=document.querySelector('button[data-reason="residence"]')||null;null!==r?r.addEventListener("click",function(){var r=document.querySelector("#native-select-vehicleType-native"),i=r?r.options[r.selectedIndex].text:null,a=document.querySelector("#native-select-manufacturerOptions-native"),n=a?a.options[a.selectedIndex].text:null,p=document.querySelector("#native-select-modelYear-native"),l=p?p.options[p.selectedIndex].text:null,s=document.querySelector("#native-select-modelDesc-native"),o=s?s.options[s.selectedIndex].text:null;this.profile.setValue(VEHICHLE_INFO_INTERNAL_PROPERTY,JSON.stringify({currentClient:e,currentPageKind:t,vehicleType:i,vehicleMake:n,vehicleYear:l,vehicleModel:o})),this.blueConicClient.profile.updateProfile()}.bind(this)):this.blueConicClient.position.subscribe('button[data-reason="residence"]',this,function(){this._captureVehicleAttr(e,t)})},_addVehicleAttr:function(e,t,r){var i=this.profile.getValue(VEHICHLE_INFO_INTERNAL_PROPERTY);if(i)try{var a=JSON.parse(i);e===a.currentClient&&t===a.currentPageKind&&(a.vehicleType&&(r[VEHICLE_TYPE_ATTR]=a.vehicleType),a.vehicleYear&&(r[VEHICLE_YEAR_ATTR]=a.vehicleYear),a.vehicleMake&&(r[VEHICLE_MAKE_ATTR]=a.vehicleMake),a.vehicleModel&&(r[VEHICLE_MODEL_ATTR]=a.vehicleModel))}catch(e){}},_capturePiiChanges:function(e,t){var r=document.querySelector('button[data-test="save1-button"]')?document.querySelector('button[data-test="save1-button"]'):null;null!==r?r.addEventListener("click",function(){var r=document.querySelector("#firstName-primary")?document.querySelector("#firstName-primary").value:null,i=document.querySelector("#lastName-primary")?document.querySelector("#lastName-primary").value:null,a=document.querySelector("#emailAddress-primary")?document.querySelector("#emailAddress-primary").value:null,n=null,p=null;a&&(t===PAGE_KIND_PREQUAL_SECURED_INSTALLMENT&&(n=this._generateProfileKey(a)),p=this._validateEmail(a),this.emailProperty&&this.profile.setValue(this.emailProperty,a)),this.profile.setValue(PII_INTERNAL_PROPERY,JSON.stringify({firstName:r,lastName:i,email:a,currentClient:e,currentPageKind:t,isBadEmail:p,dummyProfileKey:n})),this.blueConicClient.profile.updateProfile()}.bind(this)):this.blueConicClient.position.subscribe('button[data-test="save1-button"]',this,function(){this._capturePiiChanges(e,t)})},_capturePII:function(e,t,r,i){submitButton=document.querySelector('button[data-reason="productinfo"]')?document.querySelector('button[data-reason="productinfo"]'):document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]')?document.querySelector('button[data-reason="NEXT: VEHICLE INFO"]'):document.querySelector('button[data-reason="Productinfo"]')?document.querySelector('button[data-reason="Productinfo"]'):document.querySelector('button[title="NEXT: VEHICLE INFO"]')?document.querySelector('button[title="NEXT: VEHICLE INFO"]'):document.querySelector("button#submitButton")?document.querySelector("button#submitButton"):null,null!==submitButton?submitButton.addEventListener("click",function(){var a=document.querySelector("#firstName")?document.querySelector("#firstName").value:null,n=document.querySelector("#lastName")?document.querySelector("#lastName").value:null;if(!a&&!n&&document.querySelector("#fullName")||!a&&!n&&document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")){var p=document.querySelector("#fullName")?document.querySelector("#fullName").innerText:document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")?document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(1) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm").innerText:null;p&&(a=-1!==p.indexOf(" ")?p.substring(0,p.indexOf(" ")):p,n=-1!==p.indexOf(" ")?p.substring(p.indexOf(" ")+1):null)}a||n||(a=(a=document.querySelector('div.prefill-details label[for="firstName"]')?document.querySelector('div.prefill-details label[for="firstName"]').innerText:null)?a.replace(/\s$/g,""):null,n=(n=document.querySelector('div.prefill-details label[for="lastName"]')?document.querySelector('div.prefill-details label[for="lastName"]').innerText:null)?n.replace(/\s$/g,""):null);var l=document.querySelector("#confirmEmailAddress")?document.querySelector("#confirmEmailAddress").value:document.querySelector("#confirmEmailCheck")?document.querySelector("#confirmEmailCheck").value:null,s=null,o=null;l&&(s=this._generateProfileKey(l),o=this._validateEmail(l),this.emailProperty&&this.profile.setValue(this.emailProperty,l));var u=document.querySelector("#applyVTO_applicantVO_zip_id")?document.querySelector("#applyVTO_applicantVO_zip_id").value:document.querySelector("#zipCode-primary")?document.querySelector("#zipCode-primary").value:null;if(!u){var d=document.querySelector("#address")?document.querySelector("#address").innerText:document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(2) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm")?document.querySelector("#__next > div:nth-child(2) > div > div.PrefillDetailFormStyles__PrefillSubContainer-sc-j2gedn-2.edKife > div:nth-child(2) > div.subcomponents__Row-sc-pymi2z-0.iyzLbE.PrefillDetailFormStyles__AnswerGrid-sc-j2gedn-6.jrTNbm").innerText:null;d&&(u=d.substring(d.lastIndexOf(", ")+2))}this.profile.setValue(PII_INTERNAL_PROPERY,JSON.stringify({firstName:a,lastName:n,email:l,currentClient:e,currentPageKind:t,isBadEmail:o,dummyProfileKey:s,zipCode:u,prefill:"payfone"===r&&("prefilled"===i||"no_user_data_in_payfone"===i)})),this.blueConicClient.profile.updateProfile()}.bind(this)):(this.blueConicClient.position.subscribe("button#submitButton",this,function(){this._capturePII(e,t,r,i)}),this.blueConicClient.position.subscribe('button[data-reason="productinfo"]',this,function(){this._capturePII(e,t,r,i)}),this.blueConicClient.position.subscribe('button[data-reason="Productinfo"]',this,function(){this._capturePII(e,t,r,i)}),this.blueConicClient.position.subscribe('button[data-reason="NEXT: VEHICLE INFO"]',this,function(){this._capturePII(e,t,r,i)}),this.blueConicClient.position.subscribe('button[title="NEXT: VEHICLE INFO"]',this,function(){this._capturePII(e,t,r,i)}))},_addPII:function(e,t,r){var i=this.profile.getValue(PII_INTERNAL_PROPERY);if(i)try{var a=JSON.parse(i);e===a.currentClient&&t===a.currentPageKind&&(r[FIRST_NAME_ATTR]=a.firstName,r[LAST_NAME_ATTR]=a.lastName,a.email&&(r[EMAIL_ADDRESS_ATTR]=a.email,r[IS_BAD_EMAIL_ATTR]=a.isBadEmail?a.isBadEmail:this._validateEmail(a.email)),a.dummyProfileKey&&(r[DUMMY_PROFILE_KEY_ATTR]=a.dummyProfileKey),r[PREFILL_ATTR]=a.prefill,a.zipCode&&(r[ZIP_CODE_ATTR]=a.zipCode))}catch(e){}},_validateEmail:function(e){var t=!1;(e.length<5||null===e.match(/@/g)||1!==e.match(/@/g).length||null!==e.match(/\s/g))&&(t=!0);var r=e.split("@")[1];null!==r.match(/\./g)&&1===r.match(/\./g).length&&null===r.match(/,/g)||(t=!0);var i=e.substr(0,1);["@",".",","," ","/","\\","!","#","$","%","^","&","*","(",")","+","-","~"].indexOf(i)>-1&&(t=!0);var a=e.substring(e.lastIndexOf(".")+1);return-1===["COM","NET","EDU","ORG","MIL","GOV","US","BIZ"].indexOf(a.toUpperCase())&&(t=!0),t},_indexOf:function(e,t){return Array.isArray(e)?e.indexOf(t):-1},_removeItemFromArray:function(e,t){if(Array.isArray(e))for(var r;-1!==(r=this._indexOf(e,t));)e.splice(r,1)},_encodeCookieValue:function(e){return"string"!=typeof e&&(e=JSON.stringify(e)),encodeURIComponent(e.replace(/[\n\r]/g,""))},_decodeCookieValue:function(e){return decodeURIComponent(e)},_setCookie:function(e,t,r){if(r){var i=new Date,a=r*MINUTES_TO_MILLS;i.setTime(i.getTime()+a),document.cookie=e+"="+this._encodeCookieValue(t)+(null==r?"":"; expires="+i.toUTCString())+"; path=/; SameSite=None; Secure"}else document.cookie=e+"="+this._encodeCookieValue(t)+"; path=/; SameSite=None; Secure"},_getCookie:function(e){var t,r,i=e+"=",a="";return document.cookie.length>0&&-1!==(t=document.cookie.indexOf(i))&&(t+=i.length,-1===(r=document.cookie.indexOf(";",t))&&(r=document.cookie.length),a=this._decodeCookieValue(document.cookie.substring(t,r))),a},_checkSessionStorageSupport:function(){var e="__storageTest";try{return window.sessionStorage.setItem(e,e),window.sessionStorage.removeItem(e),!0}catch(e){return!1}},_getSessionId:function(){return window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME)?window.sessionStorage.getItem(APPLICATION_SESSION_ID_COOKIE_NAME):this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME)?this._getCookie(APPLICATION_SESSION_ID_COOKIE_NAME):null},_getSessionIdTimestamp:function(){return window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)?window.sessionStorage.getItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME):this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME)?this._getCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME):null},_setSessionId:function(){var e=this._uuid();return this._checkSessionStorageSupport()&&(window.sessionStorage.setItem(APPLICATION_SESSION_ID_COOKIE_NAME,e),window.sessionStorage.setItem(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME,this._currentMills)),this._setCookie(APPLICATION_SESSION_ID_COOKIE_NAME,e,null),this._setCookie(APPLICATION_SESSION_ID_TIMESTAMP_COOKIE_NAME,this._currentMills,null),e},_getTimelineCreated:function(){var e=window.sessionStorage.getItem(this._currentPageKind)?window.sessionStorage.getItem(this._currentPageKind):this._getCookie(this._currentPageKind)?this._getCookie(this._currentPageKind):null;return e?JSON.parse(e):null},_setTimelineCreated:function(){var e={};e[this._currentPageName]=this._currentMills,e=JSON.stringify(e),this._checkSessionStorageSupport()?window.sessionStorage.setItem(this._currentPageKind,e):this._setCookie(this._currentPageKind,e,null)},_uuid:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,function(e){return(e^window.crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})}});var a = [];var i='listener_regular_app_abandoner_syf';a.push({url: '/plugins/listener_regular_app_abandoner_syf/frontend/src/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwareLocalPluginsUrl() + '/plugins/listener_regular_app_abandoner_syf/ts_787c599deafd7dc3ce679c67dfbb1011/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b;var c=new Date(2012,0,1,0,0,0,0),d=new Date,e=d.getTime()-c.getTime();this.days=Math.floor(e/86400000)},getPreloadProperties:function(){return[]},onLoad:function(){var a=this.context.getParameters(),b=a.config?a.config[0]:a.config;if(b){var c=this.blueConicClient.json.parse(b),d=document.location.href;(0<=d.indexOf("#")||0<=d.indexOf("?"))&&(d=d.substring(0,d.indexOf("#"))||d.substring(0,d.indexOf("?")));var e,f=d.split("/"),g=!1;for(e=0;e<c.length;e++){var h=c[e],i=f[e+3];h.checked&&h.profileProperty&&!g&&(this._storeEngagement(h.profileProperty,this._getValue(i)),i&&30<i.length&&h.checked&&(g=!0))}this.blueConicClient.profile.updateProfile()}},_getValue:function(a){return a?30<a.length?null:(0<=a.indexOf(".")&&(a=a.substring(0,a.indexOf("."))),isNaN(a)&&"index"!==a&&0!==a.indexOf("index.")?a:null):null},_storeEngagement:function(a,b){if(b){var c=this.context.getProfile(),d={TIME:new Date().getTime()};d[b]={},d[b]["p"+this.days]=1,c.addValue("_"+a,this.blueConicClient.json.stringify(d))}}});var a = [];var i='listener_url_structure';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.0.20/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({blueConicClient:null,context:null,_profile:null,_userLanguage:null,_systemLanguage:null,_language:null,_referrer:null,_hostName:null,_currentUrl:null,_domain:null,ORIGIN_TYPES:{WEB:"web",MOBILE_WEB:"mobile_web",CONNECTION:"connection",MOBILE:"mobile_app"},CONSTANTS:{THIRTY_MINUTES_IN_MS:18e5,UNKNOWN:""},PROFILE_PROPERTIES:{CLICKCOUNT:"clickcount",VISITS:"visits",VISITCLICKS:"visitclicks",LASTVISITDATE:"lastvisitdate",VISITEDSITES:"visitedsites",VISITEDDOMAIN:"visiteddomain",ENTRYPAGE:"entrypage",REFERRERHOST:"referrerhost",REFERRERHOSTS:"referrerhosts",HOSTENTRYPAGE:"hostentrypage",HOSTAVERAGETIME:"hostaveragetime",LASTREFERRERAVERAGE:"lastreferreraverage",AVERAGETIME:"averagetime",TOTALVISITTIME:"totalvisittime",RESOLUTION:"resolution",CURRENTRESOLUTION:"currentresolution",CURRENTSCREENWIDTH:"currentscreenwidth",CURRENTSCREENHEIGHT:"currentscreenheight",ORIGIN_TYPE:"origin_type",ORIGIN_SOURCE:"origin_source",ORIGIN_DETAIL:"origin_detail",DEVICETYPE:"devicetype",RECEIVED_FROM_SYSTEM:"received_from_system",RECEIVED_FROM_CONNECTION:"received_from_connection",MOBILE_APP_ID:"mobile_app_id",MOBILE_APP_NAMEVERSION:"mobile_app_nameversion",LANGUAGE:"language",KEYWORDS:"keywords",CURRENTKEYWORDS:"currentkeywords",CURRENT_UTM_SOURCE:"current_utm_source",CURRENT_UTM_MEDIUM:"current_utm_medium",CURRENT_UTM_TERM:"current_utm_term",CURRENT_UTM_CONTENT:"current_utm_content",CURRENT_UTM_CAMPAIGN:"current_utm_campaign",UTM_SOURCE:"utm_source",UTM_MEDIUM:"utm_medium",UTM_TERM:"utm_term",UTM_CONTENT:"utm_content",UTM_CAMPAIGN:"utm_campaign"},PROFILE_PROPERTIES_FOR_CHANNEL:{},init:function(e,t){this.blueConicClient=e,this.context=t,this._profile=e.profile.getProfile(),this._channelId=e.getChannelId(),this._referrer=document.referrer,this._hostName=window.location.hostname,this._currentUrl=window.location.href,this._domain=document.domain,this._userLanguage=window.navigator.userLanguage,this._systemLanguage=navigator.systemLanguage,this._language=window.navigator.language,this.PROFILE_PROPERTIES_FOR_CHANNEL={CLICKCOUNT:this.PROFILE_PROPERTIES.CLICKCOUNT+"_"+this._channelId,VISITS:this.PROFILE_PROPERTIES.VISITS+"_"+this._channelId,VISITCLICKS:this.PROFILE_PROPERTIES.VISITCLICKS+"_"+this._channelId,LASTVISITDATE:this.PROFILE_PROPERTIES.LASTVISITDATE+"_"+this._channelId}},onPrepare:function(){this._profile&&(this._setLanguageProperties(),this._setResolutionProperties(),this._setReferrerProperties(),this._setCampaignProperties())},onLoad:function(){this._profile&&(this._setReferrerHostOnLoad(),this._setVisitProperties(),this._setOriginProperties(),this.blueConicClient.profile.updateProfile())},getPreloadProperties:function(){return[this.PROFILE_PROPERTIES.CLICKCOUNT,this.PROFILE_PROPERTIES.VISITS,this.PROFILE_PROPERTIES.VISITCLICKS,this.PROFILE_PROPERTIES.LASTVISITDATE,this.PROFILE_PROPERTIES.VISITEDSITES,this.PROFILE_PROPERTIES.ENTRYPAGE,this.PROFILE_PROPERTIES.HOSTENTRYPAGE,this.PROFILE_PROPERTIES.HOSTAVERAGETIME,this.PROFILE_PROPERTIES.LASTREFERRERAVERAGE,this.PROFILE_PROPERTIES.AVERAGETIME,this.PROFILE_PROPERTIES.TOTALVISITTIME,this.PROFILE_PROPERTIES.RESOLUTION,this.PROFILE_PROPERTIES.DEVICETYPE,this.PROFILE_PROPERTIES.ORIGIN_TYPE,this.PROFILE_PROPERTIES.ORIGIN_SOURCE,this.PROFILE_PROPERTIES.ORIGIN_DETAIL,this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM,this.PROFILE_PROPERTIES.RECEIVED_FROM_CONNECTION,this.PROFILE_PROPERTIES.VISITEDDOMAIN,this.PROFILE_PROPERTIES.MOBILE_APP_ID,this.PROFILE_PROPERTIES.MOBILE_APP_NAMEVERSION,this.PROFILE_PROPERTIES_FOR_CHANNEL.CLICKCOUNT,this.PROFILE_PROPERTIES_FOR_CHANNEL.VISITS,this.PROFILE_PROPERTIES_FOR_CHANNEL.VISITCLICKS,this.PROFILE_PROPERTIES_FOR_CHANNEL.LASTVISITDATE]},_setLanguageProperties:function(){var e=this._userLanguage||this._systemLanguage||this._language,t=this._normalizeLocale(e).split("-")[0];t&&this._profile.setValue(this.PROFILE_PROPERTIES.LANGUAGE,t)},_normalizeLocale:function(e){return e&&e.replace("_","-").toLowerCase()},_setResolutionProperties:function(){var e=screen.width,t=screen.height;this._profile.setValue(this.PROFILE_PROPERTIES.CURRENTSCREENWIDTH,e),this._profile.setValue(this.PROFILE_PROPERTIES.CURRENTSCREENHEIGHT,t);var i=e+"x"+t;this._profile.setValue(this.PROFILE_PROPERTIES.CURRENTRESOLUTION,i),this._profile.addValue(this.PROFILE_PROPERTIES.RESOLUTION,i)},_setReferrerProperties:function(){this._setReferrerKeywords(),this._setReferrerHost()},_setReferrerKeywords:function(){var e=this.HELPER.decodeReferrer(this._referrer)||[];e.length>0&&(this._addProfileValues(this.PROFILE_PROPERTIES.KEYWORDS,e),this._profile.setValues(this.PROFILE_PROPERTIES.CURRENTKEYWORDS,e))},_addProfileValues:function(e,t){(Array.isArray(t)?t:[t]).forEach((function(t){this._profile.addValue(e,t)}),this)},_setReferrerHost:function(){var e=this._getReferrerHost();e!==this._hostName&&(this._profile.setValue(this.PROFILE_PROPERTIES.ENTRYPAGE,this._currentUrl),e&&(this._profile.setValue(this.PROFILE_PROPERTIES.REFERRERHOST,e),this._profile.addValue(this.PROFILE_PROPERTIES.REFERRERHOSTS,e)))},_setReferrerHostOnLoad:function(){var e=this._getReferrerHost();e!==this._hostName&&this._setHostEntryPageProperty(),this._setHostTotalAndAverageTimeProperty(this._hostName,e)},_getReferrerHost:function(){return this._referrer.replace(/http[s]?:\/\/(.*?)(:|\?|\/|$).*/,"$1")},_setCampaignProperties:function(){[this.PROFILE_PROPERTIES.UTM_SOURCE,this.PROFILE_PROPERTIES.UTM_MEDIUM,this.PROFILE_PROPERTIES.UTM_TERM,this.PROFILE_PROPERTIES.UTM_CONTENT,this.PROFILE_PROPERTIES.UTM_CAMPAIGN].forEach((function(e){var t=this._removeHashPart(this.HELPER._getParameterByName(this._currentUrl,e));t&&(this._profile.setValue("current_"+e,t),this._profile.addValue(e,t))}),this)},_setHostEntryPageProperty:function(){this._profile.setValue(this.PROFILE_PROPERTIES.ENTRYPAGE,this._currentUrl);var e=this._getHostEntryPageMapping();e[this._hostName]={entrypage:this._currentUrl},this._profile.setValue(this.PROFILE_PROPERTIES.HOSTENTRYPAGE,JSON.stringify(e))},_getHostEntryPageMapping:function(){return this._safeJSONParse(this._profile.getValue(this.PROFILE_PROPERTIES.HOSTENTRYPAGE))},_safeJSONParse:function(e){try{var t=e.replace(/'/g,'"');return JSON.parse(t)||{}}catch(i){return{}}},_setHostTotalAndAverageTimeProperty:function(e,t){var i=this._safeJSONParse(this._profile.getValue(this.PROFILE_PROPERTIES.HOSTAVERAGETIME));i[e]||(i[e]=this._createNewVisitData());var E=this.blueConicClient.getCurrentDate().getTime(),s=this._profile.getValue(this.PROFILE_PROPERTIES.LASTREFERRERAVERAGE),r=0,R=0,I=0;Object.keys(i).map((function(e){return e.toString()})).forEach((function(n){var _=i[n];this._isSessionExpired(_.enddate)?this._addVisit(_,_.enddate-_.startdate):n===e?_.enddate=E:n===t&&s!==t&&(_.enddate=E,this._profile.setValue(this.PROFILE_PROPERTIES.LASTREFERRERAVERAGE,t)),0!==_.averageTime&&(R++,r+=_.averageTime,I+=_.averageTime*_.visits)}),this),this._profile.setValue(this.PROFILE_PROPERTIES.HOSTAVERAGETIME,JSON.stringify(i)),this._profile.setValue(this.PROFILE_PROPERTIES.TOTALVISITTIME,I);var n=R>0?Math.round(r/R):0;this._profile.setValue(this.PROFILE_PROPERTIES.AVERAGETIME,n)},_addVisit:function(e,t){if(t>0){var i=e.averageTime*e.visits+t/1e3;e.visits++,e.averageTime=Math.round(i/e.visits)}var E=this.blueConicClient.getCurrentDate().getTime();e.startdate=E,e.enddate=E},_createNewVisitData:function(){var e=this.blueConicClient.getCurrentDate().getTime();return{startdate:e,enddate:e,averageTime:0,visits:0}},_setPropertyIfEmpty:function(e,t,i){"undefined"==typeof e[t]&&(e[t]=i)},_setVisitProperties:function(){this._addVisitedDomain(this._domain),this._increaseClickCount(),this._increaseVisits(this.PROFILE_PROPERTIES.VISITS,this.PROFILE_PROPERTIES.VISITCLICKS,this.PROFILE_PROPERTIES.LASTVISITDATE),this._channelId&&this._increaseVisits(this.PROFILE_PROPERTIES_FOR_CHANNEL.VISITS,this.PROFILE_PROPERTIES_FOR_CHANNEL.VISITCLICKS,this.PROFILE_PROPERTIES_FOR_CHANNEL.LASTVISITDATE)},_increaseVisits:function(e,t,i){e=e||this.PROFILE_PROPERTIES.VISITS,t=t||this.PROFILE_PROPERTIES.VISITCLICKS,i=i||this.PROFILE_PROPERTIES.LASTVISITDATE,this._isNewSession(e,i)?(this._resetPageViewsCurrentSession(t),this._increaseSessionCount(e)):this._increasePageViewsCurrentSession(t),this._setLastVisitDate(i,this.blueConicClient.getCurrentDate().getTime())},_setLastVisitDate:function(e,t){e=e||this.PROFILE_PROPERTIES.LASTVISITDATE,this._profile.setValue(e,t)},_addVisitedDomain:function(e){this._hasVisitedDomain(e)||this._profile.addValue(this.PROFILE_PROPERTIES.VISITEDSITES,e)},_hasVisitedDomain:function(e){var t=this._profile.getValues(this.PROFILE_PROPERTIES.VISITEDSITES)||[];return t.length>0&&-1!==t.indexOf(e)},_increaseClickCount:function(){this._profile.incrementValue(this.PROFILE_PROPERTIES.CLICKCOUNT,1),this._channelId&&this._profile.incrementValue(this.PROFILE_PROPERTIES_FOR_CHANNEL.CLICKCOUNT,1)},_isNewSession:function(e,t){e=e||this.PROFILE_PROPERTIES.VISITS,t=t||this.PROFILE_PROPERTIES.LASTVISITDATE;var i=this._getNumberProperty(e),E=this._getNumberProperty(t)||0;return 0===i||this._isSessionExpired(E)},_isSessionExpired:function(e){return this.blueConicClient.getCurrentDate().getTime()>e+this.CONSTANTS.THIRTY_MINUTES_IN_MS},_resetPageViewsCurrentSession:function(e){e=e||this.PROFILE_PROPERTIES.VISITCLICKS,this._profile.setValue(e,1)},_increasePageViewsCurrentSession:function(e){e=e||this.PROFILE_PROPERTIES.VISITCLICKS,this._profile.incrementValue(e,1)},_increaseSessionCount:function(e){e=e||this.PROFILE_PROPERTIES.VISITS,this._profile.incrementValue(e,1)},_setOriginProperties:function(){var e=this._getOriginCount();e>1?this._mergeOriginProperties():0===e&&this._resolveOriginProperties()},_getOriginCount:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.ORIGIN_TYPE)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.ORIGIN_SOURCE)||[],i=this._profile.getValues(this.PROFILE_PROPERTIES.ORIGIN_DETAIL)||[];return Math.max(e.length,t.length,i.length)},_mergeOriginProperties:function(){this._mergePropertyToUnknown(this.PROFILE_PROPERTIES.ORIGIN_TYPE),this._mergePropertyToUnknown(this.PROFILE_PROPERTIES.ORIGIN_SOURCE),this._mergePropertyToUnknown(this.PROFILE_PROPERTIES.ORIGIN_DETAIL)},_mergePropertyToUnknown:function(e){var t=this._profile.getValues(e)||[];this._profile.setValue(e,1===t.length?t[0]:this.CONSTANTS.UNKNOWN)},_resolveOriginProperties:function(){this._isVisitorOriginFromWeb()?this._resolveOriginForWebVisitor():this._isVisitorOriginFromConnection()?this._resolveOriginForProfileComingFromConnection():this._isVisitorOriginFromMobileApp()&&this._resolveOriginForMobileAppVisitor()},_isVisitorOriginFromWeb:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_ID)||[];return 0===e.length&&0===t.length},_isVisitorOriginFromMobileApp:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_ID)||[],i=this._getNumberProperty(this.PROFILE_PROPERTIES.VISITS);return t.length>0&&0===e.length&&0===i},_isVisitorOriginFromConnection:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM),t=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_ID),i=this._getNumberProperty(this.PROFILE_PROPERTIES.VISITS);return e&&e.length>0&&t&&0===t.length&&i<=0},_resolveOriginForWebVisitor:function(){var e="",t=this._profile.getValues(this.PROFILE_PROPERTIES.VISITEDSITES)||[],i=this._profile.getValue(this.PROFILE_PROPERTIES.DEVICETYPE)||"",E=this._profile.getValues(this.PROFILE_PROPERTIES.ENTRYPAGE)||[];i&&(e="PC"===i?this.ORIGIN_TYPES.WEB:this.ORIGIN_TYPES.MOBILE_WEB);var s=1===t.length?t[0]:this.CONSTANTS.UNKNOWN,r=1===E.length?E[0]:this.CONSTANTS.UNKNOWN;this._setOriginProfileProperties(e,s,r)},_resolveOriginForProfileComingFromConnection:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_CONNECTION)||[],i=1===e.length?e[0]:this.CONSTANTS.UNKNOWN,E=1===t.length?t[0]:this.CONSTANTS.UNKNOWN;this._setOriginProfileProperties(this.ORIGIN_TYPES.CONNECTION,i,E)},_resolveOriginForMobileAppVisitor:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_ID)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_NAMEVERSION)||[],i=1===e.length?e[0]:this.CONSTANTS.UNKNOWN,E=1===t.length?t[0]:this.CONSTANTS.UNKNOWN;this._setOriginProfileProperties(this.ORIGIN_TYPES.MOBILE,i,E)},_setOriginProfileProperties:function(e,t,i){this._profile.setValue(this.PROFILE_PROPERTIES.ORIGIN_TYPE,e),this._profile.setValue(this.PROFILE_PROPERTIES.ORIGIN_SOURCE,t),this._profile.setValue(this.PROFILE_PROPERTIES.ORIGIN_DETAIL,i)},_removeHashPart:function(e){if(e){var t=e.indexOf("#");if(-1!==t)return e.substring(0,t)}return e},HELPER:{search_engines:[["google\\.","q"],["bing\\.","q"],["search\\.yahoo\\.","p"],["search\\.aol\\.","q"],["duckduckgo\\.","q"],["baidu\\.","wd"],["ask\\.com","q"],["search\\.lycos\\.","q"],["dogpile\\.com","q"]],substringToHash:function(e){if(e){var t=e.indexOf("#");if(-1!==t)return e.substring(0,t)}return e},decodeReferrer:function(e){for(var t=new RegExp(""),i=0;i<this.search_engines.length;i++){var E=this.search_engines[i];t.compile("^http(s?)://(www\\.)?"+E[0],"i");var s=e.match(t);if(s){var r;if(r=isNaN(E[1])?this._getParameterByName(e,E[1]):s[E[1]+1])return r=decodeURIComponent(r),E.length>2&&E[2]&&(r=decodeURIComponent(r)),r=(r=(r=r.replace(/'|"/g,"")).split(/[\s,+.]+/)).filter((function(e){return e}));break}}return null},_getParameterByName:function(e,t){if(!t)return"";t=t.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&#]"+t+"=([^&#]*)").exec(e);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))}},_getNumberProperty:function(e){var t=this._profile.getValue(e);if(!t)return 0;try{t=parseInt(t),isNaN(t)&&(t=0)}catch(i){t=0}return t}});var a = [];var i='listenerinteractiontype';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : blueConic.fn.getBCHostnameAwarePluginsRepositoryUrl(ps, pf) + i + '/1.3.4/'}]);})();})(blueConicClient);