8075581ae59ce6367531b6786e87f4472c87acdc
[motion2.git] / server / components / parsers / qs.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 _0xe4ff=['map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','unset','hasOwnProperty','^[+]?[0-9]*$','match','getFullTextValue','forEach','replace','push','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','$lte','isArray','limit','offset','sort'];(function(_0x34f702,_0x222471){var _0x5a339e=function(_0x3aebb4){while(--_0x3aebb4){_0x34f702['push'](_0x34f702['shift']());}};_0x5a339e(++_0x222471);}(_0xe4ff,0x1a3));var _0xfe4f=function(_0x3dd23c,_0x18c32f){_0x3dd23c=_0x3dd23c-0x0;var _0x520bf8=_0xe4ff[_0x3dd23c];return _0x520bf8;};'use strict';var _=require(_0xfe4f('0x0'));var sequelize=require(_0xfe4f('0x1'));var moment=require(_0xfe4f('0x2'));var LIMIT_VALUE=0xfa;exports[_0xfe4f('0x3')]=function(_0x47fff3){var _0x4732fe=null;if(_0x47fff3){_0x4732fe=_0x47fff3[_0xfe4f('0x4')](',');}return _0x4732fe;};exports[_0xfe4f('0x5')]=function(_0x11e1ae,_0x27ba60){var _0x1f1ffc={};if(!_[_0xfe4f('0x6')](_0x11e1ae)){_[_0xfe4f('0x7')](_0x11e1ae,function(_0x1a25eb,_0x519b41){try{if(_0x27ba60){var _0x1954ab=_[_0xfe4f('0x8')](_0x27ba60,{'name':_0x519b41})||{};if(_0x1954ab[_0xfe4f('0x9')]===_0xfe4f('0xa')&&_[_0xfe4f('0xb')](_0x1a25eb)){var _0x302a1c=JSON[_0xfe4f('0xc')](_0x1a25eb);var _0x84aef8={'$gte':moment(moment(_0x302a1c[_0xfe4f('0xd')])[_0xfe4f('0xe')](_0xfe4f('0xf')))['utc']()[_0xfe4f('0xe')](),'$lte':moment(moment(_0x302a1c[_0xfe4f('0x10')])[_0xfe4f('0xe')](_0xfe4f('0xf')))['utc']()['subtract'](0x1,'s')[_0xfe4f('0xe')]()};_0x1f1ffc[_0x519b41]=_0x84aef8;}else{_0x1f1ffc[_0x519b41]=_[_0xfe4f('0x11')](_0x1a25eb)?_0x1a25eb:JSON[_0xfe4f('0xc')](_0x1a25eb);}}else{_0x1f1ffc[_0x519b41]=_[_0xfe4f('0x11')](_0x1a25eb)?_0x1a25eb:JSON[_0xfe4f('0xc')](_0x1a25eb);}}catch(_0x13f63b){_0x1f1ffc[_0x519b41]=_0x1a25eb[_0xfe4f('0x4')](',');}});}return _0x1f1ffc;};exports[_0xfe4f('0x12')]=function(_0x481d0b){_0x481d0b=parseInt(_0x481d0b,0xa);if(!_0x481d0b||_0x481d0b<0x0){_0x481d0b=LIMIT_VALUE;}return _0x481d0b;};exports[_0xfe4f('0x13')]=function(_0x57106b){_0x57106b=parseInt(_0x57106b,0xa);if(!_0x57106b||_0x57106b<0x0){_0x57106b=0x0;}return _0x57106b;};exports[_0xfe4f('0x14')]=function(_0xd707c5){var _0x121d91,_0x54b4c0=null;if(_0xd707c5){_0x121d91=_0xd707c5[_0xfe4f('0x4')](',');_0x54b4c0=_[_0xfe4f('0x15')](_0x121d91,function(_0x41964a){if(_0x41964a[_0xfe4f('0x16')]('-')===0x0){return[_0x41964a===_0xfe4f('0x17')?sequelize[_0xfe4f('0x18')](sequelize[_0xfe4f('0x19')](_0xfe4f('0x17')),_0xfe4f('0x1a')):_0x41964a[_0xfe4f('0x1b')](0x1),'DESC'];}else{return[_0x41964a===_0xfe4f('0x17')?sequelize[_0xfe4f('0x18')](sequelize[_0xfe4f('0x19')](_0xfe4f('0x17')),_0xfe4f('0x1a')):_0x41964a,_0xfe4f('0x1c')];}});}return _0x54b4c0;};exports[_0xfe4f('0x1d')]=function(_0x16443a,_0x4e0189){if(_['isEmpty'](_0x16443a)){return _0x16443a;}if(_[_0xfe4f('0x11')](_0x16443a)){for(var _0x364f69=0x0;_0x364f69<_0x16443a[_0xfe4f('0x1e')];_0x364f69+=0x1){_0x16443a[_0x364f69]=this[_0xfe4f('0x1d')](_0x16443a[_0x364f69],_0x4e0189);}return _0x16443a;}if(!_['isObject'](_0x16443a)){return _0x16443a;}if(_['isString'](_0x4e0189)){_0x4e0189=[_0x4e0189];}if(!_['isArray'](_0x4e0189)){return _0x16443a;}for(var _0x24f570=0x0;_0x24f570<_0x4e0189[_0xfe4f('0x1e')];_0x24f570+=0x1){_[_0xfe4f('0x1f')](_0x16443a,_0x4e0189[_0x24f570]);}for(var _0x529b76 in _0x16443a){if(_0x16443a[_0xfe4f('0x20')](_0x529b76)){_0x16443a[_0x529b76]=this['omit'](_0x16443a[_0x529b76],_0x4e0189);}}return _0x16443a;};exports['isNumeric']=function(_0x15644b){return _0x15644b['match'](RegExp(_0xfe4f('0x21')))?!![]:![];};exports['isEmail']=function(_0x18aa57){return _0x18aa57[_0xfe4f('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xfe4f('0x23')]=function(_0x40f713){var _0x10c632=[];_0x40f713[_0xfe4f('0x4')](/[ ,]+/)[_0xfe4f('0x24')](function(_0x29eff8){_0x29eff8=_0x29eff8[_0xfe4f('0x25')](/([^:]")"+/g,'$1');_0x29eff8='+'+_0x29eff8+'*';if(_0x29eff8['includes']('@'))_0x29eff8='\x22'+_0x29eff8+'\x22';_0x10c632[_0xfe4f('0x26')](_0x29eff8);});return _0x10c632[_0xfe4f('0x27')]('\x20');};