Built motion from commit 264c1c7.|0.0.142
[motion.git] / server / api / custom_report / custom_report.controller.js
index e792b74..649bd28 100644 (file)
@@ -1 +1 @@
-var _0xd569=["\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"];_0xd569[0];var _=require(_0xd569[1]);var util=require(_0xd569[2]);var sequelize=require(_0xd569[4])[_0xd569[3]];var CustomReport=require(_0xd569[4])[_0xd569[5]];var ReportField=require(_0xd569[4])[_0xd569[6]];var Metric=require(_0xd569[4])[_0xd569[7]];var ExtractedReport=require(_0xd569[4])[_0xd569[8]];var extractUtils=require(_0xd569[9]);var reportBuildUtils=require(_0xd569[10]);var Util=require(_0xd569[11]);var sr=require(_0xd569[12]);var moment=require(_0xd569[13]);var cp=require(_0xd569[14]);var ReportTree=require(_0xd569[4])[_0xd569[15]];exports[_0xd569[16]]= function(_0x2131xf,_0x2131x10,_0x2131x11){return CustomReport[_0xd569[23]](Util[_0xd569[22]](_0x2131xf[_0xd569[21]],{deletedAt:null}))[_0xd569[20]](function(_0x2131x13){_0x2131x10[_0xd569[19]](200)[_0xd569[18]](_0x2131x13)})[_0xd569[17]](function(_0x2131x12){return handleError(_0x2131x10,_0x2131x12)})};exports[_0xd569[24]]= function(_0x2131xf,_0x2131x10){return Promise[_0xd569[29]]([])[_0xd569[20]](getQuery(_0x2131xf,_0x2131x10))[_0xd569[20]](function(_0x2131x14){if(_0x2131x14){switch(_0x2131x14){case _0xd569[28]:_0x2131x14= _0xd569[27];break;default:}};_0x2131x10[_0xd569[19]](200)[_0xd569[18]]({query:_0x2131x14})})[_0xd569[17]](function(_0x2131x12){console[_0xd569[26]](_0xd569[25],_0x2131x12)})};function getQuery(_0x2131xf,_0x2131x10){var _0x2131x16;return function(){return CustomReport[_0xd569[51]](_0xd569[50])[_0xd569[49]](_0x2131xf[_0xd569[48]][_0xd569[47]])[_0xd569[20]](function(_0x2131x18){console[_0xd569[26]](_0xd569[34]);if(!_0x2131x18){return _0x2131x10[_0xd569[35]](404)};if(_0x2131xf[_0xd569[21]][_0xd569[36]]&& _0x2131xf[_0xd569[21]][_0xd569[36]]=== _0xd569[37]){_0x2131xf[_0xd569[21]][_0xd569[38]]= moment()[_0xd569[40]](_0xd569[39]);_0x2131xf[_0xd569[21]][_0xd569[41]]= moment()[_0xd569[40]](_0xd569[39]);_0x2131x18[_0xd569[43]][_0xd569[42]]= _0x2131x18[_0xd569[43]][_0xd569[42]][_0xd569[46]](_0xd569[44],_0xd569[45])};delete _0x2131xf[_0xd569[21]][_0xd569[36]];_0x2131x16= _0x2131x18[_0xd569[43]];return _0x2131x16[_0xd569[42]]})[_0xd569[20]](reportBuildUtils[_0xd569[33]](_0x2131xf[_0xd569[32]]))[_0xd569[20]](function(_0x2131x17){return [_0x2131x17,_0x2131x16]})[_0xd569[31]](reportBuildUtils[_0xd569[30]](_0x2131xf[_0xd569[21]]))}}exports[_0xd569[52]]= function(_0x2131xf,_0x2131x10){var _0x2131x19;return Promise[_0xd569[29]]([])[_0xd569[20]](getQuery(_0x2131xf,_0x2131x10))[_0xd569[20]](reportBuildUtils[_0xd569[64]]())[_0xd569[20]](function(_0x2131x1a){if(_0x2131x1a&& _[_0xd569[53]](_0x2131x1a)){_0x2131x19= _0x2131x1a[_0xd569[54]];if(_0x2131xf[_0xd569[21]][_0xd569[55]]){_0x2131x1a= _(_0x2131x1a)[_0xd569[59]](_0x2131xf[_0xd569[21]][_0xd569[58]]|| 0)[_0xd569[57]](_0x2131xf[_0xd569[21]][_0xd569[55]])[_0xd569[56]]()};_[_0xd569[62]](_0x2131x1a,function(_0x2131x1b){_[_0xd569[61]](_0x2131x1b,function(_0x2131x1c,_0x2131x1d){if(_0x2131x1c instanceof  Date){_0x2131x1b[_0x2131x1d]= moment(_0x2131x1c)[_0xd569[40]](_0xd569[60]).toString()}})});_0x2131x10[_0xd569[19]](200)[_0xd569[18]]({rows:_0x2131x1a,count:_0x2131x19})}else {return handleError(_0x2131x10,{message:_0x2131x1a|| _0xd569[63]})}})[_0xd569[17]](function(_0x2131x12){console[_0xd569[26]](_0x2131x12);return handleError(_0x2131x10,_0x2131x12)})};exports[_0xd569[65]]= function(_0x2131xf,_0x2131x10){docExtract(_0x2131xf,_0x2131x10,_0xd569[66])};exports[_0xd569[67]]= function(_0x2131xf,_0x2131x10){docExtract(_0x2131xf,_0x2131x10,_0xd569[68])};exports[_0xd569[69]]= function(_0x2131xf,_0x2131x10){return ReportTree[_0xd569[49]](2)[_0xd569[20]](function(_0x2131x1e){_0x2131x1e= JSON[_0xd569[71]](_0x2131x1e[_0xd569[70]]);var _0x2131x1f=_[_0xd569[72]](_0x2131x1e,{id:_0x2131xf[_0xd569[48]][_0xd569[47]]});if(!_0x2131x1f){throw  new Error(_0xd569[73])};var _0x2131x20=[];findSubNodes(_0x2131x1f,_0x2131x1e,_0x2131x20);return CustomReport[_0xd569[74]]({where:{parent:_0x2131x20},individualHooks:true})})[_0xd569[20]](function(){return _0x2131x10[_0xd569[35]](200)})[_0xd569[17]](function(_0x2131x12){console[_0xd569[26]](_0x2131x12);return handleError(_0x2131x10,_0x2131x12)})};function findSubNodes(_0x2131x1f,_0x2131x1e,_0x2131x22){_0x2131x22[_0xd569[75]](_0x2131x1f[_0xd569[47]]);var _0x2131x23=_[_0xd569[76]](_0x2131x1e,{parent:_0x2131x1f[_0xd569[47]]});if(!_0x2131x23|| !_0x2131x23[_0xd569[54]]){return};_[_0xd569[62]](_0x2131x23,function(_0x2131x24){findSubNodes(_0x2131x24,_0x2131x1e,_0x2131x22)})}function docExtract(_0x2131xf,_0x2131x10,_0x2131x26){var _0x2131x18;CustomReport[_0xd569[51]](_0xd569[50])[_0xd569[49]](_0x2131xf[_0xd569[48]][_0xd569[47]])[_0xd569[20]](function(_0x2131x16){if(!_0x2131x16){return _0x2131x10[_0xd569[35]](404)};_0x2131x18= _0x2131x16;return ReportTree[_0xd569[49]](2)})[_0xd569[20]](function(_0x2131x1e){_0x2131x1e= JSON[_0xd569[71]](_0x2131x1e[_0xd569[70]]);var _0x2131x2a=_[_0xd569[72]](_0x2131x1e,{id:_0x2131x18[_0xd569[87]]});var _0x2131x2b=getReportPath(_0x2131x2a,_0x2131x1e,_0x2131x18[_0xd569[88]]);if(_0x2131xf[_0xd569[21]][_0xd569[36]]&& _0x2131xf[_0xd569[21]][_0xd569[36]]=== _0xd569[37]){_0x2131xf[_0xd569[21]][_0xd569[38]]= moment()[_0xd569[40]](_0xd569[39]);_0x2131xf[_0xd569[21]][_0xd569[41]]= moment()[_0xd569[40]](_0xd569[39]);_0x2131x18[_0xd569[43]][_0xd569[42]]= _0x2131x18[_0xd569[43]][_0xd569[42]][_0xd569[46]](_0xd569[44],_0xd569[45])};delete _0x2131xf[_0xd569[21]][_0xd569[36]];return [_0x2131x18,ExtractedReport[_0xd569[94]]({name:_0x2131x2b,startDate:_0x2131xf[_0xd569[21]][_0xd569[38]]?_0x2131xf[_0xd569[21]][_0xd569[38]]+ (_0x2131xf[_0xd569[21]][_0xd569[89]]?_0xd569[90]+ _0x2131xf[_0xd569[21]][_0xd569[89]]:_0xd569[91]):null,endDate:_0x2131xf[_0xd569[21]][_0xd569[41]]?_0x2131xf[_0xd569[21]][_0xd569[41]]+ (_0x2131xf[_0xd569[21]][_0xd569[92]]?_0xd569[90]+ _0x2131xf[_0xd569[21]][_0xd569[92]]:_0xd569[93]):null,output:_0x2131x26,UserId:_0x2131xf[_0xd569[32]][_0xd569[47]]})]})[_0xd569[31]](function(_0x2131x18,_0x2131x27){var _0x2131x28=cp[_0xd569[78]](__dirname+ _0xd569[77]);_0x2131x28[_0xd569[81]](_0xd569[84],function(_0x2131x29){console[_0xd569[26]](_0xd569[85],_0x2131x29);_0x2131x28[_0xd569[86]]()})[_0xd569[81]](_0xd569[82],function(){console[_0xd569[26]](_0xd569[83])})[_0xd569[81]](_0xd569[79],function(_0x2131x12){console[_0xd569[26]](_0xd569[80],_0x2131x12)});_0x2131x28[_0xd569[18]]({report:_0x2131x18,query:_0x2131xf[_0xd569[21]],extractedId:_0x2131x27[_0xd569[47]],user:_0x2131xf[_0xd569[32]],type:_0x2131x26})})[_0xd569[17]](function(_0x2131x12){console[_0xd569[26]](_0x2131x12);return handleError(_0x2131x10,_0x2131x12)});return _0x2131x10[_0xd569[35]](200)}function getReportPath(_0x2131x2a,_0x2131x1e,_0x2131x2b){_0x2131x2b= _0x2131x2a[_0xd569[95]]+ _0xd569[96]+ _0x2131x2b;if(_0x2131x2a[_0xd569[87]]=== _0xd569[97]){return _0x2131x2b}else {return getReportPath(_[_0xd569[72]](_0x2131x1e,{id:_0x2131x2a[_0xd569[87]]}),_0x2131x1e,_0x2131x2b)}}exports[_0xd569[98]]= function(_0x2131xf,_0x2131x10){return CustomReport[_0xd569[51]](_0xd569[50])[_0xd569[49]](_0x2131xf[_0xd569[48]][_0xd569[47]])[_0xd569[20]](function(_0x2131x18){if(!_0x2131x18){return _0x2131x10[_0xd569[35]](404)};return _0x2131x10[_0xd569[18]](_0x2131x18)})[_0xd569[17]](function(_0x2131x12){return handleError(_0x2131x10,_0x2131x12)})};exports[_0xd569[99]]= function(_0x2131xf,_0x2131x10){return CustomReport[_0xd569[51]]({method:[_0xd569[102],{CustomReportId:_0x2131xf[_0xd569[48]][_0xd569[47]]}]})[_0xd569[49]](_0x2131xf[_0xd569[48]][_0xd569[47]],{attributes:[_0xd569[100],_0xd569[101],_0xd569[88],_0xd569[87],_0xd569[42]]})[_0xd569[20]](function(_0x2131x18){if(!_0x2131x18){return _0x2131x10[_0xd569[35]](404)};return _0x2131x10[_0xd569[18]](_0x2131x18)})[_0xd569[17]](function(_0x2131x12){return handleError(_0x2131x10,_0x2131x12)})};exports[_0xd569[103]]= function(_0x2131xf,_0x2131x10){var _0x2131x2d;return sequelize[_0xd569[108]](function(_0x2131x2e){return CustomReport[_0xd569[51]](_0xd569[50])[_0xd569[49]](_0x2131xf[_0xd569[48]][_0xd569[47]])[_0xd569[20]](function(_0x2131x18){if(!_0x2131x18){return _0x2131x10[_0xd569[35]](404)};var _0x2131x2f=_0x2131x18[_0xd569[43]];delete _0x2131x2f[_0xd569[47]];delete _0x2131x2f[_0xd569[104]];delete _0x2131x2f[_0xd569[105]];_0x2131x2f[_0xd569[87]]= _0x2131xf[_0xd569[106]][_0xd569[87]];_0x2131x2d= _[_0xd569[107]](_0x2131x2f.Fields,_0xd569[43]);return CustomReport[_0xd569[94]](_0x2131x2f,{transaction:_0x2131x2e})})[_0xd569[20]](function(_0x2131x18){return [_0x2131x18,_0x2131x2d]})[_0xd569[31]](createFields(_0x2131x2e))})[_0xd569[20]](function(){return _0x2131x10[_0xd569[35]](201)})[_0xd569[17]](function(_0x2131x12){console[_0xd569[26]](_0x2131x12);return handleError(_0x2131x10,_0x2131x12)})};exports[_0xd569[94]]= function(_0x2131xf,_0x2131x10){var _0x2131x16;return sequelize[_0xd569[108]](function(_0x2131x2e){return CustomReport[_0xd569[94]](_0x2131xf[_0xd569[106]],{transaction:_0x2131x2e})[_0xd569[20]](function(_0x2131x18){_0x2131x16= _0x2131x18;return [_0x2131x16,_0x2131xf[_0xd569[106]][_0xd569[109]]]})[_0xd569[31]](createFields(_0x2131x2e))})[_0xd569[20]](function(){return _0x2131x10[_0xd569[19]](201)[_0xd569[18]](_0x2131x16)})[_0xd569[17]](function(_0x2131x12){console[_0xd569[26]](_0x2131x12);return handleError(_0x2131x10,_0x2131x12)})};exports[_0xd569[110]]= function(_0x2131xf,_0x2131x10){var _0x2131x16;return sequelize[_0xd569[108]](function(_0x2131x2e){return CustomReport[_0xd569[94]](_0x2131xf[_0xd569[106]],{transaction:_0x2131x2e})[_0xd569[20]](function(_0x2131x18){_0x2131x16= _0x2131x18;return [_0x2131x16,_0x2131xf[_0xd569[106]][_0xd569[109]]]})[_0xd569[31]](createImportFields(_0x2131x2e))})[_0xd569[20]](function(){return _0x2131x10[_0xd569[19]](201)[_0xd569[18]](_0x2131x16)})[_0xd569[17]](function(_0x2131x12){console[_0xd569[26]](_0x2131x12);return handleError(_0x2131x10,_0x2131x12)})};exports[_0xd569[111]]= function(_0x2131xf,_0x2131x10,_0x2131x11){if(_0x2131xf[_0xd569[106]][_0xd569[47]]){delete _0x2131xf[_0xd569[106]][_0xd569[47]]};var _0x2131x16;return sequelize[_0xd569[108]](function(_0x2131x2e){return CustomReport[_0xd569[49]](_0x2131xf[_0xd569[48]][_0xd569[47]])[_0xd569[20]](function(_0x2131x18){if(!_0x2131x18){return _0x2131x10[_0xd569[35]](404)};var _0x2131x30=_[_0xd569[112]](_0x2131x18,_0x2131xf[_0xd569[106]]);return _0x2131x18[_0xd569[113]]({transaction:_0x2131x2e})})[_0xd569[20]](function(_0x2131x18){_0x2131x16= _0x2131x18;if(_0x2131xf[_0xd569[106]][_0xd569[109]]){return ReportField[_0xd569[74]]({where:{CustomReportId:_0x2131xf[_0xd569[48]][_0xd569[47]]},transaction:_0x2131x2e})}})[_0xd569[20]](function(){return [_0x2131x16,_0x2131xf[_0xd569[106]][_0xd569[109]]]})[_0xd569[31]](createFields(_0x2131x2e))})[_0xd569[20]](function(){return _0x2131x10[_0xd569[35]](200)})[_0xd569[17]](function(_0x2131x12){console[_0xd569[26]](_0x2131x12);return handleError(_0x2131x10,_0x2131x12)})};function createFields(_0x2131x2e){return function(_0x2131x18,_0x2131x32){if(_0x2131x32&& Array[_0xd569[53]](_0x2131x32)&& _0x2131x32[_0xd569[54]]){var _0x2131x33=reportBuildUtils[_0xd569[114]](_0x2131x18[_0xd569[42]]);if(_0x2131x33){var _0x2131x34;return _0x2131x33[_0xd569[127]]()[_0xd569[20]](function(_0x2131x39){_0x2131x34= _[_0xd569[125]](_0x2131x39);return Metric[_0xd569[126]]()})[_0xd569[20]](function(_0x2131x35){var _0x2131x36=[];_0x2131x35= _[_0xd569[107]](_0x2131x35,_0xd569[43]);_0x2131x32[_0xd569[62]](function(_0x2131x37){_0x2131x37[_0xd569[115]]= _0x2131x18[_0xd569[47]];if(_0x2131x37[_0xd569[116]]){var _0x2131x38=_[_0xd569[72]](_0x2131x35,{id:_0x2131x37[_0xd569[116]]});if(_0x2131x38){_0x2131x37[_0xd569[117]]= _0x2131x38[_0xd569[118]];_0x2131x36[_0xd569[75]](ReportField[_0xd569[94]](_0x2131x37,{transaction:_0x2131x2e}))}else {throw  new sequelize.Error(_0xd569[119]+ _0x2131x37[_0xd569[116]]+ _0xd569[120])}}else {if(_[_0xd569[121]](_0x2131x34,_0x2131x37[_0xd569[117]])|| _0x2131x37[_0xd569[122]]){_0x2131x36[_0xd569[75]](ReportField[_0xd569[94]](_0x2131x37,{transaction:_0x2131x2e}))}else {throw  new sequelize.Error(_0xd569[123]+ _0x2131x37[_0xd569[117]]+ _0xd569[124])}}});return _0x2131x36})[_0xd569[29]]()}else {throw  new sequelize.Error(_0xd569[128])}}}}function createImportFields(_0x2131x2e){return function(_0x2131x18,_0x2131x32){if(_0x2131x32&& Array[_0xd569[53]](_0x2131x32)&& _0x2131x32[_0xd569[54]]){var _0x2131x33=reportBuildUtils[_0xd569[114]](_0x2131x18[_0xd569[42]]);if(_0x2131x33){var _0x2131x34;return _0x2131x33[_0xd569[127]]()[_0xd569[20]](function(_0x2131x39){_0x2131x34= _[_0xd569[125]](_0x2131x39);var _0x2131x36=[];var _0x2131x3b;if(_[_0xd569[131]](_0x2131x32,function(_0x2131x37){return _[_0xd569[130]](_0x2131x37,_0xd569[129])})){_0x2131x3b= _0xd569[132]}else {if(_[_0xd569[131]](_0x2131x32,function(_0x2131x37){return _[_0xd569[130]](_0x2131x37,_0xd569[116])})){_0x2131x3b= _0xd569[7]}else {throw  new sequelize.Error(_0xd569[133])}};var _0x2131x3c=_[_0xd569[135]](_0x2131x32,_0x2131x3b+ _0xd569[134]);_[_0xd569[61]](_0x2131x3c,function(_0x2131x3d,_0x2131x1d){if(_0x2131x1d!== _0xd569[136]&& _0x2131x1d!== _0xd569[137]){_0x2131x3d[0][_0x2131x3b][_0xd569[138]][_0xd569[62]](function(_0x2131x37){_0x2131x37[_0xd569[115]]= _0x2131x18[_0xd569[47]]});_0x2131x3d[0][_0x2131x3b][_0xd569[88]]+= _0xd569[139]+ sr({length:5});_0x2131x36[_0xd569[75]](Metric[_0xd569[94]](_0x2131x3d[0][_0x2131x3b],{include:[{model:ReportField,as:_0xd569[138]}],transaction:_0x2131x2e}))}else {_0x2131x3d[_0xd569[62]](function(_0x2131x37){if(_[_0xd569[121]](_0x2131x34,_0x2131x37[_0xd569[117]])|| _0x2131x37[_0xd569[122]]){_0x2131x37[_0xd569[115]]= _0x2131x18[_0xd569[47]];_0x2131x36[_0xd569[75]](ReportField[_0xd569[94]](_0x2131x37,{transaction:_0x2131x2e}))}else {throw  new sequelize.Error(_0xd569[123]+ _0x2131x37[_0xd569[117]]+ _0xd569[124])}})}});return _0x2131x36})[_0xd569[29]]()}else {throw  new sequelize.Error(_0xd569[128])}}}}exports[_0xd569[74]]= function(_0x2131xf,_0x2131x10){return CustomReport[_0xd569[49]](_0x2131xf[_0xd569[48]][_0xd569[47]])[_0xd569[20]](function(_0x2131x18){if(!_0x2131x18){return _0x2131x10[_0xd569[35]](404)};return _0x2131x18[_0xd569[74]]()})[_0xd569[20]](function(){return _0x2131x10[_0xd569[35]](204)})[_0xd569[17]](function(_0x2131x12){return handleError(_0x2131x10,_0x2131x12)})};exports[_0xd569[140]]= function(_0x2131xf,_0x2131x10){return CustomReport[_0xd569[74]]({where:{id:_0x2131xf[_0xd569[21]][_0xd569[141]]},individualHooks:true})[_0xd569[20]](function(){return _0x2131x10[_0xd569[35]](204)})[_0xd569[17]](function(_0x2131x12){return handleError(_0x2131x10,_0x2131x12)})};function handleError(_0x2131x10,_0x2131x12){return _0x2131x10[_0xd569[19]](500)[_0xd569[18]](_0x2131x12)}
\ No newline at end of file
+var _0xc995=["\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"];_0xc995[0];var _=require(_0xc995[1]);var util=require(_0xc995[2]);var sequelize=require(_0xc995[4])[_0xc995[3]];var CustomReport=require(_0xc995[4])[_0xc995[5]];var ReportField=require(_0xc995[4])[_0xc995[6]];var Metric=require(_0xc995[4])[_0xc995[7]];var ExtractedReport=require(_0xc995[4])[_0xc995[8]];var extractUtils=require(_0xc995[9]);var reportBuildUtils=require(_0xc995[10]);var Util=require(_0xc995[11]);var sr=require(_0xc995[12]);var moment=require(_0xc995[13]);var cp=require(_0xc995[14]);var ReportTree=require(_0xc995[4])[_0xc995[15]];exports[_0xc995[16]]= function(_0x595exf,_0x595ex10,_0x595ex11){return CustomReport[_0xc995[23]](Util[_0xc995[22]](_0x595exf[_0xc995[21]],{deletedAt:null}))[_0xc995[20]](function(_0x595ex13){_0x595ex10[_0xc995[19]](200)[_0xc995[18]](_0x595ex13)})[_0xc995[17]](function(_0x595ex12){return handleError(_0x595ex10,_0x595ex12)})};exports[_0xc995[24]]= function(_0x595exf,_0x595ex10){return Promise[_0xc995[29]]([])[_0xc995[20]](getQuery(_0x595exf,_0x595ex10))[_0xc995[20]](function(_0x595ex14){if(_0x595ex14){switch(_0x595ex14){case _0xc995[28]:_0x595ex14= _0xc995[27];break;default:}};_0x595ex10[_0xc995[19]](200)[_0xc995[18]]({query:_0x595ex14})})[_0xc995[17]](function(_0x595ex12){console[_0xc995[26]](_0xc995[25],_0x595ex12)})};function getQuery(_0x595exf,_0x595ex10){var _0x595ex16;return function(){return CustomReport[_0xc995[51]](_0xc995[50])[_0xc995[49]](_0x595exf[_0xc995[48]][_0xc995[47]])[_0xc995[20]](function(_0x595ex18){console[_0xc995[26]](_0xc995[34]);if(!_0x595ex18){return _0x595ex10[_0xc995[35]](404)};if(_0x595exf[_0xc995[21]][_0xc995[36]]&& _0x595exf[_0xc995[21]][_0xc995[36]]=== _0xc995[37]){_0x595exf[_0xc995[21]][_0xc995[38]]= moment()[_0xc995[40]](_0xc995[39]);_0x595exf[_0xc995[21]][_0xc995[41]]= moment()[_0xc995[40]](_0xc995[39]);_0x595ex18[_0xc995[43]][_0xc995[42]]= _0x595ex18[_0xc995[43]][_0xc995[42]][_0xc995[46]](_0xc995[44],_0xc995[45])};delete _0x595exf[_0xc995[21]][_0xc995[36]];_0x595ex16= _0x595ex18[_0xc995[43]];return _0x595ex16[_0xc995[42]]})[_0xc995[20]](reportBuildUtils[_0xc995[33]](_0x595exf[_0xc995[32]]))[_0xc995[20]](function(_0x595ex17){return [_0x595ex17,_0x595ex16]})[_0xc995[31]](reportBuildUtils[_0xc995[30]](_0x595exf[_0xc995[21]]))}}exports[_0xc995[52]]= function(_0x595exf,_0x595ex10){var _0x595ex19;return Promise[_0xc995[29]]([])[_0xc995[20]](getQuery(_0x595exf,_0x595ex10))[_0xc995[20]](reportBuildUtils[_0xc995[64]]())[_0xc995[20]](function(_0x595ex1a){if(_0x595ex1a&& _[_0xc995[53]](_0x595ex1a)){_0x595ex19= _0x595ex1a[_0xc995[54]];if(_0x595exf[_0xc995[21]][_0xc995[55]]){_0x595ex1a= _(_0x595ex1a)[_0xc995[59]](_0x595exf[_0xc995[21]][_0xc995[58]]|| 0)[_0xc995[57]](_0x595exf[_0xc995[21]][_0xc995[55]])[_0xc995[56]]()};_[_0xc995[62]](_0x595ex1a,function(_0x595ex1b){_[_0xc995[61]](_0x595ex1b,function(_0x595ex1c,_0x595ex1d){if(_0x595ex1c instanceof  Date){_0x595ex1b[_0x595ex1d]= moment(_0x595ex1c)[_0xc995[40]](_0xc995[60]).toString()}})});_0x595ex10[_0xc995[19]](200)[_0xc995[18]]({rows:_0x595ex1a,count:_0x595ex19})}else {return handleError(_0x595ex10,{message:_0x595ex1a|| _0xc995[63]})}})[_0xc995[17]](function(_0x595ex12){console[_0xc995[26]](_0x595ex12);return handleError(_0x595ex10,_0x595ex12)})};exports[_0xc995[65]]= function(_0x595exf,_0x595ex10){docExtract(_0x595exf,_0x595ex10,_0xc995[66])};exports[_0xc995[67]]= function(_0x595exf,_0x595ex10){docExtract(_0x595exf,_0x595ex10,_0xc995[68])};exports[_0xc995[69]]= function(_0x595exf,_0x595ex10){return ReportTree[_0xc995[49]](2)[_0xc995[20]](function(_0x595ex1e){_0x595ex1e= JSON[_0xc995[71]](_0x595ex1e[_0xc995[70]]);var _0x595ex1f=_[_0xc995[72]](_0x595ex1e,{id:_0x595exf[_0xc995[48]][_0xc995[47]]});if(!_0x595ex1f){throw  new Error(_0xc995[73])};var _0x595ex20=[];findSubNodes(_0x595ex1f,_0x595ex1e,_0x595ex20);return CustomReport[_0xc995[74]]({where:{parent:_0x595ex20},individualHooks:true})})[_0xc995[20]](function(){return _0x595ex10[_0xc995[35]](200)})[_0xc995[17]](function(_0x595ex12){console[_0xc995[26]](_0x595ex12);return handleError(_0x595ex10,_0x595ex12)})};function findSubNodes(_0x595ex1f,_0x595ex1e,_0x595ex22){_0x595ex22[_0xc995[75]](_0x595ex1f[_0xc995[47]]);var _0x595ex23=_[_0xc995[76]](_0x595ex1e,{parent:_0x595ex1f[_0xc995[47]]});if(!_0x595ex23|| !_0x595ex23[_0xc995[54]]){return};_[_0xc995[62]](_0x595ex23,function(_0x595ex24){findSubNodes(_0x595ex24,_0x595ex1e,_0x595ex22)})}function docExtract(_0x595exf,_0x595ex10,_0x595ex26){var _0x595ex18;CustomReport[_0xc995[51]](_0xc995[50])[_0xc995[49]](_0x595exf[_0xc995[48]][_0xc995[47]])[_0xc995[20]](function(_0x595ex16){if(!_0x595ex16){return _0x595ex10[_0xc995[35]](404)};_0x595ex18= _0x595ex16;return ReportTree[_0xc995[49]](2)})[_0xc995[20]](function(_0x595ex1e){_0x595ex1e= JSON[_0xc995[71]](_0x595ex1e[_0xc995[70]]);var _0x595ex2a=_[_0xc995[72]](_0x595ex1e,{id:_0x595ex18[_0xc995[87]]});var _0x595ex2b=getReportPath(_0x595ex2a,_0x595ex1e,_0x595ex18[_0xc995[88]]);if(_0x595exf[_0xc995[21]][_0xc995[36]]&& _0x595exf[_0xc995[21]][_0xc995[36]]=== _0xc995[37]){_0x595exf[_0xc995[21]][_0xc995[38]]= moment()[_0xc995[40]](_0xc995[39]);_0x595exf[_0xc995[21]][_0xc995[41]]= moment()[_0xc995[40]](_0xc995[39]);_0x595ex18[_0xc995[43]][_0xc995[42]]= _0x595ex18[_0xc995[43]][_0xc995[42]][_0xc995[46]](_0xc995[44],_0xc995[45])};delete _0x595exf[_0xc995[21]][_0xc995[36]];return [_0x595ex18,ExtractedReport[_0xc995[94]]({name:_0x595ex2b,startDate:_0x595exf[_0xc995[21]][_0xc995[38]]?_0x595exf[_0xc995[21]][_0xc995[38]]+ (_0x595exf[_0xc995[21]][_0xc995[89]]?_0xc995[90]+ _0x595exf[_0xc995[21]][_0xc995[89]]:_0xc995[91]):null,endDate:_0x595exf[_0xc995[21]][_0xc995[41]]?_0x595exf[_0xc995[21]][_0xc995[41]]+ (_0x595exf[_0xc995[21]][_0xc995[92]]?_0xc995[90]+ _0x595exf[_0xc995[21]][_0xc995[92]]:_0xc995[93]):null,output:_0x595ex26,UserId:_0x595exf[_0xc995[32]][_0xc995[47]]})]})[_0xc995[31]](function(_0x595ex18,_0x595ex27){var _0x595ex28=cp[_0xc995[78]](__dirname+ _0xc995[77]);_0x595ex28[_0xc995[81]](_0xc995[84],function(_0x595ex29){console[_0xc995[26]](_0xc995[85],_0x595ex29);_0x595ex28[_0xc995[86]]()})[_0xc995[81]](_0xc995[82],function(){console[_0xc995[26]](_0xc995[83])})[_0xc995[81]](_0xc995[79],function(_0x595ex12){console[_0xc995[26]](_0xc995[80],_0x595ex12)});_0x595ex28[_0xc995[18]]({report:_0x595ex18,query:_0x595exf[_0xc995[21]],extractedId:_0x595ex27[_0xc995[47]],user:_0x595exf[_0xc995[32]],type:_0x595ex26})})[_0xc995[17]](function(_0x595ex12){console[_0xc995[26]](_0x595ex12);return handleError(_0x595ex10,_0x595ex12)});return _0x595ex10[_0xc995[35]](200)}function getReportPath(_0x595ex2a,_0x595ex1e,_0x595ex2b){_0x595ex2b= _0x595ex2a[_0xc995[95]]+ _0xc995[96]+ _0x595ex2b;if(_0x595ex2a[_0xc995[87]]=== _0xc995[97]){return _0x595ex2b}else {return getReportPath(_[_0xc995[72]](_0x595ex1e,{id:_0x595ex2a[_0xc995[87]]}),_0x595ex1e,_0x595ex2b)}}exports[_0xc995[98]]= function(_0x595exf,_0x595ex10){return CustomReport[_0xc995[51]](_0xc995[50])[_0xc995[49]](_0x595exf[_0xc995[48]][_0xc995[47]])[_0xc995[20]](function(_0x595ex18){if(!_0x595ex18){return _0x595ex10[_0xc995[35]](404)};return _0x595ex10[_0xc995[18]](_0x595ex18)})[_0xc995[17]](function(_0x595ex12){return handleError(_0x595ex10,_0x595ex12)})};exports[_0xc995[99]]= function(_0x595exf,_0x595ex10){return CustomReport[_0xc995[51]]({method:[_0xc995[102],{CustomReportId:_0x595exf[_0xc995[48]][_0xc995[47]]}]})[_0xc995[49]](_0x595exf[_0xc995[48]][_0xc995[47]],{attributes:[_0xc995[100],_0xc995[101],_0xc995[88],_0xc995[87],_0xc995[42]]})[_0xc995[20]](function(_0x595ex18){if(!_0x595ex18){return _0x595ex10[_0xc995[35]](404)};return _0x595ex10[_0xc995[18]](_0x595ex18)})[_0xc995[17]](function(_0x595ex12){return handleError(_0x595ex10,_0x595ex12)})};exports[_0xc995[103]]= function(_0x595exf,_0x595ex10){var _0x595ex2d;return sequelize[_0xc995[108]](function(_0x595ex2e){return CustomReport[_0xc995[51]](_0xc995[50])[_0xc995[49]](_0x595exf[_0xc995[48]][_0xc995[47]])[_0xc995[20]](function(_0x595ex18){if(!_0x595ex18){return _0x595ex10[_0xc995[35]](404)};var _0x595ex2f=_0x595ex18[_0xc995[43]];delete _0x595ex2f[_0xc995[47]];delete _0x595ex2f[_0xc995[104]];delete _0x595ex2f[_0xc995[105]];_0x595ex2f[_0xc995[87]]= _0x595exf[_0xc995[106]][_0xc995[87]];_0x595ex2d= _[_0xc995[107]](_0x595ex2f.Fields,_0xc995[43]);return CustomReport[_0xc995[94]](_0x595ex2f,{transaction:_0x595ex2e})})[_0xc995[20]](function(_0x595ex18){return [_0x595ex18,_0x595ex2d]})[_0xc995[31]](createFields(_0x595ex2e))})[_0xc995[20]](function(){return _0x595ex10[_0xc995[35]](201)})[_0xc995[17]](function(_0x595ex12){console[_0xc995[26]](_0x595ex12);return handleError(_0x595ex10,_0x595ex12)})};exports[_0xc995[94]]= function(_0x595exf,_0x595ex10){var _0x595ex16;return sequelize[_0xc995[108]](function(_0x595ex2e){return CustomReport[_0xc995[94]](_0x595exf[_0xc995[106]],{transaction:_0x595ex2e})[_0xc995[20]](function(_0x595ex18){_0x595ex16= _0x595ex18;return [_0x595ex16,_0x595exf[_0xc995[106]][_0xc995[109]]]})[_0xc995[31]](createFields(_0x595ex2e))})[_0xc995[20]](function(){return _0x595ex10[_0xc995[19]](201)[_0xc995[18]](_0x595ex16)})[_0xc995[17]](function(_0x595ex12){console[_0xc995[26]](_0x595ex12);return handleError(_0x595ex10,_0x595ex12)})};exports[_0xc995[110]]= function(_0x595exf,_0x595ex10){var _0x595ex16;return sequelize[_0xc995[108]](function(_0x595ex2e){return CustomReport[_0xc995[94]](_0x595exf[_0xc995[106]],{transaction:_0x595ex2e})[_0xc995[20]](function(_0x595ex18){_0x595ex16= _0x595ex18;return [_0x595ex16,_0x595exf[_0xc995[106]][_0xc995[109]]]})[_0xc995[31]](createImportFields(_0x595ex2e))})[_0xc995[20]](function(){return _0x595ex10[_0xc995[19]](201)[_0xc995[18]](_0x595ex16)})[_0xc995[17]](function(_0x595ex12){console[_0xc995[26]](_0x595ex12);return handleError(_0x595ex10,_0x595ex12)})};exports[_0xc995[111]]= function(_0x595exf,_0x595ex10,_0x595ex11){if(_0x595exf[_0xc995[106]][_0xc995[47]]){delete _0x595exf[_0xc995[106]][_0xc995[47]]};var _0x595ex16;return sequelize[_0xc995[108]](function(_0x595ex2e){return CustomReport[_0xc995[49]](_0x595exf[_0xc995[48]][_0xc995[47]])[_0xc995[20]](function(_0x595ex18){if(!_0x595ex18){return _0x595ex10[_0xc995[35]](404)};var _0x595ex30=_[_0xc995[112]](_0x595ex18,_0x595exf[_0xc995[106]]);return _0x595ex18[_0xc995[113]]({transaction:_0x595ex2e})})[_0xc995[20]](function(_0x595ex18){_0x595ex16= _0x595ex18;if(_0x595exf[_0xc995[106]][_0xc995[109]]){return ReportField[_0xc995[74]]({where:{CustomReportId:_0x595exf[_0xc995[48]][_0xc995[47]]},transaction:_0x595ex2e})}})[_0xc995[20]](function(){return [_0x595ex16,_0x595exf[_0xc995[106]][_0xc995[109]]]})[_0xc995[31]](createFields(_0x595ex2e))})[_0xc995[20]](function(){return _0x595ex10[_0xc995[35]](200)})[_0xc995[17]](function(_0x595ex12){console[_0xc995[26]](_0x595ex12);return handleError(_0x595ex10,_0x595ex12)})};function createFields(_0x595ex2e){return function(_0x595ex18,_0x595ex32){if(_0x595ex32&& Array[_0xc995[53]](_0x595ex32)&& _0x595ex32[_0xc995[54]]){var _0x595ex33=reportBuildUtils[_0xc995[114]](_0x595ex18[_0xc995[42]]);if(_0x595ex33){var _0x595ex34;return _0x595ex33[_0xc995[127]]()[_0xc995[20]](function(_0x595ex39){_0x595ex34= _[_0xc995[125]](_0x595ex39);return Metric[_0xc995[126]]()})[_0xc995[20]](function(_0x595ex35){var _0x595ex36=[];_0x595ex35= _[_0xc995[107]](_0x595ex35,_0xc995[43]);_0x595ex32[_0xc995[62]](function(_0x595ex37){_0x595ex37[_0xc995[115]]= _0x595ex18[_0xc995[47]];if(_0x595ex37[_0xc995[116]]){var _0x595ex38=_[_0xc995[72]](_0x595ex35,{id:_0x595ex37[_0xc995[116]]});if(_0x595ex38){_0x595ex37[_0xc995[117]]= _0x595ex38[_0xc995[118]];_0x595ex36[_0xc995[75]](ReportField[_0xc995[94]](_0x595ex37,{transaction:_0x595ex2e}))}else {throw  new sequelize.Error(_0xc995[119]+ _0x595ex37[_0xc995[116]]+ _0xc995[120])}}else {if(_[_0xc995[121]](_0x595ex34,_0x595ex37[_0xc995[117]])|| _0x595ex37[_0xc995[122]]){_0x595ex36[_0xc995[75]](ReportField[_0xc995[94]](_0x595ex37,{transaction:_0x595ex2e}))}else {throw  new sequelize.Error(_0xc995[123]+ _0x595ex37[_0xc995[117]]+ _0xc995[124])}}});return _0x595ex36})[_0xc995[29]]()}else {throw  new sequelize.Error(_0xc995[128])}}}}function createImportFields(_0x595ex2e){return function(_0x595ex18,_0x595ex32){if(_0x595ex32&& Array[_0xc995[53]](_0x595ex32)&& _0x595ex32[_0xc995[54]]){var _0x595ex33=reportBuildUtils[_0xc995[114]](_0x595ex18[_0xc995[42]]);if(_0x595ex33){var _0x595ex34;return _0x595ex33[_0xc995[127]]()[_0xc995[20]](function(_0x595ex39){_0x595ex34= _[_0xc995[125]](_0x595ex39);var _0x595ex36=[];var _0x595ex3b;if(_[_0xc995[131]](_0x595ex32,function(_0x595ex37){return _[_0xc995[130]](_0x595ex37,_0xc995[129])})){_0x595ex3b= _0xc995[132]}else {if(_[_0xc995[131]](_0x595ex32,function(_0x595ex37){return _[_0xc995[130]](_0x595ex37,_0xc995[116])})){_0x595ex3b= _0xc995[7]}else {throw  new sequelize.Error(_0xc995[133])}};var _0x595ex3c=_[_0xc995[135]](_0x595ex32,_0x595ex3b+ _0xc995[134]);_[_0xc995[61]](_0x595ex3c,function(_0x595ex3d,_0x595ex1d){if(_0x595ex1d!== _0xc995[136]&& _0x595ex1d!== _0xc995[137]){_0x595ex3d[0][_0x595ex3b][_0xc995[138]][_0xc995[62]](function(_0x595ex37){_0x595ex37[_0xc995[115]]= _0x595ex18[_0xc995[47]]});_0x595ex3d[0][_0x595ex3b][_0xc995[88]]+= _0xc995[139]+ sr({length:5});_0x595ex36[_0xc995[75]](Metric[_0xc995[94]](_0x595ex3d[0][_0x595ex3b],{include:[{model:ReportField,as:_0xc995[138]}],transaction:_0x595ex2e}))}else {_0x595ex3d[_0xc995[62]](function(_0x595ex37){if(_[_0xc995[121]](_0x595ex34,_0x595ex37[_0xc995[117]])|| _0x595ex37[_0xc995[122]]){_0x595ex37[_0xc995[115]]= _0x595ex18[_0xc995[47]];_0x595ex36[_0xc995[75]](ReportField[_0xc995[94]](_0x595ex37,{transaction:_0x595ex2e}))}else {throw  new sequelize.Error(_0xc995[123]+ _0x595ex37[_0xc995[117]]+ _0xc995[124])}})}});return _0x595ex36})[_0xc995[29]]()}else {throw  new sequelize.Error(_0xc995[128])}}}}exports[_0xc995[74]]= function(_0x595exf,_0x595ex10){return CustomReport[_0xc995[49]](_0x595exf[_0xc995[48]][_0xc995[47]])[_0xc995[20]](function(_0x595ex18){if(!_0x595ex18){return _0x595ex10[_0xc995[35]](404)};return _0x595ex18[_0xc995[74]]()})[_0xc995[20]](function(){return _0x595ex10[_0xc995[35]](204)})[_0xc995[17]](function(_0x595ex12){return handleError(_0x595ex10,_0x595ex12)})};exports[_0xc995[140]]= function(_0x595exf,_0x595ex10){return CustomReport[_0xc995[74]]({where:{id:_0x595exf[_0xc995[21]][_0xc995[141]]},individualHooks:true})[_0xc995[20]](function(){return _0x595ex10[_0xc995[35]](204)})[_0xc995[17]](function(_0x595ex12){return handleError(_0x595ex10,_0x595ex12)})};function handleError(_0x595ex10,_0x595ex12){return _0x595ex10[_0xc995[19]](500)[_0xc995[18]](_0x595ex12)}
\ No newline at end of file