/* 领京豆签到 cron:15 0,16 * * * */ const $ = new Env('领京豆签到') var iil='jsjiami.com.v7';const i11I1l=iii1II;function Iii11l(){const liIl1=(function(){return[...[iil,'rjtsEhjpiPfamYiyy.DncIoTm.xv7wCLVYEYOQIT==','5RwO5yIU5yw75y+b772aWP7cLmkG6As76AgqF+s4UUs7VoEKHoAEGSoI56+55yIxW4K','WOTzA8k4W4joCSopWPS','rMGWyGy','8kABKqy','W59zaa90','AIbUwIpcKJC','W7ZcLSoL','WRROR4hMS4BLKQVLUjhcGa','gfRcOJykW67cJexdNXW','hsNdLmoRW4mzW6iz','x27cHCklWP9BWRLeW7aFWPjaW4qVWR7dLhtdJSo5lgzse2xcTWVdGSkgEMXgyXRcLmkYbW','pSkJq8o7CWzzvtdcGCkAWQpdGW','xgNcHCkgWPLuWRyqWQvTWOLXW48','xmo0rr91ASo8bmkHW5BcTCoMDtTyWPWwF8oagCkBW5WeW4HViSkgySk/a2quWOTeWOpdT1xcR1ddISoqFgJcIqesW6bwW4CmjSoMvqVdUHTIfgNdJcOsiwpcO8odWQ0uw8o8Dsjazx1/W5pcRaxcHL1RsCkupCkKxCo1WRxcQmofuw5njSo2WRZdT37cNSoEWQpcJv0zsxRdGNhcPmkPWOHbW7CszCk8WOlcS0ZdUCkQW6vZFvO0W5y/WRvUWR0IWRjrW4aFsSkhW5NdQCoEW4fWlmoXW6xcTNyxW5BcRKGhfCkYW5NcHvVdUXyTW6bupqhcN8kMW5TGpaddOSo1jI9bWORdGmk4W7n9WP5aW6e6WRGuEwdcOmoAd8oXrYdcNZ1qv8oPiCkSjJW5W5VcVCkBWOX1BmoZtmkRzvSLsCoFtWXyeKdcPeH5W4xdIhNdRcFdQwS7mczYWPCxWQZcUmorW4fuW4mhWO/cV8kbWQvEWQtdMZXlcSokfXjmW6e0W4FdMCknWO0fW7fCAhuWjCkZpYG+WORdTmkDuKDsmmoZoCooW5aOCCk2d8oXDJ0IfCk0WOHpCMOceNbrWR3dICkxWReJWOZdJqvlWPfbWPNcGmkQWPVdOXPaW7BdGCkMWQTqWQfUECo0W418FmoNEZS0W73dKdf3W6rHW6tcLSkexCkrWOhcSSojkCkhq8k1W608dJ84W5flW53cJCkbp8oKWOHTeZ9Xh8oCwGTAWR7cV8oOW5O0g3vIx8k/WOxdI0tdVX9RaaDwiCkXWR0ItvpdGmotWQBcUCkoE1CSESkFtYbNW7pcLmkyj8kajmoKmCohW5ytWOz5W61VfCkLW7hdJSkyW6XjkqGPW6ZcVmoYna3cOSkgWO9jEYVdPCkNDSoyWQXwW5pcICkiWRKFW6XZfSo9W60LWRfgWQ8rWPL1W6pcJWmSbeBcRdqUWO3dUhpcPvy7W4jrk2xcGu3cUKJdGYtcNmk4W57dRIdcVmomvmkpjmkQWQz5WQLhW4NcP8oubXBdQhjQW7NdPIpcGaqiBSoupMBdTSkbDq','t3WvaMTuFHtdOH1EW57dPq','W5O4W5RcHIKpghtcMw1oW6FdNG','WRJcV2O/EG','DGTpf8kZtHZdPW','fmo/W5CEW7BcSYBdV8kb','xCkzWOuum8k5w0BdHq','CCoPz8oMucyNemovWRKjWPBcNW','8yAPGgi','zmoXwsPQ','idldGSoEW6e','vapcKIRdT8kYhW','msvZEXa','4P6RW4VMNAJOGBVMROlNO5hLPlFNKOddSa','o2/cGdtcLq','cbvb','hcHxDdCmlqVdJYPSW7pdLZi','k8k7omk7','FCobhCkPfa','56Yj5yMq5AAB6lEvW4y','pgmgmCkM','WR3dLLZdVx/dUq','WO3dP3RdGSk9Bd4','WR8PW4a','jCk0zCouy8ofkLtdVHtcVgJcKW','wbtcPtC','566q5yI55AED6lAwnG','WO95WOxcNxCwsMBdV29YW4S','zSoXaSkEnfCtrZlcI8k9WPu','gW3dMSorW7K','WRpcUdBdG8kd','fYje','aWNdNSkCWO8','gGxdMCkdWOSVta','WQb4EMXKAKr9lZNdU28','dXJcLCoeW5JdIhK','crJcG8o1W47dN3JcI3T5WP7cGW','cmkSW6S','uvGl','WQJdVarD'],...(function(){return[...['lJ5grryckWC','W4OwW4xdJCoG','W5r5k8o9','eNNcPYVdRmoTW6e','qaVcKI/dTmkZ','u0Wl','WQtdG8kCW4VcSq0','e8kIW6xcUG','eCo2umkdfW','FSoVmSkika','W7LzW6OsW6ZdJKf7W5ToWRjkAmkdW7m','cINdT1vy','W75xW7ah','kfJdMG','FWdcMJyd','W5vdW5NcPG','WOjMWOS','ySk2lHzTW6FdTmkHW7DwgmouWQ0','pmoUsmk+','amkIW7JcRW','W4LrpCoqW6a','iL7dHq','tvycW7RcMZi','fcldVCkZWQG','WQXSqf9V','k0viC8oyaMBdP2pcQmkqW59fW4lcUdWnyrRdRw7cRLBdVwtcSG','WRmbW6ipffSgWR9yANFcK8o8WRJdUhSUfmkJW4XUWRCtWPpcMcLUC8oQnmkAqSk9WRe','WQyNW4hcHbuEhSo9iYG','u1ahBq','EUIVHEAXR+wtJow4UfS','ac7dSxXgWRVdKq','eXtcGmomW5G','WPb5BxfyrKXR','CSoZjmkciSkXD0VdOtFcSuS','WPTNWP/dLM57t23cUMv4','WRKAW7ig','W591W4udW4O','6zY36kAW5P2F5zY8gaxNJjNLORFVVyVLK5tLIQ7KUyZKV5dLRi7MIPtKUztLI5etWRr7WPq','W4JcPSotBN/cR2z4','W7m4W6ldJSoJWOKAW5qOWPCUW6C','jmoRu2ao','WP0aW6W4cW','W7ykW5ldI8ou','W7j5vW','ex3cPWi','uw8JqSkmBW','CCo1e8kyka','W6lcRu81W51vWOtcRL4FsSkZW7NcRKFcNSk0','lZJdR8k0WR8','qr/cNYJdVSkTfq','WQpdHLZdN2xdTq','AsbQFdhcKcaYWRmAWQxcHa','WRpcKI3dHCkB','WP3dGsvMW4JdQSk7W7HG','fIHqrdKeiW'],...(function(){return['xr/cIa3dT8k/aq','cSkMW7VcMX/dHhlcPhX/W53dQG','yb7dL8oqvIBdMSkwWPhcQ8oIW4aCECkIWRJdRZZcGrZdHmoGW4rCWRrkW6u','W5hcSJNcHCoRm2VdQt4qrsjY','E8oUmq','a8kMW7JcGGpdHMNcI1HQW47dUKz7','wHRcRW','vKGwDsaYj8kIW7ZdGW','WOJdHWH5W5pdHW','pSoND0W','WPlcVMaUz0tcVKXZE8o1ga','qgeJqmkkzq','kvTkB8oUhNldOe3cU8kf','cJ3dGSoE','W5fYaJnz','cZHqxW','rXLEba','xwVcGCkkW4WlW7K5WOrF','rc5tqby','4P6AzUAEMEIaMoASM+EGG+wLNUEsMNC','d0fiC8oIgN7dQW','WR3cVMK','w8kMWR0cmG','ctNdGSoZW4SzW6SpWR1UWPnhW7C4WRJdNMJdImo4','4P2eWRtOHA/MN6FOVPFOOB7PGkBLIlBKU4pPL7pORkddUW','uHtcVdm','x8oHgCkFaq','p8oJCeuUWRC','vGVcIcO','WQiVW4FcIr0','WQr9AxfYA0H9ka','WQSfWRrqWRFcMhTBW41sWQTC','WQz7WP0','D8oOzCoSm0rJl8oSWPq','WR7cMWRdV8kj','FUIVLEAWKowLPUI3UvNINj5e5PE15zoN5BQs5Psy5O6l','WRRdLKVdQq','lftdG8okFcxdNmoxWRC','vMe5rq','jmoND1y','WPaCWQ5mWQ/cIH7LVjlLPAtJGkFKUz/KUkhOTk/LJiy','eCotWPeogCk6xqFdO8kNW60KWRWdWQmx','WOT7WP7dNgH7t2BcTa','W4qJW4BcMtaskG','WROHW4BcQba','W640W7ldTCo1WOG3W6i3W4mdW6RcVCo6W50','W53cUSoDtNpcQq','FCoRrq1P','DCoUoCkbnCkDFa','c8oEw2yp','WONdRg3dLmkK','W5tcStVcICoRpMNdSI83xHn0'];}())];}())];}());Iii11l=function(){return liIl1;};return Iii11l();};(function(illIl1,l1llII,IilIll,lI11Ii,Iiill,l11i1i,lI11I1){return illIl1=illIl1>>0x4,l11i1i='hs',lI11I1='hs',function(l1il11,IiI1,liI,illIli,l11i1l){const IllI1i=iii1II;illIli='tfi',l11i1i=illIli+l11i1i,l11i1l='up',lI11I1+=l11i1l,l11i1i=liI(l11i1i),lI11I1=liI(lI11I1),liI=0x0;const lIII11=l1il11();while(!![]&&--lI11Ii+IiI1){try{illIli=parseInt(IllI1i(0xe1,')]T%'))/0x1+parseInt(IllI1i(0x13c,'QmWb'))/0x2+parseInt(IllI1i(0x11b,']]fq'))/0x3+parseInt(IllI1i(0x10a,'gOzq'))/0x4+parseInt(IllI1i(0x173,'G]i8'))/0x5*(-parseInt(IllI1i(0xe3,'gOzq'))/0x6)+-parseInt(IllI1i(0x104,'cK7('))/0x7+-parseInt(IllI1i(0x101,']Sio'))/0x8;}catch(IiilI){illIli=liI;}finally{l11i1l=lIII11[l11i1i]();if(illIl1<=lI11Ii)liI?Iiill?illIli=l11i1l:Iiill=l11i1l:liI=l11i1l;else{if(liI==Iiill['replace'](/[CyVTYhLIDEnpfwtQxrOP=]/g,'')){if(illIli===IiI1){lIII11['un'+l11i1i](l11i1l);break;}lIII11[lI11I1](l11i1l);}}}}}(IilIll,l1llII,function(ii1I11,liIi1,lI11II,l1llI1,llIIll,IillIi,lii){return liIi1='\x73\x70\x6c\x69\x74',ii1I11=arguments[0x0],ii1I11=ii1I11[liIi1](''),lI11II=`\x72\x65\x76\x65\x72\x73\x65`,ii1I11=ii1I11[lI11II]('\x76'),l1llI1=`\x6a\x6f\x69\x6e`,(0x16c240,ii1I11[l1llI1](''));});}(0xc30,0xce2bd,Iii11l,0xc5),Iii11l)&&(iil=0x7f6);function iii1II(_0x7ed783,_0xf14d10){const _0xcf4baf=Iii11l();return iii1II=function(_0x290465,_0x45587b){_0x290465=_0x290465-0xdf;let _0x12f565=_0xcf4baf[_0x290465];if(iii1II['RPEHmU']===undefined){var _0x1fa483=function(_0x4ed8df){const _0x20f342='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2d16a0='',_0x26b93b='';for(let _0x3b7e6f=0x0,_0x29f68b,_0x53b9b4,_0x1eba7b=0x0;_0x53b9b4=_0x4ed8df['charAt'](_0x1eba7b++);~_0x53b9b4&&(_0x29f68b=_0x3b7e6f%0x4?_0x29f68b*0x40+_0x53b9b4:_0x53b9b4,_0x3b7e6f++%0x4)?_0x2d16a0+=String['fromCharCode'](0xff&_0x29f68b>>(-0x2*_0x3b7e6f&0x6)):0x0){_0x53b9b4=_0x20f342['indexOf'](_0x53b9b4);}for(let _0x404b79=0x0,_0x32a1c8=_0x2d16a0['length'];_0x404b79<_0x32a1c8;_0x404b79++){_0x26b93b+='%'+('00'+_0x2d16a0['charCodeAt'](_0x404b79)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x26b93b);};const _0x4b2b28=function(_0x542163,_0xa18dc8){let _0x364d8f=[],_0x2aba63=0x0,_0x51d946,_0x20dc9f='';_0x542163=_0x1fa483(_0x542163);let _0x322ddb;for(_0x322ddb=0x0;_0x322ddb<0x100;_0x322ddb++){_0x364d8f[_0x322ddb]=_0x322ddb;}for(_0x322ddb=0x0;_0x322ddb<0x100;_0x322ddb++){_0x2aba63=(_0x2aba63+_0x364d8f[_0x322ddb]+_0xa18dc8['charCodeAt'](_0x322ddb%_0xa18dc8['length']))%0x100,_0x51d946=_0x364d8f[_0x322ddb],_0x364d8f[_0x322ddb]=_0x364d8f[_0x2aba63],_0x364d8f[_0x2aba63]=_0x51d946;}_0x322ddb=0x0,_0x2aba63=0x0;for(let _0x466ba2=0x0;_0x466ba2<_0x542163['length'];_0x466ba2++){_0x322ddb=(_0x322ddb+0x1)%0x100,_0x2aba63=(_0x2aba63+_0x364d8f[_0x322ddb])%0x100,_0x51d946=_0x364d8f[_0x322ddb],_0x364d8f[_0x322ddb]=_0x364d8f[_0x2aba63],_0x364d8f[_0x2aba63]=_0x51d946,_0x20dc9f+=String['fromCharCode'](_0x542163['charCodeAt'](_0x466ba2)^_0x364d8f[(_0x364d8f[_0x322ddb]+_0x364d8f[_0x2aba63])%0x100]);}return _0x20dc9f;};iii1II['aQJqXn']=_0x4b2b28,_0x7ed783=arguments,iii1II['RPEHmU']=!![];}const _0xd130f4=_0xcf4baf[0x0],_0x3130d2=_0x290465+_0xd130f4,_0x32d75d=_0x7ed783[_0x3130d2];return!_0x32d75d?(iii1II['rmJAwl']===undefined&&(iii1II['rmJAwl']=!![]),_0x12f565=iii1II['aQJqXn'](_0x12f565,_0x45587b),_0x7ed783[_0x3130d2]=_0x12f565):_0x12f565=_0x32d75d,_0x12f565;},iii1II(_0x7ed783,_0xf14d10);}const jdCookie=require(i11I1l(0xfe,']lp5')),notify=require(i11I1l(0x164,'szMv')),common=require('./utils/Rebels_jdCommon'),{H5st}=require(i11I1l(0xeb,'TsAG')),isNotify=![];let uuid=randomString(0x28,i11I1l(0x100,'G]i8')),cookie='';const cookiesArr=Object[i11I1l(0xe6,'xa^X')](jdCookie)['map'](lliiii=>jdCookie[lliiii])[i11I1l(0xf0,'ujeT')](IliI1i=>IliI1i);!cookiesArr[0x0]&&($[i11I1l(0xe2,'wp0u')]($[i11I1l(0x11c,']lp5')],'【提示】请先获取Cookie'),process[i11I1l(0x13a,'CIFO')](0x1));!(async()=>{const lil=i11I1l,ll1ii={'NntaK':function(IIli11,IllIII){return IIli11*IllIII;},'PqhEl':function(ii1li,IIll1){return ii1li(IIll1);},'WKPVp':lil(0x16a,'OZ)1'),'ECAeO':function(ll1il){return ll1il();},'DzvUU':lil(0x178,'TsAG')};console[lil(0x166,']]fq')](lil(0xf6,'QmWb')),console[lil(0x112,'#fO4')](lil(0x150,'e$O#')),notify[lil(0x158,'gLRa')]({'title':$[lil(0x114,'gOzq')]});for(let IiiIiI=0x0;IiiIiI$['logErr'](Illl1I))[i11I1l(0x10e,'59C4')](()=>$[i11I1l(0x13d,'#YEj')]());async function Main(){const IllI1l=i11I1l,lliiiI={'CkNiT':IllI1l(0xf2,']]fq'),'XVNBD':IllI1l(0x139,']lp5')},lilil=await common[IllI1l(0x167,'e1hv')](cookie);if(!lilil&&typeof lilil===lliiiI[IllI1l(0x174,'n@m4')]){if(lliiiI['XVNBD']==='kECrY')i1l1l1[IllI1l(0x140,'szMv')](IllI1l(0x17a,']Sio')+IlI1I);else{console[IllI1l(0x130,'L)h!')]('账号无效');return;}}try{await sendRequest(IllI1l(0x16b,'QmWb'));}catch(Illl11){console[IllI1l(0x177,'k&%R')]('❌\x20脚本运行遇到了错误\x0a'+Illl11);}}async function handleResponse(ii1lI,I1ilIl){const i11I1i=i11I1l,I11iII={'FuzGl':i11I1i(0x15b,'72]k'),'KuMAL':function(I1ilIi,IiiiI){return I1ilIi===IiiiI;},'Iktbo':i11I1i(0xf8,'e$O#')};try{if(i11I1i(0xf3,'QmWb')!==I11iII[i11I1i(0x154,'WDgG')])I1iIll[i11I1i(0xfb,'n@m4')][i11I1i(0x138,'szMv')](I1lliI);else switch(ii1lI){case'main':if(I1ilIl['code']==0x0&&!I1ilIl?.[i11I1i(0x160,'OZ)1')]){if(I1ilIl?.[i11I1i(0x157,'S@ez')]?.['newUserAward'])console['log'](''+(I1ilIl?.[i11I1i(0x17b,']lp5')]?.[i11I1i(0x15e,'n@m4')]?.[i11I1i(0x123,'72]k')]||'')+(I1ilIl?.['data']?.[i11I1i(0x152,'44kS')]?.[i11I1i(0x151,'ujeT')]||'')+I1ilIl?.[i11I1i(0x17e,'59C4')]?.[i11I1i(0x163,'e1hv')]?.[i11I1i(0xe0,'rn8G')][0x1]?.[i11I1i(0xf7,'q6e]')]+'京豆');else{let llIlll=I1ilIl?.[i11I1i(0x12d,'H@1[')]?.['dailyAward']||I1ilIl?.[i11I1i(0x172,'fyLs')]?.[i11I1i(0x135,')]T%')]||I1ilIl?.[i11I1i(0x16f,'G]i8')]?.[i11I1i(0x127,'Bu]Q')];console[i11I1i(0x128,'e1hv')](''+(llIlll?.[i11I1i(0x14a,'Bu]Q')]||'')+(llIlll?.['subTitle']||'')+llIlll?.[i11I1i(0x108,'Gx1c')]?.[i11I1i(0xe7,'szMv')]+'京豆');}}else I1ilIl['code']==0x3?console['log'](i11I1i(0x116,'72]k')+I1ilIl?.[i11I1i(0x125,'rn8G')]):console[i11I1i(0x13b,'&a3M')](i11I1i(0x11d,'&a3M')+I1ilIl?.[i11I1i(0xec,'&a3M')]+':'+I1ilIl?.[i11I1i(0x14c,']]fq')]);break;}}catch(lliii1){I11iII['KuMAL'](I11iII[i11I1i(0xf1,'Xa5B')],i11I1i(0xe4,'7aY4'))?iliIIi['log'](i11I1i(0x110,'7aY4')+ill11I+i11I1i(0xfd,')]T%')+(Iliiil[i11I1i(0x161,'cK7(')]||li1Il)):console[i11I1i(0x122,'cK7(')](i11I1i(0x175,'J0mi')+ii1lI+i11I1i(0x148,')t*g')+(lliii1[i11I1i(0x124,'72]k')]||lliii1));}}async function sendRequest(lIIili){const IillIl=i11I1l,IiiIil={'UVKLt':function(I11iIl,l1l11l){return I11iIl*l1l11l;},'WulTF':IillIl(0x11a,'J0mi'),'ftEux':'4.7','cBWCB':'zh-Hans-CN;q=1','wmMBT':IillIl(0x15a,'AVGk'),'JQtix':function(IilIil,l1iIi){return IilIil===l1iIi;},'uUhbS':IillIl(0xfc,'ujeT'),'IwvXV':IillIl(0x16c,'k&%R'),'pGbnz':IillIl(0x111,'S@ez'),'uJRuJ':IillIl(0x117,'VBiK'),'ZUoiG':function(l1l11i,l1iIl){return l1l11i>l1iIl;},'GpmNQ':function(illIll,iIli1I,Iiil1){return illIll(iIli1I,Iiil1);},'kWGPD':function(iiilli,l1iIIl){return iiilli>=l1iIIl;},'TStEb':function(iiilll,lI11Il){return iiilll===lI11Il;},'urSRz':function(lIII1i,l11i11){return lIII1i!==l11i11;}};if($[IillIl(0x141,'L)h!')])return;let IiiIii='',IIlll=null,liliI=null,ll1lI=IillIl(0x12a,'OZ)1'),l1iii={},IIlli={};switch(lIIili){case'main':IIlli={'appId':IillIl(0x143,'bYqI'),'functionId':IillIl(0x16e,')t*g'),'appid':IillIl(0xef,'44kS'),'clientVersion':common[IillIl(0x179,'G]i8')](),'client':IiiIil[IillIl(0x17c,']Sio')],'body':{},'version':IiiIil[IillIl(0x159,']]fq')],'ua':$['UA'],'t':!![]},l1iii=await H5st[IillIl(0x12e,'S@ez')](IIlli),IiiIii=IillIl(0x145,'WDgG'),IIlll=l1iii[IillIl(0x146,'J0mi')];break;default:console['log']('❌\x20未知请求\x20'+lIIili);return;}const l1iil={'url':IiiIii,'method':ll1lI,'headers':{'Host':IillIl(0x11e,'&a3M'),'Accept':'*/*','Cookie':cookie,'User-Agent':$['UA'],'Accept-Language':IiiIil[IillIl(0x142,'72]k')],'Accept-Encoding':IiiIil[IillIl(0x153,'QmWb')],'Referer':IillIl(0x103,'Xa5B')},'params':liliI,'data':IIlll,'timeout':0x7530};IiiIil[IillIl(0xfa,'bYqI')](ll1lI,IiiIil[IillIl(0x115,']Sio')])&&(delete l1iil[IillIl(0x14e,'WDgG')],delete l1iil[IillIl(0x126,'Bu]Q')][IiiIil[IillIl(0x133,'#YEj')]]);const ii1l1=0x1;let lIIill=0x0,I11iIi=null,I1ilII=![];while(lIIill -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }