KR/activity/jd_HappyNewYear_Share.js

252 lines
78 KiB
JavaScript
Raw Normal View History

2022-02-15 12:10:23 +08:00
/*
2022欢度元宵 邀人助力
账号内互助
每人3次助力机会 助力满需要5次
cron:15 14,22 15 2 *
15 14,22 15 2 * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_HappyNewYear_Share.js
*/
const $ = new Env('2022欢度元宵 邀人助力');
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const notify = $.isNode() ? require('./sendNotify') : '';
CryptoScripts()
$.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS;
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [],
cookie = '';
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
})
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
} else {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
}
message = ''
newCookie = ''
resMsg = ''
$.endFlag = false
let shareCodeArr = {}
$.runArr = {}
const activeEndTime = '2022/02/16 00:00:00+08:00';//活动结束时间
let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
let timeH = $.time('H')
!(async () => {
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/"
});
return;
}
if (nowTime > new Date(activeEndTime).getTime()) {
//活动结束后弹窗提醒
$.msg($.name, '活动已结束', `请删除此脚本\n咱江湖再见`);
return
}
$.temp = [];
for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
console.log(`\n\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
await getUA()
await run();
}
}
try{
for (let i = 0; i < cookiesArr.length && $.temp.length > 0 && true; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
$.canHelp = true;//能否助力
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
console.log(`\n账号内部相互邀请助力\n`);
for (let n in $.temp) {
let item = $.temp[n]
if(!item || !$.canHelp) continue
console.log(`\n${$.UserName} 去参助力 ${item}`);
const helpRes = await getCoupons(item.trim());
let res = $.toObj(helpRes,helpRes)
if(typeof res == 'object'){
if(res.code == 0 && res.data){
if(res.data.bizMsg){
console.log(res.data.bizMsg)
}
if(res.data.bizCode === -106){
delete $.temp[n]
}else if([-105,-1001].includes(res.data.bizCode)){
$.canHelp = false
}
}else if([-30001].includes(res.code)){
$.canHelp = false
}else if(res.message || res.msg){
console.log(res.message || res.msg)
}
}
await $.wait(parseInt(Math.random() * 2000 + 3000, 10))
if(!$.canHelp){
break
}
}
}
}
}catch(e){
console.log(e)
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
async function run(type = 0){
try{
resMsg = ''
let res = await showCoupon()
if($.endFlag) return
if(resMsg){
message += `【京东账号${$.index}${$.nickName || $.UserName}\n${resMsg}`
}
await $.wait(parseInt(Math.random() * 2000 + 3000, 10))
}catch(e){
console.log(e)
}
}
function getCoupons(code = '') {
return new Promise(async resolve => {
await requestAlgo();
let time = Date.now()
let body = {"inviteCode":code,"uuid":"","sv":""}
let h5st = h5stSign(body) || 'undefined'
let message = ''
let opts = {
url: `https://api-x.m.jd.com/`,
body: `h5st=${h5st}&functionId=party_yx_assist&body=${$.toStr(body,body)}&client=wh5&clientVersion=1.0.0&appid=spring_h5&t=${time}`,
headers: {
"Accept": "application/json",
"Accept-Language": "zh-cn",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Type": "application/x-www-form-urlencoded",
'Cookie': `${cookie}`,
"Origin": "https://sfgala.jd.com",
"Referer": "https://sfgala.jd.com/",
"User-Agent": $.UA ,
}
}
$.post(opts, async (err, resp, data) => {
try {
if (err) {
console.log(`${$.toStr(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
console.log(data)
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function showCoupon() {
let msg = true
return new Promise(resolve => {
let body = {"showAssistorsSwitch":true}
let opts = {
url: `https://api-x.m.jd.com/`,
body: `functionId=party_yx_inviteWindow&body=${$.toStr(body,body)}&client=wh5&clientVersion=1.0.0&appid=spring_h5`,
headers: {
"Accept": "application/json",
"Accept-Language": "zh-cn",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Type": "application/x-www-form-urlencoded",
'Cookie': `${cookie}`,
"Origin": "https://sfgala.jd.com",
"Referer": "https://sfgala.jd.com/",
"User-Agent": $.UA ,
}
}
$.post(opts, async (err, resp, data) => {
try {
if (err) {
console.log(`${$.toStr(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
// console.log(data)
let res = $.toObj(data,data);
if(typeof res == 'object'){
if(res.code == 0 && res.data){
if(res.data.bizCode === 0 && res.data.result){
res = res.data.result
console.log(res.hongbaoSum)
console.log("助力码:"+res.inviteCode)
if(res.haveAssistedNum){
$.temp.push(res.inviteCode);
}else{
console.log("助力已满")
}
}else if(res.data.bizMsg){
console.log(res.data.bizMsg)
if([-2001].includes(res.data.bizCode)){
$.endFlag = true
}
}
}else if(res.message || res.msg){
console.log(res.message || res.msg)
}
}else{
console.log(data)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(msg);
}
})
})
}
function getUA(){
$.UA = `jdapp;iPhone;10.2.2;14.3;${randomString(40)};M/5.0;network/wifi;ADID/;model/iPhone12,1;addressid/4199175193;appBuild/167863;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;`
}
function randomString(e) {
e = e || 32;
let t = "abcdef0123456789", a = t.length, n = "";
for (i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a));
return n
}
function jsonParse(str) {
if (typeof str == "string") {
try {
return JSON.parse(str);
} catch (e) {
console.log(e);
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
return [];
}
}
}
var _0xode='jsjiami.com.v6',_0xode_=['_0xode'],_0x3e5c=[_0xode,'EcKAXEUmw7LCmw==','XsO9wr/Ci1Q=','wrXCnCnDm2DDtQ==','wotcN33DiQ==','w5BUJsKgWsKIwqM=','BEXCpgYD','wox6WMOlwrA=','w44ORMKkw7k=','VMKvRzjDtw==','w4tJQ3hgBh3DvwrDtAM8w5kbI2XCpkwOJDbDgcKMEsKbB1/Cu8KOXMKLw5REDHV5wokLHz/Ci31Pwr8=','NsOkVcKDLA==','JGvDrC0swqhpenTDu8OswrLDik7ClhxQw45/w7/DjWV3','wqQJLcKUW8KoQ8KcYzNVFcOVFFdKw5DClMORw5fDnMOuwq0=','w7rCsMOnMng=','woMSKHvDnhzClXvDmhLChsKXwoxYP1jDhE/DgmjCjMOZw7Q=','w5ocfH/DnB/CtXDClgrCnsKDwowSOULDikHChmzDh8KOwrPCl8OvfcKHeMKwJg==','w7Qgw44=','CcKKQkQ6','E1rDncKNwoc=','wqrCjR/ClQ==','wo1ZwqjCszE=','wqsYN8KvTcOr','w5BUIsK5ScKFw6Y=','w4ZzecOd','wrTClMKtwrJR','wo9mwrgqaC4=','wpwgLyzDr8O8','w6k7w4tLw50r','wq0RKcKMScOwCcOH','wqsLc8K8QWHDjhQQwqJvwpNFwpfCpMK3BcO2w7h8UnxXVGoOI0p3wrZAN8K5wpc3IsObwp3DoWLCuk1owotHwrocw6XDmS8UXg==','wrLDqUo=','LWrCuws=','w7fCkwHDk3rCtw3CmA==','TFPDggvCrQ==','wpPCg8K5wpNdfxfChjLCpg==','wr3CusKvwq54','C0rDt2XDkg==','KFJkKwc=','w4JkcH3CvsK7w4BcKsOp','OcKiacKyDA==','wppFwoHCpjM=','EcOBecKiwpUT','wqAYN8KDXMO6','wrjCiTfDlXA=','wpjCnMKTwqIeCQ==','wrrClS7DmXrDqQ==','f8OnHcO1SQ==','dWvDshI=','wqXDiQbCkBY=','aMKvPw==','I0MaK2c=','A8OnBMOuOg==','wqDDjsO/w45sw6rCksOx','DcOIwpXDvBI=','w6AncMK4w6p9woLDoQ==','OU/DgcKtDA==','ZU0ew6/DrxATwqYAwrI=','w5DCu8KHw6MQ','wrTCjRs=','woMIcsOlwoA=','bsOYfQ==','EcKJW043','wqZkwq8Jag==','OWbCryUHw70=','DcOIwq3DrQ4=','wq7CjT/ClcOxQj3Clg==','woPDgcKfwrcPFGIJ','ZCBEwpbDksK2BMOjUcKE','wqvDp2HDlcKQewcv','woY6ETrDuMOnwpgM','w5bDrMKfw6BwaXxx','IMOGasKjH3I=','wqJ7R8O7wqA=','Km/Dnk3Domw=','OsKmRsK+Fw==','wrrClinDn3XDqQ==','wqkGfsK7RXM=','wp3DgcKlwq0=','w48fw7Npw5c=','IsOZdMKpGg==','wpRhw6o=','KcOHIMOsPkLCisOpwq7DnkvDqz0=','dg0uV1M=','en7DuDE5wqzDgsOKWMK5VjPCscOUw6Q=','wo7Dl8K1wrowMGgKJ8K6wpHCtQvCnXxUJg==','w7xadMOvHA==','wqTCvSs=','C8KpVEUR','IElGPRk=','LcO9wrTDojE=','w4NOwrg=','JMKaXMK5Hw==','w7Z1SMO9Jw==','Z8OSYDU=','QsKpUVDCkwQ=','w6fClTHDk1zCpxPCmg==','w6JVTsOdPg==','wqMTSMK+aA==','EsOHbsKgwrg=','FcKPSA==','w7NIXMOzIA==','MEnCrB7Cug==','LHvDisKJwqg=','wrIceMK1Zg==','WUbDvATCkw==','w5nCocOdDVo=','w70qw5dpw5Y1','L8OuZcOTwoo=','w5NwTcOGPm4/Lg==','w7nCvMOFCGLDiXLDvA==','w5DCiBvDl1rCoTfCrg==','worDkcK6w54BwqrDp8Oh','OsOVwr/DuBQAw4HCtQ==','DMKBa1Qsw5TCkyk=','w6DDokhvOMOGbMK4','F8OPRMKywogXeMOh','G8KBVkM/w4k=','wr4GQ8KsVm7Dhxs=','UsK0aCbDow==','OGgcJVTDtcOIGg==','w4RwcMORLXM=','wqQGZw==','EHPCpjnCpA==','bXrDvggvwp3DhMOW','w70qw41mw5I4TQ==','wpDDi8K4wosSCH4d','woTDmcOyw7Z3w7DCqsOR','wp9VKlPDhQHCiWDDkUM=','wr7CnDPDr3HDvlgcwoXDow==','w70qw41mw5I1','wqcxfMOZwro=','AsO6QcKjEQ==','w7PDqG9WI8ODbsK2XGDCiV/DtsKSwq4=','eHrDuikhwpDDlQ==','ehAgMsKzw5Q=','JMOMcMKGC2pYQXEaew==','FMKLVkcqw5U=','wqoSK8KhScOxBA==','L2ghMkfDqA==','OGI8JQ==','J3DDg8KzGQ==','dsOIZj9ZRg==','OMOuYMOVwoVi','wrXCocK6wqxD','woM6ER/Dmw==','WsKTIsO+w4xJIcK0csKXAGPDksOecMKG','AUDDqcK2wokywpR/HsOfw6nDgCAQL04=','FnrDvMKaZwvDssKSwp4Kw43DijrCqCAAAg==','w4rDt8K4w6RxOj05aEXDi8OyJsKUdcOlwp3CuUHCi8Oew5fCocOm','MwlCwr/Cr0xKw79xw68=','AMKNUGUu','jsjiami.rAcoym.vk6qlwTCTYSrWdy=='];if(function(_0x4aa0ba,_0x6651ee,_0x213183){function _0x3f40da(_0x66cbe6,_0xa8d18c,_0x11b699,_0x11a38d,_0x57b1dc,_0x18b84b){_0xa8d18c=_0xa8d18c>>0x8,_0x57b1dc='po';var _0x27fb3c='shift',_0x495bbd='push',_0x18b84b='';if(_0xa8d18c<_0x66cbe6){while(--_0x66cbe6){_0x11a38d=_0x4aa0ba[_0x27fb3c]();if(_0xa8d18c===_0x66cbe6&&_0x18b84b===''&&_0x18b84b['length']===0x1){_0xa8d18c=_0x11a38d,_0x11b699=_0x4aa0ba[_0x57b1dc+'p']();}else if(_0xa8d18c&&_0x11b699['replace'](/[rAykqlwTCTYSrWdy=]/g,'')===_0xa8d18c){_0x4aa0ba[_0x495bbd](_0x11a38d);}}_0x4aa0ba[_0x495bbd](_0x4aa0ba[_0x27fb3c]());}return 0xced86;};return _0x3f40da(++_0x6651ee,_0x213183)>>_0x6651ee^_0x213183;}(_0x3e5c,0x1bd,0x1bd00),_0x3e5c){_0xode_=_0x3e5c['length']^0x1bd;};function _0x5722(_0x583609,_0xdaa79d){_0x583609=~~'0x'['concat'](_0x583609['slice'](0x1));var _0x4295ed=_0x3e5c[_0x583609];if(_0x5722['fwnILs']===undefined){(function(){var _0x2e1e8e=typeof window!=='undefined'?window:typeof process==='object'&&typeof require==='function'&&typeof global==='object'?global:this;var _0x46d1da='ABCDEFGHIJKLMNOPQRSTUVWXYZab
function CryptoScripts() {
// prettier-ignore
!function(t,e){"object"==typeof exports?module.exports=exports=e():"function"==typeof define&&define.amd?define([],e):t.CryptoJS=e()}(this,function(){var t,e,r,i,n,o,s,c,a,h,l,f,d,u,p,_,v,y,g,B,w,k,S,m,x,b,H,z,A,C,D,E,R,M,F,P,W,O,I,U,K,X,L,j,N,T,q,Z,V,G,J,$,Q,Y,tt,et,rt,it,nt,ot,st,ct,at,ht,lt,ft,dt,ut,pt,_t,vt,yt,gt,Bt,wt,kt,St,mt=mt||function(t){var e;if("undefined"!=typeof window&&window.crypto&&(e=window.crypto),!e&&"undefined"!=typeof window&&window.msCrypto&&(e=window.msCrypto),!e&&"undefined"!=typeof global&&global.crypto&&(e=global.crypto),!e&&"function"==typeof require)try{e=require("crypto")}catch(e){}function r(){if(e){if("function"==typeof e.getRandomValues)try{return e.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof e.randomBytes)try{return e.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")}var i=Object.create||function(t){var e;return n.prototype=t,e=new n,n.prototype=null,e};function n(){}var o={},s=o.lib={},c=s.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),(e.init.prototype=e).$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=s.WordArray=c.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o<n;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[i+o>>>2]|=s<<24-(i+o)%4*8}else for(o=0;o<n;o+=4)e[i+o>>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i<t;i+=4)e.push(r());return new a.init(e,t)}}),h=o.enc={},l=h.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n<r;n++){var o=e[n>>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i<e;i+=2)r[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new a.init(r,e/2)}},f=h.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n<r;n++){var o=e[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i<e;i++)r[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new a.init(r,e)}},d=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},u=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,i=this._data,n=i.words,o=i.sigBytes,s=this.blockSize,c=o/(4*s),h=(c=e?t.ceil(c):t.max((0|c)-this._minBufferSize,0))*s,l=t.min(4*h,o);if(h){for(var f=0;f<h;f+=s)this._doProcessBlock(n,f);r=n.splice(0,h),i.sigBytes-=l}return new a.init(r,l)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(s.Hasher=u.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}}),o.algo={});return o}(Math);function xt(t,e,r){return t^e^r}fu
}
// 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"])