cfpilot 0.50.0 → 0.60.0-beta.1

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.
@@ -1,28 +1,19 @@
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 mo=Object.defineProperty;var C=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var je=(e,t)=>{for(var n in t)mo(e,n,{get:t[n],enumerable:!0})};function Ke(e){let t=new Uint8Array(e);crypto.getRandomValues(t);let n="";for(let r of t)n+=Xe[r>>4]+Xe[r&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(Xe[n>>4]+Xe[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 Te(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e.charCodeAt(r)^t.charCodeAt(r);return n===0}var Xe,se=C(()=>{"use strict";Xe="0123456789abcdef"});function K(e){let t=Po.exec(e);if(!t)return!1;for(let n=1;n<=4;n++){let r=Number(t[n]);if(!Number.isInteger(r)||r<0||r>255)return!1}return!0}function ae(e){return!e.includes(":")||!/^[0-9a-fA-F:.]+$/.test(e)?!1:Re(e)!==null}function To(e){return Ao.test(e)&&e.length<=253}function Ro(e){return!e||e.length>253||/[\u0000-\u001f\u007f]/.test(e)?!1:K(e)||ae(e)||To(e)||/^[a-zA-Z0-9_-]+$/.test(e)}function Rn(e,t){if(!Ro(e)||!Number.isInteger(t)||t<1||t>65535)throw new Error(__sfx("SW52YWxpZCBDT05ORUNUIGF1dGhvcml0eQ=="))}function Re(e){if(!e.includes(":"))return null;let t=e,n=t.lastIndexOf(":"),r=t.slice(n+1);if(r.includes(".")){if(!K(r))return null;let c=r.split(".").map(f=>Number(f));t=`${t.slice(0,n+1)}${(c[0]<<8|c[1]).toString(16)}:${(c[2]<<8|c[3]).toString(16)}`}let o=t.indexOf("::"),i,s;if(o>=0){if(t.indexOf("::",o+1)>=0)return null;let c=t.slice(0,o),f=t.slice(o+2);i=c?c.split(":"):[],s=f?f.split(":"):[]}else i=t.split(":"),s=[];let a=i.length+s.length;if(a>8)return null;let l=[],u=c=>/^[0-9a-fA-F]{1,4}$/.test(c)?parseInt(c,16):null;for(let c of i){let f=u(c);if(f===null)return null;l.push(f)}let d=8-a;for(let c=0;c<d;c++)l.push(0);for(let c of s){let f=u(c);if(f===null)return null;l.push(f)}return l.length===8?l:null}function Co(e){let t=e.map(l=>(l&65535).toString(16)),n=-1,r=0,o=-1,i=0;for(let l=0;l<t.length;l++)t[l]==="0"?(o<0&&(o=l),i++,i>r&&(r=i,n=o)):(o=-1,i=0);if(r<2)return t.join(":");let s=t.slice(0,n).join(":"),a=t.slice(n+r).join(":");return`${s}::${a}`}function vo(e,t,n,r){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(r?n===2:n===3){if(t+2>e.length)return null;let o=e[t+1];return t+2+o>e.length?null:{hostname:Eo.decode(e.subarray(t+2,t+2+o)),next:t+2+o}}if(r?n===3:n===4){if(t+17>e.length)return null;let o=new DataView(e.buffer,e.byteOffset+t+1,16),i=[];for(let s=0;s<8;s++)i.push(o.getUint16(s*2,!1));return{hostname:Co(i),next:t+17}}return null}async function Rt(e,t){let n=await e.peekExactly(1);if(!n)return null;let r=n[0],o;if(r===1)o=5;else if(t?r===2:r===3){let a=await e.peekExactly(2);if(!a)return null;o=2+a[1]}else if(t?r===3:r===4)o=17;else return null;let i=await e.peekExactly(o);if(!i)return null;let s=vo(i,0,r,t);return s?(e.skip(o),{hostname:s.hostname,addressType:r,consumed:o}):null}var Eo,Po,Ao,Z=C(()=>{"use strict";Eo=new TextDecoder,Po=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,Ao=/^[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 vn(e){let t=Ce.get(e);if(t!==void 0)return t;let n=e.replace(/-/g,"").trim().toLowerCase();if(!/^[0-9a-f]{32}$/.test(n))return Ce.set(e,null),null;let r=new Uint8Array(16);for(let o=0;o<16;o++)r[o]=parseInt(n.slice(o*2,o*2+2),16);return Ce.size>=16&&Ce.clear(),Ce.set(e,r),r}async function kn(e,t){let n=await e.readExactly(1);if(!n)return null;let r=await e.readExactly(16);if(!r)return null;let o=vn(t);if(!o)return null;for(let f=0;f<16;f++)if(r[f]!==o[f])return null;let i=await e.readExactly(1);if(!i)return null;let s=i[0],a=s>0?await e.readExactly(s):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 d=await Rt(e,!0);if(!d)return null;let c=u[0]<<8|u[1];return{header:{version:n[0],command:l[0],port:c,hostname:d.hostname,addressType:d.addressType,addons:a},payload:e.release()}}function Uo(e){let t=0;for(;t<e.byteLength;){let n=e[t++],r=n>>3,o=n&7;if(o===2){let i=0,s=0,a=0;do{if(t>=e.byteLength)return"";a=e[t++],i|=(a&127)<<s,s+=7}while(a&128);if(t+i>e.byteLength)return"";if(r===1&&i>0)return Cn.decode(e.subarray(t,t+i));t+=i}else if(o===0)for(;t<e.byteLength&&(e[t++]&128)!==0;);else return""}return""}function ve(e){if(e.version!==ko)return __sfx("VkxFU1Mg54mI5pys5LiN5pSv5oyB77ya")+e.version+"";if(e.command===Lo||e.command===Do)return __sfx("VkxFU1MgTXV4L+WPjeWQkeWRveS7pOS4jeaUr+aMge+8muivt+WFs+mXreWuouaIt+err+Wkmui3r+WkjeeUqA==");if(e.command!==We&&e.command!==Ct)return __sfx("VkxFU1Mg5ZG95Luk5LiN5pSv5oyB77ya")+e.command+"";let t=Uo(e.addons);return t?__sfx("VkxFU1MgZmxvdyg=")+t+__sfx("KSDkuI3mlK/mjIHvvJror7flhbPpl63lrqLmiLfnq68gZmxvdw=="):null}function Ye(e,t){if(e.byteLength<18)return null;let n=vn(t);if(!n)return null;for(let u=0;u<16;u++)if(e[1+u]!==n[u])return null;let r=e[17],o=18+r;if(e.byteLength<o+4)return null;let i=e[o];o+=1;let s=e[o]<<8|e[o+1];o+=2;let a=e[o];o+=1;let l="";if(a===1){if(e.byteLength<o+4)return null;l=`${e[o]}.${e[o+1]}.${e[o+2]}.${e[o+3]}`,o+=4}else if(a===2){if(e.byteLength<o+1)return null;let u=e[o];if(o+=1,e.byteLength<o+u)return null;l=Cn.decode(e.subarray(o,o+u)),o+=u}else if(a===3){if(e.byteLength<o+16)return null;let u=[];for(let d=0;d<8;d++)u.push((e[o+d*2]<<8|e[o+d*2+1]).toString(16));l=u.join(":"),o+=16}else return null;return{header:{version:e[0],command:i,port:s,hostname:l,addressType:a,addons:e.subarray(18,18+r)},consumed:o}}var ko,We,Ct,Lo,Do,Cn,Ce,vt=C(()=>{"use strict";Z();ko=0,We=1,Ct=2,Lo=3,Do=4,Cn=new TextDecoder,Ce=new Map});function q(e,t){return e>>>t|e<<32-t}function No(e){let t=new Uint32Array([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),n=e.length*8,r=Math.ceil((e.length+9)/64)*64,o=new Uint8Array(r);o.set(e),o[e.length]=128;let i=new DataView(o.buffer);i.setUint32(r-8,Math.floor(n/4294967296),!1),i.setUint32(r-4,n>>>0,!1);let s=new Uint32Array(64);for(let l=0;l<r;l+=64){for(let b=0;b<16;b++)s[b]=i.getUint32(l+b*4,!1);for(let b=16;b<64;b++){let v=q(s[b-15],7)^q(s[b-15],18)^s[b-15]>>>3,y=q(s[b-2],17)^q(s[b-2],19)^s[b-2]>>>10;s[b]=s[b-16]+v+s[b-7]+y>>>0}let u=t[0],d=t[1],c=t[2],f=t[3],p=t[4],w=t[5],g=t[6],A=t[7];for(let b=0;b<64;b++){let v=q(p,6)^q(p,11)^q(p,25),y=p&w^~p&g,T=A+v+y+Io[b]+s[b]>>>0,I=q(u,2)^q(u,13)^q(u,22),D=u&d^u&c^d&c,_=I+D>>>0;A=g,g=w,w=p,p=f+T>>>0,f=c,c=d,d=u,u=T+_>>>0}t[0]=t[0]+u>>>0,t[1]=t[1]+d>>>0,t[2]=t[2]+c>>>0,t[3]=t[3]+f>>>0,t[4]=t[4]+p>>>0,t[5]=t[5]+w>>>0,t[6]=t[6]+g>>>0,t[7]=t[7]+A>>>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 Dn(e){let t=No(e),n="";for(let r of t)n+=Ln[r>>4]+Ln[r&15];return n}var Io,Ln,Un=C(()=>{"use strict";Io=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]),Ln="0123456789abcdef"});function Mo(e){let t=Ve.get(e);if(t!==void 0)return t;let n=Dn(Oo.encode(e));return Ve.size>=16&&Ve.clear(),Ve.set(e,n),n}function On(e,t){if(e.byteLength<58||!t)return null;let n=Mo(t);if(In.decode(e.subarray(0,56)).trim().toLowerCase()!==n||e[56]!==13||e[57]!==10)return null;let o=58;if(e.byteLength<o+2)return null;let i=e[o];o+=1;let s=e[o];o+=1;let a="";if(s===1){if(e.byteLength<o+4)return null;a=`${e[o]}.${e[o+1]}.${e[o+2]}.${e[o+3]}`,o+=4}else if(s===3){if(e.byteLength<o+1)return null;let u=e[o];if(o+=1,e.byteLength<o+u)return null;a=In.decode(e.subarray(o,o+u)),o+=u}else if(s===4){if(e.byteLength<o+16)return null;let u=[];for(let d=0;d<8;d++)u.push((e[o+d*2]<<8|e[o+d*2+1]).toString(16));a=u.join(":"),o+=16}else return null;if(e.byteLength<o+4)return null;let l=e[o]<<8|e[o+1];return o+=2,e[o]!==13||e[o+1]!==10?null:(o+=2,{header:{command:i,port:l,hostname:a,addressType:s},consumed:o})}var Nn,Oo,In,Ve,Mn=C(()=>{"use strict";Z();Un();Nn=3,Oo=new TextEncoder,In=new TextDecoder,Ve=new Map});function Bo(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 kt(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 _e,Bn=C(()=>{"use strict";_e=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=Bo(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,r=setTimeout(()=>n.abort(),this.options.timeoutMs??5e3);try{let o=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(!o.ok){this.reply(kt(t));return}let i=new Uint8Array(await o.arrayBuffer());if(i.byteLength===0){this.reply(kt(t));return}this.reply(this.filterAaaa(i))}catch{this.reply(kt(t))}finally{clearTimeout(r)}}filterAaaa(t){if(t.byteLength<12)return t;let n=t[4]<<8|t[5],r=t[6]<<8|t[7],o=t[8]<<8|t[9],i=t[10]<<8|t[11];if(n===0&&r===0&&o===0&&i===0)return t;let s=12;for(let w=0;w<n&&s<t.byteLength;){let g=t[s++];if(g===0){s+=4,w++;continue}s+=g}let a=t.slice(0,s),l=0,u=s;for(let w of[r,o,i])for(let g=0;g<w&&u<t.byteLength;g++){let A=u;if((t[u]&192)===192)u+=2;else{for(;u<t.byteLength;){let T=t[u++];if(T===0)break;u+=T}u+=4}if(u+10>t.byteLength)return t;let b=t[u]<<8|t[u+1],v=t[u+8]<<8|t[u+9],y=u+10+v;if(y>t.byteLength)return t;b!==28?a.set(t.subarray(A,y),a.byteLength):l+=1,u=y}if(l===0)return t;let d=s,c=0,f=0,p=0;for(let w of[r,o,i])for(let g=0;g<w&&d<a.byteLength;g++){if((a[d]&192)===192)d+=2;else{for(;d<a.byteLength;){let b=a[d++];if(b===0)break;d+=b}d+=4}if(d+10>a.byteLength)break;let A=a[d+8]<<8|a[d+9];d+=10+A,w===r?c++:w===o?f++:p++}return a[6]=c>>8&255,a[7]=c&255,a[8]=f>>8&255,a[9]=f&255,a[10]=p>>8&255,a[11]=p&255,a.subarray(0,a.byteLength)}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 Hn(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}function Fn(e){if(e==null)return null;if(typeof e=="string")return new TextEncoder().encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){let n=e;return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let t=e;return typeof t.arrayBuffer=="function"?t.arrayBuffer().then(n=>new Uint8Array(n)):null}var le,na,Ho,Ge,ke=C(()=>{"use strict";le=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:r}=await this.reader.read();if(n)return this.done=!0,this.size>=t?this.take(t):null;r&&r.byteLength>0&&(this.chunks.push(r),this.size+=r.byteLength)}return this.take(t)}take(t){let n=new Uint8Array(t),r=0;for(;r<t;){let o=this.chunks[0],i=t-r;o.byteLength<=i?(n.set(o,r),r+=o.byteLength,this.chunks.shift()):(n.set(o.subarray(0,i),r),this.chunks[0]=o.subarray(i),r+=i)}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:r}=await this.reader.read();if(n)return this.done=!0,this.size>=t?this.slice(t):null;r&&r.byteLength>0&&(this.chunks.push(r),this.size+=r.byteLength)}return this.slice(t)}skip(t){return this.size<t?null:this.take(t)}slice(t){let n=new Uint8Array(t),r=0;for(let o of this.chunks){if(r>=t)break;let i=Math.min(o.byteLength,t-r);n.set(o.subarray(0,i),r),r+=i}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((o,i)=>o+i.byteLength,0),n=new Uint8Array(t),r=0;for(let o of this.chunks)n.set(o,r),r+=o.byteLength;return n}release(){let t=this.peek();this.chunks=[],this.size=0;let n=this.reader,r=this,o=!1;return new ReadableStream({async pull(i){if(!o&&(o=!0,t.byteLength>0)){i.enqueue(t);return}if(r.done){i.close();return}try{let{done:s,value:a}=await n.read();s?(r.done=!0,i.close()):a&&a.byteLength>0&&i.enqueue(a)}catch(s){i.error(s)}},cancel(i){n.cancel(i)}})}};na=4*1024*1024,Ho=4*1024*1024,Ge=class{constructor(t=Ho,n=()=>new Promise(r=>{setTimeout(r,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 jn(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=")}:Fo.includes(e.port)?{allowed:!0,reason:__sfx("55u06L+e5Ye65Y+j5LiU56uv5Y+j6YCC55So")}:{allowed:!1,reason:__sfx("55uu5qCH56uv5Y+jIA==")+e.port+__sfx("IOS4jeaUr+aMgeWPjeS7oyBTTkkg6L2s5Y+R")}}var Fo,Xn=C(()=>{"use strict";Fo=[443,80]});var Je,Kn=C(()=>{"use strict";Je=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 r=t();r&&await r.write(n)})}}});function Lt(e){return`${e.kind}://${e.host}:${e.port}`}function Ko(e,t){let n=Ze.get(Lt(e));return n!==void 0&&n.cooldownUntil>t}function Wn(e,t){let n=Lt(e),r=Ze.get(n)??{fails:0,cooldownUntil:0};if(r.fails+=1,r.fails>=zn){let o=r.fails-zn,i=Math.min(Xo,jo*2**o);r.cooldownUntil=t+i}Ze.set(n,r)}function Yn(e){Ze.delete(Lt(e))}function Dt(e,t,n){if(e.length<=1)return e;let r=e.filter(o=>{let i=t(o);return i===void 0||!Ko(i,n)});return r.length>0?r:e}var te,zn,jo,Xo,Ze,qe=C(()=>{"use strict";te=class extends Error{},zn=2,jo=3e4,Xo=5*6e4,Ze=new Map});async function ce(e,t,n,r){let o=Date.now()+n,i=null;try{let s=await Promise.race([e.readExactly(t),new Promise(a=>{i=setTimeout(()=>a(null),Math.max(1,o-Date.now()))})]);if(s===null)throw new Error(""+r+__sfx("6LaF5pe277yI")+n+__sfx("bXMg5peg5ZON5bqU77yJ"));return s}finally{i&&clearTimeout(i)}}async function Vn(e,t,n,r,o={}){let i=new le(e),s=t.getWriter(),a=o.handshakeTimeoutMs??zo,l=async u=>{await s.write(u)};try{let u=[0];o.username&&u.push(2);let d=new Uint8Array(2+u.length);d[0]=5,d[1]=u.length,d.set(u,2),await l(d);let c=await ce(i,2,a,__sfx("U09DS1M1IOaPoeaJiw=="));if(!c||c[0]!==5)throw new Error(__sfx("U09DS1M1IOaPoeaJi+Wksei0pe+8mumdnuazleWTjeW6lA=="));let f=c[1];if(f===2){let b=new TextEncoder().encode(o.username??""),v=new TextEncoder().encode(o.password??""),y=new Uint8Array(3+b.length+v.length);y[0]=1,y[1]=b.length,y.set(b,2),y[2+b.length]=v.length,y.set(v,3+b.length),await l(y);let T=await ce(i,2,a,__sfx("U09DS1M1IOiupOivgQ=="));if(!T||T[1]!==0)throw new Error(__sfx("U09DS1M1IOeUqOaIt+WQjS/lr4bnoIHorqTor4HlpLHotKU="))}else if(f!==0)throw new Error(__sfx("U09DS1M1IOS4jeaUr+aMgeeahOiupOivgeaWueW8j++8mjB4")+f.toString(16)+"");let p=Wo(n,r),w=new Uint8Array(3+p.length);w[0]=5,w[1]=1,w[2]=0,w.set(p,3),await l(w);let g=await ce(i,4,a,__sfx("U09DS1M1IENPTk5FQ1Q="));if(!g||g[0]!==5)throw new Error(__sfx("U09DS1M1IENPTk5FQ1Qg5ZON5bqU6Z2e5rOV"));if(g[1]!==0)throw new te(__sfx("U09DS1M1IENPTk5FQ1Qg5aSx6LSl77yaMHg=")+g[1].toString(16)+"");let A=g[3];if(A===1)await ce(i,4,a,__sfx("U09DS1M1IOWTjeW6lA=="));else if(A===3){let b=await ce(i,1,a,__sfx("U09DS1M1IOWTjeW6lA=="));if(!b)throw new Error(__sfx("U09DS1M1IOWTjeW6lOaIquaWrQ=="));await ce(i,b[0],a,__sfx("U09DS1M1IOWTjeW6lA=="))}else if(A===4)await ce(i,16,a,__sfx("U09DS1M1IOWTjeW6lA=="));else throw new Error(__sfx("U09DS1M1IOWTjeW6lOWcsOWdgOexu+Wei+mdnuazlQ=="));return await ce(i,2,a,__sfx("U09DS1M1IOWTjeW6lA==")),i.release()}finally{try{s.releaseLock()}catch{}}}function Wo(e,t){let n=e.replace(/^\[|\]$/g,"");if(K(n)){let i=n.split(".").map(a=>Number(a)),s=new Uint8Array(7);return s[0]=1,s.set(i,1),s[5]=t>>8&255,s[6]=t&255,s}if(ae(n)){let i=Re(n),s=new Uint8Array(19);if(s[0]=4,i)for(let a=0;a<8;a++){let l=i[a]??0;s[1+a*2]=l>>8&255,s[2+a*2]=l&255}return s[17]=t>>8&255,s[18]=t&255,s}let r=new TextEncoder().encode(n),o=new Uint8Array(2+r.length+2);return o[0]=3,o[1]=r.length,o.set(r,2),o[o.length-2]=t>>8&255,o[o.length-1]=t&255,o}var zo,_n=C(()=>{"use strict";ke();Z();qe();zo=6e3});function Vo(e){let t=e.byteLength;for(let n=0;n+3<t;n++)if(Yo.every((r,o)=>e[n+o]===r))return n;return-1}async function Gn(e,t,n,r,o={},i=Ut){Rn(n,r);let s=new le(e),a=t.getWriter(),l=n.includes(":")?`[${n}]:${r}`:`${n}:${r}`;try{let u=o.username&&o.password?__sfx("UHJveHktQXV0aG9yaXphdGlvbjogQmFzaWMg")+btoa(`${o.username}:${o.password}`)+"\r\n":"",d=[__sfx("Q09OTkVDVCA=")+l+" HTTP/1.1",`Host: ${l}`,__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",u,"",""].join(`\r
2
- `);await a.write(new TextEncoder().encode(d));let c=Date.now()+i,f="";for(;;){let A=s.peek(),b=Vo(A);if(b>=0){f=new TextDecoder().decode(A.subarray(0,b)),s.skip(b+4);break}if(A.byteLength>8192)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTlpLTotoXov4cgODE5MiDlrZfoioI="));let v=c-Date.now();if(v<=0)throw new Error(__sfx("SFRUUCDku6PnkIbmj6HmiYvotoXml7bvvIg=")+i+__sfx("bXMg5peg5ZON5bqU77yJ"));let y=null,T;try{T=await Promise.race([s.fill(),new Promise(I=>{y=setTimeout(()=>I("timeout"),v)})])}finally{y&&clearTimeout(y)}if(T==="timeout")throw new Error(__sfx("SFRUUCDku6PnkIbmj6HmiYvotoXml7bvvIg=")+i+__sfx("bXMg5peg5ZON5bqU77yJ"));if(T===null)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTkuI3lrozmlbTvvIjov57mjqXooqvmj5DliY3lhbPpl63vvIk="))}let w=f.split(`\r
3
- `)[0]??"",g=/^HTTP\/1\.[01]\s+(\d{3})/.exec(w);if(!g)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTpnZ7ms5U="));if(g[1]!=="200")throw new te(__sfx("SFRUUCDku6PnkIYgQ09OTkVDVCDlpLHotKXvvJo=")+g[1]+"");return s.release()}finally{try{a.releaseLock()}catch{}}}var Yo,Ut,Jn=C(()=>{"use strict";Z();ke();qe();Yo=[13,10,13,10];Ut=6e3});function Nt(e){if(e instanceof me||(e instanceof Error?e.message:String(e)).includes(Zn))return!0;let n=e instanceof Error?e.cause:void 0;return n!==void 0&&n!==e&&Nt(n)}function be(e){let t=e.split(".");if(t.length!==4)return null;let n=0;for(let r of t){if(!/^\d{1,3}$/.test(r))return null;let o=Number(r);if(o>255)return null;n=n*256+o}return n>>>0}function Qe(e){let t=be(e);if(t===null)return null;for(let[n,r,o,i]of _o){let s=be(n);if(s===null)continue;let a=r===0?0:4294967295<<32-r>>>0;if((t&a)===(s&a))return{kind:o,reason:i}}return null}function It(e){let t=e[6]??0,n=e[7]??0;return`${t>>>8}.${t&255}.${n>>>8}.${n&255}`}function Go(e){let t=(e.split("%")[0]??"").toLowerCase();if(!t.includes(":"))return null;let n=Re(t);if(!n)return null;let r=n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&n[4]===0;if(r&&n[5]===65535)return Qe(It(n))??null;if(r&&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(r&&n[5]===0)return Qe(It(n))??null;if(n[0]===100&&n[1]===65435&&n[2]===0&&n[3]===0&&n[4]===0&&n[5]===0){let i=Qe(It(n));if(i)return i}let o=n[0]??0;return(o&65024)===64512?{kind:"ula",reason:__sfx("SVB2NiDllK/kuIDmnKzlnLDlnLDlnYA=")}:(o&65472)===65152?{kind:"link-local",reason:__sfx("SVB2NiDpk77ot6/mnKzlnLDlnLDlnYA=")}:(o&65280)===65280?{kind:"multicast",reason:__sfx("SVB2NiDnu4Tmkq3lnLDlnYA=")}:null}function Ot(e){let t=e.trim().toLowerCase().replace(/^\[|\]$/g,"");if(t==="")return null;if(t.includes(":"))return Go(t);if(/^\d{1,3}(?:\.\d{1,3}){3}$/.test(t))return Qe(t);if(t==="localhost"||t.endsWith(".localhost"))return{kind:"loopback",reason:__sfx("546v5Zue5Li75py65ZCN")};for(let n of Jo)if(t.endsWith(n))return{kind:"internal-name",reason:__sfx("5YaF572R5Z+f5ZCN5ZCO57yA")};return null}var Zn,qn,me,_o,Jo,Mt=C(()=>{"use strict";Z();Zn=__sfx("55uu5qCH5Zyw5Z2A6KKr562W55Wl5oum5oiq"),qn={kind:"ipv6-direct-unsupported",reason:__sfx("55u06L+e5LiO5Y+N5Luj6YCa6YGT5LiN5pSv5oyBIElQdjYg55uu5qCH77yM5Y+v5pS555So6JC95Zyw5Luj55CG6L2s5Y+R")},me=class extends Error{kind;constructor(t,n){super(`${Zn}\uFF1A${t}\uFF08${n.reason}\uFF09`),this.name="TargetBlockedError",this.kind=n.kind}};_o=[[__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")]];Jo=[".local",".internal"]});function er(e){return e.ips.length>0?Zo:qo}function $o(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)?!0:e.includes(":")&&/^[0-9a-fA-F:.]+$/.test(e)}function Ft(e,t){let n=e.trim(),r=/^\[([^\]]+)\](?::(\d+))?$/.exec(n);if(r)return{host:r[1],port:Number(r[2]??t)};if(n.includes(":")&&n.split(":").length>2)return{host:n,port:t};let o=n.lastIndexOf(":");if(o<0)return{host:n,port:t};let i=n.slice(0,o),s=Number(n.slice(o+1));return i?{host:i,port:Number.isInteger(s)&&s>0?s:t}:{host:n,port:t}}async function tr(e,t,n,r=Ht){try{let o=`${e}?name=${encodeURIComponent(t)}&type=${n}`,i=await fetch(o,{headers:{accept:"application/dns-json"},signal:AbortSignal.timeout(r)});if(!i.ok)return null;let s=await i.json();if(!s||s.Status!==0&&s.Status!==3)return null;if(!Array.isArray(s.Answer))return[];let a=n==="TXT"?16:n==="A"?1:28;return s.Answer.filter(l=>l.type===a).map(l=>String(l.data))}catch{return null}}async function nr(e,t,n={}){for(let r of $n){if(n.deadline!==void 0&&Date.now()>=n.deadline)break;let o=n.timeoutMs??Ht,i=n.deadline!==void 0?n.deadline-Date.now():Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")],s=Math.max(50,Math.min(o,i)),a=await tr(r,e,t,s);if(a!==null)return a}return[]}async function ei(e,t){if(t.deadline!==void 0&&Date.now()>=t.deadline)return[];let n=$n.slice(0,2),r=t.timeoutMs??Ht,o=t.deadline!==void 0?t.deadline-Date.now():Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")],i=Math.max(50,Math.min(r,o)),s=await Promise.all(n.map(d=>tr(d,e,"A",i))),a=[],l=new Set,u=!1;for(let d of s)if(d!==null){u=!0;for(let c of d)l.has(c)||(l.add(c),a.push(c))}return u?a:await nr(e,"A",t)}function ti(e,t){let n=[],r=String(e).replace(/^"|"$/g,"").replace(/\\010/g,",").replace(/\\n/g,",").trim();if(!r||r===Qn)return n;let o=r.split(/[,;\s]+/).filter(Boolean);if(o.length===0)return n;for(let i of o){let s=i.trim();if(!s)continue;let{host:a,port:l}=Ft(s,t);if(!K(a)&&!ae(a))return[];n.push({hostname:a,port:l})}return n}async function $e(e,t,n={}){let r=e.trim();if(!r)return[];if($o(r))return[{hostname:r,port:t}];let o=`${r}:${t}`,i=ne.get(o);if(i&&Date.now()-i.at<er(i))return ne.delete(o),ne.set(o,i),i.ips;let s=Bt.get(o);if(s)return s;let a=ni(r,t,o,n).finally(()=>{Bt.delete(o)});return Bt.set(o,a),a}async function ni(e,t,n,r){let o=[],[i,s]=await Promise.all([r.skipTxt?Promise.resolve([]):nr(e,"TXT",r),ei(e,r)]);if(!r.skipTxt)for(let d of i){let c=ti(d,t);if(c.length>0){o.push(...c);break}if(String(d).replace(/^"|"$/g,"").replace(/\\010/g,",").trim()===Qn)break}if(o.length===0)for(let d of s)K(d)&&o.push({hostname:d,port:t});let a=[],l=new Set;for(let d of o){let c=`${d.hostname}:${d.port}`;l.has(c)||(l.add(c),a.push(d))}let u=Date.now();for(let[d,c]of ne)u-c.at>=er(c)&&ne.delete(d);for(;ne.size>=Qo;){let d=ne.keys().next().value;if(d===void 0)break;ne.delete(d)}return ne.set(n,{at:u,ips:a}),a}var Qn,$n,Ht,Zo,qo,Qo,ne,Bt,et=C(()=>{"use strict";Z();Qn=__sfx("QGVkZ2V0dW5uZWw="),$n=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve","https://dns.alidns.com/resolve","https://doh.pub/dns-query"],Ht=4e3,Zo=300*1e3,qo=30*1e3,Qo=1e3,ne=new Map,Bt=new Map});var Wt={};je(Wt,{[__sfx("QlVJTFRJTl9SRUxBWV9ET01BSU5T")]:()=>Xt,[__sfx("Q09MT19UT19DT1VOVFJZ")]:()=>rr,[__sfx("UkVMQVlfQkFUQ0hfU0laRQ==")]:()=>oi,[__sfx("UkVMQVlfRE9NQUlOX0xJTUlU")]:()=>Kt,clearRelayCache:()=>ai,collectRelayEndpoints:()=>Le,coloToCountry:()=>ri,relayCacheSize:()=>li,resolveRelayEntry:()=>jt,selectRelayDomains:()=>sr,stableRelayIndex:()=>zt});function ri(e){let t=String(e??"").toUpperCase();return t?rr[t]??(/^[A-Z]{2}$/.test(t)?t:"US"):"US"}function si(e){for(let[t,n]of re)e-n.at>=ir&&re.delete(t);for(;re.size>=ii;){let t=re.keys().next().value;if(t===void 0)break;re.delete(t)}}async function jt(e,t=443,n=or,r={}){let o=e.trim();if(!o)return[];let i=`${o}:${t}:${n}`,s=re.get(i);if(s&&Date.now()-s.at<ir)return s.ips;let a=o,l=t,u=(o.match(/:/g)??[]).length;if(u===1){let c=/^(.*):(\d{1,5})$/.exec(o);c&&(a=c[1],l=Number(c[2]))}else if(u>1&&o.startsWith("[")){let c=/^\[([^\]]+)\]:(\d{1,5})$/.exec(o);c&&(a=c[1],l=Number(c[2]))}let d=[];if(K(a)||ae(a))d=[{ip:a,port:Number.isInteger(l)&&l>0?l:t,label:o}];else try{d=(await $e(a,l,{skipTxt:r.skipTxt,deadline:r.deadline,timeoutMs:r.timeoutMs})).slice(0,n).map(f=>({ip:f.hostname,port:f.port,label:`${a} \u2192 ${f.hostname}`}))}catch{d=[]}if(d.length>0){let c=Date.now();si(c),re.set(i,{at:c,ips:d})}return d}function sr(e=Kt,t=Xt){return t.slice(0,Math.max(0,e))}function zt(e,t){if(t<=0)return 0;let n=(e||"").toLowerCase(),r=2166136261;for(let o=0;o<n.length;o++)r^=n.charCodeAt(o),r=Math.imul(r,16777619);return(r>>>0)%t}async function Le(e={}){let t=e.perDomain??or,n=[],r=new Set,o=f=>{for(let p of f){let w=`${p.ip}:${p.port}`;r.has(w)||(r.add(w),n.push(p))}},i=(e.userEntries??"").trim(),s=i?i.split(/[\n,;]+/).map(f=>f.trim()).filter(Boolean):[],a=e.domainLimit??Kt,l=e.useBuiltin!==!1?sr(a):[],u=await Promise.all([...s.map(f=>jt(f,443,t,{deadline:e.deadline,timeoutMs:e.timeoutMs})),...l.map(f=>jt(f,443,t,{skipTxt:!0,deadline:e.deadline,timeoutMs:e.timeoutMs}))]);for(let f=0;f<s.length;f++)o(u[f]);let d=u.slice(s.length),c=d.reduce((f,p)=>Math.max(f,p.length),0);for(let f=0;f<c;f++)for(let p of d)f<p.length&&o([p[f]]);return n}function ai(){re.clear()}function li(){return re.size}var Xt,rr,or,oi,Kt,ir,ii,re,De=C(()=>{"use strict";Z();et();Xt=[__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")],rr={[__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"};or=4,oi=6,Kt=Xt.length,ir=30*1e3,ii=256,re=new Map});function Ie(e,t,n){return`${e}|${t}:${n}`}function Ue(e,t){let n=oe.get(e);return n!==void 0&&n.cooldownUntil>t}function fi(e){for(let[t,n]of oe)n.cooldownUntil<=e&&oe.delete(t);for(;oe.size>=di;){let t=oe.keys().next().value;if(t===void 0)break;oe.delete(t)}}function lr(e,t,n){if(n)return;fi(t);let r=oe.get(e)??{fails:0,cooldownUntil:0};if(r.fails+=1,r.fails>=ar){let o=r.fails-ar;r.cooldownUntil=t+Math.min(ui,ci*2**o)}oe.set(e,r)}function Yt(e){oe.delete(e)}function cr(e,t,n){let r=[...e];return r.sort((o,i)=>{let s=Ue(t(o),n)?1:0,a=Ue(t(i),n)?1:0;return s-a}),r}var ar,ci,ui,di,oe,ur=C(()=>{"use strict";ar=2,ci=3e4,ui=5*6e4,di=256,oe=new Map});function dr(e){return e.map(([t,n])=>{let r=be(t)??0,o=n===0?0:4294967295<<32-n>>>0;return[(r&o)>>>0,o]})}function fr(e){let t=be(e);if(t===null)return!1;for(let[n,r]of bi)if((t&r)>>>0===n)return!0;return!1}function ue(e){let t=be(e);if(t===null)return!1;for(let[n,r]of yi)if((t&r)>>>0===n)return!0;return!1}function pr(e){let t=[],n=new Set,r=c=>{let f=`${c.source}|${c.host}|${c.port}`;n.has(f)||(n.add(f),t.push(c))};for(let c of e.proxies??[])c.kind==="direct"?r({source:"proxy",host:c.host,port:c.port,label:__sfx("UHJveHlJUCA=")+c.host+":"+c.port+"",via:{kind:"direct",host:c.host,port:c.port}}):r({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 o=ue(e.targetHost),i=e.optimizedIps??[],s=i.filter(c=>!ue(c.ip)),a=i.filter(c=>ue(c.ip)),l=s.length>0&&a.length>0,u=o||e.deprioritizeDirect===!0||l;r({source:"direct",host:e.targetHost,port:e.targetPort,label:__sfx("55u06L+eIA==")+e.targetHost+":"+e.targetPort+"",deprioritized:u});for(let c of s)r({source:"optimized",host:c.ip,port:c.port,label:__sfx("5LyY6YCJIA==")+c.ip+":"+c.port+""});for(let c of a)r({source:"optimized",host:c.ip,port:c.port,label:__sfx("5LyY6YCJIA==")+c.ip+":"+c.port+__sfx("77yIQ2xvdWRmbGFyZSDnvZHmrrXvvIzlj6/og73kuI3lj6/ovr7vvIk="),deprioritized:!0});let d=e.relay??[];for(let c of d)r({source:"relay",host:c.ip,port:c.port,label:__sfx("5Y+N5LujIA==")+c.label+"",deprioritized:!0});return t.map((c,f)=>({candidate:c,index:f})).sort((c,f)=>{let p=+!!c.candidate.deprioritized-+!!f.candidate.deprioritized;return p!==0?p:c.index-f.index}).map(c=>c.candidate)}function mr(e){let t=e.filter(r=>!r.deprioritized),n=t.filter(r=>r.source==="proxy");return{landing:n.filter(r=>r.via?.kind!=="direct"),[__sfx("cHJveHlJcA==")]:n.filter(r=>r.via?.kind==="direct"),direct:t.filter(r=>r.source!=="proxy"),fallback:e.filter(r=>r.deprioritized)}}function hr(e,t){let n=e instanceof Error?e.message:String(e);return Nt(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 gr(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 pi,mi,hi,gi,yi,bi,Vt=C(()=>{"use strict";Mt();pi=[[__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]],mi=[[__sfx("MTA0LjMxLjAuMA=="),15],[__sfx("MTkyLjAuMC4w"),24],[__sfx("MTkyLjAuMi4w"),24],[__sfx("MTkyLjg4Ljk5LjA="),24],[__sfx("MTk5LjI3LjEyOC4w"),21],[__sfx("MS4wLjAuMA=="),24],[__sfx("MS4xLjEuMA=="),24]],hi=[[__sfx("MjIzLjUuNS4w"),24]],gi=[...pi,...mi];yi=dr(gi),bi=dr(hi)});function yr(e,t="direct"){let n=e.trim();if(!n)return null;let r=t,o=n,i=/^([a-z0-9+.-]+):\/\//i.exec(n);if(i){let f=i[1].toLowerCase();o=n.slice(i[0].length),f===__sfx("c29ja3M1")||f===__sfx("c29ja3M=")||f===__sfx("c29ja3M1aA==")?r=__sfx("c29ja3M1"):f==="https"?r="https":f==="http"&&(r="http")}let s=o.lastIndexOf("@"),a={};if(s>=0){let f=o.slice(0,s);o=o.slice(s+1);let p=f.indexOf(":");p>=0?a={username:f.slice(0,p),password:f.slice(p+1)}:a={username:f}}let l,u=/#sni=([^/#]+)/i.exec(o);u&&(l=u[1].trim(),o=o.slice(0,u.index)+o.slice(u.index+u[0].length));let{host:d,port:c}=Ft(o,0);return!d||!Number.isInteger(c)||c<=0||c>65535?null:(!l&&r==="https"&&!wi(d)&&(l=d),{host:d,port:c,kind:r,...a,...l?{serverName:l}:{}})}function wi(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)}function Ne(e,t="direct"){let n=[];for(let r of e.split(/[\n,;]+/)){let o=r.trim();if(!o)continue;let i=yr(o,t);i&&n.push(i)}return n}var _t=C(()=>{"use strict";et()});async function xi(){return Gt||(Gt=(async()=>(await import("cloudflare:sockets")).connect)()),await Gt}function Pi(e,t){if(!K(e))return null;let n=e.split(".").map(s=>Number(s)),r=(n[0]<<8|n[1]).toString(16),o=(n[2]<<8|n[3]).toString(16);return`${t.replace(/:+$/,"")}::${r}:${o}`}async function nt(e,t,n,r,o){let s=(await xi())({hostname:e,port:t},r?{secureTransport:r,...o?{expectedServerHostname:o}:{}}:void 0),a=async(u,d)=>{let c,f=new Promise((p,w)=>{c=setTimeout(()=>w(new Error(""+d+__sfx("6LaF5pe277ya")+e+":"+t+"")),n)});try{return await Promise.race([u,f])}finally{c&&clearTimeout(c)}},l;try{if(await a(s.opened,__sfx("6L+e5o6l")),r==="starttls"){if(l=s.startTls?.(o?{expectedServerHostname:o}:void 0),!l)throw new Error(__sfx("5b2T5YmN6L+Q6KGM5pe25LiN5pSv5oyBIHN0YXJ0VGxz"));return await a(l.opened,__sfx("VExTIOaPoeaJiw==")),l}return s}catch(u){try{Promise.resolve((l??s).close()).catch(()=>{})}catch{}throw u}}async function Ai(e){let t=e.timeoutMs??tt;try{let n=await nt(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&&K(e.hostname)){let r=Pi(e.hostname,e.nat64);if(r){let o=await nt(r,e.port,t);return{readable:o.readable,writable:o.writable,via:"nat64",endpoint:`${r}:${e.port}`,close:()=>{try{o.close()}catch{}}}}}throw n}}function Ti(e){return e.includes(":")}function Ri(e){return e.source==="proxy"&&e.via!==void 0&&e.via.kind!=="direct"}async function Ci(e,t){let n=e.timeoutMs??tt,r=Math.min(Ut,Math.max(200,n));if(t.kind==="direct"){let s=await nt(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,i=await nt(t.host,t.port,n,o,t.kind==="https"?t.serverName:void 0);try{return t.kind==="http"||t.kind==="https"?{readable:await Gn(i.readable,i.writable,e.hostname,e.port,{username:t.username,password:t.password},r),writable:i.writable,via:t.kind,endpoint:`${t.host}:${t.port}`,close:()=>{try{i.close()}catch{}}}:{readable:await Vn(i.readable,i.writable,e.hostname,e.port,{username:t.username,password:t.password,handshakeTimeoutMs:r}),writable:i.writable,via:__sfx("c29ja3M1"),endpoint:`${t.host}:${t.port}`,close:()=>{try{i.close()}catch{}}}}catch(s){try{await i.close()}catch{}throw s}}function xr(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}function Li(e){if(e.length===0)return __sfx("5pyq55+l5Y6f5Zug");let t=e.map(xr),n=t.slice(-ki),r=t.length-n.length;return`${r>0?`\uFF08\u5171 ${t.length} \u6761\uFF0C\u7701\u7565\u524D ${r} \u6761\uFF09`:""}${n.join("\uFF1B")}`}function Di(e,t){return e.length===0?Promise.reject(new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"))):new Promise((n,r)=>{let o=0,i=0,s=!1,a=[],l=d=>{try{let c=d.close;Promise.resolve(c?c():d.writable.close()).catch(()=>{})}catch{}},u=()=>{if(!s)for(;i<t&&o<e.length;){let d=e[o++];i++,d().then(c=>{if(i--,s){l(c);return}s=!0,n(c)},c=>{i--,a.push(c),!s&&(u(),o>=e.length&&i===0&&(s=!0,r(new Error(__sfx("5YWo6YOoIA==")+e.length+__sfx("IOS4quWAmemAieWdh+Wksei0pe+8mg==")+Li(a)+""))))})}};u()})}async function Jt(e,t){if(e.length===0)throw new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"));if(!t||e.length<=1){let n=new Error(__sfx("5ouo5Y+35aSx6LSl"));for(let r of e)try{return await r()}catch(o){n=o}throw n}try{return await Di(e,br)}catch(n){throw new Error(__sfx("5YWo6YOoIA==")+e.length+__sfx("IOS4quWAmemAieWdh+Wksei0pe+8iOa7keWKqOeql+WPo++8jOacgOWkmiA=")+br+__sfx("IOS4quW5tuWPke+8ie+8mgo=")+xr(n),{cause:n})}}async function wr(e,t){let n=[...e];if(!t)return n;try{let r=await Le(t),o=new Set(n.map(i=>`${i.ip}:${i.port}`));for(let i of r){let s=`${i.ip}:${i.port}`;o.has(s)||(o.add(s),n.push(i))}}catch{}return n}async function Ui(e,t,n){if(e.length===0)return null;let r=e.map(o=>t({source:"relay",host:o.ip,port:o.port,label:__sfx("5Y+N5LujIA==")+o.label+""}));try{return await Jt(r,n)}catch{return null}}async function we(e){let t=e.proxies??[],n=e.concurrent??!0;if(!e.skipTargetPolicy&&t.length===0){let h=Ot(e.hostname);if(h)throw new me(e.hostname,h)}let r=e.budgetMs??Si,o=Date.now()+r,i=e.pinnedIps??[],s=i.length>0,a=s?[...i]:[...e.optimizedIps??[]],l=s;if(e.resolvePreferred&&!s)try{let h=Math.min(o,Date.now()+(e.dohBudgetMs??Ei)),P=await $e(e.hostname,e.port,{deadline:h,skipTxt:e.skipTxt??!0});if(P.length>0){l=!0;for(let R of P)a.push({ip:R.hostname,port:R.port})}}catch{}let u=ue(e.hostname),d=l&&a.length>0&&a.every(h=>ue(h.ip)),c=[...e.relay??[]];(d||u)&&e.relayPool&&(c=await wr(c,{...e.relayPool,deadline:o}));let p=c,w=pr({targetHost:e.hostname,targetPort:e.port,optimizedIps:a,proxies:t,deprioritizeDirect:u||s,relay:[]});if(w.length===0)throw new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"));let g=h=>async()=>{let P=Ie(h.source,h.host,h.port),R=o-Date.now();if(R<=0)throw new Error(__sfx("5ouo5Y+36aKE566X5bey55So5bC977yI")+r+"ms):"+e.hostname+":"+e.port+"");let F=h.source==="relay"?Math.min(e.timeoutMs??tt,vi):e.timeoutMs??tt,J=Math.max(200,Math.min(F,R)),M={...e,timeoutMs:J};try{if(!Ri(h)&&Ti(e.hostname))throw new me(e.hostname,qn);if(!e.skipTargetPolicy&&h.source!=="proxy"&&h.source!=="relay"){let O=Ot(h.host);if(O)throw new me(h.host,O)}if(h.source==="proxy"&&h.via)try{let O=await Ci(M,{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 Yn(h.via),Yt(P),O}catch(O){throw O instanceof te||Wn(h.via,Date.now()),O}let N=await Ai({...M,hostname:h.host,port:h.port});return Yt(P),N}catch(N){lr(P,Date.now(),N instanceof te);let O=hr(N,h.label);throw e.onFailure?.(O),N}},A=mr(w),{landing:b,[__sfx("cHJveHlJcA==")]:v,direct:y,fallback:T}=A,I=b.length>0||v.length>0,D=async()=>{if(b.length===0)throw new Error(__sfx("5pyq6YWN572u6JC95Zyw5Luj55CG"));let h,P=Dt(b,R=>R.via,Date.now());for(let R of P)try{return await g(R)()}catch(F){h=F}throw h??new Error(__sfx("6JC95Zyw5Luj55CG5YWo6YOo5aSx6LSl"))},_=async()=>{if(v.length===0)throw new Error(__sfx("5pyq6YWN572uIFByb3h5SVA="));let h=Date.now(),P=Dt(v,R=>R.via,h);return await Jt(P.map(g),!0)},H=async()=>{let h;if(b.length>0)try{return await D()}catch(P){h=P}if(v.length>0)try{return await _()}catch(P){h=P}throw h??new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Luj55CG"))},fe=async()=>await Jt(y.map(g),n),pe=async()=>{let h=e.pinnedRelays??[];for(let M of h)try{return await g({source:"relay",host:M.ip,port:M.port,label:__sfx("5Zu65a6a5Y+N5LujIA==")+M.ip+":"+M.port+""})()}catch{}let P=p;if(P.length===0&&e.relayPool&&(P=await wr([],{...e.relayPool,deadline:o})),P.length===0)return null;let R=zt(e.hostname,P.length),F=P[R],J=Date.now();if(Ue(Ie("relay",F.ip,F.port),J)){let M=P.find(N=>!Ue(Ie("relay",N.ip,N.port),J));M&&(F=M)}try{return await g({source:"relay",host:F.ip,port:F.port,label:__sfx("5Y+N5LujIA==")+F.label+""})()}catch{let M=cr(P.filter(N=>N!==F),N=>Ie("relay",N.ip,N.port),Date.now());return await Ui(M,g,n)}},$=async()=>{for(let h of T)try{return await g(h)()}catch{}return null};if(!I)try{return await fe()}catch(h){let P=await pe();if(P)return P;let R=await $();if(R)return R;throw h}let ie=e.proxyMode??"only",He=u||d;if(ie==="only")try{return await H()}catch(h){let P=await pe();if(P)return P;let R=await $();if(R)return R;throw h}if(ie==="global"||ie==="smart"&&He)try{return await H()}catch(h){if(ie==="global")try{return await fe()}catch{}let P=await pe();if(P)return P;let R=await $();if(R)return R;throw h}try{return await fe()}catch(h){try{return await H()}catch{}let P=await pe();if(P)return P;let R=await $();if(R)return R;throw h}}var Gt,tt,Si,Ei,br,vi,ki,Zt=C(()=>{"use strict";_n();Jn();Mt();qe();Z();et();De();ur();Vt();_t();Gt=null;tt=8e3,Si=15e3,Ei=1200;br=6,vi=2500,ki=8});function Ni(e){let t=Ii.exec(e);return t?t.slice(1).every(n=>Number(n)<=255&&String(Number(n))===n):!1}function rt(e){let t=[],n=new Map;for(let r of String(e??"").split(/\r?\n/)){let o=r.trim();if(!o||o.startsWith("#"))continue;let i=o.indexOf("=");if(i<=0)continue;let s=o.slice(0,i).trim().toLowerCase();if(!Er.test(s))continue;let a=[],l=!1;for(let c of o.slice(i+1).split(",")){let f=c.trim();if(!f)continue;let p=f.toLowerCase().startsWith("r:"),w=p?f.slice(2).trim():f;if(w.startsWith("r:"))continue;let g=w.lastIndexOf(":"),A=w,b;if(g>0&&/^\d{1,5}$/.test(w.slice(g+1))){A=w.slice(0,g).trim();let v=Number(w.slice(g+1));if(v>0&&v<=65535)b=v;else continue}if(Ni(A)&&!(a.length>0&&p!==l)&&(l=p,a.push({ip:A,port:b}),a.length>=Sr))break}if(a.length===0)continue;let u=l?`relay:${s}`:s,d=n.get(u);if(!d){if(t.length>=Oi)break;d={host:s,endpoints:[],relay:l},n.set(u,d),t.push(d)}for(let c of a){if(d.endpoints.length>=Sr)break;d.endpoints.some(f=>f.ip===c.ip&&f.port===c.port)||d.endpoints.push(c)}}return t}function Pr(e,t,n){let r=String(t??"").trim().toLowerCase();if(!r)return;let o=rt(e),i,s,a=-1;for(let l of o)if(l.relay===n){if(l.host===r){i=l;break}if(l.host.startsWith("*.")){let u=l.host.slice(1);r.endsWith(u)&&u.length>a&&(s=l,a=u.length)}}return i??s}function Ar(e,t,n){let r=Pr(e,t,!1);return r?r.endpoints.map(o=>({ip:o.ip,port:o.port??n})):[]}function Tr(e,t,n){let r=Pr(e,t,!0);return r?r.endpoints.map(o=>({ip:o.ip,port:o.port??n})):[]}function Mi(e){let t=e.indexOf("=");if(t<=0)return;let n=e.slice(0,t).trim().toLowerCase();if(!Er.test(n))return;let r=e.slice(t+1).trim().toLowerCase();if(!r)return;let o=!1,i={};for(let s of r.split(",")){let a=s.trim();if(a==="noredial"){i.noRedial=!0,o=!0;continue}let l=/^stall:(\d{1,6})$/.exec(a);l&&(i.stallMs=Math.max(200,Math.min(15e3,Number(l[1]))),o=!0)}return o?{host:n,policy:i}:void 0}function Rr(e,t){let n=String(t??"").trim().toLowerCase();if(!n)return;let r,o,i=-1;for(let s of String(e??"").split(/\r?\n/)){let a=s.trim();if(!a||a.startsWith("#"))continue;let l=Mi(a);if(l){if(l.host===n){r=l.policy;break}if(l.host.startsWith("*.")){let u=l.host.slice(1);n.endsWith(u)&&u.length>i&&(o=l.policy,i=u.length)}}}return r??o}var Ii,Er,Sr,Oi,ot=C(()=>{"use strict";Ii=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;Er=/^(?:\*\.)?[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/,Sr=8,Oi=64});function xe(e,t,n,r={}){return{hostname:t.hostname,port:t.port,proxies:n,timeoutMs:e.dialConnectMs,budgetMs:e.dialBudgetMs,dohBudgetMs:e.dohBudgetMs,concurrent:e.concurrentDial,nat64:e.nat64||void 0,proxyMode:e.proxyMode,resolvePreferred:e.resolvePreferred,relayPool:{userEntries:e.relayPool||void 0,useBuiltin:e.useBuiltinRelay},pinnedIps:e.pinnedHosts?Ar(e.pinnedHosts,t.hostname,t.port):void 0,pinnedRelays:e.pinnedHosts?Tr(e.pinnedHosts,t.hostname,t.port):void 0,...r}}var qt=C(()=>{"use strict";ot()});async function Cr(e,t,n,r=!0,o,i){let s=e.getReader(),a=t.getWriter();try{for(;!n?.exhausted;){let l;try{l=await s.read()}catch(d){i?.(d,"read");break}if(l.done)break;let u=l.value;if(!(!u||u.byteLength===0)){if(o?.(u.byteLength))break;try{await a.write(u)}catch(d){i?.(d,"write");break}}}}finally{if(r)try{await a.close()}catch{}else try{a.releaseLock()}catch{}try{s.releaseLock()}catch{}}}var he,it=C(()=>{"use strict";he=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 Ir={};je(Ir,{diagnosticCounters:()=>Xi,[__sfx("aGFuZGxlV2ViU29ja2V0")]:()=>dt,recentCloses:()=>Ki,recentDiagnostics:()=>_i,recentRoutes:()=>Vi,recentSessions:()=>zi,recordDiagnostics:()=>G,truncateCloseReason:()=>Ur});function Ur(e,t=123){let n=new TextEncoder;if(n.encode(e).length<=t)return e;let r=e.slice(0,t);for(;n.encode(r).length>t;)r=r.slice(0,-1);r=r.replace(/\uFFFD+$/,"");let o="\u2026";for(;r.length>0&&n.encode(r+o).length>t;)r=r.slice(0,-1);return r+o}function Xi(){return{...Ee,since:kr,uptimeMs:Date.now()-kr}}function Ki(){return lt}function zi(){return ct}function Wi(e){ct.unshift(e),ct.length>Pe&&(ct.length=Pe)}function Yi(e,t,n,r,o,i,s){lt.unshift({at:Date.now(),code:e,reason:t,via:n,endpoint:r,dl:o,ret:i,rd:s}),lt.length>Pe&&(lt.length=Pe)}function Vi(){return ut}function Lr(e){let t=e.trim(),n=t.indexOf("]:");if(n>=0)return t.slice(1,n);let r=t.lastIndexOf(":");return r>0?t.slice(0,r):t}function Dr(e,t,n){ut.unshift({at:Date.now(),target:e,via:t.via,endpoint:t.endpoint,cfTarget:ue(Lr(e)),publicDns:fr(Lr(e)),phase:n}),ut.length>20&&(ut.length=20)}function G(e,t,n){at.unshift({at:Date.now(),target:e,failures:t,summary:n}),at.length>Pe&&(at.length=Pe)}function _i(){return at}function Zi(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,"/"),r=n.length%4===0?"":"=".repeat(4-n.length%4),o=atob(n+r);if(o.length<17||o.length>8192)return new Uint8Array(0);let i=new Uint8Array(o.length);for(let s=0;s<o.length;s++)i[s]=o.charCodeAt(s);return i}catch{return new Uint8Array(0)}}async function dt(e,t,n,r,o,i){let[s,a]=Object.values(new WebSocketPair);try{a.accept({allowHalfOpen:!0})}catch{a.accept()}a.binaryType="arraybuffer";let l=Zi(e.headers.get(__sfx("c2VjLXdlYnNvY2tldC1wcm90b2NvbA=="))),u;{let m=(e.headers.get(__sfx("c2VjLXdlYnNvY2tldC1wcm90b2NvbA=="))??"").trim();m&&l.byteLength>0&&(u=m||void 0)}let d=[],c=0,f=!1,p=null,w=null,g=new Je,A=null,b=null,v=()=>{b&&(clearTimeout(b),b=null)},y=!1,T=new Ge,I=null,D=!1,_=!1,H=null,fe,pe=m=>{let S=fe?.stallMs??n.dialStallMs;return m?Math.max(400,Math.round(S/2)):S},$=null,ie=m=>{try{a.send(m)}catch{}},He=m=>{let S=new Uint8Array(2+m.byteLength);S[0]=0,S[1]=m.byteLength,S.set(m,2),ie(S)},h=(m,S)=>{if(D)return;D=!0;let x=p,B=m>=1008&&x?`via=${x.via} ep=${x.endpoint} `:"";Yi(m,S,x?.via??"",x?.endpoint??"",ee,O,J),Wi({at:Date.now(),mode:t,transport:"ws",target:H?`${H.hostname}:${H.port}`:"",via:x?.via??"",endpoint:x?.endpoint??"",ulBytes:hn,dlBytes:ee,redials:J,closeCode:m,reason:S});try{a.close(m,Ur(B+S))}catch{}P()},P=()=>{if(!_){if(_=!0,pn(),Se.bytes=Math.max(0,Se.bytes-c),d=[],c=0,v(),A&&(clearTimeout(A),A=null),R&&(clearTimeout(R),R=null),I){let m=I;I=null;try{m.cancel()}catch{}}if(p){let m=p.close;if(m)try{m()}catch{}else try{p.writable.close()}catch{}}}},R=null,F=new Set,J=0,M=0,N=[],O=0,gt=m=>{if(!(m.byteLength===0||ee>0)){if(O+m.byteLength>vr){h(1009,__sfx("5pyq56Gu6K6k6YCa6Lev55qE5LiK6KGM5pWw5o2u6L+H5aSa"));return}if(st+m.byteLength>Fi){h(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}N.push(m),O+=m.byteLength,st+=m.byteLength}},pn=()=>{st=Math.max(0,st-O),N=[],O=0},yt=0,co=()=>{yt+=1},mn=async(m=pe(!1))=>{if(!p)return;let S=++yt,x=p.readable.getReader();I=x,R&&clearTimeout(R);let B=setTimeout(()=>{R===B&&(R=null),!(ee>0)&&O!==0&&xn("stall")},m);R=B;try{for(;;){let{done:W,value:Y}=await x.read();if(W)break;if(Y&&Y.byteLength>0){let k=ee===0;if(ee+=Y.byteLength,k&&pn(),gn.add(Y.byteLength)){yn();return}let X=T.yieldCount;await T.onChunk(Y.byteLength),T.yieldCount>X&&Ee.downlinkYields++,ie(Y)}}}catch{}finally{try{x.releaseLock()}catch{}if(clearTimeout(B),R===B&&(R=null),I===x&&(I=null),S!==yt||D)return;if(ee===0&&O>0&&J<n.relayRedialMax&&!y){xn("eof");return}let W=p;h(1e3,W?`done via=${W.via} ep=${W.endpoint} dl=${ee} ret=${O} rd=${J}`:"done")}},ee=0,hn=0,gn=new he((n.dataBudgetMB||0)*1024*1024),yn=()=>{let m=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+n.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");G(H?`${H.hostname}:${H.port}`:__sfx("5pyq5bu656uL5Ye656uZ"),[],m),h(1009,m)},uo=async m=>{let S=w;if(S)try{await g.write(()=>w===S?S:null,m)}catch(x){G(H?`${H.hostname}:${H.port}`:__sfx("5pyq5bu656uL5Ye656uZ"),[],__sfx("5LiK6KGM5YaZ5YWl5aSx6LSl77ya")+String(x)+""),P()}},bn=async m=>{if(d.length===0)return;let S=d;d=[],c=0;for(let x of S)Se.bytes=Math.max(0,Se.bytes-x.byteLength),gt(x),await m.write(x)},wn=m=>{if(t===__sfx("dmxlc3M=")){let x=Ye(m,n.uuid);if(!x)return null;let B=ve(x.header);return{command:x.header.command,port:x.header.port,hostname:x.header.hostname,headerLength:x.consumed,...B?{reject:B}:{}}}let S=On(m,n[__sfx("dHJvamFuUGFzc3dvcmQ=")]);return S?{command:S.header.command,port:S.header.port,hostname:S.header.hostname,headerLength:S.consumed}:null},fo=()=>{A&&(clearTimeout(A),A=null)},po=async()=>{if(!(D||f)){if(wn(l)){await bt();return}h(1008,l.byteLength===0?__sfx("5o+h5omL6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0"):__sfx("5o+h5omL6LaF5pe277ya5Y2P6K6u5aS05LiN5a6M5pW05oiW6K6k6K+B5aSx6LSl"))}},bt=async()=>{if(D||f)return;let m=wn(l);if(!m){l.byteLength>0&&!A&&(A=setTimeout(()=>{A=null,po().catch(k=>h(1011,String(k)))},Gi));return}if(fo(),v(),f)return;if(f=!0,H=m,fe=n.pinnedHosts?Rr(n.pinnedHosts,m.hostname):void 0,m.reject){G(`${m.hostname}:${m.port}`,[],__sfx("5Y2P6K6u5aS05ouS57ud77ya")+m.reject+""),h(1011,m.reject);return}let S=t===__sfx("dmxlc3M=")?Ct:Nn;if(m.command===S){if(t===__sfx("dmxlc3M=")&&n.udpDns==="doh"&&m.port===53){He(new Uint8Array(0)),$=new _e({endpoint:n.udpDnsEndpoint,send:ie});let k=l.subarray(m.headerLength);k.byteLength>0&&$.push(k);return}h(1002,n.udpDns==="doh"?__sfx("VURQIOS7heaUr+aMgSBETlPvvIg1MyDnq6/lj6PvvIk="):__sfx("VURQIOacquWQr+eUqO+8iOmdouadv+WPr+W8gOWQryBETlMgb3ZlciBEb0jvvIk="));return}t===__sfx("dmxlc3M=")&&He(new Uint8Array(0));let x=[],B=null;try{p=await we(xe(n,{hostname:m.hostname,port:m.port},r,{onFailure:k=>{x.push(k),i?.failures.push(k)}}))}catch(k){B=k}if(!p){let k=x.length>0?x.map(X=>gr(X)).join(`
4
- `):__sfx("5Ye656uZ6L+e5o6l5aSx6LSl77ya")+String(B)+"";G(`${m.hostname}:${m.port}`,x,k),h(1011,k);return}let W=p.writable.getWriter();w=W,Dr(`${m.hostname}:${m.port}`,p,"initial");let Y=l.byteLength>m.headerLength?l.subarray(m.headerLength):new Uint8Array(0);l=new Uint8Array(0);try{await g.run(async()=>{Y.byteLength>0&&(gt(Y),await W.write(Y)),await bn(W)})}catch(k){G(`${m.hostname}:${m.port}`,[],__sfx("5LiK6KGM6aaW5YyF5YaZ5YWl5aSx6LSl77ya")+String(k)+""),P()}o?.waitUntil(mn())},xn=async m=>{if(D||y)return;let S=H;if(!S){h(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55uu5qCH5pyq6Kej5p6Q"));return}if(fe?.noRedial){G(`${S.hostname}:${S.port}`,[],__sfx("5oyJ5Z+f5ZCN562W55Wl56aB5q2i5YGH5rS76YeN5ouo77yIbm9yZWRpYWzvvIk=")),h(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya6K+l5Z+f5ZCN5bey56aB5q2i6Ieq5Yqo5YiH5o2i5Y+N5Luj5YWl5Y+j"));return}if(M>=n.relayRedialMax){h(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55u06L+e5LiO5Y+N5Luj5YWl5Y+j5Z2H5peg5ZON5bqU"));return}y=!0;try{let x=jn({via:p?.via,port:S.port,userProxyConfigured:r.length>0||!!n[__sfx("cHJveHlJcA==")],aggressive:n.aggressiveRedial===!0});if(!x.allowed){Ee.guardedRedials++,G(`${S.hostname}:${S.port}`,[],__sfx("5Ye656uZ5peg5pWw5o2u77ya")+x.reason+__sfx("77yb5pyq5YiH5o2i5Y+N5Luj77yI5Y+v5byA5ZCvIGFnZ3Jlc3NpdmVSZWRpYWzvvIk=")),h(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya")+x.reason+"");return}J++,m==="stall"?Ee.stallRedials++:Ee.eofRedials++,G(`${S.hostname}:${S.port}`,[],m==="stall"?__sfx("5LiL6KGM6Z2Z6buY5peg5pWw5o2u77yM5pS56LWw5Y+N5Luj5YWl5Y+j"):__sfx("5Ye656uZ6Zu25LiL6KGM5Y2zIEVPRi9SZXNldO+8jOeri+WNs+aUuei1sOWPjeS7o+WFpeWPow=="));let B=[];try{B=await Le({userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay})}catch{B=[]}p?.endpoint&&F.add(p.endpoint);let W=B.filter(k=>!F.has(`${k.ip}:${k.port}`));if(W.length===0){h(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5peg5Y+N5Luj5YWl5Y+j5Y+v55So"));return}let Y=Math.max(1,n.relayRedialMax-M);for(let k of W.slice(0,Y)){if(M++,F.add(`${k.ip}:${k.port}`),co(),p){let X=p;if(X.close)try{X.close()}catch{}}w=null,ee=0;try{let X=await we(xe(n,{hostname:k.ip,port:k.port},n.aggressiveRedial?r:[],{timeoutMs:Math.min(n.dialConnectMs,Bi),resolvePreferred:!1,skipTargetPolicy:!0,proxyMode:n.aggressiveRedial?n.proxyMode:void 0,relayPool:void 0,pinnedIps:void 0,pinnedRelays:void 0}));if(!X)continue;p=X,Dr(`${S.hostname}:${S.port}`,X,"redial");let wt=X.writable.getWriter();w=wt;let En=0;for(let Fe of N)En+=Fe.byteLength;let xt=new Uint8Array(En),Pn=0;for(let Fe of N)xt.set(Fe,Pn),Pn+=Fe.byteLength;await g.run(async()=>{xt.byteLength>0&&await wt.write(xt),await bn(wt)}),G(`${S.hostname}:${S.port}`,[],__sfx("5bey5YiH5o2i5Y+N5Luj5YWl5Y+jIA==")+k.ip+":"+k.port+""),o?.waitUntil(mn(pe(!0)));return}catch(X){G(`${S.hostname}:${S.port}`,[],__sfx("5Y+N5Luj5YWl5Y+jIA==")+k.ip+":"+k.port+__sfx("IOWksei0pe+8mg==")+String(X)+"")}}h(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5omA5pyJ5Y+N5Luj5YWl5Y+j5Z2H5aSx6LSl"))}finally{y=!1}};a.addEventListener("message",m=>{(async()=>{let S=Fn(m.data),x=S instanceof Promise?await S:S;if(!(!x||x.byteLength===0)){if(v(),hn+=x.byteLength,gn.add(x.byteLength)){yn();return}if(!f){if(l=Hn(l,x),l.byteLength>Hi){h(1009,__sfx("5o+h5omL5aS06LaF6L+HIDY0S0I="));return}await bt();return}if($){$.push(x);return}if(!w){if(Se.bytes+x.byteLength>ji){h(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}if(d.push(x),c+=x.byteLength,Se.bytes+=x.byteLength,c>vr){h(1009,__sfx("5ouo5Y+35pyf6Ze05pWw5o2u6L+H5aSa"));return}return}gt(x),await uo(x)}})()});let Sn=()=>{P()};a.addEventListener("close",Sn),a.addEventListener("error",Sn),l.byteLength>0?bt().catch(m=>h(1011,String(m))):b=setTimeout(()=>{b=null,!(D||f||l.byteLength>0)&&(Ee.firstPacketTimeouts++,h(1008,__sfx("6aaW5YyF6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0")))},Ji);try{let m={status:101,[__sfx("d2ViU29ja2V0")]:s};return u&&(m.headers={[__sfx("U2VjLVdlYlNvY2tldC1Qcm90b2NvbA==")]:u}),new Response(null,m)}catch(m){return console.error(__sfx("W+iHqueglOaVsOaNrumdol0gMTAxIOWTjeW6lOaehOmAoOWksei0pe+8mg=="),m),new Response(null,{status:200})}}var Bi,Hi,vr,Fi,st,ji,Se,at,Pe,Ee,kr,lt,ct,ut,Gi,Ji,Qt=C(()=>{"use strict";vt();Mn();Bn();ke();Xn();Kn();Zt();qt();it();Vt();De();ot();Bi=3e3,Hi=64*1024,vr=8*1024*1024,Fi=32*1024*1024,st=0,ji=32*1024*1024,Se={bytes:0};at=[],Pe=20,Ee={stallRedials:0,eofRedials:0,guardedRedials:0,firstPacketTimeouts:0,downlinkYields:0},kr=Date.now();lt=[];ct=[];ut=[];Gi=2e3,Ji=8e3});var jr={};je(jr,{[__sfx("Y2xlYXJYaHR0cFNlc3Npb25z")]:()=>as,[__sfx("aGFuZGxlWGh0dHA=")]:()=>rn,[__sfx("aXNYaHR0cFBhdGg=")]:()=>nn,[__sfx("cGFyc2VYaHR0cFJvdXRl")]:()=>tn,[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:()=>$i,[__sfx("cmVjb3JkWGh0dHBEaWFnbm9zdGljcw==")]:()=>L});function Qi(e,t){return new Promise(n=>{let r=setTimeout(()=>n(null),t);e.then(o=>{clearTimeout(r),n(o)},()=>{clearTimeout(r),n(null)})})}function L(e,t,n){ft.unshift({at:Date.now(),target:e,...t,summary:n}),ft.length>20&&(ft.length=20)}function $i(){return ft}function es(e){return String(e||"").trim().replace(/\/+$/,"")||"/"}function tn(e,t){let n=es(t??__sfx("L3hodHRw"));if(e===n||e===`${n}/`)return{kind:"stream-one"};let r=`${n}/`;if(!e.startsWith(r))return null;let o=e.slice(r.length);if(!o)return null;let i=o.split("/");if(i.length===1&&i[0])return/[\s\u0000-\u001f]/.test(i[0])?null:{kind:"session",sessionId:i[0]};if(i.length===2&&i[0]&&/^\d+$/.test(i[1])){if(/[\s\u0000-\u001f]/.test(i[0]))return null;let s=Number(i[1]);return!Number.isSafeInteger(s)||s<0||s>1e6?null:{kind:__sfx("cGFja2V0LXVw"),sessionId:i[0],seq:s}}return null}function nn(e,t){return tn(e,t)!==null}function is(e){if(e.reservedBytes<=0){e.reservedBytes=0;return}ge=Math.max(0,ge-e.reservedBytes),e.reservedBytes=0}function ss(e,t){if(t<=0)return;let n=Math.min(t,e.reservedBytes);ge=Math.max(0,ge-n),e.reservedBytes-=n}function Mr(e,t){return t<=0?!0:ge+t>os?!1:(ge+=t,e.reservedBytes+=t,!0)}function as(){for(let[e,t]of Q)j(e,t);Q.clear(),ge=0}function ls(e,t){return t-e.lastUploadAt>$t&&t-e.lastDownlinkAt>$t&&t-e.lastActivityAt>$t}function cs(e,t){return e.closed?!0:e.header||e.dialResult||e.downlinkStarted?!1:t-e.createdAt>Br}function Hr(e,t,n,r){let o=Date.now();for(let[a,l]of Q)(l.closed||ls(l,o)||!l.header&&o-l.createdAt>30*6e4)&&j(a,l);let i=Q.get(e);if(i)return Fr(i,n,o),i;if(Q.size>=Nr){for(let[a,l]of Q)cs(l,o)&&j(a,l);if(Q.size>=Nr)return null}if(!r){let a=0;for(let l of Q.values())l.header||(a+=1);if(a>=ts)return null}let s={id:e,createdAt:o,lastUploadAt:o,lastDownlinkAt:o,lastActivityAt:o,header:void 0,headerWaiters:[],dialPromise:null,dialResult:null,pending:new Map,reservedBytes:0,nextPumpSeq:0,pumpStarted:!1,signalResolve:null,traffic:new he(t),downlinkStarted:!1,closed:!1,targetLabel:""};return Q.set(e,s),s}function Fr(e,t,n){t==="upload"?e.lastUploadAt=n:e.lastDownlinkAt=n,e.lastActivityAt=n}function j(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{}is(t),t.pending.clear(),Q.delete(e)}}function us(e){let t=e.signalResolve;e.signalResolve=null,t?.()}function ds(e,t){return e.header?Promise.resolve(e.header):e.closed?Promise.resolve(null):new Promise(n=>{let r=i=>{clearTimeout(o),n(i)},o=setTimeout(()=>{let i=e.headerWaiters.indexOf(r);i>=0&&e.headerWaiters.splice(i,1),n(null)},t);e.headerWaiters.push(r)})}function fs(e,t){e.header=t;let n=e.headerWaiters;e.headerWaiters=[];for(let r of n)try{r(t)}catch{}}function en(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 ps(){return new Uint8Array([0,0])}async function ms(e,t,n){if(e.dialResult)return e.dialResult;if(!e.dialPromise){let r=e.header;if(!r)throw new Error(__sfx("VkxFU1Mg5aS05pyq5Yiw6L6+"));e.targetLabel=`${r.hostname}:${r.port}`,e.dialPromise=we(xe(t,{hostname:r.hostname,port:r.port},n,{onFailure:o=>{L(e.targetLabel,o,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+o.candidate+"):"+o.message+"")}})).then(o=>(e.dialResult=o,o)).catch(o=>{throw L(e.targetLabel,{kind:"dial",message:String(o),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(o)+""),o})}return await e.dialPromise}async function hs(e,t){let n=t.writable.getWriter();try{for(;!e.closed;){let r=e.pending.get(e.nextPumpSeq);if(r){if(e.pending.delete(e.nextPumpSeq),e.nextPumpSeq+=1,ss(e,r.byteLength),r.byteLength===0)continue;if(e.traffic.add(r.byteLength)){L(e.targetLabel,{kind:"budget",message:__sfx("5rWB6YeP6LaF6ZmQ"),candidate:"traffic"},__sfx("WEhUVFAg5LiK6KGM5rWB6YeP6LaF6ZmQ"));break}try{await n.write(r)}catch(s){L(e.targetLabel,{kind:"relay-write",message:String(s),candidate:t.endpoint},__sfx("WEhUVFAg5YaZ5YWl55uu5qCH5aSx6LSl77ya")+String(s)+"");break}continue}let o=null,i=new Promise(s=>{o=s});if(e.signalResolve=o,e.pending.has(e.nextPumpSeq)||e.closed){e.signalResolve=null;continue}await i}}finally{try{n.releaseLock()}catch{}}}async function gs(e,t,n,r,o){let i=(t.dataBudgetMB||0)*1024*1024,s=Hr(r,i,"upload",o===0);if(!s)return L(r,{kind:"session-limit",message:__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ"),candidate:""},__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ")),null;if(s.closed)return null;let a=o===0&&!s.header,l=Number(e.headers.get("content-length")??""),u=a?rs:ns;if(Number.isFinite(l)&&l>u)return a&&j(r,s),L(r,{kind:"packet-too-large",message:__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ"),candidate:""},__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ")),null;let d;try{let c=await e.arrayBuffer();d=new Uint8Array(c)}catch{return a&&j(r,s),L(r,{kind:"body-read-error",message:__sfx("6K+35rGC5L2T6K+75Y+W5aSx6LSl"),candidate:""},__sfx("6K+35rGC5L2T6K+75Y+W5aSx6LSl")),null}if(d.byteLength>u)return a&&j(r,s),L(r,{kind:"packet-too-large",message:__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ"),candidate:""},__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ")),null;if(a){let c=Ye(d,t.uuid);if(!c)return j(r,s),L(r,{kind:"header-invalid",message:__sfx("5Y2P6K6u5aS06Kej5p6Q5aSx6LSl5oiW6K6k6K+B5pyq6YCa6L+H"),candidate:""},__sfx("5Y2P6K6u5aS06Kej5p6Q5aSx6LSl77yI5ZCr6ZSZ6K+vIFVVSUTvvIk=")),null;let f=ve(c.header);if(f)return j(r,s),L(r,{kind:"header-unsupported",message:f,candidate:""},__sfx("5Y2P6K6u5aS05LiN5pSv5oyB77ya")+f),null;if(c.header.command!==We)return j(r,s),L(r,{kind:"udp-unsupported",message:__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),candidate:""},__sfx("VURQIOWRveS7pOS4jeWPl+aUr+aMgQ==")),null;fs(s,c.header),s.targetLabel=`${c.header.hostname}:${c.header.port}`;let p=d.subarray(c.consumed);if(o>=s.nextPumpSeq&&!s.pending.has(o)){if(s.pending.size>=Or)return j(r,s),L(r,{kind:"pending-full",message:__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),candidate:""},__sfx("5YiG5YyF57yT5a2Y5bey5ruh")),null;if(!Mr(s,p.byteLength))return j(r,s),L(r,{kind:"retain-full",message:__sfx("5pqC5a2Y6LaF6ZmQ"),candidate:""},__sfx("5pqC5a2Y6LaF6ZmQ")),null;s.pending.set(o,p.slice())}}else{if(o<s.nextPumpSeq||s.pending.has(o))return new Response(null,{status:200,headers:en()});if(s.pending.size>=Or)return j(r,s),L(r,{kind:"pending-full",message:__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),candidate:""},__sfx("5YiG5YyF57yT5a2Y5bey5ruh")),null;if(!Mr(s,d.byteLength))return j(r,s),L(r,{kind:"retain-full",message:__sfx("5pqC5a2Y6LaF6ZmQ"),candidate:""},__sfx("5pqC5a2Y6LaF6ZmQ")),null;s.pending.set(o,d.slice())}return us(s),new Response(null,{status:200,headers:en()})}async function ys(e,t,n,r){let o=(t.dataBudgetMB||0)*1024*1024,i=Hr(r,o,"downlink",!1);if(!i)return L(r,{kind:"session-limit",message:__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ"),candidate:""},__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ")),null;if(i.closed||i.downlinkStarted)return null;i.downlinkStarted=!0;let s=ds(i,Br),a=!1,l=null,u=null,d=!1,c=null,f=null,p=()=>{j(r,i)},w=new ReadableStream({start(g){u=g},async pull(g){if(!a)try{if(!d){let y=await s;if(a)return;if(!y){p(),g.close();return}try{g.enqueue(ps())}catch{}d=!0,f=ms(i,t,n),f.then(T=>{c=T,!i.pumpStarted&&(i.pumpStarted=!0,hs(i,T).catch(()=>{}))}).catch(()=>{});return}if(!c){if(!f)return;try{c=await f}catch{L(i.targetLabel||r,{kind:"dial",message:__sfx("ZW5zdXJlRGlhbCDlpLHotKU="),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5LiN5Y+v55So")),p(),g.close();return}}l||(l=c.readable.getReader());let{done:b,value:v}=await l.read();if(a)return;if(b){p();try{g.close()}catch{}return}if(v&&v.byteLength>0){if(Fr(i,"downlink",Date.now()),i.traffic.add(v.byteLength)){L(i.targetLabel,{kind:"budget",message:__sfx("5rWB6YeP6LaF6ZmQ"),candidate:"traffic"},__sfx("WEhUVFAg5LiL6KGM5rWB6YeP6LaF6ZmQ")),p();try{g.close()}catch{}return}g.enqueue(v)}}catch(A){if(a)return;p();try{g.error(A)}catch{}}},cancel(g){if(a=!0,c)try{c.readable.cancel(g)}catch{}p()}});return new Response(w,{status:200,headers:en()})}async function rn(e,t,n){let r=__sfx("L3hodHRw");try{r=new URL(e.url).pathname}catch{r=__sfx("L3hodHRw")}let o=tn(r,t[__sfx("eGh0dHBQYXRo")]);return o?o.kind==="stream-one"?e.method!=="POST"?null:await bs(e,t,n):o.kind===__sfx("cGFja2V0LXVw")?e.method!=="POST"?null:await gs(e,t,n,o.sessionId,o.seq):e.method==="GET"?await ys(e,t,n,o.sessionId):null:null}async function bs(e,t,n){let r=e.body;if(!r)return L("",{kind:"no-body",message:__sfx("57y65bCR6K+35rGC5L2T"),candidate:""},__sfx("57y65bCR6K+35rGC5L2T")),null;let o=new le(r),i=await Qi(kn(o,t.uuid),qi);if(!i)return await o.cancel("header timeout"),L("",{kind:"header-invalid",message:__sfx("5Y2P6K6u5aS06Kej5p6Q5aSx6LSl5oiW6K6k6K+B5pyq6YCa6L+H"),candidate:""},__sfx("5Y2P6K6u5aS06Kej5p6Q5aSx6LSl77yI5ZCr6ZSZ6K+vIFVVSUTvvIk=")),null;let s=ve(i.header);if(s)return await i.payload.cancel("unsupported header"),L(`${i.header.hostname}:${i.header.port}`,{kind:"header-unsupported",message:s,candidate:""},__sfx("5Y2P6K6u5aS05LiN5pSv5oyB77ya")+s),null;if(i.header.command!==We)return await i.payload.cancel("unsupported UDP"),L(`${i.header.hostname}:${i.header.port}`,{kind:"udp-unsupported",message:__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),candidate:""},__sfx("VURQIOWRveS7pOS4jeWPl+aUr+aMgQ==")),null;let a=new Uint8Array([0,0]),l=null,u=we(xe(t,{hostname:i.header.hostname,port:i.header.port},n,{onFailure:y=>{L(`${i.header.hostname}:${i.header.port}`,y,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+y.candidate+"):"+y.message+"")}})).catch(y=>{L(`${i.header.hostname}:${i.header.port}`,{kind:"dial",message:String(y),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(y)+"");try{i.payload.cancel("dial failed").catch(()=>{})}catch{}throw y});u.catch(()=>{});let d=!1,c=null,f=!1,p=new he((t.dataBudgetMB||0)*1024*1024),w=null,g=()=>{if(f)return;f=!0;let y=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+t.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");L(`${i.header.hostname}:${i.header.port}`,{kind:"budget",message:y,candidate:"traffic"},y);let T=l;if(T?.close)try{T.close()}catch{}try{w?.close()}catch{}},A=y=>p.add(y)?(g(),!0):!1,b=y=>{Cr(i.payload,y.writable,void 0,!1,A,(T,I)=>{let D=T instanceof Error?T.message:String(T),_=`relay-${I}`;/cancel|abort|closed/i.test(D)?_=`relay-${I}-client-cancel`:/reset|broken pipe/i.test(D)&&(_=`relay-${I}-upstream-reset`),L(`${i.header.hostname}:${i.header.port}`,{kind:_,message:D.slice(0,200),candidate:y.endpoint},__sfx("WEhUVFAg5Lit57un")+I==="read"?"\u8BFB\u4E0A\u6E38":"\u5199\u76EE\u6807"+__sfx("5aSx6LSl77yI")+_+"):"+D.slice(0,120)+"")}).catch(()=>{})};u.then(y=>{if(l=y,f){try{y.readable.cancel("client cancelled")}catch{}if(y.close)try{y.close()}catch{}return}b(y)}).catch(()=>{});let v=new ReadableStream({start(y){w=y,y.enqueue(a),d=!0},async pull(y){if(f||!d)return;if(!l)try{l=await u}catch{try{y.close()}catch{}return}let T=l;c||(c=T.readable.getReader());try{let{done:I,value:D}=await c.read();if(f)return;if(I){if(T.close)try{T.close()}catch{}y.close();return}if(D&&D.byteLength>0){if(p.add(D.byteLength)){g();return}y.enqueue(D)}}catch(I){if(f)return;let D=l;if(D?.close)try{D.close()}catch{}try{y.error(I)}catch{}}},cancel(y){f=!0;let T=l;try{T?.readable.cancel(y)}catch{}if(T?.close)try{T.close()}catch{}}});return new Response(v,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-store","X-Accel-Buffering":"no"}})}var qi,ft,Q,Br,Nr,ts,$t,ns,rs,Or,os,ge,on=C(()=>{"use strict";ke();vt();it();Zt();qt();qi=2e3;ft=[];Q=new Map,Br=3e4,Nr=100,ts=20,$t=10*6e4,ns=10*1024*1024,rs=256*1024,Or=30,os=32*1024*1024,ge=0});function mt(){return new Response(JSON.stringify({build:sn,version:ws,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var sn,ws,pt,an=C(()=>{"use strict";sn="80c0839-c8ffede2",ws=__sfx("MC41MC4w"),pt=__sfx("L19fY2ZwX3ZlcnNpb24=")});function Xr(e){return e[__sfx("S1Y=")]?new ye(e[__sfx("S1Y=")]):new ln}var ye,ln,Oe=C(()=>{"use strict";ye=class{constructor(t){this.kv=t}kv;async get(t){return await this.kv.get(t)}async put(t,n,r){r&&r>=60?await this.kv.put(t,n,{expirationTtl:r}):await this.kv.put(t,n)}async delete(t){await this.kv.delete(t)}async list(t){let n=[],r;do{let o=await this.kv.list({prefix:t,cursor:r});for(let i of o.keys)n.push(i.name);r=o.list_complete?void 0:o.cursor}while(r);return n}},ln=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,r){let o=r?Date.now()+r*1e3:0;this.data.set(t,{value:n,expiresAt:o})}async delete(t){this.data.delete(t)}async list(t){return[...this.data.keys()].filter(n=>n.startsWith(t))}}});function z(e,t){if(e==null)return t;let n=String(e).trim();if(n==="")return t;let r=Number(n);return Number.isFinite(r)?r:t}function V(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 xs(e,t,n,r){let o=z(e,t);return Number.isFinite(o)?Math.max(n,Math.min(r,Math.round(o))):t}function zr(e){let t=e.trim().toLowerCase();return t==="global"||t==="fallback"||t==="smart"?t:"only"}function Wr(e){return e.trim().toLowerCase()==="signed"?"signed":"legacy"}function Yr(e){return e.trim().toLowerCase()==="doh"?"doh":"off"}function U(e,t){return e==null?t:String(e)}function Ss(e){let t=e.trim();return t?`/${t.replace(/^\/+/,"")}`:E.wsPath}function Es(e){return{uuid:U(e[__sfx("VVVJRA==")],""),[__sfx("dHJvamFuUGFzc3dvcmQ=")]:U(e[__sfx("VFJPSkFOX1BBU1NXT1JE")],""),wsPath:Ss(U(e[__sfx("V1NfUEFUSA==")]||e[__sfx("UEFUSA==")],E.wsPath)),[__sfx("dHJvamFuUGF0aA==")]:E[__sfx("dHJvamFuUGF0aA==")],[__sfx("eGh0dHBQYXRo")]:E[__sfx("eGh0dHBQYXRo")],add:U(e[__sfx("QURE")],""),addApi:U(e[__sfx("QUREQVBJ")],""),addCsv:U(e[__sfx("QUREX0NTVg==")],""),poolOfficial:V(e[__sfx("T0ZGSUNJQUxfSVA=")],E.poolOfficial),officialCount:z(e[__sfx("T0ZGSUNJQUxfSVBfQ09VTlQ=")],E.officialCount),poolDomain:V(e[__sfx("UFJFRkVSUkVEX0RPTUFJTg==")],E.poolDomain),domainCount:z(e[__sfx("UFJFRkVSUkVEX0RPTUFJTl9DT1VOVA==")],E.domainCount),poolManual:V(e[__sfx("TUFOVUFMX0lQ")],E.poolManual),poolCountries:U(e[__sfx("UE9PTF9DT1VOVFJJRVM=")],E.poolCountries),dls:z(e[__sfx("RExT")],0),maxLatency:z(e[__sfx("TUFYX0xBVEVOQ1k=")],0),maxNodes:0,[__sfx("cHJveHlJcA==")]:U(e[__sfx("UFJPWFlJUA==")],""),[__sfx("c29ja3M1")]:U(e[__sfx("U09DS1M1")],""),httpProxy:U(e[__sfx("SFRUUF9QUk9YWQ==")],""),proxyMode:zr(U(e[__sfx("UFJPWFlfTU9ERQ==")],"")),nat64:U(e[__sfx("TkFUNjQ=")],""),concurrentDial:V(e[__sfx("VENQX0NPTkNVUlJFTlRfRElBTA==")],!0),dataBudgetMB:z(e[__sfx("REFUQV9CVURHRVRfTUI=")],E.dataBudgetMB),dialConnectMs:z(e[__sfx("RElBTF9DT05ORUNUX01T")],E.dialConnectMs),dialBudgetMs:z(e[__sfx("RElBTF9CVURHRVRfTVM=")],E.dialBudgetMs),dohBudgetMs:z(e[__sfx("RE9IX0JVREdFVF9NUw==")],E.dohBudgetMs),dialStallMs:z(e[__sfx("RElBTF9TVEFMTF9NUw==")],E.dialStallMs),relayRedialMax:z(e[__sfx("UkVMQVlfUkVESUFMX01BWA==")],E.relayRedialMax),resolvePreferred:V(e[__sfx("UkVTT0xWRV9QUkVGRVJSRUQ=")],E.resolvePreferred),aggressiveRedial:V(e[__sfx("QUdHUkVTU0lWRV9SRURJQUw=")],E.aggressiveRedial),relayPool:U(e[__sfx("UkVMQVlfUE9PTA==")],""),pinnedHosts:U(e[__sfx("UElOTkVEX0hPU1RT")],E.pinnedHosts),useBuiltinRelay:V(e[__sfx("VVNFX0JVSUxUSU5fUkVMQVk=")],E.useBuiltinRelay),[__sfx("ZW5hYmxlVHJvamFu")]:V(e[__sfx("RU5BQkxFX1RST0pBTg==")]??e[__sfx("VFJPSkFO")],E[__sfx("ZW5hYmxlVHJvamFu")]),[__sfx("ZW5hYmxlWGh0dHA=")]:V(e[__sfx("RU5BQkxFX1hIVFRQ")]??e[__sfx("WEhUVFA=")],E[__sfx("ZW5hYmxlWGh0dHA=")]),subDomain:"",subProtocol:"both",subTransport:"both",subVariants:U(e[__sfx("U1VCX1ZBUklBTlRT")],E.subVariants),subName:U(e[__sfx("U1VCX05BTUU=")],E.subName).trim()||E.subName,subPorts:U(e[__sfx("U1VCX1BPUlRT")],E.subPorts),clientFingerprint:E.clientFingerprint,ech:V(e[__sfx("RUNI")],E.ech),echHost:U(e[__sfx("RUNIX0hPU1Q=")],E.echHost),echDns:U(e[__sfx("RUNIX0ROUw==")],E.echDns),tlsFragment:!1,tlsFragmentSize:E.tlsFragmentSize,tlsFragmentDelay:E.tlsFragmentDelay,subToken:Wr(U(e[__sfx("U1VCX1RPS0VOX01PREU=")],"")),subTokenTtlDays:z(e[__sfx("U1VCX1RPS0VOX1RUTF9EQVlT")],E.subTokenTtlDays),unlockProbe:V(e[__sfx("VU5MT0NLX1BST0JF")],E.unlockProbe),udpDns:Yr(U(e[__sfx("VURQX0ROUw==")],"")),udpDnsEndpoint:U(e[__sfx("VURQX0ROU19FTkRQT0lOVA==")],E.udpDnsEndpoint)}}function Ps(e,t){let n=String(t??"").trim();if(!n)return String(e??"");if(!String(e??"").trim())return n;let o=a=>a.trim().toLowerCase(),i=new Set(n.split(/\r?\n/).map(o)),s=String(e).split(/\r?\n/).map(a=>a.trim()).filter(a=>a&&!a.startsWith("#")&&!i.has(o(a)));return s.length>0?[n,...s].join(`
5
- `):n}function As(e,t){let n=String(t??"").trim();if(!n)return String(e??"");if(!String(e??"").trim())return n;let o=a=>a.relay?`relay:${a.host}`:a.host,i=new Set(rt(n).map(o)),s=String(e).split(/\r?\n/).filter(a=>{let l=a.trim();if(!l||l.startsWith("#"))return!1;let u=rt(l);return u.length===0?!1:!u.some(d=>i.has(o(d)))});return s.length>0?[n,...s].join(`
6
- `):n}function Ts(e,t){let n={...e};for(let[r,o]of Object.entries(t))if(o!=null)if(r==="dls"||r==="maxLatency"||r==="maxNodes"||r==="officialCount"||r==="domainCount"||r==="dataBudgetMB"||r==="subTokenTtlDays")n[r]=z(o,0);else if(r==="dialConnectMs"||r==="dialBudgetMs"||r==="dohBudgetMs"||r==="dialStallMs"||r==="relayRedialMax"){let i={dialConnectMs:[1e3,2e4,E.dialConnectMs],dialBudgetMs:[3e3,6e4,E.dialBudgetMs],dohBudgetMs:[200,5e3,E.dohBudgetMs],dialStallMs:[500,15e3,E.dialStallMs],relayRedialMax:[1,8,E.relayRedialMax]},[s,a,l]=i[r];n[r]=xs(o,l,s,a)}else if(r==="concurrentDial"||r==="resolvePreferred"||r==="aggressiveRedial"||r==="useBuiltinRelay"||r===__sfx("ZW5hYmxlVHJvamFu")||r===__sfx("ZW5hYmxlWGh0dHA=")||r==="tlsFragment"||r==="ech"||r==="poolOfficial"||r==="poolDomain"||r==="poolManual"||r==="unlockProbe")n[r]=V(o,!1);else if(r==="proxyMode")n[r]=zr(String(o));else if(r==="subProtocol"){let i=String(o);n[r]=i===__sfx("dmxlc3M=")||i===__sfx("dHJvamFu")||i==="both"?i:"both"}else if(r==="subTransport"){let i=String(o);n[r]=i==="ws"||i===__sfx("eGh0dHA=")||i==="both"?i:"both"}else r==="subToken"?n[r]=Wr(String(o)):r==="pinnedHosts"?n.pinnedHosts=As(E.pinnedHosts,String(o??"")):r==="relayPool"?n.relayPool=Ps(E.relayPool,String(o??"")):r==="udpDns"?n[r]=Yr(String(o)):n[r]=String(o);return n}async function Vr(e,t){let n=Es(t),r=await e.get(Kr),o={};if(r)try{o=JSON.parse(r)}catch{o={}}let i=Ts(n,o),s=!1,a=e instanceof ye,l=Date.now();r?Me=0:Me===0&&(Me=l);let u=l-Me>Rs;return a&&u&&(i.uuid||(i.uuid=St(),s=!0),i[__sfx("dHJvamFuUGFzc3dvcmQ=")]||(i[__sfx("dHJvamFuUGFzc3dvcmQ=")]=St().replace(/-/g,"").slice(0,16),s=!0),Me=0),r&&(i.officialCount<1||i.domainCount<1)&&(i.officialCount<1&&(i.officialCount=E.officialCount,s=!0),i.domainCount<1&&(i.domainCount=E.domainCount,s=!0)),s&&await vs(e,i),i}function Cs(e){let t={...e},n=r=>new Set(E[r].split(`
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 _o=Object.defineProperty;var C=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Ze=(e,t)=>{for(var n in t)_o(e,n,{get:t[n],enumerable:!0})};function et(e){let t=new Uint8Array(e);crypto.getRandomValues(t);let n="";for(let r of t)n+=$e[r>>4]+$e[r&15];return n}function Xt(){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($e[n>>4]+$e[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 Oe(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e.charCodeAt(r)^t.charCodeAt(r);return n===0}function Vn(e,t){return e.length<=t?e:`${e.slice(0,t)}\u2026`}async function Gn(e,t){let n=Number(e.headers.get("content-length")??"");if(Number.isFinite(n)&&n>t)return null;let r=e.body;if(!r)try{let c=await e.arrayBuffer();return c.byteLength>t?null:new Uint8Array(c)}catch{return null}let o=r.getReader(),i=[],s=0;try{for(;;){let{done:c,value:d}=await o.read();if(c)break;if(d){if(s+=d.byteLength,s>t){try{await o.cancel("body too large")}catch{}return null}i.push(d)}}}catch{return null}finally{try{o.releaseLock()}catch{}}let a=new Uint8Array(s),l=0;for(let c of i)a.set(c,l),l+=c.byteLength;return a}var $e,ee=C(()=>{"use strict";$e="0123456789abcdef"});function W(e){let t=Qo.exec(e);if(!t)return!1;for(let n=1;n<=4;n++){let r=Number(t[n]);if(!Number.isInteger(r)||r<0||r>255)return!1}return!0}function pe(e){return!e.includes(":")||!/^[0-9a-fA-F:.]+$/.test(e)?!1:He(e)!==null}function $o(e){return Zo.test(e)&&e.length<=253}function ei(e){return!e||e.length>253||/[\u0000-\u001f\u007f]/.test(e)?!1:W(e)||pe(e)||$o(e)||/^[a-zA-Z0-9_-]+$/.test(e)}function Jn(e,t){if(!ei(e)||!Number.isInteger(t)||t<1||t>65535)throw new Error(__sfx("SW52YWxpZCBDT05ORUNUIGF1dGhvcml0eQ=="))}function He(e){if(!e.includes(":"))return null;let t=e,n=t.lastIndexOf(":"),r=t.slice(n+1);if(r.includes(".")){if(!W(r))return null;let u=r.split(".").map(f=>Number(f));t=`${t.slice(0,n+1)}${(u[0]<<8|u[1]).toString(16)}:${(u[2]<<8|u[3]).toString(16)}`}let o=t.indexOf("::"),i,s;if(o>=0){if(t.indexOf("::",o+1)>=0)return null;let u=t.slice(0,o),f=t.slice(o+2);i=u?u.split(":"):[],s=f?f.split(":"):[]}else i=t.split(":"),s=[];let a=i.length+s.length;if(a>8)return null;let l=[],c=u=>/^[0-9a-fA-F]{1,4}$/.test(u)?parseInt(u,16):null;for(let u of i){let f=c(u);if(f===null)return null;l.push(f)}let d=8-a;for(let u=0;u<d;u++)l.push(0);for(let u of s){let f=c(u);if(f===null)return null;l.push(f)}return l.length===8?l:null}function Fe(e){let t=e.map(l=>(l&65535).toString(16)),n=-1,r=0,o=-1,i=0;for(let l=0;l<t.length;l++)t[l]==="0"?(o<0&&(o=l),i++,i>r&&(r=i,n=o)):(o=-1,i=0);if(r<2)return t.join(":");let s=t.slice(0,n).join(":"),a=t.slice(n+r).join(":");return`${s}::${a}`}function ti(e,t,n,r){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(r?n===2:n===3){if(t+2>e.length)return null;let o=e[t+1];return t+2+o>e.length?null:{hostname:qo.decode(e.subarray(t+2,t+2+o)),next:t+2+o}}if(r?n===3:n===4){if(t+17>e.length)return null;let o=new DataView(e.buffer,e.byteOffset+t+1,16),i=[];for(let s=0;s<8;s++)i.push(o.getUint16(s*2,!1));return{hostname:Fe(i),next:t+17}}return null}async function Vt(e,t){let n=await e.peekExactly(1);if(!n)return null;let r=n[0],o;if(r===1)o=5;else if(t?r===2:r===3){let a=await e.peekExactly(2);if(!a)return null;o=2+a[1]}else if(t?r===3:r===4)o=17;else return null;let i=await e.peekExactly(o);if(!i)return null;let s=ti(i,0,r,t);return s?(e.skip(o),{hostname:s.hostname,addressType:r,consumed:o}):null}var qo,Qo,Zo,te=C(()=>{"use strict";qo=new TextDecoder,Qo=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,Zo=/^[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 Yt(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 r=new Uint8Array(16);for(let o=0;o<16;o++)r[o]=parseInt(n.slice(o*2,o*2+2),16);return Xe.size>=16&&Xe.clear(),Xe.set(e,r),r}function nt(e,t){if(e.byteLength<17)return!1;let n=Yt(t);if(!n)return!1;for(let r=0;r<16;r++)if(e[1+r]!==n[r])return!0;return!1}async function Qn(e,t){let n=await e.readExactly(1);if(!n)return null;let r=await e.readExactly(16);if(!r)return null;let o=Yt(t);if(!o)return null;for(let f=0;f<16;f++)if(r[f]!==o[f])return null;let i=await e.readExactly(1);if(!i)return null;let s=i[0],a=s>0?await e.readExactly(s):new Uint8Array(0);if(!a)return null;let l=await e.readExactly(1);if(!l)return null;let c=await e.readExactly(2);if(!c)return null;let d=await Vt(e,!0);if(!d)return null;let u=c[0]<<8|c[1];return{header:{version:n[0],command:l[0],port:u,hostname:d.hostname,addressType:d.addressType,addons:a},payload:e.release()}}function ii(e){let t=0;for(;t<e.byteLength;){let n=e[t++],r=n>>3,o=n&7;if(o===2){let i=0,s=0,a=0;do{if(t>=e.byteLength)return"";a=e[t++],i|=(a&127)<<s,s+=7}while(a&128);if(t+i>e.byteLength)return"";if(r===1&&i>0)return qn.decode(e.subarray(t,t+i));t+=i}else if(o===0)for(;t<e.byteLength&&(e[t++]&128)!==0;);else return""}return""}function je(e){if(e.version!==ni)return __sfx("VkxFU1Mg54mI5pys5LiN5pSv5oyB77ya")+e.version+"";if(e.command===ri||e.command===oi)return __sfx("VkxFU1MgTXV4L+WPjeWQkeWRveS7pOS4jeaUr+aMge+8muivt+WFs+mXreWuouaIt+err+Wkmui3r+WkjeeUqA==");if(e.command!==tt&&e.command!==Gt)return __sfx("VkxFU1Mg5ZG95Luk5LiN5pSv5oyB77ya")+e.command+"";let t=ii(e.addons);return t?__sfx("VkxFU1MgZmxvdyg=")+t+__sfx("KSDkuI3mlK/mjIHvvJror7flhbPpl63lrqLmiLfnq68gZmxvdw=="):null}function rt(e,t){if(e.byteLength<18)return null;let n=Yt(t);if(!n)return null;for(let c=0;c<16;c++)if(e[1+c]!==n[c])return null;let r=e[17],o=18+r;if(e.byteLength<o+4)return null;let i=e[o];o+=1;let s=e[o]<<8|e[o+1];o+=2;let a=e[o];o+=1;let l="";if(a===1){if(e.byteLength<o+4)return null;l=`${e[o]}.${e[o+1]}.${e[o+2]}.${e[o+3]}`,o+=4}else if(a===2){if(e.byteLength<o+1)return null;let c=e[o];if(o+=1,e.byteLength<o+c)return null;l=qn.decode(e.subarray(o,o+c)),o+=c}else if(a===3){if(e.byteLength<o+16)return null;let c=[];for(let d=0;d<8;d++)c.push(e[o+d*2]<<8|e[o+d*2+1]);l=Fe(c),o+=16}else return null;return{header:{version:e[0],command:i,port:s,hostname:l,addressType:a,addons:e.subarray(18,18+r)},consumed:o}}var ni,tt,Gt,ri,oi,qn,Xe,zt=C(()=>{"use strict";te();ni=0,tt=1,Gt=2,ri=3,oi=4,qn=new TextDecoder,Xe=new Map});function ne(e,t){return e>>>t|e<<32-t}function ai(e){let t=new Uint32Array([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),n=e.length*8,r=Math.ceil((e.length+9)/64)*64,o=new Uint8Array(r);o.set(e),o[e.length]=128;let i=new DataView(o.buffer);i.setUint32(r-8,Math.floor(n/4294967296),!1),i.setUint32(r-4,n>>>0,!1);let s=new Uint32Array(64);for(let l=0;l<r;l+=64){for(let w=0;w<16;w++)s[w]=i.getUint32(l+w*4,!1);for(let w=16;w<64;w++){let v=ne(s[w-15],7)^ne(s[w-15],18)^s[w-15]>>>3,g=ne(s[w-2],17)^ne(s[w-2],19)^s[w-2]>>>10;s[w]=s[w-16]+v+s[w-7]+g>>>0}let c=t[0],d=t[1],u=t[2],f=t[3],p=t[4],S=t[5],h=t[6],b=t[7];for(let w=0;w<64;w++){let v=ne(p,6)^ne(p,11)^ne(p,25),g=p&S^~p&h,R=b+v+g+si[w]+s[w]>>>0,B=ne(c,2)^ne(c,13)^ne(c,22),D=c&d^c&u^d&u,q=B+D>>>0;b=h,h=S,S=p,p=f+R>>>0,f=u,u=d,d=c,c=R+q>>>0}t[0]=t[0]+c>>>0,t[1]=t[1]+d>>>0,t[2]=t[2]+u>>>0,t[3]=t[3]+f>>>0,t[4]=t[4]+p>>>0,t[5]=t[5]+S>>>0,t[6]=t[6]+h>>>0,t[7]=t[7]+b>>>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 $n(e){let t=ai(e),n="";for(let r of t)n+=Zn[r>>4]+Zn[r&15];return n}var si,Zn,er=C(()=>{"use strict";si=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]),Zn="0123456789abcdef"});function nr(e){let t=ot.get(e);if(t!==void 0)return t;let n=$n(li.encode(e));return ot.size>=16&&ot.clear(),ot.set(e,n),n}function rr(e,t){if(e.byteLength<56)return!1;if(!t)return!0;let n=nr(t);return Jt.decode(e.subarray(0,56)).trim().toLowerCase()!==n}function or(e,t){if(e.byteLength<58||!t)return null;let n=nr(t);if(Jt.decode(e.subarray(0,56)).trim().toLowerCase()!==n||e[56]!==13||e[57]!==10)return null;let o=58;if(e.byteLength<o+2)return null;let i=e[o];o+=1;let s=e[o];o+=1;let a="";if(s===1){if(e.byteLength<o+4)return null;a=`${e[o]}.${e[o+1]}.${e[o+2]}.${e[o+3]}`,o+=4}else if(s===3){if(e.byteLength<o+1)return null;let c=e[o];if(o+=1,e.byteLength<o+c)return null;a=Jt.decode(e.subarray(o,o+c)),o+=c}else if(s===4){if(e.byteLength<o+16)return null;let c=[];for(let d=0;d<8;d++)c.push(e[o+d*2]<<8|e[o+d*2+1]);a=Fe(c),o+=16}else return null;if(e.byteLength<o+4)return null;let l=e[o]<<8|e[o+1];return o+=2,e[o]!==13||e[o+1]!==10?null:(o+=2,{header:{command:i,port:l,hostname:a,addressType:s},consumed:o})}var tr,li,Jt,ot,ir=C(()=>{"use strict";te();er();tr=3,li=new TextEncoder,Jt=new TextDecoder,ot=new Map});function ui(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 qt(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 it,sr=C(()=>{"use strict";it=class{constructor(t){this.options=t}options;pending=new Uint8Array(0);waiting=[];inflight=0;dropped=0;closed=!1;controllers=new Set;close(){if(!this.closed){this.closed=!0,this.waiting.length=0,this.pending=new Uint8Array(0);for(let t of this.controllers)try{t.abort()}catch{}this.controllers.clear()}}push(t){if(!(this.closed||t.byteLength===0)){if(this.pending=ui(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(){if(!this.closed)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;this.controllers.add(n);let r=setTimeout(()=>n.abort(),this.options.timeoutMs??5e3);try{let o=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(!o.ok){this.reply(qt(t));return}let i=new Uint8Array(await o.arrayBuffer());if(i.byteLength===0||i.byteLength>65535){this.reply(qt(t));return}this.reply(this.filterAaaa(i))}catch{this.reply(qt(t))}finally{clearTimeout(r),this.controllers.delete(n)}}skipName(t,n){let r=n;for(;r<t.byteLength;){let o=t[r];if(o===0)return r+1;if((o&192)===192)return r+2<=t.byteLength?r+2:-1;if((o&192)!==0||o>63)return-1;r+=1+o}return-1}filterAaaa(t){if(t.byteLength<12)return t;let n=t[4]<<8|t[5],r=t[6]<<8|t[7],o=t[8]<<8|t[9],i=t[10]<<8|t[11];if(n===0&&r===0&&o===0&&i===0)return t;let s=12;for(let f=0;f<n;f++){if(s=this.skipName(t,s),s<0||s+4>t.byteLength)return t;s+=4}let a=new Uint8Array(t.byteLength);a.set(t.subarray(0,s),0);let l=s,c=0,d=[r,o,i],u=[0,0,0];for(let f=0;f<3;f++){let p=d[f];for(let S=0;S<p;S++){let h=s,b=this.skipName(t,s);if(b<0||b+10>t.byteLength)return t;let w=t[b]<<8|t[b+1],v=t[b+8]<<8|t[b+9],g=b+10+v;if(g>t.byteLength)return t;if(w===28)c+=1;else{let R=g-h;a.set(t.subarray(h,g),l),l+=R,u[f]+=1}s=g}}return c===0?t:(a[6]=u[0]>>8&255,a[7]=u[0]&255,a[8]=u[1]>>8&255,a[9]=u[1]&255,a[10]=u[2]>>8&255,a[11]=u[2]&255,a.subarray(0,l))}reply(t){if(this.closed||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 ar(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}function lr(e){if(e==null)return null;if(typeof e=="string")return new TextEncoder().encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){let n=e;return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let t=e;return typeof t.arrayBuffer=="function"?t.arrayBuffer().then(n=>new Uint8Array(n)):null}var me,Fa,ci,st,_e=C(()=>{"use strict";me=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:r}=await this.reader.read();if(n)return this.done=!0,this.size>=t?this.take(t):null;r&&r.byteLength>0&&(this.chunks.push(r),this.size+=r.byteLength)}return this.take(t)}take(t){let n=new Uint8Array(t),r=0;for(;r<t;){let o=this.chunks[0],i=t-r;o.byteLength<=i?(n.set(o,r),r+=o.byteLength,this.chunks.shift()):(n.set(o.subarray(0,i),r),this.chunks[0]=o.subarray(i),r+=i)}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:r}=await this.reader.read();if(n)return this.done=!0,this.size>=t?this.slice(t):null;r&&r.byteLength>0&&(this.chunks.push(r),this.size+=r.byteLength)}return this.slice(t)}skip(t){return this.size<t?null:this.take(t)}slice(t){let n=new Uint8Array(t),r=0;for(let o of this.chunks){if(r>=t)break;let i=Math.min(o.byteLength,t-r);n.set(o.subarray(0,i),r),r+=i}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((o,i)=>o+i.byteLength,0),n=new Uint8Array(t),r=0;for(let o of this.chunks)n.set(o,r),r+=o.byteLength;return n}release(){let t=this.peek();this.chunks=[],this.size=0;let n=this.reader,r=this,o=!1;return new ReadableStream({async pull(i){if(!o&&(o=!0,t.byteLength>0)){i.enqueue(t);return}if(r.done){i.close();return}try{let{done:s,value:a}=await n.read();s?(r.done=!0,i.close()):a&&a.byteLength>0&&i.enqueue(a)}catch(s){i.error(s)}},cancel(i){n.cancel(i)}})}};Fa=4*1024*1024,ci=4*1024*1024,st=class{constructor(t=ci,n=()=>new Promise(r=>{setTimeout(r,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 ur(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=")}:di.includes(e.port)?{allowed:!0,reason:__sfx("55u06L+e5Ye65Y+j5LiU56uv5Y+j6YCC55So")}:{allowed:!1,reason:__sfx("55uu5qCH56uv5Y+jIA==")+e.port+__sfx("IOS4jeaUr+aMgeWPjeS7oyBTTkkg6L2s5Y+R")}}var di,cr=C(()=>{"use strict";di=[443,80]});var at,dr=C(()=>{"use strict";at=class{tail=Promise.resolve();queuedBytes=0;overflowed=!1;maxQueuedBytes;onOverflow;constructor(t={}){this.maxQueuedBytes=t.maxQueuedBytes??8388608,this.onOverflow=t.onOverflow}run(t){let n=this.tail.then(t);return this.tail=n.catch(()=>{}),n}write(t,n){if(this.overflowed)return Promise.resolve();let r=n.byteLength;return this.maxQueuedBytes>0&&this.queuedBytes+r>this.maxQueuedBytes?(this.overflowed=!0,this.onOverflow?.(this.queuedBytes+r),Promise.resolve()):(this.queuedBytes+=r,this.run(async()=>{try{let o=t();if(!o)return;await o.write(n)}finally{this.queuedBytes=Math.max(0,this.queuedBytes-r)}}))}get queuedByteCount(){return this.queuedBytes}}});function hi(e){for(let[t,n]of ae)n.cooldownUntil>0&&n.cooldownUntil<=e&&ae.delete(t);for(;ae.size>=mi;){let t=ae.keys().next().value;if(t===void 0)break;ae.delete(t)}}function Qt(e){return`${e.kind}://${e.host}:${e.port}`}function gi(e,t){let n=ae.get(Qt(e));return n!==void 0&&n.cooldownUntil>t}function pr(e,t){let n=Qt(e);hi(t);let r=ae.get(n)??{fails:0,cooldownUntil:0};if(r.fails+=1,r.fails>=fr){let o=r.fails-fr,i=Math.min(pi,fi*2**o);r.cooldownUntil=t+i}ae.set(n,r)}function mr(e){ae.delete(Qt(e))}function Zt(e,t,n){if(e.length<=1)return e;let r=e.filter(o=>{let i=t(o);return i===void 0||!gi(i,n)});return r.length>0?r:e}var le,fr,fi,pi,mi,ae,lt=C(()=>{"use strict";le=class extends Error{},fr=2,fi=3e4,pi=5*6e4,mi=256,ae=new Map});async function he(e,t,n,r){let o=Date.now()+n,i=null;try{let s=await Promise.race([e.readExactly(t),new Promise(a=>{i=setTimeout(()=>a(null),Math.max(1,o-Date.now()))})]);if(s===null)throw new Error(""+r+__sfx("6LaF5pe277yI")+n+__sfx("bXMg5peg5ZON5bqU77yJ"));return s}finally{i&&clearTimeout(i)}}async function hr(e,t,n,r,o={}){let i=new me(e),s=t.getWriter(),a=o.handshakeTimeoutMs??yi,l=async c=>{await s.write(c)};try{let c=[0];o.username&&c.push(2);let d=new Uint8Array(2+c.length);d[0]=5,d[1]=c.length,d.set(c,2),await l(d);let u=await he(i,2,a,__sfx("U09DS1M1IOaPoeaJiw=="));if(!u||u[0]!==5)throw new Error(__sfx("U09DS1M1IOaPoeaJi+Wksei0pe+8mumdnuazleWTjeW6lA=="));let f=u[1];if(f===2){let w=new TextEncoder().encode(o.username??""),v=new TextEncoder().encode(o.password??""),g=new Uint8Array(3+w.length+v.length);g[0]=1,g[1]=w.length,g.set(w,2),g[2+w.length]=v.length,g.set(v,3+w.length),await l(g);let R=await he(i,2,a,__sfx("U09DS1M1IOiupOivgQ=="));if(!R||R[1]!==0)throw new Error(__sfx("U09DS1M1IOeUqOaIt+WQjS/lr4bnoIHorqTor4HlpLHotKU="))}else if(f!==0)throw new Error(__sfx("U09DS1M1IOS4jeaUr+aMgeeahOiupOivgeaWueW8j++8mjB4")+f.toString(16)+"");let p=bi(n,r),S=new Uint8Array(3+p.length);S[0]=5,S[1]=1,S[2]=0,S.set(p,3),await l(S);let h=await he(i,4,a,__sfx("U09DS1M1IENPTk5FQ1Q="));if(!h||h[0]!==5)throw new Error(__sfx("U09DS1M1IENPTk5FQ1Qg5ZON5bqU6Z2e5rOV"));if(h[1]!==0)throw new le(__sfx("U09DS1M1IENPTk5FQ1Qg5aSx6LSl77yaMHg=")+h[1].toString(16)+"");let b=h[3];if(b===1)await he(i,4,a,__sfx("U09DS1M1IOWTjeW6lA=="));else if(b===3){let w=await he(i,1,a,__sfx("U09DS1M1IOWTjeW6lA=="));if(!w)throw new Error(__sfx("U09DS1M1IOWTjeW6lOaIquaWrQ=="));await he(i,w[0],a,__sfx("U09DS1M1IOWTjeW6lA=="))}else if(b===4)await he(i,16,a,__sfx("U09DS1M1IOWTjeW6lA=="));else throw new Error(__sfx("U09DS1M1IOWTjeW6lOWcsOWdgOexu+Wei+mdnuazlQ=="));return await he(i,2,a,__sfx("U09DS1M1IOWTjeW6lA==")),i.release()}finally{try{s.releaseLock()}catch{}}}function bi(e,t){let n=e.replace(/^\[|\]$/g,"");if(W(n)){let i=n.split(".").map(a=>Number(a)),s=new Uint8Array(7);return s[0]=1,s.set(i,1),s[5]=t>>8&255,s[6]=t&255,s}if(pe(n)){let i=He(n),s=new Uint8Array(19);if(s[0]=4,i)for(let a=0;a<8;a++){let l=i[a]??0;s[1+a*2]=l>>8&255,s[2+a*2]=l&255}return s[17]=t>>8&255,s[18]=t&255,s}let r=new TextEncoder().encode(n),o=new Uint8Array(2+r.length+2);return o[0]=3,o[1]=r.length,o.set(r,2),o[o.length-2]=t>>8&255,o[o.length-1]=t&255,o}var yi,gr=C(()=>{"use strict";_e();te();lt();yi=6e3});function xi(e){let t=e.byteLength;for(let n=0;n+3<t;n++)if(wi.every((r,o)=>e[n+o]===r))return n;return-1}async function yr(e,t,n,r,o={},i=$t){Jn(n,r);let s=new me(e),a=t.getWriter(),l=n.includes(":")?`[${n}]:${r}`:`${n}:${r}`;try{let c=o.username&&o.password?__sfx("UHJveHktQXV0aG9yaXphdGlvbjogQmFzaWMg")+btoa(`${o.username}:${o.password}`)+"\r\n":"",d=[__sfx("Q09OTkVDVCA=")+l+" HTTP/1.1",`Host: ${l}`,__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",c,"",""].join(`\r
2
+ `);await a.write(new TextEncoder().encode(d));let u=Date.now()+i,f="";for(;;){let b=s.peek(),w=xi(b);if(w>=0){f=new TextDecoder().decode(b.subarray(0,w)),s.skip(w+4);break}if(b.byteLength>8192)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTlpLTotoXov4cgODE5MiDlrZfoioI="));let v=u-Date.now();if(v<=0)throw new Error(__sfx("SFRUUCDku6PnkIbmj6HmiYvotoXml7bvvIg=")+i+__sfx("bXMg5peg5ZON5bqU77yJ"));let g=null,R;try{R=await Promise.race([s.fill(),new Promise(B=>{g=setTimeout(()=>B("timeout"),v)})])}finally{g&&clearTimeout(g)}if(R==="timeout")throw new Error(__sfx("SFRUUCDku6PnkIbmj6HmiYvotoXml7bvvIg=")+i+__sfx("bXMg5peg5ZON5bqU77yJ"));if(R===null)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTkuI3lrozmlbTvvIjov57mjqXooqvmj5DliY3lhbPpl63vvIk="))}let S=f.split(`\r
3
+ `)[0]??"",h=/^HTTP\/1\.[01]\s+(\d{3})/.exec(S);if(!h)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTpnZ7ms5U="));if(h[1]!=="200")throw new le(__sfx("SFRUUCDku6PnkIYgQ09OTkVDVCDlpLHotKXvvJo=")+h[1]+"");return s.release()}finally{try{a.releaseLock()}catch{}}}var wi,$t,br=C(()=>{"use strict";te();_e();lt();wi=[13,10,13,10];$t=6e3});function tn(e){if(e instanceof Se||(e instanceof Error?e.message:String(e)).includes(wr))return!0;let n=e instanceof Error?e.cause:void 0;return n!==void 0&&n!==e&&tn(n)}function ve(e){let t=e.split(".");if(t.length!==4)return null;let n=0;for(let r of t){if(!/^\d{1,3}$/.test(r))return null;let o=Number(r);if(o>255)return null;n=n*256+o}return n>>>0}function ut(e){let t=ve(e);if(t===null)return null;for(let[n,r,o,i]of Si){let s=ve(n);if(s===null)continue;let a=r===0?0:4294967295<<32-r>>>0;if((t&a)===(s&a))return{kind:o,reason:i}}return null}function en(e){let t=e[6]??0,n=e[7]??0;return`${t>>>8}.${t&255}.${n>>>8}.${n&255}`}function Ei(e){let t=(e.split("%")[0]??"").toLowerCase();if(!t.includes(":"))return null;let n=He(t);if(!n)return null;let r=n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0&&n[4]===0;if(r&&n[5]===65535)return ut(en(n))??null;if(r&&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(r&&n[5]===0)return ut(en(n))??null;if(n[0]===100&&n[1]===65435&&n[2]===0&&n[3]===0&&n[4]===0&&n[5]===0){let i=ut(en(n));if(i)return i}let o=n[0]??0;return(o&65024)===64512?{kind:"ula",reason:__sfx("SVB2NiDllK/kuIDmnKzlnLDlnLDlnYA=")}:(o&65472)===65152?{kind:"link-local",reason:__sfx("SVB2NiDpk77ot6/mnKzlnLDlnLDlnYA=")}:(o&65280)===65280?{kind:"multicast",reason:__sfx("SVB2NiDnu4Tmkq3lnLDlnYA=")}:null}function nn(e){let t=e.trim().toLowerCase().replace(/^\[|\]$/g,"");if(t==="")return null;if(t.includes(":"))return Ei(t);if(/^\d{1,3}(?:\.\d{1,3}){3}$/.test(t))return ut(t);if(t==="localhost"||t.endsWith(".localhost"))return{kind:"loopback",reason:__sfx("546v5Zue5Li75py65ZCN")};for(let n of Pi)if(t.endsWith(n))return{kind:"internal-name",reason:__sfx("5YaF572R5Z+f5ZCN5ZCO57yA")};return null}var wr,xr,Se,Si,Pi,rn=C(()=>{"use strict";te();wr=__sfx("55uu5qCH5Zyw5Z2A6KKr562W55Wl5oum5oiq"),xr={kind:"ipv6-direct-unsupported",reason:__sfx("55u06L+e5LiO5Y+N5Luj6YCa6YGT5LiN5pSv5oyBIElQdjYg55uu5qCH77yM5Y+v5pS555So6JC95Zyw5Luj55CG6L2s5Y+R")},Se=class extends Error{kind;constructor(t,n){super(`${wr}\uFF1A${t}\uFF08${n.reason}\uFF09`),this.name="TargetBlockedError",this.kind=n.kind}};Si=[[__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")]];Pi=[".local",".internal"]});function Pr(e){return e.ips.length>0?Ai:Ti}function Ci(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)?!0:e.includes(":")&&/^[0-9a-fA-F:.]+$/.test(e)}function an(e,t){let n=e.trim(),r=/^\[([^\]]+)\](?::(\d+))?$/.exec(n);if(r)return{host:r[1],port:Number(r[2]??t)};if(n.includes(":")&&n.split(":").length>2)return{host:n,port:t};let o=n.lastIndexOf(":");if(o<0)return{host:n,port:t};let i=n.slice(0,o),s=Number(n.slice(o+1));return i?{host:i,port:Number.isInteger(s)&&s>0?s:t}:{host:n,port:t}}async function Ar(e,t,n,r=sn){try{let o=`${e}?name=${encodeURIComponent(t)}&type=${n}`,i=await fetch(o,{headers:{accept:"application/dns-json"},signal:AbortSignal.timeout(r)});if(!i.ok)return null;let s=await i.json();if(!s||s.Status!==0&&s.Status!==3)return null;if(!Array.isArray(s.Answer))return[];let a=n==="TXT"?16:n==="A"?1:28;return s.Answer.filter(l=>l.type===a).map(l=>String(l.data))}catch{return null}}async function Tr(e,t,n={}){for(let r of Er){if(n.deadline!==void 0&&Date.now()>=n.deadline)break;let o=n.timeoutMs??sn,i=n.deadline!==void 0?n.deadline-Date.now():Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")],s=Math.max(50,Math.min(o,i)),a=await Ar(r,e,t,s);if(a!==null)return{records:a,authoritative:!0}}return{records:[],authoritative:!1}}async function vi(e,t){if(t.deadline!==void 0&&Date.now()>=t.deadline)return{records:[],authoritative:!1};let n=Er.slice(0,2),r=t.timeoutMs??sn,o=t.deadline!==void 0?t.deadline-Date.now():Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")],i=Math.max(50,Math.min(r,o)),s=await Promise.all(n.map(d=>Ar(d,e,"A",i))),a=[],l=new Set,c=!1;for(let d of s)if(d!==null){c=!0;for(let u of d)l.has(u)||(l.add(u),a.push(u))}return c?{records:a,authoritative:!0}:await Tr(e,"A",t)}function ki(e,t){let n=[],r=String(e).replace(/^"|"$/g,"").replace(/\\010/g,",").replace(/\\n/g,",").trim();if(!r||r===Sr)return n;let o=r.split(/[,;\s]+/).filter(Boolean);if(o.length===0)return n;for(let i of o){let s=i.trim();if(!s)continue;let{host:a,port:l}=an(s,t);if(!W(a)&&!pe(a))return[];n.push({hostname:a,port:l})}return n}async function ct(e,t,n={}){let r=e.trim();if(!r)return[];if(Ci(r))return[{hostname:r,port:t}];let o=`${r}:${t}`,i=ue.get(o);if(i&&Date.now()-i.at<Pr(i))return ue.delete(o),ue.set(o,i),i.ips;let s=on.get(o);if(s)return s;let a=Di(r,t,o,n).finally(()=>{on.delete(o)});return on.set(o,a),a}async function Di(e,t,n,r){let o=[],[i,s]=await Promise.all([r.skipTxt?Promise.resolve({records:[],authoritative:!1}):Tr(e,"TXT",r),vi(e,r)]),a=i.records,l=s.records;if(!r.skipTxt)for(let u of a){let f=ki(u,t);if(f.length>0){o.push(...f);break}if(String(u).replace(/^"|"$/g,"").replace(/\\010/g,",").trim()===Sr)break}if(o.length===0)for(let u of l)W(u)&&o.push({hostname:u,port:t});let c=[],d=new Set;for(let u of o){let f=`${u.hostname}:${u.port}`;d.has(f)||(d.add(f),c.push(u))}if(c.length>0||s.authoritative){let u=Date.now();for(let[f,p]of ue)u-p.at>=Pr(p)&&ue.delete(f);for(;ue.size>=Ri;){let f=ue.keys().next().value;if(f===void 0)break;ue.delete(f)}ue.set(n,{at:u,ips:c})}return c}var Sr,Er,sn,Ai,Ti,Ri,ue,on,dt=C(()=>{"use strict";te();Sr=__sfx("QGVkZ2V0dW5uZWw="),Er=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve","https://dns.alidns.com/resolve","https://doh.pub/dns-query"],sn=4e3,Ai=300*1e3,Ti=30*1e3,Ri=1e3,ue=new Map,on=new Map});function Rr(e){return e.map(([t,n])=>{let r=ve(t)??0,o=n===0?0:4294967295<<32-n>>>0;return[(r&o)>>>0,o]})}function Cr(e){let t=ve(e);if(t===null)return!1;for(let[n,r]of Oi)if((t&r)>>>0===n)return!0;return!1}function re(e){let t=ve(e);if(t===null)return!1;for(let[n,r]of Ni)if((t&r)>>>0===n)return!0;return!1}function vr(e){let t=[],n=new Set,r=u=>{let f=`${u.source}|${u.host}|${u.port}`;n.has(f)||(n.add(f),t.push(u))};for(let u of e.proxies??[])u.kind==="direct"?r({source:"proxy",host:u.host,port:u.port,label:__sfx("UHJveHlJUCA=")+u.host+":"+u.port+"",via:{kind:"direct",host:u.host,port:u.port}}):r({source:"proxy",host:u.host,port:u.port,label:`${u.kind.toUpperCase()} ${u.host}:${u.port}`,via:{kind:u.kind,host:u.host,port:u.port,username:u.username,password:u.password,serverName:u.serverName}});let o=re(e.targetHost),i=e.optimizedIps??[],s=i.filter(u=>!re(u.ip)),a=i.filter(u=>re(u.ip)),l=s.length>0&&a.length>0,c=o||e.deprioritizeDirect===!0||l;r({source:"direct",host:e.targetHost,port:e.targetPort,label:__sfx("55u06L+eIA==")+e.targetHost+":"+e.targetPort+"",deprioritized:c});for(let u of s)r({source:"optimized",host:u.ip,port:u.port,label:__sfx("5LyY6YCJIA==")+u.ip+":"+u.port+""});for(let u of a)r({source:"optimized",host:u.ip,port:u.port,label:__sfx("5LyY6YCJIA==")+u.ip+":"+u.port+__sfx("77yIQ2xvdWRmbGFyZSDnvZHmrrXvvIzlj6/og73kuI3lj6/ovr7vvIk="),deprioritized:!0});let d=e.relay??[];for(let u of d)r({source:"relay",host:u.ip,port:u.port,label:__sfx("5Y+N5LujIA==")+u.label+"",deprioritized:!0});return t.map((u,f)=>({candidate:u,index:f})).sort((u,f)=>{let p=+!!u.candidate.deprioritized-+!!f.candidate.deprioritized;return p!==0?p:u.index-f.index}).map(u=>u.candidate)}function kr(e){let t=e.filter(r=>!r.deprioritized),n=t.filter(r=>r.source==="proxy");return{landing:n.filter(r=>r.via?.kind!=="direct"),[__sfx("cHJveHlJcA==")]:n.filter(r=>r.via?.kind==="direct"),direct:t.filter(r=>r.source!=="proxy"),fallback:e.filter(r=>r.deprioritized)}}function Dr(e,t){let n=e instanceof Error?e.message:String(e);return tn(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 Ur(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 Ui,Li,Ii,Mi,Ni,Oi,ft=C(()=>{"use strict";rn();Ui=[[__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]],Li=[[__sfx("MTA0LjMxLjAuMA=="),15],[__sfx("MTkyLjAuMC4w"),24],[__sfx("MTkyLjAuMi4w"),24],[__sfx("MTkyLjg4Ljk5LjA="),24],[__sfx("MTk5LjI3LjEyOC4w"),21],[__sfx("MS4wLjAuMA=="),24],[__sfx("MS4xLjEuMA=="),24]],Ii=[[__sfx("MjIzLjUuNS4w"),24]],Mi=[...Ui,...Li];Ni=Rr(Mi),Oi=Rr(Ii)});var fn={};Ze(fn,{[__sfx("QlVJTFRJTl9SRUxBWV9ET01BSU5T")]:()=>un,[__sfx("Q09MT19UT19DT1VOVFJZ")]:()=>Nr,[__sfx("UkVMQVlfQkFUQ0hfU0laRQ==")]:()=>_i,[__sfx("UkVMQVlfRE9NQUlOX0xJTUlU")]:()=>cn,clearRelayCache:()=>Vi,collectRelayEndpoints:()=>Ke,coloToCountry:()=>ji,fetchDynamicRelayFeed:()=>Mr,parseRelayFeedText:()=>Ir,relayCacheSize:()=>Gi,resolveRelayEntry:()=>ln,selectRelayDomains:()=>Hr,stableRelayIndex:()=>dn});function Ir(e){let t=[],n=new Set;for(let r of String(e??"").split(`
4
+ `)){let o=r.split("#")[0].trim();if(!o)continue;let i=o,s=443,a=o.indexOf(":");if(a>0&&o.indexOf(":",a+1)<0){i=o.slice(0,a).trim();let c=Number(o.slice(a+1).trim());if(!Number.isInteger(c)||c<=0||c>65535)continue;s=c}if(!W(i)||re(i))continue;let l=`${i}:${s}`;if(!n.has(l)&&(n.add(l),t.push({ip:i,port:s,label:`feed ${l}`}),t.length>=Xi))break}return t}async function Mr(e=Bi,t){if(!e)return[];let n=Date.now();if(oe){let o=oe.failed?Fi:Hi;if(n-oe.at<o)return oe.ips}if(ke)return await ke;let r=t===void 0?Lr:Math.min(Lr,t-n);return r<300?oe?.ips??[]:(ke=(async()=>{try{let o=await fetch(e,{signal:AbortSignal.timeout(r),headers:{accept:"text/plain"}});if(!o.ok)throw new Error(`HTTP ${o.status}`);let i=Ir(await o.text());if(i.length===0)throw new Error("empty feed");return oe={at:Date.now(),ips:i,failed:!1},i}catch{return oe={at:Date.now(),ips:oe?.ips??[],failed:!0},oe.ips}finally{ke=null}})(),await ke)}function ji(e){let t=String(e??"").toUpperCase();return t?Nr[t]??(/^[A-Z]{2}$/.test(t)?t:"US"):"US"}function Wi(e){for(let[t,n]of ce)e-n.at>=Br&&ce.delete(t);for(;ce.size>=Ki;){let t=ce.keys().next().value;if(t===void 0)break;ce.delete(t)}}async function ln(e,t=443,n=Or,r={}){let o=e.trim();if(!o)return[];let i=`${o}:${t}:${n}`,s=ce.get(i);if(s&&Date.now()-s.at<Br)return s.ips;let a=o,l=t,c=(o.match(/:/g)??[]).length;if(c===1){let u=/^(.*):(\d{1,5})$/.exec(o);u&&(a=u[1],l=Number(u[2]))}else if(c>1&&o.startsWith("[")){let u=/^\[([^\]]+)\]:(\d{1,5})$/.exec(o);u&&(a=u[1],l=Number(u[2]))}let d=[];if(W(a)||pe(a))d=[{ip:a,port:Number.isInteger(l)&&l>0?l:t,label:o}];else try{d=(await ct(a,l,{skipTxt:r.skipTxt,deadline:r.deadline,timeoutMs:r.timeoutMs})).slice(0,n).map(f=>({ip:f.hostname,port:f.port,label:`${a} \u2192 ${f.hostname}`}))}catch{d=[]}if(d.length>0){let u=Date.now();Wi(u),ce.set(i,{at:u,ips:d})}return d}function Hr(e=cn,t=un){return t.slice(0,Math.max(0,e))}function dn(e,t){if(t<=0)return 0;let n=(e||"").toLowerCase(),r=2166136261;for(let o=0;o<n.length;o++)r^=n.charCodeAt(o),r=Math.imul(r,16777619);return(r>>>0)%t}async function Ke(e={}){let t=e.perDomain??Or,n=[],r=new Set,o=h=>{for(let b of h){let w=`${b.ip}:${b.port}`;r.has(w)||(r.add(w),n.push(b))}},i=(e.userEntries??"").trim(),s=i?i.split(/[\n,;]+/).map(h=>h.trim()).filter(Boolean):[],a=e.useBuiltin!==!1,l=e.domainLimit??cn,c=a?Hr(l):[],d=a&&e.useRemoteFeed!==!1,[u,f]=await Promise.all([Promise.all([...s.map(h=>ln(h,443,t,{deadline:e.deadline,timeoutMs:e.timeoutMs})),...c.map(h=>ln(h,443,t,{skipTxt:!0,deadline:e.deadline,timeoutMs:e.timeoutMs}))]),d?Mr(e.feedUrl,e.deadline):Promise.resolve([])]);for(let h=0;h<s.length;h++)o(u[h]);f.length>0&&o(f);let p=u.slice(s.length),S=p.reduce((h,b)=>Math.max(h,b.length),0);for(let h=0;h<S;h++)for(let b of p)h<b.length&&o([b[h]]);return n}function Vi(){ce.clear(),oe=null,ke=null}function Gi(){return ce.size}var un,Bi,Hi,Fi,Lr,Xi,oe,ke,Nr,Or,_i,cn,Br,Ki,ce,We=C(()=>{"use strict";te();dt();ft();un=[__sfx("MjE2LjM2LjgyLjEx"),__sfx("MTM3LjE4NC4yMjguODU="),__sfx("MjE2LjE2Ny4xNi4xMTI="),__sfx("MTI4LjEyMS4zMS4yNTI="),__sfx("MjMuMTQ0LjIwLjE4NA=="),__sfx("MzguODQuMjAxLjIyOA=="),__sfx("MTU1LjI0OC4xODEuMTg5"),__sfx("MzguMjQ0LjE1MC4xMTM="),__sfx("NjQuMTgxLjI1NS4yMTU=")],Bi=["https://cdn.jsdelivr.net/gh/","xmwengxing/",__sfx("Q0ZQaWxvdA=="),"@main/data/relay-ips.txt"].join(""),Hi=1800*1e3,Fi=300*1e3,Lr=2500,Xi=32,oe=null,ke=null;Nr={[__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"};Or=4,_i=6,cn=un.length,Br=30*1e3,Ki=256,ce=new Map});function V(e,t,n){return`${e}|${t}:${n}`}function ye(e,t){let n=de.get(e);return n!==void 0&&n.cooldownUntil>t}function Qi(e){for(let[t,n]of de){let r=n.cooldownUntil>0&&n.cooldownUntil<=e,o=e-n.lastFailAt>=Ji;(r||o)&&de.delete(t)}for(;de.size>=qi;){let t=de.keys().next().value;if(t===void 0)break;de.delete(t)}}function pt(e,t,n){if(n)return;Qi(t);let r=de.get(e)??{fails:0,cooldownUntil:0,lastFailAt:0};if(r.fails+=1,r.lastFailAt=t,r.fails>=Fr){let o=r.fails-Fr;r.cooldownUntil=t+Math.min(zi,Yi*2**o)}de.set(e,r)}function mt(e){de.delete(e)}function Ve(e,t,n){let r=[...e];return r.sort((o,i)=>{let s=ye(t(o),n)?1:0,a=ye(t(i),n)?1:0;return s-a}),r}function ht(e){let t=String(e??"").lastIndexOf(":");if(t<=0)return;let n=e.slice(0,t).replace(/^\[/,"").replace(/\]$/,""),r=Number(e.slice(t+1));if(!(!n||!Number.isFinite(r)||r<=0))return{ip:n,port:r}}function De(e,t,n){let r=String(e??"").trim().toLowerCase();if(!(!r||!t||!n))for(ge.delete(r),ge.set(r,{ip:t,port:n});ge.size>Zi;){let o=ge.keys().next().value;if(o===void 0)break;ge.delete(o)}}function Xr(e){let t=String(e??"").trim().toLowerCase();return t?ge.get(t):void 0}function gt(e,t,n=!0){let r=ht(t);if(!r)return;let o=String(e??"").trim().toLowerCase(),i=o?ge.get(o):void 0;i&&i.ip===r.ip&&i.port===r.port&&ge.delete(o);let s=V("relay",r.ip,r.port),a=Date.now();pt(s,a,!1),n&&pt(s,a,!1)}function pn(e,t){let n=ht(t);n&&(De(e,n.ip,n.port),mt(V("relay",n.ip,n.port)))}var Fr,Yi,zi,Ji,qi,de,ge,Zi,mn=C(()=>{"use strict";Fr=2,Yi=3e4,zi=5*6e4,Ji=10*6e4,qi=256,de=new Map;ge=new Map,Zi=128});function jr(e,t="direct"){let n=e.trim();if(!n)return null;let r=t,o=n,i=/^([a-z0-9+.-]+):\/\//i.exec(n);if(i){let f=i[1].toLowerCase();o=n.slice(i[0].length),f===__sfx("c29ja3M1")||f===__sfx("c29ja3M=")||f===__sfx("c29ja3M1aA==")?r=__sfx("c29ja3M1"):f==="https"?r="https":f==="http"&&(r="http")}let s=o.lastIndexOf("@"),a={};if(s>=0){let f=o.slice(0,s);o=o.slice(s+1);let p=f.indexOf(":");p>=0?a={username:f.slice(0,p),password:f.slice(p+1)}:a={username:f}}let l,c=/#sni=([^/#]+)/i.exec(o);c&&(l=c[1].trim(),o=o.slice(0,c.index)+o.slice(c.index+c[0].length));let{host:d,port:u}=an(o,0);return!d||!Number.isInteger(u)||u<=0||u>65535?null:(!l&&r==="https"&&!$i(d)&&(l=d),{host:d,port:u,kind:r,...a,...l?{serverName:l}:{}})}function $i(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)}function Ge(e,t="direct"){let n=[];for(let r of e.split(/[\n,;]+/)){let o=r.trim();if(!o)continue;let i=jr(o,t);i&&n.push(i)}return n}var hn=C(()=>{"use strict";dt()});async function es(){return gn||(gn=(async()=>(await import("cloudflare:sockets")).connect)()),await gn}function rs(e,t){if(!W(e))return null;let n=e.split(".").map(s=>Number(s)),r=(n[0]<<8|n[1]).toString(16),o=(n[2]<<8|n[3]).toString(16);return`${t.replace(/:+$/,"")}::${r}:${o}`}async function bt(e,t,n,r,o,i){let a=(await es())({hostname:e,port:t},r?{secureTransport:r,...o?{expectedServerHostname:o}:{}}:void 0),l=async(d,u)=>{let f=i===void 0?n:Math.max(0,Math.min(n,i-Date.now()));if(f<=0)throw new Ue(__sfx("5ouo5Y+36aKE566X5bey55So5bC977ya")+e+":"+t+"");let p,S=new Promise((h,b)=>{p=setTimeout(()=>b(new Error(""+u+__sfx("6LaF5pe277ya")+e+":"+t+"")),f)});try{return await Promise.race([d,S])}finally{p&&clearTimeout(p)}},c;try{if(await l(a.opened,__sfx("6L+e5o6l")),r==="starttls"){if(c=a.startTls?.(o?{expectedServerHostname:o}:void 0),!c)throw new Error(__sfx("5b2T5YmN6L+Q6KGM5pe25LiN5pSv5oyBIHN0YXJ0VGxz"));return await l(c.opened,__sfx("VExTIOaPoeaJiw==")),c}return a}catch(d){try{Promise.resolve((c??a).close()).catch(()=>{})}catch{}throw d}}async function os(e){let t=e.timeoutMs??yt,n=e.deadline;try{let r=await bt(e.hostname,e.port,t,void 0,void 0,n);return{readable:r.readable,writable:r.writable,via:"direct",endpoint:`${e.hostname}:${e.port}`,close:()=>{try{r.close()}catch{}}}}catch(r){if(e.nat64&&W(e.hostname)){let o=rs(e.hostname,e.nat64);if(o){let i=await bt(o,e.port,t,void 0,void 0,n);return{readable:i.readable,writable:i.writable,via:"nat64",endpoint:`${o}:${e.port}`,close:()=>{try{i.close()}catch{}}}}}throw r}}function is(e){return e.includes(":")}function ss(e){return e.source==="proxy"&&e.via!==void 0&&e.via.kind!=="direct"}async function as(e,t){let n=e.timeoutMs??yt,r=()=>e.deadline===void 0?n:e.deadline-Date.now();if(t.kind==="direct"){let a=await bt(t.host,t.port,n,void 0,void 0,e.deadline);return{readable:a.readable,writable:a.writable,via:"direct",endpoint:`${t.host}:${t.port}`,close:()=>{try{a.close()}catch{}}}}let o=t.kind==="https"?"starttls":void 0,i=await bt(t.host,t.port,n,o,t.kind==="https"?t.serverName:void 0,e.deadline),s=Math.min($t,Math.max(0,Math.min(n,r())));if(s<=0){try{i.close()}catch{}throw new Ue(__sfx("5ouo5Y+36aKE566X5bey55So5bC977ya")+t.host+":"+t.port+"")}try{return t.kind==="http"||t.kind==="https"?{readable:await yr(i.readable,i.writable,e.hostname,e.port,{username:t.username,password:t.password},s),writable:i.writable,via:t.kind,endpoint:`${t.host}:${t.port}`,close:()=>{try{i.close()}catch{}}}:{readable:await hr(i.readable,i.writable,e.hostname,e.port,{username:t.username,password:t.password,handshakeTimeoutMs:s}),writable:i.writable,via:__sfx("c29ja3M1"),endpoint:`${t.host}:${t.port}`,close:()=>{try{i.close()}catch{}}}}catch(a){try{await i.close()}catch{}throw a}}function Wr(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}function ds(e){if(e.length===0)return __sfx("5pyq55+l5Y6f5Zug");let t=e.map(Wr),n=t.slice(-cs),r=t.length-n.length;return`${r>0?`\uFF08\u5171 ${t.length} \u6761\uFF0C\u7701\u7565\u524D ${r} \u6761\uFF09`:""}${n.join("\uFF1B")}`}function fs(e,t){return e.length===0?Promise.reject(new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"))):new Promise((n,r)=>{let o=0,i=0,s=!1,a=[],l=d=>{try{let u=d.close;Promise.resolve(u?u():d.writable.close()).catch(()=>{})}catch{}},c=()=>{if(!s)for(;i<t&&o<e.length;){let d=e[o++];i++,d().then(u=>{if(i--,s){l(u);return}s=!0,n(u)},u=>{i--,a.push(u),!s&&(c(),o>=e.length&&i===0&&(s=!0,r(new Error(__sfx("5YWo6YOoIA==")+e.length+__sfx("IOS4quWAmemAieWdh+Wksei0pe+8mg==")+ds(a)+""))))})}};c()})}async function yn(e,t){if(e.length===0)throw new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"));if(!t||e.length<=1){let n=new Error(__sfx("5ouo5Y+35aSx6LSl"));for(let r of e)try{return await r()}catch(o){n=o}throw n}try{return await fs(e,_r)}catch(n){throw new Error(__sfx("5YWo6YOoIA==")+e.length+__sfx("IOS4quWAmemAieWdh+Wksei0pe+8iOa7keWKqOeql+WPo++8jOacgOWkmiA=")+_r+__sfx("IOS4quW5tuWPke+8ie+8mgo=")+Wr(n),{cause:n})}}async function Kr(e,t){let n=[...e];if(!t)return n;try{let r=await Ke(t),o=new Set(n.map(i=>`${i.ip}:${i.port}`));for(let i of r){let s=`${i.ip}:${i.port}`;o.has(s)||(o.add(s),n.push(i))}}catch{}return n}async function ps(e,t,n){if(e.length===0)return null;let r=e.map(o=>t({source:"relay",host:o.ip,port:o.port,label:__sfx("5Y+N5LujIA==")+o.label+""}));try{return await yn(r,n)}catch{return null}}async function Le(e){let t=e.proxies??[],n=e.concurrent??!0;if(!e.skipTargetPolicy&&t.length===0){let y=nn(e.hostname);if(y)throw new Se(e.hostname,y)}let r=e.budgetMs??ts,o=Date.now()+r,i=e.pinnedIps??[],s=i.length>0,a=s?[...i]:[...e.optimizedIps??[]],l=s&&i.every(y=>ye(V("direct",y.ip,y.port),Date.now())),c=s;if(e.resolvePreferred&&(!s||l))try{let y=Math.min(o,Date.now()+(e.dohBudgetMs??ns)),T=await ct(e.hostname,e.port,{deadline:y,skipTxt:e.skipTxt??!0});if(T.length>0){c=!0;for(let E of T)a.push({ip:E.hostname,port:E.port})}}catch{}let d=re(e.hostname),u=c&&a.length>0&&a.every(y=>re(y.ip)),f=[...e.relay??[]];(u||d)&&e.relayPool&&(f=await Kr(f,{...e.relayPool,deadline:o}));let S=f,h=vr({targetHost:e.hostname,targetPort:e.port,optimizedIps:a,proxies:t,deprioritizeDirect:d||s,relay:[]});if(h.length===0)throw new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"));let b=y=>async()=>{let T=V(y.source,y.host,y.port),E=o-Date.now();if(E<=0)throw new Ue(__sfx("5ouo5Y+36aKE566X5bey55So5bC977yI")+r+"ms):"+e.hostname+":"+e.port+"");let Z=y.source==="relay"?Math.min(e.timeoutMs??yt,ls):e.timeoutMs??yt,F=y.timeoutMs?Math.min(Z,y.timeoutMs):Z,se=Math.max(200,Math.min(F,E)),M={...e,timeoutMs:se,deadline:Date.now()+se};try{if(!ss(y)&&is(e.hostname))throw new Se(e.hostname,xr);if(!e.skipTargetPolicy&&y.source!=="proxy"&&y.source!=="relay"){let L=nn(y.host);if(L)throw new Se(y.host,L)}if(y.source==="proxy"&&y.via)try{let L=await as(M,{host:y.via.host,port:y.via.port,kind:y.via.kind,username:y.via.username,password:y.via.password,serverName:y.via.serverName});return mr(y.via),mt(T),L}catch(L){throw L instanceof le||pr(y.via,Date.now()),L}let U=await os({...M,hostname:y.host,port:y.port});return y.source==="relay"&&(U.isRelay=!0),mt(T),U}catch(U){U instanceof Ue||pt(T,Date.now(),U instanceof le);let L=Dr(U,y.label);throw e.onFailure?.(L),U}},w=kr(h),{landing:v,[__sfx("cHJveHlJcA==")]:g,direct:R,fallback:B}=w,D=v.length>0||g.length>0,q=async()=>{if(v.length===0)throw new Error(__sfx("5pyq6YWN572u6JC95Zyw5Luj55CG"));let y,T=Zt(v,E=>E.via,Date.now());for(let E of T)try{return await b(E)()}catch(Z){y=Z}throw y??new Error(__sfx("6JC95Zyw5Luj55CG5YWo6YOo5aSx6LSl"))},X=async()=>{if(g.length===0)throw new Error(__sfx("5pyq6YWN572uIFByb3h5SVA="));let y=Date.now(),T=Zt(g,E=>E.via,y);return await yn(T.map(b),!0)},we=async()=>{let y;if(v.length>0)try{return await q()}catch(T){y=T}if(g.length>0)try{return await X()}catch(T){y=T}throw y??new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Luj55CG"))},Ce=async()=>{let y=Ve(R,T=>V(T.source,T.host,T.port),Date.now());return await yn(y.map(b),n)},Q=async()=>{let y=e.pinnedRelays??[];for(let M of y)if(!ye(V("relay",M.ip,M.port),Date.now()))try{let U=await b({source:"relay",host:M.ip,port:M.port,label:__sfx("5Zu65a6a5Y+N5LujIA==")+M.ip+":"+M.port+"",timeoutMs:us})();return U.isRelay=!0,De(e.hostname,M.ip,M.port),U}catch{}let T=S;if(T.length===0&&e.relayPool&&(T=await Kr([],{...e.relayPool,deadline:o})),T.length===0)return null;let E=Xr(e.hostname);if(E){let M=V("relay",E.ip,E.port);if(T.some(L=>L.ip===E.ip&&L.port===E.port)&&!ye(M,Date.now()))try{let L=await b({source:"relay",host:E.ip,port:E.port,label:__sfx("5Y+N5LujIA==")+E.ip+":"+E.port+""})();return L.isRelay=!0,De(e.hostname,E.ip,E.port),L}catch{}}let Z=dn(e.hostname,T.length),F=T[Z],se=Date.now();if(ye(V("relay",F.ip,F.port),se)){let M=T.find(U=>!ye(V("relay",U.ip,U.port),se));M&&(F=M)}try{let M=await b({source:"relay",host:F.ip,port:F.port,label:__sfx("5Y+N5LujIA==")+F.label+""})();return M.isRelay=!0,De(e.hostname,F.ip,F.port),M}catch{let M=Ve(T.filter(L=>L!==F),L=>V("relay",L.ip,L.port),Date.now()),U=await ps(M,b,n);if(U){U.isRelay=!0;let L=ht(U.endpoint);L&&De(e.hostname,L.ip,L.port)}return U}},fe=async()=>{for(let y of B)try{return await b(y)()}catch{}return null};if(!D)try{return await Ce()}catch(y){let T=await Q();if(T)return T;let E=await fe();if(E)return E;throw y}let xe=e.proxyMode??"only",N=d||u;if(xe==="only")try{return await we()}catch(y){let T=await Q();if(T)return T;let E=await fe();if(E)return E;throw y}if(xe==="global"||xe==="smart"&&N)try{return await we()}catch(y){if(xe==="global")try{return await Ce()}catch{}let T=await Q();if(T)return T;let E=await fe();if(E)return E;throw y}try{return await Ce()}catch(y){try{return await we()}catch{}let T=await Q();if(T)return T;let E=await fe();if(E)return E;throw y}}var gn,yt,Ue,ts,ns,_r,ls,us,cs,bn=C(()=>{"use strict";gr();br();rn();lt();te();dt();We();mn();ft();hn();gn=null;yt=8e3,Ue=class extends Error{constructor(t){super(t),this.name="DialBudgetError"}},ts=15e3,ns=1200;_r=6,ls=2500,us=1200,cs=8});function hs(e){let t=ms.exec(e);return t?t.slice(1).every(n=>Number(n)<=255&&String(Number(n))===n):!1}function wt(e){let t=[],n=new Map;for(let r of String(e??"").split(/\r?\n/)){let o=r.trim();if(!o||o.startsWith("#"))continue;let i=o.indexOf("=");if(i<=0)continue;let s=o.slice(0,i).trim().toLowerCase();if(!Gr.test(s))continue;let a=[],l=!1;for(let u of o.slice(i+1).split(",")){let f=u.trim();if(!f)continue;let p=f.toLowerCase().startsWith("r:"),S=p?f.slice(2).trim():f;if(S.startsWith("r:"))continue;let h=S.lastIndexOf(":"),b=S,w;if(h>0&&/^\d{1,5}$/.test(S.slice(h+1))){b=S.slice(0,h).trim();let v=Number(S.slice(h+1));if(v>0&&v<=65535)w=v;else continue}if(hs(b)&&!(a.length>0&&p!==l)&&(l=p,a.push({ip:b,port:w}),a.length>=Vr))break}if(a.length===0)continue;let c=l?`relay:${s}`:s,d=n.get(c);if(!d){if(t.length>=gs)break;d={host:s,endpoints:[],relay:l},n.set(c,d),t.push(d)}for(let u of a){if(d.endpoints.length>=Vr)break;d.endpoints.some(f=>f.ip===u.ip&&f.port===u.port)||d.endpoints.push(u)}}return t}function Yr(e,t,n){let r=String(t??"").trim().toLowerCase();if(!r)return;let o=wt(e),i,s,a=-1;for(let l of o)if(l.relay===n){if(l.host===r){i=l;break}if(l.host.startsWith("*.")){let c=l.host.slice(1);r.endsWith(c)&&c.length>a&&(s=l,a=c.length)}}return i??s}function zr(e,t,n){let r=Yr(e,t,!1);return r?r.endpoints.map(o=>({ip:o.ip,port:o.port??n})):[]}function Jr(e,t,n){let r=Yr(e,t,!0);return r?r.endpoints.map(o=>({ip:o.ip,port:o.port??n})):[]}function ys(e){let t=e.indexOf("=");if(t<=0)return;let n=e.slice(0,t).trim().toLowerCase();if(!Gr.test(n))return;let r=e.slice(t+1).trim().toLowerCase();if(!r)return;let o=!1,i={};for(let s of r.split(",")){let a=s.trim();if(a==="noredial"){i.noRedial=!0,o=!0;continue}let l=/^stall:(\d{1,6})$/.exec(a);l&&(i.stallMs=Math.max(200,Math.min(15e3,Number(l[1]))),o=!0)}return o?{host:n,policy:i}:void 0}function qr(e,t){let n=String(t??"").trim().toLowerCase();if(!n)return;let r,o,i=-1;for(let s of String(e??"").split(/\r?\n/)){let a=s.trim();if(!a||a.startsWith("#"))continue;let l=ys(a);if(l){if(l.host===n){r=l.policy;break}if(l.host.startsWith("*.")){let c=l.host.slice(1);n.endsWith(c)&&c.length>i&&(o=l.policy,i=c.length)}}}return r??o}var ms,Gr,Vr,gs,xt=C(()=>{"use strict";ms=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;Gr=/^(?:\*\.)?[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/,Vr=8,gs=64});function Ie(e,t,n,r={}){return{hostname:t.hostname,port:t.port,proxies:n,timeoutMs:e.dialConnectMs,budgetMs:e.dialBudgetMs,dohBudgetMs:e.dohBudgetMs,concurrent:e.concurrentDial,nat64:e.nat64||void 0,proxyMode:e.proxyMode,resolvePreferred:e.resolvePreferred,relayPool:{userEntries:e.relayPool||void 0,useBuiltin:e.useBuiltinRelay},pinnedIps:e.pinnedHosts?zr(e.pinnedHosts,t.hostname,t.port):void 0,pinnedRelays:e.pinnedHosts?Jr(e.pinnedHosts,t.hostname,t.port):void 0,...r}}var wn=C(()=>{"use strict";xt()});async function Qr(e,t,n,r=!0,o,i){let s=e.getReader(),a=t.getWriter();try{for(;!n?.exhausted;){let l;try{l=await s.read()}catch(d){i?.(d,"read");break}if(l.done)break;let c=l.value;if(!(!c||c.byteLength===0)){if(o?.(c.byteLength))break;try{await a.write(c)}catch(d){i?.(d,"write");break}}}}finally{if(r)try{await a.close()}catch{}else try{a.releaseLock()}catch{}try{s.releaseLock()}catch{}}}var Ee,St=C(()=>{"use strict";Ee=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 ro={};Ze(ro,{diagnosticCounters:()=>Ps,[__sfx("aGFuZGxlV2ViU29ja2V0")]:()=>vt,isTlsFatalAlert:()=>to,pendingBudgetBytes:()=>Es,recentCloses:()=>As,recentDiagnostics:()=>ks,recentRoutes:()=>vs,recentSessions:()=>Ts,recordDiagnostics:()=>G,truncateCloseReason:()=>no});function to(e){return e.byteLength>=7&&e[0]===21&&e[1]===3&&e[3]===0&&e[4]===2&&e[5]===2}function Es(){return Pe.bytes}function no(e,t=123){let n=new TextEncoder;if(n.encode(e).length<=t)return e;let r=e.slice(0,t);for(;n.encode(r).length>t;)r=r.slice(0,-1);r=r.replace(/\uFFFD+$/,"");let o="\u2026";for(;r.length>0&&n.encode(r+o).length>t;)r=r.slice(0,-1);return r+o}function Ps(){return Pt.since<=0&&(Pt.since=Date.now()),{...Ae,since:Pt.since,uptimeMs:Math.max(0,Date.now()-Pt.since)}}function As(){return Tt}function Ts(){return Rt}function Rs(e){Rt.unshift(e),Rt.length>Me&&(Rt.length=Me)}function Cs(e,t,n,r,o,i,s){Tt.unshift({at:Date.now(),code:e,reason:t,via:n,endpoint:r,dl:o,ret:i,rd:s}),Tt.length>Me&&(Tt.length=Me)}function vs(){return Ct}function $r(e){let t=e.trim(),n=t.indexOf("]:");if(n>=0)return t.slice(1,n);let r=t.lastIndexOf(":");return r>0?t.slice(0,r):t}function eo(e,t,n){Ct.unshift({at:Date.now(),target:e,via:t.via,endpoint:t.endpoint,cfTarget:re($r(e)),publicDns:Cr($r(e)),phase:n}),Ct.length>20&&(Ct.length=20)}function G(e,t,n){At.unshift({at:Date.now(),target:e,failures:t,summary:n}),At.length>Me&&(At.length=Me)}function ks(){return At}function Ls(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,"/"),r=n.length%4===0?"":"=".repeat(4-n.length%4),o=atob(n+r);if(o.length<17||o.length>8192)return new Uint8Array(0);let i=new Uint8Array(o.length);for(let s=0;s<o.length;s++)i[s]=o.charCodeAt(s);return i}catch{return new Uint8Array(0)}}async function vt(e,t,n,r,o,i){let[s,a]=Object.values(new WebSocketPair);try{a.accept({allowHalfOpen:!0})}catch{a.accept()}a.binaryType="arraybuffer";let l=Ls(e.headers.get(__sfx("c2VjLXdlYnNvY2tldC1wcm90b2NvbA=="))),c;{let m=(e.headers.get(__sfx("c2VjLXdlYnNvY2tldC1wcm90b2NvbA=="))??"").trim();m&&l.byteLength>0&&(c=m||void 0)}let d=[],u=0,f=!1,p=null,S=null,h=new at({onOverflow:()=>N(1009,__sfx("5LiK6KGM56ev5Y6L6L+H5aSa77yI55uu5qCH5L6n5LiN6K+777yJ"))}),b=null,w=null,v=()=>{w&&(clearTimeout(w),w=null)},g=!1,R=new st,B=null,D=!1,q=!1,X=null,we,Ce=m=>{let x=we?.stallMs??n.dialStallMs;return m?Math.max(400,Math.round(x/2)):x},Q=null,fe=m=>{try{a.send(m)}catch{}},xe=m=>{let x=new Uint8Array(2+m.byteLength);x[0]=0,x[1]=m.byteLength,x.set(m,2),fe(x)},N=(m,x)=>{if(D)return;D=!0;let P=p,H=m>=1008&&P?`via=${P.via} ep=${P.endpoint} `:"";Cs(m,x,P?.via??"",P?.endpoint??"",$,U,F),Rs({at:Date.now(),mode:t,transport:"ws",target:X?`${X.hostname}:${X.port}`:"",via:P?.via??"",endpoint:P?.endpoint??"",ulBytes:Bn,dlBytes:$,redials:F,closeCode:m,reason:x});try{a.close(m,no(H+x))}catch{}T()},y=m=>{try{let x=m.close;Promise.resolve(x?x():m.writable.close()).catch(()=>{})}catch{}},T=()=>{if(!q){if(q=!0,Nn(),Pe.bytes=Math.max(0,Pe.bytes-u),d=[],u=0,v(),b&&(clearTimeout(b),b=null),E&&(clearTimeout(E),E=null),B){let m=B;B=null;try{m.cancel()}catch{}}Q?.close(),p&&y(p)}},E=null,Z=new Set,F=0,se=0,M=[],U=0,L=m=>m.byteLength===0||$>0?!0:U+m.byteLength>Zr?(N(1009,__sfx("5pyq56Gu6K6k6YCa6Lev55qE5LiK6KGM5pWw5o2u6L+H5aSa")),!1):Et+m.byteLength>xs?(N(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V")),!1):(M.push(m),U+=m.byteLength,Et+=m.byteLength,!0),Nn=()=>{Et=Math.max(0,Et-U),M=[],U=0},Mt=0,Oo=()=>{Mt+=1},On=async(m=Ce(!1))=>{if(!p)return;let x=++Mt,P=p.readable.getReader();B=P,E&&clearTimeout(E);let H=setTimeout(()=>{E===H&&(E=null),!($>0)&&U!==0&&Ht("stall")},m);E=H;try{for(;;){let{done:K,value:j}=await P.read();if(K)break;if(j&&j.byteLength>0){let k=$===0;if(k&&p?.isRelay&&U>0&&to(j)&&F<n.relayRedialMax&&!g){X?.hostname&&p.endpoint&&gt(X.hostname,p.endpoint,!0),Ht("alert");return}if($+=j.byteLength,k&&(Nn(),p?.isRelay&&X?.hostname&&p.endpoint&&pn(X.hostname,p.endpoint)),Hn.add(j.byteLength)){Fn();return}let _=R.yieldCount;await R.onChunk(j.byteLength),R.yieldCount>_&&Ae.downlinkYields++,fe(j)}}}catch(K){Nt=K,Ae.downlinkReadErrors++}finally{try{P.releaseLock()}catch{}if(clearTimeout(H),E===H&&(E=null),B===P&&(B=null),x!==Mt||D)return;if($===0&&U>0&&F<n.relayRedialMax&&!g){Ht("eof");return}let K=p,j=Nt&&$===0?` err=${Vn(String(Nt),40)}`:"";N(1e3,K?`done${j} via=${K.via} ep=${K.endpoint} dl=${$} ret=${U} rd=${F}`:`done${j}`)}},$=0,Nt=null,Bn=0,Hn=new Ee((n.dataBudgetMB||0)*1024*1024),Fn=()=>{let m=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+n.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");G(X?`${X.hostname}:${X.port}`:__sfx("5pyq5bu656uL5Ye656uZ"),[],m),N(1013,m)},Bo=async m=>{let x=S;if(x)try{await h.write(()=>S===x?x:null,m)}catch(P){G(X?`${X.hostname}:${X.port}`:__sfx("5pyq5bu656uL5Ye656uZ"),[],__sfx("5LiK6KGM5YaZ5YWl5aSx6LSl77ya")+String(P)+""),T()}},Ot=async m=>{if(d.length===0)return;let x=d,P=u;d=[],u=0,Pe.bytes=Math.max(0,Pe.bytes-P);for(let H of x){if(D||!L(H))return;await m.write(H)}},Xn=m=>{if(t===__sfx("dmxlc3M=")){let P=rt(m,n.uuid);if(!P)return null;let H=je(P.header);return{command:P.header.command,port:P.header.port,hostname:P.header.hostname,headerLength:P.consumed,...H?{reject:H}:{}}}let x=or(m,n[__sfx("dHJvamFuUGFzc3dvcmQ=")]);return x?{command:x.header.command,port:x.header.port,hostname:x.header.hostname,headerLength:x.consumed}:null},Ho=()=>{b&&(clearTimeout(b),b=null)},Fo=async()=>{if(!(D||f)){if(Xn(l)){await Bt();return}N(1008,l.byteLength===0?__sfx("5o+h5omL6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0"):__sfx("5o+h5omL6LaF5pe277ya5Y2P6K6u5aS05LiN5a6M5pW05oiW6K6k6K+B5aSx6LSl"))}},Xo=m=>t===__sfx("dmxlc3M=")?nt(m,n.uuid):rr(m,n[__sfx("dHJvamFuUGFzc3dvcmQ=")]),Bt=async()=>{if(D||f)return;let m=Xn(l);if(!m){if(Xo(l)){G("",[],__sfx("6K6k6K+B5aSx6LSl77ya5Yet5o2u5LiN5Yy56YWN77yI56uL5Y2z5YWz6Zet77yM5LiN562J5o+h5omL5oiq5q2i77yJ")),N(1008,__sfx("6K6k6K+B5aSx6LSl5oiW5Y2P6K6u5aS06Z2e5rOV"));return}l.byteLength>0&&!b&&(b=setTimeout(()=>{b=null,Fo().catch(k=>N(1011,String(k)))},Ds));return}if(Ho(),v(),f)return;if(f=!0,X=m,we=n.pinnedHosts?qr(n.pinnedHosts,m.hostname):void 0,m.reject){G(`${m.hostname}:${m.port}`,[],__sfx("5Y2P6K6u5aS05ouS57ud77ya")+m.reject+""),N(1011,m.reject);return}let x=t===__sfx("dmxlc3M=")?Gt:tr;if(m.command===x){if(t===__sfx("dmxlc3M=")&&n.udpDns==="doh"&&m.port===53){xe(new Uint8Array(0)),Q=new it({endpoint:n.udpDnsEndpoint,send:fe});let k=l.subarray(m.headerLength);k.byteLength>0&&Q.push(k);return}N(1002,n.udpDns==="doh"?__sfx("VURQIOS7heaUr+aMgSBETlPvvIg1MyDnq6/lj6PvvIk="):__sfx("VURQIOacquWQr+eUqO+8iOmdouadv+WPr+W8gOWQryBETlMgb3ZlciBEb0jvvIk="));return}t===__sfx("dmxlc3M=")&&xe(new Uint8Array(0));let P=[],H=null;try{p=await Le(Ie(n,{hostname:m.hostname,port:m.port},r,{onFailure:k=>{P.push(k),i?.failures.push(k)}}))}catch(k){H=k}if(!p){let k=P.length>0?P.map(_=>Ur(_)).join(`
5
+ `):__sfx("5Ye656uZ6L+e5o6l5aSx6LSl77ya")+String(H)+"";G(`${m.hostname}:${m.port}`,P,k),N(1011,k);return}if(D){y(p),G(`${m.hostname}:${m.port}`,[],__sfx("5YWl56uZ5bey5YWz6Zet77yM5Lii5byD5ouo5Y+357uT5p6c"));return}let K=p.writable.getWriter();S=K,eo(`${m.hostname}:${m.port}`,p,"initial");let j=l.byteLength>m.headerLength?l.slice(m.headerLength):new Uint8Array(0);l=new Uint8Array(0);try{await h.run(async()=>{if(j.byteLength>0){if(!L(j))return;await K.write(j)}await Ot(K)})}catch(k){G(`${m.hostname}:${m.port}`,[],__sfx("5LiK6KGM6aaW5YyF5YaZ5YWl5aSx6LSl77ya")+String(k)+""),T()}o?.waitUntil(On())},Ht=async m=>{if(D||g)return;let x=X;if(!x){N(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55uu5qCH5pyq6Kej5p6Q"));return}if(we?.noRedial){G(`${x.hostname}:${x.port}`,[],__sfx("5oyJ5Z+f5ZCN562W55Wl56aB5q2i5YGH5rS76YeN5ouo77yIbm9yZWRpYWzvvIk=")),N(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya6K+l5Z+f5ZCN5bey56aB5q2i6Ieq5Yqo5YiH5o2i5Y+N5Luj5YWl5Y+j"));return}if(p?.isRelay&&p.endpoint&&gt(x.hostname,p.endpoint,!0),se>=n.relayRedialMax){N(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55u06L+e5LiO5Y+N5Luj5YWl5Y+j5Z2H5peg5ZON5bqU"));return}g=!0;try{let P=ur({via:p?.via,port:x.port,userProxyConfigured:r.length>0||!!n[__sfx("cHJveHlJcA==")],aggressive:n.aggressiveRedial===!0});if(!P.allowed){Ae.guardedRedials++,G(`${x.hostname}:${x.port}`,[],__sfx("5Ye656uZ5peg5pWw5o2u77ya")+P.reason+__sfx("77yb5pyq5YiH5o2i5Y+N5Luj77yI5Y+v5byA5ZCvIGFnZ3Jlc3NpdmVSZWRpYWzvvIk=")),N(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya")+P.reason+"");return}F++,m==="stall"?Ae.stallRedials++:Ae.eofRedials++,G(`${x.hostname}:${x.port}`,[],m==="stall"?__sfx("5LiL6KGM6Z2Z6buY5peg5pWw5o2u77yM5pS56LWw5Y+N5Luj5YWl5Y+j"):m==="alert"?__sfx("5Y+N5Luj5YWl5Y+j6L+U5ZueIFRMUyDoh7Tlkb3lkYrorabvvIznq4vljbPliIfmjaLkuIvkuIDkuKrlj43ku6PlhaXlj6M="):__sfx("5Ye656uZ6Zu25LiL6KGM5Y2zIEVPRi9SZXNldO+8jOeri+WNs+aUuei1sOWPjeS7o+WFpeWPow=="));let H=[];try{H=await Ke({userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay})}catch{H=[]}p?.endpoint&&Z.add(p.endpoint);let K=Ve(H.filter(k=>!Z.has(`${k.ip}:${k.port}`)),k=>V("relay",k.ip,k.port),Date.now());if(K.length===0){N(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5peg5Y+N5Luj5YWl5Y+j5Y+v55So"));return}let j=Math.max(1,n.relayRedialMax-se);for(let k of K.slice(0,j)){if(se++,Z.add(`${k.ip}:${k.port}`),Oo(),p){let _=p;if(_.close)try{_.close()}catch{}}S=null,$=0;try{let _=await Le(Ie(n,{hostname:k.ip,port:k.port},n.aggressiveRedial?r:[],{timeoutMs:Math.min(n.dialConnectMs,bs),resolvePreferred:!1,skipTargetPolicy:!0,proxyMode:n.aggressiveRedial?n.proxyMode:void 0,relayPool:void 0,pinnedIps:void 0,pinnedRelays:void 0}));if(!_)continue;if(_.isRelay=!0,D){y(_);return}p=_,eo(`${x.hostname}:${x.port}`,_,"redial");let qe=_.writable.getWriter(),Kn=0;for(let Qe of M)Kn+=Qe.byteLength;let Ft=new Uint8Array(Kn),Wn=0;for(let Qe of M)Ft.set(Qe,Wn),Wn+=Qe.byteLength;if(await h.run(async()=>{Ft.byteLength>0&&await qe.write(Ft),await Ot(qe),!D&&(S=qe,await Ot(qe))}),D)return;G(`${x.hostname}:${x.port}`,[],__sfx("5bey5YiH5o2i5Y+N5Luj5YWl5Y+jIA==")+k.ip+":"+k.port+""),o?.waitUntil(On(Ce(!0)));return}catch(_){G(`${x.hostname}:${x.port}`,[],__sfx("5Y+N5Luj5YWl5Y+jIA==")+k.ip+":"+k.port+__sfx("IOWksei0pe+8mg==")+String(_)+"")}}N(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5omA5pyJ5Y+N5Luj5YWl5Y+j5Z2H5aSx6LSl"))}finally{g=!1}},jn=Promise.resolve(),jo=async m=>{let x=lr(m),P=x instanceof Promise?await x:x;if(!(!P||P.byteLength===0)){if(v(),Bn+=P.byteLength,Hn.add(P.byteLength)){Fn();return}if(!f){if(l=ar(l,P),l.byteLength>ws){N(1009,__sfx("5o+h5omL5aS06LaF6L+HIDY0S0I="));return}Bt().catch(H=>N(1011,String(H)));return}if(Q){Q.push(P);return}if(!S){if(Pe.bytes+P.byteLength>Ss){N(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}if(d.push(P),u+=P.byteLength,Pe.bytes+=P.byteLength,u>Zr){N(1009,__sfx("5ouo5Y+35pyf6Ze05pWw5o2u6L+H5aSa"));return}return}L(P)&&Bo(P)}};a.addEventListener("message",m=>{jn=jn.then(()=>jo(m.data)).catch(()=>{})});let _n=()=>{D=!0,T()};a.addEventListener("close",_n),a.addEventListener("error",_n),l.byteLength>0?Bt().catch(m=>N(1011,String(m))):w=setTimeout(()=>{w=null,!(D||f||l.byteLength>0)&&(Ae.firstPacketTimeouts++,N(1008,__sfx("6aaW5YyF6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0")))},Us);try{let m={status:101,[__sfx("d2ViU29ja2V0")]:s};return c&&(m.headers={[__sfx("U2VjLVdlYlNvY2tldC1Qcm90b2NvbA==")]:c}),new Response(null,m)}catch(m){return console.error(__sfx("W+iHqueglOaVsOaNrumdol0gMTAxIOWTjeW6lOaehOmAoOWksei0pe+8mg=="),m),new Response(null,{status:200})}}var bs,ws,Zr,xs,Et,Ss,Pe,At,Me,Ae,Pt,Tt,Rt,Ct,Ds,Us,xn=C(()=>{"use strict";zt();ir();sr();_e();cr();dr();bn();mn();wn();St();ee();ft();We();xt();bs=3e3;ws=64*1024,Zr=8*1024*1024,xs=32*1024*1024,Et=0,Ss=32*1024*1024,Pe={bytes:0};At=[],Me=20,Ae={stallRedials:0,eofRedials:0,downlinkReadErrors:0,guardedRedials:0,firstPacketTimeouts:0,downlinkYields:0},Pt={since:0};Tt=[];Rt=[];Ct=[];Ds=2e3,Us=8e3});var po={};Ze(po,{[__sfx("Y2xlYXJYaHR0cFNlc3Npb25z")]:()=>_s,[__sfx("aGFuZGxlWGh0dHA=")]:()=>Cn,[__sfx("aXNYaHR0cFBhdGg=")]:()=>Rn,[__sfx("cGFyc2VYaHR0cFJvdXRl")]:()=>Tn,[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:()=>Ns,[__sfx("cmVjb3JkWGh0dHBEaWFnbm9zdGljcw==")]:()=>I});function Ms(e,t){return new Promise(n=>{let r=setTimeout(()=>n(null),t);e.then(o=>{clearTimeout(r),n(o)},()=>{clearTimeout(r),n(null)})})}function I(e,t,n){kt.unshift({at:Date.now(),target:e,...t,summary:n}),kt.length>20&&(kt.length=20)}function Ns(){return kt}function Os(e){return String(e||"").trim().replace(/\/+$/,"")||"/"}function Tn(e,t){let n=Os(t??__sfx("L3hodHRw"));if(e===n||e===`${n}/`)return{kind:"stream-one"};let r=`${n}/`;if(!e.startsWith(r))return null;let o=e.slice(r.length);if(!o)return null;let i=o.split("/");if(i.length===1&&i[0])return/[\s\u0000-\u001f]/.test(i[0])||i[0].length>io?null:{kind:"session",sessionId:i[0]};if(i.length===2&&i[0]&&/^\d+$/.test(i[1])){if(/[\s\u0000-\u001f]/.test(i[0])||i[0].length>io)return null;let s=Number(i[1]);return!Number.isSafeInteger(s)||s<0||s>1e6?null:{kind:__sfx("cGFja2V0LXVw"),sessionId:i[0],seq:s}}return null}function Rn(e,t){return Tn(e,t)!==null}function js(e){if(e.reservedBytes<=0){e.reservedBytes=0;return}Te=Math.max(0,Te-e.reservedBytes),e.reservedBytes=0}function En(e,t){if(t<=0)return;let n=Math.min(t,e.reservedBytes);Te=Math.max(0,Te-n),e.reservedBytes-=n}function ao(e,t){return t<=0?!0:Te+t>Xs?!1:(Te+=t,e.reservedBytes+=t,!0)}function _s(){for(let[e,t]of ie)Y(e,t);ie.clear(),Te=0}function Ks(e,t){return t-e.lastUploadAt>Sn&&t-e.lastDownlinkAt>Sn&&t-e.lastActivityAt>Sn}function Ws(e,t){return e.closed?!0:e.header||e.dialResult||e.downlinkStarted?!1:t-e.createdAt>uo}function co(e,t,n,r){let o=Date.now();for(let[a,l]of ie)(l.closed||Ks(l,o)||!l.header&&o-l.createdAt>30*6e4)&&Y(a,l);let i=ie.get(e);if(i)return fo(i,n,o),i;if(ie.size>=oo){for(let[a,l]of ie)Ws(l,o)&&Y(a,l);if(ie.size>=oo)return null}if(!r){let a=0;for(let l of ie.values())l.header||(a+=1);if(a>=Bs)return null}let s={id:e,createdAt:o,lastUploadAt:o,lastDownlinkAt:o,lastActivityAt:o,header:void 0,headerWaiters:[],dialPromise:null,dialResult:null,pending:new Map,reservedBytes:0,nextPumpSeq:0,pumpStarted:!1,signalResolve:null,traffic:new Ee(t),downlinkStarted:!1,closed:!1,targetLabel:""};return ie.set(e,s),s}function fo(e,t,n){t==="upload"?e.lastUploadAt=n:e.lastDownlinkAt=n,e.lastActivityAt=n}function Pn(e){if(!lo.has(e)){lo.add(e);try{try{e.readable.cancel("session closed")}catch{}let t=e.close;Promise.resolve(t?t():e.writable.close()).catch(()=>{})}catch{}}}function Y(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{}js(t),t.pending.clear(),ie.delete(e)}}function Vs(e){let t=e.signalResolve;e.signalResolve=null,t?.()}function Gs(e,t){return e.header?Promise.resolve(e.header):e.closed?Promise.resolve(null):new Promise(n=>{let r=i=>{clearTimeout(o),n(i)},o=setTimeout(()=>{let i=e.headerWaiters.indexOf(r);i>=0&&e.headerWaiters.splice(i,1),n(null)},t);e.headerWaiters.push(r)})}function Ys(e,t){e.header=t;let n=e.headerWaiters;e.headerWaiters=[];for(let r of n)try{r(t)}catch{}}function An(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 zs(){return new Uint8Array([0,0])}async function Js(e,t,n){if(e.dialResult)return e.dialResult;if(!e.dialPromise){let r=e.header;if(!r)throw new Error(__sfx("VkxFU1Mg5aS05pyq5Yiw6L6+"));e.targetLabel=`${r.hostname}:${r.port}`,e.dialPromise=Le(Ie(t,{hostname:r.hostname,port:r.port},n,{onFailure:o=>{I(e.targetLabel,o,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+o.candidate+"):"+o.message+"")}})).then(o=>e.closed?(Pn(o),o):(e.dialResult=o,o)).catch(o=>{throw I(e.targetLabel,{kind:"dial",message:String(o),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(o)+""),o})}return await e.dialPromise}async function qs(e,t){let n=t.writable.getWriter();try{for(;!e.closed;){let r=e.pending.get(e.nextPumpSeq);if(r){if(e.pending.delete(e.nextPumpSeq),e.nextPumpSeq+=1,r.byteLength===0)continue;if(e.traffic.add(r.byteLength)){En(e,r.byteLength),I(e.targetLabel,{kind:"budget",message:__sfx("5rWB6YeP6LaF6ZmQ"),candidate:"traffic"},__sfx("WEhUVFAg5LiK6KGM5rWB6YeP6LaF6ZmQ"));break}try{await n.write(r)}catch(s){En(e,r.byteLength),I(e.targetLabel,{kind:"relay-write",message:String(s),candidate:t.endpoint},__sfx("WEhUVFAg5YaZ5YWl55uu5qCH5aSx6LSl77ya")+String(s)+"");break}En(e,r.byteLength);continue}let o=null,i=new Promise(s=>{o=s});if(e.signalResolve=o,e.pending.has(e.nextPumpSeq)||e.closed){e.signalResolve=null;continue}await i}}finally{try{n.releaseLock()}catch{}}}async function Qs(e,t,n,r,o){let i=(t.dataBudgetMB||0)*1024*1024,s=co(r,i,"upload",o===0);if(!s)return I(r,{kind:"session-limit",message:__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ"),candidate:""},__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ")),null;if(s.closed)return null;let a=o===0&&!s.header,l=Number(e.headers.get("content-length")??""),c=a?Fs:Hs;if(Number.isFinite(l)&&l>c)return a&&Y(r,s),I(r,{kind:"packet-too-large",message:__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ"),candidate:""},__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ")),null;let d=await Gn(e,c);if(!d)return a&&Y(r,s),I(r,{kind:"packet-too-large",message:__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ5oiW6K+75Y+W5aSx6LSl"),candidate:""},__sfx("5YiG5YyF6LaF5Ye65LiK6ZmQ5oiW6K+75Y+W5aSx6LSl")),null;if(a){let u=rt(d,t.uuid);if(!u){let S=nt(d,t.uuid);return Y(r,s),I(r,{kind:S?"header-auth":"header-invalid",message:S?__sfx("5Yet5o2u5LiN5Yy56YWN"):__sfx("5Y2P6K6u5aS06Kej5p6Q5aSx6LSl5oiW6K6k6K+B5pyq6YCa6L+H"),candidate:""},S?__sfx("6K6k6K+B5aSx6LSl77yIVVVJRCDkuI3ljLnphY3vvIk="):__sfx("5Y2P6K6u5aS06Kej5p6Q5aSx6LSl77yI5ZCr6ZSZ6K+vIFVVSUTvvIk=")),null}let f=je(u.header);if(f)return Y(r,s),I(r,{kind:"header-unsupported",message:f,candidate:""},__sfx("5Y2P6K6u5aS05LiN5pSv5oyB77ya")+f),null;if(u.header.command!==tt)return Y(r,s),I(r,{kind:"udp-unsupported",message:__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),candidate:""},__sfx("VURQIOWRveS7pOS4jeWPl+aUr+aMgQ==")),null;Ys(s,u.header),s.targetLabel=`${u.header.hostname}:${u.header.port}`;let p=d.subarray(u.consumed);if(o>=s.nextPumpSeq&&!s.pending.has(o)){if(s.pending.size>=so)return Y(r,s),I(r,{kind:"pending-full",message:__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),candidate:""},__sfx("5YiG5YyF57yT5a2Y5bey5ruh")),null;if(!ao(s,p.byteLength))return Y(r,s),I(r,{kind:"retain-full",message:__sfx("5pqC5a2Y6LaF6ZmQ"),candidate:""},__sfx("5pqC5a2Y6LaF6ZmQ")),null;s.pending.set(o,p.slice())}}else{if(o<s.nextPumpSeq||s.pending.has(o))return new Response(null,{status:200,headers:An()});if(s.pending.size>=so)return Y(r,s),I(r,{kind:"pending-full",message:__sfx("5YiG5YyF57yT5a2Y5bey5ruh"),candidate:""},__sfx("5YiG5YyF57yT5a2Y5bey5ruh")),null;if(!ao(s,d.byteLength))return Y(r,s),I(r,{kind:"retain-full",message:__sfx("5pqC5a2Y6LaF6ZmQ"),candidate:""},__sfx("5pqC5a2Y6LaF6ZmQ")),null;s.pending.set(o,d.slice())}return Vs(s),new Response(null,{status:200,headers:An()})}async function Zs(e,t,n,r){let o=(t.dataBudgetMB||0)*1024*1024,i=co(r,o,"downlink",!1);if(!i)return I(r,{kind:"session-limit",message:__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ"),candidate:""},__sfx("5Lya6K+d5pWw5bey6L6+5LiK6ZmQ")),null;if(i.closed||i.downlinkStarted)return null;i.downlinkStarted=!0;let s=Gs(i,uo),a=!1,l=null,c=null,d=!1,u=null,f=null,p=()=>{Y(r,i)},S=new ReadableStream({start(h){c=h},async pull(h){if(!a)try{if(!d){let g=await s;if(a)return;if(!g){I(r,{kind:"session-assoc",message:__sfx("562J5b6F5LiK6KGM5Y2P6K6u5aS06LaF5pe2"),candidate:""},__sfx("5LiL6KGM562J5b6F5Y2P6K6u5aS06LaF5pe277yI5Lya6K+d5Y+v6IO96JC95Zyo5YW25LuWIGlzb2xhdGXvvIk=")),p(),h.close();return}try{h.enqueue(zs())}catch{}d=!0,f=Js(i,t,n),f.then(R=>{if(a||i.closed){Pn(R);return}u=R,!i.pumpStarted&&(i.pumpStarted=!0,qs(i,R).catch(()=>{}))}).catch(()=>{});return}if(!u){if(!f)return;try{u=await f}catch{I(i.targetLabel||r,{kind:"dial",message:__sfx("ZW5zdXJlRGlhbCDlpLHotKU="),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5LiN5Y+v55So")),p(),h.close();return}if(a||i.closed){Pn(u);return}}l||(l=u.readable.getReader());let{done:w,value:v}=await l.read();if(a)return;if(w){p();try{h.close()}catch{}return}if(v&&v.byteLength>0){if(fo(i,"downlink",Date.now()),i.traffic.add(v.byteLength)){I(i.targetLabel,{kind:"budget",message:__sfx("5rWB6YeP6LaF6ZmQ"),candidate:"traffic"},__sfx("WEhUVFAg5LiL6KGM5rWB6YeP6LaF6ZmQ")),p();try{h.close()}catch{}return}h.enqueue(v)}}catch(b){if(a)return;p();try{h.error(b)}catch{}}},cancel(h){if(a=!0,u)try{u.readable.cancel(h)}catch{}p()}});return new Response(S,{status:200,headers:An()})}async function Cn(e,t,n){let r=__sfx("L3hodHRw");try{r=new URL(e.url).pathname}catch{r=__sfx("L3hodHRw")}let o=Tn(r,t[__sfx("eGh0dHBQYXRo")]);return o?o.kind==="stream-one"?e.method!=="POST"?null:await $s(e,t,n):o.kind===__sfx("cGFja2V0LXVw")?e.method!=="POST"?null:await Qs(e,t,n,o.sessionId,o.seq):e.method==="GET"?await Zs(e,t,n,o.sessionId):null:null}async function $s(e,t,n){let r=e.body;if(!r)return I("",{kind:"no-body",message:__sfx("57y65bCR6K+35rGC5L2T"),candidate:""},__sfx("57y65bCR6K+35rGC5L2T")),null;let o=new me(r),i=await Ms(Qn(o,t.uuid),Is);if(!i)return await o.cancel("header timeout"),I("",{kind:"header-invalid",message:__sfx("5Y2P6K6u5aS06Kej5p6Q5aSx6LSl5oiW6K6k6K+B5pyq6YCa6L+H"),candidate:""},__sfx("5Y2P6K6u5aS06Kej5p6Q5aSx6LSl77yI5ZCr6ZSZ6K+vIFVVSUTvvIk=")),null;let s=je(i.header);if(s)return await i.payload.cancel("unsupported header"),I(`${i.header.hostname}:${i.header.port}`,{kind:"header-unsupported",message:s,candidate:""},__sfx("5Y2P6K6u5aS05LiN5pSv5oyB77ya")+s),null;if(i.header.command!==tt)return await i.payload.cancel("unsupported UDP"),I(`${i.header.hostname}:${i.header.port}`,{kind:"udp-unsupported",message:__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),candidate:""},__sfx("VURQIOWRveS7pOS4jeWPl+aUr+aMgQ==")),null;let a=new Uint8Array([0,0]),l=null,c=Le(Ie(t,{hostname:i.header.hostname,port:i.header.port},n,{onFailure:g=>{I(`${i.header.hostname}:${i.header.port}`,g,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+g.candidate+"):"+g.message+"")}})).catch(g=>{I(`${i.header.hostname}:${i.header.port}`,{kind:"dial",message:String(g),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(g)+"");try{i.payload.cancel("dial failed").catch(()=>{})}catch{}throw g});c.catch(()=>{});let d=!1,u=null,f=!1,p=new Ee((t.dataBudgetMB||0)*1024*1024),S=null,h=()=>{if(f)return;f=!0;let g=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+t.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");I(`${i.header.hostname}:${i.header.port}`,{kind:"budget",message:g,candidate:"traffic"},g);let R=l;if(R?.close)try{R.close()}catch{}try{S?.close()}catch{}},b=g=>p.add(g)?(h(),!0):!1,w=g=>{Qr(i.payload,g.writable,void 0,!1,b,(R,B)=>{let D=R instanceof Error?R.message:String(R),q=`relay-${B}`;/cancel|abort|closed/i.test(D)?q=`relay-${B}-client-cancel`:/reset|broken pipe/i.test(D)&&(q=`relay-${B}-upstream-reset`),I(`${i.header.hostname}:${i.header.port}`,{kind:q,message:D.slice(0,200),candidate:g.endpoint},__sfx("WEhUVFAg5Lit57un")+B==="read"?"\u8BFB\u4E0A\u6E38":"\u5199\u76EE\u6807"+__sfx("5aSx6LSl77yI")+q+"):"+D.slice(0,120)+"")}).catch(()=>{})};c.then(g=>{if(l=g,f){try{g.readable.cancel("client cancelled")}catch{}if(g.close)try{g.close()}catch{}return}w(g)}).catch(()=>{});let v=new ReadableStream({start(g){S=g,g.enqueue(a),d=!0},async pull(g){if(f||!d)return;if(!l)try{l=await c}catch{try{g.close()}catch{}return}let R=l;u||(u=R.readable.getReader());try{let{done:B,value:D}=await u.read();if(f)return;if(B){if(R.close)try{R.close()}catch{}g.close();return}if(D&&D.byteLength>0){if(p.add(D.byteLength)){h();return}g.enqueue(D)}}catch(B){if(f)return;let D=l;if(D?.close)try{D.close()}catch{}try{g.error(B)}catch{}}},cancel(g){f=!0;let R=l;try{R?.readable.cancel(g)}catch{}if(R?.close)try{R.close()}catch{}}});return new Response(v,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-store","X-Accel-Buffering":"no"}})}var Is,kt,ie,uo,oo,io,Bs,Sn,Hs,Fs,so,Xs,Te,lo,vn=C(()=>{"use strict";_e();zt();St();ee();bn();wn();Is=2e3;kt=[];ie=new Map,uo=3e4,oo=100,io=128,Bs=20,Sn=10*6e4,Hs=10*1024*1024,Fs=256*1024,so=30,Xs=32*1024*1024,Te=0;lo=new WeakSet});function Ut(){return new Response(JSON.stringify({build:kn,version:ea,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var kn,ea,Dt,Dn=C(()=>{"use strict";kn="6bb8f9a-b6f353d8",ea=__sfx("MC42MC4wLWJldGEuMQ=="),Dt=__sfx("L19fY2ZwX3ZlcnNpb24=")});function mo(e){return e[__sfx("S1Y=")]?new Re(e[__sfx("S1Y=")]):new Un}var Re,Un,Ye=C(()=>{"use strict";Re=class{constructor(t){this.kv=t}kv;async get(t){return await this.kv.get(t)}async put(t,n,r){r&&r>=60?await this.kv.put(t,n,{expirationTtl:r}):await this.kv.put(t,n)}async delete(t){await this.kv.delete(t)}async list(t){let n=[],r;do{let o=await this.kv.list({prefix:t,cursor:r});for(let i of o.keys)n.push(i.name);r=o.list_complete?void 0:o.cursor}while(r);return n}},Un=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,r){let o=r?Date.now()+r*1e3:0;this.data.set(t,{value:n,expiresAt:o})}async delete(t){this.data.delete(t)}async list(t){return[...this.data.keys()].filter(n=>n.startsWith(t))}}});function z(e,t){if(e==null)return t;let n=String(e).trim();if(n==="")return t;let r=Number(n);return Number.isFinite(r)?r:t}function J(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 ta(e,t,n,r){let o=z(e,t);return Number.isFinite(o)?Math.max(n,Math.min(r,Math.round(o))):t}function go(e){let t=e.trim().toLowerCase();return t==="global"||t==="fallback"||t==="smart"?t:"only"}function yo(e){return e.trim().toLowerCase()==="signed"?"signed":"legacy"}function bo(e){return e.trim().toLowerCase()==="doh"?"doh":"off"}function O(e,t){return e==null?t:String(e)}function na(e){let t=e.trim();return t?`/${t.replace(/^\/+/,"")}`:A.wsPath}function ra(e){return{uuid:O(e[__sfx("VVVJRA==")],""),[__sfx("dHJvamFuUGFzc3dvcmQ=")]:O(e[__sfx("VFJPSkFOX1BBU1NXT1JE")],""),wsPath:na(O(e[__sfx("V1NfUEFUSA==")]||e[__sfx("UEFUSA==")],A.wsPath)),[__sfx("dHJvamFuUGF0aA==")]:A[__sfx("dHJvamFuUGF0aA==")],[__sfx("eGh0dHBQYXRo")]:A[__sfx("eGh0dHBQYXRo")],add:O(e[__sfx("QURE")],""),addApi:O(e[__sfx("QUREQVBJ")],""),addCsv:O(e[__sfx("QUREX0NTVg==")],""),poolOfficial:J(e[__sfx("T0ZGSUNJQUxfSVA=")],A.poolOfficial),officialCount:z(e[__sfx("T0ZGSUNJQUxfSVBfQ09VTlQ=")],A.officialCount),poolDomain:J(e[__sfx("UFJFRkVSUkVEX0RPTUFJTg==")],A.poolDomain),domainCount:z(e[__sfx("UFJFRkVSUkVEX0RPTUFJTl9DT1VOVA==")],A.domainCount),poolManual:J(e[__sfx("TUFOVUFMX0lQ")],A.poolManual),poolCountries:O(e[__sfx("UE9PTF9DT1VOVFJJRVM=")],A.poolCountries),dls:z(e[__sfx("RExT")],0),maxLatency:z(e[__sfx("TUFYX0xBVEVOQ1k=")],0),maxNodes:0,[__sfx("cHJveHlJcA==")]:O(e[__sfx("UFJPWFlJUA==")],""),[__sfx("c29ja3M1")]:O(e[__sfx("U09DS1M1")],""),httpProxy:O(e[__sfx("SFRUUF9QUk9YWQ==")],""),proxyMode:go(O(e[__sfx("UFJPWFlfTU9ERQ==")],"")),nat64:O(e[__sfx("TkFUNjQ=")],""),concurrentDial:J(e[__sfx("VENQX0NPTkNVUlJFTlRfRElBTA==")],!0),dataBudgetMB:z(e[__sfx("REFUQV9CVURHRVRfTUI=")],A.dataBudgetMB),dialConnectMs:z(e[__sfx("RElBTF9DT05ORUNUX01T")],A.dialConnectMs),dialBudgetMs:z(e[__sfx("RElBTF9CVURHRVRfTVM=")],A.dialBudgetMs),dohBudgetMs:z(e[__sfx("RE9IX0JVREdFVF9NUw==")],A.dohBudgetMs),dialStallMs:z(e[__sfx("RElBTF9TVEFMTF9NUw==")],A.dialStallMs),relayRedialMax:z(e[__sfx("UkVMQVlfUkVESUFMX01BWA==")],A.relayRedialMax),resolvePreferred:J(e[__sfx("UkVTT0xWRV9QUkVGRVJSRUQ=")],A.resolvePreferred),aggressiveRedial:J(e[__sfx("QUdHUkVTU0lWRV9SRURJQUw=")],A.aggressiveRedial),relayPool:O(e[__sfx("UkVMQVlfUE9PTA==")],""),pinnedHosts:O(e[__sfx("UElOTkVEX0hPU1RT")],A.pinnedHosts),useBuiltinRelay:J(e[__sfx("VVNFX0JVSUxUSU5fUkVMQVk=")],A.useBuiltinRelay),[__sfx("ZW5hYmxlVHJvamFu")]:J(e[__sfx("RU5BQkxFX1RST0pBTg==")]??e[__sfx("VFJPSkFO")],A[__sfx("ZW5hYmxlVHJvamFu")]),[__sfx("ZW5hYmxlWGh0dHA=")]:J(e[__sfx("RU5BQkxFX1hIVFRQ")]??e[__sfx("WEhUVFA=")],A[__sfx("ZW5hYmxlWGh0dHA=")]),subDomain:"",subProtocol:"both",subTransport:"both",subVariants:O(e[__sfx("U1VCX1ZBUklBTlRT")],A.subVariants),subName:O(e[__sfx("U1VCX05BTUU=")],A.subName).trim()||A.subName,subPorts:O(e[__sfx("U1VCX1BPUlRT")],A.subPorts),clientFingerprint:A.clientFingerprint,ech:J(e[__sfx("RUNI")],A.ech),echHost:O(e[__sfx("RUNIX0hPU1Q=")],A.echHost),echDns:O(e[__sfx("RUNIX0ROUw==")],A.echDns),tlsFragment:!1,tlsFragmentSize:A.tlsFragmentSize,tlsFragmentDelay:A.tlsFragmentDelay,subToken:yo(O(e[__sfx("U1VCX1RPS0VOX01PREU=")],"")),subTokenTtlDays:z(e[__sfx("U1VCX1RPS0VOX1RUTF9EQVlT")],A.subTokenTtlDays),unlockProbe:J(e[__sfx("VU5MT0NLX1BST0JF")],A.unlockProbe),udpDns:bo(O(e[__sfx("VURQX0ROUw==")],"")),udpDnsEndpoint:O(e[__sfx("VURQX0ROU19FTkRQT0lOVA==")],A.udpDnsEndpoint)}}function oa(e,t){let n=String(t??"").trim();if(!n)return String(e??"");if(!String(e??"").trim())return n;let o=a=>a.trim().toLowerCase(),i=new Set(n.split(/\r?\n/).map(o)),s=String(e).split(/\r?\n/).map(a=>a.trim()).filter(a=>a&&!a.startsWith("#")&&!i.has(o(a)));return s.length>0?[n,...s].join(`
6
+ `):n}function sa(e){return String(e??"").split(/\r?\n/).map(t=>t.trim()).filter(t=>t&&!ia.has(t)).join(`
7
+ `)}function aa(e,t){let n=String(t??"").trim();if(!n)return String(e??"");if(!String(e??"").trim())return n;let o=a=>a.relay?`relay:${a.host}`:a.host,i=new Set(wt(n).map(o)),s=String(e).split(/\r?\n/).filter(a=>{let l=a.trim();if(!l||l.startsWith("#"))return!1;let c=wt(l);return c.length===0?!1:!c.some(d=>i.has(o(d)))});return s.length>0?[n,...s].join(`
8
+ `):n}function la(e,t){let n={...e};for(let[r,o]of Object.entries(t))if(o!=null)if(r==="dls"||r==="maxLatency"||r==="maxNodes"||r==="officialCount"||r==="domainCount"||r==="dataBudgetMB"||r==="subTokenTtlDays")n[r]=z(o,0);else if(r==="dialConnectMs"||r==="dialBudgetMs"||r==="dohBudgetMs"||r==="dialStallMs"||r==="relayRedialMax"){let i={dialConnectMs:[1e3,2e4,A.dialConnectMs],dialBudgetMs:[3e3,6e4,A.dialBudgetMs],dohBudgetMs:[200,5e3,A.dohBudgetMs],dialStallMs:[500,15e3,A.dialStallMs],relayRedialMax:[1,8,A.relayRedialMax]},[s,a,l]=i[r];n[r]=ta(o,l,s,a)}else if(r==="concurrentDial"||r==="resolvePreferred"||r==="aggressiveRedial"||r==="useBuiltinRelay"||r===__sfx("ZW5hYmxlVHJvamFu")||r===__sfx("ZW5hYmxlWGh0dHA=")||r==="tlsFragment"||r==="ech"||r==="poolOfficial"||r==="poolDomain"||r==="poolManual"||r==="unlockProbe")n[r]=J(o,!1);else if(r==="proxyMode")n[r]=go(String(o));else if(r==="subProtocol"){let i=String(o);n[r]=i===__sfx("dmxlc3M=")||i===__sfx("dHJvamFu")||i==="both"?i:"both"}else if(r==="subTransport"){let i=String(o);n[r]=i==="ws"||i===__sfx("eGh0dHA=")||i==="both"?i:"both"}else r==="subToken"?n[r]=yo(String(o)):r==="pinnedHosts"?n.pinnedHosts=aa(A.pinnedHosts,String(o??"")):r==="relayPool"?n.relayPool=oa(A.relayPool,String(o??"")):r==="udpDns"?n[r]=bo(String(o)):n[r]=String(o);return n}async function wo(e,t){let n=ra(t),r=await e.get(ho),o={};if(r)try{o=JSON.parse(r)}catch{o={}}let i=la(n,o),s=!1;if(r&&typeof o.pinnedHosts=="string"){let d=sa(o.pinnedHosts);d!==o.pinnedHosts.trim()&&(o={...o,pinnedHosts:d},i.pinnedHosts=d,s=!0)}let a=e instanceof Re,l=Date.now();r?ze=0:ze===0&&(ze=l);let c=l-ze>ua;return a&&c&&(i.uuid||(i.uuid=Xt(),s=!0),i[__sfx("dHJvamFuUGFzc3dvcmQ=")]||(i[__sfx("dHJvamFuUGFzc3dvcmQ=")]=Xt().replace(/-/g,"").slice(0,16),s=!0),ze=0),r&&(i.officialCount<1||i.domainCount<1)&&(i.officialCount<1&&(i.officialCount=A.officialCount,s=!0),i.domainCount<1&&(i.domainCount=A.domainCount,s=!0)),s&&await da(e,i),i}function ca(e){let t={...e},n=r=>new Set(A[r].split(`
7
9
  `).map(o=>o.trim()).filter(Boolean));for(let r of["pinnedHosts","relayPool"]){let o=n(r),i=String(e[r]??"").split(`
8
10
  `).map(s=>s.trim());t[r]=i.filter(s=>s&&!o.has(s)).join(`
9
- `)}return t}async function vs(e,t){await e.put(Kr,JSON.stringify(Cs(t)))}var Kr,E,Me,Rs,ht=C(()=>{"use strict";se();ot();Oe();Kr="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,dialConnectMs:5e3,dialBudgetMs:15e3,dohBudgetMs:1200,dialStallMs:2500,relayRedialMax:4,resolvePreferred:!0,aggressiveRedial:!1,relayPool:`155.248.181.189
10
- 64.181.255.215
11
- 23.144.20.184
11
+ `)}return t}async function da(e,t){await e.put(ho,JSON.stringify(ca(t)))}var ho,A,ia,ze,ua,Lt=C(()=>{"use strict";ee();xt();Ye();ho="CONFIG",A={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:512,dialConnectMs:5e3,dialBudgetMs:15e3,dohBudgetMs:1200,dialStallMs:2500,relayRedialMax:2,resolvePreferred:!0,aggressiveRedial:!1,relayPool:`216.36.82.11
12
12
  137.184.228.85
13
- 159.60.146.82
14
- 216.195.213.76
15
- 107.174.42.185
16
- 216.36.82.11
17
- 216.195.213.107
18
13
  216.167.16.112
19
- 216.195.213.132
20
- 23.144.4.243
14
+ 128.121.31.252
15
+ 23.144.20.184
16
+ 38.84.201.228
17
+ 155.248.181.189
21
18
  38.244.150.113
22
- 151.244.201.207
23
- 194.87.62.139
24
- 192.18.136.255`,pinnedHosts:`x.com=151.101.194.146
25
- *.x.com=r:155.248.181.189
26
- *.twitter.com=r:155.248.181.189
27
- *.twimg.com=r:155.248.181.189
28
- cloudflare.com=r:45.76.246.192`,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"};Me=0,Rs=9e4});var _r,ks,fl,Ls,pl,Gr=C(()=>{"use strict";_r={[__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"),fl=(()=>{let e={};for(let t of ks.split(","))t.length>3&&(e[t.slice(0,3)]=t.slice(3));return e})(),Ls=new Map;for(let[e,t]of Object.entries(_r))for(let n of t)Ls.set(n,e);pl=Object.keys(_r)});var hl,Jr=C(()=>{"use strict";hl=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 Dl,Ul,Zr=C(()=>{"use strict";Z();se();Gr();Jr();Dl=2*1024*1024,Ul=".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 Ml,qr=C(()=>{"use strict";Oe();se();Ml=new TextEncoder});var ec,Qr=C(()=>{"use strict";Oe();ht();se();ec=3600*24});function $r(e){return Xr(e)}async function eo(e,t){if(Be.config&&Date.now()-Be.configAt<Ds)return Be.config;let n=await Vr(e,t);return Be.config=n,Be.configAt=Date.now(),n}var Ds,Be,un=C(()=>{"use strict";Oe();ht();Qr();Ds=15e3,Be={config:null,configAt:0,auth:null,authAt:0}});var no={};je(no,{clearUnlockCache:()=>js,runUnlockProbe:()=>Fs});function Bs(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 Hs(e){let t=Date.now(),n=new AbortController,r=setTimeout(()=>n.abort(),Ns);try{let o=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,*/*"}}),i="";e.mode==="trace"&&(i=(await o.text()).slice(0,512));let s=/\bloc=([A-Z]{2})\b/.exec(i)?.[1];return{id:e.id,status:o.status,verdict:Bs(o.status,e.mode,i),ms:Date.now()-t,...s?{loc:s}:{}}}catch(o){let i=o instanceof Error?o.message:String(o);return{id:e.id,status:0,verdict:"unknown",ms:Date.now()-t,error:/abort/i.test(i)?"timeout":"fetch-failed"}}finally{clearTimeout(r)}}async function Fs(e,t){let n=e||"UNK",r=Date.now(),o=Ae.get(n);if(o&&r-o.at<Os)return{...o.data,cached:!0};let i=await Promise.all(Is.map(a=>Hs(a))),s={colo:n,region:t,cached:!1,at:r,targets:i};if(Ae.size>=Ms){let a="",l=Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")];for(let[u,d]of Ae)d.at<l&&(l=d.at,a=u);a&&Ae.delete(a)}return Ae.set(n,{at:r,data:s}),s}function js(){Ae.clear()}var Is,Ns,Os,Ms,Ae,ro=C(()=>{"use strict";Is=[{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,Os=600*1e3,Ms=16,Ae=new Map});se();var ho=8*1024*1024,go=2*1024*1024,Et=600*1e3,yo=6*1024*1024*1024,ze=Date.now(),Pt=0,Tn=0;function At(e){e-ze>=Et&&(ze=e,Pt=0,Tn=0)}function bo(e,t=Date.now()){At(t),Pt+=e}function An(e){return At(e),yo-Pt}var wo=(()=>{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})(),xo=5e3;function So(e,t=xo){let n=!1,r=setTimeout(()=>{if(!n){n=!0;try{e(1e3,"Probe idle timeout")}catch{}}},t),o=r;return typeof o?.unref=="function"&&o.unref(),{cancel:()=>{n||(n=!0,clearTimeout(r))}}}async function Tt(e){let t=new URL(e.url);if(e.headers.get("Upgrade")?.toLowerCase()===__sfx("d2Vic29ja2V0")){let u=Date.now();if(At(u),++Tn>60)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((ze+Et-u)/1e3))}});let d=new WebSocketPair,[c,f]=Object.values(d);f.accept();let p=So((w,g)=>f.close(w,g));return f.addEventListener("message",w=>{let g=typeof w.data=="string"?w.data:"";if(g==="PING"||g==="ping"){p.cancel(),f.send(JSON.stringify({pong:!0,serverTime:Date.now(),colo:e.cf?.colo??"UNK",clientIp:e.headers.get("CF-Connecting-IP")??""}));try{f.close(1e3,"Probe complete")}catch{}return}p.cancel();try{f.close(1e3,"Probe aborted")}catch{}}),f.addEventListener("close",()=>p.cancel()),f.addEventListener("error",()=>p.cancel()),new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:c})}let r=Number.parseInt(t.searchParams.get("bytes")??"",10),o=Number.isFinite(r)&&r>0?Math.min(r,ho):go,i=Date.now();if(An(i)<=0){let u=Math.max(1e3,ze+Et-i);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 s=wo,a=0,l=new ReadableStream({pull(u){let d=An(Date.now());if(a>=o||d<=0){u.close();return}let c=Math.min(s.byteLength,o-a,d);u.enqueue(s.subarray(0,c)),a+=c,bo(c)}});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(o),"X-Probe-Nonce":Ke(4)}})}Qt();on();_t();an();se();ht();it();Zr();qr();se();function cn(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"}})}un();un();async function to(e){let t=$r(e);return await eo(t,e)}function dn(e){let t=[];return t.push(...Ne(e[__sfx("cHJveHlJcA==")],"direct")),t.push(...Ne(e[__sfx("c29ja3M1")],__sfx("c29ja3M1"))),t.push(...Ne(e.httpProxy,"http")),t}var so=6e4,Xs=10,Ks=500,de=new Map,fn=[];function ao(e,t){let n=de.get("__window__")??0;t>=n&&(de.clear(),n=t+so,de.set("__window__",n));let r=de.get(e);if(r===void 0){if(fn.length>=Ks){let o=fn.shift();o&&de.delete(o)}fn.push(e),r=0,de.set(e,r)}return r}function zs(e,t){let n=ao(e,t);de.set(e,n+1)}function oo(e,t){return ao(e,t)>=Xs}function io(e,t){if(!t)return!1;let n=(e.headers.get(__sfx("eC1jZnBpbG90LXRva2Vu"))??"").trim();if(!n)return!1;let r=Date.now(),o=(e.headers.get("CF-Connecting-IP")??"unknown").trim();return Te(n,t)?(de.set(o,0),!0):(zs(o,r),!1)}async function lo(e,t,n){let r=new URL(e.url);if(r.pathname===__sfx("L19fZWRnZV9wcm9iZQ=="))return Tt(e);if(r.pathname===pt||r.pathname===__sfx("L19fdmVyc2lvbg=="))return mt();if(r.pathname==="/region"&&e.method==="GET"){let{coloToCountry:s}=await Promise.resolve().then(()=>(De(),Wt)),a=e.cf?.colo??"",l=a?s(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 o=await to(t);if(r.pathname===__sfx("L19fZGlhZw==")){if(oo((e.headers.get("CF-Connecting-IP")??"unknown").trim(),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(so/1e3))}});if(!io(e,o.uuid))return null;let{recentDiagnostics:s,diagnosticCounters:a,recentRoutes:l,recentCloses:u,recentSessions:d}=await Promise.resolve().then(()=>(Qt(),Ir)),{[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:c}=await Promise.resolve().then(()=>(on(),jr));return new Response(JSON.stringify({ok:!0,impl:"self",build:sn,recent:s(),[__sfx("eGh0dHA=")]:c(),counters:a(),routes:l(),closes:u(),sessions:d()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}if(r.pathname==="/__unlock_probe"){if(!o.unlockProbe)return null;if(oo((e.headers.get("CF-Connecting-IP")??"unknown").trim(),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(!io(e,o.uuid))return null;let{coloToCountry:s}=await Promise.resolve().then(()=>(De(),Wt)),{runUnlockProbe:a}=await Promise.resolve().then(()=>(ro(),no)),l=e.cf?.colo??"",u=l?s(l):"",d=await a(l,u);return new Response(JSON.stringify({ok:!0,...d},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}let i=e.headers.get("Upgrade")?.toLowerCase();return r.pathname===o.wsPath?i!==__sfx("d2Vic29ja2V0")?null:await dt(e,__sfx("dmxlc3M="),o,dn(o),n):o[__sfx("ZW5hYmxlVHJvamFu")]&&r.pathname===o[__sfx("dHJvamFuUGF0aA==")]?i!==__sfx("d2Vic29ja2V0")?null:await dt(e,__sfx("dHJvamFu"),o,dn(o),n):o[__sfx("ZW5hYmxlWGh0dHA=")]&&nn(r.pathname,o[__sfx("eGh0dHBQYXRo")])?await rn(e,o,dn(o)):null}an();var Vc={async fetch(e,t,n){try{return new URL(e.url).pathname===pt?mt():await lo(e,t,n)??cn(200)}catch{return cn(500)}}};export{Vc as default};
19
+ 64.181.255.215`,pinnedHosts:"",useBuiltinRelay:!0,[__sfx("ZW5hYmxlVHJvamFu")]:!0,[__sfx("ZW5hYmxlWGh0dHA=")]:!0,subDomain:"",subProtocol:__sfx("dmxlc3M="),subTransport:"ws",subVariants:__sfx("dmxlc3Mtd3Msdmxlc3MteGh0dHA="),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"};ia=new Set(["x.com=151.101.194.146","cloudflare.com=r:45.76.246.192","*.x.com=r:155.248.181.189","*.twitter.com=r:155.248.181.189","*.twimg.com=r:155.248.181.189"]);ze=0,ua=9e4});var xo,fa,eu,pa,tu,So=C(()=>{"use strict";xo={[__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"]},fa=__sfx("SEtH6aaZ5rivLFRQReWPsOWMlyxOUlTkuJzkuqwsS0lY5aSn6ZiqLElDTummluWwlCxTSU7mlrDliqDlnaEsS1VM5ZCJ6ZqG5Z2hLEJLS+abvOiwtyxTR07og6Hlv5fmmI7luIIsTU5M6ams5bC85ouJLFNZROaCieWwvCxNRUzloqjlsJTmnKwsTEFY5rSb5p2J55+2LFNKQ+Wco+S9leWhnixTRUHopb/pm4Xlm74sT1JE6Iqd5Yqg5ZOlLElBROWNjuebm+mhvyxFV1Lnur3nk6blhYssWVla5aSa5Lym5aSaLFlWUua4qeWTpeWNjixMSFLkvKbmlaYsRlJB5rOV5YWw5YWL56aPLENER+W3tOm7jixBTVPpmL/lp4bmlq/nibnkuLksTUFE6ams5b636YeMLEFSTuaWr+W+t+WTpeWwlOaRqSxJU1TkvIrmlq/lnabluIPlsJQsRFhC6L+q5ouc"),eu=(()=>{let e={};for(let t of fa.split(","))t.length>3&&(e[t.slice(0,3)]=t.slice(3));return e})(),pa=new Map;for(let[e,t]of Object.entries(xo))for(let n of t)pa.set(n,e);tu=Object.keys(xo)});var ru,Eo=C(()=>{"use strict";ru=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 wu,xu,Su,Po=C(()=>{"use strict";te();ee();So();Eo();wu=8*1024*1024,xu=2*1024*1024,Su=".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 Tu,Ao=C(()=>{"use strict";Ye();ee();Tu=new TextEncoder});var Ku,To=C(()=>{"use strict";Ye();Lt();ee();Ku=3600*24});function Ro(e){return mo(e)}async function Co(e,t){if(Je.config&&Date.now()-Je.configAt<ma)return Je.config;let n=await wo(e,t);return Je.config=n,Je.configAt=Date.now(),n}var ma,Je,In=C(()=>{"use strict";Ye();Lt();To();ma=15e3,Je={config:null,configAt:0,auth:null,authAt:0}});var ko={};Ze(ko,{clearUnlockCache:()=>Pa,runUnlockProbe:()=>Ea});function xa(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 Sa(e){let t=Date.now(),n=new AbortController,r=setTimeout(()=>n.abort(),ya);try{let o=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,*/*"}}),i="";e.mode==="trace"&&(i=(await o.text()).slice(0,512));let s=/\bloc=([A-Z]{2})\b/.exec(i)?.[1];return{id:e.id,status:o.status,verdict:xa(o.status,e.mode,i),ms:Date.now()-t,...s?{loc:s}:{}}}catch(o){let i=o instanceof Error?o.message:String(o);return{id:e.id,status:0,verdict:"unknown",ms:Date.now()-t,error:/abort/i.test(i)?"timeout":"fetch-failed"}}finally{clearTimeout(r)}}async function Ea(e,t){let n=e||"UNK",r=Date.now(),o=Ne.get(n);if(o&&r-o.at<ba)return{...o.data,cached:!0};let i=await Promise.all(ga.map(a=>Sa(a))),s={colo:n,region:t,cached:!1,at:r,targets:i};if(Ne.size>=wa){let a="",l=Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")];for(let[c,d]of Ne)d.at<l&&(l=d.at,a=c);a&&Ne.delete(a)}return Ne.set(n,{at:r,data:s}),s}function Pa(){Ne.clear()}var ga,ya,ba,wa,Ne,Do=C(()=>{"use strict";ga=[{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"}],ya=4e3,ba=600*1e3,wa=16,Ne=new Map});ee();var Ko=8*1024*1024,Wo=2*1024*1024,jt=600*1e3,Vo=6*1024*1024*1024,Be=0,_t=0,zn=0;function Kt(e){(Be<=0||e-Be>=jt)&&(Be=e,_t=0,zn=0)}function Go(e,t=Date.now()){Kt(t),_t+=e}function Yn(e){return Kt(e),Vo-_t}var Yo=(()=>{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})(),zo=5e3;function Jo(e,t=zo){let n=!1,r=setTimeout(()=>{if(!n){n=!0;try{e(1e3,"Probe idle timeout")}catch{}}},t),o=r;return typeof o?.unref=="function"&&o.unref(),{cancel:()=>{n||(n=!0,clearTimeout(r))}}}async function Wt(e){let t=new URL(e.url);if(e.headers.get("Upgrade")?.toLowerCase()===__sfx("d2Vic29ja2V0")){let c=Date.now();if(Kt(c),++zn>60)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((Be+jt-c)/1e3))}});let d=new WebSocketPair,[u,f]=Object.values(d);f.accept();let p=Jo((S,h)=>f.close(S,h));return f.addEventListener("message",S=>{let h=typeof S.data=="string"?S.data:"";if(h==="PING"||h==="ping"){p.cancel(),f.send(JSON.stringify({pong:!0,serverTime:Date.now(),colo:e.cf?.colo??"UNK",clientIp:e.headers.get("CF-Connecting-IP")??""}));try{f.close(1e3,"Probe complete")}catch{}return}p.cancel();try{f.close(1e3,"Probe aborted")}catch{}}),f.addEventListener("close",()=>p.cancel()),f.addEventListener("error",()=>p.cancel()),new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:u})}let r=Number.parseInt(t.searchParams.get("bytes")??"",10),o=Number.isFinite(r)&&r>0?Math.min(r,Ko):Wo,i=Date.now();if(Yn(i)<=0){let c=Math.max(1e3,Be+jt-i);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(c/1e3))}})}let s=Yo,a=0,l=new ReadableStream({pull(c){let d=Yn(Date.now());if(a>=o||d<=0){c.close();return}let u=Math.min(s.byteLength,o-a,d);c.enqueue(s.subarray(0,u)),a+=u,Go(u)}});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(o),"X-Probe-Nonce":et(4)}})}xn();vn();hn();Dn();ee();Lt();St();Po();Ao();ee();function Ln(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"}})}In();In();async function vo(e){let t=Ro(e);return await Co(t,e)}function Mn(e){let t=[];return t.push(...Ge(e[__sfx("cHJveHlJcA==")],"direct")),t.push(...Ge(e[__sfx("c29ja3M1")],__sfx("c29ja3M1"))),t.push(...Ge(e.httpProxy,"http")),t}var Io=6e4,Aa=10,Ta=500,be=new Map,It=[];function Mo(e,t){let n=be.get("__window__")??0;t>=n&&(be.clear(),It.length=0,n=t+Io,be.set("__window__",n));let r=be.get(e);if(r===void 0){if(It.length>=Ta){let o=It.shift();o&&be.delete(o)}It.push(e),r=0,be.set(e,r)}return r}function Ra(e,t){let n=Mo(e,t);be.set(e,n+1)}function Uo(e,t){return Mo(e,t)>=Aa}function Lo(e,t){if(!t)return!1;let n=(e.headers.get(__sfx("eC1jZnBpbG90LXRva2Vu"))??"").trim();if(!n)return!1;let r=Date.now(),o=(e.headers.get("CF-Connecting-IP")??"unknown").trim();return Oe(n,t)?(be.set(o,0),!0):(Ra(o,r),!1)}async function No(e,t,n){let r=new URL(e.url);if(r.pathname===__sfx("L19fZWRnZV9wcm9iZQ=="))return Wt(e);if(r.pathname===Dt||r.pathname===__sfx("L19fdmVyc2lvbg=="))return Ut();if(r.pathname==="/region"&&e.method==="GET"){let{coloToCountry:s}=await Promise.resolve().then(()=>(We(),fn)),a=e.cf?.colo??"",l=a?s(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 o=await vo(t);if(r.pathname===__sfx("L19fZGlhZw==")){if(Uo((e.headers.get("CF-Connecting-IP")??"unknown").trim(),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(Io/1e3))}});if(!Lo(e,o.uuid))return null;let{recentDiagnostics:s,diagnosticCounters:a,recentRoutes:l,recentCloses:c,recentSessions:d}=await Promise.resolve().then(()=>(xn(),ro)),{[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:u}=await Promise.resolve().then(()=>(vn(),po));return new Response(JSON.stringify({ok:!0,impl:"self",build:kn,recent:s(),[__sfx("eGh0dHA=")]:u(),counters:a(),routes:l(),closes:c(),sessions:d()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}if(r.pathname==="/__unlock_probe"){if(!o.unlockProbe)return null;if(Uo((e.headers.get("CF-Connecting-IP")??"unknown").trim(),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(!Lo(e,o.uuid))return null;let{coloToCountry:s}=await Promise.resolve().then(()=>(We(),fn)),{runUnlockProbe:a}=await Promise.resolve().then(()=>(Do(),ko)),l=e.cf?.colo??"",c=l?s(l):"",d=await a(l,c);return new Response(JSON.stringify({ok:!0,...d},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}let i=e.headers.get("Upgrade")?.toLowerCase();return r.pathname===o.wsPath?i!==__sfx("d2Vic29ja2V0")?null:await vt(e,__sfx("dmxlc3M="),o,Mn(o),n):o[__sfx("ZW5hYmxlVHJvamFu")]&&r.pathname===o[__sfx("dHJvamFuUGF0aA==")]?i!==__sfx("d2Vic29ja2V0")?null:await vt(e,__sfx("dHJvamFu"),o,Mn(o),n):o[__sfx("ZW5hYmxlWGh0dHA=")]&&Rn(r.pathname,o[__sfx("eGh0dHBQYXRo")])?await Cn(e,o,Mn(o)):null}Dn();var Oc={async fetch(e,t,n){try{return new URL(e.url).pathname===Dt?Ut():await No(e,t,n)??Ln(200)}catch{return Ln(500)}}};export{Oc as default};
@@ -0,0 +1,6 @@
1
+ const HTML = "<!doctype html>\n<html lang=\"zh-CN\">\n<head>\n<meta charset=\"UTF-8\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<title>MobiHop 云监测台</title>\n<style>\n :root { color-scheme: dark; }\n * { box-sizing: border-box; }\n body { margin:0; font-family: system-ui, -apple-system, sans-serif; background:#0b1220; color:#e2e8f0; }\n header { padding:16px 24px; border-bottom:1px solid #1e293b; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; }\n h1 { margin:0; font-size:18px; }\n .sub { color:#64748b; font-size:13px; }\n main { padding:24px; }\n .grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; margin-bottom:20px; }\n .card { background:#111a2e; border:1px solid #1e293b; border-radius:10px; padding:14px; }\n .card .label { color:#64748b; font-size:12px; }\n .card .val { font-size:24px; font-weight:600; margin-top:4px; }\n .table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; border-radius:10px; }\n table { width:100%; min-width:720px; border-collapse:collapse; background:#111a2e; border:1px solid #1e293b; }\n th,td { padding:10px 12px; text-align:left; font-size:13px; border-bottom:1px solid #1e293b; white-space:nowrap; }\n th { color:#94a3b8; background:#0f172a; font-weight:500; }\n tr:last-child td { border-bottom:none; }\n .dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }\n .dot.on { background:#22c55e; box-shadow:0 0 6px #22c55e; }\n .dot.off { background:#475569; }\n .mono { font-family: ui-monospace, monospace; font-size:12px; }\n .err { color:#f87171; padding:12px; }\n .cfg { font-size:12px; color:#64748b; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }\n input { background:#0f172a; border:1px solid #334155; color:#e2e8f0; padding:6px 10px; border-radius:6px; font-size:13px; }\n button { background:#2563eb; color:#fff; border:none; padding:6px 12px; border-radius:6px; cursor:pointer; font-size:13px; }\n button:hover { background:#1d4ed8; }\n button.ghost { background:#1e293b; }\n button.ghost:hover { background:#334155; }\n .auth-box { max-width:420px; margin:40px auto; background:#111a2e; border:1px solid #1e293b; border-radius:12px; padding:24px; }\n .auth-box h2 { margin:0 0 6px; font-size:18px; }\n .auth-box p { color:#64748b; font-size:13px; margin:0 0 16px; }\n .auth-box label { display:block; font-size:12px; color:#94a3b8; margin:12px 0 4px; }\n .auth-box input { width:100%; }\n .auth-box .row { display:flex; gap:8px; margin-top:16px; }\n .auth-box .row button { flex:1; }\n .modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; z-index:50; }\n .modal { background:#111a2e; border:1px solid #1e293b; border-radius:12px; padding:24px; width:90%; max-width:420px; }\n .modal h3 { margin:0 0 12px; font-size:16px; }\n .modal label { display:block; font-size:12px; color:#94a3b8; margin:10px 0 4px; }\n .modal input { width:100%; }\n .modal .row { display:flex; gap:8px; margin-top:16px; justify-content:flex-end; }\n @media (max-width: 640px) {\n header { padding:12px 16px; }\n main { padding:16px; }\n .cfg input { width:100%; }\n h1 { font-size:16px; }\n .card .val { font-size:20px; }\n }\n</style>\n</head>\n<body>\n<header id=\"hdr\" style=\"display:none\">\n <div>\n <h1>MobiHop 云监测台</h1>\n <div class=\"sub\">只读监测 · 节点心跳 · 免费托管</div>\n </div>\n <div class=\"cfg\">\n API: <input id=\"api\" /> <button onclick=\"saveApi()\">保存</button>\n <button class=\"ghost\" onclick=\"openChangePw()\">修改密码</button>\n <button class=\"ghost\" onclick=\"logout()\">退出</button>\n </div>\n</header>\n<main>\n <div id=\"view-setup\" class=\"auth-box\" style=\"display:none\">\n <h2>未配置密码</h2>\n <p>监测台密码尚未初始化。请通过部署脚本(deploy-cf.ps1)设置登录密码,或联系管理员。</p>\n <p id=\"setup-err\" class=\"err\"></p>\n </div>\n <div id=\"view-login\" class=\"auth-box\" style=\"display:none\">\n <h2>登录</h2>\n <p>请输入监测台密码。</p>\n <label>密码</label>\n <input id=\"login-pw\" type=\"password\" onkeydown=\"if(event.key==='Enter')doLogin()\" />\n <div class=\"row\"><button onclick=\"doLogin()\">登录</button></div>\n <p id=\"login-err\" class=\"err\"></p>\n </div>\n <div id=\"view-app\" style=\"display:none\">\n <div class=\"grid\">\n <div class=\"card\"><div class=\"label\">设备总数</div><div class=\"val\" id=\"total\">—</div></div>\n <div class=\"card\"><div class=\"label\">在线</div><div class=\"val\" id=\"online\">—</div></div>\n <div class=\"card\"><div class=\"label\">离线</div><div class=\"val\" id=\"offline\">—</div></div>\n <div class=\"card\"><div class=\"label\">最后刷新</div><div class=\"val\" id=\"refresh\" style=\"font-size:14px\">—</div></div>\n </div>\n <div class=\"table-wrap\">\n <table>\n <thead><tr><th>状态</th><th>设备</th><th>Node ID</th><th>虚拟 IP</th><th>版本</th><th>最后 IP</th><th>最后心跳</th></tr></thead>\n <tbody id=\"rows\"><tr><td colspan=\"7\" style=\"text-align:center;color:#64748b\">加载中…</td></tr></tbody>\n </table>\n </div>\n <p id=\"err\" class=\"err\"></p>\n </div>\n</main>\n<div id=\"modal\" style=\"display:none\"></div>\n<script>\n const DEFAULT_API = location.origin;\n const apiInput = document.getElementById('api');\n if (apiInput) apiInput.value = localStorage.getItem('monitor_api') || DEFAULT_API;\n function saveApi(){ if(apiInput) localStorage.setItem('monitor_api', apiInput.value); load(); }\n function apiUrl(){ const el=document.getElementById('api'); const v = el? el.value : (localStorage.getItem('monitor_api')||DEFAULT_API); return (v||DEFAULT_API).replace(/\\/+$/,''); }\n function token(){ return localStorage.getItem('monitor_session') || ''; }\n function setToken(t){ if(t) localStorage.setItem('monitor_session', t); else localStorage.removeItem('monitor_session'); }\n function fmtTime(ms){ if(!ms) return '—'; return new Date(ms).toLocaleString('zh-CN',{hour12:false}); }\n function show(id){ ['view-setup','view-login','view-app'].forEach(v=>{ const e=document.getElementById(v); if(e) e.style.display = v===id?'block':'none'; }); const hdr=document.getElementById('hdr'); if(hdr) hdr.style.display = id==='view-app'?'flex':'none'; }\n async function apiFetch(path, opts){ opts=opts||{}; opts.headers = Object.assign({'Content-Type':'application/json'}, opts.headers||{}); const t=token(); if(t) opts.headers['Authorization']='Bearer '+t; const r=await fetch(apiUrl()+path, opts); return r; }\n\n async function init(){\n try {\n const r = await fetch(apiUrl()+'/auth/status');\n const d = await r.json();\n if (d.setupRequired) { show('view-setup'); }\n else if (!token()) { show('view-login'); }\n else { show('view-app'); load(); }\n } catch(e){ document.getElementById('login-err').textContent='连接失败: '+e.message; show('view-login'); }\n }\n\n async function doSetup(){ /* disabled: password must be set via deploy script */ }\n\n async function doLogin(){\n const pw=document.getElementById('login-pw').value;\n const err=document.getElementById('login-err');\n err.textContent='';\n try {\n const r=await fetch(apiUrl()+'/auth/login',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({password:pw})});\n const d=await r.json();\n if(!r.ok){ err.textContent=d.message||'登录失败'; return; }\n setToken(d.token); show('view-app'); load();\n } catch(e){ err.textContent='失败: '+e.message; }\n }\n\n async function logout(){\n try { await apiFetch('/auth/logout',{method:'POST'}); } catch(e){}\n setToken(''); show('view-login');\n }\n\n function openChangePw(){\n const m=document.getElementById('modal');\n m.style.display='flex';\n m.innerHTML = `<div class=\"modal\">\n <h3>修改密码</h3>\n <label>旧密码</label><input id=\"cp-old\" type=\"password\" />\n <label>新密码(至少 8 位)</label><input id=\"cp-new\" type=\"password\" />\n <label>确认新密码</label><input id=\"cp-new2\" type=\"password\" />\n <p id=\"cp-err\" class=\"err\"></p>\n <div class=\"row\"><button class=\"ghost\" onclick=\"closeModal()\">取消</button><button onclick=\"doChangePw()\">确认</button></div>\n </div>`;\n }\n function closeModal(){ const m=document.getElementById('modal'); m.style.display='none'; m.innerHTML=''; }\n async function doChangePw(){\n const oldPw=document.getElementById('cp-old').value;\n const newPw=document.getElementById('cp-new').value;\n const newPw2=document.getElementById('cp-new2').value;\n const err=document.getElementById('cp-err');\n err.textContent='';\n if(newPw.length<8){ err.textContent='新密码至少 8 位'; return; }\n if(newPw!==newPw2){ err.textContent='两次新密码不一致'; return; }\n try {\n const r=await apiFetch('/auth/change-password',{method:'POST',body:JSON.stringify({oldPassword:oldPw,newPassword:newPw})});\n const d=await r.json();\n if(!r.ok){ err.textContent=d.message||'修改失败'; return; }\n closeModal();\n alert('密码已修改,请重新登录');\n logout();\n } catch(e){ err.textContent='失败: '+e.message; }\n }\n\n async function load(){\n const err = document.getElementById('err');\n err.textContent = '';\n try {\n const r = await apiFetch('/devices');\n if(r.status===401){ setToken(''); show('view-login'); return; }\n if(!r.ok) throw new Error('HTTP ' + r.status);\n const data = await r.json();\n const devs = data.devices || [];\n document.getElementById('total').textContent = devs.length;\n const on = devs.filter(d=>d.online).length;\n document.getElementById('online').textContent = on;\n document.getElementById('offline').textContent = devs.length - on;\n document.getElementById('refresh').textContent = fmtTime(data.generatedAtMs);\n const tbody = document.getElementById('rows');\n if(devs.length===0){ tbody.innerHTML = '<tr><td colspan=\"7\" style=\"text-align:center;color:#64748b\">暂无设备。节点需配置 monitoring 上报。</td></tr>'; return; }\n tbody.innerHTML = devs.map(d => `<tr>\n <td><span class=\"dot ${d.online?'on':'off'}\"></span>${d.online?'在线':'离线'}</td>\n <td>${d.alias||'—'}</td>\n <td class=\"mono\">${d.nodeId}</td>\n <td class=\"mono\">${d.virtualIpv4||'—'}</td>\n <td>${d.version||'—'}</td>\n <td class=\"mono\">${d.lastIp||'—'}</td>\n <td>${fmtTime(d.lastSeenMs)}</td>\n </tr>`).join('');\n } catch(e){ err.textContent = '加载失败: ' + e.message; }\n }\n\n init();\n setInterval(()=>{ if(document.getElementById('view-app').style.display!=='none') load(); }, 15000);\n</script>\n</body>\n</html>\n";
2
+ export default {
3
+ fetch() {
4
+ return new Response(HTML, { headers: { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store" } });
5
+ }
6
+ }