"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _createForOfIteratorHelper(e,t){var a;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(a=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,t=function(){};return{s:t,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t}}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 o,i=!0,s=!1;return{s:function(){a=e[Symbol.iterator]()},n:function(){var e=a.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==a.return||a.return()}finally{if(s)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a=s.res.quickLabel.length)){var n=s.res.quickLabel[a];switch(t){case 0:var o=s.cEditor1.getData();if(o.trim().startsWith("#".concat(i18n.aiSearch||"AI搜索",":")))return s.cEditor1.focus(),void setTimeout(function(){var e,i,s,c,r,l,t=document.querySelector(".cEditor-area");!t||-1!==(e=(t.textContent||t.innerText).indexOf("#".concat(i18n.aiSearch||"AI搜索",":")))&&(i=document.createRange(),s=window.getSelection(),c=e+"#".concat(i18n.aiSearch||"AI搜索",":").length,r=0,l=!1,function e(t){if(!l)if(t.nodeType===Node.TEXT_NODE){var a=t.textContent,a=r+a.length;if(r<=c&&c<=a)return i.setStart(t,c-r),i.collapse(!0),s.removeAllRanges(),s.addRange(i),void(l=!0);r=a}else if(t.nodeType===Node.ELEMENT_NODE){var n=_createForOfIteratorHelper(t.childNodes);try{for(n.s();!(o=n.n()).done;){var o=o.value;if(l)break;e(o)}}catch(e){n.e(e)}finally{n.f()}}}(t))},0);"function"==typeof s.cEditor1.setData?s.cEditor1.setData("#".concat(i18n.aiSearch||"AI搜索",":")+o):"function"==typeof s.cEditor1.setValue?s.cEditor1.setValue("#".concat(i18n.aiSearch||"AI搜索",":")+o):(i=document.querySelector(".cEditor-area"))&&(i.innerHTML="#".concat(i18n.aiSearch||"AI搜索",":")+o),s.cEditor1.focus(),setTimeout(function(){var e,t,a=document.querySelector(".cEditor-area");a&&(e=document.createRange(),t=window.getSelection(),e.selectNodeContents(a),e.collapse(!1),t.removeAllRanges(),t.addRange(e))},0);break;case 1:n.desc&&s.sendText(n.desc);break;case 2:var i="",o="";n.linkUrl&&(i=-1'.concat(e,"

")),e="".concat(s.res.domain,"/visitormanager/intelligent/front/agentContentResearch?tenantId=").concat(tenant.tenantId,"&instance=").concat(tenant.bossProductInstance),c.cmsAjax.postJson(e,t).then(function(e){}))}).on("click",".addWechat",function(e){$(e.target).parents(".cards").toggleClass("wx")})}},{key:"loadMemberInfo",value:function(){var e=this,t=$("#member-tab");0\n ').concat(e,"\n ")}).join(""));var o="",i="",i=1==t?'':'',o=this.isLoginFlag?'\n
\n
\n
\n '.concat(i,'\n
\n
\n ').concat(this.settings.name,'\n
\n
\n
').concat(i18n.memberNum||"会员号",":").concat(getCookie("_memberId")||"******",'
\n
xxx公司
\n
\n
\n
\n
\n
').concat(i18n.quickOperation||"快捷操作",'
\n
\n ').concat(n,"\n
\n
\n
\n "):'
\n
\n
\n \n

'.concat(i18n.loginMore||"登录后享受更多会员服务",'

\n ').concat(i18n.toLogin||"去登录","\n
\n
\n
");e.html(o),e.off("click",".m_tags_info_item").on("click",".m_tags_info_item",function(e){e=$(e.currentTarget).data("tag");switch(e){case i18n.myProfile||"我的资料":window.open("/sys/information");break;case i18n.myOrder||"我的订单":window.open("/sys/order/list");break;case i18n.myFavorite||"我的收藏":window.open("/sys/collection");break;case i18n.myService||"我的服务":window.open("/sys/workorder/list")}})}},{key:"launchThirdPartyApp",value:function(e,t,a,n){switch(e){case 1:window.location.href="tencent://message/?uin=".concat(t);break;case 2:break;case 3:window.location.href="http://amos.alicdn.com/getcid.aw?v=2&uid=".concat(t,"&site=cntaobao&s=2&groupid=0&charset=utf-8");break;case 4:window.location.href="skype:".concat(t,"?chat");break;case 5:window.location.href="https://api.whatsapp.com/send?phone=".concat(t,"&text=Hello");break;case 6:case 7:this.showWeChatPrompt(a,n);break;case 8:window.location.href="mailto:".concat(t);break;case 9:window.location.href="tel:".concat(t);break;case 10:case 11:case 12:window.location.href="tel:".concat(link)}}},{key:"showWeChatPrompt",value:function(e,t){t.addClass("active"),t.siblings().hasClass("active")&&($(".wechat-prompt").remove(),t.siblings().removeClass("active"));var a='\n
\n
\n 微信二维码\n
\n
\n
\n '),n=$(event.target).closest(".quick_label_item").offset(),e=$(window).width(),a=$(a);$("body").append(a),a.css({top:n.top-a.outerHeight()-10,left:n.left-23}),n.left+$(".wechat-prompt").width()>e&&($(".wechat-prompt").addClass("windowRight"),a.css({top:top,left:"auto",right:20})),$(".custom_close").on("click",function(){$(".wechat-prompt").remove(),t.removeClass("active")}),$(window).on("scroll",function(){$(".wechat-prompt").remove(),t.removeClass("active")}),$(".quick_labels").on("scroll",function(){$(".wechat-prompt").remove(),t.removeClass("active")})}},{key:"clickKnowledge",value:function(e){this.handleReply(!0);var t={accid:this.res.account,bizId:e},e="".concat(this.res.domain,"/visitormanager/intelligent/front/knowledgeTitleClick?tenantId=").concat(tenant.tenantId,"&instance=").concat(tenant.bossProductInstance);c.cmsAjax.postJson(e,t).then(function(e){})}},{key:"handleReply",value:function(e){e?($(".sm_reply").remove(),this.handleMsg({type:"text",from:"reply",text:'
'})):$(".sm_reply").remove()}},{key:"getFormValue",value:function(e){if(e.hasClass("p_checkbox")||e.hasClass("p_radio")){var t=e.find("input:checked"),a=[];return t.each(function(e,t){a.push($(t).val())}),a.join(",")}return e.val()?e.val().trim():""}},{key:"formValid",value:function(e){var t=e.attr("data-type"),a=e.parents(".formIt"),n=a.find(".errorMsg"),o=this.getFormValue(e),e=a.attr("required");o?"mobile"!=t||/^[0-9\+-]+$/.test(o)?"email"!=t||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)?(a.removeClass("invalid"),n.text("")):(a.addClass("invalid"),n.text(i18n.form_invalidEmail)):(a.addClass("invalid"),n.text(i18n.form_invalidMobile)):e?(a.addClass("invalid"),n.text(i18n.sms_error2)):(a.removeClass("invalid"),n.text(""))}},{key:"submitForm",value:function(e,t,a){var n,o=this,i=e.parents(".msgform");i.find(".p_inp").trigger("valid"),0==i.find(".invalid").length&&(0<(e=i.find(".aggree input")).length&&!e.prop("checked")&&t?e.parent().addClass("noAggree"):(e.parent().removeClass("noAggree"),n={accid:this.res.account,terminal:this.getTerminal(),source:location.href},localStorage.getItem("ga4_cbo_custom_id")&&(n.deviceNo=localStorage.getItem("ga4_cbo_custom_id")),t||(n.progressId=i.attr("progressId")),i.find(".p_inp").each(function(e,t){n[$(t).attr("name")]=o.getFormValue($(t))}),t||this.handleReply(!0),e="",a?(e="".concat(this.res.domain,"/visitormanager/intelligent/front/addWork?tenantId=").concat(tenant.tenantId,"&instance=").concat(tenant.bossProductInstance),n.memberId=getCookie("_memberId")||""):e="".concat(this.res.domain,"/visitormanager/intelligent/front/addClue?tenantId=").concat(tenant.tenantId,"&instance=").concat(tenant.bossProductInstance),c.cmsAjax.postJson(e,n).then(function(e){200==e.status&&e.data&&(200==e.data.code?t?(o.needForm=!1,o.init(!1),o.showFun()):(a&&i.hide().siblings(".successBox").show(),o.handleReply(!1),o.errorMsgFun(i18n.sms_success,"success")):10004==e.data.code&&(t?$.pl_toast({msg:i18n.sms_error1}):(o.handleReply(!1),o.errorMsgFun(i18n.sms_error1,"warning"))))})))}},{key:"closeDialog",value:function(){sessionStorage.setItem("smartServiceClose","true"),this.needForm?$("#"+this.conId+"-form").removeClass("show"):($("#"+this.conId).removeClass("show"),this.cEditor1.clear(),clearInterval(this.greeting),clearTimeout(this.customreNoAnswerTimeout),clearTimeout(this.companyNoAnswerTimeout),this.logout||this.renderLogout(!0),this.cleanup())}},{key:"renderLogout",value:function(e){this.logout=!0,clearInterval(this.timeLogoutEvent),e||this.handleMsg('

——— '.concat(i18n.sms_dk," ———

"))}},{key:"handleEditorData",value:function(t){var e=t.match(//,"g"),e=t.match(e);return e&&e.forEach(function(e){t=t.replace(new RegExp(e,"g"),"]")}),t=(t=(t=(t=t.replace(/
/g,"\n")).replace(/<\/div>/g,"")).replace(/
/g,"\n")).replace(/\ \;/g," ")}},{key:"errorMsgFun",value:function(e,t){t=t||"error";this.errorToast({type:t,msg:e})}},{key:"errorToast",value:function(e){var t=$("#"+this.conId+" .sm_dialog"),a="toast_"+ +new Date,n={success:'',warning:'',error:''};t.append('\n
\n
\n ').concat(n[e.type]||n.error,"").concat(e.msg,"\n
\n
\n "));setTimeout(function(){$("#"+a).remove()},2e3)}},{key:"sendText",value:function(t){var a=this;this.sensitiveFun(t,function(e){0=t.length?(a=0,void clearInterval(e.greeting)):void e.handleMsg(t[a])},1e3*this.automaticReply.speechContentInterval)}},{key:"timeLogout",value:function(){var e=this;this.timeLogoutEvent=setInterval(function(){e.tTime++,e.tTime>=e.time&&e.renderLogout()},1e3)}},{key:"handleMsg",value:function(e,t){var a=this;e.from==this.settings.account?(e.time||(e.time=+new Date),$(".sm_output").append(this.adminHtml(e,t))):e.from==this.res.account?(e.time||(e.time=+new Date),$(".sm_output").append(this.customerHtml(e))):"reply"==e.from?(e.time||(e.time=+new Date),$(".sm_output").append(this.adminHtml(e))):$(".sm_output").append(e);var n=$(".sm_output .aiAgent_reply");n.hide(),n.last().show(),n.each(function(){$(this).find("a.clicked").length&&$(this).show()}),$(".sm_output .sm_msg").each(function(){var e=$(this).find(".aiAgent_reply");$(this).find(".msgcon").toggleClass("mb20",0this.lastSendTime&&this.addCurrentSessionTipIfNeeded():!this.lastSendTime&&this.res.enableAgentFlag&&this.manageMessagesDisplay(),this.showLastRelatedIssues()}},{key:"addLoginPromptToFirstMessage",value:function(){var t=this.currentLang||"zh_CN",e=[{zh_CN:"登录会员,可享受更多专属服务和优惠"},{en:"Logged-in members, can enjoy more exclusive services and discounts"}].filter(function(e){return e[t]})[0][t],a=$(".sm_output").find(".sm_msg"),n=new Date;n.setHours(0,0,0,0);var o=n.getTime(),i=null;a.each(function(){var e=parseInt($(this).attr("data-time"))||0;if(o<=e)return i=$(this),!1}),!i||i.find(".login-prompt").length||0<(a=i.find(".msgcon .cItem").last()).length&&(e=$('")),a.after(e))}},{key:"addCurrentSessionTipIfNeeded",value:function(){var e,t,a=$(".sm_output"),n=a.find(".sm_msg");0this.lastSendTime)return e=$(this),!1}.bind(this)),e?(t=$(''),e.before(t)):(t=$(''),n.last().before(t)))}},{key:"adminHtml",value:function(e,t){var a=[],n=[],o="",i="",s="";if(e.content)try{var c,r=JSON.parse(e.content);r.aiAgent&&r.aiAgent.relatedIssues&&this.res.replyResearch&&t&&(c=localStorage.getItem("replyResearch_"+e.time)?" disabled":"",i='"))}catch(e){}if("text"==e.type)a.push(this.getMsg(e.text,"text"));else if("custom"==e.type)try{var l,d=JSON.parse(e.content);for(l in d.lang&&(this.currentLang=d.lang),d.paramSort){var g=d.paramSort[l],m=this.getMsg(d[g],g,t);"card"!=g&&"form"!=g&&"knowledge"!=g?(m&&a.push(m),"questionTip"==g&&(o="w100"),"aiAgent"==g&&(s="mb20",a.push(i))):n.push(m)}}catch(e){}var p="";0').concat(a.join(""),"
"));var h="";return 1==this.settings.voiceSwitch&&(h=''),0\n
\n ').concat(this.settings.name,'\n ').concat($.formatDate(new Date(e.time),"yyyy-MM-dd hh:mm"),"\n ").concat(h,"\n
\n ").concat(p,"\n ").concat(n.join(""),"\n \n "):""}},{key:"isArray",value:function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{key:"getMsg",value:function(e,t,a){var n=this;if(!e||0==e.length||e.input&&0==e.input.length)return"";switch(t){case"text":case"title":return'
'.concat(marked.parse(w.symbolToHtml(e)),"
");case"image":return'
img
');case"button":var o=[];return e.forEach(function(e){o.push('').concat(e.name,""))}),'
'.concat(o.join(""),"
");case"questionTip":var i=[];return e.forEach(function(e,t){i.push('"))}),'
'.concat(i.join(""),"
");case"knowledge":return this.getKnowledge(e,t,a);case"card":return'
\n
').concat(i18n.sms_card,'zs
\n
\n
head
\n
\n

').concat(e.name,'

\n

').concat(e.role,"

\n
\n
\n
");case"form":var s=[];e.input.forEach(function(e){var t,a="";1==e.fixed?!1===e.ishide||e.showName||e.note?a=n.getFixedFormItem(e):void 0===e.ishide&&(t=!e.noRequired,a=n.getFixedFormItem(e,t)):0!=e.fixed||e.ishide?null==e.fixed&&(a=n.getFixedFormItem(e,!0)):a=n.getFormItem(e),a&&s.push(a)});var c="",r="";return e.msgAuthFlag&&(c='
\n \n \n
"),r=''),'
\n ').concat(s.join(""),"\n ").concat(c,'\n \n
");case"thirdTool":var l=(this.isArray(e)?e:[e]).map(function(e){var t="";switch(e.type){case 1:t='').concat(e.name,"");break;case 2:case 3:t='').concat(e.name,"");break;case 4:t='').concat(e.name,"");break;case 5:t='').concat(e.name,"");break;case 6:t='
').concat(e.name,'添加微信客服\n
');break;case 7:t='
').concat(e.name,'
');break;case 8:t='').concat(e.name,"");break;case 9:t='').concat(e.name,"");break;case 10:t='').concat(e.name,"");break;case 11:t='').concat(e.name,"");break;case 12:t='').concat(e.name,"")}return t}).join("");return'
\n
\n
'.concat(i18n.transfered||"目前人工坐席繁忙,您也可以按以下方式直接联系。","
\n ").concat(l,"\n
\n
");case"workOrder":var d=[];e.input.forEach(function(e,t){0==t&&(e.fixed=0);var a="";1==e.fixed?!1===e.ishide||e.showName||e.note?a=n.getFixedFormItem(e):void 0===e.ishide&&(t=!e.noRequired,a=n.getFixedFormItem(e,t)):0!=e.fixed||e.ishide?null==e.fixed&&(a=n.getFixedFormItem(e,0!=e.required)):a=n.getFormItem(e),a&&d.push(a)});var g="",m="";return e.msgAuthFlag&&(g='
\n \n \n
"),m=''),'\n
\n ').concat(d.join(""),"\n ").concat(g,'\n \n
\n ");case"aiAgent":var p,h,c=e.msg,r=e.source,l=e.relatedIssues,g="",m="";return Array.isArray(r)&&0').concat(e[t],""))}),0'.concat(p.join(""),""))):"string"==typeof r&&(g='")),Array.isArray(l)&&0

"))}),0

"))):"string"==typeof l&&(m='
")),'\n
\n
'.concat(marked.parse(c),"
\n ").concat(g,"\n ").concat(m,"\n
\n ");case"internationalEntry":return'
'.concat("正在为您转接中..."==e?i18n.transfering||e||"正在为您转接中...":i18n.humanAgents||e||"目前人工坐席繁忙,请留下您的联系方式,我们将第一时间联系您。","
");default:return""}}},{key:"showLastRelatedIssues",value:function(){$(".aiAgent_relatedIssues").addClass("hidden");var e=$(".sm_msg.ad").last();0
');return"address"==e.code?a='
'):"mobile"!=e.code&&"custLinkMobile"!=e.code||(a=this.mobileItem(e,t)),'
\n \n ").concat(a,"\n
")}},{key:"mobileItem",value:function(e,t){var a,n=this.arraySort(s.countries,"iso2"),o=n.find(function(e){return"CN"==e.iso2})||{},i=[];return i.push('\n
  • \n +86\n CN\n
  • \n '),n.forEach(function(e){var t="CN"==e.iso2?"p_active":"";i.push('
  • ').concat(e.dialCode,'').concat(e.iso2,"
  • "))}),a='
    \n
    \n
    \n '.concat(o.dialCode,'\n \n \n \n
    \n
      \n ').concat(i.join(""),'\n
    \n \n
    \n
    '),'
    \n '.concat(a,'\n \n
    \n
    ')}},{key:"getFormItem",value:function(a){var e="";if("txt"==a.dataType)switch(a.dataSubType){case"text":case"email":e='
    ');break;case"numberic":e='
    ');break;case"mobile":case"phone":e=this.mobileItem(a);break;case"simpleDate":case"allDate":e='
    ')}else if("multiTxt"==a.dataType)e='
    ');else if("select"==a.dataType){var n=[];switch(a.dataSubType){case"redio":a.dataItem.forEach(function(e,t){n.push('
    \n \n \n
    "))}),e='
    ').concat(n.join(""),'
    ');break;case"checkbox":a.dataItem.forEach(function(e,t){n.push('
    \n \n \n
    "))}),e='
    ').concat(n.join(""),'
    ');break;case"selSigle":e='
    \n
    \n
    \n \n \n
    ');break;case"selMulti":e='
    \n
    \n
    \n \n \n
    ')}}return'
    \n \n ").concat(e,"\n
    ")}},{key:"getKnowledge",value:function(e,t,a){var n,o,i="",s="",c="";return e.aiReplySurvey&&a&&(c='")),"object"==_typeof(e.content)?i=this.isArray(e.content)?(n=[],e.content.forEach(function(e,t){t=Math.floor(t/3);n.push('"))}),3').concat(i18n.sms_change,"")),'

    '.concat(i18n.sms_recommend,":").concat(s,'

    ').concat(n.join(""),"
    ")):(o=[],s="",e.content.source&&0').concat(e,""));else if("object"==_typeof(e))for(var t in e)e[t]&&t&&"null"!=t&&"null"!=e[t]&&o.push('
  • ').concat(e[t],"
  • "))}),0\n

    '.concat(i18n.sms_resource,":

    \n
      ").concat(o.join(""),"
    \n "))),'
    '.concat(marked.parse(e.content.answer),"
    ").concat(s)):"string"==typeof e.content&&(i='
    '.concat(marked.parse(e.content),"
    ")),'
    '.concat(i,"
    ").concat(c)}},{key:"customerHtml",value:function(e){return'\n
    \n
    \n ').concat($.formatDate(new Date(e.time),"yyyy-MM-dd hh:mm"),'\n
    \n
    \n ').concat(this.escapeHtml(w.symbolToHtml(e.text)),"\n
    \n
    \n ")}},{key:"escapeHtml",value:function(n){var e=n.match(new RegExp(/<[^>]+>/g));return e&&0$/.test(e)||/^
    /g,">"),-1<(a=e).indexOf("(")&&(a=e.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),n=n.replace(new RegExp(a,"g"),t))}),n}},{key:"getIcon",value:function(){var e="";1!=this.colorLayout.showFlag&&this.colorLayout.tipText&&(e='').concat(this.colorLayout.tipText,""),this.res.enableAgentFlag&&(e=''));return this.res.aiAgentImg?''):'\n \n \n ').concat(e)}},{key:"getDialog",value:function(){var e=this.colorLayout,t=$.handleDataImg(this.kefuHead)||"/npublic/commonjs/smartService/kefu.png",a="smartService ".concat("right"==e.windowLocation?"rightWindow":"leftWindow"," ").concat(1==e.windowStyle?"bigWindow":"smallWindow"," ").concat(1!=e.entranceLocation?"near":""),n='';2==this.colorLayout.modelType&&(n=i18n.sms_send);var o=i18n.sms_title;1==this.settings.titleFlag&&(o=this.settings.title);var i=this.res.memberFlag,s="";this.res.quickLabel&&Array.isArray(this.res.quickLabel)&&(s=this.res.quickLabel.filter(function(e){return 1==e.status}).filter(function(e){return"AI搜索"==e.name?e.name=i18n.aiSearch:e.name}).map(function(e,t){return'
    ').concat(e.svg||"").concat(e.name,"
    ")}).join(""));e=s?'\n
    \n '.concat(s,"\n
    \n "):"",s=i?'\n \n "):"",e=i?'\n
    \n
    \n
    '.concat(e,'
    \n
    \n
    \n \n
    \n
    \n "):'\n
    \n
    '.concat(e,'
    \n
    \n
    \n \n
    \n "),n=i?'\n \n ':"",e=i?"\n ".concat(s,"\n ").concat(e,"\n ").concat(n,"\n "):"\n ".concat(e,"\n ");return'\n
    \n
    \n \n \n \n \n \n \n \n
    \n ').concat(this.settings.name,'\n

    ').concat(o,'

    \n
    \n
    \n
    \n ').concat(e,"\n
    \n
    \n ")}},{key:"getFormlog",value:function(){var e=this.colorLayout,t="smartService ".concat("right"==e.windowLocation?"rightWindow":"leftWindow"," ").concat(1==e.windowStyle?"bigWindow":"smallWindow"," ").concat(1!=e.entranceLocation?"near":""," smsForm"),e=JSON.parse(this.res.setting.moreSetting);return'\n
    \n
    \n \n \n \n
    ').concat(e.chatSurveyForm.title,'
    \n form\n
    \n ').concat(this.getMsg(e.chatSurveyForm,"form"),"\n
    \n ")}},{key:"showFun",value:function(){var e,t=this;this.nim&&this.nim.disconnect(),this.needForm?$("#"+this.conId+"-form").addClass("show"):($("#"+this.conId+"-form").remove(),$("#"+this.conId).addClass("show"),$(".smtIconPrompt").hide(),this.handleReply(!1),this.unreadMessageCount=0,this.clearUnreadCountFromStorage(),this.updateUnreadBadge(),setTimeout(function(){0===$(".sm_output").find(".sm_msg").length&&t.showLoadingMessage(),t.res.enableAgentFlag&&t.manageMessagesDisplay()},100),this.logNim(),window.ZQSensorsObj&&(e={tenantId:tenant.tenantId,iBusinessCode:"01",iBusinessName:"智慧客服业务线",iBusinessCustId:this.res.account},ZQSensorsObj.track("SmartServiceWakeUp",e)))}},{key:"arraySort",value:function(e,a,t){var n=/^([+]\d+[.]\d+|[-]\d+[.]\d+|\d+[.]\d+|[+]\d+|[-]\d+|\d+)$/;return"desc"==t?e.sort(function(e,t){return n.test(e[a])?t[a]-e[a]:t[a].localeCompare(e[a])}):e.sort(function(e,t){return n.test(e[a])?e[a]-t[a]:e[a].localeCompare(t[a])})}},{key:"getTerminal",value:function(){return this.isWxMini()?1:this.isWechat()?2:Boolean(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))||$(window).width()<=768?4:3}},{key:"isWechat",value:function(){return"micromessenger"==navigator.userAgent.toLowerCase().match(/MicroMessenger/i)}},{key:"isWxMini",value:function(){return"miniprogram"===window.__wxjs_environment||"miniprogram"==navigator.userAgent.toLowerCase().match(/miniprogram/i)}},{key:"createGreetingPopup",value:function(){var e,t,a,n,o,i,s=this;this.shouldShowGreetingPopup()&&(0<$("#greetingPopup").length||(a=$.handleDataImg(this.kefuHead)||"/npublic/commonjs/smartService/kefu.png",e=this.colorLayout.tipTitle||i18n.AICustomerService||"您好!我是AI智能客服",t=this.colorLayout.tipText||i18n.AICustomerServiceInfo||"我可以帮您解答问题、推荐产品,随时为您服务!",i=this.colorLayout.tipLabels&&this.colorLayout.tipLabels.length?this.colorLayout.tipLabels:[],a='\n
    \n
    \n ×\n
    \n
    \n ').concat(this.settings.name,'\n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n "),$("body").append(a),(n=$("#greetingPopup")).find(".greeting-close").on("click",function(){s.closeGreetingPopup()}),n.find(".greeting-btn").on("click",function(){n.remove(),s.showFun()}),e&&n.find(".greeting-title").text(e),t&&n.find(".greeting-text").text(t||"打招呼"),i&&Array.isArray(i)&&(o=["colors1","colors2","colors3","colors4"],i=i.map(function(e,t){return'').concat(e,"")}).join(""),n.find(".greeting-tags").html(i)),setTimeout(function(){n.addClass("show")},1e3)))}},{key:"shouldShowGreetingPopup",value:function(){var e=sessionStorage.getItem("greetingPopupClosedDate");if(!e)return!0;var t=new Date;return e!=="".concat(t.getFullYear(),"-").concat(t.getMonth()+1,"-").concat(t.getDate())}},{key:"closeGreetingPopup",value:function(){var e=new Date,e="".concat(e.getFullYear(),"-").concat(e.getMonth()+1,"-").concat(e.getDate());sessionStorage.setItem("greetingPopupClosedDate",e),$("#greetingPopup").fadeOut(300)}},{key:"showMarquee",value:function(e){var t=this;$("#marqueePopup").remove();var a,n=$.handleDataImg(this.kefuHead)||"/npublic/commonjs/smartService/kefu.png",o="left"===this.colorLayout.windowLocation,i="";if("text"===e.type)i=e.text||"";else if("custom"===e.type)try{var s=JSON.parse(e.content);if(s.aiAgent&&s.aiAgent.msg)i=s.aiAgent.msg;else{var c=_createForOfIteratorHelper(s.paramSort||[]);try{for(c.s();!(r=c.n()).done;){var r=r.value;if(("text"===r||"title"===r)&&s[r]){i=s[r];break}}}catch(e){c.e(e)}finally{c.f()}}}catch(e){}(i=i.replace(/[#*_`>\[\]!]/g,"").replace(/\n/g," ").trim())&&(n='\n
    \n
    \n \n
    \n \n
    \n \n
    \n
    \n ').concat(i,'\n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n "),0<$("#greetingPopup").length&&($("#greetingPopup").remove(),this.closeGreetingPopup()),$("body").append(n),(a=$("#marqueePopup")).find(".marquee-close").on("click",function(){a.remove()}),a.find(".marquee-reply-btn").on("click",function(){a.remove(),t.showFun()}),a.find(".greeting-btn-close").on("click",function(){a.remove(),$("#greetingPopup").length&&$("#greetingPopup").show()}),setTimeout(function(){a.addClass("show")},100))}},{key:"hideMarquee",value:function(){$("#marqueePopup").remove()}},{key:"showLoadingMessage",value:function(){var e,t=$(".sm_output");0===t.find(".loading-message").length&&(e="......".split("").map(function(e,t){return'').concat(e,"")}).join(""),t.append('\n
    ').concat(e,"
    \n ")),t.scrollTop(99999999))}},{key:"hideLoadingMessage",value:function(){$(".sm_output .loading-message").remove()}},{key:"manageMessagesDisplay",value:function(){var e=this,t=$(".sm_output"),a=t.find(".sm_msg"),n=new Date;n.setHours(0,0,0,0);var o=n.getTime(),n=a.filter(function(){return(parseInt($(this).attr("data-time"))||0)\n '.concat(i18n.viewHistory||"查看历史会话","\n \n ")),a.first().length?a.first().before(n):t.append(n),n.on("click",function(){e.loadMoreMessages()})):t.find(".load-more-messages").remove()}},{key:"loadMoreMessages",value:function(){var e=$(".sm_output"),t=e.find(".sm_msg"),a=new Date;a.setHours(0,0,0,0);var n=a.getTime(),o=t.filter(function(){return(parseInt($(this).attr("data-time"))||0)'.concat(this.unreadMessageCount,""),e.append(a)):t.remove())}},{key:"saveUnreadCountToStorage",value:function(){localStorage.setItem("smartService_unreadCount",this.unreadMessageCount.toString())}},{key:"getUnreadCountFromStorage",value:function(){var e=localStorage.getItem("smartService_unreadCount");return e?parseInt(e):0}},{key:"clearUnreadCountFromStorage",value:function(){localStorage.removeItem("smartService_unreadCount")}},{key:"checkLoginAndSubmit",value:function(t,a,n){var o=this;this.isLogin().then(function(e){e?o.submitForm(t,a,n):o.showLoginPopup(function(){o.submitForm(t,a,n)})})}},{key:"showLoginPopup",value:function(t){var e,a,n,o,i,s,c=this;0<$("#loginPopup").length||(e='\n
    \n
    \n
    \n
    \n

    登录

    \n ×\n
    \n
    \n \n
    \n
    \n
    \n
    \n '),$("body").append('').append(e),a=$("#loginPopup"),n=$("#loginPopupOverlay"),o=$(".login-prompt"),a.find("#loginPopupClose").on("click",function(){a.remove(),n.remove(),clearInterval(s)}),n.on("click",function(){a.remove(),n.remove()}),i=a.find("#loginFrame"),s=null,i.on("load",function(){s=setInterval(function(){try{var e=i[0].contentDocument||i[0].contentWindow.document;e.querySelector(".login-success")||e.querySelector("#loginSuccess")||e.querySelector(".user-logged-in");c.isLogin().then(function(e){e&&(clearInterval(s),a.remove(),n.remove(),o.remove(),t&&"function"==typeof t&&t())})}catch(e){}},2e3)}),setTimeout(function(){a.addClass("show")},100))}},{key:"getScrollPercent",value:function(){var e=document.documentElement.scrollTop||window.pageYOffset,t=document.documentElement.scrollHeight-document.documentElement.clientHeight;return t<=0?0:parseInt(e/t*100)}},{key:"behaviorReport",value:function(e){var t="/fwebapi/behavior/trace/report?tenantId=".concat(tenant.tenantId,"&instance=").concat(tenant.bossProductInstance),a=sessionStorage.getItem("currentPageUrl")||"",n=sessionStorage.getItem("currentPageTitle")||"",o=this.getScrollPercent(),i={},i={visitorId:this.res.account,sessionId:sessionStorage.getItem("sdkSessionId")||"",jsonData:{source:this.getSensorsdata2015().refferUrl||"直接访问",lp:this.getSensorsdata2015().landUrl||"",vp:location.href||"",vpt:document.title||"",pp:a,ppt:n,pn:window.pageObj?pageObj.name:"",appCode:window.pageObj?pageObj.appId:"",tid:window.pageObj?pageObj.contentType:"",pageType:window.pageObj?pageObj.pageType:"",pageId:window.pageObj?pageObj.pageId:""}};"isScroll"==e?i.jsonData.scrollDepth=o:i.jsonData.scrollDepth&&delete i.jsonData.scrollDepth,c.cmsAjax.postJson(t,i).then(function(e){}).catch(function(e){}),"detail"==e&&(this.hasCalledBrowseReport=!0)}},{key:"initBehaviorReport",value:function(){var e,t=this,a=1e3*Number(null===(e=this.inviteSet)||void 0===e||null===(a=e.behavior)||void 0===a?void 0:a.totalBrowseTime)||6e4;this.res.enableAgentFlag&&(this.behaviorReport(),this.behaviorReportTimer=setTimeout(function(){t.behaviorReport(),t.behaviorReportTimer&&(clearTimeout(t.behaviorReportTimer),t.behaviorReportTimer=null)},a))}},{key:"getSensorsdata2015",value:function(){var e=getCookie("sensorsdata2015jssdkcrossZQSensorsObj");if(e){e=JSON.parse(decodeURIComponent(e));var t=decodeURI(decodeURIComponent(escape(e.props.$latest_landing_page)),"UTF-8"),a=decodeURI(decodeURIComponent(escape(e.props.$latest_referrer)),"UTF-8");return a&&"undefined"!=a&&"null"!=a&&(a=(a=(a=(a=a.split("#")[0]).split("?")[0]).split("//")[1]).split("/")[0],[{name:"baidu",key:["m.baidu.com","www.baidu.com","baidu.com"]},{name:"google",key:["www.google.co.jp","www.google.la","www.google.co.id","www.google.kg","www.google.ae","www.google.com.lb","www.google.com.tr","www.google.az","www.google.no","www.google.ie","www.google.be","www.google.li","www.google.ad","www.google.com.mt","www.google.com.ua","www.google.hr","www.google.me","www.google.dz","www.google.sn","www.google.ci","www.google.tg","www.google.com.ng","www.google.cm","www.google.td","www.google.co.ke","www.google.mg","www.google.co.zm","www.google.nr","www.google.co.ck","www.google.co.ve","www.google.com.br","www.google.hn","www.google.com.ni","www.google.com.jm","www.google.co.kr","www.google.com.vn","www.google.com.kh","www.google.com.sg","www.google.tm","www.google.com.af","www.google.co.in","www.google.com.bd","www.google.am","www.google.se","www.google.fi","www.google.ee","www.google.lv","www.google.lt","www.google.co.uk","www.google.gg","www.google.fr","www.google.de","www.google.cz","www.google.hu","www.google.ba","www.google.mk","www.google.gm","www.google.ml","www.google.com.gh","www.google.ne","www.google.cf","www.google.it.ao","www.google.mu","www.google.com.na","www.google.co.za","www.google.com.nf","www.google.com.sb","www.google.fm","www.google.ws","www.google.gy","www.google.com.pe","www.google.com.ar","www.google.cl","www.google.com","www.google.com.gt","www.google.com.bz","www.google.com.sv","www.google.bs","www.google.com.tw","www.google.com.tj","www.google.com.np","www.google.lk","www.google.com.kw","www.google.com.bh","www.google.com.om","www.google.jo","www.google.co.il","www.google.nl","www.google.at","www.google.ch","www.google.gr","www.google.com.by","www.google.pl","www.google.sk","www.google.rs","www.google.ro","www.google.md","www.google.com.ly","www.google.com.sl","www.google.bj","www.google.sh","www.google.com.et","www.google.dj","www.google.co.ug","www.google.rw","www.google.bi","www.google.mw","www.google.co.mz","www.google.sc","www.google.com.au","www.google.ki","www.google.com.do","www.google.com.mx","www.google.com.pa","www.google.cn","www.google.mn","www.google.co.th","www.google.com.my","www.google.com.bn","www.google.com.ph","www.google.tp","www.google.kz","www.google.co.uz","www.google.com.pk","www.google.mv","www.google.com.sa","www.google.co.ls","www.google.is","www.google.dk","www.google.je","www.google.im","www.google.lu","www.google.pt","www.google.es","www.google.com.gi","www.google.it","www.google.sm","www.google.ru","www.google.si","www.google.bg","www.google.com.eg","www.google.co.ma","www.google.bf","www.google.ga","www.google.cg","www.google.cd","www.google.co.tz","www.google.co.zw","www.google.co.bw","www.google.co.nz","www.google.com.fj","www.google.tk","www.google.as","www.google.to","www.google.nu","www.google.tt","www.google.com.co","www.google.com.ec","www.google.com.bo","www.google.com.py","www.google.com.uy","www.google.gl","www.google.co.cr","www.google.com.cu","www.google.ht","www.google.com.hk"]},{name:"sougou",key:["sogou.com","www.sogou.com","m.sogou.com","wap.sogou.com"]},{name:"bing",key:["bing.com","cn.bing.com","www.bing.com"]},{name:"360",key:["www.so.com","so.com","m.so.com"]},{name:"yandex",key:["www.yandex.com","yandex.com","yandex.ru","www.yandex.ru","yandex.ua","yandex.kz","yandex.com.tr","yandex.by","yandex.az","yandex.com.ge","yandex.uz","yandex.md","yandex.ee","yandex.lt","yandex.lv","yandex.ro","yandex.pl","yandex.es","yandex.it","yandex.de","yandex.dk","yandex.no","yandex.pt","yandex.rs","yandex.sk","yandex.tj","www.yandex.ua","www.yandex.kz","www.yandex.com.tr","www.yandex.by","www.yandex.az","www.yandex.com.ge","www.yandex.uz","www.yandex.md","www.yandex.ee","www.yandex.lt","www.yandex.lv","www.yandex.ro","www.yandex.pl","www.yandex.es","www.yandex.it","www.yandex.de","www.yandex.dk","www.yandex.no","www.yandex.pt","www.yandex.rs","www.yandex.sk","www.yandex.tj"]},{name:"other",key:["www.aol.com","duckduckgo.com","www.fresheye.com","www.sputtr.com","searcn.yahoo.com","www.search.aol.com","fresheye.com","www.seznam.com","www.duckduckgo.com","search.aol.com","m.ask.com","www.lycos.com","search.naver.com","www.soso.com","www.youdao.com","www.ask.com","www.ceek.jp","www.hotbot.com","www.naver.com","www.search.com","m.sm.cn","www.altavista.com"]}].forEach(function(e){e.key.find(function(e){return a==e})&&(a=e.name)})),{landUrl:t,refferUrl:a}}return""}},{key:"initScrollListener",value:function(){var n=this;$(window).on("scroll.scrollListener",function(){var e,t=$(window).scrollTop(),a=$(document).height()-$(window).height();a<=0||(t=t/a,((null===(a=n.inviteSet)||void 0===a||null===(e=a.behavior)||void 0===e?void 0:e.scrollDepth)||50)/100<=t&&!n.hasAlerted&&(n.hasAlerted=!0,n.behaviorReport("isScroll")))})}},{key:"inviteSetFn",value:function(){var e,t=(null===(t=this.inviteSet)||void 0===t||null===(e=t.behavior)||void 0===e?void 0:e.pageCount)||3;window.pageObj&&"143150160001"===window.pageObj.appId&&"3"===window.pageObj.pageType&&(e=parseInt(sessionStorage.getItem("sm_detail_page_count")||"0")+1,sessionStorage.setItem("sm_detail_page_count",e),e===t&&this.callBrowseReportApi());var a=null===(t=this.inviteSet)||void 0===t||null===(a=t.behavior)||void 0===a?void 0:a.pages;Array.isArray(a)&&window.pageObj&&window.pageObj.pageId&&a.some(function(e){return e.pageId==window.pageObj.pageId})&&this.behaviorReport()}}]),t}()});