From 3d9e860bbef33841005a976c1f4da3dac9a9744e Mon Sep 17 00:00:00 2001 From: Remigijus Kiminas Date: Tue, 26 Sep 2023 09:11:41 -0400 Subject: [PATCH] Fullheight support in default header --- lhc_web/design/defaulttheme/js/widgetv2/react.app.js | 2 +- .../design/defaulttheme/js/widgetv2/react.app.js.map | 2 +- .../widget/react-app/src/components/HeaderChat.js | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lhc_web/design/defaulttheme/js/widgetv2/react.app.js b/lhc_web/design/defaulttheme/js/widgetv2/react.app.js index 4ec2b723f5..94d98efd6d 100644 --- a/lhc_web/design/defaulttheme/js/widgetv2/react.app.js +++ b/lhc_web/design/defaulttheme/js/widgetv2/react.app.js @@ -1,3 +1,3 @@ /*! For license information please see react.app.js.LICENSE.txt */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.LHCReactAPP=e():t.LHCReactAPP=e()}(self,(function(){return function(){var __webpack_modules__={2858:function(t){t.exports=function(t){if(Array.isArray(t))return t}},1506:function(t){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},8926:function(t){function e(t,e,a,n,i,r,s){try{var o=t[r](s),c=o.value}catch(t){return void a(t)}o.done?e(c):Promise.resolve(c).then(n,i)}t.exports=function(t){return function(){var a=this,n=arguments;return new Promise((function(i,r){var s=t.apply(a,n);function o(t){e(s,i,r,o,c,"next",t)}function c(t){e(s,i,r,o,c,"throw",t)}o(void 0)}))}}},4575:function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},3913:function(t){function e(t,e){for(var a=0;a0||a.chatwidget.getIn(["chatLiveData","status"])===_constants_chat_status__WEBPACK_IMPORTED_MODULE_2__.pA)),r=a.chatwidget.getIn(["chatLiveData","status"])==_constants_chat_status__WEBPACK_IMPORTED_MODULE_2__.sk&&a.chatwidget.getIn(["chatLiveData","uid"])>0;(1==i||r)&&a.chatwidget.hasIn(["chat_ui","survey_id"])&&(a.chatwidget.hasIn(["chat_ui","survey_button"])&&1!==a.chatwidget.getIn(["chat_ui_state","show_survey"])&&1!=i||(n=!0)),a.chatwidget.hasIn(["chat_ui","close_on_unload"])&&"embed"==a.chatwidget.get("mode")&&(!1!==a.chatwidget.get("isMobile")&&!0!==n||_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.sendMessageParent("endChat",[{sender:"endButton"}])),"popup"==a.chatwidget.get("mode")&&1==n&&_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.sendMessageParent("endChat",[{sender:"endButton"}]),a.chatwidget.hasIn(["chatData","id"])&&a.chatwidget.hasIn(["chatData","hash"])?axios__WEBPACK_IMPORTED_MODULE_0___default().post(window.lhcChat.base_url+"chat/userclosechat/"+a.chatwidget.getIn(["chatData","id"])+"/"+a.chatwidget.getIn(["chatData","hash"]),null,defaultHeaders):!0===a.chatwidget.getIn(["proactive","has"])&&"popup"==window.lhcChat.mode&&window.opener&&hideInvitation()(t,e)}}function checkErrorCounter(){2==syncStatus.error_counter&&_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.sendMessageParent("reloadWidget",[])}function addMessage(t,e){return function(a,n){if(e||a({type:"ADD_MSG_TO_STORE",data:t.msg}),1!=syncStatus.add_msg){syncStatus.add_msg=!0;try{_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("messageSend",[{chat_id:t.id,hash:t.hash,msg:t.msg}])}catch(t){_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.logJSError({stack:JSON.stringify(JSON.stringify(t))})}axios__WEBPACK_IMPORTED_MODULE_0___default().post(window.lhcChat.base_url+"widgetrestapi/addmsguser",t,defaultHeaders).then((function(e){try{(e.data.error||n().chatwidget.getIn(["chatLiveData","error"]))&&a({type:"ADD_MESSAGES_SUBMITTED",data:{r:e.data.r,msg:t.msg}}),syncStatus.add_msg=!1,fetchMessages({active_widget:!0,theme:t.theme,chat_id:t.id,lmgsid:n().chatwidget.getIn(["chatLiveData","lmsgid"]),hash:t.hash})(a,n),e.data.t&&_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.sendMessageParent("botTrigger",[{trigger:e.data.t}]),void 0===e.data.r||!0===e.data.error&&!0===e.data.system?(syncStatus.error_counter++,2==syncStatus.error_counter&&(_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.logJSError({stack:JSON.stringify(JSON.stringify(e)+"\nRD:"+JSON.stringify(e.data)+"\nRH:"+JSON.stringify(e.headers)+"\nRS:"+JSON.stringify(e.status))}),checkErrorCounter()),_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("messageSendError",[{chat_id:t.id,hash:t.hash,msg:JSON.stringify(e.data)}])):syncStatus.error_counter=0}catch(t){throw t}finally{syncStatus.add_msg=!1,syncStatus.add_msg_pending.length>0&&addMessage(syncStatus.add_msg_pending.shift(),!0)(a,n)}})).catch((function(e){if(isNetworkError(e))a({type:"ADD_MESSAGES_SUBMITTED",data:{r:"SEND_CONNECTION",msg:t.msg}}),a({type:"NO_CONNECTION",data:!0});else{syncStatus.error_counter++;var i;i=e.response?JSON.stringify(JSON.stringify(e)+"\nRD:"+JSON.stringify(e.response.data)+"\nRH:"+JSON.stringify(e.response.headers)+"\nRS:"+JSON.stringify(e.response.status)):(e.request,JSON.stringify(JSON.stringify(e))),2==syncStatus.error_counter?(_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.logJSError({stack:i}),_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("messageSendError",[{chat_id:t.id,hash:t.hash,msg:i}]),checkErrorCounter()):(a({type:"ADD_MESSAGES_SUBMITTED",data:{r:"SEND_FAILED",msg:t.msg}}),syncStatus.add_msg=!1,addMessage(t,!0)(a,n))}syncStatus.add_msg=!1}))}else syncStatus.add_msg_pending.push(t)}}function userTyping(t,e){return function(a,n){var i=n();"true"===t?_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("visitorTyping",[{chat_id:i.chatwidget.getIn(["chatData","id"]),hash:i.chatwidget.getIn(["chatData","hash"]),status:!0,msg:e}]):_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("visitorTyping",[{chat_id:i.chatwidget.getIn(["chatData","id"]),hash:i.chatwidget.getIn(["chatData","hash"]),status:!1}]),i.chatwidget.get("overrides").contains("typing")||axios__WEBPACK_IMPORTED_MODULE_0___default().post(window.lhcChat.base_url+"chat/usertyping/"+i.chatwidget.getIn(["chatData","id"])+"/"+i.chatwidget.getIn(["chatData","hash"])+"/"+t,{msg:e},defaultHeaders).then((function(t){})).catch((function(t){console.log(t)}))}}function submitInlineSurvey(t){return axios__WEBPACK_IMPORTED_MODULE_0___default().post(window.lhcChat.base_url+"survey/fillinline",t,defaultHeaders)}},6313:function(t,e,a){"use strict";var n=a(4575),i=a.n(n),r=a(3913),s=a.n(r),o=a(2205),c=a.n(o),l=a(8585),d=a.n(l),u=a(9754),h=a.n(u),p=a(7294);var _=function(t){c()(r,t);var e,a,n=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h()(e);if(a){var i=h()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d()(this,t)});function r(t){return i()(this,r),n.call(this,t)}return s()(r,[{key:"render",value:function(){return p.createElement(p.Fragment,null,p.createElement("div",{className:"fade modal-backdrop show"}),p.createElement("div",{role:"dialog",id:"dialog-content","aria-modal":"true",className:"fade modal show d-block p-2",tabIndex:"-1"},p.createElement("div",{className:"modal-content p-2 "+(this.props.full_height?"h-100":"")},this.props.as_html&&p.createElement("div",{className:this.props.full_height?"h-100":"",dangerouslySetInnerHTML:{__html:this.props.text}}),!this.props.as_html&&p.createElement("p",null,this.props.text),p.createElement("div",{className:"modal-footer"},p.createElement("button",{className:"btn btn-secondary btn-sm",onClick:this.props.close,type:"button"},this.props.closeText)))))}}]),r}(p.PureComponent);e.Z=_},5918:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(7154),_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4575),_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__),_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(3913),_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__),_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(1506),_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__),_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2205),_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__),_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(8585),_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__),_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(9754),_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__),_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(9713),_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__),react__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(7294),html_react_parser__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(488),html_react_parser__WEBPACK_IMPORTED_MODULE_9___default=__webpack_require__.n(html_react_parser__WEBPACK_IMPORTED_MODULE_9__),react_redux__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(6458);function _createSuper(t){var e=_isNativeReflectConstruct();return function(){var a,n=_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(t);if(e){var i=_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this,a)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var ChatBotIntroMessage=function(_PureComponent){_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(ChatBotIntroMessage,_PureComponent);var _super=_createSuper(ChatBotIntroMessage);function ChatBotIntroMessage(t){var e;return _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this,ChatBotIntroMessage),e=_super.call(this,t),_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(e),"state",{value:""}),e.abstractClick=e.abstractClick.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(e)),e.updateTriggerClicked=e.updateTriggerClicked.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(e)),e.processBotAction=e.processBotAction.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(e)),e.disableEditor=!1,e}return _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(ChatBotIntroMessage,[{key:"getDirectInnerText",value:function(t){for(var e=t.childNodes,a="",n=0;n'+e.innerHTML)}},{key:"removeMetaMessage",value:function(t){var e=document.getElementById("messages-scroll");if(e){var a,n=e.getElementsByClassName("meta-message-"+t);for(a=0;a1&&this.onchangeAttr({value:-1}):this.onchangeAttr({value:this.props.setDefaultValue||this.props.departments.getIn(["departments",0]).get("value")}))}},{key:"render",value:function(){var t=this,e=this.props.t,a=null;if(this.props.departments.get("departments").size>1&&!this.props.departments.hasIn(["settings","hide_department"])){var n=["form-control","form-control-sm"];!0===this.props.isInvalid&&n.push("is-invalid");var i=this.props.departments.get("departments").map((function(t){return g.createElement("option",{key:"dep-"+t.get("value"),value:t.get("value")},t.get("name")," ",t.get("online")?"":e("department.offline"))}));a=g.createElement("div",{className:"form-group"},g.createElement("label",{className:"control-label"},this.props.departments.getIn(["settings","label"]),"*"),g.createElement("select",{id:"id-department-field",defaultValue:this.props.setDefaultValue||this.props.defaultValueField,className:n.join(" "),onChange:function(e){return t.onchangeAttr({value:e.target.value})}},this.props.departments.hasIn(["settings","optional"])&&g.createElement("option",{value:"-1"},this.props.departments.getIn(["settings","optional"])),i))}var r=null;if(!0===this.props.departments.getIn(["settings","product"])){var s=["form-control","form-control-sm"];!0===this.props.isInvalidProduct&&s.push("is-invalid");var o=this.props.departments.has("products")?this.props.departments.get("products").map((function(t){return g.createElement("option",{key:"product-"+t.get("value"),value:t.get("value")},t.get("name"))})):"";this.props.departments.has("products")&&this.props.departments.get("products").size>0&&(r=g.createElement("div",{className:"form-group"},g.createElement("label",{className:"control-label"},e("department.product"),!0===this.props.departments.getIn(["settings","product_required"])?"*":""),g.createElement("select",{className:s.join(" "),onChange:function(e){return t.onchangeAttrProduct({value:e.target.value})}},g.createElement("option",{value:""},e("department.choose_a_product")),o)))}return null!==r||null!==a?g.createElement("div",{className:"col-12"},a,r):null}}]),r}(g.Component);e.Z=(0,v.$j)()((0,f.Z)()(w))},7786:function(t,e,a){"use strict";var n=a(4575),i=a.n(n),r=a(3913),s=a.n(r),o=a(1506),c=a.n(o),l=a(2205),d=a.n(l),u=a(8585),h=a.n(u),p=a(9754),_=a.n(p),g=a(9713),f=a.n(g),m=a(7294),v=a(7139);var w=function(t){d()(r,t);var e,a,n=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return i()(this,r),e=n.call(this,t),f()(c()(e),"state",{hiddenIfPrefilled:!1}),e.onchangeAttr=e.onchangeAttr.bind(c()(e)),e.onFileAdded=e.onFileAdded.bind(c()(e)),e}return s()(r,[{key:"onchangeAttr",value:function(t){if(this.props.onChangeContent({id:this.props.field.get("name"),value:t.value,field:this.props.field}),"dropdown"==this.props.field.get("type")){var e=parseInt(t.target.options[t.target.selectedIndex].getAttribute("dep-id"));e>0&&this.props.onChangeContent({id:"DepartamentID",value:e,subject_id:t.target.options[t.target.selectedIndex].getAttribute("subject-id")})}}},{key:"onFileAdded",value:function(t){for(var e=this,a=t.target.files,n=[],i=0;ie.props.field.get("fs")&&o.push(t.name+": "+s("file.to_big_file"))})),o.length>0?alert(o.join("\n")):this.props.onChangeContent({id:this.props.field.get("name"),value:n[0],field:this.props.field})}},{key:"componentDidMount",value:function(){var t=this;"checkbox"==this.props.field.get("type")&&1==this.props.field.get("default")?this.props.onChangeContent({id:this.props.field.get("name"),value:!0}):"dropdown"==this.props.field.get("type")&&(this.props.onChangeContent({id:this.props.field.get("name"),value:this.props.defaultValueField}),this.props.field.get("options").map((function(e){e.get("value")==t.props.defaultValueField&&e.get("dep_id")&&t.props.onChangeContent({set_default:!0,id:"DepartamentID",subject_id:e.has("subject_id")?e.get("subject_id"):null,value:e.get("dep_id")})}))),this.props.attrPrefill&&this.props.attrPrefill.attr_prefill_admin&&this.props.attrPrefill.attr_prefill_admin.forEach((function(e){(e.index==t.props.field.get("identifier")||t.props.field.has("identifier_prefill")&&e.index==t.props.field.get("identifier_prefill"))&&(t.props.onChangeContent({id:t.props.field.get("name"),value:e.value}),t.props.field.has("hide_prefilled")&&1==t.props.field.get("hide_prefilled")&&!1===t.props.isInvalid&&t.setState({hiddenIfPrefilled:!0}))}))}},{key:"render",value:function(){var t=this;if(!0===this.state.hiddenIfPrefilled&&!0!==this.props.isInvalid)return null;var e="col-"+this.props.field.get("width"),a=!0===this.props.field.get("required"),n=[];if(""!=this.props.field.get("class")&&n.push(this.props.field.get("class")),!0===this.props.isInvalid&&n.push("is-invalid"),"text"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("input",{type:"text",className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField,placeholder:this.props.field.get("placeholder")})));if("password"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("input",{type:"password",autocomplete:"new-password",className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField,placeholder:this.props.field.get("placeholder")})));if("textarea"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},!this.props.chatUI.has("hide_message_label")&&"question"==this.props.field.get("identifier")&&m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("textarea",{className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField,placeholder:this.props.field.get("placeholder")})));if("file"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group overflow-hidden"},m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("input",{type:"file",onChange:function(e){return t.onFileAdded(e)},className:this.props.field.get("class"),required:a,name:this.props.field.get("name")})));if("checkbox"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},m.createElement("div",{className:"form-check"},m.createElement("input",{className:n.join(" "),id:"check-for-"+this.props.field.get("name"),defaultChecked:this.props.field.get("default"),type:"checkbox",value:"on",onChange:function(e){return t.onchangeAttr({value:e.target.checked})},required:a,name:this.props.field.get("name")}),m.createElement("label",{className:"form-check-label",for:"check-for-"+this.props.field.get("name"),dangerouslySetInnerHTML:{__html:this.props.field.get("label")}}))));if("hidden"==this.props.field.get("type"))return m.createElement("input",{type:"hidden",className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField,placeholder:this.props.field.get("placeholder")});if("dropdown"==this.props.field.get("type")){var i=this.props.field.get("options").map((function(e){return m.createElement("option",{key:"opt-drop-"+e.get("value"),"subject-id":e.has("subject_id")?e.get("subject_id"):null,"dep-id":e.get("dep_id"),selected:t.props.defaultValueField==e.get("value"),value:e.get("value")},e.get("name"))}));return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("select",{className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({target:e.target,value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField},i)))}return console.log("Unknown field"),null}}]),r}(m.Component);e.Z=(0,v.Z)()(w)},2446:function(t,e,a){"use strict";var n=a(7154),i=a.n(n),r=a(4575),s=a.n(r),o=a(3913),c=a.n(o),l=a(1506),d=a.n(l),u=a(2205),h=a.n(u),p=a(8585),_=a.n(p),g=a(9754),f=a.n(g),m=a(9713),v=a.n(m),w=a(7294),y=a(9669),b=a.n(y),E=a(488),I=a.n(E),D=a(7139),S=a(298),T=a.n(S);var C=function(t){h()(o,t);var e,n,r=(e=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,a=f()(e);if(n){var i=f()(this).constructor;t=Reflect.construct(a,arguments,i)}else t=a.apply(this,arguments);return _()(this,t)});function o(t){var e;return s()(this,o),e=r.call(this,t),v()(d()(e),"state",{body:null}),v()(d()(e),"dismissModal",(function(t){e.props.toggle(),t&&t.stopPropagation()})),v()(d()(e),"generalOnClick",(function(t){var a=e.props.t,n=t["data-bb-code"];if(t["data-promt"]&&"img"==t["data-promt"])(i=prompt(a("bbcode.img_link")))&&(n="["+n+"]"+i+"[/"+n+"]");else if(t["data-promt"]&&"url"==t["data-promt"]){var i;(i=prompt(a("bbcode.link")))&&(n="[url="+i+"]"+a("bbcode.link_here")+"[/url]")}e.props.insertText(n),e.props.toggle()})),v()(d()(e),"generalDataActionClick",(function(t,a){t["data-action"]&&e.props[t["data-action"]]&&e.props[t["data-action"]](t["data-action-arg"]||null),a&&a.stopPropagation()})),e}return c()(o,[{key:"componentDidMount",value:function(){var t=this;b().get(window.lhcChat.base_url+this.props.dataUrl).then((function(e){t.setState({body:e.data});var n=document.getElementById("dialog-content"),i=a(2767),r=n.querySelectorAll('[data-bs-toggle="tab"]');if(r.length>0){var s=0;Array.prototype.forEach.call(r,(function(t){t.tabItem=new i(t)}));var o=new(T())(".tab-content");o.onSwipeLeft((function(){s=s0?s-1:r.length-1,r[s].tabItem.show()}))}})).catch((function(t){console.log(t)}))}},{key:"render",value:function(){var t=this;return w.createElement(w.Fragment,null,null!==this.state.body&&w.createElement("div",{className:"fade modal-backdrop show"}),null!==this.state.body&&w.createElement("div",{role:"dialog",id:"dialog-content","aria-modal":"true",className:"fade modal show d-block",tabIndex:"-1"},I()(this.state.body,{replace:function(e){if(e.attribs&&"react-close-modal"===e.attribs.id)return w.createElement("button",{type:"button",className:"btn-close float-end","data-bs-dismiss":"modal",onClick:t.dismissModal,"aria-label":"Close"});if(e.attribs&&e.attribs.linkaction)return e.attribs.class&&(e.attribs.className=e.attribs.class,delete e.attribs.class),w.createElement("a",i()({},e.attribs,{onClick:function(a){return t.generalDataActionClick(e.attribs,a)}}),(0,E.domToReact)(e.children));if(e.attribs&&e.attribs.bbitem)return e.attribs.class&&(e.attribs.className=e.attribs.class,delete e.attribs.class),w.createElement("a",i()({},e.attribs,{onClick:function(a){return t.generalOnClick(e.attribs)}}),(0,E.domToReact)(e.children));if(e.type&&"tag"===e.type&&e.name&&"input"==e.name&&e.attribs&&e.attribs.type&&"button"==e.attribs.type)return e.attribs.class&&(e.attribs.className=e.attribs.class,delete e.attribs.class),w.createElement("input",i()({},e.attribs,{onClick:function(a){return t.generalDataActionClick(e.attribs,a)}}));if(e.type&&"script"===e.type){if(e.children.length>0)setTimeout((function(){var t=document.createElement("script");t.appendChild(document.createTextNode(e.children[0].data)),document.getElementsByTagName("head").item(0).appendChild(t)}),500);else if(e.attribs&&e.attribs.src){var a=document.createElement("script");a.src=e.attribs.src,a.type="text/javascript",document.getElementsByTagName("head").item(0).appendChild(a)}return w.createElement(w.Fragment,null)}}})))}}]),o}(w.PureComponent);e.Z=(0,D.Z)()(C)},9702:function(t,e,a){"use strict";a.d(e,{Z:function(){return N}});var n=a(4575),i=a.n(n),r=a(3913),s=a.n(r),o=a(1506),c=a.n(o),l=a(2205),d=a.n(l),u=a(8585),h=a.n(u),p=a(9754),_=a.n(p),g=a(9713),f=a.n(g),m=a(7294),v=a(6458),w=a(7139),y=a(7786),b=a(3038),E=a.n(b);var I=function(t){d()(r,t);var e,a,n=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){return i()(this,r),n.call(this,t)}return s()(r,[{key:"render",value:function(){var t=this.props.errors.mapEntries((function(t){var e=E()(t,2),a=e[0],n=e[1];if("captcha"==a||"blocked_user"==a||!isNaN(a))return[m.createElement("li",null,n)]}));return t.size>0?m.createElement("div",{"data-alert":"",className:"mt-2 alert alert-danger alert-dismissible fade show"},m.createElement("ul",{className:"ps-1 m-0"},t)):null}}]),r}(m.Component),D=a(5198),S=a(2446);var T=function(t){d()(o,t);var e,n,r=(e=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,a=_()(e);if(n){var i=_()(this).constructor;t=Reflect.construct(a,arguments,i)}else t=a.apply(this,arguments);return h()(this,t)});function o(t){return i()(this,o),r.call(this,t)}return s()(o,[{key:"componentDidMount",value:function(){new(a(208))(document.getElementById("chat-dropdown-options"))}},{key:"render",value:function(){var t=this,e=this.props.t;return m.createElement("div",{className:"btn-group dropup disable-select ps-1 pt-2"},m.createElement("i",{className:"material-icons settings text-muted",id:"chat-dropdown-options","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},""),m.createElement("div",{className:"dropdown-menu shadow bg-white lhc-dropdown-menu rounded ms-1"},m.createElement("div",{className:"d-flex flex-row px-1"},this.props.bbEnabled&&m.createElement("a",{onClick:function(e){return t.props.toggleModal()},title:e("button.bb_code")},m.createElement("i",{className:"material-icons chat-setting-item text-muted me-0 bbcode-ico"},"")),this.props.langEnabled&&m.createElement("a",{onClick:this.props.changeLanguage,title:e("button.lang")},m.createElement("i",{className:"material-icons chat-setting-item text-muted me-0 lang-ico"},"")))))}}]),o}(m.PureComponent),C=(0,w.Z)()(T),k=a(2137),O=a(5918);var A,x=function(t){d()(r,t);var e,a,n=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){return i()(this,r),n.call(this,t)}return s()(r,[{key:"componentDidMount",value:function(){k.a.sendMessageParent("readInvitation",[{name:this.props.invitation.invitation_name||"Manual"}])}},{key:"render",value:function(){return"message"==this.props.mode?m.createElement(m.Fragment,null,this.props.invitation.prev_msg&&m.createElement(O.Z,{printButton:!1,setBotPayload:this.props.setBotPayload,content:this.props.invitation.prev_msg}),this.props.invitation.message&&m.createElement("div",{className:"message-row message-admin"},m.createElement("span",{className:"usr-tit op-tit"},m.createElement("i",{title:this.props.invitation.name_support||this.props.invitation.extra_profile,className:"chat-operators mi-fs15 me-0"},this.props.invitation.bubble&&this.props.invitation.photo&&m.createElement("img",{src:this.props.invitation.photo,alt:"",className:"profile-msg-pic"}),(!this.props.invitation.photo||!this.props.invitation.bubble)&&m.createElement("i",{className:"material-icons "+(this.props.invitation.bubble?"icon-assistant me-0":"")},"")),!this.props.invitation.bubble&&(this.props.invitation.name_support||this.props.invitation.extra_profile)),m.createElement("div",{className:"msg-body",dangerouslySetInnerHTML:{__html:this.props.invitation.message}})),this.props.invitation.message_full&&m.createElement(O.Z,{printButton:!1,setBotPayload:this.props.setBotPayload,content:this.props.invitation.message_full})):m.createElement(m.Fragment,null,m.createElement("div",{id:"lhc-profile-body"},m.createElement("div",{id:"chat-status-container",className:"operator-info d-flex border-bottom p-2"},m.createElement("div",null,this.props.invitation.photo&&m.createElement("img",{width:"48",height:"48",src:this.props.invitation.photo,title:this.props.invitation.photo_title,alt:""}),!this.props.invitation.photo&&m.createElement("i",{className:"icon-assistant material-icons me-0"},"")),m.createElement("div",{className:"p-1 ps-2 w-100"},this.props.invitation.name_support&&!this.props.invitation.hide_name&&m.createElement("div",{className:"fw-bold"},this.props.invitation.name_support),this.props.invitation.extra_profile&&m.createElement("div",{dangerouslySetInnerHTML:{__html:this.props.invitation.extra_profile}})))),"profile_only"!=this.props.mode&&this.props.invitation.message&&m.createElement("div",{id:"messagesBlock"},m.createElement("div",{className:"bottom-message position-relative"},m.createElement("div",{className:"message-row message-admin pt-1 text-left ms-3"},m.createElement("div",{className:"msg-body",dangerouslySetInnerHTML:{__html:this.props.invitation.message}})))))}}]),r}(m.PureComponent),M=a(6313),P=a(6512);function L(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function R(t){for(var e=1;e0&&this.props.chatwidget.getIn(["onlineData","department","departments"]).map((function(a){a.get("value")==t.value&&(0==a.get("online")&&(e.props.dispatch({type:"dep_default",data:t.value}),e.props.dispatch({type:"onlineStatus",data:!1})),e.props.chatwidget.getIn(["onlineData","dep_forms"])!=t.value&&e.updateOnlineFieldsInit(t.value))}))),"Question"==t.id&&(!0===this.props.chatwidget.getIn(["proactive","has"])&&""!=t.value&&1===this.props.chatwidget.getIn(["chat_ui","proactive_once_typed"])&&1===this.props.chatwidget.getIn(["chat_ui","custom_html_priority"])?(this.props.dispatch({type:"attr_set",attr:["chat_ui","custom_html_priority"],data:0}),this.customHTMLPriority=!0):""==t.value&&1==this.customHTMLPriority&&this.props.dispatch({type:"attr_set",attr:["chat_ui","custom_html_priority"],data:1}))}}},{key:"handleContentChangeCustom",value:function(t){this.props.dispatch({type:"CUSTOM_FIELDS_ITEM",data:{id:t.field.get("index"),value:t.value}})}},{key:"componentDidMount",value:function(){k.a.prefillFields(this),this.updateOnlineFields(),null!==this.props.botPayload&&this.setBotPayload(this.props.botPayload);var t=document.getElementById("CSChatMessage-tmp");null!==t&&document.body.removeChild(t)}},{key:"componentWillUnmount",value:function(){var t=document.getElementById("CSChatMessage");null===t?this.props.setHideMessageField(!0):(this.props.setHideMessageField(!1),t.id="CSChatMessage-tmp",t.style.cssText="position:absolute;left:-999px;bottom:0px;",document.body.appendChild(t))}},{key:"setBotPayload",value:function(t){this.botPayload=t,this.handleSubmit()}},{key:"updateOnlineFieldsInit",value:function(t){this.props.dispatch((0,P.El)({department:this.props.chatwidget.get("department"),product:this.props.chatwidget.get("product"),theme:this.props.chatwidget.get("theme"),mode:this.props.chatwidget.get("mode"),pvhash:this.props.chatwidget.get("pvhash"),phash:this.props.chatwidget.get("phash"),bot_id:this.props.chatwidget.get("bot_id"),trigger_id:this.props.chatwidget.get("trigger_id"),vid:this.props.chatwidget.get("vid"),dep_default:t||this.props.chatwidget.get("departmentDefault")||0,online:1,chat_ui:this.props.chatwidget.get("chat_ui")}))}},{key:"updateOnlineFields",value:function(){!1===this.props.chatwidget.getIn(["onlineData","fetched"])&&this.updateOnlineFieldsInit()}},{key:"componentDidUpdate",value:function(t,e,a){if(this.updateOnlineFields(),document.getElementById("id-container-fluid")&&k.a.sendMessageParent("widgetHeight",[{height:document.getElementById("id-container-fluid").offsetHeight+40}]),1===this.props.chatwidget.get("processStatus")&&1!==t.chatwidget.get("processStatus")){var n=document.getElementById("messagesBlock");null!==n&&this.props.setMessages(n.innerHTML);var i=document.getElementById("lhc-profile-body");null!==i&&this.props.setProfile(i.innerHTML)}var r=!1;if(!1===this.apiLoaded&&null!==this.props.chatwidget.get("api_data")&&(this.apiLoaded=!0,this.setState(R(R({},this.state),this.props.chatwidget.get("api_data"))),r=!0),(!0===r||0==this.props.chatwidget.get("isMobile")&&!1===t.chatwidget.get("shown")&&!0===this.props.chatwidget.get("shown"))&&"widget"==this.props.chatwidget.get("mode")&&this.textMessageRef.current&&(this.textMessageRef.current.focus(),this.scrollBottom()),!0===this.props.chatwidget.getIn(["onlineData","fetched"])&&!1===t.chatwidget.getIn(["onlineData","fetched"])&&(this.props.chatwidget.hasIn(["chat_ui","uprev"])&&k.a.emitEvent("play_sound",[{type:"new_message",sound_on:!0===this.props.chatwidget.getIn(["usersettings","soundOn"]),widget_open:this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")||document.hasFocus()}]),this.scrollBottom()),this.props.chatwidget.get("departmentDefault")!==t.chatwidget.get("departmentDefault")){this.setState({DepartamentID:this.props.chatwidget.get("departmentDefault")});var s=document.getElementById("id-department-field");null!==s&&(s.value=this.props.chatwidget.get("departmentDefault")),this.updateOnlineFieldsInit()}}},{key:"scrollBottom",value:function(){var t=this;this.messagesAreaRef.current&&(this.messagesAreaRef.current.scrollTop=this.messagesAreaRef.current.scrollHeight+1e3,setTimeout((function(){t.messagesAreaRef.current&&(t.messagesAreaRef.current.scrollTop=t.messagesAreaRef.current.scrollHeight+1e3)}),450))}},{key:"moveCaretAtEnd",value:function(t){var e=t.target.value;t.target.value="",t.target.value=e}},{key:"render",value:function(){var t=this,e=this.props.t;if(!0===this.props.chatwidget.getIn(["onlineData","fetched"])&&!0===this.props.chatwidget.getIn(["onlineData","disabled"]))return m.createElement("div",{className:"alert alert-danger m-2",role:"alert"},e("start_chat.cant_start_a_chat"));if(!1===this.props.chatwidget.getIn(["onlineData","fetched"])||!0===this.props.chatwidget.getIn(["chat_ui","auto_start"]))return null;if(this.props.chatwidget.getIn(["onlineData","fields"]).size>0&&(!this.props.chatwidget.hasIn(["chat_ui","show_messages_box"])||1!=this.props.chatwidget.getIn(["onlineData","fields_visible"])||0!=this.props.chatwidget.getIn(["customData","fields"]).size))var a=this.props.chatwidget.getIn(["onlineData","fields"]).map((function(e){return m.createElement(y.Z,{chatUI:t.props.chatwidget.get("chat_ui"),key:e.get("identifier"),isInvalid:t.props.chatwidget.hasIn(["validationErrors",e.get("identifier")]),defaultValueField:t.state[e.get("name")]||e.get("value"),attrPrefill:{attr_prefill_admin:t.props.chatwidget.get("attr_prefill_admin"),attr_prefill:t.props.chatwidget.get("attr_prefill")},onChangeContent:t.handleContentChange,field:e})}));else a="";var n=!1,i="";if(this.props.chatwidget.getIn(["customData","fields"]).size>0&&(this.props.chatwidget.getIn(["customData","fields"]).map((function(t){return n=!t.has("type")||"hidden"!==t.get("type")||n})),1==n&&(i=this.props.chatwidget.getIn(["customData","fields"]).map((function(e){return m.createElement(y.Z,{chatUI:t.props.chatwidget.get("chat_ui"),key:e.get("identifier"),isInvalid:t.props.chatwidget.hasIn(["validationErrors",e.get("identifier")]),defaultValueField:e.get("value"),onChangeContent:t.handleContentChangeCustom,field:e})})))),this.props.chatwidget.hasIn(["onlineData","paid","error"])&&this.props.chatwidget.getIn(["onlineData","paid","error"]))return m.createElement("p",{className:"p-2"},this.props.chatwidget.getIn(["onlineData","paid","message"]));if(0==this.props.chatwidget.get("processStatus")||1==this.props.chatwidget.get("processStatus")){if(this.props.chatwidget.hasIn(["chat_ui","show_messages_box"])&&this.props.chatwidget.getIn(["onlineData","department","departments"]).size<=1&&this.props.chatwidget.getIn(["onlineData","fields_visible"])<=1&&(0==this.props.chatwidget.getIn(["customData","fields"]).size||!1===n)){var r="ps-0 no-outline form-control rounded-0 form-control rounded-start-0 rounded-end-0 border-0 "+(!0===this.props.chatwidget.get("shown")&&this.textMessageRef.current&&(/\r|\n/.exec(this.state.Question)||this.state.Question.length>this.textMessageRef.current.offsetWidth/8.6)?"msg-two-line":"msg-one-line"),s="flex-grow-1 overflow-scroll position-relative",o="bottom-message px-1";return this.props.chatwidget.hasIn(["chat_ui","msg_expand"])&&"embed"==this.props.chatwidget.get("mode")&&(s="overflow-scroll position-relative",o+=" position-relative"),this.props.chatwidget.getIn(["chat_ui","disabled"])?m.createElement(M.Z,{closeText:e("button.close"),full_height:!0,close:function(e){return t.props.dispatch((0,P.H7)(!0))},as_html:!0,text:this.props.chatwidget.getIn(["chat_ui","disabled"])}):m.createElement(m.Fragment,null,this.state.showBBCode&&m.createElement(S.Z,{showModal:this.state.showBBCode,insertText:this.insertText,toggle:this.toggleModal,dataUrl:"/chat/bbcodeinsert?react=1"}),this.state.changeLanguage&&m.createElement(S.Z,{showModal:this.state.changeLanguage,setLanguage:this.setLanguageAction,toggle:this.changeLanguage,dataUrl:"/widgetrestapi/chooselanguage"}),this.props.chatwidget.hasIn(["validationErrors","blocked_user"])&&m.createElement(M.Z,{closeText:e("button.close"),as_html:!0,close:function(e){return t.props.dispatch((0,P.H7)(!0))},text:this.props.chatwidget.getIn(["validationErrors","blocked_user"])}),!0===this.props.chatwidget.getIn(["proactive","has"])&&!this.props.chatwidget.hasIn(["proactive","data","std_header"])&&m.createElement(x,{mode:"profile_only",invitation:this.props.chatwidget.getIn(["proactive","data"])})||(this.props.chatwidget.hasIn(["chat_ui","pre_chat_html"])||this.props.chatwidget.hasIn(["chat_ui","operator_profile"])&&""!=this.props.chatwidget.getIn(["chat_ui","operator_profile"]))&&m.createElement("div",{id:"lhc-profile-body"},m.createElement("div",{id:"chat-status-container",className:"p-2 border-bottom",dangerouslySetInnerHTML:{__html:(this.props.chatwidget.hasIn(["chat_ui","pre_chat_html"])?this.props.chatwidget.getIn(["chat_ui","pre_chat_html"]):"")+(this.props.chatwidget.hasIn(["chat_ui","operator_profile"])?this.props.chatwidget.getIn(["chat_ui","operator_profile"]):"")}})),m.createElement("div",{className:s,id:"messagesBlock"},m.createElement("div",{className:o,id:"messages-scroll",ref:this.messagesAreaRef},!0===this.props.chatwidget.getIn(["proactive","has"])&&!this.props.chatwidget.getIn(["chat_ui","custom_html_priority"])&&m.createElement(x,{mode:"message",setBotPayload:this.setBotPayload,invitation:this.props.chatwidget.getIn(["proactive","data"])}),!this.props.chatwidget.getIn(["proactive","has"])&&this.props.chatwidget.hasIn(["chat_ui","cmmsg_widget"])&&m.createElement(O.Z,{printButton:this.props.chatwidget.getIn(["chat_ui","print_btn_msg"]),processStatus:this.props.chatwidget.get("processStatus"),setBotPayload:this.setBotPayload,content:this.props.chatwidget.getIn(["chat_ui","cmmsg_widget"])}),1==this.props.chatwidget.get("processStatus")&&""!=this.state.Question&&m.createElement("div",{"data-op-id":"0",className:"message-row response msg-to-store"},m.createElement("div",{className:"msg-date"}),m.createElement("span",{title:"",className:"usr-tit vis-tit"},m.createElement("i",{title:e("start_chat.visitor"),className:"material-icons chat-operators mi-fs15 me-0"},""),m.createElement("span",{className:"user-nick-title"},e("start_chat.visitor"))),m.createElement("div",{className:"msg-body"},this.state.Question)))),(!this.props.chatwidget.getIn(["proactive","has"])||1===this.props.chatwidget.getIn(["chat_ui","custom_html_priority"]))&&this.props.chatwidget.hasIn(["chat_ui","custom_html_widget"])&&m.createElement("div",{className:"custom-html-container "+(""!=this.state.Question?"visitor-started-type":""),dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_widget"])}}),(1==this.props.chatwidget.getIn(["onlineData","fields_visible"])||0==this.props.chatwidget.getIn(["onlineData","fields_visible"])&&!this.props.chatwidget.hasIn(["chat_ui","hstr_btn"]))&&m.createElement("div",{className:"d-flex flex-row border-top position-relative message-send-area"},this.props.chatwidget.hasIn(["validationErrors","question"])&&m.createElement("div",{id:"id-operator-typing",className:"bg-white ps-1"},this.props.chatwidget.getIn(["validationErrors","question"])),1==this.props.chatwidget.getIn(["onlineData","fields_visible"])&&m.createElement(m.Fragment,null,(!this.props.chatwidget.hasIn(["chat_ui","bbc_btnh"])||this.props.chatwidget.hasIn(["chat_ui","lng_btnh"]))&&m.createElement(C,{bbEnabled:!this.props.chatwidget.hasIn(["chat_ui","bbc_btnh"]),langEnabled:this.props.chatwidget.hasIn(["chat_ui","lng_btnh"]),changeLanguage:this.changeLanguage,toggleModal:this.toggleModal}),m.createElement("div",{className:"mx-auto w-100"},m.createElement("textarea",{autoFocus:0==this.props.chatwidget.get("isMobile")&&"widget"==this.props.chatwidget.get("mode")&&!0===this.props.chatwidget.get("shown"),onFocus:this.moveCaretAtEnd,maxLength:this.props.chatwidget.getIn(["chat_ui","max_length"]),"aria-label":"Type your message here...",id:"CSChatMessage",value:1==this.props.chatwidget.get("processStatus")&&!1===this.state.hasBotData?"":this.state.Question,placeholder:this.props.chatwidget.hasIn(["chat_ui","placeholder_message"])?this.props.chatwidget.getIn(["chat_ui","placeholder_message"]):e("chat.type_here"),onKeyDown:this.enterKeyDown,onChange:function(e){return t.handleContentChange({id:"Question",value:e.target.value})},ref:this.textMessageRef,rows:"1",className:r})),m.createElement("div",{className:"disable-select"},m.createElement("div",{className:"user-chatwidget-buttons pt-2",id:"ChatSendButtonContainer"},1!=this.props.chatwidget.get("processStatus")&&m.createElement("a",{onClick:this.handleSubmit,title:e("button.start_chat")},m.createElement("i",{className:"material-icons settings"+(0==this.state.Question.length?" text-muted-light":" text-muted")},"")),1==this.props.chatwidget.get("processStatus")&&m.createElement("i",{className:"material-icons text-muted settings me-0"},"")))),0==this.props.chatwidget.getIn(["onlineData","fields_visible"])&&!this.props.chatwidget.hasIn(["chat_ui","hstr_btn"])&&m.createElement("button",{className:"mx-auto pb-1 w-100 btn btn-light rounded-0",onClick:this.handleSubmit,title:e("button.start_chat")},this.props.chatwidget.getIn(["chat_ui","custom_start_button"])||e("button.start_chat_With_us"))))}return m.createElement("div",{id:"id-container-fluid"},!0===this.props.chatwidget.getIn(["proactive","has"])&&m.createElement(x,{mode:"profile",invitation:this.props.chatwidget.getIn(["proactive","data"])})||(this.props.chatwidget.hasIn(["chat_ui","pre_chat_html"])||this.props.chatwidget.hasIn(["chat_ui","operator_profile"])&&""!=this.props.chatwidget.getIn(["chat_ui","operator_profile"]))&&m.createElement("div",{id:"lhc-profile-body"},m.createElement("div",{id:"chat-status-container",className:"p-2"+(this.props.chatwidget.hasIn(["chat_ui","np_border"])?"":" border-bottom"),dangerouslySetInnerHTML:{__html:(this.props.chatwidget.hasIn(["chat_ui","pre_chat_html"])?this.props.chatwidget.getIn(["chat_ui","pre_chat_html"]):"")+(this.props.chatwidget.hasIn(["chat_ui","operator_profile"])?this.props.chatwidget.getIn(["chat_ui","operator_profile"]):"")}})),m.createElement("div",{className:"container-fluid"},m.createElement(I,{errors:this.props.chatwidget.get("validationErrors")}),!this.props.chatwidget.getIn(["proactive","has"])&&this.props.chatwidget.hasIn(["chat_ui","custom_html_widget"])&&m.createElement("div",{className:"custom-html-container",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_widget"])}}),m.createElement("form",{onSubmit:this.handleSubmit},m.createElement("div",{className:"row pt-2"},a,i,this.props.chatwidget.hasIn(["onlineData","department"])&&m.createElement(D.Z,{defaultValueField:this.state.DepartamentID,setDefaultValue:this.props.chatwidget.get("departmentDefault"),onChangeContent:this.handleContentChange,isInvalidProduct:this.props.chatwidget.hasIn(["validationErrors","ProductID"]),isInvalid:this.props.chatwidget.hasIn(["validationErrors","department"]),departments:this.props.chatwidget.getIn(["onlineData","department"])})),(!this.props.chatwidget.hasIn(["chat_ui","hstr_btn"])||""!==i||""!==a||!0===this.props.chatwidget.getIn(["proactive","has"]))&&m.createElement("div",{className:"row"},m.createElement("div",{className:"col-12 pb-3"},m.createElement("button",{disabled:1==this.props.chatwidget.get("processStatus"),type:"submit",className:"btn btn-secondary btn-sm"},this.props.chatwidget.getIn(["chat_ui","custom_start_button"])||e("button.start_chat")))))))}return 2==this.props.chatwidget.get("processStatus")?m.createElement("div",{className:"container-fluid",id:"id-container-fluid"},m.createElement("div",{className:"row"},m.createElement("div",{className:"col-12"},m.createElement("p",null,e("start_chat.thank_you_for_feedback"))))):void 0}}],[{key:"getDerivedStateFromProps",value:function(t,e){if(t.chatwidget.getIn(["chat_ui","auto_start"])&&0==t.chatwidget.get("processStatus")&&("embed"==t.chatwidget.get("mode")||"popup"==t.chatwidget.get("mode")||"widget"==t.chatwidget.get("mode")&&1==t.chatwidget.get("shown"))){var a=e;a.jsvar=t.chatwidget.get("jsVars"),a["captcha_"+t.chatwidget.getIn(["captcha","hash"])]=t.chatwidget.getIn(["captcha","ts"]),a.tscaptcha=t.chatwidget.getIn(["captcha","ts"]),a.user_timezone=k.a.getTimeZone(),a.URLRefer=window.location.href.substring(window.location.protocol.length),a.r=t.chatwidget.get("ses_ref"),""!=t.chatwidget.get("bot_id")&&(a.bot_id=t.chatwidget.get("bot_id")),""!=t.chatwidget.get("subject_id")&&(a.subject_id=t.chatwidget.get("subject_id")),""!=t.chatwidget.get("trigger_id")&&(a.trigger_id=t.chatwidget.get("trigger_id")),""!=t.chatwidget.get("operator")&&(a.operator=t.chatwidget.get("operator")),null!==t.chatwidget.get("priority")&&(a.priority=t.chatwidget.get("priority")),null!==t.chatwidget.get("pvhash")&&(a.pvhash=t.chatwidget.get("pvhash")),null!==t.chatwidget.get("phash")&&(a.phash=t.chatwidget.get("phash"));var n=k.a.getCustomFieldsSubmit(t.chatwidget.getIn(["customData","fields"]));null!==n&&(a=R(R({},a),n)),null!==t.chatwidget.get("api_data")&&(a=R(R({},a),t.chatwidget.get("api_data")));var i={department:t.chatwidget.get("department"),theme:t.chatwidget.get("theme"),mode:t.chatwidget.get("mode"),vid:t.chatwidget.get("vid"),fields:a};null!==t.botPayload&&(i.bpayload=t.botPayload),!0===t.chatwidget.hasIn(["proactive","data","invitation_id"])&&(i.invitation_id=t.chatwidget.getIn(["proactive","data","invitation_id"])),t.dispatch((0,P.Ym)(i))}return null}}]),r}(m.Component))||A,N=(0,w.Z)()(B)},9944:function(t,e,a){"use strict";a.d(e,{XI:function(){return n},sk:function(){return i},pA:function(){return r},B4:function(){return s},pV:function(){return o},Pd:function(){return c}});var n=1,i=2,r=5,s=2,o=3,c=5},2137:function(t,e,a){"use strict";a.d(e,{a:function(){return o}});var n=a(4575),i=a.n(n),r=a(3913),s=a.n(r),o=new(function(){function t(){i()(this,t);var e,n=document.currentScript||(e=document.getElementsByTagName("script"))[e.length-1],r=a(4795);this.prefix=n.getAttribute("scope")||"lhc",this.prefixUppercase=this.prefix.toUpperCase(),this.eventEmitter=new r;try{this.hasSessionStorage=!!window.sessionStorage}catch(t){this.hasSessionStorage=!1}try{this.hasLocalStorage=!!window.localStorage}catch(t){this.hasLocalStorage=!1}}return s()(t,[{key:"emitEvent",value:function(t,e,a){this.eventEmitter.emitEvent(t,e)}},{key:"sendMessageParent",value:function(t,e){window.opener&&!1===window.opener.closed?window.opener.postMessage(this.prefix+"::"+t+"::"+JSON.stringify(e||null),"*"):window.parent&&!1===window.parent.closed&&window.parent.postMessage(this.prefix+"::"+t+"::"+JSON.stringify(e||null),"/"),"undefined"!=typeof LHCEventTracker&&LHCEventTracker(t,e)}},{key:"sendMessageParentDirect",value:function(t,e){var a=null;window.parent&&window.parent["$_"+this.prefixUppercase]&&!1===window.parent.closed?a=window.parent["$_"+this.prefixUppercase].eventListener:window.opener&&window.opener["$_"+this.prefixUppercase]&&!1===window.opener.closed&&(a=window.opener["$_"+this.prefixUppercase].eventListener),null!==a?a.emitEvent(t,e):this.sendMessageParent(t,e)}},{key:"setLocalStorage",value:function(t,e){if(this.hasLocalStorage&&localStorage.setItem)try{localStorage.setItem(this.prefix+t,e)}catch(t){}}},{key:"setSessionStorage",value:function(t,e){if(this.hasSessionStorage&&sessionStorage.setItem)try{sessionStorage.setItem(this.prefix+t,e)}catch(t){}}},{key:"getSessionStorage",value:function(t){return this.hasSessionStorage&&sessionStorage.getItem?sessionStorage.getItem(this.prefix+t):null}},{key:"getLocalStorage",value:function(t){return this.hasLocalStorage&&localStorage.getItem?localStorage.getItem(this.prefix+t):null}},{key:"removeSessionStorage",value:function(t){this.hasSessionStorage&&sessionStorage.removeItem&&sessionStorage.removeItem(this.prefix+t)}},{key:"removeLocalStorage",value:function(t){this.hasLocalStorage&&localStorage.removeItem&&localStorage.removeItem(this.prefix+t)}},{key:"getTimeZone",value:function(){try{var t=Intl.DateTimeFormat().resolvedOptions().timeZone;return"undefined"==t&&(t="UTC"),t}catch(t){var e=new Date;return(e.getTimezoneOffset()<(a=new Date(e.getFullYear(),0,1),n=new Date(e.getFullYear(),6,1),Math.max(a.getTimezoneOffset(),n.getTimezoneOffset()))?e.getTimezoneOffset():e.getTimezoneOffset()-60)/60*-1}var a,n}},{key:"getCustomFieldsSubmit",value:function(t){if(t.size>0){var e={name_items:[],values_req:[],value_items:[],value_types:[],encattr:[],value_show:[]};return t.forEach((function(t){e.value_items.push(t.get("value")),e.name_items.push(t.get("name")),e.values_req.push(!0===t.get("required")?"t":"f"),e.encattr.push(!0===t.get("encrypted")?"t":""),e.value_types.push(t.get("type")),e.value_show.push(t.get("show"))})),e}return null}},{key:"prefillFields",value:function(t){var e=t.props.chatwidget.get("attr_prefill");e.length>0&&e.forEach((function(e){t.setState(e)}))}},{key:"logJSError",value:function(t){var e;(e={}).location=location&&location.href?location.href:"",e.message=window.navigator.userAgent,e.stack=t.stack,e.stack=e.stack.replace(/(\r\n|\n|\r)/gm,"");var a=new XMLHttpRequest;a.open("POST",window.lhcChat.base_url+"audit/logjserror",!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send("data="+encodeURIComponent(JSON.stringify(e)))}}]),t}());window.lhcHelperfunctions=o},5501:function(t,e,a){"use strict";var n=a(7294),i=a(3935),r=a(4575),s=a.n(r),o=a(3913),c=a.n(o),l=a(2205),d=a.n(l),u=a(8585),h=a.n(u),p=a(9754),_=a.n(p),g=a(1506),f=a.n(g),m=a(9713),v=a.n(m),w=a(6458),y=a(6512),b=a(2137),E=a(9944),I=a(7139);var D,S,T=function(t){d()(r,t);var e,n,i=(e=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,a=_()(e);if(n){var i=_()(this).constructor;t=Reflect.construct(a,arguments,i)}else t=a.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),e=i.call(this,t),v()(f()(e),"state",{dropdown:null}),e}return c()(r,[{key:"componentDidMount",value:function(){if(document.getElementById(this.props.elementId)){var t=a(208);this.setState({dropdown:new t(document.getElementById(this.props.elementId))})}}},{key:"componentWillUnmount",value:function(){this.state.dropdown&&delete this.state.dropdown}},{key:"render",value:function(){return this.props.children}}]),r}(n.PureComponent);var C=(D=(0,w.$j)((function(t){return{chatwidget:t.chatwidget}})),D(S=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),(e=i.call(this,t)).closeWidget=e.closeWidget.bind(f()(e)),e.endChat=e.endChat.bind(f()(e)),e.popup=e.popup.bind(f()(e)),e.switchColumn=e.switchColumn.bind(f()(e)),e}return c()(r,[{key:"closeWidget",value:function(){this.props.dispatch((0,y.H7)())}},{key:"endChat",value:function(){this.props.endChat()}},{key:"popup",value:function(){this.props.popupChat()}},{key:"switchColumn",value:function(){this.props.switchColumn()}},{key:"render",value:function(){var t=this,e=this.props.t,a=!this.props.chatwidget.hasIn(["chat_ui","clinst"])||this.props.chatwidget.get("isMobile"),i=this.props.chatwidget.hasIn(["chat_ui","custom_html_header_body"]),r="position-relative row header-chat"+(1==this.props.chatwidget.get("isMobile")?" mobile-header":" desktop-header")+(!0===this.props.chatwidget.get("isChatting")||!0===this.props.chatwidget.get("isOnline")&&!1===this.props.chatwidget.get("isOfflineMode")?" online-header":" offline-header"),s=!this.props.chatwidget.hasIn(["chat_ui","hide_popup"]),o=!0===this.props.chatwidget.get("isChatting")&&!this.props.chatwidget.hasIn(["chat_ui","hide_close"]),c=0,l=0,d=this.props.chatwidget.hasIn(["chat_ui","header_buttons"])&&this.props.chatwidget.getIn(["chat_ui","header_buttons"]).map((function(i,r){var l=i.get("pos");if("dropdown"!=l){if(l="left"==l?"start":"right"==l?"end":l,"min"==i.get("btn")&&a)return c++,n.createElement("a",{className:"minimize-icon header-link float-"+l,title:t.props.chatwidget.getIn(["chat_ui","min_text"])||e("button.minimize"),onClick:t.closeWidget},t.props.chatwidget.hasIn(["chat_ui","img_icon_min"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_min"]),alt:""})||n.createElement("i",{className:"material-icons"},""));if("popup"==i.get("btn")&&s)return c++,n.createElement("a",{className:"header-link float-"+l,title:t.props.chatwidget.getIn(["chat_ui","popup_text"])||e("button.popup"),onClick:t.popup},t.props.chatwidget.hasIn(["chat_ui","img_icon_popup"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_popup"]),alt:""})||n.createElement("i",{className:"material-icons"},""));if("close"==i.get("btn")&&o){var d=t.props.chatwidget.getIn(["chat_ui","end_chat_text"])||e("button.end_chat");return c++,n.createElement("a",{title:d,className:"header-link float-"+l,onClick:t.endChat},t.props.chatwidget.hasIn(["chat_ui","img_icon_close"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_close"]),alt:""})||n.createElement("i",{className:"material-icons"},""),i.get("print")&&n.createElement("span",{className:"end-chat-text"},d))}}})),u=this.props.chatwidget.hasIn(["chat_ui","header_buttons"])&&this.props.chatwidget.getIn(["chat_ui","header_buttons"]).map((function(i,r){if("dropdown"==i.get("pos")){if("min"==i.get("btn")&&a){l++;var c=t.props.chatwidget.getIn(["chat_ui","min_text"])||e("button.minimize");return n.createElement("a",{className:"minimize-icon header-link header-burger-link d-block text-nowrap py-1 ps-1",title:c,onClick:t.closeWidget},t.props.chatwidget.hasIn(["chat_ui","img_icon_min"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_min"]),alt:""})||n.createElement("i",{className:"material-icons"},""),n.createElement("span",{className:"menu-text text-nowrap"},c))}if("popup"==i.get("btn")&&s){l++;var d=t.props.chatwidget.getIn(["chat_ui","popup_text"])||e("button.popup");return n.createElement("a",{className:"header-link header-burger-link d-block text-nowrap py-1 ps-1",title:d,onClick:t.popup},t.props.chatwidget.hasIn(["chat_ui","img_icon_popup"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_popup"]),alt:""})||n.createElement("i",{className:"material-icons"},""),n.createElement("span",{className:"menu-text text-nowrap"},d))}if("close"==i.get("btn")&&o){l++;var u=t.props.chatwidget.getIn(["chat_ui","end_chat_text"])||e("button.end_chat");return n.createElement("a",{title:u,className:"header-link header-burger-link py-1 d-block text-nowrap ps-1",onClick:t.endChat},t.props.chatwidget.hasIn(["chat_ui","img_icon_close"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_close"]),alt:""})||n.createElement("i",{className:"material-icons"},""),n.createElement("span",{className:"menu-text"},u))}if("fullheight"==i.get("btn")&&!t.props.chatwidget.get("isMobile")){l++;var h;return h=t.props.chatwidget.get("position_placement").includes("full_height")?t.props.chatwidget.getIn(["chat_ui","fheight_text_class"])||e("button.fheight_text_class"):t.props.chatwidget.getIn(["chat_ui","fheight_text_col"])||e("button.fheight_text_col"),n.createElement("a",{title:h,className:"header-link header-burger-link py-1 d-block text-nowrap ps-1",onClick:t.switchColumn},t.props.chatwidget.hasIn(["chat_ui","img_icon_fheight"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_fheight"]),alt:""})||n.createElement("span",{className:"material-icons"},t.props.chatwidget.get("position_placement").includes("full_height")?n.createElement(n.Fragment,null,""):n.createElement(n.Fragment,null,"")," "),n.createElement("span",{className:"menu-text text-nowrap"},h))}}}));return n.createElement("div",{id:"widget-header-content",className:r},i&&n.createElement("div",{className:"lhc-custom-header-inside",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_header_body"])}}),(c>0||l>0)&&n.createElement("div",{className:"col-12 px-1 widget-header-menu"},l>0&&n.createElement("div",{className:"float-end position-relative"},n.createElement(T,{elementId:"headerDropDown"},n.createElement("div",{className:"btn-group dropup disable-select"},n.createElement("a",{className:"header-link",id:"headerDropDown","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},n.createElement("i",{className:"material-icons"},"")),n.createElement("div",{className:"dropdown-menu shadow bg-white rounded lhc-dropdown-menu pe-2"},u)))),d))}}]),r}(n.Component))||S),k=(0,I.Z)()(C),O=a(9702),A=a(488),x=a.n(A),M=a(7154),P=a.n(M),L=a(3038),R=a.n(L),B=a(2446);var N=n.lazy((function(){return a.e(536).then(a.bind(a,3536))})),F=n.lazy((function(){return a.e(307).then(a.bind(a,307))})),U=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),e=i.call(this,t),v()(f()(e),"state",{jsExecuted:!1,moreReactions:!1,reactToMessageId:0}),e.abstractClick=e.abstractClick.bind(f()(e)),e.imageLoaded=e.imageLoaded.bind(f()(e)),e.updateTriggerClicked=e.updateTriggerClicked.bind(f()(e)),e.disableEditor=!1,e.delayData=[],e}return c()(r,[{key:"getDirectInnerText",value:function(t){for(var e=t.childNodes,a="",n=0;n'+e.innerHTML)}},{key:"abstractClick",value:function(t,e){var a=this,n=this.props.t;if(void 0===t.onchange){if(this.addLoader(t,e.target),t.onclick)if(-1!==t.onclick.indexOf("lhinst.updateTriggerClicked"))this.updateTriggerClicked({type:"/(type)/triggerclicked"},t,e.target);else if(-1!==t.onclick.indexOf("notificationsLHC.sendNotification"))this.props.dispatch((0,y.rN)()),e.target.innerHTML=n("notifications.subscribing"),setTimeout((function(){a.removeMetaMessage(t["data-id"])}),500);else if(-1!==t.onclick.indexOf("lhinst.moreReactions"))this.setState({moreReactions:!0,reactToMessageId:t["data-id"]}),e.stopPropagation();else if(-1!==t.onclick.indexOf("lhinst.reactionsToolbar"))this.props.setReactingTo(t["data-id"]!=this.props.reactToMessageId?t["data-id"]:0),e.stopPropagation();else if(-1!==t.onclick.indexOf("lhinst.reactionsClicked"))this.updateTriggerClicked({type:"/(type)/reactions"+(this.props.themeId?"/(theme)/"+this.props.themeId:"")},t,e.target),this.props.setReactingTo(0);else if(-1!==t.onclick.indexOf("lhinst.buttonClicked"))this.updateTriggerClicked({type:""},t,e.target);else if(-1!==t.onclick.indexOf("lhinst.startVoiceCall"))this.props.voiceCall();else if(-1!==t.onclick.indexOf("lhinst.chooseFile"))this.props.abstractAction("fileupload");else if(-1!==t.onclick.indexOf("lhinst.updateChatClicked"))this.updateTriggerClicked({type:"",mainType:"updatebuttonclicked"},t,e.target);else if(-1!==t.onclick.indexOf("lhinst.editGenericStep"))this.updateTriggerClicked({type:"/(type)/editgenericstep"},t,e.target);else if(-1!==t.onclick.indexOf("lhinst.hideShowAction")){var i=JSON.parse(t["data-load"]),r=document.getElementById("message-more-"+i.id);r.classList.contains("hide")?(e.target.innerText=i.hide_text,r.classList.remove("hide")):(e.target.innerText=i.show_text,r.classList.add("hide"))}else if(-1!==t.onclick.indexOf("lhinst.executeJS"))(0,y.bQ)(t,this);else if(-1!==t.onclick.indexOf("lhinst.dropdownClicked")){var s=document.getElementById("id_generic_list-"+t["data-id"]);s&&"0"!=s.value&&""!=s.value?(t["data-payload"]=s.value,this.updateTriggerClicked({type:"/(type)/valueclicked"},t,e.target)):alert(n("bot.please_choose"))}else-1!==t.onclick.indexOf("lhinst.zoomImage")?b.a.sendMessageParentDirect("zoomImage",[{txt_download:n("bbcode.img_download"),src:t.src,title:t.title?t.title:""}]):(b.a.emitEvent("MessageClick",[t,this.props.dispatch]),console.log("Unknown click event: "+t.onclick));e.preventDefault()}else{if(t.type&&"checkbox"==t.type){if("enable-confirm"==t["payload-type"]){var o=document.getElementById("confirm-button-"+t["data-id"]);e.target.checked?(o.removeAttribute("disabled"),o.onclick=function(e){return a.updateTriggerClicked({type:""},{"data-payload":"confirm","data-id":t["data-id"]},e.target)}):o.setAttribute("disabled","disabled")}return}var c=e.target.options[e.target.selectedIndex],l={"data-payload":c.getAttribute("data-payload"),"data-id":c.getAttribute("data-id")};"trigger"==c.getAttribute("payload-type")?this.updateTriggerClicked({type:"/(type)/triggerclicked"},l,e.target):"button"!=c.getAttribute("payload-type")&&"payload"!=c.getAttribute("payload-type")||this.updateTriggerClicked({type:""},l,e.target)}}},{key:"removeMetaMessage",value:function(t,e){setTimeout((function(){var e=document.getElementById("msg-"+t);if(e){var a,n=e.getElementsByClassName("meta-message-"+t);for(a=0;a0&&n.props.dispatch({type:"UPDATE_SCROLL_TO_MESSAGE",data:t.data.message_id_first}),t.data.t&&b.a.sendMessageParent("botTrigger",[{trigger:t.data.t}]),t.data.update_message?n.props.updateMessage(e["data-id"],n):(n.props.updateMessages(),n.props.updateStatus())}))}},{key:"imageLoaded",value:function(t){this.props.scrollBottom&&this.props.scrollBottom(!0,!0)}},{key:"componentDidUpdate",value:function(t,e,a){if(0!=this.props.reactToMessageId){var n=document.getElementById("reactions-toolbar-"+this.props.reactToMessageId),i=document.getElementById("msg-"+this.props.reactToMessageId);if(!n||!i)return;var r=n.clientWidth/2,s=i.offsetWidth,o=n.parentNode.offsetLeft;o+r>s?n.style.right="-"+(r-10)+"px":o0&&this.delayData.forEach((function(e){t.props.sendDelay(e),t.props.scrollBottom(!1,!1)}))}},{key:"formatStringToCamelCase",value:function(t){var e=t.split("-");return 1===e.length?e[0]:e[0]+e.slice(1).map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("")}},{key:"getStyleObjectFromString",value:function(t){var e=this,a={};return t.split(";").forEach((function(t){var n=t.split(":"),i=R()(n,2),r=i[0],s=i[1];if(r){var o=e.formatStringToCamelCase(r.trim());a[o]=s.trim()}})),a}},{key:"render",value:function(){var t=this,e=(this.props.t,!1),a=x()(this.props.msg.msg,{replace:function(a){if(a.attribs){var i=Object.assign({},a.attribs);if(a.attribs.class){if(a.attribs.className=a.attribs.class,-1!==a.attribs.className.indexOf("message-row")&&parseInt(t.props.reactToMessageId)==parseInt(a.attribs.id.replace("msg-",""))&&(a.attribs.className+=" current-reacting-to"),a.attribs.className+=" fade-in-fast",-1!==a.attribs.className.indexOf("message-row")&&(a.attribs.className+=" index-row-"+t.props.id),-1!==a.attribs.className.indexOf("message-row")&&t.props.id>0)t.props.msg.msop>0&&t.props.msg.msop!=t.props.msg.lmsop&&0==e&&(a.attribs.className+=" operator-changes",e=!0);else if(t.props.profilePic&&-1!==a.attribs.className.indexOf("vis-icon-hld"))return n.createElement("img",{className:"profile-msg-pic",onLoad:t.imageLoaded,src:t.props.profilePic,alt:"",title:""});delete a.attribs.class}if(a.attribs.onclick&&delete a.attribs.onclick,a.name&&"img"===a.name){if(a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),void 0===a.attribs["data-ignore-load"])return n.createElement("img",P()({},a.attribs,{onLoad:t.imageLoaded,onClick:function(e){return t.abstractClick(i,e)}}))}else if(a.name&&"button"===a.name){if(i.onclick)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),n.createElement("button",P()({},a.attribs,{onClick:function(e){return t.abstractClick(i,e)}}),(0,A.domToReact)(a.children))}else if(a.name&&"a"===a.name){if(i.onclick)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),n.createElement("a",P()({},a.attribs,{onClick:function(e){return t.abstractClick(i,e)}}),(0,A.domToReact)(a.children))}else if(a.name&&"select"===a.name){if(i.onchange)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),n.createElement("select",P()({},a.attribs,{onChange:function(e){return t.abstractClick(i,e)}}),(0,A.domToReact)(a.children))}else{if(a.name&&"inlineiframe"===a.name)return n.createElement(n.Suspense,{fallback:"..."},n.createElement(F,P()({},a.attribs,{updateMessage:function(e){return t.props.updateMessage(e,t)}})));if(a.name&&"inlinesurvey"===a.name)return n.createElement(n.Suspense,{fallback:"..."},n.createElement(N,P()({},a.attribs,{surveyOptions:a.children})));if(a.name&&"input"===a.name){if(a.attribs.type&&"checkbox"==a.attribs.type&&i.onchange)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),n.createElement("input",P()({type:"checkbox"},a.attribs,{onChange:function(e){return t.abstractClick(i,e)}}));if(a.attribs.type&&"radio"==a.attribs.type)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),a.attribs.checked&&(a.attribs.defaultChecked=!0,delete a.attribs.checked),n.createElement("input",P()({type:"radio"},a.attribs))}else if(a.name&&"script"===a.name&&a.attribs["data-bot-action"]){if(!a.attribs["data-bot-always"]){if(1==t.state.jsExecuted)return n.createElement(n.Fragment,null);t.setState({jsExecuted:!0})}return(0,y.bQ)(a,t),n.createElement(n.Fragment,null)}}}}});return n.createElement(n.Fragment,null,this.state.moreReactions&&n.createElement(B.Z,{setReaction:function(e){t.updateTriggerClicked({type:"/(type)/reactions"+(t.props.themeId?"/(theme)/"+t.props.themeId:"")},JSON.parse(e),null),t.setState({moreReactions:!1}),t.props.setReactingTo(0)},confirmClose:function(e){t.setState({moreReactions:!1})},cancelClose:function(e){t.setState({moreReactions:!1})},toggle:function(e){t.setState({moreReactions:!1})},dataUrl:"/chat/reacttomessagemodal/"+this.state.reactToMessageId+(this.props.themeId?"/(theme)/"+this.props.themeId:"")}),1==this.props.hasNew&&this.props.id==this.props.newId&&n.createElement("div",{id:"scroll-to-message",className:"message-admin border-bottom new-msg-holder border-danger text-center"},n.createElement("span",{className:"new-msg bg-danger text-white d-inline-block fs12 rounded-top"},this.props.newTitle)),a)}}]),r}(n.PureComponent),H=(0,I.Z)()((0,w.$j)()(U)),j=a(8926),W=a.n(j),K=a(7757),q=a.n(K);function V(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function z(t){for(var e=1;ee.props.fileOptions.get("fs")&&i.push(t.name+": "+a("file.to_big_file"))})),i.length>0?alert(i.join("\n")):this.setState({files:t})}},{key:"componentDidUpdate",value:function(t,e){this.state.files.length>0&&0==this.state.uploading&&this.uploadFiles()}},{key:"uploadFiles",value:(e=W()(q().mark((function t(){var e,a=this;return q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.setState({uploadProgress:{},uploading:!0}),e=[],this.state.files.forEach((function(t){e.push(a.sendRequest(t))})),t.prev=3,t.next=6,Promise.all(e);case 6:this.setState({successfullUploaded:!0,uploading:!1,files:[]}),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(3),this.setState({successfullUploaded:!0,uploading:!1,files:[]});case 12:case"end":return t.stop()}}),t,this,[[3,9]])}))),function(){return e.apply(this,arguments)})},{key:"sendRequest",value:function(t){var e=this,a=this.props.t;return new Promise((function(n,i){var r=new XMLHttpRequest,s=new FormData;s.append("files",t,t.name),r.upload.addEventListener("progress",(function(n){n.lengthComputable&&(z({},e.state.uploadProgress)[t.name]={state:"pending",percentage:n.loaded/n.total*100},e.props.progress(a("file.uploading")+" "+Math.round(n.loaded/n.total*100)+"%"))})),r.upload.addEventListener("load",(function(n){z({},e.state.uploadProgress)[t.name]={state:"done",percentage:100},e.props.progress(a("file.processing"))})),r.onload=function(){var t=JSON.parse(r.response);t&&t.error&&"true"==t.error?t.error_msg?e.props.progress(t.error_msg):e.props.progress(a("file.upload_failed")):(e.props.progress(a("file.completed")),e.props.onCompletion()),n(r)},r.upload.addEventListener("error",(function(a){var n=z({},e.state.uploadProgress);n[t.name]={state:"error",percentage:0},e.setState({uploadProgress:n}),i(r)})),r.open("POST",e.props.base_url+"/file/uploadfile/"+e.props.chat_id+"/"+e.props.hash),r.send(s)}))}},{key:"openFileDialog",value:function(){this.state.uploading||this.fileInputRef.current.click()}},{key:"onFilesAddedUI",value:function(t){var e=t.target.files,a=this.fileListToArray(e);this.onFilesAdded(a)}},{key:"onDragOver",value:function(t){t.preventDefault(),this.state.uploading||this.props.onDrag&&this.props.onDrag(!0)}},{key:"componentDidMount",value:function(){var t=this;setTimeout((function(){t.props.dropArea.current&&(t.props.dropArea.current.ondragover=t.onDragOver,t.props.dropArea.current.ondragleave=t.onDragLeave,t.props.dropArea.current.ondrop=t.onDrop,document.addEventListener("paste",t.onPaste),b.a.eventEmitter.addListener("fileupload",t.openFileDialog))}),1e3)}},{key:"componentWillUnmount",value:function(){this.props.dropArea.current&&(this.props.dropArea.current.ondragover=null,this.props.dropArea.current.ondragleave=null,this.props.dropArea.current.ondrop=null),b.a.eventEmitter.removeListener("fileupload",this.openFileDialog),document.removeEventListener("paste",this.onPaste)}},{key:"onPaste",value:function(t){var e=t&&t.clipboardData&&t.clipboardData.items;if(e&&e.length){for(var a=[],n=0;n0&&this.onFilesAdded(a)}}},{key:"onDragLeave",value:function(t){this.props.onDrag&&this.props.onDrag(!1)}},{key:"onDrop",value:function(t){if(t.preventDefault(),!this.state.uploading){var e=t.dataTransfer.files,a=this.fileListToArray(e);this.onFilesAdded(a),this.props.onDrag&&this.props.onDrag(!1)}}},{key:"fileListToArray",value:function(t){for(var e=[],a=0;a=this.props.chat_ui.get("switch_to_human")&&Q().get(window.lhcChat.base_url+"restapi/isonlinechat/"+this.props.chat.get("id")+"?exclude_bot=true").then((function(t){if(t.data.isonline){var e=document.getElementById("transfer-to-human-btn");null!==e&&e.classList.remove("hide")}}))}},{key:"componentDidMount",value:function(){this.checkSwitchButtom()}},{key:"componentDidUpdate",value:function(t,e,a){this.checkSwitchButtom()}},{key:"render",value:function(){var t=this;return x()(this.props.status,{replace:function(e){if(e.attribs&&e.attribs.onclick&&e.name&&("i"==e.name||"a"==e.name)){var a=Object.assign({},e.attribs);return e.attribs.class&&(e.attribs.className=e.attribs.class,delete e.attribs.class),e.attribs.onclick&&delete e.attribs.onclick,n.createElement("i",P()({},e.attribs,{onClick:function(e){return t.abstractClick(a)}}),(0,A.domToReact)(e.children))}}})}}]),r}(n.PureComponent))||J),et=tt;var at,nt,it=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){return s()(this,r),i.call(this,t)}return c()(r,[{key:"render",value:function(){return n.createElement(n.Fragment,null,null!==this.props.profileBefore&&n.createElement("div",{dangerouslySetInnerHTML:{__html:this.props.profileBefore}}),n.createElement("div",{className:this.props.msg_expand,id:"messagesBlock",dangerouslySetInnerHTML:{__html:this.props.messagesBefore}}),!this.props.hideMessageField&&n.createElement("div",{className:"d-flex flex-row border-top position-relative message-send-area"},n.createElement("div",{className:"btn-group dropup disable-select ps-1 pt-2"},n.createElement("i",{className:"material-icons settings text-muted",id:"chat-dropdown-options","aria-haspopup":"true","aria-expanded":"false"},"")),n.createElement("div",{className:"mx-auto w-100"},n.createElement("textarea",{"aria-label":"Type your message here...",defaultValue:this.props.value,placeholder:this.props.placeholderMessage,readOnly:"readOnly",id:"CSChatMessage",rows:"1",className:"ps-0 no-outline form-control rounded-0 form-control rounded-start-0 rounded-end-0 border-0"})),n.createElement("div",{className:"disable-select"},n.createElement("div",{className:"user-chatwidget-buttons pt-2 pe-1",id:"ChatSendButtonContainer"},n.createElement("i",{className:"material-icons text-muted-light settings me-0"},"")))))}}]),r}(n.PureComponent),rt=a(6313);function st(t,e){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function(t,e){if(t){if("string"==typeof t)return ot(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?ot(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){a&&(t=a);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,o=!1;return{s:function(){a=a.call(t)},n:function(){var t=a.next();return s=t.done,t},e:function(t){o=!0,r=t},f:function(){try{s||null==a.return||a.return()}finally{if(o)throw r}}}}function ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=new Array(e);a70?!0!==this.state.scrollButton&&this.setState({scrollButton:!0}):!1!==this.state.scrollButton&&(this.setState({scrollButton:!1,otm:0}),this.props.dispatch({type:"UPDATE_LIVE_DATA",data:{attr:"lfmsgid",val:0}})))}},{key:"scrollToMessage",value:function(){var t=this;if(1==this.state.hasNew&&(clearTimeout(this.timeoutNewMessage),this.timeoutNewMessage=setTimeout((function(){t.setState({hasNew:!1,newId:0})}),1e3)),1==this.state.hasNew&&this.state.otm>0){this.setState({otm:0});try{document.getElementById("scroll-to-message").scrollIntoView()}catch(t){this.scrollBottom()}}else this.scrollBottom()}},{key:"changeFontAction",value:function(t){this.setState({fontSize:this.state.fontSize+(1==t?5:-5)}),b.a.setLocalStorage("_dfs",this.state.fontSize),this.scrollBottom()}},{key:"setLanguageAction",value:function(t){b.a.setLocalStorage("_lng",t),this.setState({changeLanguage:!1}),(0,y._Z)({lng:t,id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"])}),b.a.emitEvent("change_language",[t]),this.updateStatus()}},{key:"componentDidMount",value:function(){var t=b.a.getSessionStorage("_ttxt");null!==t&&this.setState({value:t});var e=b.a.getLocalStorage("_dfs");null!==e&&this.setState({fontSize:parseInt(e)});var a=document.getElementById("CSChatMessage");if(null!==a&&(!0===this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")||"popup"==this.props.chatwidget.get("mode"))){a.focus();var n=document.getElementById("CSChatMessage-tmp");null!==n&&document.body.removeChild(n)}}},{key:"focusMessage",value:function(){this.textMessageRef.current&&(this.textMessageRef.current.focus(),this.state.value.length>0&&(this.textMessageRef.current.selectionStart=this.state.value.length,this.textMessageRef.current.selectionEnd=this.state.value.length))}},{key:"setEditorEnabled",value:function(t){this.setState({enabledEditor:t})}},{key:"hasClass",value:function(t,e){return new RegExp("(\\s|^)"+e+"(\\s|$)").test(t.className)}},{key:"addClass",value:function(t,e){this.hasClass(t,e)||(t.className+=(t.className?" ":"")+e)}},{key:"removeClass",value:function(t,e){this.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(\\s|^)"+e+"(\\s|$)")," ").replace(/^\s+|\s+$/g,""))}},{key:"setMetaUpdateState",value:function(t){!1===t&&!0===this.pendingMetaUpdate&&(this.pendingMetaUpdate=!1,this.updateMetaAutoHide(!0),this.doScrollBottom()),!0===t&&(this.pendingMetaUpdate=!0,this.updateMetaAutoHide(),this.doScrollBottom())}},{key:"updateMetaAutoHide",value:function(t){var e=document.getElementById("messages-scroll");e&&["meta-auto-hide","meta-auto-hide-normal"].forEach((function(a){var n=e.getElementsByClassName(a);if(n.length>0){var i=t?0:1;for(r=0;r2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=[],r=!0;t=t.nextElementSibling;)r&&t&&!t.matches(e)==a?i.push(t):r=n;return i}},{key:"sendDelay",value:function(t){var e=this,a=t.id,n=t.duration,i=t.delay,r=t.untill_message,s=document.getElementById("msg-"+a);s&&(i>0&&this.addClass(s,"hide"),1==r&&this.nextUntil(s,".message-admin",!1,!0).length>0||setTimeout((function(){if(0==e.delayed)if(1==r)null!==e.intervalFunction&&e.intervalFunction(),e.intervalFunction=function(){if(e.nextUntil(s,".message-admin",!1,!0).length>0)s.parentNode.removeChild(s),e.scrollBottom(!1,!1),e.intervalFunction=null,clearInterval(e.intervalPending);else if(!e.hasClass(s,"meta-hider")){e.addClass(s,"meta-hider"),e.addClass(s,"message-row-typing"),e.removeClass(s,"hide"),e.removeClass(s,"fade-in-fast");var t,a=st(s.getElementsByClassName("msg-body"));try{for(a.s();!(t=a.n()).done;){var n=t.value;e.removeClass(n,"hide")}}catch(t){a.e(t)}finally{a.f()}e.scrollBottom(!1,!1)}},clearInterval(e.intervalPending),e.intervalPending=setInterval(e.intervalFunction,150);else{e.delayed=!0,e.addClass(s,"meta-hider"),e.addClass(s,"message-row-typing"),e.nextUntil(s,".meta-hider").forEach((function(t){e.addClass(t,"hide")})),e.unhideDelayedTimer=setTimeout((function(){e.unhideDelayed(a)}),1e3*n),e.removeClass(s,"hide"),e.removeClass(s,"fade-in-fast");var t,o=st(s.getElementsByClassName("msg-body"));try{for(o.s();!(t=o.n()).done;){var c=t.value;e.removeClass(c,"hide")}}catch(t){o.e(t)}finally{o.f()}i>0&&(e.updateMetaAutoHide(),e.scrollBottom(!1,!1))}else e.addClass(s,"message-row-typing"),e.addClass(s,"meta-hider"),e.delayQueue.push({id:a,delay:n})}),1e3*i))}},{key:"unhideDelayed",value:function(t){var e=this,a=document.getElementById("msg-"+t);if(a)if(this.nextUntil(a,".meta-hider").forEach((function(t){e.removeClass(t,"hide")})),a.parentNode.removeChild(a),this.updateMetaAutoHide(),this.scrollBottom(),this.delayQueue.length>0){var n=this.delayQueue.shift();setTimeout((function(){e.unhideDelayed(n.id)}),1e3*n.delay);var i=document.getElementById("msg-"+n.id);if(null!==i){this.removeClass(i,"hide"),this.removeClass(i,"fade-in-fast");var r,s=st(i.getElementsByClassName("msg-body"));try{for(s.s();!(r=s.n()).done;){var o=r.value;this.removeClass(o,"hide")}}catch(t){s.e(t)}finally{s.f()}}}else this.delayed=!1}},{key:"componentWillUnmount",value:function(){clearInterval(this.intervalPending),clearInterval(this.typingStopped),clearTimeout(this.unhideDelayedTimer),clearTimeout(this.timeoutNewMessage),clearTimeout(this.timeoutScroll)}},{key:"getSnapshotBeforeUpdate",value:function(t,e){if(t.chatwidget.getIn(["chatLiveData","messages"]).size!=this.props.chatwidget.getIn(["chatLiveData","messages"]).size){var a=!1,n=!0,i=0;this.messagesAreaRef.current&&((i=this.messagesAreaRef.current.scrollHeight-this.messagesAreaRef.current.scrollTop)-this.messagesAreaRef.current.offsetHeight<70?i=0:n=!1,a=!0);var r=this.state.hasNew,s=1==r?this.state.newId:0,o=1==r?this.state.otm:0;if(0!=t.chatwidget.getIn(["chatLiveData","messages"]).size&&!1===this.props.chatwidget.getIn(["chatLiveData","uw"])){var c=this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")||"widget"!=this.props.chatwidget.get("mode")&&document.hasFocus();0==r?(s=1==(r=0==c||0==window.lhcChat.is_focused||0==n||!1===this.state.messages_ui)?t.chatwidget.getIn(["chatLiveData","messages"]).size:0,o=this.props.chatwidget.getIn(["chatLiveData","otm"])):o+=this.props.chatwidget.getIn(["chatLiveData","otm"]);var l=this.props.chatwidget.hasIn(["chat_ui","msg_snippet"])&&this.props.chatwidget.getIn(["chatLiveData","messages",-1,"msg"]);b.a.emitEvent("play_sound",[{msop:this.props.chatwidget.getIn(["chatLiveData","msop"]),msg_body:l,otm:o,type:"new_message",sound_on:!0===this.props.chatwidget.getIn(["usersettings","soundOn"]),widget_open:c}])}else r=!1,s=0,o=0;if(this.setState({hasNew:r,newId:s,otm:o,scrollButton:!n}),1==a)return i}else{if(!1===t.chatwidget.get("shown")&&!0===this.props.chatwidget.get("shown"))return 0;this.props.chatwidget.getIn(["chatLiveData","error"])&&(this.props.chatwidget.getIn(["chatLiveData","lmsg"])&&(0==this.state.errorMode||this.props.chatwidget.getIn(["chatLiveData","lmsg"])!=t.chatwidget.getIn(["chatLiveData","lmsg"]))||!this.props.chatwidget.getIn(["chatLiveData","lmsg"])&&0==this.state.errorMode)?this.setState({errorMode:!0,value:this.props.chatwidget.getIn(["chatLiveData","lmsg"])}):!this.props.chatwidget.getIn(["chatLiveData","error"])&&t.chatwidget.getIn(["chatLiveData","error"])&&this.setState({errorMode:!1,value:""})}return null}},{key:"componentDidUpdate",value:function(t,e,a){var n=this;!1!==this.state.showMessages&&t.chatwidget.getIn(["chatLiveData","status"])==this.props.chatwidget.getIn(["chatLiveData","status"])&&t.chatwidget.getIn(["chatLiveData","msg_to_store"]).size==this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size||(1==this.props.chatwidget.get("newChat")&&1==this.props.chatwidget.getIn(["chatLiveData","messages"]).size?this.scrollBottom(!1,!0):this.scrollBottom(!1,t.chatwidget.getIn(["chatLiveData","msg_to_store"]).size!=this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size));var i=!1;if((!1===e.enabledEditor&&e.enabledEditor!=this.state.enabledEditor&&1==(i=!0)||this.props.chatwidget.get("msgLoaded")!==t.chatwidget.get("msgLoaded")&&(0==this.props.chatwidget.get("newChat")||1==(i=!0)))&&(0==i?this.scrollBottom(!1,!1):this.scrollBottom(!1,!0),(!0!==this.props.chatwidget.getIn(["chat_ui","auto_start"])||"embed"!=this.props.chatwidget.get("mode")||!1===this.props.chatwidget.getIn(["chat_ui","auto_start"])&&"embed"==this.props.chatwidget.get("mode")||!1===e.enabledEditor&&e.enabledEditor!=this.state.enabledEditor)&&(this.focusMessage(),setTimeout((function(){n.focusMessage()}),500))),null!==a&&this.messagesAreaRef.current){var r=document.getElementById("messages-scroll"),s=document.getElementById("msg-"+this.props.chatwidget.getIn(["chatLiveData","lfmsgid"]));r&&s&&-1===s.className.indexOf("ignore-auto-scroll")&&r.scrollHeight-r.offsetHeight>s.offsetTop?(this.setState({scrollButton:!0}),this.messagesAreaRef.current.scrollTop=s.offsetTop-3):this.messagesAreaRef.current.scrollTop=this.messagesAreaRef.current.scrollHeight-a}if(1==this.props.chatwidget.getIn(["chat_ui_state","confirm_close"])&&!1===this.state.preloadSurvey&&this.setState({preloadSurvey:!0}),!1===t.chatwidget.get("shown")&&!0===this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")&&this.textMessageRef.current&&this.textMessageRef.current.focus(),!0!==this.props.chatwidget.getIn(["chat_ui","start_on_close"])||!0!==this.props.chatwidget.getIn(["chatLiveData","closed"])||void 0!==t.chatwidget.getIn(["chatLiveData","closed"])&&!1!==t.chatwidget.hasIn(["chatLiveData","closed"])&&!1!==t.chatwidget.getIn(["chatLiveData","closed"])||this.props.chatwidget.getIn(["chat_ui","survey_id"])||this.props.endChat({show_start:this.props.chatwidget.get("shown")}),!0===this.props.chatwidget.getIn(["chatLiveData","closed"])&&0===this.props.chatwidget.getIn(["chatLiveData","status_sub"])&&5===t.chatwidget.getIn(["chatLiveData","status_sub"])&&this.props.dispatch((0,y.Rt)({id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),theme:this.props.chatwidget.get("theme")})),!(!0!==this.props.chatwidget.get("shown")||"widget"!=this.props.chatwidget.get("mode")&&"embed"!=this.props.chatwidget.get("mode")||!0!==this.props.chatwidget.get("initLoaded")||!0!==this.props.chatwidget.get("msgLoaded")||0!=t.chatwidget.get("msgLoaded")&&0!=t.chatwidget.get("initLoaded"))){"widget"==this.props.chatwidget.get("mode")&&this.textMessageRef.current&&this.textMessageRef.current.focus();var o=document.getElementById("CSChatMessage-tmp");null!==o&&document.body.removeChild(o)}}},{key:"doScrollBottom",value:function(t){var e;this.messagesAreaRef.current&&(t&&null!==(e=document.getElementById("msg-"+this.props.chatwidget.getIn(["chatLiveData","lfmsgid"])))&&-1===e.className.indexOf("ignore-auto-scroll")?this.messagesAreaRef.current.scrollTop=e.offsetTop-3:this.messagesAreaRef.current.scrollTop=this.messagesAreaRef.current.scrollHeight+1e3)}},{key:"scrollBottom",value:function(t,e){var a=this;!this.messagesAreaRef.current||t&&this.state.scrollButton||(clearTimeout(this.timeoutScroll),this.doScrollBottom(e),this.timeoutScroll=setTimeout((function(){a.doScrollBottom(e),!1===a.state.showMessages&&a.setState({showMessages:!0})}),450))}},{key:"abstractAction",value:function(t,e){b.a.emitEvent(t,e)}},{key:"updateMessage",value:function(t){this.props.dispatch((0,y.o6)({msg_id:t,lmgsid:this.props.chatwidget.getIn(["chatLiveData","lmsgid"]),mode:this.props.chatwidget.get("mode"),theme:this.props.chatwidget.get("theme"),id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),no_scroll:!0}))}},{key:"updateMessages",value:function(){var t={chat_id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),lmgsid:this.props.chatwidget.getIn(["chatLiveData","lmsgid"]),lfmsgid:this.props.chatwidget.getIn(["chatLiveData","lfmsgid"]),theme:this.props.chatwidget.get("theme"),new_chat:this.props.chatwidget.get("newChat"),active_widget:(this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")||"widget"!=this.props.chatwidget.get("mode")&&document.hasFocus())&&1==window.lhcChat.is_focused&&!1!==this.state.messages_ui};t.new_chat&&0===t.lmgsid&&(t.old_msg_id=this.props.chatwidget.getIn(["chatData","lmsg_id"])),this.props.dispatch((0,y.W4)(t))}},{key:"updateStatus",value:function(){this.props.dispatch((0,y.kW)({chat_id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),theme:this.props.chatwidget.get("theme"),mode:this.props.chatwidget.get("mode")}))}},{key:"sendMessage",value:function(){0!=this.state.value.length&&(b.a.setSessionStorage("_ttxt",""),this.props.dispatch((0,y.Hz)({id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),msg:this.state.value,mn:this.props.chatwidget.hasIn(["chat_ui","mn"]),theme:this.props.chatwidget.get("theme"),lmgsid:this.props.chatwidget.getIn(["chatLiveData","lmsgid"])})),this.setState({value:"",errorMode:!1}),this.currentMessageTyping="",this.focusMessage(),this.doScrollBottom())}},{key:"enterKeyDown",value:function(t){"Enter"!==t.key||t.shiftKey||(this.sendMessage(),t.preventDefault())}},{key:"keyUp",value:function(t){if("Enter"!==t.key&&!t.shiftKey)if(!1===this.isTyping){var e=this.props.t;this.isTyping=!0,this.props.dispatch((0,y.Hx)("true",this.props.chatwidget.hasIn(["chat_ui","hide_typing"])&&!0===this.props.chatwidget.getIn(["chat_ui","hide_typing"])?e("online_chat.visitor_typing"):this.state.value))}else if(clearTimeout(this.typingStopped),this.typingStopped=setTimeout(this.typingStoppedAction,6e3),this.currentMessageTyping!=this.state.value&&(Math.abs(this.currentMessageTyping.length-this.state.value.length)>6||this.props.chatwidget.get("overrides").contains("typing"))){var a=this.props.t;this.currentMessageTyping=this.state.value,this.props.dispatch((0,y.Hx)("true",this.props.chatwidget.hasIn(["chat_ui","hide_typing"])&&!0===this.props.chatwidget.getIn(["chat_ui","hide_typing"])?a("online_chat.visitor_typing"):this.state.value))}}},{key:"typingStoppedAction",value:function(){1==this.isTyping&&(this.isTyping=!1,this.props.dispatch((0,y.Hx)("false")))}},{key:"endChat",value:function(){this.props.endChat({show_start:this.props.chatwidget.get("shown")})}},{key:"toggleModal",value:function(){this.setState({showBBCode:!this.state.showBBCode}),this.state.showBBCode&&this.focusMessage()}},{key:"mailChat",value:function(){this.setState({showMail:!this.state.showMail})}},{key:"changeLanguage",value:function(){this.setState({changeLanguage:!this.state.changeLanguage})}},{key:"changeFont",value:function(){this.setState({changeFontSize:!this.state.changeFontSize})}},{key:"voiceCall",value:function(){var t=void 0!==window.screenLeft?window.screenLeft:window.screenX,e=void 0!==window.screenTop?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,n=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,i=a/window.screen.availWidth,r=(a-parseInt(800))/2/i+t,s="scrollbars=yes,menubar=1,resizable=1,width=800,height=600,top="+((n-parseInt(600))/2/i+e)+",left="+r,o=window.open("",b.a.prefix+"_voice_popup_v2",s),c=!1,l=!1;try{!o||o.closed||void 0===o.closed||"about:blank"===o.location.href?(o=window.open(this.props.chatwidget.get("base_url")+"voicevideo/call/"+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"]),b.a.prefix+"_voice_popup_v2",s),l=!0):c=!0}catch(t){c=!0}!o||o.closed||void 0===o.closed||1==l||!0===c&&o.focus()}},{key:"toggleSound",value:function(){this.props.dispatch({type:"toggleSound",data:!this.props.chatwidget.getIn(["usersettings","soundOn"])}),b.a.sendMessageParent("toggleSound",[{sender:"toolbarButton"}])}},{key:"render",value:function(){var t=this,e=this.props.t;if(!1===this.props.chatwidget.get("initLoaded")||!1===this.props.chatwidget.get("msgLoaded")){var a="flex-grow-1 overflow-scroll position-relative";return this.props.chatwidget.hasIn(["chat_ui","msg_expand"])&&(a="overflow-scroll position-relative"),n.createElement(it,{value:this.state.value,profileBefore:this.props.profileBefore,msg_expand:a,messagesBefore:this.props.messagesBefore,placeholderMessage:this.props.chatwidget.hasIn(["chat_ui","placeholder_message"])?this.props.chatwidget.getIn(["chat_ui","placeholder_message"]):e("chat.type_here")})}if(this.props.chatwidget.hasIn(["chatLiveData","ru"])&&this.props.chatwidget.getIn(["chatLiveData","ru"]))return u=this.props.chatwidget.get("base_url")+this.props.chatwidget.getIn(["chatLiveData","ru"]),n.createElement(n.Fragment,null,n.createElement("iframe",{allowtransparency:"true",src:u,frameBorder:"0",className:"flex-grow-1 position-relative iframe-modal"}));if(this.props.chatwidget.get("chatLiveData").has("messages"))var i=this.props.chatwidget.getIn(["chatLiveData","messages"]).map((function(a,i){return n.createElement(H,{reactToMessageId:t.state.reactToMsgId,setReactingTo:function(e){return t.setState({reactToMsgId:e})},themeId:t.props.chatwidget.get("theme"),profilePic:t.props.chatwidget.get("profile_pic"),printButton:t.props.chatwidget.getIn(["chat_ui","print_btn_msg"]),newTitle:t.props.chatwidget.getIn(["chat_ui","cnew_msgh"])||e("button.new"),newId:t.state.newId,hasNew:t.state.hasNew,voiceCall:t.voiceCall,endChat:t.props.endChat,setMetaUpdateState:t.setMetaUpdateState,sendDelay:t.sendDelay,setEditorEnabled:t.setEditorEnabled,abstractAction:t.abstractAction,updateStatus:t.updateStatus,focusMessage:t.focusMessage,updateMessage:t.updateMessage,updateMessages:t.updateMessages,scrollBottom:t.scrollBottom,id:i,key:"msg_"+i,msg:a})}));else i="";var r;r=!0===this.state.dragging?e("chat.drop_files"):this.props.chatwidget.getIn(["chatLiveData","closed"])?e("chat.chat_closed"):this.props.chatwidget.hasIn(["chat_ui","placeholder_message"])?this.props.chatwidget.getIn(["chat_ui","placeholder_message"]):e("chat.type_here"),a="flex-grow-1 overflow-scroll position-relative";var s="bottom-message px-1";this.props.chatwidget.hasIn(["chat_ui","msg_expand"])&&"embed"==this.props.chatwidget.get("mode")&&(a="overflow-scroll position-relative",s+=" position-relative");var o="mx-auto w-100";1==this.props.chatwidget.getIn(["chatLiveData","closed"])&&(o+="embed"==this.props.chatwidget.get("mode")?" pe-2":" pe-1");var c=!0,l=!1,d=!1,u="",h="flex-grow-1 position-relative iframe-modal content-loader mb-2",p=this.props.chatwidget.hasIn(["chatLiveData","status_sub"])&&(this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.Pd||this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.pV&&(this.props.chatwidget.getIn(["chatLiveData","uid"])>0||this.props.chatwidget.getIn(["chatLiveData","status"])===E.pA||this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk))||this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk&&this.props.chatwidget.getIn(["chatLiveData","uid"])>0||!0===this.state.gotToSurvey;(this.props.chatwidget.hasIn(["chatLiveData","status_sub"])&&this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.Pd||this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk&&this.props.chatwidget.getIn(["chatLiveData","status_sub"])!=E.pV)&&(d=!0),(!0===this.state.preloadSurvey||p)&&this.props.chatwidget.hasIn(["chat_ui","survey_id"])&&(u=this.props.chatwidget.get("base_url")+"survey/fillwidget/(chatid)/"+this.props.chatwidget.getIn(["chatData","id"])+"/(hash)/"+this.props.chatwidget.getIn(["chatData","hash"]),this.props.chatwidget.get("theme")&&(u=u+"/(theme)/"+this.props.chatwidget.get("theme")),u=u+"/(survey)/"+this.props.chatwidget.getIn(["chat_ui","survey_id"])+(!0===d?"/(force)/true":""),this.props.chatwidget.hasIn(["chat_ui","survey_url"])&&(u=this.props.chatwidget.getIn(["chat_ui","survey_url"]).replace("{chat_id}",this.props.chatwidget.getIn(["chatData","id"])).replace("{chat_hash}",this.props.chatwidget.getIn(["chatData","hash"]))+(!0===d?"?force=true":"")),l=!0,c=!1,(!1===p||this.props.chatwidget.hasIn(["chat_ui","survey_button"])&&0===this.props.chatwidget.getIn(["chat_ui_state","show_survey"])&&this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk&&this.props.chatwidget.getIn(["chatLiveData","status_sub"])!=E.Pd&&this.props.chatwidget.getIn(["chatLiveData","status_sub"])!=E.pV||1==this.props.chatwidget.getIn(["chat_ui_state","confirm_close"]))&&(c=!0,h=" d-none"));var _=this.props.chatwidget.getIn(["chat_ui","end_chat_text"])||e("button.end_chat"),g={fontSize:(this.props.chatwidget.hasIn(["chat_ui","font_size"])?this.state.fontSize:"100")+"%"};return n.createElement(n.Fragment,null,this.props.chatwidget.getIn(["chatLiveData","abort"])&&n.createElement(rt.Z,{closeText:e("button.close"),close:function(e){return t.props.dispatch((0,y.H7)(!0))},text:this.props.chatwidget.getIn(["chatLiveData","abort"])}),this.props.chatwidget.hasIn(["chat_ui","pre_survey_url"])&&this.props.chatwidget.getIn(["chatLiveData","uid"])>0&&2!==this.props.chatwidget.getIn(["chat_ui_state","pre_survey_done"])&&(1===this.props.chatwidget.getIn(["chat_ui_state","pre_survey_done"])||p)&&n.createElement(B.Z,{cancelClose:function(e){return t.props.dispatch((0,y.Lt)(!1))},confirmClose:function(e){return t.props.dispatch((0,y.Lt)(!0))},toggle:this.props.cancelPresurvey,dataUrl:this.props.chatwidget.getIn(["chat_ui","pre_survey_url"])+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"])+(this.props.chatwidget.hasIn(["chat_ui","survey_id"])?"/(hassurvey)/true":"")+(this.props.chatwidget.get("theme")?"/(theme)/"+this.props.chatwidget.get("theme"):null)}),l&&n.createElement(n.Fragment,null,0==c&&this.props.chatwidget.hasIn(["chatStatusData","result"])&&!this.props.chatwidget.hasIn(["chat_ui","hide_status"])&&this.props.chatwidget.getIn(["chatStatusData","result"])&&n.createElement("div",{id:"chat-status-container",className:"p-2 border-bottom live-status-"+this.props.chatwidget.getIn(["chatLiveData","status"])},n.createElement(et,{updateStatus:this.updateStatus,vtm:this.props.chatwidget.hasIn(["chat_ui","switch_to_human"])&&this.props.chatwidget.getIn(["chatLiveData","status"])==E.pA?this.props.chatwidget.getIn(["chatLiveData","vtm"]):0,status:this.props.chatwidget.getIn(["chatStatusData","result"])})),n.createElement("iframe",{allowtransparency:"true",src:u,frameBorder:"0",className:h})),(c||l)&&n.createElement(Y,{hasSurvey:l,syncInterval:this.props.chatwidget.getIn(["chat_ui","sync_interval"]),updateStatus:this.updateStatus,updateMessages:this.updateMessages,initClose:this.props.chatwidget.get("initClose"),dispatch:this.props.dispatch,status_sub:this.props.chatwidget.getIn(["chatLiveData","status_sub"]),status:this.props.chatwidget.getIn(["chatLiveData","status"]),theme:this.props.chatwidget.get("theme"),lmgsid:this.props.chatwidget.getIn(["chatLiveData","lmsgid"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),chat_id:this.props.chatwidget.getIn(["chatData","id"])}),c&&n.createElement(n.Fragment,null,1==this.props.chatwidget.getIn(["chat_ui_state","confirm_close"])&&n.createElement(B.Z,{confirmClose:this.props.endChat,cancelClose:this.props.cancelClose,toggle:this.props.cancelClose,dataUrl:"/chat/confirmleave/"+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"])}),this.state.showBBCode&&n.createElement(B.Z,{showModal:this.state.showBBCode,insertText:this.insertText,toggle:this.toggleModal,dataUrl:"/chat/bbcodeinsert?react=1"}),this.state.changeLanguage&&n.createElement(B.Z,{showModal:this.state.changeLanguage,setLanguage:this.setLanguageAction,insertText:this.insertText,toggle:this.changeLanguage,dataUrl:"/widgetrestapi/chooselanguage/(id)/"+this.props.chatwidget.getIn(["chatData","id"])+"/(hash)/"+this.props.chatwidget.getIn(["chatData","hash"])}),this.state.showMail&&n.createElement(n.Suspense,{fallback:"..."},n.createElement(ut,{showModal:this.state.showMail,changeFont:this.changeFont,toggle:this.mailChat,chatHash:this.props.chatwidget.getIn(["chatData","hash"]),chatId:this.props.chatwidget.getIn(["chatData","id"])})),this.state.changeFontSize&&n.createElement(n.Suspense,{fallback:"..."},n.createElement(ht,{showModal:this.state.changeFontSize,toggle:this.changeFont,changeFont:this.changeFontAction})),"embed"==this.props.chatwidget.get("mode")&&this.props.chatwidget.hasIn(["chat_ui","embed_cls"])&&1==this.props.chatwidget.getIn(["chat_ui","embed_cls"])&&n.createElement("div",{className:"close-modal-btn position-absolute"},this.props.chatwidget.hasIn(["chat_ui","close_btn"])&&n.createElement("a",{onClick:this.endChat,title:_},n.createElement("i",{className:"material-icons settings text-muted"},""),n.createElement("span",{className:"embed-close-title"},_))),this.props.chatwidget.hasIn(["chatStatusData","result"])&&!this.props.chatwidget.hasIn(["chat_ui","hide_status"])&&this.props.chatwidget.getIn(["chatStatusData","result"])&&n.createElement("div",{id:"chat-status-container",className:"p-2 border-bottom live-status-"+this.props.chatwidget.getIn(["chatLiveData","status"])},n.createElement(et,{updateStatus:this.updateStatus,vtm:this.props.chatwidget.hasIn(["chat_ui","switch_to_human"])&&this.props.chatwidget.getIn(["chatLiveData","status"])==E.pA?this.props.chatwidget.getIn(["chatLiveData","vtm"]):0,status:this.props.chatwidget.getIn(["chatStatusData","result"])})),n.createElement("div",{className:a+(this.props.chatwidget.hasIn(["chat_ui","after_chat_status"])&&""!=this.props.chatwidget.getIn(["chat_ui","after_chat_status"])?" has-after-chat-status":""),onClick:function(e){t.setState({reactToMsgId:0})},id:"messagesBlock",onScroll:this.onScrollMessages},this.props.chatwidget.hasIn(["chat_ui","after_chat_status"])&&""!=this.props.chatwidget.getIn(["chat_ui","after_chat_status"])&&n.createElement(n.Suspense,{fallback:""},n.createElement(pt,{setStateParent:function(e){return t.setState(e)},has_new:this.state.hasNew&&this.state.otm>0,attr:"after_chat_status"})),n.createElement("div",{className:s,id:"messages-scroll",style:g,ref:this.messagesAreaRef},this.props.chatwidget.hasIn(["chat_ui","prev_chat"])&&n.createElement("div",{dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","prev_chat"])}}),i,this.props.chatwidget.hasIn(["chatLiveData","msg_to_store"])&&this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size>0&&this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).map((function(t,e){return n.createElement("div",{"data-op-id":"0",className:"message-row response msg-to-store"},n.createElement("div",{className:"msg-body"},t.split("\n").map((function(t,e){return n.createElement(n.Fragment,{key:e},t,n.createElement("br",null))}))))}))),this.state.scrollButton&&n.createElement("div",{className:"position-absolute btn-bottom-scroll fade-in",id:"id-btn-bottom-scroll"},n.createElement("button",{type:"button",onClick:this.scrollToMessage,className:"btn btn-sm btn-secondary"},this.state.hasNew&&this.state.otm>0&&n.createElement("div",null,n.createElement("i",{className:"material-icons"},""),this.state.otm," ",1==this.state.otm?this.props.chatwidget.getIn(["chat_ui","cnew_msg"])||e("button.new_msg"):this.props.chatwidget.getIn(["chat_ui","cnew_msgm"])||e("button.new_msgm"))||this.props.chatwidget.getIn(["chat_ui","cscroll_btn"])||e("button.scroll_bottom")))),n.createElement("div",{className:(!1===this.props.chatwidget.get("msgLoaded")||!1===this.state.enabledEditor?"d-none ":"d-flex ")+"flex-row border-top position-relative message-send-area"},(this.props.chatwidget.getIn(["chatLiveData","ott"])||this.props.chatwidget.getIn(["chatLiveData","error"])&&"SEND_CONNECTION"!=this.props.chatwidget.getIn(["chatLiveData","error"])||this.props.chatwidget.get("network_down"))&&n.createElement("div",{id:"id-operator-typing",className:"bg-white ps-1"},this.props.chatwidget.getIn(["chatLiveData","error"])?-1===this.props.chatwidget.getIn(["chatLiveData","error"]).indexOf("SEND_")?this.props.chatwidget.getIn(["chatLiveData","error"]):e("online_chat."+this.props.chatwidget.getIn(["chatLiveData","error"]).toLowerCase()):this.props.chatwidget.get("network_down")?e("online_chat.send_connection"):this.props.chatwidget.getIn(["chatLiveData","ott"])),"embed"==this.props.chatwidget.get("mode")&&this.props.chatwidget.hasIn(["chat_ui","embed_cls"])&&2==this.props.chatwidget.getIn(["chat_ui","embed_cls"])&&n.createElement("div",{className:"inline-cls-btn pt-1 ps-2"},this.props.chatwidget.hasIn(["chat_ui","close_btn"])&&n.createElement("a",{onClick:this.endChat,title:_},n.createElement("i",{className:"material-icons settings text-muted me-0"},""))),n.createElement(T,{elementId:"chat-dropdown-options"},n.createElement("div",{className:"btn-group dropup disable-select ps-1 pt-2"},n.createElement("i",{className:"material-icons settings text-muted",id:"chat-dropdown-options","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},""),n.createElement("div",{className:"dropdown-menu shadow bg-white rounded lhc-dropdown-menu ms-1 "+("rtl"==window.lhcChat.staticJS.dir?"dropdown-menu-end":"")},n.createElement("div",{className:"d-flex flex-row ps-1"},n.createElement("a",{onClick:this.toggleSound,title:e("chat.option_sound")},n.createElement("i",{className:"material-icons chat-setting-item text-muted "+(!0===this.props.chatwidget.getIn(["usersettings","soundOn"])?"sound-on-ico":"sound-off-ico")},!0===this.props.chatwidget.getIn(["usersettings","soundOn"])?n.createElement(n.Fragment,null,""):n.createElement(n.Fragment,null,""))),this.props.chatwidget.hasIn(["chat_ui","print"])&&n.createElement("a",{target:"_blank",href:this.props.chatwidget.get("base_url")+"chat/printchat/"+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"]),title:e("button.print")},n.createElement("i",{className:"material-icons chat-setting-item text-muted print-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","dwntxt"])&&n.createElement("a",{target:"_blank",href:this.props.chatwidget.get("base_url")+"chat/downloadtxt/"+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"]),title:e("button.dwntxt")},n.createElement("i",{className:"material-icons chat-setting-item text-muted download-ico"},"")),!this.props.chatwidget.getIn(["chatLiveData","closed"])&&this.props.chatwidget.hasIn(["chat_ui","file"])&&n.createElement($,{fileOptions:this.props.chatwidget.getIn(["chat_ui","file_options"]),onDrag:this.dragging,dropArea:this.textMessageRef,onCompletion:this.updateMessages,progress:this.setStatusText,base_url:this.props.chatwidget.get("base_url"),chat_id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),link:!0}),!this.props.chatwidget.getIn(["chatLiveData","closed"])&&1==this.props.chatwidget.getIn(["chatLiveData","status"])&&this.props.chatwidget.hasIn(["chat_ui","voice"])&&!0===this.props.chatwidget.getIn(["chat_ui","voice"])&&n.createElement("a",{onClick:this.voiceCall,title:e("button.voice")},n.createElement("i",{className:"material-icons chat-setting-item text-muted voice-ico"},"")),!this.props.chatwidget.getIn(["chatLiveData","closed"])&&!this.props.chatwidget.hasIn(["chat_ui","bbc_btnh"])&&n.createElement("a",{onClick:this.toggleModal,title:e("button.bb_code")},n.createElement("i",{className:"material-icons chat-setting-item text-muted bbcode-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","mail"])&&n.createElement("a",{onClick:this.mailChat,title:e("button.mail")},n.createElement("i",{className:"material-icons chat-setting-item text-muted mail-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","font_size"])&&n.createElement("a",{onClick:function(e){return t.changeFont(e)}},n.createElement("i",{className:"material-icons chat-setting-item text-muted fs-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","close_btn"])&&n.createElement("a",{onClick:this.endChat,title:_},n.createElement("i",{className:"material-icons chat-setting-item text-muted close-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","lng_btnh"])&&n.createElement("a",{onClick:this.changeLanguage,title:e("button.lang")},n.createElement("i",{className:"material-icons chat-setting-item text-muted lang-ico"},"")))))),n.createElement("div",{className:o},this.props.chatwidget.getIn(["chatLiveData","closed"])&&this.props.chatwidget.hasIn(["chat_ui","survey_id"])&&n.createElement("button",{onClick:this.goToSurvey,className:"w-100 btn btn-success"},e("online_chat.go_to_survey")),(!this.props.chatwidget.getIn(["chatLiveData","closed"])||!this.props.chatwidget.hasIn(["chat_ui","survey_id"]))&&n.createElement("textarea",{onFocus:function(e){t.setState({reactToMsgId:0})},onTouchStart:this.scrollBottom,maxLength:this.props.chatwidget.getIn(["chat_ui","max_length"]),onKeyUp:this.keyUp,readOnly:this.props.chatwidget.getIn(["chatLiveData","closed"])||this.props.chatwidget.get("network_down"),id:"CSChatMessage",placeholder:r,onKeyDown:this.enterKeyDown,value:this.props.chatwidget.getIn(["chatLiveData","closed"])?"":this.state.value,onChange:this.handleChange,ref:this.textMessageRef,rows:"1",className:"ps-0 no-outline form-control rounded-0 form-control rounded-start-0 rounded-end-0 border-0 "+(!0===this.props.chatwidget.get("shown")&&this.textMessageRef.current&&(/\r|\n/.exec(this.state.value)||this.state.value.length>this.textMessageRef.current.offsetWidth/8.6)?"msg-two-line":"msg-one-line")})),!this.props.chatwidget.getIn(["chatLiveData","closed"])&&!this.props.chatwidget.get("network_down")&&n.createElement("div",{className:"disable-select"},n.createElement("div",{className:"user-chatwidget-buttons pt-2 pe-1",id:"ChatSendButtonContainer"},!0===this.state.voiceMode&&n.createElement(n.Suspense,{fallback:"..."},n.createElement(dt,{onCompletion:this.updateMessages,progress:this.setStatusText,base_url:this.props.chatwidget.get("base_url"),chat_id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),maxSeconds:this.props.chatwidget.getIn(["chat_ui","voice_message"]),cancel:this.cancelVoiceRecording})),(!this.props.chatwidget.hasIn(["chatLiveData","msg_to_store"])||0==this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size)&&this.props.chatwidget.hasIn(["chat_ui","voice_message"])&&void 0!==window.Audio&&0==this.state.value.length&&!1===this.state.voiceMode&&n.createElement("a",{onClick:this.startVoiceRecording,title:e("button.record_voice")},n.createElement("i",{className:"material-icons text-muted settings me-0"},"")),(!this.props.chatwidget.hasIn(["chatLiveData","msg_to_store"])||0==this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size)&&(!this.props.chatwidget.hasIn(["chat_ui","voice_message"])||!(void 0!==window.Audio)||this.state.value.length>0&&!1===this.state.voiceMode)&&n.createElement("a",{onClick:this.sendMessage,title:e("button.send_msg")},n.createElement("i",{className:"material-icons settings me-0"+(0==this.state.value.length?" text-muted-light":" text-muted")},"")),this.props.chatwidget.hasIn(["chatLiveData","msg_to_store"])&&this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size>0&&n.createElement("i",{className:"material-icons text-muted settings me-0"},""))))))}}]),r}(n.Component))||nt),gt=(0,I.Z)()(_t);var ft=n.lazy((function(){return a.e(476).then(a.bind(a,5476))})),mt=n.lazy((function(){return a.e(906).then(a.bind(a,906))})),vt=(ct=(0,w.$j)((function(t){return{chatwidget:t.chatwidget}})),ct(lt=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),e=i.call(this,t),v()(f()(e),"state",{}),e.endChat=e.endChat.bind(f()(e)),e.popupChat=e.popupChat.bind(f()(e)),e.cancelClose=e.cancelClose.bind(f()(e)),e.setProfile=e.setProfile.bind(f()(e)),e.setMessages=e.setMessages.bind(f()(e)),e.setHideMessageField=e.setHideMessageField.bind(f()(e)),e.setBotPayload=e.setBotPayload.bind(f()(e)),e.switchColumn=e.switchColumn.bind(f()(e)),e.lastHeiht=0,e.profileHTML=null,e.messagesHTML=null,e.hideMessageField=!1,e.botPayload=null,b.a.eventEmitter.addListener("end_chat_visitor",(function(t){return e.endChat()})),e}return c()(r,[{key:"cancelClose",value:function(){this.props.dispatch({type:"UI_STATE",data:{attr:"confirm_close",val:0}})}},{key:"setBotPayload",value:function(t){this.botPayload=t}},{key:"endChat",value:function(t){void 0===t&&(t={});var e=!1,a=!1,n=!1,i=this.props.chatwidget.hasIn(["chatLiveData","status_sub"])&&(this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.B4||this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.Pd||this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.pV&&(this.props.chatwidget.getIn(["chatLiveData","uid"])>0||this.props.chatwidget.getIn(["chatLiveData","status"])===E.pA||this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk)),r=this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk&&this.props.chatwidget.getIn(["chatLiveData","uid"])>0;(1==i||r)&&this.props.chatwidget.hasIn(["chat_ui","survey_id"])&&(this.props.chatwidget.hasIn(["chat_ui","survey_button"])&&1!==this.props.chatwidget.getIn(["chat_ui_state","show_survey"])&&1!=i?a=!0:e=!0),!1===e&&this.props.chatwidget.hasIn(["chat_ui","confirm_close"])&&0===this.props.chatwidget.getIn(["chat_ui_state","confirm_close"])?this.props.dispatch({type:"UI_STATE",data:{attr:"confirm_close",val:1}}):(1===this.props.chatwidget.getIn(["chat_ui_state","confirm_close"])&&this.props.dispatch({type:"UI_STATE",data:{attr:"confirm_close",val:2}}),1===this.props.chatwidget.getIn(["chat_ui_state","pre_survey_done"])&&this.props.dispatch({type:"UI_STATE",data:{attr:"pre_survey_done",val:2}}),this.props.chatwidget.hasIn(["chat_ui","pre_survey_url"])&&0===this.props.chatwidget.getIn(["chat_ui_state","pre_survey_done"])&&this.props.chatwidget.getIn(["chatLiveData","uid"])>0&&(this.props.dispatch({type:"UI_STATE",data:{attr:"pre_survey_done",val:1}}),n=!0),!0!==a?!1===this.props.chatwidget.get("initClose")&&this.props.chatwidget.hasIn(["chat_ui","survey_id"])&&0==e&&(this.props.chatwidget.getIn(["chatLiveData","uid"])>0||this.props.chatwidget.getIn(["chatLiveData","status"])===E.pA)?this.props.dispatch((0,y.Nl)({show_start:!(!t||!t.show_start)&&t.show_start,noCloseReason:"SHOW_SURVEY",noClose:!0,vid:this.props.chatwidget.get("vid"),chat:{id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"])}})):0==n&&this.props.dispatch((0,y.Nl)({show_start:!(!t||!t.show_start)&&t.show_start,vid:this.props.chatwidget.get("vid"),chat:{id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"])}})):this.props.dispatch({type:"UI_STATE",data:{attr:"show_survey",val:1}}))}},{key:"popupChat",value:function(){var t=null;window.parent&&window.parent["$_"+b.a.prefixUppercase]&&!1===window.parent.closed?t=window.parent["$_"+b.a.prefixUppercase].eventListener:window.opener&&window.opener["$_"+b.a.prefixUppercase]&&!1===window.opener.closed&&(t=window.opener["$_"+b.a.prefixUppercase].eventListener),null!==t?t.emitEvent("openPopup"):b.a.sendMessageParent("openPopup",[])}},{key:"switchColumn",value:function(){var t=this.props.chatwidget.get("position_placement").includes("full_height_")?this.props.chatwidget.get("position_placement_original"):"full_height"+(this.props.chatwidget.get("position_placement_original").includes("_right")?"_right":"_left");b.a.sendMessageParent("widgetHeight",[{position_placement:t}]),this.props.dispatch({type:"position_placement",data:t})}},{key:"setProfile",value:function(t){this.profileHTML=t}},{key:"setMessages",value:function(t){this.messagesHTML=t}},{key:"setHideMessageField",value:function(t){this.hideMessageField=t}},{key:"render",value:function(){if(!1===this.props.chatwidget.get("loadedCore"))return null;if(!0===this.props.chatwidget.getIn(["proactive","pending"]))return n.createElement(n.Suspense,{fallback:"..."},n.createElement(mt,{setBotPayload:this.setBotPayload}));var t="d-flex flex-column flex-grow-1 reset-container-margins";return"widget"==this.props.chatwidget.get("mode")?t+=1==this.props.chatwidget.get("isMobile")?" mobile-body":" desktop-body":"embed"==this.props.chatwidget.get("mode")&&(t+=1==this.props.chatwidget.get("isMobile")?" mobile-embed-body":" desktop-embed-body"),this.props.chatwidget.hasIn(["chat_ui","msg_expand"])&&"embed"==this.props.chatwidget.get("mode")&&(t+=" mh-100"),!0===this.props.chatwidget.get("isChatting")?(t+=" online-chat online-chat-status-"+this.props.chatwidget.getIn(["chatLiveData","status"]),n.createElement(n.Fragment,null,this.props.chatwidget.hasIn(["chat_ui","custom_html_header"])&&n.createElement("div",{className:"lhc-custom-header-above",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_header"])}}),"widget"==this.props.chatwidget.get("mode")&&n.createElement(k,{switchColumn:this.switchColumn,popupChat:this.popupChat,endChat:this.endChat}),n.createElement("div",{className:t},n.createElement(gt,{hideMessageField:this.hideMessageField,profileBefore:this.profileHTML,messagesBefore:this.messagesHTML,cancelClose:this.cancelClose,endChat:this.endChat})))):!0===this.props.chatwidget.get("isOnline")&&!1===this.props.chatwidget.get("isOfflineMode")?(t+=" start-chat",n.createElement(n.Fragment,null,this.props.chatwidget.hasIn(["chat_ui","custom_html_header"])&&n.createElement("div",{className:"lhc-custom-header-above",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_header"])}}),"widget"==this.props.chatwidget.get("mode")&&n.createElement(k,{switchColumn:this.switchColumn,popupChat:this.popupChat,endChat:this.endChat}),n.createElement("div",{className:t},n.createElement(O.Z,{botPayload:this.botPayload,setHideMessageField:this.setHideMessageField,setProfile:this.setProfile,setMessages:this.setMessages})))):(t+=" offline-chat",n.createElement(n.Fragment,null,this.props.chatwidget.hasIn(["chat_ui","custom_html_header"])&&n.createElement("div",{className:"lhc-custom-header-above",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_header"])}}),"widget"==this.props.chatwidget.get("mode")&&n.createElement(k,{switchColumn:this.switchColumn,popupChat:this.popupChat,endChat:this.endChat}),n.createElement("div",{className:t},n.createElement(n.Suspense,{fallback:""},n.createElement(ft,null)))))}}]),r}(n.Component))||lt),wt=vt,yt=a(1766);var bt=function(t){d()(i,t);var e,a,n=(e=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function i(t){var e;return s()(this,i),e=n.call(this,t),v()(f()(e),"state",{}),v()(f()(e),"playSound",(function(t){"new_message"==t.type?(!0===t.sound_on&&(!1===t.widget_open||!0===t.widget_open&&0==window.lhcChat.is_focused)&&e.playSoundFile("new_message"),0==t.widget_open&&b.a.sendMessageParent("unread_message",[{msop:t.msop||null,msg_body:t.msg_body||null,type:"unread_message",otm:t.otm||0}])):"new_invitation"==t.type&&!0===t.sound_on?null===b.a.getSessionStorage("_invs")&&(b.a.setSessionStorage("_invs",1),e.playSoundFile("new_invitation")):"new_chat"==t.type&&!0===t.sound_on&&e.playSoundFile("new_invitation"),0==window.lhcChat.is_focused&&b.a.sendMessageParent("unread_message_title",[{status:!1}])})),v()(f()(e),"playSoundFile",(function(t){new yt.Howl({src:[window.lhcChat.base_url+"/widgetrestapi/loadsound/"+t+"_mp3",window.lhcChat.base_url+"/widgetrestapi/loadsound/"+t+"_ogg",window.lhcChat.base_url+"/widgetrestapi/loadsound/"+t+"_wav"],format:["mp3","ogg","wav"],autoplay:!0})})),b.a.eventEmitter.addListener("play_sound",(function(t){return e.playSound(t)})),e}return c()(i,[{key:"render",value:function(){return null}}]),i}(n.PureComponent),Et=(0,w.$j)()(bt);var It=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),(e=i.call(this,t)).state={hasError:!1},e}return c()(r,[{key:"componentDidCatch",value:function(t,e){this.setState({hasError:!0,error:t,info:e}),b.a.logJSError({stack:t.stack?JSON.stringify(t.stack):""})}},{key:"render",value:function(){return this.state.hasError?n.createElement("p",null,"Please re-load window because of an error."):this.props.children}}]),r}(n.Component);var Dt=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(){return s()(this,r),i.apply(this,arguments)}return c()(r,[{key:"render",value:function(){return n.createElement(n.Fragment,null,n.createElement(It,null,n.createElement(Et,null),n.createElement(wt,null)))}}]),r}(n.Component),St=Dt;function Tt(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function Ct(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function kt(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:Kt,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Rt:return!1===t.get("isChatting")&&(t=t.set("processStatus",0).set("isOfflineMode",!1)),t.set("shown",!1);case"loadedCore":return t.set("loadedCore",!0);case"attr_set":return t.setIn(e.attr,e.data);case"profile_pic":return t.set("profile_pic",-1!==e.data.indexOf("http:")||-1!==e.data.indexOf("https:")?e.data:window.lhcChat.base_url+"widgetrestapi/avatar/"+e.data);case"attr_rem":return t.removeIn(e.attr);case"operator":case"leave_message":case"phash":case"pvhash":case"attr_prefill":case"attr_prefill_admin":case Bt:case"base_url":case"theme":case"jsVars":case"jsVarsPrefill":case"subject_id":case"bot_id":case"trigger_id":case"priority":case"position_placement":case"position_placement_original":case"lang":return t.set(e.type,e.data);case"widgetStatus":return 1==e.data&&!0===t.getIn(["proactive","pending"])&&(t=t.setIn(["proactive","pending"],!1)),1==e.data&&t.hasIn(["proactive","data","hide_on_open"])&&(t=t.set("proactive",(0,Wt.d0)({pending:!1,has:!1,data:{}}))),t.set("shown",e.data);case"PROACTIVE":return t.set("proactive",{pending:!1===t.get("shown")&&!1===e.data.qinv,has:!0,data:e.data});case"HIDE_INVITATION":return t.setIn(["proactive","pending"],!1);case"CANCEL_INVITATION":return t.set("proactive",(0,Wt.d0)({pending:!1,has:!1,data:{}}));case"FULL_INVITATION":return t.setIn(["proactive","pending"],!1);case Ft:return t.setIn(["usersettings","soundOn"],e.data);case Ut:return t.set("shown",!1).set("processStatus",0).set("isChatting",!1).set("newChat",!0).set("proactive",(0,Wt.d0)({pending:!1,has:!1,data:{}})).set("chatData",(0,Wt.d0)({})).removeIn(["chat_ui","survey_id"]).removeIn(["chat_ui","cmmsg_widget"]).setIn(["onlineData","fetched"],!1).set("chatLiveData",(0,Wt.d0)({msg_to_store:[],lmsop:0,vtm:0,otm:0,msop:0,uid:0,status:0,status_sub:0,uw:!1,ott:"",closed:!1,lfmsgid:0,lmsgid:0,operator:"",messages:[]})).set("chatStatusData",(0,Wt.d0)({})).set("chat_ui_state",(0,Wt.d0)({confirm_close:0,show_survey:0,pre_survey_done:0})).set("initClose",!1).set("msgLoaded",!1).set("initLoaded",!1);case"chat_status_changed":return t.setIn(["chatLiveData","ott"],e.data.text);case Nt:return t.set("isOnline",e.data);case Ht:return t.set("offlineData",(0,Wt.d0)({fetched:!0,disabled:e.data.disabled,fields_visible:e.data.fields_visible,fields:e.data.fields,department:e.data.department})).set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui)));case"department":case"mode":case"product":case"captcha":return t.set(e.type,(0,Wt.d0)(e.data));case"INIT_PRODUCTS":return t.setIn(["onlineData","department","products"],(0,Wt.d0)(e.data.products)).setIn(["onlineData","department","settings","product_required"],e.data.required);case"CHAT_SESSION_REFFERER":return t.set("ses_ref",e.data.ref);case"CHAT_ADD_OVERRIDE":return t.update("overrides",(function(t){return t.push(e.data)}));case"CHAT_REMOVE_OVERRIDE":return t.update("overrides",(function(t){return t.filter((function(t){return t!=e.data}))}));case jt:return!0===e.data.success?(b.a.sendMessageParent("chatStarted",[e.data.chatData,t.get("mode")]),"popup"==t.get("mode")&&(!0===b.a.hasSessionStorage?(b.a.setSessionStorage("_chat",JSON.stringify(e.data.chatData)),b.a.removeSessionStorage("_reset_chat")):document.location="#/"+e.data.chatData.id+"/"+e.data.chatData.hash),t.set("processStatus",2).set("isChatting",!0).set("chatData",(0,Wt.d0)(e.data.chatData)).setIn(["chatLiveData","lfmsgid"],e.data.chatLiveData.message_id_first).set("validationErrors",(0,Wt.d0)({}))):t.set("validationErrors",(0,Wt.d0)(e.data.errors)).set("processStatus",0).setIn(["chat_ui","auto_start"],!1);case"OFFLINE_SUBMITTED":return!0===e.data.success?(b.a.sendMessageParent("offlineMessage",[]),t.set("processStatus",2).set("validationErrors",(0,Wt.d0)({}))):t.set("validationErrors",(0,Wt.d0)(e.data.errors)).set("processStatus",0);case"INIT_CLOSE":return t.set("initClose",!0);case"CHAT_ALREADY_STARTED":return t.set("processStatus",2).set("isChatting",!0).set("newChat",!1).set("chatData",(0,Wt.d0)(e.data));case"OFFLINE_SUBMITTING":return t.set("processStatus",1);case"CHAT_SET_VID":return t.set("vid",e.data);case"ONLINE_SUBMITTING":return t.set("processStatus",1);case"UI_STATE":return t.setIn(["chat_ui_state",e.data.attr],e.data.val);case"UPDATE_LIVE_DATA":return t.setIn(["chatLiveData",e.data.attr],e.data.val);case"ADD_MSG_TO_STORE":return t.updateIn(["chatLiveData","msg_to_store"],(function(t){return t.push(e.data)}));case"UPDATE_SCROLL_TO_MESSAGE":return e.data>t.getIn(["chatLiveData","lfmsgid"])?t.setIn(["chatLiveData","lfmsgid"],e.data):t;case"INIT_CHAT_SUBMITTED":return e.data.chat_ui_state&&(t=t.set("chat_ui_state",t.get("chat_ui_state").merge((0,Wt.d0)(e.data.chat_ui_state)))),t.setIn(["chatLiveData","operator"],e.data.operator).set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui))).setIn(["chatLiveData","status_sub"],e.data.status_sub).setIn(["chatLiveData","status"],e.data.status).set("initLoaded",!0).setIn(["chatLiveData","closed"],e.data.closed&&!0===e.data.closed);case"REFRESH_UI_COMPLETED":return e.data.chat_ui_remove&&e.data.chat_ui_remove.forEach((function(e){t=t.removeIn(e)})),t.set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui)));case"FETCH_MESSAGE_SUBMITTED":var a=t.getIn(["chatLiveData","messages"]).findIndex((function(t){if(t.msg.includes('id="msg-'+e.data.id+'"'))return!0}));if(-1!==a){var n=document.createElement("div");n.innerHTML=t.getIn(["chatLiveData","messages",a,"msg"]);var i=n.querySelector("#msg-"+e.data.id);i&&(n.innerHTML=n.innerHTML.replace(i.outerHTML,e.data.msg),t=t.setIn(["chatLiveData","messages",a,"msg"],n.innerHTML))}return t;case"FETCH_MESSAGES_SUBMITTED":return t.hasIn(["chatData","id"])?(e.data.closed_arg&&e.data.closed_arg.survey_id&&(t=t.setIn(["chat_ui","survey_id"],e.data.closed_arg.survey_id)),e.data.disable_survey&&(t=t.removeIn(["chat_ui","survey_id"])),e.data.extension&&(t=t.set("extension",t.get("extension").merge((0,Wt.d0)(e.data.extension)))),""!==e.data.messages&&(t=t.updateIn(["chatLiveData","messages"],(function(a){return a.push({lmsop:t.getIn(["chatLiveData","msop"]),msop:e.data.msop,msg:e.data.messages})})).setIn(["chatLiveData","uw"],e.data.uw&&!0===e.data.uw).setIn(["chatLiveData","lmsgid"],e.data.message_id).setIn(["chatLiveData","lfmsgid"],e.data.message_id_first).setIn(["chatLiveData","msop"],e.data.lmsop||e.data.msop)),e.data.vtm&&(t=t.updateIn(["chatLiveData","vtm"],(function(t){return t+e.data.vtm})).updateIn(["chatLiveData","msg_to_store"],(function(t){return t.splice(0,e.data.vtm)}))),e.data.otm&&(t=t.setIn(["chatLiveData","otm"],e.data.otm)),t.get("overrides").contains("typing")||(t=t.setIn(["chatLiveData","ott"],e.data.ott)),t.setIn(["chatLiveData","status_sub"],e.data.status_sub).setIn(["chatLiveData","status"],e.data.status).set("msgLoaded",!0).set("network_down",!1).setIn(["chatLiveData","closed"],e.data.closed&&!0===e.data.closed)):t;case"CHECK_CHAT_STATUS_FINISHED":return e.data.extension&&(t=t.set("extension",t.get("extension").merge((0,Wt.d0)(e.data.extension)))),t.set("chatStatusData",(0,Wt.d0)(e.data)).setIn(["chatLiveData","closed"],e.data.closed&&!0===e.data.closed||t.getIn(["chatLiveData","closed"])).setIn(["chatLiveData","status"],e.data.status).setIn(["chatLiveData","uid"],e.data.uid).setIn(["chatLiveData","ru"],e.data.ru?e.data.ru:null).set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui))).set("network_down",!1).setIn(["chatLiveData","status_sub"],e.data.status_sub);case"ONLINE_FIELDS_UPDATED":return t.set("onlineData",(0,Wt.d0)({dep_forms:e.data.dep_forms,disabled:e.data.disabled,fetched:!0,paid:e.data.paid,fields_visible:e.data.fields_visible,fields:e.data.fields,department:e.data.department})).set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui)));case"CHAT_UI_UPDATE":return t.set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data)));case"CUSTOM_FIELDS":return t.set("customData",(0,Wt.d0)({fields:e.data}));case"dep_default":return t.set("departmentDefault",e.data);case"survey":return t.setIn(["chat_ui","survey_id"],e.data);case"CUSTOM_FIELDS_ITEM":return t.setIn(["customData","fields",e.data.id,"value"],e.data.value);case"ADD_MESSAGES_SUBMITTED":return t.setIn(["chatLiveData","error"],e.data.r).setIn(["chatLiveData","lmsg"],e.data.r?e.data.msg:"").setIn(["chatLiveData","msg_to_store"],(0,Wt.d0)([]));case"NO_CONNECTION":return t.set("network_down",e.data);default:return t}}}),Vt=a(3894),zt=a(5068),Gt=a(696),$t=a(5397),Zt=a(5538);Gt.Z.use(Zt.Z).use($t.Db);var Jt=Gt.Z,Yt=function(){for(var t=arguments.length,e=new Array(t),a=0;a-1};function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function u(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function _(t){return new Promise((function(e,a){t.onload=function(){e(t.result)},t.onerror=function(){a(t.error)}}))}function g(t){var e=new FileReader,a=_(e);return e.readAsArrayBuffer(t),a}function f(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:a&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=f(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=f(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t,e,a,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,a=_(e=new FileReader),e.readAsText(t),a;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),a=new Array(e.length),n=0;n-1?n:a),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function y(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var a=t.split("="),n=a.shift().replace(/\+/g," "),i=a.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},m.call(w.prototype),m.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];b.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var a=Error(t);this.stack=a.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function I(t,a){return new Promise((function(n,r){var s=new w(t,a);if(s.signal&&s.signal.aborted)return r(new e.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function c(){o.abort()}o.onload=function(){var t,e,a={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var a=t.split(":"),n=a.shift().trim();if(n){var i=a.join(":").trim();e.append(n,i)}})),e)};a.url="responseURL"in o?o.responseURL:a.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new b(i,a))},o.onerror=function(){r(new TypeError("Network request failed"))},o.ontimeout=function(){r(new TypeError("Network request failed"))},o.onabort=function(){r(new e.DOMException("Aborted","AbortError"))},o.open(s.method,s.url,!0),"include"===s.credentials?o.withCredentials=!0:"omit"===s.credentials&&(o.withCredentials=!1),"responseType"in o&&i&&(o.responseType="blob"),s.headers.forEach((function(t,e){o.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),o.onreadystatechange=function(){4===o.readyState&&s.signal.removeEventListener("abort",c)}),o.send(void 0===s._bodyInit?null:s._bodyInit)}))}I.polyfill=!0,t.fetch||(t.fetch=I,t.Headers=h,t.Request=w,t.Response=b),e.Headers=h,e.Request=w,e.Response=b,e.fetch=I,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},8679:function(t,e,a){"use strict";var n=a(9864),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};function c(t){return n.isMemo(t)?s:o[t.$$typeof]||i}o[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o[n.Memo]=s;var l=Object.defineProperty,d=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,h=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,_=Object.prototype;t.exports=function t(e,a,n){if("string"!=typeof a){if(_){var i=p(a);i&&i!==_&&t(e,i,n)}var s=d(a);u&&(s=s.concat(u(a)));for(var o=c(e),g=c(a),f=0;f=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,r.ctx.currentTime);for(var a=0;a=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,p()),t},codecs:function(t){return(this||r)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||r;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||r,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var a=e.canPlayType("audio/mpeg;").replace(/^no$/,""),n=t._navigator?t._navigator.userAgent:"",i=n.match(/OPR\/([0-6].)/g),s=i&&parseInt(i[0].split("/")[1],10)<33,o=-1!==n.indexOf("Safari")&&-1===n.indexOf("Chrome"),c=n.match(/Version\/(.*?) /),l=o&&c&&parseInt(c[1],10)<15;return t._codecs={mp3:!(s||!a&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!a,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(l||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(l||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||r;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(a){for(;t._html5AudioPool.length0?o._seek:a._sprite[t][0]/1e3),d=Math.max(0,(a._sprite[t][0]+a._sprite[t][1])/1e3-l),u=1e3*d/Math.abs(o._rate),h=a._sprite[t][0]/1e3,p=(a._sprite[t][0]+a._sprite[t][1])/1e3;o._sprite=t,o._ended=!1;var _=function(){o._paused=!1,o._seek=l,o._start=h,o._stop=p,o._loop=!(!o._loop&&!a._sprite[t][2])};if(!(l>=p)){var g=o._node;if(a._webAudio){var f=function(){a._playLock=!1,_(),a._refreshBuffer(o);var t=o._muted||a._muted?0:o._volume;g.gain.setValueAtTime(t,r.ctx.currentTime),o._playStart=r.ctx.currentTime,void 0===g.bufferSource.start?o._loop?g.bufferSource.noteGrainOn(0,l,86400):g.bufferSource.noteGrainOn(0,l,d):o._loop?g.bufferSource.start(0,l,86400):g.bufferSource.start(0,l,d),u!==1/0&&(a._endTimers[o._id]=setTimeout(a._ended.bind(a,o),u)),e||setTimeout((function(){a._emit("play",o._id),a._loadQueue()}),0)};"running"===r.state&&"interrupted"!==r.ctx.state?f():(a._playLock=!0,a.once("resume",f),a._clearTimer(o._id))}else{var m=function(){g.currentTime=l,g.muted=o._muted||a._muted||r._muted||g.muted,g.volume=o._volume*r.volume(),g.playbackRate=o._rate;try{var n=g.play();if(n&&"undefined"!=typeof Promise&&(n instanceof Promise||"function"==typeof n.then)?(a._playLock=!0,_(),n.then((function(){a._playLock=!1,g._unlocked=!0,e?a._loadQueue():a._emit("play",o._id)})).catch((function(){a._playLock=!1,a._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),o._ended=!0,o._paused=!0}))):e||(a._playLock=!1,_(),a._emit("play",o._id)),g.playbackRate=o._rate,g.paused)return void a._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||o._loop?a._endTimers[o._id]=setTimeout(a._ended.bind(a,o),u):(a._endTimers[o._id]=function(){a._ended(o),g.removeEventListener("ended",a._endTimers[o._id],!1)},g.addEventListener("ended",a._endTimers[o._id],!1))}catch(t){a._emit("playerror",o._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===g.src&&(g.src=a._src,g.load());var v=window&&window.ejecta||!g.readyState&&r._navigator.isCocoonJS;if(g.readyState>=3||v)m();else{a._playLock=!0,a._state="loading";var w=function(){a._state="loaded",m(),g.removeEventListener(r._canPlayEvent,w,!1)};g.addEventListener(r._canPlayEvent,w,!1),a._clearTimer(o._id)}}return o._id}a._ended(o)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var a=e._getSoundIds(t),n=0;n=0?e=parseInt(i[0],10):t=parseFloat(i[0])}else i.length>=2&&(t=parseFloat(i[0]),e=parseInt(i[1],10));if(!(void 0!==t&&t>=0&&t<=1))return(a=e?n._soundById(e):n._sounds[0])?a._volume:0;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"volume",action:function(){n.volume.apply(n,i)}}),n;void 0===e&&(n._volume=t),e=n._getSoundIds(e);for(var c=0;c0?n/l:n),u=Date.now();t._fadeTo=a,t._interval=setInterval((function(){var i=(Date.now()-u)/n;u=Date.now(),o+=c*i,o=Math.round(100*o)/100,o=c<0?Math.max(a,o):Math.min(a,o),s._webAudio?t._volume=o:s.volume(o,t._id,!0),r&&(s._volume=o),(ae&&o>=a)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,s.volume(a,t._id),s._emit("fade",t._id))}),d)},_stopFade:function(t){var e=this,a=e._soundById(t);return a&&a._interval&&(e._webAudio&&a._node.gain.cancelScheduledValues(r.ctx.currentTime),clearInterval(a._interval),a._interval=null,e.volume(a._fadeTo,t),a._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,a,n=this,i=arguments;if(0===i.length)return n._loop;if(1===i.length){if("boolean"!=typeof i[0])return!!(a=n._soundById(parseInt(i[0],10)))&&a._loop;t=i[0],n._loop=t}else 2===i.length&&(t=i[0],e=parseInt(i[1],10));for(var r=n._getSoundIds(e),s=0;s=0?e=parseInt(i[0],10):t=parseFloat(i[0])}else 2===i.length&&(t=parseFloat(i[0]),e=parseInt(i[1],10));if("number"!=typeof t)return(a=n._soundById(e))?a._rate:n._rate;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"rate",action:function(){n.rate.apply(n,i)}}),n;void 0===e&&(n._rate=t),e=n._getSoundIds(e);for(var c=0;c=0?e=parseInt(n[0],10):a._sounds.length&&(e=a._sounds[0]._id,t=parseFloat(n[0]))}else 2===n.length&&(t=parseFloat(n[0]),e=parseInt(n[1],10));if(void 0===e)return 0;if("number"==typeof t&&("loaded"!==a._state||a._playLock))return a._queue.push({event:"seek",action:function(){a.seek.apply(a,n)}}),a;var o=a._soundById(e);if(o){if(!("number"==typeof t&&t>=0)){if(a._webAudio){var c=a.playing(e)?r.ctx.currentTime-o._playStart:0,l=o._rateSeek?o._rateSeek-o._seek:0;return o._seek+(l+c*Math.abs(o._rate))}return o._node.currentTime}var d=a.playing(e);d&&a.pause(e,!0),o._seek=t,o._ended=!1,a._clearTimer(e),a._webAudio||!o._node||isNaN(o._node.duration)||(o._node.currentTime=t);var u=function(){d&&a.play(e,!0),a._emit("seek",e)};if(d&&!a._webAudio){var h=function(){a._playLock?setTimeout(h,0):u()};setTimeout(h,0)}else u()}return a},playing:function(t){var e=this;if("number"==typeof t){var a=e._soundById(t);return!!a&&!a._paused}for(var n=0;n=0&&r._howls.splice(n,1);var i=!0;for(a=0;a=0){i=!1;break}return c&&i&&delete c[t._src],r.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,a,n){var i=this["_on"+t];return"function"==typeof e&&i.push(n?{id:a,fn:e,once:n}:{id:a,fn:e}),this},off:function(t,e,a){var n=this,i=n["_on"+t],r=0;if("number"==typeof e&&(a=e,e=null),e||a)for(r=0;r=0;r--)i[r].id&&i[r].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,a)}.bind(n,i[r].fn),0),i[r].once&&n.off(t,i[r].fn,i[r].id));return n._loadQueue(t),n},_loadQueue:function(t){var e=this;if(e._queue.length>0){var a=e._queue[0];a.event===t&&(e._queue.shift(),e._loadQueue()),t||a.action()}return e},_ended:function(t){var e=this,a=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime=0;n--){if(a<=e)return;t._sounds[n]._ended&&(t._webAudio&&t._sounds[n]._node&&t._sounds[n]._node.disconnect(0),t._sounds.splice(n,1),a--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],a=0;a=0;if(r._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=r._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(r._navigator&&r._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var o=function(t){this._parent=t,this.init()};o.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++r._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,a=r._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===r.ctx.createGain?r.ctx.createGainNode():r.ctx.createGain(),t._node.gain.setValueAtTime(a,r.ctx.currentTime),t._node.paused=!0,t._node.connect(r.masterGain)):r.noAudio||(t._node=r._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(r._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=a*r.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++r._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(r._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var c={},l=function(t){var e=t._src;if(c[e])return t._duration=c[e].duration,void h(t);if(/^data:[^;]+;base64,/.test(e)){for(var a=atob(e.split(",")[1]),n=new Uint8Array(a.length),i=0;i0?(c[e._src]=t,h(e,t)):a()};"undefined"!=typeof Promise&&1===r.ctx.decodeAudioData.length?r.ctx.decodeAudioData(t).then(n).catch(a):r.ctx.decodeAudioData(t,n,a)},h=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},p=function(){if(r.usingWebAudio){try{"undefined"!=typeof AudioContext?r.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?r.ctx=new webkitAudioContext:r.usingWebAudio=!1}catch(t){r.usingWebAudio=!1}r.ctx||(r.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(r._navigator&&r._navigator.platform),e=r._navigator&&r._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),a=e?parseInt(e[1],10):null;if(t&&a&&a<9){var n=/safari/.test(r._navigator&&r._navigator.userAgent.toLowerCase());r._navigator&&!n&&(r.usingWebAudio=!1)}r.usingWebAudio&&(r.masterGain=void 0===r.ctx.createGain?r.ctx.createGainNode():r.ctx.createGain(),r.masterGain.gain.setValueAtTime(r._muted?0:r._volume,r.ctx.currentTime),r.masterGain.connect(r.ctx.destination)),r._setup()}};void 0===(n=function(){return{Howler:r,Howl:s}}.apply(e,[]))||(t.exports=n),e.Howler=r,e.Howl=s,void 0!==a.g?(a.g.HowlerGlobal=i,a.g.Howler=r,a.g.Howl=s,a.g.Sound=o):"undefined"!=typeof window&&(window.HowlerGlobal=i,window.Howler=r,window.Howl=s,window.Sound=o)}(),function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var a=e._howls.length-1;a>=0;a--)e._howls[a].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,a){var n=this;return n.ctx&&n.ctx.listener?(e="number"!=typeof e?n._pos[1]:e,a="number"!=typeof a?n._pos[2]:a,"number"!=typeof t?n._pos:(n._pos=[t,e,a],void 0!==n.ctx.listener.positionX?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]),n)):n},HowlerGlobal.prototype.orientation=function(t,e,a,n,i,r){var s=this;if(!s.ctx||!s.ctx.listener)return s;var o=s._orientation;return e="number"!=typeof e?o[1]:e,a="number"!=typeof a?o[2]:a,n="number"!=typeof n?o[3]:n,i="number"!=typeof i?o[4]:i,r="number"!=typeof r?o[5]:r,"number"!=typeof t?o:(s._orientation=[t,e,a,n,i,r],void 0!==s.ctx.listener.forwardX?(s.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),s.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),s.ctx.listener.forwardZ.setTargetAtTime(a,Howler.ctx.currentTime,.1),s.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),s.ctx.listener.upY.setTargetAtTime(i,Howler.ctx.currentTime,.1),s.ctx.listener.upZ.setTargetAtTime(r,Howler.ctx.currentTime,.1)):s.ctx.listener.setOrientation(t,e,a,n,i,r),s)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var a=this;return a._orientation=e.orientation||[1,0,0],a._stereo=e.stereo||null,a._pos=e.pos||null,a._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},a._onstereo=e.onstereo?[{fn:e.onstereo}]:[],a._onpos=e.onpos?[{fn:e.onpos}]:[],a._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,a){var n=this;if(!n._webAudio)return n;if("loaded"!==n._state)return n._queue.push({event:"stereo",action:function(){n.stereo(t,a)}}),n;var i=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===a){if("number"!=typeof t)return n._stereo;n._stereo=t,n._pos=[t,0,0]}for(var r=n._getSoundIds(a),s=0;s/i,h=//i,p=/<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi,_=s.isIE(9),g=_||s.isIE();if("function"==typeof window.DOMParser){var f=new window.DOMParser,m=_?"text/xml":"text/html";n=function(t,e){return e&&(t="<"+e+">"+t+""),_&&(t=t.replace(p,"<$1$2$3/>")),f.parseFromString(t,m)}}if("object"==typeof document.implementation){var v=document.implementation.createHTMLDocument(g?"HTML_DOM_PARSER_TITLE":void 0);i=function(t,e){if(e)return v.documentElement.getElementsByTagName(e)[0].innerHTML=t,v;try{return v.documentElement.innerHTML=t,v}catch(e){if(n)return n(t)}}}var w=document.createElement("template");w.content&&(r=function(t){return w.innerHTML=t,w.content.childNodes});var y=i||n;t.exports=function(t){var e,a,i,s,p=t.match(d);switch(p&&p[1]&&(e=p[1].toLowerCase()),e){case o:if(n)return a=n(t),u.test(t)||(i=a.getElementsByTagName(c)[0])&&i.parentNode.removeChild(i),h.test(t)||(i=a.getElementsByTagName(l)[0])&&i.parentNode.removeChild(i),a.getElementsByTagName(o);break;case c:case l:if(y)return s=y(t).getElementsByTagName(e),h.test(t)&&u.test(t)?s[0].parentNode.childNodes:s;break;default:if(r)return r(t);if(y)return y(t,l).getElementsByTagName(l)[0].childNodes}return[]}},5057:function(t,e,a){var n=a(6982),i=a(3412),r=i.formatDOM,s=i.isIE(9),o=/<(![a-zA-Z\s]+)>/;t.exports=function(t){if("string"!=typeof t)throw new TypeError("First argument must be a string");if(!t)return[];var e,a=t.match(o);return a&&a[1]&&(e=a[1],s&&(t=t.replace(a[0],""))),r(n(t),null,e)}},3412:function(t,e,a){for(var n,i=a(9804).CASE_SENSITIVE_TAG_NAMES,r={},s=0,o=i.length;s=0;--r){var s=this.tryEntries[r],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(c&&l){if(this.prev=0;--a){var i=this.tryEntries[a];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var a=this.tryEntries[e];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),T(a),_}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var a=this.tryEntries[e];if(a.tryLoc===t){var n=a.completion;if("throw"===n.type){var i=n.arg;T(a)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,a,n){return this.delegate={iterator:k(t),resultName:a,nextLoc:n},"next"===this.method&&(this.arg=e),_}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},53:function(t,e){"use strict";var a,n,i,r,s;if("undefined"==typeof window||"function"!=typeof MessageChannel){var o=null,c=null,l=function(){if(null!==o)try{var t=e.unstable_now();o(!0,t),o=null}catch(t){throw setTimeout(l,0),t}},d=Date.now();e.unstable_now=function(){return Date.now()-d},a=function(t){null!==o?setTimeout(a,0,t):(o=t,setTimeout(l,0))},n=function(t,e){c=setTimeout(t,e)},i=function(){clearTimeout(c)},r=function(){return!1},s=e.unstable_forceFrameRate=function(){}}else{var u=window.performance,h=window.Date,p=window.setTimeout,_=window.clearTimeout;if("undefined"!=typeof console){var g=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof g&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof u&&"function"==typeof u.now)e.unstable_now=function(){return u.now()};else{var f=h.now();e.unstable_now=function(){return h.now()-f}}var m=!1,v=null,w=-1,y=5,b=0;r=function(){return e.unstable_now()>=b},s=function(){},e.unstable_forceFrameRate=function(t){0>t||125>>1,i=t[n];if(!(void 0!==i&&0C(s,a))void 0!==c&&0>C(c,s)?(t[n]=c,t[o]=a,n=o):(t[n]=s,t[r]=a,n=r);else{if(!(void 0!==c&&0>C(c,a)))break t;t[n]=c,t[o]=a,n=o}}}return e}return null}function C(t,e){var a=t.sortIndex-e.sortIndex;return 0!==a?a:t.id-e.id}var k=[],O=[],A=1,x=null,M=3,P=!1,L=!1,R=!1;function B(t){for(var e=S(O);null!==e;){if(null===e.callback)T(O);else{if(!(e.startTime<=t))break;T(O),e.sortIndex=e.expirationTime,D(k,e)}e=S(O)}}function N(t){if(R=!1,B(t),!L)if(null!==S(k))L=!0,a(F);else{var e=S(O);null!==e&&n(N,e.startTime-t)}}function F(t,a){L=!1,R&&(R=!1,i()),P=!0;var s=M;try{for(B(a),x=S(k);null!==x&&(!(x.expirationTime>a)||t&&!r());){var o=x.callback;if(null!==o){x.callback=null,M=x.priorityLevel;var c=o(x.expirationTime<=a);a=e.unstable_now(),"function"==typeof c?x.callback=c:x===S(k)&&T(k),B(a)}else T(k);x=S(k)}if(null!==x)var l=!0;else{var d=S(O);null!==d&&n(N,d.startTime-a),l=!1}return l}finally{x=null,M=s,P=!1}}function U(t){switch(t){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var H=s;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.callback=null},e.unstable_continueExecution=function(){L||P||(L=!0,a(F))},e.unstable_getCurrentPriorityLevel=function(){return M},e.unstable_getFirstCallbackNode=function(){return S(k)},e.unstable_next=function(t){switch(M){case 1:case 2:case 3:var e=3;break;default:e=M}var a=M;M=e;try{return t()}finally{M=a}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=H,e.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var a=M;M=t;try{return e()}finally{M=a}},e.unstable_scheduleCallback=function(t,r,s){var o=e.unstable_now();if("object"==typeof s&&null!==s){var c=s.delay;c="number"==typeof c&&0o?(t.sortIndex=c,D(O,t),null===S(k)&&t===S(O)&&(R?i():R=!0,n(N,c-o))):(t.sortIndex=s,D(k,t),L||P||(L=!0,a(F))),t},e.unstable_shouldYield=function(){var t=e.unstable_now();B(t);var a=S(k);return a!==x&&null!==x&&null!==a&&null!==a.callback&&a.startTime<=t&&a.expirationTime=this.touchStartX?(this.onSwipeRightAgent&&this.onSwipeRightAgent(),"swiped right"):this.touchEndY+this.options.threshold<=this.touchStartY?(this.onSwipeUpAgent&&this.onSwipeUpAgent(),"swiped up"):this.touchEndY-this.options.threshold>=this.touchStartY?(this.onSwipeDownAgent&&this.onSwipeDownAgent(),"swiped down"):this.touchEndY===this.touchStartY?(this.onTapAgent&&this.onTapAgent(),"tap"):void 0}}}},__webpack_module_cache__={},deferred,leafPrototypes,getProto,inProgress,dataWebpackPrefix;function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var a=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(a.exports,a,a.exports,__webpack_require__),a.exports}__webpack_require__.m=__webpack_modules__,deferred=[],__webpack_require__.O=function(t,e,a,n){if(!e){var i=1/0;for(c=0;c=n)&&Object.keys(__webpack_require__.O).every((function(t){return __webpack_require__.O[t](e[s])}))?e.splice(s--,1):(r=!1,n0&&deferred[c-1][2]>n;c--)deferred[c]=deferred[c-1];deferred[c]=[e,a,n]},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,{a:e}),e},getProto=Object.getPrototypeOf?function(t){return Object.getPrototypeOf(t)}:function(t){return t.__proto__},__webpack_require__.t=function(t,e){if(1&e&&(t=this(t)),8&e)return t;if("object"==typeof t&&t){if(4&e&&t.__esModule)return t;if(16&e&&"function"==typeof t.then)return t}var a=Object.create(null);__webpack_require__.r(a);var n={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var i=2&e&&t;"object"==typeof i&&!~leafPrototypes.indexOf(i);i=getProto(i))Object.getOwnPropertyNames(i).forEach((function(e){n[e]=function(){return t[e]}}));return n.default=function(){return t},__webpack_require__.d(a,n),a},__webpack_require__.d=function(t,e){for(var a in e)__webpack_require__.o(e,a)&&!__webpack_require__.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},__webpack_require__.f={},__webpack_require__.e=function(t){return Promise.all(Object.keys(__webpack_require__.f).reduce((function(e,a){return __webpack_require__.f[a](t,e),e}),[]))},__webpack_require__.u=function(t){return t+"."+{218:"5fd9b6569a5e09b99c04",261:"7a317c455be0706d739d",307:"743838d3441f79e939a9",476:"430b407336b2c532e572",502:"7d9075974af1f1c56a6a",536:"daa69d70da79b79bc1ec",610:"c7e436abad4aaa076cad",800:"8c3bfdb4ac7cf39ec020",815:"8e6ab21729cb74142161",906:"2159cf8d9f1f8d4b1854"}[t]+".js"},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},inProgress={},dataWebpackPrefix="LHCReactAPP:",__webpack_require__.l=function(t,e,a,n){if(inProgress[t])inProgress[t].push(e);else{var i,r;if(void 0!==a)for(var s=document.getElementsByTagName("script"),o=0;o0||a.chatwidget.getIn(["chatLiveData","status"])===_constants_chat_status__WEBPACK_IMPORTED_MODULE_2__.pA)),r=a.chatwidget.getIn(["chatLiveData","status"])==_constants_chat_status__WEBPACK_IMPORTED_MODULE_2__.sk&&a.chatwidget.getIn(["chatLiveData","uid"])>0;(1==i||r)&&a.chatwidget.hasIn(["chat_ui","survey_id"])&&(a.chatwidget.hasIn(["chat_ui","survey_button"])&&1!==a.chatwidget.getIn(["chat_ui_state","show_survey"])&&1!=i||(n=!0)),a.chatwidget.hasIn(["chat_ui","close_on_unload"])&&"embed"==a.chatwidget.get("mode")&&(!1!==a.chatwidget.get("isMobile")&&!0!==n||_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.sendMessageParent("endChat",[{sender:"endButton"}])),"popup"==a.chatwidget.get("mode")&&1==n&&_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.sendMessageParent("endChat",[{sender:"endButton"}]),a.chatwidget.hasIn(["chatData","id"])&&a.chatwidget.hasIn(["chatData","hash"])?axios__WEBPACK_IMPORTED_MODULE_0___default().post(window.lhcChat.base_url+"chat/userclosechat/"+a.chatwidget.getIn(["chatData","id"])+"/"+a.chatwidget.getIn(["chatData","hash"]),null,defaultHeaders):!0===a.chatwidget.getIn(["proactive","has"])&&"popup"==window.lhcChat.mode&&window.opener&&hideInvitation()(t,e)}}function checkErrorCounter(){2==syncStatus.error_counter&&_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.sendMessageParent("reloadWidget",[])}function addMessage(t,e){return function(a,n){if(e||a({type:"ADD_MSG_TO_STORE",data:t.msg}),1!=syncStatus.add_msg){syncStatus.add_msg=!0;try{_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("messageSend",[{chat_id:t.id,hash:t.hash,msg:t.msg}])}catch(t){_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.logJSError({stack:JSON.stringify(JSON.stringify(t))})}axios__WEBPACK_IMPORTED_MODULE_0___default().post(window.lhcChat.base_url+"widgetrestapi/addmsguser",t,defaultHeaders).then((function(e){try{(e.data.error||n().chatwidget.getIn(["chatLiveData","error"]))&&a({type:"ADD_MESSAGES_SUBMITTED",data:{r:e.data.r,msg:t.msg}}),syncStatus.add_msg=!1,fetchMessages({active_widget:!0,theme:t.theme,chat_id:t.id,lmgsid:n().chatwidget.getIn(["chatLiveData","lmsgid"]),hash:t.hash})(a,n),e.data.t&&_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.sendMessageParent("botTrigger",[{trigger:e.data.t}]),void 0===e.data.r||!0===e.data.error&&!0===e.data.system?(syncStatus.error_counter++,2==syncStatus.error_counter&&(_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.logJSError({stack:JSON.stringify(JSON.stringify(e)+"\nRD:"+JSON.stringify(e.data)+"\nRH:"+JSON.stringify(e.headers)+"\nRS:"+JSON.stringify(e.status))}),checkErrorCounter()),_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("messageSendError",[{chat_id:t.id,hash:t.hash,msg:JSON.stringify(e.data)}])):syncStatus.error_counter=0}catch(t){throw t}finally{syncStatus.add_msg=!1,syncStatus.add_msg_pending.length>0&&addMessage(syncStatus.add_msg_pending.shift(),!0)(a,n)}})).catch((function(e){if(isNetworkError(e))a({type:"ADD_MESSAGES_SUBMITTED",data:{r:"SEND_CONNECTION",msg:t.msg}}),a({type:"NO_CONNECTION",data:!0});else{syncStatus.error_counter++;var i;i=e.response?JSON.stringify(JSON.stringify(e)+"\nRD:"+JSON.stringify(e.response.data)+"\nRH:"+JSON.stringify(e.response.headers)+"\nRS:"+JSON.stringify(e.response.status)):(e.request,JSON.stringify(JSON.stringify(e))),2==syncStatus.error_counter?(_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.logJSError({stack:i}),_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("messageSendError",[{chat_id:t.id,hash:t.hash,msg:i}]),checkErrorCounter()):(a({type:"ADD_MESSAGES_SUBMITTED",data:{r:"SEND_FAILED",msg:t.msg}}),syncStatus.add_msg=!1,addMessage(t,!0)(a,n))}syncStatus.add_msg=!1}))}else syncStatus.add_msg_pending.push(t)}}function userTyping(t,e){return function(a,n){var i=n();"true"===t?_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("visitorTyping",[{chat_id:i.chatwidget.getIn(["chatData","id"]),hash:i.chatwidget.getIn(["chatData","hash"]),status:!0,msg:e}]):_lib_helperFunctions__WEBPACK_IMPORTED_MODULE_1__.a.eventEmitter.emitEvent("visitorTyping",[{chat_id:i.chatwidget.getIn(["chatData","id"]),hash:i.chatwidget.getIn(["chatData","hash"]),status:!1}]),i.chatwidget.get("overrides").contains("typing")||axios__WEBPACK_IMPORTED_MODULE_0___default().post(window.lhcChat.base_url+"chat/usertyping/"+i.chatwidget.getIn(["chatData","id"])+"/"+i.chatwidget.getIn(["chatData","hash"])+"/"+t,{msg:e},defaultHeaders).then((function(t){})).catch((function(t){console.log(t)}))}}function submitInlineSurvey(t){return axios__WEBPACK_IMPORTED_MODULE_0___default().post(window.lhcChat.base_url+"survey/fillinline",t,defaultHeaders)}},6313:function(t,e,a){"use strict";var n=a(4575),i=a.n(n),r=a(3913),s=a.n(r),o=a(2205),c=a.n(o),l=a(8585),d=a.n(l),u=a(9754),h=a.n(u),p=a(7294);var _=function(t){c()(r,t);var e,a,n=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h()(e);if(a){var i=h()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d()(this,t)});function r(t){return i()(this,r),n.call(this,t)}return s()(r,[{key:"render",value:function(){return p.createElement(p.Fragment,null,p.createElement("div",{className:"fade modal-backdrop show"}),p.createElement("div",{role:"dialog",id:"dialog-content","aria-modal":"true",className:"fade modal show d-block p-2",tabIndex:"-1"},p.createElement("div",{className:"modal-content p-2 "+(this.props.full_height?"h-100":"")},this.props.as_html&&p.createElement("div",{className:this.props.full_height?"h-100":"",dangerouslySetInnerHTML:{__html:this.props.text}}),!this.props.as_html&&p.createElement("p",null,this.props.text),p.createElement("div",{className:"modal-footer"},p.createElement("button",{className:"btn btn-secondary btn-sm",onClick:this.props.close,type:"button"},this.props.closeText)))))}}]),r}(p.PureComponent);e.Z=_},5918:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(7154),_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4575),_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__),_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(3913),_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__),_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(1506),_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__),_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2205),_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__),_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(8585),_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__),_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(9754),_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__),_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(9713),_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7__),react__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(7294),html_react_parser__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(488),html_react_parser__WEBPACK_IMPORTED_MODULE_9___default=__webpack_require__.n(html_react_parser__WEBPACK_IMPORTED_MODULE_9__),react_redux__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(6458);function _createSuper(t){var e=_isNativeReflectConstruct();return function(){var a,n=_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(t);if(e){var i=_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this,a)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var ChatBotIntroMessage=function(_PureComponent){_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(ChatBotIntroMessage,_PureComponent);var _super=_createSuper(ChatBotIntroMessage);function ChatBotIntroMessage(t){var e;return _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this,ChatBotIntroMessage),e=_super.call(this,t),_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(e),"state",{value:""}),e.abstractClick=e.abstractClick.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(e)),e.updateTriggerClicked=e.updateTriggerClicked.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(e)),e.processBotAction=e.processBotAction.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(e)),e.disableEditor=!1,e}return _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(ChatBotIntroMessage,[{key:"getDirectInnerText",value:function(t){for(var e=t.childNodes,a="",n=0;n'+e.innerHTML)}},{key:"removeMetaMessage",value:function(t){var e=document.getElementById("messages-scroll");if(e){var a,n=e.getElementsByClassName("meta-message-"+t);for(a=0;a1&&this.onchangeAttr({value:-1}):this.onchangeAttr({value:this.props.setDefaultValue||this.props.departments.getIn(["departments",0]).get("value")}))}},{key:"render",value:function(){var t=this,e=this.props.t,a=null;if(this.props.departments.get("departments").size>1&&!this.props.departments.hasIn(["settings","hide_department"])){var n=["form-control","form-control-sm"];!0===this.props.isInvalid&&n.push("is-invalid");var i=this.props.departments.get("departments").map((function(t){return g.createElement("option",{key:"dep-"+t.get("value"),value:t.get("value")},t.get("name")," ",t.get("online")?"":e("department.offline"))}));a=g.createElement("div",{className:"form-group"},g.createElement("label",{className:"control-label"},this.props.departments.getIn(["settings","label"]),"*"),g.createElement("select",{id:"id-department-field",defaultValue:this.props.setDefaultValue||this.props.defaultValueField,className:n.join(" "),onChange:function(e){return t.onchangeAttr({value:e.target.value})}},this.props.departments.hasIn(["settings","optional"])&&g.createElement("option",{value:"-1"},this.props.departments.getIn(["settings","optional"])),i))}var r=null;if(!0===this.props.departments.getIn(["settings","product"])){var s=["form-control","form-control-sm"];!0===this.props.isInvalidProduct&&s.push("is-invalid");var o=this.props.departments.has("products")?this.props.departments.get("products").map((function(t){return g.createElement("option",{key:"product-"+t.get("value"),value:t.get("value")},t.get("name"))})):"";this.props.departments.has("products")&&this.props.departments.get("products").size>0&&(r=g.createElement("div",{className:"form-group"},g.createElement("label",{className:"control-label"},e("department.product"),!0===this.props.departments.getIn(["settings","product_required"])?"*":""),g.createElement("select",{className:s.join(" "),onChange:function(e){return t.onchangeAttrProduct({value:e.target.value})}},g.createElement("option",{value:""},e("department.choose_a_product")),o)))}return null!==r||null!==a?g.createElement("div",{className:"col-12"},a,r):null}}]),r}(g.Component);e.Z=(0,v.$j)()((0,f.Z)()(w))},7786:function(t,e,a){"use strict";var n=a(4575),i=a.n(n),r=a(3913),s=a.n(r),o=a(1506),c=a.n(o),l=a(2205),d=a.n(l),u=a(8585),h=a.n(u),p=a(9754),_=a.n(p),g=a(9713),f=a.n(g),m=a(7294),v=a(7139);var w=function(t){d()(r,t);var e,a,n=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return i()(this,r),e=n.call(this,t),f()(c()(e),"state",{hiddenIfPrefilled:!1}),e.onchangeAttr=e.onchangeAttr.bind(c()(e)),e.onFileAdded=e.onFileAdded.bind(c()(e)),e}return s()(r,[{key:"onchangeAttr",value:function(t){if(this.props.onChangeContent({id:this.props.field.get("name"),value:t.value,field:this.props.field}),"dropdown"==this.props.field.get("type")){var e=parseInt(t.target.options[t.target.selectedIndex].getAttribute("dep-id"));e>0&&this.props.onChangeContent({id:"DepartamentID",value:e,subject_id:t.target.options[t.target.selectedIndex].getAttribute("subject-id")})}}},{key:"onFileAdded",value:function(t){for(var e=this,a=t.target.files,n=[],i=0;ie.props.field.get("fs")&&o.push(t.name+": "+s("file.to_big_file"))})),o.length>0?alert(o.join("\n")):this.props.onChangeContent({id:this.props.field.get("name"),value:n[0],field:this.props.field})}},{key:"componentDidMount",value:function(){var t=this;"checkbox"==this.props.field.get("type")&&1==this.props.field.get("default")?this.props.onChangeContent({id:this.props.field.get("name"),value:!0}):"dropdown"==this.props.field.get("type")&&(this.props.onChangeContent({id:this.props.field.get("name"),value:this.props.defaultValueField}),this.props.field.get("options").map((function(e){e.get("value")==t.props.defaultValueField&&e.get("dep_id")&&t.props.onChangeContent({set_default:!0,id:"DepartamentID",subject_id:e.has("subject_id")?e.get("subject_id"):null,value:e.get("dep_id")})}))),this.props.attrPrefill&&this.props.attrPrefill.attr_prefill_admin&&this.props.attrPrefill.attr_prefill_admin.forEach((function(e){(e.index==t.props.field.get("identifier")||t.props.field.has("identifier_prefill")&&e.index==t.props.field.get("identifier_prefill"))&&(t.props.onChangeContent({id:t.props.field.get("name"),value:e.value}),t.props.field.has("hide_prefilled")&&1==t.props.field.get("hide_prefilled")&&!1===t.props.isInvalid&&t.setState({hiddenIfPrefilled:!0}))}))}},{key:"render",value:function(){var t=this;if(!0===this.state.hiddenIfPrefilled&&!0!==this.props.isInvalid)return null;var e="col-"+this.props.field.get("width"),a=!0===this.props.field.get("required"),n=[];if(""!=this.props.field.get("class")&&n.push(this.props.field.get("class")),!0===this.props.isInvalid&&n.push("is-invalid"),"text"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("input",{type:"text",className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField,placeholder:this.props.field.get("placeholder")})));if("password"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("input",{type:"password",autocomplete:"new-password",className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField,placeholder:this.props.field.get("placeholder")})));if("textarea"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},!this.props.chatUI.has("hide_message_label")&&"question"==this.props.field.get("identifier")&&m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("textarea",{className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField,placeholder:this.props.field.get("placeholder")})));if("file"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group overflow-hidden"},m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("input",{type:"file",onChange:function(e){return t.onFileAdded(e)},className:this.props.field.get("class"),required:a,name:this.props.field.get("name")})));if("checkbox"==this.props.field.get("type"))return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},m.createElement("div",{className:"form-check"},m.createElement("input",{className:n.join(" "),id:"check-for-"+this.props.field.get("name"),defaultChecked:this.props.field.get("default"),type:"checkbox",value:"on",onChange:function(e){return t.onchangeAttr({value:e.target.checked})},required:a,name:this.props.field.get("name")}),m.createElement("label",{className:"form-check-label",for:"check-for-"+this.props.field.get("name"),dangerouslySetInnerHTML:{__html:this.props.field.get("label")}}))));if("hidden"==this.props.field.get("type"))return m.createElement("input",{type:"hidden",className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField,placeholder:this.props.field.get("placeholder")});if("dropdown"==this.props.field.get("type")){var i=this.props.field.get("options").map((function(e){return m.createElement("option",{key:"opt-drop-"+e.get("value"),"subject-id":e.has("subject_id")?e.get("subject_id"):null,"dep-id":e.get("dep_id"),selected:t.props.defaultValueField==e.get("value"),value:e.get("value")},e.get("name"))}));return m.createElement("div",{className:e},m.createElement("div",{className:"form-group"},m.createElement("label",{className:"control-label"},this.props.field.get("label"),!0===a?"*":""),m.createElement("select",{className:n.join(" "),required:a,onChange:function(e){return t.onchangeAttr({target:e.target,value:e.target.value})},name:this.props.field.get("name"),defaultValue:this.props.defaultValueField},i)))}return console.log("Unknown field"),null}}]),r}(m.Component);e.Z=(0,v.Z)()(w)},2446:function(t,e,a){"use strict";var n=a(7154),i=a.n(n),r=a(4575),s=a.n(r),o=a(3913),c=a.n(o),l=a(1506),d=a.n(l),u=a(2205),h=a.n(u),p=a(8585),_=a.n(p),g=a(9754),f=a.n(g),m=a(9713),v=a.n(m),w=a(7294),y=a(9669),b=a.n(y),E=a(488),I=a.n(E),D=a(7139),S=a(298),T=a.n(S);var C=function(t){h()(o,t);var e,n,r=(e=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,a=f()(e);if(n){var i=f()(this).constructor;t=Reflect.construct(a,arguments,i)}else t=a.apply(this,arguments);return _()(this,t)});function o(t){var e;return s()(this,o),e=r.call(this,t),v()(d()(e),"state",{body:null}),v()(d()(e),"dismissModal",(function(t){e.props.toggle(),t&&t.stopPropagation()})),v()(d()(e),"generalOnClick",(function(t){var a=e.props.t,n=t["data-bb-code"];if(t["data-promt"]&&"img"==t["data-promt"])(i=prompt(a("bbcode.img_link")))&&(n="["+n+"]"+i+"[/"+n+"]");else if(t["data-promt"]&&"url"==t["data-promt"]){var i;(i=prompt(a("bbcode.link")))&&(n="[url="+i+"]"+a("bbcode.link_here")+"[/url]")}e.props.insertText(n),e.props.toggle()})),v()(d()(e),"generalDataActionClick",(function(t,a){t["data-action"]&&e.props[t["data-action"]]&&e.props[t["data-action"]](t["data-action-arg"]||null),a&&a.stopPropagation()})),e}return c()(o,[{key:"componentDidMount",value:function(){var t=this;b().get(window.lhcChat.base_url+this.props.dataUrl).then((function(e){t.setState({body:e.data});var n=document.getElementById("dialog-content"),i=a(2767),r=n.querySelectorAll('[data-bs-toggle="tab"]');if(r.length>0){var s=0;Array.prototype.forEach.call(r,(function(t){t.tabItem=new i(t)}));var o=new(T())(".tab-content");o.onSwipeLeft((function(){s=s0?s-1:r.length-1,r[s].tabItem.show()}))}})).catch((function(t){console.log(t)}))}},{key:"render",value:function(){var t=this;return w.createElement(w.Fragment,null,null!==this.state.body&&w.createElement("div",{className:"fade modal-backdrop show"}),null!==this.state.body&&w.createElement("div",{role:"dialog",id:"dialog-content","aria-modal":"true",className:"fade modal show d-block",tabIndex:"-1"},I()(this.state.body,{replace:function(e){if(e.attribs&&"react-close-modal"===e.attribs.id)return w.createElement("button",{type:"button",className:"btn-close float-end","data-bs-dismiss":"modal",onClick:t.dismissModal,"aria-label":"Close"});if(e.attribs&&e.attribs.linkaction)return e.attribs.class&&(e.attribs.className=e.attribs.class,delete e.attribs.class),w.createElement("a",i()({},e.attribs,{onClick:function(a){return t.generalDataActionClick(e.attribs,a)}}),(0,E.domToReact)(e.children));if(e.attribs&&e.attribs.bbitem)return e.attribs.class&&(e.attribs.className=e.attribs.class,delete e.attribs.class),w.createElement("a",i()({},e.attribs,{onClick:function(a){return t.generalOnClick(e.attribs)}}),(0,E.domToReact)(e.children));if(e.type&&"tag"===e.type&&e.name&&"input"==e.name&&e.attribs&&e.attribs.type&&"button"==e.attribs.type)return e.attribs.class&&(e.attribs.className=e.attribs.class,delete e.attribs.class),w.createElement("input",i()({},e.attribs,{onClick:function(a){return t.generalDataActionClick(e.attribs,a)}}));if(e.type&&"script"===e.type){if(e.children.length>0)setTimeout((function(){var t=document.createElement("script");t.appendChild(document.createTextNode(e.children[0].data)),document.getElementsByTagName("head").item(0).appendChild(t)}),500);else if(e.attribs&&e.attribs.src){var a=document.createElement("script");a.src=e.attribs.src,a.type="text/javascript",document.getElementsByTagName("head").item(0).appendChild(a)}return w.createElement(w.Fragment,null)}}})))}}]),o}(w.PureComponent);e.Z=(0,D.Z)()(C)},9702:function(t,e,a){"use strict";a.d(e,{Z:function(){return N}});var n=a(4575),i=a.n(n),r=a(3913),s=a.n(r),o=a(1506),c=a.n(o),l=a(2205),d=a.n(l),u=a(8585),h=a.n(u),p=a(9754),_=a.n(p),g=a(9713),f=a.n(g),m=a(7294),v=a(6458),w=a(7139),y=a(7786),b=a(3038),E=a.n(b);var I=function(t){d()(r,t);var e,a,n=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){return i()(this,r),n.call(this,t)}return s()(r,[{key:"render",value:function(){var t=this.props.errors.mapEntries((function(t){var e=E()(t,2),a=e[0],n=e[1];if("captcha"==a||"blocked_user"==a||!isNaN(a))return[m.createElement("li",null,n)]}));return t.size>0?m.createElement("div",{"data-alert":"",className:"mt-2 alert alert-danger alert-dismissible fade show"},m.createElement("ul",{className:"ps-1 m-0"},t)):null}}]),r}(m.Component),D=a(5198),S=a(2446);var T=function(t){d()(o,t);var e,n,r=(e=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,a=_()(e);if(n){var i=_()(this).constructor;t=Reflect.construct(a,arguments,i)}else t=a.apply(this,arguments);return h()(this,t)});function o(t){return i()(this,o),r.call(this,t)}return s()(o,[{key:"componentDidMount",value:function(){new(a(208))(document.getElementById("chat-dropdown-options"))}},{key:"render",value:function(){var t=this,e=this.props.t;return m.createElement("div",{className:"btn-group dropup disable-select ps-1 pt-2"},m.createElement("i",{className:"material-icons settings text-muted",id:"chat-dropdown-options","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},""),m.createElement("div",{className:"dropdown-menu shadow bg-white lhc-dropdown-menu rounded ms-1"},m.createElement("div",{className:"d-flex flex-row px-1"},this.props.bbEnabled&&m.createElement("a",{onClick:function(e){return t.props.toggleModal()},title:e("button.bb_code")},m.createElement("i",{className:"material-icons chat-setting-item text-muted me-0 bbcode-ico"},"")),this.props.langEnabled&&m.createElement("a",{onClick:this.props.changeLanguage,title:e("button.lang")},m.createElement("i",{className:"material-icons chat-setting-item text-muted me-0 lang-ico"},"")))))}}]),o}(m.PureComponent),C=(0,w.Z)()(T),k=a(2137),O=a(5918);var A,x=function(t){d()(r,t);var e,a,n=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){return i()(this,r),n.call(this,t)}return s()(r,[{key:"componentDidMount",value:function(){k.a.sendMessageParent("readInvitation",[{name:this.props.invitation.invitation_name||"Manual"}])}},{key:"render",value:function(){return"message"==this.props.mode?m.createElement(m.Fragment,null,this.props.invitation.prev_msg&&m.createElement(O.Z,{printButton:!1,setBotPayload:this.props.setBotPayload,content:this.props.invitation.prev_msg}),this.props.invitation.message&&m.createElement("div",{className:"message-row message-admin"},m.createElement("span",{className:"usr-tit op-tit"},m.createElement("i",{title:this.props.invitation.name_support||this.props.invitation.extra_profile,className:"chat-operators mi-fs15 me-0"},this.props.invitation.bubble&&this.props.invitation.photo&&m.createElement("img",{src:this.props.invitation.photo,alt:"",className:"profile-msg-pic"}),(!this.props.invitation.photo||!this.props.invitation.bubble)&&m.createElement("i",{className:"material-icons "+(this.props.invitation.bubble?"icon-assistant me-0":"")},"")),!this.props.invitation.bubble&&(this.props.invitation.name_support||this.props.invitation.extra_profile)),m.createElement("div",{className:"msg-body",dangerouslySetInnerHTML:{__html:this.props.invitation.message}})),this.props.invitation.message_full&&m.createElement(O.Z,{printButton:!1,setBotPayload:this.props.setBotPayload,content:this.props.invitation.message_full})):m.createElement(m.Fragment,null,m.createElement("div",{id:"lhc-profile-body"},m.createElement("div",{id:"chat-status-container",className:"operator-info d-flex border-bottom p-2"},m.createElement("div",null,this.props.invitation.photo&&m.createElement("img",{width:"48",height:"48",src:this.props.invitation.photo,title:this.props.invitation.photo_title,alt:""}),!this.props.invitation.photo&&m.createElement("i",{className:"icon-assistant material-icons me-0"},"")),m.createElement("div",{className:"p-1 ps-2 w-100"},this.props.invitation.name_support&&!this.props.invitation.hide_name&&m.createElement("div",{className:"fw-bold"},this.props.invitation.name_support),this.props.invitation.extra_profile&&m.createElement("div",{dangerouslySetInnerHTML:{__html:this.props.invitation.extra_profile}})))),"profile_only"!=this.props.mode&&this.props.invitation.message&&m.createElement("div",{id:"messagesBlock"},m.createElement("div",{className:"bottom-message position-relative"},m.createElement("div",{className:"message-row message-admin pt-1 text-left ms-3"},m.createElement("div",{className:"msg-body",dangerouslySetInnerHTML:{__html:this.props.invitation.message}})))))}}]),r}(m.PureComponent),M=a(6313),P=a(6512);function L(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function R(t){for(var e=1;e0&&this.props.chatwidget.getIn(["onlineData","department","departments"]).map((function(a){a.get("value")==t.value&&(0==a.get("online")&&(e.props.dispatch({type:"dep_default",data:t.value}),e.props.dispatch({type:"onlineStatus",data:!1})),e.props.chatwidget.getIn(["onlineData","dep_forms"])!=t.value&&e.updateOnlineFieldsInit(t.value))}))),"Question"==t.id&&(!0===this.props.chatwidget.getIn(["proactive","has"])&&""!=t.value&&1===this.props.chatwidget.getIn(["chat_ui","proactive_once_typed"])&&1===this.props.chatwidget.getIn(["chat_ui","custom_html_priority"])?(this.props.dispatch({type:"attr_set",attr:["chat_ui","custom_html_priority"],data:0}),this.customHTMLPriority=!0):""==t.value&&1==this.customHTMLPriority&&this.props.dispatch({type:"attr_set",attr:["chat_ui","custom_html_priority"],data:1}))}}},{key:"handleContentChangeCustom",value:function(t){this.props.dispatch({type:"CUSTOM_FIELDS_ITEM",data:{id:t.field.get("index"),value:t.value}})}},{key:"componentDidMount",value:function(){k.a.prefillFields(this),this.updateOnlineFields(),null!==this.props.botPayload&&this.setBotPayload(this.props.botPayload);var t=document.getElementById("CSChatMessage-tmp");null!==t&&document.body.removeChild(t)}},{key:"componentWillUnmount",value:function(){var t=document.getElementById("CSChatMessage");null===t?this.props.setHideMessageField(!0):(this.props.setHideMessageField(!1),t.id="CSChatMessage-tmp",t.style.cssText="position:absolute;left:-999px;bottom:0px;",document.body.appendChild(t))}},{key:"setBotPayload",value:function(t){this.botPayload=t,this.handleSubmit()}},{key:"updateOnlineFieldsInit",value:function(t){this.props.dispatch((0,P.El)({department:this.props.chatwidget.get("department"),product:this.props.chatwidget.get("product"),theme:this.props.chatwidget.get("theme"),mode:this.props.chatwidget.get("mode"),pvhash:this.props.chatwidget.get("pvhash"),phash:this.props.chatwidget.get("phash"),bot_id:this.props.chatwidget.get("bot_id"),trigger_id:this.props.chatwidget.get("trigger_id"),vid:this.props.chatwidget.get("vid"),dep_default:t||this.props.chatwidget.get("departmentDefault")||0,online:1,chat_ui:this.props.chatwidget.get("chat_ui")}))}},{key:"updateOnlineFields",value:function(){!1===this.props.chatwidget.getIn(["onlineData","fetched"])&&this.updateOnlineFieldsInit()}},{key:"componentDidUpdate",value:function(t,e,a){if(this.updateOnlineFields(),document.getElementById("id-container-fluid")&&k.a.sendMessageParent("widgetHeight",[{height:document.getElementById("id-container-fluid").offsetHeight+40}]),1===this.props.chatwidget.get("processStatus")&&1!==t.chatwidget.get("processStatus")){var n=document.getElementById("messagesBlock");null!==n&&this.props.setMessages(n.innerHTML);var i=document.getElementById("lhc-profile-body");null!==i&&this.props.setProfile(i.innerHTML)}var r=!1;if(!1===this.apiLoaded&&null!==this.props.chatwidget.get("api_data")&&(this.apiLoaded=!0,this.setState(R(R({},this.state),this.props.chatwidget.get("api_data"))),r=!0),(!0===r||0==this.props.chatwidget.get("isMobile")&&!1===t.chatwidget.get("shown")&&!0===this.props.chatwidget.get("shown"))&&"widget"==this.props.chatwidget.get("mode")&&this.textMessageRef.current&&(this.textMessageRef.current.focus(),this.scrollBottom()),!0===this.props.chatwidget.getIn(["onlineData","fetched"])&&!1===t.chatwidget.getIn(["onlineData","fetched"])&&(this.props.chatwidget.hasIn(["chat_ui","uprev"])&&k.a.emitEvent("play_sound",[{type:"new_message",sound_on:!0===this.props.chatwidget.getIn(["usersettings","soundOn"]),widget_open:this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")||document.hasFocus()}]),this.scrollBottom()),this.props.chatwidget.get("departmentDefault")!==t.chatwidget.get("departmentDefault")){this.setState({DepartamentID:this.props.chatwidget.get("departmentDefault")});var s=document.getElementById("id-department-field");null!==s&&(s.value=this.props.chatwidget.get("departmentDefault")),this.updateOnlineFieldsInit()}}},{key:"scrollBottom",value:function(){var t=this;this.messagesAreaRef.current&&(this.messagesAreaRef.current.scrollTop=this.messagesAreaRef.current.scrollHeight+1e3,setTimeout((function(){t.messagesAreaRef.current&&(t.messagesAreaRef.current.scrollTop=t.messagesAreaRef.current.scrollHeight+1e3)}),450))}},{key:"moveCaretAtEnd",value:function(t){var e=t.target.value;t.target.value="",t.target.value=e}},{key:"render",value:function(){var t=this,e=this.props.t;if(!0===this.props.chatwidget.getIn(["onlineData","fetched"])&&!0===this.props.chatwidget.getIn(["onlineData","disabled"]))return m.createElement("div",{className:"alert alert-danger m-2",role:"alert"},e("start_chat.cant_start_a_chat"));if(!1===this.props.chatwidget.getIn(["onlineData","fetched"])||!0===this.props.chatwidget.getIn(["chat_ui","auto_start"]))return null;if(this.props.chatwidget.getIn(["onlineData","fields"]).size>0&&(!this.props.chatwidget.hasIn(["chat_ui","show_messages_box"])||1!=this.props.chatwidget.getIn(["onlineData","fields_visible"])||0!=this.props.chatwidget.getIn(["customData","fields"]).size))var a=this.props.chatwidget.getIn(["onlineData","fields"]).map((function(e){return m.createElement(y.Z,{chatUI:t.props.chatwidget.get("chat_ui"),key:e.get("identifier"),isInvalid:t.props.chatwidget.hasIn(["validationErrors",e.get("identifier")]),defaultValueField:t.state[e.get("name")]||e.get("value"),attrPrefill:{attr_prefill_admin:t.props.chatwidget.get("attr_prefill_admin"),attr_prefill:t.props.chatwidget.get("attr_prefill")},onChangeContent:t.handleContentChange,field:e})}));else a="";var n=!1,i="";if(this.props.chatwidget.getIn(["customData","fields"]).size>0&&(this.props.chatwidget.getIn(["customData","fields"]).map((function(t){return n=!t.has("type")||"hidden"!==t.get("type")||n})),1==n&&(i=this.props.chatwidget.getIn(["customData","fields"]).map((function(e){return m.createElement(y.Z,{chatUI:t.props.chatwidget.get("chat_ui"),key:e.get("identifier"),isInvalid:t.props.chatwidget.hasIn(["validationErrors",e.get("identifier")]),defaultValueField:e.get("value"),onChangeContent:t.handleContentChangeCustom,field:e})})))),this.props.chatwidget.hasIn(["onlineData","paid","error"])&&this.props.chatwidget.getIn(["onlineData","paid","error"]))return m.createElement("p",{className:"p-2"},this.props.chatwidget.getIn(["onlineData","paid","message"]));if(0==this.props.chatwidget.get("processStatus")||1==this.props.chatwidget.get("processStatus")){if(this.props.chatwidget.hasIn(["chat_ui","show_messages_box"])&&this.props.chatwidget.getIn(["onlineData","department","departments"]).size<=1&&this.props.chatwidget.getIn(["onlineData","fields_visible"])<=1&&(0==this.props.chatwidget.getIn(["customData","fields"]).size||!1===n)){var r="ps-0 no-outline form-control rounded-0 form-control rounded-start-0 rounded-end-0 border-0 "+(!0===this.props.chatwidget.get("shown")&&this.textMessageRef.current&&(/\r|\n/.exec(this.state.Question)||this.state.Question.length>this.textMessageRef.current.offsetWidth/8.6)?"msg-two-line":"msg-one-line"),s="flex-grow-1 overflow-scroll position-relative",o="bottom-message px-1";return this.props.chatwidget.hasIn(["chat_ui","msg_expand"])&&"embed"==this.props.chatwidget.get("mode")&&(s="overflow-scroll position-relative",o+=" position-relative"),this.props.chatwidget.getIn(["chat_ui","disabled"])?m.createElement(M.Z,{closeText:e("button.close"),full_height:!0,close:function(e){return t.props.dispatch((0,P.H7)(!0))},as_html:!0,text:this.props.chatwidget.getIn(["chat_ui","disabled"])}):m.createElement(m.Fragment,null,this.state.showBBCode&&m.createElement(S.Z,{showModal:this.state.showBBCode,insertText:this.insertText,toggle:this.toggleModal,dataUrl:"/chat/bbcodeinsert?react=1"}),this.state.changeLanguage&&m.createElement(S.Z,{showModal:this.state.changeLanguage,setLanguage:this.setLanguageAction,toggle:this.changeLanguage,dataUrl:"/widgetrestapi/chooselanguage"}),this.props.chatwidget.hasIn(["validationErrors","blocked_user"])&&m.createElement(M.Z,{closeText:e("button.close"),as_html:!0,close:function(e){return t.props.dispatch((0,P.H7)(!0))},text:this.props.chatwidget.getIn(["validationErrors","blocked_user"])}),!0===this.props.chatwidget.getIn(["proactive","has"])&&!this.props.chatwidget.hasIn(["proactive","data","std_header"])&&m.createElement(x,{mode:"profile_only",invitation:this.props.chatwidget.getIn(["proactive","data"])})||(this.props.chatwidget.hasIn(["chat_ui","pre_chat_html"])||this.props.chatwidget.hasIn(["chat_ui","operator_profile"])&&""!=this.props.chatwidget.getIn(["chat_ui","operator_profile"]))&&m.createElement("div",{id:"lhc-profile-body"},m.createElement("div",{id:"chat-status-container",className:"p-2 border-bottom",dangerouslySetInnerHTML:{__html:(this.props.chatwidget.hasIn(["chat_ui","pre_chat_html"])?this.props.chatwidget.getIn(["chat_ui","pre_chat_html"]):"")+(this.props.chatwidget.hasIn(["chat_ui","operator_profile"])?this.props.chatwidget.getIn(["chat_ui","operator_profile"]):"")}})),m.createElement("div",{className:s,id:"messagesBlock"},m.createElement("div",{className:o,id:"messages-scroll",ref:this.messagesAreaRef},!0===this.props.chatwidget.getIn(["proactive","has"])&&!this.props.chatwidget.getIn(["chat_ui","custom_html_priority"])&&m.createElement(x,{mode:"message",setBotPayload:this.setBotPayload,invitation:this.props.chatwidget.getIn(["proactive","data"])}),!this.props.chatwidget.getIn(["proactive","has"])&&this.props.chatwidget.hasIn(["chat_ui","cmmsg_widget"])&&m.createElement(O.Z,{printButton:this.props.chatwidget.getIn(["chat_ui","print_btn_msg"]),processStatus:this.props.chatwidget.get("processStatus"),setBotPayload:this.setBotPayload,content:this.props.chatwidget.getIn(["chat_ui","cmmsg_widget"])}),1==this.props.chatwidget.get("processStatus")&&""!=this.state.Question&&m.createElement("div",{"data-op-id":"0",className:"message-row response msg-to-store"},m.createElement("div",{className:"msg-date"}),m.createElement("span",{title:"",className:"usr-tit vis-tit"},m.createElement("i",{title:e("start_chat.visitor"),className:"material-icons chat-operators mi-fs15 me-0"},""),m.createElement("span",{className:"user-nick-title"},e("start_chat.visitor"))),m.createElement("div",{className:"msg-body"},this.state.Question)))),(!this.props.chatwidget.getIn(["proactive","has"])||1===this.props.chatwidget.getIn(["chat_ui","custom_html_priority"]))&&this.props.chatwidget.hasIn(["chat_ui","custom_html_widget"])&&m.createElement("div",{className:"custom-html-container "+(""!=this.state.Question?"visitor-started-type":""),dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_widget"])}}),(1==this.props.chatwidget.getIn(["onlineData","fields_visible"])||0==this.props.chatwidget.getIn(["onlineData","fields_visible"])&&!this.props.chatwidget.hasIn(["chat_ui","hstr_btn"]))&&m.createElement("div",{className:"d-flex flex-row border-top position-relative message-send-area"},this.props.chatwidget.hasIn(["validationErrors","question"])&&m.createElement("div",{id:"id-operator-typing",className:"bg-white ps-1"},this.props.chatwidget.getIn(["validationErrors","question"])),1==this.props.chatwidget.getIn(["onlineData","fields_visible"])&&m.createElement(m.Fragment,null,(!this.props.chatwidget.hasIn(["chat_ui","bbc_btnh"])||this.props.chatwidget.hasIn(["chat_ui","lng_btnh"]))&&m.createElement(C,{bbEnabled:!this.props.chatwidget.hasIn(["chat_ui","bbc_btnh"]),langEnabled:this.props.chatwidget.hasIn(["chat_ui","lng_btnh"]),changeLanguage:this.changeLanguage,toggleModal:this.toggleModal}),m.createElement("div",{className:"mx-auto w-100"},m.createElement("textarea",{autoFocus:0==this.props.chatwidget.get("isMobile")&&"widget"==this.props.chatwidget.get("mode")&&!0===this.props.chatwidget.get("shown"),onFocus:this.moveCaretAtEnd,maxLength:this.props.chatwidget.getIn(["chat_ui","max_length"]),"aria-label":"Type your message here...",id:"CSChatMessage",value:1==this.props.chatwidget.get("processStatus")&&!1===this.state.hasBotData?"":this.state.Question,placeholder:this.props.chatwidget.hasIn(["chat_ui","placeholder_message"])?this.props.chatwidget.getIn(["chat_ui","placeholder_message"]):e("chat.type_here"),onKeyDown:this.enterKeyDown,onChange:function(e){return t.handleContentChange({id:"Question",value:e.target.value})},ref:this.textMessageRef,rows:"1",className:r})),m.createElement("div",{className:"disable-select"},m.createElement("div",{className:"user-chatwidget-buttons pt-2",id:"ChatSendButtonContainer"},1!=this.props.chatwidget.get("processStatus")&&m.createElement("a",{onClick:this.handleSubmit,title:e("button.start_chat")},m.createElement("i",{className:"material-icons settings"+(0==this.state.Question.length?" text-muted-light":" text-muted")},"")),1==this.props.chatwidget.get("processStatus")&&m.createElement("i",{className:"material-icons text-muted settings me-0"},"")))),0==this.props.chatwidget.getIn(["onlineData","fields_visible"])&&!this.props.chatwidget.hasIn(["chat_ui","hstr_btn"])&&m.createElement("button",{className:"mx-auto pb-1 w-100 btn btn-light rounded-0",onClick:this.handleSubmit,title:e("button.start_chat")},this.props.chatwidget.getIn(["chat_ui","custom_start_button"])||e("button.start_chat_With_us"))))}return m.createElement("div",{id:"id-container-fluid"},!0===this.props.chatwidget.getIn(["proactive","has"])&&m.createElement(x,{mode:"profile",invitation:this.props.chatwidget.getIn(["proactive","data"])})||(this.props.chatwidget.hasIn(["chat_ui","pre_chat_html"])||this.props.chatwidget.hasIn(["chat_ui","operator_profile"])&&""!=this.props.chatwidget.getIn(["chat_ui","operator_profile"]))&&m.createElement("div",{id:"lhc-profile-body"},m.createElement("div",{id:"chat-status-container",className:"p-2"+(this.props.chatwidget.hasIn(["chat_ui","np_border"])?"":" border-bottom"),dangerouslySetInnerHTML:{__html:(this.props.chatwidget.hasIn(["chat_ui","pre_chat_html"])?this.props.chatwidget.getIn(["chat_ui","pre_chat_html"]):"")+(this.props.chatwidget.hasIn(["chat_ui","operator_profile"])?this.props.chatwidget.getIn(["chat_ui","operator_profile"]):"")}})),m.createElement("div",{className:"container-fluid"},m.createElement(I,{errors:this.props.chatwidget.get("validationErrors")}),!this.props.chatwidget.getIn(["proactive","has"])&&this.props.chatwidget.hasIn(["chat_ui","custom_html_widget"])&&m.createElement("div",{className:"custom-html-container",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_widget"])}}),m.createElement("form",{onSubmit:this.handleSubmit},m.createElement("div",{className:"row pt-2"},a,i,this.props.chatwidget.hasIn(["onlineData","department"])&&m.createElement(D.Z,{defaultValueField:this.state.DepartamentID,setDefaultValue:this.props.chatwidget.get("departmentDefault"),onChangeContent:this.handleContentChange,isInvalidProduct:this.props.chatwidget.hasIn(["validationErrors","ProductID"]),isInvalid:this.props.chatwidget.hasIn(["validationErrors","department"]),departments:this.props.chatwidget.getIn(["onlineData","department"])})),(!this.props.chatwidget.hasIn(["chat_ui","hstr_btn"])||""!==i||""!==a||!0===this.props.chatwidget.getIn(["proactive","has"]))&&m.createElement("div",{className:"row"},m.createElement("div",{className:"col-12 pb-3"},m.createElement("button",{disabled:1==this.props.chatwidget.get("processStatus"),type:"submit",className:"btn btn-secondary btn-sm"},this.props.chatwidget.getIn(["chat_ui","custom_start_button"])||e("button.start_chat")))))))}return 2==this.props.chatwidget.get("processStatus")?m.createElement("div",{className:"container-fluid",id:"id-container-fluid"},m.createElement("div",{className:"row"},m.createElement("div",{className:"col-12"},m.createElement("p",null,e("start_chat.thank_you_for_feedback"))))):void 0}}],[{key:"getDerivedStateFromProps",value:function(t,e){if(t.chatwidget.getIn(["chat_ui","auto_start"])&&0==t.chatwidget.get("processStatus")&&("embed"==t.chatwidget.get("mode")||"popup"==t.chatwidget.get("mode")||"widget"==t.chatwidget.get("mode")&&1==t.chatwidget.get("shown"))){var a=e;a.jsvar=t.chatwidget.get("jsVars"),a["captcha_"+t.chatwidget.getIn(["captcha","hash"])]=t.chatwidget.getIn(["captcha","ts"]),a.tscaptcha=t.chatwidget.getIn(["captcha","ts"]),a.user_timezone=k.a.getTimeZone(),a.URLRefer=window.location.href.substring(window.location.protocol.length),a.r=t.chatwidget.get("ses_ref"),""!=t.chatwidget.get("bot_id")&&(a.bot_id=t.chatwidget.get("bot_id")),""!=t.chatwidget.get("subject_id")&&(a.subject_id=t.chatwidget.get("subject_id")),""!=t.chatwidget.get("trigger_id")&&(a.trigger_id=t.chatwidget.get("trigger_id")),""!=t.chatwidget.get("operator")&&(a.operator=t.chatwidget.get("operator")),null!==t.chatwidget.get("priority")&&(a.priority=t.chatwidget.get("priority")),null!==t.chatwidget.get("pvhash")&&(a.pvhash=t.chatwidget.get("pvhash")),null!==t.chatwidget.get("phash")&&(a.phash=t.chatwidget.get("phash"));var n=k.a.getCustomFieldsSubmit(t.chatwidget.getIn(["customData","fields"]));null!==n&&(a=R(R({},a),n)),null!==t.chatwidget.get("api_data")&&(a=R(R({},a),t.chatwidget.get("api_data")));var i={department:t.chatwidget.get("department"),theme:t.chatwidget.get("theme"),mode:t.chatwidget.get("mode"),vid:t.chatwidget.get("vid"),fields:a};null!==t.botPayload&&(i.bpayload=t.botPayload),!0===t.chatwidget.hasIn(["proactive","data","invitation_id"])&&(i.invitation_id=t.chatwidget.getIn(["proactive","data","invitation_id"])),t.dispatch((0,P.Ym)(i))}return null}}]),r}(m.Component))||A,N=(0,w.Z)()(B)},9944:function(t,e,a){"use strict";a.d(e,{XI:function(){return n},sk:function(){return i},pA:function(){return r},B4:function(){return s},pV:function(){return o},Pd:function(){return c}});var n=1,i=2,r=5,s=2,o=3,c=5},2137:function(t,e,a){"use strict";a.d(e,{a:function(){return o}});var n=a(4575),i=a.n(n),r=a(3913),s=a.n(r),o=new(function(){function t(){i()(this,t);var e,n=document.currentScript||(e=document.getElementsByTagName("script"))[e.length-1],r=a(4795);this.prefix=n.getAttribute("scope")||"lhc",this.prefixUppercase=this.prefix.toUpperCase(),this.eventEmitter=new r;try{this.hasSessionStorage=!!window.sessionStorage}catch(t){this.hasSessionStorage=!1}try{this.hasLocalStorage=!!window.localStorage}catch(t){this.hasLocalStorage=!1}}return s()(t,[{key:"emitEvent",value:function(t,e,a){this.eventEmitter.emitEvent(t,e)}},{key:"sendMessageParent",value:function(t,e){window.opener&&!1===window.opener.closed?window.opener.postMessage(this.prefix+"::"+t+"::"+JSON.stringify(e||null),"*"):window.parent&&!1===window.parent.closed&&window.parent.postMessage(this.prefix+"::"+t+"::"+JSON.stringify(e||null),"/"),"undefined"!=typeof LHCEventTracker&&LHCEventTracker(t,e)}},{key:"sendMessageParentDirect",value:function(t,e){var a=null;window.parent&&window.parent["$_"+this.prefixUppercase]&&!1===window.parent.closed?a=window.parent["$_"+this.prefixUppercase].eventListener:window.opener&&window.opener["$_"+this.prefixUppercase]&&!1===window.opener.closed&&(a=window.opener["$_"+this.prefixUppercase].eventListener),null!==a?a.emitEvent(t,e):this.sendMessageParent(t,e)}},{key:"setLocalStorage",value:function(t,e){if(this.hasLocalStorage&&localStorage.setItem)try{localStorage.setItem(this.prefix+t,e)}catch(t){}}},{key:"setSessionStorage",value:function(t,e){if(this.hasSessionStorage&&sessionStorage.setItem)try{sessionStorage.setItem(this.prefix+t,e)}catch(t){}}},{key:"getSessionStorage",value:function(t){return this.hasSessionStorage&&sessionStorage.getItem?sessionStorage.getItem(this.prefix+t):null}},{key:"getLocalStorage",value:function(t){return this.hasLocalStorage&&localStorage.getItem?localStorage.getItem(this.prefix+t):null}},{key:"removeSessionStorage",value:function(t){this.hasSessionStorage&&sessionStorage.removeItem&&sessionStorage.removeItem(this.prefix+t)}},{key:"removeLocalStorage",value:function(t){this.hasLocalStorage&&localStorage.removeItem&&localStorage.removeItem(this.prefix+t)}},{key:"getTimeZone",value:function(){try{var t=Intl.DateTimeFormat().resolvedOptions().timeZone;return"undefined"==t&&(t="UTC"),t}catch(t){var e=new Date;return(e.getTimezoneOffset()<(a=new Date(e.getFullYear(),0,1),n=new Date(e.getFullYear(),6,1),Math.max(a.getTimezoneOffset(),n.getTimezoneOffset()))?e.getTimezoneOffset():e.getTimezoneOffset()-60)/60*-1}var a,n}},{key:"getCustomFieldsSubmit",value:function(t){if(t.size>0){var e={name_items:[],values_req:[],value_items:[],value_types:[],encattr:[],value_show:[]};return t.forEach((function(t){e.value_items.push(t.get("value")),e.name_items.push(t.get("name")),e.values_req.push(!0===t.get("required")?"t":"f"),e.encattr.push(!0===t.get("encrypted")?"t":""),e.value_types.push(t.get("type")),e.value_show.push(t.get("show"))})),e}return null}},{key:"prefillFields",value:function(t){var e=t.props.chatwidget.get("attr_prefill");e.length>0&&e.forEach((function(e){t.setState(e)}))}},{key:"logJSError",value:function(t){var e;(e={}).location=location&&location.href?location.href:"",e.message=window.navigator.userAgent,e.stack=t.stack,e.stack=e.stack.replace(/(\r\n|\n|\r)/gm,"");var a=new XMLHttpRequest;a.open("POST",window.lhcChat.base_url+"audit/logjserror",!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send("data="+encodeURIComponent(JSON.stringify(e)))}}]),t}());window.lhcHelperfunctions=o},5501:function(t,e,a){"use strict";var n=a(7294),i=a(3935),r=a(4575),s=a.n(r),o=a(3913),c=a.n(o),l=a(2205),d=a.n(l),u=a(8585),h=a.n(u),p=a(9754),_=a.n(p),g=a(1506),f=a.n(g),m=a(9713),v=a.n(m),w=a(6458),y=a(6512),b=a(2137),E=a(9944),I=a(7139);var D,S,T=function(t){d()(r,t);var e,n,i=(e=r,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,a=_()(e);if(n){var i=_()(this).constructor;t=Reflect.construct(a,arguments,i)}else t=a.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),e=i.call(this,t),v()(f()(e),"state",{dropdown:null}),e}return c()(r,[{key:"componentDidMount",value:function(){if(document.getElementById(this.props.elementId)){var t=a(208);this.setState({dropdown:new t(document.getElementById(this.props.elementId))})}}},{key:"componentWillUnmount",value:function(){this.state.dropdown&&delete this.state.dropdown}},{key:"render",value:function(){return this.props.children}}]),r}(n.PureComponent);var C=(D=(0,w.$j)((function(t){return{chatwidget:t.chatwidget}})),D(S=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),(e=i.call(this,t)).closeWidget=e.closeWidget.bind(f()(e)),e.endChat=e.endChat.bind(f()(e)),e.popup=e.popup.bind(f()(e)),e.switchColumn=e.switchColumn.bind(f()(e)),e}return c()(r,[{key:"closeWidget",value:function(){this.props.dispatch((0,y.H7)())}},{key:"endChat",value:function(){this.props.endChat()}},{key:"popup",value:function(){this.props.popupChat()}},{key:"switchColumn",value:function(){this.props.switchColumn()}},{key:"render",value:function(){var t=this,e=this.props.t,a=!this.props.chatwidget.hasIn(["chat_ui","clinst"])||this.props.chatwidget.get("isMobile"),i=this.props.chatwidget.hasIn(["chat_ui","custom_html_header_body"]),r="position-relative row header-chat"+(1==this.props.chatwidget.get("isMobile")?" mobile-header":" desktop-header")+(!0===this.props.chatwidget.get("isChatting")||!0===this.props.chatwidget.get("isOnline")&&!1===this.props.chatwidget.get("isOfflineMode")?" online-header":" offline-header"),s=!this.props.chatwidget.hasIn(["chat_ui","hide_popup"]),o=!0===this.props.chatwidget.get("isChatting")&&!this.props.chatwidget.hasIn(["chat_ui","hide_close"]),c=0,l=0,d=this.props.chatwidget.hasIn(["chat_ui","header_buttons"])&&this.props.chatwidget.getIn(["chat_ui","header_buttons"]).map((function(i,r){var d=i.get("pos");if("dropdown"!=d){if(d="left"==d?"start":"right"==d?"end":d,"min"==i.get("btn")&&a)return c++,n.createElement("a",{className:"minimize-icon header-link float-"+d,title:t.props.chatwidget.getIn(["chat_ui","min_text"])||e("button.minimize"),onClick:t.closeWidget},t.props.chatwidget.hasIn(["chat_ui","img_icon_min"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_min"]),alt:""})||n.createElement("i",{className:"material-icons"},""));if("popup"==i.get("btn")&&s)return c++,n.createElement("a",{className:"header-link float-"+d,title:t.props.chatwidget.getIn(["chat_ui","popup_text"])||e("button.popup"),onClick:t.popup},t.props.chatwidget.hasIn(["chat_ui","img_icon_popup"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_popup"]),alt:""})||n.createElement("i",{className:"material-icons"},""));if("close"==i.get("btn")&&o){var u=t.props.chatwidget.getIn(["chat_ui","end_chat_text"])||e("button.end_chat");return c++,n.createElement("a",{title:u,className:"header-link float-"+d,onClick:t.endChat},t.props.chatwidget.hasIn(["chat_ui","img_icon_close"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_close"]),alt:""})||n.createElement("i",{className:"material-icons"},""),i.get("print")&&n.createElement("span",{className:"end-chat-text"},u))}if("fullheight"==i.get("btn")&&!t.props.chatwidget.get("isMobile")){l++;var h;return h=t.props.chatwidget.get("position_placement").includes("full_height")?t.props.chatwidget.getIn(["chat_ui","fheight_text_class"])||e("button.fheight_text_class"):t.props.chatwidget.getIn(["chat_ui","fheight_text_col"])||e("button.fheight_text_col"),n.createElement("a",{title:h,className:"header-link float-"+d,onClick:t.switchColumn},t.props.chatwidget.hasIn(["chat_ui","img_icon_fheight"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_fheight"]),alt:""})||n.createElement("span",{className:"material-icons"},t.props.chatwidget.get("position_placement").includes("full_height")?n.createElement(n.Fragment,null,""):n.createElement(n.Fragment,null,"")))}}})),u=this.props.chatwidget.hasIn(["chat_ui","header_buttons"])&&this.props.chatwidget.getIn(["chat_ui","header_buttons"]).map((function(i,r){if("dropdown"==i.get("pos")){if("min"==i.get("btn")&&a){l++;var c=t.props.chatwidget.getIn(["chat_ui","min_text"])||e("button.minimize");return n.createElement("a",{className:"minimize-icon header-link header-burger-link d-block text-nowrap py-1 ps-1",title:c,onClick:t.closeWidget},t.props.chatwidget.hasIn(["chat_ui","img_icon_min"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_min"]),alt:""})||n.createElement("i",{className:"material-icons"},""),n.createElement("span",{className:"menu-text text-nowrap"},c))}if("popup"==i.get("btn")&&s){l++;var d=t.props.chatwidget.getIn(["chat_ui","popup_text"])||e("button.popup");return n.createElement("a",{className:"header-link header-burger-link d-block text-nowrap py-1 ps-1",title:d,onClick:t.popup},t.props.chatwidget.hasIn(["chat_ui","img_icon_popup"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_popup"]),alt:""})||n.createElement("i",{className:"material-icons"},""),n.createElement("span",{className:"menu-text text-nowrap"},d))}if("close"==i.get("btn")&&o){l++;var u=t.props.chatwidget.getIn(["chat_ui","end_chat_text"])||e("button.end_chat");return n.createElement("a",{title:u,className:"header-link header-burger-link py-1 d-block text-nowrap ps-1",onClick:t.endChat},t.props.chatwidget.hasIn(["chat_ui","img_icon_close"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_close"]),alt:""})||n.createElement("i",{className:"material-icons"},""),n.createElement("span",{className:"menu-text"},u))}if("fullheight"==i.get("btn")&&!t.props.chatwidget.get("isMobile")){l++;var h;return h=t.props.chatwidget.get("position_placement").includes("full_height")?t.props.chatwidget.getIn(["chat_ui","fheight_text_class"])||e("button.fheight_text_class"):t.props.chatwidget.getIn(["chat_ui","fheight_text_col"])||e("button.fheight_text_col"),n.createElement("a",{title:h,className:"header-link header-burger-link py-1 d-block text-nowrap ps-1",onClick:t.switchColumn},t.props.chatwidget.hasIn(["chat_ui","img_icon_fheight"])&&n.createElement("img",{className:"px-1",src:t.props.chatwidget.getIn(["chat_ui","img_icon_fheight"]),alt:""})||n.createElement("span",{className:"material-icons"},t.props.chatwidget.get("position_placement").includes("full_height")?n.createElement(n.Fragment,null,""):n.createElement(n.Fragment,null,"")," "),n.createElement("span",{className:"menu-text text-nowrap"},h))}}}));return n.createElement("div",{id:"widget-header-content",className:r},i&&n.createElement("div",{className:"lhc-custom-header-inside",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_header_body"])}}),(c>0||l>0)&&n.createElement("div",{className:"col-12 px-1 widget-header-menu"},l>0&&n.createElement("div",{className:"float-end position-relative"},n.createElement(T,{elementId:"headerDropDown"},n.createElement("div",{className:"btn-group dropup disable-select"},n.createElement("a",{className:"header-link",id:"headerDropDown","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},n.createElement("i",{className:"material-icons"},"")),n.createElement("div",{className:"dropdown-menu shadow bg-white rounded lhc-dropdown-menu pe-2"},u)))),d))}}]),r}(n.Component))||S),k=(0,I.Z)()(C),O=a(9702),A=a(488),x=a.n(A),M=a(7154),P=a.n(M),L=a(3038),R=a.n(L),B=a(2446);var N=n.lazy((function(){return a.e(536).then(a.bind(a,3536))})),F=n.lazy((function(){return a.e(307).then(a.bind(a,307))})),U=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),e=i.call(this,t),v()(f()(e),"state",{jsExecuted:!1,moreReactions:!1,reactToMessageId:0}),e.abstractClick=e.abstractClick.bind(f()(e)),e.imageLoaded=e.imageLoaded.bind(f()(e)),e.updateTriggerClicked=e.updateTriggerClicked.bind(f()(e)),e.disableEditor=!1,e.delayData=[],e}return c()(r,[{key:"getDirectInnerText",value:function(t){for(var e=t.childNodes,a="",n=0;n'+e.innerHTML)}},{key:"abstractClick",value:function(t,e){var a=this,n=this.props.t;if(void 0===t.onchange){if(this.addLoader(t,e.target),t.onclick)if(-1!==t.onclick.indexOf("lhinst.updateTriggerClicked"))this.updateTriggerClicked({type:"/(type)/triggerclicked"},t,e.target);else if(-1!==t.onclick.indexOf("notificationsLHC.sendNotification"))this.props.dispatch((0,y.rN)()),e.target.innerHTML=n("notifications.subscribing"),setTimeout((function(){a.removeMetaMessage(t["data-id"])}),500);else if(-1!==t.onclick.indexOf("lhinst.moreReactions"))this.setState({moreReactions:!0,reactToMessageId:t["data-id"]}),e.stopPropagation();else if(-1!==t.onclick.indexOf("lhinst.reactionsToolbar"))this.props.setReactingTo(t["data-id"]!=this.props.reactToMessageId?t["data-id"]:0),e.stopPropagation();else if(-1!==t.onclick.indexOf("lhinst.reactionsClicked"))this.updateTriggerClicked({type:"/(type)/reactions"+(this.props.themeId?"/(theme)/"+this.props.themeId:"")},t,e.target),this.props.setReactingTo(0);else if(-1!==t.onclick.indexOf("lhinst.buttonClicked"))this.updateTriggerClicked({type:""},t,e.target);else if(-1!==t.onclick.indexOf("lhinst.startVoiceCall"))this.props.voiceCall();else if(-1!==t.onclick.indexOf("lhinst.chooseFile"))this.props.abstractAction("fileupload");else if(-1!==t.onclick.indexOf("lhinst.updateChatClicked"))this.updateTriggerClicked({type:"",mainType:"updatebuttonclicked"},t,e.target);else if(-1!==t.onclick.indexOf("lhinst.editGenericStep"))this.updateTriggerClicked({type:"/(type)/editgenericstep"},t,e.target);else if(-1!==t.onclick.indexOf("lhinst.hideShowAction")){var i=JSON.parse(t["data-load"]),r=document.getElementById("message-more-"+i.id);r.classList.contains("hide")?(e.target.innerText=i.hide_text,r.classList.remove("hide")):(e.target.innerText=i.show_text,r.classList.add("hide"))}else if(-1!==t.onclick.indexOf("lhinst.executeJS"))(0,y.bQ)(t,this);else if(-1!==t.onclick.indexOf("lhinst.dropdownClicked")){var s=document.getElementById("id_generic_list-"+t["data-id"]);s&&"0"!=s.value&&""!=s.value?(t["data-payload"]=s.value,this.updateTriggerClicked({type:"/(type)/valueclicked"},t,e.target)):alert(n("bot.please_choose"))}else-1!==t.onclick.indexOf("lhinst.zoomImage")?b.a.sendMessageParentDirect("zoomImage",[{txt_download:n("bbcode.img_download"),src:t.src,title:t.title?t.title:""}]):(b.a.emitEvent("MessageClick",[t,this.props.dispatch]),console.log("Unknown click event: "+t.onclick));e.preventDefault()}else{if(t.type&&"checkbox"==t.type){if("enable-confirm"==t["payload-type"]){var o=document.getElementById("confirm-button-"+t["data-id"]);e.target.checked?(o.removeAttribute("disabled"),o.onclick=function(e){return a.updateTriggerClicked({type:""},{"data-payload":"confirm","data-id":t["data-id"]},e.target)}):o.setAttribute("disabled","disabled")}return}var c=e.target.options[e.target.selectedIndex],l={"data-payload":c.getAttribute("data-payload"),"data-id":c.getAttribute("data-id")};"trigger"==c.getAttribute("payload-type")?this.updateTriggerClicked({type:"/(type)/triggerclicked"},l,e.target):"button"!=c.getAttribute("payload-type")&&"payload"!=c.getAttribute("payload-type")||this.updateTriggerClicked({type:""},l,e.target)}}},{key:"removeMetaMessage",value:function(t,e){setTimeout((function(){var e=document.getElementById("msg-"+t);if(e){var a,n=e.getElementsByClassName("meta-message-"+t);for(a=0;a0&&n.props.dispatch({type:"UPDATE_SCROLL_TO_MESSAGE",data:t.data.message_id_first}),t.data.t&&b.a.sendMessageParent("botTrigger",[{trigger:t.data.t}]),t.data.update_message?n.props.updateMessage(e["data-id"],n):(n.props.updateMessages(),n.props.updateStatus())}))}},{key:"imageLoaded",value:function(t){this.props.scrollBottom&&this.props.scrollBottom(!0,!0)}},{key:"componentDidUpdate",value:function(t,e,a){if(0!=this.props.reactToMessageId){var n=document.getElementById("reactions-toolbar-"+this.props.reactToMessageId),i=document.getElementById("msg-"+this.props.reactToMessageId);if(!n||!i)return;var r=n.clientWidth/2,s=i.offsetWidth,o=n.parentNode.offsetLeft;o+r>s?n.style.right="-"+(r-10)+"px":o0&&this.delayData.forEach((function(e){t.props.sendDelay(e),t.props.scrollBottom(!1,!1)}))}},{key:"formatStringToCamelCase",value:function(t){var e=t.split("-");return 1===e.length?e[0]:e[0]+e.slice(1).map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("")}},{key:"getStyleObjectFromString",value:function(t){var e=this,a={};return t.split(";").forEach((function(t){var n=t.split(":"),i=R()(n,2),r=i[0],s=i[1];if(r){var o=e.formatStringToCamelCase(r.trim());a[o]=s.trim()}})),a}},{key:"render",value:function(){var t=this,e=(this.props.t,!1),a=x()(this.props.msg.msg,{replace:function(a){if(a.attribs){var i=Object.assign({},a.attribs);if(a.attribs.class){if(a.attribs.className=a.attribs.class,-1!==a.attribs.className.indexOf("message-row")&&parseInt(t.props.reactToMessageId)==parseInt(a.attribs.id.replace("msg-",""))&&(a.attribs.className+=" current-reacting-to"),a.attribs.className+=" fade-in-fast",-1!==a.attribs.className.indexOf("message-row")&&(a.attribs.className+=" index-row-"+t.props.id),-1!==a.attribs.className.indexOf("message-row")&&t.props.id>0)t.props.msg.msop>0&&t.props.msg.msop!=t.props.msg.lmsop&&0==e&&(a.attribs.className+=" operator-changes",e=!0);else if(t.props.profilePic&&-1!==a.attribs.className.indexOf("vis-icon-hld"))return n.createElement("img",{className:"profile-msg-pic",onLoad:t.imageLoaded,src:t.props.profilePic,alt:"",title:""});delete a.attribs.class}if(a.attribs.onclick&&delete a.attribs.onclick,a.name&&"img"===a.name){if(a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),void 0===a.attribs["data-ignore-load"])return n.createElement("img",P()({},a.attribs,{onLoad:t.imageLoaded,onClick:function(e){return t.abstractClick(i,e)}}))}else if(a.name&&"button"===a.name){if(i.onclick)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),n.createElement("button",P()({},a.attribs,{onClick:function(e){return t.abstractClick(i,e)}}),(0,A.domToReact)(a.children))}else if(a.name&&"a"===a.name){if(i.onclick)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),n.createElement("a",P()({},a.attribs,{onClick:function(e){return t.abstractClick(i,e)}}),(0,A.domToReact)(a.children))}else if(a.name&&"select"===a.name){if(i.onchange)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),n.createElement("select",P()({},a.attribs,{onChange:function(e){return t.abstractClick(i,e)}}),(0,A.domToReact)(a.children))}else{if(a.name&&"inlineiframe"===a.name)return n.createElement(n.Suspense,{fallback:"..."},n.createElement(F,P()({},a.attribs,{updateMessage:function(e){return t.props.updateMessage(e,t)}})));if(a.name&&"inlinesurvey"===a.name)return n.createElement(n.Suspense,{fallback:"..."},n.createElement(N,P()({},a.attribs,{surveyOptions:a.children})));if(a.name&&"input"===a.name){if(a.attribs.type&&"checkbox"==a.attribs.type&&i.onchange)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),n.createElement("input",P()({type:"checkbox"},a.attribs,{onChange:function(e){return t.abstractClick(i,e)}}));if(a.attribs.type&&"radio"==a.attribs.type)return a.attribs.style&&(a.attribs.style=t.getStyleObjectFromString(a.attribs.style)),a.attribs.checked&&(a.attribs.defaultChecked=!0,delete a.attribs.checked),n.createElement("input",P()({type:"radio"},a.attribs))}else if(a.name&&"script"===a.name&&a.attribs["data-bot-action"]){if(!a.attribs["data-bot-always"]){if(1==t.state.jsExecuted)return n.createElement(n.Fragment,null);t.setState({jsExecuted:!0})}return(0,y.bQ)(a,t),n.createElement(n.Fragment,null)}}}}});return n.createElement(n.Fragment,null,this.state.moreReactions&&n.createElement(B.Z,{setReaction:function(e){t.updateTriggerClicked({type:"/(type)/reactions"+(t.props.themeId?"/(theme)/"+t.props.themeId:"")},JSON.parse(e),null),t.setState({moreReactions:!1}),t.props.setReactingTo(0)},confirmClose:function(e){t.setState({moreReactions:!1})},cancelClose:function(e){t.setState({moreReactions:!1})},toggle:function(e){t.setState({moreReactions:!1})},dataUrl:"/chat/reacttomessagemodal/"+this.state.reactToMessageId+(this.props.themeId?"/(theme)/"+this.props.themeId:"")}),1==this.props.hasNew&&this.props.id==this.props.newId&&n.createElement("div",{id:"scroll-to-message",className:"message-admin border-bottom new-msg-holder border-danger text-center"},n.createElement("span",{className:"new-msg bg-danger text-white d-inline-block fs12 rounded-top"},this.props.newTitle)),a)}}]),r}(n.PureComponent),H=(0,I.Z)()((0,w.$j)()(U)),j=a(8926),W=a.n(j),K=a(7757),q=a.n(K);function V(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function z(t){for(var e=1;ee.props.fileOptions.get("fs")&&i.push(t.name+": "+a("file.to_big_file"))})),i.length>0?alert(i.join("\n")):this.setState({files:t})}},{key:"componentDidUpdate",value:function(t,e){this.state.files.length>0&&0==this.state.uploading&&this.uploadFiles()}},{key:"uploadFiles",value:(e=W()(q().mark((function t(){var e,a=this;return q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.setState({uploadProgress:{},uploading:!0}),e=[],this.state.files.forEach((function(t){e.push(a.sendRequest(t))})),t.prev=3,t.next=6,Promise.all(e);case 6:this.setState({successfullUploaded:!0,uploading:!1,files:[]}),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(3),this.setState({successfullUploaded:!0,uploading:!1,files:[]});case 12:case"end":return t.stop()}}),t,this,[[3,9]])}))),function(){return e.apply(this,arguments)})},{key:"sendRequest",value:function(t){var e=this,a=this.props.t;return new Promise((function(n,i){var r=new XMLHttpRequest,s=new FormData;s.append("files",t,t.name),r.upload.addEventListener("progress",(function(n){n.lengthComputable&&(z({},e.state.uploadProgress)[t.name]={state:"pending",percentage:n.loaded/n.total*100},e.props.progress(a("file.uploading")+" "+Math.round(n.loaded/n.total*100)+"%"))})),r.upload.addEventListener("load",(function(n){z({},e.state.uploadProgress)[t.name]={state:"done",percentage:100},e.props.progress(a("file.processing"))})),r.onload=function(){var t=JSON.parse(r.response);t&&t.error&&"true"==t.error?t.error_msg?e.props.progress(t.error_msg):e.props.progress(a("file.upload_failed")):(e.props.progress(a("file.completed")),e.props.onCompletion()),n(r)},r.upload.addEventListener("error",(function(a){var n=z({},e.state.uploadProgress);n[t.name]={state:"error",percentage:0},e.setState({uploadProgress:n}),i(r)})),r.open("POST",e.props.base_url+"/file/uploadfile/"+e.props.chat_id+"/"+e.props.hash),r.send(s)}))}},{key:"openFileDialog",value:function(){this.state.uploading||this.fileInputRef.current.click()}},{key:"onFilesAddedUI",value:function(t){var e=t.target.files,a=this.fileListToArray(e);this.onFilesAdded(a)}},{key:"onDragOver",value:function(t){t.preventDefault(),this.state.uploading||this.props.onDrag&&this.props.onDrag(!0)}},{key:"componentDidMount",value:function(){var t=this;setTimeout((function(){t.props.dropArea.current&&(t.props.dropArea.current.ondragover=t.onDragOver,t.props.dropArea.current.ondragleave=t.onDragLeave,t.props.dropArea.current.ondrop=t.onDrop,document.addEventListener("paste",t.onPaste),b.a.eventEmitter.addListener("fileupload",t.openFileDialog))}),1e3)}},{key:"componentWillUnmount",value:function(){this.props.dropArea.current&&(this.props.dropArea.current.ondragover=null,this.props.dropArea.current.ondragleave=null,this.props.dropArea.current.ondrop=null),b.a.eventEmitter.removeListener("fileupload",this.openFileDialog),document.removeEventListener("paste",this.onPaste)}},{key:"onPaste",value:function(t){var e=t&&t.clipboardData&&t.clipboardData.items;if(e&&e.length){for(var a=[],n=0;n0&&this.onFilesAdded(a)}}},{key:"onDragLeave",value:function(t){this.props.onDrag&&this.props.onDrag(!1)}},{key:"onDrop",value:function(t){if(t.preventDefault(),!this.state.uploading){var e=t.dataTransfer.files,a=this.fileListToArray(e);this.onFilesAdded(a),this.props.onDrag&&this.props.onDrag(!1)}}},{key:"fileListToArray",value:function(t){for(var e=[],a=0;a=this.props.chat_ui.get("switch_to_human")&&Q().get(window.lhcChat.base_url+"restapi/isonlinechat/"+this.props.chat.get("id")+"?exclude_bot=true").then((function(t){if(t.data.isonline){var e=document.getElementById("transfer-to-human-btn");null!==e&&e.classList.remove("hide")}}))}},{key:"componentDidMount",value:function(){this.checkSwitchButtom()}},{key:"componentDidUpdate",value:function(t,e,a){this.checkSwitchButtom()}},{key:"render",value:function(){var t=this;return x()(this.props.status,{replace:function(e){if(e.attribs&&e.attribs.onclick&&e.name&&("i"==e.name||"a"==e.name)){var a=Object.assign({},e.attribs);return e.attribs.class&&(e.attribs.className=e.attribs.class,delete e.attribs.class),e.attribs.onclick&&delete e.attribs.onclick,n.createElement("i",P()({},e.attribs,{onClick:function(e){return t.abstractClick(a)}}),(0,A.domToReact)(e.children))}}})}}]),r}(n.PureComponent))||J),et=tt;var at,nt,it=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){return s()(this,r),i.call(this,t)}return c()(r,[{key:"render",value:function(){return n.createElement(n.Fragment,null,null!==this.props.profileBefore&&n.createElement("div",{dangerouslySetInnerHTML:{__html:this.props.profileBefore}}),n.createElement("div",{className:this.props.msg_expand,id:"messagesBlock",dangerouslySetInnerHTML:{__html:this.props.messagesBefore}}),!this.props.hideMessageField&&n.createElement("div",{className:"d-flex flex-row border-top position-relative message-send-area"},n.createElement("div",{className:"btn-group dropup disable-select ps-1 pt-2"},n.createElement("i",{className:"material-icons settings text-muted",id:"chat-dropdown-options","aria-haspopup":"true","aria-expanded":"false"},"")),n.createElement("div",{className:"mx-auto w-100"},n.createElement("textarea",{"aria-label":"Type your message here...",defaultValue:this.props.value,placeholder:this.props.placeholderMessage,readOnly:"readOnly",id:"CSChatMessage",rows:"1",className:"ps-0 no-outline form-control rounded-0 form-control rounded-start-0 rounded-end-0 border-0"})),n.createElement("div",{className:"disable-select"},n.createElement("div",{className:"user-chatwidget-buttons pt-2 pe-1",id:"ChatSendButtonContainer"},n.createElement("i",{className:"material-icons text-muted-light settings me-0"},"")))))}}]),r}(n.PureComponent),rt=a(6313);function st(t,e){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function(t,e){if(t){if("string"==typeof t)return ot(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?ot(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){a&&(t=a);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,o=!1;return{s:function(){a=a.call(t)},n:function(){var t=a.next();return s=t.done,t},e:function(t){o=!0,r=t},f:function(){try{s||null==a.return||a.return()}finally{if(o)throw r}}}}function ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=new Array(e);a70?!0!==this.state.scrollButton&&this.setState({scrollButton:!0}):!1!==this.state.scrollButton&&(this.setState({scrollButton:!1,otm:0}),this.props.dispatch({type:"UPDATE_LIVE_DATA",data:{attr:"lfmsgid",val:0}})))}},{key:"scrollToMessage",value:function(){var t=this;if(1==this.state.hasNew&&(clearTimeout(this.timeoutNewMessage),this.timeoutNewMessage=setTimeout((function(){t.setState({hasNew:!1,newId:0})}),1e3)),1==this.state.hasNew&&this.state.otm>0){this.setState({otm:0});try{document.getElementById("scroll-to-message").scrollIntoView()}catch(t){this.scrollBottom()}}else this.scrollBottom()}},{key:"changeFontAction",value:function(t){this.setState({fontSize:this.state.fontSize+(1==t?5:-5)}),b.a.setLocalStorage("_dfs",this.state.fontSize),this.scrollBottom()}},{key:"setLanguageAction",value:function(t){b.a.setLocalStorage("_lng",t),this.setState({changeLanguage:!1}),(0,y._Z)({lng:t,id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"])}),b.a.emitEvent("change_language",[t]),this.updateStatus()}},{key:"componentDidMount",value:function(){var t=b.a.getSessionStorage("_ttxt");null!==t&&this.setState({value:t});var e=b.a.getLocalStorage("_dfs");null!==e&&this.setState({fontSize:parseInt(e)});var a=document.getElementById("CSChatMessage");if(null!==a&&(!0===this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")||"popup"==this.props.chatwidget.get("mode"))){a.focus();var n=document.getElementById("CSChatMessage-tmp");null!==n&&document.body.removeChild(n)}}},{key:"focusMessage",value:function(){this.textMessageRef.current&&(this.textMessageRef.current.focus(),this.state.value.length>0&&(this.textMessageRef.current.selectionStart=this.state.value.length,this.textMessageRef.current.selectionEnd=this.state.value.length))}},{key:"setEditorEnabled",value:function(t){this.setState({enabledEditor:t})}},{key:"hasClass",value:function(t,e){return new RegExp("(\\s|^)"+e+"(\\s|$)").test(t.className)}},{key:"addClass",value:function(t,e){this.hasClass(t,e)||(t.className+=(t.className?" ":"")+e)}},{key:"removeClass",value:function(t,e){this.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(\\s|^)"+e+"(\\s|$)")," ").replace(/^\s+|\s+$/g,""))}},{key:"setMetaUpdateState",value:function(t){!1===t&&!0===this.pendingMetaUpdate&&(this.pendingMetaUpdate=!1,this.updateMetaAutoHide(!0),this.doScrollBottom()),!0===t&&(this.pendingMetaUpdate=!0,this.updateMetaAutoHide(),this.doScrollBottom())}},{key:"updateMetaAutoHide",value:function(t){var e=document.getElementById("messages-scroll");e&&["meta-auto-hide","meta-auto-hide-normal"].forEach((function(a){var n=e.getElementsByClassName(a);if(n.length>0){var i=t?0:1;for(r=0;r2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=[],r=!0;t=t.nextElementSibling;)r&&t&&!t.matches(e)==a?i.push(t):r=n;return i}},{key:"sendDelay",value:function(t){var e=this,a=t.id,n=t.duration,i=t.delay,r=t.untill_message,s=document.getElementById("msg-"+a);s&&(i>0&&this.addClass(s,"hide"),1==r&&this.nextUntil(s,".message-admin",!1,!0).length>0||setTimeout((function(){if(0==e.delayed)if(1==r)null!==e.intervalFunction&&e.intervalFunction(),e.intervalFunction=function(){if(e.nextUntil(s,".message-admin",!1,!0).length>0)s.parentNode.removeChild(s),e.scrollBottom(!1,!1),e.intervalFunction=null,clearInterval(e.intervalPending);else if(!e.hasClass(s,"meta-hider")){e.addClass(s,"meta-hider"),e.addClass(s,"message-row-typing"),e.removeClass(s,"hide"),e.removeClass(s,"fade-in-fast");var t,a=st(s.getElementsByClassName("msg-body"));try{for(a.s();!(t=a.n()).done;){var n=t.value;e.removeClass(n,"hide")}}catch(t){a.e(t)}finally{a.f()}e.scrollBottom(!1,!1)}},clearInterval(e.intervalPending),e.intervalPending=setInterval(e.intervalFunction,150);else{e.delayed=!0,e.addClass(s,"meta-hider"),e.addClass(s,"message-row-typing"),e.nextUntil(s,".meta-hider").forEach((function(t){e.addClass(t,"hide")})),e.unhideDelayedTimer=setTimeout((function(){e.unhideDelayed(a)}),1e3*n),e.removeClass(s,"hide"),e.removeClass(s,"fade-in-fast");var t,o=st(s.getElementsByClassName("msg-body"));try{for(o.s();!(t=o.n()).done;){var c=t.value;e.removeClass(c,"hide")}}catch(t){o.e(t)}finally{o.f()}i>0&&(e.updateMetaAutoHide(),e.scrollBottom(!1,!1))}else e.addClass(s,"message-row-typing"),e.addClass(s,"meta-hider"),e.delayQueue.push({id:a,delay:n})}),1e3*i))}},{key:"unhideDelayed",value:function(t){var e=this,a=document.getElementById("msg-"+t);if(a)if(this.nextUntil(a,".meta-hider").forEach((function(t){e.removeClass(t,"hide")})),a.parentNode.removeChild(a),this.updateMetaAutoHide(),this.scrollBottom(),this.delayQueue.length>0){var n=this.delayQueue.shift();setTimeout((function(){e.unhideDelayed(n.id)}),1e3*n.delay);var i=document.getElementById("msg-"+n.id);if(null!==i){this.removeClass(i,"hide"),this.removeClass(i,"fade-in-fast");var r,s=st(i.getElementsByClassName("msg-body"));try{for(s.s();!(r=s.n()).done;){var o=r.value;this.removeClass(o,"hide")}}catch(t){s.e(t)}finally{s.f()}}}else this.delayed=!1}},{key:"componentWillUnmount",value:function(){clearInterval(this.intervalPending),clearInterval(this.typingStopped),clearTimeout(this.unhideDelayedTimer),clearTimeout(this.timeoutNewMessage),clearTimeout(this.timeoutScroll)}},{key:"getSnapshotBeforeUpdate",value:function(t,e){if(t.chatwidget.getIn(["chatLiveData","messages"]).size!=this.props.chatwidget.getIn(["chatLiveData","messages"]).size){var a=!1,n=!0,i=0;this.messagesAreaRef.current&&((i=this.messagesAreaRef.current.scrollHeight-this.messagesAreaRef.current.scrollTop)-this.messagesAreaRef.current.offsetHeight<70?i=0:n=!1,a=!0);var r=this.state.hasNew,s=1==r?this.state.newId:0,o=1==r?this.state.otm:0;if(0!=t.chatwidget.getIn(["chatLiveData","messages"]).size&&!1===this.props.chatwidget.getIn(["chatLiveData","uw"])){var c=this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")||"widget"!=this.props.chatwidget.get("mode")&&document.hasFocus();0==r?(s=1==(r=0==c||0==window.lhcChat.is_focused||0==n||!1===this.state.messages_ui)?t.chatwidget.getIn(["chatLiveData","messages"]).size:0,o=this.props.chatwidget.getIn(["chatLiveData","otm"])):o+=this.props.chatwidget.getIn(["chatLiveData","otm"]);var l=this.props.chatwidget.hasIn(["chat_ui","msg_snippet"])&&this.props.chatwidget.getIn(["chatLiveData","messages",-1,"msg"]);b.a.emitEvent("play_sound",[{msop:this.props.chatwidget.getIn(["chatLiveData","msop"]),msg_body:l,otm:o,type:"new_message",sound_on:!0===this.props.chatwidget.getIn(["usersettings","soundOn"]),widget_open:c}])}else r=!1,s=0,o=0;if(this.setState({hasNew:r,newId:s,otm:o,scrollButton:!n}),1==a)return i}else{if(!1===t.chatwidget.get("shown")&&!0===this.props.chatwidget.get("shown"))return 0;this.props.chatwidget.getIn(["chatLiveData","error"])&&(this.props.chatwidget.getIn(["chatLiveData","lmsg"])&&(0==this.state.errorMode||this.props.chatwidget.getIn(["chatLiveData","lmsg"])!=t.chatwidget.getIn(["chatLiveData","lmsg"]))||!this.props.chatwidget.getIn(["chatLiveData","lmsg"])&&0==this.state.errorMode)?this.setState({errorMode:!0,value:this.props.chatwidget.getIn(["chatLiveData","lmsg"])}):!this.props.chatwidget.getIn(["chatLiveData","error"])&&t.chatwidget.getIn(["chatLiveData","error"])&&this.setState({errorMode:!1,value:""})}return null}},{key:"componentDidUpdate",value:function(t,e,a){var n=this;!1!==this.state.showMessages&&t.chatwidget.getIn(["chatLiveData","status"])==this.props.chatwidget.getIn(["chatLiveData","status"])&&t.chatwidget.getIn(["chatLiveData","msg_to_store"]).size==this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size||(1==this.props.chatwidget.get("newChat")&&1==this.props.chatwidget.getIn(["chatLiveData","messages"]).size?this.scrollBottom(!1,!0):this.scrollBottom(!1,t.chatwidget.getIn(["chatLiveData","msg_to_store"]).size!=this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size));var i=!1;if((!1===e.enabledEditor&&e.enabledEditor!=this.state.enabledEditor&&1==(i=!0)||this.props.chatwidget.get("msgLoaded")!==t.chatwidget.get("msgLoaded")&&(0==this.props.chatwidget.get("newChat")||1==(i=!0)))&&(0==i?this.scrollBottom(!1,!1):this.scrollBottom(!1,!0),(!0!==this.props.chatwidget.getIn(["chat_ui","auto_start"])||"embed"!=this.props.chatwidget.get("mode")||!1===this.props.chatwidget.getIn(["chat_ui","auto_start"])&&"embed"==this.props.chatwidget.get("mode")||!1===e.enabledEditor&&e.enabledEditor!=this.state.enabledEditor)&&(this.focusMessage(),setTimeout((function(){n.focusMessage()}),500))),null!==a&&this.messagesAreaRef.current){var r=document.getElementById("messages-scroll"),s=document.getElementById("msg-"+this.props.chatwidget.getIn(["chatLiveData","lfmsgid"]));r&&s&&-1===s.className.indexOf("ignore-auto-scroll")&&r.scrollHeight-r.offsetHeight>s.offsetTop?(this.setState({scrollButton:!0}),this.messagesAreaRef.current.scrollTop=s.offsetTop-3):this.messagesAreaRef.current.scrollTop=this.messagesAreaRef.current.scrollHeight-a}if(1==this.props.chatwidget.getIn(["chat_ui_state","confirm_close"])&&!1===this.state.preloadSurvey&&this.setState({preloadSurvey:!0}),!1===t.chatwidget.get("shown")&&!0===this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")&&this.textMessageRef.current&&this.textMessageRef.current.focus(),!0!==this.props.chatwidget.getIn(["chat_ui","start_on_close"])||!0!==this.props.chatwidget.getIn(["chatLiveData","closed"])||void 0!==t.chatwidget.getIn(["chatLiveData","closed"])&&!1!==t.chatwidget.hasIn(["chatLiveData","closed"])&&!1!==t.chatwidget.getIn(["chatLiveData","closed"])||this.props.chatwidget.getIn(["chat_ui","survey_id"])||this.props.endChat({show_start:this.props.chatwidget.get("shown")}),!0===this.props.chatwidget.getIn(["chatLiveData","closed"])&&0===this.props.chatwidget.getIn(["chatLiveData","status_sub"])&&5===t.chatwidget.getIn(["chatLiveData","status_sub"])&&this.props.dispatch((0,y.Rt)({id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),theme:this.props.chatwidget.get("theme")})),!(!0!==this.props.chatwidget.get("shown")||"widget"!=this.props.chatwidget.get("mode")&&"embed"!=this.props.chatwidget.get("mode")||!0!==this.props.chatwidget.get("initLoaded")||!0!==this.props.chatwidget.get("msgLoaded")||0!=t.chatwidget.get("msgLoaded")&&0!=t.chatwidget.get("initLoaded"))){"widget"==this.props.chatwidget.get("mode")&&this.textMessageRef.current&&this.textMessageRef.current.focus();var o=document.getElementById("CSChatMessage-tmp");null!==o&&document.body.removeChild(o)}}},{key:"doScrollBottom",value:function(t){var e;this.messagesAreaRef.current&&(t&&null!==(e=document.getElementById("msg-"+this.props.chatwidget.getIn(["chatLiveData","lfmsgid"])))&&-1===e.className.indexOf("ignore-auto-scroll")?this.messagesAreaRef.current.scrollTop=e.offsetTop-3:this.messagesAreaRef.current.scrollTop=this.messagesAreaRef.current.scrollHeight+1e3)}},{key:"scrollBottom",value:function(t,e){var a=this;!this.messagesAreaRef.current||t&&this.state.scrollButton||(clearTimeout(this.timeoutScroll),this.doScrollBottom(e),this.timeoutScroll=setTimeout((function(){a.doScrollBottom(e),!1===a.state.showMessages&&a.setState({showMessages:!0})}),450))}},{key:"abstractAction",value:function(t,e){b.a.emitEvent(t,e)}},{key:"updateMessage",value:function(t){this.props.dispatch((0,y.o6)({msg_id:t,lmgsid:this.props.chatwidget.getIn(["chatLiveData","lmsgid"]),mode:this.props.chatwidget.get("mode"),theme:this.props.chatwidget.get("theme"),id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),no_scroll:!0}))}},{key:"updateMessages",value:function(){var t={chat_id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),lmgsid:this.props.chatwidget.getIn(["chatLiveData","lmsgid"]),lfmsgid:this.props.chatwidget.getIn(["chatLiveData","lfmsgid"]),theme:this.props.chatwidget.get("theme"),new_chat:this.props.chatwidget.get("newChat"),active_widget:(this.props.chatwidget.get("shown")&&"widget"==this.props.chatwidget.get("mode")||"widget"!=this.props.chatwidget.get("mode")&&document.hasFocus())&&1==window.lhcChat.is_focused&&!1!==this.state.messages_ui};t.new_chat&&0===t.lmgsid&&(t.old_msg_id=this.props.chatwidget.getIn(["chatData","lmsg_id"])),this.props.dispatch((0,y.W4)(t))}},{key:"updateStatus",value:function(){this.props.dispatch((0,y.kW)({chat_id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),theme:this.props.chatwidget.get("theme"),mode:this.props.chatwidget.get("mode")}))}},{key:"sendMessage",value:function(){0!=this.state.value.length&&(b.a.setSessionStorage("_ttxt",""),this.props.dispatch((0,y.Hz)({id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),msg:this.state.value,mn:this.props.chatwidget.hasIn(["chat_ui","mn"]),theme:this.props.chatwidget.get("theme"),lmgsid:this.props.chatwidget.getIn(["chatLiveData","lmsgid"])})),this.setState({value:"",errorMode:!1}),this.currentMessageTyping="",this.focusMessage(),this.doScrollBottom())}},{key:"enterKeyDown",value:function(t){"Enter"!==t.key||t.shiftKey||(this.sendMessage(),t.preventDefault())}},{key:"keyUp",value:function(t){if("Enter"!==t.key&&!t.shiftKey)if(!1===this.isTyping){var e=this.props.t;this.isTyping=!0,this.props.dispatch((0,y.Hx)("true",this.props.chatwidget.hasIn(["chat_ui","hide_typing"])&&!0===this.props.chatwidget.getIn(["chat_ui","hide_typing"])?e("online_chat.visitor_typing"):this.state.value))}else if(clearTimeout(this.typingStopped),this.typingStopped=setTimeout(this.typingStoppedAction,6e3),this.currentMessageTyping!=this.state.value&&(Math.abs(this.currentMessageTyping.length-this.state.value.length)>6||this.props.chatwidget.get("overrides").contains("typing"))){var a=this.props.t;this.currentMessageTyping=this.state.value,this.props.dispatch((0,y.Hx)("true",this.props.chatwidget.hasIn(["chat_ui","hide_typing"])&&!0===this.props.chatwidget.getIn(["chat_ui","hide_typing"])?a("online_chat.visitor_typing"):this.state.value))}}},{key:"typingStoppedAction",value:function(){1==this.isTyping&&(this.isTyping=!1,this.props.dispatch((0,y.Hx)("false")))}},{key:"endChat",value:function(){this.props.endChat({show_start:this.props.chatwidget.get("shown")})}},{key:"toggleModal",value:function(){this.setState({showBBCode:!this.state.showBBCode}),this.state.showBBCode&&this.focusMessage()}},{key:"mailChat",value:function(){this.setState({showMail:!this.state.showMail})}},{key:"changeLanguage",value:function(){this.setState({changeLanguage:!this.state.changeLanguage})}},{key:"changeFont",value:function(){this.setState({changeFontSize:!this.state.changeFontSize})}},{key:"voiceCall",value:function(){var t=void 0!==window.screenLeft?window.screenLeft:window.screenX,e=void 0!==window.screenTop?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,n=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,i=a/window.screen.availWidth,r=(a-parseInt(800))/2/i+t,s="scrollbars=yes,menubar=1,resizable=1,width=800,height=600,top="+((n-parseInt(600))/2/i+e)+",left="+r,o=window.open("",b.a.prefix+"_voice_popup_v2",s),c=!1,l=!1;try{!o||o.closed||void 0===o.closed||"about:blank"===o.location.href?(o=window.open(this.props.chatwidget.get("base_url")+"voicevideo/call/"+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"]),b.a.prefix+"_voice_popup_v2",s),l=!0):c=!0}catch(t){c=!0}!o||o.closed||void 0===o.closed||1==l||!0===c&&o.focus()}},{key:"toggleSound",value:function(){this.props.dispatch({type:"toggleSound",data:!this.props.chatwidget.getIn(["usersettings","soundOn"])}),b.a.sendMessageParent("toggleSound",[{sender:"toolbarButton"}])}},{key:"render",value:function(){var t=this,e=this.props.t;if(!1===this.props.chatwidget.get("initLoaded")||!1===this.props.chatwidget.get("msgLoaded")){var a="flex-grow-1 overflow-scroll position-relative";return this.props.chatwidget.hasIn(["chat_ui","msg_expand"])&&(a="overflow-scroll position-relative"),n.createElement(it,{value:this.state.value,profileBefore:this.props.profileBefore,msg_expand:a,messagesBefore:this.props.messagesBefore,placeholderMessage:this.props.chatwidget.hasIn(["chat_ui","placeholder_message"])?this.props.chatwidget.getIn(["chat_ui","placeholder_message"]):e("chat.type_here")})}if(this.props.chatwidget.hasIn(["chatLiveData","ru"])&&this.props.chatwidget.getIn(["chatLiveData","ru"]))return u=this.props.chatwidget.get("base_url")+this.props.chatwidget.getIn(["chatLiveData","ru"]),n.createElement(n.Fragment,null,n.createElement("iframe",{allowtransparency:"true",src:u,frameBorder:"0",className:"flex-grow-1 position-relative iframe-modal"}));if(this.props.chatwidget.get("chatLiveData").has("messages"))var i=this.props.chatwidget.getIn(["chatLiveData","messages"]).map((function(a,i){return n.createElement(H,{reactToMessageId:t.state.reactToMsgId,setReactingTo:function(e){return t.setState({reactToMsgId:e})},themeId:t.props.chatwidget.get("theme"),profilePic:t.props.chatwidget.get("profile_pic"),printButton:t.props.chatwidget.getIn(["chat_ui","print_btn_msg"]),newTitle:t.props.chatwidget.getIn(["chat_ui","cnew_msgh"])||e("button.new"),newId:t.state.newId,hasNew:t.state.hasNew,voiceCall:t.voiceCall,endChat:t.props.endChat,setMetaUpdateState:t.setMetaUpdateState,sendDelay:t.sendDelay,setEditorEnabled:t.setEditorEnabled,abstractAction:t.abstractAction,updateStatus:t.updateStatus,focusMessage:t.focusMessage,updateMessage:t.updateMessage,updateMessages:t.updateMessages,scrollBottom:t.scrollBottom,id:i,key:"msg_"+i,msg:a})}));else i="";var r;r=!0===this.state.dragging?e("chat.drop_files"):this.props.chatwidget.getIn(["chatLiveData","closed"])?e("chat.chat_closed"):this.props.chatwidget.hasIn(["chat_ui","placeholder_message"])?this.props.chatwidget.getIn(["chat_ui","placeholder_message"]):e("chat.type_here"),a="flex-grow-1 overflow-scroll position-relative";var s="bottom-message px-1";this.props.chatwidget.hasIn(["chat_ui","msg_expand"])&&"embed"==this.props.chatwidget.get("mode")&&(a="overflow-scroll position-relative",s+=" position-relative");var o="mx-auto w-100";1==this.props.chatwidget.getIn(["chatLiveData","closed"])&&(o+="embed"==this.props.chatwidget.get("mode")?" pe-2":" pe-1");var c=!0,l=!1,d=!1,u="",h="flex-grow-1 position-relative iframe-modal content-loader mb-2",p=this.props.chatwidget.hasIn(["chatLiveData","status_sub"])&&(this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.Pd||this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.pV&&(this.props.chatwidget.getIn(["chatLiveData","uid"])>0||this.props.chatwidget.getIn(["chatLiveData","status"])===E.pA||this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk))||this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk&&this.props.chatwidget.getIn(["chatLiveData","uid"])>0||!0===this.state.gotToSurvey;(this.props.chatwidget.hasIn(["chatLiveData","status_sub"])&&this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.Pd||this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk&&this.props.chatwidget.getIn(["chatLiveData","status_sub"])!=E.pV)&&(d=!0),(!0===this.state.preloadSurvey||p)&&this.props.chatwidget.hasIn(["chat_ui","survey_id"])&&(u=this.props.chatwidget.get("base_url")+"survey/fillwidget/(chatid)/"+this.props.chatwidget.getIn(["chatData","id"])+"/(hash)/"+this.props.chatwidget.getIn(["chatData","hash"]),this.props.chatwidget.get("theme")&&(u=u+"/(theme)/"+this.props.chatwidget.get("theme")),u=u+"/(survey)/"+this.props.chatwidget.getIn(["chat_ui","survey_id"])+(!0===d?"/(force)/true":""),this.props.chatwidget.hasIn(["chat_ui","survey_url"])&&(u=this.props.chatwidget.getIn(["chat_ui","survey_url"]).replace("{chat_id}",this.props.chatwidget.getIn(["chatData","id"])).replace("{chat_hash}",this.props.chatwidget.getIn(["chatData","hash"]))+(!0===d?"?force=true":"")),l=!0,c=!1,(!1===p||this.props.chatwidget.hasIn(["chat_ui","survey_button"])&&0===this.props.chatwidget.getIn(["chat_ui_state","show_survey"])&&this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk&&this.props.chatwidget.getIn(["chatLiveData","status_sub"])!=E.Pd&&this.props.chatwidget.getIn(["chatLiveData","status_sub"])!=E.pV||1==this.props.chatwidget.getIn(["chat_ui_state","confirm_close"]))&&(c=!0,h=" d-none"));var _=this.props.chatwidget.getIn(["chat_ui","end_chat_text"])||e("button.end_chat"),g={fontSize:(this.props.chatwidget.hasIn(["chat_ui","font_size"])?this.state.fontSize:"100")+"%"};return n.createElement(n.Fragment,null,this.props.chatwidget.getIn(["chatLiveData","abort"])&&n.createElement(rt.Z,{closeText:e("button.close"),close:function(e){return t.props.dispatch((0,y.H7)(!0))},text:this.props.chatwidget.getIn(["chatLiveData","abort"])}),this.props.chatwidget.hasIn(["chat_ui","pre_survey_url"])&&this.props.chatwidget.getIn(["chatLiveData","uid"])>0&&2!==this.props.chatwidget.getIn(["chat_ui_state","pre_survey_done"])&&(1===this.props.chatwidget.getIn(["chat_ui_state","pre_survey_done"])||p)&&n.createElement(B.Z,{cancelClose:function(e){return t.props.dispatch((0,y.Lt)(!1))},confirmClose:function(e){return t.props.dispatch((0,y.Lt)(!0))},toggle:this.props.cancelPresurvey,dataUrl:this.props.chatwidget.getIn(["chat_ui","pre_survey_url"])+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"])+(this.props.chatwidget.hasIn(["chat_ui","survey_id"])?"/(hassurvey)/true":"")+(this.props.chatwidget.get("theme")?"/(theme)/"+this.props.chatwidget.get("theme"):null)}),l&&n.createElement(n.Fragment,null,0==c&&this.props.chatwidget.hasIn(["chatStatusData","result"])&&!this.props.chatwidget.hasIn(["chat_ui","hide_status"])&&this.props.chatwidget.getIn(["chatStatusData","result"])&&n.createElement("div",{id:"chat-status-container",className:"p-2 border-bottom live-status-"+this.props.chatwidget.getIn(["chatLiveData","status"])},n.createElement(et,{updateStatus:this.updateStatus,vtm:this.props.chatwidget.hasIn(["chat_ui","switch_to_human"])&&this.props.chatwidget.getIn(["chatLiveData","status"])==E.pA?this.props.chatwidget.getIn(["chatLiveData","vtm"]):0,status:this.props.chatwidget.getIn(["chatStatusData","result"])})),n.createElement("iframe",{allowtransparency:"true",src:u,frameBorder:"0",className:h})),(c||l)&&n.createElement(Y,{hasSurvey:l,syncInterval:this.props.chatwidget.getIn(["chat_ui","sync_interval"]),updateStatus:this.updateStatus,updateMessages:this.updateMessages,initClose:this.props.chatwidget.get("initClose"),dispatch:this.props.dispatch,status_sub:this.props.chatwidget.getIn(["chatLiveData","status_sub"]),status:this.props.chatwidget.getIn(["chatLiveData","status"]),theme:this.props.chatwidget.get("theme"),lmgsid:this.props.chatwidget.getIn(["chatLiveData","lmsgid"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),chat_id:this.props.chatwidget.getIn(["chatData","id"])}),c&&n.createElement(n.Fragment,null,1==this.props.chatwidget.getIn(["chat_ui_state","confirm_close"])&&n.createElement(B.Z,{confirmClose:this.props.endChat,cancelClose:this.props.cancelClose,toggle:this.props.cancelClose,dataUrl:"/chat/confirmleave/"+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"])}),this.state.showBBCode&&n.createElement(B.Z,{showModal:this.state.showBBCode,insertText:this.insertText,toggle:this.toggleModal,dataUrl:"/chat/bbcodeinsert?react=1"}),this.state.changeLanguage&&n.createElement(B.Z,{showModal:this.state.changeLanguage,setLanguage:this.setLanguageAction,insertText:this.insertText,toggle:this.changeLanguage,dataUrl:"/widgetrestapi/chooselanguage/(id)/"+this.props.chatwidget.getIn(["chatData","id"])+"/(hash)/"+this.props.chatwidget.getIn(["chatData","hash"])}),this.state.showMail&&n.createElement(n.Suspense,{fallback:"..."},n.createElement(ut,{showModal:this.state.showMail,changeFont:this.changeFont,toggle:this.mailChat,chatHash:this.props.chatwidget.getIn(["chatData","hash"]),chatId:this.props.chatwidget.getIn(["chatData","id"])})),this.state.changeFontSize&&n.createElement(n.Suspense,{fallback:"..."},n.createElement(ht,{showModal:this.state.changeFontSize,toggle:this.changeFont,changeFont:this.changeFontAction})),"embed"==this.props.chatwidget.get("mode")&&this.props.chatwidget.hasIn(["chat_ui","embed_cls"])&&1==this.props.chatwidget.getIn(["chat_ui","embed_cls"])&&n.createElement("div",{className:"close-modal-btn position-absolute"},this.props.chatwidget.hasIn(["chat_ui","close_btn"])&&n.createElement("a",{onClick:this.endChat,title:_},n.createElement("i",{className:"material-icons settings text-muted"},""),n.createElement("span",{className:"embed-close-title"},_))),this.props.chatwidget.hasIn(["chatStatusData","result"])&&!this.props.chatwidget.hasIn(["chat_ui","hide_status"])&&this.props.chatwidget.getIn(["chatStatusData","result"])&&n.createElement("div",{id:"chat-status-container",className:"p-2 border-bottom live-status-"+this.props.chatwidget.getIn(["chatLiveData","status"])},n.createElement(et,{updateStatus:this.updateStatus,vtm:this.props.chatwidget.hasIn(["chat_ui","switch_to_human"])&&this.props.chatwidget.getIn(["chatLiveData","status"])==E.pA?this.props.chatwidget.getIn(["chatLiveData","vtm"]):0,status:this.props.chatwidget.getIn(["chatStatusData","result"])})),n.createElement("div",{className:a+(this.props.chatwidget.hasIn(["chat_ui","after_chat_status"])&&""!=this.props.chatwidget.getIn(["chat_ui","after_chat_status"])?" has-after-chat-status":""),onClick:function(e){t.setState({reactToMsgId:0})},id:"messagesBlock",onScroll:this.onScrollMessages},this.props.chatwidget.hasIn(["chat_ui","after_chat_status"])&&""!=this.props.chatwidget.getIn(["chat_ui","after_chat_status"])&&n.createElement(n.Suspense,{fallback:""},n.createElement(pt,{setStateParent:function(e){return t.setState(e)},has_new:this.state.hasNew&&this.state.otm>0,attr:"after_chat_status"})),n.createElement("div",{className:s,id:"messages-scroll",style:g,ref:this.messagesAreaRef},this.props.chatwidget.hasIn(["chat_ui","prev_chat"])&&n.createElement("div",{dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","prev_chat"])}}),i,this.props.chatwidget.hasIn(["chatLiveData","msg_to_store"])&&this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size>0&&this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).map((function(t,e){return n.createElement("div",{"data-op-id":"0",className:"message-row response msg-to-store"},n.createElement("div",{className:"msg-body"},t.split("\n").map((function(t,e){return n.createElement(n.Fragment,{key:e},t,n.createElement("br",null))}))))}))),this.state.scrollButton&&n.createElement("div",{className:"position-absolute btn-bottom-scroll fade-in",id:"id-btn-bottom-scroll"},n.createElement("button",{type:"button",onClick:this.scrollToMessage,className:"btn btn-sm btn-secondary"},this.state.hasNew&&this.state.otm>0&&n.createElement("div",null,n.createElement("i",{className:"material-icons"},""),this.state.otm," ",1==this.state.otm?this.props.chatwidget.getIn(["chat_ui","cnew_msg"])||e("button.new_msg"):this.props.chatwidget.getIn(["chat_ui","cnew_msgm"])||e("button.new_msgm"))||this.props.chatwidget.getIn(["chat_ui","cscroll_btn"])||e("button.scroll_bottom")))),n.createElement("div",{className:(!1===this.props.chatwidget.get("msgLoaded")||!1===this.state.enabledEditor?"d-none ":"d-flex ")+"flex-row border-top position-relative message-send-area"},(this.props.chatwidget.getIn(["chatLiveData","ott"])||this.props.chatwidget.getIn(["chatLiveData","error"])&&"SEND_CONNECTION"!=this.props.chatwidget.getIn(["chatLiveData","error"])||this.props.chatwidget.get("network_down"))&&n.createElement("div",{id:"id-operator-typing",className:"bg-white ps-1"},this.props.chatwidget.getIn(["chatLiveData","error"])?-1===this.props.chatwidget.getIn(["chatLiveData","error"]).indexOf("SEND_")?this.props.chatwidget.getIn(["chatLiveData","error"]):e("online_chat."+this.props.chatwidget.getIn(["chatLiveData","error"]).toLowerCase()):this.props.chatwidget.get("network_down")?e("online_chat.send_connection"):this.props.chatwidget.getIn(["chatLiveData","ott"])),"embed"==this.props.chatwidget.get("mode")&&this.props.chatwidget.hasIn(["chat_ui","embed_cls"])&&2==this.props.chatwidget.getIn(["chat_ui","embed_cls"])&&n.createElement("div",{className:"inline-cls-btn pt-1 ps-2"},this.props.chatwidget.hasIn(["chat_ui","close_btn"])&&n.createElement("a",{onClick:this.endChat,title:_},n.createElement("i",{className:"material-icons settings text-muted me-0"},""))),n.createElement(T,{elementId:"chat-dropdown-options"},n.createElement("div",{className:"btn-group dropup disable-select ps-1 pt-2"},n.createElement("i",{className:"material-icons settings text-muted",id:"chat-dropdown-options","data-bs-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},""),n.createElement("div",{className:"dropdown-menu shadow bg-white rounded lhc-dropdown-menu ms-1 "+("rtl"==window.lhcChat.staticJS.dir?"dropdown-menu-end":"")},n.createElement("div",{className:"d-flex flex-row ps-1"},n.createElement("a",{onClick:this.toggleSound,title:e("chat.option_sound")},n.createElement("i",{className:"material-icons chat-setting-item text-muted "+(!0===this.props.chatwidget.getIn(["usersettings","soundOn"])?"sound-on-ico":"sound-off-ico")},!0===this.props.chatwidget.getIn(["usersettings","soundOn"])?n.createElement(n.Fragment,null,""):n.createElement(n.Fragment,null,""))),this.props.chatwidget.hasIn(["chat_ui","print"])&&n.createElement("a",{target:"_blank",href:this.props.chatwidget.get("base_url")+"chat/printchat/"+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"]),title:e("button.print")},n.createElement("i",{className:"material-icons chat-setting-item text-muted print-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","dwntxt"])&&n.createElement("a",{target:"_blank",href:this.props.chatwidget.get("base_url")+"chat/downloadtxt/"+this.props.chatwidget.getIn(["chatData","id"])+"/"+this.props.chatwidget.getIn(["chatData","hash"]),title:e("button.dwntxt")},n.createElement("i",{className:"material-icons chat-setting-item text-muted download-ico"},"")),!this.props.chatwidget.getIn(["chatLiveData","closed"])&&this.props.chatwidget.hasIn(["chat_ui","file"])&&n.createElement($,{fileOptions:this.props.chatwidget.getIn(["chat_ui","file_options"]),onDrag:this.dragging,dropArea:this.textMessageRef,onCompletion:this.updateMessages,progress:this.setStatusText,base_url:this.props.chatwidget.get("base_url"),chat_id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),link:!0}),!this.props.chatwidget.getIn(["chatLiveData","closed"])&&1==this.props.chatwidget.getIn(["chatLiveData","status"])&&this.props.chatwidget.hasIn(["chat_ui","voice"])&&!0===this.props.chatwidget.getIn(["chat_ui","voice"])&&n.createElement("a",{onClick:this.voiceCall,title:e("button.voice")},n.createElement("i",{className:"material-icons chat-setting-item text-muted voice-ico"},"")),!this.props.chatwidget.getIn(["chatLiveData","closed"])&&!this.props.chatwidget.hasIn(["chat_ui","bbc_btnh"])&&n.createElement("a",{onClick:this.toggleModal,title:e("button.bb_code")},n.createElement("i",{className:"material-icons chat-setting-item text-muted bbcode-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","mail"])&&n.createElement("a",{onClick:this.mailChat,title:e("button.mail")},n.createElement("i",{className:"material-icons chat-setting-item text-muted mail-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","font_size"])&&n.createElement("a",{onClick:function(e){return t.changeFont(e)}},n.createElement("i",{className:"material-icons chat-setting-item text-muted fs-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","close_btn"])&&n.createElement("a",{onClick:this.endChat,title:_},n.createElement("i",{className:"material-icons chat-setting-item text-muted close-ico"},"")),this.props.chatwidget.hasIn(["chat_ui","lng_btnh"])&&n.createElement("a",{onClick:this.changeLanguage,title:e("button.lang")},n.createElement("i",{className:"material-icons chat-setting-item text-muted lang-ico"},"")))))),n.createElement("div",{className:o},this.props.chatwidget.getIn(["chatLiveData","closed"])&&this.props.chatwidget.hasIn(["chat_ui","survey_id"])&&n.createElement("button",{onClick:this.goToSurvey,className:"w-100 btn btn-success"},e("online_chat.go_to_survey")),(!this.props.chatwidget.getIn(["chatLiveData","closed"])||!this.props.chatwidget.hasIn(["chat_ui","survey_id"]))&&n.createElement("textarea",{onFocus:function(e){t.setState({reactToMsgId:0})},onTouchStart:this.scrollBottom,maxLength:this.props.chatwidget.getIn(["chat_ui","max_length"]),onKeyUp:this.keyUp,readOnly:this.props.chatwidget.getIn(["chatLiveData","closed"])||this.props.chatwidget.get("network_down"),id:"CSChatMessage",placeholder:r,onKeyDown:this.enterKeyDown,value:this.props.chatwidget.getIn(["chatLiveData","closed"])?"":this.state.value,onChange:this.handleChange,ref:this.textMessageRef,rows:"1",className:"ps-0 no-outline form-control rounded-0 form-control rounded-start-0 rounded-end-0 border-0 "+(!0===this.props.chatwidget.get("shown")&&this.textMessageRef.current&&(/\r|\n/.exec(this.state.value)||this.state.value.length>this.textMessageRef.current.offsetWidth/8.6)?"msg-two-line":"msg-one-line")})),!this.props.chatwidget.getIn(["chatLiveData","closed"])&&!this.props.chatwidget.get("network_down")&&n.createElement("div",{className:"disable-select"},n.createElement("div",{className:"user-chatwidget-buttons pt-2 pe-1",id:"ChatSendButtonContainer"},!0===this.state.voiceMode&&n.createElement(n.Suspense,{fallback:"..."},n.createElement(dt,{onCompletion:this.updateMessages,progress:this.setStatusText,base_url:this.props.chatwidget.get("base_url"),chat_id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"]),maxSeconds:this.props.chatwidget.getIn(["chat_ui","voice_message"]),cancel:this.cancelVoiceRecording})),(!this.props.chatwidget.hasIn(["chatLiveData","msg_to_store"])||0==this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size)&&this.props.chatwidget.hasIn(["chat_ui","voice_message"])&&void 0!==window.Audio&&0==this.state.value.length&&!1===this.state.voiceMode&&n.createElement("a",{onClick:this.startVoiceRecording,title:e("button.record_voice")},n.createElement("i",{className:"material-icons text-muted settings me-0"},"")),(!this.props.chatwidget.hasIn(["chatLiveData","msg_to_store"])||0==this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size)&&(!this.props.chatwidget.hasIn(["chat_ui","voice_message"])||!(void 0!==window.Audio)||this.state.value.length>0&&!1===this.state.voiceMode)&&n.createElement("a",{onClick:this.sendMessage,title:e("button.send_msg")},n.createElement("i",{className:"material-icons settings me-0"+(0==this.state.value.length?" text-muted-light":" text-muted")},"")),this.props.chatwidget.hasIn(["chatLiveData","msg_to_store"])&&this.props.chatwidget.getIn(["chatLiveData","msg_to_store"]).size>0&&n.createElement("i",{className:"material-icons text-muted settings me-0"},""))))))}}]),r}(n.Component))||nt),gt=(0,I.Z)()(_t);var ft=n.lazy((function(){return a.e(476).then(a.bind(a,5476))})),mt=n.lazy((function(){return a.e(906).then(a.bind(a,906))})),vt=(ct=(0,w.$j)((function(t){return{chatwidget:t.chatwidget}})),ct(lt=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),e=i.call(this,t),v()(f()(e),"state",{}),e.endChat=e.endChat.bind(f()(e)),e.popupChat=e.popupChat.bind(f()(e)),e.cancelClose=e.cancelClose.bind(f()(e)),e.setProfile=e.setProfile.bind(f()(e)),e.setMessages=e.setMessages.bind(f()(e)),e.setHideMessageField=e.setHideMessageField.bind(f()(e)),e.setBotPayload=e.setBotPayload.bind(f()(e)),e.switchColumn=e.switchColumn.bind(f()(e)),e.lastHeiht=0,e.profileHTML=null,e.messagesHTML=null,e.hideMessageField=!1,e.botPayload=null,b.a.eventEmitter.addListener("end_chat_visitor",(function(t){return e.endChat()})),e}return c()(r,[{key:"cancelClose",value:function(){this.props.dispatch({type:"UI_STATE",data:{attr:"confirm_close",val:0}})}},{key:"setBotPayload",value:function(t){this.botPayload=t}},{key:"endChat",value:function(t){void 0===t&&(t={});var e=!1,a=!1,n=!1,i=this.props.chatwidget.hasIn(["chatLiveData","status_sub"])&&(this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.B4||this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.Pd||this.props.chatwidget.getIn(["chatLiveData","status_sub"])==E.pV&&(this.props.chatwidget.getIn(["chatLiveData","uid"])>0||this.props.chatwidget.getIn(["chatLiveData","status"])===E.pA||this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk)),r=this.props.chatwidget.getIn(["chatLiveData","status"])==E.sk&&this.props.chatwidget.getIn(["chatLiveData","uid"])>0;(1==i||r)&&this.props.chatwidget.hasIn(["chat_ui","survey_id"])&&(this.props.chatwidget.hasIn(["chat_ui","survey_button"])&&1!==this.props.chatwidget.getIn(["chat_ui_state","show_survey"])&&1!=i?a=!0:e=!0),!1===e&&this.props.chatwidget.hasIn(["chat_ui","confirm_close"])&&0===this.props.chatwidget.getIn(["chat_ui_state","confirm_close"])?this.props.dispatch({type:"UI_STATE",data:{attr:"confirm_close",val:1}}):(1===this.props.chatwidget.getIn(["chat_ui_state","confirm_close"])&&this.props.dispatch({type:"UI_STATE",data:{attr:"confirm_close",val:2}}),1===this.props.chatwidget.getIn(["chat_ui_state","pre_survey_done"])&&this.props.dispatch({type:"UI_STATE",data:{attr:"pre_survey_done",val:2}}),this.props.chatwidget.hasIn(["chat_ui","pre_survey_url"])&&0===this.props.chatwidget.getIn(["chat_ui_state","pre_survey_done"])&&this.props.chatwidget.getIn(["chatLiveData","uid"])>0&&(this.props.dispatch({type:"UI_STATE",data:{attr:"pre_survey_done",val:1}}),n=!0),!0!==a?!1===this.props.chatwidget.get("initClose")&&this.props.chatwidget.hasIn(["chat_ui","survey_id"])&&0==e&&(this.props.chatwidget.getIn(["chatLiveData","uid"])>0||this.props.chatwidget.getIn(["chatLiveData","status"])===E.pA)?this.props.dispatch((0,y.Nl)({show_start:!(!t||!t.show_start)&&t.show_start,noCloseReason:"SHOW_SURVEY",noClose:!0,vid:this.props.chatwidget.get("vid"),chat:{id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"])}})):0==n&&this.props.dispatch((0,y.Nl)({show_start:!(!t||!t.show_start)&&t.show_start,vid:this.props.chatwidget.get("vid"),chat:{id:this.props.chatwidget.getIn(["chatData","id"]),hash:this.props.chatwidget.getIn(["chatData","hash"])}})):this.props.dispatch({type:"UI_STATE",data:{attr:"show_survey",val:1}}))}},{key:"popupChat",value:function(){var t=null;window.parent&&window.parent["$_"+b.a.prefixUppercase]&&!1===window.parent.closed?t=window.parent["$_"+b.a.prefixUppercase].eventListener:window.opener&&window.opener["$_"+b.a.prefixUppercase]&&!1===window.opener.closed&&(t=window.opener["$_"+b.a.prefixUppercase].eventListener),null!==t?t.emitEvent("openPopup"):b.a.sendMessageParent("openPopup",[])}},{key:"switchColumn",value:function(){var t=this.props.chatwidget.get("position_placement").includes("full_height_")?this.props.chatwidget.get("position_placement_original"):"full_height"+(this.props.chatwidget.get("position_placement_original").includes("_right")?"_right":"_left");b.a.sendMessageParent("widgetHeight",[{position_placement:t}]),this.props.dispatch({type:"position_placement",data:t})}},{key:"setProfile",value:function(t){this.profileHTML=t}},{key:"setMessages",value:function(t){this.messagesHTML=t}},{key:"setHideMessageField",value:function(t){this.hideMessageField=t}},{key:"render",value:function(){if(!1===this.props.chatwidget.get("loadedCore"))return null;if(!0===this.props.chatwidget.getIn(["proactive","pending"]))return n.createElement(n.Suspense,{fallback:"..."},n.createElement(mt,{setBotPayload:this.setBotPayload}));var t="d-flex flex-column flex-grow-1 reset-container-margins";return"widget"==this.props.chatwidget.get("mode")?t+=1==this.props.chatwidget.get("isMobile")?" mobile-body":" desktop-body":"embed"==this.props.chatwidget.get("mode")&&(t+=1==this.props.chatwidget.get("isMobile")?" mobile-embed-body":" desktop-embed-body"),this.props.chatwidget.hasIn(["chat_ui","msg_expand"])&&"embed"==this.props.chatwidget.get("mode")&&(t+=" mh-100"),!0===this.props.chatwidget.get("isChatting")?(t+=" online-chat online-chat-status-"+this.props.chatwidget.getIn(["chatLiveData","status"]),n.createElement(n.Fragment,null,this.props.chatwidget.hasIn(["chat_ui","custom_html_header"])&&n.createElement("div",{className:"lhc-custom-header-above",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_header"])}}),"widget"==this.props.chatwidget.get("mode")&&n.createElement(k,{switchColumn:this.switchColumn,popupChat:this.popupChat,endChat:this.endChat}),n.createElement("div",{className:t},n.createElement(gt,{hideMessageField:this.hideMessageField,profileBefore:this.profileHTML,messagesBefore:this.messagesHTML,cancelClose:this.cancelClose,endChat:this.endChat})))):!0===this.props.chatwidget.get("isOnline")&&!1===this.props.chatwidget.get("isOfflineMode")?(t+=" start-chat",n.createElement(n.Fragment,null,this.props.chatwidget.hasIn(["chat_ui","custom_html_header"])&&n.createElement("div",{className:"lhc-custom-header-above",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_header"])}}),"widget"==this.props.chatwidget.get("mode")&&n.createElement(k,{switchColumn:this.switchColumn,popupChat:this.popupChat,endChat:this.endChat}),n.createElement("div",{className:t},n.createElement(O.Z,{botPayload:this.botPayload,setHideMessageField:this.setHideMessageField,setProfile:this.setProfile,setMessages:this.setMessages})))):(t+=" offline-chat",n.createElement(n.Fragment,null,this.props.chatwidget.hasIn(["chat_ui","custom_html_header"])&&n.createElement("div",{className:"lhc-custom-header-above",dangerouslySetInnerHTML:{__html:this.props.chatwidget.getIn(["chat_ui","custom_html_header"])}}),"widget"==this.props.chatwidget.get("mode")&&n.createElement(k,{switchColumn:this.switchColumn,popupChat:this.popupChat,endChat:this.endChat}),n.createElement("div",{className:t},n.createElement(n.Suspense,{fallback:""},n.createElement(ft,null)))))}}]),r}(n.Component))||lt),wt=vt,yt=a(1766);var bt=function(t){d()(i,t);var e,a,n=(e=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function i(t){var e;return s()(this,i),e=n.call(this,t),v()(f()(e),"state",{}),v()(f()(e),"playSound",(function(t){"new_message"==t.type?(!0===t.sound_on&&(!1===t.widget_open||!0===t.widget_open&&0==window.lhcChat.is_focused)&&e.playSoundFile("new_message"),0==t.widget_open&&b.a.sendMessageParent("unread_message",[{msop:t.msop||null,msg_body:t.msg_body||null,type:"unread_message",otm:t.otm||0}])):"new_invitation"==t.type&&!0===t.sound_on?null===b.a.getSessionStorage("_invs")&&(b.a.setSessionStorage("_invs",1),e.playSoundFile("new_invitation")):"new_chat"==t.type&&!0===t.sound_on&&e.playSoundFile("new_invitation"),0==window.lhcChat.is_focused&&b.a.sendMessageParent("unread_message_title",[{status:!1}])})),v()(f()(e),"playSoundFile",(function(t){new yt.Howl({src:[window.lhcChat.base_url+"/widgetrestapi/loadsound/"+t+"_mp3",window.lhcChat.base_url+"/widgetrestapi/loadsound/"+t+"_ogg",window.lhcChat.base_url+"/widgetrestapi/loadsound/"+t+"_wav"],format:["mp3","ogg","wav"],autoplay:!0})})),b.a.eventEmitter.addListener("play_sound",(function(t){return e.playSound(t)})),e}return c()(i,[{key:"render",value:function(){return null}}]),i}(n.PureComponent),Et=(0,w.$j)()(bt);var It=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(t){var e;return s()(this,r),(e=i.call(this,t)).state={hasError:!1},e}return c()(r,[{key:"componentDidCatch",value:function(t,e){this.setState({hasError:!0,error:t,info:e}),b.a.logJSError({stack:t.stack?JSON.stringify(t.stack):""})}},{key:"render",value:function(){return this.state.hasError?n.createElement("p",null,"Please re-load window because of an error."):this.props.children}}]),r}(n.Component);var Dt=function(t){d()(r,t);var e,a,i=(e=r,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=_()(e);if(a){var i=_()(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h()(this,t)});function r(){return s()(this,r),i.apply(this,arguments)}return c()(r,[{key:"render",value:function(){return n.createElement(n.Fragment,null,n.createElement(It,null,n.createElement(Et,null),n.createElement(wt,null)))}}]),r}(n.Component),St=Dt;function Tt(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function Ct(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function kt(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:Kt,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Rt:return!1===t.get("isChatting")&&(t=t.set("processStatus",0).set("isOfflineMode",!1)),t.set("shown",!1);case"loadedCore":return t.set("loadedCore",!0);case"attr_set":return t.setIn(e.attr,e.data);case"profile_pic":return t.set("profile_pic",-1!==e.data.indexOf("http:")||-1!==e.data.indexOf("https:")?e.data:window.lhcChat.base_url+"widgetrestapi/avatar/"+e.data);case"attr_rem":return t.removeIn(e.attr);case"operator":case"leave_message":case"phash":case"pvhash":case"attr_prefill":case"attr_prefill_admin":case Bt:case"base_url":case"theme":case"jsVars":case"jsVarsPrefill":case"subject_id":case"bot_id":case"trigger_id":case"priority":case"position_placement":case"position_placement_original":case"lang":return t.set(e.type,e.data);case"widgetStatus":return 1==e.data&&!0===t.getIn(["proactive","pending"])&&(t=t.setIn(["proactive","pending"],!1)),1==e.data&&t.hasIn(["proactive","data","hide_on_open"])&&(t=t.set("proactive",(0,Wt.d0)({pending:!1,has:!1,data:{}}))),t.set("shown",e.data);case"PROACTIVE":return t.set("proactive",{pending:!1===t.get("shown")&&!1===e.data.qinv,has:!0,data:e.data});case"HIDE_INVITATION":return t.setIn(["proactive","pending"],!1);case"CANCEL_INVITATION":return t.set("proactive",(0,Wt.d0)({pending:!1,has:!1,data:{}}));case"FULL_INVITATION":return t.setIn(["proactive","pending"],!1);case Ft:return t.setIn(["usersettings","soundOn"],e.data);case Ut:return t.set("shown",!1).set("processStatus",0).set("isChatting",!1).set("newChat",!0).set("proactive",(0,Wt.d0)({pending:!1,has:!1,data:{}})).set("chatData",(0,Wt.d0)({})).removeIn(["chat_ui","survey_id"]).removeIn(["chat_ui","cmmsg_widget"]).setIn(["onlineData","fetched"],!1).set("chatLiveData",(0,Wt.d0)({msg_to_store:[],lmsop:0,vtm:0,otm:0,msop:0,uid:0,status:0,status_sub:0,uw:!1,ott:"",closed:!1,lfmsgid:0,lmsgid:0,operator:"",messages:[]})).set("chatStatusData",(0,Wt.d0)({})).set("chat_ui_state",(0,Wt.d0)({confirm_close:0,show_survey:0,pre_survey_done:0})).set("initClose",!1).set("msgLoaded",!1).set("initLoaded",!1);case"chat_status_changed":return t.setIn(["chatLiveData","ott"],e.data.text);case Nt:return t.set("isOnline",e.data);case Ht:return t.set("offlineData",(0,Wt.d0)({fetched:!0,disabled:e.data.disabled,fields_visible:e.data.fields_visible,fields:e.data.fields,department:e.data.department})).set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui)));case"department":case"mode":case"product":case"captcha":return t.set(e.type,(0,Wt.d0)(e.data));case"INIT_PRODUCTS":return t.setIn(["onlineData","department","products"],(0,Wt.d0)(e.data.products)).setIn(["onlineData","department","settings","product_required"],e.data.required);case"CHAT_SESSION_REFFERER":return t.set("ses_ref",e.data.ref);case"CHAT_ADD_OVERRIDE":return t.update("overrides",(function(t){return t.push(e.data)}));case"CHAT_REMOVE_OVERRIDE":return t.update("overrides",(function(t){return t.filter((function(t){return t!=e.data}))}));case jt:return!0===e.data.success?(b.a.sendMessageParent("chatStarted",[e.data.chatData,t.get("mode")]),"popup"==t.get("mode")&&(!0===b.a.hasSessionStorage?(b.a.setSessionStorage("_chat",JSON.stringify(e.data.chatData)),b.a.removeSessionStorage("_reset_chat")):document.location="#/"+e.data.chatData.id+"/"+e.data.chatData.hash),t.set("processStatus",2).set("isChatting",!0).set("chatData",(0,Wt.d0)(e.data.chatData)).setIn(["chatLiveData","lfmsgid"],e.data.chatLiveData.message_id_first).set("validationErrors",(0,Wt.d0)({}))):t.set("validationErrors",(0,Wt.d0)(e.data.errors)).set("processStatus",0).setIn(["chat_ui","auto_start"],!1);case"OFFLINE_SUBMITTED":return!0===e.data.success?(b.a.sendMessageParent("offlineMessage",[]),t.set("processStatus",2).set("validationErrors",(0,Wt.d0)({}))):t.set("validationErrors",(0,Wt.d0)(e.data.errors)).set("processStatus",0);case"INIT_CLOSE":return t.set("initClose",!0);case"CHAT_ALREADY_STARTED":return t.set("processStatus",2).set("isChatting",!0).set("newChat",!1).set("chatData",(0,Wt.d0)(e.data));case"OFFLINE_SUBMITTING":return t.set("processStatus",1);case"CHAT_SET_VID":return t.set("vid",e.data);case"ONLINE_SUBMITTING":return t.set("processStatus",1);case"UI_STATE":return t.setIn(["chat_ui_state",e.data.attr],e.data.val);case"UPDATE_LIVE_DATA":return t.setIn(["chatLiveData",e.data.attr],e.data.val);case"ADD_MSG_TO_STORE":return t.updateIn(["chatLiveData","msg_to_store"],(function(t){return t.push(e.data)}));case"UPDATE_SCROLL_TO_MESSAGE":return e.data>t.getIn(["chatLiveData","lfmsgid"])?t.setIn(["chatLiveData","lfmsgid"],e.data):t;case"INIT_CHAT_SUBMITTED":return e.data.chat_ui_state&&(t=t.set("chat_ui_state",t.get("chat_ui_state").merge((0,Wt.d0)(e.data.chat_ui_state)))),t.setIn(["chatLiveData","operator"],e.data.operator).set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui))).setIn(["chatLiveData","status_sub"],e.data.status_sub).setIn(["chatLiveData","status"],e.data.status).set("initLoaded",!0).setIn(["chatLiveData","closed"],e.data.closed&&!0===e.data.closed);case"REFRESH_UI_COMPLETED":return e.data.chat_ui_remove&&e.data.chat_ui_remove.forEach((function(e){t=t.removeIn(e)})),t.set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui)));case"FETCH_MESSAGE_SUBMITTED":var a=t.getIn(["chatLiveData","messages"]).findIndex((function(t){if(t.msg.includes('id="msg-'+e.data.id+'"'))return!0}));if(-1!==a){var n=document.createElement("div");n.innerHTML=t.getIn(["chatLiveData","messages",a,"msg"]);var i=n.querySelector("#msg-"+e.data.id);i&&(n.innerHTML=n.innerHTML.replace(i.outerHTML,e.data.msg),t=t.setIn(["chatLiveData","messages",a,"msg"],n.innerHTML))}return t;case"FETCH_MESSAGES_SUBMITTED":return t.hasIn(["chatData","id"])?(e.data.closed_arg&&e.data.closed_arg.survey_id&&(t=t.setIn(["chat_ui","survey_id"],e.data.closed_arg.survey_id)),e.data.disable_survey&&(t=t.removeIn(["chat_ui","survey_id"])),e.data.extension&&(t=t.set("extension",t.get("extension").merge((0,Wt.d0)(e.data.extension)))),""!==e.data.messages&&(t=t.updateIn(["chatLiveData","messages"],(function(a){return a.push({lmsop:t.getIn(["chatLiveData","msop"]),msop:e.data.msop,msg:e.data.messages})})).setIn(["chatLiveData","uw"],e.data.uw&&!0===e.data.uw).setIn(["chatLiveData","lmsgid"],e.data.message_id).setIn(["chatLiveData","lfmsgid"],e.data.message_id_first).setIn(["chatLiveData","msop"],e.data.lmsop||e.data.msop)),e.data.vtm&&(t=t.updateIn(["chatLiveData","vtm"],(function(t){return t+e.data.vtm})).updateIn(["chatLiveData","msg_to_store"],(function(t){return t.splice(0,e.data.vtm)}))),e.data.otm&&(t=t.setIn(["chatLiveData","otm"],e.data.otm)),t.get("overrides").contains("typing")||(t=t.setIn(["chatLiveData","ott"],e.data.ott)),t.setIn(["chatLiveData","status_sub"],e.data.status_sub).setIn(["chatLiveData","status"],e.data.status).set("msgLoaded",!0).set("network_down",!1).setIn(["chatLiveData","closed"],e.data.closed&&!0===e.data.closed)):t;case"CHECK_CHAT_STATUS_FINISHED":return e.data.extension&&(t=t.set("extension",t.get("extension").merge((0,Wt.d0)(e.data.extension)))),t.set("chatStatusData",(0,Wt.d0)(e.data)).setIn(["chatLiveData","closed"],e.data.closed&&!0===e.data.closed||t.getIn(["chatLiveData","closed"])).setIn(["chatLiveData","status"],e.data.status).setIn(["chatLiveData","uid"],e.data.uid).setIn(["chatLiveData","ru"],e.data.ru?e.data.ru:null).set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui))).set("network_down",!1).setIn(["chatLiveData","status_sub"],e.data.status_sub);case"ONLINE_FIELDS_UPDATED":return t.set("onlineData",(0,Wt.d0)({dep_forms:e.data.dep_forms,disabled:e.data.disabled,fetched:!0,paid:e.data.paid,fields_visible:e.data.fields_visible,fields:e.data.fields,department:e.data.department})).set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data.chat_ui)));case"CHAT_UI_UPDATE":return t.set("chat_ui",t.get("chat_ui").merge((0,Wt.d0)(e.data)));case"CUSTOM_FIELDS":return t.set("customData",(0,Wt.d0)({fields:e.data}));case"dep_default":return t.set("departmentDefault",e.data);case"survey":return t.setIn(["chat_ui","survey_id"],e.data);case"CUSTOM_FIELDS_ITEM":return t.setIn(["customData","fields",e.data.id,"value"],e.data.value);case"ADD_MESSAGES_SUBMITTED":return t.setIn(["chatLiveData","error"],e.data.r).setIn(["chatLiveData","lmsg"],e.data.r?e.data.msg:"").setIn(["chatLiveData","msg_to_store"],(0,Wt.d0)([]));case"NO_CONNECTION":return t.set("network_down",e.data);default:return t}}}),Vt=a(3894),zt=a(5068),Gt=a(696),$t=a(5397),Zt=a(5538);Gt.Z.use(Zt.Z).use($t.Db);var Jt=Gt.Z,Yt=function(){for(var t=arguments.length,e=new Array(t),a=0;a-1};function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function u(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function _(t){return new Promise((function(e,a){t.onload=function(){e(t.result)},t.onerror=function(){a(t.error)}}))}function g(t){var e=new FileReader,a=_(e);return e.readAsArrayBuffer(t),a}function f(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:a&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=f(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=f(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t,e,a,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,a=_(e=new FileReader),e.readAsText(t),a;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),a=new Array(e.length),n=0;n-1?n:a),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function y(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var a=t.split("="),n=a.shift().replace(/\+/g," "),i=a.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},m.call(w.prototype),m.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];b.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var a=Error(t);this.stack=a.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function I(t,a){return new Promise((function(n,r){var s=new w(t,a);if(s.signal&&s.signal.aborted)return r(new e.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function c(){o.abort()}o.onload=function(){var t,e,a={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var a=t.split(":"),n=a.shift().trim();if(n){var i=a.join(":").trim();e.append(n,i)}})),e)};a.url="responseURL"in o?o.responseURL:a.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new b(i,a))},o.onerror=function(){r(new TypeError("Network request failed"))},o.ontimeout=function(){r(new TypeError("Network request failed"))},o.onabort=function(){r(new e.DOMException("Aborted","AbortError"))},o.open(s.method,s.url,!0),"include"===s.credentials?o.withCredentials=!0:"omit"===s.credentials&&(o.withCredentials=!1),"responseType"in o&&i&&(o.responseType="blob"),s.headers.forEach((function(t,e){o.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),o.onreadystatechange=function(){4===o.readyState&&s.signal.removeEventListener("abort",c)}),o.send(void 0===s._bodyInit?null:s._bodyInit)}))}I.polyfill=!0,t.fetch||(t.fetch=I,t.Headers=h,t.Request=w,t.Response=b),e.Headers=h,e.Request=w,e.Response=b,e.fetch=I,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},8679:function(t,e,a){"use strict";var n=a(9864),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};function c(t){return n.isMemo(t)?s:o[t.$$typeof]||i}o[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o[n.Memo]=s;var l=Object.defineProperty,d=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,h=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,_=Object.prototype;t.exports=function t(e,a,n){if("string"!=typeof a){if(_){var i=p(a);i&&i!==_&&t(e,i,n)}var s=d(a);u&&(s=s.concat(u(a)));for(var o=c(e),g=c(a),f=0;f=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,r.ctx.currentTime);for(var a=0;a=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,p()),t},codecs:function(t){return(this||r)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||r;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||r,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var a=e.canPlayType("audio/mpeg;").replace(/^no$/,""),n=t._navigator?t._navigator.userAgent:"",i=n.match(/OPR\/([0-6].)/g),s=i&&parseInt(i[0].split("/")[1],10)<33,o=-1!==n.indexOf("Safari")&&-1===n.indexOf("Chrome"),c=n.match(/Version\/(.*?) /),l=o&&c&&parseInt(c[1],10)<15;return t._codecs={mp3:!(s||!a&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!a,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(l||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(l||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||r;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(a){for(;t._html5AudioPool.length0?o._seek:a._sprite[t][0]/1e3),d=Math.max(0,(a._sprite[t][0]+a._sprite[t][1])/1e3-l),u=1e3*d/Math.abs(o._rate),h=a._sprite[t][0]/1e3,p=(a._sprite[t][0]+a._sprite[t][1])/1e3;o._sprite=t,o._ended=!1;var _=function(){o._paused=!1,o._seek=l,o._start=h,o._stop=p,o._loop=!(!o._loop&&!a._sprite[t][2])};if(!(l>=p)){var g=o._node;if(a._webAudio){var f=function(){a._playLock=!1,_(),a._refreshBuffer(o);var t=o._muted||a._muted?0:o._volume;g.gain.setValueAtTime(t,r.ctx.currentTime),o._playStart=r.ctx.currentTime,void 0===g.bufferSource.start?o._loop?g.bufferSource.noteGrainOn(0,l,86400):g.bufferSource.noteGrainOn(0,l,d):o._loop?g.bufferSource.start(0,l,86400):g.bufferSource.start(0,l,d),u!==1/0&&(a._endTimers[o._id]=setTimeout(a._ended.bind(a,o),u)),e||setTimeout((function(){a._emit("play",o._id),a._loadQueue()}),0)};"running"===r.state&&"interrupted"!==r.ctx.state?f():(a._playLock=!0,a.once("resume",f),a._clearTimer(o._id))}else{var m=function(){g.currentTime=l,g.muted=o._muted||a._muted||r._muted||g.muted,g.volume=o._volume*r.volume(),g.playbackRate=o._rate;try{var n=g.play();if(n&&"undefined"!=typeof Promise&&(n instanceof Promise||"function"==typeof n.then)?(a._playLock=!0,_(),n.then((function(){a._playLock=!1,g._unlocked=!0,e?a._loadQueue():a._emit("play",o._id)})).catch((function(){a._playLock=!1,a._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),o._ended=!0,o._paused=!0}))):e||(a._playLock=!1,_(),a._emit("play",o._id)),g.playbackRate=o._rate,g.paused)return void a._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||o._loop?a._endTimers[o._id]=setTimeout(a._ended.bind(a,o),u):(a._endTimers[o._id]=function(){a._ended(o),g.removeEventListener("ended",a._endTimers[o._id],!1)},g.addEventListener("ended",a._endTimers[o._id],!1))}catch(t){a._emit("playerror",o._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===g.src&&(g.src=a._src,g.load());var v=window&&window.ejecta||!g.readyState&&r._navigator.isCocoonJS;if(g.readyState>=3||v)m();else{a._playLock=!0,a._state="loading";var w=function(){a._state="loaded",m(),g.removeEventListener(r._canPlayEvent,w,!1)};g.addEventListener(r._canPlayEvent,w,!1),a._clearTimer(o._id)}}return o._id}a._ended(o)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var a=e._getSoundIds(t),n=0;n=0?e=parseInt(i[0],10):t=parseFloat(i[0])}else i.length>=2&&(t=parseFloat(i[0]),e=parseInt(i[1],10));if(!(void 0!==t&&t>=0&&t<=1))return(a=e?n._soundById(e):n._sounds[0])?a._volume:0;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"volume",action:function(){n.volume.apply(n,i)}}),n;void 0===e&&(n._volume=t),e=n._getSoundIds(e);for(var c=0;c0?n/l:n),u=Date.now();t._fadeTo=a,t._interval=setInterval((function(){var i=(Date.now()-u)/n;u=Date.now(),o+=c*i,o=Math.round(100*o)/100,o=c<0?Math.max(a,o):Math.min(a,o),s._webAudio?t._volume=o:s.volume(o,t._id,!0),r&&(s._volume=o),(ae&&o>=a)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,s.volume(a,t._id),s._emit("fade",t._id))}),d)},_stopFade:function(t){var e=this,a=e._soundById(t);return a&&a._interval&&(e._webAudio&&a._node.gain.cancelScheduledValues(r.ctx.currentTime),clearInterval(a._interval),a._interval=null,e.volume(a._fadeTo,t),a._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,a,n=this,i=arguments;if(0===i.length)return n._loop;if(1===i.length){if("boolean"!=typeof i[0])return!!(a=n._soundById(parseInt(i[0],10)))&&a._loop;t=i[0],n._loop=t}else 2===i.length&&(t=i[0],e=parseInt(i[1],10));for(var r=n._getSoundIds(e),s=0;s=0?e=parseInt(i[0],10):t=parseFloat(i[0])}else 2===i.length&&(t=parseFloat(i[0]),e=parseInt(i[1],10));if("number"!=typeof t)return(a=n._soundById(e))?a._rate:n._rate;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"rate",action:function(){n.rate.apply(n,i)}}),n;void 0===e&&(n._rate=t),e=n._getSoundIds(e);for(var c=0;c=0?e=parseInt(n[0],10):a._sounds.length&&(e=a._sounds[0]._id,t=parseFloat(n[0]))}else 2===n.length&&(t=parseFloat(n[0]),e=parseInt(n[1],10));if(void 0===e)return 0;if("number"==typeof t&&("loaded"!==a._state||a._playLock))return a._queue.push({event:"seek",action:function(){a.seek.apply(a,n)}}),a;var o=a._soundById(e);if(o){if(!("number"==typeof t&&t>=0)){if(a._webAudio){var c=a.playing(e)?r.ctx.currentTime-o._playStart:0,l=o._rateSeek?o._rateSeek-o._seek:0;return o._seek+(l+c*Math.abs(o._rate))}return o._node.currentTime}var d=a.playing(e);d&&a.pause(e,!0),o._seek=t,o._ended=!1,a._clearTimer(e),a._webAudio||!o._node||isNaN(o._node.duration)||(o._node.currentTime=t);var u=function(){d&&a.play(e,!0),a._emit("seek",e)};if(d&&!a._webAudio){var h=function(){a._playLock?setTimeout(h,0):u()};setTimeout(h,0)}else u()}return a},playing:function(t){var e=this;if("number"==typeof t){var a=e._soundById(t);return!!a&&!a._paused}for(var n=0;n=0&&r._howls.splice(n,1);var i=!0;for(a=0;a=0){i=!1;break}return c&&i&&delete c[t._src],r.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,a,n){var i=this["_on"+t];return"function"==typeof e&&i.push(n?{id:a,fn:e,once:n}:{id:a,fn:e}),this},off:function(t,e,a){var n=this,i=n["_on"+t],r=0;if("number"==typeof e&&(a=e,e=null),e||a)for(r=0;r=0;r--)i[r].id&&i[r].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,a)}.bind(n,i[r].fn),0),i[r].once&&n.off(t,i[r].fn,i[r].id));return n._loadQueue(t),n},_loadQueue:function(t){var e=this;if(e._queue.length>0){var a=e._queue[0];a.event===t&&(e._queue.shift(),e._loadQueue()),t||a.action()}return e},_ended:function(t){var e=this,a=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime=0;n--){if(a<=e)return;t._sounds[n]._ended&&(t._webAudio&&t._sounds[n]._node&&t._sounds[n]._node.disconnect(0),t._sounds.splice(n,1),a--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],a=0;a=0;if(r._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=r._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(r._navigator&&r._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var o=function(t){this._parent=t,this.init()};o.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++r._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,a=r._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===r.ctx.createGain?r.ctx.createGainNode():r.ctx.createGain(),t._node.gain.setValueAtTime(a,r.ctx.currentTime),t._node.paused=!0,t._node.connect(r.masterGain)):r.noAudio||(t._node=r._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(r._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=a*r.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++r._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(r._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var c={},l=function(t){var e=t._src;if(c[e])return t._duration=c[e].duration,void h(t);if(/^data:[^;]+;base64,/.test(e)){for(var a=atob(e.split(",")[1]),n=new Uint8Array(a.length),i=0;i0?(c[e._src]=t,h(e,t)):a()};"undefined"!=typeof Promise&&1===r.ctx.decodeAudioData.length?r.ctx.decodeAudioData(t).then(n).catch(a):r.ctx.decodeAudioData(t,n,a)},h=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},p=function(){if(r.usingWebAudio){try{"undefined"!=typeof AudioContext?r.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?r.ctx=new webkitAudioContext:r.usingWebAudio=!1}catch(t){r.usingWebAudio=!1}r.ctx||(r.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(r._navigator&&r._navigator.platform),e=r._navigator&&r._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),a=e?parseInt(e[1],10):null;if(t&&a&&a<9){var n=/safari/.test(r._navigator&&r._navigator.userAgent.toLowerCase());r._navigator&&!n&&(r.usingWebAudio=!1)}r.usingWebAudio&&(r.masterGain=void 0===r.ctx.createGain?r.ctx.createGainNode():r.ctx.createGain(),r.masterGain.gain.setValueAtTime(r._muted?0:r._volume,r.ctx.currentTime),r.masterGain.connect(r.ctx.destination)),r._setup()}};void 0===(n=function(){return{Howler:r,Howl:s}}.apply(e,[]))||(t.exports=n),e.Howler=r,e.Howl=s,void 0!==a.g?(a.g.HowlerGlobal=i,a.g.Howler=r,a.g.Howl=s,a.g.Sound=o):"undefined"!=typeof window&&(window.HowlerGlobal=i,window.Howler=r,window.Howl=s,window.Sound=o)}(),function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var a=e._howls.length-1;a>=0;a--)e._howls[a].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,a){var n=this;return n.ctx&&n.ctx.listener?(e="number"!=typeof e?n._pos[1]:e,a="number"!=typeof a?n._pos[2]:a,"number"!=typeof t?n._pos:(n._pos=[t,e,a],void 0!==n.ctx.listener.positionX?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]),n)):n},HowlerGlobal.prototype.orientation=function(t,e,a,n,i,r){var s=this;if(!s.ctx||!s.ctx.listener)return s;var o=s._orientation;return e="number"!=typeof e?o[1]:e,a="number"!=typeof a?o[2]:a,n="number"!=typeof n?o[3]:n,i="number"!=typeof i?o[4]:i,r="number"!=typeof r?o[5]:r,"number"!=typeof t?o:(s._orientation=[t,e,a,n,i,r],void 0!==s.ctx.listener.forwardX?(s.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),s.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),s.ctx.listener.forwardZ.setTargetAtTime(a,Howler.ctx.currentTime,.1),s.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),s.ctx.listener.upY.setTargetAtTime(i,Howler.ctx.currentTime,.1),s.ctx.listener.upZ.setTargetAtTime(r,Howler.ctx.currentTime,.1)):s.ctx.listener.setOrientation(t,e,a,n,i,r),s)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var a=this;return a._orientation=e.orientation||[1,0,0],a._stereo=e.stereo||null,a._pos=e.pos||null,a._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},a._onstereo=e.onstereo?[{fn:e.onstereo}]:[],a._onpos=e.onpos?[{fn:e.onpos}]:[],a._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,a){var n=this;if(!n._webAudio)return n;if("loaded"!==n._state)return n._queue.push({event:"stereo",action:function(){n.stereo(t,a)}}),n;var i=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===a){if("number"!=typeof t)return n._stereo;n._stereo=t,n._pos=[t,0,0]}for(var r=n._getSoundIds(a),s=0;s/i,h=//i,p=/<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi,_=s.isIE(9),g=_||s.isIE();if("function"==typeof window.DOMParser){var f=new window.DOMParser,m=_?"text/xml":"text/html";n=function(t,e){return e&&(t="<"+e+">"+t+""),_&&(t=t.replace(p,"<$1$2$3/>")),f.parseFromString(t,m)}}if("object"==typeof document.implementation){var v=document.implementation.createHTMLDocument(g?"HTML_DOM_PARSER_TITLE":void 0);i=function(t,e){if(e)return v.documentElement.getElementsByTagName(e)[0].innerHTML=t,v;try{return v.documentElement.innerHTML=t,v}catch(e){if(n)return n(t)}}}var w=document.createElement("template");w.content&&(r=function(t){return w.innerHTML=t,w.content.childNodes});var y=i||n;t.exports=function(t){var e,a,i,s,p=t.match(d);switch(p&&p[1]&&(e=p[1].toLowerCase()),e){case o:if(n)return a=n(t),u.test(t)||(i=a.getElementsByTagName(c)[0])&&i.parentNode.removeChild(i),h.test(t)||(i=a.getElementsByTagName(l)[0])&&i.parentNode.removeChild(i),a.getElementsByTagName(o);break;case c:case l:if(y)return s=y(t).getElementsByTagName(e),h.test(t)&&u.test(t)?s[0].parentNode.childNodes:s;break;default:if(r)return r(t);if(y)return y(t,l).getElementsByTagName(l)[0].childNodes}return[]}},5057:function(t,e,a){var n=a(6982),i=a(3412),r=i.formatDOM,s=i.isIE(9),o=/<(![a-zA-Z\s]+)>/;t.exports=function(t){if("string"!=typeof t)throw new TypeError("First argument must be a string");if(!t)return[];var e,a=t.match(o);return a&&a[1]&&(e=a[1],s&&(t=t.replace(a[0],""))),r(n(t),null,e)}},3412:function(t,e,a){for(var n,i=a(9804).CASE_SENSITIVE_TAG_NAMES,r={},s=0,o=i.length;s=0;--r){var s=this.tryEntries[r],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(c&&l){if(this.prev=0;--a){var i=this.tryEntries[a];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var a=this.tryEntries[e];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),T(a),_}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var a=this.tryEntries[e];if(a.tryLoc===t){var n=a.completion;if("throw"===n.type){var i=n.arg;T(a)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,a,n){return this.delegate={iterator:k(t),resultName:a,nextLoc:n},"next"===this.method&&(this.arg=e),_}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},53:function(t,e){"use strict";var a,n,i,r,s;if("undefined"==typeof window||"function"!=typeof MessageChannel){var o=null,c=null,l=function(){if(null!==o)try{var t=e.unstable_now();o(!0,t),o=null}catch(t){throw setTimeout(l,0),t}},d=Date.now();e.unstable_now=function(){return Date.now()-d},a=function(t){null!==o?setTimeout(a,0,t):(o=t,setTimeout(l,0))},n=function(t,e){c=setTimeout(t,e)},i=function(){clearTimeout(c)},r=function(){return!1},s=e.unstable_forceFrameRate=function(){}}else{var u=window.performance,h=window.Date,p=window.setTimeout,_=window.clearTimeout;if("undefined"!=typeof console){var g=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof g&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof u&&"function"==typeof u.now)e.unstable_now=function(){return u.now()};else{var f=h.now();e.unstable_now=function(){return h.now()-f}}var m=!1,v=null,w=-1,y=5,b=0;r=function(){return e.unstable_now()>=b},s=function(){},e.unstable_forceFrameRate=function(t){0>t||125>>1,i=t[n];if(!(void 0!==i&&0C(s,a))void 0!==c&&0>C(c,s)?(t[n]=c,t[o]=a,n=o):(t[n]=s,t[r]=a,n=r);else{if(!(void 0!==c&&0>C(c,a)))break t;t[n]=c,t[o]=a,n=o}}}return e}return null}function C(t,e){var a=t.sortIndex-e.sortIndex;return 0!==a?a:t.id-e.id}var k=[],O=[],A=1,x=null,M=3,P=!1,L=!1,R=!1;function B(t){for(var e=S(O);null!==e;){if(null===e.callback)T(O);else{if(!(e.startTime<=t))break;T(O),e.sortIndex=e.expirationTime,D(k,e)}e=S(O)}}function N(t){if(R=!1,B(t),!L)if(null!==S(k))L=!0,a(F);else{var e=S(O);null!==e&&n(N,e.startTime-t)}}function F(t,a){L=!1,R&&(R=!1,i()),P=!0;var s=M;try{for(B(a),x=S(k);null!==x&&(!(x.expirationTime>a)||t&&!r());){var o=x.callback;if(null!==o){x.callback=null,M=x.priorityLevel;var c=o(x.expirationTime<=a);a=e.unstable_now(),"function"==typeof c?x.callback=c:x===S(k)&&T(k),B(a)}else T(k);x=S(k)}if(null!==x)var l=!0;else{var d=S(O);null!==d&&n(N,d.startTime-a),l=!1}return l}finally{x=null,M=s,P=!1}}function U(t){switch(t){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var H=s;e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.callback=null},e.unstable_continueExecution=function(){L||P||(L=!0,a(F))},e.unstable_getCurrentPriorityLevel=function(){return M},e.unstable_getFirstCallbackNode=function(){return S(k)},e.unstable_next=function(t){switch(M){case 1:case 2:case 3:var e=3;break;default:e=M}var a=M;M=e;try{return t()}finally{M=a}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=H,e.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var a=M;M=t;try{return e()}finally{M=a}},e.unstable_scheduleCallback=function(t,r,s){var o=e.unstable_now();if("object"==typeof s&&null!==s){var c=s.delay;c="number"==typeof c&&0o?(t.sortIndex=c,D(O,t),null===S(k)&&t===S(O)&&(R?i():R=!0,n(N,c-o))):(t.sortIndex=s,D(k,t),L||P||(L=!0,a(F))),t},e.unstable_shouldYield=function(){var t=e.unstable_now();B(t);var a=S(k);return a!==x&&null!==x&&null!==a&&null!==a.callback&&a.startTime<=t&&a.expirationTime=this.touchStartX?(this.onSwipeRightAgent&&this.onSwipeRightAgent(),"swiped right"):this.touchEndY+this.options.threshold<=this.touchStartY?(this.onSwipeUpAgent&&this.onSwipeUpAgent(),"swiped up"):this.touchEndY-this.options.threshold>=this.touchStartY?(this.onSwipeDownAgent&&this.onSwipeDownAgent(),"swiped down"):this.touchEndY===this.touchStartY?(this.onTapAgent&&this.onTapAgent(),"tap"):void 0}}}},__webpack_module_cache__={},deferred,leafPrototypes,getProto,inProgress,dataWebpackPrefix;function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var a=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(a.exports,a,a.exports,__webpack_require__),a.exports}__webpack_require__.m=__webpack_modules__,deferred=[],__webpack_require__.O=function(t,e,a,n){if(!e){var i=1/0;for(c=0;c=n)&&Object.keys(__webpack_require__.O).every((function(t){return __webpack_require__.O[t](e[s])}))?e.splice(s--,1):(r=!1,n0&&deferred[c-1][2]>n;c--)deferred[c]=deferred[c-1];deferred[c]=[e,a,n]},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,{a:e}),e},getProto=Object.getPrototypeOf?function(t){return Object.getPrototypeOf(t)}:function(t){return t.__proto__},__webpack_require__.t=function(t,e){if(1&e&&(t=this(t)),8&e)return t;if("object"==typeof t&&t){if(4&e&&t.__esModule)return t;if(16&e&&"function"==typeof t.then)return t}var a=Object.create(null);__webpack_require__.r(a);var n={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var i=2&e&&t;"object"==typeof i&&!~leafPrototypes.indexOf(i);i=getProto(i))Object.getOwnPropertyNames(i).forEach((function(e){n[e]=function(){return t[e]}}));return n.default=function(){return t},__webpack_require__.d(a,n),a},__webpack_require__.d=function(t,e){for(var a in e)__webpack_require__.o(e,a)&&!__webpack_require__.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},__webpack_require__.f={},__webpack_require__.e=function(t){return Promise.all(Object.keys(__webpack_require__.f).reduce((function(e,a){return __webpack_require__.f[a](t,e),e}),[]))},__webpack_require__.u=function(t){return t+"."+{218:"5fd9b6569a5e09b99c04",261:"7a317c455be0706d739d",307:"743838d3441f79e939a9",476:"430b407336b2c532e572",502:"7d9075974af1f1c56a6a",536:"daa69d70da79b79bc1ec",610:"c7e436abad4aaa076cad",800:"8c3bfdb4ac7cf39ec020",815:"8e6ab21729cb74142161",906:"2159cf8d9f1f8d4b1854"}[t]+".js"},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},inProgress={},dataWebpackPrefix="LHCReactAPP:",__webpack_require__.l=function(t,e,a,n){if(inProgress[t])inProgress[t].push(e);else{var i,r;if(void 0!==a)for(var s=document.getElementsByTagName("script"),o=0;o {\n if (persistent){\n dispatch({type: \"CANCEL_INVITATION\"});\n } else {\n dispatch({type: \"HIDE_INVITATION\"});\n }\n })\n .catch((err) => {\n console.log(err);\n })\n }\n}\n\nexport function minimizeWidget(forceClose) {\n return function(dispatch, getState) {\n const state = getState();\n if (state.chatwidget.getIn(['proactive','has']) === true) {\n hideInvitation()(dispatch, getState);\n } else {\n helperFunctions.sendMessageParent('closeWidget', [{'sender' : 'closeButton'}]);\n }\n if (forceClose && (window.lhcChat['mode'] == 'popup' || window.lhcChat['mode'] == 'embed')) {\n helperFunctions.removeSessionStorage('_chat');\n helperFunctions.removeSessionStorage('_reset_chat');\n window.close();\n }\n }\n}\n\nexport function cancelPresurvey(confirm) {\n return function(dispatch, getState) {\n const state = getState();\n\n let args = '';\n\n if (state.chatwidget.get('theme')) {\n args = args + '/(theme)/' + state.chatwidget.get('theme');\n }\n\n if (confirm === true) {\n args = args + '/(confirm)/true';\n }\n\n axios.post(window.lhcChat['base_url'] + state.chatwidget.getIn(['chat_ui','pre_survey_url']) + state.chatwidget.getIn(['chatData','id']) + '/' + state.chatwidget.getIn(['chatData','hash']) + args, null, defaultHeaders).then((response) => {\n if (confirm === false || response.data.confirmed) {\n dispatch({'type' : 'UI_STATE', 'data' : {'attr': 'pre_survey_done', 'val': 2}});\n if (!state.chatwidget.hasIn(['chat_ui','survey_id'])) {\n helperFunctions.sendMessageParent('endChat',[{'sender' : 'endButton'}]);\n }\n }\n })\n .catch((err) => {\n console.log(err);\n })\n }\n}\n\nexport function endChat(obj, action) {\n action = action || \"t\";\n return function(dispatch, getState) {\n clearTimeout(syncStatus.auto_close_timeout);\n axios.post(window.lhcChat['base_url'] + \"chat/chatwidgetclosed/(eclose)/\"+action+\"/(hash)/\" + obj['chat']['id'] +'_'+ obj['chat']['hash'] + '/(vid)/' + obj['vid'] + '/(close)/' + (!obj.noClose ? '1' : '0'), null, defaultHeaders)\n .then((response) => {\n if (!obj.noClose) {\n if (window.lhcChat['mode'] == 'popup') {\n helperFunctions.removeSessionStorage('_chat');\n helperFunctions.removeSessionStorage('_reset_chat');\n // We try to close window at first place\n window.close();\n\n // If it's direct chat window we have to show start chat form\n helperFunctions.eventEmitter.emitEvent('endedChat', [{'chat_id':obj['chat']['id'], 'hash': obj['chat']['hash']}]);\n } else {\n helperFunctions.sendMessageParent('endChat', [{show_start: obj['show_start'], 'sender' : 'endButton'}]);\n }\n } else {\n dispatch({type: \"INIT_CLOSE\", data: obj})\n }\n })\n .catch((err) => {\n console.log(err);\n })\n }\n}\n\nexport function setSiteAccess(payload) {\n return axios.post(window.lhcChat['base_url'] + \"widgetrestapi/setsiteaccess/\", payload, defaultHeaders);\n}\n\nexport function getProducts(obj) {\n return function(dispatch) {\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/getproducts/\" + obj['dep_id'], null, defaultHeaders)\n .then((response) => {\n dispatch({type: \"INIT_PRODUCTS\", data: response.data})\n })\n .catch((err) => {\n console.log(err);\n })\n }\n}\n\nexport function voteAction(obj) {\n return axios.post(window.lhcChat['base_url'] + \"chat/voteaction/\" + obj.id + '/' + obj.hash + '/' + obj.type, null, defaultHeaders)\n}\n\nexport function updateMessageData(obj, payload) {\n return axios.post(window.lhcChat['base_url'] + \"chat/updatemessagedata/\" + obj.id + '/' + obj.hash + '/' + obj.msg_id, payload, defaultHeaders)\n}\n\nexport function transferToHumanAction(obj) {\n return axios.post(window.lhcChat['base_url'] + \"chat/transfertohuman/\" + obj.id + '/' + obj.hash, null, defaultHeaders)\n}\n\nexport function initProactive(data) {\n return function(dispatch, getState) {\n const state = getState();\n\n let payload = {\n 'invitation' : data.invitation,\n 'vid_id' : data.vid_id,\n 'uts' : (new Date()).getTime()\n };\n\n if (state.chatwidget.get('theme')) {\n payload['theme'] = state.chatwidget.get('theme');\n }\n\n if (state.chatwidget.get('vid')) {\n payload['vid'] = state.chatwidget.get('vid');\n }\n\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/getinvitation\", payload, defaultHeaders).then((response) => {\n if (response.data.chat_id && response.data.chat_hash) {\n dispatch({type: \"ONLINE_SUBMITTED\", data: {\n success : true,\n chatData : {\n id : response.data.chat_id,\n hash : response.data.chat_hash\n }\n }});\n showMessageSnippet({'id' : response.data.chat_id, 'hash' : response.data.chat_hash})(dispatch, getState);\n } else {\n dispatch({type: \"PROACTIVE\", data: response.data})\n }\n });\n }\n}\n\nexport function showMessageSnippet(obj) {\n return function(dispatch, getState) {\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/getmessagesnippet\", obj, defaultHeaders)\n .then((response) => {\n helperFunctions.sendMessageParent('msgSnippet',[response.data]);\n const state = getState();\n helperFunctions.emitEvent('play_sound', [{'type' : 'new_chat','sound_on' : (state.chatwidget.getIn(['usersettings','soundOn']) === true), 'widget_open' : false}]);\n })\n .catch((err) => {\n })\n }\n}\n\nexport function storeSubscriber(payload) {\n return function(dispatch, getState) {\n const state = getState();\n\n let args = '/(action)/sub';\n\n if (state.chatwidget.hasIn(['chatData','id']) && state.chatwidget.hasIn(['chatData','hash'])) {\n args = args + '/(hash)/' + state.chatwidget.getIn(['chatData','id']) + '_' + state.chatwidget.getIn(['chatData','hash']);\n }\n\n if (state.chatwidget.get('theme')) {\n args = args + '/(theme)/' + state.chatwidget.get('theme');\n }\n\n if (state.chatwidget.get('vid')) {\n args = args + '/(vid)/' + state.chatwidget.get('vid');\n }\n\n axios.post(window.lhcChat['base_url'] + \"notifications/subscribe\" +args, {'data' : payload}, defaultHeaders)\n .then((response) => {\n if (state.chatwidget.hasIn(['chatData','id']) && state.chatwidget.hasIn(['chatData','hash'])) {\n dispatch(fetchMessages({\n 'chat_id': state.chatwidget.getIn(['chatData','id']),\n 'hash' : state.chatwidget.getIn(['chatData','hash']),\n 'lmgsid' : state.chatwidget.getIn(['chatLiveData','lmsgid']),\n 'theme' : state.chatwidget.get('theme'),\n 'active_widget' : true\n }));\n }\n })\n }\n}\n\nexport function updateTriggerClicked(typeParams, params) {\n return function(dispatch, getState) {\n const state = getState();\n return axios.post(window.lhcChat['base_url'] + \"genericbot/\"+(typeParams.mainType ? typeParams.mainType : \"buttonclicked\")+\"/\" + state.chatwidget.getIn(['chatData','id']) + '/' + state.chatwidget.getIn(['chatData','hash']) + typeParams.type, params, defaultHeaders)\n }\n}\n\nexport function subscribeNotifications(params) {\n return function(dispatch, getState) {\n const state = getState();\n helperFunctions.sendMessageParent('subscribeEvent', [{'pk' : state.chatwidget.getIn(['chat_ui','notifications_pk'])}]);\n }\n}\n\nexport function initOfflineForm(obj) {\n return function(dispatch) {\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/onlinesettings\", obj, defaultHeaders)\n .then((response) => {\n dispatch({type: \"OFFLINE_FIELDS_UPDATED\", data: response.data})\n })\n .catch((err) => {\n dispatch({type: \"OFFLINE_FIELDS_REJECTED\", data: err})\n })\n }\n}\n\nexport function initOnlineForm(obj) {\n return function(dispatch) {\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/onlinesettings\", obj, defaultHeaders)\n .then((response) => {\n if (response.data.paid.continue && response.data.paid.continue === true) {\n dispatch({type: \"ONLINE_SUBMITTED\", data: {\n success : true,\n chatData : {\n id : response.data.paid.id,\n hash : response.data.paid.hash\n }\n }});\n } else {\n dispatch({type: \"ONLINE_FIELDS_UPDATED\", data: response.data})\n }\n })\n .catch((err) => {\n dispatch({type: \"ONLINE_FIELDS_REJECTED\", data: err})\n })\n }\n}\n\nexport function getCaptcha(dispatch, form, obj) {\n var date = new Date();\n var timestamp = Math.round(date.getTime()/1000);\n axios.post(window.lhcChat['base_url'] + \"captcha/captchastring/fake/\" + timestamp, null, defaultHeaders)\n .then((response) => {\n dispatch({type: \"captcha\", data: {'hash' : response.data.result, 'ts' : timestamp}});\n\n // Update submit object instantly\n obj.fields['captcha_' + response.data.result] = timestamp;\n obj.fields['tscaptcha'] = timestamp;\n\n // We auto resubmit only one time\n if (!obj.fields['tscaptcha_resubmit']) {\n obj.fields['tscaptcha_resubmit'] = 1;\n form(obj)(dispatch);\n } else {\n delete obj.fields['tscaptcha_resubmit'];\n }\n\n });\n}\n\nexport function submitOnlineForm(obj) {\n return function(dispatch) {\n dispatch({type: \"ONLINE_SUBMITTING\"});\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/submitonline\", obj, defaultHeaders)\n .then((response) => {\n\n // If validation contains invalid captcha update it instantly\n if (response.data.success === false && response.data.errors.captcha) {\n getCaptcha(dispatch, submitOnlineForm, obj);\n if (!obj.fields['tscaptcha_resubmit']) {\n return;\n }\n }\n\n dispatch({type: \"ONLINE_SUBMITTED\", data: response.data});\n\n if (response.data.t) {\n helperFunctions.sendMessageParent('botTrigger',[{'trigger' : response.data.t}]);\n }\n\n })\n .catch((err) => {\n dispatch({type: \"ONLINE_SUBMITT_REJECTED\", data: err})\n })\n }\n}\n\nexport function submitOfflineForm(obj) {\n return function(dispatch) {\n dispatch({type: \"OFFLINE_SUBMITTING\"});\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/submitoffline\", obj, {headers: { 'Content-Type': 'multipart/form-data'}})\n .then((response) => {\n\n // If validation contains invalid captcha update it instantly\n if (response.data.success === false && response.data.errors.captcha) {\n getCaptcha(dispatch, submitOfflineForm, obj);\n if (!obj.fields['tscaptcha_resubmit']) {\n return;\n }\n }\n\n dispatch({type: \"OFFLINE_SUBMITTED\", data: response.data})\n })\n .catch((err) => {\n dispatch({type: \"OFFLINE_SUBMITT_REJECTED\", data: err})\n })\n }\n}\n\nexport function updateUISettings(obj) {\n return function(dispatch, getState) {\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/uisettings\", obj, defaultHeaders)\n .then((response) => {\n dispatch({type: \"REFRESH_UI_COMPLETED\", data: response.data})\n })\n .catch((err) => {\n console.log(err);\n dispatch({type: \"REFRESH_UI_REJECTED\", data: err})\n })\n }\n}\n\nexport function initChatUI(obj) {\n\n // We should always sync chat status\n // As this value can be true if visitor starts another chat just\n syncStatus.status = false;\n\n return function(dispatch, getState) {\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/initchat\", obj, defaultHeaders)\n .then((response) => {\n dispatch({type: \"INIT_CHAT_SUBMITTED\", data: response.data})\n\n if (response.data.init_calls) {\n response.data.init_calls.forEach((callExtension) => {\n if (callExtension.extension === 'nodeJSChat') {\n import('../extensions/nodejs/nodeJSChat').then((module) => {\n module.nodeJSChat.bootstrap(callExtension.params, dispatch, getState);\n });\n\n } else if (callExtension.extension === 'dummy_extensions') {\n // Import your extension here\n }\n });\n }\n })\n .catch((err) => {\n console.log(err);\n dispatch({type: \"INIT_CHAT_REJECTED\", data: err})\n })\n }\n}\n\nfunction processResponseCheckStatus(response, getState, dispatch) {\n if (response.op) {\n\n response.op.forEach((op) => {\n var action = op.split(':')[0];\n if (action == 'lhc_chat_redirect') {\n helperFunctions.sendMessageParent('location',[op.split(':')[1].replace(new RegExp('__SPLIT__','g'),':')]);\n } else if (action == 'lhc_screenshot') {\n\n const state = getState();\n\n var append = '';\n\n if ( state.chatwidget.hasIn(['chatData','id'])) {\n append = append + '/(hash)/' + state.chatwidget.getIn(['chatData','id']) + '_' + state.chatwidget.getIn(['chatData','hash']);\n }\n\n if ( state.chatwidget.get('vid')) {\n append = append + '/(vid)/' + state.chatwidget.get('vid');\n }\n\n helperFunctions.sendMessageParent('screenshot',[window.lhcChat['base_url'] + 'file/storescreenshot' + append]);\n } else if (action == 'lhc_cobrowse') {\n helperFunctions.sendMessageParent('screenshare',[]);\n } else if (action == 'lhc_cobrowse_cmd') {\n helperFunctions.sendMessageParent('screenshareCommand',[op]);\n } else if (action == 'lhc_ui_refresh') {\n const state = getState();\n updateUISettings({'id' : state.chatwidget.getIn(['chatData','id']), 'hash' : state.chatwidget.getIn(['chatData','hash'])})(dispatch, getState);\n } else if (action.indexOf('lhinst.updateMessageRow') !== -1) {\n const state = getState();\n updateMessage({'msg_id' : action.replace('lhinst.updateMessageRow(','').replace(')',''), 'lmgsid' : state.chatwidget.getIn(['chatLiveData','lmsgid']), 'mode' : state.chatwidget.get('mode'), 'theme' : state.chatwidget.get('theme'), 'id' : state.chatwidget.getIn(['chatData','id']), 'hash' : state.chatwidget.getIn(['chatData','hash'])})(dispatch, getState);\n }\n });\n }\n}\n\nexport function updateMessage(obj) {\n return function(dispatch, getState) {\n const state = getState();\n\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/fetchmessage\", obj, defaultHeaders)\n .then((response) => {\n\n // Get present className of the row\n let elm = document.getElementById('msg-'+response.data.id);\n let classNameRow = null;\n if (elm !== null) {\n classNameRow = elm.className;\n }\n\n // Now we can update as we know a class\n dispatch({type: \"FETCH_MESSAGE_SUBMITTED\", data: response.data});\n\n // Reselect updated row\n elm = document.getElementById('msg-'+response.data.id);\n\n // Update className\n if (elm && classNameRow !== null) {\n elm.className = classNameRow;\n }\n\n // Just adjust a scroll\n if (!obj.no_scroll) {\n let elmScroll = document.getElementById('messages-scroll');\n if (elmScroll !== null) {\n elmScroll.scrollTop = elmScroll.scrollHeight + 1000;\n }\n }\n })\n .catch((err) => {\n console.log(err);\n })\n }\n}\n\nexport function parseScript(domNode, inst, obj, dispatch, getState) {\n const attr = domNode.attribs || domNode;\n\n if (attr['data-bot-action'] == 'lhinst.disableVisitorEditor') {\n inst.disableEditor = true;\n } else if (attr['data-bot-action'] == 'lhinst.setDelay') {\n inst.delayData.push(JSON.parse(attr['data-bot-args']));\n } else if (attr['data-bot-action'] == 'button-click') {\n dispatch(updateTriggerClicked({'type' : '/(type)/'+attr['data-action-type'] + (obj.theme ? '/(theme)/' + obj.theme : '')}, {\n \"payload-id\": (typeof attr['data-identifier'] === 'undefined' ? null : attr['data-identifier']),\n payload: attr['data-payload'],\n id : attr['data-id'],\n processed : (typeof attr['data-keep'] === 'undefined')})).then((data) => {\n if (data.data.t) {\n helperFunctions.sendMessageParent('botTrigger', [{'trigger' : data.data.t}]);\n }\n if (data.data.update_message) {\n const state = getState();\n updateMessage({'no_scroll' : true, 'msg_id' : attr['data-id'], 'lmgsid' : state.chatwidget.getIn(['chatLiveData','lmsgid']), 'mode' : state.chatwidget.get('mode'), 'theme' : state.chatwidget.get('theme'), 'id' : state.chatwidget.getIn(['chatData','id']), 'hash' : state.chatwidget.getIn(['chatData','hash'])})(dispatch, getState);\n } else {\n fetchMessages({'theme' : obj.theme, 'chat_id' : obj.id, 'lmgsid' : obj.lmgsid, 'hash' : obj.hash})(dispatch, getState);\n checkChatStatus({\n 'chat_id': obj.id,\n 'hash' : obj.hash,\n 'theme' : obj.theme,\n 'mode' : obj.mode\n })\n }\n });\n\n } else if (attr['data-bot-action'] == 'execute-js') {\n if (attr['data-bot-extension']) {\n var args = {};\n if (typeof attr['data-bot-args'] !== 'undefined') {\n args = JSON.parse(attr['data-bot-args']);\n }\n helperFunctions.emitEvent('extensionExecute',[attr['data-bot-extension'],[args]]);\n } else if (attr['data-bot-emit']) {\n var args = {};\n if (typeof attr['data-bot-args'] !== 'undefined') {\n args = JSON.parse(attr['data-bot-args']);\n }\n helperFunctions.emitEvent(attr['data-bot-emit'],[args]);\n } else if (attr['data-bot-event']) {\n inst.props[attr['data-bot-event']]();\n } else {\n if (attr.src) {\n var th = document.getElementsByTagName('head')[0];\n var s = document.createElement('script');\n s.setAttribute('type','text/javascript');\n s.setAttribute('src', attr.src);\n th.appendChild(s);\n } else if (typeof domNode.children[0] !== 'undefined' && typeof domNode.children[0]['data'] !== 'undefined') {\n eval(domNode.children[0]['data']);\n }\n }\n }\n}\n\nfunction isNetworkError(err) {\n return !!err.isAxiosError && !err.response;\n}\n\nexport function fetchMessages(obj) {\n return function(dispatch, getState) {\n\n if (syncStatus.msg == true || syncStatus.add_msg == true) {\n return;\n }\n\n syncStatus.msg = true;\n\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/fetchmessages\", obj, defaultHeaders)\n .then((response) => {\n\n try {\n dispatch({type: \"FETCH_MESSAGES_SUBMITTED\", data: response.data});\n\n processResponseCheckStatus(response.data, getState, dispatch);\n\n helperFunctions.emitEvent('chat.fetch_messages',[response.data, dispatch, getState]);\n\n if (response.data.cs || (response.data.closed && response.data.closed === true)) {\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/checkchatstatus\", obj, defaultHeaders)\n .then((response) => {\n if (response.data.deleted) {\n helperFunctions.sendMessageParent('endChat',[{'sender' : 'endButton'}]);\n clearTimeout(syncStatus.auto_close_timeout);\n } else {\n dispatch({type: \"CHECK_CHAT_STATUS_FINISHED\", data: response.data});\n helperFunctions.emitEvent('chat.check_status',[response.data, dispatch, getState]);\n }\n if (response.data.closed && response.data.closed === true && !response.data.deleted) {\n setAutoClose(getState);\n }\n })\n .catch((err) => {\n dispatch({type: \"CHECK_CHAT_STATUS_REJECTED\", data: err})\n })\n }\n\n } catch (e) {\n throw e;\n } finally {\n syncStatus.msg = false;\n }\n\n })\n .catch((err) => {\n\n if (isNetworkError(err)) {\n dispatch({type: \"NO_CONNECTION\", data: true});\n }\n\n syncStatus.msg = false;\n })\n }\n}\n\nexport function checkChatStatus(obj) {\n return function(dispatch, getState) {\n\n if (syncStatus.status == true) {\n return;\n }\n\n syncStatus.status = true;\n\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/checkchatstatus\", obj, defaultHeaders)\n .then((response) => {\n if (response.data.deleted) {\n helperFunctions.sendMessageParent('endChat',[{'sender' : 'endButton'}]);\n clearTimeout(syncStatus.auto_close_timeout);\n } else {\n syncStatus.status = false;\n dispatch({type: \"CHECK_CHAT_STATUS_FINISHED\", data: response.data});\n helperFunctions.emitEvent('chat.check_status',[response.data, dispatch, getState]);\n }\n if (response.data.closed && response.data.closed === true && !response.data.deleted) {\n setAutoClose(getState);\n }\n })\n .catch((err) => {\n syncStatus.status = false;\n })\n }\n}\n\nfunction setAutoClose(getState) {\n const state = getState();\n if (state.chatwidget.hasIn(['chat_ui','open_timeout'])) {\n clearTimeout(syncStatus.auto_close_timeout);\n syncStatus.auto_close_timeout = setTimeout(function(){\n helperFunctions.sendMessageParent('endChat',[{'sender' : 'endButton'}]);\n clearTimeout(syncStatus.auto_close_timeout);\n },state.chatwidget.getIn(['chat_ui','open_timeout']) * 1000);\n }\n}\n\nexport function pageUnload() {\n return function(dispatch, getState) {\n const state = getState();\n\n let surveyMode = false\n let surveyByVisitor = (state.chatwidget.hasIn(['chatLiveData','status_sub']) && (state.chatwidget.getIn(['chatLiveData','status_sub']) == STATUS_SUB_CONTACT_FORM || state.chatwidget.getIn(['chatLiveData','status_sub']) == STATUS_SUB_SURVEY_SHOW || (state.chatwidget.getIn(['chatLiveData','status_sub']) == STATUS_SUB_USER_CLOSED_CHAT && (state.chatwidget.getIn(['chatLiveData','uid']) > 0 || state.chatwidget.getIn(['chatLiveData','status']) === STATUS_BOT_CHAT))));\n let surveyByOperator = (state.chatwidget.getIn(['chatLiveData','status']) == STATUS_CLOSED_CHAT && state.chatwidget.getIn(['chatLiveData','uid']) > 0);\n\n if ((surveyByVisitor == true || surveyByOperator) && state.chatwidget.hasIn(['chat_ui','survey_id'])) {\n // If survey button is required and we have not went to survey yet\n if ((!state.chatwidget.hasIn(['chat_ui','survey_button']) || state.chatwidget.getIn(['chat_ui_state','show_survey']) === 1) || surveyByVisitor == true) {\n surveyMode = true;\n }\n }\n\n /**\n * Unload always if we have this options in theme and chat is in survey mode on mobile or is unloading in general desktop application\n * */\n if (state.chatwidget.hasIn(['chat_ui','close_on_unload']) && state.chatwidget.get('mode') == 'embed') {\n if (state.chatwidget.get('isMobile') === false || surveyMode === true) {\n helperFunctions.sendMessageParent('endChat',[{'sender' : 'endButton'}]);\n }\n }\n\n // If popoup is closed\n if (state.chatwidget.get('mode') == 'popup' && surveyMode == true) {\n helperFunctions.sendMessageParent('endChat',[{'sender' : 'endButton'}]);\n }\n\n if (state.chatwidget.hasIn(['chatData','id']) && state.chatwidget.hasIn(['chatData','hash'])) {\n axios.post(window.lhcChat['base_url'] + \"chat/userclosechat/\" + state.chatwidget.getIn(['chatData','id']) + '/' + state.chatwidget.getIn(['chatData','hash']), null, defaultHeaders);\n } else if (state.chatwidget.getIn(['proactive','has']) === true && window.lhcChat['mode'] == 'popup' && window.opener) {\n hideInvitation()(dispatch, getState);\n }\n }\n}\n\nfunction checkErrorCounter() {\n if (syncStatus.error_counter == 2) {\n // Restart widget on second error\n helperFunctions.sendMessageParent('reloadWidget',[]);\n }\n}\n\nexport function addMessage(obj, ignoreAdd) {\n return function(dispatch, getState) {\n\n if (!ignoreAdd) {\n dispatch({type: \"ADD_MSG_TO_STORE\", data: obj.msg});\n }\n\n if (syncStatus.add_msg == true) {\n syncStatus.add_msg_pending.push(obj);\n return;\n }\n\n syncStatus.add_msg = true;\n\n try {\n helperFunctions.eventEmitter.emitEvent('messageSend', [{'chat_id':obj.id, 'hash': obj.hash, msg: obj.msg}]);\n } catch (error) {\n helperFunctions.logJSError({\n 'stack' : JSON.stringify(JSON.stringify(error))\n });\n }\n\n axios.post(window.lhcChat['base_url'] + \"widgetrestapi/addmsguser\", obj, defaultHeaders)\n .then((response) => {\n try {\n // Update error state if it changed\n if (response.data.error || getState().chatwidget.getIn(['chatLiveData','error'])) {\n dispatch({type: \"ADD_MESSAGES_SUBMITTED\", data: {r: response.data.r, msg: obj.msg}});\n }\n \n syncStatus.add_msg = false;\n \n fetchMessages({'active_widget': true, 'theme' : obj.theme, 'chat_id' : obj.id, 'lmgsid' : getState().chatwidget.getIn(['chatLiveData','lmsgid']), 'hash' : obj.hash})(dispatch, getState);\n\n if (response.data.t) {\n helperFunctions.sendMessageParent('botTrigger',[{'trigger' : response.data.t}]);\n }\n\n if (typeof response.data.r === 'undefined' || (response.data.error === true && response.data.system === true)) {\n\n syncStatus.error_counter++;\n\n // Log error only if it happens two times in a row\n if (syncStatus.error_counter == 2) {\n helperFunctions.logJSError({\n 'stack' : JSON.stringify(JSON.stringify(response) + \"\\nRD:\"+JSON.stringify(response.data) +\"\\nRH:\"+ JSON.stringify(response.headers) +\"\\nRS:\"+ JSON.stringify(response.status))\n });\n\n checkErrorCounter();\n }\n\n helperFunctions.eventEmitter.emitEvent('messageSendError', [{'chat_id':obj.id, 'hash': obj.hash, msg: JSON.stringify(response.data)}]);\n } else {\n syncStatus.error_counter = 0;\n }\n } catch (e) {\n throw e;\n } finally {\n syncStatus.add_msg = false;\n // There is pending message to be added\n if (syncStatus.add_msg_pending.length > 0) {\n addMessage(syncStatus.add_msg_pending.shift(), true)(dispatch, getState);\n }\n }\n })\n .catch((error) => {\n if (isNetworkError(error)) {\n dispatch({type: \"ADD_MESSAGES_SUBMITTED\", data: {r: \"SEND_CONNECTION\", \"msg\" : obj.msg}});\n dispatch({type: \"NO_CONNECTION\", data: true});\n } else {\n syncStatus.error_counter++;\n\n var stack = null;\n\n // Error\n if (error.response) {\n stack = JSON.stringify(JSON.stringify(error) + \"\\nRD:\"+JSON.stringify(error.response.data) +\"\\nRH:\"+ JSON.stringify(error.response.headers) +\"\\nRS:\"+ JSON.stringify(error.response.status));\n } else if (error.request) {\n stack = JSON.stringify(JSON.stringify(error));\n } else {\n stack = JSON.stringify(JSON.stringify(error));\n }\n\n // Log error only if it happens two times in a row\n if (syncStatus.error_counter == 2) {\n\n helperFunctions.logJSError({\n 'stack': stack\n });\n\n helperFunctions.eventEmitter.emitEvent('messageSendError', [{'chat_id':obj.id, 'hash': obj.hash, msg: stack}]);\n\n checkErrorCounter();\n } else {\n\n dispatch({type: \"ADD_MESSAGES_SUBMITTED\", data: {r: \"SEND_FAILED\", \"msg\" : obj.msg}});\n\n syncStatus.add_msg = false;\n\n // Try to send message again\n addMessage(obj, true)(dispatch, getState);\n }\n }\n\n syncStatus.add_msg = false;\n })\n }\n}\n\nexport function userTyping(status, msg) {\n return function(dispatch, getState) {\n const state = getState();\n\n if (status === 'true') {\n helperFunctions.eventEmitter.emitEvent('visitorTyping', [{'chat_id':state.chatwidget.getIn(['chatData','id']), 'hash': state.chatwidget.getIn(['chatData','hash']),'status': true, msg: msg}]);\n } else {\n helperFunctions.eventEmitter.emitEvent('visitorTyping', [{'chat_id':state.chatwidget.getIn(['chatData','id']), 'hash': state.chatwidget.getIn(['chatData','hash']),'status': false}]);\n }\n\n if (!state.chatwidget.get('overrides').contains('typing')) {\n axios.post(window.lhcChat['base_url'] + \"chat/usertyping/\" + state.chatwidget.getIn(['chatData','id']) + '/' + state.chatwidget.getIn(['chatData','hash']) + '/' + status, {'msg' : msg}, defaultHeaders)\n .then((response) => {\n }).catch((err) => {\n console.log(err);\n });\n }\n }\n}\n\nexport function submitInlineSurvey(obj) {\n return axios.post(window.lhcChat['base_url'] + \"survey/fillinline\", obj, defaultHeaders);\n}","import React, { PureComponent } from 'react';\n\nclass ChatAbort extends PureComponent {\n\n constructor(props) {\n super(props);\n }\n\n render() {\n return \n
\n
\n
\n\n {this.props.as_html &&
}\n {!this.props.as_html &&

{this.props.text}

}\n\n
\n \n
\n
\n
\n
;\n }\n}\n\nexport default ChatAbort;\n","import React, { PureComponent } from 'react';\nimport parse, { domToReact } from 'html-react-parser';\nimport { connect } from \"react-redux\";\nimport { withTranslation } from 'react-i18next';\n\nclass ChatBotIntroMessage extends PureComponent {\n\n state = {\n value: ''\n };\n\n constructor(props) {\n super(props);\n this.abstractClick = this.abstractClick.bind(this);\n this.updateTriggerClicked = this.updateTriggerClicked.bind(this);\n this.processBotAction = this.processBotAction.bind(this);\n this.disableEditor = false;\n }\n\n getDirectInnerText(element) {\n var childNodes = element.childNodes;\n var result = '';\n\n for (var i = 0; i < childNodes.length; i++) {\n if(childNodes[i].nodeType == 3) {\n result += childNodes[i].data.trim();\n }\n }\n\n return result;\n }\n\n addLoader(attrs, element) {\n\n if (this.props.printButton == true && !attrs[\"data-no-msg\"] && (attrs.type == 'button' || element.tagName === 'A')) {\n this.setState({value : this.getDirectInnerText(element)});\n if (element.tagName !== 'A') {\n this.removeMetaMessage(attrs['data-id']);\n }\n }\n\n if (attrs[\"data-no-msg\"] && !attrs[\"data-no-change\"] && attrs.type == 'button') {\n element.setAttribute(\"disabled\",\"disabled\");\n element.innerHTML = \"\" + element.innerHTML;\n }\n }\n\n removeMetaMessage(messageId) {\n var msgArea = document.getElementById('messages-scroll');\n if (msgArea) {\n var x = msgArea.getElementsByClassName(\"meta-message-\" + messageId);\n var i;\n for (i = 0; i < x.length; i++) {\n x[i].parentNode.removeChild(x[i]);\n }\n }\n }\n\n /**\n * Here we handle bot buttons actions\n * */\n abstractClick(attrs, e) {\n\n const { t } = this.props;\n\n this.addLoader(attrs,e.target);\n\n if (attrs.onclick.indexOf('lhinst.updateTriggerClicked') !== -1) {\n this.updateTriggerClicked({type:'triggerclicked'}, attrs, e.target);\n } else if (attrs.onclick.indexOf('notificationsLHC.sendNotification') !== -1) {\n // todo\n } else if (attrs.onclick.indexOf('lhinst.buttonClicked') !== -1) {\n this.updateTriggerClicked({type:''}, attrs, e.target);\n } else if (attrs.onclick.indexOf('lhinst.updateChatClicked') !== -1) {\n this.updateTriggerClicked({type:'',mainType: 'updatebuttonclicked'}, attrs, e.target);\n } else if (attrs.onclick.indexOf('lhinst.editGenericStep') !== -1) {\n this.updateTriggerClicked({type:'editgenericstep'}, attrs, e.target);\n } else if (attrs.onclick.indexOf('lhinst.dropdownClicked') !== -1) {\n const list = document.getElementById('id_generic_list-' + attrs['data-id']);\n if (list && list.value != \"0\" && list.value != \"\") {\n attrs['data-payload'] = list.value;\n this.updateTriggerClicked({type:'valueclicked'}, attrs, e.target);\n } else {\n alert(t('bot.please_choose'));\n }\n } else {\n helperFunctions.emitEvent('MessageClick',[attrs, this.props.dispatch]);\n console.log('Unknown click event: ' + attrs.onclick);\n }\n\n e.preventDefault();\n }\n\n updateTriggerClicked(paramsType, attrs, target) {\n this.props.setBotPayload({type: paramsType['type'], payload: attrs['data-payload'], id : attrs['data-id'], processed : (typeof attrs['data-keep'] === 'undefined')})\n }\n\n processBotAction(domNode) {\n\n const attr = domNode.attribs;\n\n if (attr['data-bot-action'] == 'lhinst.disableVisitorEditor') {\n this.disableEditor = true;\n } else if (attr['data-bot-action'] == 'lhinst.setDelay') {\n //this.delayData.push(JSON.parse(attr['data-bot-args']));\n } else if (attr['data-bot-action'] == 'execute-js') {\n eval(domNode.children[0]['data']);\n }\n }\n\n render() {\n\n let content = parse(this.props.content, {\n replace: domNode => {\n if (domNode.attribs) {\n\n var cloneAttr = Object.assign({}, domNode.attribs);\n\n if (domNode.attribs.onclick) {\n delete domNode.attribs.onclick;\n }\n\n if (domNode.attribs.class) {\n domNode.attribs.className = domNode.attribs.class;\n\n if (domNode.attribs.className.indexOf('message-row') !== -1) {\n domNode.attribs.className += ' index-row-0';\n }\n\n delete domNode.attribs.class;\n }\n\n if (domNode.name && domNode.name === 'button') {\n if (cloneAttr.onclick) {\n return \n }\n } else if (domNode.name && domNode.name === 'a') {\n if (cloneAttr.onclick) {\n return this.abstractClick(cloneAttr, e)} >{domToReact(domNode.children)}\n }\n } else if (domNode.name && domNode.name === 'script' && domNode.attribs['data-bot-action']) {\n this.processBotAction(domNode);\n }\n }\n }\n });\n\n return {content}{this.state.value != '' &&
{this.state.value.split('\\n').map((item, idx) => {return ({item}
)})}
}
\n\n }\n}\n\nexport default ChatBotIntroMessage;","import React, { Component } from 'react';\nimport { withTranslation } from 'react-i18next';\nimport { getProducts } from \"../actions/chatActions\"\nimport { connect } from \"react-redux\";\n\nclass ChatDepartment extends Component {\n\n constructor(props) {\n super(props);\n this.onchangeAttr = this.onchangeAttr.bind(this);\n this.onchangeAttrProduct = this.onchangeAttrProduct.bind(this);\n }\n\n onchangeAttr(e) {\n this.props.onChangeContent({id : 'DepartamentID', value : e.value});\n\n if (this.props.departments.getIn(['settings','product_by_department']) === true) {\n this.props.dispatch(getProducts({'dep_id' : e.value}));\n }\n }\n\n onchangeAttrProduct(e) {\n this.props.onChangeContent({id : 'ProductID', value : e.value});\n }\n\n componentDidMount() {\n\n // We have product functionality enabled\n if (this.props.departments.getIn(['settings','product']) === true && (this.props.departments.getIn(['settings','product_by_department']) === true || this.props.departments.has('products')))\n {\n this.props.onChangeContent({id : 'HasProductID', value : true});\n }\n\n if (this.props.departments.get('departments').size == 0)\n {\n return;\n }\n\n if (this.props.departments.get('departments').size == 1 || !this.props.departments.hasIn(['settings','optional'])) {\n this.onchangeAttr({'value': this.props.setDefaultValue || this.props.departments.getIn(['departments',0]).get('value')});\n } else if (this.props.departments.get('departments').size > 1) {\n this.onchangeAttr({'value': -1});\n }\n }\n\n render() {\n\n const { t } = this.props;\n\n var departmentOutput = null;\n if (this.props.departments.get('departments').size > 1 && !this.props.departments.hasIn(['settings','hide_department'])) {\n var classNameInput = ['form-control','form-control-sm'];\n\n if (this.props.isInvalid === true) {\n classNameInput.push('is-invalid');\n }\n\n var options = this.props.departments.get('departments').map(dep => );\n departmentOutput =
\n \n \n
;\n }\n\n var productOutput = null;\n if (this.props.departments.getIn(['settings','product']) === true) {\n var classNameInputProduct = ['form-control','form-control-sm'];\n\n if (this.props.isInvalidProduct === true) {\n classNameInputProduct.push('is-invalid');\n }\n\n var prouducts = this.props.departments.has('products') ? this.props.departments.get('products').map(dep => ) : \"\";\n if (this.props.departments.has('products') && this.props.departments.get('products').size > 0) {\n productOutput =
\n \n \n
;\n };\n }\n\n if (productOutput !== null || departmentOutput !== null){\n return
{departmentOutput}{productOutput}
\n } else {\n return null;\n }\n }\n}\n\nexport default connect()(withTranslation()(ChatDepartment));\n","import React, { Component } from 'react';\nimport { withTranslation } from 'react-i18next';\n\nclass ChatField extends Component {\n\n state = {\n hiddenIfPrefilled: false\n };\n\n constructor(props) {\n super(props);\n this.onchangeAttr = this.onchangeAttr.bind(this);\n this.onFileAdded = this.onFileAdded.bind(this);\n }\n\n onchangeAttr(e) {\n this.props.onChangeContent({id : this.props.field.get('name'), value : e.value, field : this.props.field});\n \n if (this.props.field.get('type') == 'dropdown' ) {\n var selectedOption = parseInt(e.target.options[e.target.selectedIndex].getAttribute('dep-id'));\n if (selectedOption > 0) {\n // Maybe we should add product and custom start chat form dependency\n // Now we just assume different departments will have same start chat form settings\n this.props.onChangeContent({id : 'DepartamentID', value : selectedOption, subject_id: e.target.options[e.target.selectedIndex].getAttribute('subject-id')});\n }\n }\n }\n\n onFileAdded(e) {\n const list = e.target.files;\n const files = [];\n for (var i = 0; i < list.length; i++) {\n files.push(list.item(i));\n }\n\n if (list.length == 0) {\n return null;\n }\n\n const ruleTest = new RegExp(\"(\\.|\\/)(\" + this.props.field.get('ft_us') + \")$\",\"i\");\n\n const { t } = this.props;\n\n let uploadErrors = [];\n files.forEach(file => {\n if (!(ruleTest.test(file.type) || ruleTest.test(file.name))) {\n uploadErrors.push(file.name + ': ' + t('file.incorrect_type'));\n }\n if (file.size > this.props.field.get('fs')) {\n uploadErrors.push(file.name + ': '+ t('file.to_big_file'));\n }\n });\n\n if (uploadErrors.length > 0) {\n alert(uploadErrors.join(\"\\n\"));\n } else {\n this.props.onChangeContent({id : this.props.field.get('name'), value : files[0], field : this.props.field});\n }\n }\n\n componentDidMount() {\n if (this.props.field.get('type') == 'checkbox' && this.props.field.get('default') == true) {\n this.props.onChangeContent({id : this.props.field.get('name'), value : true});\n } else if (this.props.field.get('type') == 'dropdown') {\n this.props.onChangeContent({id : this.props.field.get('name'), value : this.props.defaultValueField});\n this.props.field.get('options').map((dep) => {\n if (dep.get('value') == this.props.defaultValueField && dep.get('dep_id')) {\n this.props.onChangeContent({set_default: true, id : 'DepartamentID', subject_id: (dep.has('subject_id') ? dep.get('subject_id') : null), value : dep.get('dep_id')});\n }\n });\n }\n\n if (this.props.attrPrefill && this.props.attrPrefill.attr_prefill_admin) {\n this.props.attrPrefill.attr_prefill_admin.forEach((item) => {\n if (item.index == this.props.field.get('identifier') || (this.props.field.has('identifier_prefill') && item.index == this.props.field.get('identifier_prefill'))) {\n this.props.onChangeContent({id : this.props.field.get('name'), value : item.value});\n // Hide only valid prefilled fields\n if (this.props.field.has('hide_prefilled') && this.props.field.get('hide_prefilled') == true && this.props.isInvalid === false) {\n this.setState({'hiddenIfPrefilled':true});\n }\n }\n });\n }\n }\n\n render() {\n\n if (this.state.hiddenIfPrefilled === true && this.props.isInvalid !== true) {\n return null;\n }\n\n var className = 'col-' + this.props.field.get('width');\n var required = this.props.field.get('required') === true;\n\n var classNameInput = [];\n\n if (this.props.field.get('class') != '') {\n classNameInput.push(this.props.field.get('class'));\n }\n\n if (this.props.isInvalid === true) {\n classNameInput.push('is-invalid');\n }\n\n if (this.props.field.get('type') == 'text') {\n return (\n
\n
\n \n this.onchangeAttr({'value' : e.target.value})} name={this.props.field.get('name')} defaultValue={this.props.defaultValueField} placeholder={this.props.field.get('placeholder')} />\n
\n
\n )\n } else if (this.props.field.get('type') == 'password') {\n return (\n
\n
\n \n this.onchangeAttr({'value' : e.target.value})} name={this.props.field.get('name')} defaultValue={this.props.defaultValueField} placeholder={this.props.field.get('placeholder')} />\n
\n
\n )\n } else if (this.props.field.get('type') == 'textarea') {\n return (\n
\n
\n {!this.props.chatUI.has('hide_message_label') && this.props.field.get('identifier') == 'question' && }\n