PageSourceSearch

https://www.manchester-metrology.co.uk/packs/js/live_chat-e3f6f677f4c0b20b7d66.js

js manchester-metrology.co.uk collected 2026-10-01 00:47:29 UTC 23,263 bytes, 3 lines download raw bytes

1/*! For license information please see live_chat-e3f6f677f4c0b20b7d66.js.LICENSE.txt */
2"use strict";(self.webpackChunkmh_web=self.webpackChunkmh_web||[]).push([[826],{29077:function(e,t,n){var a=n(32293),r=n(57203),i='\n  <div class="chat border hidden [chat_template_class]">\n    <div class="d-flex flex-wrap">\n      <div class="messages__container w-100">\n\n      </div>\n      <div class="messages_input__container d-flex w-100 border-top">\n        <div class="messages_input__wrapper h-100">\n          <textarea class="messages_input border-right bg-white h-100" placeholder="'.concat(a.A.t("type_your_message"),'" style="outline: 0;"></textarea>\n        </div>\n        <button class="btn border-0 btn-light rounded-0 send-message h-100 d-flex align-items-center justify-content-center shadow-none ">\n          <i class="send-message-icon fa fa-paper-plane"></i>\n        </button>\n      </div>\n      <div class="chat-overflow hidden p-3" data-role="message-form">\n      </div>\n    </div>\n  </div>\n'),o=n(95869),s=(n(60960),/[a-z0-9][.']?(?:(?:[a-z0-9_-]+[.'])*[a-z0-9_-]+)*@(?:[a-z0-9]+(?:\.|-{1,2}))*[a-z0-9]+\.[a-z]{2,}/gi),c=n(69150);function u(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,l(a.key),a)}}function l(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function h(e,t,n){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}var p=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=h(this,t,['[data-role="chat_contact_form"]'])).liveChatInstance=e,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(t,e),n=t,a=[{key:"onSubmit",value:function(e){e.preventDefault(),this.liveChatInstance.onSubmit(e,this.formData())}}],r=[{key:"init",value:function(e){return new t(e)}}],a&&u(n.prototype,a),r&&u(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,a,r}(c.A),g=n(74692);function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){b(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function b(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(){w=function(){return t};var e,t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,a){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),s=new P(a||[]);return r(o,"_invoke",{value:M(e,n,s)}),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var f="suspendedStart",d="suspendedYield",m="executing",p="completed",g={};function v(){}function y(){}function b(){}var _={};u(_,o,(function(){return this}));var k=Object.getPrototypeOf,O=k&&k(k(T([])));O&&O!==n&&a.call(O,o)&&(_=O);var C=b.prototype=v.prototype=Object.create(_);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}
vendor: 5,010 bytes, line 2
2))}function x(e,t){function n(r,i,o,s){var c=h(e[r],e,i);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&a.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(l).then((function(e){u.value=e,o(u)}),(function(e){return n("throw",e,o,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,a){function r(){return new t((function(t,r){n(e,a,t,r)}))}return i=i?i.then(r,r):r()}})}function M(t,n,a){var r=f;return function(i,o){if(r===m)throw Error("Generator is already running");if(r===p){if("throw"===i)throw o;return{value:e,done:!0}}for(a.method=i,a.arg=o;;){var s=a.delegate;if(s){var c=j(s,a);if(c){if(c===g)continue;return c}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(r===f)throw r=p,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);r=m;var u=h(t,n,a);if("normal"===u.type){if(r=a.done?p:d,u.arg===g)continue;return{value:u.arg,done:a.done}}"throw"===u.type&&(r=p,a.method="throw",a.arg=u.arg)}}}function j(t,n){var a=n.method,r=t.iterator[a];if(r===e)return n.delegate=null,"throw"===a&&t.iterator.return&&(n.method="return",n.arg=e,j(t,n),"throw"===n.method)||"return"!==a&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+a+"' method")),g;var i=h(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(a.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=b,r(C,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:y,configurable:!0}),y.displayName=u(b,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,c,"GeneratorFunction")),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},S(x.prototype),u(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,a,r,i){void 0===i&&(i=Promise);var o=new x(l(e,n,a,r),i);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},S(C),u(C,c,"Generator"),u(C,o,(function(){return this})),u(C,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var a in t)n.push(a);return n.reverse(),function e(){for(;n.length;){var a=n.pop();if(a in t)return e.value=a,e.done=!1,e}return e.done=!0,e}},t.values=T,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&a.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(a,r){return s.type="throw",s.arg=t,n.next=a,r&&(n.method="next",n.arg=e),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=a.call(o,"catchLoc"),u=a.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];
2if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var a=n.completion;if("throw"===a.type){var r=a.arg;L(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,a){return this.delegate={iterator:T(t),resultName:n,nextLoc:a},"next"===this.method&&(this.arg=e),g}},t}function _(e,t,n,a,r,i,o){try{var s=e[i](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(a,r)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var i=e.apply(t,n);function o(e){_(i,a,r,o,s,"next",e)}function s(e){_(i,a,r,o,s,"throw",e)}o(void 0)}))}}function O(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,C(a.key),a)}}function C(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var S='[data-role="chat_email_submit_btn"]',x='[data-role="chat_email_input"]',M='[data-role="chat_email_form"]',j='[data-role="message-form"]',E='[data-automated-chat-response="true"]',L={en:"en-US",de:"de-DE",fr:"fr-FR",it:"it-IT",nl:"nl-NL",pt:"pt-PT","zh-CN":"zh-CN",cs:"cs-CZ",da:"da-DK",ru:"ru-RU",sk:"sk-SK"},P={hour:"numeric",minute:"2-digit"};function T(){try{var e="__test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(t){return!1}}var D=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initializeStates(),this.prepareChatContainer(),window.location.search.match(/chat=true/)&&this.toggleChatWindow(),this.email&&(this.onFirstChatOpen(),this.loadChatMessages())}return t=e,n=[{key:"initializeStates",value:function(){this.isOpened=!1,this.isLoaded=!1,this.formData={},this.messages=this.getMessages()}},{key:"bindEvents",value:function(){this.bindToggleChatWindow(),this.bindCloseChat(),this.bindSubmitButton(),this.bindMarkMessagesAsRead(),this.bindMessageInputKeyPress()}},{key:"bindToggleChatWindow",value:function(){var e=this;g(".live-chat-icon").click((function(t){t.preventDefault(),e.toggleChatWindow()}))}},{key:"bindCloseChat",value:function(){var e=this;g(".site-footer, .page-inner").on("click",(function(){e.closeChat()}))}},{key:"bindSubmitButton",value:function(){var e=this;this.$chat.find(".send-message").click((function(t){return e.submit()}))}},{key:"bindMarkMessagesAsRead",value:function(){var e=this;this.$messageInput.on("focus",(function(){return e.markMessagesAsRead()}))}},{key:"bindMessageInputKeyPress",value:function(){var e=this;this.$messageInput.keypress((function(t){13!==t.which||t.shiftKey||e.submit()}))}},{key:"bindChatElements",value:function(){this.$messagesContainer=this.$chat.find(".messages__container"),this.$messageInput=this.$chat.find(".messages_input"),this.$unreadMessagesBadge=g(".live-chat-icon .floating-btn--indicator"),this.$unreadMessagesBadgeBackgroun
2d=g(".live-chat-icon .floating-btn--background"),this.email=JSON.parse(localStorage.getItem("contacts")||"{}").email,this.subscribed=!1,this.bindEvents()}},{key:"setChatContainer",value:function(){this.chatWithContactForm=g("[data-chat-contact-form]").data("chat-contact-form"),this.$chat=g(i.replace("[chat_template_class]",this.chatWithContactForm?"chat-contact-form":"chat-email-form"))}},{key:"prepareChatContainer",value:(h=k(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.setChatContainer(),this.bindChatElements();case 2:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"onFirstChatOpen",value:function(){g(document.body).append(this.$chat),this.prefillWithMessages(),this.email&&this.joinGuestChat(),this.isLoaded=!0}},{key:"toggleChatWindow",value:function(){this.$chat.hasClass("chat--visible")?this.closeChat():this.openChat()}},{key:"closeChat",value:function(){this.$chat.removeClass("chat--visible"),this.$chat.fadeOut(300),this.$unreadMessagesBadge.text()&&this.displayUnreadMessagesBadge(!0)}},{key:"openChat",value:function(){this.isOpened||(this.isOpened=!0,this.isLoaded||this.onFirstChatOpen(),(new o.A).send("event",{event_category:"live_chat",event_action:"open"})),this.$chat.fadeIn(150),this.$chat.addClass("chat--visible"),this.displayUnreadMessagesBadge(!1),this.$messageInput.focus(),this.scrollToBottom()}},{key:"getDesignatedForm",value:function(){if(this.chatWithContactForm)return g.getJSON("/api/leads/new",{data_role:"chat_contact_form",id:"chat_contact_form"},(function(e){g(j).append('\n          <div class="text-white mb-3 small text-center">'.concat(a.A.t("lets_begin_by_filling_out"),"</div>\n          ").concat(e.html,"\n        "))}));g(j).append('\n        <form class="chat-email-form d-flex h-100 flex-column align-items-center justify-content-center">\n          <div class="text-white mb-4">'.concat(a.A.t("provide_email"),'</div>\n          <div class="input-group overflow-email-input animated" data-role="chat_email_form">\n            <input class="form-control" name="email" placeholder="').concat(a.A.t("email"),'" type="email" data-role="chat_email_input">\n            <div class="input-group-append">\n              <button class="btn btn-primary" data-role="chat_email_submit_btn" type="submit">\n                ').concat(a.A.t("submit"),"\n              </button>\n            </div>\n          </div>\n        </form>"))}},{key:"submit",value:(l=k(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.message=this.$messageInput.val().trim(),this.message){e.next=4;break}return this.$messageInput.focus(),e.abrupt("return");case 4:if(!this.email){e.next=8;break}this.sendMessage(),e.next=17;break;case 8:if(g(".chat-overflow").fadeIn(200),!this.chatWithContactForm){e.next=15;break}return e.next=12,this.getDesignatedForm();case 12:p.init(this),e.next=17;break;case 15:this.getDesignatedForm(),this.askForEmail();case 17:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"onSubmit",value:function(e,t){this.formData=t,e.preventDefault(),this.sendMessageThenSaveToLocalStorage()}},{key:"sendMessage",value:function(){var e=this;if(this.message)return new Promise((function(t,n){g.ajax({url:"/api/chat_messages",method:"POST",dataType:"json",data:{chat_message:{first_name:e.formData.first_name,last_name:e.formData.last_name,phone:e.formData.phone,location:e.formData.location,email:e.email,message:e.message,receive_newsletters:"receive_newsletters"in e.formData}}}).done((function(n){var a={id:n.data.id,message:e.message,type:"customer"};e.renderMessage(a,!0),0===e.messages.length&&window.gtag&&"enabled"===g("[data-chat-analytics]").data("chat-analytics")&&window.gtag("event","submit",{event_category:"chat",event_label:"click"}),e.addMessageToLocalStorage(a),e.$messageInput.val(""),t()})).fail((function(e){console.error(e),n(e)}))}))}},{key:"markMessagesAsRead",value:function(){if(this.email){var e=this.getMessages().filter((function(e){return"seller"===e.type})),t=e[e.length-1];g.ajax({url:"/api/chat_messages/read",method:"POST",dataType:"json",data:{chat_message:{email:this.email,last_seller_message_id:t&&t.id}}}).fail((function(e){console.error(e)}))}this.$unreadMessagesBadge.text(""),this.displayUnreadMessagesBadge(!1)}},{key:"renderMessage",value:function(e){var t=e.id,n=e.type,a=e.message,r=g('\n      <div class="'.concat(arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"animate bounceIn ":"","chat_message chat_message--from-").concat(n,'" data-chat-id=').concat(t,'>
2\n        <span class="text-pre-line notranslate">').concat(a,"</span>\n      </div>\n    "));this.$messagesContainer.append(r),setTimeout((function(){r.removeClass("animate"),r.removeClass("bounceIn")}),500),this.scrollToBottom()}},{key:"askForEmail",value:function(){g(".chat-overflow").fadeIn(200),this.bindEmailFormEvents()}},{key:"bindEmailFormEvents",value:function(){var e=this;g(S).on("click",(function(t){t.preventDefault(),e.sendMessageThenSaveToLocalStorage()})),g(x).on("keypress",(function(t){e.removeHeadShakeClass()}))}},{key:"sendMessageThenSaveToLocalStorage",value:function(){var e=this;if(this.chatWithContactForm?this.email=this.formData.email:this.email=g(".overflow-email-input input").val(),this.email.match(s)){g(".chat-overflow").fadeOut(100);var t=this.sendMessage();t&&(t.then((function(){e.saveContactToLocalStorage(),g(E).data("automated-chat-response")&&setTimeout((function(){e.renderMessage({id:null,type:"seller",message:a.A.t("we_will_respond_to_you")},!0)}),1e3)})),this.subscribed||this.joinGuestChat())}else this.addHeadShakeClass()}},{key:"saveContactToLocalStorage",value:function(){var e=JSON.parse(localStorage.getItem("contacts")||"{}");localStorage.setItem("contacts",JSON.stringify(y(y(y({},e),this.formData),{},{email:this.email})))}},{key:"addHeadShakeClass",value:function(){g(M).addClass("headShake")}},{key:"removeHeadShakeClass",value:function(){g(M).removeClass("headShake")}},{key:"joinGuestChat",value:function(){var e=document.querySelector('meta[name="cable-url"]').content,t=(0,r.createConsumer)("".concat(e,"?email=").concat(this.email)),n={received:g.proxy(this.onNewGuestChatMessage,this)};t.subscriptions.create({channel:"GuestChatChannel"},n),this.subscribed=!0}},{key:"onNewGuestChatMessage",value:function(e){if("new_message"===e.type)this.loadChatMessages();else{var t=e.chat_message_id;this.checkLastSentMessage(t)}}},{key:"checkLastSentMessage",value:function(e){var t=this;g.getJSON("/api/chat_messages/".concat(e,"?email=").concat(this.email),(function(n){var a=n.data.attributes;a.read_at&&t.addReadTimestamp(y({id:e},a))}))}},{key:"isBefore",value:function(e,t){return e<t}},{key:"isBeforeDate",value:function(e){var t=new Date,n=e.getDate(),a=e.getMonth()+1,r=e.getFullYear(),i=t.getDate(),o=t.getMonth()+1,s=t.getFullYear(),c=new Date("".concat(r,"-").concat(a,"-").concat(n)),u=new Date("".concat(s,"-").concat(o,"-").concat(i));return this.isBefore(c,u)}},{key:"addReadTimestamp",value:function(e){var t,n=new Date(e.read_at);t=this.isBeforeDate(n)?new Intl.DateTimeFormat(L[a.A.lang]||a.A.lang,y(y({},P),{},{year:"numeric",month:"short",day:"2-digit"})).format(n):new Intl.DateTimeFormat(L[a.A.lang]||a.A.lang,P).format(n);var r='\n      <div class="chat_timestamp-badge small text-right text-secondary '.concat(a.A.has("read_at")?"notranslate":"",'">\n        ').concat(a.A.t("read_at",{timestamp:t}),"\n      </div>\n    ");g(".chat_timestamp-badge").hide(),g("[data-chat-id=".concat(e.id,"]")).after(r),this.scrollToBottom()}},{key:"loadChatMessages",value:function(){var e=this;g.getJSON("/api/chat_messages?email=".concat(this.email),(function(t){var n=t.data;if(n.length&&n.length.toString()!==e.$unreadMessagesBadge.text()&&(e.displayUnreadMessagesBadge(!0),e.$unreadMessagesBadge.text(n.length)),0===n.length){var a=e.messages[e.messages.length-1];a&&a.id&&e.checkLastSentMessage(a.id)}else n.forEach((function(t){if(!g("[data-chat-id=".concat(t.id,"]")).length){var n={id:t.id,type:"seller",message:t.attributes.message};e.renderMessage(n,!0),e.addMessageToLocalStorage(n)}}))}))}},{key:"prefillWithMessages",value:function(){var e=this;this.messages[0]?this.messages.forEach((function(t){e.renderMessage(t)})):setTimeout((function(){e.renderMessage({id:null,type:"seller",message:a.A.t("default_chat_message")},!0)}),1e3)}},{key:"addMessageToLocalStorage",value:function(e){this.messages.push(e),localStorage.setItem("chat-messages",JSON.stringify(this.messages))}},{key:"displayUnreadMessagesBadge",value:function(e){e?(this.$unreadMessagesBadge.show(),this.$unreadMessagesBadgeBackgroun
2d.removeClass("invisible")):(this.$unreadMessagesBadge.hide(),this.$unreadMessagesBadgeBackground.addClass("invisible"))}},{key:"scrollToBottom",value:function(){this.$messagesContainer.scrollTop(this.$messagesContainer.prop("scrollHeight"))}},{key:"getMessages",value:function(){var e=this;return JSON.parse(localStorage.getItem("chat-messages")||"[]").filter((function(t){return e.hasRequiredProps(t)}))}},{key:"hasRequiredProps",value:function(e){return[e.hasOwnProperty("id"),e.hasOwnProperty("message"),e.hasOwnProperty("type")].every((function(e){return e}))}}],c=[{key:"init",value:(u=k(w().mark((function t(){return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==g(".live-chat-icon").length){t.next=2;break}return t.abrupt("return");case 2:if(T()){t.next=5;break}return console.warn("Local Storage is not accessible."),t.abrupt("return");case 5:return t.abrupt("return",new e);case 6:case"end":return t.stop()}}),t)}))),function(){return u.apply(this,arguments)})}],n&&O(t.prototype,n),c&&O(t,c),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,c,u,l,h}(),$=D;n(74692)((function(){$.init()}))}},function(e){e.O(0,[293,882,869,150,692,706,203],(function(){return t=29077,e(e.s=t);var t}));e.O()}]);
3//# sourceMappingURL=live_chat-e3f6f677f4c0b20b7d66.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.