cfpilot 0.40.0 → 0.40.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/control.js +1 -1
- package/assets/dataplane.js +1 -1
- package/assets/worker.js +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/assets/control.js
CHANGED
|
@@ -4,7 +4,7 @@ const __sfx=(()=>{const __t=new TextDecoder(),__c=new Map();return b=>{let v=__c
|
|
|
4
4
|
`))),a){let k=""+R+__sfx("IFRyb2phbg==");r.push(k),I.push(k),n.push([__sfx("ICAtIG5hbWU6IA==")+G(k)+"",__sfx("ICAgIHR5cGU6IHRyb2phbg=="),__sfx("ICAgIHBhc3N3b3JkOiA=")+G(t.config.trojanPassword)+"",__sfx("ICAgIHNlcnZlcjog")+h.ip+"",__sfx("ICAgIHBvcnQ6IA==")+C+"",__sfx("ICAgIG5ldHdvcms6IHdz"),__sfx("ICAgIHRsczogdHJ1ZQ=="),__sfx("ICAgIHNuaTog")+t.domain+"",__sfx("ICAgIGNsaWVudC1maW5nZXJwcmludDog")+bn(t.config.clientFingerprint)+"",...l()," ws-opts:",__sfx("ICAgICAgcGF0aDog")+G(t.config.trojanPath)+""," headers:",` Host: ${t.domain}`].join(`
|
|
5
5
|
`))}}});e.push(__sfx("IyBDRlBpbG90IOiHquWKqOeUn+aIkOiuoumYhQ==")),e.push(__sfx("bWl4ZWQtcG9ydDogNzg5MA==")),e.push(__sfx("YWxsb3ctbGFuOiBmYWxzZQ==")),e.push(__sfx("bW9kZTogcnVsZQ==")),e.push(__sfx("bG9nLWxldmVsOiBpbmZv")),e.push(__sfx("dW5pZmllZC1kZWxheTogdHJ1ZQ==")),e.push(__sfx("dGNwLWNvbmN1cnJlbnQ6IHRydWU=")),e.push(""),e.push("dns:"),e.push(__sfx("ICBlbmFibGU6IHRydWU=")),e.push(__sfx("ICBpcHY2OiBmYWxzZQ==")),e.push(__sfx("ICBlbmhhbmNlZC1tb2RlOiBmYWtlLWlw")),e.push(__sfx("ICBmYWtlLWlwLXJhbmdlOiAxOTguMTguMC4xLzE2")),e.push(" default-nameserver:"),e.push(" - 223.5.5.5"),e.push(" - 119.29.29.29"),e.push(" nameserver:"),e.push(" - https://223.5.5.5/dns-query"),e.push(" - https://dns.alidns.com/dns-query"),e.push(" fallback:"),e.push(" - 8.8.4.4"),e.push(" - 1.1.1.1"),e.push(" fallback-filter:"),e.push(__sfx("ICAgIGdlb2lwOiB0cnVl")),e.push(__sfx("ICAgIGdlb2lwLWNvZGU6IENO")),e.push(""),u&&(e.push(" nameserver-policy:"),e.push(` ${G(p)}: ${c?G(c):"https://223.5.5.5/dns-query"}`),e.push(""));let f=sn(t.routeProfile??"",{mainGroup:q,autoGroup:__sfx("6Ieq5Yqo6YCJ5oup")});if(e.push("proxies:"),n.length===0?e.push(" []"):e.push(...n),e.push(""),e.push(__sfx("cHJveHktZ3JvdXBzOg==")),e.push(__sfx("ICAtIG5hbWU6ICJDRlBpbG90Ig==")),e.push(__sfx("ICAgIHR5cGU6IHNlbGVjdA==")),e.push(" proxies:"),e.push(__sfx("ICAgICAgLSAi6Ieq5Yqo6YCJ5oupIg==")),e.push(__sfx("ICAgICAgLSAi5pWF6Zqc6L2s56e7Ig==")),o.v4.length>0&&e.push(__sfx("ICAgICAgLSAi5LyY6YCJSVB2NCI=")),o.v6.length>0&&e.push(__sfx("ICAgICAgLSAi5LyY6YCJSVB2NiI=")),r.length===0)e.push(" []");else for(let d of r)e.push(` - ${G(d)}`);if(r.length>0){e.push(""),e.push(__sfx("ICAtIG5hbWU6ICLoh6rliqjpgInmi6ki")),e.push(__sfx("ICAgIHR5cGU6IHVybC10ZXN0")),e.push(__sfx("ICAgIHVybDogImh0dHA6Ly93d3cuZ3N0YXRpYy5jb20vZ2VuZXJhdGVfMjA0Ig==")),e.push(__sfx("ICAgIGludGVydmFsOiAzMDA=")),e.push(__sfx("ICAgIHRvbGVyYW5jZTogNTA=")),e.push(" proxies:");for(let h of r)e.push(` - ${G(h)}`);e.push(""),e.push(__sfx("ICAtIG5hbWU6ICLmlYXpmpzovaznp7si")),e.push(__sfx("ICAgIHR5cGU6IGZhbGxiYWNr")),e.push(__sfx("ICAgIHVybDogImh0dHA6Ly93d3cuZ3N0YXRpYy5jb20vZ2VuZXJhdGVfMjA0Ig==")),e.push(__sfx("ICAgIGludGVydmFsOiAzMDA=")),e.push(" proxies:");for(let h of r)e.push(` - ${G(h)}`);let d=(h,m)=>{e.push(""),e.push(__sfx("ICAtIG5hbWU6IA==")+G(h)+""),e.push(__sfx("ICAgIHR5cGU6IHNlbGVjdA==")),e.push(" proxies:");for(let A of m)e.push(` - ${G(A)}`)};o.v4.length>0&&d(__sfx("5LyY6YCJSVB2NA=="),o.v4),o.v6.length>0&&d(__sfx("5LyY6YCJSVB2Ng=="),o.v6)}return f.groups.length>0&&(e.push(""),e.push(...f.groups)),e.push(""),e.push("rules:"),f.rules.length>0?(e.push(...f.rules),f.rules.some(d=>d.includes("MATCH,"))||e.push(` - MATCH,${q}`)):e.push(...dt(q)),e.push(""),e.join(`
|
|
6
6
|
`)}function uo(t){let e=[],n=[],r=wt(t.config.subVariants,t.config,Pn),o=r.some(c=>c===__sfx("dmxlc3Mtd3M=")),s=r.includes(__sfx("dHJvamFu")),i=t.config.ech,a=t.config.echHost.trim()||__sfx("Y2xvdWRmbGFyZS1lY2guY29t"),u=()=>i?{ech:{enabled:!0,query_server_name:a}}:{};for(let c of yt(t)){let l=[];c.entries.forEach((f,d)=>{let h=`${c.name} ${Re(f,"vless",d,"")}`;for(let m of Et(f,t)){let A=t.ports.length>1?`:${m}`:"",I=`${h}${A}`,C=""+I+__sfx("IFRyb2phbg==");o&&l.push(I),s&&l.push(C),o&&e.push({type:__sfx("dmxlc3M="),tag:I,server:f.ip,server_port:m,uuid:t.config.uuid,tls:{enabled:!0,server_name:t.domain,insecure:!1,utls:{enabled:!0,fingerprint:t.config.clientFingerprint},...u()},transport:{type:"ws",path:t.config.wsPath,headers:{Host:t.domain}}}),s&&e.push({type:__sfx("dHJvamFu"),tag:C,server:f.ip,server_port:m,password:t.config.trojanPassword,tls:{enabled:!0,server_name:t.domain,insecure:!1,utls:{enabled:!0,fingerprint:t.config.clientFingerprint},...u()},transport:{type:"ws",path:t.config.trojanPath,headers:{Host:t.domain}}})}}),l.length>0&&n.push({tag:c.name,members:l})}e.push({type:"direct",tag:"direct"});for(let c of n)e.push({type:"selector",tag:c.tag,outbounds:c.members,default:c.members[0]});return e.push({type:"selector",tag:__sfx("Q0ZQaWxvdA=="),outbounds:n.length>0?n.map(c=>c.tag):["direct"],default:n.length>0?n[0].tag:"direct"}),JSON.stringify({log:{level:"info",timestamp:!0},dns:{servers:[{tag:"dns-out",address:"https://1.1.1.1/dns-query"},{tag:"local",address:"local"}],rules:[{domain_suffix:wn,server:"local"}]},inbounds:[{type:"mixed",tag:"mixed-in",listen:__sfx("MTI3LjAuMC4x"),listen_port:2080}],outbounds:e,route:{rules:[{ip_is_private:!0,outbound:"direct"},{domain_suffix:wn,outbound:"direct"}],final:__sfx("Q0ZQaWxvdA=="),auto_detect_interface:!0}},null,2)}function lo(t){let e=[],n=wt(t.config.subVariants,t.config);for(let r of yt(t))r.entries.forEach((o,s)=>{let i=Re(o,__sfx("dmxlc3M="),s,r.name);for(let a of Et(o,t)){let u=t.ports.length>1?`:${a}`:"",p=`${i}${u}`,c={...o,port:a};for(let l of n)l===__sfx("dmxlc3Mtd3M=")?e.push(hn(c,t,"ws",`${p} WS`)):l===__sfx("dmxlc3MteGh0dHA=")?e.push(hn(c,t,__sfx("eGh0dHA="),""+p+__sfx("IFhIVFRQ"))):e.push(io(c,t,""+p+__sfx("IFRyb2phbg==")))}});return Yt(e.join(`
|
|
7
|
-
`))}function Tn(t,e){let n=Pt(e.config.subName);switch(t){case __sfx("Y2xhc2g="):return{body:ao(e),contentType:"text/yaml; charset=utf-8",fileName:n};case"singbox":return{body:uo(e),contentType:"application/json; charset=utf-8",fileName:n};default:return{body:lo(e),contentType:"text/plain; charset=utf-8",fileName:n}}}var re,Hr,Br,un,ln,cn,Gr,Kr,jr,$r,to,no,ne,ro,ge,mn,Pn,oo,wn,We=H(()=>{"use strict";$t();J();pt();gt();re=443;Hr=[__sfx("aXDlnLDlnYA="),__sfx("aXAg5Zyw5Z2A"),"ip",__sfx("5Zyw5Z2A"),__sfx("5pyN5Yqh5Zmo"),"server","host"],Br=[__sfx("56uv5Y+j"),"port"],un=[__sfx("5LiL6L296YCf5bqm"),__sfx("6YCf5bqm"),"speed","download"],ln=[__sfx("5bmz5Z2H5bu26L+f"),__sfx("5bu26L+f"),"latency","delay",__sfx("5ZON5bqU5pe26Ze0"),"rtt"],cn=["colo",__sfx("5py65oi/"),__sfx("5pWw5o2u5Lit5b+D"),__sfx("5Zyw5Yy6"),"region"],Gr=[__sfx("5Zu95a62"),"country",__sfx("5Zu95Yir")],Kr=[__sfx("5Z+O5biC"),"city"],jr=["tls",__sfx("5piv5ZCm5pSv5oyBdGxz"),__sfx("5pSv5oyBdGxz")];$r={official:__sfx("5a6Y5pa55LyY6YCJSVA="),domain:__sfx("5LyY6YCJ5Z+f5ZCN"),manual:__sfx("5LyY6YCJ"),api:__sfx("6L+c56iLQVBJ"),csv:__sfx("5rWL6YCfQ1NW")};to=12e4,no=32,ne=new Map,ro="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",ge=2*1024*1024;mn=[__sfx("dmxlc3Mtd3M="),__sfx("dmxlc3MteGh0dHA="),__sfx("dHJvamFu")];Pn=[__sfx("dmxlc3Mtd3M="),__sfx("dHJvamFu")];oo=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;wn=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});function wo(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function vn(t,e){let n=await crypto.subtle.importKey("raw",kn.encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",n,kn.encode(e));return wo(new Uint8Array(r))}async function Qe(t){let e=(await t.get(Je))?.trim();if(e)return he=0,me=null,Oe=e,e;if(!(t instanceof V))return Ze();if(Oe)return Oe;let n=Date.now();if(he===0&&(he=n),n-he<=yo)return me||(me=Ze()),me;let r=Ze();return await t.put(Je,r),he=0,me=r,Oe=r,r}async function Dn(t){let e=Ze();return t instanceof V?await t.put(Je,e):await t.put(Je,e),Oe=e,me=null,he=0,e}async function Ln(t,e={}){let n=e.ttlDays??0,r=Math.floor((e.now??Date.now())/1e3),o=n>0?r+Math.round(n*86400):0,s=Math.floor(Math.random()*36**8).toString(36).padStart(8,"0"),i=`${xt}.${o.toString(36)}.${s}`,a=(await vn(t,i)).slice(0,At);return`${i}.${a}`}async function qe(t,e,n=Date.now()){if(!t||!e)return{ok:!1,reason:"format"};let r=e.split(".");if(r.length!==4||r[0]!==xt)return{ok:!1,reason:"format"};let o=r[1],s=r[2],i=r[3];if(!o||!s||i.length!==At)return{ok:!1,reason:"format"};let a=Number.parseInt(o,36);if(!Number.isFinite(a)||a<0)return{ok:!1,reason:"format"};let u=(await vn(t,`${xt}.${o}.${s}`)).slice(0,At);return W(i,u)?a>0&&Math.floor(n/1e3)>=a?{ok:!1,reason:"expired",exp:a}:{ok:!0,exp:a}:{ok:!1,reason:"signature"}}var Je,xt,At,kn,Ze,Oe,me,he,yo,Tt=H(()=>{"use strict";we();J();Je="SUB_TOKEN_SECRET",xt="v1",At=22,kn=new TextEncoder;Ze=()=>L(32);Oe=null,me=null,he=0,yo=9e4});function Co(t){let e="";for(let n of t)e+=(n<16?"0":"")+n.toString(16);return e}function xo(t){if(!/^[0-9a-f]*$/.test(t)||t.length%2!==0)return null;let e=new Uint8Array(new ArrayBuffer(t.length/2));for(let n=0;n<e.length;n++)e[n]=Number.parseInt(t.slice(n*2,n*2+2),16);return e}async function Kn(t,e,n){let r=xo(e);if(!r)return null;let o=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),"PBKDF2",!1,["deriveBits"]),s=await crypto.subtle.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},o,256);return Co(new Uint8Array(s))}function jn(t){if(t.startsWith(`${Ot}$`)){let[r,o,s,i]=t.split("$");if(r!==Ot||!s||!i)return null;let a=Number.parseInt(o??"",10);return!Number.isFinite(a)||a<1||a>1e6?null:{scheme:"pbkdf2",salt:s,iterations:a,expected:i}}let[e,n]=t.split(":");return!e||!n?null:{scheme:"sha256",salt:e,iterations:0,expected:n}}async function Yn(t,e){return t.scheme==="pbkdf2"?await Kn(e,t.salt,t.iterations):await st(`${t.salt}:${e}`)}async function Ne(t,e){let n=await Kn(t,e,Bn);return n?`${Ot}$${Bn}$${e}$${n}`:`${e}:${await st(`${e}:${t}`)}`}async function Ao(t,e){let n=jn(t);if(!n)return!1;let r=await Yn(n,e);return r?W(r,n.expected):!1}function $e(t){return`/${t.trim().replace(/^\/+/,"")}`}async function zn(t,e,n){let r=await t.get(Ee)??"",o=n&&n.trim()?$e(n):"";if(o)P.panelAbsentSince=0,P.pendingPanelPath=null,r!==o&&(r=o,await t.put(Ee,r));else if(r)P.panelAbsentSince=0,P.pendingPanelPath=null;else if(!(t instanceof V))r=$e(`${Be}-${Ue(6)}`),await t.put(Ee,r);else{let u=Date.now();P.panelAbsentSince===0&&(P.panelAbsentSince=u),u-P.panelAbsentSince<=Hn?(P.pendingPanelPath||(P.pendingPanelPath=$e(`${Be}-${Ue(6)}`)),r=P.pendingPanelPath):(r=$e(`${Be}-${Ue(6)}`),await t.put(Ee,r),P.panelAbsentSince=0,P.pendingPanelPath=null)}let s=await t.get(le)??"",i=null,a=e&&e.trim()?e.trim():"";if(a){if(P.passwordAbsentSince=0,P.pendingPasswordHash=null,P.pendingGeneratedPassword=null,!s||!await Ao(s,a)){let p=L(8);s=await Ne(a,p),await t.put(le,s)}await t.get(ee)&&await t.delete(ee)}else if(s)P.passwordAbsentSince=0,P.pendingPasswordHash=null,P.pendingGeneratedPassword=null;else if(t instanceof V){let u=Date.now();if(P.passwordAbsentSince===0&&(P.passwordAbsentSince=u),u-P.passwordAbsentSince<=Hn)(!P.pendingGeneratedPassword||!P.pendingPasswordHash)&&(P.pendingGeneratedPassword=`cfp-${L(8)}`,P.pendingPasswordHash=await Ne(P.pendingGeneratedPassword,L(8))),s=P.pendingPasswordHash,i=P.pendingGeneratedPassword;else{let p=`cfp-${L(8)}`,c=L(8);s=await Ne(p,c),await t.put(le,s),i=p,await t.put(ee,p),P.passwordAbsentSince=0,P.pendingPasswordHash=null,P.pendingGeneratedPassword=null}}else{let u=`cfp-${L(8)}`,p=L(8);s=await Ne(u,p),await t.put(le,s),i=u,await t.put(ee,u)}return{panelPath:r,passwordHash:s,generatedPassword:i}}async function Vn(t,e){let n=jn(t.passwordHash);if(!n)return{ok:!1,legacy:!1};let r=await Yn(n,e);if(!r)return{ok:!1,legacy:!1};let o=W(r,n.expected);return{ok:o,legacy:o&&n.scheme==="sha256"}}async function Xn(t,e){let n=L(8);await t.put(le,await Ne(e,n))}async function Wn(t){await t.get(ee)&&await t.delete(ee)}function Nt(t){let e=t.headers.get("Cookie")??"",n={};for(let r of e.split(";")){let o=r.indexOf("=");if(o<0)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&(n[s]=decodeURIComponent(i))}return n}function To(t){for(let[e,n]of se)n<=t&&se.delete(e)}async function Zn(t){let e=L(24);await t.put(`${He}${e}`,JSON.stringify({ua:"",t:Date.now()}),Gn);let n=Date.now();return To(n),se.set(e,n+Eo*1e3),e}function Jn(t){return!!Nt(t)[Ie]}async function It(t,e){let n=Nt(e)[Ie];if(!n)return!1;let r=se.get(n);if(r!==void 0){if(r>Date.now())return!0;se.delete(n)}return!!await t.get(`${He}${n}`)}function Qn(t,e=Gn){return`${Ie}=${t}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=${e}`}function qn(){return`${Ie}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`}async function _n(t,e){let n=Nt(e)[Ie];if(!n)return;let r=`${He}${n}`,o=se.has(n);if(se.delete(n),o){await t.delete(r);return}await t.get(r)&&await t.delete(r)}async function $n(t){let e=L(20);return await t.put(`${Me}${e}`,"1",So),e}async function er(t,e,n){if(!e)return!1;let r=await t.get("SCANNER_TOKEN");if(r&&W(r,e))return!0;let o=n?.SCANNER_TOKEN?.trim();return o&&W(o,e)?!0:await t.get(`${Me}${e}`)?(await t.delete(`${Me}${e}`),!0):!1}var Ie,Gn,Eo,Hn,So,Bn,Ot,P,se,kt=H(()=>{"use strict";we();Ce();J();Ie=__sfx("Y2ZwaWxvdF9zZXNz"),Gn=3600*24,Eo=90,Hn=9e4,So=600,Bn=3e4,Ot="pbkdf2",P={panelAbsentSince:0,pendingPanelPath:null,passwordAbsentSince:0,pendingPasswordHash:null,pendingGeneratedPassword:null};se=new Map});function tr(t){return zt(t)}async function vt(t,e){if(Y.config&&Date.now()-Y.configAt<Ro)return Y.config;let n=await Zt(t,e);return Y.config=n,Y.configAt=Date.now(),n}function nr(){Y.config=null,Y.configAt=0}async function Dt(t,e){if(Y.auth&&Date.now()-Y.authAt<Oo)return Y.auth;let n=await zn(t,e.PANEL_PASSWORD,e.PANEL_PATH);return Y.auth=n,Y.authAt=Date.now(),n}function Lt(t){switch((t??"").toLowerCase()){case __sfx("Y2xhc2g="):case"mihomo":case"yaml":return __sfx("Y2xhc2g=");case"singbox":case"sing-box":case"json":return"singbox";case"v2ray":return"v2ray";case"base64":return"base64";default:return"base64"}}function ke(t){let e=String(t??"").trim();if(!e)return e;e=e.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,""),e=e.replace(/[/?#].*$/,"");let n=e.lastIndexOf("@");if(n>=0&&(e=e.slice(n+1)),e.startsWith("[")){let r=e.indexOf("]");r>0&&(e=e.slice(1,r))}else{let r=e.indexOf(":");r>=0&&e.indexOf(":",r+1)<0&&(e=e.slice(0,r))}return e.trim()}function rr(t){let e=(t??"").toLowerCase();return e?e.includes(__sfx("Y2xhc2g="))||e.includes("mihomo")||e.includes(__sfx("ZmxjbGFzaA=="))||e.includes(__sfx("Y2xhc2h4"))||e.includes("stash")?__sfx("Y2xhc2g="):e.includes("sing-box")||e.includes("singbox")?"singbox":e.includes("v2ray")||e.includes("v2rayng")||e.includes("shadowrocket")||e.includes("nekobox")||e.includes("surge")||e.includes("loon")||e.includes("quantumult")?"base64":null:null}var Ro,Oo,Y,et=H(()=>{"use strict";we();Ce();kt();Ro=15e3,Oo=6e4,Y={config:null,configAt:0,auth:null,authAt:0}});function Ut(t){let e=[];if(t.split(/\r?\n/).forEach((s,i)=>{let a=s.trim();if(!a)return;let u=a.replace(/^["']|["']$/g,"").trim();!u||u.startsWith("#")||oe(a)===null&&e.push(i+1)}),e.length===0)return"";let r=e.slice(0,3).map(s=>`\u7B2C ${s} \u884C`).join("\u3001"),o=e.length>3?` \u7B49 ${e.length} \u884C`:"";return __sfx("5omL5Yqo5oyH5a6aIElQIOaciSA=")+e.length+__sfx("IOihjOaXoOazleivhuWIq++8iA==")+r+""+o+")"}function Ft(t,e,n){if(!t){n.push({field:e,message:""+e+__sfx("IOS4jeiDveS4uuepug==")});return}if(!t.startsWith("/")){n.push({field:e,message:""+e+__sfx("IOW/hemhu+S7pSAvIOW8gOWktA==")});return}if(t.length>128){n.push({field:e,message:""+e+__sfx("IOi/h+mVv++8iOacgOWkmiAxMjgg5a2X56ym77yJ")});return}/[\s\u0000-\u001f]/.test(t)&&n.push({field:e,message:""+e+__sfx("IOS4jeiDveWMheWQq+epuuagvOaIluaOp+WItuWtl+espg==")})}function ie(t,e,n,r,o){if(!Number.isFinite(t)){o.push({field:e,message:""+e+__sfx("IOW/hemhu+aYr+aVsOWtlw==")});return}(t<n||t>r)&&o.push({field:e,message:""+e+__sfx("IOW/hemhu+WcqCA=")+n+" ~ "+r+__sfx("IOS5i+mXtO+8iOW9k+WJjSA=")+t+")"})}function tt(t,e,n,r=ko){let o=t.split(/\r?\n|,/).map(s=>s.trim()).filter(Boolean);if(o.length>r){n.push({field:e,message:""+e+__sfx("IOacgOWkmiA=")+r+__sfx("IOadoe+8iOW9k+WJjSA=")+o.length+")"});return}for(let s of o)if(!Io.test(s)){n.push({field:e,message:""+e+__sfx("IOmHjOacieaXoOazleivhuWIq+eahOadoeebru+8mg==")+s.slice(0,40)+""});return}}function sr(t,e,n){let r=t.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>10){n.push({field:e,message:""+e+__sfx("IOacgOWkmiAxMCDmnaHvvIjlvZPliY0g")+r.length+")"});return}for(let o of r)if(!/^https?:\/\/\S+$/i.test(o)){n.push({field:e,message:""+e+__sfx("IOW/hemhu+aYryBodHRwKHMpIOWcsOWdgO+8mg==")+o.slice(0,40)+""});return}}function Do(t,e,n){let r=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(r.length>or){n.push({field:e,message:""+e+__sfx("IOacgOWkmiA=")+or+__sfx("IOadoe+8iOW9k+WJjSA=")+r.length+")"});return}let o=Ut(t);o&&n.push({field:e,message:o})}function ve(t){let e=[],n=o=>Object.prototype.hasOwnProperty.call(t,o);n("wsPath")&&Ft(String(t.wsPath??""),"wsPath",e),n(__sfx("dHJvamFuUGF0aA=="))&&Ft(String(t.trojanPath??""),__sfx("dHJvamFuUGF0aA=="),e),n(__sfx("eGh0dHBQYXRo"))&&Ft(String(t.xhttpPath??""),__sfx("eGh0dHBQYXRo"),e);let r=["wsPath",__sfx("dHJvamFuUGF0aA=="),__sfx("eGh0dHBQYXRo")].filter(o=>n(o)).map(o=>`${o}=${String(t[o]??"")}`);if(r.length>=2){let o=r.map(s=>s.slice(s.indexOf("=")+1));new Set(o).size!==o.length&&e.push({field:"paths",message:__sfx("d3NQYXRoIC8gdHJvamFuUGF0aCAvIHhodHRwUGF0aCDkuI3og73ph43lpI0=")})}if(n("proxyMode")){let o=String(t.proxyMode??"");["only","global","fallback","smart"].includes(o)||e.push({field:"proxyMode",message:__sfx("cHJveHlNb2RlIOWAvOaXoOaViA==")})}if(n("clientFingerprint")){let o=String(t.clientFingerprint??"").trim();(o.length>32||!/^[A-Za-z0-9._-]*$/.test(o))&&e.push({field:"clientFingerprint",message:__sfx("Y2xpZW50RmluZ2VycHJpbnQg5YC85peg5pWI")})}if(n("subDomain")){let o=String(t.subDomain??"").trim();o&&(!No.test(o)||o.includes("/"))&&e.push({field:"subDomain",message:__sfx("c3ViRG9tYWluIOW/hemhu+aYr+WQiOazleS4u+acuuWQje+8iOS4jeWQq+WNj+iuruS4jui3r+W+hO+8iQ==")})}if(n(__sfx("cHJveHlJcA=="))&&tt(String(t.proxyIp??""),__sfx("cHJveHlJcA=="),e),n(__sfx("c29ja3M1"))&&tt(String(t.socks5??""),__sfx("c29ja3M1"),e),n("httpProxy")&&tt(String(t.httpProxy??""),"httpProxy",e),n("relayPool")&&tt(String(t.relayPool??""),"relayPool",e,vo),n("officialCount")&&ie(Number(t.officialCount),"officialCount",1,200,e),n("domainCount")&&ie(Number(t.domainCount),"domainCount",1,200,e),n("maxNodes")&&ie(Number(t.maxNodes),"maxNodes",0,500,e),n("dls")&&ie(Number(t.dls),"dls",0,1e3,e),n("maxLatency")&&ie(Number(t.maxLatency),"maxLatency",0,1e4,e),n("dataBudgetMB")&&ie(Number(t.dataBudgetMB),"dataBudgetMB",0,102400,e),n("subTokenTtlDays")&&ie(Number(t.subTokenTtlDays),"subTokenTtlDays",0,3650,e),n("subPorts")){let o=String(t.subPorts??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>6?e.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg5pyA5aSaIDYg5Liq56uv5Y+j")}):s.every(i=>/^\d{1,5}$/.test(i)&&Number(i)>=1&&Number(i)<=65535)||e.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg6YeM5q+P5Liq56uv5Y+j6YO95b+F6aG75pivIDF+NjU1MzUg55qE5pWw5a2X")})}}if(n("subName")){let o=String(t.subName??"");o.length>40&&e.push({field:"subName",message:__sfx("c3ViTmFtZSDmnIDlpJogNDAg5a2X56ym")}),/[\u0000-\u001f]/.test(o)&&e.push({field:"subName",message:__sfx("c3ViTmFtZSDkuI3og73ljIXlkKvmjqfliLblrZfnrKY=")})}if(n("addApi")&&sr(String(t.addApi??""),"addApi",e),n("addCsv")&&sr(String(t.addCsv??""),"addCsv",e),n("add")&&Do(String(t.add??""),"add",e),n("uuid")){let o=String(t.uuid??"").trim();o&&!/^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/.test(o)&&e.push({field:"uuid",message:__sfx("dXVpZCDlv4XpobvmmK/moIflh4YgVVVJRO+8iDM2IOS9je+8jOWPr+W4pui/nuWtl+espu+8iQ==")})}if(n("poolCountries")){let o=String(t.poolCountries??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>30?e.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDmnIDlpJogMzAg5Liq5Zu95a62L+WcsOWMug==")}):s.every(i=>/^[A-Za-z]{2,3}$/.test(i))||e.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDlj6rog73mmK8gMn4zIOS9jeWtl+avjeS7o+eggQ==")})}}if(n("udpDnsEndpoint")){let o=String(t.udpDnsEndpoint??"").trim();o&&!/^https:\/\/\S+$/i.test(o)&&e.push({field:"udpDnsEndpoint",message:__sfx("dWRwRG5zRW5kcG9pbnQg5b+F6aG75pivIGh0dHBzIOWcsOWdgA==")})}return e}function De(t){return t.length===0?"":t.length===1?t[0].message:"有 "+t.length+__sfx("IOmhuemFjee9ruS4jeWQiOazle+8mg==")+t.map(e=>e.message).join("\uFF1B")+""}var No,Io,ko,vo,or,ir=H(()=>{"use strict";We();No=/^(?=.{1,253}$)([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;Io=/^(?:(?:socks5|socks|socks5h|http|https):\/\/)?(?:[^\s@/]+@)?(?:\[[0-9a-fA-F:]+\]|[A-Za-z0-9._-]+)(?::\d{1,5})?$/;ko=20,vo=200,or=2e3});function lr(t,e=Date.now()){let n={};for(let o of ur){let s=t[o];s!==void 0&&(n[o]=s)}let r=Lo.map(o=>({field:o.field,reason:o.reason}));for(let o of[__sfx("c29ja3M1"),"httpProxy"]){let s=String(t[o]??"");if(!s){n[o]="";continue}if(s.includes("@")){r.push({field:o,reason:__sfx("5ZCr55So5oi35ZCNL+WPo+S7pO+8jOmcgOaJi+W3pemHjeaWsOWhq+WGmQ==")});continue}n[o]=s}return{schemaVersion:1,exportedAt:new Date(e).toISOString(),config:n,omitted:r}}function cr(t){let e=new Set([...ur.map(String),__sfx("c29ja3M1"),"httpProxy"]),n={};for(let[r,o]of Object.entries(t))e.has(r)&&(n[r]=o);return n}function ar(t){if(t==null)return"\uFF08\u7A7A\uFF09";if(typeof t=="string"){let e=t.replace(/\s+/g," ").trim();return e.length>60?`${e.slice(0,60)}\u2026`:e||"\uFF08\u7A7A\uFF09"}return String(t)}function fr(t,e){let n=[];for(let[r,o]of Object.entries(e)){let s=t[r];String(s)!==String(o)&&n.push({field:r,from:ar(s),to:ar(o)})}return n}var ur,Lo,pr=H(()=>{"use strict";ur=["poolOfficial","officialCount","poolDomain","domainCount","poolManual","poolCountries","add","dls","maxLatency","maxNodes",__sfx("cHJveHlJcA=="),"relayPool","useBuiltinRelay","proxyMode","nat64","concurrentDial","dataBudgetMB","resolvePreferred","aggressiveRedial",__sfx("ZW5hYmxlVHJvamFu"),__sfx("ZW5hYmxlWGh0dHA="),"subProtocol","subTransport","subVariants","subName","subPorts","clientFingerprint","ech","echHost","echDns","tlsFragment","tlsFragmentSize","tlsFragmentDelay","subToken","subTokenTtlDays","unlockProbe","udpDns","udpDnsEndpoint"],Lo=[{field:"uuid",reason:__sfx("5YWl56uZ5Yet5o2u")},{field:__sfx("dHJvamFuUGFzc3dvcmQ="),reason:__sfx("5YWl56uZ5Yet5o2u")},{field:"wsPath",reason:__sfx("5a6e5L6L5qCH6K+G77yI6K6i6ZiF6ZO+5o6l6YeM5Y+v6KeB77yM5a+85Ye65Y2z5pq06Zyy5YWl5Y+j77yJ")},{field:__sfx("dHJvamFuUGF0aA=="),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:__sfx("eGh0dHBQYXRo"),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"subDomain",reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"addApi",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")},{field:"addCsv",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")}]});function gr(){return new Response(JSON.stringify({build:Mt,version:Ht,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var Mt,Ht,dr,Bt=H(()=>{"use strict";Mt="c84de11-a5e14406",Ht=__sfx("MC40MC4w"),dr=__sfx("L19fY2ZwX3ZlcnNpb24=")});var br={};Er(br,{API_PREFIX:()=>Kt,getScannerToken:()=>Ko,handleApi:()=>jo,pruneLoginFailures:()=>hr});function Ho(t){return t.headers.get("CF-Connecting-IP")??t.headers.get("x-forwarded-for")?.split(",")[0]?.trim()??"unknown"}function Bo(t,e){let n=be.get(t);return n?e>=n.resetAt?(be.delete(t),!1):n.count>=Uo:!1}function hr(t,e,n=Mo){if(!(t.size<n)){for(let[r,o]of t)e>=o.resetAt&&t.delete(r);for(;t.size>=n;){let r=t.keys().next().value;if(r===void 0)break;t.delete(r)}}}function Go(t,e){let n=be.get(t);if(!n||e>=n.resetAt){hr(be,e),be.set(t,{count:1,resetAt:e+mr});return}n.count+=1}function x(t,e=200,n={}){return new Response(JSON.stringify(t),{status:e,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...n}})}function S(t,e){return x({ok:!1,error:t},e)}async function Ko(t,e){let n=await t.get(lt);if(n)return n;if(typeof e.SCANNER_TOKEN=="string"&&e.SCANNER_TOKEN)return e.SCANNER_TOKEN;let r=L(24);return await t.put(lt,r),r}async function jo(t,e,n){if(!e.pathname.startsWith(Kt))return null;let{store:r,env:o,config:s,auth:i}=n,a=e.pathname.slice(Kt.length)||"/",u=t.method.toUpperCase();if(a==="/session"&&u==="GET"){let c=await It(r,t);return x(c?{ok:!0,authenticated:c,panelPath:i.panelPath}:{ok:!0,authenticated:c,hasSessionCookie:Jn(t)})}if(a==="/login"&&u==="POST"){let c="";try{let m=await t.json();c=String(m.password??"")}catch{return S(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(!c)return S(__sfx("6K+36L6T5YWl5a+G56CB"),400);let l=Ho(t),f=Date.now();if(Bo(l,f))return new Response(JSON.stringify({ok:!1,error:__sfx("5bCd6K+V6L+H5LqO6aKR57mB77yM6K+356iN5ZCO5YaN6K+V")}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(mr/1e3))}});let d=await Vn(i,c);if(!d.ok)return Go(l,f),S(__sfx("5a+G56CB6ZSZ6K+v"),401);be.delete(l),d.legacy&&await Xn(r,c).catch(()=>{}),await Wn(r).catch(()=>{});let h=await Zn(r);return x({ok:!0},200,{"Set-Cookie":Qn(h)})}if(a==="/logout"&&u==="POST")return await _n(r,t),x({ok:!0},200,{"Set-Cookie":qn()});if(a==="/preferred-ips"&&u==="POST"){let c=t.headers.get("Authorization")??"",l=c.startsWith("Bearer ")?c.slice(7).trim():c.trim();if(!await er(r,l,o))return S(__sfx("VG9rZW4g5qCh6aqM5aSx6LSl"),401);let d;try{d=await t.json()}catch{return S(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}let m=(Array.isArray(d.ips)?d.ips.map(g=>String(g)):[]).map(g=>g.trim()).filter(g=>g.length>0),{valid:A,invalid:I}=yn(m),C=d.mode==="append",B=d.target==="relay",R=g=>g.split("#")[0].trim().replace(/^\[([^\]]+)\]:(\d+)$/,"$1:$2");if(A.length===0&&m.length>0)return S(__sfx("5rKh5pyJ5Y+v6K+G5Yir55qE5p2h55uu77yI5bey6Lez6L+HIA==")+I+" \u884C\uFF09",400);if(B){if(A.length===0)return S(__sfx("5rKh5pyJ5Y+v6K+G5Yir55qE5Y+N5Luj5YWl5Y+j"),400);let g=Fo,w=A.slice(0,g),O=A.length-w.length,F=(s.relayPool??"").split(`
|
|
7
|
+
`))}function Tn(t,e){let n=Pt(e.config.subName);switch(t){case __sfx("Y2xhc2g="):return{body:ao(e),contentType:"text/yaml; charset=utf-8",fileName:n};case"singbox":return{body:uo(e),contentType:"application/json; charset=utf-8",fileName:n};default:return{body:lo(e),contentType:"text/plain; charset=utf-8",fileName:n}}}var re,Hr,Br,un,ln,cn,Gr,Kr,jr,$r,to,no,ne,ro,ge,mn,Pn,oo,wn,We=H(()=>{"use strict";$t();J();pt();gt();re=443;Hr=[__sfx("aXDlnLDlnYA="),__sfx("aXAg5Zyw5Z2A"),"ip",__sfx("5Zyw5Z2A"),__sfx("5pyN5Yqh5Zmo"),"server","host"],Br=[__sfx("56uv5Y+j"),"port"],un=[__sfx("5LiL6L296YCf5bqm"),__sfx("6YCf5bqm"),"speed","download"],ln=[__sfx("5bmz5Z2H5bu26L+f"),__sfx("5bu26L+f"),"latency","delay",__sfx("5ZON5bqU5pe26Ze0"),"rtt"],cn=["colo",__sfx("5py65oi/"),__sfx("5pWw5o2u5Lit5b+D"),__sfx("5Zyw5Yy6"),"region"],Gr=[__sfx("5Zu95a62"),"country",__sfx("5Zu95Yir")],Kr=[__sfx("5Z+O5biC"),"city"],jr=["tls",__sfx("5piv5ZCm5pSv5oyBdGxz"),__sfx("5pSv5oyBdGxz")];$r={official:__sfx("5a6Y5pa55LyY6YCJSVA="),domain:__sfx("5LyY6YCJ5Z+f5ZCN"),manual:__sfx("5LyY6YCJ"),api:__sfx("6L+c56iLQVBJ"),csv:__sfx("5rWL6YCfQ1NW")};to=12e4,no=32,ne=new Map,ro="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",ge=2*1024*1024;mn=[__sfx("dmxlc3Mtd3M="),__sfx("dmxlc3MteGh0dHA="),__sfx("dHJvamFu")];Pn=[__sfx("dmxlc3Mtd3M="),__sfx("dHJvamFu")];oo=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;wn=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});function wo(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function vn(t,e){let n=await crypto.subtle.importKey("raw",kn.encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",n,kn.encode(e));return wo(new Uint8Array(r))}async function Qe(t){let e=(await t.get(Je))?.trim();if(e)return he=0,me=null,Oe=e,e;if(!(t instanceof V))return Ze();if(Oe)return Oe;let n=Date.now();if(he===0&&(he=n),n-he<=yo)return me||(me=Ze()),me;let r=Ze();return await t.put(Je,r),he=0,me=r,Oe=r,r}async function Dn(t){let e=Ze();return t instanceof V?await t.put(Je,e):await t.put(Je,e),Oe=e,me=null,he=0,e}async function Ln(t,e={}){let n=e.ttlDays??0,r=Math.floor((e.now??Date.now())/1e3),o=n>0?r+Math.round(n*86400):0,s=Math.floor(Math.random()*36**8).toString(36).padStart(8,"0"),i=`${xt}.${o.toString(36)}.${s}`,a=(await vn(t,i)).slice(0,At);return`${i}.${a}`}async function qe(t,e,n=Date.now()){if(!t||!e)return{ok:!1,reason:"format"};let r=e.split(".");if(r.length!==4||r[0]!==xt)return{ok:!1,reason:"format"};let o=r[1],s=r[2],i=r[3];if(!o||!s||i.length!==At)return{ok:!1,reason:"format"};let a=Number.parseInt(o,36);if(!Number.isFinite(a)||a<0)return{ok:!1,reason:"format"};let u=(await vn(t,`${xt}.${o}.${s}`)).slice(0,At);return W(i,u)?a>0&&Math.floor(n/1e3)>=a?{ok:!1,reason:"expired",exp:a}:{ok:!0,exp:a}:{ok:!1,reason:"signature"}}var Je,xt,At,kn,Ze,Oe,me,he,yo,Tt=H(()=>{"use strict";we();J();Je="SUB_TOKEN_SECRET",xt="v1",At=22,kn=new TextEncoder;Ze=()=>L(32);Oe=null,me=null,he=0,yo=9e4});function Co(t){let e="";for(let n of t)e+=(n<16?"0":"")+n.toString(16);return e}function xo(t){if(!/^[0-9a-f]*$/.test(t)||t.length%2!==0)return null;let e=new Uint8Array(new ArrayBuffer(t.length/2));for(let n=0;n<e.length;n++)e[n]=Number.parseInt(t.slice(n*2,n*2+2),16);return e}async function Kn(t,e,n){let r=xo(e);if(!r)return null;let o=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),"PBKDF2",!1,["deriveBits"]),s=await crypto.subtle.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},o,256);return Co(new Uint8Array(s))}function jn(t){if(t.startsWith(`${Ot}$`)){let[r,o,s,i]=t.split("$");if(r!==Ot||!s||!i)return null;let a=Number.parseInt(o??"",10);return!Number.isFinite(a)||a<1||a>1e6?null:{scheme:"pbkdf2",salt:s,iterations:a,expected:i}}let[e,n]=t.split(":");return!e||!n?null:{scheme:"sha256",salt:e,iterations:0,expected:n}}async function Yn(t,e){return t.scheme==="pbkdf2"?await Kn(e,t.salt,t.iterations):await st(`${t.salt}:${e}`)}async function Ne(t,e){let n=await Kn(t,e,Bn);return n?`${Ot}$${Bn}$${e}$${n}`:`${e}:${await st(`${e}:${t}`)}`}async function Ao(t,e){let n=jn(t);if(!n)return!1;let r=await Yn(n,e);return r?W(r,n.expected):!1}function $e(t){return`/${t.trim().replace(/^\/+/,"")}`}async function zn(t,e,n){let r=await t.get(Ee)??"",o=n&&n.trim()?$e(n):"";if(o)P.panelAbsentSince=0,P.pendingPanelPath=null,r!==o&&(r=o,await t.put(Ee,r));else if(r)P.panelAbsentSince=0,P.pendingPanelPath=null;else if(!(t instanceof V))r=$e(`${Be}-${Ue(6)}`),await t.put(Ee,r);else{let u=Date.now();P.panelAbsentSince===0&&(P.panelAbsentSince=u),u-P.panelAbsentSince<=Hn?(P.pendingPanelPath||(P.pendingPanelPath=$e(`${Be}-${Ue(6)}`)),r=P.pendingPanelPath):(r=$e(`${Be}-${Ue(6)}`),await t.put(Ee,r),P.panelAbsentSince=0,P.pendingPanelPath=null)}let s=await t.get(le)??"",i=null,a=e&&e.trim()?e.trim():"";if(a){if(P.passwordAbsentSince=0,P.pendingPasswordHash=null,P.pendingGeneratedPassword=null,!s||!await Ao(s,a)){let p=L(8);s=await Ne(a,p),await t.put(le,s)}await t.get(ee)&&await t.delete(ee)}else if(s)P.passwordAbsentSince=0,P.pendingPasswordHash=null,P.pendingGeneratedPassword=null;else if(t instanceof V){let u=Date.now();if(P.passwordAbsentSince===0&&(P.passwordAbsentSince=u),u-P.passwordAbsentSince<=Hn)(!P.pendingGeneratedPassword||!P.pendingPasswordHash)&&(P.pendingGeneratedPassword=`cfp-${L(8)}`,P.pendingPasswordHash=await Ne(P.pendingGeneratedPassword,L(8))),s=P.pendingPasswordHash,i=P.pendingGeneratedPassword;else{let p=`cfp-${L(8)}`,c=L(8);s=await Ne(p,c),await t.put(le,s),i=p,await t.put(ee,p),P.passwordAbsentSince=0,P.pendingPasswordHash=null,P.pendingGeneratedPassword=null}}else{let u=`cfp-${L(8)}`,p=L(8);s=await Ne(u,p),await t.put(le,s),i=u,await t.put(ee,u)}return{panelPath:r,passwordHash:s,generatedPassword:i}}async function Vn(t,e){let n=jn(t.passwordHash);if(!n)return{ok:!1,legacy:!1};let r=await Yn(n,e);if(!r)return{ok:!1,legacy:!1};let o=W(r,n.expected);return{ok:o,legacy:o&&n.scheme==="sha256"}}async function Xn(t,e){let n=L(8);await t.put(le,await Ne(e,n))}async function Wn(t){await t.get(ee)&&await t.delete(ee)}function Nt(t){let e=t.headers.get("Cookie")??"",n={};for(let r of e.split(";")){let o=r.indexOf("=");if(o<0)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&(n[s]=decodeURIComponent(i))}return n}function To(t){for(let[e,n]of se)n<=t&&se.delete(e)}async function Zn(t){let e=L(24);await t.put(`${He}${e}`,JSON.stringify({ua:"",t:Date.now()}),Gn);let n=Date.now();return To(n),se.set(e,n+Eo*1e3),e}function Jn(t){return!!Nt(t)[Ie]}async function It(t,e){let n=Nt(e)[Ie];if(!n)return!1;let r=se.get(n);if(r!==void 0){if(r>Date.now())return!0;se.delete(n)}return!!await t.get(`${He}${n}`)}function Qn(t,e=Gn){return`${Ie}=${t}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=${e}`}function qn(){return`${Ie}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`}async function _n(t,e){let n=Nt(e)[Ie];if(!n)return;let r=`${He}${n}`,o=se.has(n);if(se.delete(n),o){await t.delete(r);return}await t.get(r)&&await t.delete(r)}async function $n(t){let e=L(20);return await t.put(`${Me}${e}`,"1",So),e}async function er(t,e,n){if(!e)return!1;let r=await t.get("SCANNER_TOKEN");if(r&&W(r,e))return!0;let o=n?.SCANNER_TOKEN?.trim();return o&&W(o,e)?!0:await t.get(`${Me}${e}`)?(await t.delete(`${Me}${e}`),!0):!1}var Ie,Gn,Eo,Hn,So,Bn,Ot,P,se,kt=H(()=>{"use strict";we();Ce();J();Ie=__sfx("Y2ZwaWxvdF9zZXNz"),Gn=3600*24,Eo=90,Hn=9e4,So=600,Bn=3e4,Ot="pbkdf2",P={panelAbsentSince:0,pendingPanelPath:null,passwordAbsentSince:0,pendingPasswordHash:null,pendingGeneratedPassword:null};se=new Map});function tr(t){return zt(t)}async function vt(t,e){if(Y.config&&Date.now()-Y.configAt<Ro)return Y.config;let n=await Zt(t,e);return Y.config=n,Y.configAt=Date.now(),n}function nr(){Y.config=null,Y.configAt=0}async function Dt(t,e){if(Y.auth&&Date.now()-Y.authAt<Oo)return Y.auth;let n=await zn(t,e.PANEL_PASSWORD,e.PANEL_PATH);return Y.auth=n,Y.authAt=Date.now(),n}function Lt(t){switch((t??"").toLowerCase()){case __sfx("Y2xhc2g="):case"mihomo":case"yaml":return __sfx("Y2xhc2g=");case"singbox":case"sing-box":case"json":return"singbox";case"v2ray":return"v2ray";case"base64":return"base64";default:return"base64"}}function ke(t){let e=String(t??"").trim();if(!e)return e;e=e.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,""),e=e.replace(/[/?#].*$/,"");let n=e.lastIndexOf("@");if(n>=0&&(e=e.slice(n+1)),e.startsWith("[")){let r=e.indexOf("]");r>0&&(e=e.slice(1,r))}else{let r=e.indexOf(":");r>=0&&e.indexOf(":",r+1)<0&&(e=e.slice(0,r))}return e.trim()}function rr(t){let e=(t??"").toLowerCase();return e?e.includes(__sfx("Y2xhc2g="))||e.includes("mihomo")||e.includes(__sfx("ZmxjbGFzaA=="))||e.includes(__sfx("Y2xhc2h4"))||e.includes("stash")?__sfx("Y2xhc2g="):e.includes("sing-box")||e.includes("singbox")?"singbox":e.includes("v2ray")||e.includes("v2rayng")||e.includes("shadowrocket")||e.includes("nekobox")||e.includes("surge")||e.includes("loon")||e.includes("quantumult")?"base64":null:null}var Ro,Oo,Y,et=H(()=>{"use strict";we();Ce();kt();Ro=15e3,Oo=6e4,Y={config:null,configAt:0,auth:null,authAt:0}});function Ut(t){let e=[];if(t.split(/\r?\n/).forEach((s,i)=>{let a=s.trim();if(!a)return;let u=a.replace(/^["']|["']$/g,"").trim();!u||u.startsWith("#")||oe(a)===null&&e.push(i+1)}),e.length===0)return"";let r=e.slice(0,3).map(s=>`\u7B2C ${s} \u884C`).join("\u3001"),o=e.length>3?` \u7B49 ${e.length} \u884C`:"";return __sfx("5omL5Yqo5oyH5a6aIElQIOaciSA=")+e.length+__sfx("IOihjOaXoOazleivhuWIq++8iA==")+r+""+o+")"}function Ft(t,e,n){if(!t){n.push({field:e,message:""+e+__sfx("IOS4jeiDveS4uuepug==")});return}if(!t.startsWith("/")){n.push({field:e,message:""+e+__sfx("IOW/hemhu+S7pSAvIOW8gOWktA==")});return}if(t.length>128){n.push({field:e,message:""+e+__sfx("IOi/h+mVv++8iOacgOWkmiAxMjgg5a2X56ym77yJ")});return}/[\s\u0000-\u001f]/.test(t)&&n.push({field:e,message:""+e+__sfx("IOS4jeiDveWMheWQq+epuuagvOaIluaOp+WItuWtl+espg==")})}function ie(t,e,n,r,o){if(!Number.isFinite(t)){o.push({field:e,message:""+e+__sfx("IOW/hemhu+aYr+aVsOWtlw==")});return}(t<n||t>r)&&o.push({field:e,message:""+e+__sfx("IOW/hemhu+WcqCA=")+n+" ~ "+r+__sfx("IOS5i+mXtO+8iOW9k+WJjSA=")+t+")"})}function tt(t,e,n,r=ko){let o=t.split(/\r?\n|,/).map(s=>s.trim()).filter(Boolean);if(o.length>r){n.push({field:e,message:""+e+__sfx("IOacgOWkmiA=")+r+__sfx("IOadoe+8iOW9k+WJjSA=")+o.length+")"});return}for(let s of o)if(!Io.test(s)){n.push({field:e,message:""+e+__sfx("IOmHjOacieaXoOazleivhuWIq+eahOadoeebru+8mg==")+s.slice(0,40)+""});return}}function sr(t,e,n){let r=t.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>10){n.push({field:e,message:""+e+__sfx("IOacgOWkmiAxMCDmnaHvvIjlvZPliY0g")+r.length+")"});return}for(let o of r)if(!/^https?:\/\/\S+$/i.test(o)){n.push({field:e,message:""+e+__sfx("IOW/hemhu+aYryBodHRwKHMpIOWcsOWdgO+8mg==")+o.slice(0,40)+""});return}}function Do(t,e,n){let r=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(r.length>or){n.push({field:e,message:""+e+__sfx("IOacgOWkmiA=")+or+__sfx("IOadoe+8iOW9k+WJjSA=")+r.length+")"});return}let o=Ut(t);o&&n.push({field:e,message:o})}function ve(t){let e=[],n=o=>Object.prototype.hasOwnProperty.call(t,o);n("wsPath")&&Ft(String(t.wsPath??""),"wsPath",e),n(__sfx("dHJvamFuUGF0aA=="))&&Ft(String(t.trojanPath??""),__sfx("dHJvamFuUGF0aA=="),e),n(__sfx("eGh0dHBQYXRo"))&&Ft(String(t.xhttpPath??""),__sfx("eGh0dHBQYXRo"),e);let r=["wsPath",__sfx("dHJvamFuUGF0aA=="),__sfx("eGh0dHBQYXRo")].filter(o=>n(o)).map(o=>`${o}=${String(t[o]??"")}`);if(r.length>=2){let o=r.map(s=>s.slice(s.indexOf("=")+1));new Set(o).size!==o.length&&e.push({field:"paths",message:__sfx("d3NQYXRoIC8gdHJvamFuUGF0aCAvIHhodHRwUGF0aCDkuI3og73ph43lpI0=")})}if(n("proxyMode")){let o=String(t.proxyMode??"");["only","global","fallback","smart"].includes(o)||e.push({field:"proxyMode",message:__sfx("cHJveHlNb2RlIOWAvOaXoOaViA==")})}if(n("clientFingerprint")){let o=String(t.clientFingerprint??"").trim();(o.length>32||!/^[A-Za-z0-9._-]*$/.test(o))&&e.push({field:"clientFingerprint",message:__sfx("Y2xpZW50RmluZ2VycHJpbnQg5YC85peg5pWI")})}if(n("subDomain")){let o=String(t.subDomain??"").trim();o&&(!No.test(o)||o.includes("/"))&&e.push({field:"subDomain",message:__sfx("c3ViRG9tYWluIOW/hemhu+aYr+WQiOazleS4u+acuuWQje+8iOS4jeWQq+WNj+iuruS4jui3r+W+hO+8iQ==")})}if(n(__sfx("cHJveHlJcA=="))&&tt(String(t.proxyIp??""),__sfx("cHJveHlJcA=="),e),n(__sfx("c29ja3M1"))&&tt(String(t.socks5??""),__sfx("c29ja3M1"),e),n("httpProxy")&&tt(String(t.httpProxy??""),"httpProxy",e),n("relayPool")&&tt(String(t.relayPool??""),"relayPool",e,vo),n("officialCount")&&ie(Number(t.officialCount),"officialCount",1,200,e),n("domainCount")&&ie(Number(t.domainCount),"domainCount",1,200,e),n("maxNodes")&&ie(Number(t.maxNodes),"maxNodes",0,500,e),n("dls")&&ie(Number(t.dls),"dls",0,1e3,e),n("maxLatency")&&ie(Number(t.maxLatency),"maxLatency",0,1e4,e),n("dataBudgetMB")&&ie(Number(t.dataBudgetMB),"dataBudgetMB",0,102400,e),n("subTokenTtlDays")&&ie(Number(t.subTokenTtlDays),"subTokenTtlDays",0,3650,e),n("subPorts")){let o=String(t.subPorts??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>6?e.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg5pyA5aSaIDYg5Liq56uv5Y+j")}):s.every(i=>/^\d{1,5}$/.test(i)&&Number(i)>=1&&Number(i)<=65535)||e.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg6YeM5q+P5Liq56uv5Y+j6YO95b+F6aG75pivIDF+NjU1MzUg55qE5pWw5a2X")})}}if(n("subName")){let o=String(t.subName??"");o.length>40&&e.push({field:"subName",message:__sfx("c3ViTmFtZSDmnIDlpJogNDAg5a2X56ym")}),/[\u0000-\u001f]/.test(o)&&e.push({field:"subName",message:__sfx("c3ViTmFtZSDkuI3og73ljIXlkKvmjqfliLblrZfnrKY=")})}if(n("addApi")&&sr(String(t.addApi??""),"addApi",e),n("addCsv")&&sr(String(t.addCsv??""),"addCsv",e),n("add")&&Do(String(t.add??""),"add",e),n("uuid")){let o=String(t.uuid??"").trim();o&&!/^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/.test(o)&&e.push({field:"uuid",message:__sfx("dXVpZCDlv4XpobvmmK/moIflh4YgVVVJRO+8iDM2IOS9je+8jOWPr+W4pui/nuWtl+espu+8iQ==")})}if(n("poolCountries")){let o=String(t.poolCountries??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>30?e.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDmnIDlpJogMzAg5Liq5Zu95a62L+WcsOWMug==")}):s.every(i=>/^[A-Za-z]{2,3}$/.test(i))||e.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDlj6rog73mmK8gMn4zIOS9jeWtl+avjeS7o+eggQ==")})}}if(n("udpDnsEndpoint")){let o=String(t.udpDnsEndpoint??"").trim();o&&!/^https:\/\/\S+$/i.test(o)&&e.push({field:"udpDnsEndpoint",message:__sfx("dWRwRG5zRW5kcG9pbnQg5b+F6aG75pivIGh0dHBzIOWcsOWdgA==")})}return e}function De(t){return t.length===0?"":t.length===1?t[0].message:"有 "+t.length+__sfx("IOmhuemFjee9ruS4jeWQiOazle+8mg==")+t.map(e=>e.message).join("\uFF1B")+""}var No,Io,ko,vo,or,ir=H(()=>{"use strict";We();No=/^(?=.{1,253}$)([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;Io=/^(?:(?:socks5|socks|socks5h|http|https):\/\/)?(?:[^\s@/]+@)?(?:\[[0-9a-fA-F:]+\]|[A-Za-z0-9._-]+)(?::\d{1,5})?$/;ko=20,vo=200,or=2e3});function lr(t,e=Date.now()){let n={};for(let o of ur){let s=t[o];s!==void 0&&(n[o]=s)}let r=Lo.map(o=>({field:o.field,reason:o.reason}));for(let o of[__sfx("c29ja3M1"),"httpProxy"]){let s=String(t[o]??"");if(!s){n[o]="";continue}if(s.includes("@")){r.push({field:o,reason:__sfx("5ZCr55So5oi35ZCNL+WPo+S7pO+8jOmcgOaJi+W3pemHjeaWsOWhq+WGmQ==")});continue}n[o]=s}return{schemaVersion:1,exportedAt:new Date(e).toISOString(),config:n,omitted:r}}function cr(t){let e=new Set([...ur.map(String),__sfx("c29ja3M1"),"httpProxy"]),n={};for(let[r,o]of Object.entries(t))e.has(r)&&(n[r]=o);return n}function ar(t){if(t==null)return"\uFF08\u7A7A\uFF09";if(typeof t=="string"){let e=t.replace(/\s+/g," ").trim();return e.length>60?`${e.slice(0,60)}\u2026`:e||"\uFF08\u7A7A\uFF09"}return String(t)}function fr(t,e){let n=[];for(let[r,o]of Object.entries(e)){let s=t[r];String(s)!==String(o)&&n.push({field:r,from:ar(s),to:ar(o)})}return n}var ur,Lo,pr=H(()=>{"use strict";ur=["poolOfficial","officialCount","poolDomain","domainCount","poolManual","poolCountries","add","dls","maxLatency","maxNodes",__sfx("cHJveHlJcA=="),"relayPool","useBuiltinRelay","proxyMode","nat64","concurrentDial","dataBudgetMB","resolvePreferred","aggressiveRedial",__sfx("ZW5hYmxlVHJvamFu"),__sfx("ZW5hYmxlWGh0dHA="),"subProtocol","subTransport","subVariants","subName","subPorts","clientFingerprint","ech","echHost","echDns","tlsFragment","tlsFragmentSize","tlsFragmentDelay","subToken","subTokenTtlDays","unlockProbe","udpDns","udpDnsEndpoint"],Lo=[{field:"uuid",reason:__sfx("5YWl56uZ5Yet5o2u")},{field:__sfx("dHJvamFuUGFzc3dvcmQ="),reason:__sfx("5YWl56uZ5Yet5o2u")},{field:"wsPath",reason:__sfx("5a6e5L6L5qCH6K+G77yI6K6i6ZiF6ZO+5o6l6YeM5Y+v6KeB77yM5a+85Ye65Y2z5pq06Zyy5YWl5Y+j77yJ")},{field:__sfx("dHJvamFuUGF0aA=="),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:__sfx("eGh0dHBQYXRo"),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"subDomain",reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"addApi",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")},{field:"addCsv",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")}]});function gr(){return new Response(JSON.stringify({build:Mt,version:Ht,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var Mt,Ht,dr,Bt=H(()=>{"use strict";Mt="8b1bb07-a5e14406",Ht=__sfx("MC40MC4y"),dr=__sfx("L19fY2ZwX3ZlcnNpb24=")});var br={};Er(br,{API_PREFIX:()=>Kt,getScannerToken:()=>Ko,handleApi:()=>jo,pruneLoginFailures:()=>hr});function Ho(t){return t.headers.get("CF-Connecting-IP")??t.headers.get("x-forwarded-for")?.split(",")[0]?.trim()??"unknown"}function Bo(t,e){let n=be.get(t);return n?e>=n.resetAt?(be.delete(t),!1):n.count>=Uo:!1}function hr(t,e,n=Mo){if(!(t.size<n)){for(let[r,o]of t)e>=o.resetAt&&t.delete(r);for(;t.size>=n;){let r=t.keys().next().value;if(r===void 0)break;t.delete(r)}}}function Go(t,e){let n=be.get(t);if(!n||e>=n.resetAt){hr(be,e),be.set(t,{count:1,resetAt:e+mr});return}n.count+=1}function x(t,e=200,n={}){return new Response(JSON.stringify(t),{status:e,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...n}})}function S(t,e){return x({ok:!1,error:t},e)}async function Ko(t,e){let n=await t.get(lt);if(n)return n;if(typeof e.SCANNER_TOKEN=="string"&&e.SCANNER_TOKEN)return e.SCANNER_TOKEN;let r=L(24);return await t.put(lt,r),r}async function jo(t,e,n){if(!e.pathname.startsWith(Kt))return null;let{store:r,env:o,config:s,auth:i}=n,a=e.pathname.slice(Kt.length)||"/",u=t.method.toUpperCase();if(a==="/session"&&u==="GET"){let c=await It(r,t);return x(c?{ok:!0,authenticated:c,panelPath:i.panelPath}:{ok:!0,authenticated:c,hasSessionCookie:Jn(t)})}if(a==="/login"&&u==="POST"){let c="";try{let m=await t.json();c=String(m.password??"")}catch{return S(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(!c)return S(__sfx("6K+36L6T5YWl5a+G56CB"),400);let l=Ho(t),f=Date.now();if(Bo(l,f))return new Response(JSON.stringify({ok:!1,error:__sfx("5bCd6K+V6L+H5LqO6aKR57mB77yM6K+356iN5ZCO5YaN6K+V")}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(mr/1e3))}});let d=await Vn(i,c);if(!d.ok)return Go(l,f),S(__sfx("5a+G56CB6ZSZ6K+v"),401);be.delete(l),d.legacy&&await Xn(r,c).catch(()=>{}),await Wn(r).catch(()=>{});let h=await Zn(r);return x({ok:!0},200,{"Set-Cookie":Qn(h)})}if(a==="/logout"&&u==="POST")return await _n(r,t),x({ok:!0},200,{"Set-Cookie":qn()});if(a==="/preferred-ips"&&u==="POST"){let c=t.headers.get("Authorization")??"",l=c.startsWith("Bearer ")?c.slice(7).trim():c.trim();if(!await er(r,l,o))return S(__sfx("VG9rZW4g5qCh6aqM5aSx6LSl"),401);let d;try{d=await t.json()}catch{return S(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}let m=(Array.isArray(d.ips)?d.ips.map(g=>String(g)):[]).map(g=>g.trim()).filter(g=>g.length>0),{valid:A,invalid:I}=yn(m),C=d.mode==="append",B=d.target==="relay",R=g=>g.split("#")[0].trim().replace(/^\[([^\]]+)\]:(\d+)$/,"$1:$2");if(A.length===0&&m.length>0)return S(__sfx("5rKh5pyJ5Y+v6K+G5Yir55qE5p2h55uu77yI5bey6Lez6L+HIA==")+I+" \u884C\uFF09",400);if(B){if(A.length===0)return S(__sfx("5rKh5pyJ5Y+v6K+G5Yir55qE5Y+N5Luj5YWl5Y+j"),400);let g=Fo,w=A.slice(0,g),O=A.length-w.length,F=(s.relayPool??"").split(`
|
|
8
8
|
`).map(N=>N.trim()).filter(Boolean),z,Le=w.length;if(C){let N=new Set(F.map(R)),v=w.filter(Fe=>{let U=R(Fe);return N.has(U)?!1:(N.add(U),!0)});Le=v.length,z=[...F,...v]}else z=w;z.length>g&&(z=z.slice(0,g));let nt=await Jt(r,s);return await fe(r,ce(nt,{relayPool:z.join(`
|
|
9
9
|
`)})),n.onConfigChanged(),x({ok:!0,target:"relay",mode:C?"append":"replace",count:w.length,added:Le,invalid:I,overLimit:O,limit:g})}let k=await r.get(Z),E,b=A.length;if(C){let g=(k??"").split(`
|
|
10
10
|
`).map(F=>F.trim()).filter(F=>F.length>0),w=new Set(g.map(R)),O=A.filter(F=>{let z=R(F);return w.has(z)?!1:(w.add(z),!0)});b=O.length,E=[...g,...O].join(`
|
package/assets/dataplane.js
CHANGED
|
@@ -2,4 +2,4 @@ const __sfx=(()=>{const __t=new TextDecoder(),__c=new Map();return b=>{let v=__c
|
|
|
2
2
|
`);await i.write(new TextEncoder().encode(u));let c=Date.now()+ht,d="";for(;;){let P=s.peek(),T=po(P);if(T>=0){d=new TextDecoder().decode(P.subarray(0,T)),s.skip(T+4);break}if(P.byteLength>8192)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTlpLTotoXov4cgODE5MiDlrZfoioI="));let p=c-Date.now();if(p<=0)throw new Error(__sfx("SFRUUCDku6PnkIbmj6HmiYvotoXml7bvvIg=")+ht+__sfx("bXMg5peg5ZON5bqU77yJ"));let R=null,A;try{A=await Promise.race([s.fill(),new Promise(k=>{R=setTimeout(()=>k("timeout"),p)})])}finally{R&&clearTimeout(R)}if(A==="timeout")throw new Error(__sfx("SFRUUCDku6PnkIbmj6HmiYvotoXml7bvvIg=")+ht+__sfx("bXMg5peg5ZON5bqU77yJ"));if(A===null)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTkuI3lrozmlbTvvIjov57mjqXooqvmj5DliY3lhbPpl63vvIk="))}let g=d.split(`\r
|
|
3
3
|
`)[0]??"",y=/^HTTP\/1\.[01]\s+(\d{3})/.exec(g);if(!y)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTpnZ7ms5U="));if(y[1]!=="200")throw new re(__sfx("SFRUUCDku6PnkIYgQ09OTkVDVCDlpLHotKXvvJo=")+y[1]+"");return s.release()}finally{try{i.releaseLock()}catch{}}}var fo,ht,kn=S(()=>{"use strict";G();Pe();Fe();fo=[13,10,13,10];ht=6e3});function yt(e){if(e instanceof le||(e instanceof Error?e.message:String(e)).includes(Dn))return!0;let n=e instanceof Error?e.cause:void 0;return n!==void 0&&n!==e&&yt(n)}function In(e){let t=e.split(".");if(t.length!==4)return null;let n=0;for(let o of t){if(!/^\d{1,3}$/.test(o))return null;let r=Number(o);if(r>255)return null;n=n*256+r}return n>>>0}function Ke(e){let t=In(e);if(t===null)return null;for(let[n,o,r,s]of mo){let i=In(n);if(i===null)continue;let a=o===0?0:4294967295<<32-o>>>0;if((t&a)===(i&a))return{kind:r,reason:s}}return null}function gt(e){let t=e[6]??0,n=e[7]??0;return`${t>>>8}.${t&255}.${n>>>8}.${n&255}`}function ho(e){let t=(e.split("%")[0]??"").toLowerCase();if(!t.includes(":"))return null;let n=we(t);if(!n)return null;let o=n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&n[4]===0;if(o&&n[5]===65535)return Ke(gt(n))??null;if(o&&n[5]===0&&n[6]===0&&(n[7]===0||n[7]===1))return n[7]===1?{kind:"loopback",reason:__sfx("546v5Zue5Zyw5Z2A")}:{kind:"unspecified",reason:__sfx("5pyq5oyH5a6a5Zyw5Z2A")};if(o&&n[5]===0)return Ke(gt(n))??null;if(n[0]===100&&n[1]===65435&&n[2]===0&&n[3]===0&&n[4]===0&&n[5]===0){let s=Ke(gt(n));if(s)return s}let r=n[0]??0;return(r&65024)===64512?{kind:"ula",reason:__sfx("SVB2NiDllK/kuIDmnKzlnLDlnLDlnYA=")}:(r&65472)===65152?{kind:"link-local",reason:__sfx("SVB2NiDpk77ot6/mnKzlnLDlnLDlnYA=")}:(r&65280)===65280?{kind:"multicast",reason:__sfx("SVB2NiDnu4Tmkq3lnLDlnYA=")}:null}function bt(e){let t=e.trim().toLowerCase().replace(/^\[|\]$/g,"");if(t==="")return null;if(t.includes(":"))return ho(t);if(/^\d{1,3}(?:\.\d{1,3}){3}$/.test(t))return Ke(t);if(t==="localhost"||t.endsWith(".localhost"))return{kind:"loopback",reason:__sfx("546v5Zue5Li75py65ZCN")};for(let n of go)if(t.endsWith(n))return{kind:"internal-name",reason:__sfx("5YaF572R5Z+f5ZCN5ZCO57yA")};return null}var Dn,On,le,mo,go,wt=S(()=>{"use strict";G();Dn=__sfx("55uu5qCH5Zyw5Z2A6KKr562W55Wl5oum5oiq"),On={kind:"ipv6-direct-unsupported",reason:__sfx("55u06L+e5LiO5Y+N5Luj6YCa6YGT5LiN5pSv5oyBIElQdjYg55uu5qCH77yM5Y+v5pS555So6JC95Zyw5Luj55CG6L2s5Y+R")},le=class extends Error{kind;constructor(t,n){super(`${Dn}\uFF1A${t}\uFF08${n.reason}\uFF09`),this.name="TargetBlockedError",this.kind=n.kind}};mo=[[__sfx("MC4wLjAuMA=="),8,"unspecified",__sfx("5pyq5oyH5a6a5Zyw5Z2A")],[__sfx("MTAuMC4wLjA="),8,"private",__sfx("56eB5pyJ572R5q61")],[__sfx("MTAwLjY0LjAuMA=="),10,"cgnat",__sfx("6L+Q6JCl5ZWG57qnIE5BVCDnvZHmrrU=")],[__sfx("MTI3LjAuMC4w"),8,"loopback",__sfx("546v5Zue5Zyw5Z2A")],[__sfx("MTY5LjI1NC4wLjA="),16,"link-local",__sfx("6ZO+6Lev5pys5ZywIC8g5LqR5YWD5pWw5o2u5Zyw5Z2A")],[__sfx("MTcyLjE2LjAuMA=="),12,"private",__sfx("56eB5pyJ572R5q61")],[__sfx("MTkyLjE2OC4wLjA="),16,"private",__sfx("56eB5pyJ572R5q61")],[__sfx("MjI0LjAuMC4w"),4,"multicast",__sfx("57uE5pKt5Zyw5Z2A")],[__sfx("MjQwLjAuMC4w"),4,"reserved",__sfx("5L+d55WZ5Zyw5Z2A")]];go=[".local",".internal"]});function Mn(e){return e.ips.length>0?bo:wo}function Po(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)?!0:e.includes(":")&&/^[0-9a-fA-F:.]+$/.test(e)}function Pt(e,t){let n=e.trim(),o=/^\[([^\]]+)\](?::(\d+))?$/.exec(n);if(o)return{host:o[1],port:Number(o[2]??t)};if(n.includes(":")&&n.split(":").length>2)return{host:n,port:t};let r=n.lastIndexOf(":");if(r<0)return{host:n,port:t};let s=n.slice(0,r),i=Number(n.slice(r+1));return s?{host:s,port:Number.isInteger(i)&&i>0?i:t}:{host:n,port:t}}async function So(e,t,n,o=Ln){try{let r=`${e}?name=${encodeURIComponent(t)}&type=${n}`,s=await fetch(r,{headers:{accept:"application/dns-json"},signal:AbortSignal.timeout(o)});if(!s.ok)return null;let i=await s.json();if(!i||i.Status!==0&&i.Status!==3)return null;if(!Array.isArray(i.Answer))return[];let a=n==="TXT"?16:n==="A"?1:28;return i.Answer.filter(l=>l.type===a).map(l=>String(l.data))}catch{return null}}async function Un(e,t,n={}){for(let o of yo){if(n.deadline!==void 0&&Date.now()>=n.deadline)break;let r=n.timeoutMs??Ln,s=n.deadline!==void 0?n.deadline-Date.now():Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")],i=Math.max(50,Math.min(r,s)),a=await So(o,e,t,i);if(a!==null)return a}return[]}function Eo(e,t){let n=[],o=String(e).replace(/^"|"$/g,"").replace(/\\010/g,",").replace(/\\n/g,",").trim();if(!o||o===Nn)return n;let r=o.split(/[,;\s]+/).filter(Boolean);if(r.length===0)return n;for(let s of r){let i=s.trim();if(!i)continue;let{host:a,port:l}=Pt(i,t);if(!H(a)&&!te(a))return[];n.push({hostname:a,port:l})}return n}async function Ge(e,t,n={}){let o=e.trim();if(!o)return[];if(Po(o))return[{hostname:o,port:t}];let r=`${o}:${t}`,s=Z.get(r);if(s&&Date.now()-s.at<Mn(s))return Z.delete(r),Z.set(r,s),s.ips;let i=xt.get(r);if(i)return i;let a=Ao(o,t,r,n).finally(()=>{xt.delete(r)});return xt.set(r,a),a}async function Ao(e,t,n,o){let r=[],[s,i]=await Promise.all([o.skipTxt?Promise.resolve([]):Un(e,"TXT",o),Un(e,"A",o)]);if(!o.skipTxt)for(let c of s){let d=Eo(c,t);if(d.length>0){r.push(...d);break}if(String(c).replace(/^"|"$/g,"").replace(/\\010/g,",").trim()===Nn)break}if(r.length===0)for(let c of i)H(c)&&r.push({hostname:c,port:t});let a=[],l=new Set;for(let c of r){let d=`${c.hostname}:${c.port}`;l.has(d)||(l.add(d),a.push(c))}let u=Date.now();for(let[c,d]of Z)u-d.at>=Mn(d)&&Z.delete(c);for(;Z.size>=xo;){let c=Z.keys().next().value;if(c===void 0)break;Z.delete(c)}return Z.set(n,{at:u,ips:a}),a}var Nn,yo,Ln,bo,wo,xo,Z,xt,Xe=S(()=>{"use strict";G();Nn=__sfx("QGVkZ2V0dW5uZWw="),yo=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve","https://dns.alidns.com/resolve","https://doh.pub/dns-query"],Ln=4e3,bo=300*1e3,wo=30*1e3,xo=1e3,Z=new Map,xt=new Map});var At={};Ie(At,{[__sfx("QlVJTFRJTl9SRUxBWV9ET01BSU5T")]:()=>Hn,[__sfx("Q09MT19UT19DT1VOVFJZ")]:()=>Bn,[__sfx("UkVMQVlfQkFUQ0hfU0laRQ==")]:()=>We,[__sfx("UkVMQVlfRE9NQUlOX0xJTUlU")]:()=>Et,clearRelayCache:()=>vo,collectRelayEndpoints:()=>Se,coloToCountry:()=>To,relayCacheSize:()=>ko,resolveRelayEntry:()=>St,selectRelayDomains:()=>Gn});function To(e){let t=String(e??"").toUpperCase();return t?Bn[t]??(/^[A-Z]{2}$/.test(t)?t:"US"):"US"}function Co(e){for(let[t,n]of J)e-n.at>=Kn&&J.delete(t);for(;J.size>=Ro;){let t=J.keys().next().value;if(t===void 0)break;J.delete(t)}}async function St(e,t=443,n=Fn,o={}){let r=e.trim();if(!r)return[];let s=`${r}:${t}:${n}`,i=J.get(s);if(i&&Date.now()-i.at<Kn)return i.ips;let a=r,l=t,u=(r.match(/:/g)??[]).length;if(u===1){let d=/^(.*):(\d{1,5})$/.exec(r);d&&(a=d[1],l=Number(d[2]))}else if(u>1&&r.startsWith("[")){let d=/^\[([^\]]+)\]:(\d{1,5})$/.exec(r);d&&(a=d[1],l=Number(d[2]))}let c=[];if(H(a)||te(a))c=[{ip:a,port:Number.isInteger(l)&&l>0?l:t,label:r}];else try{c=(await Ge(a,l,{skipTxt:o.skipTxt,deadline:o.deadline,timeoutMs:o.timeoutMs})).slice(0,n).map(f=>({ip:f.hostname,port:f.port,label:`${a} \u2192 ${f.hostname}`}))}catch{c=[]}if(c.length>0){let d=Date.now();Co(d),J.set(s,{at:d,ips:c})}return c}function Gn(e=Et,t=Hn){return t.slice(0,Math.max(0,e))}async function Se(e={}){let t=e.perDomain??Fn,n=[],o=new Set,r=f=>{for(let g of f){let y=`${g.ip}:${g.port}`;o.has(y)||(o.add(y),n.push(g))}},s=(e.userEntries??"").trim(),i=s?s.split(/[\n,;]+/).map(f=>f.trim()).filter(Boolean):[],a=e.domainLimit??Et,l=e.useBuiltin!==!1?Gn(a):[],u=await Promise.all([...i.map(f=>St(f,443,t,{deadline:e.deadline,timeoutMs:e.timeoutMs})),...l.map(f=>St(f,443,t,{skipTxt:!0,deadline:e.deadline,timeoutMs:e.timeoutMs}))]);for(let f=0;f<i.length;f++)r(u[f]);let c=u.slice(i.length),d=c.reduce((f,g)=>Math.max(f,g.length),0);for(let f=0;f<d;f++)for(let g of c)f<g.length&&r([g[f]]);return n}function vo(){J.clear()}function ko(){return J.size}var Hn,Bn,Fn,We,Et,Kn,Ro,J,Ee=S(()=>{"use strict";G();Xe();Hn=[__sfx("MTkyLjE4LjEzNi4yNTU="),__sfx("MTI4LjEyMS4zMS4yNTI="),__sfx("MTI5LjE1OS4zNy4xMzY="),__sfx("MjMuMTQ0LjEyLjYz"),__sfx("MjE2LjM2Ljg2LjYy"),__sfx("NDUuMTMzLjExNy4xODU="),__sfx("MzguODQuMjAxLjIyOA=="),__sfx("MTA5LjEyMC4xNDIuMjE5"),__sfx("NDUuMTQwLjE2Ny40Mw=="),__sfx("NS4yNTMuMTg4LjEzOQ=="),__sfx("MjE2LjM2LjgyLjMx"),__sfx("MTY3LjI1My45Ni45MA=="),__sfx("MTk0Ljg3LjYyLjEzOQ=="),__sfx("MjMuMTQ0LjIwLjE4NA=="),__sfx("MTI4LjEyMS4zMS41OA=="),__sfx("MTA0LjIzOC4xNTQuNzc="),__sfx("MzguMjQ0LjE1MC4xMTM="),__sfx("MTU1LjI0OC4xODEuMTg5"),__sfx("MjE2LjM2LjgyLjE0MQ=="),__sfx("NjQuMTgxLjI1NS4yMTU="),__sfx("MzEuMjUuMjM5LjY2"),__sfx("NDUuNzYuMjQ2LjE5Mg=="),__sfx("MjMuOTUuMTEzLjYx"),__sfx("MTUxLjI0NC4yMDEuMjA3")],Bn={[__sfx("SEtH")]:"HK",[__sfx("U1lE")]:"AU",[__sfx("TUVM")]:"AU",[__sfx("Qk5F")]:"AU",[__sfx("UEVS")]:"AU",[__sfx("QURM")]:"AU",[__sfx("Q0JS")]:"AU",[__sfx("U0lO")]:"SG",[__sfx("TlJU")]:"JP",[__sfx("SE5E")]:"JP",[__sfx("S0lY")]:"JP",[__sfx("VFlP")]:"JP",[__sfx("T1NB")]:"JP",[__sfx("TkdP")]:"JP",[__sfx("Q1RT")]:"JP",[__sfx("RlVL")]:"JP",[__sfx("T0tB")]:"JP",[__sfx("SUNO")]:"KR",[__sfx("U0VM")]:"KR",[__sfx("UFVT")]:"KR",[__sfx("RlJB")]:"DE",[__sfx("TVVD")]:"DE",[__sfx("RFVT")]:"DE",[__sfx("QkVS")]:"DE",[__sfx("SEFN")]:"DE",[__sfx("U1RS")]:"DE",[__sfx("VklF")]:"DE",[__sfx("WlJI")]:"DE",[__sfx("Q0RH")]:"FR",[__sfx("TUFE")]:"ES",[__sfx("TVhQ")]:"IT",[__sfx("RkNP")]:"IT",[__sfx("UFJH")]:"CZ",[__sfx("V0FX")]:"PL",[__sfx("QVJO")]:"SE",[__sfx("QU1T")]:"NL",[__sfx("SEVM")]:"FI",[__sfx("TEhS")]:"GB",[__sfx("TEdX")]:"GB",[__sfx("TUFO")]:"GB",[__sfx("RURJ")]:"GB",[__sfx("TEFY")]:"US",[__sfx("U0pD")]:"US",[__sfx("U0ZP")]:"US",[__sfx("U0VB")]:"US",[__sfx("UERY")]:"US",[__sfx("U0FO")]:"US",[__sfx("TEFT")]:"US",[__sfx("UEhY")]:"US",[__sfx("U0xD")]:"US",[__sfx("REVO")]:"US",[__sfx("REZX")]:"US",[__sfx("SUFI")]:"US",[__sfx("QVVT")]:"US",[__sfx("T1JE")]:"US",[__sfx("TVNQ")]:"US",[__sfx("RFRX")]:"US",[__sfx("U1RM")]:"US",[__sfx("TUNJ")]:"US",[__sfx("QVRM")]:"US",[__sfx("TUlB")]:"US",[__sfx("TUNP")]:"US",[__sfx("Qk5B")]:"US",[__sfx("Q0xU")]:"US",[__sfx("SUFE")]:"US",[__sfx("Qk9T")]:"US",[__sfx("RVdS")]:"US",[__sfx("SkZL")]:"US",[__sfx("UEhM")]:"US",[__sfx("WVla")]:"CA",[__sfx("WVZS")]:"CA",[__sfx("WVVM")]:"CA",[__sfx("TUVY")]:"MX",[__sfx("R1JV")]:"BR",[__sfx("VFBF")]:"TW",[__sfx("S0hI")]:"TW",[__sfx("VFNB")]:"TW",[__sfx("Uk1R")]:"TW"};Fn=4,We=6,Et=6,Kn=30*1e3,Ro=256,J=new Map});function Tt(e){let t=e.split(".");if(t.length!==4)return null;let n=0;for(let o of t){if(!/^\d{1,3}$/.test(o))return null;let r=Number(o);if(r>255)return null;n=n*256+r}return n>>>0}function Xn(e){return e.map(([t,n])=>{let o=Tt(t)??0,r=n===0?0:4294967295<<32-n>>>0;return[(o&r)>>>0,r]})}function Wn(e){let t=Tt(e);if(t===null)return!1;for(let[n,o]of Lo)if((t&o)>>>0===n)return!0;return!1}function se(e){let t=Tt(e);if(t===null)return!1;for(let[n,o]of No)if((t&o)>>>0===n)return!0;return!1}function zn(e){let t=[],n=new Set,o=c=>{let d=`${c.source}|${c.host}|${c.port}`;n.has(d)||(n.add(d),t.push(c))};for(let c of e.proxies??[])c.kind==="direct"?o({source:"proxy",host:c.host,port:c.port,label:__sfx("UHJveHlJUCA=")+c.host+":"+c.port+"",via:{kind:"direct",host:c.host,port:c.port}}):o({source:"proxy",host:c.host,port:c.port,label:`${c.kind.toUpperCase()} ${c.host}:${c.port}`,via:{kind:c.kind,host:c.host,port:c.port,username:c.username,password:c.password,serverName:c.serverName}});let s=se(e.targetHost)||e.deprioritizeDirect===!0;o({source:"direct",host:e.targetHost,port:e.targetPort,label:__sfx("55u06L+eIA==")+e.targetHost+":"+e.targetPort+"",deprioritized:s});let i=e.optimizedIps??[],a=i.filter(c=>!se(c.ip)),l=i.filter(c=>se(c.ip));for(let c of a)o({source:"optimized",host:c.ip,port:c.port,label:__sfx("5LyY6YCJIA==")+c.ip+":"+c.port+""});for(let c of l)o({source:"optimized",host:c.ip,port:c.port,label:__sfx("5LyY6YCJIA==")+c.ip+":"+c.port+__sfx("77yIQ2xvdWRmbGFyZSDnvZHmrrXvvIzlj6/og73kuI3lj6/ovr7vvIk="),deprioritized:!0});let u=e.relay??[];for(let c of u)o({source:"relay",host:c.ip,port:c.port,label:__sfx("5Y+N5LujIA==")+c.label+"",deprioritized:!0});return t.map((c,d)=>({candidate:c,index:d})).sort((c,d)=>{let f=+!!c.candidate.deprioritized-+!!d.candidate.deprioritized;return f!==0?f:c.index-d.index}).map(c=>c.candidate)}function Vn(e){let t=e.filter(o=>!o.deprioritized),n=t.filter(o=>o.source==="proxy");return{landing:n.filter(o=>o.via?.kind!=="direct"),[__sfx("cHJveHlJcA==")]:n.filter(o=>o.via?.kind==="direct"),direct:t.filter(o=>o.source!=="proxy"),fallback:e.filter(o=>o.deprioritized)}}function Yn(e,t){let n=e instanceof Error?e.message:String(e);return yt(e)?{kind:"policy",message:n,candidate:t}:/proxy request failed|cannot connect to the specified address|TCP Loop/i.test(n)?{kind:"blocked",message:n,candidate:t}:/timeout|超时|timed out|abort/i.test(n)?{kind:"timeout",message:n,candidate:t}:{kind:"other",message:n,candidate:t}}function jn(e){switch(e.kind){case"blocked":return __sfx("5Ye656uZ6KKrIENsb3VkZmxhcmUg5ouS57ud77yI")+e.candidate+"):"+e.message+__sfx("CiAg5bi46KeB5Y6f5Zug77ya55uu5qCH5Zyw5Z2A5ZyoIENsb3VkZmxhcmUg6Ieq5a62572R5q6177yIV29ya2VyIOS4jeiDveS4u+WKqOi/nuWbniBDRiDoh6rlt7HnmoTlhaXlj6PvvInjgIIKICDihpIg5o2i5LiA5Liq56ys5LiJ5pa5IElQ77yM5oiW5pS555So5Luj55CG6JC95Zyw44CC");case"policy":return __sfx("5Ye656uZ6KKr562W55Wl5ouS57ud77yI")+e.candidate+"):"+e.message+__sfx("CiAg55uu5qCH5bGe5LqO546v5ZueIC8g5YaF572RIC8g6ZO+6Lev5pys5ZywIC8g5L+d55WZ5Zyw5Z2A77yMV29ya2VyIOebtOi/nuaXoOazleWIsOi+vuOAggogIOKGkiDopoHorr/pl67lsYDln5/nvZHorr7lpIfvvIzor7fphY3nva7okL3lnLDku6PnkIbvvIjnlLHku6PnkIbkvqflu7rov57vvInjgII=");case"timeout":return __sfx("5Ye656uZ6LaF5pe277yI")+e.candidate+"):"+e.message+__sfx("CiAg4oaSIOivpeWcsOWdgOW9k+WJjeS4jeWPr+i+vu+8jOWPr+aNouS4gOadoeWAmemAieaIluWQr+eUqOS7o+eQhuiQveWcsOOAgg==");default:return __sfx("5Ye656uZ5aSx6LSl77yI")+e.candidate+"):"+e.message+""}}var Io,Do,Oo,Uo,No,Lo,Rt=S(()=>{"use strict";wt();Io=[[__sfx("MTAzLjIxLjI0NC4w"),22],[__sfx("MTAzLjIyLjIwMC4w"),22],[__sfx("MTAzLjMxLjQuMA=="),22],[__sfx("MTA0LjE2LjAuMA=="),13],[__sfx("MTA0LjI0LjAuMA=="),14],[__sfx("MTA4LjE2Mi4xOTIuMA=="),18],[__sfx("MTMxLjAuNzIuMA=="),22],[__sfx("MTQxLjEwMS42NC4w"),18],[__sfx("MTYyLjE1OC4wLjA="),15],[__sfx("MTcyLjY0LjAuMA=="),13],[__sfx("MTczLjI0NS40OC4w"),20],[__sfx("MTg4LjExNC45Ni4w"),20],[__sfx("MTkwLjkzLjI0MC4w"),20],[__sfx("MTk3LjIzNC4yNDAuMA=="),22],[__sfx("MTk4LjQxLjEyOC4w"),17]],Do=[[__sfx("MTA0LjMxLjAuMA=="),15],[__sfx("MTkyLjAuMC4w"),24],[__sfx("MTkyLjAuMi4w"),24],[__sfx("MTkyLjg4Ljk5LjA="),24],[__sfx("MTk5LjI3LjEyOC4w"),21],[__sfx("MS4wLjAuMA=="),24],[__sfx("MS4xLjEuMA=="),24]],Oo=[[__sfx("MjIzLjUuNS4w"),24]],Uo=[...Io,...Do];No=Xn(Uo),Lo=Xn(Oo)});function _n(e,t="direct"){let n=e.trim();if(!n)return null;let o=t,r=n,s=/^([a-z0-9+.-]+):\/\//i.exec(n);if(s){let f=s[1].toLowerCase();r=n.slice(s[0].length),f===__sfx("c29ja3M1")||f===__sfx("c29ja3M=")||f===__sfx("c29ja3M1aA==")?o=__sfx("c29ja3M1"):f==="https"?o="https":f==="http"&&(o="http")}let i=r.lastIndexOf("@"),a={};if(i>=0){let f=r.slice(0,i);r=r.slice(i+1);let g=f.indexOf(":");g>=0?a={username:f.slice(0,g),password:f.slice(g+1)}:a={username:f}}let l,u=/#sni=([^/#]+)/i.exec(r);u&&(l=u[1].trim(),r=r.slice(0,u.index)+r.slice(u.index+u[0].length));let{host:c,port:d}=Pt(r,0);return!c||!Number.isInteger(d)||d<=0||d>65535?null:(!l&&o==="https"&&!Mo(c)&&(l=c),{host:c,port:d,kind:o,...a,...l?{serverName:l}:{}})}function Mo(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)}function Ae(e,t="direct"){let n=[];for(let o of e.split(/[\n,;]+/)){let r=o.trim();if(!r)continue;let s=_n(r,t);s&&n.push(s)}return n}var Ct=S(()=>{"use strict";Xe()});async function Ho(){return vt||(vt=(async()=>(await import("cloudflare:sockets")).connect)()),await vt}function Fo(e,t){if(!H(e))return null;let n=e.split(".").map(i=>Number(i)),o=(n[0]<<8|n[1]).toString(16),r=(n[2]<<8|n[3]).toString(16);return`${t.replace(/:+$/,"")}::${o}:${r}`}async function ze(e,t,n,o,r){let i=(await Ho())({hostname:e,port:t},o?{secureTransport:o,...r?{expectedServerHostname:r}:{}}:void 0),a=async(u,c)=>{let d,f=new Promise((g,y)=>{d=setTimeout(()=>y(new Error(""+c+__sfx("6LaF5pe277ya")+e+":"+t+"")),n)});try{return await Promise.race([u,f])}finally{d&&clearTimeout(d)}},l;try{if(await a(i.opened,__sfx("6L+e5o6l")),o==="starttls"){if(l=i.startTls?.(r?{expectedServerHostname:r}:void 0),!l)throw new Error(__sfx("5b2T5YmN6L+Q6KGM5pe25LiN5pSv5oyBIHN0YXJ0VGxz"));return await a(l.opened,__sfx("VExTIOaPoeaJiw==")),l}return i}catch(u){try{Promise.resolve((l??i).close()).catch(()=>{})}catch{}throw u}}async function Ko(e){let t=e.timeoutMs??Dt;try{let n=await ze(e.hostname,e.port,t);return{readable:n.readable,writable:n.writable,via:"direct",endpoint:`${e.hostname}:${e.port}`,close:()=>{try{n.close()}catch{}}}}catch(n){if(e.nat64&&H(e.hostname)){let o=Fo(e.hostname,e.nat64);if(o){let r=await ze(o,e.port,t);return{readable:r.readable,writable:r.writable,via:"nat64",endpoint:`${o}:${e.port}`,close:()=>{try{r.close()}catch{}}}}}throw n}}function Go(e){return e.includes(":")}function Xo(e){return e.source==="proxy"&&e.via!==void 0&&e.via.kind!=="direct"}async function Wo(e,t){let n=e.timeoutMs??Dt;if(t.kind==="direct"){let s=await ze(t.host,t.port,n);return{readable:s.readable,writable:s.writable,via:"direct",endpoint:`${t.host}:${t.port}`,close:()=>{try{s.close()}catch{}}}}let o=t.kind==="https"?"starttls":void 0,r=await ze(t.host,t.port,n,o,t.kind==="https"?t.serverName:void 0);try{return t.kind==="http"||t.kind==="https"?{readable:await vn(r.readable,r.writable,e.hostname,e.port,{username:t.username,password:t.password}),writable:r.writable,via:t.kind,endpoint:`${t.host}:${t.port}`,close:()=>{try{r.close()}catch{}}}:{readable:await Rn(r.readable,r.writable,e.hostname,e.port,{username:t.username,password:t.password}),writable:r.writable,via:__sfx("c29ja3M1"),endpoint:`${t.host}:${t.port}`,close:()=>{try{r.close()}catch{}}}}catch(s){try{await r.close()}catch{}throw s}}function Jn(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}function Vo(e){if(e.length===0)return __sfx("5pyq55+l5Y6f5Zug");let t=e.map(Jn),n=t.slice(-zo),o=t.length-n.length;return`${o>0?`\uFF08\u5171 ${t.length} \u6761\uFF0C\u7701\u7565\u524D ${o} \u6761\uFF09`:""}${n.join("\uFF1B")}`}function Yo(e){return e.length===0?Promise.reject(new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"))):new Promise((t,n)=>{let o=e.length,r=!1,s=[];for(let i of e)i().then(a=>{if(r){try{let l=a.close;Promise.resolve(l?l():a.writable.close()).catch(()=>{})}catch{}return}r=!0,t(a)},a=>{s.push(a),o-=1,o===0&&!r&&(r=!0,n(new Error(__sfx("5pys5om5IA==")+e.length+__sfx("IOS4quWAmemAieWFqOmDqOWksei0pe+8mg==")+Vo(s)+"")))})})}async function It(e,t){if(e.length===0)throw new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"));if(!t||e.length<=1){let s=new Error(__sfx("5ouo5Y+35aSx6LSl"));for(let i of e)try{return await i()}catch(a){s=a}throw s}let n=[],o=new Error(__sfx("5ouo5Y+35aSx6LSl"));for(let s=0;s<e.length;s+=kt){let i=e.slice(s,s+kt);try{return await Yo(i)}catch(a){o=a,n.push(Jn(a))}}throw new Error(__sfx("5YWo6YOoIA==")+e.length+__sfx("IOS4quWAmemAieWdh+Wksei0pe+8iOWIhiA=")+n.length+__sfx("IOaJue+8jOavj+aJueacgOWkmiA=")+kt+__sfx("IOS4quW5tuWPke+8ie+8mgo=")+n.join(`
|
|
4
4
|
`),{cause:o})}async function Zn(e,t){let n=[...e];if(!t)return n;try{let o=await Se(t),r=new Set(n.map(s=>`${s.ip}:${s.port}`));for(let s of o){let i=`${s.ip}:${s.port}`;r.has(i)||(r.add(i),n.push(s))}}catch{}return n}async function jo(e,t,n){if(e.length===0)return null;for(let o=0;o<e.length;o+=We){let s=e.slice(o,o+We).map(i=>t({source:"relay",host:i.ip,port:i.port,label:__sfx("5Y+N5LujIA==")+i.label+""}));try{return await It(s,n)}catch{}}return null}async function pe(e){let t=e.proxies??[],n=e.concurrent??!0;if(!e.skipTargetPolicy&&t.length===0){let h=bt(e.hostname);if(h)throw new le(e.hostname,h)}let o=e.budgetMs??Bo,r=Date.now()+o,s=[...e.optimizedIps??[]],i=!1;if(e.resolvePreferred)try{let h=await Ge(e.hostname,e.port,{deadline:r});if(h.length>0){i=!0;for(let w of h)s.push({ip:w.hostname,port:w.port})}}catch{}let a=se(e.hostname),l=i&&s.length>0&&s.every(h=>se(h.ip)),u=[...e.relay??[]];(l||a)&&e.relayPool&&(u=await Zn(u,{...e.relayPool,deadline:r}));let d=u,f=zn({targetHost:e.hostname,targetPort:e.port,optimizedIps:s,proxies:t,deprioritizeDirect:a,relay:[]});if(f.length===0)throw new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"));let g=h=>async()=>{let w=r-Date.now();if(w<=0)throw new Error(__sfx("5ouo5Y+36aKE566X5bey55So5bC977yI")+o+"ms):"+e.hostname+":"+e.port+"");let v=Math.max(200,Math.min(e.timeoutMs??Dt,w)),j={...e,timeoutMs:v};try{if(!Xo(h)&&Go(e.hostname))throw new le(e.hostname,On);if(!e.skipTargetPolicy&&h.source!=="proxy"&&h.source!=="relay"){let U=bt(h.host);if(U)throw new le(h.host,U)}if(h.source==="proxy"&&h.via)try{let U=await Wo(j,{host:h.via.host,port:h.via.port,kind:h.via.kind,username:h.via.username,password:h.via.password,serverName:h.via.serverName});return Tn(h.via),U}catch(U){throw U instanceof re||An(h.via,Date.now()),U}return await Ko({...j,hostname:h.host,port:h.port})}catch(U){let _=Yn(U,h.label);throw e.onFailure?.(_),U}},y=Vn(f),{landing:P,[__sfx("cHJveHlJcA==")]:T,direct:p,fallback:R}=y,A=P.length>0||T.length>0,k=async()=>{if(P.length===0)throw new Error(__sfx("5pyq6YWN572u6JC95Zyw5Luj55CG"));let h,w=mt(P,v=>v.via,Date.now());for(let v of w)try{return await g(v)()}catch(j){h=j}throw h??new Error(__sfx("6JC95Zyw5Luj55CG5YWo6YOo5aSx6LSl"))},K=async()=>{if(T.length===0)throw new Error(__sfx("5pyq6YWN572uIFByb3h5SVA="));let h=Date.now(),w=mt(T,v=>v.via,h);return await It(w.map(g),!0)},q=async()=>{let h;if(P.length>0)try{return await k()}catch(w){h=w}if(T.length>0)try{return await K()}catch(w){h=w}throw h??new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Luj55CG"))},N=async()=>await It(p.map(g),n),Y=async()=>{let h=d;return h.length===0&&e.relayPool&&(h=await Zn([],{...e.relayPool,deadline:r})),await jo(h,g,n)},$=async()=>{for(let h of R)try{return await g(h)()}catch{}return null};if(!A)try{return await N()}catch(h){let w=await Y();if(w)return w;let v=await $();if(v)return v;throw h}let ie=e.proxyMode??"only",D=a||l;if(ie==="only")try{return await q()}catch(h){let w=await Y();if(w)return w;let v=await $();if(v)return v;throw h}if(ie==="global"||ie==="smart"&&D)try{return await q()}catch(h){if(ie==="global")try{return await N()}catch{}let w=await Y();if(w)return w;let v=await $();if(v)return v;throw h}try{return await N()}catch(h){try{return await q()}catch{}let w=await Y();if(w)return w;let v=await $();if(v)return v;throw h}}var vt,Dt,Bo,kt,zo,Ot=S(()=>{"use strict";Cn();kn();wt();Fe();G();Xe();Ee();Rt();Ct();vt=null;Dt=8e3,Bo=15e3;kt=6,zo=8});async function Qn(e,t,n,o=!0,r,s){let i=e.getReader(),a=t.getWriter();try{for(;!n?.exhausted;){let l;try{l=await i.read()}catch(c){s?.(c,"read");break}if(l.done)break;let u=l.value;if(!(!u||u.byteLength===0)){if(r?.(u.byteLength))break;try{await a.write(u)}catch(c){s?.(c,"write");break}}}}finally{if(o)try{await a.close()}catch{}else try{a.releaseLock()}catch{}try{i.releaseLock()}catch{}}}var ce,Ve=S(()=>{"use strict";ce=class{constructor(t){this.limitBytes=t}limitBytes;total=0;get enabled(){return this.limitBytes>0}get bytes(){return this.total}add(t){return this.limitBytes<=0||t<=0?!1:(this.total+=t,this.total>this.limitBytes)}}});var or={};Ie(or,{diagnosticCounters:()=>Qo,[__sfx("aGFuZGxlV2ViU29ja2V0")]:()=>Ze,recentDiagnostics:()=>$o,recentRoutes:()=>qo,recordDiagnostics:()=>Q,truncateCloseReason:()=>rr});function rr(e,t=123){let n=new TextEncoder;if(n.encode(e).length<=t)return e;let o=e.slice(0,t);for(;n.encode(o).length>t;)o=o.slice(0,-1);o=o.replace(/\uFFFD+$/,"");let r="\u2026";for(;o.length>0&&n.encode(o+r).length>t;)o=o.slice(0,-1);return o+r}function Qo(){return{...he}}function qo(){return _e}function nr(e,t,n){_e.unshift({at:Date.now(),target:e,via:t.via,endpoint:t.endpoint,cfTarget:se(e.split(":")[0]??""),publicDns:Wn(e.split(":")[0]??""),phase:n}),_e.length>20&&(_e.length=20)}function Q(e,t,n){je.unshift({at:Date.now(),target:e,failures:t,summary:n}),je.length>tr&&(je.length=tr)}function $o(){return je}function ns(e){if(!e)return new Uint8Array(0);let t=e.trim();if(!t||t.length>16384)return new Uint8Array(0);try{let n=t.replace(/-/g,"+").replace(/_/g,"/"),o=n.length%4===0?"":"=".repeat(4-n.length%4),r=atob(n+o);if(r.length<17||r.length>8192)return new Uint8Array(0);let s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s}catch{return new Uint8Array(0)}}async function Ze(e,t,n,o,r,s){let[i,a]=Object.values(new WebSocketPair);try{a.accept({allowHalfOpen:!0})}catch{a.accept()}a.binaryType="arraybuffer";let l=ns(e.headers.get(__sfx("c2VjLXdlYnNvY2tldC1wcm90b2NvbA=="))),u=[],c=0,d=!1,f=null,g=null,y=new He,P=null,T=null,p=()=>{T&&(clearTimeout(T),T=null)},R=!1,A=new Me,k=null,K=!1,q=!1,N=null,Y=null,$=m=>{try{a.send(m)}catch{}},ie=m=>{let b=new Uint8Array(2+m.byteLength);b[0]=0,b[1]=m.byteLength,b.set(m,2),$(b)},D=(m,b)=>{K=!0;try{a.close(m,rr(b))}catch{}h()},h=()=>{if(!q){if(q=!0,jt(),me.bytes=Math.max(0,me.bytes-c),u=[],c=0,p(),P&&(clearTimeout(P),P=null),w&&(clearTimeout(w),w=null),k){let m=k;k=null;try{m.cancel()}catch{}}if(f){let m=f.close;if(m)try{m()}catch{}else try{f.writable.close()}catch{}}}},w=null,v=new Set,j=0,U=[],_=0,tt=m=>{if(!(m.byteLength===0||ae>0)){if(_+m.byteLength>er){D(1009,__sfx("5pyq56Gu6K6k6YCa6Lev55qE5LiK6KGM5pWw5o2u6L+H5aSa"));return}if(Ye+m.byteLength>Zo){D(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}U.push(m),_+=m.byteLength,Ye+=m.byteLength}},jt=()=>{Ye=Math.max(0,Ye-_),U=[],_=0},nt=0,Ur=()=>{nt+=1},_t=async()=>{if(!f)return;let m=++nt,b=f.readable.getReader();k=b,w&&clearTimeout(w);let x=setTimeout(()=>{w===x&&(w=null),!(ae>0)&&_!==0&&$t("stall")},$n);w=x;try{for(;;){let{done:B,value:M}=await b.read();if(B)break;if(M&&M.byteLength>0){let O=ae===0;if(ae+=M.byteLength,O&&jt(),Zt.add(M.byteLength)){Jt();return}let C=A.yieldCount;await A.onChunk(M.byteLength),A.yieldCount>C&&he.downlinkYields++,$(M)}}}catch{}finally{try{b.releaseLock()}catch{}if(clearTimeout(x),w===x&&(w=null),k===b&&(k=null),m!==nt||K)return;if(ae===0&&_>0&&j<Ut&&!R){$t("eof");return}let B=f;D(1e3,B?`done via=${B.via} ep=${B.endpoint} dl=${ae} ret=${_} rd=${j}`:"done")}},ae=0,Zt=new ce((n.dataBudgetMB||0)*1024*1024),Jt=()=>{let m=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+n.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");Q(N?`${N.hostname}:${N.port}`:__sfx("5pyq5bu656uL5Ye656uZ"),[],m),D(1009,m)},Nr=async m=>{let b=g;if(b)try{await y.write(()=>g===b?b:null,m)}catch(x){Q(N?`${N.hostname}:${N.port}`:__sfx("5pyq5bu656uL5Ye656uZ"),[],__sfx("5LiK6KGM5YaZ5YWl5aSx6LSl77ya")+String(x)+""),h()}},Qt=async m=>{if(u.length===0)return;let b=u;u=[],c=0;for(let x of b)me.bytes=Math.max(0,me.bytes-x.byteLength),tt(x),await m.write(x)},qt=m=>{if(t===__sfx("dmxlc3M=")){let x=Ue(m,n.uuid);return x?{command:x.header.command,port:x.header.port,hostname:x.header.hostname,headerLength:x.consumed}:null}let b=gn(m,n[__sfx("dHJvamFuUGFzc3dvcmQ=")]);return b?{command:b.header.command,port:b.header.port,hostname:b.header.hostname,headerLength:b.consumed}:null},Lr=()=>{P&&(clearTimeout(P),P=null)},Mr=async()=>{if(!(K||d)){if(qt(l)){await rt();return}D(1008,l.byteLength===0?__sfx("5o+h5omL6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0"):__sfx("5o+h5omL6LaF5pe277ya5Y2P6K6u5aS05LiN5a6M5pW05oiW6K6k6K+B5aSx6LSl"))}},rt=async()=>{if(K||d)return;let m=qt(l);if(!m){l.byteLength>0&&!P&&(P=setTimeout(()=>{P=null,Mr().catch(C=>D(1011,String(C)))},es));return}if(Lr(),p(),d)return;d=!0,N=m;let b=t===__sfx("dmxlc3M=")?ln:hn;if(m.command===b){if(t===__sfx("dmxlc3M=")&&n.udpDns==="doh"&&m.port===53){ie(new Uint8Array(0)),Y=new Le({endpoint:n.udpDnsEndpoint,send:$});let C=l.subarray(m.headerLength);C.byteLength>0&&Y.push(C);return}D(1002,n.udpDns==="doh"?__sfx("VURQIOS7heaUr+aMgSBETlPvvIg1MyDnq6/lj6PvvIk="):__sfx("VURQIOacquWQr+eUqO+8iOmdouadv+WPr+W8gOWQryBETlMgb3ZlciBEb0jvvIk="));return}t===__sfx("dmxlc3M=")&&ie(new Uint8Array(0));let x=[],B=null;try{f=await pe({hostname:m.hostname,port:m.port,proxies:o,timeoutMs:qn,concurrent:n.concurrentDial,nat64:n.nat64||void 0,proxyMode:n.proxyMode,resolvePreferred:n.resolvePreferred,relayPool:{userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay},onFailure:C=>{x.push(C),s?.failures.push(C)}})}catch(C){B=C}if(!f){let C=x.length>0?x.map(ye=>jn(ye)).join(`
|
|
5
|
-
`):__sfx("5Ye656uZ6L+e5o6l5aSx6LSl77ya")+String(B)+"";Q(`${m.hostname}:${m.port}`,x,C),D(1011,C);return}let M=f.writable.getWriter();g=M,nr(`${m.hostname}:${m.port}`,f,"initial");let O=l.byteLength>m.headerLength?l.subarray(m.headerLength):new Uint8Array(0);l=new Uint8Array(0);try{await y.run(async()=>{O.byteLength>0&&(tt(O),await M.write(O)),await Qt(M)})}catch(C){Q(`${m.hostname}:${m.port}`,[],__sfx("5LiK6KGM6aaW5YyF5YaZ5YWl5aSx6LSl77ya")+String(C)+""),h()}r?.waitUntil(_t())},$t=async m=>{if(K||R)return;let b=N;if(!b){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55uu5qCH5pyq6Kej5p6Q"));return}if(j>=Ut){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55u06L+e5LiO5Y+N5Luj5YWl5Y+j5Z2H5peg5ZON5bqU"));return}R=!0;let x=xn({via:f?.via,port:b.port,userProxyConfigured:o.length>0||!!n[__sfx("cHJveHlJcA==")],aggressive:n.aggressiveRedial===!0});if(!x.allowed){he.guardedRedials++,Q(`${b.hostname}:${b.port}`,[],__sfx("5Ye656uZ5peg5pWw5o2u77ya")+x.reason+__sfx("77yb5pyq5YiH5o2i5Y+N5Luj77yI5Y+v5byA5ZCvIGFnZ3Jlc3NpdmVSZWRpYWzvvIk=")),D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya")+x.reason+"");return}j++,m==="stall"?he.stallRedials++:he.eofRedials++,Q(`${b.hostname}:${b.port}`,[],m==="stall"?__sfx("55u06L+eIA==")+$n+__sfx("bXMg5peg5LiL6KGM5pWw5o2u77yM5pS56LWw5Y+N5Luj5YWl5Y+j"):__sfx("5Ye656uZ6Zu25LiL6KGM5Y2zIEVPRi9SZXNldO+8jOeri+WNs+aUuei1sOWPjeS7o+WFpeWPow=="));let B=[];try{B=await Se({userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay})}catch{B=[]}let M=B.filter(O=>!v.has(`${O.ip}:${O.port}`));if(M.length===0){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5peg5Y+N5Luj5YWl5Y+j5Y+v55So"));return}for(let O of M.slice(0,Ut)){if(v.add(`${O.ip}:${O.port}`),Ur(),f){let C=f;if(C.close)try{C.close()}catch{}}g=null,ae=0;try{let C=await pe({hostname:O.ip,port:O.port,timeoutMs:qn,resolvePreferred:!1,skipTargetPolicy:!0,proxies:n.aggressiveRedial?o:void 0,proxyMode:n.aggressiveRedial?n.proxyMode:void 0});if(!C)continue;f=C,nr(`${b.hostname}:${b.port}`,C,"redial");let ye=C.writable.getWriter();g=ye;let tn=0;for(let ke of U)tn+=ke.byteLength;let ot=new Uint8Array(tn),nn=0;for(let ke of U)ot.set(ke,nn),nn+=ke.byteLength;await y.run(async()=>{ot.byteLength>0&&await ye.write(ot),await Qt(ye)}),Q(`${b.hostname}:${b.port}`,[],__sfx("5bey5YiH5o2i5Y+N5Luj5YWl5Y+jIA==")+O.ip+":"+O.port+""),r?.waitUntil(_t());return}catch(C){Q(`${b.hostname}:${b.port}`,[],__sfx("5Y+N5Luj5YWl5Y+jIA==")+O.ip+":"+O.port+__sfx("IOWksei0pe+8mg==")+String(C)+"")}}D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5omA5pyJ5Y+N5Luj5YWl5Y+j5Z2H5aSx6LSl"))};a.addEventListener("message",m=>{(async()=>{let b=m.data,x=typeof b=="string"?new TextEncoder().encode(b):new Uint8Array(b);if(x.byteLength!==0){if(p(),Zt.add(x.byteLength)){Jt();return}if(!d){if(l=wn(l,x),l.byteLength>_o){D(1009,__sfx("5o+h5omL5aS06LaF6L+HIDY0S0I="));return}await rt();return}if(Y){Y.push(x);return}if(!g){if(me.bytes+x.byteLength>Jo){D(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}if(u.push(x),c+=x.byteLength,me.bytes+=x.byteLength,c>er){D(1009,__sfx("5ouo5Y+35pyf6Ze05pWw5o2u6L+H5aSa"));return}return}tt(x),await Nr(x)}})()});let en=()=>{h()};a.addEventListener("close",en),a.addEventListener("error",en),l.byteLength>0?rt().catch(m=>D(1011,String(m))):T=setTimeout(()=>{T=null,!(K||d||l.byteLength>0)&&(he.firstPacketTimeouts++,D(1008,__sfx("6aaW5YyF6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0")))},ts);try{return new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:i})}catch(m){return console.error(__sfx("W+iHqueglOaVsOaNrumdol0gMTAxIOWTjeW6lOaehOmAoOWksei0pe+8mg=="),m),new Response(null,{status:200})}}var qn,$n,Ut,_o,er,Zo,Ye,Jo,me,je,tr,he,_e,es,ts,Nt=S(()=>{"use strict";dt();yn();bn();Pe();Pn();Sn();Ot();Ve();Rt();Ee();qn=5e3,$n=2500,Ut=2,_o=64*1024,er=8*1024*1024,Zo=32*1024*1024,Ye=0,Jo=32*1024*1024,me={bytes:0};je=[],tr=20,he={stallRedials:0,eofRedials:0,guardedRedials:0,firstPacketTimeouts:0,downlinkYields:0};_e=[];es=2e3,ts=8e3});var fr={};Ie(fr,{[__sfx("Y2xlYXJYaHR0cFNlc3Npb25z")]:()=>ds,[__sfx("aGFuZGxlWGh0dHA=")]:()=>Bt,[__sfx("aXNYaHR0cFBhdGg=")]:()=>Ht,[__sfx("cGFyc2VYaHR0cFJvdXRl")]:()=>Mt,[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:()=>ss,[__sfx("cmVjb3JkWGh0dHBEaWFnbm9zdGljcw==")]:()=>V});function os(e,t){return new Promise(n=>{let o=setTimeout(()=>n(null),t);e.then(r=>{clearTimeout(o),n(r)},()=>{clearTimeout(o),n(null)})})}function V(e,t,n){Je.unshift({at:Date.now(),target:e,...t,summary:n}),Je.length>20&&(Je.length=20)}function ss(){return Je}function is(e){return String(e||"").trim().replace(/\/+$/,"")||"/"}function Mt(e,t){let n=is(t??__sfx("L3hodHRw"));if(e===n||e===`${n}/`)return{kind:"stream-one"};let o=`${n}/`;if(!e.startsWith(o))return null;let r=e.slice(o.length);if(!r)return null;let s=r.split("/");if(s.length===1&&s[0])return/[\s\u0000-\u001f]/.test(s[0])?null:{kind:"session",sessionId:s[0]};if(s.length===2&&s[0]&&/^\d+$/.test(s[1])){if(/[\s\u0000-\u001f]/.test(s[0]))return null;let i=Number(s[1]);return!Number.isSafeInteger(i)||i<0||i>1e6?null:{kind:__sfx("cGFja2V0LXVw"),sessionId:s[0],seq:i}}return null}function Ht(e,t){return Mt(e,t)!==null}function cs(e){if(e.reservedBytes<=0){e.reservedBytes=0;return}ue=Math.max(0,ue-e.reservedBytes),e.reservedBytes=0}function us(e,t){if(t<=0)return;let n=Math.min(t,e.reservedBytes);ue=Math.max(0,ue-n),e.reservedBytes-=n}function lr(e,t){return t<=0?!0:ue+t>ls?!1:(ue+=t,e.reservedBytes+=t,!0)}function ds(){for(let[e,t]of W)z(e,t);W.clear(),ue=0}function fs(e,t){return t-e.lastUploadAt>Lt&&t-e.lastDownlinkAt>Lt&&t-e.lastActivityAt>Lt}function ps(e,t){return e.closed?!0:e.header||e.dialResult||e.downlinkStarted?!1:t-e.createdAt>cr}function ur(e,t,n,o){let r=Date.now();for(let[a,l]of W)(l.closed||fs(l,r)||!l.header&&r-l.createdAt>30*6e4)&&z(a,l);let s=W.get(e);if(s)return dr(s,n,r),s;if(W.size>=sr){for(let[a,l]of W)ps(l,r)&&z(a,l);if(W.size>=sr)return null}if(!o){let a=0;for(let l of W.values())l.header||(a+=1);if(a>=as)return null}let i={id:e,createdAt:r,lastUploadAt:r,lastDownlinkAt:r,lastActivityAt:r,header:void 0,headerWaiters:[],dialPromise:null,dialResult:null,pending:new Map,reservedBytes:0,nextPumpSeq:0,pumpStarted:!1,signalResolve:null,traffic:new ce(t),downlinkStarted:!1,closed:!1,targetLabel:""};return W.set(e,i),i}function dr(e,t,n){t==="upload"?e.lastUploadAt=n:e.lastDownlinkAt=n,e.lastActivityAt=n}function z(e,t){if(!t.closed){t.closed=!0;for(let n of t.headerWaiters)try{n(null)}catch{}if(t.headerWaiters=[],t.signalResolve?.(),t.signalResolve=null,t.dialResult?.close)try{t.dialResult.close()}catch{}cs(t),t.pending.clear(),W.delete(e)}}function ms(e){let t=e.signalResolve;e.signalResolve=null,t?.()}function hs(e,t){return e.header?Promise.resolve(e.header):e.closed?Promise.resolve(null):new Promise(n=>{let o=s=>{clearTimeout(r),n(s)},r=setTimeout(()=>{let s=e.headerWaiters.indexOf(o);s>=0&&e.headerWaiters.splice(s,1),n(null)},t);e.headerWaiters.push(o)})}function gs(e,t){e.header=t;let n=e.headerWaiters;e.headerWaiters=[];for(let o of n)try{o(t)}catch{}}function L(e){let t=100+Math.floor(Math.random()*900);return{"Content-Type":"text/event-stream","Cache-Control":"no-store","X-Accel-Buffering":"no","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST","X-Padding":"X".repeat(t),...e}}function ys(e){let t=e.addons,n=new Uint8Array(2+t.byteLength);return n[0]=e.version,n[1]=t.byteLength,n.set(t,2),n}async function bs(e,t,n){if(e.dialResult)return e.dialResult;if(!e.dialPromise){let o=e.header;if(!o)throw new Error(__sfx("VkxFU1Mg5aS05pyq5Yiw6L6+"));e.targetLabel=`${o.hostname}:${o.port}`,e.dialPromise=pe({hostname:o.hostname,port:o.port,proxies:n,nat64:t.nat64,concurrent:t.concurrentDial,proxyMode:t.proxyMode,resolvePreferred:t.resolvePreferred,relayPool:{userEntries:t.relayPool||void 0,useBuiltin:t.useBuiltinRelay},onFailure:r=>{V(e.targetLabel,r,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+r.candidate+"):"+r.message+"")}}).then(r=>(e.dialResult=r,r)).catch(r=>{throw V(e.targetLabel,{kind:"dial",message:String(r),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(r)+""),r})}return await e.dialPromise}async function ws(e,t){let n=t.writable.getWriter();try{for(;!e.closed;){let o=e.pending.get(e.nextPumpSeq);if(o){if(e.pending.delete(e.nextPumpSeq),e.nextPumpSeq+=1,us(e,o.byteLength),o.byteLength===0)continue;if(e.traffic.add(o.byteLength)){V(e.targetLabel,{kind:"budget",message:__sfx("5rWB6YeP6LaF6ZmQ"),candidate:"traffic"},__sfx("WEhUVFAg5LiK6KGM5rWB6YeP6LaF6ZmQ"));break}try{await n.write(o)}catch(i){V(e.targetLabel,{kind:"relay-write",message:String(i),candidate:t.endpoint},__sfx("WEhUVFAg5YaZ5YWl55uu5qCH5aSx6LSl77ya")+String(i)+"");break}continue}let r=null,s=new Promise(i=>{r=i});if(e.signalResolve=r,e.pending.has(e.nextPumpSeq)||e.closed){e.signalResolve=null;continue}await s}}finally{try{n.releaseLock()}catch{}}}async function xs(e,t,n,o,r){let s=(t.dataBudgetMB||0)*1024*1024,i=ur(o,s,"upload",r===0);if(!i)return new Response(__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ77yM6K+356iN5ZCO6YeN6K+V"),{status:503,headers:L()});if(i.closed)return null;let a=Number(e.headers.get("content-length")??"");if(Number.isFinite(a)&&a>ir)return new Response(__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ"),{status:413,headers:L()});let l;try{let u=await e.arrayBuffer();l=new Uint8Array(u)}catch{return new Response(__sfx("6K+35rGC5L2T6K+75Y+W5aSx6LSl"),{status:400,headers:L()})}if(l.byteLength>ir)return new Response(__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ"),{status:413,headers:L()});if(r===0&&!i.header){let u=Ue(l,t.uuid);if(!u)return z(o,i),new Response(__sfx("VkxFU1Mg5aS06Kej5p6Q5aSx6LSl"),{status:400,headers:L()});if(u.header.command!==ut)return z(o,i),new Response(__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),{status:400,headers:L()});gs(i,u.header),i.targetLabel=`${u.header.hostname}:${u.header.port}`;let c=l.subarray(u.consumed);if(r>=i.nextPumpSeq&&!i.pending.has(r)){if(i.pending.size>=ar)return z(o,i),new Response(__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),{status:503,headers:L()});if(!lr(i,c.byteLength))return z(o,i),new Response(__sfx("5pqC5a2Y6LaF6ZmQ"),{status:503,headers:L()});i.pending.set(r,c.slice())}}else{if(r<i.nextPumpSeq||i.pending.has(r))return new Response(null,{status:200,headers:L()});if(i.pending.size>=ar)return z(o,i),new Response(__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),{status:503,headers:L()});if(!lr(i,l.byteLength))return z(o,i),new Response(__sfx("5pqC5a2Y6LaF6ZmQ"),{status:503,headers:L()});i.pending.set(r,l.slice())}return ms(i),new Response(null,{status:200,headers:L()})}async function Ps(e,t,n,o){let r=(t.dataBudgetMB||0)*1024*1024,s=ur(o,r,"downlink",!1);if(!s)return new Response(__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ77yM6K+356iN5ZCO6YeN6K+V"),{status:503,headers:L()});if(s.closed||s.downlinkStarted)return null;s.downlinkStarted=!0;let i=hs(s,cr),a=!1,l=null,u=null,c=!1,d=null,f=()=>{z(o,s)},g=new ReadableStream({start(y){u=y},async pull(y){if(!a)try{if(!c){let p=await i;if(a)return;if(!p){f(),y.close();return}try{d=await bs(s,t,n)}catch{f(),y.close();return}if(a)return;s.pumpStarted||(s.pumpStarted=!0,ws(s,d).catch(()=>{}));try{y.enqueue(ys(p))}catch{}c=!0;return}if(!d)return;l||(l=d.readable.getReader());let{done:P,value:T}=await l.read();if(a)return;if(P){f();try{y.close()}catch{}return}if(T&&T.byteLength>0){if(dr(s,"downlink",Date.now()),s.traffic.add(T.byteLength)){V(s.targetLabel,{kind:"budget",message:__sfx("5rWB6YeP6LaF6ZmQ"),candidate:"traffic"},__sfx("WEhUVFAg5LiL6KGM5rWB6YeP6LaF6ZmQ")),f();try{y.close()}catch{}return}y.enqueue(T)}}catch(P){if(a)return;f();try{y.error(P)}catch{}}},cancel(y){if(a=!0,d)try{d.readable.cancel(y)}catch{}f()}});return new Response(g,{status:200,headers:L()})}async function Bt(e,t,n){let o=__sfx("L3hodHRw");try{o=new URL(e.url).pathname}catch{o=__sfx("L3hodHRw")}let r=Mt(o,t[__sfx("eGh0dHBQYXRo")]);return r?r.kind==="stream-one"?e.method!=="POST"?null:await Ss(e,t,n):r.kind===__sfx("cGFja2V0LXVw")?e.method!=="POST"?null:await xs(e,t,n,r.sessionId,r.seq):e.method==="GET"?await Ps(e,t,n,r.sessionId):null:null}async function Ss(e,t,n){let o=e.body;if(!o)return new Response(__sfx("57y65bCR6K+35rGC5L2T"),{status:400});let r=new ne(o),s=await os(un(r,t.uuid),rs);if(!s)return await r.cancel("header timeout"),new Response(__sfx("VkxFU1Mg5aS06Kej5p6Q5aSx6LSl"),{status:400});if(s.header.command!==ut)return await s.payload.cancel("unsupported UDP"),new Response(__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),{status:400});let i;try{i=await pe({hostname:s.header.hostname,port:s.header.port,proxies:n,nat64:t.nat64,concurrent:t.concurrentDial,proxyMode:t.proxyMode,resolvePreferred:t.resolvePreferred,relayPool:{userEntries:t.relayPool||void 0,useBuiltin:t.useBuiltinRelay},onFailure:p=>{V(`${s.header.hostname}:${s.header.port}`,p,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+p.candidate+"):"+p.message+"")}})}catch(p){V(`${s.header.hostname}:${s.header.port}`,{kind:"dial",message:String(p),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(p)+"");try{s.payload.cancel("dial failed").catch(()=>{})}catch{}return new Response(__sfx("5Ye656uZ5LiN5Y+v55So"),{status:502})}let a=s.header.addons;if(a.byteLength>255)return new Response(__sfx("QWRkb25zIOmVv+W6pui2heWHuiBWTEVTUyDljY/orq7kuIrpmZA="),{status:400});let l=new Uint8Array(2+a.byteLength);l[0]=s.header.version,l[1]=a.byteLength,l.set(a,2);let u=!1,c=null,d=!1,f=new ce((t.dataBudgetMB||0)*1024*1024),g=null,y=()=>{if(d)return;d=!0;let p=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+t.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");if(V(`${s.header.hostname}:${s.header.port}`,{kind:"budget",message:p,candidate:"traffic"},p),i.close)try{i.close()}catch{}try{g?.close()}catch{}},P=p=>f.add(p)?(y(),!0):!1;Qn(s.payload,i.writable,void 0,!1,P,(p,R)=>{let A=p instanceof Error?p.message:String(p),k=`relay-${R}`;/cancel|abort|closed/i.test(A)?k=`relay-${R}-client-cancel`:/reset|broken pipe/i.test(A)&&(k=`relay-${R}-upstream-reset`),V(`${s.header.hostname}:${s.header.port}`,{kind:k,message:A.slice(0,200),candidate:i.endpoint},__sfx("WEhUVFAg5Lit57un")+R==="read"?"\u8BFB\u4E0A\u6E38":"\u5199\u76EE\u6807"+__sfx("5aSx6LSl77yI")+k+"):"+A.slice(0,120)+"")}).catch(()=>{});let T=new ReadableStream({start(p){g=p,p.enqueue(l),u=!0},async pull(p){if(!(d||!u)){c||(c=i.readable.getReader());try{let{done:R,value:A}=await c.read();if(d)return;if(R){if(i.close)try{i.close()}catch{}p.close();return}if(A&&A.byteLength>0){if(f.add(A.byteLength)){y();return}p.enqueue(A)}}catch(R){if(d)return;if(i.close)try{i.close()}catch{}try{p.error(R)}catch{}}}},cancel(p){d=!0;try{i.readable.cancel(p)}catch{}if(i.close)try{i.close()}catch{}}});return new Response(T,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-store","X-Accel-Buffering":"no"}})}var rs,Je,W,cr,sr,as,Lt,ir,ar,ls,ue,Ft=S(()=>{"use strict";Pe();dt();Ve();Ot();rs=2e3;Je=[];W=new Map,cr=3e4,sr=100,as=20,Lt=10*6e4,ir=10*1024*1024,ar=30,ls=32*1024*1024,ue=0});function qe(){return new Response(JSON.stringify({build:Kt,version:Es,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var Kt,Es,Qe,Gt=S(()=>{"use strict";Kt="c84de11-a5e14406",Es=__sfx("MC40MC4w"),Qe=__sfx("L19fY2ZwX3ZlcnNpb24=")});function pr(e){return e[__sfx("S1Y=")]?new de(e[__sfx("S1Y=")]):new Xt}var de,Xt,Te=S(()=>{"use strict";de=class{constructor(t){this.kv=t}kv;async get(t){return await this.kv.get(t)}async put(t,n,o){o&&o>=60?await this.kv.put(t,n,{expirationTtl:o}):await this.kv.put(t,n)}async delete(t){await this.kv.delete(t)}async list(t){let n=[],o;do{let r=await this.kv.list({prefix:t,cursor:o});for(let s of r.keys)n.push(s.name);o=r.list_complete?void 0:r.cursor}while(o);return n}},Xt=class{data=new Map;async get(t){let n=this.data.get(t);return n?n.expiresAt>0&&n.expiresAt<=Date.now()?(this.data.delete(t),null):n.value:null}async put(t,n,o){let r=o?Date.now()+o*1e3:0;this.data.set(t,{value:n,expiresAt:r})}async delete(t){this.data.delete(t)}async list(t){return[...this.data.keys()].filter(n=>n.startsWith(t))}}});function fe(e,t){if(e==null)return t;let n=String(e).trim();if(n==="")return t;let o=Number(n);return Number.isFinite(o)?o:t}function F(e,t){if(e==null||e==="")return t;let n=String(e).trim().toLowerCase();return["1","true","yes","on"].includes(n)?!0:["0","false","no","off"].includes(n)?!1:t}function hr(e){let t=e.trim().toLowerCase();return t==="global"||t==="fallback"||t==="smart"?t:"only"}function gr(e){return e.trim().toLowerCase()==="signed"?"signed":"legacy"}function yr(e){return e.trim().toLowerCase()==="doh"?"doh":"off"}function I(e,t){return e==null?t:String(e)}function As(e){let t=e.trim();return t?`/${t.replace(/^\/+/,"")}`:E.wsPath}function Ts(e){return{uuid:I(e[__sfx("VVVJRA==")],""),[__sfx("dHJvamFuUGFzc3dvcmQ=")]:I(e[__sfx("VFJPSkFOX1BBU1NXT1JE")],""),wsPath:As(I(e[__sfx("V1NfUEFUSA==")]||e[__sfx("UEFUSA==")],E.wsPath)),[__sfx("dHJvamFuUGF0aA==")]:E[__sfx("dHJvamFuUGF0aA==")],[__sfx("eGh0dHBQYXRo")]:E[__sfx("eGh0dHBQYXRo")],add:I(e[__sfx("QURE")],""),addApi:I(e[__sfx("QUREQVBJ")],""),addCsv:I(e[__sfx("QUREX0NTVg==")],""),poolOfficial:F(e[__sfx("T0ZGSUNJQUxfSVA=")],E.poolOfficial),officialCount:fe(e[__sfx("T0ZGSUNJQUxfSVBfQ09VTlQ=")],E.officialCount),poolDomain:F(e[__sfx("UFJFRkVSUkVEX0RPTUFJTg==")],E.poolDomain),domainCount:fe(e[__sfx("UFJFRkVSUkVEX0RPTUFJTl9DT1VOVA==")],E.domainCount),poolManual:F(e[__sfx("TUFOVUFMX0lQ")],E.poolManual),poolCountries:I(e[__sfx("UE9PTF9DT1VOVFJJRVM=")],E.poolCountries),dls:fe(e[__sfx("RExT")],0),maxLatency:fe(e[__sfx("TUFYX0xBVEVOQ1k=")],0),maxNodes:0,[__sfx("cHJveHlJcA==")]:I(e[__sfx("UFJPWFlJUA==")],""),[__sfx("c29ja3M1")]:I(e[__sfx("U09DS1M1")],""),httpProxy:I(e[__sfx("SFRUUF9QUk9YWQ==")],""),proxyMode:hr(I(e[__sfx("UFJPWFlfTU9ERQ==")],"")),nat64:I(e[__sfx("TkFUNjQ=")],""),concurrentDial:F(e[__sfx("VENQX0NPTkNVUlJFTlRfRElBTA==")],!0),dataBudgetMB:fe(e[__sfx("REFUQV9CVURHRVRfTUI=")],E.dataBudgetMB),resolvePreferred:F(e[__sfx("UkVTT0xWRV9QUkVGRVJSRUQ=")],E.resolvePreferred),aggressiveRedial:F(e[__sfx("QUdHUkVTU0lWRV9SRURJQUw=")],E.aggressiveRedial),relayPool:I(e[__sfx("UkVMQVlfUE9PTA==")],""),useBuiltinRelay:F(e[__sfx("VVNFX0JVSUxUSU5fUkVMQVk=")],E.useBuiltinRelay),[__sfx("ZW5hYmxlVHJvamFu")]:F(e[__sfx("RU5BQkxFX1RST0pBTg==")]??e[__sfx("VFJPSkFO")],E[__sfx("ZW5hYmxlVHJvamFu")]),[__sfx("ZW5hYmxlWGh0dHA=")]:F(e[__sfx("RU5BQkxFX1hIVFRQ")]??e[__sfx("WEhUVFA=")],E[__sfx("ZW5hYmxlWGh0dHA=")]),subDomain:"",subProtocol:"both",subTransport:"both",subVariants:I(e[__sfx("U1VCX1ZBUklBTlRT")],E.subVariants),subName:I(e[__sfx("U1VCX05BTUU=")],E.subName).trim()||E.subName,subPorts:I(e[__sfx("U1VCX1BPUlRT")],E.subPorts),clientFingerprint:E.clientFingerprint,ech:F(e[__sfx("RUNI")],E.ech),echHost:I(e[__sfx("RUNIX0hPU1Q=")],E.echHost),echDns:I(e[__sfx("RUNIX0ROUw==")],E.echDns),tlsFragment:!1,tlsFragmentSize:E.tlsFragmentSize,tlsFragmentDelay:E.tlsFragmentDelay,subToken:gr(I(e[__sfx("U1VCX1RPS0VOX01PREU=")],"")),subTokenTtlDays:fe(e[__sfx("U1VCX1RPS0VOX1RUTF9EQVlT")],E.subTokenTtlDays),unlockProbe:F(e[__sfx("VU5MT0NLX1BST0JF")],E.unlockProbe),udpDns:yr(I(e[__sfx("VURQX0ROUw==")],"")),udpDnsEndpoint:I(e[__sfx("VURQX0ROU19FTkRQT0lOVA==")],E.udpDnsEndpoint)}}function Rs(e,t){let n={...e};for(let[o,r]of Object.entries(t))if(r!=null)if(o==="dls"||o==="maxLatency"||o==="maxNodes"||o==="officialCount"||o==="domainCount"||o==="dataBudgetMB"||o==="subTokenTtlDays")n[o]=fe(r,0);else if(o==="concurrentDial"||o==="resolvePreferred"||o==="aggressiveRedial"||o==="useBuiltinRelay"||o===__sfx("ZW5hYmxlVHJvamFu")||o===__sfx("ZW5hYmxlWGh0dHA=")||o==="tlsFragment"||o==="ech"||o==="poolOfficial"||o==="poolDomain"||o==="poolManual"||o==="unlockProbe")n[o]=F(r,!1);else if(o==="proxyMode")n[o]=hr(String(r));else if(o==="subProtocol"){let s=String(r);n[o]=s===__sfx("dmxlc3M=")||s===__sfx("dHJvamFu")||s==="both"?s:"both"}else if(o==="subTransport"){let s=String(r);n[o]=s==="ws"||s===__sfx("eGh0dHA=")||s==="both"?s:"both"}else o==="subToken"?n[o]=gr(String(r)):o==="udpDns"?n[o]=yr(String(r)):n[o]=String(r);return n}async function br(e,t){let n=Ts(t),o=await e.get(mr),r={};if(o)try{r=JSON.parse(o)}catch{r={}}let s=Rs(n,r),i=!1,a=e instanceof de,l=Date.now();o?Re=0:Re===0&&(Re=l);let u=l-Re>Cs;return a&&u&&(s.uuid||(s.uuid=st(),i=!0),s[__sfx("dHJvamFuUGFzc3dvcmQ=")]||(s[__sfx("dHJvamFuUGFzc3dvcmQ=")]=st().replace(/-/g,"").slice(0,16),i=!0),Re=0),o&&(s.officialCount<1||s.domainCount<1)&&(s.officialCount<1&&(s.officialCount=E.officialCount,i=!0),s.domainCount<1&&(s.domainCount=E.domainCount,i=!0)),i&&await vs(e,s),s}async function vs(e,t){await e.put(mr,JSON.stringify(t))}var mr,E,Re,Cs,$e=S(()=>{"use strict";ee();Te();mr="CONFIG",E={uuid:"",[__sfx("dHJvamFuUGFzc3dvcmQ=")]:"",wsPath:__sfx("L3ZsZXNz"),[__sfx("dHJvamFuUGF0aA==")]:__sfx("L3Ryb2phbg=="),[__sfx("eGh0dHBQYXRo")]:__sfx("L3hodHRw"),add:"",addApi:"",addCsv:"",poolOfficial:!0,officialCount:20,poolDomain:!0,domainCount:10,poolManual:!0,poolCountries:"",dls:0,maxLatency:0,maxNodes:0,[__sfx("cHJveHlJcA==")]:"",[__sfx("c29ja3M1")]:"",httpProxy:"",proxyMode:"only",nat64:"",concurrentDial:!0,dataBudgetMB:0,resolvePreferred:!0,aggressiveRedial:!1,relayPool:"",useBuiltinRelay:!0,[__sfx("ZW5hYmxlVHJvamFu")]:!0,[__sfx("ZW5hYmxlWGh0dHA=")]:!0,subDomain:"",subProtocol:__sfx("dmxlc3M="),subTransport:"ws",subVariants:__sfx("dmxlc3Mtd3M="),subName:__sfx("Q0ZQaWxvdA=="),subPorts:"443",clientFingerprint:"chrome",ech:!1,echHost:__sfx("Y2xvdWRmbGFyZS1lY2guY29t"),echDns:"",tlsFragment:!1,tlsFragmentSize:"10-20",tlsFragmentDelay:"10-20",subToken:"legacy",subTokenTtlDays:0,unlockProbe:!1,udpDns:"off",udpDnsEndpoint:"https://dns.google/dns-query"};Re=0,Cs=9e4});var wr,ks,ea,Is,ta,xr=S(()=>{"use strict";wr={[__sfx("SEs=")]:["HKG"],[__sfx("VFc=")]:["TPE","KHH"],[__sfx("SlA=")]:["NRT","KIX","CTS","FUK"],[__sfx("S1I=")]:["ICN","PUS"],[__sfx("U0c=")]:["SIN"],[__sfx("TVk=")]:["KUL"],[__sfx("VEg=")]:["BKK"],[__sfx("Vk4=")]:["SGN","HAN"],[__sfx("SUQ=")]:["CGK","DPS"],[__sfx("UEg=")]:["MNL"],[__sfx("SU4=")]:["BOM","MAA","DEL"],[__sfx("QVU=")]:["SYD","MEL","BNE","PER"],[__sfx("Tlo=")]:["AKL"],[__sfx("VVM=")]:["LAX","SJC","SEA","ORD","DFW","IAD","EWR","ATL","MIA","DEN","PHX","BOS"],[__sfx("Q0E=")]:["YYZ","YVR","YYC"],[__sfx("R0I=")]:["LHR","MAN"],[__sfx("REU=")]:["FRA","MUC","BER"],[__sfx("RlI=")]:["CDG","MRS"],[__sfx("Tkw=")]:["AMS"],[__sfx("SVQ=")]:["MXP","FCO"],[__sfx("RVM=")]:["MAD","BCN"],[__sfx("U0U=")]:["ARN"],[__sfx("Q0g=")]:["ZRH"],[__sfx("QVQ=")]:["VIE"],[__sfx("UEw=")]:["WAW"],[__sfx("UlU=")]:["DME","SVO"],[__sfx("VFI=")]:["IST"],[__sfx("QUU=")]:["DXB"],[__sfx("SUw=")]:["TLV"],[__sfx("WkE=")]:["JNB"],[__sfx("QlI=")]:["GRU","GIG"],[__sfx("QVI=")]:["EZE"],[__sfx("Q0w=")]:["SCL"],[__sfx("TVg=")]:["MEX"]},ks=__sfx("SEtH6aaZ5rivLFRQReWPsOWMlyxOUlTkuJzkuqwsS0lY5aSn6ZiqLElDTummluWwlCxTSU7mlrDliqDlnaEsS1VM5ZCJ6ZqG5Z2hLEJLS+abvOiwtyxTR07og6Hlv5fmmI7luIIsTU5M6ams5bC85ouJLFNZROaCieWwvCxNRUzloqjlsJTmnKwsTEFY5rSb5p2J55+2LFNKQ+Wco+S9leWhnixTRUHopb/pm4Xlm74sT1JE6Iqd5Yqg5ZOlLElBROWNjuebm+mhvyxFV1Lnur3nk6blhYssWVla5aSa5Lym5aSaLFlWUua4qeWTpeWNjixMSFLkvKbmlaYsRlJB5rOV5YWw5YWL56aPLENER+W3tOm7jixBTVPpmL/lp4bmlq/nibnkuLksTUFE6ams5b636YeMLEFSTuaWr+W+t+WTpeWwlOaRqSxJU1TkvIrmlq/lnabluIPlsJQsRFhC6L+q5ouc"),ea=(()=>{let e={};for(let t of ks.split(","))t.length>3&&(e[t.slice(0,3)]=t.slice(3));return e})(),Is=new Map;for(let[e,t]of Object.entries(wr))for(let n of t)Is.set(n,e);ta=Object.keys(wr)});var ra,Pr=S(()=>{"use strict";ra=new Set("GEOSITE GEOIP GEOIP-CIDR DOMAIN DOMAIN-SUFFIX DOMAIN-KEYWORD IP-CIDR IP-CIDR6 SRC-IP-CIDR DST-PORT SRC-PORT PROCESS-NAME MATCH".split(" "))});var wa,xa,Sr=S(()=>{"use strict";G();ee();xr();Pr();wa=2*1024*1024,xa=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});var Aa,Er=S(()=>{"use strict";Te();ee();Aa=new TextEncoder});var Xa,Ar=S(()=>{"use strict";Te();$e();ee();Xa=3600*24});function Tr(e){return pr(e)}async function Rr(e,t){if(Ce.config&&Date.now()-Ce.configAt<Ds)return Ce.config;let n=await br(e,t);return Ce.config=n,Ce.configAt=Date.now(),n}var Ds,Ce,zt=S(()=>{"use strict";Te();$e();Ar();Ds=15e3,Ce={config:null,configAt:0,auth:null,authAt:0}});var vr={};Ie(vr,{clearUnlockCache:()=>Ks,runUnlockProbe:()=>Fs});function Hs(e,t,n){return e===200?"ok":e===404?t==="status"?"region":"unknown":e===403||e===451?"blocked":t==="trace"&&/\bloc=[A-Z]{2}\b/.test(n)?"ok":"unknown"}async function Bs(e){let t=Date.now(),n=new AbortController,o=setTimeout(()=>n.abort(),Ns);try{let r=await fetch(e.url,{method:"GET",redirect:"manual",signal:n.signal,headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,*/*"}}),s="";e.mode==="trace"&&(s=(await r.text()).slice(0,512));let i=/\bloc=([A-Z]{2})\b/.exec(s)?.[1];return{id:e.id,status:r.status,verdict:Hs(r.status,e.mode,s),ms:Date.now()-t,...i?{loc:i}:{}}}catch(r){let s=r instanceof Error?r.message:String(r);return{id:e.id,status:0,verdict:"unknown",ms:Date.now()-t,error:/abort/i.test(s)?"timeout":"fetch-failed"}}finally{clearTimeout(o)}}async function Fs(e,t){let n=e||"UNK",o=Date.now(),r=ge.get(n);if(r&&o-r.at<Ls)return{...r.data,cached:!0};let s=await Promise.all(Us.map(a=>Bs(a))),i={colo:n,region:t,cached:!1,at:o,targets:s};if(ge.size>=Ms){let a="",l=Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")];for(let[u,c]of ge)c.at<l&&(l=c.at,a=u);a&&ge.delete(a)}return ge.set(n,{at:o,data:i}),i}function Ks(){ge.clear()}var Us,Ns,Ls,Ms,ge,kr=S(()=>{"use strict";Us=[{id:"netflix",url:"https://www.netflix.com/title/81215567",mode:"status"},{id:"youtube",url:"https://www.youtube.com/premium",mode:"status"},{id:"gemini",url:"https://gemini.google.com/",mode:"status"}],Ns=4e3,Ls=600*1e3,Ms=16,ge=new Map});ee();var Br=8*1024*1024,Fr=2*1024*1024,on=600*1e3,Kr=6*1024*1024*1024,it=Date.now(),at=0;function sn(e){e-it>=on&&(it=e,at=0)}function Gr(e,t=Date.now()){sn(t),at+=e}function rn(e){return sn(e),Kr-at}var Xr=(()=>{let e=new Uint8Array(65536),t=2654435769;for(let n=0;n<e.length;n++)t^=t<<13,t^=t>>>17,t^=t<<5,e[n]=t&255;return e})(),Wr=5e3;function zr(e,t=Wr){let n=!1,o=setTimeout(()=>{if(!n){n=!0;try{e(1e3,"Probe idle timeout")}catch{}}},t),r=o;return typeof r?.unref=="function"&&r.unref(),{cancel:()=>{n||(n=!0,clearTimeout(o))}}}async function lt(e){let t=new URL(e.url);if(e.headers.get("Upgrade")?.toLowerCase()===__sfx("d2Vic29ja2V0")){let u=new WebSocketPair,[c,d]=Object.values(u);d.accept();let f=zr((g,y)=>d.close(g,y));return d.addEventListener("message",g=>{let y=typeof g.data=="string"?g.data:"";if(y==="PING"||y==="ping"){f.cancel(),d.send(JSON.stringify({pong:!0,colo:e.cf?.colo??"UNK",clientIp:e.headers.get("CF-Connecting-IP")??""}));try{d.close(1e3,"Probe complete")}catch{}return}f.cancel();try{d.close(1e3,"Probe aborted")}catch{}}),d.addEventListener("close",()=>f.cancel()),d.addEventListener("error",()=>f.cancel()),new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:c})}let o=Number.parseInt(t.searchParams.get("bytes")??"",10),r=Number.isFinite(o)&&o>0?Math.min(o,Br):Fr,s=Date.now();if(rn(s)<=0){let u=Math.max(1e3,it+on-s);return new Response(JSON.stringify({ok:!1,error:"probe budget exhausted"}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(u/1e3))}})}let i=Xr,a=0,l=new ReadableStream({pull(u){let c=rn(Date.now());if(a>=r||c<=0){u.close();return}let d=Math.min(i.byteLength,r-a,c);u.enqueue(i.subarray(0,d)),a+=d,Gr(d)}});return new Response(l,{status:200,headers:{"Content-Type":"application/octet-stream","Content-Encoding":"identity","Cache-Control":"no-store","Access-Control-Allow-Origin":"*","X-Probe-Bytes":String(r),"X-Probe-Nonce":Oe(4)}})}Nt();Ft();Ct();Gt();ee();$e();Ve();Sr();Er();ee();function Wt(e){let t=e===200?"Welcome":e===404?"Not Found":"Service Unavailable",n=`<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${t}</title><style>body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;background:#f7f8fa;color:#333;font-family:-apple-system,"Segoe UI","PingFang SC",sans-serif}.c{text-align:center}h1{font-size:22px;font-weight:600;margin:0 0 10px}p{color:#888;font-size:14px;margin:0}</style></head><body><div class="c"><h1>${t}</h1><p>This site is up and running.</p></div></body></html>`;return new Response(n,{status:e,headers:{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store","X-Content-Type-Options":"nosniff"}})}zt();zt();async function Cr(e){let t=Tr(e);return await Rr(t,e)}function Vt(e){let t=[];return t.push(...Ae(e[__sfx("cHJveHlJcA==")],"direct")),t.push(...Ae(e[__sfx("c29ja3M1")],__sfx("c29ja3M1"))),t.push(...Ae(e.httpProxy,"http")),t}var Yt=6e4,Gs=10,ve=0,et=0;function Ir(e){return e>=et?(ve=0,et=e+Yt,!1):ve>=Gs}function Dr(e,t){if(!t)return!1;let n=(e.headers.get(__sfx("eC1jZnBpbG90LXRva2Vu"))??"").trim();if(!n)return!1;let o=Date.now();return be(n,t)?(ve=0,!0):(o>=et&&(et=o+Yt,ve=0),ve+=1,!1)}async function Or(e,t,n){let o=new URL(e.url);if(o.pathname===__sfx("L19fZWRnZV9wcm9iZQ=="))return lt(e);if(o.pathname===Qe||o.pathname===__sfx("L19fdmVyc2lvbg=="))return qe();if(o.pathname==="/region"&&e.method==="GET"){let{coloToCountry:i}=await Promise.resolve().then(()=>(Ee(),At)),a=e.cf?.colo??"",l=a?i(a):"";return new Response(JSON.stringify({ok:!0,colo:a,region:l,timestamp:new Date().toISOString()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8"}})}let r=await Cr(t);if(o.pathname===__sfx("L19fZGlhZw==")){if(Ir(Date.now()))return new Response(JSON.stringify({ok:!1,error:"token attempts throttled"},null,2),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(Yt/1e3))}});if(!Dr(e,r.uuid))return null;let{recentDiagnostics:i,diagnosticCounters:a,recentRoutes:l}=await Promise.resolve().then(()=>(Nt(),or)),{[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:u}=await Promise.resolve().then(()=>(Ft(),fr));return new Response(JSON.stringify({ok:!0,impl:"self",build:Kt,recent:i(),[__sfx("eGh0dHA=")]:u(),counters:a(),routes:l()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}if(o.pathname==="/__unlock_probe"){if(!r.unlockProbe)return null;if(Ir(Date.now()))return new Response(JSON.stringify({ok:!1,error:"token attempts throttled"},null,2),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}});if(!Dr(e,r.uuid))return null;let{coloToCountry:i}=await Promise.resolve().then(()=>(Ee(),At)),{runUnlockProbe:a}=await Promise.resolve().then(()=>(kr(),vr)),l=e.cf?.colo??"",u=l?i(l):"",c=await a(l,u);return new Response(JSON.stringify({ok:!0,...c},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}let s=e.headers.get("Upgrade")?.toLowerCase();return o.pathname===r.wsPath?s!==__sfx("d2Vic29ja2V0")?null:await Ze(e,__sfx("dmxlc3M="),r,Vt(r),n):r[__sfx("ZW5hYmxlVHJvamFu")]&&o.pathname===r[__sfx("dHJvamFuUGF0aA==")]?s!==__sfx("d2Vic29ja2V0")?null:await Ze(e,__sfx("dHJvamFu"),r,Vt(r),n):r[__sfx("ZW5hYmxlWGh0dHA=")]&&Ht(o.pathname,r[__sfx("eGh0dHBQYXRo")])?await Bt(e,r,Vt(r)):null}Gt();var Nl={async fetch(e,t,n){try{return new URL(e.url).pathname===Qe?qe():await Or(e,t,n)??Wt(200)}catch{return Wt(500)}}};export{Nl as default};
|
|
5
|
+
`):__sfx("5Ye656uZ6L+e5o6l5aSx6LSl77ya")+String(B)+"";Q(`${m.hostname}:${m.port}`,x,C),D(1011,C);return}let M=f.writable.getWriter();g=M,nr(`${m.hostname}:${m.port}`,f,"initial");let O=l.byteLength>m.headerLength?l.subarray(m.headerLength):new Uint8Array(0);l=new Uint8Array(0);try{await y.run(async()=>{O.byteLength>0&&(tt(O),await M.write(O)),await Qt(M)})}catch(C){Q(`${m.hostname}:${m.port}`,[],__sfx("5LiK6KGM6aaW5YyF5YaZ5YWl5aSx6LSl77ya")+String(C)+""),h()}r?.waitUntil(_t())},$t=async m=>{if(K||R)return;let b=N;if(!b){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55uu5qCH5pyq6Kej5p6Q"));return}if(j>=Ut){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55u06L+e5LiO5Y+N5Luj5YWl5Y+j5Z2H5peg5ZON5bqU"));return}R=!0;let x=xn({via:f?.via,port:b.port,userProxyConfigured:o.length>0||!!n[__sfx("cHJveHlJcA==")],aggressive:n.aggressiveRedial===!0});if(!x.allowed){he.guardedRedials++,Q(`${b.hostname}:${b.port}`,[],__sfx("5Ye656uZ5peg5pWw5o2u77ya")+x.reason+__sfx("77yb5pyq5YiH5o2i5Y+N5Luj77yI5Y+v5byA5ZCvIGFnZ3Jlc3NpdmVSZWRpYWzvvIk=")),D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya")+x.reason+"");return}j++,m==="stall"?he.stallRedials++:he.eofRedials++,Q(`${b.hostname}:${b.port}`,[],m==="stall"?__sfx("55u06L+eIA==")+$n+__sfx("bXMg5peg5LiL6KGM5pWw5o2u77yM5pS56LWw5Y+N5Luj5YWl5Y+j"):__sfx("5Ye656uZ6Zu25LiL6KGM5Y2zIEVPRi9SZXNldO+8jOeri+WNs+aUuei1sOWPjeS7o+WFpeWPow=="));let B=[];try{B=await Se({userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay})}catch{B=[]}let M=B.filter(O=>!v.has(`${O.ip}:${O.port}`));if(M.length===0){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5peg5Y+N5Luj5YWl5Y+j5Y+v55So"));return}for(let O of M.slice(0,Ut)){if(v.add(`${O.ip}:${O.port}`),Ur(),f){let C=f;if(C.close)try{C.close()}catch{}}g=null,ae=0;try{let C=await pe({hostname:O.ip,port:O.port,timeoutMs:qn,resolvePreferred:!1,skipTargetPolicy:!0,proxies:n.aggressiveRedial?o:void 0,proxyMode:n.aggressiveRedial?n.proxyMode:void 0});if(!C)continue;f=C,nr(`${b.hostname}:${b.port}`,C,"redial");let ye=C.writable.getWriter();g=ye;let tn=0;for(let ke of U)tn+=ke.byteLength;let ot=new Uint8Array(tn),nn=0;for(let ke of U)ot.set(ke,nn),nn+=ke.byteLength;await y.run(async()=>{ot.byteLength>0&&await ye.write(ot),await Qt(ye)}),Q(`${b.hostname}:${b.port}`,[],__sfx("5bey5YiH5o2i5Y+N5Luj5YWl5Y+jIA==")+O.ip+":"+O.port+""),r?.waitUntil(_t());return}catch(C){Q(`${b.hostname}:${b.port}`,[],__sfx("5Y+N5Luj5YWl5Y+jIA==")+O.ip+":"+O.port+__sfx("IOWksei0pe+8mg==")+String(C)+"")}}D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5omA5pyJ5Y+N5Luj5YWl5Y+j5Z2H5aSx6LSl"))};a.addEventListener("message",m=>{(async()=>{let b=m.data,x=typeof b=="string"?new TextEncoder().encode(b):new Uint8Array(b);if(x.byteLength!==0){if(p(),Zt.add(x.byteLength)){Jt();return}if(!d){if(l=wn(l,x),l.byteLength>_o){D(1009,__sfx("5o+h5omL5aS06LaF6L+HIDY0S0I="));return}await rt();return}if(Y){Y.push(x);return}if(!g){if(me.bytes+x.byteLength>Jo){D(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}if(u.push(x),c+=x.byteLength,me.bytes+=x.byteLength,c>er){D(1009,__sfx("5ouo5Y+35pyf6Ze05pWw5o2u6L+H5aSa"));return}return}tt(x),await Nr(x)}})()});let en=()=>{h()};a.addEventListener("close",en),a.addEventListener("error",en),l.byteLength>0?rt().catch(m=>D(1011,String(m))):T=setTimeout(()=>{T=null,!(K||d||l.byteLength>0)&&(he.firstPacketTimeouts++,D(1008,__sfx("6aaW5YyF6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0")))},ts);try{return new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:i})}catch(m){return console.error(__sfx("W+iHqueglOaVsOaNrumdol0gMTAxIOWTjeW6lOaehOmAoOWksei0pe+8mg=="),m),new Response(null,{status:200})}}var qn,$n,Ut,_o,er,Zo,Ye,Jo,me,je,tr,he,_e,es,ts,Nt=S(()=>{"use strict";dt();yn();bn();Pe();Pn();Sn();Ot();Ve();Rt();Ee();qn=5e3,$n=2500,Ut=2,_o=64*1024,er=8*1024*1024,Zo=32*1024*1024,Ye=0,Jo=32*1024*1024,me={bytes:0};je=[],tr=20,he={stallRedials:0,eofRedials:0,guardedRedials:0,firstPacketTimeouts:0,downlinkYields:0};_e=[];es=2e3,ts=8e3});var fr={};Ie(fr,{[__sfx("Y2xlYXJYaHR0cFNlc3Npb25z")]:()=>ds,[__sfx("aGFuZGxlWGh0dHA=")]:()=>Bt,[__sfx("aXNYaHR0cFBhdGg=")]:()=>Ht,[__sfx("cGFyc2VYaHR0cFJvdXRl")]:()=>Mt,[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:()=>ss,[__sfx("cmVjb3JkWGh0dHBEaWFnbm9zdGljcw==")]:()=>V});function os(e,t){return new Promise(n=>{let o=setTimeout(()=>n(null),t);e.then(r=>{clearTimeout(o),n(r)},()=>{clearTimeout(o),n(null)})})}function V(e,t,n){Je.unshift({at:Date.now(),target:e,...t,summary:n}),Je.length>20&&(Je.length=20)}function ss(){return Je}function is(e){return String(e||"").trim().replace(/\/+$/,"")||"/"}function Mt(e,t){let n=is(t??__sfx("L3hodHRw"));if(e===n||e===`${n}/`)return{kind:"stream-one"};let o=`${n}/`;if(!e.startsWith(o))return null;let r=e.slice(o.length);if(!r)return null;let s=r.split("/");if(s.length===1&&s[0])return/[\s\u0000-\u001f]/.test(s[0])?null:{kind:"session",sessionId:s[0]};if(s.length===2&&s[0]&&/^\d+$/.test(s[1])){if(/[\s\u0000-\u001f]/.test(s[0]))return null;let i=Number(s[1]);return!Number.isSafeInteger(i)||i<0||i>1e6?null:{kind:__sfx("cGFja2V0LXVw"),sessionId:s[0],seq:i}}return null}function Ht(e,t){return Mt(e,t)!==null}function cs(e){if(e.reservedBytes<=0){e.reservedBytes=0;return}ue=Math.max(0,ue-e.reservedBytes),e.reservedBytes=0}function us(e,t){if(t<=0)return;let n=Math.min(t,e.reservedBytes);ue=Math.max(0,ue-n),e.reservedBytes-=n}function lr(e,t){return t<=0?!0:ue+t>ls?!1:(ue+=t,e.reservedBytes+=t,!0)}function ds(){for(let[e,t]of W)z(e,t);W.clear(),ue=0}function fs(e,t){return t-e.lastUploadAt>Lt&&t-e.lastDownlinkAt>Lt&&t-e.lastActivityAt>Lt}function ps(e,t){return e.closed?!0:e.header||e.dialResult||e.downlinkStarted?!1:t-e.createdAt>cr}function ur(e,t,n,o){let r=Date.now();for(let[a,l]of W)(l.closed||fs(l,r)||!l.header&&r-l.createdAt>30*6e4)&&z(a,l);let s=W.get(e);if(s)return dr(s,n,r),s;if(W.size>=sr){for(let[a,l]of W)ps(l,r)&&z(a,l);if(W.size>=sr)return null}if(!o){let a=0;for(let l of W.values())l.header||(a+=1);if(a>=as)return null}let i={id:e,createdAt:r,lastUploadAt:r,lastDownlinkAt:r,lastActivityAt:r,header:void 0,headerWaiters:[],dialPromise:null,dialResult:null,pending:new Map,reservedBytes:0,nextPumpSeq:0,pumpStarted:!1,signalResolve:null,traffic:new ce(t),downlinkStarted:!1,closed:!1,targetLabel:""};return W.set(e,i),i}function dr(e,t,n){t==="upload"?e.lastUploadAt=n:e.lastDownlinkAt=n,e.lastActivityAt=n}function z(e,t){if(!t.closed){t.closed=!0;for(let n of t.headerWaiters)try{n(null)}catch{}if(t.headerWaiters=[],t.signalResolve?.(),t.signalResolve=null,t.dialResult?.close)try{t.dialResult.close()}catch{}cs(t),t.pending.clear(),W.delete(e)}}function ms(e){let t=e.signalResolve;e.signalResolve=null,t?.()}function hs(e,t){return e.header?Promise.resolve(e.header):e.closed?Promise.resolve(null):new Promise(n=>{let o=s=>{clearTimeout(r),n(s)},r=setTimeout(()=>{let s=e.headerWaiters.indexOf(o);s>=0&&e.headerWaiters.splice(s,1),n(null)},t);e.headerWaiters.push(o)})}function gs(e,t){e.header=t;let n=e.headerWaiters;e.headerWaiters=[];for(let o of n)try{o(t)}catch{}}function L(e){let t=100+Math.floor(Math.random()*900);return{"Content-Type":"text/event-stream","Cache-Control":"no-store","X-Accel-Buffering":"no","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST","X-Padding":"X".repeat(t),...e}}function ys(e){let t=e.addons,n=new Uint8Array(2+t.byteLength);return n[0]=e.version,n[1]=t.byteLength,n.set(t,2),n}async function bs(e,t,n){if(e.dialResult)return e.dialResult;if(!e.dialPromise){let o=e.header;if(!o)throw new Error(__sfx("VkxFU1Mg5aS05pyq5Yiw6L6+"));e.targetLabel=`${o.hostname}:${o.port}`,e.dialPromise=pe({hostname:o.hostname,port:o.port,proxies:n,nat64:t.nat64,concurrent:t.concurrentDial,proxyMode:t.proxyMode,resolvePreferred:t.resolvePreferred,relayPool:{userEntries:t.relayPool||void 0,useBuiltin:t.useBuiltinRelay},onFailure:r=>{V(e.targetLabel,r,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+r.candidate+"):"+r.message+"")}}).then(r=>(e.dialResult=r,r)).catch(r=>{throw V(e.targetLabel,{kind:"dial",message:String(r),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(r)+""),r})}return await e.dialPromise}async function ws(e,t){let n=t.writable.getWriter();try{for(;!e.closed;){let o=e.pending.get(e.nextPumpSeq);if(o){if(e.pending.delete(e.nextPumpSeq),e.nextPumpSeq+=1,us(e,o.byteLength),o.byteLength===0)continue;if(e.traffic.add(o.byteLength)){V(e.targetLabel,{kind:"budget",message:__sfx("5rWB6YeP6LaF6ZmQ"),candidate:"traffic"},__sfx("WEhUVFAg5LiK6KGM5rWB6YeP6LaF6ZmQ"));break}try{await n.write(o)}catch(i){V(e.targetLabel,{kind:"relay-write",message:String(i),candidate:t.endpoint},__sfx("WEhUVFAg5YaZ5YWl55uu5qCH5aSx6LSl77ya")+String(i)+"");break}continue}let r=null,s=new Promise(i=>{r=i});if(e.signalResolve=r,e.pending.has(e.nextPumpSeq)||e.closed){e.signalResolve=null;continue}await s}}finally{try{n.releaseLock()}catch{}}}async function xs(e,t,n,o,r){let s=(t.dataBudgetMB||0)*1024*1024,i=ur(o,s,"upload",r===0);if(!i)return new Response(__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ77yM6K+356iN5ZCO6YeN6K+V"),{status:503,headers:L()});if(i.closed)return null;let a=Number(e.headers.get("content-length")??"");if(Number.isFinite(a)&&a>ir)return new Response(__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ"),{status:413,headers:L()});let l;try{let u=await e.arrayBuffer();l=new Uint8Array(u)}catch{return new Response(__sfx("6K+35rGC5L2T6K+75Y+W5aSx6LSl"),{status:400,headers:L()})}if(l.byteLength>ir)return new Response(__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ"),{status:413,headers:L()});if(r===0&&!i.header){let u=Ue(l,t.uuid);if(!u)return z(o,i),new Response(__sfx("VkxFU1Mg5aS06Kej5p6Q5aSx6LSl"),{status:400,headers:L()});if(u.header.command!==ut)return z(o,i),new Response(__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),{status:400,headers:L()});gs(i,u.header),i.targetLabel=`${u.header.hostname}:${u.header.port}`;let c=l.subarray(u.consumed);if(r>=i.nextPumpSeq&&!i.pending.has(r)){if(i.pending.size>=ar)return z(o,i),new Response(__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),{status:503,headers:L()});if(!lr(i,c.byteLength))return z(o,i),new Response(__sfx("5pqC5a2Y6LaF6ZmQ"),{status:503,headers:L()});i.pending.set(r,c.slice())}}else{if(r<i.nextPumpSeq||i.pending.has(r))return new Response(null,{status:200,headers:L()});if(i.pending.size>=ar)return z(o,i),new Response(__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),{status:503,headers:L()});if(!lr(i,l.byteLength))return z(o,i),new Response(__sfx("5pqC5a2Y6LaF6ZmQ"),{status:503,headers:L()});i.pending.set(r,l.slice())}return ms(i),new Response(null,{status:200,headers:L()})}async function Ps(e,t,n,o){let r=(t.dataBudgetMB||0)*1024*1024,s=ur(o,r,"downlink",!1);if(!s)return new Response(__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ77yM6K+356iN5ZCO6YeN6K+V"),{status:503,headers:L()});if(s.closed||s.downlinkStarted)return null;s.downlinkStarted=!0;let i=hs(s,cr),a=!1,l=null,u=null,c=!1,d=null,f=()=>{z(o,s)},g=new ReadableStream({start(y){u=y},async pull(y){if(!a)try{if(!c){let p=await i;if(a)return;if(!p){f(),y.close();return}try{d=await bs(s,t,n)}catch{f(),y.close();return}if(a)return;s.pumpStarted||(s.pumpStarted=!0,ws(s,d).catch(()=>{}));try{y.enqueue(ys(p))}catch{}c=!0;return}if(!d)return;l||(l=d.readable.getReader());let{done:P,value:T}=await l.read();if(a)return;if(P){f();try{y.close()}catch{}return}if(T&&T.byteLength>0){if(dr(s,"downlink",Date.now()),s.traffic.add(T.byteLength)){V(s.targetLabel,{kind:"budget",message:__sfx("5rWB6YeP6LaF6ZmQ"),candidate:"traffic"},__sfx("WEhUVFAg5LiL6KGM5rWB6YeP6LaF6ZmQ")),f();try{y.close()}catch{}return}y.enqueue(T)}}catch(P){if(a)return;f();try{y.error(P)}catch{}}},cancel(y){if(a=!0,d)try{d.readable.cancel(y)}catch{}f()}});return new Response(g,{status:200,headers:L()})}async function Bt(e,t,n){let o=__sfx("L3hodHRw");try{o=new URL(e.url).pathname}catch{o=__sfx("L3hodHRw")}let r=Mt(o,t[__sfx("eGh0dHBQYXRo")]);return r?r.kind==="stream-one"?e.method!=="POST"?null:await Ss(e,t,n):r.kind===__sfx("cGFja2V0LXVw")?e.method!=="POST"?null:await xs(e,t,n,r.sessionId,r.seq):e.method==="GET"?await Ps(e,t,n,r.sessionId):null:null}async function Ss(e,t,n){let o=e.body;if(!o)return new Response(__sfx("57y65bCR6K+35rGC5L2T"),{status:400});let r=new ne(o),s=await os(un(r,t.uuid),rs);if(!s)return await r.cancel("header timeout"),new Response(__sfx("VkxFU1Mg5aS06Kej5p6Q5aSx6LSl"),{status:400});if(s.header.command!==ut)return await s.payload.cancel("unsupported UDP"),new Response(__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),{status:400});let i;try{i=await pe({hostname:s.header.hostname,port:s.header.port,proxies:n,nat64:t.nat64,concurrent:t.concurrentDial,proxyMode:t.proxyMode,resolvePreferred:t.resolvePreferred,relayPool:{userEntries:t.relayPool||void 0,useBuiltin:t.useBuiltinRelay},onFailure:p=>{V(`${s.header.hostname}:${s.header.port}`,p,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+p.candidate+"):"+p.message+"")}})}catch(p){V(`${s.header.hostname}:${s.header.port}`,{kind:"dial",message:String(p),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(p)+"");try{s.payload.cancel("dial failed").catch(()=>{})}catch{}return new Response(__sfx("5Ye656uZ5LiN5Y+v55So"),{status:502})}let a=s.header.addons;if(a.byteLength>255)return new Response(__sfx("QWRkb25zIOmVv+W6pui2heWHuiBWTEVTUyDljY/orq7kuIrpmZA="),{status:400});let l=new Uint8Array(2+a.byteLength);l[0]=s.header.version,l[1]=a.byteLength,l.set(a,2);let u=!1,c=null,d=!1,f=new ce((t.dataBudgetMB||0)*1024*1024),g=null,y=()=>{if(d)return;d=!0;let p=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+t.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");if(V(`${s.header.hostname}:${s.header.port}`,{kind:"budget",message:p,candidate:"traffic"},p),i.close)try{i.close()}catch{}try{g?.close()}catch{}},P=p=>f.add(p)?(y(),!0):!1;Qn(s.payload,i.writable,void 0,!1,P,(p,R)=>{let A=p instanceof Error?p.message:String(p),k=`relay-${R}`;/cancel|abort|closed/i.test(A)?k=`relay-${R}-client-cancel`:/reset|broken pipe/i.test(A)&&(k=`relay-${R}-upstream-reset`),V(`${s.header.hostname}:${s.header.port}`,{kind:k,message:A.slice(0,200),candidate:i.endpoint},__sfx("WEhUVFAg5Lit57un")+R==="read"?"\u8BFB\u4E0A\u6E38":"\u5199\u76EE\u6807"+__sfx("5aSx6LSl77yI")+k+"):"+A.slice(0,120)+"")}).catch(()=>{});let T=new ReadableStream({start(p){g=p,p.enqueue(l),u=!0},async pull(p){if(!(d||!u)){c||(c=i.readable.getReader());try{let{done:R,value:A}=await c.read();if(d)return;if(R){if(i.close)try{i.close()}catch{}p.close();return}if(A&&A.byteLength>0){if(f.add(A.byteLength)){y();return}p.enqueue(A)}}catch(R){if(d)return;if(i.close)try{i.close()}catch{}try{p.error(R)}catch{}}}},cancel(p){d=!0;try{i.readable.cancel(p)}catch{}if(i.close)try{i.close()}catch{}}});return new Response(T,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-store","X-Accel-Buffering":"no"}})}var rs,Je,W,cr,sr,as,Lt,ir,ar,ls,ue,Ft=S(()=>{"use strict";Pe();dt();Ve();Ot();rs=2e3;Je=[];W=new Map,cr=3e4,sr=100,as=20,Lt=10*6e4,ir=10*1024*1024,ar=30,ls=32*1024*1024,ue=0});function qe(){return new Response(JSON.stringify({build:Kt,version:Es,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var Kt,Es,Qe,Gt=S(()=>{"use strict";Kt="8b1bb07-a5e14406",Es=__sfx("MC40MC4y"),Qe=__sfx("L19fY2ZwX3ZlcnNpb24=")});function pr(e){return e[__sfx("S1Y=")]?new de(e[__sfx("S1Y=")]):new Xt}var de,Xt,Te=S(()=>{"use strict";de=class{constructor(t){this.kv=t}kv;async get(t){return await this.kv.get(t)}async put(t,n,o){o&&o>=60?await this.kv.put(t,n,{expirationTtl:o}):await this.kv.put(t,n)}async delete(t){await this.kv.delete(t)}async list(t){let n=[],o;do{let r=await this.kv.list({prefix:t,cursor:o});for(let s of r.keys)n.push(s.name);o=r.list_complete?void 0:r.cursor}while(o);return n}},Xt=class{data=new Map;async get(t){let n=this.data.get(t);return n?n.expiresAt>0&&n.expiresAt<=Date.now()?(this.data.delete(t),null):n.value:null}async put(t,n,o){let r=o?Date.now()+o*1e3:0;this.data.set(t,{value:n,expiresAt:r})}async delete(t){this.data.delete(t)}async list(t){return[...this.data.keys()].filter(n=>n.startsWith(t))}}});function fe(e,t){if(e==null)return t;let n=String(e).trim();if(n==="")return t;let o=Number(n);return Number.isFinite(o)?o:t}function F(e,t){if(e==null||e==="")return t;let n=String(e).trim().toLowerCase();return["1","true","yes","on"].includes(n)?!0:["0","false","no","off"].includes(n)?!1:t}function hr(e){let t=e.trim().toLowerCase();return t==="global"||t==="fallback"||t==="smart"?t:"only"}function gr(e){return e.trim().toLowerCase()==="signed"?"signed":"legacy"}function yr(e){return e.trim().toLowerCase()==="doh"?"doh":"off"}function I(e,t){return e==null?t:String(e)}function As(e){let t=e.trim();return t?`/${t.replace(/^\/+/,"")}`:E.wsPath}function Ts(e){return{uuid:I(e[__sfx("VVVJRA==")],""),[__sfx("dHJvamFuUGFzc3dvcmQ=")]:I(e[__sfx("VFJPSkFOX1BBU1NXT1JE")],""),wsPath:As(I(e[__sfx("V1NfUEFUSA==")]||e[__sfx("UEFUSA==")],E.wsPath)),[__sfx("dHJvamFuUGF0aA==")]:E[__sfx("dHJvamFuUGF0aA==")],[__sfx("eGh0dHBQYXRo")]:E[__sfx("eGh0dHBQYXRo")],add:I(e[__sfx("QURE")],""),addApi:I(e[__sfx("QUREQVBJ")],""),addCsv:I(e[__sfx("QUREX0NTVg==")],""),poolOfficial:F(e[__sfx("T0ZGSUNJQUxfSVA=")],E.poolOfficial),officialCount:fe(e[__sfx("T0ZGSUNJQUxfSVBfQ09VTlQ=")],E.officialCount),poolDomain:F(e[__sfx("UFJFRkVSUkVEX0RPTUFJTg==")],E.poolDomain),domainCount:fe(e[__sfx("UFJFRkVSUkVEX0RPTUFJTl9DT1VOVA==")],E.domainCount),poolManual:F(e[__sfx("TUFOVUFMX0lQ")],E.poolManual),poolCountries:I(e[__sfx("UE9PTF9DT1VOVFJJRVM=")],E.poolCountries),dls:fe(e[__sfx("RExT")],0),maxLatency:fe(e[__sfx("TUFYX0xBVEVOQ1k=")],0),maxNodes:0,[__sfx("cHJveHlJcA==")]:I(e[__sfx("UFJPWFlJUA==")],""),[__sfx("c29ja3M1")]:I(e[__sfx("U09DS1M1")],""),httpProxy:I(e[__sfx("SFRUUF9QUk9YWQ==")],""),proxyMode:hr(I(e[__sfx("UFJPWFlfTU9ERQ==")],"")),nat64:I(e[__sfx("TkFUNjQ=")],""),concurrentDial:F(e[__sfx("VENQX0NPTkNVUlJFTlRfRElBTA==")],!0),dataBudgetMB:fe(e[__sfx("REFUQV9CVURHRVRfTUI=")],E.dataBudgetMB),resolvePreferred:F(e[__sfx("UkVTT0xWRV9QUkVGRVJSRUQ=")],E.resolvePreferred),aggressiveRedial:F(e[__sfx("QUdHUkVTU0lWRV9SRURJQUw=")],E.aggressiveRedial),relayPool:I(e[__sfx("UkVMQVlfUE9PTA==")],""),useBuiltinRelay:F(e[__sfx("VVNFX0JVSUxUSU5fUkVMQVk=")],E.useBuiltinRelay),[__sfx("ZW5hYmxlVHJvamFu")]:F(e[__sfx("RU5BQkxFX1RST0pBTg==")]??e[__sfx("VFJPSkFO")],E[__sfx("ZW5hYmxlVHJvamFu")]),[__sfx("ZW5hYmxlWGh0dHA=")]:F(e[__sfx("RU5BQkxFX1hIVFRQ")]??e[__sfx("WEhUVFA=")],E[__sfx("ZW5hYmxlWGh0dHA=")]),subDomain:"",subProtocol:"both",subTransport:"both",subVariants:I(e[__sfx("U1VCX1ZBUklBTlRT")],E.subVariants),subName:I(e[__sfx("U1VCX05BTUU=")],E.subName).trim()||E.subName,subPorts:I(e[__sfx("U1VCX1BPUlRT")],E.subPorts),clientFingerprint:E.clientFingerprint,ech:F(e[__sfx("RUNI")],E.ech),echHost:I(e[__sfx("RUNIX0hPU1Q=")],E.echHost),echDns:I(e[__sfx("RUNIX0ROUw==")],E.echDns),tlsFragment:!1,tlsFragmentSize:E.tlsFragmentSize,tlsFragmentDelay:E.tlsFragmentDelay,subToken:gr(I(e[__sfx("U1VCX1RPS0VOX01PREU=")],"")),subTokenTtlDays:fe(e[__sfx("U1VCX1RPS0VOX1RUTF9EQVlT")],E.subTokenTtlDays),unlockProbe:F(e[__sfx("VU5MT0NLX1BST0JF")],E.unlockProbe),udpDns:yr(I(e[__sfx("VURQX0ROUw==")],"")),udpDnsEndpoint:I(e[__sfx("VURQX0ROU19FTkRQT0lOVA==")],E.udpDnsEndpoint)}}function Rs(e,t){let n={...e};for(let[o,r]of Object.entries(t))if(r!=null)if(o==="dls"||o==="maxLatency"||o==="maxNodes"||o==="officialCount"||o==="domainCount"||o==="dataBudgetMB"||o==="subTokenTtlDays")n[o]=fe(r,0);else if(o==="concurrentDial"||o==="resolvePreferred"||o==="aggressiveRedial"||o==="useBuiltinRelay"||o===__sfx("ZW5hYmxlVHJvamFu")||o===__sfx("ZW5hYmxlWGh0dHA=")||o==="tlsFragment"||o==="ech"||o==="poolOfficial"||o==="poolDomain"||o==="poolManual"||o==="unlockProbe")n[o]=F(r,!1);else if(o==="proxyMode")n[o]=hr(String(r));else if(o==="subProtocol"){let s=String(r);n[o]=s===__sfx("dmxlc3M=")||s===__sfx("dHJvamFu")||s==="both"?s:"both"}else if(o==="subTransport"){let s=String(r);n[o]=s==="ws"||s===__sfx("eGh0dHA=")||s==="both"?s:"both"}else o==="subToken"?n[o]=gr(String(r)):o==="udpDns"?n[o]=yr(String(r)):n[o]=String(r);return n}async function br(e,t){let n=Ts(t),o=await e.get(mr),r={};if(o)try{r=JSON.parse(o)}catch{r={}}let s=Rs(n,r),i=!1,a=e instanceof de,l=Date.now();o?Re=0:Re===0&&(Re=l);let u=l-Re>Cs;return a&&u&&(s.uuid||(s.uuid=st(),i=!0),s[__sfx("dHJvamFuUGFzc3dvcmQ=")]||(s[__sfx("dHJvamFuUGFzc3dvcmQ=")]=st().replace(/-/g,"").slice(0,16),i=!0),Re=0),o&&(s.officialCount<1||s.domainCount<1)&&(s.officialCount<1&&(s.officialCount=E.officialCount,i=!0),s.domainCount<1&&(s.domainCount=E.domainCount,i=!0)),i&&await vs(e,s),s}async function vs(e,t){await e.put(mr,JSON.stringify(t))}var mr,E,Re,Cs,$e=S(()=>{"use strict";ee();Te();mr="CONFIG",E={uuid:"",[__sfx("dHJvamFuUGFzc3dvcmQ=")]:"",wsPath:__sfx("L3ZsZXNz"),[__sfx("dHJvamFuUGF0aA==")]:__sfx("L3Ryb2phbg=="),[__sfx("eGh0dHBQYXRo")]:__sfx("L3hodHRw"),add:"",addApi:"",addCsv:"",poolOfficial:!0,officialCount:20,poolDomain:!0,domainCount:10,poolManual:!0,poolCountries:"",dls:0,maxLatency:0,maxNodes:0,[__sfx("cHJveHlJcA==")]:"",[__sfx("c29ja3M1")]:"",httpProxy:"",proxyMode:"only",nat64:"",concurrentDial:!0,dataBudgetMB:0,resolvePreferred:!0,aggressiveRedial:!1,relayPool:"",useBuiltinRelay:!0,[__sfx("ZW5hYmxlVHJvamFu")]:!0,[__sfx("ZW5hYmxlWGh0dHA=")]:!0,subDomain:"",subProtocol:__sfx("dmxlc3M="),subTransport:"ws",subVariants:__sfx("dmxlc3Mtd3M="),subName:__sfx("Q0ZQaWxvdA=="),subPorts:"443",clientFingerprint:"chrome",ech:!1,echHost:__sfx("Y2xvdWRmbGFyZS1lY2guY29t"),echDns:"",tlsFragment:!1,tlsFragmentSize:"10-20",tlsFragmentDelay:"10-20",subToken:"legacy",subTokenTtlDays:0,unlockProbe:!1,udpDns:"off",udpDnsEndpoint:"https://dns.google/dns-query"};Re=0,Cs=9e4});var wr,ks,ea,Is,ta,xr=S(()=>{"use strict";wr={[__sfx("SEs=")]:["HKG"],[__sfx("VFc=")]:["TPE","KHH"],[__sfx("SlA=")]:["NRT","KIX","CTS","FUK"],[__sfx("S1I=")]:["ICN","PUS"],[__sfx("U0c=")]:["SIN"],[__sfx("TVk=")]:["KUL"],[__sfx("VEg=")]:["BKK"],[__sfx("Vk4=")]:["SGN","HAN"],[__sfx("SUQ=")]:["CGK","DPS"],[__sfx("UEg=")]:["MNL"],[__sfx("SU4=")]:["BOM","MAA","DEL"],[__sfx("QVU=")]:["SYD","MEL","BNE","PER"],[__sfx("Tlo=")]:["AKL"],[__sfx("VVM=")]:["LAX","SJC","SEA","ORD","DFW","IAD","EWR","ATL","MIA","DEN","PHX","BOS"],[__sfx("Q0E=")]:["YYZ","YVR","YYC"],[__sfx("R0I=")]:["LHR","MAN"],[__sfx("REU=")]:["FRA","MUC","BER"],[__sfx("RlI=")]:["CDG","MRS"],[__sfx("Tkw=")]:["AMS"],[__sfx("SVQ=")]:["MXP","FCO"],[__sfx("RVM=")]:["MAD","BCN"],[__sfx("U0U=")]:["ARN"],[__sfx("Q0g=")]:["ZRH"],[__sfx("QVQ=")]:["VIE"],[__sfx("UEw=")]:["WAW"],[__sfx("UlU=")]:["DME","SVO"],[__sfx("VFI=")]:["IST"],[__sfx("QUU=")]:["DXB"],[__sfx("SUw=")]:["TLV"],[__sfx("WkE=")]:["JNB"],[__sfx("QlI=")]:["GRU","GIG"],[__sfx("QVI=")]:["EZE"],[__sfx("Q0w=")]:["SCL"],[__sfx("TVg=")]:["MEX"]},ks=__sfx("SEtH6aaZ5rivLFRQReWPsOWMlyxOUlTkuJzkuqwsS0lY5aSn6ZiqLElDTummluWwlCxTSU7mlrDliqDlnaEsS1VM5ZCJ6ZqG5Z2hLEJLS+abvOiwtyxTR07og6Hlv5fmmI7luIIsTU5M6ams5bC85ouJLFNZROaCieWwvCxNRUzloqjlsJTmnKwsTEFY5rSb5p2J55+2LFNKQ+Wco+S9leWhnixTRUHopb/pm4Xlm74sT1JE6Iqd5Yqg5ZOlLElBROWNjuebm+mhvyxFV1Lnur3nk6blhYssWVla5aSa5Lym5aSaLFlWUua4qeWTpeWNjixMSFLkvKbmlaYsRlJB5rOV5YWw5YWL56aPLENER+W3tOm7jixBTVPpmL/lp4bmlq/nibnkuLksTUFE6ams5b636YeMLEFSTuaWr+W+t+WTpeWwlOaRqSxJU1TkvIrmlq/lnabluIPlsJQsRFhC6L+q5ouc"),ea=(()=>{let e={};for(let t of ks.split(","))t.length>3&&(e[t.slice(0,3)]=t.slice(3));return e})(),Is=new Map;for(let[e,t]of Object.entries(wr))for(let n of t)Is.set(n,e);ta=Object.keys(wr)});var ra,Pr=S(()=>{"use strict";ra=new Set("GEOSITE GEOIP GEOIP-CIDR DOMAIN DOMAIN-SUFFIX DOMAIN-KEYWORD IP-CIDR IP-CIDR6 SRC-IP-CIDR DST-PORT SRC-PORT PROCESS-NAME MATCH".split(" "))});var wa,xa,Sr=S(()=>{"use strict";G();ee();xr();Pr();wa=2*1024*1024,xa=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});var Aa,Er=S(()=>{"use strict";Te();ee();Aa=new TextEncoder});var Xa,Ar=S(()=>{"use strict";Te();$e();ee();Xa=3600*24});function Tr(e){return pr(e)}async function Rr(e,t){if(Ce.config&&Date.now()-Ce.configAt<Ds)return Ce.config;let n=await br(e,t);return Ce.config=n,Ce.configAt=Date.now(),n}var Ds,Ce,zt=S(()=>{"use strict";Te();$e();Ar();Ds=15e3,Ce={config:null,configAt:0,auth:null,authAt:0}});var vr={};Ie(vr,{clearUnlockCache:()=>Ks,runUnlockProbe:()=>Fs});function Hs(e,t,n){return e===200?"ok":e===404?t==="status"?"region":"unknown":e===403||e===451?"blocked":t==="trace"&&/\bloc=[A-Z]{2}\b/.test(n)?"ok":"unknown"}async function Bs(e){let t=Date.now(),n=new AbortController,o=setTimeout(()=>n.abort(),Ns);try{let r=await fetch(e.url,{method:"GET",redirect:"manual",signal:n.signal,headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,*/*"}}),s="";e.mode==="trace"&&(s=(await r.text()).slice(0,512));let i=/\bloc=([A-Z]{2})\b/.exec(s)?.[1];return{id:e.id,status:r.status,verdict:Hs(r.status,e.mode,s),ms:Date.now()-t,...i?{loc:i}:{}}}catch(r){let s=r instanceof Error?r.message:String(r);return{id:e.id,status:0,verdict:"unknown",ms:Date.now()-t,error:/abort/i.test(s)?"timeout":"fetch-failed"}}finally{clearTimeout(o)}}async function Fs(e,t){let n=e||"UNK",o=Date.now(),r=ge.get(n);if(r&&o-r.at<Ls)return{...r.data,cached:!0};let s=await Promise.all(Us.map(a=>Bs(a))),i={colo:n,region:t,cached:!1,at:o,targets:s};if(ge.size>=Ms){let a="",l=Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")];for(let[u,c]of ge)c.at<l&&(l=c.at,a=u);a&&ge.delete(a)}return ge.set(n,{at:o,data:i}),i}function Ks(){ge.clear()}var Us,Ns,Ls,Ms,ge,kr=S(()=>{"use strict";Us=[{id:"netflix",url:"https://www.netflix.com/title/81215567",mode:"status"},{id:"youtube",url:"https://www.youtube.com/premium",mode:"status"},{id:"gemini",url:"https://gemini.google.com/",mode:"status"}],Ns=4e3,Ls=600*1e3,Ms=16,ge=new Map});ee();var Br=8*1024*1024,Fr=2*1024*1024,on=600*1e3,Kr=6*1024*1024*1024,it=Date.now(),at=0;function sn(e){e-it>=on&&(it=e,at=0)}function Gr(e,t=Date.now()){sn(t),at+=e}function rn(e){return sn(e),Kr-at}var Xr=(()=>{let e=new Uint8Array(65536),t=2654435769;for(let n=0;n<e.length;n++)t^=t<<13,t^=t>>>17,t^=t<<5,e[n]=t&255;return e})(),Wr=5e3;function zr(e,t=Wr){let n=!1,o=setTimeout(()=>{if(!n){n=!0;try{e(1e3,"Probe idle timeout")}catch{}}},t),r=o;return typeof r?.unref=="function"&&r.unref(),{cancel:()=>{n||(n=!0,clearTimeout(o))}}}async function lt(e){let t=new URL(e.url);if(e.headers.get("Upgrade")?.toLowerCase()===__sfx("d2Vic29ja2V0")){let u=new WebSocketPair,[c,d]=Object.values(u);d.accept();let f=zr((g,y)=>d.close(g,y));return d.addEventListener("message",g=>{let y=typeof g.data=="string"?g.data:"";if(y==="PING"||y==="ping"){f.cancel(),d.send(JSON.stringify({pong:!0,colo:e.cf?.colo??"UNK",clientIp:e.headers.get("CF-Connecting-IP")??""}));try{d.close(1e3,"Probe complete")}catch{}return}f.cancel();try{d.close(1e3,"Probe aborted")}catch{}}),d.addEventListener("close",()=>f.cancel()),d.addEventListener("error",()=>f.cancel()),new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:c})}let o=Number.parseInt(t.searchParams.get("bytes")??"",10),r=Number.isFinite(o)&&o>0?Math.min(o,Br):Fr,s=Date.now();if(rn(s)<=0){let u=Math.max(1e3,it+on-s);return new Response(JSON.stringify({ok:!1,error:"probe budget exhausted"}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(u/1e3))}})}let i=Xr,a=0,l=new ReadableStream({pull(u){let c=rn(Date.now());if(a>=r||c<=0){u.close();return}let d=Math.min(i.byteLength,r-a,c);u.enqueue(i.subarray(0,d)),a+=d,Gr(d)}});return new Response(l,{status:200,headers:{"Content-Type":"application/octet-stream","Content-Encoding":"identity","Cache-Control":"no-store","Access-Control-Allow-Origin":"*","X-Probe-Bytes":String(r),"X-Probe-Nonce":Oe(4)}})}Nt();Ft();Ct();Gt();ee();$e();Ve();Sr();Er();ee();function Wt(e){let t=e===200?"Welcome":e===404?"Not Found":"Service Unavailable",n=`<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${t}</title><style>body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;background:#f7f8fa;color:#333;font-family:-apple-system,"Segoe UI","PingFang SC",sans-serif}.c{text-align:center}h1{font-size:22px;font-weight:600;margin:0 0 10px}p{color:#888;font-size:14px;margin:0}</style></head><body><div class="c"><h1>${t}</h1><p>This site is up and running.</p></div></body></html>`;return new Response(n,{status:e,headers:{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store","X-Content-Type-Options":"nosniff"}})}zt();zt();async function Cr(e){let t=Tr(e);return await Rr(t,e)}function Vt(e){let t=[];return t.push(...Ae(e[__sfx("cHJveHlJcA==")],"direct")),t.push(...Ae(e[__sfx("c29ja3M1")],__sfx("c29ja3M1"))),t.push(...Ae(e.httpProxy,"http")),t}var Yt=6e4,Gs=10,ve=0,et=0;function Ir(e){return e>=et?(ve=0,et=e+Yt,!1):ve>=Gs}function Dr(e,t){if(!t)return!1;let n=(e.headers.get(__sfx("eC1jZnBpbG90LXRva2Vu"))??"").trim();if(!n)return!1;let o=Date.now();return be(n,t)?(ve=0,!0):(o>=et&&(et=o+Yt,ve=0),ve+=1,!1)}async function Or(e,t,n){let o=new URL(e.url);if(o.pathname===__sfx("L19fZWRnZV9wcm9iZQ=="))return lt(e);if(o.pathname===Qe||o.pathname===__sfx("L19fdmVyc2lvbg=="))return qe();if(o.pathname==="/region"&&e.method==="GET"){let{coloToCountry:i}=await Promise.resolve().then(()=>(Ee(),At)),a=e.cf?.colo??"",l=a?i(a):"";return new Response(JSON.stringify({ok:!0,colo:a,region:l,timestamp:new Date().toISOString()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8"}})}let r=await Cr(t);if(o.pathname===__sfx("L19fZGlhZw==")){if(Ir(Date.now()))return new Response(JSON.stringify({ok:!1,error:"token attempts throttled"},null,2),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(Yt/1e3))}});if(!Dr(e,r.uuid))return null;let{recentDiagnostics:i,diagnosticCounters:a,recentRoutes:l}=await Promise.resolve().then(()=>(Nt(),or)),{[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:u}=await Promise.resolve().then(()=>(Ft(),fr));return new Response(JSON.stringify({ok:!0,impl:"self",build:Kt,recent:i(),[__sfx("eGh0dHA=")]:u(),counters:a(),routes:l()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}if(o.pathname==="/__unlock_probe"){if(!r.unlockProbe)return null;if(Ir(Date.now()))return new Response(JSON.stringify({ok:!1,error:"token attempts throttled"},null,2),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}});if(!Dr(e,r.uuid))return null;let{coloToCountry:i}=await Promise.resolve().then(()=>(Ee(),At)),{runUnlockProbe:a}=await Promise.resolve().then(()=>(kr(),vr)),l=e.cf?.colo??"",u=l?i(l):"",c=await a(l,u);return new Response(JSON.stringify({ok:!0,...c},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}let s=e.headers.get("Upgrade")?.toLowerCase();return o.pathname===r.wsPath?s!==__sfx("d2Vic29ja2V0")?null:await Ze(e,__sfx("dmxlc3M="),r,Vt(r),n):r[__sfx("ZW5hYmxlVHJvamFu")]&&o.pathname===r[__sfx("dHJvamFuUGF0aA==")]?s!==__sfx("d2Vic29ja2V0")?null:await Ze(e,__sfx("dHJvamFu"),r,Vt(r),n):r[__sfx("ZW5hYmxlWGh0dHA=")]&&Ht(o.pathname,r[__sfx("eGh0dHBQYXRo")])?await Bt(e,r,Vt(r)):null}Gt();var Nl={async fetch(e,t,n){try{return new URL(e.url).pathname===Qe?qe():await Or(e,t,n)??Wt(200)}catch{return Wt(500)}}};export{Nl as default};
|
package/assets/worker.js
CHANGED
|
@@ -4,7 +4,7 @@ const __sfx=(()=>{const __t=new TextDecoder(),__c=new Map();return b=>{let v=__c
|
|
|
4
4
|
`))),a){let U=""+T+__sfx("IFRyb2phbg==");r.push(U),g.push(U),n.push([__sfx("ICAtIG5hbWU6IA==")+$(U)+"",__sfx("ICAgIHR5cGU6IHRyb2phbg=="),__sfx("ICAgIHBhc3N3b3JkOiA=")+$(e.config.trojanPassword)+"",__sfx("ICAgIHNlcnZlcjog")+h.ip+"",__sfx("ICAgIHBvcnQ6IA==")+S+"",__sfx("ICAgIG5ldHdvcms6IHdz"),__sfx("ICAgIHRsczogdHJ1ZQ=="),__sfx("ICAgIHNuaTog")+e.domain+"",__sfx("ICAgIGNsaWVudC1maW5nZXJwcmludDog")+uo(e.config.clientFingerprint)+"",...c()," ws-opts:",__sfx("ICAgICAgcGF0aDog")+$(e.config.trojanPath)+""," headers:",` Host: ${e.domain}`].join(`
|
|
5
5
|
`))}}});t.push(__sfx("IyBDRlBpbG90IOiHquWKqOeUn+aIkOiuoumYhQ==")),t.push(__sfx("bWl4ZWQtcG9ydDogNzg5MA==")),t.push(__sfx("YWxsb3ctbGFuOiBmYWxzZQ==")),t.push(__sfx("bW9kZTogcnVsZQ==")),t.push(__sfx("bG9nLWxldmVsOiBpbmZv")),t.push(__sfx("dW5pZmllZC1kZWxheTogdHJ1ZQ==")),t.push(__sfx("dGNwLWNvbmN1cnJlbnQ6IHRydWU=")),t.push(""),t.push("dns:"),t.push(__sfx("ICBlbmFibGU6IHRydWU=")),t.push(__sfx("ICBpcHY2OiBmYWxzZQ==")),t.push(__sfx("ICBlbmhhbmNlZC1tb2RlOiBmYWtlLWlw")),t.push(__sfx("ICBmYWtlLWlwLXJhbmdlOiAxOTguMTguMC4xLzE2")),t.push(" default-nameserver:"),t.push(" - 223.5.5.5"),t.push(" - 119.29.29.29"),t.push(" nameserver:"),t.push(" - https://223.5.5.5/dns-query"),t.push(" - https://dns.alidns.com/dns-query"),t.push(" fallback:"),t.push(" - 8.8.4.4"),t.push(" - 1.1.1.1"),t.push(" fallback-filter:"),t.push(__sfx("ICAgIGdlb2lwOiB0cnVl")),t.push(__sfx("ICAgIGdlb2lwLWNvZGU6IENO")),t.push(""),l&&(t.push(" nameserver-policy:"),t.push(` ${$(f)}: ${u?$(u):"https://223.5.5.5/dns-query"}`),t.push(""));let d=$r(e.routeProfile??"",{mainGroup:he,autoGroup:__sfx("6Ieq5Yqo6YCJ5oup")});if(t.push("proxies:"),n.length===0?t.push(" []"):t.push(...n),t.push(""),t.push(__sfx("cHJveHktZ3JvdXBzOg==")),t.push(__sfx("ICAtIG5hbWU6ICJDRlBpbG90Ig==")),t.push(__sfx("ICAgIHR5cGU6IHNlbGVjdA==")),t.push(" proxies:"),t.push(__sfx("ICAgICAgLSAi6Ieq5Yqo6YCJ5oupIg==")),t.push(__sfx("ICAgICAgLSAi5pWF6Zqc6L2s56e7Ig==")),o.v4.length>0&&t.push(__sfx("ICAgICAgLSAi5LyY6YCJSVB2NCI=")),o.v6.length>0&&t.push(__sfx("ICAgICAgLSAi5LyY6YCJSVB2NiI=")),r.length===0)t.push(" []");else for(let p of r)t.push(` - ${$(p)}`);if(r.length>0){t.push(""),t.push(__sfx("ICAtIG5hbWU6ICLoh6rliqjpgInmi6ki")),t.push(__sfx("ICAgIHR5cGU6IHVybC10ZXN0")),t.push(__sfx("ICAgIHVybDogImh0dHA6Ly93d3cuZ3N0YXRpYy5jb20vZ2VuZXJhdGVfMjA0Ig==")),t.push(__sfx("ICAgIGludGVydmFsOiAzMDA=")),t.push(__sfx("ICAgIHRvbGVyYW5jZTogNTA=")),t.push(" proxies:");for(let h of r)t.push(` - ${$(h)}`);t.push(""),t.push(__sfx("ICAtIG5hbWU6ICLmlYXpmpzovaznp7si")),t.push(__sfx("ICAgIHR5cGU6IGZhbGxiYWNr")),t.push(__sfx("ICAgIHVybDogImh0dHA6Ly93d3cuZ3N0YXRpYy5jb20vZ2VuZXJhdGVfMjA0Ig==")),t.push(__sfx("ICAgIGludGVydmFsOiAzMDA=")),t.push(" proxies:");for(let h of r)t.push(` - ${$(h)}`);let p=(h,y)=>{t.push(""),t.push(__sfx("ICAtIG5hbWU6IA==")+$(h)+""),t.push(__sfx("ICAgIHR5cGU6IHNlbGVjdA==")),t.push(" proxies:");for(let x of y)t.push(` - ${$(x)}`)};o.v4.length>0&&p(__sfx("5LyY6YCJSVB2NA=="),o.v4),o.v6.length>0&&p(__sfx("5LyY6YCJSVB2Ng=="),o.v6)}return d.groups.length>0&&(t.push(""),t.push(...d.groups)),t.push(""),t.push("rules:"),d.rules.length>0?(t.push(...d.rules),d.rules.some(p=>p.includes("MATCH,"))||t.push(` - MATCH,${he}`)):t.push(...xn(he)),t.push(""),t.join(`
|
|
6
6
|
`)}function ha(e){let t=[],n=[],r=Rn(e.config.subVariants,e.config,po),o=r.some(u=>u===__sfx("dmxlc3Mtd3M=")),s=r.includes(__sfx("dHJvamFu")),i=e.config.ech,a=e.config.echHost.trim()||__sfx("Y2xvdWRmbGFyZS1lY2guY29t"),l=()=>i?{ech:{enabled:!0,query_server_name:a}}:{};for(let u of Cn(e)){let c=[];u.entries.forEach((d,p)=>{let h=`${u.name} ${lt(d,"vless",p,"")}`;for(let y of vn(d,e)){let x=e.ports.length>1?`:${y}`:"",g=`${h}${x}`,S=""+g+__sfx("IFRyb2phbg==");o&&c.push(g),s&&c.push(S),o&&t.push({type:__sfx("dmxlc3M="),tag:g,server:d.ip,server_port:y,uuid:e.config.uuid,tls:{enabled:!0,server_name:e.domain,insecure:!1,utls:{enabled:!0,fingerprint:e.config.clientFingerprint},...l()},transport:{type:"ws",path:e.config.wsPath,headers:{Host:e.domain}}}),s&&t.push({type:__sfx("dHJvamFu"),tag:S,server:d.ip,server_port:y,password:e.config.trojanPassword,tls:{enabled:!0,server_name:e.domain,insecure:!1,utls:{enabled:!0,fingerprint:e.config.clientFingerprint},...l()},transport:{type:"ws",path:e.config.trojanPath,headers:{Host:e.domain}}})}}),c.length>0&&n.push({tag:u.name,members:c})}t.push({type:"direct",tag:"direct"});for(let u of n)t.push({type:"selector",tag:u.tag,outbounds:u.members,default:u.members[0]});return t.push({type:"selector",tag:__sfx("Q0ZQaWxvdA=="),outbounds:n.length>0?n.map(u=>u.tag):["direct"],default:n.length>0?n[0].tag:"direct"}),JSON.stringify({log:{level:"info",timestamp:!0},dns:{servers:[{tag:"dns-out",address:"https://1.1.1.1/dns-query"},{tag:"local",address:"local"}],rules:[{domain_suffix:co,server:"local"}]},inbounds:[{type:"mixed",tag:"mixed-in",listen:__sfx("MTI3LjAuMC4x"),listen_port:2080}],outbounds:t,route:{rules:[{ip_is_private:!0,outbound:"direct"},{domain_suffix:co,outbound:"direct"}],final:__sfx("Q0ZQaWxvdA=="),auto_detect_interface:!0}},null,2)}function ya(e){let t=[],n=Rn(e.config.subVariants,e.config);for(let r of Cn(e))r.entries.forEach((o,s)=>{let i=lt(o,__sfx("dmxlc3M="),s,r.name);for(let a of vn(o,e)){let l=e.ports.length>1?`:${a}`:"",f=`${i}${l}`,u={...o,port:a};for(let c of n)c===__sfx("dmxlc3Mtd3M=")?t.push(lo(u,e,"ws",`${f} WS`)):c===__sfx("dmxlc3MteGh0dHA=")?t.push(lo(u,e,__sfx("eGh0dHA="),""+f+__sfx("IFhIVFRQ"))):t.push(ma(u,e,""+f+__sfx("IFRyb2phbg==")))}});return Lr(t.join(`
|
|
7
|
-
`))}function wo(e,t){let n=kn(t.config.subName);switch(e){case __sfx("Y2xhc2g="):return{body:ga(t),contentType:"text/yaml; charset=utf-8",fileName:n};case"singbox":return{body:ha(t),contentType:"application/json; charset=utf-8",fileName:n};default:return{body:ya(t),contentType:"text/plain; charset=utf-8",fileName:n}}}var Ce,ji,Yi,eo,to,no,_i,Zi,Ji,aa,ua,ca,Re,fa,Ge,ao,po,da,co,Nt=v(()=>{"use strict";ae();de();Pn();Sn();Ce=443;ji=[__sfx("aXDlnLDlnYA="),__sfx("aXAg5Zyw5Z2A"),"ip",__sfx("5Zyw5Z2A"),__sfx("5pyN5Yqh5Zmo"),"server","host"],Yi=[__sfx("56uv5Y+j"),"port"],eo=[__sfx("5LiL6L296YCf5bqm"),__sfx("6YCf5bqm"),"speed","download"],to=[__sfx("5bmz5Z2H5bu26L+f"),__sfx("5bu26L+f"),"latency","delay",__sfx("5ZON5bqU5pe26Ze0"),"rtt"],no=["colo",__sfx("5py65oi/"),__sfx("5pWw5o2u5Lit5b+D"),__sfx("5Zyw5Yy6"),"region"],_i=[__sfx("5Zu95a62"),"country",__sfx("5Zu95Yir")],Zi=[__sfx("5Z+O5biC"),"city"],Ji=["tls",__sfx("5piv5ZCm5pSv5oyBdGxz"),__sfx("5pSv5oyBdGxz")];aa={official:__sfx("5a6Y5pa55LyY6YCJSVA="),domain:__sfx("5LyY6YCJ5Z+f5ZCN"),manual:__sfx("5LyY6YCJ"),api:__sfx("6L+c56iLQVBJ"),csv:__sfx("5rWL6YCfQ1NW")};ua=12e4,ca=32,Re=new Map,fa="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",Ge=2*1024*1024;ao=[__sfx("dmxlc3Mtd3M="),__sfx("dmxlc3MteGh0dHA="),__sfx("dHJvamFu")];po=[__sfx("dmxlc3Mtd3M="),__sfx("dHJvamFu")];da=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;co=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});function Ta(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ao(e,t){let n=await crypto.subtle.importKey("raw",Eo.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",n,Eo.encode(t));return Ta(new Uint8Array(r))}async function Ht(e){let t=(await e.get(Ft))?.trim();if(t)return ze=0,Xe=null,ut=t,t;if(!(e instanceof se))return Mt();if(ut)return ut;let n=Date.now();if(ze===0&&(ze=n),n-ze<=Ra)return Xe||(Xe=Mt()),Xe;let r=Mt();return await e.put(Ft,r),ze=0,Xe=r,ut=r,r}async function To(e){let t=Mt();return e instanceof se?await e.put(Ft,t):await e.put(Ft,t),ut=t,Xe=null,ze=0,t}async function Ro(e,t={}){let n=t.ttlDays??0,r=Math.floor((t.now??Date.now())/1e3),o=n>0?r+Math.round(n*86400):0,s=Math.floor(Math.random()*36**8).toString(36).padStart(8,"0"),i=`${Dn}.${o.toString(36)}.${s}`,a=(await Ao(e,i)).slice(0,Un);return`${i}.${a}`}async function Bt(e,t,n=Date.now()){if(!e||!t)return{ok:!1,reason:"format"};let r=t.split(".");if(r.length!==4||r[0]!==Dn)return{ok:!1,reason:"format"};let o=r[1],s=r[2],i=r[3];if(!o||!s||i.length!==Un)return{ok:!1,reason:"format"};let a=Number.parseInt(o,36);if(!Number.isFinite(a)||a<0)return{ok:!1,reason:"format"};let l=(await Ao(e,`${Dn}.${o}.${s}`)).slice(0,Un);return ne(i,l)?a>0&&Math.floor(n/1e3)>=a?{ok:!1,reason:"expired",exp:a}:{ok:!0,exp:a}:{ok:!1,reason:"signature"}}var Ft,Dn,Un,Eo,Mt,ut,Xe,ze,Ra,Nn=v(()=>{"use strict";Qe();de();Ft="SUB_TOKEN_SECRET",Dn="v1",Un=22,Eo=new TextEncoder;Mt=()=>_(32);ut=null,Xe=null,ze=0,Ra=9e4});function Ia(e){let t="";for(let n of e)t+=(n<16?"0":"")+n.toString(16);return t}function Oa(e){if(!/^[0-9a-f]*$/.test(e)||e.length%2!==0)return null;let t=new Uint8Array(new ArrayBuffer(e.length/2));for(let n=0;n<t.length;n++)t[n]=Number.parseInt(e.slice(n*2,n*2+2),16);return t}async function Uo(e,t,n){let r=Oa(t);if(!r)return null;let o=await crypto.subtle.importKey("raw",new TextEncoder().encode(e),"PBKDF2",!1,["deriveBits"]),s=await crypto.subtle.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},o,256);return Ia(new Uint8Array(s))}function No(e){if(e.startsWith(`${Mn}$`)){let[r,o,s,i]=e.split("$");if(r!==Mn||!s||!i)return null;let a=Number.parseInt(o??"",10);return!Number.isFinite(a)||a<1||a>1e6?null:{scheme:"pbkdf2",salt:s,iterations:a,expected:i}}let[t,n]=e.split(":");return!t||!n?null:{scheme:"sha256",salt:t,iterations:0,expected:n}}async function Lo(e,t){return e.scheme==="pbkdf2"?await Uo(t,e.salt,e.iterations):await pn(`${e.salt}:${t}`)}async function ct(e,t){let n=await Uo(e,t,Oo);return n?`${Mn}$${Oo}$${t}$${n}`:`${t}:${await pn(`${t}:${e}`)}`}async function Da(e,t){let n=No(e);if(!n)return!1;let r=await Lo(n,t);return r?ne(r,n.expected):!1}function Gt(e){return`/${e.trim().replace(/^\/+/,"")}`}async function Mo(e,t,n){let r=await e.get(et)??"",o=n&&n.trim()?Gt(n):"";if(o)D.panelAbsentSince=0,D.pendingPanelPath=null,r!==o&&(r=o,await e.put(et,r));else if(r)D.panelAbsentSince=0,D.pendingPanelPath=null;else if(!(e instanceof se))r=Gt(`${Rt}-${Et(6)}`),await e.put(et,r);else{let l=Date.now();D.panelAbsentSince===0&&(D.panelAbsentSince=l),l-D.panelAbsentSince<=Io?(D.pendingPanelPath||(D.pendingPanelPath=Gt(`${Rt}-${Et(6)}`)),r=D.pendingPanelPath):(r=Gt(`${Rt}-${Et(6)}`),await e.put(et,r),D.panelAbsentSince=0,D.pendingPanelPath=null)}let s=await e.get(Me)??"",i=null,a=t&&t.trim()?t.trim():"";if(a){if(D.passwordAbsentSince=0,D.pendingPasswordHash=null,D.pendingGeneratedPassword=null,!s||!await Da(s,a)){let f=_(8);s=await ct(a,f),await e.put(Me,s)}await e.get(Ae)&&await e.delete(Ae)}else if(s)D.passwordAbsentSince=0,D.pendingPasswordHash=null,D.pendingGeneratedPassword=null;else if(e instanceof se){let l=Date.now();if(D.passwordAbsentSince===0&&(D.passwordAbsentSince=l),l-D.passwordAbsentSince<=Io)(!D.pendingGeneratedPassword||!D.pendingPasswordHash)&&(D.pendingGeneratedPassword=`cfp-${_(8)}`,D.pendingPasswordHash=await ct(D.pendingGeneratedPassword,_(8))),s=D.pendingPasswordHash,i=D.pendingGeneratedPassword;else{let f=`cfp-${_(8)}`,u=_(8);s=await ct(f,u),await e.put(Me,s),i=f,await e.put(Ae,f),D.passwordAbsentSince=0,D.pendingPasswordHash=null,D.pendingGeneratedPassword=null}}else{let l=`cfp-${_(8)}`,f=_(8);s=await ct(l,f),await e.put(Me,s),i=l,await e.put(Ae,l)}return{panelPath:r,passwordHash:s,generatedPassword:i}}async function Fo(e,t){let n=No(e.passwordHash);if(!n)return{ok:!1,legacy:!1};let r=await Lo(n,t);if(!r)return{ok:!1,legacy:!1};let o=ne(r,n.expected);return{ok:o,legacy:o&&n.scheme==="sha256"}}async function Ho(e,t){let n=_(8);await e.put(Me,await ct(t,n))}async function Bo(e){await e.get(Ae)&&await e.delete(Ae)}function Fn(e){let t=e.headers.get("Cookie")??"",n={};for(let r of t.split(";")){let o=r.indexOf("=");if(o<0)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&(n[s]=decodeURIComponent(i))}return n}function Ua(e){for(let[t,n]of ve)n<=e&&ve.delete(t)}async function Ko(e){let t=_(24);await e.put(`${Tt}${t}`,JSON.stringify({ua:"",t:Date.now()}),Do);let n=Date.now();return Ua(n),ve.set(t,n+ka*1e3),t}function Go(e){return!!Fn(e)[ft]}async function Hn(e,t){let n=Fn(t)[ft];if(!n)return!1;let r=ve.get(n);if(r!==void 0){if(r>Date.now())return!0;ve.delete(n)}return!!await e.get(`${Tt}${n}`)}function Xo(e,t=Do){return`${ft}=${e}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=${t}`}function zo(){return`${ft}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`}async function Wo(e,t){let n=Fn(t)[ft];if(!n)return;let r=`${Tt}${n}`,o=ve.has(n);if(ve.delete(n),o){await e.delete(r);return}await e.get(r)&&await e.delete(r)}async function Vo(e){let t=_(20);return await e.put(`${At}${t}`,"1",va),t}async function jo(e,t,n){if(!t)return!1;let r=await e.get("SCANNER_TOKEN");if(r&&ne(r,t))return!0;let o=n?.SCANNER_TOKEN?.trim();return o&&ne(o,t)?!0:await e.get(`${At}${t}`)?(await e.delete(`${At}${t}`),!0):!1}var ft,Do,ka,Io,va,Oo,Mn,D,ve,Bn=v(()=>{"use strict";Qe();nt();de();ft=__sfx("Y2ZwaWxvdF9zZXNz"),Do=3600*24,ka=90,Io=9e4,va=600,Oo=3e4,Mn="pbkdf2",D={panelAbsentSince:0,pendingPanelPath:null,passwordAbsentSince:0,pendingPasswordHash:null,pendingGeneratedPassword:null};ve=new Map});function Kn(e){return Mr(e)}async function Xt(e,t){if(oe.config&&Date.now()-oe.configAt<Na)return oe.config;let n=await Kr(e,t);return oe.config=n,oe.configAt=Date.now(),n}function Yo(){oe.config=null,oe.configAt=0}async function Gn(e,t){if(oe.auth&&Date.now()-oe.authAt<La)return oe.auth;let n=await Mo(e,t.PANEL_PASSWORD,t.PANEL_PATH);return oe.auth=n,oe.authAt=Date.now(),n}function Xn(e){switch((e??"").toLowerCase()){case __sfx("Y2xhc2g="):case"mihomo":case"yaml":return __sfx("Y2xhc2g=");case"singbox":case"sing-box":case"json":return"singbox";case"v2ray":return"v2ray";case"base64":return"base64";default:return"base64"}}function dt(e){let t=String(e??"").trim();if(!t)return t;t=t.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,""),t=t.replace(/[/?#].*$/,"");let n=t.lastIndexOf("@");if(n>=0&&(t=t.slice(n+1)),t.startsWith("[")){let r=t.indexOf("]");r>0&&(t=t.slice(1,r))}else{let r=t.indexOf(":");r>=0&&t.indexOf(":",r+1)<0&&(t=t.slice(0,r))}return t.trim()}function _o(e){let t=(e??"").toLowerCase();return t?t.includes(__sfx("Y2xhc2g="))||t.includes("mihomo")||t.includes(__sfx("ZmxjbGFzaA=="))||t.includes(__sfx("Y2xhc2h4"))||t.includes("stash")?__sfx("Y2xhc2g="):t.includes("sing-box")||t.includes("singbox")?"singbox":t.includes("v2ray")||t.includes("v2rayng")||t.includes("shadowrocket")||t.includes("nekobox")||t.includes("surge")||t.includes("loon")||t.includes("quantumult")?"base64":null:null}var Na,La,oe,zt=v(()=>{"use strict";Qe();nt();Bn();Na=15e3,La=6e4,oe={config:null,configAt:0,auth:null,authAt:0}});function Wn(e){let t=[];if(e.split(/\r?\n/).forEach((s,i)=>{let a=s.trim();if(!a)return;let l=a.replace(/^["']|["']$/g,"").trim();!l||l.startsWith("#")||ke(a)===null&&t.push(i+1)}),t.length===0)return"";let r=t.slice(0,3).map(s=>`\u7B2C ${s} \u884C`).join("\u3001"),o=t.length>3?` \u7B49 ${t.length} \u884C`:"";return __sfx("5omL5Yqo5oyH5a6aIElQIOaciSA=")+t.length+__sfx("IOihjOaXoOazleivhuWIq++8iA==")+r+""+o+")"}function zn(e,t,n){if(!e){n.push({field:t,message:""+t+__sfx("IOS4jeiDveS4uuepug==")});return}if(!e.startsWith("/")){n.push({field:t,message:""+t+__sfx("IOW/hemhu+S7pSAvIOW8gOWktA==")});return}if(e.length>128){n.push({field:t,message:""+t+__sfx("IOi/h+mVv++8iOacgOWkmiAxMjgg5a2X56ym77yJ")});return}/[\s\u0000-\u001f]/.test(e)&&n.push({field:t,message:""+t+__sfx("IOS4jeiDveWMheWQq+epuuagvOaIluaOp+WItuWtl+espg==")})}function Ie(e,t,n,r,o){if(!Number.isFinite(e)){o.push({field:t,message:""+t+__sfx("IOW/hemhu+aYr+aVsOWtlw==")});return}(e<n||e>r)&&o.push({field:t,message:""+t+__sfx("IOW/hemhu+WcqCA=")+n+" ~ "+r+__sfx("IOS5i+mXtO+8iOW9k+WJjSA=")+e+")"})}function Wt(e,t,n,r=Ha){let o=e.split(/\r?\n|,/).map(s=>s.trim()).filter(Boolean);if(o.length>r){n.push({field:t,message:""+t+__sfx("IOacgOWkmiA=")+r+__sfx("IOadoe+8iOW9k+WJjSA=")+o.length+")"});return}for(let s of o)if(!Fa.test(s)){n.push({field:t,message:""+t+__sfx("IOmHjOacieaXoOazleivhuWIq+eahOadoeebru+8mg==")+s.slice(0,40)+""});return}}function Jo(e,t,n){let r=e.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>10){n.push({field:t,message:""+t+__sfx("IOacgOWkmiAxMCDmnaHvvIjlvZPliY0g")+r.length+")"});return}for(let o of r)if(!/^https?:\/\/\S+$/i.test(o)){n.push({field:t,message:""+t+__sfx("IOW/hemhu+aYryBodHRwKHMpIOWcsOWdgO+8mg==")+o.slice(0,40)+""});return}}function Ka(e,t,n){let r=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(r.length>Zo){n.push({field:t,message:""+t+__sfx("IOacgOWkmiA=")+Zo+__sfx("IOadoe+8iOW9k+WJjSA=")+r.length+")"});return}let o=Wn(e);o&&n.push({field:t,message:o})}function pt(e){let t=[],n=o=>Object.prototype.hasOwnProperty.call(e,o);n("wsPath")&&zn(String(e.wsPath??""),"wsPath",t),n(__sfx("dHJvamFuUGF0aA=="))&&zn(String(e.trojanPath??""),__sfx("dHJvamFuUGF0aA=="),t),n(__sfx("eGh0dHBQYXRo"))&&zn(String(e.xhttpPath??""),__sfx("eGh0dHBQYXRo"),t);let r=["wsPath",__sfx("dHJvamFuUGF0aA=="),__sfx("eGh0dHBQYXRo")].filter(o=>n(o)).map(o=>`${o}=${String(e[o]??"")}`);if(r.length>=2){let o=r.map(s=>s.slice(s.indexOf("=")+1));new Set(o).size!==o.length&&t.push({field:"paths",message:__sfx("d3NQYXRoIC8gdHJvamFuUGF0aCAvIHhodHRwUGF0aCDkuI3og73ph43lpI0=")})}if(n("proxyMode")){let o=String(e.proxyMode??"");["only","global","fallback","smart"].includes(o)||t.push({field:"proxyMode",message:__sfx("cHJveHlNb2RlIOWAvOaXoOaViA==")})}if(n("clientFingerprint")){let o=String(e.clientFingerprint??"").trim();(o.length>32||!/^[A-Za-z0-9._-]*$/.test(o))&&t.push({field:"clientFingerprint",message:__sfx("Y2xpZW50RmluZ2VycHJpbnQg5YC85peg5pWI")})}if(n("subDomain")){let o=String(e.subDomain??"").trim();o&&(!Ma.test(o)||o.includes("/"))&&t.push({field:"subDomain",message:__sfx("c3ViRG9tYWluIOW/hemhu+aYr+WQiOazleS4u+acuuWQje+8iOS4jeWQq+WNj+iuruS4jui3r+W+hO+8iQ==")})}if(n(__sfx("cHJveHlJcA=="))&&Wt(String(e.proxyIp??""),__sfx("cHJveHlJcA=="),t),n(__sfx("c29ja3M1"))&&Wt(String(e.socks5??""),__sfx("c29ja3M1"),t),n("httpProxy")&&Wt(String(e.httpProxy??""),"httpProxy",t),n("relayPool")&&Wt(String(e.relayPool??""),"relayPool",t,Ba),n("officialCount")&&Ie(Number(e.officialCount),"officialCount",1,200,t),n("domainCount")&&Ie(Number(e.domainCount),"domainCount",1,200,t),n("maxNodes")&&Ie(Number(e.maxNodes),"maxNodes",0,500,t),n("dls")&&Ie(Number(e.dls),"dls",0,1e3,t),n("maxLatency")&&Ie(Number(e.maxLatency),"maxLatency",0,1e4,t),n("dataBudgetMB")&&Ie(Number(e.dataBudgetMB),"dataBudgetMB",0,102400,t),n("subTokenTtlDays")&&Ie(Number(e.subTokenTtlDays),"subTokenTtlDays",0,3650,t),n("subPorts")){let o=String(e.subPorts??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>6?t.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg5pyA5aSaIDYg5Liq56uv5Y+j")}):s.every(i=>/^\d{1,5}$/.test(i)&&Number(i)>=1&&Number(i)<=65535)||t.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg6YeM5q+P5Liq56uv5Y+j6YO95b+F6aG75pivIDF+NjU1MzUg55qE5pWw5a2X")})}}if(n("subName")){let o=String(e.subName??"");o.length>40&&t.push({field:"subName",message:__sfx("c3ViTmFtZSDmnIDlpJogNDAg5a2X56ym")}),/[\u0000-\u001f]/.test(o)&&t.push({field:"subName",message:__sfx("c3ViTmFtZSDkuI3og73ljIXlkKvmjqfliLblrZfnrKY=")})}if(n("addApi")&&Jo(String(e.addApi??""),"addApi",t),n("addCsv")&&Jo(String(e.addCsv??""),"addCsv",t),n("add")&&Ka(String(e.add??""),"add",t),n("uuid")){let o=String(e.uuid??"").trim();o&&!/^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/.test(o)&&t.push({field:"uuid",message:__sfx("dXVpZCDlv4XpobvmmK/moIflh4YgVVVJRO+8iDM2IOS9je+8jOWPr+W4pui/nuWtl+espu+8iQ==")})}if(n("poolCountries")){let o=String(e.poolCountries??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>30?t.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDmnIDlpJogMzAg5Liq5Zu95a62L+WcsOWMug==")}):s.every(i=>/^[A-Za-z]{2,3}$/.test(i))||t.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDlj6rog73mmK8gMn4zIOS9jeWtl+avjeS7o+eggQ==")})}}if(n("udpDnsEndpoint")){let o=String(e.udpDnsEndpoint??"").trim();o&&!/^https:\/\/\S+$/i.test(o)&&t.push({field:"udpDnsEndpoint",message:__sfx("dWRwRG5zRW5kcG9pbnQg5b+F6aG75pivIGh0dHBzIOWcsOWdgA==")})}return t}function mt(e){return e.length===0?"":e.length===1?e[0].message:"有 "+e.length+__sfx("IOmhuemFjee9ruS4jeWQiOazle+8mg==")+e.map(t=>t.message).join("\uFF1B")+""}var Ma,Fa,Ha,Ba,Zo,Qo=v(()=>{"use strict";Nt();Ma=/^(?=.{1,253}$)([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;Fa=/^(?:(?:socks5|socks|socks5h|http|https):\/\/)?(?:[^\s@/]+@)?(?:\[[0-9a-fA-F:]+\]|[A-Za-z0-9._-]+)(?::\d{1,5})?$/;Ha=20,Ba=200,Zo=2e3});function es(e,t=Date.now()){let n={};for(let o of qo){let s=e[o];s!==void 0&&(n[o]=s)}let r=Ga.map(o=>({field:o.field,reason:o.reason}));for(let o of[__sfx("c29ja3M1"),"httpProxy"]){let s=String(e[o]??"");if(!s){n[o]="";continue}if(s.includes("@")){r.push({field:o,reason:__sfx("5ZCr55So5oi35ZCNL+WPo+S7pO+8jOmcgOaJi+W3pemHjeaWsOWhq+WGmQ==")});continue}n[o]=s}return{schemaVersion:1,exportedAt:new Date(t).toISOString(),config:n,omitted:r}}function ts(e){let t=new Set([...qo.map(String),__sfx("c29ja3M1"),"httpProxy"]),n={};for(let[r,o]of Object.entries(e))t.has(r)&&(n[r]=o);return n}function $o(e){if(e==null)return"\uFF08\u7A7A\uFF09";if(typeof e=="string"){let t=e.replace(/\s+/g," ").trim();return t.length>60?`${t.slice(0,60)}\u2026`:t||"\uFF08\u7A7A\uFF09"}return String(e)}function ns(e,t){let n=[];for(let[r,o]of Object.entries(t)){let s=e[r];String(s)!==String(o)&&n.push({field:r,from:$o(s),to:$o(o)})}return n}var qo,Ga,rs=v(()=>{"use strict";qo=["poolOfficial","officialCount","poolDomain","domainCount","poolManual","poolCountries","add","dls","maxLatency","maxNodes",__sfx("cHJveHlJcA=="),"relayPool","useBuiltinRelay","proxyMode","nat64","concurrentDial","dataBudgetMB","resolvePreferred","aggressiveRedial",__sfx("ZW5hYmxlVHJvamFu"),__sfx("ZW5hYmxlWGh0dHA="),"subProtocol","subTransport","subVariants","subName","subPorts","clientFingerprint","ech","echHost","echDns","tlsFragment","tlsFragmentSize","tlsFragmentDelay","subToken","subTokenTtlDays","unlockProbe","udpDns","udpDnsEndpoint"],Ga=[{field:"uuid",reason:__sfx("5YWl56uZ5Yet5o2u")},{field:__sfx("dHJvamFuUGFzc3dvcmQ="),reason:__sfx("5YWl56uZ5Yet5o2u")},{field:"wsPath",reason:__sfx("5a6e5L6L5qCH6K+G77yI6K6i6ZiF6ZO+5o6l6YeM5Y+v6KeB77yM5a+85Ye65Y2z5pq06Zyy5YWl5Y+j77yJ")},{field:__sfx("dHJvamFuUGF0aA=="),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:__sfx("eGh0dHBQYXRo"),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"subDomain",reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"addApi",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")},{field:"addCsv",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")}]});function ss(){return new Response(JSON.stringify({build:gt,version:Vn,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var gt,Vn,os,jn=v(()=>{"use strict";gt="c84de11-a5e14406",Vn=__sfx("MC40MC4w"),os=__sfx("L19fY2ZwX3ZlcnNpb24=")});var ls={};Je(ls,{API_PREFIX:()=>_n,getScannerToken:()=>_a,handleApi:()=>Za,pruneLoginFailures:()=>as});function Va(e){return e.headers.get("CF-Connecting-IP")??e.headers.get("x-forwarded-for")?.split(",")[0]?.trim()??"unknown"}function ja(e,t){let n=We.get(e);return n?t>=n.resetAt?(We.delete(e),!1):n.count>=za:!1}function as(e,t,n=Wa){if(!(e.size<n)){for(let[r,o]of e)t>=o.resetAt&&e.delete(r);for(;e.size>=n;){let r=e.keys().next().value;if(r===void 0)break;e.delete(r)}}}function Ya(e,t){let n=We.get(e);if(!n||t>=n.resetAt){as(We,t),We.set(e,{count:1,resetAt:t+is});return}n.count+=1}function G(e,t=200,n={}){return new Response(JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...n}})}function H(e,t){return G({ok:!1,error:e},t)}async function _a(e,t){let n=await e.get(yn);if(n)return n;if(typeof t.SCANNER_TOKEN=="string"&&t.SCANNER_TOKEN)return t.SCANNER_TOKEN;let r=_(24);return await e.put(yn,r),r}async function Za(e,t,n){if(!t.pathname.startsWith(_n))return null;let{store:r,env:o,config:s,auth:i}=n,a=t.pathname.slice(_n.length)||"/",l=e.method.toUpperCase();if(a==="/session"&&l==="GET"){let u=await Hn(r,e);return G(u?{ok:!0,authenticated:u,panelPath:i.panelPath}:{ok:!0,authenticated:u,hasSessionCookie:Go(e)})}if(a==="/login"&&l==="POST"){let u="";try{let y=await e.json();u=String(y.password??"")}catch{return H(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(!u)return H(__sfx("6K+36L6T5YWl5a+G56CB"),400);let c=Va(e),d=Date.now();if(ja(c,d))return new Response(JSON.stringify({ok:!1,error:__sfx("5bCd6K+V6L+H5LqO6aKR57mB77yM6K+356iN5ZCO5YaN6K+V")}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(is/1e3))}});let p=await Fo(i,u);if(!p.ok)return Ya(c,d),H(__sfx("5a+G56CB6ZSZ6K+v"),401);We.delete(c),p.legacy&&await Ho(r,u).catch(()=>{}),await Bo(r).catch(()=>{});let h=await Ko(r);return G({ok:!0},200,{"Set-Cookie":Xo(h)})}if(a==="/logout"&&l==="POST")return await Wo(r,e),G({ok:!0},200,{"Set-Cookie":zo()});if(a==="/preferred-ips"&&l==="POST"){let u=e.headers.get("Authorization")??"",c=u.startsWith("Bearer ")?u.slice(7).trim():u.trim();if(!await jo(r,c,o))return H(__sfx("VG9rZW4g5qCh6aqM5aSx6LSl"),401);let p;try{p=await e.json()}catch{return H(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}let y=(Array.isArray(p.ips)?p.ips.map(m=>String(m)):[]).map(m=>m.trim()).filter(m=>m.length>0),{valid:x,invalid:g}=fo(y),S=p.mode==="append",E=p.target==="relay",T=m=>m.split("#")[0].trim().replace(/^\[([^\]]+)\]:(\d+)$/,"$1:$2");if(x.length===0&&y.length>0)return H(__sfx("5rKh5pyJ5Y+v6K+G5Yir55qE5p2h55uu77yI5bey6Lez6L+HIA==")+g+" \u884C\uFF09",400);if(E){if(x.length===0)return H(__sfx("5rKh5pyJ5Y+v6K+G5Yir55qE5Y+N5Luj5YWl5Y+j"),400);let m=Xa,b=x.slice(0,m),A=x.length-b.length,L=(s.relayPool??"").split(`
|
|
7
|
+
`))}function wo(e,t){let n=kn(t.config.subName);switch(e){case __sfx("Y2xhc2g="):return{body:ga(t),contentType:"text/yaml; charset=utf-8",fileName:n};case"singbox":return{body:ha(t),contentType:"application/json; charset=utf-8",fileName:n};default:return{body:ya(t),contentType:"text/plain; charset=utf-8",fileName:n}}}var Ce,ji,Yi,eo,to,no,_i,Zi,Ji,aa,ua,ca,Re,fa,Ge,ao,po,da,co,Nt=v(()=>{"use strict";ae();de();Pn();Sn();Ce=443;ji=[__sfx("aXDlnLDlnYA="),__sfx("aXAg5Zyw5Z2A"),"ip",__sfx("5Zyw5Z2A"),__sfx("5pyN5Yqh5Zmo"),"server","host"],Yi=[__sfx("56uv5Y+j"),"port"],eo=[__sfx("5LiL6L296YCf5bqm"),__sfx("6YCf5bqm"),"speed","download"],to=[__sfx("5bmz5Z2H5bu26L+f"),__sfx("5bu26L+f"),"latency","delay",__sfx("5ZON5bqU5pe26Ze0"),"rtt"],no=["colo",__sfx("5py65oi/"),__sfx("5pWw5o2u5Lit5b+D"),__sfx("5Zyw5Yy6"),"region"],_i=[__sfx("5Zu95a62"),"country",__sfx("5Zu95Yir")],Zi=[__sfx("5Z+O5biC"),"city"],Ji=["tls",__sfx("5piv5ZCm5pSv5oyBdGxz"),__sfx("5pSv5oyBdGxz")];aa={official:__sfx("5a6Y5pa55LyY6YCJSVA="),domain:__sfx("5LyY6YCJ5Z+f5ZCN"),manual:__sfx("5LyY6YCJ"),api:__sfx("6L+c56iLQVBJ"),csv:__sfx("5rWL6YCfQ1NW")};ua=12e4,ca=32,Re=new Map,fa="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",Ge=2*1024*1024;ao=[__sfx("dmxlc3Mtd3M="),__sfx("dmxlc3MteGh0dHA="),__sfx("dHJvamFu")];po=[__sfx("dmxlc3Mtd3M="),__sfx("dHJvamFu")];da=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;co=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});function Ta(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ao(e,t){let n=await crypto.subtle.importKey("raw",Eo.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",n,Eo.encode(t));return Ta(new Uint8Array(r))}async function Ht(e){let t=(await e.get(Ft))?.trim();if(t)return ze=0,Xe=null,ut=t,t;if(!(e instanceof se))return Mt();if(ut)return ut;let n=Date.now();if(ze===0&&(ze=n),n-ze<=Ra)return Xe||(Xe=Mt()),Xe;let r=Mt();return await e.put(Ft,r),ze=0,Xe=r,ut=r,r}async function To(e){let t=Mt();return e instanceof se?await e.put(Ft,t):await e.put(Ft,t),ut=t,Xe=null,ze=0,t}async function Ro(e,t={}){let n=t.ttlDays??0,r=Math.floor((t.now??Date.now())/1e3),o=n>0?r+Math.round(n*86400):0,s=Math.floor(Math.random()*36**8).toString(36).padStart(8,"0"),i=`${Dn}.${o.toString(36)}.${s}`,a=(await Ao(e,i)).slice(0,Un);return`${i}.${a}`}async function Bt(e,t,n=Date.now()){if(!e||!t)return{ok:!1,reason:"format"};let r=t.split(".");if(r.length!==4||r[0]!==Dn)return{ok:!1,reason:"format"};let o=r[1],s=r[2],i=r[3];if(!o||!s||i.length!==Un)return{ok:!1,reason:"format"};let a=Number.parseInt(o,36);if(!Number.isFinite(a)||a<0)return{ok:!1,reason:"format"};let l=(await Ao(e,`${Dn}.${o}.${s}`)).slice(0,Un);return ne(i,l)?a>0&&Math.floor(n/1e3)>=a?{ok:!1,reason:"expired",exp:a}:{ok:!0,exp:a}:{ok:!1,reason:"signature"}}var Ft,Dn,Un,Eo,Mt,ut,Xe,ze,Ra,Nn=v(()=>{"use strict";Qe();de();Ft="SUB_TOKEN_SECRET",Dn="v1",Un=22,Eo=new TextEncoder;Mt=()=>_(32);ut=null,Xe=null,ze=0,Ra=9e4});function Ia(e){let t="";for(let n of e)t+=(n<16?"0":"")+n.toString(16);return t}function Oa(e){if(!/^[0-9a-f]*$/.test(e)||e.length%2!==0)return null;let t=new Uint8Array(new ArrayBuffer(e.length/2));for(let n=0;n<t.length;n++)t[n]=Number.parseInt(e.slice(n*2,n*2+2),16);return t}async function Uo(e,t,n){let r=Oa(t);if(!r)return null;let o=await crypto.subtle.importKey("raw",new TextEncoder().encode(e),"PBKDF2",!1,["deriveBits"]),s=await crypto.subtle.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},o,256);return Ia(new Uint8Array(s))}function No(e){if(e.startsWith(`${Mn}$`)){let[r,o,s,i]=e.split("$");if(r!==Mn||!s||!i)return null;let a=Number.parseInt(o??"",10);return!Number.isFinite(a)||a<1||a>1e6?null:{scheme:"pbkdf2",salt:s,iterations:a,expected:i}}let[t,n]=e.split(":");return!t||!n?null:{scheme:"sha256",salt:t,iterations:0,expected:n}}async function Lo(e,t){return e.scheme==="pbkdf2"?await Uo(t,e.salt,e.iterations):await pn(`${e.salt}:${t}`)}async function ct(e,t){let n=await Uo(e,t,Oo);return n?`${Mn}$${Oo}$${t}$${n}`:`${t}:${await pn(`${t}:${e}`)}`}async function Da(e,t){let n=No(e);if(!n)return!1;let r=await Lo(n,t);return r?ne(r,n.expected):!1}function Gt(e){return`/${e.trim().replace(/^\/+/,"")}`}async function Mo(e,t,n){let r=await e.get(et)??"",o=n&&n.trim()?Gt(n):"";if(o)D.panelAbsentSince=0,D.pendingPanelPath=null,r!==o&&(r=o,await e.put(et,r));else if(r)D.panelAbsentSince=0,D.pendingPanelPath=null;else if(!(e instanceof se))r=Gt(`${Rt}-${Et(6)}`),await e.put(et,r);else{let l=Date.now();D.panelAbsentSince===0&&(D.panelAbsentSince=l),l-D.panelAbsentSince<=Io?(D.pendingPanelPath||(D.pendingPanelPath=Gt(`${Rt}-${Et(6)}`)),r=D.pendingPanelPath):(r=Gt(`${Rt}-${Et(6)}`),await e.put(et,r),D.panelAbsentSince=0,D.pendingPanelPath=null)}let s=await e.get(Me)??"",i=null,a=t&&t.trim()?t.trim():"";if(a){if(D.passwordAbsentSince=0,D.pendingPasswordHash=null,D.pendingGeneratedPassword=null,!s||!await Da(s,a)){let f=_(8);s=await ct(a,f),await e.put(Me,s)}await e.get(Ae)&&await e.delete(Ae)}else if(s)D.passwordAbsentSince=0,D.pendingPasswordHash=null,D.pendingGeneratedPassword=null;else if(e instanceof se){let l=Date.now();if(D.passwordAbsentSince===0&&(D.passwordAbsentSince=l),l-D.passwordAbsentSince<=Io)(!D.pendingGeneratedPassword||!D.pendingPasswordHash)&&(D.pendingGeneratedPassword=`cfp-${_(8)}`,D.pendingPasswordHash=await ct(D.pendingGeneratedPassword,_(8))),s=D.pendingPasswordHash,i=D.pendingGeneratedPassword;else{let f=`cfp-${_(8)}`,u=_(8);s=await ct(f,u),await e.put(Me,s),i=f,await e.put(Ae,f),D.passwordAbsentSince=0,D.pendingPasswordHash=null,D.pendingGeneratedPassword=null}}else{let l=`cfp-${_(8)}`,f=_(8);s=await ct(l,f),await e.put(Me,s),i=l,await e.put(Ae,l)}return{panelPath:r,passwordHash:s,generatedPassword:i}}async function Fo(e,t){let n=No(e.passwordHash);if(!n)return{ok:!1,legacy:!1};let r=await Lo(n,t);if(!r)return{ok:!1,legacy:!1};let o=ne(r,n.expected);return{ok:o,legacy:o&&n.scheme==="sha256"}}async function Ho(e,t){let n=_(8);await e.put(Me,await ct(t,n))}async function Bo(e){await e.get(Ae)&&await e.delete(Ae)}function Fn(e){let t=e.headers.get("Cookie")??"",n={};for(let r of t.split(";")){let o=r.indexOf("=");if(o<0)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&(n[s]=decodeURIComponent(i))}return n}function Ua(e){for(let[t,n]of ve)n<=e&&ve.delete(t)}async function Ko(e){let t=_(24);await e.put(`${Tt}${t}`,JSON.stringify({ua:"",t:Date.now()}),Do);let n=Date.now();return Ua(n),ve.set(t,n+ka*1e3),t}function Go(e){return!!Fn(e)[ft]}async function Hn(e,t){let n=Fn(t)[ft];if(!n)return!1;let r=ve.get(n);if(r!==void 0){if(r>Date.now())return!0;ve.delete(n)}return!!await e.get(`${Tt}${n}`)}function Xo(e,t=Do){return`${ft}=${e}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=${t}`}function zo(){return`${ft}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`}async function Wo(e,t){let n=Fn(t)[ft];if(!n)return;let r=`${Tt}${n}`,o=ve.has(n);if(ve.delete(n),o){await e.delete(r);return}await e.get(r)&&await e.delete(r)}async function Vo(e){let t=_(20);return await e.put(`${At}${t}`,"1",va),t}async function jo(e,t,n){if(!t)return!1;let r=await e.get("SCANNER_TOKEN");if(r&&ne(r,t))return!0;let o=n?.SCANNER_TOKEN?.trim();return o&&ne(o,t)?!0:await e.get(`${At}${t}`)?(await e.delete(`${At}${t}`),!0):!1}var ft,Do,ka,Io,va,Oo,Mn,D,ve,Bn=v(()=>{"use strict";Qe();nt();de();ft=__sfx("Y2ZwaWxvdF9zZXNz"),Do=3600*24,ka=90,Io=9e4,va=600,Oo=3e4,Mn="pbkdf2",D={panelAbsentSince:0,pendingPanelPath:null,passwordAbsentSince:0,pendingPasswordHash:null,pendingGeneratedPassword:null};ve=new Map});function Kn(e){return Mr(e)}async function Xt(e,t){if(oe.config&&Date.now()-oe.configAt<Na)return oe.config;let n=await Kr(e,t);return oe.config=n,oe.configAt=Date.now(),n}function Yo(){oe.config=null,oe.configAt=0}async function Gn(e,t){if(oe.auth&&Date.now()-oe.authAt<La)return oe.auth;let n=await Mo(e,t.PANEL_PASSWORD,t.PANEL_PATH);return oe.auth=n,oe.authAt=Date.now(),n}function Xn(e){switch((e??"").toLowerCase()){case __sfx("Y2xhc2g="):case"mihomo":case"yaml":return __sfx("Y2xhc2g=");case"singbox":case"sing-box":case"json":return"singbox";case"v2ray":return"v2ray";case"base64":return"base64";default:return"base64"}}function dt(e){let t=String(e??"").trim();if(!t)return t;t=t.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,""),t=t.replace(/[/?#].*$/,"");let n=t.lastIndexOf("@");if(n>=0&&(t=t.slice(n+1)),t.startsWith("[")){let r=t.indexOf("]");r>0&&(t=t.slice(1,r))}else{let r=t.indexOf(":");r>=0&&t.indexOf(":",r+1)<0&&(t=t.slice(0,r))}return t.trim()}function _o(e){let t=(e??"").toLowerCase();return t?t.includes(__sfx("Y2xhc2g="))||t.includes("mihomo")||t.includes(__sfx("ZmxjbGFzaA=="))||t.includes(__sfx("Y2xhc2h4"))||t.includes("stash")?__sfx("Y2xhc2g="):t.includes("sing-box")||t.includes("singbox")?"singbox":t.includes("v2ray")||t.includes("v2rayng")||t.includes("shadowrocket")||t.includes("nekobox")||t.includes("surge")||t.includes("loon")||t.includes("quantumult")?"base64":null:null}var Na,La,oe,zt=v(()=>{"use strict";Qe();nt();Bn();Na=15e3,La=6e4,oe={config:null,configAt:0,auth:null,authAt:0}});function Wn(e){let t=[];if(e.split(/\r?\n/).forEach((s,i)=>{let a=s.trim();if(!a)return;let l=a.replace(/^["']|["']$/g,"").trim();!l||l.startsWith("#")||ke(a)===null&&t.push(i+1)}),t.length===0)return"";let r=t.slice(0,3).map(s=>`\u7B2C ${s} \u884C`).join("\u3001"),o=t.length>3?` \u7B49 ${t.length} \u884C`:"";return __sfx("5omL5Yqo5oyH5a6aIElQIOaciSA=")+t.length+__sfx("IOihjOaXoOazleivhuWIq++8iA==")+r+""+o+")"}function zn(e,t,n){if(!e){n.push({field:t,message:""+t+__sfx("IOS4jeiDveS4uuepug==")});return}if(!e.startsWith("/")){n.push({field:t,message:""+t+__sfx("IOW/hemhu+S7pSAvIOW8gOWktA==")});return}if(e.length>128){n.push({field:t,message:""+t+__sfx("IOi/h+mVv++8iOacgOWkmiAxMjgg5a2X56ym77yJ")});return}/[\s\u0000-\u001f]/.test(e)&&n.push({field:t,message:""+t+__sfx("IOS4jeiDveWMheWQq+epuuagvOaIluaOp+WItuWtl+espg==")})}function Ie(e,t,n,r,o){if(!Number.isFinite(e)){o.push({field:t,message:""+t+__sfx("IOW/hemhu+aYr+aVsOWtlw==")});return}(e<n||e>r)&&o.push({field:t,message:""+t+__sfx("IOW/hemhu+WcqCA=")+n+" ~ "+r+__sfx("IOS5i+mXtO+8iOW9k+WJjSA=")+e+")"})}function Wt(e,t,n,r=Ha){let o=e.split(/\r?\n|,/).map(s=>s.trim()).filter(Boolean);if(o.length>r){n.push({field:t,message:""+t+__sfx("IOacgOWkmiA=")+r+__sfx("IOadoe+8iOW9k+WJjSA=")+o.length+")"});return}for(let s of o)if(!Fa.test(s)){n.push({field:t,message:""+t+__sfx("IOmHjOacieaXoOazleivhuWIq+eahOadoeebru+8mg==")+s.slice(0,40)+""});return}}function Jo(e,t,n){let r=e.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>10){n.push({field:t,message:""+t+__sfx("IOacgOWkmiAxMCDmnaHvvIjlvZPliY0g")+r.length+")"});return}for(let o of r)if(!/^https?:\/\/\S+$/i.test(o)){n.push({field:t,message:""+t+__sfx("IOW/hemhu+aYryBodHRwKHMpIOWcsOWdgO+8mg==")+o.slice(0,40)+""});return}}function Ka(e,t,n){let r=e.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(r.length>Zo){n.push({field:t,message:""+t+__sfx("IOacgOWkmiA=")+Zo+__sfx("IOadoe+8iOW9k+WJjSA=")+r.length+")"});return}let o=Wn(e);o&&n.push({field:t,message:o})}function pt(e){let t=[],n=o=>Object.prototype.hasOwnProperty.call(e,o);n("wsPath")&&zn(String(e.wsPath??""),"wsPath",t),n(__sfx("dHJvamFuUGF0aA=="))&&zn(String(e.trojanPath??""),__sfx("dHJvamFuUGF0aA=="),t),n(__sfx("eGh0dHBQYXRo"))&&zn(String(e.xhttpPath??""),__sfx("eGh0dHBQYXRo"),t);let r=["wsPath",__sfx("dHJvamFuUGF0aA=="),__sfx("eGh0dHBQYXRo")].filter(o=>n(o)).map(o=>`${o}=${String(e[o]??"")}`);if(r.length>=2){let o=r.map(s=>s.slice(s.indexOf("=")+1));new Set(o).size!==o.length&&t.push({field:"paths",message:__sfx("d3NQYXRoIC8gdHJvamFuUGF0aCAvIHhodHRwUGF0aCDkuI3og73ph43lpI0=")})}if(n("proxyMode")){let o=String(e.proxyMode??"");["only","global","fallback","smart"].includes(o)||t.push({field:"proxyMode",message:__sfx("cHJveHlNb2RlIOWAvOaXoOaViA==")})}if(n("clientFingerprint")){let o=String(e.clientFingerprint??"").trim();(o.length>32||!/^[A-Za-z0-9._-]*$/.test(o))&&t.push({field:"clientFingerprint",message:__sfx("Y2xpZW50RmluZ2VycHJpbnQg5YC85peg5pWI")})}if(n("subDomain")){let o=String(e.subDomain??"").trim();o&&(!Ma.test(o)||o.includes("/"))&&t.push({field:"subDomain",message:__sfx("c3ViRG9tYWluIOW/hemhu+aYr+WQiOazleS4u+acuuWQje+8iOS4jeWQq+WNj+iuruS4jui3r+W+hO+8iQ==")})}if(n(__sfx("cHJveHlJcA=="))&&Wt(String(e.proxyIp??""),__sfx("cHJveHlJcA=="),t),n(__sfx("c29ja3M1"))&&Wt(String(e.socks5??""),__sfx("c29ja3M1"),t),n("httpProxy")&&Wt(String(e.httpProxy??""),"httpProxy",t),n("relayPool")&&Wt(String(e.relayPool??""),"relayPool",t,Ba),n("officialCount")&&Ie(Number(e.officialCount),"officialCount",1,200,t),n("domainCount")&&Ie(Number(e.domainCount),"domainCount",1,200,t),n("maxNodes")&&Ie(Number(e.maxNodes),"maxNodes",0,500,t),n("dls")&&Ie(Number(e.dls),"dls",0,1e3,t),n("maxLatency")&&Ie(Number(e.maxLatency),"maxLatency",0,1e4,t),n("dataBudgetMB")&&Ie(Number(e.dataBudgetMB),"dataBudgetMB",0,102400,t),n("subTokenTtlDays")&&Ie(Number(e.subTokenTtlDays),"subTokenTtlDays",0,3650,t),n("subPorts")){let o=String(e.subPorts??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>6?t.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg5pyA5aSaIDYg5Liq56uv5Y+j")}):s.every(i=>/^\d{1,5}$/.test(i)&&Number(i)>=1&&Number(i)<=65535)||t.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg6YeM5q+P5Liq56uv5Y+j6YO95b+F6aG75pivIDF+NjU1MzUg55qE5pWw5a2X")})}}if(n("subName")){let o=String(e.subName??"");o.length>40&&t.push({field:"subName",message:__sfx("c3ViTmFtZSDmnIDlpJogNDAg5a2X56ym")}),/[\u0000-\u001f]/.test(o)&&t.push({field:"subName",message:__sfx("c3ViTmFtZSDkuI3og73ljIXlkKvmjqfliLblrZfnrKY=")})}if(n("addApi")&&Jo(String(e.addApi??""),"addApi",t),n("addCsv")&&Jo(String(e.addCsv??""),"addCsv",t),n("add")&&Ka(String(e.add??""),"add",t),n("uuid")){let o=String(e.uuid??"").trim();o&&!/^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/.test(o)&&t.push({field:"uuid",message:__sfx("dXVpZCDlv4XpobvmmK/moIflh4YgVVVJRO+8iDM2IOS9je+8jOWPr+W4pui/nuWtl+espu+8iQ==")})}if(n("poolCountries")){let o=String(e.poolCountries??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>30?t.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDmnIDlpJogMzAg5Liq5Zu95a62L+WcsOWMug==")}):s.every(i=>/^[A-Za-z]{2,3}$/.test(i))||t.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDlj6rog73mmK8gMn4zIOS9jeWtl+avjeS7o+eggQ==")})}}if(n("udpDnsEndpoint")){let o=String(e.udpDnsEndpoint??"").trim();o&&!/^https:\/\/\S+$/i.test(o)&&t.push({field:"udpDnsEndpoint",message:__sfx("dWRwRG5zRW5kcG9pbnQg5b+F6aG75pivIGh0dHBzIOWcsOWdgA==")})}return t}function mt(e){return e.length===0?"":e.length===1?e[0].message:"有 "+e.length+__sfx("IOmhuemFjee9ruS4jeWQiOazle+8mg==")+e.map(t=>t.message).join("\uFF1B")+""}var Ma,Fa,Ha,Ba,Zo,Qo=v(()=>{"use strict";Nt();Ma=/^(?=.{1,253}$)([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;Fa=/^(?:(?:socks5|socks|socks5h|http|https):\/\/)?(?:[^\s@/]+@)?(?:\[[0-9a-fA-F:]+\]|[A-Za-z0-9._-]+)(?::\d{1,5})?$/;Ha=20,Ba=200,Zo=2e3});function es(e,t=Date.now()){let n={};for(let o of qo){let s=e[o];s!==void 0&&(n[o]=s)}let r=Ga.map(o=>({field:o.field,reason:o.reason}));for(let o of[__sfx("c29ja3M1"),"httpProxy"]){let s=String(e[o]??"");if(!s){n[o]="";continue}if(s.includes("@")){r.push({field:o,reason:__sfx("5ZCr55So5oi35ZCNL+WPo+S7pO+8jOmcgOaJi+W3pemHjeaWsOWhq+WGmQ==")});continue}n[o]=s}return{schemaVersion:1,exportedAt:new Date(t).toISOString(),config:n,omitted:r}}function ts(e){let t=new Set([...qo.map(String),__sfx("c29ja3M1"),"httpProxy"]),n={};for(let[r,o]of Object.entries(e))t.has(r)&&(n[r]=o);return n}function $o(e){if(e==null)return"\uFF08\u7A7A\uFF09";if(typeof e=="string"){let t=e.replace(/\s+/g," ").trim();return t.length>60?`${t.slice(0,60)}\u2026`:t||"\uFF08\u7A7A\uFF09"}return String(e)}function ns(e,t){let n=[];for(let[r,o]of Object.entries(t)){let s=e[r];String(s)!==String(o)&&n.push({field:r,from:$o(s),to:$o(o)})}return n}var qo,Ga,rs=v(()=>{"use strict";qo=["poolOfficial","officialCount","poolDomain","domainCount","poolManual","poolCountries","add","dls","maxLatency","maxNodes",__sfx("cHJveHlJcA=="),"relayPool","useBuiltinRelay","proxyMode","nat64","concurrentDial","dataBudgetMB","resolvePreferred","aggressiveRedial",__sfx("ZW5hYmxlVHJvamFu"),__sfx("ZW5hYmxlWGh0dHA="),"subProtocol","subTransport","subVariants","subName","subPorts","clientFingerprint","ech","echHost","echDns","tlsFragment","tlsFragmentSize","tlsFragmentDelay","subToken","subTokenTtlDays","unlockProbe","udpDns","udpDnsEndpoint"],Ga=[{field:"uuid",reason:__sfx("5YWl56uZ5Yet5o2u")},{field:__sfx("dHJvamFuUGFzc3dvcmQ="),reason:__sfx("5YWl56uZ5Yet5o2u")},{field:"wsPath",reason:__sfx("5a6e5L6L5qCH6K+G77yI6K6i6ZiF6ZO+5o6l6YeM5Y+v6KeB77yM5a+85Ye65Y2z5pq06Zyy5YWl5Y+j77yJ")},{field:__sfx("dHJvamFuUGF0aA=="),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:__sfx("eGh0dHBQYXRo"),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"subDomain",reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"addApi",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")},{field:"addCsv",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")}]});function ss(){return new Response(JSON.stringify({build:gt,version:Vn,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var gt,Vn,os,jn=v(()=>{"use strict";gt="8b1bb07-a5e14406",Vn=__sfx("MC40MC4y"),os=__sfx("L19fY2ZwX3ZlcnNpb24=")});var ls={};Je(ls,{API_PREFIX:()=>_n,getScannerToken:()=>_a,handleApi:()=>Za,pruneLoginFailures:()=>as});function Va(e){return e.headers.get("CF-Connecting-IP")??e.headers.get("x-forwarded-for")?.split(",")[0]?.trim()??"unknown"}function ja(e,t){let n=We.get(e);return n?t>=n.resetAt?(We.delete(e),!1):n.count>=za:!1}function as(e,t,n=Wa){if(!(e.size<n)){for(let[r,o]of e)t>=o.resetAt&&e.delete(r);for(;e.size>=n;){let r=e.keys().next().value;if(r===void 0)break;e.delete(r)}}}function Ya(e,t){let n=We.get(e);if(!n||t>=n.resetAt){as(We,t),We.set(e,{count:1,resetAt:t+is});return}n.count+=1}function G(e,t=200,n={}){return new Response(JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...n}})}function H(e,t){return G({ok:!1,error:e},t)}async function _a(e,t){let n=await e.get(yn);if(n)return n;if(typeof t.SCANNER_TOKEN=="string"&&t.SCANNER_TOKEN)return t.SCANNER_TOKEN;let r=_(24);return await e.put(yn,r),r}async function Za(e,t,n){if(!t.pathname.startsWith(_n))return null;let{store:r,env:o,config:s,auth:i}=n,a=t.pathname.slice(_n.length)||"/",l=e.method.toUpperCase();if(a==="/session"&&l==="GET"){let u=await Hn(r,e);return G(u?{ok:!0,authenticated:u,panelPath:i.panelPath}:{ok:!0,authenticated:u,hasSessionCookie:Go(e)})}if(a==="/login"&&l==="POST"){let u="";try{let y=await e.json();u=String(y.password??"")}catch{return H(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(!u)return H(__sfx("6K+36L6T5YWl5a+G56CB"),400);let c=Va(e),d=Date.now();if(ja(c,d))return new Response(JSON.stringify({ok:!1,error:__sfx("5bCd6K+V6L+H5LqO6aKR57mB77yM6K+356iN5ZCO5YaN6K+V")}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(is/1e3))}});let p=await Fo(i,u);if(!p.ok)return Ya(c,d),H(__sfx("5a+G56CB6ZSZ6K+v"),401);We.delete(c),p.legacy&&await Ho(r,u).catch(()=>{}),await Bo(r).catch(()=>{});let h=await Ko(r);return G({ok:!0},200,{"Set-Cookie":Xo(h)})}if(a==="/logout"&&l==="POST")return await Wo(r,e),G({ok:!0},200,{"Set-Cookie":zo()});if(a==="/preferred-ips"&&l==="POST"){let u=e.headers.get("Authorization")??"",c=u.startsWith("Bearer ")?u.slice(7).trim():u.trim();if(!await jo(r,c,o))return H(__sfx("VG9rZW4g5qCh6aqM5aSx6LSl"),401);let p;try{p=await e.json()}catch{return H(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}let y=(Array.isArray(p.ips)?p.ips.map(m=>String(m)):[]).map(m=>m.trim()).filter(m=>m.length>0),{valid:x,invalid:g}=fo(y),S=p.mode==="append",E=p.target==="relay",T=m=>m.split("#")[0].trim().replace(/^\[([^\]]+)\]:(\d+)$/,"$1:$2");if(x.length===0&&y.length>0)return H(__sfx("5rKh5pyJ5Y+v6K+G5Yir55qE5p2h55uu77yI5bey6Lez6L+HIA==")+g+" \u884C\uFF09",400);if(E){if(x.length===0)return H(__sfx("5rKh5pyJ5Y+v6K+G5Yir55qE5Y+N5Luj5YWl5Y+j"),400);let m=Xa,b=x.slice(0,m),A=x.length-b.length,L=(s.relayPool??"").split(`
|
|
8
8
|
`).map(K=>K.trim()).filter(Boolean),N,J=b.length;if(S){let K=new Set(L.map(T)),z=b.filter(Ue=>{let V=T(Ue);return K.has(V)?!1:(K.add(V),!0)});J=z.length,N=[...L,...z]}else N=b;N.length>m&&(N=N.slice(0,m));let Se=await Gr(r,s);return await He(r,Fe(Se,{relayPool:N.join(`
|
|
9
9
|
`)})),n.onConfigChanged(),G({ok:!0,target:"relay",mode:S?"append":"replace",count:b.length,added:J,invalid:g,overLimit:A,limit:m})}let U=await r.get(ie),C,P=x.length;if(S){let m=(U??"").split(`
|
|
10
10
|
`).map(L=>L.trim()).filter(L=>L.length>0),b=new Set(m.map(T)),A=x.filter(L=>{let N=T(L);return b.has(N)?!1:(b.add(N),!0)});P=A.length,C=[...m,...A].join(`
|
package/dist/cli.js
CHANGED