diff --git a/ampDache.js b/ampDache.js new file mode 100644 index 0000000..6f1bbd6 --- /dev/null +++ b/ampDache.js @@ -0,0 +1,302 @@ +/* +高德打车签到 +仅QX测试,青龙面板,其他自测 +获取Cookie方法 ,QX开重写,进入【高德地图/微信/支付宝 小程序[高德打车],打车,福利中心】,任意一端获取成功即可3端签到 + +自动签到 地图APP/微信小程序、支付宝小程序 +由于不懂JS,代码是硬堆的 + +环境变量 GD_Val = '{"userId":"xx","adiu":"xx","sessionid":"xx"}' + +======调试区|忽略====== +# ^https:\/\/(m5(|-zb)|dache)\.amap\.com\/(ws\/yuece\/(act|openapi\/activity\/current)\/query|common\/(alipaymini|wxmini)\?_ENCRYPT=) url script-response-body http://192.168.2.170:8080/ampDache.js +# APP/A/V https://m5.amap.com/ws/yuece/openapi/activity/current/query +# APP https://m5-zb.amap.com/ws/yuece/act/query +#支付宝 https://dache.amap.com/common/alipaymini?_ENCRYPT= +# 微信 https://dache.amap.com/common/wxmini?_ENCRYPT= +======调试区|忽略====== + +==================================== +[rewrite_local] +^https:\/\/(m5(|-zb)|dache)\.amap\.com\/(ws\/yuece\/(act|openapi\/activity\/current)\/query|common\/(alipaymini|wxmini)\?_ENCRYPT=) url script-response-body https://raw.githubusercontent.com/wf021325/qx/master/task/ampDache.js + +[task_local] +1 0 * * * https://raw.githubusercontent.com/wf021325/qx/master/task/ampDache.js, tag=高德地图打车签到, enabled=true + +[mitm] +hostname = *.amap.com +==================================== + */ + + +//************抠的算法 +function s(e,t){var n,r=4-e.length%4;n=t?0==(3&e.length)?e.length>>>2:1+(e.length>>>2):e.length/4+1;for(var o=new Uint32Array(Math.floor(n)),i=(r<<24)+(r<<16)+(r<<8)+r,a=0;a>>2]&=~(255<<((3&a)<<3)),o[a>>>2]|=(255&e[a])<<((3&a)<<3);return o}function u(e,t,n,r,o,i){return(n>>>5^t<<2)+(t>>>3^n<<4)^(e^t)+(i[3&r^o]^n)}function l(e){if(e.length<16){var t=new Uint8Array(16);t.set(e),e=t}return e}function a(e,t){var n=e.length,r=n<<2;if(t){var o=e[n-1];if(o<(r-=4)-3||o>r)return null;r=o}for(var i=new Uint8Array(Math.floor(r)),a=0;a>2]>>((3&a)<<3);return i}function c(e){for(var t=e.length,n=new Uint8Array(Math.floor(3*t+1)),r=0,o=0;o>6,n[r++]=128|63&i;else{if(!(i<55296||i>57343)){if(o+1>18,n[r++]=128|s>>12&63,n[r++]=128|s>>6&63,n[r++]=128|63&s,o++;continue}}throw new Error("Malformed string")}n[r++]=224|i>>12,n[r++]=128|i>>6&63,n[r++]=128|63&i}}return n.subarray(0,r+1)}function d(e,t){return"string"==typeof e&&(e=new Buffer(e,"base64")),"string"==typeof t&&(t=c(t)),null==e||0===e.length?e:a(function(e,t){var n,r,o,i,a,s=e.length,l=s-1;for(n=e[0],o=2654435769*Math.floor(6+52/s);0!==o;o-=2654435769){for(i=o>>>2&3,a=l;a>0;--a)r=e[a-1],n=e[a]-=u(o,n,r,a,i,t);r=e[l],n=e[0]-=u(o,n,r,a,i,t)}return e}(s(e,!0),s(l(t),!0)),!1)}function f(e,t){return"string"==typeof e&&(e=c(e)),"string"==typeof t&&(t=c(t)),null==e||0===e.length?e:a(function(e,t){var n,r,o,i,a,s,l=e.length,c=l-1;for(r=e[c],o=0,s=0|Math.floor(6+52/l);s>0;--s){for(i=(o+=2654435769)>>>2&3,a=0;a>2);out+=base64EncodeChars.charAt((c1&0x3)<<4);out+="==";break;}c2=str.charCodeAt(i++);if(i==len){out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt(((c1&0x3)<<4)|((c2&0xF0)>>4));out+=base64EncodeChars.charAt((c2&0xF)<<2);out+="=";break;}c3=str.charCodeAt(i++);out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt(((c1&0x3)<<4)|((c2&0xF0)>>4));out+=base64EncodeChars.charAt(((c2&0xF)<<2)|((c3&0xC0)>>6));out+=base64EncodeChars.charAt(c3&0x3F);}return out;}function base64decode(str){var c1,c2,c3,c4;var i,len,out;len=str.length;i=0;out="";while(i>4));do{c3=str.charCodeAt(i++)&0xff;if(c3==61)return out;c3=base64DecodeChars[c3];}while(i>2));do{c4=str.charCodeAt(i++)&0xff;if(c4==61)return out;c4=base64DecodeChars[c4];}while(i { + if (typeof $request != "undefined") { + getToken(); + return; + } + if (gdVal != undefined) { + let obj = JSON.parse(gdVal); + userId = obj.userId; + sessionid = obj.sessionid; + adiu = obj.adiu; + if (sessionid.length < 30) { + $.msg($.name, '', '❌请先获取sessionid🎉'); + return; + } + } else { + $.msg($.name, '', '❌请先获取sessionid🎉'); + return; + } + intRSA(); + intCryptoJS(); + + message += `----------微信小程序签到----------\n`; + node = 'wechatMP',channel = 'h5_common',actID = '53A31cHhhPJ',playID = '53A3fQm9AM7'; + await checkIn(); isOk && (await signIn()); + + message += `----------高德地图APP签到----------\n`; + node = 'Amap',channel = 'h5_common',actID = '53m5Q2UjZ6J',playID = '53m5Xt43PGU'; + await checkIn(); isOk && (await signIn()); + + message += `----------支付宝小程序签到----------\n`; + node = 'alipayMini',channel = 'alipay_mini',actID = '53wHnt77TQ5',playID = '53wHtx24q7u'; + await checkIn(); isOk && (await signIn()); + + console.log(message); //node,青龙日志 + await SendMsg(message); +})() +.catch((e) => {$.log("", `❌失败! 原因: ${e}!`, "");}) +.finally(() => {$.done();}); + + +function getToken() { + if ($request && $request.method != 'OPTIONS' && /\/common\/(alipaymini|wxmini)\?_ENCRYPT=/.test($request.url)) { //WX、ALI + let ENCRYPT = $request.url.split("_ENCRYPT=")[1].split("&")[0]; + ENCRYPT = base64decode(ENCRYPT); + let obj = {}, abc = {}; + ENCRYPT.split('&').forEach(item => obj[item.split('=')[0]] = (item.split('=')[1])) + abc.userId = obj.userId; + abc.adiu = obj.deviceId; + abc.sessionid = obj.sessionId; + if (abc.sessionid.length > 30) { + $.setdata(JSON.stringify(abc), _key); + $.msg($.name, '从小程序获取签到sessionid成功🎉', $.toStr(abc)); + } + } else if ($request && $request.method != 'OPTIONS') { //WX、ALI、APP + let abc = {}; + let obj = JSON.parse($response.body); + abc.userId = obj.content.uid; + abc.adiu = obj.content.adiu; + let hed = $request.headers; + abc.sessionid = hed['Sessionid'] || hed['sessionid']; + if (abc.sessionid.length > 30) { + $.setdata(JSON.stringify(abc), _key); + $.msg($.name, '获取签到sessionid成功🎉', $.toStr(abc)); + } else { + let ck = hed['Cookie'] || hed['cookie']; + if (ck.includes('sessionid=')) { + abc.sessionid = ck.split("sessionid=")[1].split(";")[0]; + if (abc.sessionid.length > 30) { + $.setdata(JSON.stringify(abc), _key); + $.msg($.name, '从Cookie中获取签到sessionid成功🎉', $.toStr(abc)); + } + } + } + } +} + +function getKey() { + for (var t = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678', n = t.length, r = "", i = 0; i < 16; i++) + r += t.charAt(Math.floor(Math.random() * n)); + return r +} +function getSign(channel) { + const sign = channel + '@oEEln6dQJK7lRfGxQjlyGthZ4loXcRHR' + return md5(sign).toUpperCase() +} +function getQuery(node, adiu,channel, key, sign) { + let xck = RSA_Public_Encrypt(key); + let _in = { + "channel": channel, + "sign": sign + }; + _in = Encrypt_Body(Json2Form(_in), key); + let query = { + "adiu": adiu, + "node": node, + "env": "prod", + "xck_channel": "default", + "xck": encodeURIComponent(xck), + "in": encodeURIComponent(_in) + } + return Json2Form(query) +} + +function getBody(body,key) { + body = 'in=' + encodeURIComponent(Encrypt_Body(Json2Form(body), key)); + return body +} +function getHeaders(sessionid) { + return { + 'Content-Type': 'application/x-www-form-urlencoded', + 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 amap/12.13.1.2034 AliApp(amap/12.13.1.2034) NetType/WiFi', + 'sessionid': sessionid + } +} + +function getShowBody(node, channel,adiu, userId, sign, actID, playIDs) { + return { + "bizVersion": "060800", + "h5version": "6.80.17", + "platform": "ios", + "tid": adiu, + "eId": "", + "adiu": adiu, + "diu": adiu, + "imei": adiu, + "idfa": adiu, + "enterprise": "0", + "ts": new Date().getTime(), + "uid": userId, + "userId": userId, + "channel": channel, + "dip": "20020", + "adCode": "", + "actID": actID, + "playTypes": "dailySign", + "playIDs": playIDs, + "node": node, + "sign": sign + } +} +function getSigBody(node, channel, adiu, userId, sign, actID, playID, signTerm, signDay) { + return{ + "bizVersion": "060800", + "h5version": "6.80.17", + "platform": "ios", + "tid": adiu, + "eId": "", + "adiu": adiu, + "diu": adiu, + "imei": adiu, + "idfa": adiu, + "enterprise": "0", + "ts": new Date().getTime(), + "uid": userId, + "userId": userId, + "channel": channel, + "dip": "20020", + "actID": actID, + "playID": playID, + "signTerm": signTerm, + "signType": "1", + "signDay": signDay, + "adCode": "", + "node": node, + "div": "", + "sign": sign + } +} + +function checkIn() { + return new Promise((resove) => { + key = getKey(); + sign = getSign(channel); + url= 'https://m5.amap.com/ws/car-place/show?' + getQuery(node, adiu,channel, key, sign); + body = getShowBody(node, channel, adiu, userId, sign, actID, playID); + body = getBody(body,key); + headers = getHeaders(sessionid); + const rest = {url: url,body: body,headers: headers}; + $.post(rest, (err, resp, data) => { + try { + debug("resp查询:"+data) + var obj = JSON.parse(data); + if(obj?.code == '1'){ + obj?.data?.playMap?.dailySign?.signList.forEach(t => { + if(t?.date == $.time('MM月dd日')){ + signTerm = obj?.data?.playMap?.dailySign?.signTerm; + signDay = t.day; + isSign = t.isSign;//isSign = 1 为签到过,懒得管了,让它再提交一次吧 + message += `查询:${t.date} isSign=${isSign} ${t.award.amount}里程\n`; + return isOk = true;//查询结果 + } + }) + }else{ + message += `查询:${obj?.message}\n`; + return isOk = false;//查询结果 + } + } catch (e) { + $.logErr(e,"❌查询:请重新登陆更新Token"); + } finally { + resove() + } + }) + }) +} +function signIn() { + return new Promise((resove) => { + key = getKey(); + sign = getSign(channel); + url= 'https://m5.amap.com/ws/alice/activity/daily_sign/do_sign?' + getQuery(node, adiu,channel, key, sign); + body = getSigBody(node, channel, adiu, userId, sign, actID, playID, signTerm, signDay); + body = getBody(body,key); + headers = getHeaders(sessionid); + const rest = {url: url,body: body,headers: headers}; + $.post(rest, (err, resp, data) => { + try { + debug('resp签到:'+data) + var obj = JSON.parse(data); + if(obj?.code == '1'){ + message += `签到:签到成功\n`; + }else{ + message += `签到:${obj?.message}\n`; + } + } catch (e) { + $.logErr(e,"❌请重新登陆更新Token"); + } finally { + resove() + } + }) + }) +} + +//通知 +async function SendMsg(message){$.isNode()?await notify.sendNotify($.name,message):$.msg($.name,"",message);} +//DEBUG +function debug(text){if($.is_debug==='true'){if(typeof text=="string"){console.log(text);}else if(typeof text=="object"){console.log($.toStr(text));}}} + + + +//JSON转为&a=b拼接的提交内容 键按A~Z排序 +function Json2Form(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(t).sort().map((function(e){return"".concat(e,"=").concat(t[e])})).join("&")} +//************#CryptoJS +function intCryptoJS(){CryptoJS=function(t,r){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&"undefined"!=typeof global&&global.crypto&&(n=global.crypto),!n&&"function"==typeof require)try{n=require("crypto")}catch(t){}var e=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(r){var n;return t.prototype=r,n=new t,t.prototype=null,n}}(),o={},a=o.lib={},s=a.Base={extend:function(t){var r=i(this);return t&&r.mixIn(t),r.hasOwnProperty("init")&&this.init!==r.init||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=s.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=null!=r?r:4*t.length},toString:function(t){return(t||f).stringify(this)},concat:function(t){var r=this.words,n=t.words,e=this.sigBytes,i=t.sigBytes;if(this.clamp(),e%4)for(var o=0;o>>2]>>>24-o%4*8&255;r[e+o>>>2]|=a<<24-(e+o)%4*8}else for(var s=0;s>>2]=n[s>>>2];return this.sigBytes+=i,this},clamp:function(){var r=this.words,n=this.sigBytes;r[n>>>2]&=4294967295<<32-n%4*8,r.length=t.ceil(n/4)},clone:function(){var t=s.clone.call(this);return t.words=this.words.slice(0),t},random:function(r){var n,i=[],o=function(r){r=r;var n=987654321,e=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&e)<<16)+(r=18e3*(65535&r)+(r>>16)&e)&e;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}},a=!1;try{e(),a=!0}catch(t){}for(var s,u=0;u>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(t){for(var r=t.length,n=[],e=0;e>>3]|=parseInt(t.substr(e,2),16)<<24-e%8*4;return new c.init(n,r/2)}},h=u.Latin1={stringify:function(t){for(var r=t.words,n=t.sigBytes,e=[],i=0;i>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},parse:function(t){for(var r=t.length,n=[],e=0;e>>2]|=(255&t.charCodeAt(e))<<24-e%4*8;return new c.init(n,r)}},p=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},d=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(r){var n,e=this._data,i=e.words,o=e.sigBytes,a=this.blockSize,s=o/(4*a),u=(s=r?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*a,f=t.min(4*u,o);if(u){for(var h=0;h>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=t[r+0],p=t[r+1],d=t[r+2],l=t[r+3],y=t[r+4],v=t[r+5],g=t[r+6],w=t[r+7],_=t[r+8],m=t[r+9],B=t[r+10],b=t[r+11],C=t[r+12],S=t[r+13],x=t[r+14],A=t[r+15],H=o[0],z=o[1],M=o[2],D=o[3];z=h(z=h(z=h(z=h(z=f(z=f(z=f(z=f(z=u(z=u(z=u(z=u(z=c(z=c(z=c(z=c(z,M=c(M,D=c(D,H=c(H,z,M,D,s,7,a[0]),z,M,p,12,a[1]),H,z,d,17,a[2]),D,H,l,22,a[3]),M=c(M,D=c(D,H=c(H,z,M,D,y,7,a[4]),z,M,v,12,a[5]),H,z,g,17,a[6]),D,H,w,22,a[7]),M=c(M,D=c(D,H=c(H,z,M,D,_,7,a[8]),z,M,m,12,a[9]),H,z,B,17,a[10]),D,H,b,22,a[11]),M=c(M,D=c(D,H=c(H,z,M,D,C,7,a[12]),z,M,S,12,a[13]),H,z,x,17,a[14]),D,H,A,22,a[15]),M=u(M,D=u(D,H=u(H,z,M,D,p,5,a[16]),z,M,g,9,a[17]),H,z,b,14,a[18]),D,H,s,20,a[19]),M=u(M,D=u(D,H=u(H,z,M,D,v,5,a[20]),z,M,B,9,a[21]),H,z,A,14,a[22]),D,H,y,20,a[23]),M=u(M,D=u(D,H=u(H,z,M,D,m,5,a[24]),z,M,x,9,a[25]),H,z,l,14,a[26]),D,H,_,20,a[27]),M=u(M,D=u(D,H=u(H,z,M,D,S,5,a[28]),z,M,d,9,a[29]),H,z,w,14,a[30]),D,H,C,20,a[31]),M=f(M,D=f(D,H=f(H,z,M,D,v,4,a[32]),z,M,_,11,a[33]),H,z,b,16,a[34]),D,H,x,23,a[35]),M=f(M,D=f(D,H=f(H,z,M,D,p,4,a[36]),z,M,y,11,a[37]),H,z,w,16,a[38]),D,H,B,23,a[39]),M=f(M,D=f(D,H=f(H,z,M,D,S,4,a[40]),z,M,s,11,a[41]),H,z,l,16,a[42]),D,H,g,23,a[43]),M=f(M,D=f(D,H=f(H,z,M,D,m,4,a[44]),z,M,C,11,a[45]),H,z,A,16,a[46]),D,H,d,23,a[47]),M=h(M,D=h(D,H=h(H,z,M,D,s,6,a[48]),z,M,w,10,a[49]),H,z,x,15,a[50]),D,H,v,21,a[51]),M=h(M,D=h(D,H=h(H,z,M,D,C,6,a[52]),z,M,l,10,a[53]),H,z,B,15,a[54]),D,H,p,21,a[55]),M=h(M,D=h(D,H=h(H,z,M,D,_,6,a[56]),z,M,A,10,a[57]),H,z,g,15,a[58]),D,H,S,21,a[59]),M=h(M,D=h(D,H=h(H,z,M,D,y,6,a[60]),z,M,b,10,a[61]),H,z,d,15,a[62]),D,H,m,21,a[63]),o[0]=o[0]+H|0,o[1]=o[1]+z|0,o[2]=o[2]+M|0,o[3]=o[3]+D|0},_doFinalize:function(){var r=this._data,n=r.words,e=8*this._nDataBytes,i=8*r.sigBytes;n[i>>>5]|=128<<24-i%32;var o=t.floor(e/4294967296),a=e;n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var f=c[u];c[u]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,r,n,e,i,o,a){var s=t+(r&n|~r&e)+i+a;return(s<>>32-o)+r}function u(t,r,n,e,i,o,a){var s=t+(r&e|n&~e)+i+a;return(s<>>32-o)+r}function f(t,r,n,e,i,o,a){var s=t+(r^n^e)+i+a;return(s<>>32-o)+r}function h(t,r,n,e,i,o,a){var s=t+(n^(r|~e))+i+a;return(s<>>32-o)+r}r.MD5=i._createHelper(s),r.HmacMD5=i._createHmacHelper(s)}(Math),function(){var t=CryptoJS,r=t.lib.WordArray;t.enc.Base64={stringify:function(t){var r=t.words,n=t.sigBytes,e=this._map;t.clamp();for(var i=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s>>6*(3-s)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(t){var n=t.length,e=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o>>6-a%4*2;i[o>>>2]|=(s|c)<<24-o%4*8,o++}return r.create(i,o)}(t,n,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}();};function md5(word){return CryptoJS.MD5(word).toString();} + +//************RSA +function intRSA(){RSA={};!function(exports){var window={},navigator={},dbits;Array.prototype.forEach||(Array.prototype.forEach=function(t,e){var i,r;if(null==this)throw new TypeError(" this is null or not defined");var n=Object(this),s=n.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(arguments.length>1&&(i=e),r=0;r=0;){var o=e*this[t++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=67108863&o}return n}function am2(t,e,i,r,n,s){for(var o=32767&e,h=e>>15;--s>=0;){var a=32767&this[t],u=this[t++]>>15,p=h*a+u*o;n=((a=o*a+((32767&p)<<15)+i[r]+(1073741823&n))>>>30)+(p>>>15)+h*u+(n>>>30),i[r++]=1073741823&a}return n}function am3(t,e,i,r,n,s){for(var o=16383&e,h=e>>14;--s>=0;){var a=16383&this[t],u=this[t++]>>14,p=h*a+u*o;n=((a=o*a+((16383&p)<<14)+i[r]+n)>>28)+(p>>14)+h*u,i[r++]=268435455&a}return n}j_lm&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,dbits=30):j_lm&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function bnpFromInt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function nbv(t){var e=nbi();return e.fromInt(t),e}function bnpFromString(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var r=t.length,n=!1,s=0;--r>=0;){var o=8==i?255&t[r]:intAt(t,r);o<0?"-"==t.charAt(r)&&(n=!0):(n=!1,0==s?this[this.t++]=o:s+i>this.DB?(this[this.t-1]|=(o&(1<>this.DB-s):this[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==i&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function bnToString(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,r=(1<0)for(h>h)>0&&(n=!0,s=int2char(i));o>=0;)h>(h+=this.DB-e)):(i=this[o]>>(h-=e)&r,h<=0&&(h+=this.DB,--o)),i>0&&(n=!0),n&&(s+=int2char(i));return n?s:"0"}function bnNegate(){var t=nbi();return BigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0}function nbits(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function bnpDRShiftTo(t,e){for(var i=t;i=0;--i)e[i+o+1]=this[i]>>n|h,h=(this[i]&s)<=0;--i)e[i]=0;e[o]=h,e.t=this.t+o+1,e.s=this.s,e.clamp()}function bnpRShiftTo(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,s=(1<>r;for(var o=i+1;o>r;r>0&&(e[this.t-i-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()}function bnpMultiplyTo(t,e){var i=this.abs(),r=t.abs(),n=i.t;for(e.t=n+r.t;--n>=0;)e[n]=0;for(n=0;n=0;)t[i]=0;for(i=0;i=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()}function bnpDivRemTo(t,e,i){var r=t.abs();if(!(r.t<=0)){var n=this.abs();if(n.t0?(r.lShiftTo(a,s),n.lShiftTo(a,i)):(r.copyTo(s),n.copyTo(i));var u=s.t,p=s[u-1];if(0!=p){var c=p*(1<1?s[u-2]>>this.F2:0),g=this.FV/c,l=(1<=0&&(i[i.t++]=1,i.subTo(v,i)),BigInteger.ONE.dlShiftTo(u,v),v.subTo(s,s);s.t=0;){var y=i[--d]==p?this.DM:Math.floor(i[d]*g+(i[d-1]+f)*l);if((i[d]+=s.am(0,y,i,b,0,u))0&&i.rShiftTo(a,i),o<0&&BigInteger.ZERO.subTo(i,i)}}}function bnMod(t){var e=nbi();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(BigInteger.ZERO)>0&&t.subTo(e,e),e}function Classic(t){this.m=t}function cConvert(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function cRevert(t){return t}function cReduce(t){t.divRemTo(this.m,null,t)}function cMulTo(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function cSqrTo(t,e){t.squareTo(e),this.reduce(e)}function bnpInvDigit(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}function montRevert(t){var e=nbi();return t.copyTo(e),this.reduce(e),e}function montReduce(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function montSqrTo(t,e){t.squareTo(e),this.reduce(e)}function montMulTo(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function bnpIsEven(){return 0==(this.t>0?1&this[0]:this.s)}function bnpExp(t,e){if(t>4294967295||t<1)return BigInteger.ONE;var i=nbi(),r=nbi(),n=e.convert(this),s=nbits(t)-1;for(n.copyTo(i);--s>=0;)if(e.sqrTo(i,r),(t&1<0)e.mulTo(r,n,i);else{var o=i;i=r,r=o}return e.revert(i)}function bnModPowInt(t,e){var i;return i=t<256||e.isEven()?new Classic(e):new Montgomery(e),this.exp(t,i)}function bnClone(){var t=nbi();return this.copyTo(t),t}function bnIntValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),r=nbv(i),n=nbi(),s=nbi(),o="";for(this.divRemTo(r,n,s);n.signum()>0;)o=(i+s.intValue()).toString(t).substr(1)+o,n.divRemTo(r,n,s);return s.intValue().toString(t)+o}function bnpFromRadix(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),r=Math.pow(e,i),n=!1,s=0,o=0,h=0;h=i&&(this.dMultiply(r),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),n&&BigInteger.ZERO.subTo(this,this)}function bnpFromNumber(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var r=new Array,n=7&t;r.length=1+(t>>3),e.nextBytes(r),n>0?r[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<=0;)r<8?(i=(this[t]&(1<>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e}function bnEquals(t){return 0==this.compareTo(t)}function bnMin(t){return this.compareTo(t)<0?this:t}function bnMax(t){return this.compareTo(t)>0?this:t}function bnpBitwiseTo(t,e,i){var r,n,s=Math.min(t.t,this.t);for(r=0;r>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function bnGetLowestSetBit(){for(var t=0;t=this.t?0!=this.s:0!=(this[e]&1<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[i++]=r:r<-1&&(e[i++]=this.DV+r),e.t=i,e.clamp()}function bnAdd(t){var e=nbi();return this.addTo(t,e),e}function bnSubtract(t){var e=nbi();return this.subTo(t,e),e}function bnMultiply(t){var e=nbi();return this.multiplyTo(t,e),e}function bnSquare(){var t=nbi();return this.squareTo(t),t}function bnDivide(t){var e=nbi();return this.divRemTo(t,e,null),e}function bnRemainder(t){var e=nbi();return this.divRemTo(t,null,e),e}function bnDivideAndRemainder(t){var e=nbi(),i=nbi();return this.divRemTo(t,e,i),new Array(e,i)}function bnpDMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function bnpDAddOffset(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function NullExp(){}function nNop(t){return t}function nMulTo(t,e,i){t.multiplyTo(e,i)}function nSqrTo(t,e){t.squareTo(e)}function bnPow(t){return this.exp(t,new NullExp)}function bnpMultiplyLowerTo(t,e,i){var r,n=Math.min(this.t+t.t,e);for(i.s=0,i.t=n;n>0;)i[--n]=0;for(r=i.t-this.t;n=0;)i[r]=0;for(r=Math.max(e-this.t,0);r2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=nbi();return t.copyTo(e),this.reduce(e),e}function barrettRevert(t){return t}function barrettReduce(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function barrettSqrTo(t,e){t.squareTo(e),this.reduce(e)}function barrettMulTo(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function bnModPow(t,e){var i,r,n=t.bitLength(),s=nbv(1);if(n<=0)return s;i=n<18?1:n<48?3:n<144?4:n<768?5:6,r=n<8?new Classic(e):e.isEven()?new Barrett(e):new Montgomery(e);var o=new Array,h=3,a=i-1,u=(1<1){var p=nbi();for(r.sqrTo(o[1],p);h<=u;)o[h]=nbi(),r.mulTo(p,o[h-2],o[h]),h+=2}var c,g,l=t.t-1,f=!0,d=nbi();for(n=nbits(t[l])-1;l>=0;){for(n>=a?c=t[l]>>n-a&u:(c=(t[l]&(1<0&&(c|=t[l-1]>>this.DB+n-a)),h=i;0==(1&c);)c>>=1,--h;if((n-=h)<0&&(n+=this.DB,--l),f)o[c].copyTo(s),f=!1;else{for(;h>1;)r.sqrTo(s,d),r.sqrTo(d,s),h-=2;h>0?r.sqrTo(s,d):(g=s,s=d,d=g),r.mulTo(d,o[c],s)}for(;l>=0&&0==(t[l]&1<0&&(e.rShiftTo(s,e),i.rShiftTo(s,i));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return s>0&&i.lShiftTo(s,i),i}function bnpModInt(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i}function bnModInverse(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return BigInteger.ZERO;for(var i=t.clone(),r=this.clone(),n=nbv(1),s=nbv(0),o=nbv(0),h=nbv(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),e?(n.isEven()&&s.isEven()||(n.addTo(this,n),s.subTo(t,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),e?(o.isEven()&&h.isEven()||(o.addTo(this,o),h.subTo(t,h)),o.rShiftTo(1,o)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);i.compareTo(r)>=0?(i.subTo(r,i),e&&n.subTo(o,n),s.subTo(h,s)):(r.subTo(i,r),e&&o.subTo(n,o),h.subTo(s,h))}return 0!=r.compareTo(BigInteger.ONE)?BigInteger.ZERO:h.compareTo(t)>=0?h.subtract(t):h.signum()<0?(h.addTo(t,h),h.signum()<0?h.add(t):h):h}Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=nMulTo,NullExp.prototype.sqrTo=nSqrTo,Barrett.prototype.convert=barrettConvert,Barrett.prototype.revert=barrettRevert,Barrett.prototype.reduce=barrettReduce,Barrett.prototype.mulTo=barrettMulTo,Barrett.prototype.sqrTo=barrettSqrTo;var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(t){var e,i=this.abs();if(1==i.t&&i[0]<=lowprimes[lowprimes.length-1]){for(e=0;e>1)>lowprimes.length&&(t=lowprimes.length);for(var n=nbi(),s=0;s=256||rng_pptr>=rng_psize)window.removeEventListener?window.removeEventListener("mousemove",onMouseMoveListener,!1):window.detachEvent&&window.detachEvent("onmousemove",onMouseMoveListener);else try{var e=t.x+t.y;rng_pool[rng_pptr++]=255&e,this.count+=1}catch(t){}};window.addEventListener?window.addEventListener("mousemove",onMouseMoveListener,!1):window.attachEvent&&window.attachEvent("onmousemove",onMouseMoveListener)}function rng_get_byte(){if(null==rng_state){for(rng_state=prng_newstate();rng_pptr=0&&e>0;){var s=t.charCodeAt(n--);s<128?r[--e]=s:s>127&&s<2048?(r[--e]=63&s|128,r[--e]=s>>6|192):(r[--e]=63&s|128,r[--e]=s>>6&63|128,r[--e]=s>>12|224)}if(r[--e]=0,2==i)for(var o=new SecureRandom,h=new Array;e>2;){for(h[0]=0;0==h[0];)o.nextBytes(h);r[--e]=h[0]}else if(0==i)r[--e]=0;else for(;e>2;)r[--e]=255;return r[--e]=i,r[--e]=0,new BigInteger(r)}function RSAKey(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function RSASetPublic(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=parseBigInt(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")}function RSADoPublic(t){return t.modPowInt(this.e,this.n)}function RSAPublicEncrypt(t,e){var i=pkcs1pad2(t,this.n.bitLength()+7>>3,e);if(null==i)return null;var r=this.doPublic(i);if(null==r)return null;var n=r.toString(16);return 0==(1&n.length)?n:"0"+n}function RSAPrivateEncrypt(t,e){var i=pkcs1pad2(t,this.n.bitLength()+7>>3,e);if(null==i)return null;var r=this.doPrivate(i);if(null==r)return null;var n=r.toString(16);return 0==(1&n.length)?n:"0"+n}function pkcs1unpad2(t,e,i){var r=t.toByteArray(),n=0;if(0==i)n=-1;else{for(;n=r.length)return null}for(var s="";++n191&&o<224?(s+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(s+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return s}function RSASetPrivate(t,e,i){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=parseBigInt(t,16),this.e=parseInt(e,16),this.d=parseBigInt(i,16)):console.error("Invalid RSA private key")}function RSASetPrivateEx(t,e,i,r,n,s,o,h){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=parseBigInt(t,16),this.e=parseInt(e,16),this.d=parseBigInt(i,16),this.p=parseBigInt(r,16),this.q=parseBigInt(n,16),this.dmp1=parseBigInt(s,16),this.dmq1=parseBigInt(o,16),this.coeff=parseBigInt(h,16)):console.error("Invalid RSA private key")}function RSAGenerate(t,e){var i=new SecureRandom,r=t>>1;this.e=parseInt(e,16);for(var n=new BigInteger(e,16);;){for(;this.p=new BigInteger(t-r,1,i),0!=this.p.subtract(BigInteger.ONE).gcd(n).compareTo(BigInteger.ONE)||!this.p.isProbablePrime(10););for(;this.q=new BigInteger(r,1,i),0!=this.q.subtract(BigInteger.ONE).gcd(n).compareTo(BigInteger.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(BigInteger.ONE),h=this.q.subtract(BigInteger.ONE),a=o.multiply(h);if(0==a.gcd(n).compareTo(BigInteger.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}}function RSADoPrivate(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)}function RSAPrivateDecrypt(t,e){var i=parseBigInt(t,16),r=this.doPrivate(i);return null==r?null:pkcs1unpad2(r,this.n.bitLength()+7>>3,e)}function RSAPublicDecrypt(t,e){var i=parseBigInt(t,16),r=this.doPublic(i);return null==r?null:pkcs1unpad2(r,this.n.bitLength()+7>>3,e)}SecureRandom.prototype.nextBytes=rng_get_bytes,RSAKey.prototype.doPublic=RSADoPublic,RSAKey.prototype.setPublic=RSASetPublic,RSAKey.prototype.encrypt_public=RSAPublicEncrypt,RSAKey.prototype.encrypt_private=RSAPrivateEncrypt,RSAKey.prototype.doPrivate=RSADoPrivate,RSAKey.prototype.setPrivate=RSASetPrivate,RSAKey.prototype.setPrivateEx=RSASetPrivateEx,RSAKey.prototype.generate=RSAGenerate,RSAKey.prototype.decrypt_private=RSAPrivateDecrypt,RSAKey.prototype.decrypt_public=RSAPublicDecrypt,function(){RSAKey.prototype.generateAsync=function(t,e,i){var r=new SecureRandom,n=t>>1;this.e=parseInt(e,16);var s=new BigInteger(e,16),o=this,h=function(){var e=function(){if(o.p.compareTo(o.q)<=0){var t=o.p;o.p=o.q,o.q=t}var e=o.p.subtract(BigInteger.ONE),r=o.q.subtract(BigInteger.ONE),n=e.multiply(r);0==n.gcd(s).compareTo(BigInteger.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(n),o.dmp1=o.d.mod(e),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout(function(){i()},0)):setTimeout(h,0)},a=function(){o.q=nbi(),o.q.fromNumberAsync(n,1,r,function(){o.q.subtract(BigInteger.ONE).gcda(s,function(t){0==t.compareTo(BigInteger.ONE)&&o.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(a,0)})})},u=function(){o.p=nbi(),o.p.fromNumberAsync(t-n,1,r,function(){o.p.subtract(BigInteger.ONE).gcda(s,function(t){0==t.compareTo(BigInteger.ONE)&&o.p.isProbablePrime(10)?setTimeout(a,0):setTimeout(u,0)})})};setTimeout(u,0)};setTimeout(h,0)};BigInteger.prototype.gcda=function(t,e){var i=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){var n=i;i=r,r=n}var s=i.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)e(i);else{s0&&(i.rShiftTo(o,i),r.rShiftTo(o,r));var h=function(){(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r)),i.signum()>0?setTimeout(h,0):(o>0&&r.lShiftTo(o,r),setTimeout(function(){e(r)},0))};setTimeout(h,10)}};BigInteger.prototype.fromNumberAsync=function(t,e,i,r){if("number"==typeof e)if(t<2)this.fromInt(1);else{this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);var n=this,s=function(){n.dAddOffset(2,0),n.bitLength()>t&&n.subTo(BigInteger.ONE.shiftLeft(t-1),n),n.isProbablePrime(e)?setTimeout(function(){r()},0):setTimeout(s,0)};setTimeout(s,0)}else{var o=new Array,h=7&t;o.length=1+(t>>3),e.nextBytes(o),h>0?o[0]&=(1<>6)+b64map.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=b64map.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=b64map.charAt(i>>2)+b64map.charAt((3&i)<<4));(3&r.length)>0;)r+=b64pad;return r}function b64tohex(t){var e,i,r="",n=0;for(e=0;e>2),i=3&v,n=1):1==n?(r+=int2char(i<<2|v>>4),i=15&v,n=2):2==n?(r+=int2char(i),r+=int2char(v>>2),i=3&v,n=3):(r+=int2char(i<<2|v>>4),r+=int2char(15&v),n=0));return 1==n&&(r+=int2char(i<<2)),r}function b64toBA(t){var e,i=b64tohex(t),r=new Array;for(e=0;2*e15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+i).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},KJUR.asn1.DERAbstractString=function(t){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},JSX.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractTime=function(t){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e){var i=this.zeroPadding,r=this.localDateToUTC(t),n=String(r.getFullYear());return"utc"==e&&(n=n.substr(2,2)),n+i(String(r.getMonth()+1),2)+i(String(r.getDate()),2)+i(String(r.getHours()),2)+i(String(r.getMinutes()),2)+i(String(r.getSeconds()),2)+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setByDateValue=function(t,e,i,r,n,s){var o=new Date(Date.UTC(t,e-1,i,r,n,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},JSX.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractStructured=function(t){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},JSX.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},JSX.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object),KJUR.asn1.DERInteger=function(t){KJUR.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new BigInteger(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):void 0!==t.hex&&this.setValueHex(t.hex))},JSX.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object),KJUR.asn1.DERBitString=function(t){KJUR.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7=2?(s[s.length]=o,o=0,h=0):o<<=4}}if(h)throw"Hex encoding incomplete: 4 bits missing";return s},window.Hex=i}(),function(t){"use strict";var e,i={};i.decode=function(t){var i;if(void 0===e){var r="= \f\n\r\t?\u2028\u2029";for(e=[],i=0;i<64;++i)e["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i)]=i;for(i=0;i=4?(n[n.length]=s>>16,n[n.length]=s>>8&255,n[n.length]=255&s,s=0,o=0):s<<=6}}switch(o){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:n[n.length]=s>>10;break;case 3:n[n.length]=s>>16,n[n.length]=s>>8&255}return n},i.re=/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,i.unarmor=function(t){var e=i.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw"RegExp out of sync";t=e[2]}return i.decode(t)},window.Base64=i}(),function(t){"use strict";var e=function(t,e){var i=document.createElement(t);return i.className=e,i},i=function(t){return document.createTextNode(t)};function r(t,e){t instanceof r?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}function n(t,e,i,r,n){this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=n}r.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw"Requesting byte offset "+t+" on a stream of length "+this.enc.length;return this.enc[t]},r.prototype.hexDigits="0123456789ABCDEF",r.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},r.prototype.hexDump=function(t,e,i){for(var r="",n=t;n191&&n<224?String.fromCharCode((31&n)<<6|63&this.get(r++)):String.fromCharCode((15&n)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return i},r.prototype.parseStringBMP=function(t,e){for(var i="",r=t;r4){i<<=3;var r=this.get(t);if(0===r)i-=8;else for(;r<128;)r<<=1,--i;return"("+i+" bit)"}for(var n=0,s=t;st;--o){for(var h=this.get(o),a=s;a<8;++a)n+=h>>a&1?"1":"0";s=0}}return n},r.prototype.parseOctetString=function(t,e){var i=e-t,r="("+i+" byte) ";i>100&&(e=t+100);for(var n=t;n100&&(r+="…"),r},r.prototype.parseOID=function(t,e){for(var i="",r=0,n=0,s=t;s=31?"bigint":r);r=n=0}}return i},n.prototype.typeName=function(){if(void 0===this.tag)return"unknown";var t=this.tag>>6,e=(this.tag,31&this.tag);switch(t){case 0:switch(e){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString";default:return"Universal_"+e.toString(16)}case 1:return"Application_"+e.toString(16);case 2:return"["+e+"]";case 3:return"Private_"+e.toString(16)}},n.prototype.reSeemsASCII=/^[ -~]+$/,n.prototype.content=function(){if(void 0===this.tag)return null;var t=this.tag>>6,e=31&this.tag,i=this.posContent(),r=Math.abs(this.length);if(0!==t){if(null!==this.sub)return"("+this.sub.length+" elem)";var n=this.stream.parseStringISO(i,i+Math.min(r,100));return this.reSeemsASCII.test(n)?n.substring(0,200)+(n.length>200?"…":""):this.stream.parseOctetString(i,i+r)}switch(e){case 1:return 0===this.stream.get(i)?"false":"true";case 2:return this.stream.parseInteger(i,i+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(i,i+r);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(i,i+r);case 6:return this.stream.parseOID(i,i+r);case 16:case 17:return"("+this.sub.length+" elem)";case 12:return this.stream.parseStringUTF(i,i+r);case 18:case 19:case 20:case 21:case 22:case 26:return this.stream.parseStringISO(i,i+r);case 30:return this.stream.parseStringBMP(i,i+r);case 23:case 24:return this.stream.parseTime(i,i+r)}return null},n.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},n.prototype.print=function(t){if(void 0===t&&(t=""),document.writeln(t+this),null!==this.sub){t+=" ";for(var e=0,i=this.sub.length;e=0&&(e+="+"),e+=this.length,32&this.tag?e+=" (constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var i=0,r=this.sub.length;i",n+="Length: "+this.header+"+",this.length>=0?n+=this.length:n+=-this.length+" (undefined)",32&this.tag?n+="
(constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(n+="
(encapsulates)"),null!==s&&(n+="
Value:
"+s+"","object"==typeof oids&&6==this.tag)){var a=oids[s];a&&(a.d&&(n+="
"+a.d),a.c&&(n+="
"+a.c),a.w&&(n+="
(warning!)"))}h.innerHTML=n,t.appendChild(h);var u=e("div","sub");if(null!==this.sub)for(var p=0,c=this.sub.length;p=o)){var h=e("span",r);h.appendChild(i(n.hexDump(s,o))),t.appendChild(h)}},n.prototype.toHexDOM=function(t){var r=e("span","hex");if(void 0===t&&(t=r),this.head.hexNode=r,this.head.onmouseover=function(){this.hexNode.className="hexCurrent"},this.head.onmouseout=function(){this.hexNode.className="hex"},r.asn1=this,r.onmouseover=function(){var e=!t.selected;e&&(t.selected=this.asn1,this.className="hexCurrent"),this.asn1.fakeHover(e)},r.onmouseout=function(){var e=t.selected==this.asn1;this.asn1.fakeOut(e),e&&(t.selected=null,this.className="hex")},this.toHexDOM_sub(r,"tag",this.stream,this.posStart(),this.posStart()+1),this.toHexDOM_sub(r,this.length>=0?"dlen":"ulen",this.stream,this.posStart()+1,this.posContent()),null===this.sub)r.appendChild(i(this.stream.hexDump(this.posContent(),this.posEnd())));else if(this.sub.length>0){var n=this.sub[0],s=this.sub[this.sub.length-1];this.toHexDOM_sub(r,"intro",this.stream,this.posContent(),n.posStart());for(var o=0,h=this.sub.length;o3)throw"Length over 24 bits not supported at position "+(t.pos-1);if(0===i)return-1;e=0;for(var r=0;r4)return!1;var s=new r(i);if(3==t&&s.get(),s.get()>>6&1)return!1;try{var o=n.decodeLength(s);return s.pos-i.pos+o==e}catch(t){return!1}},n.decode=function(t){t instanceof r||(t=new r(t,0));var e=new r(t),i=t.get(),s=n.decodeLength(t),o=t.pos-e.pos,h=null;if(n.hasContent(i,s,t)){var a=t.pos;if(3==i&&t.get(),h=[],s>=0){for(var u=a+s;t.pos>3)-11;try{var lt="",ct="";if(string.length>maxLength)return lt=string.match(eval("/.{1,"+maxLength+"}/g")),lt.forEach(function(t){var e=k.encrypt_public(t,padding);ct+=e}),output?hex2b64(ct):ct;var t=k.encrypt_public(string,padding),y=output?hex2b64(t):t;return y}catch(t){return!1}},JSEncrypt.prototype.private_decryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11,MAX_DECRYPT_BLOCK=parseInt((k.n.bitLength()+1)/4);try{var ct="";if(string=output?b64tohex(string):string,string.length>maxLength){var lt=string.match(eval("/.{1,"+MAX_DECRYPT_BLOCK+"}/g"));return lt.forEach(function(t){var e=k.decrypt_private(t,padding);ct+=e}),ct}var y=k.decrypt_private(string,padding);return y}catch(t){return!1}},JSEncrypt.prototype.private_encryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11;try{var lt="",ct="";if(string.length>maxLength)return lt=string.match(eval("/.{1,"+maxLength+"}/g")),lt.forEach(function(t){var e=k.encrypt_private(t,padding);ct+=e}),output?hex2b64(ct):ct;var t=k.encrypt_private(string,padding),y=output?hex2b64(t):t;return y}catch(t){return!1}},JSEncrypt.prototype.public_decryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11,MAX_DECRYPT_BLOCK=parseInt((k.n.bitLength()+1)/4);try{var ct="";if(string=output?b64tohex(string):string,string.length>maxLength){var lt=string.match(eval("/.{1,"+MAX_DECRYPT_BLOCK+"}/g"));return lt.forEach(function(t){var e=k.decrypt_public(t,padding);ct+=e}),ct}var y=k.decrypt_public(string,padding);return y}catch(t){return!1}},JSEncrypt.version="2.3.0",exports.JSEncrypt=JSEncrypt}(RSA);};function RSA_Public_Encrypt(t){var public_key="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+8wDPpA9orgXJFrZZXjbETVpdaIlV26Auq46+V3olSimyQBpTfKEKKULcaA+cZ5oXUBZ7o1aDVj7IEadBKOH2eCDUydfJ9PABgLduW668s8jrbqQVM2vzMO6F2sW/23Wc4vas0Rez99OCWgqnEnIvmxQuM4lrKO0wcvX026ic2QIDAQAB";var Crypt=new RSA.JSEncrypt;return Crypt.setPublicKey(public_key),Crypt.public_encryptLong(t,2,true)} + + +//************新抠的算法,加解密 +/* +console.log(Encrypt_Body('channel', '1')) +console.log(Deccrypt_Body('hKHzTY9UTCjkFQQN', '1')) +function a(r,e){var n=r.length,t=n<<2;if(e){var a=r[n-1];if(a<(t-=4)-3||a>t)return null;t=a}for(var o=new Uint8Array(Math.floor(t)),i=0;i>2]>>((3&i)<<3);return o}function s(r,e){var n,t=4-r.length%4;n=e?0==(3&r.length)?r.length>>>2:1+(r.length>>>2):r.length/4+1;for(var a=new Uint32Array(Math.floor(n)),o=(t<<24)+(t<<16)+(t<<8)+t,i=0;i>>2]&=~(255<<((3&i)<<3)),a[i>>>2]|=(255&r[i])<<((3&i)<<3);return a}function u(r,e,n,t,a,o){return(n>>>5^e<<2)+(e>>>3^n<<4)^(r^e)+(o[3&t^a]^n)}function l(r){if(r.length<16){var e=new Uint8Array(16);e.set(r),r=e}return r}function c(r){for(var e=r.length,n=new Uint8Array(Math.floor(3*e+1)),t=0,a=0;a>6,n[t++]=128|63&o;else{if(!(o<55296||o>57343)){if(a+1>18,n[t++]=128|f>>12&63,n[t++]=128|f>>6&63,n[t++]=128|63&f,a++;continue}}throw new Error("Malformed string")}n[t++]=224|o>>12,n[t++]=128|o>>6&63,n[t++]=128|63&o}}return n.subarray(0,t+1)}function p(r){var e=r.length;return 0===e?"":e<32767?function(r,e){for(var n=new Uint16Array(e),t=0,a=0,o=r.length;t>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n[t]=i;break;case 12:case 13:if(!(a>10&1023|55296,n[t]=1023&f|56320;break;default:throw new Error("Bad UTF-8 encoding 0x"+i.toString(16))}}return t>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t[a]=f;break;case 12:case 13:if(!(o>10&1023|55296,t[a]=1023&c|56320;break;default:throw new Error("Bad UTF-8 encoding 0x"+f.toString(16))}if(a>=32766){var s=a+1;n.push(String.fromCharCode.apply(String,t.subarray(0,s))),e-=s,a=-1}}return a>0&&n.push(String.fromCharCode.apply(String,t.subarray(0,a))),n.join("")}(r,e)}function f(r,e){return"string"==typeof r&&(r=c(r)),"string"==typeof e&&(e=c(e)),null==r||0===r.length?r:a(function(r,e){var n,t,a,o,i,f,c=r.length,s=c-1;for(t=r[s],a=0,f=0|Math.floor(6+52/c);f>0;--f){for(o=(a+=2654435769)>>>2&3,i=0;i>>2&3,i=c;i>0;--i)t=r[i-1],n=r[i]-=u(a,n,t,i,o,e);t=r[c],n=r[0]-=u(a,n,t,i,o,e)}return r}(s(r,!0),s(l(e),!0)),!1)}function Encrypt_Body(r,e){return function(r){for(var e="",n=new Uint8Array(r),t=n.byteLength,a=0;a{s.call(this,t,(t,s,r)=>{t?a(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.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}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 a=this.getdata(t);if(a)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,a)=>e(a))})}runScript(t,e){return new Promise(s=>{let a=this.getdata("@chavy_boxjs_userCfgs.httpapi");a=a?a.replace(/\n/g,"").trim():a;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[i,o]=a.split("@"),n={url:`http://${o}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":i,Accept:"*/*"},timeout:r};this.post(n,(t,e,a)=>s(a))}).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),a=!s&&this.fs.existsSync(e);if(!s&&!a)return{};{const a=s?t:e;try{return JSON.parse(this.fs.readFileSync(a))}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),a=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):a?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const a=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of a)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,a)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[a+1])>>0==+e[a+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,a]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,a,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,a,r]=/^@(.*?)\.(.*?)$/.exec(e),i=this.getval(a),o=a?"null"===i?null:i||"{}":"{}";try{const e=JSON.parse(o);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),a)}catch(e){const i={};this.lodash_set(i,r,t),s=this.setval(JSON.stringify(i),a)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return 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=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let s=require("iconv-lite");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:a,statusCode:r,headers:i,rawBody:o}=t,n=s.decode(o,this.encoding);e(null,{status:a,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:a,response:r}=t;e(a,r,r&&s.decode(r.rawBody,this.encoding))})}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let a=require("iconv-lite");this.initGotEnv(t);const{url:r,...i}=t;this.got[s](r,i).then(t=>{const{statusCode:s,statusCode:r,headers:i,rawBody:o}=t,n=a.decode(o,this.encoding);e(null,{status:s,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:s,response:r}=t;e(s,r,r&&a.decode(r.rawBody,this.encoding))})}}time(t,e=null){const s=e?new Date(e):new Date;let a={"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 a)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?a[e]:("00"+a[e]).substr((""+a[e]).length)));return t}queryStr(t){let e="";for(const s in t){let a=t[s];null!=a&&""!==a&&("object"==typeof a&&(a=JSON.stringify(a)),e+=`${s}=${a}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",a="",r){const i=t=>{switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{let e=t.url||t.openUrl||t["open-url"];return{url:e}}case"Loon":{let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}case"Quantumult X":{let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl,a=t["update-pasteboard"]||t.updatePasteboard;return{"open-url":e,"media-url":s,"update-pasteboard":a}}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,a,i(r));break;case"Quantumult X":$notify(e,s,a,i(r));break;case"Node.js":}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),a&&t.push(a),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){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,t.stack)}}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} \ No newline at end of file