/*! For license information please see lhn-jssdk-current.min.js.LICENSE.txt */ (function(){var __webpack_exports__={};function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return e};var e={},n=Object.prototype,t=n.hasOwnProperty,a=Object.defineProperty||function(e,n,t){e[n]=t.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",o=l.asyncIterator||"@@asyncIterator",i=l.toStringTag||"@@toStringTag";function r(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{r({},"")}catch(e){r=function(e,n,t){return e[n]=t}}function h(e,n,t,l){var s=n&&n.prototype instanceof u?n:u,o=Object.create(s.prototype),i=new Q(l||[]);return a(o,"_invoke",{value:S(e,t,i)}),o}function c(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=h;var d={};function u(){}function p(){}function m(){}var y={};r(y,s,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(J([])));g&&g!==n&&t.call(g,s)&&(y=g);var f=m.prototype=u.prototype=Object.create(y);function k(e){["next","throw","return"].forEach((function(n){r(e,n,(function(e){return this._invoke(n,e)}))}))}function C(e,n){function l(a,s,o,i){var r=c(e[a],e,s);if("throw"!==r.type){var h=r.arg,d=h.value;return d&&"object"==_typeof(d)&&t.call(d,"__await")?n.resolve(d.__await).then((function(e){l("next",e,o,i)}),(function(e){l("throw",e,o,i)})):n.resolve(d).then((function(e){h.value=e,o(h)}),(function(e){return l("throw",e,o,i)}))}i(r.arg)}var s;a(this,"_invoke",{value:function(e,t){function a(){return new n((function(n,a){l(e,t,n,a)}))}return s=s?s.then(a,a):a()}})}function S(e,n,t){var a="suspendedStart";return function(l,s){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===l)throw s;return x()}for(t.method=l,t.arg=s;;){var o=t.delegate;if(o){var i=_(o,t);if(i){if(i===d)continue;return i}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===a)throw a="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);a="executing";var r=c(e,n,t);if("normal"===r.type){if(a=t.done?"completed":"suspendedYield",r.arg===d)continue;return{value:r.arg,done:t.done}}"throw"===r.type&&(a="completed",t.method="throw",t.arg=r.arg)}}}function _(e,n){var t=n.method,a=e.iterator[t];if(void 0===a)return n.delegate=null,"throw"===t&&e.iterator.return&&(n.method="return",n.arg=void 0,_(e,n),"throw"===n.method)||"return"!==t&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+t+"' method")),d;var l=c(a,e.iterator,n.arg);if("throw"===l.type)return n.method="throw",n.arg=l.arg,n.delegate=null,d;var s=l.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,d):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function b(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function w(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function Q(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function J(e){if(e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,l=function n(){for(;++a=0;--l){var s=this.tryEntries[l],o=s.completion;if("root"===s.tryLoc)return a("end");if(s.tryLoc<=this.prev){var i=t.call(s,"catchLoc"),r=t.call(s,"finallyLoc");if(i&&r){if(this.prev=0;--a){var l=this.tryEntries[a];if(l.tryLoc<=this.prev&&t.call(l,"finallyLoc")&&this.prev=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),w(t),d}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var a=t.completion;if("throw"===a.type){var l=a.arg;w(t)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:J(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=void 0),d}},e}function asyncGeneratorStep(e,n,t,a,l,s,o){try{var i=e[s](o),r=i.value}catch(e){return void t(e)}i.done?n(r):Promise.resolve(r).then(a,l)}function _asyncToGenerator(e){return function(){var n=this,t=arguments;return new Promise((function(a,l){var s=e.apply(n,t);function o(e){asyncGeneratorStep(s,a,l,o,i,"next",e)}function i(e){asyncGeneratorStep(s,a,l,o,i,"throw",e)}o(void 0)}))}}function _slicedToArray(e,n){return _arrayWithHoles(e)||_iterableToArrayLimit(e,n)||_unsupportedIterableToArray(e,n)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,n){if(e){if("string"==typeof e)return _arrayLikeToArray(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,a=new Array(n);t0&&"help.livehelpnow.net"!=s)?(kbdata=t.split("|&|"),"lhnkb"==kbdata[kbdata.length-1]?(cookie_found=!0,kbdata.pop(),t=kbdata.join("|&|")):t=null):"exact"==lhnJsSdk.options.domain_policy?(exactdata=t.split("|&|"),"exact"==exactdata[exactdata.length-1]?(cookie_found=!0,exactdata.pop(),t=exactdata.join("|&|")):t=null):(1===s.split(".").length||isValidIp(s)||"true"==qs("lhn_preview")||"strict"==lhnJsSdk.options.domain_policy)&&(strictdata=t.split("|&|"),"strict"==strictdata[strictdata.length-1]?(cookie_found=!0,strictdata.pop(),t=strictdata.join("|&|")):t=null)}}return 0==cookie_found&&(cookie_info=window.localStorage.getItem(e),cookie_info?(cookie_info=cookie_info.split("; "),t=cookie_info[0],expires=cookie_info[1]||"",expires=expires.replace("expires=",""),new Date>new Date(expires)&&(t=null,window.localStorage.removeItem(e))):t=null),t},setData:function(e,n,t){void 0===t&&(t=86400);var a=new Date;a.setTime(a.getTime()+1e3*t);var l="; expires="+a.toGMTString();if("cookie"!=lhnStorage.type||lhnJsSdk.options.disableCookies)n+=l,window.localStorage.setItem(e,n);else{var s=location.host;if(s=s.split(":")[0],lhn_secure="https:"==location.protocol?";secure;samesite=none":"","lhnkb"==lhnJsSdk.options.domain_policy)kbdata=n+"|&|lhnkb","kb.livehelpnow.net"==s?(path="/"+document.location.pathname.split("/")[1]+"/;",document.cookie=e+"="+kbdata+l+"; path="+path+"domain="+s+lhn_secure):s.indexOf("livehelpnow.net")>0&&"help.livehelpnow.net"!=s?document.cookie=e+"="+kbdata+l+"; path=/;domain="+s+lhn_secure:(lhnJsSdk.options.domain_policy="",lhnStorage.setData(e,n,t));else if("exact"==lhnJsSdk.options.domain_policy)exactdata=n+"|&|exact",document.cookie=e+"="+exactdata+l+"; path="+document.location.pathname+lhn_secure;else if(1===s.split(".").length||isValidIp(s)||"true"==qs("lhn_preview")||"strict"==lhnJsSdk.options.domain_policy)strictdata=n+"|&|strict",document.cookie=e+"="+strictdata+l+"; path=/"+lhn_secure;else{var o=s.split(".");o.shift();var i="."+o.join(".");i=i.split(":")[0],document.cookie=e+"="+n+l+"; path=/; domain="+i+lhn_secure,null!=lhnStorage.getData(e)&&lhnStorage.getData(e)==n||(i="."+s,document.cookie=e+"="+n+l+"; path=/; domain="+i+lhn_secure)}n+=l,window.localStorage.setItem(e,n)}},removeData:function(e){var n=location.host;if(n=n.split(":")[0],"exact"==lhnJsSdk.options.domain_policy)document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path="+document.location.pathname+";";else if(1===n.split(".").length||isValidIp(n)||"true"==qs("lhn_preview")||"strict"==lhnJsSdk.options.domain_policy)document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/;";else{var t=n.split(".");t.shift();var a="."+t.join(".");a=a.split(":")[0],document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; domain="+a}window.localStorage.removeItem(e)}};ga_local._trackgtm=function(e,n,t){"object"==("undefined"==typeof dataLayer?"undefined":_typeof(dataLayer))&&"function"==typeof dataLayer.push&&dataLayer.push({event:"LiveHelpNow",eventCategory:"LiveHelpNow",eventAction:e,eventLabel:n,eventNonInteraction:t})},ga_local._trackgaq=function(e,n,t){"object"==("undefined"==typeof _gaq?"undefined":_typeof(_gaq))&&_gaq.push(["_trackEvent","LiveHelpNow",e,n,null,t])},ga_local._trackga=function(e,n,t){var a=window.GoogleAnalyticsObject||"ga";if("function"==typeof window[a]&&"function"==typeof window[a].getAll){var l=window[a].getAll(),s=l[0].get&&l[0].get("name");_sendToGaTracker(e,n,t,a,s)}else"function"==typeof window[a]&&function(){var e=!1;return window[a]((function(n){"object"==_typeof(n)&&(e=!0)})),e}()&&_sendToGaTracker(e,n,t,a)},ga_local._trackgtag=function(e,n,t){"function"==typeof gtag&&"object"==("undefined"==typeof dataLayer?"undefined":_typeof(dataLayer))&&"function"==typeof dataLayer.push&>ag("event",e,{event_category:"LiveHelpNow",event_label:n,non_interaction:t})},lhnJsSdk.init=init,lhnJsSdk.log=log,lhnJsSdk.openHOC=openHOC,lhnJsSdk.closeHOC=closeHOC,lhnJsSdk.isOnline=isOnline,lhnJsSdk.showInvite=showInvite,lhnJsSdk.embedChatButton=embedChatButton,lhnJsSdk.embedChat=embedPreChat,lhnJsSdk.embedSurvey=embedSurvey,lhnJsSdk.embedKbLookup=embedKbLookup,lhnJsSdk.embedKbArticle=embedKbArticle,lhnJsSdk.wireKbLookup=wireKbLookup,lhnJsSdk.embedTicket=embedTicket,lhnJsSdk.embedCallback=embedCallback,lhnJsSdk.externalPage=externalPage,lhnJsSdk.externalPageOpen=externalPageOpen,lhnJsSdk.externalPageClose=externalPageClose,lhnJsSdk.endChat=endChat,lhnJsSdk.setGaType=setGaType,lhnJsSdk.getGaType=getGaType,lhnJsSdk.doGaTrack=doGaTrack,lhnJsSdk.lhnsocket=lhnsocket,lhnJsSdk.track_conversion=track_conversion,lhnJsSdk.refresh=refresh,lhnJsSdk.refresh_visitor=refresh_visitor,lhnJsSdk.refresh_dictionary=refresh_dictionary,lhnJsSdk.lhnStorage=lhnStorage,lhnJsSdk.updateVisitorOptions=updateVisitorOptions}function generateTabId(){return Math.floor(Math.random()*Date.now())}function init(){if(!window.lhnJsSdkLoaded){window.lhnJsSdkLoaded=!0;var e=navigator.userAgent;re.test(e)?lhnJsSdk.log("crawler","the user agent is a crawler! - "+e):(window.lhnJsSdkInit(),detectGaType(),void 0===lhnJsSdk.options&&(lhnJsSdk.options={}),lhnJsSdk.options.tracking=void 0===lhnJsSdk.options.tracking||lhnJsSdk.options.tracking,lhnJsSdk.options.disableCookies=void 0!==lhnJsSdk.options.disableCookies&&lhnJsSdk.options.disableCookies,function(e,n,t,a){var l=e.getElementsByTagName("head")[0],s=e.createElement("script");s.src=a;var o=!1;if(s.onload=s.onreadystatechange=function(){o||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(o=!0,s.onload=s.onreadystatechange=null,l&&s.parentNode&&l.removeChild(s),jQuery="undefined"!=typeof jQuery?jQuery:lhnQuery,navigator.appVersion.indexOf("MSIE 8.")>0&&function(e,n,t,a){var l=e.getElementsByTagName("head")[0],s=e.createElement("script");s.type="text/javascript",s.src=a,l.appendChild(s)}(document,0,0,appurl+"/js/es5-shim.min.js"),(navigator.appVersion.indexOf("MSIE ")>0||window.MSInputMethodContext&&document.documentMode)&&function(e,n,t,a){var l=e.getElementsByTagName("head")[0],s=e.createElement("script");s.type="text/javascript",s.src="https://cdn.livehelpnow.net/assets/js/bluebird/bluebird.min.js",l.appendChild(s)}(document),lhnQuery.fn.serializeObject=function(e){if(null==(e=void 0===e&&null!=e?0:e))var n={};else n={view_id:e};var t=this.serializeArray();return lhnQuery.each(t,(function(){this.value=html2text(this.value),void 0!==n[this.name]?(n[this.name].push||(n[this.name]=[n[this.name]]),n[this.name].push(lhnQuery.trim(this.value)||"")):n[this.name]=lhnQuery.trim(this.value)||""})),n},lhnStorage.checkType(),lhnStorage.getData("lhnJWT")&&void 0!==JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1]))&&"true"!=qs("lhn_preview")?(visitorValidated=!0,setup()):connectOAuth())},l.appendChild(s),void 0===i&&window.addEventListener){var i="",r=!1,h="";h=-1!=(navigator.userAgent.indexOf("Opera")||navigator.userAgent.indexOf("OPR"))?"Opera":-1!=navigator.userAgent.indexOf("Chrome")?"Chrome":-1!=navigator.userAgent.indexOf("Safari")?"Safari":-1!=navigator.userAgent.indexOf("Firefox")?"Firefox":-1!=navigator.userAgent.indexOf("MSIE")||1==!!document.documentMode?"Internet Explorer":navigator.userAgent,window.addEventListener("error",(function(e){e.target.src&&e.type?i+=e.type+" loading "+e.target.localName+" "+e.target.src+" | ":e.message&&(1==r?lhnSendError(e.message+" line:"+e.lineno+" column:"+e.colno,h):i+=e.message+" line:"+e.lineno+" column:"+e.colno+" | ")}),!0),window.setTimeout((function(){lhnSendError(i,h),r=!0}),8e3)}}(document,0,0,appurl+"/js/lhn-jquery-3.5.1.min.js"))}}function connectOAuth(){var e=appurl+"/oauth/token/",n={client_id:lhnJsSdk.setup.application_id,client_secret:lhnJsSdk.setup.application_secret,grant_type:"client_credentials"};null!=lhnStorage.getData("lhnContact")&&"null"!=lhnStorage.getData("lhnContact")&&(n.lhncontact=lhnStorage.getData("lhnContact")),ajaxCall(e,n,"GET",connectOAuthCallback)}function connectOAuthCallback(e){visitorValidated=!0,lhnStorage.setData("lhn"+e.token_type,e.access_token,e.expires_in),lhnStorage.setData("lhnRefresh",e.refresh_token,e.refresh_expires_in),setup()}function refreshOAuth(e){var n=appurl+"/oauth/token/",t={client_id:lhnJsSdk.setup.application_id,client_secret:lhnJsSdk.setup.application_secret,grant_type:"client_credentials"};null!=lhnStorage.getData("lhnContact")&&"null"!=lhnStorage.getData("lhnContact")&&(t.lhncontact=lhnStorage.getData("lhnContact")),ajaxCall(n,t,"GET",refreshOAuthCallback,e)}function refreshOAuthCallback(e,n){lhnStorage.setData("lhn"+e.token_type,e.access_token,e.expires_in),lhnStorage.setData("lhnRefresh",e.refresh_token,e.refresh_expires_in),ajaxCall(n.url,n.data,n.type,n.successCallback,n.options)}function visitorSetup(){if(lhnJsSdk.setup.account=JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).iss.client,log("Account #",lhnJsSdk.setup.account),lhnJsSdk.settings=void 0!==lhnJsSdk.settings?lhnJsSdk.settings:{},visitor_tracking=JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).iss.visitor_tracking,visitor_tracking="undefined"==typeof visitor_tracking||visitor_tracking,navigator.javaEnabled()?lhnJsSdk.options.java="Yes":lhnJsSdk.options.java="No",lhnJsSdk.options.res="",lhnJsSdk.options.depth="",window.screen&&(lhnJsSdk.options.res=screen.width+"x"+screen.height,lhnJsSdk.options.depth=screen.colorDepth),lhnJsSdk.options.custom1=void 0===lhnJsSdk.options.custom1?"":lhnJsSdk.options.custom1,lhnJsSdk.options.custom2=void 0===lhnJsSdk.options.custom2?"":lhnJsSdk.options.custom2,lhnJsSdk.options.custom3=void 0===lhnJsSdk.options.custom3?"":lhnJsSdk.options.custom3,lhnJsSdk.options.custom1Label=void 0===lhnJsSdk.options.custom1Label?"":lhnJsSdk.options.custom1Label,lhnJsSdk.options.custom2Label=void 0===lhnJsSdk.options.custom2Label?"":lhnJsSdk.options.custom2Label,lhnJsSdk.options.custom3Label=void 0===lhnJsSdk.options.custom3Label?"":lhnJsSdk.options.custom3Label,lhnJsSdk.options.operator_id=void 0===lhnJsSdk.options.operator_id?0:lhnJsSdk.options.operator_id,lhnJsSdk.options.dept=void 0===lhnJsSdk.options.dept?lhnJsSdk.settings.department:lhnJsSdk.options.dept,lhnJsSdk.options.referrer=document.referrer.length>400?encodeURIComponent(document.referrer.substring(0,400)):encodeURIComponent(document.referrer),lhnJsSdk.options.pagetitle=document.title.length>100?encodeURIComponent(document.title.substring(0,100)):encodeURIComponent(document.title),lhnJsSdk.options.pageurl=encodeURIComponent(document.location).length>500?encodeURIComponent(document.location).substring(0,500):encodeURIComponent(document.location),lhnJsSdk.options.cookie=navigator.cookieEnabled,lhnJsSdk.options.embedArticle=void 0===lhnJsSdk.options.embedArticle||lhnJsSdk.options.embedArticle,lhnJsSdk.options.sound=void 0===lhnJsSdk.options.sound?appurl+"/audio/hoc_alert.wav":lhnJsSdk.options.sound,lhnJsSdk.options.jumplogic=void 0===lhnJsSdk.options.jumplogic?{}:lhnJsSdk.options.jumplogic,lhnJsSdk.options.invite_as_chat=void 0!==lhnJsSdk.options.invite_as_chat&&lhnJsSdk.options.invite_as_chat,lhnJsSdk.options.domain_policy=void 0===lhnJsSdk.options.domain_policy?"unknown":lhnJsSdk.options.domain_policy,lhnJsSdk.options.disableChatInQueue=void 0!==lhnJsSdk.options.disableChatInQueue&&lhnJsSdk.options.disableChatInQueue,lhnJsSdk.options.timeFormat=void 0===lhnJsSdk.options.timeFormat?"12":lhnJsSdk.options.timeFormat,lhnJsSdk.options.invite_type=void 0===lhnJsSdk.options.invite_type?"message":lhnJsSdk.options.invite_type,chatSurveyId=void 0===lhnJsSdk.options.chatSurveyId?chatSurveyId:lhnJsSdk.options.chatSurveyId,0!=lhnJsSdk.options.tracking&&1==visitor_tracking||null!=lhnJsSdk.chatSession){var e={java:lhnJsSdk.options.java,res:lhnJsSdk.options.res,depth:lhnJsSdk.options.depth,custom1:lhnJsSdk.options.custom1,custom2:lhnJsSdk.options.custom2,custom3:lhnJsSdk.options.custom3,custom1Label:lhnJsSdk.options.custom1Label,custom2Label:lhnJsSdk.options.custom2Label,custom3Label:lhnJsSdk.options.custom3Label,operator_id:lhnJsSdk.options.operator_id,dept:lhnJsSdk.options.dept,cookie:lhnJsSdk.options.cookie,referrer:lhnJsSdk.options.referrer,pagetitle:lhnJsSdk.options.pagetitle,pageurl:lhnJsSdk.options.pageurl,chatwindowid:system_windows.chat,utm_source:qs("utm_source"),utm_medium:qs("utm_medium"),utm_campaign:qs("utm_campaign"),utm_term:qs("utm_term"),utm_content:qs("utm_content"),click_id:detectClickId()};ajaxCall(appurl+apiversion+"/visitor/init/",e,"POST",joinVisitorChannel)}else updateOnlineStatus({chat:{online_type:"department",online_status:!0}})}function joinVisitorChannel(data){if(void 0!==data.payload&&void 0!==data.payload.online_status&&(lhnJsSdk.isOnline=data.payload.online_status,updateButtons()),void 0!==data.payload&&void 0!==data.payload.department&&(lhnJsSdk.options.dept=data.payload.department,opImgInChat=data.payload.op_img_in_chat),void 0!==data.payload.jwt&&data.payload.jwt?(lhnStorage.setData("lhnJWT",data.payload.jwt,data.payload.jwt_expire),resource_id=JSON.parse(decodeBase64(data.payload.jwt.split(".")[1])).resource.id,lhnStorage.setData("lhnContact",resource_id,63113904)):(resource_id=JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).resource.id,null!=resource_id&&"null"!=resource_id&&lhnStorage.setData("lhnContact",resource_id,63113904)),void 0!==data.payload.conversions&&data.payload.conversions.length>0)for(var lhnConv=0;lhnConv0)for(var e=0;e0)openHOC("c",{is_lhn_hoc_button:!0});else{if(document.getElementById("Zsmenu")&&(document.getElementById("Zsmenu").style.display="none"),"function"==typeof CustomOpenLHNChat)return CustomOpenLHNChat(),!1;if("undefined"!=typeof lhnWin&&lhnWin&&!lhnWin.closed)return lhnWin.blur(),setTimeout(lhnWin.focus(),10),!1;var n=(screen.width-500-32)/2,t=(screen.height-500-96)/2,a=0==lhnJsSdk.isOnline?"yes":"no";lhnWin=window.open("//www.livehelpnow.net/lhn/livechatvisitor.aspx?zzwindow="+e.win+"&lhnid=1&d="+lhnJsSdk.options.dept,"lhnchat","left="+n+",top="+t+",width=500,height=500,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars="+a+",copyhistory=no,resizable=yes"),"undefined"!=typeof _gaq&&_gaq&&_gaq.push(["_trackEvent","LiveHelpNow","Chat button clicked",""]),"undefined"!=typeof ga&&ga&&ga("send","event","LiveHelpNow","Chat button clicked")}}function hocInit(e){ajaxCall(appurl+apiversion+"/ui/hoc/"+e.id+"/init/",{current_url:document.location.href},"GET",hocSetup,e)}function setHocVersionValues(e,n){"basic"==e||"modern"==e||"sidebar"==e?(hocVersion="v1",hocLayout=e,conversationPartial="conversation",lhnCssPath="modern"):(hocVersion="v2",hocLayout=e,conversationPartial="conversation_v2",lhnCssPath="v2"),"round"==n||"slide"==n||"tab"==n?(lhnButton="button",lhnCssButtonPath="modern"):(lhnButton=n,lhnCssButtonPath="v2")}function hocSetup(e,n){if(null!=_typeof(e.payload)&&void 0!==e.payload.options){var t=void 0===e.payload.options.language?"english":e.payload.options.language;lhnJsSdk.settings={systems:e.payload.options.systems,styles:e.payload.options.styles,poweredby:e.payload.options.poweredby,department:e.payload.options.department,autoinvite:e.payload.options.autoinvite,general:{docWidth:lhnQuery(document).width(),winWidth:window.screen.width,ratio:lhnQuery(document).width()/window.screen.width},button:void 0!==e.payload.options.button?e.payload.options.button:"slide",language:t,file_upload_allowed:void 0!==e.payload.options.file_upload_allowed&&e.payload.options.file_upload_allowed},chatTransport=void 0!==e.payload.options.chat_transport?e.payload.options.chat_transport:chatTransport,lhnJsSdk.settings.styles.layout=void 0===lhnJsSdk.settings.styles.layout?"modern":lhnJsSdk.settings.styles.layout,lhnJsSdk.settings.styles.position=void 0===lhnJsSdk.settings.styles.position?"left":lhnJsSdk.settings.styles.position,lhnJsSdk.settings.styles.button_position=void 0===lhnJsSdk.settings.styles.button_position?"right":lhnJsSdk.settings.styles.button_position,lhnJsSdk.db_dictionary=void 0===e.payload.options.dictionary?{}:e.payload.options.dictionary,lhnJsSdk.settings.styles.custom_css=e.payload.options.custom_css,void 0!==lhnJsSdk.options.autoinvite&&lhnQuery.extend(lhnJsSdk.settings.autoinvite,lhnJsSdk.options.autoinvite),lhnJsSdk.options.invite_type=lhnJsSdk.settings.autoinvite.type,setHocVersionValues(lhnJsSdk.settings.styles.layout,lhnJsSdk.settings.button),buildDictionary(),lhnJsSdk.dict.companyName=null!=lhnJsSdk.dictionary.companyName?lhnJsSdk.dictionary.companyName:e.payload.options.company_name,isMobile()&&"v1"==hocVersion&&(lhnJsSdk.settings.styles.layout="sidebar"),"custom"!=lhnJsSdk.settings.styles.theme&&(s=document,o=appurl+"/css/"+lhnCssPath+"/"+lhnJsSdk.settings.styles.theme+".css?v=1",i=s.getElementsByTagName("head")[0],(r=s.createElement("link")).type="text/css",r.rel="stylesheet",r.href=o,r.crossOrigin="anonymous",i.insertBefore(r,i.firstChild)),1==lhnJsSdk.settings.styles.custom_css&&function(e,n,t,a){var l=e.getElementsByTagName("head")[0],s=e.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=a,s.crossOrigin="anonymous",l.insertBefore(s,l.firstChild)}(document,0,0,appurl+"/hoc/css/custom.css?hoc_id="+n.id),function(e,n,t,a){var l=e.getElementsByTagName("head")[0],s=e.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=a,s.crossOrigin="anonymous",l.insertBefore(s,l.firstChild)}(document,0,0,appurl+"/css/fonts/opensans.css"),function(e,n,t,a){var l=e.getElementsByTagName("head")[0],s=e.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=a,s.crossOrigin="anonymous",l.insertBefore(s,l.firstChild)}(document,0,0,appurl+"/css/"+lhnCssButtonPath+"/"+lhnButton+".css"),function(e,n,t,a){css_done=!1;var l=e.getElementsByTagName("head")[0],s=e.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=a,s.crossOrigin="anonymous",s.onload=s.onreadystatechange=function(){css_done||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(css_done=!0,setTimeout((function(){lhnQuery("#lhnHelpOutCenter").removeClass("lhnHide"),lhnQuery("#lhnHelpOutCenter").show()}),3e3))},l.insertBefore(s,l.firstChild)}(document,0,0,appurl+"/css/"+lhnCssPath+"/hoc.css?v=1"),void 0!==n.css&&function(e,n,t,a){var l=e.getElementsByTagName("head")[0],s=e.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=a,s.crossOrigin="anonymous",l.appendChild(s)}(document,0,0,n.css),function(n,t){var a=n.getElementsByTagName("body");(a=n.createElement("div")).id="lhnHelpOutCenter",a.className="lhn"+lhnJsSdk.settings.styles.position+" lhnWindow circleButton lhnWindow-"+lhnJsSdk.settings.styles.layout+" lhnHide",a.innerHTML=e.payload.template,a.style.display="none",n.body.appendChild(a)}(document),"v2"==hocVersion&&lhnQuery(".lhn-chat-container-chatbox-classic").addClass("lhnHoc"+lhnJsSdk.settings.styles.position),lhnJsSdk.settings.general.hocWidth=isMobile()?"100%":330,hocWidthClass=isMobile()?"lhnHocWidthMobile":"lhnHocWidth",lhnQuery("#lhnHelpOutCenter").addClass(hocWidthClass);var a=Object.keys(lhnJsSdk.settings.systems).length;for(var l in"v1"==hocVersion?function(e,n,t){var a,l=e.getElementById("lhnHocMenuContainer");(a=e.createElement("ul")).id="lhnHocMenu",l.appendChild(a)}(document):function(e,n,t){var a,l=e.getElementById("lhnHocMenuContainer");(a=e.createElement("ul")).id="lhnHocMenu",l.prepend(a)}(document),lhnJsSdk.settings.systems){switch("v1"==hocVersion?function(e,n,t,a,l,s){var o,i=e.getElementById("hocContainer");(o=e.createElement("div")).setAttribute("systemorder",a),o.setAttribute("systemtype",l),o.id="hocSys"+l,o.className="lhnHocSection",i.appendChild(o)}(document,0,0,l,lhnJsSdk.settings.systems[l].system,lhnJsSdk.settings.systems[l].window):(systemSection=lhnQuery("#hocSys"+lhnJsSdk.settings.systems[l].system),systemSection.attr("systemorder",l),systemSection.attr("systemtype",lhnJsSdk.settings.systems[l].system)),100/a+"%"){case"25%":lhnHocMenuWidth="lhnHocMenuWidth25";break;case"50%":lhnHocMenuWidth="lhnHocMenuWidth50";break;case"75%":lhnHocMenuWidth="lhnHocMenuWidth75";break;default:lhnHocMenuWidth="lhnHocMenuWidth100"}switch(function(e,n,t,a,s){var o,i=e.getElementById("lhnHocMenu");(o=e.createElement("li")).setAttribute("systemorder",a),o.setAttribute("systemtype",s),o.setAttribute("tabindex","0"),o.className="lhnHocTab "+lhnHocMenuWidth,o.innerHTML=lhnJsSdk.dict[lhnJsSdk.settings.systems[l].system+"Menu"],i.appendChild(o)}(document,0,0,l,lhnJsSdk.settings.systems[l].system),a>1?lhnQuery(".lhnHocToggleMenu, .lhnWindow-tabs").removeClass("lhnHide"):lhnQuery("#hocContainer, .lhn-chat-container-chatbox-classic").addClass("no-menu"),lhnJsSdk.settings.systems[l].system){case"chat":lhnJsSdk.chatSession=lhnJsSdk.settings.systems[l].active_chat_session_id||null,started_jump_logic=lhnJsSdk.settings.systems[l].started_jump_logic||null,custName=lhnStorage.getData("lhnCustName"),chatSurveyId=void 0!==lhnJsSdk.settings.systems[l].survey?lhnJsSdk.settings.systems[l].survey:null,system_windows.chat=void 0===lhnJsSdk.options.chatWindowId?lhnJsSdk.settings.systems[l].window:lhnJsSdk.options.chatWindowId,preChatType=1==lhnJsSdk.settings.systems[l].jump_logic?"jump_logic":preChatType,chatOfflineType=void 0!==lhnJsSdk.settings.systems[l].offline?lhnJsSdk.settings.systems[l].offline:{offline:0},chatMode=void 0!==lhnJsSdk.settings.systems[l].mode?lhnJsSdk.settings.systems[l].mode:"standard",chatMode="jump_logic"==preChatType?"standard":chatMode,disableEndChat=void 0!==lhnJsSdk.settings.systems[l].disableEndChat&&lhnJsSdk.settings.systems[l].disableEndChat,disableEndChat=void 0!==lhnJsSdk.options.disableEndChat?lhnJsSdk.options.disableEndChat:disableEndChat;break;case"callback":system_windows.callback=void 0===lhnJsSdk.options.callbackWindowId?lhnJsSdk.settings.systems[l].window:lhnJsSdk.options.callbackWindowId;break;case"ticket":void 0!==e.payload.options.systems[l]?lhnJsSdk.settings.take_screen_shot=void 0!==e.payload.options.systems[l].take_screen_shot&&e.payload.options.systems[l].take_screen_shot:lhnJsSdk.settings.take_screen_shot=!1,system_windows.ticket=void 0===lhnJsSdk.options.ticketkWindowId?lhnJsSdk.settings.systems[l].window:lhnJsSdk.options.ticketkWindowId;break;default:system_windows[lhnJsSdk.settings.systems[l].system]=lhnJsSdk.settings.systems[l].window}}visitorSetup(),setTimeout((function(){null==lhnJsSdk.chatSession||isMobile()||openHOC("c",{is_lhn_hoc_button:!0})}),1e3),lhnQuery(document).ready((function(){if(void 0===lhnJsSdk.settings.styles.nobutton||0==lhnJsSdk.settings.styles.nobutton){var e=void 0!==lhnJsSdk.options.hoc_button_tabindex?lhnJsSdk.options.hoc_button_tabindex:"0";"modern"==lhnCssButtonPath?function(n,t,a){var l="",s=0==lhnJsSdk.isOnline?"livechat_offline":"livechat";l+='
',l+='
',l+='
',l+='
',l+='
',l+='
',l+='
',l+='
',l+='
',l+="
",l+="
",l+='
',l+="
",l+='
',l+=""+lhnJsSdk.dict[s]+"",l+="
",l+='
',l+="
",l+="
";var o=n.getElementsByTagName("body");(o=n.createElement("div")).id="lhnHocButton",o.className="lhn"+lhnJsSdk.settings.styles.button_position+" lhn"+lhnJsSdk.settings.button+" lhnHide",o.innerHTML=l,o.setAttribute("tabindex",e),n.body.appendChild(o)}(document):function(t,a,l){ajaxCall(appurl+apiversion+"/ui/element/hoc/button",{button:lhnJsSdk.settings.button,position:lhnJsSdk.settings.styles.button_position,tabindex:e},"GET",n,{document:t,body:"body"})}(document)}function n(e,n){lhnQuery(e.payload).appendTo(n.body)}isMobile()&&lhnQuery("#lhnHelpOutCenter, #lhnHocButton, #lhnHocInvite").addClass("lhnMobileHoc"),setTimeout((function(){(void 0!==lhnJsSdk.settings.styles&&void 0===lhnJsSdk.settings.styles.button_offline||lhnJsSdk.isOnline||!lhnJsSdk.isOnline&&"hidden"!=lhnJsSdk.settings.styles.button_offline)&&lhnQuery("#lhnHocButton").removeClass("lhnHide"),"function"==typeof window.lhnStatusUpdate&&window.lhnStatusUpdate()}),200),lhnQuery(".lhnHocTab").click((function(){return switchHocTab(lhnQuery(this).attr("systemtype")),!1})),lhnQuery(".lhnHocClose, .lhnWindow-header-minimizer").click((function(){return closeHOC(),!1})),lhnQuery(".lhnHocChatClose, .lhnWindow-header-closer").click((function(){return(null!=lhnJsSdk.chatSession||lhnQuery(".lhnCustomerMessage").length>0&&(lhnQuery(".lhnOperatorMessage.jumplogic").length>0||lhnQuery(".lhnOperatorMessage.oldjumplogic").length>0))&&"c"==activeTab&&(0==disableEndChat||1==disableEndChat&&null==lhnJsSdk.chatSession)&&1!=chatEnd?(null!=webrtc.callManager&&webrtc.callManager.isActive?lhnQuery(".lhnPromptMsg.webrtcWarning").removeClass("lhnHide"):lhnQuery(".lhnPromptMsg.webrtcWarning").addClass("lhnHide"),lhnQuery(".lhnPrompt.closechat, .lhnPromptOverlay.closechat").removeClass("lhnHide"),setTimeout((function(){lhnQuery(".lhnPromptAccept.closechat").focus()}),50)):(chatEnd=!1,closeHOC()),!1})),lhnQuery(document).off("click",".lhnPromptAccept.closechat").on("click",".lhnPromptAccept.closechat",(function(){lhnQuery(this).prop("disabled",!0),("v1"!=hocVersion||isMobile())&&lhnQuery(".lhnPrompt, .lhnPromptOverlay").addClass("lhnHide"),chatEnd=!0,endChat()})),lhnQuery(document).off("click",".lhnPromptDecline.closechat").on("click",".lhnPromptDecline.closechat",(function(){lhnQuery(".lhnPrompt, .lhnPromptOverlay").addClass("lhnHide"),lhnStorage.setData("lhnHocMinimized","true"),closeHOC()})),lhnQuery(".lhnHocExternalClose").click((function(){return externalPageClose(),!1})),lhnQuery(".lhnHocToggleMenu").click((function(){return lhnQuery("#lhnHocMenuContainer").slideToggle(200),!1})),lhnQuery(document).on("click","#lhnHocButton",(function(e){lhnQuery(e.target).is(".lhnClose")||("visible"==lhnQuery("#lhnHelpOutCenter").css("visibility")?(lhnJsSdk.closeHOC(),lhnStorage.setData("lhnHocMinimized","true")):(lhnQuery("#lhnHelpOutCenter").removeClass("lhnHide"),lhnQuery(".lhnExternal").removeClass("lhnHide"),lhnStorage.removeData("lhnHocMinimized"),openHOC(null,{is_lhn_hoc_button:!0})))})),lhnQuery("#lhnHocButton").keypress((function(e){lhnQuery(e.target).is(".lhnClose")||13!=e.keyCode&&32!=e.keyCode||("visible"==lhnQuery("#lhnHelpOutCenter").css("visibility")?(lhnJsSdk.closeHOC(),lhnStorage.setData("lhnHocMinimized","true")):(lhnQuery("#lhnHelpOutCenter").removeClass("lhnHide"),lhnQuery(".lhnExternal").removeClass("lhnHide"),lhnStorage.removeData("lhnHocMinimized"),openHOC(null,{is_lhn_hoc_button:!0})))})),lhnQuery(document).off("keyup",".lhnHocInviteButton.lhnstart").on("keyup",".lhnHocInviteButton.lhnstart",(function(e){32!=e.keyCode&&13!=e.keyCode||lhnQuery(this).click()})),lhnQuery(document).off("click",".lhnHocInviteButton.lhnstart").on("click",".lhnHocInviteButton.lhnstart",(function(){openHOC("c",{motive:motive=lhnQuery("#lhnHocInvite").hasClass("lhn_auto")?"auto_invite":lhnQuery("#lhnHocInvite").hasClass("lhn_proactive")?"proactive_invite":lhnQuery("#lhnHocInvite").hasClass("lhn_trigger")?"trigger_invite:"+lhnQuery("#lhnHocInvite").attr("rel"):lhnQuery("#lhnHocInvite").hasClass("lhn_manual")?"manual_invite":null,is_lhn_hoc_button:!0}),"function"==typeof window.lhnJsSdkInviteAccepted&&window.lhnJsSdkInviteAccepted(),clearTimeout(lhnJsSdk.trigger_timeout),hideInvite(),null!=motive&&doGaTrack("LiveChat","Invite-Accepted",!1)})),lhnQuery(document).off("keyup",".lhnHocInviteButton.lhncancel").on("keyup",".lhnHocInviteButton.lhncancel",(function(e){32!=e.keyCode&&13!=e.keyCode||lhnQuery(this).click()})),lhnQuery(document).off("click",".lhnHocInviteButton.lhncancel").on("click",".lhnHocInviteButton.lhncancel",(function(){if(lhnQuery("#lhnHocInvite").hasClass("lhn_auto"))var e={message_type:1,message_sub_type:136,message:"Auto invitation dismissed"};else if(lhnQuery("#lhnHocInvite").hasClass("lhn_proactive"))e={message_type:1,message_sub_type:137,message:"Proactive invitation dismissed"};else if(lhnQuery("#lhnHocInvite").hasClass("lhn_trigger"))e={message_type:1,message_sub_type:138,message:"Trigger invitation dismissed"};else e=null;hideInvite(),"function"==typeof window.lhnJsSdkInviteRejected&&window.lhnJsSdkInviteRejected(),null!=e&&(chatSessionId=null==lhnJsSdk.chatSession?0:lhnJsSdk.chatSession,"socket"==chatTransport?0==chatSessionId?lhnJsSdk.vChan.push("message:sent",e):lhnJsSdk.chatChan.push("message:sent",e):ajaxCall(appurl+apiversion+"/chat/"+chatSessionId+"/message/",e,"POST",null,{}),doGaTrack("LiveChat","Invite-Declined",!1))})),lhnQuery(document).on("click",".heart-click",(function(){var e=lhnQuery(this).attr("article-id");lhnQuery("label.heart").removeClass("selected all");for(var n=lhnQuery(this).val(),t=0;t0?(lhnQuery(".lhnHocSection[systemtype='chat']").remove(),lhnQuery(".lhnHocTab[systemtype='chat']").remove(),lhnQuery(".lhnHocTab").length>1?lhnQuery(".lhnHocTab").css("width",100/lhnQuery(".lhnHocTab").length+"%"):(lhnQuery(".lhnHocToggleMenu, .lhnWindow-tabs").addClass("lhnHide"),lhnQuery("#hocContainer").addClass("no-menu")),setTimeout((function(){openHOC("cb",{is_lhn_hoc_button:!0})}),0)):(embedCallback(e,chatOfflineType.callback),chatType="offline",updateHeaderFooter("chat"));break;case"ticket":lhnQuery(".lhnHocSection[systemtype='ticket']").length>0?(lhnQuery(".lhnHocSection[systemtype='chat']").remove(),lhnQuery(".lhnHocTab[systemtype='chat']").remove(),lhnQuery(".lhnHocTab").length>1?lhnQuery(".lhnHocTab").css("width",100/lhnQuery(".lhnHocTab").length+"%"):(lhnQuery(".lhnHocToggleMenu, .lhnWindow-tabs").addClass("lhnHide"),lhnQuery("#hocContainer").addClass("no-menu")),setTimeout((function(){openHOC("t",{is_lhn_hoc_button:!0})}),0)):(embedTicket(e,chatOfflineType.ticket),chatType="offline",updateHeaderFooter("chat"));break;case"bot":lhnJsSdk.options.chatWindowId=chatOfflineType.bot,lhnJsSdk.refresh(),lhnJsSdk.refresh_visitor(),embedPreChat(e,chatOfflineType.bot,t);break;default:ajaxCall(appurl+apiversion+"/ui/form/",i={system:"chat",layout:"hoc",partial:"offline",view_id:n},"GET",embedOfflineChatCallback,{el:e,win:n})}else{t=void 0!==t?t:{};var i,r={el:e,win:n};if("jump_logic"==preChatType||void 0!==t.invite)"v1"!=hocVersion&&(lhnQuery(".lhnChat").removeClass("chatInputShow"),lhnQuery(".lhnChat").addClass("chatInputHide")),void 0!==t&&(r=lhnQuery.extend(r,t)),ajaxCall(appurl+apiversion+"/ui/form/",i={system:"chat",layout:"hoc",partial:conversationPartial,view_id:n,type:"jump_logic"},"GET",embedJumpLogic,r);else"v1"!=hocVersion&&(lhnQuery(".lhnChat").removeClass("chatInputHide"),lhnQuery(".lhnChat").addClass("chatInputShow")),ajaxCall(appurl+apiversion+"/ui/form/",i={system:"chat",layout:"hoc",partial:"pre_conversation",view_id:n},"GET",embedPreChatCallback,r)}}function embedJumpLogic(e,n){void 0!==lhnJsSdk.lhnsocket&&null!=lhnJsSdk.lhnsocket&&0!=lhnJsSdk.lhnsocket.isConnected()||connectSocket(null,vchanConnect),void 0!==e.payload&&0==lhnQuery(".lhnChat").length&&embedChatSetup(e,n,"jumplogic",fetchSubmittedJumpLogic,jumpLogicStartChat),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function fetchSubmittedJumpLogic(e,n){ajaxCall(appurl+apiversion+"/chat/prechat_question/submitted",{view_id:e},"GET",fetchSubmittedJumpLogicCallback,n)}function fetchSubmittedJumpLogicCallback(e,n){if(void 0!==e.payload)if(stopInactivityTimer(),null!=e.payload.messages){void 0===lhnJsSdk.fieldData&&(lhnJsSdk.fieldData={}),n.value=null;for(var t=0;t'+customerImg+""):customerResourceImg='
',isBotChatMessage(a))l=decodeHTMLEntities(l=jumpLogicTokenReplace(a.answer)),lhnQuery('
'+l+'
').insertBefore(".lhnWindow-chat_input_jumplogic");else l=decodeHTMLEntities(l=jumpLogicTokenReplace(a.question)),lhnQuery('
'+l+'
').insertBefore(".lhnWindow-chat_input_jumplogic"),""!=a.answer&&lhnQuery("
'+a.answer+'
'+customerResourceImg+"
").insertBefore(".lhnWindow-chat_input_jumplogic");scrollChat(),n.field_id=parseInt(a.field_info.split("_")[2]),t==e.payload.messages.length-1&&(n.fetch=!1,preChatFunc({},n))}}else fetchNextJumpLogic(n.win,1,n)}function isBotChatMessage(e){return[0,1,2].includes(e.resource_type)}function fetchNextJumpLogic(e,n,t){var a={view_id:e,order:n};t.submitted=!1,t.from_goto=!1,"helpful"==n?(a.action=t.action,a.bot_answer_id=t.bot_answer_id,a.bot_chat_field_id=t.bot_chat_field_id,0==lhnQuery("[id^=hlpfl_"+t.bot_answer_id+"_"+t.bot_chat_field_id+"_]").length&&ajaxCall(appurl+apiversion+"/chat/prechat_question",a,"GET",embedPreChatQuestionCallback,t)):0==lhnQuery("[id^=fld_"+n+"_]").length&&ajaxCall(appurl+apiversion+"/chat/prechat_question",a,"GET",embedPreChatQuestionCallback,t)}function jumpLogicTokenReplace(e){for(var n=/{{(\d*)}}/,t=n.exec(e);null!=t;){var a=lhnQuery(".lhnCustomerMessage[attr='"+t[1]+"'] .lhnWindow-message").last().text();e=e.replace(t[0],html2text(a)),t=n.exec(e)}return e}function decodeHTMLEntities(e){for(var n=0,t=[["amp","&"],["apos","'"],["lt","<"],["gt",">"],["quot",'"'],["nbsp"," "]];n'+t+"":a='
'+t+"
";lhnQuery(a).appendTo(".lhnWindow-chat_input_jumplogic")}))}else if(t.includes(e.payload.field_type)){var i=lhnQuery(".lhnChat .jumplogic:last"),r=i.find(".lhnInput");if("TEXTAREA"==r[0].tagName?lhnQuery("#lhnChatMessageBox .message").addClass("isLargeText"):lhnQuery("#lhnChatMessageBox .message").removeClass("isLargeText"),""!=r.attr("placeholder")&&null!=r.attr("placeholder")?(lhnQuery("#lhnChatMessageBox .message").attr("placeholder",r.attr("placeholder")),lhnQuery("#lhnChatMessageBox label").text(r.attr("placeholder"))):(lhnQuery("#lhnChatMessageBox .message").attr("placeholder",lhnJsSdk.dict.chatBoxPlaceholder),lhnQuery("#lhnChatMessageBox label").text(lhnJsSdk.dict.chatBoxPlaceholder)),""!=r.attr("maxlength")&&null!=r.attr("maxlength")?lhnQuery("#lhnChatMessageBox .message").attr("maxlength",r.attr("maxlength")):lhnQuery("#lhnChatMessageBox .message").attr("maxlength","150"),lhnQuery.each(r[0].attributes,(function(e,n){"class"!=n.nodeName&&"id"!=n.nodeName&&lhnQuery("#lhnChatMessageBox .message").attr(n.nodeName,n.value)})),i.find(".lhnFieldInput").hasClass("lhnPhoneField")){var h=i.find(".lhnPhoneCountries").clone();lhnQuery(".lhnWindow-chat_input").prepend(h),lhnQuery("#lhnChatMessageBox").addClass("lhnPaddingLeftPhoneInput")}lhnQuery(".lhnWindow-chat_input").removeClass("lhnHide"),"v1"!=hocVersion?(lhnQuery(".lhnChat").removeClass("chatInputHide"),lhnQuery(".lhnChat").addClass("chatInputShow")):lhnQuery(".lhnWindow-chat_input form").removeClass("lhnHide")}if(playSound(),lhnQuery("#lhnChatMessageBox .message").focus(),lhnQuery(".lhnChat .lhnWindow-message--container:last .lhnWindow-message").height()>lhnQuery(".lhnChat").height()){var c=lhnQuery(".lhnChat")[0].scrollHeight-lhnQuery(".lhnChat .lhnWindow-message--container:last .lhnWindow-message").height()-30;lhnQuery(".lhnChat").scrollTop(c)}else scrollChat();n.jumplogic=JSON.parse(e.payload.jump_logic),n.order=e.payload.order,n.field_type=e.payload.field_type,lhnQuery(document).off("click",".lhnChat .lhnOption").on("click",".lhnChat .lhnOption",(function(e){var t=lhnQuery(this).parent().prev().find(".lhnFieldInput"),a=t.find("> input").attr("name");lhnQuery(".lhnWindow-chat_input_jumplogic").find(".lhnOption").remove(),submitPreChatQuestion(a,lhnQuery(this).attr("value"),lhnQuery(this).text(),t.find("> input").attr("crm"),n),lhnQuery(document).off("click",".lhnChat .lhnOption")})),lhnQuery(document).off("click",".lhnWindow-chat_input.jumplogic .lhnSendButton").on("click",".lhnWindow-chat_input.jumplogic .lhnSendButton",(function(e){validate("hocSyschat .lhnWindow-chat_input")&&jumplogicFieldSubmit(e,n)})),lhnQuery(document).off("keydown",".lhnWindow-chat_input.jumplogic #lhnChatMessage").on("keydown",".lhnWindow-chat_input.jumplogic #lhnChatMessage",(function(e){if(13==e.which||9==e.which)return e.preventDefault(),!1})),lhnQuery(document).off("keyup",".lhnWindow-chat_input.jumplogic #lhnChatMessage").on("keyup",".lhnWindow-chat_input.jumplogic #lhnChatMessage",(function(e){13!=e.which&&9!=e.which||!validate("hocSyschat .lhnWindow-chat_input")?""!=lhnQuery.trim(lhnQuery(this).val())?(lhnQuery(this).parent().parent().find("button").addClass("lhnShowButton"),lhnQuery("#lhnChatMessageBox").hasClass("lhnPaddingLeftPhoneInput")||(lhnQuery("#hocSyschat").addClass("lhnTextboxActive"),"v1"!=hocVersion&&customerTyping(lhnQuery(".lhnWindow-chat_input.jumplogic #lhnChatMessageBox > textarea")))):(lhnQuery(this).parent().parent().find("button").removeClass("lhnShowButton"),lhnQuery("#hocSyschat").removeClass("lhnTextboxActive"),"v1"!=hocVersion&&customerTyping(lhnQuery(".lhnWindow-chat_input.jumplogic #lhnChatMessageBox > textarea"))):jumplogicFieldSubmit(e,n)})),lhnQuery(document).ready((function(){autoFillForm("lhnWindow-chat_input",null,{}),"19"==e.payload.field_type&&($el=lhnQuery(".lhnOperatorMessage.jumplogic").last().find("label"),submitPreChatQuestion($el.attr("for"),"","",$el.attr("crm"),n))})),t.includes(e.payload.field_type)&&""==lhnQuery(".lhnWindow-chat_input.jumplogic #lhnChatMessageBox > textarea").val()&&(["pre-fill","pre-fill and skip"].includes(l)&&""!=s&&(lhnQuery(".lhnWindow-chat_input.jumplogic #lhnChatMessageBox > textarea").val(e.payload.prefill_value),lhnQuery(".lhnSendButton").addClass("lhnShowButton")),"pre-fill and skip"==e.payload.prefill_type&&""!=s&&lhnQuery(".lhnWindow-chat_input.jumplogic .lhnSendButton").trigger("click"))}),1e3)}}function jumplogicFieldSubmit(e,n){var t=lhnQuery(".lhnChat .jumplogic:last").find(".lhnInput"),a=lhnQuery(".lhnWindow-chat_input.jumplogic #lhnChatMessage").val();return lhnQuery("#lhnChatMessageBox").hasClass("lhnPaddingLeftPhoneInput")&&!a.includes("+")&&(a=lhnQuery(".lhnWindow-chat_input .lhnPhoneSelectedCountryCode").text()+a),submitPreChatQuestion(t.attr("name"),a,a,t.attr("crm"),n),lhnQuery(document).off("keyup",".lhnWindow-chat_input.jumplogic #lhnChatMessage"),lhnQuery(document).off("click",".lhnWindow-chat_input.jumplogic .lhnSendButton"),lhnQuery("#lhnChatMessageBox > textarea").val(""),lhnQuery(".lhnWindow-chat_input .lhnPhoneCountries").remove(),lhnQuery("#phoneFieldScript").remove(),lhnQuery("#lhnChatMessageBox").removeClass("lhnPaddingLeftPhoneInput"),lhnQuery(".lhnSendButton").removeClass("lhnShowButton"),"v1"!=hocVersion&&(lhnQuery("#lhnChatMessage").scrollTop(0),lhnQuery("#lhnChatMessageBox").scrollTop(0),customerTyping(lhnQuery(".lhnWindow-chat_input.jumplogic #lhnChatMessageBox > textarea"))),e.preventDefault(),!1}function submitPreChatQuestion(e,n,t,a,l){lhnQuery.each(lhnQuery("#lhnChatMessageBox .message")[0].attributes,(function(e,n){null!=n&&"class"!=n.nodeName&&"id"!=n.nodeName&&setTimeout((function(){lhnQuery("#lhnChatMessageBox .message").removeAttr(n.nodeName)}),50)})),lhnQuery(".lhnChat .jumplogic:last").find(".lhnFieldInput").remove(),lhnQuery(".lhnWindow-chat_input").addClass("lhnHide"),lhnQuery(".lhnWindow-chat_input_jumplogic").addClass("lhnHide"),lhnQuery("#hocSyschat").removeClass("lhnTextboxActive"),"v1"!=hocVersion&&(lhnQuery(".lhnChat").removeClass("chatInputShow"),lhnQuery(".lhnChat").addClass("chatInputHide")),vchanConnect(),t=html2text(t);var s={field_info:e,value:n};l.value=n;var o=parseInt(e.split("_")[3]),i=parseInt(e.split("_")[1]);if(l.field_id=parseInt(e.split("_")[2]),28==o&&""!=lhnQuery.trim(n)?(custName=lhnQuery.trim(n),lhnStorage.setData("lhnCustName",custName)):111==o&&""!=lhnQuery.trim(n).split(" ")[0]&&(custName=lhnQuery.trim(n).split(" ")[0],lhnStorage.setData("lhnCustName",custName)),void 0===lhnJsSdk.fieldData&&(lhnJsSdk.fieldData={}),46146!=o&&(lhnJsSdk.fieldData[a]=n),""!=n||"19"==l.field_type&&1==l.from_goto?ajaxCall(appurl+apiversion+"/chat/prechat_question",s,"PUT",preChatFunc,l):preChatFunc({},l),t=convertUrlsAndImages(t=checkMsgForVideoLinks(t)),""!=n&&(null!=custName?(customerImg=custName.slice(0,1),customerResourceImg='
'+customerImg+"
"):customerResourceImg='
',lhnQuery("
'+t+'
'+customerResourceImg+"
").insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat()),"function"==typeof window.lhnJsSdkBotInputReceived){var r=lhnQuery.trim(lhnQuery("label[for='"+e+"'] p").text());window.lhnJsSdkBotInputReceived(r,n)}lhnJsSdk.vChan.push("jump_logic:message",{field_info:e,order:i,text:t},1e4)}function submitPreChatQuestionCallback(e,n){void 0!==e.jwt&&null!=e.jwt&&lhnStorage.setData("lhnJWT",e.jwt,e.jwt_expire);for(var t=null,a=!1,l=0;l":return n>parseInt(e[">"]);case">=":return n>=parseInt(e[">="]);case"<":return n-1;case"notcontains":return n.indexOf(e.notcontains)<0;case"online":return lhnJsSdk.isOnline==e.online;case"regex":return new RegExp(e.regex,"gi").test(n);case"current_page":return window.location.href.indexOf(e.current_page)>-1;case"previous_question":for(var t=lhnQuery(".lhnCustomerMessage[attr='"+e.previous_question.question+"'] .lhnWindow-message").text(),a=!1,l=e.previous_question.conditions,s=0;s
'+jumpLogicTokenReplace(action.text)+'
'),scrollChat();break;case"close_window":lhnJsSdk.closeHOC();break;case"start_chat":(void 0===opts.fetch||void 0!==opts.fetch&&1!=opts.fetch)&&jumpLogicStartChat(opts);break;case"start_sms":(void 0===opts.fetch||void 0!==opts.fetch&&1!=opts.fetch)&&ajaxCall(appurl+apiversion+"/chat/create/sms",{client_sms:action.start_sms},"POST",null,{});break;case"end_chat":endChat();break;case"dept":lhnJsSdk.options.dept!=action.dept&&(lhnJsSdk.options.dept=action.dept,ajaxCall(appurl+apiversion+"/visitor/update_dept",{dept:action.dept},"POST",null,{}),vchanLeave(),vchanConnect(),lhnJsSdk.vChan.push("jump_logic:dept",{dept:action.dept},1e4));break;case"email":(void 0===opts.fetch||void 0!==opts.fetch&&1!=opts.fetch)&&1!=opts.submitted&&ajaxCall(appurl+apiversion+"/chat/0/email_transcript",action.email,"POST",null,{});break;case"kb_article":lhnQuery(".lhnChat").append('
'),setTimeout((function(){scrollChat()}),200);var lhnArticleId=action.kb_article;embedKbArticle(lhnArticleId,"lhnKbEmbed"),lhnQuery(document).ready((function(){lhnQuery(document).off("click","#lhnKbEmbed").on("click","#lhnKbEmbed",(function(){embedExternalPage(),embedKbArticle(lhnArticleId,"lhnExternal")}))}));break;case"callback":if(void 0===opts.fetch||void 0!==opts.fetch&&1!=opts.fetch){var cb=action.callback;lhnQuery(".lhnChat").append('
'+lhnJsSdk.dict.callbackTitle+"
"),scrollChat(),lhnQuery("#hocSyschat").append('
'),embedCallback("cb"+cb+" .sf_main_form",cb),lhnQuery(document).ready((function(){lhnQuery(document).on("click","[rel='cb"+cb+"']",(function(){return lhnQuery("#cb"+cb).removeClass("lhnHide"),!1})),lhnQuery(document).on("click",".secure_forms .form_close",(function(){return lhnQuery("#cb"+cb).addClass("lhnHide"),!1}))}))}break;case"ticket":if(void 0===opts.fetch||void 0!==opts.fetch&&1!=opts.fetch){var ticket=action.ticket;lhnQuery(".lhnChat").append('
'+lhnJsSdk.dict.ticketTitle+"
"),scrollChat(),lhnQuery("#hocSyschat").append('
'),embedTicket("ticket"+ticket+" .sf_main_form",ticket),lhnQuery(document).ready((function(){lhnQuery(document).on("click","[rel='ticket"+ticket+"']",(function(){return lhnQuery("#ticket"+ticket).removeClass("lhnHide"),!1})),lhnQuery(document).on("click",".secure_forms .form_close",(function(){return lhnQuery("#ticket"+ticket).addClass("lhnHide"),!1}))}))}break;case"push_visitor":(void 0===opts.fetch||void 0!==opts.fetch&&1!=opts.fetch)&&ajaxCall(appurl+apiversion+"/visitor/push",{push_to:action.push_visitor},"POST",null,{});break;case"record_outcome":(void 0===opts.fetch||void 0!==opts.fetch&&1!=opts.fetch)&&ajaxCall(appurl+apiversion+"/visitor/record_bot_outcome",{outcome:action.record_outcome,window_id:opts.win},"POST",null,{});break;case"secure_form":if(void 0===opts.fetch||void 0!==opts.fetch&&1!=opts.fetch){var msg=action.secure_form,html="
";lhnQuery(".lhnChat").append(html),scrollChat(),loadSecureForms("sf"+i,msg,{prechat:!0})}break;case"delay":return sleep(1e3*action.delay).then((function(){i
'+jumpLogicTokenReplace(e)+'
'),scrollChat(),parseAction(actions,callback_index,opts)},window.lhnBotCallback=lhnBotCustomJsCallback,i=action_length,eval(custom_js)):eval(custom_js)}i")).appendTo("#"+n.el),lhnQuery(".lhnPreChatForm").removeClass("lhnHide"),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"),lhnQuery(document).ready((function(){if(!lhnStorage.getData("lhnShowedSMS")&&null!=lhnQuery(".lhnPromptAccept.sms").attr("rel")&&""!=lhnQuery(".lhnPromptAccept.sms").attr("rel")&&isMobile()){var e=lhnQuery(".lhnPrompt.sms")[0].innerHTML.replace(/{{(Company)}}/g,lhnJsSdk.dict.companyName);lhnQuery(".lhnPrompt.sms")[0].innerHTML=e,lhnQuery(".lhnPrompt.sms, .lhnPromptOverlay.sms").removeClass("lhnHide")}lhnQuery(document).off("click",".lhnSubmit.hocPrechat").on("click",".lhnSubmit.hocPrechat",(function(){return validatePreChatForm(n.el,n.win),!1})),lhnQuery(document).off("keypress",".lhnPreChatForm input[type='text'], .lhnPreChatForm textarea").on("keypress",".lhnPreChatForm input[type='text'], .lhnPreChatForm textarea",(function(e){if(13==e.keyCode&&lhnQuery(".lhnHocOverlay").is(":visible"))return validatePreChatForm(n.el,n.win),!1})),lhnQuery(".lhnPromptAccept.sms").click((function(){"function"==typeof window.lhnJsSdkSmsChatShown&&window.lhnJsSdkSmsChatShown(),window.location="sms:"+lhnQuery(this).attr("rel")})),lhnQuery(".lhnPromptDecline.sms").click((function(){lhnQuery(".lhnPrompt, .lhnPromptOverlay").addClass("lhnHide"),lhnStorage.setData("lhnShowedSMS",!0)})),lhnJsSdk.fieldData=void 0!==lhnJsSdk.fieldData?lhnJsSdk.fieldData:void 0!==lhnJsSdk.preChatData?lhnJsSdk.preChatData:void 0,autoFillForm("lhnPreChatForm",validatePreChatForm,n),lhnQuery(".lhnFormButton.hocPrechat").html(lhnJsSdk.dict.startChat)})),chatType="prechat",updateHeaderFooter("chat"),firstOpen.chat=!1,doGaTrack("LiveChat","Prechat-Survey",!1),"function"==typeof window.lhnJsSdkPreChatShown&&window.lhnJsSdkPreChatShown()))}function validatePreChatForm(e,n){lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide"),validate(e)?(lhnQuery(".lhnPreChatForm input, .lhnPreChatForm textarea").each((function(){if(lhnAttr=(lhnQuery(this).attr("id")||"").split("_"),"fld"==lhnAttr[0]){var e=parseInt(lhnAttr[3]);if(28==e&&""!=lhnQuery.trim(lhnQuery(this).val()))return custName=html2text(lhnQuery.trim(lhnQuery(this).val())),void lhnStorage.setData("lhnCustName",custName);111==e&&""!=lhnQuery.trim(lhnQuery(this).val()).split(" ")[0]&&(custName=html2text(lhnQuery.trim(lhnQuery(this).val()).split(" ")[0]),lhnStorage.setData("lhnCustName",custName))}"dept"==lhnQuery(this).attr("lhnInputType")&&(lhnJsSdk.options.dept=lhnQuery(this).val(),lhnJsSdk.refresh_visitor())})),null==lhnJsSdk.lhnsocket||0==lhnJsSdk.lhnsocket.isConnected()?(connectSocket(null,vchanConnect),setTimeout((function(){1==lhnJsSdk.isOnline&&embedChat(e,n,lhnQuery(".lhnPreChatForm form").serializeObject(null))}),200)):embedChat(e,n,lhnQuery(".lhnPreChatForm form").serializeObject(null)),lhnQuery(".lhnPreChatForm").addClass("lhnHide"),"function"==typeof window.lhnJsSdkPreChatSubmitted&&window.lhnJsSdkPreChatSubmitted()):(lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"))}function preChatErrorCallback(e){lhnQuery("#lhnChatTable").remove(),lhnQuery(".lhnPreChatForm").removeClass("lhnHide")}function embedOfflineChatCallback(e,n){void 0!==e.payload&&(lhnQuery("#hocSyschat").html(""),lhnQuery(e.payload).appendTo("#"+n.el),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"),lhnQuery(document).ready((function(){lhnQuery(document).off("click",".lhnSubmit.hocOffline").on("click",".lhnSubmit.hocOffline",(function(){return validateOfflineChatForm(n.el,n.win),!1})),lhnJsSdk.fieldData=void 0!==lhnJsSdk.fieldData?lhnJsSdk.fieldData:void 0!==lhnJsSdk.preChatData?lhnJsSdk.preChatData:void 0,autoFillForm("lhnOfflineForm",validateOfflineChatForm,n),lhnQuery(".lhnFormButton.hocOffline").html(lhnJsSdk.dict.submit)})),chatType="offline",updateHeaderFooter("chat"),firstOpen.chat=!1,doGaTrack("LiveChat","Offline-Form-Opened",!1),autoFillForm("lhnOfflineForm",validateOfflineChatForm,n),"function"==typeof window.lhnJsSdkOfflineShown&&window.lhnJsSdkOfflineShown())}function validateOfflineChatForm(e,n){if(lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide"),validate(e)){var t=lhnQuery(".lhnOfflineForm form").serializeObject(n);t=lhnQuery.extend(t,{department_id:lhnJsSdk.options.dept});ajaxCall(appurl+apiversion+"/chat/offline",t,"PUT",validateOfflineFormCallback,{el:e})}else lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function validateOfflineFormCallback(e,n){void 0!==e.message&&(lhnQuery("#"+n.el+" .lhnOfflineForm").remove(),lhnQuery("#lhnHocFooter button").remove(),lhnQuery("
"+lb2br(e.message)+"
").appendTo("#"+n.el),doGaTrack("LiveChat","Offline-Form-Submitted",!1),"function"==typeof window.lhnJsSdkOfflineSubmitted&&window.lhnJsSdkOfflineSubmitted()),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"),chatType="prechat",firstOpen.chat=!0}function lookupConversation(e,n,t){void 0!==(t=void 0!==t?t:{})&&(t=lhnQuery.extend({el:e,win:n},t));var a={view_id:t.win,launch_url:lhnJsSdk.options.pageurl,custom1:lhnJsSdk.options.custom1,custom2:lhnJsSdk.options.custom2,custom3:lhnJsSdk.options.custom3,motive:motive};void 0!==lhnJsSdk.options.operator_id&&(a.operator_id=lhnJsSdk.options.operator_id),ajaxCall(appurl+apiversion+"/chat/conversation",a,"GET",lookupConversationCallback,t)}function lookupConversationCallback(e,n){if(void 0!==e.payload&&1==e.payload.has_chatted){e={system:"chat",layout:"hoc",partial:conversationPartial,view_id:n.win,type:"conversation"};ajaxCall(appurl+apiversion+"/ui/form/",e,"GET",embedConversation,n)}else chatMode="standard",embedPreChat(n.el,n.win)}function embedChatSetup(e,n,t,a,l){lhnQuery(e.payload).appendTo("#"+n.el),lhnQuery("#"+n.el+" .lhnPromptMsg").addClass("lhnHide"),lhnQuery("#"+n.el+" .lhnPromptAccept.closechat").text(lhnJsSdk.dict.endChat),lhnQuery("#"+n.el+" .lhnPromptAccept.closechat").attr("title",lhnJsSdk.dict.endChat),lhnQuery("#"+n.el+" .lhnPromptDecline.closechat").text(lhnJsSdk.dict.hide),lhnQuery("#"+n.el+" .lhnPromptDecline.closechat").attr("title",lhnJsSdk.dict.hide),"v1"==hocVersion?(lhnQuery("#"+n.el+" .lhnSendButton").text(lhnJsSdk.dict.send),lhnQuery("#"+n.el+" .lhnChatActions .lhnHocEndChatAction").text(lhnJsSdk.dict.endChat),lhnQuery("#"+n.el+" .lhnChatActions .lhnHocEmailAction").text(lhnJsSdk.dict.email),lhnQuery("#"+n.el+" .lhnChatActions .lhnHocFileUploadAction").text(lhnJsSdk.dict.uploadFile)):lhnQuery(".lhnChat").addClass("chatInputHide"),lhnQuery("#"+n.el+" #lhnChatMessageBox .message").attr("placeholder",lhnJsSdk.dict.chatBoxPlaceholder),lhnQuery("#"+n.el+" #lhnChatMessageBox label").text(lhnJsSdk.dict.chatBoxPlaceholder),firstOpen.chat=!1;var s,o,i;chatType=t,updateHeaderFooter("chat"),"function"==typeof window.lhnJsSdkPreChatShown&&window.lhnJsSdkPreChatShown(),0==lhnQuery("#emoji-mart").length&&(s=document,o=s.getElementsByTagName("head")[0],(i=s.createElement("script")).type="text/javascript",i.src="https://cdn.jsdelivr.net/npm/emoji-mart@latest/dist/browser.js",i.id="emoji-mart",o.appendChild(i)),lhnQuery(document).ready((function(){if(disableEndChat&&lhnQuery("#"+n.el+" .lhnChatActions .lhnHocEndChatAction").remove(),lhnQuery(".lhnHocBillboards").length>0){lhnQuery("#hocSyschat.lhnHocSection").addClass("hasBillboard");var e=lhnQuery(".lhnHocBillboards").attr("data-cycle-slides"),s=lhnQuery(".lhnHocBillboards "+e).length,o=s;lhnQuery(".lhnHocBillboards "+e).each((function(){o==s&&lhnQuery(this).addClass("lhnCurrentBillboard").addClass("lhnShow"),lhnQuery(this).css("z-index",o),o--})),lhn_billboard_rotate=setInterval((function(){lhnQuery(".lhnCurrentBillboard").fadeOut("slow",(function(){lhnQuery(this).css("z-index",0),lhnQuery(this).removeClass("lhnCurrentBillboard"),lhnQuery(this).index() div, .lhnOperatorMessage > div").css("border-radius","5px"),lhnQuery(".lhnCustomerMessage > span, .lhnOperatorMessage > span").css("font-size","12px"),lhnQuery(document).off("keypress","#lhnChatMessageBox > textarea").on("keypress","#lhnChatMessageBox > textarea",(function(e){return 13==e.keyCode&&""!=lhnQuery.trim(lhnQuery("#lhnChatMessageBox > textarea").val())?(null!=custName&&(n.from_name=custName),lhnJsSdk.chatSession||(n.new_message=lhnQuery("#lhnChatMessageBox > textarea").val(),l(n)),!1):13==e.keyCode||lhnQuery(this).val().length>=4e3?(e.preventDefault(),!1):void 0})),lhnQuery(document).off("input","#lhnChatMessageBox > textarea").on("input","#lhnChatMessageBox > textarea",(function(e){if(oldCustomerTyping=isCustomerTyping,""!=lhnQuery.trim(lhnQuery("#lhnChatMessageBox > textarea").val())){var n=!0;isCustomerTyping=!0,lhnQuery(".lhnInput-chat_input-buttons .lhnSendButton").addClass("lhnShowButton")}else{n=!1;isCustomerTyping=!1,lhnQuery(".lhnInput-chat_input-buttons .lhnSendButton").removeClass("lhnShowButton")}oldCustomerTyping!=isCustomerTyping&&null!=lhnJsSdk.chatSession&&ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/set_typing_status/",{status:n},"POST",null,{})})),lhnQuery(document).off("click",".lhnSendButton").on("click",".lhnSendButton",(function(){return""!=lhnQuery.trim(lhnQuery("#lhnChatMessageBox > textarea").val())&&(null!=custName&&(n.from_name=custName),lhnJsSdk.chatSession||"jumplogic"==chatType||(n.new_message=lhnQuery("#lhnChatMessageBox > textarea").val(),l(n))),!1})),lhnQuery(document).off("keyup",".lhnChatActionsMenu").on("keyup",".lhnChatActionsMenu",(function(e){32!=e.keyCode&&13!=e.keyCode||lhnQuery(this).click()})),lhnQuery(document).on("click","#lhnHelpOutCenter, #lhnHelpOutCenter *",(function(e){lhnQuery(e.target).is(".lhnChatActions, .lhnChatActions *, .lhnChatActionsMenu, .lhnChatActionsMenu *")||"v1"==hocVersion&&lhnQuery(".lhnChatActions").addClass("lhnHide")})),lhnQuery(document).off("click",".lhnChatActions .lhnHocEndChatAction").on("click",".lhnChatActions .lhnHocEndChatAction",(function(){return endChat(),lhnQuery(".lhnChatActions").addClass("lhnHide"),!1})),lhnQuery(document).off("click",".lhnChatActions .lhnHocEmailAction").on("click",".lhnChatActions .lhnHocEmailAction",(function(){return displayEmailForm(),lhnQuery(".lhnChatActions").addClass("lhnHide"),!1})),lhnQuery(document).off("click",".lhnChatActions .lhnHocFileUploadAction").on("click",".lhnChatActions .lhnHocFileUploadAction",(function(){return displayFileUpload(""),"v1"==hocVersion&&lhnQuery(".lhnChatActions").addClass("lhnHide"),!1})),lhnQuery(document).off("keyup",".lhnChat #lhnHocEmailTo").on("keyup",".lhnChat #lhnHocEmailTo",(function(){""!=lhnQuery.trim(lhnQuery(this).val())&&isValidEmailAddress(lhnQuery.trim(lhnQuery(this).val()))?lhnQuery(".lhnChat .hocEmailChat").removeClass("lhnHide"):lhnQuery(".lhnChat .hocEmailChat").addClass("lhnHide")})),lhnQuery(document).off("click",".lhnChat .hocEmailChat").on("click",".lhnChat .hocEmailChat",(function(e){var n=lhnQuery(this).parent().find(".lhnHocEmailTo").val();return isValidEmailAddress(n)&&emailChat(n,lhnQuery(this).parent()),!1})),n.el=n.el+" .lhnChat",void 0!==n.invite&&"open_chat_window"!=n.invite){"conversation"==t&&a(n.win,n);var i=new Date;if("24"==lhnJsSdk.options.timeFormat)i.getHours(),("0"+i.getMinutes()).slice(-2);else i.toLocaleString("en-us",{hour:"numeric",minute:"numeric",hour12:!0});var r=checkMsgForVideoLinks(n.invite);r=convertUrlsAndImages(r);var h="proactive"==n.invite_type?n.invite_id:"invite";"v1"!=hocVersion&&(lhnQuery(".lhnChat").addClass("chatInputShow"),lhnQuery(".lhnChat").removeClass("chatInputHide")),lhnQuery(".lhnWindow-chat_input.jumplogic").removeClass("lhnHide"),lhnQuery("
'+r+'
').insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat(),"trigger"==n.invite_type?lhnQuery(".lhnChat").attr("invite",n.invite_type+"_invite:"+n.invite_id):lhnQuery(".lhnChat").attr("invite",n.invite_type+"_invite"),lhnQuery(".lhnWindow-chat_input > form").removeClass("lhnHide"),"v1"!=hocVersion&&lhnQuery(".lhnWindow-chat_input").css("display","flex"),setTimeout((function(){playSound()}),800)}else!lhnStorage.getData("lhnShowedSMS")&&null!=lhnQuery(".lhnPromptAccept.sms").attr("rel")&&""!=lhnQuery(".lhnPromptAccept.sms").attr("rel")&&isMobile()?lhnQuery(".lhnPrompt.sms, .lhnPromptOverlay.sms").removeClass("lhnHide"):a(n.win,n);lhnQuery(".lhnPromptAccept.sms").click((function(){"function"==typeof window.lhnJsSdkSmsChatShown&&window.lhnJsSdkSmsChatShown(),window.location="sms:"+lhnQuery(this).attr("rel")})),lhnQuery(".lhnPromptDecline.sms").click((function(){a(n.win,n),lhnQuery(".lhnPrompt, .lhnPromptOverlay").addClass("lhnHide"),lhnStorage.setData("lhnShowedSMS",!0)})),"conversation"==t&&(lhnQuery(".lhnWindow-chat_input > form").removeClass("lhnHide"),"v1"!=hocVersion&&lhnQuery(".lhnWindow-chat_input").css("display","flex"))}}))}function embedConversation(e,n){if(void 0!==e.message&&"Department now offline"==e.message)return online_type=0!=lhnJsSdk.options.dept?"department":"client",firstOpen.chat=!1,void updateOnlineStatus({chat:{online_status:!1,online_type:online_type},el:n.el,win:n.win});"undefined"!=e.payload&&0==lhnQuery(".lhnChat").length&&(embedChatSetup(e,n,"conversation",fetchConversation,conversationStartChat),lhnQuery(document).ready((function(){"v1"!=hocVersion&&(lhnQuery(".lhnChat").removeClass("chatInputHide"),lhnQuery(".lhnChat").addClass("chatInputShow")),lhnQuery(".lhnWindow-chat_input").removeClass("jumplogic").removeClass("lhnHide"),lhnQuery(".lhnChat").scroll((function(){if(lhnQuery(".lhnChat").scrollTop()<=300&&moreMessages&&!isLoadingMessages){isLoadingMessages=!0;var e={limit:15,ending_message_id:firstMessageId=lhnQuery(".lhnChat .lhnWindow-message--container").first().attr("id")};ajaxCall("conversation"==chatMode?appurl+apiversion+"/chat/visitor/history/":appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/history/",e,"GET",moreChatMessagesCallback,{})}}))}))),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function fetchConversation(e,n){ajaxCall(appurl+apiversion+"/chat/visitor/history/",{limit:15},"GET",moreChatMessagesCallback,n)}function conversationStartChat(e){"function"==typeof window.lhnJsSdkPreChatSubmitted&&window.lhnJsSdkPreChatSubmitted(),null!=lhnQuery(".lhnChat").attr("invite")&&""!=lhnQuery(".lhnChat").attr("invite")&&(motive=lhnQuery(".lhnChat").attr("invite"),doGaTrack("LiveChat","Invite-Accepted",!1));var n={view_id:e.win,launch_url:lhnJsSdk.options.pageurl,custom1:lhnJsSdk.options.custom1,custom2:lhnJsSdk.options.custom2,custom3:lhnJsSdk.options.custom3,custom1Label:lhnJsSdk.options.custom1Label,custom2Label:lhnJsSdk.options.custom2Label,custom3Label:lhnJsSdk.options.custom3Label,motive:motive,jumplogic:!0};void 0!==lhnJsSdk.options.operator_id&&(n.operator_id=lhnJsSdk.options.operator_id),ajaxCall(appurl+apiversion+"/chat/conversation/",n,"POST",joinChatCallback,e),launchedChat=!0,doGaTrack("LiveChat","Chat-Started",!1)}function embedChat(e,n,t){lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide");var a={system:"chat",layout:"hoc",partial:conversationPartial,view_id:n};lhnJsSdk.chatSession&&(a.args={chat_session:lhnJsSdk.chatSession});var l={el:e,win:n};void 0!==t&&null!=t&&(l.prechat=t),ajaxCall(appurl+apiversion+"/ui/form/",a,"GET",embedChatCallback,l)}function embedChatCallback(e,n){if(void 0!==e.message&&"Department now offline"==e.message){var t=0!=lhnJsSdk.options.dept?"department":"client";return firstOpen.chat=!1,void updateOnlineStatus({chat:{online_status:!1,online_type:t},el:n.el,win:n.win})}if(void 0!==e.payload&&0==lhnQuery(".lhnChat").length)if(embedChatSetup(e,n,"chat"),null==lhnJsSdk.chatSession){e={view_id:n.win,launch_url:lhnJsSdk.options.pageurl,custom1:lhnJsSdk.options.custom1,custom2:lhnJsSdk.options.custom2,custom3:lhnJsSdk.options.custom3,custom1Label:lhnJsSdk.options.custom1Label,custom2Label:lhnJsSdk.options.custom2Label,custom3Label:lhnJsSdk.options.custom3Label,motive:motive};var a={el:n.el};"undefined"!=n.prechat&&null!=n.prechat&&(e.prechat=n.prechat,a.errorCallback=preChatErrorCallback),void 0!==lhnJsSdk.options.operator_id&&(e.operator_id=lhnJsSdk.options.operator_id),!lhnStorage.getData("lhnShowedSMS")&&isMobile()&&lhnQuery(".lhnPrompt.sms").length>0?lhnQuery(".lhnPrompt.sms, .lhnPromptOverlay.sms").removeClass("lhnHide"):(ajaxCall(appurl+apiversion+"/chat/create/",e,"POST",joinChatCallback,a),launchedChat=!0,doGaTrack("LiveChat","Chat-Started",!1)),lhnQuery(document).ready((function(){lhnQuery(".lhnPromptAccept.sms").click((function(){"function"==typeof window.lhnJsSdkSmsChatShown&&window.lhnJsSdkSmsChatShown(),window.location="sms:"+lhnQuery(this).attr("rel")})),lhnQuery(".lhnPromptDecline.sms").click((function(){lhnQuery(".lhnPrompt, .lhnPromptOverlay").addClass("lhnHide"),lhnStorage.setData("lhnShowedSMS",!0),ajaxCall(appurl+apiversion+"/chat/create/",e,"POST",joinChatCallback,a),launchedChat=!0,doGaTrack("LiveChat","Chat-Started",!1)}))}))}else joinChatCallback({payload:{}},n);lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function joinChatCallback(e,n){if(void 0!==e.jwt&&null!=e.jwt&&lhnStorage.setData("lhnJWT",e.jwt,e.jwt_expire),void 0!==e.payload&&(lhnJsSdk.chatSession||void 0!==e.payload.chat_session_id)){lhnQuery(".lhnPreChatForm").remove(),lhnQuery(".lhnWindow-chat_input > form").removeClass("lhnHide"),lhnQuery(".lhnWindow-chat_input").removeClass("jumplogic").removeClass("lhnHide"),lhnQuery(".lhnWindow-chat_input_jumplogic").remove(),lhnQuery(".lhnChatActionsMenu").removeClass("lhnHide"),"v1"!=hocVersion&&(lhnQuery(".lhnChat").removeClass("chatInputHide"),lhnQuery(".lhnChat").addClass("chatInputShow"),lhnQuery(".lhnWindow-chat_input").css("display","flex"),lhnQuery(".lhn-emojis-btn").removeClass("lhnHide"),lhnQuery(".lhnChatActions").removeClass("lhnHide")),chatType="chat",lhnJsSdk.chatSession=lhnJsSdk.chatSession?lhnJsSdk.chatSession:e.payload.chat_session_id,0==lhnJsSdk.isHOC&&lhnStorage.setData("lhnChatSession",lhnJsSdk.chatSession,300),void 0!==e.payload.operator?(lhnQuery(".lhnOperatorName").text(e.payload.operator.name),lhnQuery(".lhnOperatorDesc").text(e.payload.operator.description),lhnQuery(".lhnWindow-header h4").html(''+e.payload.operator.name),""!=e.payload.operator.image?(lhnQuery(".lhnOperatorImage, .lhnWindow-header-avatar--img").addClass("hasImage"),lhnQuery(".lhnOperatorImage, .lhnWindow-header-avatar--img").html('')):(lhnQuery(".lhnOperatorImage, .lhnWindow-header-avatar--img").removeClass("hasImage"),lhnQuery(".lhnOperatorImage, .lhnWindow-header-avatar--img").html(""))):""!=lhnQuery(".lhnOperatorInfo .lhnOperatorName").text().trim()?lhnQuery("#lhnHocHeader h3 span").text(lhnJsSdk.dict.chatTitle):"v1"==hocVersion?(lhnQuery(".lhnWindow-header-avatar").removeClass("lhnHide"),lhnQuery("#lhnHocHeader h3 span").text(lhnJsSdk.dict.chatTitle),lhnQuery(".lhnWindow-header h4").html(''+lhnJsSdk.dict.agentConnecting)):lhnQuery(".lhnWindow-header-text h3").html(''+lhnJsSdk.dict.agentConnecting+""),launchedChat&&"function"==typeof window.lhnJsSdkChatStarted&&window.lhnJsSdkChatStarted(),joinChatSessionCallback();lhnQuery(document).ready((function(){lhnQuery(".lhnHocBillboards").length>0&&lhnQuery("#hocSyschat.lhnHocSection").addClass("hasBillboard"),"v1"==hocVersion&&lhnQuery(".lhnCustomerMessage > div, .lhnOperatorMessage > div").css("border-radius","5px"),lhnQuery(".lhnCustomerMessage > span, .lhnOperatorMessage > span").css("font-size","12px"),lhnQuery(document).on("keypress","#lhnChatMessageBox > textarea",(function(e){13==e.keyCode&&e.preventDefault()})),lhnQuery(document).on("keyup","#lhnChatMessageBox > textarea",(function(e){return 13==e.keyCode&&""!=lhnQuery.trim(lhnQuery(this).val())&&"jumplogic"!=chatType?(null!=custName&&(n.from_name=custName),chatMsgSent(lhnQuery.trim(lhnQuery(this).val()),n),e.preventDefault(),!1):13==e.keyCode||lhnQuery(this).val().length>=4e3?(e.preventDefault(),!1):void("v1"==hocVersion?lhnQuery.trim(lhnQuery(this).val()).length>0?lhnQuery("#hocSyschat").addClass("lhnTextboxActive"):lhnQuery("#hocSyschat").removeClass("lhnTextboxActive"):lhnQuery.trim(lhnQuery(this).val()).length>0?(lhnQuery("#hocSyschat #lhnChatMessageBox").addClass("lhnTextboxActive"),lhnQuery("#hocSyschat #lhnChatMessageBox #lhnChatMessage").addClass("lhnTextboxActive")):(lhnQuery("#hocSyschat #lhnChatMessageBox").removeClass("lhnTextboxActive"),lhnQuery("#hocSyschat #lhnChatMessageBox #lhnChatMessage").removeClass("lhnTextboxActive")))})),lhnQuery(document).on("keyup","#lhnChatMessageBox > textarea",(function(e){var n=isCustomerTyping;if(cursorPosition=lhnQuery("#lhnChatMessage")[0].selectionStart,"v1"!=hocVersion&&customerTyping(lhnQuery(this)),""!=lhnQuery.trim(lhnQuery(this).val())){var t=!0;isCustomerTyping=!0,lhnQuery(".lhnInput-chat_input-buttons .lhnSendButton").addClass("lhnShowButton")}else{t=!1;isCustomerTyping=!1,lhnQuery(".lhnInput-chat_input-buttons .lhnSendButton").removeClass("lhnShowButton")}n!=isCustomerTyping&&null!=lhnJsSdk.chatSession&&ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/set_typing_status/",{status:t},"POST",null,{}),null!=lhnJsSdk.chatSession&&lhnJsSdk.chatChan.push("visitor_typing:capture",{visitor_text:lhnQuery.trim(lhnQuery(this).val()),customer_language:custLanguageId,operator_language:operLanguageId},lhnJsSdk.chatSession)})),lhnQuery(document).on("click","#lhnChatMessageBox > textarea",(function(){cursorPosition=lhnQuery("#lhnChatMessage")[0].selectionStart})),lhnQuery(document).on("click",".lhnSendButton",(function(){return""!=lhnQuery.trim(lhnQuery("#lhnChatMessageBox > textarea").val())&&(null!=custName&&(n.from_name=custName),"v1"!=hocVersion&&lhnQuery(".lhnChatActions").removeClass("lhnHide"),chatMsgSent(lhnQuery.trim(lhnQuery("#lhnChatMessageBox > textarea").val()),n)),!1})),lhnQuery(document).on("click",".lhnHocEmojiAction",(function(){if(0==lhnQuery(".lhn-emojis-container").children().length){var e={onEmojiSelect:function(e){insertEmoji(e)},theme:"light",previewPosition:"none",locale:custLanguageId,searchPosition:"none",emojiButtonSize:30,emojiSize:18,dynamicWidth:!0},n=new EmojiMart.Picker(e);lhnQuery(".lhn-emojis-container").append(n)}1==lhnQuery(".lhn-emojis-container").is(":visible")?(lhnQuery(".lhn-emojis-container").addClass("lhnHide"),customerTyping(lhnQuery("#lhnChatMessageBox > textarea"))):lhnQuery(".lhn-emojis-container").removeClass("lhnHide")})),lhnQuery(document).off("click",".lhnChatActionsMenu").on("click",".lhnChatActionsMenu",(function(e){lhnQuery(".lhnChatActions").hasClass("lhnHide")?lhnQuery(".lhnChatActions").removeClass("lhnHide"):(lhnQuery(".lhnChatActions").addClass("lhnHide"),lhnQuery(".lhnChatActions .lhnHocEndChatAction").focus())})),lhnQuery(document).off("keyup",".lhnChatActionsMenu").on("keyup",".lhnChatActionsMenu",(function(e){32!=e.keyCode&&13!=e.keyCode||lhnQuery(this).click()})),lhnQuery(document).on("click","#lhnHelpOutCenter, #lhnHelpOutCenter *",(function(e){"v1"==hocVersion?lhnQuery(e.target).is(".lhnChatActions, .lhnChatActions *, .lhnChatActionsMenu, .lhnChatActionsMenu *")||lhnQuery(".lhnChatActions").addClass("lhnHide"):lhnQuery(e.target).is(".lhnHocEmojiAction *")||lhnQuery(e.target).is("em-emoji-picker")||1==lhnQuery(".lhn-emojis-container").is(":visible")&&lhnQuery(".lhn-emojis-container").addClass("lhnHide")})),lhnQuery(document).off("click",".lhnChatActions .lhnHocEndChatAction").on("click",".lhnChatActions .lhnHocEndChatAction",(function(e){return endChat(),lhnQuery(".lhnChatActions").addClass("lhnHide"),!1})),lhnQuery(document).off("click",".lhnChatActions .lhnHocEmailAction").on("click",".lhnChatActions .lhnHocEmailAction",(function(e){return displayEmailForm(),lhnQuery(".lhnChatActions").addClass("lhnHide"),!1})),lhnQuery(document).off("click",".lhnChatActions .lhnHocFileUploadAction").on("click",".lhnChatActions .lhnHocFileUploadAction",(function(e){return displayFileUpload(""),"v1"==hocVersion&&lhnQuery(".lhnChatActions").addClass("lhnHide"),!1})),lhnQuery(document).on("click",".removeAttachment",(function(){lhnAttachmentCount--,lhnQuery(this).parent().remove(),0==lhnAttachmentCount&&lhnQuery(".uploadNote").removeClass("lhnHide")})),lhnQuery(document).off("keyup",".lhnChat #lhnHocEmailTo").on("keyup",".lhnChat #lhnHocEmailTo",(function(){""!=lhnQuery.trim(lhnQuery(this).val())&&isValidEmailAddress(lhnQuery.trim(lhnQuery(this).val()))?lhnQuery(".lhnChat .hocEmailChat").removeClass("lhnHide"):lhnQuery(".lhnChat .hocEmailChat").addClass("lhnHide")})),lhnQuery(document).off("click",".lhnChat .hocEmailChat").on("click",".lhnChat .hocEmailChat",(function(e){var n=lhnQuery(this).parent().find(".lhnHocEmailTo").val();return isValidEmailAddress(n)&&emailChat(n,lhnQuery(this).parent()),!1})),lhnQuery(document).on("click",".lhnChat #submitAttachments",(function(){submitAttachments()})),lhnQuery(document).on("click","#removeAttachments",(function(){lhnQuery(".hocActionFileUpload").remove()})),lhnQuery(document).off("click","#dropContainer").on("click","#dropContainer",(function(e){"removeAttachment"!=e.target.className&&lhnQuery("#fileUpload").trigger("click")})),document.addEventListener("dragover",(function(e){e.preventDefault()}),!1),document.addEventListener("drop",(function(e){"dropLocation"!=e.target.className&&"uploadNote"!=e.target.className&&"fileName"!=e.target.className&&"attachmentIcon"!=e.target.className&&"attachmentContainer"!=e.target.className&&"removeAttachment"!=e.target.className||(e.preventDefault(),fileUpload(e))}),!1),document.addEventListener("change",(function(e){"file-upload"==e.target.name&&(e.preventDefault(),fileUpload(e),lhnQuery("#fileUpload").val(""))}),!1),lhnQuery(document).off("click",".lhnChat .hocRemoteAssistAccept").on("click",".lhnChat .hocRemoteAssistAccept",(function(e){var n={message:"-Desktop-Sharing-Accept-"+lhnQuery(this).closest(".hocRemoteAssist").attr("rel"),message_type:1,message_sub_type:55};"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message/",n,"POST",null,{});n={message_id:lhnQuery(this).parent().attr("id")};return ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/ack/",n,"POST",null,{}),lhnQuery(this).parent().remove(),!1})),lhnQuery(document).off("click",".lhnChat .hocRemoteAssistDecline").on("click",".lhnChat .hocRemoteAssistDecline",(function(e){var n={message:"Desktop sharing session invitation has been declined by the visitor.",message_type:1,message_sub_type:56};"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message/",n,"POST",null,{});n={message_id:lhnQuery(this).parent().attr("id")};return ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/ack/",n,"POST",null,{}),lhnQuery(this).parent().remove(),!1})),lhnQuery(document).off("click",".lhnChat .hocChatTimeoutAccept").on("click",".lhnChat .hocChatTimeoutAccept",(function(e){var n={message:"Chat timeout has been accepted by the visitor.",message_type:1,message_sub_type:145};return"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message/",n,"POST",null,{}),lhnJsSdk.isOnline=!1,chatSurveyId=0,chatType="timeout",endChat(),updateEmbeddedChat(),!1})),lhnQuery(document).off("click",".lhnChat .hocChatTimeoutDecline").on("click",".lhnChat .hocChatTimeoutDecline",(function(e){var n={message:"Chat timeout has been declined by the visitor.",message_type:1,message_sub_type:146};return"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message/",n,"POST",null,{}),lhnQuery(this).parent().remove(),!1})),lhnQuery(document).off("click","#lhnHelpOutCenter #hocSyschat .form_close").on("click","#lhnHelpOutCenter #hocSyschat .form_close",(function(e){var n=lhnQuery(this).closest(".secure_forms").attr("id");return lhnQuery("#hocSyschat").find('[rel="'+n+'"]').each((function(){if(lhnQuery(this).hasClass("success")){var e={message_id:lhnQuery(this).closest(".lhnWindow-message--container").attr("id")};ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/ack/",e,"POST",null,{})}lhnQuery("#"+n).remove()})),!1})),lhnQuery(".lhnChat").scroll((function(){if(lhnQuery(".lhnChat").scrollTop()<=300&&moreMessages&&!isLoadingMessages){isLoadingMessages=!0;var e={limit:15,ending_message_id:firstMessageId};ajaxCall("conversation"==chatMode?appurl+apiversion+"/chat/visitor/history/":appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/history/",e,"GET",moreChatMessagesCallback,{})}})),lhnQuery("#lhnChatMessageBox .message").attr("placeholder",lhnJsSdk.dict.chatBoxPlaceholder),lhnQuery("#lhnChatMessageBox .message").attr("maxlength","2000"),lhnQuery("#"+n.el+" #lhnChatMessageBox label").text(lhnJsSdk.dict.chatBoxPlaceholder),lhnQuery(document).off("click",".lhnChat .hocCallOfferAccept").on("click",".lhnChat .hocCallOfferAccept",(function(e){if(webrtc.isJsLoaded){webrtc.callManager=initCallManager(tabId,lhnJsSdk.lhnsocket),webrtc.callManager.setupCall(lhnStorage.getData("lhnJWT"));var n={message_id:lhnQuery(this).parent().attr("id")};ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/ack/",n,"POST",null,{})}else t=document,a=appurl+"/js/visitor-webrtc.js",(l=t.createElement("script")).setAttribute("type","text/javascript"),l.setAttribute("src",a),l.onload=l.onreadystatechange=function(){if(!this.readyState||"loaded"===this.readyState||"complete"===this.readyState){webrtc.isJsLoaded=!0,webrtc.callManager=initCallManager(tabId,lhnJsSdk.lhnsocket),webrtc.callManager.setupCall(lhnStorage.getData("lhnJWT"));var e={message_id:lhnQuery(".lhnChat .hocCallOfferAccept").parent().attr("id")};ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/ack/",e,"POST",null,{})}},l.onerror=function(){webrtc.isJsLoaded=!1;var e={message:"Webrtc JS load failed",message_type:1,message_sub_type:184};"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",e):ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message/",e,"POST",null,{})},t.getElementsByTagName("head")[0].appendChild(l);var t,a,l;return lhnQuery(this).parent().remove(),!1})),lhnQuery(document).off("click",".lhnChat .hocCallOfferDecline").on("click",".lhnChat .hocCallOfferDecline",(function(e){var n={message:"Call Offer Declined",message_type:1,message_sub_type:185};"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message/",n,"POST",null,{});n={message_id:lhnQuery(this).parent().attr("id")};return ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/ack/",n,"POST",null,{}),lhnQuery(this).parent().remove(),!1}))})),void 0!==n.new_message&&chatMsgSent(lhnQuery.trim(n.new_message),n)}}function joinChatSession(){""==lhnQuery("#hocSyschat").html()&&0==lhnQuery(".lhnChat").length?lhnQuery.each(lhnJsSdk.settings.systems,(function(e){"chat"==lhnQuery(this)[0].system&&generateHocContents(lhnQuery(this)[0].system)})):joinChatSessionCallback()}function joinChatSessionCallback(){if(null!=lhnJsSdk.chatSession)if(isSocketReady()){if(isChatChannelReady())return;messageReadInterval=setInterval((function(){markMessagesRead()}),1e3),lhnJsSdk.chatChan=lhnJsSdk.lhnsocket.channel("chat_session:"+lhnJsSdk.chatSession,{token:lhnStorage.getData("lhnJWT"),last_message_id:null,chat_mode:chatMode}),lhnJsSdk.chatChan.on("message:received",(function(e){lhnStorage.removeData("lhnHocMinimized"),1==lhnQuery.isNumeric(e.visitor_chat_session.id)&&(opts={status:"delivered"},ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message_status/",{status:"delivered",message_id:e.visitor_chat_session.id},"POST",null,{})),chatTypingStatus({operator_typing:!1}),chatMsgReceived(e),lhnJsSdk.chatChan.params.last_message_id=e.visitor_chat_session.id})),lhnJsSdk.chatChan.on("message:sent",(function(e){chatMsgSentCallback({payload:e},{status:e.messageStatus})})),lhnJsSdk.chatChan.on("message:status",(function(e){lhnQuery("#"+e.message_id+" .lhnStatus").text(e.status)})),lhnJsSdk.chatChan.on("typing_status:changed",(function(e){chatTypingStatus(e)})),lhnJsSdk.chatChan.on("bus:status",(function(e){if("changed"==e.status.name&&"operator"==e.status.type)lhnQuery(".lhnOperatorName").text(e.metadata.name),lhnQuery(".lhnOperatorDesc").text(e.metadata.description),"v1"==hocVersion?(lhnQuery("#lhnHocHeader h3 span").text(lhnJsSdk.dict.chatTitle),lhnQuery(".lhnWindow-header-avatar").removeClass("lhnHide"),lhnQuery(".lhnWindow-header h4").html(''+e.metadata.name),""!=e.metadata.image&&null!=e.metadata.image?(lhnQuery(".lhnOperatorImage, .lhnWindow-header-avatar--img").addClass("hasImage"),lhnQuery(".lhnOperatorImage, .lhnWindow-header-avatar--img").html('')):(lhnQuery(".lhnOperatorImage, .lhnWindow-header-avatar--img").removeClass("hasImage"),lhnQuery(".lhnOperatorImage, .lhnWindow-header-avatar--img").html(""))):(""!=e.metadata.image&&null!=e.metadata.image?(operatorImg=e.metadata.image,lhnQuery(".lhnOperatorImg").addClass("hasImage"),lhnQuery(".lhnOperatorImg").html(''),lhnQuery(".lhnWindow-header-avatar--img").html(''),lhnQuery(".lhnWindow-header-avatar--img").removeClass("lhnHasText")):(operatorImg=e.metadata.name.slice(0,1),lhnQuery(".lhnOperatorImg").text(operatorImg),lhnQuery(".lhnWindow-header-avatar--img").text(operatorImg),lhnQuery(".lhnWindow-header-avatar--img").addClass("lhnHasText")),lhnQuery(".lhnWindow-avatar").removeClass("lhnHide"),lhnQuery(".lhn-chat-header-logo").addClass("lhnHide"),lhnQuery(".lhnWindow-header-text").html('

'+e.metadata.name+"

"));else if("timeout"==e.status.name&&"chat"==e.status.type)chatTimeout(e.message);else if("closed"==e.status.name&&"chat"==e.status.type){if("v1"!=hocVersion||isMobile()&&null!=chatSurveyId&&0!=chatSurveyId){embedExternalPage();var n={message:"Your chat has ended",message_type:1,message_sub_type:9};"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message/",n,"POST",chatMsgSentCallback,{})}chatEnded()}})),lhnJsSdk.chatChan.join().receive("ok",(function(e){lhnJsSdk.log("Joined Channel","chat_session:"+lhnJsSdk.chatSession),stopInactivityTimer(),operLanguageId=e.operator_language,custLanguageId=e.customer_language,operatorImg=e.operator_picture_path,""!=e.operator&&"v1"!=hocVersion&&lhnQuery("#lhnHocHeader h3 span").text(e.operator),customerImg="silhouette"!=e.visitor_picture_path?e.visitor_picture_path:null!=custName?custName.slice(0,1):e.visitor_picture_path,initChatMsgReceived(e,{}),e.messages.length>0&&(moreMessages=e.more_messages,lhnJsSdk.chatChan.params.last_message_id=e.messages[e.messages.length-1].messageId),startSocketTimer()})).receive("error",(function(e){"Invalid Chat Session"==e.response&&(chatSurveyId=null,chatEnded())})).receive("timeout",(function(e){lhnJsSdk.log("chat channel timeout",lhnJsSdk.chatSession)})),lhnJsSdk.chatChan.onClose((function(){lhnJsSdk.log("chat channel closed",lhnJsSdk.chatSession)}))}else setTimeout((function(){connectSocket(null,reconnectChannels)}),500)}function moreChatMessagesCallback(e,n){moreMessages=e.payload.more_messages,historyChatMsgReceived(e.payload,n)}function showInvite(e,n,t,a,l){if(1==lhnJsSdk.isHOC){a=void 0!==a?a:"manual";var s=void 0!==(l=void 0!==l?l:{}).type?l.type:lhnJsSdk.options.invite_type;if(("jump_logic"!=preChatType||"message"!=s)&&1!=lhnJsSdk.options.invite_as_chat&&"open_chat_window"!=e||"promo"==a||isMobile()&&"proactive"!=a&&"trigger"!=a)if("jump_logic"!=s||"auto"!=a||isMobile()){if("jump_logic"==s&&"auto"==a&&isMobile())return!1;"slide"==lhnJsSdk.settings.button&&setTimeout((function(){lhnQuery("#lhnHocButton").addClass("lhndown"),setTimeout((function(){lhnQuery("#lhnHocButton").addClass("lhnHide")}),1500)}),Math.max(1e3*n-1500,0)),setTimeout((function(){"round"==lhnJsSdk.settings.button||"tab"==lhnJsSdk.settings.button||"slide"==lhnJsSdk.settings.button?function(n,t,l){var s='
';s+='
'+e+"
",s+='
',s+='
'+lhnJsSdk.dict.inviteCancel+"
","promo"!=a&&(s+='
'+lhnJsSdk.dict.inviteStart+"
"),s+='
',s+="
",s+="
";var o=n.getElementsByTagName("body");(o=n.createElement("div")).id="lhnHocInvite",o.className="lhn"+lhnJsSdk.settings.styles.button_position+" lhn_"+a+" lhnHide",o.innerHTML=s,n.body.appendChild(o)}(document):(lhnQuery(".lhnHocButton .lhnHelp span").text(e),lhnQuery(".lhnHocButton .lhnHelp").addClass("lhnAutoInvite"),lhnQuery(".lhnHocButton .lhnHelp span").addClass("lhnAutoInviteSpan")),void 0!==l&&lhnQuery("#lhnHocInvite").attr("rel",l),t&&playSound(),lhnQuery("#lhnHocInvite").removeClass("lhnHide"),lhnQuery("#lhnHocInvite .lhnMsg").focus(),doGaTrack("LiveChat","Invite-Shown",!0),ajaxCall(appurl+apiversion+"/visitor/invite",{},"DELETE",null,{})}),1e3*n)}else openHOC("c",{is_lhn_hoc_button:!0}),doGaTrack("LiveChat","Invite-Shown",!0),ajaxCall(appurl+apiversion+"/visitor/invite",{},"DELETE",null,{});else 1!=started_jump_logic&&setTimeout((function(){openHOC("c",{invite:e,invite_type:a,invite_id:l,is_lhn_hoc_button:!0}),doGaTrack("LiveChat","Invite-Shown",!0),ajaxCall(appurl+apiversion+"/visitor/invite",{},"DELETE",null,{})}),1e3*n)}"function"==typeof window.lhnJsSdkInviteReceived&&"chat"!=a&&window.lhnJsSdkInviteReceived(e,n,a)}function insertEmoji(e){var n=lhnQuery("#lhnChatMessage").val();lhnQuery("#lhnChatMessage").val(n.slice(0,cursorPosition)+e.native+n.slice(cursorPosition)),lhnQuery(".lhn-emojis-container").addClass("lhnHide"),cursorPosition+=4}function customerTyping(e){cursorPosition=lhnQuery("#lhnChatMessage")[0].selectionStart;var n=lhnQuery("#lhnChatMessageBox")[0],t=lhnQuery(".lhnWindow-chat_input")[0],a=lhnQuery(".lhnChat")[0],l=lhnQuery(".lhn-chat-container-chatbox-classic-tabs-chat-form-emojis-container")[0],s=0==lhnQuery(".lhnHocBillboards").length?72:132;s=0==lhnQuery("#lhnHelpOutCenter .no-menu").length?s:43,s=0==lhnQuery("#lhnHelpOutCenter .no-menu .lhnHocBillboards").length?s:103;var o=0==lhnQuery("#lhnHelpOutCenter .no-menu").length?56:31,i=e[0];if(""!=lhnQuery.trim(e.val())){if(lhnQuery(".lhnChatActions").addClass("lhnHide"),i.scrollHeight>40&&i.scrollHeight<=190){n.style.height=i.scrollHeight+"px",t.style.height=i.scrollHeight+"px",i.style.height="auto",i.style.height=i.scrollHeight+"px",i.scrollTop=i.scrollHeight+"px";var r=s+(i.scrollHeight-36)+"px";lhnQuery(".lhnChat").css("max-height","calc(100% - "+r+")");var h=o+(i.scrollHeight-36)+"px";a.style.bottom=h,a.scrollTop=a.scrollHeight,l.style.bottom=i.scrollHeight+8+"px"}}else i.style.height="40px",n.style.height="40px",t.style.height="40px",l.style.bottom="48px",a.style="","chat"==chatType&&(lhnQuery(".lhnChat").addClass("chatInputShow"),lhnQuery(".lhnChatActions").removeClass("lhnHide"))}function hideInvite(){lhnQuery("#lhnHocInvite").addClass("lhncancel"),setTimeout((function(){lhnQuery("#lhnHocInvite").hide(),lhnQuery("#lhnHocInvite").remove()}),1500),"slide"==lhnJsSdk.settings.button&&setTimeout((function(){lhnQuery("#lhnHocButton").removeClass("lhnHide"),lhnQuery("#lhnHocButton").removeClass("lhndown")}),1500)}function displayEmailForm(){if(0==lhnQuery(".conversationForm.hocEmail").length){var e='
';e+=':
",e+='',e+='",e+="
",lhnQuery(".lhnChat").append(e),scrollChat()}}function emailChat(e,n){var t={email_address:e};ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/email_transcript/",t,"POST",emailChatCallback,{el:n,email:e})}function emailChatCallback(e,n){lhnJsSdk.log("Email","Send successfully"),lhnQuery(n.el).html(lhnJsSdk.dict.emailSuccess+" "+n.email),lhnQuery(n.el).removeClass("hocEmail")}function displayFileUpload(e){lhnQuery(".lhnChat").find(".hocActionFileUpload").length>0&&lhnQuery(".lhnChat").find(".hocActionFileUpload").remove();var n='
';n+='
',n+='
',n+='

',n+=''+lhnJsSdk.dict.file_upload_description+"",n+="
",n+="
",n+='',n+='',n+='',n+="
",lhnQuery(".lhnChat").append(n),scrollChat()}function fileUpload(e){if(e.stopPropagation(),e.preventDefault(),lhnAttachmentCount>=5)lhnQuery("#attachmentErrorMsg").removeClass("lhnHide").text("Attachments are limited to 5").delay(5e3).queue((function(e){lhnQuery("#attachmentErrorMsg").addClass("lhnHide").text(""),e()}));else if("drop"==e.type||"change"==e.type){var n="change"==e.type?new LhnUpload(e.target.files[0]):new LhnUpload(e.dataTransfer.files[0]),t=new FileReader,a=n.file.name;t.readAsDataURL(n.file),t.onload=function(e){lhnAttachmentCount++;var n=a+";"+e.total+";"+e.target.result;0==lhnAttachmentCount?lhnQuery(".uploadNote").removeClass("lhnHide"):lhnQuery(".uploadNote").addClass("lhnHide"),filename_formatted=a.length>28?a.slice(0,28)+"...":a,attachmentHtml='

X

'+filename_formatted+'

',lhnQuery(".dropLocation").append(attachmentHtml)}}}function displayPhoneField(e,n){ajaxCall(appurl+apiversion+"/ui/element/",{system:"shared",partial:"phone_field"},"GET",displayPhoneFieldCallback,{id:e,msg:n})}function displayPhoneFieldCallback(e,n){var t='
';t+=e.payload,t+="
",lhnQuery(".lhnChat").append(t),lhnQuery("#"+n.id+" input.lhnInput").keypress((function(e){13==e.which&&(client_sms=n.msg.split(" - ")[1],lhnQuery(this).blur(),lhnQuery(this).parent().addClass("lhnHide"),setTimeout((function(){visitor_sms=lhnQuery("#"+n.id+" #fld_0_0_0").val(),data={visitor_sms:visitor_sms,client_sms:client_sms,from_name:custName},ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/submit_phone/",data,"POST",null,{})}),250))})),scrollChat()}function uploadFile(e,n,t,a){var l=e.split(";"),s=1==t?null:custName,o={name:l[0],length:l[1],data:l[2]+";"+l[3],from_name:s};if(193==a&&(o.message_type=t,o.message_sub_type=a),7==t)return o.from_name=null,o.context_id=l[0].split("-")[0],ajaxCall(appurl+apiversion+"/attachment/ticket/",o,"PUT","inline",{async:!1}).responseJSON.payload.attachment_id;ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/upload_file/",o,"POST",uploadFileCallback,{el:n,message_sub_type:a})}function validateBase64Data(){return _validateBase64Data.apply(this,arguments)}function _validateBase64Data(){return(_validateBase64Data=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=!0,lhnQuery("#dropContainer").find(".attachmentContainer").each((function(){var e=lhnQuery(this).find(".attachmentData").val().split(";");if(!new RegExp(/^[-A-Za-z0-9+/]*={0,3}$/).test(e[3].split("base64,")[1])){var t=lhnQuery(this).find(".fileName").text()+" is not a valid file";return lhnQuery("#attachmentErrorMsg").removeClass("lhnHide").text(t).delay(6e3).queue((function(e){lhnQuery("#attachmentErrorMsg").addClass("lhnHide").text(""),e()})),n=!1,!1}})),e.abrupt("return",n);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function submitAttachments(){return _submitAttachments.apply(this,arguments)}function _submitAttachments(){return(_submitAttachments=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!=lhnQuery("#dropContainer").find(".attachmentContainer").length){e.next=5;break}return lhnQuery(".uploadNote").text("Please click here or drop a file to upload an attachment").css("color","#a94442").delay(5e3).queue((function(e){lhnQuery(".uploadNote").text("Click here or drop a file to add up to 5 attachments. Use buttons below to submit or delete all attachments.").css("color","inherit"),e()})),e.abrupt("return",!1);case 5:return e.next=7,validateBase64Data();case 7:if(1!=e.sent){e.next=17;break}return lhnQuery("#dropContainer").find(".attachmentContainer").each((function(){uploadFile(lhnQuery(this).find(".attachmentData").val(),lhnQuery(this).parent().parent().parent(),null,null);var e={message_id:lhnQuery(this).parent().parent().parent().attr("id")};""!=e.message_id&&ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/ack/",e,"POST",null,{})})),lhnQuery("#submitAttachments").addClass("lhnHide"),lhnQuery("#removeAttachments").addClass("lhnHide"),lhnQuery("#dropContainer").remove(),lhnAttachmentCount=0,e.abrupt("return",!0);case 17:return e.abrupt("return",!1);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function uploadFileCallback(e,n){lhnJsSdk.log("File","Upload successful"),lhnQuery(n.el).html(lhnJsSdk.dict.uploadFileSuccess),193!=n.message_sub_type&&chatMsgSentCallback(e,n)}function displayRemoteAssistance(e,n){var t='
';t+=lhnJsSdk.dict.remoteAssistance+":
",t+='',t+='',t+="
",lhnQuery(".lhnChat").append(t),scrollChat()}function loadSecureForms(e,n,t){t=void 0===t?{}:t,"undefined"!=typeof LHN_Forms||formsWorking?loadSecureForm(e,n):(formsWorking=!0,function(a,l,s,o){var i=a.getElementsByTagName("head")[0],r=a.createElement("script");r.src=o;var h=!1;r.onload=r.onreadystatechange=function(){h||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(h=!0,r.onload=r.onreadystatechange=null,function(a,l,s,o){var i=a.getElementsByTagName("head")[0],r=a.createElement("script");r.src=o;var h=!1;r.onload=r.onreadystatechange=function(){h||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||(h=!0,r.onload=r.onreadystatechange=null,top.LHN_Forms=LHN_Forms,LHN_Forms.secureForms.properties.windowType="HOC",LHN_Forms.secureForms.properties.systemId=t.systemId||1,LHN_Forms.secureForms.properties.prechat=t.prechat||!1,LHN_Forms.secureForms.properties.contextId=JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).resource.id,LHN_Forms.secureForms.properties.departmentId=lhnJsSdk.options.dept,LHN_Forms.secureForms.properties.visitorName=custName,LHN_Forms.properties.clientId=lhnJsSdk.setup.account,LHN_Forms.properties.jwtToken=lhnStorage.getData("lhnJWT"),LHN_Forms.secureForms.properties.hocVersion=hocVersion,LHN_Forms.secureForms.loadForm(LHN_Forms.properties.clientId,{},1,(function(){loadSecureForm(e,n),formsWorking=!1})))},i.appendChild(r)}(document,0,0,appurl+"/js/forms.js"))},i.appendChild(r)}(document,0,0,appurl+"/js/lhn-common.js"))}function loadSecureForm(e,n){if(formsWorking)setTimeout((function(){loadSecureForm(e,n)}),500);else{var t='
';t+=LHN_Forms.secureForms.findAndConvertCommands(n,1),t+="
",lhnQuery("#"+e).append(t),scrollChat()}}function checkMsgForTenor(e){return e.indexOf("s://media.tenor.co/images/")>-1&&(e=e.replace(/(^|[^"'])(https?:\/\/\S*(png|jpg|jpeg|gif|raw))([\s<]|$)/gi,'$1
via Tenor
$4')),e}function checkMsgForVideoLinks(e){if(e.indexOf("youtube.com/watch")>-1||e.indexOf("youtube.com/v/")>-1||e.indexOf("youtu.be/")>-1||e.indexOf("vimeo.com/")>-1)var n=/(?]*)(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(groups\/(.*?)\/videos\/|channels\/(.*?)\/|video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/gi;return e=e.replace(n,(function(e,n,t,a,l,s,o,i,r){return a.indexOf("youtu")>-1&&"user"!=r&&"oembed"!=r&&"attribution_link"!=r&&"playlist"!=r?'':a.indexOf("vimeo.com")>-1?'':e}))}function checkMsgForLinks(e){return e.replace(/[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/g,(function(e){return''+e+""}))}function encodeTags(e,n){return"operator"==n&&(e=e.replace(/</gi,"<").replace(/>/gi,">")),e}function endChat(){if(lhnJsSdk.chatSession||"jump_logic"!=preChatType){if("v1"!=hocVersion||isMobile()&&null!=chatSurveyId&&0!=chatSurveyId){var e={message:"Your chat has ended",message_type:1,message_sub_type:9};"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",e):ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/message/",e,"POST",chatMsgSentCallback,{})}ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/terminate/",{},"POST",chatEnded,{})}else ajaxCall(appurl+apiversion+"/chat/jumplogic/terminate/",{},"POST",jumplogic_chatended,{}),lhnJsSdk.vChan.push("jump_logic:ended",{},1e4)}function chatEnded(){(stopSocketTimer(),startInactivityTimer(),clearInterval(messageReadInterval),operatorImg=void 0,customerImg=void 0,doGaTrack("LiveChat","Chat-Ended",!1),"v1"!=hocVersion&&(lhnQuery(".lhnChat").removeClass("chatInputShow"),lhnQuery(".lhnChat").addClass("chatInputHide")),lhnQuery(".lhnWindow-chat_input > form").addClass("lhnHide"),lhnQuery(".lhnWindow-chat_input").addClass("lhnHide"),visitorMessageCount=0,lhnQuery(".lhnCustomerMessage").each((function(){isNaN(lhnQuery(this).attr("id"))||visitorMessageCount++})),null!=chatSurveyId&&0!=chatSurveyId&&visitorMessageCount>0)?("v1"==hocVersion||isMobile()||embedExternalPage(),lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide"),embedSurvey(lhnQuery(".lhnChat").parent().attr("id"),chatSurveyId,lhnJsSdk.chatSession)):("function"==typeof window.lhnJsSdkChatEnded&&window.lhnJsSdkChatEnded(lhnJsSdk.chatSession),null!=chatSurveyId&&0!=chatSurveyId&&0!=visitorMessageCount||closeHOC(),chatType="prechat",lhnQuery("#hocSyschat").html(""),firstOpen.chat=!0,launchedChat=!1);"undefined"!=typeof lhn_billboard_rotate&&clearInterval(lhn_billboard_rotate),lhnJsSdk.chatChan.leave().receive("ok",(function(){lhnJsSdk.chatChan=null})),1==lhnJsSdk.isHOC&&void 0!==lhnJsSdk.settings.systems[hoc_chat_order]&&(lhnJsSdk.settings.systems[hoc_chat_order].active_chat_session_id=null),lhnStorage.removeData("lhnShowedSMS"),lhnStorage.removeData("lhnHocMinimized"),lhnStorage.removeData("lhnChatSession"),lhnJsSdk.chatSession=null,custName=null,lhnQuery(".lhnPromptAccept.closechat").prop("disabled",!1)}function chatTimeout(e){html='
',html+=e+"
",html+='',html+='',html+="
",lhnQuery(".lhnChat").append(html),scrollChat(),"function"==typeof window.lhnJsSdkChatTimeout&&window.lhnJsSdkChatTimeout(e)}function initChatMsgReceived(e,n){if(void 0!==e.messages){if(void 0!==e.chat_fields&&null!=e.chat_fields&&lhnQuery(".lhnOperatorMessage.jumplogic").length<1&&"prepend"!=n.type)for(var t=0;t'+customerImg+""):customerResourceImg='
',lhnQuery(".lhnChat").append('
'+jumpLogicTokenReplace(e.chat_fields[t].question)+'
'),lhnQuery(".lhnChat").append("
'+e.chat_fields[t].answer+'
'+customerResourceImg+"
"),scrollChat()}for(var l=0;l
'+e.chat_fields[t].answer+'
'),lhnQuery(".lhnChat").prepend('
'+jumpLogicTokenReplace(e.chat_fields[t].question)+'
')}"proactive_invite"==n.motive&&"conversation"==chatMode&&conversationStartChat(n)}}function checkFocus(){return document.hasFocus()}function markMessagesRead(){1==checkFocus()&&"visible"==lhnQuery("#lhnHelpOutCenter").css("visibility")&&lhnQuery(".lhnOperatorMessage[status!=read], .lhnSystemMessage[status!=read]").each((function(){1==lhnQuery.isNumeric(lhnQuery(this).attr("id"))&&(lhnJsSdk.chatChan.push("message:status",{message_id:lhnQuery(this).attr("id"),status:"read"},lhnJsSdk.chatSession),lhnQuery(".lhnChat #"+lhnQuery(this).attr("id")).attr("status","read"))}))}function chatMsgReceived(e){if(opts="undefined"==typeof opts?{}:opts,void 0!==e.visitor_chat_session&&lhnQuery(".lhnChat #"+e.visitor_chat_session.id).length<1){if(191==e.visitor_chat_session.message_sub_type||188==e.visitor_chat_session.message_sub_type)return;var n="lhnOperatorMessage lhnWindow-message--container",t="operator";opts.picture_path=operatorImg,1==e.visitor_chat_session.message_type||117==e.visitor_chat_session.message_sub_type||3==e.visitor_chat_session.message_type&&5==e.visitor_chat_session.message_sub_type?(n="lhnSystemMessage lhnWindow-message--container",t="system",opts.picture_path=null):0==e.visitor_chat_session.operator_id&&(n="lhnCustomerMessage lhnWindow-message--container",t="customer",opts.picture_path=customerImg),opts.message_type=t;var a=convertTime(e.visitor_chat_session.created_time);insertMessage(e.visitor_chat_session.id,n,e.visitor_chat_session.from_name,e.visitor_chat_session.chat_message,a,opts),"function"==typeof window.lhnJsSdkChatNewMessage&&window.lhnJsSdkChatNewMessage(e.visitor_chat_session.id,e.visitor_chat_session.chat_message,t),1==lhnJsSdk.isHOC&&(parseInt(lhnQuery("#lhnHelpOutCenter").css(lhnJsSdk.settings.styles.position))<0||!lhnQuery("#hocSyschat").hasClass("hocactive")||"hidden"==lhnQuery("#lhnHelpOutCenter").css("visibility"))&&openHOC("c",{is_lhn_hoc_button:!0}),192!=e.visitor_chat_session.message_sub_type&&playSound(),lhnQuery(".lhnQueueInfo").fadeOut("slow"),lhnQuery(".lhnQueueInfo").text(""),lhnQuery(".lhnOperatorInfo .lhnOperatorStatus").removeClass("queued"),lhnQuery(".lhnAgentStatus").addClass("lhnAgentStatus--active"),lhnQuery(".lhnSendButton").prop("disabled",!1),lhnQuery("#lhnChatMessage").prop("disabled",!1)}}function insertMessage(e,n,t,a,l,s){lhnQuery(".lhnChat").attr("aria-busy","true"),s=void 0!==s?s:{},""==lhnQuery("#hocSyschat").html()&&embedChat();var o=new Date(l);if("24"==lhnJsSdk.options.timeFormat)var i=o.getHours()+":"+("0"+o.getMinutes()).slice(-2);else i=o.toLocaleString("en-us",{hour:"numeric",minute:"numeric",hour12:!0});if(void 0!==s.message_type&&(a=encodeTags(a,s.message_type)),0==(a=checkMsgForLinks(a=checkMsgForVideoLinks(a=checkMsgForTenor(a=lhnQuery.trim(a))))).indexOf('{"/set_language')){a=a.replace(/\//i,"");var r=JSON.parse(a);operLanguageId=r.set_language[0].oper,custLanguageId=r.set_language[1].cust}else if("/file_request"==a)displayFileUpload(e);else if(a.indexOf("/desktop_sharing")>-1)a.indexOf("joinme")>-1?displayRemoteAssistance(e,"joinme"):a.indexOf("zoom")>-1&&displayRemoteAssistance(e,"zoom");else if(0==a.indexOf('{"/send_secure_form')){var h="
";null!=s.type&&"prepend"==s.type?lhnQuery(".lhnChat").prepend(h):(lhnQuery(".lhnChat").append(h),scrollChat()),"v1"!=hocVersion&&embedExternalPage(),loadSecureForms(e,a)}else-1!==a.indexOf("/session_ended")?("v1"!=hocVersion&&embedExternalPage(),chatEnded()):a.indexOf("/offer_sms")>-1?displayPhoneField(e,a):"/call_offer"==a?displayCallOffer(e):"/visitor_page_capture"==a?visitorPageCapture(e,1):lhnQuery(".lhnChat #"+e).length<1&&(a=convertUrlsAndImages(a),"v1"==hocVersion?h="
"+t+'
'+a+'
'+i+'
':(null==s.picture_path?resourceImg="":1==s.picture_path.length?(nameInitialClass="operator"==s.message_type?'"lhnMessageImg lhnOperatorInitial"':'"lhnMessageImg lhnCustomerInitial"',resourceImg="
"+s.picture_path+"
"):"silhouette"==s.picture_path||0==opImgInChat?resourceImg='
':resourceImg='
',h="
'+a+'
'+t+''+i+"
"+resourceImg+"
"),null!=s.type&&"prepend"==s.type?lhnQuery(".lhnChat").prepend(h):(lhnQuery(".lhnChat").append(h),setTimeout((function(){if(lhnQuery(".lhnChat .lhnWindow-message--container:last .lhnWindowMessageInner").height()>lhnQuery(".lhnChat").height()&&["system","operator"].includes(s.message_type)){var e=lhnQuery(".lhnChat")[0].scrollHeight-lhnQuery(".lhnChat .lhnWindow-message--container:last .lhnWindowMessageInner").height()-20;lhnQuery(".lhnChat").scrollTop(e)}else scrollChat();lhnQuery(".lhnChat").attr("aria-busy","false")}),800)))}function visitorPageCapture(e,n){return _visitorPageCapture.apply(this,arguments)}function _visitorPageCapture(){return _visitorPageCapture=_asyncToGenerator(_regeneratorRuntime().mark((function e(n,t){var a,l;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!=lhnQuery("#html2canvas").length){e.next=4;break}return a=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"text/javascript";return new Promise((function(a){var l=document.createElement("script");l.src=e,l.type=t,l.id=n,l.addEventListener("load",(function(){a({loaded:!0})})),document.head.appendChild(l)}))},e.next=4,a(appurl+"/js/html2canvas.min.js","html2canvas").then((function(e){console.log("Script successfully loaded",e)}));case 4:return e.next=6,uploadPageCapture(n,t);case 6:if(l=e.sent,1!=t){e.next=11;break}ajaxCall(appurl+apiversion+"/chat/"+lhnJsSdk.chatSession+"/ack/",{message_id:n},"POST",null,{}),e.next=12;break;case 11:return e.abrupt("return",l);case 12:case"end":return e.stop()}}),e)}))),_visitorPageCapture.apply(this,arguments)}function uploadPageCapture(e,n){return _uploadPageCapture.apply(this,arguments)}function _uploadPageCapture(){return(_uploadPageCapture=_asyncToGenerator(_regeneratorRuntime().mark((function e(n,t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",html2canvas(document.body).then((function(e){var a=e.toDataURL();return uploadFile(n+"-screencapture.png;"+a.length+";"+a,"#"+n,t,193)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function displayCallOffer(e){var n='
';n+=lhnJsSdk.dict.callAssistance+":
",n+='',n+='',n+="
",lhnQuery(".lhnChat").append(n),scrollChat()}function proactiveMsgReceived(e){if(void 0!==e.visitor_chat_session){showInvite(e.visitor_chat_session.chat_message,1,!0,"proactive",e.visitor_chat_session.id);var n={message:"Proactive invitation shown",message_type:1,message_sub_type:135};chatSessionId=null==lhnJsSdk.chatSession?0:lhnJsSdk.chatSession,"socket"==chatTransport?0==chatSessionId?lhnJsSdk.vChan.push("message:sent",n):lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+chatSessionId+"/message/",n,"POST",null,{});n={invite_type:"proactive",department_id:lhnJsSdk.options.dept,operator_id:e.operator.id};ajaxCall(appurl+apiversion+"/analytics/chat/invite_tracking",n,"POST",null,{})}}function triggerMsgReceived(e){if(void 0!==e.visitor_chat_session&&void 0!==e.trigger&&void 0!==e.trigger.delay){showInvite(e.visitor_chat_session.chat_message,e.trigger.delay,!0,"trigger",e.trigger.id),lhnJsSdk.trigger_timeout=setTimeout((function(){hideInvite();var e={message:"Trigger invitation dismissed",message_type:1,message_sub_type:138};chatSessionId=null==lhnJsSdk.chatSession?0:lhnJsSdk.chatSession,"socket"==chatTransport?0==chatSessionId?lhnJsSdk.vChan.push("message:sent",e):lhnJsSdk.chatChan.push("message:sent",e):ajaxCall(appurl+apiversion+"/chat/"+chatSessionId+"/message/",e,"POST",null,{})}),3e4+1e3*e.trigger.delay);var n={message:"Trigger invitation shown",message_type:1,message_sub_type:139};chatSessionId=null==lhnJsSdk.chatSession?0:lhnJsSdk.chatSession,"socket"==chatTransport?0==chatSessionId?lhnJsSdk.vChan.push("message:sent",n):lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+chatSessionId+"/message/",n,"POST",null,{}),ajaxCall(appurl+apiversion+"/analytics/chat/invite_tracking",n={invite_type:"trigger"},"POST",null,{})}}function triggerPromoReceived(e){if(void 0!==e.visitor_chat_session&&void 0!==e.trigger&&void 0!==e.trigger.delay)if("function"==typeof lhnPromo)lhnPromo(e.visitor_chat_session.chat_message),ajaxCall(appurl+apiversion+"/visitor/invite",{},"DELETE",null,{});else{showInvite(e.visitor_chat_session.chat_message,e.trigger.delay,!0,"promo",e.trigger.id);var n={message:"Trigger promo shown",message_type:1,message_sub_type:156};chatSessionId=null==lhnJsSdk.chatSession?0:lhnJsSdk.chatSession,"socket"==chatTransport?0==chatSessionId?lhnJsSdk.vChan.push("message:sent",n):lhnJsSdk.chatChan.push("message:sent",n):ajaxCall(appurl+apiversion+"/chat/"+chatSessionId+"/message/",n,"POST",null,{})}}function updateQueueStatus(e){if("v1"==hocVersion)lhnQuery(".lhnQueueInfo").text(e.visitor_chat_session.chat_message),lhnQuery(".lhnQueueInfo").fadeIn("slow"),lhnQuery(".lhnOperatorInfo .lhnOperatorStatus").addClass("queued"),lhnQuery(".lhnAgentStatus").removeClass("lhnAgentStatus--active");else{var n=convertTime(e.visitor_chat_session.created_time);insertMessage(e.visitor_chat_session.id,"lhnSystemMessage lhnWindow-message--container","system",e.visitor_chat_session.chat_message,n,{picture_path:null})}}function chatMsgSent(e,n){lhnQuery("#lhnChatMessageBox > textarea").val(""),lhnQuery(".lhnSendButton").removeClass("lhnShowButton"),"v1"==hocVersion?lhnQuery("#hocSyschat").removeClass("lhnTextboxActive"):(customerTyping(lhnQuery("#lhnChatMessageBox > textarea")),lhnQuery("#lhnChatMessage").scrollTop(0),lhnQuery("#lhnChatMessageBox").scrollTop(0),lhnQuery("#hocSyschat #lhnChatMessage, #hocSyschat #lhnChatMessageBox").removeClass("lhnTextboxActive"));var t={message:e=html2text(e)};void 0!==n.message_type&&(t.message_type=n.message_type),void 0!==n.message_sub_type&&(t.message_sub_type=n.message_sub_type),void 0!==n.from_name&&(t.from_name=n.from_name),chatSessionId=null==lhnJsSdk.chatSession?0:lhnJsSdk.chatSession,isSocketReady()||lhnSendError(JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).jti+" 15.1 - socket disconnected on chat msg sent",navigator.userAgent),isChatChannelReady()||(lhnSendError(JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).jti+" 15.1 - chat channel not ready on chat msg sent",navigator.userAgent),joinChatSessionCallback()),""!=operLanguageId&&""!=custLanguageId&&operLanguageId!=custLanguageId&&(t.message_sub_type=76,t.cust_lang=custLanguageId,t.oper_lang=operLanguageId),"socket"==chatTransport?lhnJsSdk.chatChan.push("message:sent",t):ajaxCall(appurl+apiversion+"/chat/"+chatSessionId+"/message/",t,"POST",chatMsgSentCallback,{})}function chatMsgSentCallback(e,n){if(_typeof(e.payload.messageId)&&lhnQuery(".lhnChat #"+e.payload.messageId).length<1&&lhnQuery(".lhnChat").length>0){var t=convertTime(e.payload.createdTime),a=new Date(t);if("24"==lhnJsSdk.options.timeFormat)var l=a.getHours()+":"+("0"+a.getMinutes()).slice(-2);else l=a.toLocaleString("en-us",{hour:"numeric",minute:"numeric",hour12:!0});var s="lhnCustomerMessage lhnWindow-message--container";resourceImg=customerImg,""==e.payload.fromName&&(s="lhnSystemMessage lhnWindow-message--container",resourceImg=null);var o=checkMsgForVideoLinks(e.payload.chatMessage);o=convertUrlsAndImages(o),"v1"==hocVersion?lhnQuery(".lhnChat").append("
"+e.payload.fromName+'
'+o+'
'+l+"
"):(null==resourceImg?resourceImg="":1==resourceImg.length?resourceImg='
'+resourceImg+"
":"silhouette"==resourceImg?resourceImg='
':resourceImg='
',html="
'+o+'
'+e.payload.fromName+''+l+"
"+resourceImg+"
",lhnQuery(".lhnChat").append(html)),scrollChat(),"function"==typeof window.lhnJsSdkChatNewMessage&&window.lhnJsSdkChatNewMessage(e.payload.messageId,o,"customer")}}function chatTypingStatus(e){if(void 0!==e.operator_typing)if((isOperatorTyping=1==e.operator_typing||"true"==e.operator_typing)&&!lhnQuery("#lhnOperatorTyping").is(":visible"))if("v1"==hocVersion)lhnQuery("#lhnHocButton #lhnOpType").removeClass("lhnHide"),lhnQuery(".lhnChat").append("
Operator is typing
"),scrollChat();else{if("jumplogic"==chatType&&null==operatorImg)lhnQuery(".lhnChat").append("
Operator is typing
");else{if(1==operatorImg.length)var n="
"+operatorImg+"
";else n="
";lhnQuery(".lhnChat").append("
Operator is typing
"+n+"
")}scrollChat()}else isOperatorTyping||(lhnQuery("#lhnHocButton #lhnOpType").addClass("lhnHide"),lhnQuery(".lhnChat #lhnOperatorTyping").remove(),scrollChat())}function playSound(){""!=lhnJsSdk.options.sound&&function(e,n,t){var a=e.createElement("audio");a.setAttribute("controls",""),a.setAttribute("autoplay",""),a.id="lhnHocBellSound";var l=document.createElement("source");l.src=lhnJsSdk.options.sound+"?rnd="+Math.floor(1e3*Math.random()),l.type="audio/wav",a.appendChild(l),e.body.appendChild(a)}(document),setTimeout((function(){lhnQuery("#lhnHocBellSound").remove()}),5e3)}function disableChat(e){lhnQuery(".lhnSendButton").prop("disabled",e),lhnQuery("#lhnChatMessage").prop("disabled",e),lhnQuery(".lhnChatActions").prop("disabled",e),lhnQuery(".lhnHocFileUploadAction").prop("disabled",e),lhnQuery(".lhnHocEmojiAction").prop("disabled",e)}function embedSurvey(e,n,t){var a={system:"survey",layout:"hoc",partial:"form",view_id:n};"v1"==hocVersion?ajaxCall(appurl+apiversion+"/ui/form/",a,"GET",embedSurveyCallback,{el:e,id:t}):ajaxCall(appurl+apiversion+"/ui/form/",a,"GET",embedExternalSurveyCallback,{el:"lhn-external-container",id:t})}function embedExternalSurveyCallback(e,n){if(disableChat(!0),void 0!==e.payload){if(isMobile()){var t=lhnQuery(".lhnChat")[0].scrollHeight;lhnQuery(e.payload).appendTo(".lhnChat"),lhnQuery(".lhnChat").scrollTop(t)}else embedExternalPage(),externalPage(e.payload);lhnQuery(document).ready((function(){closeSurveyInterval=setInterval((function(){externalPageClose()}),18e5),lhnQuery(document).on("click",".lhnHocExternalClose",(function(){return externalPageClose(),!1})),lhnQuery(document).on("click",".lhnRadioGroup span",(function(){lhnQuery(this).hasClass("selected")||(lhnQuery(this).closest(".lhnRadioGroup").find("span").removeClass("lhnSelected"),lhnQuery(this).addClass("lhnSelected"),lhnQuery(this).closest(".lhnRadioGroup").find("input").prop("checked",!1),lhnQuery(this).parent().find("input").prop("checked",!0))})),lhnQuery(document).off("click",".lhnSubmit.hocSurvey").on("click",".lhnSubmit.hocSurvey",(function(){return validateSurveyForm(n.el,n.win,n.id),!1})),lhnQuery(".lhnFormButton.hocSurvey").html(lhnJsSdk.dict.submit),isMobile()||lhnQuery(".lhnExternal.standalone").removeClass("lhnHide")}))}else"function"==typeof window.lhnJsSdkChatEnded&&window.lhnJsSdkChatEnded(lhnJsSdk.chatSession),"chat"==chatType&&(closeHOC(),chatType="prechat",lhnQuery("#hocSyschat").html(""),firstOpen.chat=!0,launchedChat=!1);lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"),doGaTrack("Survey","Form-Opened",!1),firstOpen.chat=!0,"function"==typeof window.lhnJsSdkSurveyShown&&window.lhnJsSdkSurveyShown()}function embedSurveyCallback(e,n){if(void 0!==e.payload){if(chatType="survey",updateHeaderFooter("chat"),isMobile()){var t=lhnQuery(".lhnChat")[0].scrollHeight;lhnQuery(e.payload).appendTo(".lhnChat"),lhnQuery(".lhnChat").scrollTop(t-12)}else lhnQuery("#"+n.el).html(""),lhnQuery(e.payload).appendTo("#"+n.el);lhnQuery(document).ready((function(){lhnQuery(document).on("click",".lhnRadioGroup span",(function(){lhnQuery(this).hasClass("selected")||(lhnQuery(this).closest(".lhnRadioGroup").find("span").removeClass("lhnSelected"),lhnQuery(this).addClass("lhnSelected"),lhnQuery(this).closest(".lhnRadioGroup").find("input").prop("checked",!1),lhnQuery(this).parent().find("input").prop("checked",!0))})),lhnQuery(document).off("click",".lhnSubmit.hocSurvey").on("click",".lhnSubmit.hocSurvey",(function(){return validateSurveyForm(n.el,n.win,n.id),!1})),lhnQuery(".lhnFormButton.hocSurvey").html(lhnJsSdk.dict.submit)})),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"),doGaTrack("Survey","Form-Opened",!1),firstOpen.chat=!0,"function"==typeof window.lhnJsSdkSurveyShown&&window.lhnJsSdkSurveyShown()}else"function"==typeof window.lhnJsSdkChatEnded&&window.lhnJsSdkChatEnded(lhnJsSdk.chatSession),"chat"==chatType&&(closeHOC(),chatType="prechat",lhnQuery("#hocSyschat").html(""),firstOpen.chat=!0,launchedChat=!1)}function validateSurveyForm(e,n,t){lhnQuery(document).off("click",".lhnSubmit.hocSurvey"),lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide");var a=!0;if(lhnQuery(".lhnField.lhnrating").each((function(){1!=lhnQuery("input[name='"+lhnQuery(this).find("input[type='radio']").first().attr("name")+"']").is(":checked")&&(a=!1)})),a){var l=lhnQuery(".lhnSurveyForm form").serializeObject(n);l.survey_id=chatSurveyId,l.link_id=t,ajaxCall(appurl+apiversion+"/survey/",l,"PUT",validateSurveyFormCallback,{el:e,chat_session:t})}else lhnQuery(document).on("click",".lhnSubmit.hocSurvey",(function(){return validateSurveyForm(e,n,t),!1})),alert("Please answer all questions"),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function validateSurveyFormCallback(e,n){void 0!==e.message&&("function"==typeof window.lhnJsSdkSurveySubmitted&&(survey_data=[],lhnQuery.each(lhnQuery(".lhnSurveyForm form").serializeArray(),(function(){lhnQuery(this)[0].name.indexOf("fld")>=0&&(o={},o[lhnQuery.trim(lhnQuery("label[for='"+lhnQuery(this)[0].name+"']").text().replace("*",""))]=lhnQuery(this)[0].value,survey_data.push(o))})),window.lhnJsSdkSurveySubmitted(survey_data)),isMobile()?(lhnQuery(".lhnChat .lhnSurveyForm").remove(),lhnQuery("
"+lb2br(e.message)+"
").appendTo(".lhnChat")):"v1"==hocVersion?(lhnQuery("#"+n.el+" .lhnSurveyForm").remove(),lhnQuery("
"+lb2br(e.message)+"
").appendTo("#"+n.el)):(lhnQuery("."+n.el+" .lhnSurveyForm").remove(),lhnQuery("
"+lb2br(e.message)+"
").appendTo("."+n.el)),setTimeout((function(){externalPageClose(),setTimeout((function(){closeHOC()}),2e3)}),5e3),chatEnd=!1,chatType="prechat",firstOpen.chat=!0,launchedChat=!1,doGaTrack("Survey","Form-Submitted",!1)),lhnJsSdk.vChan.push("survey:submitted",{},1e4),"function"==typeof window.lhnJsSdkChatEnded&&(externalPageClose(),window.lhnJsSdkChatEnded(n.chat_session)),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function embedKbLookup(e,n){lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide"),ajaxCall(appurl+apiversion+"/ui/form/",{system:"kb",layout:"hoc",partial:"search",view_id:n},"GET",embedKbLookupCallback,{el:e})}function embedKbLookupCallback(e,n){void 0!==e.payload&&(lhnQuery(e.payload).appendTo("#"+n.el),lhnQuery("#txtKeyword").attr("placeholder",lhnJsSdk.dict.knowledgeSearch),embedExternalPage(),wireKbLookup({searchBox:lhnQuery("#txtKeyword"),resultsContainerNode:lhnQuery("#searchResultsContainer"),categories:lhnJsSdk.options.kb_categories||null}),firstOpen.knowledge=!1);lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function wireKbLookup(e){var n,t,a;n=document,t=appurl+"/js/kb/jquery-jqote2.js",(a=n.createElement("script")).setAttribute("type","text/javascript"),a.setAttribute("src",t),n.getElementsByTagName("head")[0].appendChild(a),function(e,n,t,a){var l=e.createElement("script");l.setAttribute("type","text/javascript"),l.setAttribute("src",a),e.getElementsByTagName("head")[0].appendChild(l)}(document,0,0,appurl+"/js/kb/lhn-localization-1.0.0.js"),function(n,t,a,l){var s=n.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("src",l);var o=!1;s.onload=s.onreadystatechange=function(){if(!(o||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){o=!0;var n={clientID:lhnJsSdk.setup.account,url:appurl+apiversion+"/kb/article/search/",JWT:lhnStorage.getData("lhnJWT"),delay:5e3,department_id:lhnJsSdk.options.dept};void 0!==e&&lhnQuery.extend(n,e),typeahead=new lhnQuery.typeahead(n),void 0!==lhnJsSdk.search_term?(typeahead.searchBox.val(lhnJsSdk.search_term),typeahead.searchBox.keyup()):lhnJsSdk.isHOC&&(typeahead.searchBox.focus(),getKbTopArticles())}},n.getElementsByTagName("head")[0].appendChild(s)}(document,0,0,appurl+"/js/kb/lhn-typeahead-1.0.0.js")}function getKbTopArticles(){var e={category_ids:lhnJsSdk.options.kb_categories||null};ajaxCall(appurl+apiversion+"/kb/articles/top/",e,"GET",getKbTopArticleCallback,{})}function getKbTopArticleCallback(e){if(void 0!==e.payload)for(var n=e.payload.entries,t=0;t=1?'':l-o>0?'':'';var i=e.payload.links[t].html.show;lhnQuery('
'+stripToSize(a.answer,200)+(a.answer.length>200?"...":"")+'
").appendTo("#searchResultsContainer .results")}}function embedKbArticle(e,n){var t=!1;null!=lhnStorage.getData("Heart-"+e)&&(t=!0),ajaxCall(appurl+apiversion+"/ui/kb/article/"+e,{system:"kb",layout:"jssdk",partial:"show",args:{},article_rated:t},"GET",embedKbArticleCallback,{el:n})}function embedKbArticleCallback(e,n){var t="";void 0!==e.payload&&(t=e.payload),"lhnExternal"==n.el?externalPage(t):lhnQuery("#"+n.el).html(t)}function articleRatingCallback(e){"ok"==e.status&&(lhnQuery("#heart-rating-label").text(e.msg),lhnStorage.setData("Heart-"+e.article_id,e.rating),setTimeout((function(){lhnQuery(".hearts").addClass("lhnHide"),e.rating<5&&(lhnJsSdk.showInvite("Sorry the article didn't have the answer you needed
If you'd like, you can ask the team for help here.",1,!0),externalPageClose())}),6e3))}function embedTicket(e,n){lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide"),ajaxCall(appurl+apiversion+"/ui/form/",{system:"ticket",layout:"hoc",partial:"form",view_id:n},"GET",embedTicketCallback,{el:e,win:n})}function embedTicketCallback(e,n){var t,a,l;void 0!==e.payload&&(lhnQuery("#"+n.el).html(""),t=document,a=baseurl+"Scripts/jquery.scrollTo.js",(l=t.createElement("script")).setAttribute("type","text/javascript"),l.setAttribute("src",a),t.getElementsByTagName("head")[0].appendChild(l),"v1"==hocVersion||"v1"!=hocVersion&&"lhnExternalContainer"!=n.el?lhnQuery(e.payload).appendTo("#"+n.el):(embedExternalPage(),externalPage(e.payload)),lhnQuery(document).ready((function(){lhnQuery("input[type='file']").change((function(e){var n=lhnQuery(this).attr("id"),t=lhnQuery(this).val().substring(lhnQuery(this).val().lastIndexOf("\\")+1),a=new FileReader;a.onload=function(e){fileData=t+";"+e.total+";"+e.target.result;var a=fileData.split(";"),l={name:a[0],length:a[1],data:a[2]+";"+a[3],from_name:custName};ajaxCall(appurl+apiversion+"/attachment/ticket/",l,"PUT",formFileUploadCallback,{field_id:n})},a.readAsDataURL(e.target.files[0])})),lhnQuery(document).off("click",".lhnSubmit.hocTicket").on("click",".lhnSubmit.hocTicket",(function(){return lhnQuery(".lhnSubmit.hocTicket").prop("disabled",!0),validateTicketForm(n.el,n.win),!1})),lhnQuery(".lhnFormButton.hocTicket").html(lhnJsSdk.dict.submit),autoFillForm("lhnTicketForm",validateTicketForm,n)})),doGaTrack("Ticket","Form-Opened",!1),"function"==typeof window.lhnJsSdkTicketShown&&window.lhnJsSdkTicketShown()),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function formFileUploadCallback(e,n){if(void 0!==e.payload){var t=n.field_id.replace("filename","filedata"),a=n.field_id.replace("filename","fld");lhnQuery("#"+t).val(e.payload.attachment_id),lhnQuery("#"+a).val("[attachment: "+e.payload.attachment_id+"]")}}function validateTicketForm(e,n){return _validateTicketForm.apply(this,arguments)}function _validateTicketForm(){return(_validateTicketForm=_asyncToGenerator(_regeneratorRuntime().mark((function e(n,t){var a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide"),!validate(n)){e.next=12;break}if(a="",1!=lhnJsSdk.settings.take_screen_shot){e.next=9;break}return e.next=8,visitorPageCapture(0,7);case 8:a=e.sent;case 9:ajaxCall(appurl+apiversion+"/ticket/",{fields:lhnQuery(".lhnTicketForm form").serializeObject(t),view_id:t,screen_capture:a},"PUT",validateTicketFormCallback,{el:n,view_id:t}),e.next=15;break;case 12:lhnQuery(".lhnSubmit.hocTicket").prop("disabled",!1),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide");case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function validateTicketFormCallback(e,n){void 0!==e.payload&&void 0!==e.message&&(lhnQuery("#"+n.el+" .lhnTicketForm").remove(),lhnQuery("
"+e.message.replace("###ticketid###",e.payload.ticket_id)+"
").appendTo("#"+n.el),firstOpen.ticket=!0,doGaTrack("Ticket","Form-Submitted",!1),"function"==typeof window.lhnJsSdkTicketSubmitted&&window.lhnJsSdkTicketSubmitted()),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"),lhnQuery(".lightpick").addClass("lhnHide")}function embedCallback(e,n){lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide"),ajaxCall(appurl+apiversion+"/ui/form/",{system:"callback",layout:"hoc",partial:"form",view_id:n},"GET",embedCallbackCallback,{el:e,win:n})}function embedCallbackCallback(e,n){var t,a,l;void 0!==e.payload?(lhnQuery("#"+n.el).html(""),t=document,a=baseurl+"Scripts/jquery.scrollTo.js",(l=t.createElement("script")).setAttribute("type","text/javascript"),l.setAttribute("src",a),t.getElementsByTagName("head")[0].appendChild(l),"v1"==hocVersion||"v1"!=hocVersion&&"lhnExternalContainer"!=n.el?lhnQuery(e.payload).appendTo("#"+n.el):(embedExternalPage(),externalPage(e.payload)),lhnQuery(document).ready((function(){lhnQuery(document).off("click",".lhnSubmit.hocCallback").on("click",".lhnSubmit.hocCallback",(function(){return lhnQuery(".lhnSubmit.hocCallback").prop("disabled",!0),validateCallForm(n.el,n.win),!1})),autoFillForm("lhnCallbackForm",validateCallForm,n),lhnQuery(".lhnFormButton.hocCallback").html(lhnJsSdk.dict.submit)})),doGaTrack("Callback","Form-Opened",!1),"function"==typeof window.lhnJsSdkCallbackShown&&window.lhnJsSdkCallbackShown()):e&&void 0!==e.status&&"error"==e.status&&(lhnQuery("#"+n.el+" .lhnmsgbox").remove(),lhnQuery("
"+e.error+"
").appendTo("#"+n.el)),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function validateCallForm(e,n){lhnQuery(".lhnHocOverlay").removeClass("lhnHide"),lhnQuery(".lhnloading").removeClass("lhnHide"),validate(e)?ajaxCall(appurl+apiversion+"/callback/",{fields:lhnQuery(".lhnCallbackForm form").serializeObject(n),current_page:lhnJsSdk.options.pageurl,view_id:n},"PUT",validateCallFormCallback,{el:e,win:n}):(lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"),lhnQuery(".lhnSubmit.hocCallback").prop("disabled",!1))}function validateCallFormCallback(e,n){void 0!==e.payload&&void 0!==e.message&&(lhnQuery("#"+n.el+" .lhnCallbackForm").remove(),lhnQuery("
"+e.message+"
").appendTo("#"+n.el),firstOpen.callback=!0,doGaTrack("Callback","Form-Submitted",!1),"function"==typeof window.lhnJsSdkCallbackSubmitted&&window.lhnJsSdkCallbackSubmitted(),void 0!==n.win&&(lhnQuery("[rel='cb"+n.win+"']").remove(),setTimeout((function(){lhnQuery("#cb"+n.win+" .form_close").click()}),3e3))),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide")}function openHOC(e,n){var t;(t=void 0!==n&&void 0!==n.is_lhn_hoc_button,isWorking||void 0===lhnJsSdk.settings.general||null!=lhnStorage.getData("lhnHocMinimized")&&0!=t&&(lhnJsSdk.chatSession||"jumplogic"!=chatType&&"prechat"!=chatType))||(isWorking=!0,activeTab=null==activeTab?systems_long[lhnJsSdk.settings.systems[1].system]:activeTab,e=systems[e=void 0===e||null==e?activeTab:e],void 0!==n&&void 0!==n.search_term&&(lhnJsSdk.search_term=n.search_term),switchHocTab(e,n)?(lhnQuery("#lhnHelpOutCenter").addClass("lhnActive"),isWorking=!1,void 0!==lhnJsSdk.options.hideButtonWhenOpen&&1==lhnJsSdk.options.hideButtonWhenOpen&&("slide"==lhnJsSdk.settings.button?(lhnQuery("#lhnHocButton").addClass("lhndown"),setTimeout((function(){lhnQuery("#lhnHocButton").addClass("lhnHide")}),1e3)):lhnQuery("#lhnHocButton").addClass("lhnHide")),"function"==typeof window.lhnJsSdkEmbeddedOpened&&window.lhnJsSdkEmbeddedOpened(),setTimeout((function(){lhnQuery("#lhnHelpOutCenter #lhnWindowCloser").focus()}),50)):isWorking=!1);return!1}function closeHOC(){void 0!==lhnJsSdk.settings.general&&("v1"!=hocVersion?lhnQuery(".lhnExternal").hasClass("right")&&parseInt(lhnQuery(".lhnExternal").css("right"))>20||lhnQuery(".lhnExternal").hasClass("left")&&parseInt(lhnQuery(".lhnExternal").css("left"))>20?(externalPageClose(),setTimeout((function(){lhnQuery(".lhnExternal").addClass("lhnHide"),lhnQuery("#lhnHelpOutCenter").removeClass("lhnActive")}),1e3)):(lhnQuery(".lhnExternal").addClass("lhnHide"),lhnQuery("#lhnHelpOutCenter").removeClass("lhnActive")):lhnQuery("#lhnHelpOutCenter").removeClass("lhnActive"),"slide"==lhnJsSdk.settings.button?setTimeout((function(){lhnQuery("#lhnHocButton").removeClass("lhnHide"),lhnQuery("#lhnHocButton").removeClass("lhndown")}),500):lhnQuery("#lhnHocButton").removeClass("lhnHide"),lhnQuery("#lhnHocButton").focus(),"function"==typeof window.lhnJsSdkEmbeddedClosed&&window.lhnJsSdkEmbeddedClosed())}function switchHocTab(e,n){vchanConnect();var t=lhnQuery(".lhnHocTab[systemtype='"+e+"']").attr("systemorder");return log("tab system type",e),log("tab order",t),lhnQuery.each(systems,(function(n,t){t==e&&(activeTab=n)})),void 0===t?(lhnJsSdk.log("HOC Error","Invalid HOC Tab"),!1):(firstOpen[e]?("chat"==lhnJsSdk.settings.systems[t].system&&(lhnJsSdk.settings.chatSystemMessages=lhnJsSdk.settings.systems[t].messages,hoc_chat_order=t),generateHocContents(lhnJsSdk.settings.systems[t].system,n),"ticket"!=e&&"callback"!=e||(firstOpen[e]=!0)):"knowledge"==e&&void 0!==lhnJsSdk.search_term&&(typeahead.searchBox.val(lhnJsSdk.search_term),typeahead.searchBox.keyup()),"v1"!=hocVersion&&(lhnQuery(".lhnExternal").hasClass("right")&&parseInt(lhnQuery(".lhnExternal").css("right"))>20&&externalPageClose(),lhnQuery(".lhnExternal").hasClass("left")&&parseInt(lhnQuery(".lhnExternal").css("left"))>20&&externalPageClose()),updateHeaderFooter(lhnJsSdk.settings.systems[t].system),lhnQuery(".lhnHocSection.hocactive").removeClass("hocactive"),lhnQuery(".lhnHocSection[systemtype='"+e+"']").addClass("hocactive"),lhnQuery(".lhnHocTab.hocactive").removeClass("hocactive"),lhnQuery(".lhnHocTab[systemtype='"+e+"']").addClass("hocactive"),!0)}function updateHeaderFooter(e){if(1==lhnJsSdk.isHOC){if(clearInterval(poweredByInterval),poweredByInterval=setInterval((function(){lhnQuery("#lhnWindowFooter, .lhnHocPoweredBy").removeClass("lhnHide"),lhnQuery(".lhnHocPoweredBy a").attr("href")!=lhnJsSdk.settings.poweredby.link&&(lhnQuery(".lhnHocPoweredBy a").html(lhnJsSdk.settings.poweredby.text),lhnQuery(".lhnHocPoweredBy a").attr("href",lhnJsSdk.settings.poweredby.link))}),5e3),lhnQuery("#lhnWindowFooter").html(""),lhnQuery("#lhnWindowFooter").addClass("lhnHide"),lhnQuery(".lhnWindow-header-avatar").addClass("lhnHide"),lhnQuery(".lhnWindow-header-text").removeClass("lhnWindow-chat"),lhnQuery(".lhnWindow-header-text h4").html(""),""==lhnJsSdk.settings.poweredby.text)var n="";else if("v1"==hocVersion)n='";else n='";switch(e){case"chat":"prechat"==chatType?(lhnQuery(".lhn-chat-header-logo").removeClass("lhnHide"),lhnQuery("#lhnHocHeader span").text(lhnJsSdk.dict.newChatTitle),lhnQuery("#lhnWindowFooter").removeClass("lhnHide")):"offline"==chatType?(lhnQuery(".lhn-chat-header-logo").removeClass("lhnHide"),lhnQuery("#lhnHocHeader span").text(lhnJsSdk.dict.offlineTitle),lhnQuery("#lhnWindowFooter").removeClass("lhnHide")):"survey"==chatType?(lhnQuery(".lhn-chat-header-logo").removeClass("lhnHide"),lhnQuery("#lhnHocHeader span").text(lhnJsSdk.dict.surveyTitle),lhnQuery("#lhnWindowFooter").removeClass("lhnHide")):(1==lhnJsSdk.settings.file_upload_allowed?(lhnQuery("#lhnHelpOutCenter div.lhnChatActions").addClass("lhnChatActionsTop"),lhnQuery(".lhnHocFileUploadAction").removeClass("lhnHide")):(lhnQuery(".lhnHocFileUploadAction").remove(),"v1"!=hocVersion&&lhnQuery(".lhnChatActions").remove()),lhnQuery("#lhnWindowFooter").removeClass("lhnHide"),lhnQuery(".lhnWindow-header-text").addClass("lhnWindow-chat"),""!=lhnQuery(".lhnOperatorInfo .lhnOperatorName").text().trim()?(lhnQuery("#lhnHocHeader h3 span").text(lhnJsSdk.dict.chatTitle),lhnQuery(".lhnWindow-header-avatar").removeClass("lhnHide"),"v1"==hocVersion?lhnQuery(".lhnWindow-header-text h4").html(' '+lhnQuery(".lhnOperatorInfo .lhnOperatorName").text()):(lhnQuery(".lhn-chat-header-logo").addClass("lhnHide"),lhnQuery(".lhnWindow-header-text").html('

'+lhnQuery(".lhnOperatorInfo .lhnOperatorName").text()+"

"),lhnQuery(".lhnOperatorInfo .lhnOperatorImg.hasImage").length>0?(lhnQuery(".lhnWindow-header-avatar--img").html(lhnQuery(".lhnOperatorInfo .lhnOperatorImg.hasImage").html()),lhnQuery(".lhnWindow-header-avatar--img").removeClass("lhnHasText")):(lhnQuery(".lhnWindow-header-avatar--img").text(lhnQuery(".lhnOperatorInfo .lhnOperatorImg").text()),lhnQuery(".lhnWindow-header-avatar--img").addClass("lhnHasText")),lhnQuery(".lhnAgentStatus").addClass("lhnAgentStatus--active"))):"jumplogic"!=chatType?"v1"==hocVersion?(lhnQuery("#lhnHocHeader h3 span").text(lhnJsSdk.dict.chatTitle),lhnQuery(".lhnWindow-header-avatar").removeClass("lhnHide"),lhnQuery(".lhnWindow-header-text h4").html(' '+lhnJsSdk.dict.agentConnecting)):lhnQuery(".lhnWindow-header-text h3").html(''+lhnJsSdk.dict.agentConnecting+""):lhnQuery("#lhnHocHeader h3 span").text(lhnJsSdk.dict.chatTitle),lhnQuery(".lhnOperatorInfo .lhnOperatorImage.hasImage").length>0&&lhnQuery(".lhnWindow-header-avatar--img").html(lhnQuery(".lhnOperatorInfo .lhnOperatorImage.hasImage").html()));break;case"ticket":lhnQuery(".lhnWindow-avatar").addClass("lhnHide"),lhnQuery(".lhn-chat-header-logo").removeClass("lhnHide"),lhnQuery("#lhnHocHeader span").text(lhnJsSdk.dict.ticketTitle),lhnQuery("#lhnWindowFooter").removeClass("lhnHide");break;case"knowledge":lhnQuery(".lhnWindow-avatar").addClass("lhnHide"),lhnQuery(".lhn-chat-header-logo").removeClass("lhnHide"),lhnQuery("#lhnHocHeader span").text(lhnJsSdk.dict.knowledgeTitle),lhnQuery("#lhnWindowFooter").removeClass("lhnHide");break;case"callback":lhnQuery(".lhnWindow-avatar").addClass("lhnHide"),lhnQuery(".lhn-chat-header-logo").removeClass("lhnHide"),lhnQuery("#lhnHocHeader span").text(lhnJsSdk.dict.callbackTitle),lhnQuery("#lhnWindowFooter").removeClass("lhnHide")}lhnQuery("#lhnWindowFooter").append(n)}}function autoFillForm(e,n,t){void 0!==lhnJsSdk.fieldData&&(lhnQuery.each(lhnJsSdk.fieldData,(function(n,t){"_readonly"==n.substring(n.length-9,n.length)&&(n=n.substring(0,n.length-9),lhnQuery("."+e+" [crm='"+n+"']").attr("readonly","readonly")),lhnQuery("."+e+" [crm='"+n+"']").val(t),lhnQuery("."+e).find(".lhnSendButton").addClass("lhnShowButton")})),void 0!==lhnJsSdk.fieldData.auto_submit&&1==lhnJsSdk.fieldData.auto_submit&&null!=n&&n(t.el,t.win))}function externalPage(e){new RegExp("^https?:").test(e)&&(e=""),"v1"==hocVersion?lhnQuery(".lhnExternalContainer").html(e):lhnQuery(".lhn-external-container").html(e),externalPageOpen()}function embedExternalPage(){if(0==lhnQuery(".lhnExternal").length){var e=1==lhnJsSdk.isHOC?lhnJsSdk.settings.styles.position:"right";"v1"==hocVersion?(t=document,a=appurl+"/css/modern/external.css",l=t.getElementsByTagName("head")[0],(s=t.createElement("link")).type="text/css",s.rel="stylesheet",s.href=a,l.appendChild(s)):function(e,n,t,a){var l=e.getElementsByTagName("head")[0],s=e.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=a,l.appendChild(s)}(document,0,0,appurl+"/css/v2/external.css"),lhnJsSdk.options.embedArticleDirection=void 0===lhnJsSdk.options.embedArticleDirection?e:lhnJsSdk.options.embedArticleDirection;var n=document.createElement("div");n.className="lhnExternal standalone "+lhnJsSdk.options.embedArticleDirection+" lhnWindow-"+hocLayout+" lhnHide",n.innerHTML="v1"==hocVersion?'close
':"full_screen"==hocLayout?'':'close
',document.body.appendChild(n),lhnQuery(document).ready((function(){lhnQuery(document).on("click",".lhnHocExternalClose",(function(){return externalPageClose(),!1})),lhnQuery(document).on("click","#searchResultsContainer .lhn_result a",(function(e){e.preventDefault(),embedKbArticle(lhnQuery(this).attr("rel"),"lhnExternal")})),lhnQuery(document).on("click",".lhnChat .hocSecureForm .form_chat_btn",(function(){return"v1"!=hocVersion&&externalPageOpen(),!1}))}))}var t,a,l,s;lhnQuery(".lhn-external-container").html("")}function externalPageOpen(){if("v1"==hocVersion){if(lhnQuery(".lhnExternal").hasClass("standalone"))var e=lhnJsSdk.options.embedArticleDirection,n=400;else e=lhnJsSdk.settings.styles.position,n=lhnJsSdk.settings.general.hocWidth;if(parseInt(lhnQuery(".lhnExternal").css(e))<0)({})[e]="+="+n,lhnQuery(".lhnExternal").addClass("lhn-external-animate-"+e+"-open"),lhnQuery(".lhnExternal").removeClass("lhnHide"),setTimeout((function(){lhnQuery(".lhnExternal").addClass("lhn-animate-"+e+"-open"),lhnQuery(".lhnExternal").removeClass("lhn-external-animate-"+e+"-open")}),740)}else{if(lhnQuery(".lhnExternal").hasClass("standalone"))e=lhnJsSdk.options.embedArticleDirection,n="column"==hocLayout?390:375;else e=lhnJsSdk.settings.styles.position,n="column"==hocLayout?390:375;var t="right"==e?"left":"right";if("full_screen"==hocLayout)lhnQuery(".lhnExternal").addClass("external-"+hocLayout),lhnQuery(".lhnExternal").removeClass("lhnHide");else if(20==parseInt(lhnQuery(".lhnExternal").css(e))){({})[e]="+="+n,lhnQuery(".lhnExternal").removeClass("lhnHide"),lhnQuery(".lhn-chat-container-chatbox-classic").removeClass("lhn-chat-container-filter-shadow"),lhnQuery(".lhn-chat-container-chatbox-classic").addClass("lhn-external-slideout-"+e),lhnQuery(".lhnExternal").addClass("lhn-external-animate-"+e+"-open"),setTimeout((function(){lhnQuery(".lhnExternal").addClass("lhn-animate-"+e+"-open"),lhnQuery(".lhnExternal").removeClass("lhn-external-animate-"+e+"-open")}),740),lhnQuery(".lhn-chat-container-chatbox-classic-header").addClass("lhn-external-border-top-"+t+"-radius"),lhnQuery(".lhn-chat-container-chatbox-classic").addClass("lhn-external-border-bottom-"+t+"-radius"),lhnQuery(".lhnExternal").addClass("lhn-external-border-top-"+e+"-radius"),lhnQuery(".lhnExternal").addClass("lhn-external-border-bottom-"+e+"-radius")}else isMobile()&&(lhnQuery(".lhnExternal.standalone."+e).addClass("lhn-external-mobile-position-"+e),lhnQuery(".lhnExternal").removeClass("lhnHide"));lhnQuery(".lhnExternal .lhn-external-container").scrollTop(0)}}function externalPageClose(){if("v1"==hocVersion){if(lhnQuery(".lhnExternal").hasClass("standalone"))var e=lhnJsSdk.options.embedArticleDirection,n=400;else e=lhnJsSdk.settings.styles.position,n=lhnJsSdk.settings.general.hocWidth;if(parseInt(lhnQuery(".lhnExternal").css(e))>=0)({})[e]="-="+n,lhnQuery(".lhnExternal").addClass("lhn-external-animate-"+e+"-close"),lhnQuery(".lhnExternal").removeClass("lhn-animate-"+e+"-open"),setTimeout((function(){lhnQuery(".lhnExternal").removeClass("lhn-external-animate-"+e+"-close"),lhnQuery(".lhnExternal").addClass("lhnHide"),lhnQuery(".lhnExternal .lhnExternalContainer").html("")}),750)}else{if("undefined"!=typeof closeSurveyInterval&&clearInterval(closeSurveyInterval),lhnQuery(".lhnExternal").hasClass("standalone"))e=lhnJsSdk.options.embedArticleDirection,n=375;else e=lhnJsSdk.settings.styles.position,n=lhnJsSdk.settings.general.hocWidth;var t="right"==e?"left":"right";if("full_screen"==hocLayout)lhnQuery(".lhnExternal").addClass("lhnHide"),lhnQuery(".lhnExternal .lhn-external-container").html(""),lhnQuery(".lhnExternal").removeClass("external-"+hocLayout);else if(parseInt(lhnQuery(".lhnExternal").css(e))>=0){({})[e]="-="+n,lhnQuery(".lhnExternal").addClass("lhn-external-animate-"+e+"-close"),lhnQuery(".lhnExternal").removeClass("lhn-animate-"+e+"-open"),setTimeout((function(){lhnQuery(".lhnExternal").removeClass("lhn-external-animate-"+e+"-close"),lhnQuery(".lhnExternal").addClass("lhnHide"),lhnQuery(".lhnExternal .lhn-external-container").html(""),lhnQuery(".lhn-chat-container-chatbox-classic").addClass("lhn-chat-container-filter-shadow"),lhnQuery(".lhn-chat-container-chatbox-classic").removeClass("lhn-external-slideout-"+e),lhnQuery(".lhn-chat-container-chatbox-classic-header").removeClass("lhn-external-border-top-"+t+"-radius"),lhnQuery(".lhn-chat-container-chatbox-classic").removeClass("lhn-external-border-bottom-"+t+"-radius"),lhnQuery(".lhnExternal").removeClass("lhn-external-border-top-"+e+"-radius"),lhnQuery(".lhnExternal").removeClass("lhn-external-border-bottom-"+e+"-radius")}),750)}else isMobile()&&(lhnQuery(".lhnExternal").addClass("lhnHide"),lhnQuery(".lhnExternal .lhn-external-container").html(""))}}function log(e,n,t){t=void 0!==t&&t,(develop||t)&&"undefined"!=typeof console&&console.log(e+": "+n)}function isMobile(){var e,n=!1;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(n=!0),n}function convertTime(e){if("Z"==e.substr(-1)){e=e.substr(0,e.length-1)+"-0400";var n=new Date(e)}else{var t=e.split(/\D/),a=new Date(t[0],--t[1],t[2],t[3],t[4]),l=a.getTimezoneOffset();n=dateAdd(a,"minute",240-l)}return n}function dateAdd(e,n,t){var a=new Date(e);switch(n.toLowerCase()){case"year":a.setFullYear(a.getFullYear()+t);break;case"quarter":a.setMonth(a.getMonth()+3*t);break;case"month":a.setMonth(a.getMonth()+t);break;case"week":a.setDate(a.getDate()+7*t);break;case"day":a.setDate(a.getDate()+t);break;case"hour":a.setTime(a.getTime()+36e5*t);break;case"minute":a.setTime(a.getTime()+6e4*t);break;case"second":a.setTime(a.getTime()+1e3*t);break;default:a=void 0}return a}function ajaxCall(e,n,t,a,l){if(!isBlocked){(l=void 0!==l?l:{}).delay=void 0!==l.delay?l.delay:5e3,lhnasync=void 0===l.async||l.async,n.dept=lhnJsSdk.options.dept;var s=location.host.split(":")[0];if(1!==s.split(".").length&&2!==s.split(".").length){var o=s.split(".");o.shift(),s=o.join(".")}if(n.page_host=s,lhnStorage.getData("lhnJWT")||1!=visitorValidated||!(e.indexOf("api")>0)){if("XDomainRequest"in window&&null!==window.XDomainRequest){var i=new XDomainRequest;i&&(i.onload=function(){for(var e=i.responseText;"object"!=_typeof(e);)e=JSON.parse(e);e&&void 0!==e.status&&"error"!=e.status&&null!=a?a(e,l):"error"==e.status&&void 0!==e.message&&(log("REST Error",e.message,!0),"undefined"!=l.errorCallback&&l.errorCallback?l.errorCallback(l):void 0!==l.el&&l.el&&(lhnQuery("#"+l.el+" .lhnmsgbox").remove(),lhnQuery("
"+e.message+"
").appendTo("#"+l.el)))},i.onerror=function(){log("Ajax Error","XDR Error",!0),a==chatMsgSentCallback&&setTimeout((function(){l.delay=2*l.delay,ajaxCall(e,n,t,a,l)}),l.delay)},i.ontimeout=function(){},i.onprogress=function(){},i.open(t,e+"?"+lhnQuery.param(n)+"&token="+lhnStorage.getData("lhnJWT")),i.send())}else lhnAjaxData=lhnQuery.ajax({url:e,data:n,type:t,async:lhnasync,success:function(e){(e="object"!=_typeof(e)?JSON.parse(e):e)&&(void 0!==e.status&&"error"!=e.status&&null!=a&&"inline"!=a||void 0!==e.token_type)?a(e,l):"error"==e.status&&void 0!==e.message&&(log("REST Error",e.message,!0),"undefined"!=l.errorCallback&&l.errorCallback?l.errorCallback(l):void 0!==l.el&&l.el&&(lhnQuery("#"+l.el+" .lhnmsgbox").remove(),lhnQuery("
"+e.message+"
").appendTo("#"+l.el),lhnQuery(".lhnHocOverlay").addClass("lhnHide"),lhnQuery(".lhnloading").addClass("lhnHide"),void 0!==l.temp_id&&lhnQuery("#lhnCustomerMsgSent."+l.temp_id).remove()))},error:function(s,o,i){log("Ajax Error",o+" - "+i,!0),a==chatMsgSentCallback&&(5e3==l.delay&&(l.temp_id=Math.floor(99999998*Math.random())+1,lhnQuery(".lhnChat").append("
")),setTimeout((function(){l.delay=2*l.delay,ajaxCall(e,n,t,a,l)}),l.delay))},beforeSend:function(e,n){e.setRequestHeader("Authorization","Bearer "+lhnStorage.getData("lhnJWT"))}});return lhnAjaxData}refresh_opts={url:e,data:n,type:t,successCallback:a,options:l},refreshOAuth(refresh_opts)}}function validate(e){var n=!0;return lhnQuery("#"+e+" input, #"+e+" textarea, #"+e+" select").removeClass("lhnError"),lhnQuery("#"+e+" .lhnField").removeClass("lhnNot-valid"),lhnQuery(".lhnErrorMsg").remove(),lhnQuery("#"+e+" [rel*=required]:visible").each((function(){var t="#"+e+" #"+lhnQuery(this).attr("id");if("requiredText"!=lhnQuery(t).attr("rel")&&"requiredFile"!=lhnQuery(t).attr("rel")||""!=lhnQuery(t).val()?"requiredDDL"==lhnQuery(t).attr("rel")&&-1==lhnQuery(t+" option:selected").attr("value")&&(lhnQuery(this).addClass("lhnError"),lhnQuery(this).closest(".lhnField").addClass("lhnNot-valid"),""!=lhnJsSdk.dict.error_msg_empty&&(lhn_error_msg=lhnJsSdk.dict.error_msg_empty.replace("$$$label$$$",lhnQuery(this).closest(".lhnField").find("label p").text()),lhnQuery(this).parent().append(''+lhn_error_msg+"")),lhnQuery(this).focus(),n=!1):(lhnQuery(this).addClass("lhnError"),lhnQuery(this).closest(".lhnField").addClass("lhnNot-valid"),""!=lhnJsSdk.dict.error_msg_empty&&(lhn_error_msg=lhnJsSdk.dict.error_msg_empty.replace("$$$label$$$",lhnQuery(this).closest(".lhnField").find("label p").text()),lhnQuery(this).parent().append(''+lhn_error_msg+"")),lhnQuery(this).focus(),n=!1),"email"!=lhnQuery(t).attr("validatefor")||isValidEmailAddress(lhnQuery(t).val())?"phone"!=lhnQuery(t).attr("validatefor")||isValidPhone(lhnQuery(t).val())?"url"!=lhnQuery(t).attr("validatefor")||isValidUrl(lhnQuery(t).val())?"number"!=lhnQuery(t).attr("validatefor")||isValidNumber(lhnQuery(t).val())||(lhnQuery(this).addClass("lhnError"),lhnQuery(this).closest(".lhnField").addClass("lhnNot-valid"),""!=lhnJsSdk.dict.error_msg_number&&(lhn_error_msg=lhnJsSdk.dict.error_msg_number.replace("$$$label$$$",lhnQuery(this).closest(".lhnField").find("label p").text()),lhnQuery(this).parent().append(''+lhn_error_msg+"")),lhnQuery(this).focus(),n=!1):(lhnQuery(this).addClass("lhnError"),lhnQuery(this).closest(".lhnField").addClass("lhnNot-valid"),""!=lhnJsSdk.dict.error_msg_url&&(lhn_error_msg=lhnJsSdk.dict.error_msg_url.replace("$$$label$$$",lhnQuery(this).closest(".lhnField").find("label p").text()),lhnQuery(this).parent().append(''+lhn_error_msg+"")),lhnQuery(this).focus(),n=!1):(lhnQuery(this).addClass("lhnError"),lhnQuery(this).closest(".lhnField").addClass("lhnNot-valid"),""!=lhnJsSdk.dict.error_msg_phone&&(lhn_error_msg=lhnJsSdk.dict.error_msg_phone.replace("$$$label$$$",lhnQuery(this).closest(".lhnField").find("label p").text()),lhnQuery(this).parent().append(''+lhn_error_msg+"")),lhnQuery(this).focus(),n=!1):(lhnQuery(this).addClass("lhnError"),lhnQuery(this).closest(".lhnField").addClass("lhnNot-valid"),""!=lhnJsSdk.dict.error_msg_email&&(lhn_error_msg=lhnJsSdk.dict.error_msg_email.replace("$$$label$$$",lhnQuery(this).closest(".lhnField").find("label p").text()),lhnQuery(this).parent().append(''+lhn_error_msg+"")),lhnQuery(this).focus(),n=!1),lhnQuery(".lhnCheckboxGroup.lhnRequiredCheckbox").each((function(){lhnChecked=!1,lhnQuery(this).find("input").each((function(){lhnChecked=lhnChecked||lhnQuery(this).prop("checked")})),0==lhnChecked&&(n=!1)})),0==n)return n})),n}function isValidPhone(e){return!!(/^[0-9-+.]+$/.test(e)&&e.length>5)}function isValidEmailAddress(e){return new RegExp(/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i).test(e)}function isValidUrl(e){return new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/).test(e)}function isValidNumber(e){return new RegExp(/^\W?\s?(([1-9]\d{0,2}(,\d{3})*)(.\d+)*)?$/).test(e)}function isAlphaOnly(e){return!!/^[^*!@%_0-9\^]+$/.test(e)}function isValidIp(e){return new RegExp(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/).test(e)}function stripToSize(e,n){return e.replace(/^(.{200}[^\s]*).*/,"$1")}function connectSocket(e,n){connectionAttempted=!0,isSocketConnecting()||(closeSocketConnection(),lhnJsSdk.lhnsocket=void 0!==e&&null!=e?new Socket(sockurl+"/socket",{timeout:2e4,heartbeatIntervalMs:2e4,transport:e,reconnectAfterMs:reconnectSocketInterval}):new Socket(sockurl+"/socket",{timeout:2e4,heartbeatIntervalMs:2e4,reconnectAfterMs:reconnectSocketInterval}),lhnJsSdk.lhnsocket.onOpen((function(){void 0!==n&&null!=n&&n(),startInactivityTimer()})),lhnJsSdk.lhnsocket.onClose((function(){lhnjti=null==lhnStorage.getData("lhnJWT")?"nocookie":JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).jti,lhnJsSdk.log("visitor socket closed",lhnjti,navigator.userAgent)})),lhnJsSdk.lhnsocket.onError((function(e,n,t){lhnjti=null==lhnStorage.getData("lhnJWT")?"nocookie":JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).jti,lhnJsSdk.log("visitor socket closed",lhnjti,navigator.userAgent),n===WebSocket&&0===t?(longPollAttempted=!0,lhnJsSdk.lhnsocket.replaceTransport(LongPoll),lhnJsSdk.lhnsocket.connect()):(n!==WebSocket&&0===t&&!0===longPollAttempted||n!==WebSocket&&t>0)&&(lhnJsSdk.lhnsocket.disconnect(),longPollAttempted=!1)})),lhnJsSdk.lhnsocket.connect())}function reconnectSocketInterval(e){return[500,1e3,1e3,2e3,3e3][e-1]||5e3}function startSocketTimer(){socketTimerStarted||(socketTimerStarted=!0,socket_timer=setInterval((function(){isSocketReady()?isVisitorChannelReady()&&isChatChannelReady()||reconnectChannels():connectSocket(null,reconnectChannels)}),3e4))}function stopSocketTimer(){clearInterval(socket_timer),socketTimerStarted=!1}function closeSocketConnection(){void 0!==lhnJsSdk.lhnsocket&&null!=lhnJsSdk.lhnsocket&&(lhnJsSdk.lhnsocket.disconnect(),lhnJsSdk.lhnsocket=null)}function startInactivityTimer(){inactivityTimerStarted||(inactivityTimerStarted=!0,inactivity_timer=setInterval((function(){null==lhnJsSdk.chatSession&&(stopSocketTimer(),stopInactivityTimer(),closeSocketConnection())}),3e5))}function stopInactivityTimer(){clearInterval(inactivity_timer),inactivityTimerStarted=!1}function isSocketConnecting(){return void 0!==lhnJsSdk.lhnsocket&&(null!=lhnJsSdk.lhnsocket&&(lhnJsSdk.lhnsocket.isConnected()||"connecting"===lhnJsSdk.lhnsocket.connectionState()))}function isSocketReady(){return void 0!==lhnJsSdk.lhnsocket&&(null!=lhnJsSdk.lhnsocket&&lhnJsSdk.lhnsocket.isConnected())}function isVisitorChannelReady(){if(!isSocketReady())return!1;if(0==lhnJsSdk.lhnsocket.channels.length)return!1;var e=getChannel("visitor_session");return null!=e&&"joined"===e.state}function isChatChannelReady(){if(!isSocketReady())return!1;if(null==lhnJsSdk.chatSession)return!0;if(0==lhnJsSdk.lhnsocket.channels.length)return!1;var e=getChannel("chat_session");return null!=e&&"joined"===e.state}function getChannel(e){for(var n=0;n
'+e.text+'
').insertBefore(".lhnWindow-chat_input_jumplogic"),void 0!==lhnQuery(".lhnChat")[0]&&scrollChat()))})),lhnJsSdk.vChan.on("jump_logic:new_question",(function(e){1==lhnJsSdk.isHOC&&(parseInt(lhnQuery("#lhnHelpOutCenter").css(lhnJsSdk.settings.styles.position))<0||!lhnQuery("#hocSyschat").hasClass("hocactive")||"hidden"==lhnQuery("#lhnHelpOutCenter").css("visibility"))?openHOC("c",{is_lhn_hoc_button:!0}):jl_working||(void 0!==e.html?(lhnQuery(e.html).insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat()):setTimeout((function(){fetchNextJumpLogic(e.win,e.goto,e.opts)}),1500))})),lhnJsSdk.vChan.on("jump_logic:dept",(function(e){lhnJsSdk.isOnline=null!=lhnJsSdk.chatSession||e.chat.online_status,lhnJsSdk.options.dept=e.dept,online_type=0!=lhnJsSdk.options.dept?"department":"client",updateOnlineStatus({chat:{online_status:lhnJsSdk.isOnline,online_type:online_type}}),"function"==typeof window.lhnStatusUpdate&&window.lhnStatusUpdate()})),lhnJsSdk.vChan.on("jump_logic:ended",(function(e){jumplogic_chatended()})),lhnJsSdk.vChan.on("survey:submitted",(function(){"survey"==chatType&&(closeHOC(),chatType="prechat",lhnQuery("#hocSyschat").html(""),firstOpen.chat=!0,launchedChat=!1)})),lhnJsSdk.vChan.on("jump_logic:goto",(function(e){jl_working&&(opts=e.opts,opts.from_goto=!0,embedPreChatQuestionCallback(e,opts))})),lhnJsSdk.vChan.on("jump_logic:show_typing",(function(e){chatTypingStatus({operator_typing:e.operator_typing})})),lhnJsSdk.vChan.on("jump_logic:text",(function(e){0==lhnQuery("#"+e.message_id).length&&(payload_text=jumpLogicTokenReplace(e.text),payload_text=convertUrlsAndImages(payload_text),lhnQuery("
'+payload_text+'
').insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat())})),lhnJsSdk.vChan.on("jump_logic:ai_text",(function(e){0==lhnQuery("#"+e.message_id).length&&(payload_text=jumpLogicTokenReplace(e.text),payload_text=convertUrlsAndImages(payload_text),lhnQuery("
'+payload_text+'
').insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat())})),lhnJsSdk.vChan.on("jump_logic:close_window",(function(e){lhnJsSdk.closeHOC()})),lhnJsSdk.vChan.on("jump_logic:start_chat",(function(e){isOrigin(e)&&jl_working&&jumpLogicStartChat(e.opts)})),lhnJsSdk.vChan.on("jump_logic:restart_bot",(function(e){lhnQuery(".lhnChat [id^='fld_'], .lhnChat [for^='fld_'], .lhnChat .lhnOperatorMessage, .lhnChat .lhnCustomerMessage").attr("id","")})),lhnJsSdk.vChan.on("jump_logic:chat_ended",(function(e){chatEnded()})),lhnJsSdk.vChan.on("jump_logic:kb_article",(function(e){0==lhnQuery("#"+e.message_id).length&&(lhnQuery('
').insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat(),embedKbArticleCallback(e,{el:"lhnKbEmbed"}),lhnQuery(document).ready((function(){lhnQuery(document).on("click","#lhnKbEmbed",(function(){embedExternalPage(),embedKbArticleCallback(e,{el:"lhnExternal"})})),scrollChat()})))})),lhnJsSdk.vChan.on("jump_logic:callback",(function(e){if(0==lhnQuery("#"+e.message_id).length){var n=e.action.callback,t=e.action.win;lhnQuery('
'+lhnJsSdk.dict.callbackTitle+"
").insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat(),"v1"!=hocVersion?embedCallbackCallback(e,{el:"lhnExternalContainer",win:t}):(lhnQuery("#hocSyschat").append('
'),embedCallbackCallback(e,{el:"cb"+n+" .sf_main_form",win:t})),lhnQuery(document).ready((function(){lhnQuery(document).on("click","[rel='cb"+n+"']",(function(){return"v1"!=hocVersion?externalPageOpen():lhnQuery("#cb"+n).removeClass("lhnHide"),!1})),lhnQuery(document).on("click",".secure_forms .form_close",(function(){return lhnQuery("#cb"+n).addClass("lhnHide"),!1})),lhnQuery(document).on("click",".lhnHocExternalClose",(function(){return lhnQuery("[rel='cb"+n+"']").addClass("lhnHide"),!1}))}))}})),lhnJsSdk.vChan.on("jump_logic:ticket",(function(e){if(0==lhnQuery("#"+e.message_id).length){var n=e.action.ticket,t=e.action.win;lhnQuery('
'+lhnJsSdk.dict.ticketTitle+"
").insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat(),"v1"!=hocVersion?embedTicketCallback(e,{el:"lhnExternalContainer",win:t}):(lhnQuery("#hocSyschat").append('
'),embedTicketCallback(e,{el:"ticket"+n+" .sf_main_form",win:t})),lhnQuery(document).ready((function(){lhnQuery(document).on("click","[rel='ticket"+n+"']",(function(){return"v1"!=hocVersion?externalPageOpen():lhnQuery("#ticket"+n).removeClass("lhnHide"),!1})),lhnQuery(document).on("click",".secure_forms .form_close",(function(){return lhnQuery("#ticket"+n).addClass("lhnHide"),!1})),lhnQuery(document).on("click",".lhnHocExternalClose",(function(){return lhnQuery("[rel='ticket"+n+"']").addClass("lhnHide"),!1}))}))}})),lhnJsSdk.vChan.on("jump_logic:secure_form",(function(e){var n=e.action.secure_form;"v1"!=hocVersion&&embedExternalPage(),lhnQuery(e.html).insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat(),"v1"!=hocVersion&&embedExternalPage(),loadSecureForms(e.id,n,{prechat:!0})})),lhnJsSdk.vChan.on("jump_logic:custom_js",(function(payload){custom_js_obj="object"!=_typeof(payload.action.custom_js)?JSON.parse(payload.action.custom_js):payload.action.custom_js,custom_js=jumpLogicTokenReplace(custom_js_obj.js),callback_index=payload.action.order,"feedback"==custom_js_obj.type?(window.lhnBotCustomJsCallback=function(e){lhnQuery('
'+jumpLogicTokenReplace(e)+'
').insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat(),processActions(payload.data)},window.lhnBotCallback=lhnBotCustomJsCallback,i=action_length,eval(custom_js)):eval(custom_js)})),lhnJsSdk.vChan.on("jump_logic:math_formula",(function(e){lhnQuery(e.result).insertBefore(".lhnWindow-chat_input_jumplogic"),scrollChat()})),lhnJsSdk.vChan.on("system:stop",(function(e){stopSocketTimer(),closeSocketConnection()})),lhnJsSdk.vChan.on("system:reconnect",(function(e){connectSocket(null,reconnectChannels)})),lhnJsSdk.vChan.on("jump_logic:step_done",(function(){jl_working=!1})),lhnJsSdk.vChan.onClose((function(){lhnjti=null==lhnStorage.getData("lhnJWT")?"nocookie":JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).jti,lhnJsSdk.log("visitor channel closed",lhnjti,navigator.userAgent)})),lhnJsSdk.vChan.join().receive("ok",(function(e){lhnJsSdk.log("Joined Channel","visitor_session:"+JSON.parse(decodeBase64(lhnStorage.getData("lhnJWT").split(".")[1])).jti),lhnJsSdk.isOnline=null!=lhnJsSdk.chatSession||e.chat.online_status,online_type=0!=lhnJsSdk.options.dept?"department":"client",updateOnlineStatus({chat:{online_status:lhnJsSdk.isOnline,online_type:online_type}}),"function"==typeof window.lhnStatusUpdate&&window.lhnStatusUpdate()})).receive("error",(function(e){"forbidden"==e&&(isBlocked=!0,lhnQuery("#lhnHocButton, #lhnHelpOutCenter, #lhnHocInvite").addClass("lhnHide")),vchanLeave(),closeSocketConnection()}))}else setTimeout((function(){connectSocket(null,reconnectChannels)}),500)}function isOrigin(e){return tabId==e.tab_id}function vchanLeave(){vChannelJoined=!1,void 0!==lhnJsSdk.vChan&&null!=lhnJsSdk.vChan&&(lhnJsSdk.vChan.isLeaving()||lhnJsSdk.vChan.isClosed()||lhnJsSdk.vChan.leave())}function chatChannelLeave(){void 0!==lhnJsSdk.chatChan&&null!=lhnJsSdk.chatChan&&(lhnJsSdk.chatChan.isLeaving()||lhnJsSdk.chatChan.isClosed()||lhnJsSdk.chatChan.leave())}function qs(e){e=e.replace(/[*+?^$.\[\]{}()|\\\/]/g,"\\$&");var n=location.search.match(new RegExp("[?&]"+e+"=([^&]+)(&|$)","i"));return n&&decodeURIComponent(n[1].replace(/\+/g," "))}function decodeBase64(e){var n,t,a,l={},s=0,o=0,i="",r=String.fromCharCode,h=e.length;for(n=0;n<64;n++)l["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(n)]=n;for(t=0;t=8;)((a=s>>>(o-=8)&255)||t");case"object":e.html(lb2br(e.html()));break;default:return e}}function html2text(e){return e.replace(/&/g,"&").replace(//g,">")}function convertUrlsAndImages(e){var n=(e=(e=e.replace(/(^|[^"'])(https?:\/\/\S*\.(png|jpg|jpeg|gif))([\s<]|$)/gi,'$1
$2$4')).replace(/(?:(?:)|(?:
)|(?:)|(?:)|(?:)|(?:)|(?:)|(?:<.+?value=.+?>)|(?:[a-z0-9.-]+@[a-z0-9.-]+)|\b(?!http)[a-z]+:\/\/[^\s<>]+[^\s<>.]|((?:(?:(?:https?:)?(?:\/\/)?(?:[a-z0-9-]+\.)+(?:[a-z]{2,}|\d{1,})(?:\/|\?)(?:[^\s<>\/\?]*[^\s<>.])*(?:(?:\/|\?)[^\s<>\/\?]*[^\s<>.])*)|(?:(?:https?:)?(?:\/\/)[^\s<>]+[^\s<>.])|(?:\b(?:[a-z0-9-]+\.){2,}(?:[a-z]{2,}|\d{1,}))|(?:\b(?:[a-z0-9-]+\.)(?:com|net|org)))))/gim,(function(e,n){return void 0!==n?''+e+"":e}))).match(/(.*?)<\/a>/gi);if(null!=n)for(var t=0;t