/* 活动名称:新版玩一玩之摇一摇抽奖 5.17-8.31结束 活动入口:APP-我的-更多工具-玩一玩 活动建议:定时自行修改,奖票有效期2个月 cron:1 1 1 1 * */ const $ = new Env('新版玩一玩之摇一摇抽奖') var iil='jsjiami.com.v7';const llliI=iii1II;(function(IiIi,iI1ll1,IlI1Il,l1il1l,liIil,IllI1I,liIii){return IiIi=IiIi>>0x3,IllI1I='hs',liIii='hs',function(II1ll1,IlI1Ii,i11I1I,l1il1i,ll1){const llI=iii1II;l1il1i='tfi',IllI1I=l1il1i+IllI1I,ll1='up',liIii+=ll1,IllI1I=i11I1I(IllI1I),liIii=i11I1I(liIii),i11I1I=0x0;const iI1llI=II1ll1();while(!![]&&--l1il1l+IlI1Ii){try{l1il1i=-parseInt(llI(0x176,'rp41'))/0x1+parseInt(llI(0x141,'It0)'))/0x2*(parseInt(llI(0x220,'*XPz'))/0x3)+parseInt(llI(0x1b1,'8VTF'))/0x4*(-parseInt(llI(0x13c,'It0)'))/0x5)+-parseInt(llI(0x205,'kWXu'))/0x6*(parseInt(llI(0x1a0,'j(*1'))/0x7)+-parseInt(llI(0x1bb,'e@aF'))/0x8*(-parseInt(llI(0x19e,'yiD('))/0x9)+-parseInt(llI(0x1c1,'QUCG'))/0xa+-parseInt(llI(0x177,'%YSL'))/0xb*(-parseInt(llI(0x1ce,'Qksb'))/0xc);}catch(llliii){l1il1i=i11I1I;}finally{ll1=iI1llI[IllI1I]();if(IiIi<=l1il1l)i11I1I?liIil?l1il1i=ll1:liIil=ll1:i11I1I=ll1;else{if(i11I1I==liIil['replace'](/[LWJbrgYpwqhHyTfNVGu=]/g,'')){if(l1il1i===IlI1Ii){iI1llI['un'+IllI1I](ll1);break;}iI1llI[liIii](ll1);}}}}}(IlI1Il,iI1ll1,function(IllI11,l1llIi,II1llI,i11I11,l1llIl,ii1I1l,ii1I1i){return l1llIi='\x73\x70\x6c\x69\x74',IllI11=arguments[0x0],IllI11=IllI11[l1llIi](''),II1llI=`\x72\x65\x76\x65\x72\x73\x65`,IllI11=IllI11[II1llI]('\x76'),i11I11=`\x6a\x6f\x69\x6e`,(0x16e420,IllI11[i11I11](''));});}(0x630,0x9b6dc,Iii11l,0xc8),Iii11l)&&(iil=`\x02f`);const jdCookie=require('./jdCookie'),notify=require(llliI(0x1b4,'d9xR')),common=require(llliI(0x175,')B5T')),{H5st}=require(llliI(0x134,'][n@')),isNotify=![];let superlinkId=llliI(0x1f9,'%YSL'),waitTimes=0x3e8,cookie='';const cookiesArr=Object['keys'](jdCookie)['map'](IIll1=>jdCookie[IIll1])[llliI(0x1a1,'V3)k')](ll1il=>ll1il);!cookiesArr[0x0]&&($[llliI(0x1d6,'][n@')]($[llliI(0x1fb,'Kd8F')],llliI(0x189,'V3)k')),process[llliI(0x140,'z*kT')](0x1));!(async()=>{const iI1li1=llliI,IiiIiI={'vSstd':function(lilii,l1iiI){return lilii$['logErr'](ll1ll))[llliI(0x1a3,'d9xR')](()=>$[llliI(0x1cc,'BO5v')]());function iii1II(_0x1f1a4e,_0x2a3666){const _0x51ff28=Iii11l();return iii1II=function(_0x4fa918,_0x4fac7d){_0x4fa918=_0x4fa918-0x12c;let _0x43ede1=_0x51ff28[_0x4fa918];if(iii1II['xnimEC']===undefined){var _0x1a9d06=function(_0xde0ee0){const _0x581bb8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1f0b56='',_0x3c977c='';for(let _0x36d9ab=0x0,_0x5db273,_0x4cf974,_0xb1950=0x0;_0x4cf974=_0xde0ee0['charAt'](_0xb1950++);~_0x4cf974&&(_0x5db273=_0x36d9ab%0x4?_0x5db273*0x40+_0x4cf974:_0x4cf974,_0x36d9ab++%0x4)?_0x1f0b56+=String['fromCharCode'](0xff&_0x5db273>>(-0x2*_0x36d9ab&0x6)):0x0){_0x4cf974=_0x581bb8['indexOf'](_0x4cf974);}for(let _0x5a6d1e=0x0,_0x241bc5=_0x1f0b56['length'];_0x5a6d1e<_0x241bc5;_0x5a6d1e++){_0x3c977c+='%'+('00'+_0x1f0b56['charCodeAt'](_0x5a6d1e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3c977c);};const _0x5abde3=function(_0x5ef464,_0x5c3589){let _0x5d4aba=[],_0x341d6b=0x0,_0x310a67,_0x497d33='';_0x5ef464=_0x1a9d06(_0x5ef464);let _0x43e66b;for(_0x43e66b=0x0;_0x43e66b<0x100;_0x43e66b++){_0x5d4aba[_0x43e66b]=_0x43e66b;}for(_0x43e66b=0x0;_0x43e66b<0x100;_0x43e66b++){_0x341d6b=(_0x341d6b+_0x5d4aba[_0x43e66b]+_0x5c3589['charCodeAt'](_0x43e66b%_0x5c3589['length']))%0x100,_0x310a67=_0x5d4aba[_0x43e66b],_0x5d4aba[_0x43e66b]=_0x5d4aba[_0x341d6b],_0x5d4aba[_0x341d6b]=_0x310a67;}_0x43e66b=0x0,_0x341d6b=0x0;for(let _0x17de72=0x0;_0x17de72<_0x5ef464['length'];_0x17de72++){_0x43e66b=(_0x43e66b+0x1)%0x100,_0x341d6b=(_0x341d6b+_0x5d4aba[_0x43e66b])%0x100,_0x310a67=_0x5d4aba[_0x43e66b],_0x5d4aba[_0x43e66b]=_0x5d4aba[_0x341d6b],_0x5d4aba[_0x341d6b]=_0x310a67,_0x497d33+=String['fromCharCode'](_0x5ef464['charCodeAt'](_0x17de72)^_0x5d4aba[(_0x5d4aba[_0x43e66b]+_0x5d4aba[_0x341d6b])%0x100]);}return _0x497d33;};iii1II['qRoYiU']=_0x5abde3,_0x1f1a4e=arguments,iii1II['xnimEC']=!![];}const _0x1f55bd=_0x51ff28[0x0],_0x25e847=_0x4fa918+_0x1f55bd,_0x4b4c96=_0x1f1a4e[_0x25e847];return!_0x4b4c96?(iii1II['cpZpvP']===undefined&&(iii1II['cpZpvP']=!![]),_0x43ede1=iii1II['qRoYiU'](_0x43ede1,_0x4fac7d),_0x1f1a4e[_0x25e847]=_0x43ede1):_0x43ede1=_0x4b4c96,_0x43ede1;},iii1II(_0x1f1a4e,_0x2a3666);}async function Main(){const lllii1=llliI,Illl11={'plftA':lllii1(0x15d,'Qksb'),'VWIIA':function(ii1lI,I1ilIl){return ii1lI===I1ilIl;},'pKQxy':lllii1(0x15a,'BO5v'),'gCkVX':function(I11iII,I1ilIi){return I11iII===I1ilIi;},'mxFtx':lllii1(0x1bf,'BO5v'),'gZsAJ':function(IiiiI,llIlli){return IiiiI/llIlli;},'LBxgG':function(llIlll,lliii1){return llIlll%lliii1;},'hQPMy':function(Iiii1,lIIili){return Iiii1>lIIili;},'lsvJH':function(IiiIil,IiiIii){return IiiIil>IiiIii;},'YJNnL':function(IIlll,liliI){return IIllllilIl;},'WPUax':'bhXlT','FNgTb':liIli(0x1a4,'hod['),'tjoEo':liIli(0x17b,'tcGi'),'ASKCY':liIli(0x183,'Kk&]')};try{switch(l11i11){case liIli(0x179,'nr5&'):if(IilIl1[liIli(0x1e1,'*Xm6')]==0x0&&IilIl1[liIli(0x1e3,'kWXu')])$['superRedBagHome']=IilIl1['data'];else{if(IilIl1[liIli(0x146,'][n@')]||IilIl1[liIli(0x190,'BO5v')])lIII1l[liIli(0x167,'nr5&')]!==lIII1l[liIli(0x1cf,'Kd8F')]?console[liIli(0x213,'rp41')](''+(IilIl1[liIli(0x16a,'tcGi')]||IilIl1['msg'])):lI1IiI[liIli(0x1e6,'z*kT')](''+(i1lI[liIli(0x1f1,'*Xm6')]||IlI1l[liIli(0x1c4,')B5T')]));else IilIl1[liIli(0x13a,'kWXu')]?console['log'](''+IilIl1[liIli(0x1dd,'#uek')]):console[liIli(0x200,'Kk&]')]('❓'+l11i11+'\x20'+JSON['stringify'](IilIl1));}break;case lIII1l['CeoGw']:if(lIII1l[liIli(0x1ed,'][n@')](IilIl1[liIli(0x1f5,'][n@')],0x0)&&IilIl1[liIli(0x21d,'KnIy')]){if(IilIl1[liIli(0x184,'Q(ni')]&&lIII1l['ihGJw'](IilIl1['data']['shakeLeftTime'],0x0)){if(IilIl1[liIli(0x203,'koJS')]&&IilIl1['data'][liIli(0x1f7,'%YSL')]){if(lIII1l['WPUax']===liIli(0x131,'*Fvd')){const iIli11=IilIl1['data'][liIli(0x16c,'JdMH')][liIli(0x181,'#uek')];switch(iIli11){case 0x0:console[liIli(0x156,'KnIy')]('空气');break;case 0x1:console[liIli(0x1fa,'Iw(b')]('获得'+IilIl1['data'][liIli(0x1f7,'%YSL')][liIli(0x166,'Kd8F')]+'(满'+IilIl1['data'][liIli(0x12f,'koJS')][liIli(0x217,'o&%N')]+'减'+IilIl1[liIli(0x198,'kWXu')][liIli(0x12d,'r!o6')][liIli(0x163,']Fmb')]+')');break;case 0x2:console[liIli(0x1ad,'CdNZ')]('收入'+IilIl1['data'][liIli(0x18e,'][n@')]['amount']+'红包');break;case 0x3:console['log']('收入'+IilIl1[liIli(0x172,'][n@')][liIli(0x18a,']Fmb')][liIli(0x136,'JdMH')]+'京豆');break;case 0x4:console[liIli(0x17e,')B5T')]('收入'+IilIl1['data'][liIli(0x1ee,'CdNZ')][liIli(0x147,'Kd8F')]+'现金');break;case 0x18:console['log']('收入'+IilIl1['data'][liIli(0x20a,'kWXu')][liIli(0x16f,'*Fvd')]+IilIl1[liIli(0x1be,'*mUE')][liIli(0x195,'mAi8')]['prizeConfigName']);break;default:console['log'](liIli(0x144,'Kk&]')+IilIl1['data']['prizeDrawVo'][liIli(0x149,'V3)k')]+'('+iIli11+')');break;}}else lilIiI[liIli(0x16e,'*mUE')]('空气');}else liIli(0x18f,'$$&h')!==liIli(0x142,'r!o6')?IiiIl1['message'][liIli(0x1e4,'1DRy')](lIIil1):console['log']('空气');}else $[liIli(0x1f4,'W!fc')]=!![];}else{if(IilIl1[liIli(0x207,'$$&h')]||IilIl1[liIli(0x1dc,'%YSL')])console['log'](''+(IilIl1[liIli(0x1ec,'E!xh')]||IilIl1[liIli(0x1ff,'koJS')]));else IilIl1['message']?lIII1l['FNgTb']!==lIII1l[liIli(0x13e,'][n@')]?console[liIli(0x1ad,'CdNZ')](''+IilIl1[liIli(0x1ab,'$$&h')]):iIIIIi[liIli(0x202,'fB95')]=iii1I1[liIli(0x12c,'yiD(')]:lIII1l['ASKCY']!=='nxogl'?(lilIl1['msg'](i1l1ii[liIli(0x1e9,'JdMH')],'【提示】请先获取Cookie'),i1l1[liIli(0x138,'KnIy')](0x1)):console[liIli(0x17f,'kWXu')]('❓'+l11i11+'\x20'+JSON['stringify'](IilIl1));}break;}}catch(llIIli){console[liIli(0x168,'d9xR')](liIli(0x199,'Kd8F')+l11i11+liIli(0x20f,'r!o6')+(llIIli[liIli(0x187,'cmL7')]||llIIli));}}async function sendRequest(lIII1I){const liIll=llliI,illIlI={'OZdeb':liIll(0x19a,'[DcD'),'WmdAt':liIll(0x14f,'Qksb'),'YOSWF':liIll(0x170,'Iw(b'),'ZLsvj':'4.7','nkYxg':liIll(0x1b5,'yiD('),'ofoHO':function(l1il11,IiI1){return l1il11===IiI1;},'ICxwS':liIll(0x12e,'fB95'),'IGtYN':liIll(0x1c7,'1DRy'),'Zqkag':liIll(0x130,'TI!!'),'pVMDv':liIll(0x1d1,'e@aF'),'BBhxf':'application/x-www-form-urlencoded','PdYkn':'application/json,\x20text/plain,\x20*/*','Qpwuk':'h5_1.0.0','PbDaL':liIll(0x208,'o&%N'),'FeVVU':'Content-Type','IJOhL':function(liI,illIli){return liI=ii1I11;}};if($[liIll(0x150,'Kk&]')])return;let liIiI='',l1il1I=null,Iiili=null,IilIli='POST',li1={},illIl1={};switch(lIII1I){case illIlI[liIll(0x1df,'d9xR')]:illIl1={'appId':liIll(0x173,'][n@'),'functionId':lIII1I,'appid':illIlI[liIll(0x14d,')B5T')],'clientVersion':common[liIll(0x154,'mNy2')](),'client':liIll(0x148,'8VTF'),'body':{'linkId':superlinkId},'version':liIll(0x194,'%YSL'),'ua':$['UA'],'t':!![]},li1=await H5st[liIll(0x1ef,'cM9T')](illIl1),liIiI=liIll(0x1eb,'hod['),l1il1I=li1[liIll(0x1d4,'%YSL')];break;case'superRedBagDraw':illIl1={'appId':illIlI[liIll(0x1f8,'i@W%')],'functionId':lIII1I,'appid':'activity_platform_se','clientVersion':common[liIll(0x16d,'CdNZ')](),'client':'ios','body':{'linkId':superlinkId},'version':illIlI[liIll(0x1a8,'V3)k')],'ua':$['UA'],'t':!![]},li1=await H5st[liIll(0x161,'][n@')](illIl1),liIiI=illIlI[liIll(0x1a2,'cM9T')],l1il1I=li1[liIll(0x14c,'x*cu')];break;default:console[liIll(0x171,'It0)')](liIll(0x1b0,'Iw(b')+lIII1I);return;}const l1llII={};l1il1I&&Object[liIll(0x178,'o&%N')](l1il1I,l1llII);Iiili&&(illIlI[liIll(0x1d7,'o&%N')](illIlI[liIll(0x1c8,'1DRy')],illIlI[liIll(0x21a,'TI!!')])?i1ilil[liIll(0x21c,'r!o6')]('❓'+lilIii+'\x20'+i1ill1[liIll(0x191,'yiD(')](iIIl1l)):Object[liIll(0x1f6,'$$&h')](Iiili,l1llII));const IilIll={'url':liIiI,'method':IilIli,'headers':{'origin':illIlI[liIll(0x1ac,'*XPz')],'Referer':illIlI[liIll(0x1e7,'d9xR')],'User-Agent':$['UA'],'Cookie':cookie,'content-type':illIlI['BBhxf'],'accept':illIlI['PdYkn'],'x-rp-client':illIlI[liIll(0x211,'QUCG')]},'params':Iiili,'data':l1il1I,'timeout':0x7530};IilIli===illIlI['PbDaL']&&(delete IilIll[liIll(0x17d,'d9xR')],delete IilIll[liIll(0x1ea,'TI!!')][illIlI[liIll(0x180,'*mUE')]]);const lI11Ii=0x1;let Iiill=0x0,l11i1i=null,lI11I1=![];while(illIlI[liIll(0x214,'r!o6')](Iiill,lI11Ii)){Iiill>0x0&&await $[liIll(0x160,'j(*1')](0x3e8);const lI11II=await common[liIll(0x1e0,'mAi8')](IilIll);if(!lI11II[liIll(0x17a,'*XPz')]){if(illIlI['YLIll'](illIlI[liIll(0x15f,'KnIy')],illIlI[liIll(0x165,'Kk&]')]))i1illl['log'](I1llil),I1llii&&(Iii11I[liIll(0x15c,'JdMH')]=!![],Iil1II[liIll(0x204,'Qksb')]&&lI1Ill[liIll(0x1a7,']Fmb')][liIll(0x188,'CdNZ')](lI1Ili));else{l11i1i=liIll(0x1b2,'nr5&')+lIII1I+'\x20请求失败\x20➜\x20'+lI11II['error'],Iiill++;lI11II[liIll(0x21e,'i@W%')]&&lI11II[liIll(0x1f3,'][n@')]===0x193&&['wheelsLottery']['includes'](lIII1I)&&(illIlI[liIll(0x19b,'*Fvd')](liIll(0x1c2,'8VTF'),liIll(0x153,'mAi8'))?$[liIll(0x1e5,'n^Ky')]=!![]:lI1Iii['log'](''+i1li['message']));continue;}}if(!lI11II[liIll(0x203,'koJS')]){if(liIll(0x1fd,'mAi8')!==illIlI['LjBfw']){l11i1i=liIll(0x152,'QUCG')+lIII1I+liIll(0x21b,'rp41'),Iiill++;continue;}else i1IIl[liIll(0x1f6,'$$&h')](I1lll1,i1IIi);}await handleResponse(lIII1I,lI11II[liIll(0x1d2,'JdMH')]),lI11I1=![];break;}illIlI[liIll(0x15e,'Kk&]')](Iiill,lI11Ii)&&(console['log'](l11i1i),lI11I1&&(liIll(0x1fc,'tcGi')==='GXdAU'?($['outFlag']=!![],$[liIll(0x1ab,'$$&h')]&&$[liIll(0x158,'j(*1')]['fix'](l11i1i)):(I1iIll['outFlag']=!![],I1lliI[liIll(0x216,'fB95')]&&iillll[liIll(0x1dd,'#uek')][liIll(0x133,'W!fc')](lIIilI))));}var version_ = 'jsjiami.com.v7'; // prettier-ignore function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -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) }