votcore
Version:
Vot Kit for Valensas Bots
1 lines • 63.4 kB
JavaScript
var _0x4598=["https://deneme.sorunapp.com","getConversationIdentifier","production","checkIncomingHookToken","getUser","User","name","client","surname","phone","mail","variable","saveContext","save","endConversation","put","/Conversation?","Sorun - Error while ending conversation","deleteWithChannel","receiveMessage","Sorun - No token specified","Sorun - Only TEXT or CARD messages can be handled","getWithChannel","conversationID","Conversation","Sorun - Incoming hook token is invalid","sendMessage","Sorun - No conversationID was specified","Sending message with body: %o","Sorun:sendMessage","Sending message with querystring: %s","post","textReply","urlReply","discoverUrl","description","cardReply","CardMessage","/Agent?","subtract","minutes","isActive","isBot","isAfter","lastOnline","getPoolData","Sorun - Error while getting open conversations","/Pool?","poolID","Sorun - Pool not found","find","getPoolDataByPoolID","/Client/Pool?","Sorun - Error while getting pool information","yieldToAgent","Sorun:yieldToAgent","Sorun - Error while yielding to an agent","Sorun:changePool","Sorun - Error while changing conversation pool","setHold","Sorun:setHold","Sorun - Error while setting conversation as on hold","unHold","Sorun:unHold","getCompanyData","/Client/Company?","Sorun - Error while getting company information","inWorkingHours","isOutOfOffice","inWorkingHoursByPoolID","getOpenConversations","findMostAvailableAgent","all","getActiveAgents","concat","fromPairs","groupBy","currentAgent","orderBy","channel","date","Message","context","status","Started","startDate","endDate","serialize","deserialize","parse","isMobile","ios","toContext","fromContext","Sayfaya git","firstName","lastName","email","phoneNumber","accessToken","__rest","getOwnPropertySymbols","project","channels","redisUrl","engineUrl","schedulerUrl","flows","flowResultCallback","start","createClient","redis","promisifyAll","Redis","ready","Connected","createTask","/triggers","startOneTimeTask","Conversation does not have an ID","callback","/timeout","VotClient:Scheduler","One time task scheduled: %o","revokeOneTimeTask","DELETE","One time task revoked: %o","getCommands","VotClient:getCommands","Reqeusting commands for message: %s","Commands response: %O","intents","getIntents","VotClient:getIntents","Reqeusting intents for message: %s","/intents","Intents response: %O","getYesNo","VotClient:getYesNo","Reqeusting yes or no response for message: %s","Error fetching yes no response.","positive","predict","VotClient:predict","Predicting response with model %s for message: %s","Error fetching prediction response.","Response for %s model: %O","extractOne","VotClient:extractOne","Reqeusting extraction of %s in message: %s","Extraction response of %s in message: %s is %o","dequeueOld","zremrangebyscoreAsync","-inf","getTime","enqueue","zaddAsync","dequeue","zremrangebyrankAsync","removeFromQueue","zremAsync","getNextOnQueue","zrangebyscoreAsync","getRankOnQueue","zrankAsync","pushMessage","messages:","msetAsync","conversation:","getAsync","channel2conversation:","Invalid conversation","getClient","runTrigger","runFlow","entrypoint","This flow does not have an entrypoint specified. You have to provide one during instantiation","Flow path: %s","join","Invalid flow declaration","Client: %o","This conversation is not registered to a flow","Complete state: %o","Flow exited with path: "," -> ","passedValidation","Validation failed with at least one requirement","Calling action body","Action body successfully returned","VotClient","bluebird","moment-timezone","moment/locale/tr","exports","apply","return (function() ","console","log","warn","debug","info","error","exception","trace","call","defineProperty","__esModule","default","hasOwnProperty","prototype","use strict","lodash","install","slice","length","splice","label","isUri","Invalid Url","push","trys","get","sent","load","data","replace","trim","text","title","attr",'meta[name="description"]',"content","utils:getUrlTitleAndDescription","An error has occured while fetching url information: %o","validate","isArray","toPairs","forEach","__awaiter","next","throw","done","value","then","return","ops","pop","function","iterator","addBetween","getUrlTitleAndDescription","validateFunctional","validateBoolean","fromPairsPromise","arrayify","inverseMap","joi","moment","source-map-support","info:votcore:","verbose:votcore:","verbose:votcore","error:votcore","warn:votcore","uri","string","__generator","Generator is already executing.","logger","createLogger","vot","bunyan","cheerio","ChannelMessageStatic","kind","Action","exits","options","allKeysJoiSchema","isJoi","keys","toJoiSchema","object","prepareState","requirements","mapValues","validation","state","body","result","passthrough","ChannelClient","__assign","assign","flow","fromPrototype","filter","indexOf","resolve","isString","Context","Flow","steps","payload","toString","toJSON","GUID","uuid","Channels","SorunClient","__extends","setPrototypeOf","__proto__","constructor","create","locale","message","conversation","type","TEXT","verbose","Sorun:SorunMessage","Constructed a SorunMessageInput: %o","fromMessage","Sorun:fromMessage","Generating Sorun payload for message: %o","payloadType","Using text message type","url","Using url message type","toCard","self","Sorun","channelData","platform","Generated card message instead for url message: %o","fromCardMessage","card","Using card message type","Sorun - This message payload type is no compatible with Sorun","map","elements","Sorun - Card with only a single body is supported by Sorun","Sorun - Card does not have a body","buttons","link","Sorun - This message type is not compatible with Sorun","imageUrl","stringify","CARD","getDate","toDate","messageDate","YYYY-MM-DD-HH-mm","Europe/Istanbul","getMessagePayloadType","location","Sorun - Unknown payload type","getMessageType","LOG","isAgent","user","Sorun - Unknown message type","getPlatform","CLIENTANDROID","android","Sorun - Unknown platform","web","toMessage","userID","uniqueID","TextMessage","UrlMessage","action","Sorun - Unknown card type","image","SorunMessage","apiKey","incomingHookToken","environment","initialContext","companyID","timeoutInMilliseconds","isProduction","https://api.sorunapp.com"];!function(x,t){!function(t){for(;--t;)x.push(x.shift())}(++t)}(_0x4598,193);var _0x5317=function(x,t){var x=parseInt(x,16);return _0x4598[x]};module[_0x5317("0x0")]=function(x){function t(r){if(n(this,function(){var x=Function(_0x5317("0x2")+'{}.constructor("return this")( ));'),t=function(){},n=x();n[_0x5317("0x3")]?(n[_0x5317("0x3")][_0x5317("0x4")]=t,n[_0x5317("0x3")][_0x5317("0x5")]=t,n[_0x5317("0x3")][_0x5317("0x6")]=t,n[_0x5317("0x3")][_0x5317("0x7")]=t,n[_0x5317("0x3")][_0x5317("0x8")]=t,n[_0x5317("0x3")][_0x5317("0x9")]=t,n[_0x5317("0x3")].trace=t):n[_0x5317("0x3")]=function(x){var t={};return t[_0x5317("0x4")]=x,t[_0x5317("0x5")]=x,t[_0x5317("0x6")]=x,t[_0x5317("0x7")]=x,t.error=x,t[_0x5317("0x9")]=x,t[_0x5317("0xa")]=x,t}(t)})(),e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return x[r][_0x5317("0xb")](i.exports,i,i[_0x5317("0x0")],t),i.l=!0,i.exports}var n=function(){var x=!![];return function(t,n){var e=x?function(){if(n){var x=n[_0x5317("0x1")](t,arguments);return n=null,x}}:function(){};return x=![],e}}(),e={};return t.m=x,t.c=e,t.i=function(x){return x},t.d=function(x,n,e){t.o(x,n)||Object[_0x5317("0xc")](x,n,{configurable:!1,enumerable:!0,get:e})},t.n=function(x){var n=x&&x.__esModule?function(){return x[_0x5317("0xe")]}:function(){return x};return t.d(n,"a",n),n},t.o=function(x,t){return Object[_0x5317("0x10")][_0x5317("0xf")][_0x5317("0xb")](x,t)},t.p="",t(t.s=64)}([function(x,t,n){function e(x){for(var n in x)t[_0x5317("0xf")](n)||(t[n]=x[n])}_0x5317("0x11"),Object.defineProperty(t,"__esModule",{value:!0}),e(n(16)),e(n(17)),e(n(30)),e(n(24)),e(n(19)),e(n(25)),e(n(26)),e(n(28)),e(n(15)),e(n(18)),e(n(29)),e(n(27)),e(n(23))},function(x,t){x[_0x5317("0x0")]=require(_0x5317("0x12"))},function(x,t,n){n(7)[_0x5317("0x13")]()},function(x,t,n){function e(x){for(var n in x)t[_0x5317("0xf")](n)||(t[n]=x[n])}function r(x,t){for(var n=x[_0x5317("0x14")](),e=0;e<x[_0x5317("0x15")]-1;e++)n[_0x5317("0x16")](2*e-1,0,t);return n}function i(x){return d(this,void 0,void 0,function(){var t,n,e,r,i;return h(this,function(o){switch(o.label){case 0:if(!y[_0x5317("0x18")](x))throw new Error(_0x5317("0x19"));o[_0x5317("0x17")]=1;case 1:return o[_0x5317("0x1b")][_0x5317("0x1a")]([1,3,,4]),[4,v[_0x5317("0xe")].get(x)];case 2:return t=o[_0x5317("0x1d")](),n=p[_0x5317("0x1e")](t[_0x5317("0x1f")]),e=n(_0x5317("0x23")).text()[_0x5317("0x21")]()[_0x5317("0x20")](/(\r\n|\n|\r)/gm,""),r=n(_0x5317("0x25"))[_0x5317("0x24")](_0x5317("0x26")).trim()[_0x5317("0x20")](/(\r\n|\n|\r)/gm,""),[2,{title:e,description:r,url:x}];case 3:return i=o.sent(),w[_0x5317("0x6")][_0x5317("0x7")](_0x5317("0x27"))(_0x5317("0x28"),i),[2,null];case 4:return[2]}})})}function o(x,t){return new Promise(function(n,e){l[_0x5317("0x29")](x,t,{convert:!0,allowUnknown:!0,stripUnknown:!0,abortEarly:!0,skipFunctions:!0},function(x,t){return x?e(x):n(t)})})}function _(x,t){return new Promise(function(n,e){l[_0x5317("0x29")](x,t,{convert:!0,allowUnknown:!0,stripUnknown:!0,abortEarly:!0,skipFunctions:!0},function(x,t){return n(x?[x,null]:[null,t])})})}function a(x,t){return new Promise(function(n,e){l.validate(x,t,{convert:!0,allowUnknown:!0,stripUnknown:!0,abortEarly:!0,skipFunctions:!0},function(x){return n(!x)})})}function s(x,t){var n={data:x},e={data:t};return new Promise(function(x,t){l[_0x5317("0x29")](n,e,{convert:!0,allowUnknown:!0,stripUnknown:!0,abortEarly:!0,skipFunctions:!0},function(t){return x(!t)})})}function c(x){return d(this,void 0,void 0,function(){var t,n,e,r,i,o,_;return h(this,function(a){switch(a[_0x5317("0x17")]){case 0:t={},n=0,e=x,a[_0x5317("0x17")]=1;case 1:return n<e[_0x5317("0x15")]?(r=e[n],[4,r]):[3,4];case 2:i=a[_0x5317("0x1d")](),o=i[0],_=i[1],t[o]=_,a[_0x5317("0x17")]=3;case 3:return n++,[3,1];case 4:return[2,t]}})})}function u(x){return x&&!Array[_0x5317("0x2a")](x)?[x]:x}function f(x){var t={};return b[_0x5317("0x2b")](x)[_0x5317("0x2c")](function(x){var n=x[0],e=x[1];t[e]=n}),t}_0x5317("0x11");var d=this&&this[_0x5317("0x2d")]||function(x,t,n,e){return new(n||(n=Promise))(function(r,i){function o(x){try{a(e[_0x5317("0x2e")](x))}catch(x){i(x)}}function _(x){try{a(e[_0x5317("0x2f")](x))}catch(x){i(x)}}function a(x){x[_0x5317("0x30")]?r(x[_0x5317("0x31")]):new n(function(t){t(x[_0x5317("0x31")])})[_0x5317("0x32")](o,_)}a((e=e[_0x5317("0x1")](x,t||[]))[_0x5317("0x2e")]())})},h=this&&this.__generator||function(x,t){function n(x){return function(t){return e([x,t])}}function e(n){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(o=i[2&n[0]?_0x5317("0x33"):n[0]?"throw":_0x5317("0x2e")])&&!(o=o[_0x5317("0xb")](i,n[1]))[_0x5317("0x30")])return o;switch(i=0,o&&(n=[0,o[_0x5317("0x31")]]),n[0]){case 0:case 1:o=n;break;case 4:return a[_0x5317("0x17")]++,{value:n[1],done:!1};case 5:a[_0x5317("0x17")]++,i=n[1],n=[0];continue;case 7:n=a[_0x5317("0x34")][_0x5317("0x35")](),a[_0x5317("0x1b")].pop();continue;default:if(o=a.trys,!(o=o[_0x5317("0x15")]>0&&o[o[_0x5317("0x15")]-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a[_0x5317("0x17")]=n[1];break}if(6===n[0]&&a[_0x5317("0x17")]<o[1]){a[_0x5317("0x17")]=o[1],o=n;break}if(o&&a[_0x5317("0x17")]<o[2]){a[_0x5317("0x17")]=o[2],a[_0x5317("0x34")][_0x5317("0x1a")](n);break}o[2]&&a.ops[_0x5317("0x35")](),a.trys[_0x5317("0x35")]();continue}n=t[_0x5317("0xb")](x,a)}catch(x){n=[6,x],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var r,i,o,_,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return _={next:n(0),throw:n(1),return:n(2)},_0x5317("0x36")==typeof Symbol&&(_[Symbol.iterator]=function(){return this}),_};Object[_0x5317("0xc")](t,"__esModule",{value:!0});var l=n(4);e(n(10)),e(n(8));var v=n(5),p=n(13),b=n(1),w=n(8),y=n(9);t[_0x5317("0x38")]=r,t[_0x5317("0x39")]=i,t.validate=o,t[_0x5317("0x3a")]=_,t.validateBoolean=a,t.is=s,t.fromPairsPromise=c,t[_0x5317("0x3d")]=u,t[_0x5317("0x3e")]=f},function(x,t){x.exports=require(_0x5317("0x3f"))},function(x,t){x[_0x5317("0x0")]=require("axios")},function(x,t){x[_0x5317("0x0")]=require(_0x5317("0x40"))},function(x,t){x.exports=require(_0x5317("0x41"))},function(x,t,n){_0x5317("0x11"),Object[_0x5317("0xc")](t,"__esModule",{value:!0});var e=n(12);t[_0x5317("0x6")]={info:function(x){return e(x?_0x5317("0x42")+x:"info:votcore")},verbose:function(x){return e(x?_0x5317("0x43")+x:_0x5317("0x44"))},error:function(x){return e(x?"error:votcore:"+x:_0x5317("0x45"))},warn:function(x){return e(x?"warn:votcore:"+x:_0x5317("0x46"))}}},function(x,t,n){function e(x){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t[_0x5317("0x17")]){case 0:return[4,_.is(x,o.string()[_0x5317("0x47")]({scheme:[/https?/]}))];case 1:return[2,t[_0x5317("0x1d")]()]}})})}var r=this&&this[_0x5317("0x2d")]||function(x,t,n,e){return new(n||(n=Promise))(function(r,i){function o(x){try{a(e[_0x5317("0x2e")](x))}catch(x){i(x)}}function _(x){try{a(e[_0x5317("0x2f")](x))}catch(x){i(x)}}function a(x){x[_0x5317("0x30")]?r(x[_0x5317("0x31")]):new n(function(t){t(x[_0x5317("0x31")])})[_0x5317("0x32")](o,_)}a((e=e[_0x5317("0x1")](x,t||[]))[_0x5317("0x2e")]())})},i=this&&this[_0x5317("0x49")]||function(x,t){function n(x){return function(t){return e([x,t])}}function e(n){if(r)throw new TypeError(_0x5317("0x4a"));for(;a;)try{if(r=1,i&&(o=i[2&n[0]?"return":n[0]?_0x5317("0x2f"):"next"])&&!(o=o[_0x5317("0xb")](i,n[1]))[_0x5317("0x30")])return o;switch(i=0,o&&(n=[0,o[_0x5317("0x31")]]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a[_0x5317("0x17")]++,i=n[1],n=[0];continue;case 7:n=a.ops.pop(),a[_0x5317("0x1b")][_0x5317("0x35")]();continue;default:if(o=a.trys,!(o=o[_0x5317("0x15")]>0&&o[o[_0x5317("0x15")]-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a[_0x5317("0x17")]<o[1]){a[_0x5317("0x17")]=o[1],o=n;break}if(o&&a[_0x5317("0x17")]<o[2]){a[_0x5317("0x17")]=o[2],a[_0x5317("0x34")][_0x5317("0x1a")](n);break}o[2]&&a[_0x5317("0x34")][_0x5317("0x35")](),a[_0x5317("0x1b")][_0x5317("0x35")]();continue}n=t[_0x5317("0xb")](x,a)}catch(x){n=[6,x],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var r,i,o,_,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return _={next:n(0),throw:n(1),return:n(2)},_0x5317("0x36")==typeof Symbol&&(_[Symbol[_0x5317("0x37")]]=function(){return this}),_};Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var o=n(4),_=n(3);t[_0x5317("0x18")]=e},function(x,t,n){_0x5317("0x11"),Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var e=n(11);t[_0x5317("0x4b")]=e[_0x5317("0x4c")]({name:_0x5317("0x4d")})},function(x,t){x[_0x5317("0x0")]=require(_0x5317("0x4e"))},function(x,t){x[_0x5317("0x0")]=require(_0x5317("0x6"))},function(x,t){x[_0x5317("0x0")]=require(_0x5317("0x4f"))},function(x,t,n){_0x5317("0x11"),Object[_0x5317("0xc")](t,"__esModule",{value:!0});var e=function(){function x(){}return x}();t.ChannelMessageStatic=e},function(x,t,n){_0x5317("0x11");var e=this&&this.__awaiter||function(x,t,n,e){return new(n||(n=Promise))(function(r,i){function o(x){try{a(e[_0x5317("0x2e")](x))}catch(x){i(x)}}function _(x){try{a(e[_0x5317("0x2f")](x))}catch(x){i(x)}}function a(x){x[_0x5317("0x30")]?r(x[_0x5317("0x31")]):new n(function(t){t(x[_0x5317("0x31")])})[_0x5317("0x32")](o,_)}a((e=e[_0x5317("0x1")](x,t||[]))[_0x5317("0x2e")]())})},r=this&&this.__generator||function(x,t){function n(x){return function(t){return e([x,t])}}function e(n){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(o=i[2&n[0]?_0x5317("0x33"):n[0]?_0x5317("0x2f"):"next"])&&!(o=o[_0x5317("0xb")](i,n[1]))[_0x5317("0x30")])return o;switch(i=0,o&&(n=[0,o[_0x5317("0x31")]]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,i=n[1],n=[0];continue;case 7:n=a[_0x5317("0x34")][_0x5317("0x35")](),a.trys[_0x5317("0x35")]();continue;default:if(o=a[_0x5317("0x1b")],!(o=o.length>0&&o[o[_0x5317("0x15")]-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a[_0x5317("0x17")]=n[1];break}if(6===n[0]&&a[_0x5317("0x17")]<o[1]){a[_0x5317("0x17")]=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a[_0x5317("0x34")][_0x5317("0x1a")](n);break}o[2]&&a[_0x5317("0x34")].pop(),a[_0x5317("0x1b")][_0x5317("0x35")]();continue}n=t[_0x5317("0xb")](x,a)}catch(x){n=[6,x],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var r,i,o,_,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return _={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(_[Symbol[_0x5317("0x37")]]=function(){return this}),_};Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var i=n(4),o=n(1),_=n(3),a=function(){function x(x,t){this.kind=_0x5317("0x52"),this.requirements=null,this[_0x5317("0x53")]=x,this[_0x5317("0x54")]=t}return x[_0x5317("0x10")][_0x5317("0x55")]=function(x){if(x[_0x5317("0x56")])return!0;for(var t=0,n=Object[_0x5317("0x57")](x);t<n.length;t++)if(!x[n[t]][_0x5317("0x56")])return!1;return!0},x[_0x5317("0x10")][_0x5317("0x58")]=function(x){var t=this;if(x){for(var n=function(x){var e=t[_0x5317("0x55")](x);if(e&&!x[_0x5317("0x56")])return i[_0x5317("0x59")]().keys(x);if(e&&x[_0x5317("0x56")])return x;for(var r=0,o=Object[_0x5317("0x57")](x);r<o[_0x5317("0x15")];r++){var _=o[r],a=x[_];x[_]=n(a)}return i[_0x5317("0x59")]()[_0x5317("0x57")](x)},e=0,r=o[_0x5317("0x57")](x);e<r[_0x5317("0x15")];e++){var _=r[e],a=x[_];x[_]=n(a)}return x}},x[_0x5317("0x10")][_0x5317("0x5a")]=function(x){return e(this,void 0,void 0,function(){var t,n,e,i,a,s,c,u,f,d,h;return r(this,function(r){switch(r.label){case 0:if(t=!1,n={},!(e=this[_0x5317("0x58")](this[_0x5317("0x5b")])))return[2,{passedValidation:!0}];i=o[_0x5317("0x5c")](e,function(){return{}}),a=0,s=o[_0x5317("0x57")](e),r.label=1;case 1:return a<s[_0x5317("0x15")]?(c=s[a],u=e[c],[4,_.validateFunctional(x[_0x5317("0x1f")],u)]):[3,4];case 2:f=r[_0x5317("0x1d")](),d=f[0],h=f[1],d&&(n[c]=d,t=!0),i[c]=h,r[_0x5317("0x17")]=3;case 3:return a++,[3,1];case 4:return this.validation=n,this[_0x5317("0x5e")]=i,[2,{passedValidation:!t}]}})})},x[_0x5317("0x10")][_0x5317("0x5f")]=function(x){var t=x[_0x5317("0x60")];return e(this,void 0,void 0,function(){return r(this,function(x){return[2,t[_0x5317("0x61")]({})]})})},x}();t[_0x5317("0x52")]=a},function(x,t,n){_0x5317("0x11"),Object[_0x5317("0xc")](t,"__esModule",{value:!0});var e=function(){function x(){}return x}();t[_0x5317("0x62")]=e},function(x,t,n){var e=this&&this[_0x5317("0x63")]||Object[_0x5317("0x64")]||function(x){for(var t,n=1,e=arguments[_0x5317("0x15")];n<e;n++){t=arguments[n];for(var r in t)Object[_0x5317("0x10")][_0x5317("0xf")][_0x5317("0xb")](t,r)&&(x[r]=t[r])}return x},r=this&&this.__awaiter||function(x,t,n,e){return new(n||(n=Promise))(function(r,i){function o(x){try{a(e[_0x5317("0x2e")](x))}catch(x){i(x)}}function _(x){try{a(e[_0x5317("0x2f")](x))}catch(x){i(x)}}function a(x){x[_0x5317("0x30")]?r(x.value):new n(function(t){t(x[_0x5317("0x31")])})[_0x5317("0x32")](o,_)}a((e=e[_0x5317("0x1")](x,t||[]))[_0x5317("0x2e")]())})},i=this&&this[_0x5317("0x49")]||function(x,t){function n(x){return function(t){return e([x,t])}}function e(n){if(r)throw new TypeError(_0x5317("0x4a"));for(;a;)try{if(r=1,i&&(o=i[_0x5317(2&n[0]?"0x33":n[0]?"0x2f":"0x2e")])&&!(o=o[_0x5317("0xb")](i,n[1]))[_0x5317("0x30")])return o;switch(i=0,o&&(n=[0,o[_0x5317("0x31")]]),n[0]){case 0:case 1:o=n;break;case 4:return a[_0x5317("0x17")]++,{value:n[1],done:!1};case 5:a[_0x5317("0x17")]++,i=n[1],n=[0];continue;case 7:n=a.ops[_0x5317("0x35")](),a[_0x5317("0x1b")][_0x5317("0x35")]();continue;default:if(o=a.trys,!(o=o[_0x5317("0x15")]>0&&o[o[_0x5317("0x15")]-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a[_0x5317("0x17")]<o[1]){a[_0x5317("0x17")]=o[1],o=n;break}if(o&&a[_0x5317("0x17")]<o[2]){a[_0x5317("0x17")]=o[2],a[_0x5317("0x34")].push(n);break}o[2]&&a.ops[_0x5317("0x35")](),a[_0x5317("0x1b")].pop();continue}n=t[_0x5317("0xb")](x,a)}catch(x){n=[6,x],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var r,i,o,_,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return _={next:n(0),throw:n(1),return:n(2)},_0x5317("0x36")==typeof Symbol&&(_[Symbol.iterator]=function(){return this}),_};Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var o=n(1),_=function(){function x(x){var t=x[_0x5317("0x1f")],n=x[_0x5317("0x5e")],e=x[_0x5317("0x65")];this[_0x5317("0x1f")]=t,this.state=n,this.flow=e}return x[_0x5317("0x66")]=function(x,t){return r(this,void 0,void 0,function(){var n,r,_,a,s,c,u,f;return i(this,function(i){switch(i[_0x5317("0x17")]){case 0:n=e({},x),r=Object.keys(x)[_0x5317("0x67")](function(x){return["state","flow"][_0x5317("0x68")](x)>-1}),_=0,a=r,i.label=1;case 1:return _<a[_0x5317("0x15")]?(s=a[_],[4,Promise.resolve(x[s])]):[3,6];case 2:return c=i[_0x5317("0x1d")](),o[_0x5317("0x6a")](c)||Array[_0x5317("0x2a")](c)?(n[s]=c,[3,5]):[3,3];case 3:return u=n,f=s,[4,c(t)];case 4:u[f]=i.sent(),i.label=5;case 5:return _++,[3,1];case 6:return[2,n]}})})},x}();t.Context=_},function(x,t,n){_0x5317("0x11"),Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var e=function(){function x(x,t){this[_0x5317("0x51")]=_0x5317("0x6c"),this[_0x5317("0x6d")]={},this[_0x5317("0x53")]=x,this[_0x5317("0x54")]=t}return x}();t[_0x5317("0x6c")]=e},function(x,t,n){_0x5317("0x11"),Object.defineProperty(t,_0x5317("0xd"),{value:!0});var e=n(20),r=function(){function x(x){this[_0x5317("0x6e")]=x||e.v4()}return x.prototype[_0x5317("0x6f")]=function(){return this[_0x5317("0x6e")]},x[_0x5317("0x10")][_0x5317("0x70")]=function(){return this[_0x5317("0x6e")]},x}();t[_0x5317("0x71")]=r},function(x,t){x.exports=require(_0x5317("0x72"))},function(x,t,n){_0x5317("0x11"),Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var e=n(22);t.Channels={Sorun:e.SorunClient}},function(x,t,n){_0x5317("0x11");var e=this&&this[_0x5317("0x75")]||function(){var x=Object[_0x5317("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x[_0x5317("0x77")]=t}||function(x,t){for(var n in t)t[_0x5317("0xf")](n)&&(x[n]=t[n])};return function(t,n){function e(){this[_0x5317("0x78")]=t}x(t,n),t[_0x5317("0x10")]=null===n?Object[_0x5317("0x79")](n):(e.prototype=n[_0x5317("0x10")],new e)}}(),r=this&&this[_0x5317("0x63")]||Object[_0x5317("0x64")]||function(x){for(var t,n=1,e=arguments.length;n<e;n++){t=arguments[n];for(var r in t)Object[_0x5317("0x10")].hasOwnProperty[_0x5317("0xb")](t,r)&&(x[r]=t[r])}return x},i=this&&this[_0x5317("0x2d")]||function(x,t,n,e){return new(n||(n=Promise))(function(r,i){function o(x){try{a(e.next(x))}catch(x){i(x)}}function _(x){try{a(e[_0x5317("0x2f")](x))}catch(x){i(x)}}function a(x){x[_0x5317("0x30")]?r(x[_0x5317("0x31")]):new n(function(t){t(x[_0x5317("0x31")])})[_0x5317("0x32")](o,_)}a((e=e[_0x5317("0x1")](x,t||[]))[_0x5317("0x2e")]())})},o=this&&this.__generator||function(x,t){function n(x){return function(t){return e([x,t])}}function e(n){if(r)throw new TypeError(_0x5317("0x4a"));for(;a;)try{if(r=1,i&&(o=i[_0x5317(2&n[0]?"0x33":n[0]?"0x2f":"0x2e")])&&!(o=o.call(i,n[1]))[_0x5317("0x30")])return o;switch(i=0,o&&(n=[0,o[_0x5317("0x31")]]),n[0]){case 0:case 1:o=n;break;case 4:return a[_0x5317("0x17")]++,{value:n[1],done:!1};case 5:a[_0x5317("0x17")]++,i=n[1],n=[0];continue;case 7:n=a[_0x5317("0x34")][_0x5317("0x35")](),a.trys[_0x5317("0x35")]();continue;default:if(o=a[_0x5317("0x1b")],!(o=o[_0x5317("0x15")]>0&&o[o[_0x5317("0x15")]-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a[_0x5317("0x17")]=n[1];break}if(6===n[0]&&a[_0x5317("0x17")]<o[1]){a[_0x5317("0x17")]=o[1],o=n;break}if(o&&a[_0x5317("0x17")]<o[2]){a[_0x5317("0x17")]=o[2],a[_0x5317("0x34")][_0x5317("0x1a")](n);break}o[2]&&a[_0x5317("0x34")].pop(),a[_0x5317("0x1b")][_0x5317("0x35")]();continue}n=t[_0x5317("0xb")](x,a)}catch(x){n=[6,x],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var r,i,o,_,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return _={next:n(0),throw:n(1),return:n(2)},_0x5317("0x36")==typeof Symbol&&(_[Symbol[_0x5317("0x37")]]=function(){return this}),_};Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var _=n(5),a=n(1),s=n(32);n(33),s[_0x5317("0x7a")]("tr");var c=n(34),u=n(0),f=n(14),d=n(3),h=n(9),l=function(x){function t(t){var n=t[_0x5317("0x7b")],e=t.client,r=t[_0x5317("0x7c")],i=x[_0x5317("0xb")](this)||this;return i.client=e,i[_0x5317("0x7c")]=r,i[_0x5317("0x7b")]=n,i[_0x5317("0x7b")][_0x5317("0x7d")]||(i[_0x5317("0x7b")][_0x5317("0x7d")]=_0x5317("0x7e")),d[_0x5317("0x6")][_0x5317("0x7f")](_0x5317("0x80"))(_0x5317("0x81"),{message:n,client:e,conversation:r}),i}return e(t,x),t[_0x5317("0x82")]=function(x){switch(d[_0x5317("0x6")][_0x5317("0x7f")](_0x5317("0x83"))(_0x5317("0x84"),x),x[_0x5317("0x85")]){case _0x5317("0x22"):return d[_0x5317("0x6")][_0x5317("0x7f")](_0x5317("0x83"))(_0x5317("0x86")),{payload:x[_0x5317("0x6e")].toString(),type:_0x5317("0x7e")};case _0x5317("0x87"):d[_0x5317("0x6")].verbose("Sorun:fromMessage")(_0x5317("0x88"));var n=x,e=n[_0x5317("0x89")](),r=d[_0x5317("0x3d")](e),i=new u.CardMessage({payload:r,conversation:n[_0x5317("0x7c")],type:_0x5317("0x8a"),channel:_0x5317("0x8b"),channelData:n[_0x5317("0x8c")],platform:n[_0x5317("0x8d")],user:n.user});return d.debug.verbose(_0x5317("0x83"))(_0x5317("0x8e"),i),t[_0x5317("0x8f")](i);case _0x5317("0x90"):return d[_0x5317("0x6")][_0x5317("0x7f")](_0x5317("0x83"))(_0x5317("0x91")),t.fromCardMessage(x);default:throw new Error(_0x5317("0x92"))}},t[_0x5317("0x8f")]=function(x){var t=x,n=t[_0x5317("0x6e")].map(function(x){if(x[_0x5317("0x94")][_0x5317("0x15")]>1)throw new Error(_0x5317("0x95"));if(0===x.elements[_0x5317("0x15")])throw new Error(_0x5317("0x96"));var t=x[_0x5317("0x94")][0],n=t[_0x5317("0x97")].map(function(x){switch(x[_0x5317("0x7d")]){case _0x5317("0x7b"):return{type:"T",text:x[_0x5317("0x17")][_0x5317("0x20")](/"/g,""),action:x[_0x5317("0x7b")][_0x5317("0x20")](/"/g,"")};case _0x5317("0x98"):var t=x.title;return{type:"L",text:t?t[_0x5317("0x20")](/"/g,""):void 0,action:x.url};default:throw new Error(_0x5317("0x99"))}}),e=t[_0x5317("0x22")],r=t[_0x5317("0x23")],i=e?e.replace(/"/g,""):void 0,o=r?r.replace(/"/g,""):void 0;return{image:t[_0x5317("0x9a")],text:i,title:o,buttons:n}});return{payload:JSON[_0x5317("0x9b")](n),type:_0x5317("0x9c")}},t[_0x5317("0x10")][_0x5317("0x9d")]=function(){try{return this[_0x5317("0x7b")].messageDate?s.tz(this[_0x5317("0x7b")][_0x5317("0x9f")],_0x5317("0xa0"),_0x5317("0xa1"))[_0x5317("0x9e")]():s()[_0x5317("0x9e")]()}catch(x){throw new Error("Sorun - Error while parsing messageDate")}},t.prototype.getMessagePayloadType=function(){return i(this,void 0,void 0,function(){return o(this,function(x){switch(x[_0x5317("0x17")]){case 0:return a.isString(this[_0x5317("0x7b")][_0x5317("0x6e")])?[4,h[_0x5317("0x18")](this[_0x5317("0x7b")][_0x5317("0x6e")])]:[3,2];case 1:return x[_0x5317("0x1d")]()?[2,_0x5317("0x87")]:[2,_0x5317("0x22")];case 2:if(this[_0x5317("0x7b")].payload[_0x5317("0xf")]("x")&&this.message[_0x5317("0x6e")][_0x5317("0xf")]("y"))return[2,_0x5317("0xa3")];if(_0x5317("0x9c")===this[_0x5317("0x7b")][_0x5317("0x7d")])return[2,_0x5317("0x90")];x[_0x5317("0x17")]=3;case 3:throw new Error(_0x5317("0xa4"))}})})},t[_0x5317("0x10")][_0x5317("0xa5")]=function(){if(_0x5317("0xa6")===this[_0x5317("0x7b")][_0x5317("0x7d")])return _0x5317("0x4");if(_0x5317("0x7e")===this[_0x5317("0x7b")][_0x5317("0x7d")]&&this[_0x5317("0x7b")][_0x5317("0xa7")])return"agent";if(_0x5317("0x7e")===this.message[_0x5317("0x7d")]&&!this[_0x5317("0x7b")][_0x5317("0xa7")])return _0x5317("0xa8");throw new Error(_0x5317("0xa9"))},t[_0x5317("0x10")].getPlatform=function(){if(this[_0x5317("0x7b")].platform,0){if(_0x5317("0xab")===this[_0x5317("0x7b")][_0x5317("0x8d")])return _0x5317("0xac");if("CLIENTIOS"===this.message[_0x5317("0x8d")])return"ios";throw new Error(_0x5317("0xad"))}return _0x5317("0xae")},t[_0x5317("0x10")].toMessage=function(x,t){return i(this,void 0,void 0,function(){var n,e,r,i;return o(this,function(o){switch(o[_0x5317("0x17")]){case 0:return n={id:this[_0x5317("0x7b")].id,userID:this.message[_0x5317("0xb0")],uniqueID:this[_0x5317("0x7b")].uniqueID},[4,this[_0x5317("0xa2")]()];case 1:switch(o[_0x5317("0x1d")]()){case _0x5317("0x22"):return[2,new(u[_0x5317("0xb2")])({payload:this[_0x5317("0x7b")][_0x5317("0x6e")][_0x5317("0x6f")](),conversation:x,type:this[_0x5317("0xa5")](),channelData:n,channel:_0x5317("0x8b"),date:this[_0x5317("0x9d")](),platform:this[_0x5317("0xaa")](),user:t})];case _0x5317("0x87"):return[2,new(u[_0x5317("0xb3")])({payload:this[_0x5317("0x7b")][_0x5317("0x6e")],conversation:x,type:this.getMessageType(),channelData:n,channel:"Sorun",date:this[_0x5317("0x9d")](),platform:this[_0x5317("0xaa")](),user:t})];case _0x5317("0x90"):return e=this.message[_0x5317("0x6e")],r=e[_0x5317("0x93")](function(x){var t=x[_0x5317("0x97")][_0x5317("0x93")](function(x){switch(x.type){case"L":return{type:_0x5317("0x98"),url:x.action,title:x[_0x5317("0x22")]};case"T":return{type:_0x5317("0x7b"),message:x[_0x5317("0xb4")],label:x[_0x5317("0x22")]};default:throw new Error(_0x5317("0xb5"))}});return{title:x[_0x5317("0x23")],imageUrl:x[_0x5317("0xb6")],text:x[_0x5317("0x22")],buttons:t}}),i={elements:r},[2,new u.CardMessage({payload:[i],conversation:x,type:this[_0x5317("0xa5")](),channelData:n,channel:_0x5317("0x8b"),date:this[_0x5317("0x9d")](),platform:this[_0x5317("0xaa")](),user:t})];default:throw new Error(_0x5317("0xa9"))}return[2]}})})},t}(f.ChannelMessageStatic);t.SorunMessage=l;var v=function(x){function t(t){var n=t[_0x5317("0xb8")],e=t[_0x5317("0xb9")],r=t[_0x5317("0x87")],i=t[_0x5317("0xba")],o=t.initialContext,_=t[_0x5317("0xbc")],a=t[_0x5317("0xbd")],s=x.call(this)||this;return s.kind=_0x5317("0x8b"),s[_0x5317("0xb8")]=n,s[_0x5317("0xba")]=i||"development",s[_0x5317("0xb9")]=e,s[_0x5317("0xbb")]=o,s[_0x5317("0xbc")]=_,s[_0x5317("0xbd")]=a,s[_0x5317("0x87")]=r||_0x5317(s.isProduction()?"0xbf":"0xc0"),s}return e(t,x),t.getConversationIdentifier=function(x){return x.channelData.id},t[_0x5317("0x10")][_0x5317("0xbe")]=function(){return _0x5317("0xc2")===this[_0x5317("0xba")]},t[_0x5317("0x10")][_0x5317("0xc3")]=function(x){return x===this.incomingHookToken},t[_0x5317("0x10")][_0x5317("0xc4")]=function(x){return i(this,void 0,void 0,function(){var t;return o(this,function(n){return t=x,[2,new(u[_0x5317("0xc5")])({firstName:t[_0x5317("0xc7")][_0x5317("0xc6")],lastName:t[_0x5317("0xc7")][_0x5317("0xc8")],phoneNumber:t[_0x5317("0xc7")].phone,email:t[_0x5317("0xc7")][_0x5317("0xca")],accessToken:t[_0x5317("0x7c")][_0x5317("0xcb")]&&t[_0x5317("0x7c")].variable[_0x5317("0x20")](/ /g,"+")})]})})},t[_0x5317("0x10")][_0x5317("0xcc")]=function(x,t){return i(this,void 0,void 0,function(){return o(this,function(n){switch(n[_0x5317("0x17")]){case 0:return[4,x[_0x5317("0xcd")](t)];case 1:return[2,n[_0x5317("0x1d")]()]}})})},t[_0x5317("0x10")][_0x5317("0xce")]=function(x,t){return i(this,void 0,void 0,function(){var n,e;return o(this,function(r){switch(r[_0x5317("0x17")]){case 0:return n={token:this[_0x5317("0xb8")],ended:!0,id:t[_0x5317("0x8c")].id},[4,_.default[_0x5317("0xcf")](this[_0x5317("0x87")]+_0x5317("0xd0")+c[_0x5317("0x9b")](n),{timeout:this[_0x5317("0xbd")]})];case 1:if(e=r[_0x5317("0x1d")](),1!==e[_0x5317("0x1f")][_0x5317("0x60")])throw new Error(_0x5317("0xd1"));return[4,x[_0x5317("0xd2")](t)];case 2:return r[_0x5317("0x1d")](),[2,e[_0x5317("0x1f")]]}})})},t[_0x5317("0x10")][_0x5317("0xd3")]=function(x,t,n){return i(this,void 0,void 0,function(){var e,r,i,_,a;return o(this,function(o){switch(o[_0x5317("0x17")]){case 0:if(!n.incomingHookToken)throw new Error(_0x5317("0xd4"));if(!(e=this[_0x5317("0xc3")](n[_0x5317("0xb9")])))return[3,4];if(r=new l(t),[_0x5317("0x7e"),_0x5317("0x9c")][_0x5317("0x68")](r[_0x5317("0x7b")][_0x5317("0x7d")])<0)throw new Error(_0x5317("0xd5"));return[4,x.getWithChannel(_0x5317("0x8b"),t[_0x5317("0x7b")].conversationID)];case 1:return i=o.sent(),[4,this[_0x5317("0xc4")](r)];case 2:return _=o[_0x5317("0x1d")](),a=i||new(u[_0x5317("0xd8")])({channel:_0x5317("0x8b"),context:this[_0x5317("0xbb")],channelData:{id:t[_0x5317("0x7b")][_0x5317("0xd7")]}}),[4,r[_0x5317("0xaf")](a,_)];case 3:return[2,o[_0x5317("0x1d")]()];case 4:throw new Error(_0x5317("0xd9"))}})})},t[_0x5317("0x10")][_0x5317("0xda")]=function(x){return i(this,void 0,void 0,function(){var t,n,e,r,i,a,s;return o(this,function(o){switch(o[_0x5317("0x17")]){case 0:if(o.trys[_0x5317("0x1a")]([0,2,,3]),!(t=x.conversation[_0x5317("0x8c")].id))throw new Error(_0x5317("0xdb"));return n=l[_0x5317("0x82")](x),e=n[_0x5317("0x6e")],r=n[_0x5317("0x7d")],i={token:this[_0x5317("0xb8")],conversation:t,type:r,payload:e},d[_0x5317("0x6")][_0x5317("0x7")]("Sorun:sendMessage")(_0x5317("0xdc"),i),d[_0x5317("0x6")][_0x5317("0x7")](_0x5317("0xdd"))(_0x5317("0xde"),c[_0x5317("0x9b")](i)),[4,_.default[_0x5317("0xdf")](this[_0x5317("0x87")]+"/Message?"+c[_0x5317("0x9b")](i),{},{timeout:this.timeoutInMilliseconds})];case 1:if(a=o[_0x5317("0x1d")](),0===a[_0x5317("0x1f")].result)throw a[_0x5317("0x1f")][_0x5317("0x8")];return[2,{result:1,content:1}];case 2:throw s=o[_0x5317("0x1d")](),d[_0x5317("0x6")][_0x5317("0x7")](_0x5317("0xdd"))(s),s;case 3:return[2]}})})},t[_0x5317("0x10")].textReply=function(x,t){return i(this,void 0,void 0,function(){var n;return o(this,function(e){switch(e[_0x5317("0x17")]){case 0:return n=new u.TextMessage({payload:t,conversation:x[_0x5317("0x7c")],type:_0x5317("0x8a"),channel:_0x5317("0x8b"),channelData:x[_0x5317("0x8c")],platform:x[_0x5317("0x8d")],user:x[_0x5317("0xa8")]}),[4,this[_0x5317("0xda")](n)];case 1:return[2,e[_0x5317("0x1d")]()]}})})},t[_0x5317("0x10")].urlReply=function(x,t,n){return void 0===n&&(n={discoverUrl:!0}),i(this,void 0,void 0,function(){var e,i,_;return o(this,function(o){switch(o[_0x5317("0x17")]){case 0:return e=t,!n[_0x5317("0xe2")]||t[_0x5317("0xe3")]||t[_0x5317("0x23")]?[3,2]:[4,d.getUrlTitleAndDescription(t[_0x5317("0x87")])];case 1:i=o[_0x5317("0x1d")](),e=r({},i,t),o[_0x5317("0x17")]=2;case 2:return _=new u.UrlMessage({payload:e,conversation:x[_0x5317("0x7c")],type:_0x5317("0x8a"),channel:_0x5317("0x8b"),channelData:x[_0x5317("0x8c")],platform:x[_0x5317("0x8d")],user:x[_0x5317("0xa8")]}),[4,this[_0x5317("0xda")](_)];case 3:return[2,o[_0x5317("0x1d")]()]}})})},t[_0x5317("0x10")][_0x5317("0xe4")]=function(x,t){return i(this,void 0,void 0,function(){var n,e;return o(this,function(r){switch(r[_0x5317("0x17")]){case 0:return n=d[_0x5317("0x3d")](t),e=new(u[_0x5317("0xe5")])({payload:n,conversation:x[_0x5317("0x7c")],type:_0x5317("0x8a"),channel:_0x5317("0x8b"),channelData:x.channelData,platform:x[_0x5317("0x8d")],user:x[_0x5317("0xa8")]}),[4,this[_0x5317("0xda")](e)];case 1:return[2,r[_0x5317("0x1d")]()]}})})},t[_0x5317("0x10")].getActiveAgents=function(){return i(this,void 0,void 0,function(){var x,t,n,e;return o(this,function(r){switch(r[_0x5317("0x17")]){case 0:return x={token:this[_0x5317("0xb8")]},[4,_[_0x5317("0xe")][_0x5317("0x1c")](this.url+_0x5317("0xe6")+c.stringify(x),{timeout:this[_0x5317("0xbd")]})];case 1:if(t=r[_0x5317("0x1d")](),1!==t[_0x5317("0x1f")][_0x5317("0x60")]||!t[_0x5317("0x1f")][_0x5317("0x26")])throw new Error("Sorun - Error while getting agents");return n=t[_0x5317("0x1f")][_0x5317("0x26")],e=s()[_0x5317("0xe7")](5,_0x5317("0xe8")),[2,n[_0x5317("0x67")](function(x){return x[_0x5317("0xe9")]&&!x[_0x5317("0xea")]&&s.tz(x[_0x5317("0xec")],_0x5317("0xa0"),_0x5317("0xa1"))[_0x5317("0xeb")](e)})]}})})},t[_0x5317("0x10")][_0x5317("0xed")]=function(x){return i(this,void 0,void 0,function(){var t,n,e,r,i,s,u;return o(this,function(o){switch(o[_0x5317("0x17")]){case 0:return t={token:this[_0x5317("0xb8")],id:x.channelData.id},[4,_[_0x5317("0xe")][_0x5317("0x1c")](this.url+"/Conversation?"+c.stringify(t),{timeout:this[_0x5317("0xbd")]})];case 1:if(n=o[_0x5317("0x1d")](),1!==n[_0x5317("0x1f")].result||!n[_0x5317("0x1f")][_0x5317("0x26")])throw new Error(_0x5317("0xee"));return e={token:this[_0x5317("0xb8")]},[4,_[_0x5317("0xe")].get(this[_0x5317("0x87")]+_0x5317("0xef")+c[_0x5317("0x9b")](e),{timeout:this[_0x5317("0xbd")]})];case 2:if(r=o[_0x5317("0x1d")](),1!==r.data.result||!r[_0x5317("0x1f")][_0x5317("0x26")])throw new Error(_0x5317("0xee"));if(!(i=n.data[_0x5317("0x26")].length>=0?n[_0x5317("0x1f")][_0x5317("0x26")][0][_0x5317("0xf0")]:null))throw new Error(_0x5317("0xf1"));if(s=r[_0x5317("0x1f")][_0x5317("0x26")],!(u=a[_0x5317("0xf2")](s,{id:i})))throw new Error("Sorun - Pool not found");return[2,u]}})})},t[_0x5317("0x10")][_0x5317("0xf3")]=function(x){return i(this,void 0,void 0,function(){var t,n,e;return o(this,function(r){switch(r[_0x5317("0x17")]){case 0:return t={company:this.companyID},[4,_[_0x5317("0xe")][_0x5317("0x1c")](this[_0x5317("0x87")]+_0x5317("0xf4")+c[_0x5317("0x9b")](t),{timeout:this.timeoutInMilliseconds})];case 1:if(n=r[_0x5317("0x1d")](),1!==n.data.result||!n[_0x5317("0x1f")].content)throw new Error(_0x5317("0xf5"));if(!(e=a[_0x5317("0xf2")](n[_0x5317("0x1f")][_0x5317("0x26")],{id:x})))throw new Error(_0x5317("0xf1"));return[2,e]}})})},t.prototype[_0x5317("0xf6")]=function(x,t,n){return i(this,void 0,void 0,function(){var e,r;return o(this,function(i){switch(i.label){case 0:return e={token:this[_0x5317("0xb8")],id:t.channelData.id,currentAgent:n},d[_0x5317("0x6")].info(_0x5317("0xf7"))(this[_0x5317("0x87")]+_0x5317("0xd0")+c.stringify(e)),[4,_.default[_0x5317("0xcf")](this[_0x5317("0x87")]+_0x5317("0xd0")+c[_0x5317("0x9b")](e),{timeout:this[_0x5317("0xbd")]})];case 1:return r=i.sent(),[4,x[_0x5317("0xd2")](t)];case 2:if(i[_0x5317("0x1d")](),1!==r[_0x5317("0x1f")][_0x5317("0x60")])throw new Error(_0x5317("0xf8"));return[2,r.data]}})})},t[_0x5317("0x10")].changePool=function(x,t){return i(this,void 0,void 0,function(){var n,e;return o(this,function(r){switch(r[_0x5317("0x17")]){case 0:return n={token:this[_0x5317("0xb8")],id:x.channelData.id,pool:t},d[_0x5317("0x6")][_0x5317("0x7")](_0x5317("0xf9"))(this[_0x5317("0x87")]+_0x5317("0xd0")+c[_0x5317("0x9b")](n)),[4,_[_0x5317("0xe")].put(this.url+_0x5317("0xd0")+c.stringify(n))];case 1:if(e=r[_0x5317("0x1d")](),1!==e[_0x5317("0x1f")].result)throw new Error(_0x5317("0xfa"));return[2,e[_0x5317("0x1f")]]}})})},t[_0x5317("0x10")][_0x5317("0xfb")]=function(x){return i(this,void 0,void 0,function(){var t,n;return o(this,function(e){switch(e[_0x5317("0x17")]){case 0:return t={token:this[_0x5317("0xb8")],id:x[_0x5317("0x8c")].id,setHold:!0},d[_0x5317("0x6")].info(_0x5317("0xfc"))(this[_0x5317("0x87")]+"/Conversation?"+c[_0x5317("0x9b")](t)),[4,_[_0x5317("0xe")][_0x5317("0xcf")](this[_0x5317("0x87")]+"/Conversation?"+c[_0x5317("0x9b")](t))];case 1:if(n=e[_0x5317("0x1d")](),1!==n[_0x5317("0x1f")].result)throw new Error(_0x5317("0xfd"));return[2,n[_0x5317("0x1f")]]}})})},t[_0x5317("0x10")][_0x5317("0xfe")]=function(x){return i(this,void 0,void 0,function(){var t,n;return o(this,function(e){switch(e[_0x5317("0x17")]){case 0:return t={token:this[_0x5317("0xb8")],id:x.channelData.id},d[_0x5317("0x6")][_0x5317("0x7")](_0x5317("0xff"))(this[_0x5317("0x87")]+"/Conversation?"+c[_0x5317("0x9b")](t)),[4,_[_0x5317("0xe")][_0x5317("0xcf")](this.url+_0x5317("0xd0")+c.stringify(t),{timeout:this.timeoutInMilliseconds})];case 1:if(n=e[_0x5317("0x1d")](),1!==n[_0x5317("0x1f")][_0x5317("0x60")])throw new Error("Sorun - Error while removing conversation from hold");return[2,n[_0x5317("0x1f")]]}})})},t[_0x5317("0x10")][_0x5317("0x100")]=function(){return i(this,void 0,void 0,function(){var x,t;return o(this,function(n){switch(n[_0x5317("0x17")]){case 0:return x={company:this[_0x5317("0xbc")]},[4,_.default[_0x5317("0x1c")](this.url+_0x5317("0x101")+c[_0x5317("0x9b")](x),{timeout:this[_0x5317("0xbd")]})];case 1:if(t=n.sent(),1!==t[_0x5317("0x1f")].result)throw new Error("Sorun - Error while getting company information");if(t.data[_0x5317("0x26")]&&0===t[_0x5317("0x1f")].content[_0x5317("0x15")])throw new Error(_0x5317("0x102"));return[2,t[_0x5317("0x1f")][_0x5317("0x26")][0]]}})})},t[_0x5317("0x10")][_0x5317("0x103")]=function(x){return i(this,void 0,void 0,function(){var t;return o(this,function(n){switch(n[_0x5317("0x17")]){case 0:return[4,this[_0x5317("0xed")](x)];case 1:return t=n[_0x5317("0x1d")](),[2,!t.isOutOfOffice]}})})},t[_0x5317("0x10")][_0x5317("0x105")]=function(x){return i(this,void 0,void 0,function(){var t;return o(this,function(n){switch(n.label){case 0:return[4,this[_0x5317("0xf3")](x)];case 1:return t=n[_0x5317("0x1d")](),[2,!t[_0x5317("0x104")]]}})})},t[_0x5317("0x10")][_0x5317("0x106")]=function(){return i(this,void 0,void 0,function(){var x,t;return o(this,function(n){switch(n[_0x5317("0x17")]){case 0:return x={token:this[_0x5317("0xb8")]},[4,_[_0x5317("0xe")][_0x5317("0x1c")](this[_0x5317("0x87")]+_0x5317("0xd0")+c[_0x5317("0x9b")](x),{timeout:this[_0x5317("0xbd")]})];case 1:if(t=n.sent(),1!==t.data[_0x5317("0x60")]||!t[_0x5317("0x1f")].content)throw new Error(_0x5317("0xee"));return[2,t.data.content]}})})},t[_0x5317("0x10")][_0x5317("0x107")]=function(x){return i(this,void 0,void 0,function(){var t,n,e,i,_,s,c,u,f,d,h,l;return o(this,function(o){switch(o[_0x5317("0x17")]){case 0:return _=(i=Promise)[_0x5317("0x108")],s=[this.getOpenConversations()],[4,this.getActiveAgents()];case 1:return[4,_[_0x5317("0x1")](i,[s[_0x5317("0x10a")]([o[_0x5317("0x1d")]()])])];case 2:return t=o[_0x5317("0x1d")](),n=t[0],e=t[1],c=a.fromPairs(e[_0x5317("0x93")](function(x){return[x.id,0]})),u=a[_0x5317("0x5c")](a[_0x5317("0x10c")](n[_0x5317("0x67")](function(x){return e[_0x5317("0x93")](function(x){return x.id})[_0x5317("0x68")](x[_0x5317("0x10d")])>-1}),_0x5317("0x10d")),function(x){return x[_0x5317("0x15")]}),f=r({},c,u),d=a[_0x5317("0x2b")](f),h=d.filter(function(t){return t[1]<x}),h[_0x5317("0x15")]<=0?[2,null]:(l=a[_0x5317("0x10e")](h,function(x){return x[1]},["asc"]),[2,l[0][0]])}})})},t}(u[_0x5317("0x62")]);t.SorunClient=v},function(x,t,n){var e=this&&this[_0x5317("0x75")]||function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,t){x[_0x5317("0x77")]=t}||function(x,t){for(var n in t)t[_0x5317("0xf")](n)&&(x[n]=t[n])};return function(t,n){function e(){this[_0x5317("0x78")]=t}x(t,n),t[_0x5317("0x10")]=null===n?Object.create(n):(e[_0x5317("0x10")]=n[_0x5317("0x10")],new e)}}();Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var r=n(0),i=function(x){function t(t){var n=t[_0x5317("0x6e")],e=t[_0x5317("0x7c")],r=t[_0x5317("0xa8")],i=t.type,o=t[_0x5317("0x8d")],_=t[_0x5317("0x10f")],a=t[_0x5317("0x8c")],s=t[_0x5317("0x110")],c=t.id;return x[_0x5317("0xb")](this,{payload:n,conversation:e,user:r,channel:_,platform:o,payloadType:"card",type:i,channelData:a,date:s,id:c})||this}return e(t,x),t}(r[_0x5317("0x111")]);t[_0x5317("0xe5")]=i},function(x,t,n){Object.defineProperty(t,_0x5317("0xd"),{value:!0});var e=n(1),r=n(6),i=n(0),o=function(){function x(x){var t=x[_0x5317("0x10f")],n=x[_0x5317("0x112")],o=x[_0x5317("0x8c")],_=void 0===o?{}:o,a=x[_0x5317("0x113")],s=void 0===a?_0x5317("0x114"):a,c=x[_0x5317("0x115")],u=void 0===c?r()[_0x5317("0x9e")]():c,f=x[_0x5317("0x116")],d=x.id;this.startDate=u,this[_0x5317("0x116")]=f,this[_0x5317("0x112")]=n||new(i[_0x5317("0x6b")])({}),this[_0x5317("0x113")]=s,this[_0x5317("0x10f")]=t,this[_0x5317("0x8c")]=_,d&&e.isString(d)?this.id=new(i[_0x5317("0x71")])(d):d&&!e[_0x5317("0x6a")](d)?this.id=d:this.id=new i.GUID}return x[_0x5317("0x10")][_0x5317("0x117")]=function(){return JSON[_0x5317("0x9b")](this)},x}();o[_0x5317("0x118")]=function(x){var t=JSON.parse(x);return new o(t)},t[_0x5317("0xd8")]=o},function(x,t,n){_0x5317("0x11"),Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var e=n(6),r=n(0),i=function(){function x(x){var t=x[_0x5317("0x6e")],n=x.conversation,i=x[_0x5317("0xa8")],o=x[_0x5317("0x8d")],_=x.payloadType,a=x.type,s=x[_0x5317("0x10f")],c=x[_0x5317("0x8c")],u=void 0===c?{}:c,f=x.date,d=void 0===f?e().toDate():f,h=x.id,l=void 0===h?new(r[_0x5317("0x71")]):h;this.id=l,this[_0x5317("0x7c")]=n,this[_0x5317("0xa8")]=i,this[_0x5317("0x85")]=_,this[_0x5317("0x6e")]=t,this[_0x5317("0x8d")]=o,this[_0x5317("0x110")]=d,this.type=a,this.channel=s,this[_0x5317("0x8c")]=u}return x.prototype[_0x5317("0x11a")]=function(){return _0x5317("0xac")===this[_0x5317("0x8d")]||_0x5317("0x11b")===this.platform},x[_0x5317("0x10")][_0x5317("0x11c")]=function(){return JSON[_0x5317("0x9b")]({id:this.id,payloadType:this.payloadType,payload:this.payload,date:this[_0x5317("0x110")],type:this.type,channelData:this.channelData})},x[_0x5317("0x10")][_0x5317("0x11d")]=function(t){return new x(JSON[_0x5317("0x119")](t))},x}();t[_0x5317("0x111")]=i},function(x,t,n){_0x5317("0x11");var e=this&&this[_0x5317("0x75")]||function(){var x=Object[_0x5317("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x[_0x5317("0x77")]=t}||function(x,t){for(var n in t)t.hasOwnProperty(n)&&(x[n]=t[n])};return function(t,n){function e(){this[_0x5317("0x78")]=t}x(t,n),t[_0x5317("0x10")]=null===n?Object[_0x5317("0x79")](n):(e[_0x5317("0x10")]=n[_0x5317("0x10")],new e)}}();Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var r=n(0),i=function(x){function t(t){var n=t[_0x5317("0x6e")],e=t[_0x5317("0x7c")],r=t[_0x5317("0xa8")],i=t[_0x5317("0x7d")],o=t[_0x5317("0x8d")],_=t[_0x5317("0x10f")],a=t[_0x5317("0x8c")],s=t.date,c=t.id;return x.call(this,{payload:n,conversation:e,channel:_,user:r,platform:o,payloadType:"text",type:i,channelData:a,date:s,id:c})||this}return e(t,x),t}(r[_0x5317("0x111")]);t[_0x5317("0xb2")]=i},function(x,t,n){_0x5317("0x11");var e=this&&this[_0x5317("0x75")]||function(){var x=Object[_0x5317("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x[_0x5317("0x77")]=t}||function(x,t){for(var n in t)t[_0x5317("0xf")](n)&&(x[n]=t[n])};return function(t,n){function e(){this[_0x5317("0x78")]=t}x(t,n),t[_0x5317("0x10")]=null===n?Object[_0x5317("0x79")](n):(e[_0x5317("0x10")]=n[_0x5317("0x10")],new e)}}();Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var r=n(0),i=function(x){function t(t){var n=t[_0x5317("0x7c")],e=t[_0x5317("0x110")],r=t[_0x5317("0xa8")],i=t.id,o=t.payload,_=t[_0x5317("0x8d")],a=t.channel;return x[_0x5317("0xb")](this,{payload:o,conversation:n,user:r,channel:a,platform:_,payloadType:_0x5317("0x112"),type:"trigger",date:e,id:i})||this}return e(t,x),t}(r[_0x5317("0x111")]);t.TriggerMessage=i},function(x,t,n){_0x5317("0x11");var e=this&&this[_0x5317("0x75")]||function(){var x=Object[_0x5317("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x[_0x5317("0x77")]=t}||function(x,t){for(var n in t)t[_0x5317("0xf")](n)&&(x[n]=t[n])};return function(t,n){function e(){this.constructor=t}x(t,n),t[_0x5317("0x10")]=null===n?Object[_0x5317("0x79")](n):(e.prototype=n.prototype,new e)}}();Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var r=n(0),i=function(x){function t(t){var n=t[_0x5317("0x6e")],e=t[_0x5317("0x7c")],r=t[_0x5317("0x7d")],i=t[_0x5317("0xa8")],o=t[_0x5317("0x8d")],_=t[_0x5317("0x10f")],a=t.channelData,s=t[_0x5317("0x110")],c=t.id;return x[_0x5317("0xb")](this,{payload:n,conversation:e,channel:_,user:i,platform:o,payloadType:_0x5317("0x87"),type:r,channelData:a,date:s,id:c})||this}return e(t,x),t[_0x5317("0x10")][_0x5317("0x89")]=function(){var x={type:_0x5317("0x98"),url:this[_0x5317("0x6e")][_0x5317("0x87")],title:_0x5317("0x11e")};return{elements:[{title:this[_0x5317("0x6e")][_0x5317("0x23")],text:this[_0x5317("0x6e")].description,buttons:[x]}]}},t}(r[_0x5317("0x111")]);t[_0x5317("0xb3")]=i},function(x,t,n){_0x5317("0x11"),Object[_0x5317("0xc")](t,_0x5317("0xd"),{value:!0});var e=n(0),r=function(){function x(x){var t=x[_0x5317("0x11f")],n=x[_0x5317("0x120")],r=x[_0x5317("0x121")],i=x[_0x5317("0x122")],o=x[_0x5317("0x123")],_=x.id,a=void 0===_?new e.GUID:_;this.id=a,this[_0x5317("0x11f")]=t,this[_0x5317("0x120")]=n,this[_0x5317("0x121")]=r,this[_0x5317("0x122")]=i,this[_0x5317("0x123")]=o}return x}();t.User=r},function(x,t,n){_0x5317("0x11");var e=this&&this[_0x5317("0x63")]||Object.assign||function(x){for(var t,n=1,e=arguments[_0x5317("0x15")];n<e;n++){t=arguments[n];for(var r in t)Object[_0x5317("0x10")].hasOwnProperty[_0x5317("0xb")](t,r)&&(x[r]=t[r])}return x},r=this&&this.__awaiter||function(x,t,n,e){return new(n||(n=Promise))(function(r,i){function o(x){try{a(e[_0x5317("0x2e")](x))}catch(x){i(x)}}function _(x){try{a(e[_0x5317("0x2f")](x))}catch(x){i(x)}}function a(x){x[_0x5317("0x30")]?r(x[_0x5317("0x31")]):new n(function(t){t(x[_0x5317("0x31")])}).then(o,_)}a((e=e[_0x5317("0x1")](x,t||[]))[_0x5317("0x2e")]())})},i=this&&this[_0x5317("0x49")]||function(x,t){function n(x){return function(t){return e([x,t])}}function e(n){if(r)throw new TypeError(_0x5317("0x4a"));for(;a;)try{if(r=1,i&&(o=i[_0x5317(2&n[0]?"0x33":n[0]?"0x2f":"0x2e")])&&!(o=o[_0x5317("0xb")](i,n[1]))[_0x5317("0x30")])return o;switch(i=0,o&&(n=[0,o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a[_0x5317("0x17")]++,{value:n[1],done:!1};case 5:a[_0x5317("0x17")]++,i=n[1],n=[0];continue;case 7:n=a[_0x5317("0x34")][_0x5317("0x35")](),a[_0x5317("0x1b")][_0x5317("0x35")]();continue;default:if(o=a[_0x5317("0x1b")],!(o=o[_0x5317("0x15")]>0&&o[o.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a[_0x5317("0x17")]=n[1];break}if(6===n[0]&&a[_0x5317("0x17")]<o[1]){a[_0x5317("0x17")]=o[1],o=n;break}if(o&&a[_0x5317("0x17")]<o[2]){a[_0x5317("0x17")]=o[2],a[_0x5317("0x34")][_0x5317("0x1a")](n);break}o[2]&&a[_0x5317("0x34")][_0x5317("0x35")](),a[_0x5317("0x1b")].pop();continue}n=t[_0x5317("0xb")](x,a)}catch(x){n=[6,x],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:voi