Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / services / agi / graph / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x8f59=['getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','size','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','no\x20edge/s\x20available','condition','split','length','vswitch','target','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits'];(function(_0x164b96,_0x12f735){var _0x5489d9=function(_0x57ef88){while(--_0x57ef88){_0x164b96['push'](_0x164b96['shift']());}};_0x5489d9(++_0x12f735);}(_0x8f59,0x11d));var _0x98f5=function(_0x51c938,_0x7b322){_0x51c938=_0x51c938-0x0;var _0x4bb8b2=_0x8f59[_0x51c938];return _0x4bb8b2;};'use strict';var _=require(_0x98f5('0x0'));var logger=require(_0x98f5('0x1'))(_0x98f5('0x2'));var verticesWithRetry=[_0x98f5('0x3'),_0x98f5('0x4'),_0x98f5('0x5')];var Graph=function(){this['vertices']={};this[_0x98f5('0x6')]={};this[_0x98f5('0x7')]=0x0;};Graph[_0x98f5('0x8')][_0x98f5('0x9')]=function(_0x54c7c2){this[_0x98f5('0xa')][_0x54c7c2['id']]=_0x54c7c2;this[_0x98f5('0x6')][_0x54c7c2['id']]=[];};Graph[_0x98f5('0x8')]['addEdge']=function(_0x5e91b3,_0x109417,_0x1cd8a8){this[_0x98f5('0x6')][_0x5e91b3]['push']({'target':_0x109417,'condition':_0x1cd8a8});this[_0x98f5('0x7')]+=0x1;};Graph[_0x98f5('0x8')][_0x98f5('0xb')]=function(){return _[_0x98f5('0xb')](this['vertices']);};Graph[_0x98f5('0x8')]['relations']=function(){return this['numberOfEdges'];};Graph[_0x98f5('0x8')][_0x98f5('0xc')]=function(_0x576e1e){return this[_0x98f5('0xa')][_0x576e1e];};Graph[_0x98f5('0x8')][_0x98f5('0xd')]=function(_0x160626,_0x3286f7){if(!this[_0x98f5('0xa')][_0x160626]){return logger['info'](_0x98f5('0xe'));}var _0xbade31=_0x3286f7(this['vertices'][_0x160626]);if(!_0xbade31){return logger[_0x98f5('0xf')](_0x98f5('0x10'));}if(this[_0x98f5('0x6')][_0x160626]['length']===0x0){return logger[_0x98f5('0xf')](_0x98f5('0x11'));}for(var _0x113545=0x0,_0x5bb486=[],_0x440cfa=![];_0x113545<this[_0x98f5('0x6')][_0x160626]['length'];_0x113545+=0x1){if(this[_0x98f5('0x6')][_0x160626][_0x113545]['condition']){_0x5bb486=this[_0x98f5('0x6')][_0x160626][_0x113545][_0x98f5('0x12')][_0x98f5('0x13')](',');for(var _0x11b6d4=0x0;_0x11b6d4<_0x5bb486[_0x98f5('0x14')];_0x11b6d4+=0x1){if(this[_0x98f5('0xa')][_0x160626]['agicommand']===_0x98f5('0x15')&&_0x5bb486[_0x11b6d4]==='-'){_0x440cfa=this['edges'][_0x160626][_0x113545][_0x98f5('0x16')];logger[_0x98f5('0xf')]('default',_0x5bb486[_0x11b6d4],this[_0x98f5('0x6')][_0x160626][_0x113545][_0x98f5('0x16')]);}else if(this[_0x98f5('0xa')][_0x160626][_0x98f5('0x17')]===_0x98f5('0x3')&&_0x5bb486[_0x11b6d4]==='i'){_0x440cfa=this[_0x98f5('0x6')][_0x160626][_0x113545][_0x98f5('0x16')];logger['info'](_0x98f5('0x18'),_0x5bb486[_0x11b6d4],this['edges'][_0x160626][_0x113545][_0x98f5('0x16')]);}if(_0x5bb486[_0x11b6d4]===_0xbade31){return this['traverseBFS'](this[_0x98f5('0x6')][_0x160626][_0x113545][_0x98f5('0x16')],_0x3286f7);}}}else{return this[_0x98f5('0xd')](this[_0x98f5('0x6')][_0x160626][_0x113545][_0x98f5('0x16')],_0x3286f7);}}if(_0x5bb486[_0x98f5('0x14')]){if(this[_0x98f5('0xa')][_0x160626]['agicommand']===_0x98f5('0x15')){if(_0x440cfa){return this[_0x98f5('0xd')](_0x440cfa,_0x3286f7);}return logger['info'](_0x98f5('0x19'));}else if(_[_0x98f5('0x1a')](verticesWithRetry,this[_0x98f5('0xa')][_0x160626][_0x98f5('0x17')])){if(_0xbade31==='-'){return logger[_0x98f5('0xf')](_0x98f5('0x1b'));}if(_0x440cfa&&_0xbade31!=='t'){return this[_0x98f5('0xd')](_0x440cfa,_0x3286f7);}return this[_0x98f5('0xd')](_0x160626,_0x3286f7);}return logger['info']('condition\x20not\x20found');}};module[_0x98f5('0x1c')]=Graph;