Built motion from commit aab208717af8d15f4fa224cdb6a202877019af9b. Version 3.0.0...
[motion-next.git] / server / services / routing / lib / rule-engine.js
index 186095b..4ba274a 100644 (file)
@@ -1 +1 @@
-const a1163_0x3698=['ignoreFactChanges','inherits','rules','toString','orderBy','result','name','findRules','call','condition','matchPath','prototype','prioritize','consequence','isString','noop','isNil','execute','matches','sync','ruleRef','next','clone','nextTick','asc','filter','init','map','push','object','EventEmitter','priority','exports','register','lodash','isObject','turn','activeRules','length','toJSON'];(function(_0x820e61,_0x3698fd){const _0x5f3eac=function(_0x2a4b9e){while(--_0x2a4b9e){_0x820e61['push'](_0x820e61['shift']());}};_0x5f3eac(++_0x3698fd);}(a1163_0x3698,0x170));const a1163_0x5f3e=function(_0x820e61,_0x3698fd){_0x820e61=_0x820e61-0x0;let _0x5f3eac=a1163_0x3698[_0x820e61];return _0x5f3eac;};const _0x2e7698=a1163_0x5f3e;'use strict';const _=require(_0x2e7698('0x1a')),util=require('util'),EventEmitter=require('events')[_0x2e7698('0x16')];function RuleEngine(_0x2a4b9e,_0x355b11){const _0x1731cb=_0x2e7698;return this['init'](),!_[_0x1731cb('0x8')](_0x2a4b9e)&&this[_0x1731cb('0x19')](_0x2a4b9e),_0x355b11&&(this[_0x1731cb('0x20')]=_0x355b11['ignoreFactChanges']),this;}util[_0x2e7698('0x21')](RuleEngine,EventEmitter),RuleEngine[_0x2e7698('0x3')]['init']=function(){const _0x26a650=_0x2e7698;this[_0x26a650('0x22')]=[],this['activeRules']=[];},RuleEngine[_0x2e7698('0x3')][_0x2e7698('0x19')]=function(_0x1b5d5f){const _0x4028b1=_0x2e7698;if(Array['isArray'](_0x1b5d5f))this[_0x4028b1('0x22')]=this['rules']['concat'](_0x1b5d5f);else _0x1b5d5f!==null&&_[_0x4028b1('0x1b')](_0x1b5d5f)&&this[_0x4028b1('0x22')][_0x4028b1('0x14')](_0x1b5d5f);this[_0x4028b1('0xb')]();},RuleEngine[_0x2e7698('0x3')][_0x2e7698('0xb')]=function(){const _0x2b1463=_0x2e7698;this[_0x2b1463('0x1d')]=this[_0x2b1463('0x22')][_0x2b1463('0x11')](function(_0xf45b17){_['isNil'](_0xf45b17['on'])&&(_0xf45b17['on']=!![]);if(_0xf45b17['on']===!![])return _0xf45b17;}),this[_0x2b1463('0x1d')]=_[_0x2b1463('0x24')](this['activeRules'],['p'],[_0x2b1463('0x10')]);},RuleEngine[_0x2e7698('0x3')][_0x2e7698('0x9')]=function(_0x1cc397,_0x41fa17){const _0x4bddfb=_0x2e7698;let _0x1e5586=![];_0x1cc397[_0x4bddfb('0x25')]=!![];const _0x446009=_[_0x4bddfb('0xe')](_0x1cc397);let _0xdee694=_[_0x4bddfb('0xe')](_0x1cc397);const _0x1d38b8=this[_0x4bddfb('0x1d')],_0xbfff68=[],_0x28d462=this[_0x4bddfb('0x20')];(function _0x7d7c99(_0xed5850){const _0x18ea05=_0x4bddfb,_0x5405d1={'rules':function(){return _0x1d38b8;},'rule':function(){return _0x1d38b8[_0xed5850];},'when':function(_0x2bdf40){const _0x181957=a1163_0x5f3e;if(_0x2bdf40){const _0x1f6a93=_0x1d38b8[_0xed5850][_0x181957('0x5')];_0x1f6a93[_0x181957('0xc')]=_0x1d38b8[_0xed5850]['id']||_0x1d38b8[_0xed5850][_0x181957('0x26')]||'index_'+_0xed5850,process[_0x181957('0xf')](function(){const _0x5a8b76=_0x181957;_0xbfff68[_0x5a8b76('0x14')](_0x1f6a93[_0x5a8b76('0xc')]),_0x1f6a93[_0x5a8b76('0x0')](_0x446009,_0x5405d1);});}else process[_0x181957('0xf')](function(){const _0x4dd164=_0x181957;_0x5405d1[_0x4dd164('0xd')]();});},'restart':function(){return _0x7d7c99(0x0);},'stop':function(){return _0x1e5586=!![],_0x7d7c99(0x0);},'next':function(_0x5b9efa){const _0x3240a8=a1163_0x5f3e;!_0x28d462&&!_['isEqual'](_0xdee694,_0x446009)?(_0xdee694=_[_0x3240a8('0xe')](_0x446009),process[_0x3240a8('0xf')](function(){_0x5405d1['restart']();})):process[_0x3240a8('0xf')](function(){const _0x5ce685=_0x3240a8;return _[_0x5ce685('0x8')](_0x5b9efa)?_0x7d7c99(_0xed5850+0x1):_0x7d7c99(_0x5b9efa);});}};if(_0xed5850<_0x1d38b8['length']&&_0x1e5586===![]){const _0x3f0bb0=_0x1d38b8[_0xed5850][_0x18ea05('0x1')];_0x3f0bb0[_0x18ea05('0x0')](_0x446009,_0x5405d1);}else process[_0x18ea05('0xf')](function(){const _0x1328ba=_0x18ea05;return _0x446009[_0x1328ba('0x2')]=_0xbfff68,_0x41fa17?_0x41fa17(_0x446009):_[_0x1328ba('0x7')]();});}(0x0));},RuleEngine[_0x2e7698('0x3')][_0x2e7698('0x27')]=function(_0x51c67e){const _0x2535bf=_0x2e7698;if(_[_0x2535bf('0x8')](_0x51c67e))return this[_0x2535bf('0x22')];else{const _0xf49009=_[_0x2535bf('0xa')](_0x51c67e);return _[_0x2535bf('0x11')](this['rules'],_0xf49009);}},RuleEngine[_0x2e7698('0x3')][_0x2e7698('0x1c')]=function(_0x228b51,_0x5a1dad){const _0x285d9f=_0x2e7698,_0x107e2f=_0x228b51==='on'||_0x228b51==='ON'?!![]:![],_0x4dca4c=this['findRules'](_0x5a1dad);for(let _0x21cacb=0x0,_0x4f0f80=_0x4dca4c[_0x285d9f('0x1e')];_0x21cacb<_0x4f0f80;_0x21cacb+=0x1){_0x4dca4c[_0x21cacb]['on']=_0x107e2f;}this[_0x285d9f('0xb')]();},RuleEngine['prototype'][_0x2e7698('0x4')]=function(_0x42419d,_0x2a16ef){const _0x6ad79f=_0x2e7698;_0x42419d=parseInt(_0x42419d,0xa);const _0xf54df1=this[_0x6ad79f('0x27')](_0x2a16ef);for(let _0x28fcec=0x0,_0x4d3aec=_0xf54df1[_0x6ad79f('0x1e')];_0x28fcec<_0x4d3aec;_0x28fcec+=0x1){_0xf54df1[_0x28fcec][_0x6ad79f('0x17')]=_0x42419d;}this[_0x6ad79f('0xb')]();},RuleEngine[_0x2e7698('0x3')][_0x2e7698('0x1f')]=function(){const _0x221d8f=_0x2e7698;let _0xfc96d1=this[_0x221d8f('0x22')];if(_0xfc96d1 instanceof Array)_0xfc96d1=_0xfc96d1[_0x221d8f('0x13')](function(_0x323cb6){const _0x4309b8=_0x221d8f;return _0x323cb6[_0x4309b8('0x1')]=_0x323cb6[_0x4309b8('0x1')][_0x4309b8('0x23')](),_0x323cb6[_0x4309b8('0x5')]=_0x323cb6['consequence'][_0x4309b8('0x23')](),_0x323cb6;});else!_[_0x221d8f('0x8')](_0xfc96d1)&&(_0xfc96d1[_0x221d8f('0x1')]=_0xfc96d1[_0x221d8f('0x1')][_0x221d8f('0x23')](),_0xfc96d1[_0x221d8f('0x5')]=_0xfc96d1[_0x221d8f('0x5')][_0x221d8f('0x23')]());return _0xfc96d1;},RuleEngine['prototype']['fromJSON']=function(_0x4fbeee){const _0x3994e0=_0x2e7698;this[_0x3994e0('0x12')]();_[_0x3994e0('0x6')](_0x4fbeee)&&(_0x4fbeee=JSON['parse'](_0x4fbeee));if(_0x4fbeee instanceof Array)_0x4fbeee=_0x4fbeee[_0x3994e0('0x13')](function(_0x3162ba){const _0x245b70=_0x3994e0;return _0x3162ba['condition']=eval('('+_0x3162ba[_0x245b70('0x1')]+')'),_0x3162ba[_0x245b70('0x5')]=eval('('+_0x3162ba[_0x245b70('0x5')]+')'),_0x3162ba;});else _0x4fbeee!==null&&typeof _0x4fbeee==_0x3994e0('0x15')&&(_0x4fbeee[_0x3994e0('0x1')]=eval('('+_0x4fbeee[_0x3994e0('0x1')]+')'),_0x4fbeee[_0x3994e0('0x5')]=eval('('+_0x4fbeee[_0x3994e0('0x5')]+')'));this[_0x3994e0('0x19')](_0x4fbeee);},module[_0x2e7698('0x18')]=RuleEngine;
\ No newline at end of file
+const a1163_0x51ed=['util','restart','init','isObject','consequence','asc','execute','filter','clone','concat','turn','length','name','isEqual','findRules','EventEmitter','toJSON','call','condition','rules','map','inherits','priority','isNil','result','push','events','prototype','isArray','nextTick','ruleRef','index_','matchPath','sync','parse','ignoreFactChanges','activeRules','lodash','noop','fromJSON','isString','matches','register','toString','prioritize'];(function(_0xc9da67,_0x51ed90){const _0x28a014=function(_0xca3b9c){while(--_0xca3b9c){_0xc9da67['push'](_0xc9da67['shift']());}};_0x28a014(++_0x51ed90);}(a1163_0x51ed,0x12b));const a1163_0x28a0=function(_0xc9da67,_0x51ed90){_0xc9da67=_0xc9da67-0x0;let _0x28a014=a1163_0x51ed[_0xc9da67];return _0x28a014;};const _0x407283=a1163_0x28a0;'use strict';const _=require(_0x407283('0x8')),util=require(_0x407283('0x10')),EventEmitter=require(_0x407283('0x2a'))[_0x407283('0x1f')];function RuleEngine(_0xca3b9c,_0x376ce2){const _0x2d86d1=_0x407283;return this['init'](),!_[_0x2d86d1('0x27')](_0xca3b9c)&&this['register'](_0xca3b9c),_0x376ce2&&(this['ignoreFactChanges']=_0x376ce2['ignoreFactChanges']),this;}util[_0x407283('0x25')](RuleEngine,EventEmitter),RuleEngine[_0x407283('0x2b')][_0x407283('0x12')]=function(){const _0x3aeaa5=_0x407283;this[_0x3aeaa5('0x23')]=[],this[_0x3aeaa5('0x7')]=[];},RuleEngine[_0x407283('0x2b')][_0x407283('0xd')]=function(_0x8ec65e){const _0x304166=_0x407283;if(Array[_0x304166('0x2c')](_0x8ec65e))this['rules']=this['rules'][_0x304166('0x19')](_0x8ec65e);else _0x8ec65e!==null&&_[_0x304166('0x13')](_0x8ec65e)&&this['rules'][_0x304166('0x29')](_0x8ec65e);this[_0x304166('0x4')]();},RuleEngine['prototype'][_0x407283('0x4')]=function(){const _0x4230bd=_0x407283;this[_0x4230bd('0x7')]=this[_0x4230bd('0x23')][_0x4230bd('0x17')](function(_0xef5eda){const _0x50f5b0=_0x4230bd;_[_0x50f5b0('0x27')](_0xef5eda['on'])&&(_0xef5eda['on']=!![]);if(_0xef5eda['on']===!![])return _0xef5eda;}),this[_0x4230bd('0x7')]=_['orderBy'](this[_0x4230bd('0x7')],['p'],[_0x4230bd('0x15')]);},RuleEngine[_0x407283('0x2b')][_0x407283('0x16')]=function(_0x2f1715,_0x5199fd){const _0x58af3d=_0x407283;let _0x409e44=![];_0x2f1715[_0x58af3d('0x28')]=!![];const _0xcef5ee=_[_0x58af3d('0x18')](_0x2f1715);let _0x5c78d7=_['clone'](_0x2f1715);const _0x50f149=this['activeRules'],_0x8b02c6=[],_0x29b73b=this[_0x58af3d('0x6')];(function _0x154235(_0x1681a3){const _0x34a2d0=_0x58af3d,_0x42e940={'rules':function(){return _0x50f149;},'rule':function(){return _0x50f149[_0x1681a3];},'when':function(_0x27685d){const _0x29e324=a1163_0x28a0;if(_0x27685d){const _0x300d25=_0x50f149[_0x1681a3][_0x29e324('0x14')];_0x300d25[_0x29e324('0x1')]=_0x50f149[_0x1681a3]['id']||_0x50f149[_0x1681a3][_0x29e324('0x1c')]||_0x29e324('0x2')+_0x1681a3,process[_0x29e324('0x0')](function(){const _0x34801f=_0x29e324;_0x8b02c6[_0x34801f('0x29')](_0x300d25['ruleRef']),_0x300d25[_0x34801f('0x21')](_0xcef5ee,_0x42e940);});}else process['nextTick'](function(){_0x42e940['next']();});},'restart':function(){return _0x154235(0x0);},'stop':function(){return _0x409e44=!![],_0x154235(0x0);},'next':function(_0x12b5c2){const _0x574363=a1163_0x28a0;!_0x29b73b&&!_[_0x574363('0x1d')](_0x5c78d7,_0xcef5ee)?(_0x5c78d7=_[_0x574363('0x18')](_0xcef5ee),process[_0x574363('0x0')](function(){const _0x1a8011=_0x574363;_0x42e940[_0x1a8011('0x11')]();})):process[_0x574363('0x0')](function(){const _0x5d2729=_0x574363;return _[_0x5d2729('0x27')](_0x12b5c2)?_0x154235(_0x1681a3+0x1):_0x154235(_0x12b5c2);});}};if(_0x1681a3<_0x50f149[_0x34a2d0('0x1b')]&&_0x409e44===![]){const _0x8d95b6=_0x50f149[_0x1681a3][_0x34a2d0('0x22')];_0x8d95b6[_0x34a2d0('0x21')](_0xcef5ee,_0x42e940);}else process[_0x34a2d0('0x0')](function(){const _0x3d4803=_0x34a2d0;return _0xcef5ee[_0x3d4803('0x3')]=_0x8b02c6,_0x5199fd?_0x5199fd(_0xcef5ee):_[_0x3d4803('0x9')]();});}(0x0));},RuleEngine['prototype'][_0x407283('0x1e')]=function(_0x42314c){const _0x4a23d9=_0x407283;if(_['isNil'](_0x42314c))return this[_0x4a23d9('0x23')];else{const _0x3ab1c5=_[_0x4a23d9('0xc')](_0x42314c);return _['filter'](this[_0x4a23d9('0x23')],_0x3ab1c5);}},RuleEngine[_0x407283('0x2b')][_0x407283('0x1a')]=function(_0x1b9372,_0x566037){const _0x5aae8a=_0x407283,_0x98c2bd=_0x1b9372==='on'||_0x1b9372==='ON'?!![]:![],_0x48506e=this[_0x5aae8a('0x1e')](_0x566037);for(let _0xf7f1ba=0x0,_0xaacb53=_0x48506e['length'];_0xf7f1ba<_0xaacb53;_0xf7f1ba+=0x1){_0x48506e[_0xf7f1ba]['on']=_0x98c2bd;}this[_0x5aae8a('0x4')]();},RuleEngine[_0x407283('0x2b')][_0x407283('0xf')]=function(_0x58e864,_0x4215fa){const _0x85d4d9=_0x407283;_0x58e864=parseInt(_0x58e864,0xa);const _0x34c8cb=this[_0x85d4d9('0x1e')](_0x4215fa);for(let _0x335195=0x0,_0x2734e2=_0x34c8cb[_0x85d4d9('0x1b')];_0x335195<_0x2734e2;_0x335195+=0x1){_0x34c8cb[_0x335195][_0x85d4d9('0x26')]=_0x58e864;}this[_0x85d4d9('0x4')]();},RuleEngine['prototype'][_0x407283('0x20')]=function(){const _0x5c389d=_0x407283;let _0x41368c=this[_0x5c389d('0x23')];if(_0x41368c instanceof Array)_0x41368c=_0x41368c[_0x5c389d('0x24')](function(_0x5ab257){const _0x101a10=_0x5c389d;return _0x5ab257[_0x101a10('0x22')]=_0x5ab257[_0x101a10('0x22')][_0x101a10('0xe')](),_0x5ab257[_0x101a10('0x14')]=_0x5ab257['consequence']['toString'](),_0x5ab257;});else!_[_0x5c389d('0x27')](_0x41368c)&&(_0x41368c['condition']=_0x41368c['condition']['toString'](),_0x41368c[_0x5c389d('0x14')]=_0x41368c['consequence'][_0x5c389d('0xe')]());return _0x41368c;},RuleEngine[_0x407283('0x2b')][_0x407283('0xa')]=function(_0x285ca6){const _0x5441d9=_0x407283;this[_0x5441d9('0x12')]();_[_0x5441d9('0xb')](_0x285ca6)&&(_0x285ca6=JSON[_0x5441d9('0x5')](_0x285ca6));if(_0x285ca6 instanceof Array)_0x285ca6=_0x285ca6[_0x5441d9('0x24')](function(_0x2ed663){const _0x2b52a3=_0x5441d9;return _0x2ed663[_0x2b52a3('0x22')]=eval('('+_0x2ed663['condition']+')'),_0x2ed663[_0x2b52a3('0x14')]=eval('('+_0x2ed663[_0x2b52a3('0x14')]+')'),_0x2ed663;});else _0x285ca6!==null&&typeof _0x285ca6=='object'&&(_0x285ca6[_0x5441d9('0x22')]=eval('('+_0x285ca6[_0x5441d9('0x22')]+')'),_0x285ca6[_0x5441d9('0x14')]=eval('('+_0x285ca6['consequence']+')'));this[_0x5441d9('0xd')](_0x285ca6);},module['exports']=RuleEngine;
\ No newline at end of file