Built motion from commit dec9cf4.|0.0.134
[motion.git] / server / api / custom_report / custom_report.controller.js
index d1d3620..b941734 100644 (file)
@@ -1 +1 @@
-var _0xcfce=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x4D\x65\x74\x72\x69\x63","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x6E\x61\x6D\x65","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x70\x61\x72\x65\x6E\x74","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\x6F\x72\x64\x65\x72","\x25\x73\x20\x25\x73","\x73\x6F\x72\x74\x5F\x62\x79","\x73\x6F\x72\x74\x5F\x6F\x72\x64\x65\x72","\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x25","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x24","\x72\x6F\x6C\x65","\x73\x70\x6C\x69\x74","\x70\x61\x72\x73\x65","\x66\x6F\x72\x4F\x77\x6E","\x63\x6C\x69\x65\x6E\x74\x51\x75\x65\x72\x79","\x24\x6C\x69\x6B\x65","\x66\x6F\x72\x49\x6E","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x62\x6C\x65\x77\x20\x75\x70\x21","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x63\x65\x69\x6C","\x6F\x66\x66\x73\x65\x74","\x25\x73\x3A\x2F\x2F\x25\x73\x25\x73\x3F\x70\x61\x67\x65\x3D\x25\x64","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x68\x6F\x73\x74","\x68\x65\x61\x64\x65\x72\x73","\x62\x61\x73\x65\x55\x72\x6C","\x72\x6F\x77\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x70\x72\x65\x76\x69\x65\x77","\x6C\x6F\x67","\x6C\x65\x6E\x67\x74\x68","\x73\x70\x72\x65\x61\x64","\x61\x6C\x6C","\x66\x6F\x75\x6E\x64\x20\x72\x65\x70\x6F\x72\x74","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x75\x69\x50\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x50\x44\x46","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x43\x53\x56","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x62\x6F\x64\x79","\x65\x6E\x64\x44\x61\x74\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x53\x54\x41\x52\x54\x5F\x4F\x52\x5F\x45\x4E\x44\x5F\x44\x41\x54\x45\x5F\x4D\x49\x53\x53\x49\x4E\x47","\x65\x78\x74\x72\x61\x63\x74","\x63\x72\x65\x61\x74\x65","\x73\x68\x6F\x77","\x46\x69\x65\x6C\x64\x73","\x63\x6F\x70\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x6D\x61\x70","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74\x49\x64","\x69\x6D\x70\x6F\x72\x74","","\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x43\x4F\x55\x4E\x54\x28\x44\x49\x53\x54\x49\x4E\x43\x54\x20\x25\x73\x29","\x66\x69\x65\x6C\x64","\x43\x4F\x55\x4E\x54\x20\x44\x49\x53\x54\x49\x4E\x43\x54","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x28\x25\x73\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73\x20\x41\x53\x43\x29","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x20\x41\x53\x43","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x28\x25\x73\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20\x25\x73\x20\x44\x45\x53\x43\x29","\x47\x52\x4F\x55\x50\x5F\x43\x4F\x4E\x43\x41\x54\x20\x44\x45\x53\x43","\x25\x73\x28\x25\x73\x29","\x25\x73\x20\x41\x53\x20\x27\x25\x73\x27","\x61\x6C\x69\x61\x73","\x67\x72\x6F\x75\x70\x42\x79","\x6F\x72\x64\x65\x72\x42\x79","\x67\x72\x6F\x75\x70","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x20","\x2C","\x6A\x6F\x69\x6E","\x2C\x43\x4F\x55\x4E\x54\x28\x2A\x29","\x20\x46\x52\x4F\x4D\x20","\x74\x61\x62\x6C\x65","\x28\x29","\x20\x57\x48\x45\x52\x45\x20","\x70\x65\x72\x50\x61\x67\x65","\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x3E\x3D\x20\x27","\x27","\x63\x72\x65\x61\x74\x65\x64\x41\x74\x20\x3C\x3D\x20\x27","\x66\x69\x6E\x64","\x20\x4C\x49\x4B\x45\x20\x27\x25","\x25\x27","\x20\x41\x4E\x44\x20","\x20\x47\x52\x4F\x55\x50\x20\x42\x59\x20","\x20\x4F\x52\x44\x45\x52\x20\x42\x59\x20","\x20\x4C\x49\x4D\x49\x54\x20","\x20\x4F\x46\x46\x53\x45\x54\x20","\x28","\x72\x75\x6C\x65\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E","\x20\x27","\x4C\x49\x4B\x45","\x76\x61\x6C\x75\x65","\x29","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0xcfce[0];var _=require(_0xcfce[1]);var util=require(_0xcfce[2]);var sequelize=require(_0xcfce[4])[_0xcfce[3]];var CustomReport=require(_0xcfce[4])[_0xcfce[5]];var ReportField=require(_0xcfce[4])[_0xcfce[6]];var Metric=require(_0xcfce[4])[_0xcfce[7]];var ExtractedReport=require(_0xcfce[4])[_0xcfce[8]];var extractUtils=require(_0xcfce[9]);exports[_0xcfce[10]]=function(_0x4495x9,_0x4495xa,_0x4495xb){var _0x4495xc=[_0xcfce[11],_0xcfce[12],_0xcfce[13]];var _0x4495xd=_0x4495x9[_0xcfce[15]][_0xcfce[14]]?parseInt(_0x4495x9[_0xcfce[15]][_0xcfce[14]],10):100;var _0x4495xe=_0x4495x9[_0xcfce[15]][_0xcfce[16]]?parseInt(_0x4495x9[_0xcfce[15]][_0xcfce[16]],10):0;var _0x4495xf={where:{},limit:_0x4495xd,offset:_0x4495xe*_0x4495xd};_[_0xcfce[35]](_0x4495x9[_0xcfce[15]],function(_0x4495x10,_0x4495x11){switch(_0x4495x11){case _0xcfce[14]:;case _0xcfce[16]:break ;;case _0xcfce[19]:_0x4495xf[_0xcfce[17]]=util[_0xcfce[22]](_0xcfce[18],_0x4495x9[_0xcfce[15]][_0xcfce[19]],_0x4495x9[_0xcfce[15]][_0xcfce[20]]||_0xcfce[21])||null;break ;;case _0xcfce[20]:break ;;case _0xcfce[28]:_0x4495xf[_0xcfce[24]][_0xcfce[23]]=[];_0x4495xc[_0xcfce[27]](function(_0x4495x12){var _0x4495x13={};_0x4495x13[_0x4495x12]={$like:_0xcfce[25]+_0x4495x10+_0xcfce[25]};_0x4495xf[_0xcfce[24]][_0xcfce[23]][_0xcfce[26]](_0x4495x13);});break ;;case _0xcfce[29]:_0x4495xf[_0xcfce[24]][_0xcfce[29]]={$or:_0x4495x10[_0xcfce[30]](/[\s,]+/)};break ;;case _0xcfce[33]:var _0x4495x14=JSON[_0xcfce[31]](_0x4495x10);_[_0xcfce[32]](_0x4495x14,function(_0x4495x15,_0x4495x16){_0x4495xf[_0xcfce[24]][_0x4495x16]=_0x4495x15});break ;;default:_0x4495xf[_0xcfce[24]][_0x4495x11]={$like:{}};_0x4495xf[_0xcfce[24]][_0x4495x11][_0xcfce[34]]=_0xcfce[25]+_0x4495x10+_0xcfce[25];;}});CustomReport[_0xcfce[50]](_0x4495xf)[_0xcfce[49]](function(_0x4495x18){var _0x4495x19=Math[_0xcfce[41]](_0x4495x18[_0xcfce[40]]/_0x4495xd);var _0x4495x1a=_0x4495x19>(_0x4495xf[_0xcfce[42]]+1)?util[_0xcfce[22]](_0xcfce[43],_0x4495x9[_0xcfce[44]],_0x4495x9[_0xcfce[46]][_0xcfce[45]],_0x4495x9[_0xcfce[47]],_0x4495xe+1):null;var _0x4495x1b=_0x4495xe>0?util[_0xcfce[22]](_0xcfce[43],_0x4495x9[_0xcfce[44]],_0x4495x9[_0xcfce[46]][_0xcfce[45]],_0x4495x9[_0xcfce[47]],_0x4495xe-1):null;_0x4495xa[_0xcfce[38]](200)[_0xcfce[37]]({count:_0x4495x18[_0xcfce[40]],rows:_0x4495x18[_0xcfce[48]],next_page:_0x4495x1a,previous_page:_0x4495x1b,total_pages:_0x4495x19});})[_0xcfce[39]](function(_0x4495x17){_0x4495xa[_0xcfce[38]](500)[_0xcfce[37]]({error:_0xcfce[36]})});};exports[_0xcfce[51]]=function(_0x4495x9,_0x4495xa){CustomReport[_0xcfce[64]](_0x4495x9[_0xcfce[63]][_0xcfce[62]],{include:[{all:true}]})[_0xcfce[49]](function(_0x4495x1e){console[_0xcfce[52]](_0xcfce[56]);if(!_0x4495x1e){return _0x4495xa[_0xcfce[57]](404)};var _0x4495xf=buildReport(_0x4495x1e[_0xcfce[58]],_0x4495x9[_0xcfce[15]]);var _0x4495x1f=[sequelize[_0xcfce[15]](_0x4495xf,{type:sequelize[_0xcfce[60]][_0xcfce[59]]})];if(_0x4495x9[_0xcfce[15]][_0xcfce[61]]){var _0x4495x20=buildReport(_0x4495x1e[_0xcfce[58]],_0x4495x9[_0xcfce[15]],true);_0x4495x1f[_0xcfce[26]](sequelize[_0xcfce[15]](_0x4495x20,{type:sequelize[_0xcfce[60]][_0xcfce[59]]}));};return _0x4495x1f;})[_0xcfce[55]]()[_0xcfce[54]](function(_0x4495x1c,_0x4495x1d){console[_0xcfce[52]](_0x4495x1c[_0xcfce[53]]);console[_0xcfce[52]](_0x4495x1d);_0x4495xa[_0xcfce[38]](200)[_0xcfce[37]]({rows:_0x4495x1c,count:_0x4495x1d?_0x4495x1d[0]:null});})[_0xcfce[39]](function(_0x4495x17){console[_0xcfce[52]](_0x4495x17);return handleError(_0x4495xa,_0x4495x17);})};exports[_0xcfce[65]]=function(_0x4495x9,_0x4495xa){docExtract(_0x4495x9,_0x4495xa,_0xcfce[66])};exports[_0xcfce[67]]=function(_0x4495x9,_0x4495xa){docExtract(_0x4495x9,_0x4495xa,_0xcfce[68])};function docExtract(_0x4495x9,_0x4495xa,_0x4495x22){if(!_0x4495x9[_0xcfce[70]][_0xcfce[69]]||!_0x4495x9[_0xcfce[70]][_0xcfce[71]]){return _0x4495xa[_0xcfce[38]](500)[_0xcfce[37]]({message:_0xcfce[72]})};CustomReport[_0xcfce[64]](_0x4495x9[_0xcfce[63]][_0xcfce[62]],{include:[{all:true}]})[_0xcfce[49]](function(_0x4495x1e){if(!_0x4495x1e){return _0x4495xa[_0xcfce[57]](404)};return [_0x4495x1e,ExtractedReport[_0xcfce[74]]({name:_0x4495x1e[_0xcfce[11]],startDate:_0x4495x9[_0xcfce[70]][_0xcfce[69]],endDate:_0x4495x9[_0xcfce[70]][_0xcfce[71]],output:_0x4495x22})];})[_0xcfce[54]](function(_0x4495x1e,_0x4495x23){extractUtils[_0xcfce[73]+_0x4495x22](_0x4495x1e,_0x4495x9[_0xcfce[70]][_0xcfce[69]],_0x4495x9[_0xcfce[70]][_0xcfce[71]],_0x4495x23[_0xcfce[62]])})[_0xcfce[39]](function(_0x4495x17){console[_0xcfce[52]](_0x4495x17);return handleError(_0x4495xa,_0x4495x17);});return _0x4495xa[_0xcfce[57]](200);}exports[_0xcfce[75]]=function(_0x4495x9,_0x4495xa){CustomReport[_0xcfce[64]](_0x4495x9[_0xcfce[63]][_0xcfce[62]],{include:[{model:ReportField,as:_0xcfce[76],include:[Metric]}]})[_0xcfce[49]](function(_0x4495x1e){if(!_0x4495x1e){return _0x4495xa[_0xcfce[57]](404)};return _0x4495xa[_0xcfce[37]](_0x4495x1e);})[_0xcfce[39]](function(_0x4495x17){return handleError(_0x4495xa,_0x4495x17)})};exports[_0xcfce[77]]=function(_0x4495x9,_0x4495xa){CustomReport[_0xcfce[64]](_0x4495x9[_0xcfce[63]][_0xcfce[62]],{include:[{all:true}]})[_0xcfce[49]](function(_0x4495x1e){if(!_0x4495x1e){return _0x4495xa[_0xcfce[57]](404)};var _0x4495x24=_0x4495x1e[_0xcfce[58]];delete _0x4495x24[_0xcfce[62]];delete _0x4495x24[_0xcfce[78]];delete _0x4495x24[_0xcfce[79]];_0x4495x24[_0xcfce[13]]=_0x4495x9[_0xcfce[70]][_0xcfce[13]];_0x4495x24[_0xcfce[76]]=_[_0xcfce[80]](_0x4495x24.Fields,_0xcfce[58]);_[_0xcfce[27]](_0x4495x24.Fields,function(_0x4495x25){delete _0x4495x25[_0xcfce[62]];delete _0x4495x25[_0xcfce[81]];delete _0x4495x25[_0xcfce[78]];delete _0x4495x25[_0xcfce[79]];});return CustomReport[_0xcfce[74]](_0x4495x24,{include:[{all:true}]});})[_0xcfce[49]](function(){return _0x4495xa[_0xcfce[57]](201)})[_0xcfce[39]](function(_0x4495x17){console[_0xcfce[52]](_0x4495x17);return handleError(_0x4495xa,_0x4495x17);})};exports[_0xcfce[82]]=function(_0x4495x9,_0x4495xa){CustomReport[_0xcfce[74]](_0x4495x9[_0xcfce[70]],{include:[{model:ReportField,as:_0xcfce[76],include:[Metric]}]})[_0xcfce[49]](function(_0x4495x1e){return _0x4495xa[_0xcfce[38]](201)[_0xcfce[37]](_0x4495x1e)})[_0xcfce[39]](function(_0x4495x17){return handleError(_0x4495xa,_0x4495x17)})};function buildReport(_0x4495x1e,_0x4495xf,_0x4495x27){var _0x4495x28=[],_0x4495x29=[],_0x4495x2a=[];_[_0xcfce[27]](_0x4495x1e.Fields,function(_0x4495x25){var _0x4495x2b=_0xcfce[83];if(_0x4495x25[_0xcfce[84]]){switch(_0x4495x25[_0xcfce[84]]){case _0xcfce[87]:_0x4495x2b=util[_0xcfce[22]](_0xcfce[85],_0x4495x25[_0xcfce[86]]);break ;;case _0xcfce[89]:_0x4495x2b=util[_0xcfce[22]](_0xcfce[88],_0x4495x25[_0xcfce[86]],_0x4495x25[_0xcfce[86]]);break ;;case _0xcfce[91]:_0x4495x2b=util[_0xcfce[22]](_0xcfce[90],_0x4495x25[_0xcfce[86]],_0x4495x25[_0xcfce[86]]);break ;;default:_0x4495x2b=util[_0xcfce[22]](_0xcfce[92],_0x4495x25[_0xcfce[84]],_0x4495x25[_0xcfce[86]]);;}}else {_0x4495x2b=_0x4495x25[_0xcfce[86]]};_0x4495x28[_0xcfce[26]](util[_0xcfce[22]](_0xcfce[93],_0x4495x2b,_0x4495x25[_0xcfce[94]]));if(_0x4495x25[_0xcfce[95]]){_0x4495x29[_0xcfce[26]](_0x4495x25[_0xcfce[86]])};if(_0x4495x25[_0xcfce[96]]){_0x4495x2a[_0xcfce[26]](util[_0xcfce[22]](_0xcfce[18],_0x4495x25[_0xcfce[86]],_0x4495x25[_0xcfce[96]]))};});var _0x4495x2c=getConditions(JSON[_0xcfce[31]](_0x4495x1e[_0xcfce[98]])[_0xcfce[97]]);var _0x4495x2d=_0xcfce[59];_0x4495x2d+=_0xcfce[99]+_0x4495x28[_0xcfce[101]](_0xcfce[100]);if(_0x4495x27){_0x4495x2d+=_0xcfce[102]};_0x4495x2d+=_0xcfce[103]+_0x4495x1e[_0xcfce[104]];_0x4495x2d+=_0x4495x2c!==_0xcfce[105]?_0xcfce[106]+_0x4495x2c:_0xcfce[83];var _0x4495x2e=false;var _0x4495x2f=false;var _0x4495x30,_0x4495x31;var _0x4495x32=[];if(_0x4495xf){_[_0xcfce[32]](_0x4495xf,function(_0x4495x10,_0x4495x11){switch(_0x4495x11){case _0xcfce[16]:if(_0x4495xf[_0xcfce[107]]){_0x4495x2e=parseInt(_0x4495xf[_0xcfce[107]],10);_0x4495x2f=parseInt(_0x4495x10,10)*_0x4495x2e;};break ;;case _0xcfce[107]:_0x4495x2e=parseInt(_0x4495x10,10);break ;;case _0xcfce[69]:_0x4495x32[_0xcfce[26]](_0xcfce[108]+_0x4495x10+_0xcfce[109]);break ;;case _0xcfce[71]:_0x4495x32[_0xcfce[26]](_0xcfce[110]+_0x4495x10+_0xcfce[109]);break ;;case _0xcfce[61]:break ;;default:var _0x4495x33=_[_0xcfce[111]](_0x4495x1e.Fields,{alias:_0x4495x11})[_0xcfce[86]];if(_0x4495x33){_0x4495x32[_0xcfce[26]](_0x4495x33+_0xcfce[112]+_0x4495x10+_0xcfce[113])}else {_0x4495x32[_0xcfce[26]](_0x4495x11+_0xcfce[112]+_0x4495x10+_0xcfce[113])};;}})};if(_0x4495x32[_0xcfce[53]]){_0x4495x2d+=((_0x4495x2c!==_0xcfce[105])?_0xcfce[114]:_0xcfce[106])+_0x4495x32[_0xcfce[101]](_0xcfce[114])};_0x4495x2d+=_0x4495x29[_0xcfce[53]]?_0xcfce[115]+_0x4495x29[_0xcfce[101]](_0xcfce[100]):_0xcfce[83];_0x4495x2d+=_0x4495x2a[_0xcfce[53]]?_0xcfce[116]+_0x4495x2a[_0xcfce[101]](_0xcfce[100]):_0xcfce[83];_0x4495x2d+=_0x4495x2e&&!_0x4495x27?_0xcfce[117]+_0x4495x2e:_0xcfce[83];_0x4495x2d+=_0x4495x2f&&!_0x4495x27?_0xcfce[118]+_0x4495x2f:_0xcfce[83];console[_0xcfce[52]](_0x4495x2d);return _0x4495x2d;}function getConditions(_0x4495x35){if(!_0x4495x35){return _0xcfce[83]};for(var _0x4495x36=_0xcfce[119],_0x4495x37=0;_0x4495x37<_0x4495x35[_0xcfce[120]][_0xcfce[53]];_0x4495x37++){_0x4495x37>0&&(_0x4495x36+=_0xcfce[99]+_0x4495x35[_0xcfce[121]]+_0xcfce[99]);_0x4495x36+=_0x4495x35[_0xcfce[120]][_0x4495x37][_0xcfce[97]]?getConditions(_0x4495x35[_0xcfce[120]][_0x4495x37][_0xcfce[97]]):_0x4495x35[_0xcfce[120]][_0x4495x37][_0xcfce[86]]+_0xcfce[99]+_0x4495x35[_0xcfce[120]][_0x4495x37][_0xcfce[122]]+_0xcfce[123]+(_0x4495x35[_0xcfce[120]][_0x4495x37][_0xcfce[122]]===_0xcfce[124]?_0xcfce[25]+_0x4495x35[_0xcfce[120]][_0x4495x37][_0xcfce[125]]+_0xcfce[25]:_0x4495x35[_0xcfce[120]][_0x4495x37][_0xcfce[125]])+_0xcfce[109];};return _0x4495x36+_0xcfce[126];}exports[_0xcfce[74]]=function(_0x4495x9,_0x4495xa){CustomReport[_0xcfce[74]](_0x4495x9[_0xcfce[70]])[_0xcfce[49]](function(_0x4495x1e){return _0x4495xa[_0xcfce[38]](201)[_0xcfce[37]](_0x4495x1e)})[_0xcfce[39]](function(_0x4495x17){return handleError(_0x4495xa,_0x4495x17)})};exports[_0xcfce[127]]=function(_0x4495x9,_0x4495xa){if(_0x4495x9[_0xcfce[70]][_0xcfce[62]]){delete _0x4495x9[_0xcfce[70]][_0xcfce[62]]};ReportField[_0xcfce[129]]({where:{CustomReportId:_0x4495x9[_0xcfce[63]][_0xcfce[62]]}})[_0xcfce[49]](function(){return ReportField[_0xcfce[128]](_0x4495x9[_0xcfce[70]].Fields)})[_0xcfce[49]](function(){delete _0x4495x9[_0xcfce[70]][_0xcfce[76]];return CustomReport[_0xcfce[127]](_0x4495x9[_0xcfce[70]],{where:{id:_0x4495x9[_0xcfce[63]][_0xcfce[62]]}});})[_0xcfce[49]](function(){return _0x4495xa[_0xcfce[57]](200)})[_0xcfce[39]](function(_0x4495x17){console[_0xcfce[52]](_0x4495x17);return handleError(_0x4495xa,_0x4495x17);});};exports[_0xcfce[129]]=function(_0x4495x9,_0x4495xa){CustomReport[_0xcfce[64]](_0x4495x9[_0xcfce[63]][_0xcfce[62]])[_0xcfce[49]](function(_0x4495x1e){if(!_0x4495x1e){return _0x4495xa[_0xcfce[57]](404)};_0x4495x1e[_0xcfce[129]]()[_0xcfce[49]](function(){return _0x4495xa[_0xcfce[57]](204)})[_0xcfce[39]](function(_0x4495x17){return handleError(_0x4495xa,_0x4495x17)});})[_0xcfce[39]](function(_0x4495x17){return handleError(_0x4495xa,_0x4495x17)})};exports[_0xcfce[130]]=function(_0x4495x9,_0x4495xa){CustomReport[_0xcfce[129]]({where:{id:_0x4495x9[_0xcfce[15]][_0xcfce[62]]},individualHooks:true})[_0xcfce[49]](function(){return _0x4495xa[_0xcfce[57]](204)})[_0xcfce[39]](function(_0x4495x17){return handleError(_0x4495xa,_0x4495x17)})};function handleError(_0x4495xa,_0x4495x17){return _0x4495xa[_0xcfce[38]](500)[_0xcfce[37]](_0x4495x17)}
\ No newline at end of file
+var _0x1cee=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x4D\x65\x74\x72\x69\x63","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x62\x75\x69\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x6D\x6F\x6D\x65\x6E\x74","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x67\x65\x74\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x72\x79","\x45\x72\x72\x6F\x72\x20\x67\x65\x74\x74\x69\x6E\x67\x20\x71\x75\x65\x72\x79\x20\x66\x72\x6F\x6D\x20\x61\x70\x69\x3A","\x6C\x6F\x67","\x6E\x6F\x20\x73\x75\x66\x66\x69\x63\x69\x65\x6E\x74\x20\x71\x75\x65\x75\x65\x20\x70\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x73\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x75\x73\x65\x72","\x70\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E","\x61\x6C\x6C","\x62\x75\x69\x6C\x64\x51\x75\x65\x72\x79","\x73\x70\x72\x65\x61\x64","\x75\x73\x65\x72","\x62\x75\x69\x6C\x64\x46\x69\x6C\x74\x65\x72","\x66\x6F\x75\x6E\x64\x20\x72\x65\x70\x6F\x72\x74","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x64\x61\x69\x6C\x79","\x74\x72\x75\x65","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44","\x66\x6F\x72\x6D\x61\x74","\x65\x6E\x64\x44\x61\x74\x65","\x74\x61\x62\x6C\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x5F\x68\x69\x73\x74\x6F\x72\x79","","\x72\x65\x70\x6C\x61\x63\x65","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x66\x69\x65\x6C\x64\x73","\x73\x63\x6F\x70\x65","\x70\x72\x65\x76\x69\x65\x77","\x69\x73\x41\x72\x72\x61\x79","\x6C\x65\x6E\x67\x74\x68","\x6C\x69\x6D\x69\x74","\x76\x61\x6C\x75\x65","\x74\x61\x6B\x65","\x6F\x66\x66\x73\x65\x74","\x73\x6C\x69\x63\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x4F\x77\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x71\x75\x65\x72\x79\x20\x65\x72\x72\x6F\x72","\x63\x68\x65\x63\x6B\x51\x75\x65\x72\x79","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x50\x44\x46","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x43\x53\x56","\x64\x65\x73\x74\x72\x6F\x79\x4E\x6F\x64\x65\x52\x65\x70\x6F\x72\x74\x73","\x74\x72\x65\x65","\x70\x61\x72\x73\x65","\x66\x69\x6E\x64","\x4E\x6F\x64\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x70\x75\x73\x68","\x66\x69\x6C\x74\x65\x72","\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x2E\x6A\x73","\x66\x6F\x72\x6B","\x65\x72\x72\x6F\x72","\x63\x68\x69\x6C\x64\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x63\x68\x69\x6C\x64\x20\x63\x6C\x6F\x73\x65","\x6D\x65\x73\x73\x61\x67\x65","\x63\x68\x69\x6C\x64\x20\x6D\x65\x73\x73\x61\x67\x65","\x6B\x69\x6C\x6C","\x70\x61\x72\x65\x6E\x74","\x6E\x61\x6D\x65","\x73\x74\x61\x72\x74\x54\x69\x6D\x65","\x20","\x30\x30\x3A\x30\x30","\x65\x6E\x64\x54\x69\x6D\x65","\x32\x33\x3A\x35\x39","\x63\x72\x65\x61\x74\x65","\x74\x65\x78\x74","\x2F\x20","\x23","\x73\x68\x6F\x77","\x65\x78\x70\x6F\x72\x74","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x46\x69\x65\x6C\x64\x73","\x63\x6F\x70\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x62\x6F\x64\x79","\x6D\x61\x70","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64\x73","\x69\x6D\x70\x6F\x72\x74","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x67\x65\x74\x54\x61\x62\x6C\x65","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74\x49\x64","\x4D\x65\x74\x72\x69\x63\x49\x64","\x66\x69\x65\x6C\x64","\x6D\x65\x74\x72\x69\x63","\x54\x68\x65\x20\x6D\x65\x74\x72\x69\x63\x20\x77\x69\x74\x68\x20\x69\x64\x20","\x20\x79\x6F\x75\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x63\x75\x73\x74\x6F\x6D","\x54\x68\x65\x20\x66\x69\x65\x6C\x64\x20","\x20\x79\x6F\x75\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65","\x6B\x65\x79\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x59\x6F\x75\x20\x68\x61\x76\x65\x20\x6E\x6F\x74\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65\x20\x6F\x72\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x44\x65\x66\x61\x75\x6C\x74\x4D\x65\x74\x72\x69\x63\x49\x64","\x68\x61\x73","\x65\x76\x65\x72\x79","\x44\x65\x66\x61\x75\x6C\x74\x4D\x65\x74\x72\x69\x63","\x55\x6E\x73\x75\x70\x70\x6F\x72\x74\x65\x64\x20\x49\x6D\x70\x6F\x72\x74\x20\x66\x6F\x72\x6D\x61\x74\x20\x28\x4D\x65\x74\x72\x69\x63\x20\x74\x79\x70\x65\x20\x69\x6E\x20\x72\x65\x70\x6F\x72\x74\x20\x66\x69\x65\x6C\x64\x73\x20\x69\x73\x20\x6D\x69\x73\x73\x69\x6E\x67\x29","\x49\x64","\x67\x72\x6F\x75\x70\x42\x79","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x6E\x75\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64\x73","\x5F","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x1cee[0];var _=require(_0x1cee[1]);var util=require(_0x1cee[2]);var sequelize=require(_0x1cee[4])[_0x1cee[3]];var CustomReport=require(_0x1cee[4])[_0x1cee[5]];var ReportField=require(_0x1cee[4])[_0x1cee[6]];var Metric=require(_0x1cee[4])[_0x1cee[7]];var ExtractedReport=require(_0x1cee[4])[_0x1cee[8]];var extractUtils=require(_0x1cee[9]);var reportBuildUtils=require(_0x1cee[10]);var Util=require(_0x1cee[11]);var sr=require(_0x1cee[12]);var moment=require(_0x1cee[13]);var cp=require(_0x1cee[14]);var ReportTree=require(_0x1cee[4])[_0x1cee[15]];exports[_0x1cee[16]]= function(_0xa116xf,_0xa116x10,_0xa116x11){return CustomReport[_0x1cee[23]](Util[_0x1cee[22]](_0xa116xf[_0x1cee[21]],{deletedAt:null}))[_0x1cee[20]](function(_0xa116x13){_0xa116x10[_0x1cee[19]](200)[_0x1cee[18]](_0xa116x13)})[_0x1cee[17]](function(_0xa116x12){return handleError(_0xa116x10,_0xa116x12)})};exports[_0x1cee[24]]= function(_0xa116xf,_0xa116x10){return Promise[_0x1cee[29]]([])[_0x1cee[20]](getQuery(_0xa116xf,_0xa116x10))[_0x1cee[20]](function(_0xa116x14){if(_0xa116x14){switch(_0xa116x14){case _0x1cee[28]:_0xa116x14= _0x1cee[27];break;default:}};_0xa116x10[_0x1cee[19]](200)[_0x1cee[18]]({query:_0xa116x14})})[_0x1cee[17]](function(_0xa116x12){console[_0x1cee[26]](_0x1cee[25],_0xa116x12)})};function getQuery(_0xa116xf,_0xa116x10){var _0xa116x16;return function(){return CustomReport[_0x1cee[51]](_0x1cee[50])[_0x1cee[49]](_0xa116xf[_0x1cee[48]][_0x1cee[47]])[_0x1cee[20]](function(_0xa116x18){console[_0x1cee[26]](_0x1cee[34]);if(!_0xa116x18){return _0xa116x10[_0x1cee[35]](404)};if(_0xa116xf[_0x1cee[21]][_0x1cee[36]]&& _0xa116xf[_0x1cee[21]][_0x1cee[36]]=== _0x1cee[37]){_0xa116xf[_0x1cee[21]][_0x1cee[38]]= moment()[_0x1cee[40]](_0x1cee[39]);_0xa116xf[_0x1cee[21]][_0x1cee[41]]= moment()[_0x1cee[40]](_0x1cee[39]);_0xa116x18[_0x1cee[43]][_0x1cee[42]]= _0xa116x18[_0x1cee[43]][_0x1cee[42]][_0x1cee[46]](_0x1cee[44],_0x1cee[45])};delete _0xa116xf[_0x1cee[21]][_0x1cee[36]];_0xa116x16= _0xa116x18[_0x1cee[43]];return _0xa116x16[_0x1cee[42]]})[_0x1cee[20]](reportBuildUtils[_0x1cee[33]](_0xa116xf[_0x1cee[32]]))[_0x1cee[20]](function(_0xa116x17){return [_0xa116x17,_0xa116x16]})[_0x1cee[31]](reportBuildUtils[_0x1cee[30]](_0xa116xf[_0x1cee[21]]))}}exports[_0x1cee[52]]= function(_0xa116xf,_0xa116x10){var _0xa116x19;return Promise[_0x1cee[29]]([])[_0x1cee[20]](getQuery(_0xa116xf,_0xa116x10))[_0x1cee[20]](reportBuildUtils[_0x1cee[64]]())[_0x1cee[20]](function(_0xa116x1a){if(_0xa116x1a&& _[_0x1cee[53]](_0xa116x1a)){_0xa116x19= _0xa116x1a[_0x1cee[54]];if(_0xa116xf[_0x1cee[21]][_0x1cee[55]]){_0xa116x1a= _(_0xa116x1a)[_0x1cee[59]](_0xa116xf[_0x1cee[21]][_0x1cee[58]]|| 0)[_0x1cee[57]](_0xa116xf[_0x1cee[21]][_0x1cee[55]])[_0x1cee[56]]()};_[_0x1cee[62]](_0xa116x1a,function(_0xa116x1b){_[_0x1cee[61]](_0xa116x1b,function(_0xa116x1c,_0xa116x1d){if(_0xa116x1c instanceof  Date){_0xa116x1b[_0xa116x1d]= moment(_0xa116x1c)[_0x1cee[40]](_0x1cee[60]).toString()}})});_0xa116x10[_0x1cee[19]](200)[_0x1cee[18]]({rows:_0xa116x1a,count:_0xa116x19})}else {return handleError(_0xa116x10,{message:_0xa116x1a|| _0x1cee[63]})}})[_0x1cee[17]](function(_0xa116x12){console[_0x1cee[26]](_0xa116x12);return handleError(_0xa116x10,_0xa116x12)})};exports[_0x1cee[65]]= function(_0xa116xf,_0xa116x10){docExtract(_0xa116xf,_0xa116x10,_0x1cee[66])};exports[_0x1cee[67]]= function(_0xa116xf,_0xa116x10){docExtract(_0xa116xf,_0xa116x10,_0x1cee[68])};exports[_0x1cee[69]]= function(_0xa116xf,_0xa116x10){return ReportTree[_0x1cee[49]](2)[_0x1cee[20]](function(_0xa116x1e){_0xa116x1e= JSON[_0x1cee[71]](_0xa116x1e[_0x1cee[70]]);var _0xa116x1f=_[_0x1cee[72]](_0xa116x1e,{id:_0xa116xf[_0x1cee[48]][_0x1cee[47]]});if(!_0xa116x1f){throw  new Error(_0x1cee[73])};var _0xa116x20=[];findSubNodes(_0xa116x1f,_0xa116x1e,_0xa116x20);console[_0x1cee[26]](_0xa116x20);return CustomReport[_0x1cee[74]]({where:{parent:_0xa116x20},individualHooks:true})})[_0x1cee[20]](function(){return _0xa116x10[_0x1cee[35]](200)})[_0x1cee[17]](function(_0xa116x12){console[_0x1cee[26]](_0xa116x12);return handleError(_0xa116x10,_0xa116x12)})};function findSubNodes(_0xa116x1f,_0xa116x1e,_0xa116x22){_0xa116x22[_0x1cee[75]](_0xa116x1f[_0x1cee[47]]);var _0xa116x23=_[_0x1cee[76]](_0xa116x1e,{parent:_0xa116x1f[_0x1cee[47]]});if(!_0xa116x23|| !_0xa116x23[_0x1cee[54]]){return};_[_0x1cee[62]](_0xa116x23,function(_0xa116x24){findSubNodes(_0xa116x24,_0xa116x1e,_0xa116x22)})}function docExtract(_0xa116xf,_0xa116x10,_0xa116x26){var _0xa116x18;CustomReport[_0x1cee[51]](_0x1cee[50])[_0x1cee[49]](_0xa116xf[_0x1cee[48]][_0x1cee[47]])[_0x1cee[20]](function(_0xa116x16){if(!_0xa116x16){return _0xa116x10[_0x1cee[35]](404)};_0xa116x18= _0xa116x16;return ReportTree[_0x1cee[49]](2)})[_0x1cee[20]](function(_0xa116x1e){_0xa116x1e= JSON[_0x1cee[71]](_0xa116x1e[_0x1cee[70]]);var _0xa116x2a=_[_0x1cee[72]](_0xa116x1e,{id:_0xa116x18[_0x1cee[87]]});var _0xa116x2b=getReportPath(_0xa116x2a,_0xa116x1e,_0xa116x18[_0x1cee[88]]);if(_0xa116xf[_0x1cee[21]][_0x1cee[36]]&& _0xa116xf[_0x1cee[21]][_0x1cee[36]]=== _0x1cee[37]){_0xa116xf[_0x1cee[21]][_0x1cee[38]]= moment()[_0x1cee[40]](_0x1cee[39]);_0xa116xf[_0x1cee[21]][_0x1cee[41]]= moment()[_0x1cee[40]](_0x1cee[39]);_0xa116x18[_0x1cee[43]][_0x1cee[42]]= _0xa116x18[_0x1cee[43]][_0x1cee[42]][_0x1cee[46]](_0x1cee[44],_0x1cee[45])};delete _0xa116xf[_0x1cee[21]][_0x1cee[36]];return [_0xa116x18,ExtractedReport[_0x1cee[94]]({name:_0xa116x2b,startDate:_0xa116xf[_0x1cee[21]][_0x1cee[38]]?_0xa116xf[_0x1cee[21]][_0x1cee[38]]+ (_0xa116xf[_0x1cee[21]][_0x1cee[89]]?_0x1cee[90]+ _0xa116xf[_0x1cee[21]][_0x1cee[89]]:_0x1cee[91]):null,endDate:_0xa116xf[_0x1cee[21]][_0x1cee[41]]?_0xa116xf[_0x1cee[21]][_0x1cee[41]]+ (_0xa116xf[_0x1cee[21]][_0x1cee[92]]?_0x1cee[90]+ _0xa116xf[_0x1cee[21]][_0x1cee[92]]:_0x1cee[93]):null,output:_0xa116x26,UserId:_0xa116xf[_0x1cee[32]][_0x1cee[47]]})]})[_0x1cee[31]](function(_0xa116x18,_0xa116x27){var _0xa116x28=cp[_0x1cee[78]](__dirname+ _0x1cee[77]);_0xa116x28[_0x1cee[81]](_0x1cee[84],function(_0xa116x29){console[_0x1cee[26]](_0x1cee[85],_0xa116x29);_0xa116x28[_0x1cee[86]]()})[_0x1cee[81]](_0x1cee[82],function(){console[_0x1cee[26]](_0x1cee[83])})[_0x1cee[81]](_0x1cee[79],function(_0xa116x12){console[_0x1cee[26]](_0x1cee[80],_0xa116x12)});_0xa116x28[_0x1cee[18]]({report:_0xa116x18,query:_0xa116xf[_0x1cee[21]],extractedId:_0xa116x27[_0x1cee[47]],user:_0xa116xf[_0x1cee[32]],type:_0xa116x26})})[_0x1cee[17]](function(_0xa116x12){console[_0x1cee[26]](_0xa116x12);return handleError(_0xa116x10,_0xa116x12)});return _0xa116x10[_0x1cee[35]](200)}function getReportPath(_0xa116x2a,_0xa116x1e,_0xa116x2b){_0xa116x2b= _0xa116x2a[_0x1cee[95]]+ _0x1cee[96]+ _0xa116x2b;if(_0xa116x2a[_0x1cee[87]]=== _0x1cee[97]){return _0xa116x2b}else {return getReportPath(_[_0x1cee[72]](_0xa116x1e,{id:_0xa116x2a[_0x1cee[87]]}),_0xa116x1e,_0xa116x2b)}}exports[_0x1cee[98]]= function(_0xa116xf,_0xa116x10){return CustomReport[_0x1cee[51]](_0x1cee[50])[_0x1cee[49]](_0xa116xf[_0x1cee[48]][_0x1cee[47]])[_0x1cee[20]](function(_0xa116x18){if(!_0xa116x18){return _0xa116x10[_0x1cee[35]](404)};return _0xa116x10[_0x1cee[18]](_0xa116x18)})[_0x1cee[17]](function(_0xa116x12){return handleError(_0xa116x10,_0xa116x12)})};exports[_0x1cee[99]]= function(_0xa116xf,_0xa116x10){return CustomReport[_0x1cee[51]]({method:[_0x1cee[102],{CustomReportId:_0xa116xf[_0x1cee[48]][_0x1cee[47]]}]})[_0x1cee[49]](_0xa116xf[_0x1cee[48]][_0x1cee[47]],{attributes:[_0x1cee[100],_0x1cee[101],_0x1cee[88],_0x1cee[87],_0x1cee[42]]})[_0x1cee[20]](function(_0xa116x18){if(!_0xa116x18){return _0xa116x10[_0x1cee[35]](404)};return _0xa116x10[_0x1cee[18]](_0xa116x18)})[_0x1cee[17]](function(_0xa116x12){return handleError(_0xa116x10,_0xa116x12)})};exports[_0x1cee[103]]= function(_0xa116xf,_0xa116x10){var _0xa116x2d;return sequelize[_0x1cee[108]](function(_0xa116x2e){return CustomReport[_0x1cee[51]](_0x1cee[50])[_0x1cee[49]](_0xa116xf[_0x1cee[48]][_0x1cee[47]])[_0x1cee[20]](function(_0xa116x18){if(!_0xa116x18){return _0xa116x10[_0x1cee[35]](404)};var _0xa116x2f=_0xa116x18[_0x1cee[43]];delete _0xa116x2f[_0x1cee[47]];delete _0xa116x2f[_0x1cee[104]];delete _0xa116x2f[_0x1cee[105]];_0xa116x2f[_0x1cee[87]]= _0xa116xf[_0x1cee[106]][_0x1cee[87]];_0xa116x2d= _[_0x1cee[107]](_0xa116x2f.Fields,_0x1cee[43]);return CustomReport[_0x1cee[94]](_0xa116x2f,{transaction:_0xa116x2e})})[_0x1cee[20]](function(_0xa116x18){return [_0xa116x18,_0xa116x2d]})[_0x1cee[31]](createFields(_0xa116x2e))})[_0x1cee[20]](function(){return _0xa116x10[_0x1cee[35]](201)})[_0x1cee[17]](function(_0xa116x12){console[_0x1cee[26]](_0xa116x12);return handleError(_0xa116x10,_0xa116x12)})};exports[_0x1cee[94]]= function(_0xa116xf,_0xa116x10){var _0xa116x16;return sequelize[_0x1cee[108]](function(_0xa116x2e){return CustomReport[_0x1cee[94]](_0xa116xf[_0x1cee[106]],{transaction:_0xa116x2e})[_0x1cee[20]](function(_0xa116x18){_0xa116x16= _0xa116x18;return [_0xa116x16,_0xa116xf[_0x1cee[106]][_0x1cee[109]]]})[_0x1cee[31]](createFields(_0xa116x2e))})[_0x1cee[20]](function(){return _0xa116x10[_0x1cee[19]](201)[_0x1cee[18]](_0xa116x16)})[_0x1cee[17]](function(_0xa116x12){console[_0x1cee[26]](_0xa116x12);return handleError(_0xa116x10,_0xa116x12)})};exports[_0x1cee[110]]= function(_0xa116xf,_0xa116x10){var _0xa116x16;return sequelize[_0x1cee[108]](function(_0xa116x2e){return CustomReport[_0x1cee[94]](_0xa116xf[_0x1cee[106]],{transaction:_0xa116x2e})[_0x1cee[20]](function(_0xa116x18){_0xa116x16= _0xa116x18;return [_0xa116x16,_0xa116xf[_0x1cee[106]][_0x1cee[109]]]})[_0x1cee[31]](createImportFields(_0xa116x2e))})[_0x1cee[20]](function(){return _0xa116x10[_0x1cee[19]](201)[_0x1cee[18]](_0xa116x16)})[_0x1cee[17]](function(_0xa116x12){console[_0x1cee[26]](_0xa116x12);return handleError(_0xa116x10,_0xa116x12)})};exports[_0x1cee[111]]= function(_0xa116xf,_0xa116x10,_0xa116x11){if(_0xa116xf[_0x1cee[106]][_0x1cee[47]]){delete _0xa116xf[_0x1cee[106]][_0x1cee[47]]};var _0xa116x16;return sequelize[_0x1cee[108]](function(_0xa116x2e){return CustomReport[_0x1cee[49]](_0xa116xf[_0x1cee[48]][_0x1cee[47]])[_0x1cee[20]](function(_0xa116x18){if(!_0xa116x18){return _0xa116x10[_0x1cee[35]](404)};var _0xa116x30=_[_0x1cee[112]](_0xa116x18,_0xa116xf[_0x1cee[106]]);return _0xa116x18[_0x1cee[113]]({transaction:_0xa116x2e})})[_0x1cee[20]](function(_0xa116x18){_0xa116x16= _0xa116x18;if(_0xa116xf[_0x1cee[106]][_0x1cee[109]]){return ReportField[_0x1cee[74]]({where:{CustomReportId:_0xa116xf[_0x1cee[48]][_0x1cee[47]]},transaction:_0xa116x2e})}})[_0x1cee[20]](function(){return [_0xa116x16,_0xa116xf[_0x1cee[106]][_0x1cee[109]]]})[_0x1cee[31]](createFields(_0xa116x2e))})[_0x1cee[20]](function(){return _0xa116x10[_0x1cee[35]](200)})[_0x1cee[17]](function(_0xa116x12){console[_0x1cee[26]](_0xa116x12);return handleError(_0xa116x10,_0xa116x12)})};function createFields(_0xa116x2e){return function(_0xa116x18,_0xa116x32){if(_0xa116x32&& Array[_0x1cee[53]](_0xa116x32)&& _0xa116x32[_0x1cee[54]]){var _0xa116x33=reportBuildUtils[_0x1cee[114]](_0xa116x18[_0x1cee[42]]);if(_0xa116x33){var _0xa116x34;return _0xa116x33[_0x1cee[127]]()[_0x1cee[20]](function(_0xa116x39){_0xa116x34= _[_0x1cee[125]](_0xa116x39);return Metric[_0x1cee[126]]()})[_0x1cee[20]](function(_0xa116x35){var _0xa116x36=[];_0xa116x35= _[_0x1cee[107]](_0xa116x35,_0x1cee[43]);_0xa116x32[_0x1cee[62]](function(_0xa116x37){_0xa116x37[_0x1cee[115]]= _0xa116x18[_0x1cee[47]];if(_0xa116x37[_0x1cee[116]]){var _0xa116x38=_[_0x1cee[72]](_0xa116x35,{id:_0xa116x37[_0x1cee[116]]});if(_0xa116x38){_0xa116x37[_0x1cee[117]]= _0xa116x38[_0x1cee[118]];_0xa116x36[_0x1cee[75]](ReportField[_0x1cee[94]](_0xa116x37,{transaction:_0xa116x2e}))}else {throw  new sequelize.Error(_0x1cee[119]+ _0xa116x37[_0x1cee[116]]+ _0x1cee[120])}}else {if(_[_0x1cee[121]](_0xa116x34,_0xa116x37[_0x1cee[117]])|| _0xa116x37[_0x1cee[122]]){_0xa116x36[_0x1cee[75]](ReportField[_0x1cee[94]](_0xa116x37,{transaction:_0xa116x2e}))}else {throw  new sequelize.Error(_0x1cee[123]+ _0xa116x37[_0x1cee[117]]+ _0x1cee[124])}}});return _0xa116x36})[_0x1cee[29]]()}else {throw  new sequelize.Error(_0x1cee[128])}}}}function createImportFields(_0xa116x2e){return function(_0xa116x18,_0xa116x32){if(_0xa116x32&& Array[_0x1cee[53]](_0xa116x32)&& _0xa116x32[_0x1cee[54]]){var _0xa116x33=reportBuildUtils[_0x1cee[114]](_0xa116x18[_0x1cee[42]]);if(_0xa116x33){var _0xa116x34;return _0xa116x33[_0x1cee[127]]()[_0x1cee[20]](function(_0xa116x39){_0xa116x34= _[_0x1cee[125]](_0xa116x39);var _0xa116x36=[];var _0xa116x3b;if(_[_0x1cee[131]](_0xa116x32,function(_0xa116x37){return _[_0x1cee[130]](_0xa116x37,_0x1cee[129])})){_0xa116x3b= _0x1cee[132]}else {if(_[_0x1cee[131]](_0xa116x32,function(_0xa116x37){return _[_0x1cee[130]](_0xa116x37,_0x1cee[116])})){_0xa116x3b= _0x1cee[7]}else {throw  new sequelize.Error(_0x1cee[133])}};var _0xa116x3c=_[_0x1cee[135]](_0xa116x32,_0xa116x3b+ _0x1cee[134]);_[_0x1cee[61]](_0xa116x3c,function(_0xa116x3d,_0xa116x1d){if(_0xa116x1d!== _0x1cee[136]&& _0xa116x1d!== _0x1cee[137]){_0xa116x3d[0][_0xa116x3b][_0x1cee[138]][_0x1cee[62]](function(_0xa116x37){_0xa116x37[_0x1cee[115]]= _0xa116x18[_0x1cee[47]]});_0xa116x3d[0][_0xa116x3b][_0x1cee[88]]+= _0x1cee[139]+ sr({length:5});_0xa116x36[_0x1cee[75]](Metric[_0x1cee[94]](_0xa116x3d[0][_0xa116x3b],{include:[{model:ReportField,as:_0x1cee[138]}],transaction:_0xa116x2e}))}else {_0xa116x3d[_0x1cee[62]](function(_0xa116x37){if(_[_0x1cee[121]](_0xa116x34,_0xa116x37[_0x1cee[117]])|| _0xa116x37[_0x1cee[122]]){_0xa116x37[_0x1cee[115]]= _0xa116x18[_0x1cee[47]];_0xa116x36[_0x1cee[75]](ReportField[_0x1cee[94]](_0xa116x37,{transaction:_0xa116x2e}))}else {throw  new sequelize.Error(_0x1cee[123]+ _0xa116x37[_0x1cee[117]]+ _0x1cee[124])}})}});return _0xa116x36})[_0x1cee[29]]()}else {throw  new sequelize.Error(_0x1cee[128])}}}}exports[_0x1cee[74]]= function(_0xa116xf,_0xa116x10){return CustomReport[_0x1cee[49]](_0xa116xf[_0x1cee[48]][_0x1cee[47]])[_0x1cee[20]](function(_0xa116x18){if(!_0xa116x18){return _0xa116x10[_0x1cee[35]](404)};return _0xa116x18[_0x1cee[74]]()})[_0x1cee[20]](function(){return _0xa116x10[_0x1cee[35]](204)})[_0x1cee[17]](function(_0xa116x12){return handleError(_0xa116x10,_0xa116x12)})};exports[_0x1cee[140]]= function(_0xa116xf,_0xa116x10){return CustomReport[_0x1cee[74]]({where:{id:_0xa116xf[_0x1cee[21]][_0x1cee[141]]},individualHooks:true})[_0x1cee[20]](function(){return _0xa116x10[_0x1cee[35]](204)})[_0x1cee[17]](function(_0xa116x12){return handleError(_0xa116x10,_0xa116x12)})};function handleError(_0xa116x10,_0xa116x12){return _0xa116x10[_0x1cee[19]](500)[_0x1cee[18]](_0xa116x12)}
\ No newline at end of file