window.lpTag=window.lpTag||{};lpTag.taglets=lpTag.taglets||{};lpTag.agentSDK=lpTag.agentSDK||function(){function a(a){p=j();k(a&&a.notificationCallback,v.notify);k(a&&a.visitorFocusedCallback,v.visitorFocused);k(a&&a.visitorBlurredCallback,v.visitorBlurred);if(p)try{p.command({appName:s.manager,cmdName:t.initialize,data:{}})}catch(b){n("Error initializing communication. The error: "+b)}}function b(){if(p&&p.dispose)try{p.dispose()}catch(a){n("Error disposing of the courier. The error: "+a)}p=null}function c(a,b,c){var d=l(b,"'get' success",!0),e=l(c,"'get' error",!0);if(p&&a){o('Calling "get" on the following key: '+a);try{p.request({appName:s.manager,reqName:u.get,data:{key:a}},function(a,b){e(a);d(b)})}catch(f){n('Error calling "get" on the following key: '+a+". The error: "+f);e(f)}}else{var g;p?a||(g='No key provided when calling "get"'):g='No channel defined when calling "get". Maybe you are missing a call to "init"?';if(g){n(g);e(g)}}}function d(a,b,c){var d=l(b,"'bind' valueUpdateCallback"),e=l(c,"'bind' notifyWhenDoneCallback");if(p&&a){o('Calling "bind" on the following key: '+a);try{p.bind({appName:s.manager,eventName:a,func:d});p.command({appName:s.manager,cmdName:t.bind,data:{key:a}},e)}catch(f){n('Error calling "bind" on the following key: '+a+". The error: "+f);e(f)}}else{var g;p?a||(g='No key provided when calling "bind"'):g='No channel defined when calling "bind". Maybe you are missing a call to "init"?';if(g){n(g);e(g)}}}function e(a,b,c){var d=l(b,"'bind' valueUpdateCallback"),e=l(c,"'bind' notifyWhenDoneCallback");if(p&&a){o('Calling "unbind" on the following key: '+a);try{p.unbind({appName:s.manager,eventName:a,func:d});p.command({appName:s.manager,cmdName:t.unbind,data:{key:a}},e)}catch(f){n('Error calling "unbind" on the following key: '+a+". The error: "+f);e(f)}}else{var g;p?a||(g='No key provided when calling "unbind"'):g='No channel defined when calling "unbind". Maybe you are missing a call to "init"?';if(g){n(g);e(g)}}}function f(a,b,c){var d=l(c,"'command' notifyWhenDoneCallback");if(p&&a){o('Calling "command" with the following cmdName: '+a);try{p.command({appName:s.manager,cmdName:a,data:b},d)}catch(e){n('Error calling "command" with the following cmdName: '+a+". The error: "+e);d(e)}}else{var f;p?a||(f='No cmdName provided when calling "command"'):f='No channel defined when calling "command". Maybe you are missing a call to "init"?';if(f){n(f);d(f)}}}function g(a){k(a,v.notify)}function h(a){k(a,v.visitorFocused)}function i(a){k(a,v.visitorBlurred)}function j(){if(lpTag.Chronos.PostMessageCourier){o("Creating an instance of the courier");try{return new lpTag.Chronos.PostMessageCourier}catch(a){n("Error creating instance of courier")}}return void 0}function k(a,b){if(a&&p&&b){o("binding on "+b);try{p.bind({appName:s.events,eventName:b,func:l(a,b+" event")})}catch(c){n("Error binding on "+b+". The error: "+JSON.stringify(c))}}else p||n("No channel defined when binding on "+b+'. Maybe you are missing a call to "init"?')}function l(a,b,c){return function(d){if(a&&(d||!c))try{a.call(this,d)}catch(e){n("Callback provided for "+b+" encountered an error. The error: "+JSON.stringify(e)+" . The callback data: "+JSON.stringify(d))}}}function m(a,b){window.lpTag&&lpTag.log&&lpTag.log(a,b,q)}function n(a){m(a,"ERROR")}function o(a){m(a,"INFO")}var p,q="agentSDK",r="1.0.1",s={manager:"iFrame manager",events:"iFrame events"},t={bind:"Bind",unbind:"Unbind",write:"Write ChatLine",initialize:"Initialize"},u={get:"Get"},v={notify:"Notify",visitorFocused:"Visitor Focused",visitorBlurred:"Visitor Blurred"};return{v:r,name:q,init:a,get:c,bind:d,unbind:e,command:f,dispose:b,onNotify:g,onVisitorFocused:h,onVisitorBlurred:i,appNames:s,eventNames:v,cmdNames:t,reqNames:u}}();!function(a,b){"use strict";if("function"==typeof define&&define.amd)define("Chronos.EventsUtil",[],function(){return b(a,a,!0)});else if("object"==typeof exports)b(a,exports);else{a.Chronos=a.Chronos||{};b(a,a.Chronos)}}("undefined"==typeof window.lpTag?this:window.lpTag,function(a,b,c){"use strict";function d(a,b,c){var d=[];if(a[b]&&a[b].length)for(var e=0;e0){a.index>=a.eventBufferLimit&&(a.index=0);a.fired[a.index]=b;a.index++}else a.fired.push(b);a=null}}function j(a,b){var c=!1;if(!b){e("Ev listen id not spec for unregister","ERROR","Events");return null}for(var d in a)if(a.hasOwnProperty(d))for(var f=0;f0)for(var g=0;g0}function h(a,b,d){return function(){try{a.func.call(a.context,b,d);b=null;a.triggerOnce&&e(a);a=null}catch(f){c.log("Error executing "+d.eventName+" eventId: "+a.id+"e="+f.message,"ERROR","Events")}}}function i(a){c.storeEventData({triggerData:a,eventBufferLimit:k,attrName:n,fired:q,index:s})}var j,k,l,m="Events",n="eventName",o=0,p={},q=[],r="evId_",s=0;l=a&&a.appName||"*";j=a&&"boolean"==typeof a.cloneEventData?a.cloneEventData:!1;k=a&&!isNaN(a.eventBufferLimit)?a.eventBufferLimit:-1;this.once=b;this.hasFired=f;this.trigger=g;this.publish=g;this.bind=d;this.register=d;this.unbind=e;this.unregister=e}d||(b.Events=b.Events||e);return e});!function(a,b){"use strict";if("function"==typeof define&&define.amd)define("Chronos.CommandsUtil",["Chronos.EventsUtil"],function(c){return b(a,a,c,!0)});else if("object"==typeof exports)b(a,exports,require("util/EventsUtil").EventsUtil);else{a.Chronos=a.Chronos||{};b(a,a.Chronos,a.Chronos.EventsUtil)}}("undefined"==typeof window.lpTag?this:window.lpTag,function(a,b,c,d){"use strict";function e(a){var b=a.cmd[a.attrName];if(!b||!a.cmd.func||"function"!=typeof a.cmd.func||!f(a.cmd,b)){c.log("comply: has invalid params: command=["+b+"]","ERROR",a.loggerName);return null}if(a.lstnrs[b]&&a.lstnrs[b].length){c.log("comply: cannot comply because command already exist command="+b,"ERROR",a.loggerName);return null}var d=a.prefix+a.id++,e={id:d,func:a.cmd.func,context:a.cmd.context||null,appName:a.cmd.appName};a.lstnrs[b]=a.lstnrs[b]||[];a.lstnrs[b].push(e);c.log("Cmd comply: evName=["+b+"] appName="+e.appName,"DEBUG",a.loggerName);return d}function f(a,b){return!(b&&"*"===b||a.appName&&"*"===a.appName)}var g={bind:e,valid:f};d||(b.CommandsUtil=b.CommandsUtil||g);return g});!function(a,b){"use strict";if("function"==typeof define&&define.amd)define("Chronos.Commands",["Chronos.EventsUtil","Chronos.CommandsUtil"],function(c,d){return b(a,a,c,d,!0)});else if("object"==typeof exports)b(a,exports,require("util/EventsUtil").EventsUtil,require("util/CommandsUtil").CommandsUtil);else{a.Chronos=a.Chronos||{};b(a,a.Chronos,a.Chronos.EventsUtil,a.Chronos.CommandsUtil)}}("undefined"==typeof window.lpTag?this:window.lpTag,function(a,b,c,d,e){"use strict";function f(a){function b(a){"*"!==k&&(a.appName=a.appName||k);return d.bind({cmd:a,attrName:m,loggerName:l,prefix:q,id:n,lstnrs:o})}function e(a){"*"!==k&&(a.appName=a.appName||k);return c.unbind({unbindObj:a,attrName:m,loggerName:l,lstnrs:o})}function f(a,b){if("undefined"==typeof b){b=a;a=k}return c.hasFired(p,a,b)}function g(a,b){if(!a||"undefined"==typeof a.cmdName||!d.valid(a,a.cmdName)){c.log("CMD name not spec for command","ERROR","Commands");return null}"*"!==k&&(a.appName=a.appName||k);a.passDataByRef=a.passDataByRef||!i;h(a);if(!o[a.cmdName])return!1;var e=c.getListeners(o,a.cmdName,a.appName);if(e.length>0)for(var f=0;f0}function h(a){c.storeEventData({triggerData:a,eventBufferLimit:j,attrName:m,fired:p,index:r})}var i,j,k,l="Commands",m="cmdName",n=0,o={},p=[],q="cmdId_",r=0;k=a&&a.appName||"*";i=a&&"boolean"==typeof a.cloneEventData?a.cloneEventData:!1;j=a&&!isNaN(a.eventBufferLimit)?a.eventBufferLimit:-1;this.hasFired=f;this.comply=b;this.stopComplying=e;this.command=g}e||(b.Commands=b.Commands||f);return f});!function(a,b){"use strict";if("function"==typeof define&&define.amd)define("Chronos.Reqres",["Chronos.EventsUtil","Chronos.CommandsUtil"],function(c,d){return b(a,a,c,d,!0)});else if("object"==typeof exports)b(a,exports,require("util/EventsUtil").EventsUtil,require("util/CommandsUtil").CommandsUtil);else{a.Chronos=a.Chronos||{};b(a,a.Chronos,a.Chronos.EventsUtil,a.Chronos.CommandsUtil)}}("undefined"==typeof window.lpTag?this:window.lpTag,function(a,b,c,d,e){function f(a){function b(a){"*"!==k&&(a.appName=a.appName||k);return d.bind({cmd:a,attrName:m,loggerName:l,prefix:q,id:n,lstnrs:o})}function e(a){"*"!==k&&(a.appName=a.appName||k);return c.unbind({unbindObj:a,attrName:m,loggerName:l,lstnrs:o})}function f(a,b){if("undefined"==typeof b){b=a;a=k}return c.hasFired(p,a,b)}function g(a,b){var e;if(!a||"undefined"==typeof a.reqName||!d.valid(a,a.reqName)){c.log("request: name not spec for command","ERROR","ReqRes");throw new Error("Invalid request object")}"*"!==k&&(a.appName=a.appName||k);a.passDataByRef=a.passDataByRef||!i;h(a);if(!o[a.reqName])return e;var f=c.getListeners(o,a.reqName,a.appName);if(f.length>0)for(var g=0;g0?c:1)*100;return{total:c,error:d,percent:b}}function j(){this.timer&&clearTimeout(this.timer);n.call(this);if(this.bucketIndex>this.bucketsNumber){this.bucketIndex=0;h.call(this)&&(this.state=d.HALF_OPEN)}this.timer=setTimeout(j.bind(this),this.bucket)}function k(){this.bucketIndex=0;this.bucket=this.slidingTimeWindow/this.bucketsNumber;this.timer&&clearTimeout(this.timer);this.timer=setTimeout(j.bind(this),this.bucket)}function l(){var a={};a[e.FAILURE]=0;a[e.SUCCESS]=0;a[e.TIMEOUT]=0;a[e.OUTAGE]=0;return a}function m(){return this.buckets[this.buckets.length-1]}function n(){this.bucketIndex++;this.buckets.push(l.call(this));this.buckets.length>this.bucketsNumber&&this.buckets.shift()}function o(a,b){return function(){if(!b.done){if(b.timer){clearTimeout(b.timer);b.timer=null;delete b.timer}var c=m.call(this);c[a]++;this.forced||r.call(this);b.done=!0}}.bind(this)}function p(a,b){var c={done:!1},d=o.call(this,e.SUCCESS,c),f=o.call(this,e.FAILURE,c),g=o.call(this,e.TIMEOUT,c);b=!isNaN(b)&&b>0?parseInt(b,10):this.timeout;b>0&&(c.timer=setTimeout(g,b));try{a(d,f,g)}catch(h){f()}}function q(a){try{a()}catch(b){}var c=m.call(this);c[e.OUTAGE]++}function r(){var a=i.call(this);if(d.HALF_OPEN===this.state){var b=!m.call(this)[e.SUCCESS]&&0this.tolerance,f=a.total>this.calibration,g=f&&c;if(g){this.state=d.OPEN;this.onopen(a)}}}return{initialize:a,run:b,close:f,open:c,reset:g,isOpen:h,calculate:i}}();b.STATE=d;Function.prototype.bind||(Function.prototype.bind=c);a.CircuitBreaker=a.CircuitBreaker||b});!function(a,b){"use strict";"function"==typeof define&&define.amd?define("cacher",["exports"],function(){a.Cacher||b(a);return a.Cacher}):b("object"==typeof exports?exports:a)}("undefined"==typeof window.lpTag?this:window.lpTag,function(a){"use strict";function b(a){if(!1==this instanceof b)return new b(a);this.initialize(a);return void 0}b.prototype=function(){function a(a){function b(a,b){d.nostore=!0;c.call(d,b.key,b.value,b.ttl);delete d.nostore}var d=this,e=!1,f=0;if(!this.initialized){a=a||{};this.cache={};this.length=0;this.max=!isNaN(a.max)&&00?parseInt(a,10):b}function h(a,b){return"function"==typeof a?a:!0===b?function(){}:b}function i(a,b,c){var d,e,f,g=new RegExp(/(http{1}s{0,1}?:\/\/)([^\/\?]+)(\/?)/gi);if(!a||0!==a.indexOf("http")){f=c?b.top||b.contentWindow&&b.contentWindow.parent||window:b;return f.location.protocol+"//"+f.location.host}d=g.exec(a);d&&3<=d.length&&""!==d[2]&&(e=d[1].toLowerCase()+d[2].toLowerCase());return e}function j(a,b){var c,d,e;try{d=a&&a.contentWindow&&"undefined"!=typeof Window&&!(a instanceof Window)&&a.getAttribute&&a.getAttribute("src")}catch(f){}try{if(!d){d=k("lpHost");if(!d){e=k("hostParam");e&&(d=k(e))}}d||(d=document.referrer);d&&(d=decodeURIComponent(d));c=i(d,a,b)}catch(f){p("Cannot parse origin","ERROR","PostMessageUtilities")}return c||"*"}function k(a){return decodeURIComponent((new RegExp("[?|&]"+a+"=([^&;]+?)(&|#|;|$)").exec(document.location.search)||[void 0,""])[1].replace(/\+/g,"%20"))||null}function l(a,b){var c;"undefined"!=typeof setImmediate&&(isNaN(b)||0>=b)?c=setImmediate(a):!1===b?a():c=setTimeout(a,isNaN(b)||0>=b?0:parseInt(b,10));return function(){m(c)}}function m(a){var b=g(a);b&&("undefined"!=typeof clearImmediate?clearImmediate(b):clearTimeout(b))}function n(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c);return function(){o(a,b,c)}}function o(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c)}function p(b,c,d){a&&"function"==typeof a.log&&a.log(b,c,d)}function q(a){function b(){}function c(){return e.apply(this instanceof b&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}var d,e;if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");d=Array.prototype.slice.call(arguments,1);e=this;b.prototype=this.prototype;c.prototype=new b;return c}var r="_xxxxxx-4xxx-yxxx";Function.prototype.bind||(Function.prototype.bind=q);var s={SEQUENCE_FORMAT:r,stringify:d,hasPostMessageObjectsSupport:e,createUniqueSequence:f,parseNumber:g,parseFunction:h,getHost:i,resolveOrigin:j,getURLParameter:k,delay:l,addEventListener:n,removeEventListener:o,log:p,bind:q};c||(b.PostMessageUtilities=b.PostMessageUtilities||s);return s});!function(a,b,c){"use strict";if("function"==typeof define&&define.amd)define("Chronos.PostMessageChannelPolyfill",["Chronos.PostMessageUtilities"],function(d){return c(a,b,d,!0)});else if("object"!=typeof exports){b.Chronos=b.Chronos||{};c(a,b.Chronos,b.Chronos.PostMessageUtilities)}}(this,"undefined"==typeof window.lpTag?this:window.lpTag,function(a,b,c,d){"use strict";function e(a,b){if(!1==this instanceof e)return new e(a,b);this.initialize(a,b);return void 0}var f="LPPort_";e.prototype=function(){function b(b,d){if(!this.initialized){d=d||{};this.target=b||a.top;this.hosted=this.target===a||this.target===a.top;this.portId=c.createUniqueSequence(f+c.SEQUENCE_FORMAT);this.serialize=c.parseFunction(d.serialize,c.stringify);this.deserialize=c.parseFunction(d.deserialize,JSON.parse);this.initialized=!0}}function d(a){var b,d,e=g.call(this),f=this.target;if(a)try{this.hosted||(f=this.target.contentWindow);b=h.call(this,a);d=this.serialize(b);f.postMessage(d,e)}catch(i){c.log("Error while trying to post the message","ERROR","PostMessageChannelPolyfill");return!1}}function e(a){var b;if("function"==typeof this.onmessage){b=i.call(this,a);return this.onmessage(b)}}function g(){this.origin||(this.origin=c.resolveOrigin(this.target));return this.origin}function h(a){return{port:this.portId,message:a}}function i(a){var b;if(a&&a.data)try{b=this.deserialize(a.data);if(b.port&&0===b.port.indexOf(f))return{origin:a.origin,data:b.message}}catch(d){c.log("Error while trying to deserialize the message","ERROR","PostMessageChannelPolyfill")}return b||a}return{initialize:b,postMessage:d,receive:e}}();d||(b.PostMessageChannelPolyfill=b.PostMessageChannelPolyfill||e);return e});!function(a,b,c){"use strict";if("function"==typeof define&&define.amd)define("Chronos.PostMessageChannel",["Chronos.PostMessageUtilities","Chronos.PostMessageChannelPolyfill"],function(d,e){return c(a,b,d,e,!0)});else if("object"!=typeof exports){b.Chronos=b.Chronos||{};c(a,b.Chronos,b.Chronos.PostMessageUtilities,b.Chronos.PostMessageChannelPolyfill)}}(this,"undefined"==typeof window.lpTag?this:window.lpTag,function(a,b,c,d,e){"use strict";function f(a,b){if(!1==this instanceof f)return new f(a,b);this.initialize(a,b);return void 0}var g="LPFRM",h="LPTKN",i="HNDSK",j=100,k=5e3,l=3,m=100;f.prototype=function(){function b(b,e){var f,g;if(!this.initialized){this.hosted=!1;this.messageQueue=[];b=b||{};g=r.call(this,b,e);if(!C.call(this)){this.receiver=new d(this.target,{serialize:this.serialize,deserialize:this.deserialize});this.receiver.onmessage=g}if(this.hosted||!C.call(this)){f=t(g).bind(this);this.removeListener=c.addEventListener(a,"message",f)}else C.call(this)&&this.channelFactory();!this.target||this.loading||this.ready||q.call(this,g,f);this.initialized=!0}}function e(a,b){var d=c.parseFunction(this[a]);if(d){b||d.call(this);this[a]=void 0;delete this[a]}}function f(a){e.call(this,"rmtimer",a)}function n(a){e.call(this,"rmload",a)}function o(){if(!this.disposed){if(this.removeListener){this.removeListener.call(this);this.removeListener=void 0}if(this.targetUrl&&this.target||this.removeDispose)try{this.targetContainer?this.targetContainer.removeChild(this.target):document.body.removeChild(this.target)}catch(a){c.log("Error while trying to remove the iframe from the container","ERROR","PostMessageChannel")}f.call(this);n.call(this);this.messageQueue.length=0;this.messageQueue=void 0;this.channel=void 0;this.onready=void 0;this.disposed=!0}}function p(a,b,d){var e,f;if(!this.disposed)try{if(a){if(this.ready||d){e=b||this.receiver;f=u.call(this,a);e.postMessage(f);return!0}if(this.maxConcurrency>=this.messageQueue.length){this.messageQueue.push(a);return!0}return!1}}catch(g){c.log("Error while trying to post the message","ERROR","PostMessageChannel");return!1}}function q(b,e){var f;try{f=D.call(this)}catch(g){f=!1}if(!f){this.channel=!1;this.receiver=new d(this.target,{serialize:this.serialize,deserialize:this.deserialize});this.receiver.onmessage=b;if(!this.hosted){e=t(b).bind(this);this.removeListener=c.addEventListener(a,"message",e)}D.call(this)}this.handshakeAttempts--;c.delay(function(){if(!this.disposed&&!this.hosted&&!this.ready){this.rmload=H.call(this,this.target);this.rmtimer=c.delay(D.bind(this,this.handshakeInterval),this.handshakeInterval)}}.bind(this))}function r(b,d){var e;s.call(this,b);e=B(d).bind(this);this.channelFactory=w.call(this,e);if(!b.target||(b.target!==a||b.target===a.top)&&"undefined"!=typeof Window&&b.target instanceof Window){this.hosted=!0;this.target=b.target||a.top}else if(b.target.contentWindow)this.target=b.target;else if(b.target.url){this.targetUrl=b.target.url;this.targetOrigin=this.targetOrigin||c.getHost(b.target.url)}this.hosted||(this.token=c.createUniqueSequence(h+c.SEQUENCE_FORMAT));if(this.targetUrl){this.loading=!0;this.targetContainer=b.target.container||document.body;this.target=G.call(this,b.target,this.targetContainer)}return e}function s(a){this.serialize=c.parseFunction(a.serialize,c.stringify);this.deserialize=c.parseFunction(a.deserialize,JSON.parse);this.targetOrigin=a.targetOrigin;this.maxConcurrency=c.parseNumber(a.maxConcurrency,j);this.handshakeInterval=c.parseNumber(a.handshakeInterval,k);this.handshakeAttempts=c.parseNumber(a.handshakeAttempts,l);this.hostParam=a.hostParam;this.channel="undefined"!=typeof a.channel?a.channel:v();this.useObjects=a.useObjects;this.onready=A(a.onready,a.target).bind(this);this.removeDispose=a.removeDispose}function t(a){return function(b){var d,e;if(b.ports&&00&&(rec_widget.agentIntroduced=!0),e[t].text.indexOf("js-hook_email")>0&&(rec_widget.emailSent=!0);rec_widget.agentIntroduced||lpTag.agentSDK.get("agentInfo",rec_widget.introAgent,rec_widget.onError),rec_widget.emailSent||lpTag.agentSDK.get("surveyQuestions",rec_widget.setEmail,rec_widget.onError)},introAgent:function(e){""!==rec_widget.email&&generic.jsonrpc.fetch({method:"liveperson.agent",params:[{REP_ID:e.agentId}],onSuccess:function(t){var n=t.getValue();if(n){i=n.NICKNAME.toUpperCase();var r=n.YEARS_WITH_ELC?"

"+n.YEARS_WITH_ELC+"

":"",a=n.FAVORITE_TIP?"

"+n.FAVORITE_TIP+"

":"",o=n.FAVORITE_PRODUCTS?"

"+n.FAVORITE_PRODUCTS+"

":"";lpTag.agentSDK.command(lpTag.agentSDK.cmdNames.write,{text:'

'+i+"

"+r+a+o},rec_widget.notifyWhenDone)}else{var i=e.agentNickname;lpTag.agentSDK.command(lpTag.agentSDK.cmdNames.write,{text:'

'+i+"

"},rec_widget.notifyWhenDone)}},onFailure:function(e){console.log("error getting agent info: ",e.getValue())}})},setEmail:function(e){rec_widget.email=e.preChat.email.value},onError:function(e){},getUrlParameter:function(e){var t,n,r=decodeURIComponent(window.location.search.substring(1)).split("&");for(n=0;n'+o+" "+i+""},rec_widget.notifyWhenDone),setTimeout((function(){e(".loading-status").remove(),e(".add-to-cart[data-skubaseid="+n+"]").show()}),2e3)},onFailure:function(e){}})},e("body").addClass("lp_agent_widget")}}(jQuery); ;