cfpilot 0.40.0 → 0.40.6

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 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="f4493ce-0f8ba4c0",Ht=__sfx("MC40MC42"),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(`
@@ -1,5 +1,5 @@
1
- const __sfx=(()=>{const __t=new TextDecoder(),__c=new Map();return b=>{let v=__c.get(b);if(v===void 0){const s=atob(b),u=new Uint8Array(s.length);for(let i=0;i<s.length;i++)u[i]=s.charCodeAt(i);v=__t.decode(u);__c.set(b,v)}return v}})();var Hr=Object.defineProperty;var S=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Ie=(e,t)=>{for(var n in t)Hr(e,n,{get:t[n],enumerable:!0})};function Oe(e){let t=new Uint8Array(e);crypto.getRandomValues(t);let n="";for(let o of t)n+=De[o>>4]+De[o&15];return n}function st(){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[];for(let n of e)t.push(De[n>>4]+De[n&15]);return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function be(e,t){if(e.length!==t.length)return!1;let n=0;for(let o=0;o<e.length;o++)n|=e.charCodeAt(o)^t.charCodeAt(o);return n===0}var De,ee=S(()=>{"use strict";De="0123456789abcdef"});function H(e){let t=Yr.exec(e);if(!t)return!1;for(let n=1;n<=4;n++){let o=Number(t[n]);if(!Number.isInteger(o)||o<0||o>255)return!1}return!0}function te(e){return!e.includes(":")||!/^[0-9a-fA-F:.]+$/.test(e)?!1:we(e)!==null}function _r(e){return jr.test(e)&&e.length<=253}function Zr(e){return!e||e.length>253||/[\u0000-\u001f\u007f]/.test(e)?!1:H(e)||te(e)||_r(e)||/^[a-zA-Z0-9_-]+$/.test(e)}function an(e,t){if(!Zr(e)||!Number.isInteger(t)||t<1||t>65535)throw new Error(__sfx("SW52YWxpZCBDT05ORUNUIGF1dGhvcml0eQ=="))}function we(e){if(!e.includes(":"))return null;let t=e,n=t.lastIndexOf(":"),o=t.slice(n+1);if(o.includes(".")){if(!H(o))return null;let d=o.split(".").map(f=>Number(f));t=`${t.slice(0,n+1)}${(d[0]<<8|d[1]).toString(16)}:${(d[2]<<8|d[3]).toString(16)}`}let r=t.indexOf("::"),s,i;if(r>=0){if(t.indexOf("::",r+1)>=0)return null;let d=t.slice(0,r),f=t.slice(r+2);s=d?d.split(":"):[],i=f?f.split(":"):[]}else s=t.split(":"),i=[];let a=s.length+i.length;if(a>8)return null;let l=[],u=d=>/^[0-9a-fA-F]{1,4}$/.test(d)?parseInt(d,16):null;for(let d of s){let f=u(d);if(f===null)return null;l.push(f)}let c=8-a;for(let d=0;d<c;d++)l.push(0);for(let d of i){let f=u(d);if(f===null)return null;l.push(f)}return l.length===8?l:null}function Jr(e){let t=e.map(l=>(l&65535).toString(16)),n=-1,o=0,r=-1,s=0;for(let l=0;l<t.length;l++)t[l]==="0"?(r<0&&(r=l),s++,s>o&&(o=s,n=r)):(r=-1,s=0);if(o<2)return t.join(":");let i=t.slice(0,n).join(":"),a=t.slice(n+o).join(":");return`${i}::${a}`}function Qr(e,t,n,o){if(t<0||t>=e.length)return null;if(n===1)return t+5>e.length?null:{hostname:`${e[t+1]}.${e[t+2]}.${e[t+3]}.${e[t+4]}`,next:t+5};if(o?n===2:n===3){if(t+2>e.length)return null;let r=e[t+1];return t+2+r>e.length?null:{hostname:Vr.decode(e.subarray(t+2,t+2+r)),next:t+2+r}}if(o?n===3:n===4){if(t+17>e.length)return null;let r=new DataView(e.buffer,e.byteOffset+t+1,16),s=[];for(let i=0;i<8;i++)s.push(r.getUint16(i*2,!1));return{hostname:Jr(s),next:t+17}}return null}async function ct(e,t){let n=await e.peekExactly(1);if(!n)return null;let o=n[0],r;if(o===1)r=5;else if(t?o===2:o===3){let a=await e.peekExactly(2);if(!a)return null;r=2+a[1]}else if(t?o===3:o===4)r=17;else return null;let s=await e.peekExactly(r);if(!s)return null;let i=Qr(s,0,o,t);return i?(e.skip(r),{hostname:i.hostname,addressType:o,consumed:r}):null}var Vr,Yr,jr,G=S(()=>{"use strict";Vr=new TextDecoder,Yr=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,jr=/^[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])?)+$/});function cn(e){let t=xe.get(e);if(t!==void 0)return t;let n=e.replace(/-/g,"").trim().toLowerCase();if(!/^[0-9a-f]{32}$/.test(n))return xe.set(e,null),null;let o=new Uint8Array(16);for(let r=0;r<16;r++)o[r]=parseInt(n.slice(r*2,r*2+2),16);return xe.size>=16&&xe.clear(),xe.set(e,o),o}async function un(e,t){let n=await e.readExactly(1);if(!n)return null;let o=await e.readExactly(16);if(!o)return null;let r=cn(t);if(!r)return null;for(let f=0;f<16;f++)if(o[f]!==r[f])return null;let s=await e.readExactly(1);if(!s)return null;let i=s[0],a=i>0?await e.readExactly(i):new Uint8Array(0);if(!a)return null;let l=await e.readExactly(1);if(!l)return null;let u=await e.readExactly(2);if(!u)return null;let c=await ct(e,!0);if(!c)return null;let d=u[0]<<8|u[1];return{header:{version:n[0],command:l[0],port:d,hostname:c.hostname,addressType:c.addressType,addons:a},payload:e.release()}}function Ue(e,t){if(e.byteLength<18)return null;let n=cn(t);if(!n)return null;for(let u=0;u<16;u++)if(e[1+u]!==n[u])return null;let o=e[17],r=18+o;if(e.byteLength<r+4)return null;let s=e[r];r+=1;let i=e[r]<<8|e[r+1];r+=2;let a=e[r];r+=1;let l="";if(a===1){if(e.byteLength<r+4)return null;l=`${e[r]}.${e[r+1]}.${e[r+2]}.${e[r+3]}`,r+=4}else if(a===2){if(e.byteLength<r+1)return null;let u=e[r];if(r+=1,e.byteLength<r+u)return null;l=qr.decode(e.subarray(r,r+u)),r+=u}else if(a===3){if(e.byteLength<r+16)return null;let u=[];for(let c=0;c<8;c++)u.push((e[r+c*2]<<8|e[r+c*2+1]).toString(16));l=u.join(":"),r+=16}else return null;return{header:{version:e[0],command:s,port:i,hostname:l,addressType:a,addons:e.subarray(18,18+o)},consumed:r}}var ut,ln,qr,xe,dt=S(()=>{"use strict";G();ut=1,ln=2,qr=new TextDecoder,xe=new Map});function X(e,t){return e>>>t|e<<32-t}function eo(e){let t=new Uint32Array([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),n=e.length*8,o=Math.ceil((e.length+9)/64)*64,r=new Uint8Array(o);r.set(e),r[e.length]=128;let s=new DataView(r.buffer);s.setUint32(o-8,Math.floor(n/4294967296),!1),s.setUint32(o-4,n>>>0,!1);let i=new Uint32Array(64);for(let l=0;l<o;l+=64){for(let p=0;p<16;p++)i[p]=s.getUint32(l+p*4,!1);for(let p=16;p<64;p++){let R=X(i[p-15],7)^X(i[p-15],18)^i[p-15]>>>3,A=X(i[p-2],17)^X(i[p-2],19)^i[p-2]>>>10;i[p]=i[p-16]+R+i[p-7]+A>>>0}let u=t[0],c=t[1],d=t[2],f=t[3],g=t[4],y=t[5],P=t[6],T=t[7];for(let p=0;p<64;p++){let R=X(g,6)^X(g,11)^X(g,25),A=g&y^~g&P,k=T+R+A+$r[p]+i[p]>>>0,K=X(u,2)^X(u,13)^X(u,22),q=u&c^u&d^c&d,N=K+q>>>0;T=P,P=y,y=g,g=f+k>>>0,f=d,d=c,c=u,u=k+N>>>0}t[0]=t[0]+u>>>0,t[1]=t[1]+c>>>0,t[2]=t[2]+d>>>0,t[3]=t[3]+f>>>0,t[4]=t[4]+g>>>0,t[5]=t[5]+y>>>0,t[6]=t[6]+P>>>0,t[7]=t[7]+T>>>0}let a=new Uint8Array(28);for(let l=0;l<7;l++)a[l*4]=t[l]>>>24&255,a[l*4+1]=t[l]>>>16&255,a[l*4+2]=t[l]>>>8&255,a[l*4+3]=t[l]&255;return a}function fn(e){let t=eo(e),n="";for(let o of t)n+=dn[o>>4]+dn[o&15];return n}var $r,dn,pn=S(()=>{"use strict";$r=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dn="0123456789abcdef"});function no(e){let t=Ne.get(e);if(t!==void 0)return t;let n=fn(to.encode(e));return Ne.size>=16&&Ne.clear(),Ne.set(e,n),n}function gn(e,t){if(e.byteLength<58||!t)return null;let n=no(t);if(mn.decode(e.subarray(0,56)).trim().toLowerCase()!==n||e[56]!==13||e[57]!==10)return null;let r=58;if(e.byteLength<r+2)return null;let s=e[r];r+=1;let i=e[r];r+=1;let a="";if(i===1){if(e.byteLength<r+4)return null;a=`${e[r]}.${e[r+1]}.${e[r+2]}.${e[r+3]}`,r+=4}else if(i===3){if(e.byteLength<r+1)return null;let u=e[r];if(r+=1,e.byteLength<r+u)return null;a=mn.decode(e.subarray(r,r+u)),r+=u}else if(i===4){if(e.byteLength<r+16)return null;let u=[];for(let c=0;c<8;c++)u.push((e[r+c*2]<<8|e[r+c*2+1]).toString(16));a=u.join(":"),r+=16}else return null;if(e.byteLength<r+4)return null;let l=e[r]<<8|e[r+1];return r+=2,e[r]!==13||e[r+1]!==10?null:(r+=2,{header:{command:s,port:l,hostname:a,addressType:i},consumed:r})}var hn,to,mn,Ne,yn=S(()=>{"use strict";G();pn();hn=3,to=new TextEncoder,mn=new TextDecoder,Ne=new Map});function ro(e,t){if(e.byteLength===0)return t;if(t.byteLength===0)return e;let n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}function ft(e){if(e.byteLength<12)return new Uint8Array(0);let t=e.slice();return t[2]=128|e[2]&1,t[3]=130,t}var Le,bn=S(()=>{"use strict";Le=class{constructor(t){this.options=t}options;pending=new Uint8Array(0);waiting=[];inflight=0;dropped=0;push(t){if(t.byteLength!==0){if(this.pending=ro(this.pending,t),this.pending.byteLength>262144){this.pending=new Uint8Array(0);return}this.drain()}}get droppedCount(){return this.dropped}get activeQueries(){return this.inflight}get queuedCount(){return this.waiting.length}drain(){for(;this.pending.byteLength>=2;){let t=this.pending[0]<<8|this.pending[1];if(t===0||t>65535){this.dropped+=1,this.pending=this.pending.subarray(2);continue}if(this.pending.byteLength<2+t){this.pump();return}let n=this.pending.slice(2,2+t);if(this.pending=this.pending.subarray(2+t),this.waiting.length>=32){this.dropped+=1;continue}this.waiting.push(n)}this.pump()}pump(){for(;this.inflight<4&&this.waiting.length>0;){let t=this.waiting.shift();this.inflight+=1,this.resolve(t).finally(()=>{this.inflight-=1,this.pump()})}}async resolve(t){let n=new AbortController,o=setTimeout(()=>n.abort(),this.options.timeoutMs??5e3);try{let r=await fetch(this.options.endpoint,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:t.slice().buffer,signal:n.signal});if(!r.ok){this.reply(ft(t));return}let s=new Uint8Array(await r.arrayBuffer());if(s.byteLength===0){this.reply(ft(t));return}this.reply(s)}catch{this.reply(ft(t))}finally{clearTimeout(o)}}reply(t){if(t.byteLength===0||t.byteLength>65535)return;let n=new Uint8Array(2+t.byteLength);n[0]=t.byteLength>>8&255,n[1]=t.byteLength&255,n.set(t,2),this.options.send(n)}}});function wn(e,t){if(e.byteLength===0)return t;if(t.byteLength===0)return e;let n=new Uint8Array(new ArrayBuffer(e.byteLength+t.byteLength));return n.set(e,0),n.set(t,e.byteLength),n}var ne,ei,oo,Me,Pe=S(()=>{"use strict";ne=class{reader;chunks=[];size=0;done=!1;constructor(t){this.reader=t.getReader()}async cancel(t){if(!this.done){this.done=!0,this.chunks=[],this.size=0;try{await this.reader.cancel(t)}catch{}}}async fill(){for(;;){if(this.done)return null;let{done:t,value:n}=await this.reader.read();if(t)return this.done=!0,null;if(n&&n.byteLength>0)return this.chunks.push(n),this.size+=n.byteLength,n.byteLength}}async readExactly(t){if(t===0)return new Uint8Array(0);for(;this.size<t;){if(this.done)return null;let{done:n,value:o}=await this.reader.read();if(n)return this.done=!0,this.size>=t?this.take(t):null;o&&o.byteLength>0&&(this.chunks.push(o),this.size+=o.byteLength)}return this.take(t)}take(t){let n=new Uint8Array(t),o=0;for(;o<t;){let r=this.chunks[0],s=t-o;r.byteLength<=s?(n.set(r,o),o+=r.byteLength,this.chunks.shift()):(n.set(r.subarray(0,s),o),this.chunks[0]=r.subarray(s),o+=s)}return this.size-=t,n}async peekExactly(t){if(t===0)return new Uint8Array(0);for(;this.size<t;){if(this.done)return null;let{done:n,value:o}=await this.reader.read();if(n)return this.done=!0,this.size>=t?this.slice(t):null;o&&o.byteLength>0&&(this.chunks.push(o),this.size+=o.byteLength)}return this.slice(t)}skip(t){return this.size<t?null:this.take(t)}slice(t){let n=new Uint8Array(t),o=0;for(let r of this.chunks){if(o>=t)break;let s=Math.min(r.byteLength,t-o);n.set(r.subarray(0,s),o),o+=s}return n}peek(){if(this.chunks.length===0)return new Uint8Array(0);if(this.chunks.length===1)return this.chunks[0];let t=this.chunks.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t),o=0;for(let r of this.chunks)n.set(r,o),o+=r.byteLength;return n}release(){let t=this.peek();this.chunks=[],this.size=0;let n=this.reader,o=this,r=!1;return new ReadableStream({async pull(s){if(!r&&(r=!0,t.byteLength>0)){s.enqueue(t);return}if(o.done){s.close();return}try{let{done:i,value:a}=await n.read();i?(o.done=!0,s.close()):a&&a.byteLength>0&&s.enqueue(a)}catch(i){s.error(i)}},cancel(s){n.cancel(s)}})}},ei=4*1024*1024,oo=4*1024*1024,Me=class{constructor(t=oo,n=()=>new Promise(o=>{setTimeout(o,0)})){this.threshold=t;this.yieldOnce=n}threshold;yieldOnce;sinceYield=0;yields=0;async onChunk(t){this.sinceYield+=t,!(this.sinceYield<this.threshold)&&(this.sinceYield=0,this.yields+=1,await this.yieldOnce())}get yieldCount(){return this.yields}}});function xn(e){if(e.aggressive)return{allowed:!0,reason:__sfx("5r+A6L+b5qih5byP5YWB6K645YiH5o2i77yI5Y+v6IO96YeN5aSN6K+35rGC77yJ")};let t=e.via;return t&&t!=="direct"&&t!=="nat64"?{allowed:!1,reason:__sfx("5b2T5YmN6LWw6JC95Zyw5Luj55CGKA==")+t+__sfx("Ke+8jOWIh+aNouS8mue7lei/h+eUqOaIt+aMh+WumuWHuuWPow==")}:e.userProxyConfigured?{allowed:!1,reason:__sfx("5bey6YWN572u6JC95Zyw5Luj55CG5oiWIFByb3h5SVDvvIzkuI3oh6rliqjliIfmjaLlh7rlj6M=")}:so.includes(e.port)?{allowed:!0,reason:__sfx("55u06L+e5Ye65Y+j5LiU56uv5Y+j6YCC55So")}:{allowed:!1,reason:__sfx("55uu5qCH56uv5Y+jIA==")+e.port+__sfx("IOS4jeaUr+aMgeWPjeS7oyBTTkkg6L2s5Y+R")}}var so,Pn=S(()=>{"use strict";so=[443,80]});var He,Sn=S(()=>{"use strict";He=class{tail=Promise.resolve();run(t){let n=this.tail.then(t);return this.tail=n.catch(()=>{}),n}write(t,n){return this.run(async()=>{let o=t();o&&await o.write(n)})}}});function pt(e){return`${e.kind}://${e.host}:${e.port}`}function lo(e,t){let n=Be.get(pt(e));return n!==void 0&&n.cooldownUntil>t}function An(e,t){let n=pt(e),o=Be.get(n)??{fails:0,cooldownUntil:0};if(o.fails+=1,o.fails>=En){let r=o.fails-En,s=Math.min(ao,io*2**r);o.cooldownUntil=t+s}Be.set(n,o)}function Tn(e){Be.delete(pt(e))}function mt(e,t,n){if(e.length<=1)return e;let o=e.filter(r=>{let s=t(r);return s===void 0||!lo(s,n)});return o.length>0?o:e}var re,En,io,ao,Be,Fe=S(()=>{"use strict";re=class extends Error{},En=2,io=3e4,ao=5*6e4,Be=new Map});async function oe(e,t,n,o){let r=Date.now()+n,s=null;try{let i=await Promise.race([e.readExactly(t),new Promise(a=>{s=setTimeout(()=>a(null),Math.max(1,r-Date.now()))})]);if(i===null)throw new Error(""+o+__sfx("6LaF5pe277yI")+n+__sfx("bXMg5peg5ZON5bqU77yJ"));return i}finally{s&&clearTimeout(s)}}async function Rn(e,t,n,o,r={}){let s=new ne(e),i=t.getWriter(),a=r.handshakeTimeoutMs??co,l=async u=>{await i.write(u)};try{let u=[0];r.username&&u.push(2);let c=new Uint8Array(2+u.length);c[0]=5,c[1]=u.length,c.set(u,2),await l(c);let d=await oe(s,2,a,__sfx("U09DS1M1IOaPoeaJiw=="));if(!d||d[0]!==5)throw new Error(__sfx("U09DS1M1IOaPoeaJi+Wksei0pe+8mumdnuazleWTjeW6lA=="));let f=d[1];if(f===2){let p=new TextEncoder().encode(r.username??""),R=new TextEncoder().encode(r.password??""),A=new Uint8Array(3+p.length+R.length);A[0]=1,A[1]=p.length,A.set(p,2),A[2+p.length]=R.length,A.set(R,3+p.length),await l(A);let k=await oe(s,2,a,__sfx("U09DS1M1IOiupOivgQ=="));if(!k||k[1]!==0)throw new Error(__sfx("U09DS1M1IOeUqOaIt+WQjS/lr4bnoIHorqTor4HlpLHotKU="))}else if(f!==0)throw new Error(__sfx("U09DS1M1IOS4jeaUr+aMgeeahOiupOivgeaWueW8j++8mjB4")+f.toString(16)+"");let g=uo(n,o),y=new Uint8Array(3+g.length);y[0]=5,y[1]=1,y[2]=0,y.set(g,3),await l(y);let P=await oe(s,4,a,__sfx("U09DS1M1IENPTk5FQ1Q="));if(!P||P[0]!==5)throw new Error(__sfx("U09DS1M1IENPTk5FQ1Qg5ZON5bqU6Z2e5rOV"));if(P[1]!==0)throw new re(__sfx("U09DS1M1IENPTk5FQ1Qg5aSx6LSl77yaMHg=")+P[1].toString(16)+"");let T=P[3];if(T===1)await oe(s,4,a,__sfx("U09DS1M1IOWTjeW6lA=="));else if(T===3){let p=await oe(s,1,a,__sfx("U09DS1M1IOWTjeW6lA=="));if(!p)throw new Error(__sfx("U09DS1M1IOWTjeW6lOaIquaWrQ=="));await oe(s,p[0],a,__sfx("U09DS1M1IOWTjeW6lA=="))}else if(T===4)await oe(s,16,a,__sfx("U09DS1M1IOWTjeW6lA=="));else throw new Error(__sfx("U09DS1M1IOWTjeW6lOWcsOWdgOexu+Wei+mdnuazlQ=="));return await oe(s,2,a,__sfx("U09DS1M1IOWTjeW6lA==")),s.release()}finally{try{i.releaseLock()}catch{}}}function uo(e,t){let n=e.replace(/^\[|\]$/g,"");if(H(n)){let s=n.split(".").map(a=>Number(a)),i=new Uint8Array(7);return i[0]=1,i.set(s,1),i[5]=t>>8&255,i[6]=t&255,i}if(te(n)){let s=we(n),i=new Uint8Array(19);if(i[0]=4,s)for(let a=0;a<8;a++){let l=s[a]??0;i[1+a*2]=l>>8&255,i[2+a*2]=l&255}return i[17]=t>>8&255,i[18]=t&255,i}let o=new TextEncoder().encode(n),r=new Uint8Array(2+o.length+2);return r[0]=3,r[1]=o.length,r.set(o,2),r[r.length-2]=t>>8&255,r[r.length-1]=t&255,r}var co,Cn=S(()=>{"use strict";Pe();G();Fe();co=6e3});function po(e){let t=e.byteLength;for(let n=0;n+3<t;n++)if(fo.every((o,r)=>e[n+r]===o))return n;return-1}async function vn(e,t,n,o,r={}){an(n,o);let s=new ne(e),i=t.getWriter(),a=n.includes(":")?`[${n}]:${o}`:`${n}:${o}`;try{let l=r.username&&r.password?__sfx("UHJveHktQXV0aG9yaXphdGlvbjogQmFzaWMg")+btoa(`${r.username}:${r.password}`)+"\r\n":"",u=[__sfx("Q09OTkVDVCA=")+a+" HTTP/1.1",`Host: ${a}`,__sfx("UHJveHktQ29ubmVjdGlvbjoga2VlcC1hbGl2ZQ=="),"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",l,"",""].join(`\r
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
- `)[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
- `),{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};
1
+ const __sfx=(()=>{const __t=new TextDecoder(),__c=new Map();return b=>{let v=__c.get(b);if(v===void 0){const s=atob(b),u=new Uint8Array(s.length);for(let i=0;i<s.length;i++)u[i]=s.charCodeAt(i);v=__t.decode(u);__c.set(b,v)}return v}})();var Mr=Object.defineProperty;var S=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var De=(e,t)=>{for(var n in t)Mr(e,n,{get:t[n],enumerable:!0})};function Ue(e){let t=new Uint8Array(e);crypto.getRandomValues(t);let n="";for(let o of t)n+=Oe[o>>4]+Oe[o&15];return n}function it(){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[];for(let n of e)t.push(Oe[n>>4]+Oe[n&15]);return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function we(e,t){if(e.length!==t.length)return!1;let n=0;for(let o=0;o<e.length;o++)n|=e.charCodeAt(o)^t.charCodeAt(o);return n===0}var Oe,$=S(()=>{"use strict";Oe="0123456789abcdef"});function H(e){let t=Vr.exec(e);if(!t)return!1;for(let n=1;n<=4;n++){let o=Number(t[n]);if(!Number.isInteger(o)||o<0||o>255)return!1}return!0}function ee(e){return!e.includes(":")||!/^[0-9a-fA-F:.]+$/.test(e)?!1:xe(e)!==null}function jr(e){return Yr.test(e)&&e.length<=253}function _r(e){return!e||e.length>253||/[\u0000-\u001f\u007f]/.test(e)?!1:H(e)||ee(e)||jr(e)||/^[a-zA-Z0-9_-]+$/.test(e)}function ln(e,t){if(!_r(e)||!Number.isInteger(t)||t<1||t>65535)throw new Error(__sfx("SW52YWxpZCBDT05ORUNUIGF1dGhvcml0eQ=="))}function xe(e){if(!e.includes(":"))return null;let t=e,n=t.lastIndexOf(":"),o=t.slice(n+1);if(o.includes(".")){if(!H(o))return null;let d=o.split(".").map(f=>Number(f));t=`${t.slice(0,n+1)}${(d[0]<<8|d[1]).toString(16)}:${(d[2]<<8|d[3]).toString(16)}`}let r=t.indexOf("::"),s,i;if(r>=0){if(t.indexOf("::",r+1)>=0)return null;let d=t.slice(0,r),f=t.slice(r+2);s=d?d.split(":"):[],i=f?f.split(":"):[]}else s=t.split(":"),i=[];let a=s.length+i.length;if(a>8)return null;let l=[],u=d=>/^[0-9a-fA-F]{1,4}$/.test(d)?parseInt(d,16):null;for(let d of s){let f=u(d);if(f===null)return null;l.push(f)}let c=8-a;for(let d=0;d<c;d++)l.push(0);for(let d of i){let f=u(d);if(f===null)return null;l.push(f)}return l.length===8?l:null}function Zr(e){let t=e.map(l=>(l&65535).toString(16)),n=-1,o=0,r=-1,s=0;for(let l=0;l<t.length;l++)t[l]==="0"?(r<0&&(r=l),s++,s>o&&(o=s,n=r)):(r=-1,s=0);if(o<2)return t.join(":");let i=t.slice(0,n).join(":"),a=t.slice(n+o).join(":");return`${i}::${a}`}function Jr(e,t,n,o){if(t<0||t>=e.length)return null;if(n===1)return t+5>e.length?null:{hostname:`${e[t+1]}.${e[t+2]}.${e[t+3]}.${e[t+4]}`,next:t+5};if(o?n===2:n===3){if(t+2>e.length)return null;let r=e[t+1];return t+2+r>e.length?null:{hostname:zr.decode(e.subarray(t+2,t+2+r)),next:t+2+r}}if(o?n===3:n===4){if(t+17>e.length)return null;let r=new DataView(e.buffer,e.byteOffset+t+1,16),s=[];for(let i=0;i<8;i++)s.push(r.getUint16(i*2,!1));return{hostname:Zr(s),next:t+17}}return null}async function ut(e,t){let n=await e.peekExactly(1);if(!n)return null;let o=n[0],r;if(o===1)r=5;else if(t?o===2:o===3){let a=await e.peekExactly(2);if(!a)return null;r=2+a[1]}else if(t?o===3:o===4)r=17;else return null;let s=await e.peekExactly(r);if(!s)return null;let i=Jr(s,0,o,t);return i?(e.skip(r),{hostname:i.hostname,addressType:o,consumed:r}):null}var zr,Vr,Yr,G=S(()=>{"use strict";zr=new TextDecoder,Vr=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,Yr=/^[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])?)+$/});function un(e){let t=Pe.get(e);if(t!==void 0)return t;let n=e.replace(/-/g,"").trim().toLowerCase();if(!/^[0-9a-f]{32}$/.test(n))return Pe.set(e,null),null;let o=new Uint8Array(16);for(let r=0;r<16;r++)o[r]=parseInt(n.slice(r*2,r*2+2),16);return Pe.size>=16&&Pe.clear(),Pe.set(e,o),o}async function dn(e,t){let n=await e.readExactly(1);if(!n)return null;let o=await e.readExactly(16);if(!o)return null;let r=un(t);if(!r)return null;for(let f=0;f<16;f++)if(o[f]!==r[f])return null;let s=await e.readExactly(1);if(!s)return null;let i=s[0],a=i>0?await e.readExactly(i):new Uint8Array(0);if(!a)return null;let l=await e.readExactly(1);if(!l)return null;let u=await e.readExactly(2);if(!u)return null;let c=await ut(e,!0);if(!c)return null;let d=u[0]<<8|u[1];return{header:{version:n[0],command:l[0],port:d,hostname:c.hostname,addressType:c.addressType,addons:a},payload:e.release()}}function Ne(e,t){if(e.byteLength<18)return null;let n=un(t);if(!n)return null;for(let u=0;u<16;u++)if(e[1+u]!==n[u])return null;let o=e[17],r=18+o;if(e.byteLength<r+4)return null;let s=e[r];r+=1;let i=e[r]<<8|e[r+1];r+=2;let a=e[r];r+=1;let l="";if(a===1){if(e.byteLength<r+4)return null;l=`${e[r]}.${e[r+1]}.${e[r+2]}.${e[r+3]}`,r+=4}else if(a===2){if(e.byteLength<r+1)return null;let u=e[r];if(r+=1,e.byteLength<r+u)return null;l=Qr.decode(e.subarray(r,r+u)),r+=u}else if(a===3){if(e.byteLength<r+16)return null;let u=[];for(let c=0;c<8;c++)u.push((e[r+c*2]<<8|e[r+c*2+1]).toString(16));l=u.join(":"),r+=16}else return null;return{header:{version:e[0],command:s,port:i,hostname:l,addressType:a,addons:e.subarray(18,18+o)},consumed:r}}var dt,cn,Qr,Pe,ft=S(()=>{"use strict";G();dt=1,cn=2,Qr=new TextDecoder,Pe=new Map});function X(e,t){return e>>>t|e<<32-t}function $r(e){let t=new Uint32Array([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),n=e.length*8,o=Math.ceil((e.length+9)/64)*64,r=new Uint8Array(o);r.set(e),r[e.length]=128;let s=new DataView(r.buffer);s.setUint32(o-8,Math.floor(n/4294967296),!1),s.setUint32(o-4,n>>>0,!1);let i=new Uint32Array(64);for(let l=0;l<o;l+=64){for(let p=0;p<16;p++)i[p]=s.getUint32(l+p*4,!1);for(let p=16;p<64;p++){let R=X(i[p-15],7)^X(i[p-15],18)^i[p-15]>>>3,A=X(i[p-2],17)^X(i[p-2],19)^i[p-2]>>>10;i[p]=i[p-16]+R+i[p-7]+A>>>0}let u=t[0],c=t[1],d=t[2],f=t[3],g=t[4],y=t[5],P=t[6],T=t[7];for(let p=0;p<64;p++){let R=X(g,6)^X(g,11)^X(g,25),A=g&y^~g&P,k=T+R+A+qr[p]+i[p]>>>0,K=X(u,2)^X(u,13)^X(u,22),J=u&c^u&d^c&d,N=K+J>>>0;T=P,P=y,y=g,g=f+k>>>0,f=d,d=c,c=u,u=k+N>>>0}t[0]=t[0]+u>>>0,t[1]=t[1]+c>>>0,t[2]=t[2]+d>>>0,t[3]=t[3]+f>>>0,t[4]=t[4]+g>>>0,t[5]=t[5]+y>>>0,t[6]=t[6]+P>>>0,t[7]=t[7]+T>>>0}let a=new Uint8Array(28);for(let l=0;l<7;l++)a[l*4]=t[l]>>>24&255,a[l*4+1]=t[l]>>>16&255,a[l*4+2]=t[l]>>>8&255,a[l*4+3]=t[l]&255;return a}function pn(e){let t=$r(e),n="";for(let o of t)n+=fn[o>>4]+fn[o&15];return n}var qr,fn,mn=S(()=>{"use strict";qr=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),fn="0123456789abcdef"});function to(e){let t=Le.get(e);if(t!==void 0)return t;let n=pn(eo.encode(e));return Le.size>=16&&Le.clear(),Le.set(e,n),n}function yn(e,t){if(e.byteLength<58||!t)return null;let n=to(t);if(hn.decode(e.subarray(0,56)).trim().toLowerCase()!==n||e[56]!==13||e[57]!==10)return null;let r=58;if(e.byteLength<r+2)return null;let s=e[r];r+=1;let i=e[r];r+=1;let a="";if(i===1){if(e.byteLength<r+4)return null;a=`${e[r]}.${e[r+1]}.${e[r+2]}.${e[r+3]}`,r+=4}else if(i===3){if(e.byteLength<r+1)return null;let u=e[r];if(r+=1,e.byteLength<r+u)return null;a=hn.decode(e.subarray(r,r+u)),r+=u}else if(i===4){if(e.byteLength<r+16)return null;let u=[];for(let c=0;c<8;c++)u.push((e[r+c*2]<<8|e[r+c*2+1]).toString(16));a=u.join(":"),r+=16}else return null;if(e.byteLength<r+4)return null;let l=e[r]<<8|e[r+1];return r+=2,e[r]!==13||e[r+1]!==10?null:(r+=2,{header:{command:s,port:l,hostname:a,addressType:i},consumed:r})}var gn,eo,hn,Le,bn=S(()=>{"use strict";G();mn();gn=3,eo=new TextEncoder,hn=new TextDecoder,Le=new Map});function no(e,t){if(e.byteLength===0)return t;if(t.byteLength===0)return e;let n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}function pt(e){if(e.byteLength<12)return new Uint8Array(0);let t=e.slice();return t[2]=128|e[2]&1,t[3]=130,t}var Me,wn=S(()=>{"use strict";Me=class{constructor(t){this.options=t}options;pending=new Uint8Array(0);waiting=[];inflight=0;dropped=0;push(t){if(t.byteLength!==0){if(this.pending=no(this.pending,t),this.pending.byteLength>262144){this.pending=new Uint8Array(0);return}this.drain()}}get droppedCount(){return this.dropped}get activeQueries(){return this.inflight}get queuedCount(){return this.waiting.length}drain(){for(;this.pending.byteLength>=2;){let t=this.pending[0]<<8|this.pending[1];if(t===0||t>65535){this.dropped+=1,this.pending=this.pending.subarray(2);continue}if(this.pending.byteLength<2+t){this.pump();return}let n=this.pending.slice(2,2+t);if(this.pending=this.pending.subarray(2+t),this.waiting.length>=32){this.dropped+=1;continue}this.waiting.push(n)}this.pump()}pump(){for(;this.inflight<4&&this.waiting.length>0;){let t=this.waiting.shift();this.inflight+=1,this.resolve(t).finally(()=>{this.inflight-=1,this.pump()})}}async resolve(t){let n=new AbortController,o=setTimeout(()=>n.abort(),this.options.timeoutMs??5e3);try{let r=await fetch(this.options.endpoint,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:t.slice().buffer,signal:n.signal});if(!r.ok){this.reply(pt(t));return}let s=new Uint8Array(await r.arrayBuffer());if(s.byteLength===0){this.reply(pt(t));return}this.reply(s)}catch{this.reply(pt(t))}finally{clearTimeout(o)}}reply(t){if(t.byteLength===0||t.byteLength>65535)return;let n=new Uint8Array(2+t.byteLength);n[0]=t.byteLength>>8&255,n[1]=t.byteLength&255,n.set(t,2),this.options.send(n)}}});function xn(e,t){if(e.byteLength===0)return t;if(t.byteLength===0)return e;let n=new Uint8Array(new ArrayBuffer(e.byteLength+t.byteLength));return n.set(e,0),n.set(t,e.byteLength),n}var te,ni,ro,He,Se=S(()=>{"use strict";te=class{reader;chunks=[];size=0;done=!1;constructor(t){this.reader=t.getReader()}async cancel(t){if(!this.done){this.done=!0,this.chunks=[],this.size=0;try{await this.reader.cancel(t)}catch{}}}async fill(){for(;;){if(this.done)return null;let{done:t,value:n}=await this.reader.read();if(t)return this.done=!0,null;if(n&&n.byteLength>0)return this.chunks.push(n),this.size+=n.byteLength,n.byteLength}}async readExactly(t){if(t===0)return new Uint8Array(0);for(;this.size<t;){if(this.done)return null;let{done:n,value:o}=await this.reader.read();if(n)return this.done=!0,this.size>=t?this.take(t):null;o&&o.byteLength>0&&(this.chunks.push(o),this.size+=o.byteLength)}return this.take(t)}take(t){let n=new Uint8Array(t),o=0;for(;o<t;){let r=this.chunks[0],s=t-o;r.byteLength<=s?(n.set(r,o),o+=r.byteLength,this.chunks.shift()):(n.set(r.subarray(0,s),o),this.chunks[0]=r.subarray(s),o+=s)}return this.size-=t,n}async peekExactly(t){if(t===0)return new Uint8Array(0);for(;this.size<t;){if(this.done)return null;let{done:n,value:o}=await this.reader.read();if(n)return this.done=!0,this.size>=t?this.slice(t):null;o&&o.byteLength>0&&(this.chunks.push(o),this.size+=o.byteLength)}return this.slice(t)}skip(t){return this.size<t?null:this.take(t)}slice(t){let n=new Uint8Array(t),o=0;for(let r of this.chunks){if(o>=t)break;let s=Math.min(r.byteLength,t-o);n.set(r.subarray(0,s),o),o+=s}return n}peek(){if(this.chunks.length===0)return new Uint8Array(0);if(this.chunks.length===1)return this.chunks[0];let t=this.chunks.reduce((r,s)=>r+s.byteLength,0),n=new Uint8Array(t),o=0;for(let r of this.chunks)n.set(r,o),o+=r.byteLength;return n}release(){let t=this.peek();this.chunks=[],this.size=0;let n=this.reader,o=this,r=!1;return new ReadableStream({async pull(s){if(!r&&(r=!0,t.byteLength>0)){s.enqueue(t);return}if(o.done){s.close();return}try{let{done:i,value:a}=await n.read();i?(o.done=!0,s.close()):a&&a.byteLength>0&&s.enqueue(a)}catch(i){s.error(i)}},cancel(s){n.cancel(s)}})}},ni=4*1024*1024,ro=4*1024*1024,He=class{constructor(t=ro,n=()=>new Promise(o=>{setTimeout(o,0)})){this.threshold=t;this.yieldOnce=n}threshold;yieldOnce;sinceYield=0;yields=0;async onChunk(t){this.sinceYield+=t,!(this.sinceYield<this.threshold)&&(this.sinceYield=0,this.yields+=1,await this.yieldOnce())}get yieldCount(){return this.yields}}});function Pn(e){if(e.aggressive)return{allowed:!0,reason:__sfx("5r+A6L+b5qih5byP5YWB6K645YiH5o2i77yI5Y+v6IO96YeN5aSN6K+35rGC77yJ")};let t=e.via;return t&&t!=="direct"&&t!=="nat64"?{allowed:!1,reason:__sfx("5b2T5YmN6LWw6JC95Zyw5Luj55CGKA==")+t+__sfx("Ke+8jOWIh+aNouS8mue7lei/h+eUqOaIt+aMh+WumuWHuuWPow==")}:e.userProxyConfigured?{allowed:!1,reason:__sfx("5bey6YWN572u6JC95Zyw5Luj55CG5oiWIFByb3h5SVDvvIzkuI3oh6rliqjliIfmjaLlh7rlj6M=")}:oo.includes(e.port)?{allowed:!0,reason:__sfx("55u06L+e5Ye65Y+j5LiU56uv5Y+j6YCC55So")}:{allowed:!1,reason:__sfx("55uu5qCH56uv5Y+jIA==")+e.port+__sfx("IOS4jeaUr+aMgeWPjeS7oyBTTkkg6L2s5Y+R")}}var oo,Sn=S(()=>{"use strict";oo=[443,80]});var Be,En=S(()=>{"use strict";Be=class{tail=Promise.resolve();run(t){let n=this.tail.then(t);return this.tail=n.catch(()=>{}),n}write(t,n){return this.run(async()=>{let o=t();o&&await o.write(n)})}}});function mt(e){return`${e.kind}://${e.host}:${e.port}`}function ao(e,t){let n=Fe.get(mt(e));return n!==void 0&&n.cooldownUntil>t}function Tn(e,t){let n=mt(e),o=Fe.get(n)??{fails:0,cooldownUntil:0};if(o.fails+=1,o.fails>=An){let r=o.fails-An,s=Math.min(io,so*2**r);o.cooldownUntil=t+s}Fe.set(n,o)}function Rn(e){Fe.delete(mt(e))}function ht(e,t,n){if(e.length<=1)return e;let o=e.filter(r=>{let s=t(r);return s===void 0||!ao(s,n)});return o.length>0?o:e}var ne,An,so,io,Fe,Ke=S(()=>{"use strict";ne=class extends Error{},An=2,so=3e4,io=5*6e4,Fe=new Map});async function re(e,t,n,o){let r=Date.now()+n,s=null;try{let i=await Promise.race([e.readExactly(t),new Promise(a=>{s=setTimeout(()=>a(null),Math.max(1,r-Date.now()))})]);if(i===null)throw new Error(""+o+__sfx("6LaF5pe277yI")+n+__sfx("bXMg5peg5ZON5bqU77yJ"));return i}finally{s&&clearTimeout(s)}}async function Cn(e,t,n,o,r={}){let s=new te(e),i=t.getWriter(),a=r.handshakeTimeoutMs??lo,l=async u=>{await i.write(u)};try{let u=[0];r.username&&u.push(2);let c=new Uint8Array(2+u.length);c[0]=5,c[1]=u.length,c.set(u,2),await l(c);let d=await re(s,2,a,__sfx("U09DS1M1IOaPoeaJiw=="));if(!d||d[0]!==5)throw new Error(__sfx("U09DS1M1IOaPoeaJi+Wksei0pe+8mumdnuazleWTjeW6lA=="));let f=d[1];if(f===2){let p=new TextEncoder().encode(r.username??""),R=new TextEncoder().encode(r.password??""),A=new Uint8Array(3+p.length+R.length);A[0]=1,A[1]=p.length,A.set(p,2),A[2+p.length]=R.length,A.set(R,3+p.length),await l(A);let k=await re(s,2,a,__sfx("U09DS1M1IOiupOivgQ=="));if(!k||k[1]!==0)throw new Error(__sfx("U09DS1M1IOeUqOaIt+WQjS/lr4bnoIHorqTor4HlpLHotKU="))}else if(f!==0)throw new Error(__sfx("U09DS1M1IOS4jeaUr+aMgeeahOiupOivgeaWueW8j++8mjB4")+f.toString(16)+"");let g=co(n,o),y=new Uint8Array(3+g.length);y[0]=5,y[1]=1,y[2]=0,y.set(g,3),await l(y);let P=await re(s,4,a,__sfx("U09DS1M1IENPTk5FQ1Q="));if(!P||P[0]!==5)throw new Error(__sfx("U09DS1M1IENPTk5FQ1Qg5ZON5bqU6Z2e5rOV"));if(P[1]!==0)throw new ne(__sfx("U09DS1M1IENPTk5FQ1Qg5aSx6LSl77yaMHg=")+P[1].toString(16)+"");let T=P[3];if(T===1)await re(s,4,a,__sfx("U09DS1M1IOWTjeW6lA=="));else if(T===3){let p=await re(s,1,a,__sfx("U09DS1M1IOWTjeW6lA=="));if(!p)throw new Error(__sfx("U09DS1M1IOWTjeW6lOaIquaWrQ=="));await re(s,p[0],a,__sfx("U09DS1M1IOWTjeW6lA=="))}else if(T===4)await re(s,16,a,__sfx("U09DS1M1IOWTjeW6lA=="));else throw new Error(__sfx("U09DS1M1IOWTjeW6lOWcsOWdgOexu+Wei+mdnuazlQ=="));return await re(s,2,a,__sfx("U09DS1M1IOWTjeW6lA==")),s.release()}finally{try{i.releaseLock()}catch{}}}function co(e,t){let n=e.replace(/^\[|\]$/g,"");if(H(n)){let s=n.split(".").map(a=>Number(a)),i=new Uint8Array(7);return i[0]=1,i.set(s,1),i[5]=t>>8&255,i[6]=t&255,i}if(ee(n)){let s=xe(n),i=new Uint8Array(19);if(i[0]=4,s)for(let a=0;a<8;a++){let l=s[a]??0;i[1+a*2]=l>>8&255,i[2+a*2]=l&255}return i[17]=t>>8&255,i[18]=t&255,i}let o=new TextEncoder().encode(n),r=new Uint8Array(2+o.length+2);return r[0]=3,r[1]=o.length,r.set(o,2),r[r.length-2]=t>>8&255,r[r.length-1]=t&255,r}var lo,vn=S(()=>{"use strict";Se();G();Ke();lo=6e3});function fo(e){let t=e.byteLength;for(let n=0;n+3<t;n++)if(uo.every((o,r)=>e[n+r]===o))return n;return-1}async function kn(e,t,n,o,r={}){ln(n,o);let s=new te(e),i=t.getWriter(),a=n.includes(":")?`[${n}]:${o}`:`${n}:${o}`;try{let l=r.username&&r.password?__sfx("UHJveHktQXV0aG9yaXphdGlvbjogQmFzaWMg")+btoa(`${r.username}:${r.password}`)+"\r\n":"",u=[__sfx("Q09OTkVDVCA=")+a+" HTTP/1.1",`Host: ${a}`,__sfx("UHJveHktQ29ubmVjdGlvbjoga2VlcC1hbGl2ZQ=="),"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",l,"",""].join(`\r
2
+ `);await i.write(new TextEncoder().encode(u));let c=Date.now()+gt,d="";for(;;){let P=s.peek(),T=fo(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=")+gt+__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=")+gt+__sfx("bXMg5peg5ZON5bqU77yJ"));if(A===null)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTkuI3lrozmlbTvvIjov57mjqXooqvmj5DliY3lhbPpl63vvIk="))}let g=d.split(`\r
3
+ `)[0]??"",y=/^HTTP\/1\.[01]\s+(\d{3})/.exec(g);if(!y)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTpnZ7ms5U="));if(y[1]!=="200")throw new ne(__sfx("SFRUUCDku6PnkIYgQ09OTkVDVCDlpLHotKXvvJo=")+y[1]+"");return s.release()}finally{try{i.releaseLock()}catch{}}}var uo,gt,In=S(()=>{"use strict";G();Se();Ke();uo=[13,10,13,10];gt=6e3});function bt(e){if(e instanceof le||(e instanceof Error?e.message:String(e)).includes(On))return!0;let n=e instanceof Error?e.cause:void 0;return n!==void 0&&n!==e&&bt(n)}function Dn(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 Ge(e){let t=Dn(e);if(t===null)return null;for(let[n,o,r,s]of po){let i=Dn(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 yt(e){let t=e[6]??0,n=e[7]??0;return`${t>>>8}.${t&255}.${n>>>8}.${n&255}`}function mo(e){let t=(e.split("%")[0]??"").toLowerCase();if(!t.includes(":"))return null;let n=xe(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 Ge(yt(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 Ge(yt(n))??null;if(n[0]===100&&n[1]===65435&&n[2]===0&&n[3]===0&&n[4]===0&&n[5]===0){let s=Ge(yt(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 wt(e){let t=e.trim().toLowerCase().replace(/^\[|\]$/g,"");if(t==="")return null;if(t.includes(":"))return mo(t);if(/^\d{1,3}(?:\.\d{1,3}){3}$/.test(t))return Ge(t);if(t==="localhost"||t.endsWith(".localhost"))return{kind:"loopback",reason:__sfx("546v5Zue5Li75py65ZCN")};for(let n of ho)if(t.endsWith(n))return{kind:"internal-name",reason:__sfx("5YaF572R5Z+f5ZCN5ZCO57yA")};return null}var On,Un,le,po,ho,xt=S(()=>{"use strict";G();On=__sfx("55uu5qCH5Zyw5Z2A6KKr562W55Wl5oum5oiq"),Un={kind:"ipv6-direct-unsupported",reason:__sfx("55u06L+e5LiO5Y+N5Luj6YCa6YGT5LiN5pSv5oyBIElQdjYg55uu5qCH77yM5Y+v5pS555So6JC95Zyw5Luj55CG6L2s5Y+R")},le=class extends Error{kind;constructor(t,n){super(`${On}\uFF1A${t}\uFF08${n.reason}\uFF09`),this.name="TargetBlockedError",this.kind=n.kind}};po=[[__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")]];ho=[".local",".internal"]});function Hn(e){return e.ips.length>0?yo:bo}function xo(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)?!0:e.includes(":")&&/^[0-9a-fA-F:.]+$/.test(e)}function St(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 Po(e,t,n,o=Mn){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 Nn(e,t,n={}){for(let o of go){if(n.deadline!==void 0&&Date.now()>=n.deadline)break;let r=n.timeoutMs??Mn,s=n.deadline!==void 0?n.deadline-Date.now():Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")],i=Math.max(50,Math.min(r,s)),a=await Po(o,e,t,i);if(a!==null)return a}return[]}function So(e,t){let n=[],o=String(e).replace(/^"|"$/g,"").replace(/\\010/g,",").replace(/\\n/g,",").trim();if(!o||o===Ln)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}=St(i,t);if(!H(a)&&!ee(a))return[];n.push({hostname:a,port:l})}return n}async function Xe(e,t,n={}){let o=e.trim();if(!o)return[];if(xo(o))return[{hostname:o,port:t}];let r=`${o}:${t}`,s=j.get(r);if(s&&Date.now()-s.at<Hn(s))return j.delete(r),j.set(r,s),s.ips;let i=Pt.get(r);if(i)return i;let a=Eo(o,t,r,n).finally(()=>{Pt.delete(r)});return Pt.set(r,a),a}async function Eo(e,t,n,o){let r=[],[s,i]=await Promise.all([o.skipTxt?Promise.resolve([]):Nn(e,"TXT",o),Nn(e,"A",o)]);if(!o.skipTxt)for(let c of s){let d=So(c,t);if(d.length>0){r.push(...d);break}if(String(c).replace(/^"|"$/g,"").replace(/\\010/g,",").trim()===Ln)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 j)u-d.at>=Hn(d)&&j.delete(c);for(;j.size>=wo;){let c=j.keys().next().value;if(c===void 0)break;j.delete(c)}return j.set(n,{at:u,ips:a}),a}var Ln,go,Mn,yo,bo,wo,j,Pt,We=S(()=>{"use strict";G();Ln=__sfx("QGVkZ2V0dW5uZWw="),go=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve","https://dns.alidns.com/resolve","https://doh.pub/dns-query"],Mn=4e3,yo=300*1e3,bo=30*1e3,wo=1e3,j=new Map,Pt=new Map});var Rt={};De(Rt,{[__sfx("QlVJTFRJTl9SRUxBWV9ET01BSU5T")]:()=>At,[__sfx("Q09MT19UT19DT1VOVFJZ")]:()=>Bn,[__sfx("UkVMQVlfQkFUQ0hfU0laRQ==")]:()=>ze,[__sfx("UkVMQVlfRE9NQUlOX0xJTUlU")]:()=>Tt,clearRelayCache:()=>Co,collectRelayEndpoints:()=>Ee,coloToCountry:()=>Ao,relayCacheSize:()=>vo,resolveRelayEntry:()=>Et,selectRelayDomains:()=>Gn});function Ao(e){let t=String(e??"").toUpperCase();return t?Bn[t]??(/^[A-Z]{2}$/.test(t)?t:"US"):"US"}function Ro(e){for(let[t,n]of _)e-n.at>=Kn&&_.delete(t);for(;_.size>=To;){let t=_.keys().next().value;if(t===void 0)break;_.delete(t)}}async function Et(e,t=443,n=Fn,o={}){let r=e.trim();if(!r)return[];let s=`${r}:${t}:${n}`,i=_.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)||ee(a))c=[{ip:a,port:Number.isInteger(l)&&l>0?l:t,label:r}];else try{c=(await Xe(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();Ro(d),_.set(s,{at:d,ips:c})}return c}function Gn(e=Tt,t=At){return t.slice(0,Math.max(0,e))}async function Ee(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??Tt,l=e.useBuiltin!==!1?Gn(a):[],u=await Promise.all([...i.map(f=>Et(f,443,t,{deadline:e.deadline,timeoutMs:e.timeoutMs})),...l.map(f=>Et(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 Co(){_.clear()}function vo(){return _.size}var At,Bn,Fn,ze,Tt,Kn,To,_,Ae=S(()=>{"use strict";G();We();At=[__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,ze=6,Tt=At.length,Kn=30*1e3,To=256,_=new Map});function Ct(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=Ct(t)??0,r=n===0?0:4294967295<<32-n>>>0;return[(o&r)>>>0,r]})}function Wn(e){let t=Ct(e);if(t===null)return!1;for(let[n,o]of No)if((t&o)>>>0===n)return!0;return!1}function oe(e){let t=Ct(e);if(t===null)return!1;for(let[n,o]of Uo)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=oe(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=>!oe(c.ip)),l=i.filter(c=>oe(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 bt(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 ko,Io,Do,Oo,Uo,No,vt=S(()=>{"use strict";xt();ko=[[__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]],Io=[[__sfx("MTA0LjMxLjAuMA=="),15],[__sfx("MTkyLjAuMC4w"),24],[__sfx("MTkyLjAuMi4w"),24],[__sfx("MTkyLjg4Ljk5LjA="),24],[__sfx("MTk5LjI3LjEyOC4w"),21],[__sfx("MS4wLjAuMA=="),24],[__sfx("MS4xLjEuMA=="),24]],Do=[[__sfx("MjIzLjUuNS4w"),24]],Oo=[...ko,...Io];Uo=Xn(Oo),No=Xn(Do)});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}=St(r,0);return!c||!Number.isInteger(d)||d<=0||d>65535?null:(!l&&o==="https"&&!Lo(c)&&(l=c),{host:c,port:d,kind:o,...a,...l?{serverName:l}:{}})}function Lo(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)}function Te(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 kt=S(()=>{"use strict";We()});async function Mo(){return It||(It=(async()=>(await import("cloudflare:sockets")).connect)()),await It}function Bo(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 Ye(e,t,n,o,r){let i=(await Mo())({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 Fo(e){let t=e.timeoutMs??Ve;try{let n=await Ye(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=Bo(e.hostname,e.nat64);if(o){let r=await Ye(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 Ko(e){return e.includes(":")}function Go(e){return e.source==="proxy"&&e.via!==void 0&&e.via.kind!=="direct"}async function Xo(e,t){let n=e.timeoutMs??Ve;if(t.kind==="direct"){let s=await Ye(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 Ye(t.host,t.port,n,o,t.kind==="https"?t.serverName:void 0);try{return t.kind==="http"||t.kind==="https"?{readable:await kn(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 Cn(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 Ot(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+=Dt){let i=e.slice(s,s+Dt);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=")+Dt+__sfx("IOS4quW5tuWPke+8ie+8mgo=")+n.join(`
4
+ `),{cause:o})}async function Zn(e,t){let n=[...e];if(!t)return n;try{let o=await Ee(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+=ze){let s=e.slice(o,o+ze).map(i=>t({source:"relay",host:i.ip,port:i.port,label:__sfx("5Y+N5LujIA==")+i.label+""}));try{return await Ot(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=wt(e.hostname);if(h)throw new le(e.hostname,h)}let o=e.budgetMs??Ho,r=Date.now()+o,s=[...e.optimizedIps??[]],i=!1;if(e.resolvePreferred)try{let h=await Xe(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=oe(e.hostname),l=i&&s.length>0&&s.every(h=>oe(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=h.source==="relay"?Math.min(e.timeoutMs??Ve,Wo):e.timeoutMs??Ve,q=Math.max(200,Math.min(v,w)),ie={...e,timeoutMs:q};try{if(!Go(h)&&Ko(e.hostname))throw new le(e.hostname,Un);if(!e.skipTargetPolicy&&h.source!=="proxy"&&h.source!=="relay"){let O=wt(h.host);if(O)throw new le(h.host,O)}if(h.source==="proxy"&&h.via)try{let O=await Xo(ie,{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 Rn(h.via),O}catch(O){throw O instanceof ne||Tn(h.via,Date.now()),O}return await Fo({...ie,hostname:h.host,port:h.port})}catch(O){let ye=Yn(O,h.label);throw e.onFailure?.(ye),O}},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=ht(P,v=>v.via,Date.now());for(let v of w)try{return await g(v)()}catch(q){h=q}throw h??new Error(__sfx("6JC95Zyw5Luj55CG5YWo6YOo5aSx6LSl"))},K=async()=>{if(T.length===0)throw new Error(__sfx("5pyq6YWN572uIFByb3h5SVA="));let h=Date.now(),w=ht(T,v=>v.via,h);return await Ot(w.map(g),!0)},J=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 Ot(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)},Q=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 Q();if(v)return v;throw h}let se=e.proxyMode??"only",D=a||l;if(se==="only")try{return await J()}catch(h){let w=await Y();if(w)return w;let v=await Q();if(v)return v;throw h}if(se==="global"||se==="smart"&&D)try{return await J()}catch(h){if(se==="global")try{return await N()}catch{}let w=await Y();if(w)return w;let v=await Q();if(v)return v;throw h}try{return await N()}catch(h){try{return await J()}catch{}let w=await Y();if(w)return w;let v=await Q();if(v)return v;throw h}}var It,Ve,Ho,Dt,Wo,zo,Ut=S(()=>{"use strict";vn();In();xt();Ke();G();We();Ae();vt();kt();It=null;Ve=8e3,Ho=15e3;Dt=6,Wo=2500,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,je=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 rr={};De(rr,{diagnosticCounters:()=>$o,[__sfx("aGFuZGxlV2ViU29ja2V0")]:()=>Qe,recentDiagnostics:()=>ts,recentRoutes:()=>es,recordDiagnostics:()=>Z,truncateCloseReason:()=>nr});function nr(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 $o(){return{...he}}function es(){return Je}function tr(e,t,n){Je.unshift({at:Date.now(),target:e,via:t.via,endpoint:t.endpoint,cfTarget:oe(e.split(":")[0]??""),publicDns:Wn(e.split(":")[0]??""),phase:n}),Je.length>20&&(Je.length=20)}function Z(e,t,n){Ze.unshift({at:Date.now(),target:e,failures:t,summary:n}),Ze.length>er&&(Ze.length=er)}function ts(){return Ze}function os(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 Qe(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=os(e.headers.get(__sfx("c2VjLXdlYnNvY2tldC1wcm90b2NvbA=="))),u=[],c=0,d=!1,f=null,g=null,y=new Be,P=null,T=null,p=()=>{T&&(clearTimeout(T),T=null)},R=!1,A=new He,k=null,K=!1,J=!1,N=null,Y=null,Q=m=>{try{a.send(m)}catch{}},se=m=>{let b=new Uint8Array(2+m.byteLength);b[0]=0,b[1]=m.byteLength,b.set(m,2),Q(b)},D=(m,b)=>{K=!0;try{a.close(m,nr(b))}catch{}h()},h=()=>{if(!J){if(J=!0,_t(),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,q=0,ie=[],O=0,ye=m=>{if(!(m.byteLength===0||ae>0)){if(O+m.byteLength>$n){D(1009,__sfx("5pyq56Gu6K6k6YCa6Lev55qE5LiK6KGM5pWw5o2u6L+H5aSa"));return}if(_e+m.byteLength>Qo){D(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}ie.push(m),O+=m.byteLength,_e+=m.byteLength}},_t=()=>{_e=Math.max(0,_e-O),ie=[],O=0},rt=0,Or=()=>{rt+=1},Zt=async()=>{if(!f)return;let m=++rt,b=f.readable.getReader();k=b,w&&clearTimeout(w);let x=setTimeout(()=>{w===x&&(w=null),!(ae>0)&&O!==0&&en("stall")},qn);w=x;try{for(;;){let{done:B,value:M}=await b.read();if(B)break;if(M&&M.byteLength>0){let U=ae===0;if(ae+=M.byteLength,U&&_t(),Jt.add(M.byteLength)){Qt();return}let C=A.yieldCount;await A.onChunk(M.byteLength),A.yieldCount>C&&he.downlinkYields++,Q(M)}}}catch{}finally{try{b.releaseLock()}catch{}if(clearTimeout(x),w===x&&(w=null),k===b&&(k=null),m!==rt||K)return;if(ae===0&&O>0&&q<Nt&&!R){en("eof");return}let B=f;D(1e3,B?`done via=${B.via} ep=${B.endpoint} dl=${ae} ret=${O} rd=${q}`:"done")}},ae=0,Jt=new ce((n.dataBudgetMB||0)*1024*1024),Qt=()=>{let m=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+n.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");Z(N?`${N.hostname}:${N.port}`:__sfx("5pyq5bu656uL5Ye656uZ"),[],m),D(1009,m)},Ur=async m=>{let b=g;if(b)try{await y.write(()=>g===b?b:null,m)}catch(x){Z(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),ye(x),await m.write(x)},$t=m=>{if(t===__sfx("dmxlc3M=")){let x=Ne(m,n.uuid);return x?{command:x.header.command,port:x.header.port,hostname:x.header.hostname,headerLength:x.consumed}:null}let b=yn(m,n[__sfx("dHJvamFuUGFzc3dvcmQ=")]);return b?{command:b.header.command,port:b.header.port,hostname:b.header.hostname,headerLength:b.consumed}:null},Nr=()=>{P&&(clearTimeout(P),P=null)},Lr=async()=>{if(!(K||d)){if($t(l)){await ot();return}D(1008,l.byteLength===0?__sfx("5o+h5omL6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0"):__sfx("5o+h5omL6LaF5pe277ya5Y2P6K6u5aS05LiN5a6M5pW05oiW6K6k6K+B5aSx6LSl"))}},ot=async()=>{if(K||d)return;let m=$t(l);if(!m){l.byteLength>0&&!P&&(P=setTimeout(()=>{P=null,Lr().catch(C=>D(1011,String(C)))},ns));return}if(Nr(),p(),d)return;d=!0,N=m;let b=t===__sfx("dmxlc3M=")?cn:gn;if(m.command===b){if(t===__sfx("dmxlc3M=")&&n.udpDns==="doh"&&m.port===53){se(new Uint8Array(0)),Y=new Me({endpoint:n.udpDnsEndpoint,send:Q});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=")&&se(new Uint8Array(0));let x=[],B=null;try{f=await pe({hostname:m.hostname,port:m.port,proxies:o,timeoutMs:_o,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(be=>jn(be)).join(`
5
+ `):__sfx("5Ye656uZ6L+e5o6l5aSx6LSl77ya")+String(B)+"";Z(`${m.hostname}:${m.port}`,x,C),D(1011,C);return}let M=f.writable.getWriter();g=M,tr(`${m.hostname}:${m.port}`,f,"initial");let U=l.byteLength>m.headerLength?l.subarray(m.headerLength):new Uint8Array(0);l=new Uint8Array(0);try{await y.run(async()=>{U.byteLength>0&&(ye(U),await M.write(U)),await qt(M)})}catch(C){Z(`${m.hostname}:${m.port}`,[],__sfx("5LiK6KGM6aaW5YyF5YaZ5YWl5aSx6LSl77ya")+String(C)+""),h()}r?.waitUntil(Zt())},en=async m=>{if(K||R)return;let b=N;if(!b){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55uu5qCH5pyq6Kej5p6Q"));return}if(q>=Nt){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55u06L+e5LiO5Y+N5Luj5YWl5Y+j5Z2H5peg5ZON5bqU"));return}R=!0;let x=Pn({via:f?.via,port:b.port,userProxyConfigured:o.length>0||!!n[__sfx("cHJveHlJcA==")],aggressive:n.aggressiveRedial===!0});if(!x.allowed){he.guardedRedials++,Z(`${b.hostname}:${b.port}`,[],__sfx("5Ye656uZ5peg5pWw5o2u77ya")+x.reason+__sfx("77yb5pyq5YiH5o2i5Y+N5Luj77yI5Y+v5byA5ZCvIGFnZ3Jlc3NpdmVSZWRpYWzvvIk=")),D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya")+x.reason+"");return}q++,m==="stall"?he.stallRedials++:he.eofRedials++,Z(`${b.hostname}:${b.port}`,[],m==="stall"?__sfx("55u06L+eIA==")+qn+__sfx("bXMg5peg5LiL6KGM5pWw5o2u77yM5pS56LWw5Y+N5Luj5YWl5Y+j"):__sfx("5Ye656uZ6Zu25LiL6KGM5Y2zIEVPRi9SZXNldO+8jOeri+WNs+aUuei1sOWPjeS7o+WFpeWPow=="));let B=[];try{B=await Ee({userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay})}catch{B=[]}f?.endpoint&&v.add(f.endpoint);let M=B.filter(U=>!v.has(`${U.ip}:${U.port}`));if(M.length===0){D(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5peg5Y+N5Luj5YWl5Y+j5Y+v55So"));return}for(let U of M.slice(0,Nt)){if(v.add(`${U.ip}:${U.port}`),Or(),f){let C=f;if(C.close)try{C.close()}catch{}}g=null,ae=0;try{let C=await pe({hostname:U.ip,port:U.port,timeoutMs:Zo,resolvePreferred:!1,skipTargetPolicy:!0,proxies:n.aggressiveRedial?o:void 0,proxyMode:n.aggressiveRedial?n.proxyMode:void 0});if(!C)continue;f=C,tr(`${b.hostname}:${b.port}`,C,"redial");let be=C.writable.getWriter();g=be;let nn=0;for(let Ie of ie)nn+=Ie.byteLength;let st=new Uint8Array(nn),rn=0;for(let Ie of ie)st.set(Ie,rn),rn+=Ie.byteLength;await y.run(async()=>{st.byteLength>0&&await be.write(st),await qt(be)}),Z(`${b.hostname}:${b.port}`,[],__sfx("5bey5YiH5o2i5Y+N5Luj5YWl5Y+jIA==")+U.ip+":"+U.port+""),r?.waitUntil(Zt());return}catch(C){Z(`${b.hostname}:${b.port}`,[],__sfx("5Y+N5Luj5YWl5Y+jIA==")+U.ip+":"+U.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(),Jt.add(x.byteLength)){Qt();return}if(!d){if(l=xn(l,x),l.byteLength>Jo){D(1009,__sfx("5o+h5omL5aS06LaF6L+HIDY0S0I="));return}await ot();return}if(Y){Y.push(x);return}if(!g){if(me.bytes+x.byteLength>qo){D(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}if(u.push(x),c+=x.byteLength,me.bytes+=x.byteLength,c>$n){D(1009,__sfx("5ouo5Y+35pyf6Ze05pWw5o2u6L+H5aSa"));return}return}ye(x),await Ur(x)}})()});let tn=()=>{h()};a.addEventListener("close",tn),a.addEventListener("error",tn),l.byteLength>0?ot().catch(m=>D(1011,String(m))):T=setTimeout(()=>{T=null,!(K||d||l.byteLength>0)&&(he.firstPacketTimeouts++,D(1008,__sfx("6aaW5YyF6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0")))},rs);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 _o,qn,Nt,Zo,Jo,$n,Qo,_e,qo,me,Ze,er,he,Je,ns,rs,Lt=S(()=>{"use strict";ft();bn();wn();Se();Sn();En();Ut();je();vt();Ae();_o=5e3,qn=2500,Nt=4,Zo=3e3,Jo=64*1024,$n=8*1024*1024,Qo=32*1024*1024,_e=0,qo=32*1024*1024,me={bytes:0};Ze=[],er=20,he={stallRedials:0,eofRedials:0,guardedRedials:0,firstPacketTimeouts:0,downlinkYields:0};Je=[];ns=2e3,rs=8e3});var dr={};De(dr,{[__sfx("Y2xlYXJYaHR0cFNlc3Npb25z")]:()=>ps,[__sfx("aGFuZGxlWGh0dHA=")]:()=>Ft,[__sfx("aXNYaHR0cFBhdGg=")]:()=>Bt,[__sfx("cGFyc2VYaHR0cFJvdXRl")]:()=>Ht,[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:()=>as,[__sfx("cmVjb3JkWGh0dHBEaWFnbm9zdGljcw==")]:()=>V});function is(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){qe.unshift({at:Date.now(),target:e,...t,summary:n}),qe.length>20&&(qe.length=20)}function as(){return qe}function ls(e){return String(e||"").trim().replace(/\/+$/,"")||"/"}function Ht(e,t){let n=ls(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 Bt(e,t){return Ht(e,t)!==null}function ds(e){if(e.reservedBytes<=0){e.reservedBytes=0;return}ue=Math.max(0,ue-e.reservedBytes),e.reservedBytes=0}function fs(e,t){if(t<=0)return;let n=Math.min(t,e.reservedBytes);ue=Math.max(0,ue-n),e.reservedBytes-=n}function ar(e,t){return t<=0?!0:ue+t>us?!1:(ue+=t,e.reservedBytes+=t,!0)}function ps(){for(let[e,t]of W)z(e,t);W.clear(),ue=0}function ms(e,t){return t-e.lastUploadAt>Mt&&t-e.lastDownlinkAt>Mt&&t-e.lastActivityAt>Mt}function hs(e,t){return e.closed?!0:e.header||e.dialResult||e.downlinkStarted?!1:t-e.createdAt>lr}function cr(e,t,n,o){let r=Date.now();for(let[a,l]of W)(l.closed||ms(l,r)||!l.header&&r-l.createdAt>30*6e4)&&z(a,l);let s=W.get(e);if(s)return ur(s,n,r),s;if(W.size>=or){for(let[a,l]of W)hs(l,r)&&z(a,l);if(W.size>=or)return null}if(!o){let a=0;for(let l of W.values())l.header||(a+=1);if(a>=cs)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 ur(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{}ds(t),t.pending.clear(),W.delete(e)}}function gs(e){let t=e.signalResolve;e.signalResolve=null,t?.()}function ys(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 bs(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 ws(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 xs(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 Ps(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,fs(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 Ss(e,t,n,o,r){let s=(t.dataBudgetMB||0)*1024*1024,i=cr(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>sr)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>sr)return new Response(__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ"),{status:413,headers:L()});if(r===0&&!i.header){let u=Ne(l,t.uuid);if(!u)return z(o,i),new Response(__sfx("VkxFU1Mg5aS06Kej5p6Q5aSx6LSl"),{status:400,headers:L()});if(u.header.command!==dt)return z(o,i),new Response(__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),{status:400,headers:L()});bs(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>=ir)return z(o,i),new Response(__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),{status:503,headers:L()});if(!ar(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>=ir)return z(o,i),new Response(__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),{status:503,headers:L()});if(!ar(i,l.byteLength))return z(o,i),new Response(__sfx("5pqC5a2Y6LaF6ZmQ"),{status:503,headers:L()});i.pending.set(r,l.slice())}return gs(i),new Response(null,{status:200,headers:L()})}async function Es(e,t,n,o){let r=(t.dataBudgetMB||0)*1024*1024,s=cr(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=ys(s,lr),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 xs(s,t,n)}catch{f(),y.close();return}if(a)return;s.pumpStarted||(s.pumpStarted=!0,Ps(s,d).catch(()=>{}));try{y.enqueue(ws(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(ur(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 Ft(e,t,n){let o=__sfx("L3hodHRw");try{o=new URL(e.url).pathname}catch{o=__sfx("L3hodHRw")}let r=Ht(o,t[__sfx("eGh0dHBQYXRo")]);return r?r.kind==="stream-one"?e.method!=="POST"?null:await As(e,t,n):r.kind===__sfx("cGFja2V0LXVw")?e.method!=="POST"?null:await Ss(e,t,n,r.sessionId,r.seq):e.method==="GET"?await Es(e,t,n,r.sessionId):null:null}async function As(e,t,n){let o=e.body;if(!o)return new Response(__sfx("57y65bCR6K+35rGC5L2T"),{status:400});let r=new te(o),s=await is(dn(r,t.uuid),ss);if(!s)return await r.cancel("header timeout"),new Response(__sfx("VkxFU1Mg5aS06Kej5p6Q5aSx6LSl"),{status:400});if(s.header.command!==dt)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 ss,qe,W,lr,or,cs,Mt,sr,ir,us,ue,Kt=S(()=>{"use strict";Se();ft();je();Ut();ss=2e3;qe=[];W=new Map,lr=3e4,or=100,cs=20,Mt=10*6e4,sr=10*1024*1024,ir=30,us=32*1024*1024,ue=0});function et(){return new Response(JSON.stringify({build:Gt,version:Ts,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var Gt,Ts,$e,Xt=S(()=>{"use strict";Gt="f4493ce-0f8ba4c0",Ts=__sfx("MC40MC42"),$e=__sfx("L19fY2ZwX3ZlcnNpb24=")});function fr(e){return e[__sfx("S1Y=")]?new de(e[__sfx("S1Y=")]):new Wt}var de,Wt,Re=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}},Wt=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 mr(e){let t=e.trim().toLowerCase();return t==="global"||t==="fallback"||t==="smart"?t:"only"}function hr(e){return e.trim().toLowerCase()==="signed"?"signed":"legacy"}function gr(e){return e.trim().toLowerCase()==="doh"?"doh":"off"}function I(e,t){return e==null?t:String(e)}function Rs(e){let t=e.trim();return t?`/${t.replace(/^\/+/,"")}`:E.wsPath}function Cs(e){return{uuid:I(e[__sfx("VVVJRA==")],""),[__sfx("dHJvamFuUGFzc3dvcmQ=")]:I(e[__sfx("VFJPSkFOX1BBU1NXT1JE")],""),wsPath:Rs(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:mr(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:hr(I(e[__sfx("U1VCX1RPS0VOX01PREU=")],"")),subTokenTtlDays:fe(e[__sfx("U1VCX1RPS0VOX1RUTF9EQVlT")],E.subTokenTtlDays),unlockProbe:F(e[__sfx("VU5MT0NLX1BST0JF")],E.unlockProbe),udpDns:gr(I(e[__sfx("VURQX0ROUw==")],"")),udpDnsEndpoint:I(e[__sfx("VURQX0ROU19FTkRQT0lOVA==")],E.udpDnsEndpoint)}}function vs(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]=mr(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]=hr(String(r)):o==="udpDns"?n[o]=gr(String(r)):n[o]=String(r);return n}async function yr(e,t){let n=Cs(t),o=await e.get(pr),r={};if(o)try{r=JSON.parse(o)}catch{r={}}let s=vs(n,r),i=!1,a=e instanceof de,l=Date.now();o?Ce=0:Ce===0&&(Ce=l);let u=l-Ce>ks;return a&&u&&(s.uuid||(s.uuid=it(),i=!0),s[__sfx("dHJvamFuUGFzc3dvcmQ=")]||(s[__sfx("dHJvamFuUGFzc3dvcmQ=")]=it().replace(/-/g,"").slice(0,16),i=!0),Ce=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 Is(e,s),s}async function Is(e,t){await e.put(pr,JSON.stringify(t))}var pr,E,Ce,ks,tt=S(()=>{"use strict";$();Re();pr="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"};Ce=0,ks=9e4});var br,Ds,na,Os,ra,wr=S(()=>{"use strict";br={[__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"]},Ds=__sfx("SEtH6aaZ5rivLFRQReWPsOWMlyxOUlTkuJzkuqwsS0lY5aSn6ZiqLElDTummluWwlCxTSU7mlrDliqDlnaEsS1VM5ZCJ6ZqG5Z2hLEJLS+abvOiwtyxTR07og6Hlv5fmmI7luIIsTU5M6ams5bC85ouJLFNZROaCieWwvCxNRUzloqjlsJTmnKwsTEFY5rSb5p2J55+2LFNKQ+Wco+S9leWhnixTRUHopb/pm4Xlm74sT1JE6Iqd5Yqg5ZOlLElBROWNjuebm+mhvyxFV1Lnur3nk6blhYssWVla5aSa5Lym5aSaLFlWUua4qeWTpeWNjixMSFLkvKbmlaYsRlJB5rOV5YWw5YWL56aPLENER+W3tOm7jixBTVPpmL/lp4bmlq/nibnkuLksTUFE6ams5b636YeMLEFSTuaWr+W+t+WTpeWwlOaRqSxJU1TkvIrmlq/lnabluIPlsJQsRFhC6L+q5ouc"),na=(()=>{let e={};for(let t of Ds.split(","))t.length>3&&(e[t.slice(0,3)]=t.slice(3));return e})(),Os=new Map;for(let[e,t]of Object.entries(br))for(let n of t)Os.set(n,e);ra=Object.keys(br)});var sa,xr=S(()=>{"use strict";sa=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 Pa,Sa,Pr=S(()=>{"use strict";G();$();wr();xr();Pa=2*1024*1024,Sa=".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 Ra,Sr=S(()=>{"use strict";Re();$();Ra=new TextEncoder});var za,Er=S(()=>{"use strict";Re();tt();$();za=3600*24});function Ar(e){return fr(e)}async function Tr(e,t){if(ve.config&&Date.now()-ve.configAt<Us)return ve.config;let n=await yr(e,t);return ve.config=n,ve.configAt=Date.now(),n}var Us,ve,Vt=S(()=>{"use strict";Re();tt();Er();Us=15e3,ve={config:null,configAt:0,auth:null,authAt:0}});var Cr={};De(Cr,{clearUnlockCache:()=>Xs,runUnlockProbe:()=>Gs});function Fs(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 Ks(e){let t=Date.now(),n=new AbortController,o=setTimeout(()=>n.abort(),Ms);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:Fs(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 Gs(e,t){let n=e||"UNK",o=Date.now(),r=ge.get(n);if(r&&o-r.at<Hs)return{...r.data,cached:!0};let s=await Promise.all(Ls.map(a=>Ks(a))),i={colo:n,region:t,cached:!1,at:o,targets:s};if(ge.size>=Bs){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 Xs(){ge.clear()}var Ls,Ms,Hs,Bs,ge,vr=S(()=>{"use strict";Ls=[{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"}],Ms=4e3,Hs=600*1e3,Bs=16,ge=new Map});$();var Hr=8*1024*1024,Br=2*1024*1024,sn=600*1e3,Fr=6*1024*1024*1024,at=Date.now(),lt=0;function an(e){e-at>=sn&&(at=e,lt=0)}function Kr(e,t=Date.now()){an(t),lt+=e}function on(e){return an(e),Fr-lt}var Gr=(()=>{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})(),Xr=5e3;function Wr(e,t=Xr){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 ct(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=Wr((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,Hr):Br,s=Date.now();if(on(s)<=0){let u=Math.max(1e3,at+sn-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=Gr,a=0,l=new ReadableStream({pull(u){let c=on(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,Kr(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":Ue(4)}})}Lt();Kt();kt();Xt();$();tt();je();Pr();Sr();$();function zt(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"}})}Vt();Vt();async function Rr(e){let t=Ar(e);return await Tr(t,e)}function Yt(e){let t=[];return t.push(...Te(e[__sfx("cHJveHlJcA==")],"direct")),t.push(...Te(e[__sfx("c29ja3M1")],__sfx("c29ja3M1"))),t.push(...Te(e.httpProxy,"http")),t}var jt=6e4,Ws=10,ke=0,nt=0;function kr(e){return e>=nt?(ke=0,nt=e+jt,!1):ke>=Ws}function Ir(e,t){if(!t)return!1;let n=(e.headers.get(__sfx("eC1jZnBpbG90LXRva2Vu"))??"").trim();if(!n)return!1;let o=Date.now();return we(n,t)?(ke=0,!0):(o>=nt&&(nt=o+jt,ke=0),ke+=1,!1)}async function Dr(e,t,n){let o=new URL(e.url);if(o.pathname===__sfx("L19fZWRnZV9wcm9iZQ=="))return ct(e);if(o.pathname===$e||o.pathname===__sfx("L19fdmVyc2lvbg=="))return et();if(o.pathname==="/region"&&e.method==="GET"){let{coloToCountry:i}=await Promise.resolve().then(()=>(Ae(),Rt)),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 Rr(t);if(o.pathname===__sfx("L19fZGlhZw==")){if(kr(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(jt/1e3))}});if(!Ir(e,r.uuid))return null;let{recentDiagnostics:i,diagnosticCounters:a,recentRoutes:l}=await Promise.resolve().then(()=>(Lt(),rr)),{[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:u}=await Promise.resolve().then(()=>(Kt(),dr));return new Response(JSON.stringify({ok:!0,impl:"self",build:Gt,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(kr(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(!Ir(e,r.uuid))return null;let{coloToCountry:i}=await Promise.resolve().then(()=>(Ae(),Rt)),{runUnlockProbe:a}=await Promise.resolve().then(()=>(vr(),Cr)),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 Qe(e,__sfx("dmxlc3M="),r,Yt(r),n):r[__sfx("ZW5hYmxlVHJvamFu")]&&o.pathname===r[__sfx("dHJvamFuUGF0aA==")]?s!==__sfx("d2Vic29ja2V0")?null:await Qe(e,__sfx("dHJvamFu"),r,Yt(r),n):r[__sfx("ZW5hYmxlWGh0dHA=")]&&Bt(o.pathname,r[__sfx("eGh0dHBQYXRo")])?await Ft(e,r,Yt(r)):null}Xt();var Ml={async fetch(e,t,n){try{return new URL(e.url).pathname===$e?et():await Dr(e,t,n)??zt(200)}catch{return zt(500)}}};export{Ml as default};