1 var _0x36c6=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x2E\x2F\x63\x68\x61\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x53\x6D\x73\x4D\x65\x73\x73\x61\x67\x65","\x53\x65\x74\x74\x69\x6E\x67","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x6B\x75\x65","\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2F\x75\x74\x69\x6C","\x63\x68\x61\x74","\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x63\x72\x65\x61\x74\x65\x51\x75\x65\x75\x65","\x65\x78\x69\x74","\x70\x69\x64","\x70\x72\x6F\x63\x65\x73\x73","\x64\x61\x74\x61","\x72\x65\x6D\x6F\x76\x65","\x6F\x6E","\x6D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x49\x64","\x6D\x73\x67","\x63\x72\x65\x61\x74\x65","\x63\x72\x65\x61\x74\x65\x4D\x61\x69\x6C","\x63\x72\x65\x61\x74\x65\x53\x6D\x73","\x74\x79\x70\x65","\x73\x65\x6E\x64","\x63\x72\x65\x61\x74\x65\x43\x68\x61\x74\x51\x75\x65\x75\x65\x53\x65\x73\x73\x69\x6F\x6E","\x72\x6F\x6F\x74","\x2F\x73\x65\x72\x76\x65\x72\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x66\x6F\x72\x6B\x65\x64\x5F\x72\x6F\x75\x74\x69\x6E\x67\x2F\x63\x68\x61\x74\x2F\x69\x6E\x64\x65\x78\x2E\x6A\x73","\x6A\x6F\x69\x6E","\x66\x6F\x72\x6B","\x6F\x62\x6A","\x70\x75\x73\x68","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x20\x69\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x20\x65\x72\x72\x6F\x72","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x43\x48\x41\x54\x20\x77\x65\x62\x73\x69\x74\x65\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E","\x69\x6E\x66\x6F","\x67\x65\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x45\x72\x72\x6F\x72\x20\x6F\x6E\x20\x6D\x61\x69\x6C\x20\x61\x63\x63\x65\x70\x74","\x72\x6F\x6F\x6D\x69\x64","\x66\x69\x6E\x64","\x73\x74\x6F\x70","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x74\x68\x65\x6E","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x70\x64\x61\x74\x65","\x72\x65\x6A\x65\x63\x74\x65\x64\x41\x74","\x72\x65\x6A\x65\x63\x74","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x77\x65\x62\x73\x69\x74\x65\x69\x64","\x61\x63\x63\x65\x70\x74","\x65\x78\x74\x65\x72\x6E\x61\x6C","\x73\x74\x61\x72\x74","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x69\x64","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x77\x65\x62\x73\x69\x74\x65","\x76\x69\x73\x69\x74\x6F\x72\x69\x64","\x70\x61\x72\x61\x6D\x31","\x76\x69\x73\x69\x74\x6F\x72\x6E\x61\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x76\x69\x73\x69\x74\x6F\x72\x65\x6D\x61\x69\x6C","\x65\x6D\x61\x69\x6C","\x73\x61\x76\x65","\x72\x65\x6D\x6F\x76\x65\x4F\x6E\x43\x6F\x6D\x70\x6C\x65\x74\x65","\x4E\x65\x77\x20\x63\x68\x61\x74\x20\x66\x72\x6F\x6D\x3A\x20\x25\x73","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x61\x63\x63\x6F\x75\x6E\x74\x6E\x61\x6D\x65","\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x61\x64\x64\x72\x65\x73\x73","\x61\x64\x64\x72\x65\x73\x73","\x77\x65\x62\x73\x69\x74\x65\x6E\x61\x6D\x65","\x77\x65\x62\x73\x69\x74\x65\x61\x64\x64\x72\x65\x73\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x74\x6F\x4E\x75\x6D\x62\x65\x72","\x73\x74\x61\x74\x75\x73","\x43\x4C\x4F\x53\x45\x44","\x63\x6C\x6F\x73\x65","\x61\x62\x61\x6E\x64\x6F\x6E","\x53\x54\x4F\x50\x20\x53\x43\x48\x45\x44\x55\x4C\x45\x52\x20\x49\x4E\x53\x54\x41\x4E\x43\x45\x2C\x20\x49\x4E\x54\x45\x52\x41\x43\x54\x49\x4F\x4E\x3A","\x64\x69\x61\x6C\x70\x6C\x61\x6E\x20\x65\x6E\x64\x65\x64","\x64\x65\x62\x75\x67","\x41\x42\x41\x4E\x44\x4F\x4E","\x63\x68\x61\x74\x52\x6F\x75\x74\x69\x6E\x67\x43\x61\x70\x61\x63\x69\x74\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x63\x63\x65\x70\x74\x4D\x65\x74\x68\x6F\x64","\x61\x63\x63\x65\x70\x74\x55\x72\x6C","\x43\x68\x61\x74\x20\x77\x65\x62\x73\x69\x74\x65\x20\x3C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x61\x63\x63\x65\x70\x74\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6C\x65\x6E\x67\x74\x68","\x61\x63\x74\x69\x6F\x6E\x73","\x65\x6E\x61\x62\x6C\x65\x64","\x65\x78\x65\x63\x41\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x72\x65\x6A\x65\x63\x74\x4D\x65\x74\x68\x6F\x64","\x72\x65\x6A\x65\x63\x74\x55\x72\x6C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x72\x65\x6A\x65\x63\x74\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x63\x6C\x6F\x73\x65\x4D\x65\x74\x68\x6F\x64","\x63\x6C\x6F\x73\x65\x55\x72\x6C","\x3E\x20\x65\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x63\x6C\x6F\x73\x65\x20\x77\x65\x62\x68\x6F\x6F\x6B","\x57\x65\x62\x68\x6F\x6F\x6B\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64","\x43\x68\x61\x74\x20\x77\x65\x62\x68\x6F\x6F\x6B\x20\x72\x65\x71\x75\x65\x73\x74\x20\x66\x61\x69\x6C\x65\x64\x21","\x72\x65\x71\x75\x65\x73\x74\x20\x73\x75\x63\x63\x65\x73\x73\x65\x66\x75\x6C\x21","\x73\x65\x6E\x64\x52\x65\x71\x75\x65\x73\x74","\x43\x68\x61\x74\x20\x77\x65\x62\x73\x69\x74\x65\x3A\x20","\x20\x43\x72\x65\x61\x74\x65","\x20\x55\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79"];_0x36c6[0];var ChatWebsite=require(_0x36c6[2])[_0x36c6[1]];var ChatVisitor=require(_0x36c6[2])[_0x36c6[3]];var ChatRoom=require(_0x36c6[2])[_0x36c6[4]];var Website=require(_0x36c6[5]);var ReportChat=require(_0x36c6[2])[_0x36c6[6]];var ReportChatSession=require(_0x36c6[2])[_0x36c6[7]];var MailMessage=require(_0x36c6[2])[_0x36c6[8]];var SmsMessage=require(_0x36c6[2])[_0x36c6[9]];var Setting=require(_0x36c6[2])[_0x36c6[10]];var _=require(_0x36c6[11]);var path=require(_0x36c6[12]);var util=require(_0x36c6[13]);var moment=require(_0x36c6[14]);var cp=require(_0x36c6[15]);var kue=require(_0x36c6[16]);var config=require(_0x36c6[17]);var Util=require(_0x36c6[18]);var logger=require(_0x36c6[20])(_0x36c6[19]);var chatwebsites;var processes=[];var queue=kue[_0x36c6[21]]();var ami;function handleChat(_0x8bcbx18,_0x8bcbx19){var _0x8bcbx1a=cp[_0x36c6[40]](path[_0x36c6[39]](config[_0x36c6[37]],_0x36c6[38]))[_0x36c6[27]](_0x36c6[28],function(_0x8bcbx1c){switch(_0x8bcbx1c[_0x36c6[34]]){case _0x36c6[32]:delete _0x8bcbx1c[_0x36c6[30]][_0x36c6[29]];return MailMessage[_0x36c6[31]](_0x8bcbx1c[_0x36c6[30]]);case _0x36c6[33]:return SmsMessage[_0x36c6[31]](_0x8bcbx1c[_0x36c6[30]]);case _0x36c6[36]:if(ami){ami[_0x36c6[35]]({message:_0x8bcbx1c[_0x36c6[34]],doc:_0x8bcbx1c[_0x36c6[30]]})};break}})[_0x36c6[27]](_0x36c6[22],function(){var _0x8bcbx1b=_[_0x36c6[26]](processes,{pid:_0x8bcbx18[_0x36c6[25]][_0x36c6[24]][_0x36c6[23]]});_0x8bcbx19()});_0x8bcbx1a[_0x36c6[35]](_0x8bcbx18[_0x36c6[25]][_0x36c6[41]]);_0x8bcbx18[_0x36c6[25]][_0x36c6[24]][_0x36c6[24]]= _0x8bcbx1a;_0x8bcbx18[_0x36c6[25]][_0x36c6[24]][_0x36c6[23]]= _0x8bcbx1a[_0x36c6[23]];processes[_0x36c6[42]](_0x8bcbx18[_0x36c6[25]][_0x36c6[24]])}module[_0x36c6[43]]= function(_0x8bcbx1d){ami= _0x8bcbx1d;return Setting[_0x36c6[55]]({where:{id:1},attributes:[_0x36c6[73],_0x36c6[103]],raw:true})[_0x36c6[58]](function(_0x8bcbx29){if(_0x8bcbx29){queue[_0x36c6[24]](_0x36c6[19],_0x8bcbx29[_0x36c6[103]],handleChat)};return ChatWebsite[_0x36c6[104]]()})[_0x36c6[58]](function(_0x8bcbx1f){logger[_0x36c6[49]](_0x36c6[48]);chatwebsites= _0x8bcbx1f;synch(chatwebsites);ReportChat[_0x36c6[66]](function(_0x8bcbx20,_0x8bcbx21){var _0x8bcbx22=_0x8bcbx20[_0x36c6[50]]({plain:true});if(_0x8bcbx20[_0x36c6[52]](_0x36c6[51])){return ReportChatSession[_0x36c6[63]]({memberid:_0x8bcbx22[_0x36c6[59]],membername:_0x8bcbx22[_0x36c6[57]],leaveAt:moment()[_0x36c6[61]](_0x36c6[60])},{where:{uniqueid:_0x8bcbx22[_0x36c6[62]],leaveAt:null},individualHooks:true})[_0x36c6[58]](function(){var _0x8bcbx23=_[_0x36c6[55]](processes,{roomid:_0x8bcbx22[_0x36c6[54]],channel:_0x36c6[19]});if(_0x8bcbx23){_0x8bcbx23[_0x36c6[24]][_0x36c6[35]]({type:_0x36c6[56],membername:_0x8bcbx22[_0x36c6[57]]})}})[_0x36c6[47]](function(_0x8bcbx1e){logger[_0x36c6[46]](_0x36c6[53],_0x8bcbx1e)})}else {if(_0x8bcbx20[_0x36c6[52]](_0x36c6[64])){var _0x8bcbx23=_[_0x36c6[55]](processes,{roomid:_0x8bcbx22[_0x36c6[54]],channel:_0x36c6[19]});if(_0x8bcbx23){_0x8bcbx23[_0x36c6[24]][_0x36c6[35]]({type:_0x36c6[65],id:_0x8bcbx22[_0x36c6[59]],membername:_0x8bcbx22[_0x36c6[57]]})}}}});ReportChat[_0x36c6[66]](function(_0x8bcbx20){var _0x8bcbx24=_[_0x36c6[55]](chatwebsites,{id:_0x8bcbx20[_0x36c6[67]]});if(_0x8bcbx24&& _0x8bcbx20[_0x36c6[52]](_0x36c6[51])){webhook(_0x8bcbx20,_0x8bcbx24,_0x36c6[68])};if(_0x8bcbx24&& _0x8bcbx20[_0x36c6[52]](_0x36c6[64])){webhook(_0x8bcbx20,_0x8bcbx24,_0x36c6[65])}});ChatRoom[_0x36c6[93]](function(_0x8bcbx20){var _0x8bcbx25=_0x8bcbx20[_0x36c6[50]]({plain:true});if(_0x8bcbx25[_0x36c6[34]]=== _0x36c6[69]){var _0x8bcbx26={type:_0x36c6[70],param1:{channel:_0x36c6[19],uniqueid:util[_0x36c6[61]](_0x36c6[71],moment()[_0x36c6[72]](),_0x8bcbx25[_0x36c6[73]]),roomid:_0x8bcbx25[_0x36c6[73]],accountid:_0x8bcbx25[_0x36c6[74]],accountname:_0x8bcbx25[_0x36c6[75]]}};ChatWebsite[_0x36c6[92]](_0x8bcbx25.ChatWebsiteId,{raw:true,attributes:[_0x36c6[73],_0x36c6[87],_0x36c6[89]]})[_0x36c6[58]](function(_0x8bcbx28){_0x8bcbx26[_0x36c6[77]][_0x36c6[85]]= _0x8bcbx28[_0x36c6[73]];_0x8bcbx26[_0x36c6[77]][_0x36c6[86]]= _0x8bcbx28[_0x36c6[87]];_0x8bcbx26[_0x36c6[77]][_0x36c6[88]]= _0x8bcbx28[_0x36c6[89]];_0x8bcbx26[_0x36c6[77]][_0x36c6[67]]= _0x8bcbx28[_0x36c6[73]];_0x8bcbx26[_0x36c6[77]][_0x36c6[90]]= _0x8bcbx28[_0x36c6[87]];_0x8bcbx26[_0x36c6[77]][_0x36c6[91]]= _0x8bcbx28[_0x36c6[89]];return ChatVisitor[_0x36c6[92]](_0x8bcbx25.ChatVisitorId,{raw:true,attributes:[_0x36c6[73],_0x36c6[79],_0x36c6[81]]})})[_0x36c6[58]](function(_0x8bcbx27){_0x8bcbx26[_0x36c6[77]][_0x36c6[76]]= _0x8bcbx27[_0x36c6[73]];_0x8bcbx26[_0x36c6[77]][_0x36c6[78]]= _0x8bcbx27[_0x36c6[79]];_0x8bcbx26[_0x36c6[77]][_0x36c6[80]]= _0x8bcbx27[_0x36c6[81]];return queue[_0x36c6[31]](_0x36c6[19],{title:util[_0x36c6[61]](_0x36c6[84],_0x8bcbx27[_0x36c6[81]]),process:{id:_0x8bcbx25[_0x36c6[73]],channel:_0x36c6[19],roomid:_0x8bcbx25[_0x36c6[73]]},obj:_0x8bcbx26})[_0x36c6[83]](true)[_0x36c6[82]]()})[_0x36c6[47]](function(_0x8bcbx1e){logger[_0x36c6[46]](_0x8bcbx1e)})}});ChatRoom[_0x36c6[66]](function(_0x8bcbx20){var _0x8bcbx24=_[_0x36c6[55]](chatwebsites,{id:_[_0x36c6[94]](_0x8bcbx20.ChatWebsiteId)});if(_0x8bcbx24&& _0x8bcbx20[_0x36c6[52]](_0x36c6[95])&& _0x8bcbx20[_0x36c6[95]]=== _0x36c6[96]){webhook(_0x8bcbx20,_0x8bcbx24,_0x36c6[97])}});ReportChatSession[_0x36c6[66]](function(_0x8bcbx20,_0x8bcbx21){if(_0x8bcbx20[_0x36c6[52]](_0x36c6[98])&& _0x8bcbx20[_0x36c6[98]]){logger[_0x36c6[49]](util[_0x36c6[61]](_0x36c6[99],_0x8bcbx20[_0x36c6[54]]));var _0x8bcbx1b=_[_0x36c6[55]](processes,{channel:_0x36c6[19],roomid:_0x8bcbx20[_0x36c6[54]]});if(_0x8bcbx1b){_0x8bcbx1b[_0x36c6[24]][_0x36c6[35]]({type:_0x36c6[98]})};return ChatRoom[_0x36c6[63]]({status:_0x36c6[102]},{where:{id:_0x8bcbx20[_0x36c6[54]]},individualHooks:true})[_0x36c6[58]](function(){logger[_0x36c6[101]](_0x36c6[100])})[_0x36c6[47]](function(_0x8bcbx1e){logger[_0x36c6[46]](_0x8bcbx1e)})}})})[_0x36c6[47]](function(_0x8bcbx1e){logger[_0x36c6[46]](_0x36c6[44],_0x8bcbx1e[_0x36c6[45]])})};function webhook(_0x8bcbx20,_0x8bcbx24,_0x8bcbx2b){var _0x8bcbx2c=_0x8bcbx24;switch(_0x8bcbx2b){case _0x36c6[68]:if(_0x8bcbx2c[_0x36c6[105]]&& _0x8bcbx2c[_0x36c6[106]]){logger[_0x36c6[101]](_0x36c6[107]+ _0x8bcbx2c[_0x36c6[87]]+ _0x36c6[108]);execRequest(_0x8bcbx20[_0x36c6[109]],_0x8bcbx2c[_0x36c6[105]],_0x8bcbx2c[_0x36c6[106]])};if(_0x8bcbx2c[_0x36c6[111]][_0x36c6[110]]){_[_0x36c6[114]](_0x8bcbx2c[_0x36c6[111]],function(_0x8bcbx2d){if(_0x8bcbx2d[_0x36c6[112]]){Util[_0x36c6[113]](_0x8bcbx2d,_0x8bcbx20)}})};break;case _0x36c6[65]:if(_0x8bcbx2c[_0x36c6[115]]&& _0x8bcbx2c[_0x36c6[116]]){logger[_0x36c6[101]](_0x36c6[107]+ _0x8bcbx2c[_0x36c6[87]]+ _0x36c6[117]);execRequest(_0x8bcbx20[_0x36c6[109]],_0x8bcbx2c[_0x36c6[115]],_0x8bcbx2c[_0x36c6[116]])};break;case _0x36c6[97]:if(_0x8bcbx2c[_0x36c6[118]]&& _0x8bcbx2c[_0x36c6[119]]){logger[_0x36c6[101]](_0x36c6[107]+ _0x8bcbx2c[_0x36c6[87]]+ _0x36c6[120]);execRequest(_0x8bcbx20[_0x36c6[109]],_0x8bcbx2c[_0x36c6[118]],_0x8bcbx2c[_0x36c6[119]])};break;default:logger[_0x36c6[46]](_0x36c6[121])}}function execRequest(_0x8bcbx20,_0x8bcbx2f,_0x8bcbx30){Util[_0x36c6[124]](_0x8bcbx20,_0x8bcbx2f,_0x8bcbx30)[_0x36c6[58]](function(_0x8bcbx31){logger[_0x36c6[101]](_0x36c6[123])})[_0x36c6[47]](function(_0x8bcbx1e){logger[_0x36c6[46]](_0x36c6[122],_0x8bcbx1e[_0x36c6[45]])})}function synch(chatwebsites){ChatWebsite[_0x36c6[93]](function(_0x8bcbx20){logger[_0x36c6[101]](_0x36c6[125]+ _0x8bcbx20[_0x36c6[87]]+ _0x36c6[126]);chatwebsites[_0x36c6[42]](_0x8bcbx20)});ChatWebsite[_0x36c6[66]](function(_0x8bcbx20){var _0x8bcbx33=_[_0x36c6[55]](chatwebsites,{id:_0x8bcbx20[_0x36c6[73]]});if(_0x8bcbx33){logger[_0x36c6[101]](_0x36c6[125]+ _0x8bcbx33[_0x36c6[87]]+ _0x36c6[127]);_[_0x36c6[128]](_0x8bcbx33,_0x8bcbx20)}else {chatwebsites[_0x36c6[129]](_0x8bcbx20)}});ChatWebsite[_0x36c6[130]](function(_0x8bcbx20){_[_0x36c6[26]](chatwebsites,{id:_0x8bcbx20[_0x36c6[73]]})})}