r&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(kt(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,t=r>e.w_size?e.w_size:r,a=e.strstart-e.block_start,(a>=t||(a||n===U)&&n!==q&&e.strm.avail_in===0&&a<=r)&&(i=a>r?r:a,f=n===U&&e.strm.avail_in===0&&i===a?1:0,wt(e,e.block_start,i,f),e.block_start+=i,$(e.strm)),f?re:Z)},at=(e,n)=>{let t,i;for(;;){if(e.lookahead=v&&(e.ins_h=J(e,e.ins_h,e.window[e.strstart+v-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),t!==0&&e.strstart-t<=e.w_size-P&&(e.match_length=Nn(e,t)),e.match_length>=v)if(i=W(e,e.strstart-e.match_start,e.match_length-v),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=v){e.match_length--;do e.strstart++,e.ins_h=J(e,e.ins_h,e.window[e.strstart+v-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=J(e,e.ins_h,e.window[e.strstart+1]);else i=W(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(L(e,!1),e.strm.avail_out===0))return Z}return e.insert=e.strstart{let t,i,a;for(;;){if(e.lookahead=v&&(e.ins_h=J(e,e.ins_h,e.window[e.strstart+v-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=v-1,t!==0&&e.prev_length4096)&&(e.match_length=v-1)),e.prev_length>=v&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-v,i=W(e,e.strstart-1-e.prev_match,e.prev_length-v),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=a&&(e.ins_h=J(e,e.ins_h,e.window[e.strstart+v-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=v-1,e.strstart++,i&&(L(e,!1),e.strm.avail_out===0))return Z}else if(e.match_available){if(i=W(e,0,e.window[e.strstart-1]),i&&L(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Z}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=W(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let t,i,a,r,f=e.window;for(;;){if(e.lookahead<=V){if(de(e),e.lookahead<=V&&n===q)return Z;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=v&&e.strstart>0&&(a=e.strstart-1,i=f[a],i===f[++a]&&i===f[++a]&&i===f[++a])){r=e.strstart+V;do;while(i===f[++a]&&i===f[++a]&&i===f[++a]&&i===f[++a]&&i===f[++a]&&i===f[++a]&&i===f[++a]&&i===f[++a]&&ae.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=v?(t=W(e,1,e.match_length-v),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(t=W(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),t&&(L(e,!1),e.strm.avail_out===0))return Z}return e.insert=0,n===U?(L(e,!0),e.strm.avail_out===0?re:ge):e.sym_next&&(L(e,!1),e.strm.avail_out===0)?Z:pe},fa=(e,n)=>{let t;for(;;){if(e.lookahead===0&&(de(e),e.lookahead===0)){if(n===q)return Z;break}if(e.match_length=0,t=W(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,t&&(L(e,!1),e.strm.avail_out===0))return Z}return e.insert=0,n===U?(L(e,!0),e.strm.avail_out===0?re:ge):e.sym_next&&(L(e,!1),e.strm.avail_out===0)?Z:pe};function F(e,n,t,i,a){this.good_length=e,this.max_lazy=n,this.nice_length=t,this.max_chain=i,this.func=a}var ve=[new F(0,0,0,0,Zn),new F(4,4,8,4,at),new F(4,5,16,8,at),new F(4,6,32,32,at),new F(4,4,16,16,se),new F(8,16,32,32,se),new F(8,16,128,128,se),new F(8,32,128,256,se),new F(32,128,258,1024,se),new F(32,258,258,4096,se)],sa=e=>{e.window_size=2*e.w_size,j(e.head),e.max_lazy_match=ve[e.level].max_lazy,e.good_match=ve[e.level].good_length,e.nice_match=ve[e.level].nice_length,e.max_chain_length=ve[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=v-1,e.match_available=0,e.ins_h=0};function _a(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ge,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ta*2),this.dyn_dtree=new Uint16Array((2*Qi+1)*2),this.bl_tree=new Uint16Array((2*ea+1)*2),j(this.dyn_ltree),j(this.dyn_dtree),j(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(na+1),this.heap=new Uint16Array(2*pt+1),j(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*pt+1),j(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Ne=e=>{if(!e)return 1;let n=e.state;return!n||n.strm!==e||n.status!==ce&&n.status!==St&&n.status!==gt&&n.status!==bt&&n.status!==xt&&n.status!==vt&&n.status!==ne&&n.status!==xe?1:0},Cn=e=>{if(Ne(e))return ie(e,B);e.total_in=e.total_out=0,e.data_type=Gi;let n=e.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap===2?St:n.wrap?ce:ne,e.adler=n.wrap===2?0:1,n.last_flush=-2,$i(n),D},$n=e=>{let n=Cn(e);return n===D&&sa(e.state),n},ha=(e,n)=>Ne(e)||e.state.wrap!==2?B:(e.state.gzhead=n,D),Ln=(e,n,t,i,a,r)=>{if(!e)return B;let f=1;if(n===Bi&&(n=6),i<0?(f=0,i=-i):i>15&&(f=2,i-=16),a<1||a>ji||t!==Ge||i<8||i>15||n<0||n>9||r<0||r>Yi||i===8&&f!==1)return ie(e,B);i===8&&(i=9);let o=new _a;return e.state=o,o.strm=e,o.status=ce,o.wrap=f,o.gzhead=null,o.w_bits=i,o.w_size=1<Ln(e,n,Ge,Vi,Wi,Xi),da=(e,n)=>{if(Ne(e)||n>Ut||n<0)return e?ie(e,B):B;let t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===xe&&n!==U)return ie(e,e.avail_out===0?it:B);let i=t.last_flush;if(t.last_flush=n,t.pending!==0){if($(e),e.avail_out===0)return t.last_flush=-1,D}else if(e.avail_in===0&&Ft(n)<=Ft(i)&&n!==U)return ie(e,it);if(t.status===xe&&e.avail_in!==0)return ie(e,it);if(t.status===ce&&t.wrap===0&&(t.status=ne),t.status===ce){let a=Ge+(t.w_bits-8<<4)<<8,r=-1;if(t.strategy>=Ue||t.level<2?r=0:t.level<6?r=1:t.level===6?r=2:r=3,a|=r<<6,t.strstart!==0&&(a|=ia),a+=31-a%31,be(t,a),t.strstart!==0&&(be(t,e.adler>>>16),be(t,e.adler&65535)),e.adler=1,t.status=ne,$(e),t.pending!==0)return t.last_flush=-1,D}if(t.status===St){if(e.adler=0,A(t,31),A(t,139),A(t,8),t.gzhead)A(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),A(t,t.gzhead.time&255),A(t,t.gzhead.time>>8&255),A(t,t.gzhead.time>>16&255),A(t,t.gzhead.time>>24&255),A(t,t.level===9?2:t.strategy>=Ue||t.level<2?4:0),A(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(A(t,t.gzhead.extra.length&255),A(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=I(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=gt;else if(A(t,0),A(t,0),A(t,0),A(t,0),A(t,0),A(t,t.level===9?2:t.strategy>=Ue||t.level<2?4:0),A(t,aa),t.status=ne,$(e),t.pending!==0)return t.last_flush=-1,D}if(t.status===gt){if(t.gzhead.extra){let a=t.pending,r=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+r>t.pending_buf_size;){let o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>a&&(e.adler=I(e.adler,t.pending_buf,t.pending-a,a)),t.gzindex+=o,$(e),t.pending!==0)return t.last_flush=-1,D;a=0,r-=o}let f=new Uint8Array(t.gzhead.extra);t.pending_buf.set(f.subarray(t.gzindex,t.gzindex+r),t.pending),t.pending+=r,t.gzhead.hcrc&&t.pending>a&&(e.adler=I(e.adler,t.pending_buf,t.pending-a,a)),t.gzindex=0}t.status=bt}if(t.status===bt){if(t.gzhead.name){let a=t.pending,r;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>a&&(e.adler=I(e.adler,t.pending_buf,t.pending-a,a)),$(e),t.pending!==0)return t.last_flush=-1,D;a=0}t.gzindexa&&(e.adler=I(e.adler,t.pending_buf,t.pending-a,a)),t.gzindex=0}t.status=xt}if(t.status===xt){if(t.gzhead.comment){let a=t.pending,r;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>a&&(e.adler=I(e.adler,t.pending_buf,t.pending-a,a)),$(e),t.pending!==0)return t.last_flush=-1,D;a=0}t.gzindexa&&(e.adler=I(e.adler,t.pending_buf,t.pending-a,a))}t.status=vt}if(t.status===vt){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&($(e),t.pending!==0))return t.last_flush=-1,D;A(t,e.adler&255),A(t,e.adler>>8&255),e.adler=0}if(t.status=ne,$(e),t.pending!==0)return t.last_flush=-1,D}if(e.avail_in!==0||t.lookahead!==0||n!==q&&t.status!==xe){let a=t.level===0?Zn(t,n):t.strategy===Ue?fa(t,n):t.strategy===Ki?oa(t,n):ve[t.level].func(t,n);if((a===re||a===ge)&&(t.status=xe),a===Z||a===re)return e.avail_out===0&&(t.last_flush=-1),D;if(a===pe&&(n===Mi?Ui(t):n!==Ut&&(wt(t,0,0,!1),n===Fi&&(j(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),$(e),e.avail_out===0))return t.last_flush=-1,D}return n!==U?D:t.wrap<=0?Mt:(t.wrap===2?(A(t,e.adler&255),A(t,e.adler>>8&255),A(t,e.adler>>16&255),A(t,e.adler>>24&255),A(t,e.total_in&255),A(t,e.total_in>>8&255),A(t,e.total_in>>16&255),A(t,e.total_in>>24&255)):(be(t,e.adler>>>16),be(t,e.adler&65535)),$(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?D:Mt)},ua=e=>{if(Ne(e))return B;let n=e.state.status;return e.state=null,n===ne?ie(e,Hi):D},wa=(e,n)=>{let t=n.length;if(Ne(e))return B;let i=e.state,a=i.wrap;if(a===2||a===1&&i.status!==ce||i.lookahead)return B;if(a===1&&(e.adler=ze(e.adler,n,t,0)),i.wrap=0,t>=i.w_size){a===0&&(j(i.head),i.strstart=0,i.block_start=0,i.insert=0);let h=new Uint8Array(i.w_size);h.set(n.subarray(t-i.w_size,t),0),n=h,t=i.w_size}let r=e.avail_in,f=e.next_in,o=e.input;for(e.avail_in=t,e.next_in=0,e.input=n,de(i);i.lookahead>=v;){let h=i.strstart,l=i.lookahead-(v-1);do i.ins_h=J(i,i.ins_h,i.window[h+v-1]),i.prev[h&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=h,h++;while(--l);i.strstart=h,i.lookahead=v-1,de(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=v-1,i.match_available=0,e.next_in=f,e.input=o,e.avail_in=r,i.wrap=a,D},pa=ca,ga=Ln,ba=$n,xa=Cn,va=ha,ka=da,ma=ua,Ea=wa,ya="pako deflate (from Nodeca project)",me={deflateInit:pa,deflateInit2:ga,deflateReset:ba,deflateResetKeep:xa,deflateSetHeader:va,deflate:ka,deflateEnd:ma,deflateSetDictionary:Ea,deflateInfo:ya},Aa=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),Sa=function(e){let n=Array.prototype.slice.call(arguments,1);for(;n.length;){let t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)Aa(t,i)&&(e[i]=t[i])}}return e},Ta=e=>{let n=0;for(let i=0,a=e.length;i=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Re[254]=Re[254]=1;var za=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,i,a,r,f=e.length,o=0;for(a=0;a>>6,n[r++]=128|t&63):t<65536?(n[r++]=224|t>>>12,n[r++]=128|t>>>6&63,n[r++]=128|t&63):(n[r++]=240|t>>>18,n[r++]=128|t>>>12&63,n[r++]=128|t>>>6&63,n[r++]=128|t&63);return n},Ra=(e,n)=>{if(n<65534&&e.subarray&&Un)return String.fromCharCode.apply(null,e.length===n?e:e.subarray(0,n));let t="";for(let i=0;i{let t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let i,a,r=new Array(t*2);for(a=0,i=0;i4){r[a++]=65533,i+=o-1;continue}for(f&=o===2?31:o===3?15:7;o>1&&i1){r[a++]=65533;continue}f<65536?r[a++]=f:(f-=65536,r[a++]=55296|f>>10&1023,r[a++]=56320|f&1023)}return Ra(r,a)},Ia=(e,n)=>{n=n||e.length,n>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(e[t]&192)===128;)t--;return t<0||t===0?n:t+Re[e[t]]>n?t:n},Oe={string2buf:za,buf2string:Oa,utf8border:Ia};function Da(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Mn=Da,Fn=Object.prototype.toString,{Z_NO_FLUSH:Na,Z_SYNC_FLUSH:Za,Z_FULL_FLUSH:Ca,Z_FINISH:$a,Z_OK:Ye,Z_STREAM_END:La,Z_DEFAULT_COMPRESSION:Ua,Z_DEFAULT_STRATEGY:Ma,Z_DEFLATED:Fa}=we;function Ze(e){this.options=je.assign({level:Ua,method:Fa,chunkSize:16384,windowBits:15,memLevel:8,strategy:Ma},e||{});let n=this.options;n.raw&&n.windowBits>0?n.windowBits=-n.windowBits:n.gzip&&n.windowBits>0&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mn,this.strm.avail_out=0;let t=me.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==Ye)throw new Error(ae[t]);if(n.header&&me.deflateSetHeader(this.strm,n.header),n.dictionary){let i;if(typeof n.dictionary=="string"?i=Oe.string2buf(n.dictionary):Fn.call(n.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(n.dictionary):i=n.dictionary,t=me.deflateSetDictionary(this.strm,i),t!==Ye)throw new Error(ae[t]);this._dict_set=!0}}Ze.prototype.push=function(e,n){let t=this.strm,i=this.options.chunkSize,a,r;if(this.ended)return!1;for(n===~~n?r=n:r=n===!0?$a:Na,typeof e=="string"?t.input=Oe.string2buf(e):Fn.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(r===Za||r===Ca)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(a=me.deflate(t,r),a===La)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),a=me.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ye;if(t.avail_out===0){this.onData(t.output);continue}if(r>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Ze.prototype.onData=function(e){this.chunks.push(e)};Ze.prototype.onEnd=function(e){e===Ye&&(this.result=je.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Tt(e,n){let t=new Ze(n);if(t.push(e,!0),t.err)throw t.msg||ae[t.err];return t.result}function Ha(e,n){return n=n||{},n.raw=!0,Tt(e,n)}function Ba(e,n){return n=n||{},n.gzip=!0,Tt(e,n)}var Pa=Ze,Ka=Tt,Ya=Ha,Xa=Ba,Ga=we,ja={Deflate:Pa,deflate:Ka,deflateRaw:Ya,gzip:Xa,constants:Ga},Me=16209,Va=16191,Wa=function(n,t){let i,a,r,f,o,h,l,s,E,d,_,u,R,k,g,S,b,c,y,O,w,T,m,p,x=n.state;i=n.next_in,m=n.input,a=i+(n.avail_in-5),r=n.next_out,p=n.output,f=r-(t-n.avail_out),o=r+(n.avail_out-257),h=x.dmax,l=x.wsize,s=x.whave,E=x.wnext,d=x.window,_=x.hold,u=x.bits,R=x.lencode,k=x.distcode,g=(1<>>24,_>>>=c,u-=c,c=b>>>16&255,c===0)p[r++]=b&65535;else if(c&16){y=b&65535,c&=15,c&&(u>>=c,u-=c),u<15&&(_+=m[i++]<>>24,_>>>=c,u-=c,c=b>>>16&255,c&16){if(O=b&65535,c&=15,uh){n.msg="invalid distance too far back",x.mode=Me;break e}if(_>>>=c,u-=c,c=r-f,O>c){if(c=O-c,c>s&&x.sane){n.msg="invalid distance too far back",x.mode=Me;break e}if(w=0,T=d,E===0){if(w+=l-c,c2;)p[r++]=T[w++],p[r++]=T[w++],p[r++]=T[w++],y-=3;y&&(p[r++]=T[w++],y>1&&(p[r++]=T[w++]))}else{w=r-O;do p[r++]=p[w++],p[r++]=p[w++],p[r++]=p[w++],y-=3;while(y>2);y&&(p[r++]=p[w++],y>1&&(p[r++]=p[w++]))}}else if((c&64)===0){b=k[(b&65535)+(_&(1<>3,i-=y,u-=y<<3,_&=(1<{let h=o.bits,l=0,s=0,E=0,d=0,_=0,u=0,R=0,k=0,g=0,S=0,b,c,y,O,w,T=null,m,p=new Uint16Array(_e+1),x=new Uint16Array(_e+1),ee=null,Dt,$e,Le;for(l=0;l<=_e;l++)p[l]=0;for(s=0;s=1&&p[d]===0;d--);if(_>d&&(_=d),d===0)return a[r++]=1<<24|64<<16|0,a[r++]=1<<24|64<<16|0,o.bits=1,0;for(E=1;E0&&(e===Pt||d!==1))return-1;for(x[1]=0,l=1;l<_e;l++)x[l+1]=x[l]+p[l];for(s=0;sHt||e===Kt&&g>Bt)return 1;for(;;){Dt=l-R,f[s]+1=m?($e=ee[f[s]-m],Le=T[f[s]-m]):($e=96,Le=0),b=1<>R)+c]=Dt<<24|$e<<16|Le|0;while(c!==0);for(b=1<>=1;if(b!==0?(S&=b-1,S+=b):S=0,s++,--p[l]===0){if(l===d)break;l=n[t+f[s]]}if(l>_&&(S&O)!==y){for(R===0&&(R=_),w+=E,u=l-R,k=1<Ht||e===Kt&&g>Bt)return 1;y=S&O,a[y]=_<<24|u<<16|w-r|0}}return S!==0&&(a[w+S]=l-R<<24|64<<16|0),o.bits=_,0},Ee=tr,nr=0,Hn=1,Bn=2,{Z_FINISH:Yt,Z_BLOCK:ir,Z_TREES:Fe,Z_OK:le,Z_STREAM_END:ar,Z_NEED_DICT:rr,Z_STREAM_ERROR:M,Z_DATA_ERROR:Pn,Z_MEM_ERROR:Kn,Z_BUF_ERROR:lr,Z_DEFLATED:Xt}=we,Ve=16180,Gt=16181,jt=16182,Vt=16183,Wt=16184,qt=16185,Jt=16186,Qt=16187,en=16188,tn=16189,Xe=16190,K=16191,lt=16192,nn=16193,ot=16194,an=16195,rn=16196,ln=16197,on=16198,He=16199,Be=16200,fn=16201,sn=16202,_n=16203,hn=16204,cn=16205,ft=16206,dn=16207,un=16208,z=16209,Yn=16210,Xn=16211,or=852,fr=592,sr=15,_r=sr,wn=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function hr(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var oe=e=>{if(!e)return 1;let n=e.state;return!n||n.strm!==e||n.modeXn?1:0},Gn=e=>{if(oe(e))return M;let n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=n.wrap&1),n.mode=Ve,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(or),n.distcode=n.distdyn=new Int32Array(fr),n.sane=1,n.back=-1,le},jn=e=>{if(oe(e))return M;let n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,Gn(e)},Vn=(e,n)=>{let t;if(oe(e))return M;let i=e.state;return n<0?(t=0,n=-n):(t=(n>>4)+5,n<48&&(n&=15)),n&&(n<8||n>15)?M:(i.window!==null&&i.wbits!==n&&(i.window=null),i.wrap=t,i.wbits=n,jn(e))},Wn=(e,n)=>{if(!e)return M;let t=new hr;e.state=t,t.strm=e,t.window=null,t.mode=Ve;let i=Vn(e,n);return i!==le&&(e.state=null),i},cr=e=>Wn(e,_r),pn=!0,st,_t,dr=e=>{if(pn){st=new Int32Array(512),_t=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(Ee(Hn,e.lens,0,288,st,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;Ee(Bn,e.lens,0,32,_t,0,e.work,{bits:5}),pn=!1}e.lencode=st,e.lenbits=9,e.distcode=_t,e.distbits=5},qn=(e,n,t,i)=>{let a,r=e.state;return r.window===null&&(r.wsize=1<=r.wsize?(r.window.set(n.subarray(t-r.wsize,t),0),r.wnext=0,r.whave=r.wsize):(a=r.wsize-r.wnext,a>i&&(a=i),r.window.set(n.subarray(t-i,t-i+a),r.wnext),i-=a,i?(r.window.set(n.subarray(t-i,t),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave{let t,i,a,r,f,o,h,l,s,E,d,_,u,R,k=0,g,S,b,c,y,O,w,T,m=new Uint8Array(4),p,x,ee=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(oe(e)||!e.output||!e.input&&e.avail_in!==0)return M;t=e.state,t.mode===K&&(t.mode=lt),f=e.next_out,a=e.output,h=e.avail_out,r=e.next_in,i=e.input,o=e.avail_in,l=t.hold,s=t.bits,E=o,d=h,T=le;e:for(;;)switch(t.mode){case Ve:if(t.wrap===0){t.mode=lt;break}for(;s<16;){if(o===0)break e;o--,l+=i[r++]<>>8&255,t.check=I(t.check,m,2,0),l=0,s=0,t.mode=Gt;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",t.mode=z;break}if((l&15)!==Xt){e.msg="unknown compression method",t.mode=z;break}if(l>>>=4,s-=4,w=(l&15)+8,t.wbits===0&&(t.wbits=w),w>15||w>t.wbits){e.msg="invalid window size",t.mode=z;break}t.dmax=1<>8&1),t.flags&512&&t.wrap&4&&(m[0]=l&255,m[1]=l>>>8&255,t.check=I(t.check,m,2,0)),l=0,s=0,t.mode=jt;case jt:for(;s<32;){if(o===0)break e;o--,l+=i[r++]<>>8&255,m[2]=l>>>16&255,m[3]=l>>>24&255,t.check=I(t.check,m,4,0)),l=0,s=0,t.mode=Vt;case Vt:for(;s<16;){if(o===0)break e;o--,l+=i[r++]<>8),t.flags&512&&t.wrap&4&&(m[0]=l&255,m[1]=l>>>8&255,t.check=I(t.check,m,2,0)),l=0,s=0,t.mode=Wt;case Wt:if(t.flags&1024){for(;s<16;){if(o===0)break e;o--,l+=i[r++]<>>8&255,t.check=I(t.check,m,2,0)),l=0,s=0}else t.head&&(t.head.extra=null);t.mode=qt;case qt:if(t.flags&1024&&(_=t.length,_>o&&(_=o),_&&(t.head&&(w=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(r,r+_),w)),t.flags&512&&t.wrap&4&&(t.check=I(t.check,i,_,r)),o-=_,r+=_,t.length-=_),t.length))break e;t.length=0,t.mode=Jt;case Jt:if(t.flags&2048){if(o===0)break e;_=0;do w=i[r+_++],t.head&&w&&t.length<65536&&(t.head.name+=String.fromCharCode(w));while(w&&_>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=K;break;case tn:for(;s<32;){if(o===0)break e;o--,l+=i[r++]<>>=s&7,s-=s&7,t.mode=ft;break}for(;s<3;){if(o===0)break e;o--,l+=i[r++]<>>=1,s-=1,l&3){case 0:t.mode=nn;break;case 1:if(dr(t),t.mode=He,n===Fe){l>>>=2,s-=2;break e}break;case 2:t.mode=rn;break;case 3:e.msg="invalid block type",t.mode=z}l>>>=2,s-=2;break;case nn:for(l>>>=s&7,s-=s&7;s<32;){if(o===0)break e;o--,l+=i[r++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=z;break}if(t.length=l&65535,l=0,s=0,t.mode=ot,n===Fe)break e;case ot:t.mode=an;case an:if(_=t.length,_){if(_>o&&(_=o),_>h&&(_=h),_===0)break e;a.set(i.subarray(r,r+_),f),o-=_,r+=_,h-=_,f+=_,t.length-=_;break}t.mode=K;break;case rn:for(;s<14;){if(o===0)break e;o--,l+=i[r++]<>>=5,s-=5,t.ndist=(l&31)+1,l>>>=5,s-=5,t.ncode=(l&15)+4,l>>>=4,s-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=z;break}t.have=0,t.mode=ln;case ln:for(;t.have>>=3,s-=3}for(;t.have<19;)t.lens[ee[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,p={bits:t.lenbits},T=Ee(nr,t.lens,0,19,t.lencode,0,t.work,p),t.lenbits=p.bits,T){e.msg="invalid code lengths set",t.mode=z;break}t.have=0,t.mode=on;case on:for(;t.have>>24,S=k>>>16&255,b=k&65535,!(g<=s);){if(o===0)break e;o--,l+=i[r++]<>>=g,s-=g,t.lens[t.have++]=b;else{if(b===16){for(x=g+2;s>>=g,s-=g,t.have===0){e.msg="invalid bit length repeat",t.mode=z;break}w=t.lens[t.have-1],_=3+(l&3),l>>>=2,s-=2}else if(b===17){for(x=g+3;s>>=g,s-=g,w=0,_=3+(l&7),l>>>=3,s-=3}else{for(x=g+7;s>>=g,s-=g,w=0,_=11+(l&127),l>>>=7,s-=7}if(t.have+_>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=z;break}for(;_--;)t.lens[t.have++]=w}}if(t.mode===z)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=z;break}if(t.lenbits=9,p={bits:t.lenbits},T=Ee(Hn,t.lens,0,t.nlen,t.lencode,0,t.work,p),t.lenbits=p.bits,T){e.msg="invalid literal/lengths set",t.mode=z;break}if(t.distbits=6,t.distcode=t.distdyn,p={bits:t.distbits},T=Ee(Bn,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,p),t.distbits=p.bits,T){e.msg="invalid distances set",t.mode=z;break}if(t.mode=He,n===Fe)break e;case He:t.mode=Be;case Be:if(o>=6&&h>=258){e.next_out=f,e.avail_out=h,e.next_in=r,e.avail_in=o,t.hold=l,t.bits=s,Wa(e,d),f=e.next_out,a=e.output,h=e.avail_out,r=e.next_in,i=e.input,o=e.avail_in,l=t.hold,s=t.bits,t.mode===K&&(t.back=-1);break}for(t.back=0;k=t.lencode[l&(1<>>24,S=k>>>16&255,b=k&65535,!(g<=s);){if(o===0)break e;o--,l+=i[r++]<>c)],g=k>>>24,S=k>>>16&255,b=k&65535,!(c+g<=s);){if(o===0)break e;o--,l+=i[r++]<>>=c,s-=c,t.back+=c}if(l>>>=g,s-=g,t.back+=g,t.length=b,S===0){t.mode=cn;break}if(S&32){t.back=-1,t.mode=K;break}if(S&64){e.msg="invalid literal/length code",t.mode=z;break}t.extra=S&15,t.mode=fn;case fn:if(t.extra){for(x=t.extra;s>>=t.extra,s-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=sn;case sn:for(;k=t.distcode[l&(1<>>24,S=k>>>16&255,b=k&65535,!(g<=s);){if(o===0)break e;o--,l+=i[r++]<>c)],g=k>>>24,S=k>>>16&255,b=k&65535,!(c+g<=s);){if(o===0)break e;o--,l+=i[r++]<>>=c,s-=c,t.back+=c}if(l>>>=g,s-=g,t.back+=g,S&64){e.msg="invalid distance code",t.mode=z;break}t.offset=b,t.extra=S&15,t.mode=_n;case _n:if(t.extra){for(x=t.extra;s>>=t.extra,s-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=z;break}t.mode=hn;case hn:if(h===0)break e;if(_=d-h,t.offset>_){if(_=t.offset-_,_>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=z;break}_>t.wnext?(_-=t.wnext,u=t.wsize-_):u=t.wnext-_,_>t.length&&(_=t.length),R=t.window}else R=a,u=f-t.offset,_=t.length;_>h&&(_=h),h-=_,t.length-=_;do a[f++]=R[u++];while(--_);t.length===0&&(t.mode=Be);break;case cn:if(h===0)break e;a[f++]=t.length,h--,t.mode=Be;break;case ft:if(t.wrap){for(;s<32;){if(o===0)break e;o--,l|=i[r++]<{if(oe(e))return M;let n=e.state;return n.window&&(n.window=null),e.state=null,le},pr=(e,n)=>{if(oe(e))return M;let t=e.state;return(t.wrap&2)===0?M:(t.head=n,n.done=!1,le)},gr=(e,n)=>{let t=n.length,i,a,r;return oe(e)||(i=e.state,i.wrap!==0&&i.mode!==Xe)?M:i.mode===Xe&&(a=1,a=ze(a,n,t,0),a!==i.check)?Pn:(r=qn(e,n,t,t),r?(i.mode=Yn,Kn):(i.havedict=1,le))},br=jn,xr=Vn,vr=Gn,kr=cr,mr=Wn,Er=ur,yr=wr,Ar=pr,Sr=gr,Tr="pako inflate (from Nodeca project)",X={inflateReset:br,inflateReset2:xr,inflateResetKeep:vr,inflateInit:kr,inflateInit2:mr,inflate:Er,inflateEnd:yr,inflateGetHeader:Ar,inflateSetDictionary:Sr,inflateInfo:Tr};function zr(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Rr=zr,Jn=Object.prototype.toString,{Z_NO_FLUSH:Or,Z_FINISH:Ir,Z_OK:Ie,Z_STREAM_END:ht,Z_NEED_DICT:ct,Z_STREAM_ERROR:Dr,Z_DATA_ERROR:gn,Z_MEM_ERROR:Nr}=we;function Ce(e){this.options=je.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});let n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),n.windowBits>=0&&n.windowBits<16&&!(e&&e.windowBits)&&(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(n.windowBits&15)===0&&(n.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mn,this.strm.avail_out=0;let t=X.inflateInit2(this.strm,n.windowBits);if(t!==Ie)throw new Error(ae[t]);if(this.header=new Rr,X.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Oe.string2buf(n.dictionary):Jn.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=X.inflateSetDictionary(this.strm,n.dictionary),t!==Ie)))throw new Error(ae[t])}Ce.prototype.push=function(e,n){let t=this.strm,i=this.options.chunkSize,a=this.options.dictionary,r,f,o;if(this.ended)return!1;for(n===~~n?f=n:f=n===!0?Ir:Or,Jn.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),r=X.inflate(t,f),r===ct&&a&&(r=X.inflateSetDictionary(t,a),r===Ie?r=X.inflate(t,f):r===gn&&(r=ct));t.avail_in>0&&r===ht&&t.state.wrap>0&&e[t.next_in]!==0;)X.inflateReset(t),r=X.inflate(t,f);switch(r){case Dr:case gn:case ct:case Nr:return this.onEnd(r),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||r===ht))if(this.options.to==="string"){let h=Oe.utf8border(t.output,t.next_out),l=t.next_out-h,s=Oe.buf2string(t.output,h);t.next_out=l,t.avail_out=i-l,l&&t.output.set(t.output.subarray(h,h+l),0),this.onData(s)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(r===Ie&&o===0)){if(r===ht)return r=X.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Ce.prototype.onData=function(e){this.chunks.push(e)};Ce.prototype.onEnd=function(e){e===Ie&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=je.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function zt(e,n){let t=new Ce(n);if(t.push(e),t.err)throw t.msg||ae[t.err];return t.result}function Zr(e,n){return n=n||{},n.raw=!0,zt(e,n)}var Cr=Ce,$r=zt,Lr=Zr,Ur=zt,Mr=we,Fr={Inflate:Cr,inflate:$r,inflateRaw:Lr,ungzip:Ur,constants:Mr},{Deflate:Jr,deflate:Qr,deflateRaw:el,gzip:tl}=ja,{Inflate:nl,inflate:il,inflateRaw:al,ungzip:Hr}=Fr;var Qn=Hr;var ei=Uint8Array.from([0,0,0,1,0,0]),Br=4294967296,N=(...e)=>{let n=e.reduce((a,r)=>a+r.length,0),t=new Uint8Array(n),i=0;for(let a of e)t.set(a,i),i+=a.length;return t},fe=(e,n)=>e.length===n.length&&e.every((t,i)=>t===n[i]);function Rt(e,n){let t=0,i=1;for(let a=0;a<10&&n+a>>0,i=Math.floor(n/Br)>>>0,a=[];do{let r=t&127;t=(t>>>7|(i&127)<<25)>>>0,i>>>=7;let f=i!==0||t!==0;a.push(r|(f?128:0))}while(i!==0||t!==0);return Uint8Array.from(a)}var Q=(e,n)=>G(e<<3|n);function We(e,n){return N(Q(e,2),G(n.length),n)}function qe(e){let n=[],t=0;for(;te.length)throw new Error("truncated fixed64");o=e.slice(t,t+8),t+=8}else if(f===2){let h=Rt(e,t);t=h.next;let l=h.value;if(!Number.isSafeInteger(l)||t+l>e.length)throw new Error("truncated length-delimited field");o=e.slice(t,t+l),t+=l}else if(f===5){if(t+4>e.length)throw new Error("truncated fixed32");o=e.slice(t,t+4),t+=4}else throw new Error(`unsupported wire type ${f}`);n.push({number:r,wireType:f,value:o,raw:e.slice(i,t)})}return n}function ti(e,n,t){let i=qe(e);if(!i.some(h=>h.number===1&&h.wireType===0)||!i.some(h=>h.number===2&&h.wireType===0))return e;let a=!1,r=!1,f=i.map(h=>h.wireType!==0?h.raw:h.number===1?N(Q(1,0),G(Math.round(n.latitude*1e8))):h.number===2?N(Q(2,0),G(Math.round(n.longitude*1e8))):h.number===3?N(Q(3,0),G(n.accuracy)):n.motionSimulationEnabled&&h.number===11?(a=!0,N(Q(11,0),G(63))):n.motionSimulationEnabled&&h.number===12?(r=!0,N(Q(12,0),G(467))):h.raw);n.motionSimulationEnabled&&!a&&f.push(N(Q(11,0),G(63))),n.motionSimulationEnabled&&!r&&f.push(N(Q(12,0),G(467)));let o=N(...f);return fe(o,e)||(t.locations+=1),o}function Pr(e,n,t){let i=qe(e);if(!i.some(o=>o.number===1&&o.wireType===2&&/^[0-9a-fA-F]{1,2}(:[0-9a-fA-F]{1,2}){5}$/.test(Array.from(o.value,h=>String.fromCharCode(h)).join(""))))return e;let r=!1,f=i.map(o=>{if(o.number!==2||o.wireType!==2)return o.raw;let h=ti(o.value,n,t);return r||(r=!fe(h,o.value)),We(2,h)});return r&&(t.wifi+=1),N(...f)}function Kr(e,n,t){let i=!1,a=qe(e).map(r=>{if(r.number!==5||r.wireType!==2)return r.raw;let f=ti(r.value,n,t);return i||(i=!fe(f,r.value)),We(5,f)});return i&&(t.cell+=1),N(...a)}function Je(e,n,t={wifi:0,cell:0,locations:0}){let i=qe(e).map(a=>a.number===2&&a.wireType===2?We(2,Pr(a.value,n,t)):(a.number===22||a.number===24)&&a.wireType===2?We(a.number,Kr(a.value,n,t)):a.raw);return{data:N(...i),stats:t}}var Ot=(e,n)=>e[n]<<8|e[n+1],Yr=(e,n)=>e[n]*16777216+(e[n+1]<<16)+(e[n+2]<<8)+e[n+3]>>>0,ni=e=>Uint8Array.from([e>>>8&255,e&255]),Xr=e=>Uint8Array.from([e>>>24&255,e>>>16&255,e>>>8&255,e&255]);function Gr(e,n){e:for(let t=0;t<=e.length-n.length;t+=1){for(let i=0;ie.length)throw new Error("truncated ARPC string");t+=2+Ot(e,t)}let i=t+4,a=i+4;if(a>e.length)throw new Error("truncated ARPC header");let r=Yr(e,i);if(!r||a+r>e.length)throw new Error("invalid ARPC length");let f=Je(e.slice(a,a+r),n);if(fe(f.data,e.slice(a,a+r)))throw new Error("unchanged ARPC");return{data:N(e.slice(0,i),Xr(f.data.length),f.data,e.slice(a+r)),stats:f.stats}}function Vr(e,n){let t=Gr(e,ei);if(t<0)throw new Error("marker not found");let i=t+ei.length,a=i+2,r=Ot(e,i);if(!r||a+r>e.length)throw new Error("invalid marker length");let f=Je(e.slice(a,a+r),n);if(f.data.length>65535||fe(f.data,e.slice(a,a+r)))throw new Error("unchanged marker");return{data:N(e.slice(0,i),ni(f.data.length),f.data,e.slice(a+r)),stats:f.stats}}function Wr(e,n,t){if(n+10>e.length)throw new Error("short frame");let i=Ot(e,n+8);if(!i||n+10+i>e.length)throw new Error("invalid frame");let a=Je(e.slice(n+10,n+10+i),t);if(a.data.length>65535||fe(a.data,e.slice(n+10,n+10+i)))throw new Error("unchanged frame");return{data:N(e.slice(0,n+8),ni(a.data.length),a.data,e.slice(n+10+i)),stats:a.stats}}function ii(e,n){for(let i of[jr,Vr])try{return i(e,n)}catch(a){}let t=[...new Set([0,2,4,6,8,10,12,14,16,...Array.from({length:Math.min(96,Math.max(0,e.length-10))+1},(i,a)=>a)])];for(let i of t)try{return Wr(e,i,n)}catch(a){}for(let i=0;i<=Math.min(256,e.length);i+=1)try{let a=Je(e.slice(i),n);if(!fe(a.data,e.slice(i)))return{data:N(e.slice(0,i),a.data),stats:a.stats}}catch(a){}throw new Error("no patchable wloc payload found")}var ai="locationSpoofer.settings.v1";function ri(){return typeof $task!="undefined"?"quantumultX":typeof $loon!="undefined"?"loon":typeof $rocket!="undefined"?"shadowrocket":typeof Egern!="undefined"?"egern":typeof $environment!="undefined"&&$environment["stash-version"]?"stash":typeof $environment!="undefined"&&$environment["surge-version"]?"surge":"unknown"}function li(e){let n=ri()==="quantumultX"?$prefs.valueForKey(e):$persistentStore.read(e);if(!n)return null;try{return JSON.parse(n)}catch(t){return null}}function oi(){let e=typeof $response=="undefined"?null:$response,n=e&&e.bodyBytes!=null?e.bodyBytes:e&&e.body;return n instanceof ArrayBuffer?new Uint8Array(n):ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):typeof n=="string"?Uint8Array.from(n,t=>t.charCodeAt(0)&255):new Uint8Array}function qr(e,n){let t=Object.assign({},e||{});for(let i of["Content-Encoding","content-encoding","Transfer-Encoding","transfer-encoding"])delete t[i];return t["Content-Length"]=String(n),t}function fi(e){let n=typeof $response=="undefined"?{}:$response,t=qr(n.headers,e.length),i=ri();i==="quantumultX"?(delete t["Content-Length"],$done({status:"HTTP/1.1 200 OK",headers:t,bodyBytes:e.buffer})):i==="stash"?$done(Object.assign({},n,{status:200,headers:t,body:e})):$done({response:Object.assign({},n,{status:200,headers:t,body:e})})}function It(){$done({})}try{let e=li(ai),n=oi();if(!e||!e.enabled||!n.length)It();else{let i=n.length>=2&&n[0]===31&&n[1]===139?Qn(n):n,a=ii(i,{latitude:Number(e.latitude),longitude:Number(e.longitude),accuracy:Number(e.accuracy!=null?e.accuracy:25),motionSimulationEnabled:e.motionSimulationEnabled===!0});fi(a.data)}}catch(e){console.log(`[Location Spoofer] ${e&&e.message?e.message:e}`),It()}})();
-/*! Bundled license information:
-
-pako/dist/pako.esm.mjs:
- (*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
-*/
+/* wloc.js - Build 2026-08-08 21:31:58 */
+const e=(()=>{const e=e=>e in globalThis;switch(!0){case e("$task"):return"Quantumult X";case e("$loon"):return"Loon";case e("$rocket"):return"Shadowrocket";case e("Egern"):return"Egern";case Boolean(globalThis.$environment?.["surge-version"]):return"Surge";case Boolean(globalThis.$environment?.["stash-version"]):return"Stash";case e("Cloudflare"):return"Worker";case Boolean(globalThis.process?.versions?.node):return"Node.js";default:return}})();class t{static#e=new Map([]);static#t=[];static#a=new Map([]);static clear=()=>{};static count=(e="default")=>{switch(t.#e.has(e)){case!0:t.#e.set(e,t.#e.get(e)+1);break;case!1:t.#e.set(e,0)}t.log(`${e}: ${t.#e.get(e)}`)};static countReset=(e="default")=>{switch(t.#e.has(e)){case!0:t.#e.set(e,0),t.log(`${e}: ${t.#e.get(e)}`);break;case!1:t.warn(`Counter "${e}" doesn’t exist`)}};static debug=(...e)=>{t.#r<4||(e=e.map(e=>` ${e}`),t.log(...e))};static error(...a){if(!(t.#r<1)){switch(e){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":case"Quantumult X":default:a=a.map(e=>` ${e}`);break;case"Worker":case"Node.js":a=a.map(e=>` ${e?.stack??e}`)}t.log(...a)}}static exception=(...e)=>t.error(...e);static group=e=>t.#t.unshift(e);static groupEnd=()=>t.#t.shift();static info(...e){t.#r<3||(e=e.map(e=>` ${e}`),t.log(...e))}static#r=3;static get logLevel(){switch(t.#r){case 0:return"OFF";case 1:return"ERROR";case 2:return"WARN";case 3:default:return"INFO";case 4:return"DEBUG";case 5:return"ALL"}}static set logLevel(e){switch(typeof e){case"string":e=e.toLowerCase();break;case"number":break;default:e="warn"}switch(e){case 0:case"off":t.#r=0;break;case 1:case"error":t.#r=1;break;case 2:case"warn":case"warning":default:t.#r=2;break;case 3:case"info":t.#r=3;break;case 4:case"debug":t.#r=4;break;case 5:case"all":t.#r=5}}static log=(...e)=>{0!==t.#r&&(e=e.flatMap(e=>{switch(typeof e){case"object":return[JSON.stringify(e)];case"bigint":case"number":case"boolean":return[e.toString()];case"string":return e.split(/\r?\n/u);default:return[e]}}),t.#t.forEach(t=>{(e=e.map(e=>` ${e}`)).unshift(` ${t}:`)}),e=["",...e],console.log(e.join("\n")))};static time=(e="default")=>t.#a.set(e,Date.now());static timeEnd=(e="default")=>t.#a.delete(e);static timeLog=(e="default")=>{const a=t.#a.get(e);a?t.log(`${e}: ${Date.now()-a}ms`):t.warn(`Timer "${e}" doesn’t exist`)};static warn(...e){t.#r<2||(e=e.map(e=>` ${e}`),t.log(...e))}}class a{static escape(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,e=>t[e])}static get(e={},t="",r=void 0){Array.isArray(t)||(t=a.toPath(t));const n=t.reduce((e,t)=>Object(e)[t],e);return void 0===n?r:n}static merge(e,...t){if(null==e)return e;for(const r of t)if(null!=r)for(const t of Object.keys(r)){const n=r[t],i=e[t];switch(!0){case a.#n(n)&&a.#n(i):e[t]=a.merge(i,n);break;case n instanceof Map&&i instanceof Map:if(n.size>0)for(const[e,t]of n)i.set(e,t);break;case n instanceof Set&&i instanceof Set:if(n.size>0)for(const e of n)i.add(e);break;case Array.isArray(n)&&0===n.length&&void 0!==i:case n instanceof Map&&0===n.size&&void 0!==i:case n instanceof Set&&0===n.size&&void 0!==i:break;case void 0!==n:e[t]=n}}return e}static#n(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}static omit(e={},t=[]){return Array.isArray(t)||(t=[t.toString()]),t.forEach(t=>a.unset(e,t)),e}static pick(e={},t=[]){Array.isArray(t)||(t=[t.toString()]);const a=Object.entries(e).filter(([e,a])=>t.includes(e));return Object.fromEntries(a)}static set(e,t,r){return Array.isArray(t)||(t=a.toPath(t)),t.slice(0,-1).reduce((e,a,r)=>Object(e[a])===e[a]?e[a]:e[a]=/^\d+$/.test(t[r+1])?[]:{},e)[t[t.length-1]]=r,e}static toPath(e){return e.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean)}static unescape(e){const t={"&":"&","<":"<",">":">",""":'"',"'":"'"};return e.replace(/&|<|>|"|'/g,e=>t[e])}static unset(e={},t=""){Array.isArray(t)||(t=a.toPath(t));return t.reduce((e,a,r)=>r===t.length-1?(delete e[a],!0):Object(e)[a],e)}}class r{static parse(e){let t={};switch(typeof e){case"string":{const n=e.replace(/^\?/,"");if(!n)break;const i=Object.fromEntries(n.split("&").filter(Boolean).map(e=>{const[t="",a=""]=e.split("=",2);return[r.#i(t).replace(/\[([^\[\]]+)\]/g,".$1"),r.#i(a).replace(/\"/g,"")]}));Object.keys(i).forEach(e=>a.set(t,e,i[e]));break}case"object":switch(e){case null:break;default:{const r={};Object.keys(e).forEach(t=>a.set(r,t,e[t])),t=r;break}}break;case"undefined":t={}}return t}static stringify(e={}){if(!e||"object"!=typeof e)return"";const t=[];return Object.keys(e).forEach(a=>r.#o(e,a,t)),0===t.length?"":t.map(([e,t])=>`${r.#s(r.#l(e))}=${r.#s(t)}`).join("&")}static#o(e,t,n){const i=a.get(e,t);void 0!==i&&(null!==i?Array.isArray(i)?i.forEach((a,i)=>{void 0!==a&&r.#o(e,`${t}[${i}]`,n)}):r.#n(i)?Object.keys(i).forEach(a=>r.#o(e,`${t}.${a}`,n)):n.push([t,String(i)]):n.push([t,""]))}static#l(e){const[t,...r]=a.toPath(e);return r.reduce((e,t)=>/^\d+$/.test(t)?`${e}[${t}]`:`${e}.${t}`,t)}static#n(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}static#s(e){return encodeURIComponent(e)}static#i(e){return decodeURIComponent(e.replace(/\+/g," "))}}t.debug(" $argument"),globalThis.$argument=r.parse(globalThis.$argument),globalThis.$argument.LogLevel&&(t.logLevel=globalThis.$argument.LogLevel),t.debug(" $argument",`$argument: ${JSON.stringify(globalThis.$argument)}`);const n={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Content Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function i(r={}){switch(e){case"Surge":r.policy&&a.set(r,"headers.X-Surge-Policy",r.policy),t.log(" 执行结束!",` ${(new Date).getTime()/1e3-$script.startTime} 秒`),$done(r);break;case"Loon":r.policy&&(r.node=r.policy),t.log(" 执行结束!",` ${(new Date-$script.startTime)/1e3} 秒`),$done(r);break;case"Stash":r.policy&&a.set(r,"headers.X-Stash-Selected-Proxy",encodeURI(r.policy)),t.log(" 执行结束!",` ${(new Date-$script.startTime)/1e3} 秒`),$done(r);break;case"Egern":case"Shadowrocket":t.log(" 执行结束!"),$done(r);break;case"Quantumult X":switch(r.policy&&a.set(r,"opts.policy",r.policy),typeof(r=a.pick(r,["status","url","headers","body","bodyBytes"])).status){case"number":r.status=`HTTP/1.1 ${r.status} ${n[r.status]}`;break;case"string":case"undefined":break;default:throw new TypeError(`${Function.name}: 参数类型错误, status 必须为数字或字符串`)}r.body instanceof ArrayBuffer?(r.bodyBytes=r.body,r.body=void 0):ArrayBuffer.isView(r.body)?(r.bodyBytes=r.body.buffer.slice(r.body.byteOffset,r.body.byteLength+r.body.byteOffset),r.body=void 0):r.body&&(r.bodyBytes=void 0),t.log(" 执行结束!"),$done(r);break;case"Worker":default:t.log(" 执行结束!");break;case"Node.js":t.log(" 执行结束!"),process.exit(1)}}class o{static data=null;static dataFile="box.dat";static#c=/^@(?[^.]+)(?:\.(?.*))?$/;static getItem(t,r=null){let n=r;switch(t.startsWith("@")){case!0:{const{key:e,path:r}=t.match(o.#c)?.groups;t=e;let i=o.getItem(t,{});"object"!=typeof i&&(i={}),n=a.get(i,r);try{n=JSON.parse(n)}catch{}break}default:switch(e){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":n=$persistentStore.read(t);break;case"Quantumult X":n=$prefs.valueForKey(t);break;case"Worker":o.data=o.data??{},n=o.data[t];break;case"Node.js":o.data=o.#d(o.dataFile),n=o.data?.[t];break;default:n=o.data?.[t]||null}try{n=JSON.parse(n)}catch{}}return n??r}static setItem(t=new String,r=new String){let n=!1;if("object"==typeof r)r=JSON.stringify(r);else r=String(r);switch(t.startsWith("@")){case!0:{const{key:e,path:i}=t.match(o.#c)?.groups;t=e;let s=o.getItem(t,{});"object"!=typeof s&&(s={}),a.set(s,i,r),n=o.setItem(t,s);break}default:switch(e){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":n=$persistentStore.write(r,t);break;case"Quantumult X":n=$prefs.setValueForKey(r,t);break;case"Worker":o.data=o.data??{},o.data[t]=r,n=!0;break;case"Node.js":o.data=o.#d(o.dataFile),o.data[t]=r,o.#u(o.dataFile),n=!0;break;default:n=o.data?.[t]||null}}return n}static removeItem(t){let r=!1;switch(t.startsWith("@")){case!0:{const{key:e,path:n}=t.match(o.#c)?.groups;t=e;let i=o.getItem(t);"object"!=typeof i&&(i={}),a.unset(i,n),r=o.setItem(t,i);break}default:switch(e){case"Surge":r=$persistentStore.write(null,t);break;case"Loon":case"Stash":case"Egern":case"Shadowrocket":default:r=!1;break;case"Quantumult X":r=$prefs.removeValueForKey(t);break;case"Worker":o.data=o.data??{},delete o.data[t],r=!0;break;case"Node.js":o.data=o.#d(o.dataFile),delete o.data[t],o.#u(o.dataFile),r=!0}}return r}static clear(){let t=!1;switch(e){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":default:t=!1;break;case"Quantumult X":t=$prefs.removeAllValues();break;case"Worker":o.data={},t=!0;break;case"Node.js":o.data=o.#d(o.dataFile),o.data={},o.#u(o.dataFile),t=!0}return t}static#d=t=>{if("Node.js"!==e)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const e=this.path.resolve(t),a=this.path.resolve(process.cwd(),t),r=this.fs.existsSync(e),n=!r&&this.fs.existsSync(a);if(!r&&!n)return{};{const t=r?e:a;try{return JSON.parse(this.fs.readFileSync(t))}catch(e){return{}}}}};static#u=(t=this.dataFile)=>{if("Node.js"===e){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const e=this.path.resolve(t),a=this.path.resolve(process.cwd(),t),r=this.fs.existsSync(e),n=!r&&this.fs.existsSync(a),i=JSON.stringify(this.data);r?this.fs.writeFileSync(e,i):n?this.fs.writeFileSync(a,i):this.fs.writeFileSync(e,i)}}}function s(e){let t=e.length;for(;--t>=0;)e[t]=0}s(new Array(576));s(new Array(60));s(new Array(512));s(new Array(256));s(new Array(29));s(new Array(30));var l=(e,t,a,r)=>{let n=65535&e,i=e>>>16&65535,o=0;for(;0!==a;){o=a>2e3?2e3:a,a-=o;do{n=n+t[r++]|0,i=i+n|0}while(--o);n%=65521,i%=65521}return n|i<<16};const c=new Uint32Array((()=>{let e,t=[];for(var a=0;a<256;a++){e=a;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[a]=e}return t})());var d=(e,t,a,r)=>{const n=c,i=r+a;e^=-1;for(let a=r;a>>8^n[255&(e^t[a])];return-1^e},u={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},f={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const h=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var w=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const a=t.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const t in a)h(a,t)&&(e[t]=a[t])}}return e},g=e=>{let t=0;for(let a=0,r=e.length;a=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;b[254]=b[255]=1;var m=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,a,r,n,i,o=e.length,s=0;for(n=0;n>>6,t[i++]=128|63&a):a<65536?(t[i++]=224|a>>>12,t[i++]=128|a>>>6&63,t[i++]=128|63&a):(t[i++]=240|a>>>18,t[i++]=128|a>>>12&63,t[i++]=128|a>>>6&63,t[i++]=128|63&a);return t},y=(e,t)=>{const a=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,n;const i=new Array(2*a);for(n=0,r=0;r4)i[n++]=65533,r+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&r1?i[n++]=65533:t<65536?i[n++]=t:(t-=65536,i[n++]=55296|t>>10&1023,i[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&p)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let a="";for(let r=0;r{(t=t||e.length)>e.length&&(t=e.length);let a=t-1;for(;a>=0&&128==(192&e[a]);)a--;return a<0||0===a?t:a+b[e[a]]>t?a:t};var v=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const _=16209;var x=function(e,t){let a,r,n,i,o,s,l,c,d,u,f,h,w,g,p,b,m,y,k,v,x,E,A,$;const R=e.state;a=e.next_in,A=e.input,r=a+(e.avail_in-5),n=e.next_out,$=e.output,i=n-(t-e.avail_out),o=n+(e.avail_out-257),s=R.dmax,l=R.wsize,c=R.whave,d=R.wnext,u=R.window,f=R.hold,h=R.bits,w=R.lencode,g=R.distcode,p=(1<>>24,f>>>=y,h-=y,y=m>>>16&255,0===y)$[n++]=65535&m;else{if(!(16&y)){if(64&y){if(32&y){R.mode=16191;break e}e.msg="invalid literal/length code",R.mode=_;break e}m=w[(65535&m)+(f&(1<>>=y,h-=y),h<15&&(f+=A[a++]<>>24,f>>>=y,h-=y,y=m>>>16&255,16&y){if(v=65535&m,y&=15,hs){e.msg="invalid distance too far back",R.mode=_;break e}if(f>>>=y,h-=y,y=n-i,v>y){if(y=v-y,y>c&&R.sane){e.msg="invalid distance too far back",R.mode=_;break e}if(x=0,E=u,0===d){if(x+=l-y,y2;)$[n++]=E[x++],$[n++]=E[x++],$[n++]=E[x++],k-=3;k&&($[n++]=E[x++],k>1&&($[n++]=E[x++]))}else{x=n-v;do{$[n++]=$[x++],$[n++]=$[x++],$[n++]=$[x++],k-=3}while(k>2);k&&($[n++]=$[x++],k>1&&($[n++]=$[x++]))}break}if(64&y){e.msg="invalid distance code",R.mode=_;break e}m=g[(65535&m)+(f&(1<>3,a-=k,h-=k<<3,f&=(1<{const l=s.bits;let c,d,u,f,h,w,g=0,p=0,b=0,m=0,y=0,k=0,v=0,_=0,x=0,T=0,N=null;const M=new Uint16Array(16),O=new Uint16Array(16);let j,F,I,L=null;for(g=0;g<=E;g++)M[g]=0;for(p=0;p=1&&0===M[m];m--);if(y>m&&(y=m),0===m)return n[i++]=20971520,n[i++]=20971520,s.bits=1,0;for(b=1;b0&&(0===e||1!==m))return-1;for(O[1]=0,g=1;g852||2===e&&x>592)return 1;for(;;){j=g-v,o[p]+1=w?(F=L[o[p]-w],I=N[o[p]-w]):(F=96,I=0),c=1<>v)+d]=j<<24|F<<16|I}while(0!==d);for(c=1<>=1;if(0!==c?(T&=c-1,T+=c):T=0,p++,0===--M[g]){if(g===m)break;g=t[a+o[p]]}if(g>y&&(T&f)!==u){for(0===v&&(v=y),h+=b,k=g-v,_=1<852||2===e&&x>592)return 1;u=T&f,n[u]=y<<24|k<<16|h-i}}return 0!==T&&(n[h+T]=g-v<<24|64<<16),s.bits=y,0};const{Z_FINISH:N,Z_BLOCK:M,Z_TREES:O,Z_OK:j,Z_STREAM_END:F,Z_NEED_DICT:I,Z_STREAM_ERROR:L,Z_DATA_ERROR:B,Z_MEM_ERROR:C,Z_BUF_ERROR:U,Z_DEFLATED:P}=f,D=16180,Z=16190,z=16191,q=16192,H=16194,W=16199,K=16200,X=16206,Q=16209,V=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function J(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const G=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Y=e=>{if(G(e))return L;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=D,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,j},ee=e=>{if(G(e))return L;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Y(e)},te=(e,t)=>{let a;if(G(e))return L;const r=e.state;return t<0?(a=0,t=-t):(a=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?L:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=a,r.wbits=t,ee(e))},ae=(e,t)=>{if(!e)return L;const a=new J;e.state=a,a.strm=e,a.window=null,a.mode=D;const r=te(e,t);return r!==j&&(e.state=null),r};let re,ne,ie=!0;const oe=e=>{if(ie){re=new Int32Array(512),ne=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(T(1,e.lens,0,288,re,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;T(2,e.lens,0,32,ne,0,e.work,{bits:5}),ie=!1}e.lencode=re,e.lenbits=9,e.distcode=ne,e.distbits=5},se=(e,t,a,r)=>{let n;const i=e.state;return null===i.window&&(i.window=new Uint8Array(1<=i.wsize?(i.window.set(t.subarray(a-i.wsize,a),0),i.wnext=0,i.whave=i.wsize):(n=i.wsize-i.wnext,n>r&&(n=r),i.window.set(t.subarray(a-r,a-r+n),i.wnext),(r-=n)?(i.window.set(t.subarray(a-r,a),0),i.wnext=r,i.whave=i.wsize):(i.wnext+=n,i.wnext===i.wsize&&(i.wnext=0),i.whaveae(e,15),inflateInit2:ae,inflate:(e,t)=>{let a,r,n,i,o,s,c,u,f,h,w,g,p,b,m,y,k,v,_,E,A,$,R=0;const S=new Uint8Array(4);let J,Y;const ee=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(G(e)||!e.output||!e.input&&0!==e.avail_in)return L;a=e.state,a.mode===z&&(a.mode=q),o=e.next_out,n=e.output,c=e.avail_out,i=e.next_in,r=e.input,s=e.avail_in,u=a.hold,f=a.bits,h=s,w=c,$=j;e:for(;;)switch(a.mode){case D:if(0===a.wrap){a.mode=q;break}for(;f<16;){if(0===s)break e;s--,u+=r[i++]<>>8&255,a.check=d(a.check,S,2,0),u=0,f=0,a.mode=16181;break}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",a.mode=Q;break}if((15&u)!==P){e.msg="unknown compression method",a.mode=Q;break}if(u>>>=4,f-=4,A=8+(15&u),0===a.wbits&&(a.wbits=A),A>15||A>a.wbits){e.msg="invalid window size",a.mode=Q;break}a.dmax=1<>8&1),512&a.flags&&4&a.wrap&&(S[0]=255&u,S[1]=u>>>8&255,a.check=d(a.check,S,2,0)),u=0,f=0,a.mode=16182;case 16182:for(;f<32;){if(0===s)break e;s--,u+=r[i++]<>>8&255,S[2]=u>>>16&255,S[3]=u>>>24&255,a.check=d(a.check,S,4,0)),u=0,f=0,a.mode=16183;case 16183:for(;f<16;){if(0===s)break e;s--,u+=r[i++]<>8),512&a.flags&&4&a.wrap&&(S[0]=255&u,S[1]=u>>>8&255,a.check=d(a.check,S,2,0)),u=0,f=0,a.mode=16184;case 16184:if(1024&a.flags){for(;f<16;){if(0===s)break e;s--,u+=r[i++]<>>8&255,a.check=d(a.check,S,2,0)),u=0,f=0}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(g=a.length,g>s&&(g=s),g&&(a.head&&(A=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(r.subarray(i,i+g),A)),512&a.flags&&4&a.wrap&&(a.check=d(a.check,r,g,i)),s-=g,i+=g,a.length-=g),a.length))break e;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===s)break e;g=0;do{A=r[i+g++],a.head&&A&&a.length<65536&&(a.head.name+=String.fromCharCode(A))}while(A&&g>9&1,a.head.done=!0),e.adler=a.check=0,a.mode=z;break;case 16189:for(;f<32;){if(0===s)break e;s--,u+=r[i++]<>>=7&f,f-=7&f,a.mode=X;break}for(;f<3;){if(0===s)break e;s--,u+=r[i++]<>>=1,f-=1,3&u){case 0:a.mode=16193;break;case 1:if(oe(a),a.mode=W,t===O){u>>>=2,f-=2;break e}break;case 2:a.mode=16196;break;case 3:e.msg="invalid block type",a.mode=Q}u>>>=2,f-=2;break;case 16193:for(u>>>=7&f,f-=7&f;f<32;){if(0===s)break e;s--,u+=r[i++]<>>16^65535)){e.msg="invalid stored block lengths",a.mode=Q;break}if(a.length=65535&u,u=0,f=0,a.mode=H,t===O)break e;case H:a.mode=16195;case 16195:if(g=a.length,g){if(g>s&&(g=s),g>c&&(g=c),0===g)break e;n.set(r.subarray(i,i+g),o),s-=g,i+=g,c-=g,o+=g,a.length-=g;break}a.mode=z;break;case 16196:for(;f<14;){if(0===s)break e;s--,u+=r[i++]<>>=5,f-=5,a.ndist=1+(31&u),u>>>=5,f-=5,a.ncode=4+(15&u),u>>>=4,f-=4,a.nlen>286||a.ndist>30){e.msg="too many length or distance symbols",a.mode=Q;break}a.have=0,a.mode=16197;case 16197:for(;a.have>>=3,f-=3}for(;a.have<19;)a.lens[ee[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,J={bits:a.lenbits},$=T(0,a.lens,0,19,a.lencode,0,a.work,J),a.lenbits=J.bits,$){e.msg="invalid code lengths set",a.mode=Q;break}a.have=0,a.mode=16198;case 16198:for(;a.have>>24,y=R>>>16&255,k=65535&R,!(m<=f);){if(0===s)break e;s--,u+=r[i++]<>>=m,f-=m,a.lens[a.have++]=k;else{if(16===k){for(Y=m+2;f>>=m,f-=m,0===a.have){e.msg="invalid bit length repeat",a.mode=Q;break}A=a.lens[a.have-1],g=3+(3&u),u>>>=2,f-=2}else if(17===k){for(Y=m+3;f>>=m,f-=m,A=0,g=3+(7&u),u>>>=3,f-=3}else{for(Y=m+7;f>>=m,f-=m,A=0,g=11+(127&u),u>>>=7,f-=7}if(a.have+g>a.nlen+a.ndist){e.msg="invalid bit length repeat",a.mode=Q;break}for(;g--;)a.lens[a.have++]=A}}if(a.mode===Q)break;if(0===a.lens[256]){e.msg="invalid code -- missing end-of-block",a.mode=Q;break}if(a.lenbits=9,J={bits:a.lenbits},$=T(1,a.lens,0,a.nlen,a.lencode,0,a.work,J),a.lenbits=J.bits,$){e.msg="invalid literal/lengths set",a.mode=Q;break}if(a.distbits=6,a.distcode=a.distdyn,J={bits:a.distbits},$=T(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,J),a.distbits=J.bits,$){e.msg="invalid distances set",a.mode=Q;break}if(a.mode=W,t===O)break e;case W:a.mode=K;case K:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=s,a.hold=u,a.bits=f,x(e,w),o=e.next_out,n=e.output,c=e.avail_out,i=e.next_in,r=e.input,s=e.avail_in,u=a.hold,f=a.bits,a.mode===z&&(a.back=-1);break}for(a.back=0;R=a.lencode[u&(1<>>24,y=R>>>16&255,k=65535&R,!(m<=f);){if(0===s)break e;s--,u+=r[i++]<>v)],m=R>>>24,y=R>>>16&255,k=65535&R,!(v+m<=f);){if(0===s)break e;s--,u+=r[i++]<>>=v,f-=v,a.back+=v}if(u>>>=m,f-=m,a.back+=m,a.length=k,0===y){a.mode=16205;break}if(32&y){a.back=-1,a.mode=z;break}if(64&y){e.msg="invalid literal/length code",a.mode=Q;break}a.extra=15&y,a.mode=16201;case 16201:if(a.extra){for(Y=a.extra;f>>=a.extra,f-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=16202;case 16202:for(;R=a.distcode[u&(1<>>24,y=R>>>16&255,k=65535&R,!(m<=f);){if(0===s)break e;s--,u+=r[i++]<>v)],m=R>>>24,y=R>>>16&255,k=65535&R,!(v+m<=f);){if(0===s)break e;s--,u+=r[i++]<>>=v,f-=v,a.back+=v}if(u>>>=m,f-=m,a.back+=m,64&y){e.msg="invalid distance code",a.mode=Q;break}a.offset=k,a.extra=15&y,a.mode=16203;case 16203:if(a.extra){for(Y=a.extra;f>>=a.extra,f-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){e.msg="invalid distance too far back",a.mode=Q;break}a.mode=16204;case 16204:if(0===c)break e;if(g=w-c,a.offset>g){if(g=a.offset-g,g>a.whave&&a.sane){e.msg="invalid distance too far back",a.mode=Q;break}g>a.wnext?(g-=a.wnext,p=a.wsize-g):p=a.wnext-g,g>a.length&&(g=a.length),b=a.window}else b=n,p=o-a.offset,g=a.length;g>c&&(g=c),c-=g,a.length-=g;do{n[o++]=b[p++]}while(--g);0===a.length&&(a.mode=K);break;case 16205:if(0===c)break e;n[o++]=a.length,c--,a.mode=K;break;case X:if(a.wrap){for(;f<32;){if(0===s)break e;s--,u|=r[i++]<{if(G(e))return L;let t=e.state;return t.window&&(t.window=null),e.state=null,j},inflateGetHeader:(e,t)=>{if(G(e))return L;const a=e.state;return 2&a.wrap?(a.head=t,t.done=!1,j):L},inflateSetDictionary:(e,t)=>{const a=t.length;let r,n,i;return G(e)?L:(r=e.state,0!==r.wrap&&r.mode!==Z?L:r.mode===Z&&(n=1,n=l(n,t,a,0),n!==r.check)?B:(i=se(e,t,a,a),i?(r.mode=16210,C):(r.havedict=1,j)))},inflateInfo:"pako inflate (from Nodeca project)"};var ce=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const de=Object.prototype.toString,{Z_NO_FLUSH:ue,Z_FINISH:fe,Z_OK:he,Z_STREAM_END:we,Z_NEED_DICT:ge,Z_STREAM_ERROR:pe,Z_DATA_ERROR:be,Z_MEM_ERROR:me,Z_BUF_ERROR:ye}=f,ke={chunkSize:65536,windowBits:15,to:""};function ve(e){this.options=w({},ke,e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new v,this.strm.avail_out=0;let a=le.inflateInit2(this.strm,t.windowBits);if(a!==he)throw new Error(u[a]);if(this.header=new ce,le.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=m(t.dictionary):"[object ArrayBuffer]"===de.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(a=le.inflateSetDictionary(this.strm,t.dictionary),a!==he)))throw new Error(u[a])}ve.prototype.push=function(e,t){const a=this.strm,r=this.options.chunkSize,n=this.options.dictionary;let i,o,s;if(this.ended)return!1;for(o=t===~~t?t:!0===t?fe:ue,"[object ArrayBuffer]"===de.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(r),a.next_out=0,a.avail_out=r),i=le.inflate(a,o),i===ge&&n&&(i=le.inflateSetDictionary(a,n),i===he?i=le.inflate(a,o):i===be&&(i=ge));a.avail_in>0&&i===we&&2&a.state.wrap&&0!==a.state.flags&&0!==a.input[a.next_in];)le.inflateReset(a),i=le.inflate(a,o);switch(i){case pe:case be:case ge:case me:return this.onEnd(i),this.ended=!0,!1}if(s=a.avail_out,a.next_out&&(0===a.avail_out||i===we||o>0))if("string"===this.options.to){let e=k(a.output,a.next_out),t=a.next_out-e,n=y(a.output,e);a.next_out=t,a.avail_out=r-t,t&&a.output.set(a.output.subarray(e,e+t),0),this.onData(n)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out)),a.avail_out=0,a.next_out=0;if(i!==he&&i!==ye||0!==s){if(i===we)return i=le.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(0===a.avail_in){if(o===fe)return i=le.inflateEnd(this.strm),this.onEnd(i===he?ye:i),this.ended=!0,!1;break}}}return!0},ve.prototype.onData=function(e){this.chunks.push(e)},ve.prototype.onEnd=function(e){e===he&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=g(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var _e={ungzip:function(e,t){const a=new ve(t);if(a.push(e,!0),a.err)throw a.msg||u[a.err];return a.result}};const{ungzip:xe}=_e;var Ee=xe;function Ae(e,t){let a=0,r=1,n=0;for(;t=70)throw new Error("varint too long at "+t)}throw new Error("truncated varint")}function $e(e){let t=Math.floor(e);if(t>=0){const e=[];for(;t>=128;)e.push(t%128|128),t=Math.floor(t/128);return e.push(t),e}const a=[0,0,0,0,0,0,0,0];let r=-t;for(let e=0;e<8;e++)a[e]=255&r,r=Math.floor(r/256);let n=1;for(let e=0;e<8;e++){const t=(255&~a[e])+n;a[e]=255&t,n=t>>8}const i=[];for(let e=0;e<10;e++){let t=0;for(let r=0;r<7;r++){const n=7*e+r;n<64&&(t|=(a[n>>3]>>(7&n)&1)<String.fromCharCode(255&e)).join("");n=/^[0-9a-fA-F]{1,2}(:[0-9a-fA-F]{1,2}){5}$/.test(t)}if(!n)return e;let i=!1;const o=[];for(const e of r)if(2===e.fieldNo&&2===e.wireType)try{const r=Ne(e.value,t,a);r.length===e.value.length&&r.join(",")===e.value.join(",")||(i=!0),o.push(Te(e.fieldNo,e.wireType,r))}catch{a.skipped++,o.push(e.raw)}else o.push(e.raw);return i&&a.wifi++,Re(o)}function Oe(e,t,a){const r=Se(e);let n=!1;const i=[];for(const e of r)if(5===e.fieldNo&&2===e.wireType)try{const r=Ne(e.value,t,a);r.length===e.value.length&&r.join(",")===e.value.join(",")||(n=!0),i.push(Te(e.fieldNo,e.wireType,r))}catch{a.skipped++,i.push(e.raw)}else i.push(e.raw);return n&&a.cell++,Re(i)}function je(e,t,a){const r=Se(e),n=[];for(const e of r)2===e.wireType&&2===e.fieldNo?n.push(Te(e.fieldNo,e.wireType,Me(e.value,t,a))):2!==e.wireType||22!==e.fieldNo&&24!==e.fieldNo?n.push(e.raw):n.push(Te(e.fieldNo,e.wireType,Oe(e.value,t,a)));return Re(n)}function Fe(e){return{wifi:e.wifi||0,cell:e.cell||0,locations:e.locations||0,skipped:e.skipped||0}}function Ie(e,t){e.wifi=t.wifi,e.cell=t.cell,e.locations=t.locations,e.skipped=t.skipped}function Le(e,t){if(e.length!==t.length)return!1;for(let a=0;ae.length)throw new Error("invalid frame length "+n+" at "+t+" for "+e.length);const i=e.slice(0,t+8),o=e.slice(t+10,t+10+n),s=e.slice(t+10+n),l=Fe(r),c=je(o,a,r),d=r.locations-l.locations+(r.wifi-l.wifi)+(r.cell-l.cell);if(c.length>65535)throw new Error("patched payload too large: "+c.length);if(d<=0||Le(o,c))throw Ie(r,l),new Error("frame parsed but no patchable wloc payload at "+t);return Re([i,[c.length>>8&255,255&c.length],c,s])}function Ce(e,a){const r={wifi:0,cell:0,locations:0,skipped:0};if(e.length<10)throw new Error("body too short: "+e.length);const n=[],i=[0,2,4,6,8,10,12,14,16],o=Math.min(96,Math.max(0,e.length-10));for(let e=0;e<=o;e++)i.indexOf(e)<0&&i.push(e);for(let o=0;o0&&!Le(r,o))return Re([e.slice(0,i),o]);Ie(a,n)}catch(e){Ie(a,n),r.length<6&&r.push("raw@"+i+":"+(e&&e.message?e.message:String(e)))}}throw new Error("raw protobuf scan failed; "+r.join(" | "))}(e,a,r);return t.info(`[wloc] patched via raw fallback locations=${r.locations} wifi=${r.wifi} cell=${r.cell} skipped=${r.skipped}`),{data:n,stats:r}}catch(e){n.push("raw:"+(e&&e.message?e.message:String(e)))}throw new Error("no patchable wloc payload found; "+n.join(" | "))}function Ue(e){return e.length>=2&&31===e[0]&&139===e[1]}async function Pe(e,a,r){const n=e.url||"";t.group(`[wloc] Response ${n}`);try{let e=function(e){if(!e)return[];if("undefined"!=typeof ArrayBuffer){if(e instanceof ArrayBuffer)return Array.prototype.slice.call(new Uint8Array(e));if(ArrayBuffer.isView&&ArrayBuffer.isView(e))return Array.prototype.slice.call(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}if("number"==typeof e.length&&"string"!=typeof e){const t=[];for(let a=0;a{const e=function(){try{return"undefined"!=typeof $response?$response:void 0}catch{return}}();if(!e)return void t.warn("[wloc] 非响应模式,跳过");const a=Ze();t.logLevel=a.logLevel,ze=await Pe($request,e,a)})().catch(e=>t.error(e)).finally(()=>{switch(typeof ze){case"object":ze.headers?.["Content-Encoding"]&&(ze.headers["Content-Encoding"]="identity"),ze.headers?.["content-encoding"]&&(ze.headers["content-encoding"]="identity"),"Quantumult X"===e?(ze.status||(ze.status=200),delete ze.headers?.["Content-Length"],delete ze.headers?.["content-length"],delete ze.headers?.["Transfer-Encoding"],i(ze)):i("Stash"===e?ze:{response:ze});break;case"undefined":i({});break;default:t.error("[wloc] 不合法的 response 类型: "+typeof ze),i({})}});
diff --git a/ThirdParty/WlocScripts/modules/direct/wloc.conf b/ThirdParty/WlocScripts/modules/direct/wloc.conf
index 0702cb1..656c824 100644
--- a/ThirdParty/WlocScripts/modules/direct/wloc.conf
+++ b/ThirdParty/WlocScripts/modules/direct/wloc.conf
@@ -1,11 +1,11 @@
#!name=Apple WLOC 定位修改
-#!desc=Location Spoofer 第三方代理模块
-#!author=xweiba
+#!desc=Apple 网络定位修改 | 使用说明: https://github.com/xweiba/location-spoofer/blob/main/docs/THIRD_PARTY_MODULES.md
+#!author=Yu9191 Rewrite
#!homepage=https://github.com/xweiba/location-spoofer
[rewrite_local]
-^https?:\/\/(?:gs-loc(?:-cn)?\.apple\.com|gsp-ssl\.ls\.apple\.com|bluedot\.is\.autonavi\.com(?:\.gds\.alibabadns\.com)?)\/clls\/wloc url script-response-body https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.7
-^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version) url script-echo-response https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.7
+^https?:\/\/(?:gs-loc(?:-cn)?\.apple\.com|gsp-ssl\.ls\.apple\.com|bluedot\.is\.autonavi\.com(?:\.gds\.alibabadns\.com)?)\/clls\/wloc url script-response-body https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.8
+^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/save url script-echo-response https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.8
[mitm]
hostname = gs-loc.apple.com, gs-loc-cn.apple.com, gsp-ssl.ls.apple.com, bluedot.is.autonavi.com, bluedot.is.autonavi.com.gds.alibabadns.com
diff --git a/ThirdParty/WlocScripts/modules/direct/wloc.lpx b/ThirdParty/WlocScripts/modules/direct/wloc.lpx
index eb2ad2c..4043f46 100644
--- a/ThirdParty/WlocScripts/modules/direct/wloc.lpx
+++ b/ThirdParty/WlocScripts/modules/direct/wloc.lpx
@@ -1,8 +1,10 @@
#!name=Apple WLOC 定位修改
-#!desc=Location Spoofer 第三方代理模块
-#!author=xweiba
+#!desc=Apple 网络定位修改 | 使用说明: https://github.com/xweiba/location-spoofer/blob/main/docs/THIRD_PARTY_MODULES.md
+#!icon=https://raw.githubusercontent.com/xweiba/location-spoofer/main/Resources/Assets.xcassets/AppIcon.appiconset/AppIcon.png
+#!author=Yu9191 Rewrite
#!homepage=https://github.com/xweiba/location-spoofer
+
[Argument]
longitude = input, "113.94114", tag=经度(在线选点优先)
latitude = input, "22.544577", tag=纬度(在线选点优先)
@@ -11,8 +13,8 @@ randomRadius = input, "0", tag=扰动半径(米,0为关闭)
logLevel = select, "info", "off", "error", "warn", "debug", "all", tag=日志级别
[Script]
-http-response ^https?:\/\/(?:gs-loc(?:-cn)?\.apple\.com|gsp-ssl\.ls\.apple\.com|bluedot\.is\.autonavi\.com(?:\.gds\.alibabadns\.com)?)\/clls\/wloc script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.7, requires-body=true, binary-body-mode=true, timeout=30, tag=Apple WLOC, argument=[{longitude},{latitude},{accuracy},{randomRadius},{logLevel}]
-http-request ^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version) script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.7, timeout=10, tag=WLOC Settings
+http-response ^https?:\/\/(?:gs-loc(?:-cn)?\.apple\.com|gsp-ssl\.ls\.apple\.com|bluedot\.is\.autonavi\.com(?:\.gds\.alibabadns\.com)?)\/clls\/wloc script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.8, requires-body=true, binary-body-mode=true, timeout=30, tag=Apple WLOC, argument=[{longitude},{latitude},{accuracy},{randomRadius},{logLevel}]
+http-request ^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/save script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.8, timeout=10, tag=WLOC Settings
[MITM]
hostname = gs-loc.apple.com, gs-loc-cn.apple.com, gsp-ssl.ls.apple.com, bluedot.is.autonavi.com, bluedot.is.autonavi.com.gds.alibabadns.com
diff --git a/ThirdParty/WlocScripts/modules/direct/wloc.module b/ThirdParty/WlocScripts/modules/direct/wloc.module
index f414532..852bcac 100644
--- a/ThirdParty/WlocScripts/modules/direct/wloc.module
+++ b/ThirdParty/WlocScripts/modules/direct/wloc.module
@@ -1,13 +1,13 @@
#!name=Apple WLOC 定位修改
-#!desc=修改 Apple 网络定位返回坐标 (Shadowrocket 小火箭) | 快捷指令(推荐): 设置地理位置 https://www.icloud.com/shortcuts/a82717d8fdad4e6280866fcf911173f7 清理恢复位置 https://www.icloud.com/shortcuts/f42632d406504f24a2cd163af4fe012f | 选点页面: https://wloc-pages.pages.dev/
+#!desc=Apple 网络定位修改 | 使用说明: https://github.com/xweiba/location-spoofer/blob/main/docs/THIRD_PARTY_MODULES.md
#!author=Yu9191 Rewrite
#!homepage=https://github.com/xweiba/location-spoofer
#!icon=https://raw.githubusercontent.com/xweiba/location-spoofer/main/Resources/Assets.xcassets/AppIcon.appiconset/AppIcon.png
#!category=Tools
[Script]
-Apple WLOC = type=http-response,pattern=^https?:\/\/(?:gs-loc(?:-cn)?\.apple\.com|gsp-ssl\.ls\.apple\.com|bluedot\.is\.autonavi\.com(?:\.gds\.alibabadns\.com)?)\/clls\/wloc,requires-body=1,binary-body-mode=1,max-size=0,timeout=30,script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.7,argument=longitude=113.94114&latitude=22.544577&accuracy=25&randomRadius=0&logLevel=info
-WLOC Settings = type=http-request,pattern=^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version),requires-body=0,max-size=0,timeout=10,script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.7
+Apple WLOC = type=http-response,pattern=^https?:\/\/(?:gs-loc(?:-cn)?\.apple\.com|gsp-ssl\.ls\.apple\.com|bluedot\.is\.autonavi\.com(?:\.gds\.alibabadns\.com)?)\/clls\/wloc,requires-body=1,binary-body-mode=1,max-size=0,timeout=30,script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.8,argument=longitude=113.94114&latitude=22.544577&accuracy=25&randomRadius=0&logLevel=info
+WLOC Settings = type=http-request,pattern=^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/save,requires-body=0,max-size=0,timeout=10,script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.8
[MITM]
hostname = %APPEND% gs-loc.apple.com, gs-loc-cn.apple.com, gsp-ssl.ls.apple.com, bluedot.is.autonavi.com, bluedot.is.autonavi.com.gds.alibabadns.com
diff --git a/ThirdParty/WlocScripts/modules/direct/wloc.sgmodule b/ThirdParty/WlocScripts/modules/direct/wloc.sgmodule
index 3942743..84d4e08 100644
--- a/ThirdParty/WlocScripts/modules/direct/wloc.sgmodule
+++ b/ThirdParty/WlocScripts/modules/direct/wloc.sgmodule
@@ -1,14 +1,14 @@
#!name=Apple WLOC 定位修改
-#!desc=Location Spoofer 第三方代理模块
-#!author=xweiba
+#!desc=Apple 网络定位修改 | 使用说明: https://github.com/xweiba/location-spoofer/blob/main/docs/THIRD_PARTY_MODULES.md
+#!author=Yu9191 Rewrite
#!homepage=https://github.com/xweiba/location-spoofer
#!category=Tools
#!arguments=经度:113.94114, 纬度:22.544577, 精度:25, 扰动半径:0, 日志级别:info
#!arguments-desc=经度/纬度: 默认坐标(在线选点储存后优先)\n精度: GPS精度(米)\n扰动半径: 每次响应在目标点周围随机偏移的最大距离(米),0为关闭\n日志级别: off/error/warn/info/debug/all\n\n使用方法: 打开选点页面 -> 选位置 -> 储存到设备
[Script]
-Apple WLOC = type=http-response, pattern="^https?:\/\/(?:gs-loc(?:-cn)?\.apple\.com|gsp-ssl\.ls\.apple\.com|bluedot\.is\.autonavi\.com(?:\.gds\.alibabadns\.com)?)\/clls\/wloc", requires-body=1, binary-body-mode=1, max-size=0, timeout=30, script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.7, argument=longitude={{{经度}}}&latitude={{{纬度}}}&accuracy={{{精度}}}&randomRadius={{{扰动半径}}}&logLevel={{{日志级别}}}
-WLOC Settings = type=http-request, pattern="^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version)", requires-body=0, max-size=0, timeout=10, script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.7
+Apple WLOC = type=http-response, pattern="^https?:\/\/(?:gs-loc(?:-cn)?\.apple\.com|gsp-ssl\.ls\.apple\.com|bluedot\.is\.autonavi\.com(?:\.gds\.alibabadns\.com)?)\/clls\/wloc", requires-body=1, binary-body-mode=1, max-size=0, timeout=30, script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.8, argument=longitude={{{经度}}}&latitude={{{纬度}}}&accuracy={{{精度}}}&randomRadius={{{扰动半径}}}&logLevel={{{日志级别}}}
+WLOC Settings = type=http-request, pattern="^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/save", requires-body=0, max-size=0, timeout=10, script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.8
[MITM]
hostname = %APPEND% gs-loc.apple.com, gs-loc-cn.apple.com, gsp-ssl.ls.apple.com, bluedot.is.autonavi.com, bluedot.is.autonavi.com.gds.alibabadns.com
diff --git a/ThirdParty/WlocScripts/modules/direct/wloc.stoverride b/ThirdParty/WlocScripts/modules/direct/wloc.stoverride
index 397f689..16a4852 100644
--- a/ThirdParty/WlocScripts/modules/direct/wloc.stoverride
+++ b/ThirdParty/WlocScripts/modules/direct/wloc.stoverride
@@ -1,7 +1,8 @@
name: Apple WLOC 定位修改
-desc: Location Spoofer 第三方代理模块
-author: xweiba
+desc: "Apple 网络定位修改 | 使用说明: https://github.com/xweiba/location-spoofer/blob/main/docs/THIRD_PARTY_MODULES.md"
+author: Yu9191 Rewrite
homepage: https://github.com/xweiba/location-spoofer
+icon: https://raw.githubusercontent.com/xweiba/location-spoofer/main/Resources/Assets.xcassets/AppIcon.appiconset/AppIcon.png
category: Tools
http:
@@ -20,7 +21,7 @@ http:
max-size: 0
timeout: 30
argument: longitude=113.94114&latitude=22.544577&accuracy=25&randomRadius=0&logLevel=info
- - match: ^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version)
+ - match: ^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/save
name: WLOC.Settings
type: request
require-body: false
@@ -28,8 +29,8 @@ http:
script-providers:
WLOC.Location:
- url: https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.7
+ url: https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js?v=1.0.8
interval: 86400
WLOC.Settings:
- url: https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.7
+ url: https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js?v=1.0.8
interval: 86400
diff --git a/ThirdParty/WlocScripts/package-lock.json b/ThirdParty/WlocScripts/package-lock.json
deleted file mode 100644
index 344233c..0000000
--- a/ThirdParty/WlocScripts/package-lock.json
+++ /dev/null
@@ -1,508 +0,0 @@
-{
- "name": "@location-spoofer/wloc-scripts",
- "version": "1.0.0",
- "lockfileVersion": 3,
- "requires": true,
- "packages": {
- "": {
- "name": "@location-spoofer/wloc-scripts",
- "version": "1.0.0",
- "dependencies": {
- "pako": "2.1.0"
- },
- "devDependencies": {
- "esbuild": "0.25.8"
- }
- },
- "node_modules/@esbuild/aix-ppc64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.8.tgz",
- "integrity": "sha512-urAvrUedIqEiFR3FYSLTWQgLu5tb+m0qZw0NBEasUeo6wuqatkMDaRT+1uABiGXEu5vqgPd7FGE1BhsAIy9QVA==",
- "cpu": [
- "ppc64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "aix"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/android-arm": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.25.8.tgz",
- "integrity": "sha512-RONsAvGCz5oWyePVnLdZY/HHwA++nxYWIX1atInlaW6SEkwq6XkP3+cb825EUcRs5Vss/lGh/2YxAb5xqc07Uw==",
- "cpu": [
- "arm"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/android-arm64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.25.8.tgz",
- "integrity": "sha512-OD3p7LYzWpLhZEyATcTSJ67qB5D+20vbtr6vHlHWSQYhKtzUYrETuWThmzFpZtFsBIxRvhO07+UgVA9m0i/O1w==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/android-x64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.25.8.tgz",
- "integrity": "sha512-yJAVPklM5+4+9dTeKwHOaA+LQkmrKFX96BM0A/2zQrbS6ENCmxc4OVoBs5dPkCCak2roAD+jKCdnmOqKszPkjA==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/darwin-arm64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.8.tgz",
- "integrity": "sha512-Jw0mxgIaYX6R8ODrdkLLPwBqHTtYHJSmzzd+QeytSugzQ0Vg4c5rDky5VgkoowbZQahCbsv1rT1KW72MPIkevw==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/darwin-x64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.25.8.tgz",
- "integrity": "sha512-Vh2gLxxHnuoQ+GjPNvDSDRpoBCUzY4Pu0kBqMBDlK4fuWbKgGtmDIeEC081xi26PPjn+1tct+Bh8FjyLlw1Zlg==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/freebsd-arm64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.8.tgz",
- "integrity": "sha512-YPJ7hDQ9DnNe5vxOm6jaie9QsTwcKedPvizTVlqWG9GBSq+BuyWEDazlGaDTC5NGU4QJd666V0yqCBL2oWKPfA==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "freebsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/freebsd-x64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.8.tgz",
- "integrity": "sha512-MmaEXxQRdXNFsRN/KcIimLnSJrk2r5H8v+WVafRWz5xdSVmWLoITZQXcgehI2ZE6gioE6HirAEToM/RvFBeuhw==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "freebsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-arm": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.25.8.tgz",
- "integrity": "sha512-FuzEP9BixzZohl1kLf76KEVOsxtIBFwCaLupVuk4eFVnOZfU+Wsn+x5Ryam7nILV2pkq2TqQM9EZPsOBuMC+kg==",
- "cpu": [
- "arm"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-arm64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.25.8.tgz",
- "integrity": "sha512-WIgg00ARWv/uYLU7lsuDK00d/hHSfES5BzdWAdAig1ioV5kaFNrtK8EqGcUBJhYqotlUByUKz5Qo6u8tt7iD/w==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-ia32": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.25.8.tgz",
- "integrity": "sha512-A1D9YzRX1i+1AJZuFFUMP1E9fMaYY+GnSQil9Tlw05utlE86EKTUA7RjwHDkEitmLYiFsRd9HwKBPEftNdBfjg==",
- "cpu": [
- "ia32"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-loong64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.25.8.tgz",
- "integrity": "sha512-O7k1J/dwHkY1RMVvglFHl1HzutGEFFZ3kNiDMSOyUrB7WcoHGf96Sh+64nTRT26l3GMbCW01Ekh/ThKM5iI7hQ==",
- "cpu": [
- "loong64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-mips64el": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.8.tgz",
- "integrity": "sha512-uv+dqfRazte3BzfMp8PAQXmdGHQt2oC/y2ovwpTteqrMx2lwaksiFZ/bdkXJC19ttTvNXBuWH53zy/aTj1FgGw==",
- "cpu": [
- "mips64el"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-ppc64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.8.tgz",
- "integrity": "sha512-GyG0KcMi1GBavP5JgAkkstMGyMholMDybAf8wF5A70CALlDM2p/f7YFE7H92eDeH/VBtFJA5MT4nRPDGg4JuzQ==",
- "cpu": [
- "ppc64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-riscv64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.8.tgz",
- "integrity": "sha512-rAqDYFv3yzMrq7GIcen3XP7TUEG/4LK86LUPMIz6RT8A6pRIDn0sDcvjudVZBiiTcZCY9y2SgYX2lgK3AF+1eg==",
- "cpu": [
- "riscv64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-s390x": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.25.8.tgz",
- "integrity": "sha512-Xutvh6VjlbcHpsIIbwY8GVRbwoviWT19tFhgdA7DlenLGC/mbc3lBoVb7jxj9Z+eyGqvcnSyIltYUrkKzWqSvg==",
- "cpu": [
- "s390x"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/linux-x64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.25.8.tgz",
- "integrity": "sha512-ASFQhgY4ElXh3nDcOMTkQero4b1lgubskNlhIfJrsH5OKZXDpUAKBlNS0Kx81jwOBp+HCeZqmoJuihTv57/jvQ==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/netbsd-arm64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.8.tgz",
- "integrity": "sha512-d1KfruIeohqAi6SA+gENMuObDbEjn22olAR7egqnkCD9DGBG0wsEARotkLgXDu6c4ncgWTZJtN5vcgxzWRMzcw==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "netbsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/netbsd-x64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.8.tgz",
- "integrity": "sha512-nVDCkrvx2ua+XQNyfrujIG38+YGyuy2Ru9kKVNyh5jAys6n+l44tTtToqHjino2My8VAY6Lw9H7RI73XFi66Cg==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "netbsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/openbsd-arm64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.8.tgz",
- "integrity": "sha512-j8HgrDuSJFAujkivSMSfPQSAa5Fxbvk4rgNAS5i3K+r8s1X0p1uOO2Hl2xNsGFppOeHOLAVgYwDVlmxhq5h+SQ==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "openbsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/openbsd-x64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.8.tgz",
- "integrity": "sha512-1h8MUAwa0VhNCDp6Af0HToI2TJFAn1uqT9Al6DJVzdIBAd21m/G0Yfc77KDM3uF3T/YaOgQq3qTJHPbTOInaIQ==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "openbsd"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/openharmony-arm64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.8.tgz",
- "integrity": "sha512-r2nVa5SIK9tSWd0kJd9HCffnDHKchTGikb//9c7HX+r+wHYCpQrSgxhlY6KWV1nFo1l4KFbsMlHk+L6fekLsUg==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "openharmony"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/sunos-x64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.25.8.tgz",
- "integrity": "sha512-zUlaP2S12YhQ2UzUfcCuMDHQFJyKABkAjvO5YSndMiIkMimPmxA+BYSBikWgsRpvyxuRnow4nS5NPnf9fpv41w==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "sunos"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/win32-arm64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.25.8.tgz",
- "integrity": "sha512-YEGFFWESlPva8hGL+zvj2z/SaK+pH0SwOM0Nc/d+rVnW7GSTFlLBGzZkuSU9kFIGIo8q9X3ucpZhu8PDN5A2sQ==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/win32-ia32": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.25.8.tgz",
- "integrity": "sha512-hiGgGC6KZ5LZz58OL/+qVVoZiuZlUYlYHNAmczOm7bs2oE1XriPFi5ZHHrS8ACpV5EjySrnoCKmcbQMN+ojnHg==",
- "cpu": [
- "ia32"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/@esbuild/win32-x64": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.25.8.tgz",
- "integrity": "sha512-cn3Yr7+OaaZq1c+2pe+8yxC8E144SReCQjN6/2ynubzYjvyqZjTXfQJpAcQpsdJq3My7XADANiYGHoFC69pLQw==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">=18"
- }
- },
- "node_modules/esbuild": {
- "version": "0.25.8",
- "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.25.8.tgz",
- "integrity": "sha512-vVC0USHGtMi8+R4Kz8rt6JhEWLxsv9Rnu/lGYbPR8u47B+DCBksq9JarW0zOO7bs37hyOK1l2/oqtbciutL5+Q==",
- "dev": true,
- "hasInstallScript": true,
- "license": "MIT",
- "bin": {
- "esbuild": "bin/esbuild"
- },
- "engines": {
- "node": ">=18"
- },
- "optionalDependencies": {
- "@esbuild/aix-ppc64": "0.25.8",
- "@esbuild/android-arm": "0.25.8",
- "@esbuild/android-arm64": "0.25.8",
- "@esbuild/android-x64": "0.25.8",
- "@esbuild/darwin-arm64": "0.25.8",
- "@esbuild/darwin-x64": "0.25.8",
- "@esbuild/freebsd-arm64": "0.25.8",
- "@esbuild/freebsd-x64": "0.25.8",
- "@esbuild/linux-arm": "0.25.8",
- "@esbuild/linux-arm64": "0.25.8",
- "@esbuild/linux-ia32": "0.25.8",
- "@esbuild/linux-loong64": "0.25.8",
- "@esbuild/linux-mips64el": "0.25.8",
- "@esbuild/linux-ppc64": "0.25.8",
- "@esbuild/linux-riscv64": "0.25.8",
- "@esbuild/linux-s390x": "0.25.8",
- "@esbuild/linux-x64": "0.25.8",
- "@esbuild/netbsd-arm64": "0.25.8",
- "@esbuild/netbsd-x64": "0.25.8",
- "@esbuild/openbsd-arm64": "0.25.8",
- "@esbuild/openbsd-x64": "0.25.8",
- "@esbuild/openharmony-arm64": "0.25.8",
- "@esbuild/sunos-x64": "0.25.8",
- "@esbuild/win32-arm64": "0.25.8",
- "@esbuild/win32-ia32": "0.25.8",
- "@esbuild/win32-x64": "0.25.8"
- }
- },
- "node_modules/pako": {
- "version": "2.1.0",
- "resolved": "https://registry.npmmirror.com/pako/-/pako-2.1.0.tgz",
- "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==",
- "license": "(MIT AND Zlib)"
- }
- }
-}
diff --git a/ThirdParty/WlocScripts/package.json b/ThirdParty/WlocScripts/package.json
index 11f7080..8226667 100644
--- a/ThirdParty/WlocScripts/package.json
+++ b/ThirdParty/WlocScripts/package.json
@@ -1,16 +1,10 @@
{
"name": "@location-spoofer/wloc-scripts",
- "version": "1.0.0",
+ "version": "1.0.8",
"private": true,
"type": "module",
+ "license": "AGPL-3.0",
"scripts": {
- "build": "node build.mjs",
"test": "node --test"
- },
- "dependencies": {
- "pako": "2.1.0"
- },
- "devDependencies": {
- "esbuild": "0.25.8"
}
}
diff --git a/ThirdParty/WlocScripts/src/core.js b/ThirdParty/WlocScripts/src/core.js
deleted file mode 100644
index 15f66f0..0000000
--- a/ThirdParty/WlocScripts/src/core.js
+++ /dev/null
@@ -1,263 +0,0 @@
-export const MOTION_ACTIVITY_TYPE = 63;
-export const MOTION_ACTIVITY_CONFIDENCE = 467;
-export const WLOC_MARKER = Uint8Array.from([0, 0, 0, 1, 0, 0]);
-const UINT32_RANGE = 0x100000000;
-
-const concat = (...parts) => {
- const length = parts.reduce((sum, part) => sum + part.length, 0);
- const out = new Uint8Array(length);
- let offset = 0;
- for (const part of parts) {
- out.set(part, offset);
- offset += part.length;
- }
- return out;
-};
-
-const equal = (left, right) =>
- left.length === right.length && left.every((value, index) => value === right[index]);
-
-function readVarint(data, offset) {
- let value = 0;
- let multiplier = 1;
- for (let index = 0; index < 10 && offset + index < data.length; index += 1) {
- const byte = data[offset + index];
- const chunk = byte & 0x7f;
- if (value !== null && chunk <= Math.floor((Number.MAX_SAFE_INTEGER - value) / multiplier)) {
- value += chunk * multiplier;
- } else {
- value = null;
- }
- if ((byte & 0x80) === 0) return { value, next: offset + index + 1 };
- multiplier *= 0x80;
- }
- throw new Error("invalid varint");
-}
-
-function writeVarint(input) {
- const value = Math.trunc(Number(input));
- if (!Number.isSafeInteger(value)) throw new Error("varint value is not a safe integer");
- let low = value >>> 0;
- let high = Math.floor(value / UINT32_RANGE) >>> 0;
- const bytes = [];
- do {
- const byte = low & 0x7f;
- low = ((low >>> 7) | ((high & 0x7f) << 25)) >>> 0;
- high >>>= 7;
- const hasMore = high !== 0 || low !== 0;
- bytes.push(byte | (hasMore ? 0x80 : 0));
- } while (high !== 0 || low !== 0);
- return Uint8Array.from(bytes);
-}
-
-const writeTag = (number, wireType) => writeVarint((number << 3) | wireType);
-
-function writeLengthDelimited(number, value) {
- return concat(writeTag(number, 2), writeVarint(value.length), value);
-}
-
-export function parseFields(data) {
- const fields = [];
- let offset = 0;
- while (offset < data.length) {
- const start = offset;
- const tag = readVarint(data, offset);
- offset = tag.next;
- if (!Number.isSafeInteger(tag.value)) throw new Error("protobuf tag is too large");
- const number = Math.floor(tag.value / 8);
- const wireType = tag.value & 7;
- if (number === 0) throw new Error("invalid protobuf field 0");
- let value;
- if (wireType === 0) {
- const item = readVarint(data, offset);
- value = data.slice(offset, item.next);
- offset = item.next;
- } else if (wireType === 1) {
- if (offset + 8 > data.length) throw new Error("truncated fixed64");
- value = data.slice(offset, offset + 8);
- offset += 8;
- } else if (wireType === 2) {
- const length = readVarint(data, offset);
- offset = length.next;
- const size = length.value;
- if (!Number.isSafeInteger(size) || offset + size > data.length) {
- throw new Error("truncated length-delimited field");
- }
- value = data.slice(offset, offset + size);
- offset += size;
- } else if (wireType === 5) {
- if (offset + 4 > data.length) throw new Error("truncated fixed32");
- value = data.slice(offset, offset + 4);
- offset += 4;
- } else {
- throw new Error(`unsupported wire type ${wireType}`);
- }
- fields.push({ number, wireType, value, raw: data.slice(start, offset) });
- }
- return fields;
-}
-
-function patchLocation(data, config, stats) {
- const fields = parseFields(data);
- if (!fields.some((field) => field.number === 1 && field.wireType === 0) ||
- !fields.some((field) => field.number === 2 && field.wireType === 0)) {
- return data;
- }
- let hasMotionType = false;
- let hasMotionConfidence = false;
- const parts = fields.map((field) => {
- if (field.wireType !== 0) return field.raw;
- if (field.number === 1) return concat(writeTag(1, 0), writeVarint(Math.round(config.latitude * 1e8)));
- if (field.number === 2) return concat(writeTag(2, 0), writeVarint(Math.round(config.longitude * 1e8)));
- if (field.number === 3) return concat(writeTag(3, 0), writeVarint(config.accuracy));
- if (config.motionSimulationEnabled && field.number === 11) {
- hasMotionType = true;
- return concat(writeTag(11, 0), writeVarint(MOTION_ACTIVITY_TYPE));
- }
- if (config.motionSimulationEnabled && field.number === 12) {
- hasMotionConfidence = true;
- return concat(writeTag(12, 0), writeVarint(MOTION_ACTIVITY_CONFIDENCE));
- }
- return field.raw;
- });
- if (config.motionSimulationEnabled && !hasMotionType) {
- parts.push(concat(writeTag(11, 0), writeVarint(MOTION_ACTIVITY_TYPE)));
- }
- if (config.motionSimulationEnabled && !hasMotionConfidence) {
- parts.push(concat(writeTag(12, 0), writeVarint(MOTION_ACTIVITY_CONFIDENCE)));
- }
- const out = concat(...parts);
- if (!equal(out, data)) stats.locations += 1;
- return out;
-}
-
-function patchWifi(data, config, stats) {
- const fields = parseFields(data);
- const hasMac = fields.some((field) =>
- field.number === 1 && field.wireType === 2 &&
- /^[0-9a-fA-F]{1,2}(:[0-9a-fA-F]{1,2}){5}$/.test(
- Array.from(field.value, (byte) => String.fromCharCode(byte)).join("")
- )
- );
- if (!hasMac) return data;
- let changed = false;
- const parts = fields.map((field) => {
- if (field.number !== 2 || field.wireType !== 2) return field.raw;
- const value = patchLocation(field.value, config, stats);
- changed ||= !equal(value, field.value);
- return writeLengthDelimited(2, value);
- });
- if (changed) stats.wifi += 1;
- return concat(...parts);
-}
-
-function patchCell(data, config, stats) {
- let changed = false;
- const parts = parseFields(data).map((field) => {
- if (field.number !== 5 || field.wireType !== 2) return field.raw;
- const value = patchLocation(field.value, config, stats);
- changed ||= !equal(value, field.value);
- return writeLengthDelimited(5, value);
- });
- if (changed) stats.cell += 1;
- return concat(...parts);
-}
-
-export function patchPayload(data, config, stats = { wifi: 0, cell: 0, locations: 0 }) {
- const parts = parseFields(data).map((field) => {
- if (field.number === 2 && field.wireType === 2) {
- return writeLengthDelimited(2, patchWifi(field.value, config, stats));
- }
- if ((field.number === 22 || field.number === 24) && field.wireType === 2) {
- return writeLengthDelimited(field.number, patchCell(field.value, config, stats));
- }
- return field.raw;
- });
- return { data: concat(...parts), stats };
-}
-
-const uint16 = (data, offset) => (data[offset] << 8) | data[offset + 1];
-const uint32 = (data, offset) =>
- ((data[offset] * 0x1000000) + (data[offset + 1] << 16) +
- (data[offset + 2] << 8) + data[offset + 3]) >>> 0;
-const writeUint16 = (value) => Uint8Array.from([(value >>> 8) & 0xff, value & 0xff]);
-const writeUint32 = (value) => Uint8Array.from([
- (value >>> 24) & 0xff, (value >>> 16) & 0xff, (value >>> 8) & 0xff, value & 0xff
-]);
-
-function findBytes(data, marker) {
- outer: for (let offset = 0; offset <= data.length - marker.length; offset += 1) {
- for (let index = 0; index < marker.length; index += 1) {
- if (data[offset + index] !== marker[index]) continue outer;
- }
- return offset;
- }
- return -1;
-}
-
-function patchARPC(body, config) {
- if (body.length < 2) throw new Error("short ARPC");
- let offset = 2;
- for (let index = 0; index < 3; index += 1) {
- if (offset + 2 > body.length) throw new Error("truncated ARPC string");
- offset += 2 + uint16(body, offset);
- }
- const lengthOffset = offset + 4;
- const payloadOffset = lengthOffset + 4;
- if (payloadOffset > body.length) throw new Error("truncated ARPC header");
- const length = uint32(body, lengthOffset);
- if (!length || payloadOffset + length > body.length) throw new Error("invalid ARPC length");
- const patched = patchPayload(body.slice(payloadOffset, payloadOffset + length), config);
- if (equal(patched.data, body.slice(payloadOffset, payloadOffset + length))) throw new Error("unchanged ARPC");
- return { data: concat(body.slice(0, lengthOffset), writeUint32(patched.data.length),
- patched.data, body.slice(payloadOffset + length)), stats: patched.stats };
-}
-
-function patchMarker(body, config) {
- const markerOffset = findBytes(body, WLOC_MARKER);
- if (markerOffset < 0) throw new Error("marker not found");
- const lengthOffset = markerOffset + WLOC_MARKER.length;
- const payloadOffset = lengthOffset + 2;
- const length = uint16(body, lengthOffset);
- if (!length || payloadOffset + length > body.length) throw new Error("invalid marker length");
- const patched = patchPayload(body.slice(payloadOffset, payloadOffset + length), config);
- if (patched.data.length > 65535 || equal(patched.data, body.slice(payloadOffset, payloadOffset + length))) {
- throw new Error("unchanged marker");
- }
- return { data: concat(body.slice(0, lengthOffset), writeUint16(patched.data.length),
- patched.data, body.slice(payloadOffset + length)), stats: patched.stats };
-}
-
-function patchSynthetic(body, offset, config) {
- if (offset + 10 > body.length) throw new Error("short frame");
- const length = uint16(body, offset + 8);
- if (!length || offset + 10 + length > body.length) throw new Error("invalid frame");
- const patched = patchPayload(body.slice(offset + 10, offset + 10 + length), config);
- if (patched.data.length > 65535 || equal(patched.data, body.slice(offset + 10, offset + 10 + length))) {
- throw new Error("unchanged frame");
- }
- return { data: concat(body.slice(0, offset + 8), writeUint16(patched.data.length),
- patched.data, body.slice(offset + 10 + length)), stats: patched.stats };
-}
-
-export function patchWlocBody(body, config) {
- for (const patcher of [patchARPC, patchMarker]) {
- try { return patcher(body, config); } catch {}
- }
- const offsets = [...new Set([0, 2, 4, 6, 8, 10, 12, 14, 16,
- ...Array.from({ length: Math.min(96, Math.max(0, body.length - 10)) + 1 }, (_, index) => index)])];
- for (const offset of offsets) {
- try { return patchSynthetic(body, offset, config); } catch {}
- }
- for (let offset = 0; offset <= Math.min(256, body.length); offset += 1) {
- try {
- const patched = patchPayload(body.slice(offset), config);
- if (!equal(patched.data, body.slice(offset))) {
- return { data: concat(body.slice(0, offset), patched.data), stats: patched.stats };
- }
- } catch {}
- }
- throw new Error("no patchable wloc payload found");
-}
-
-export const internals = { concat, writeVarint, writeTag, writeLengthDelimited, equal };
diff --git a/ThirdParty/WlocScripts/src/response-entry.js b/ThirdParty/WlocScripts/src/response-entry.js
deleted file mode 100644
index 49f46ab..0000000
--- a/ThirdParty/WlocScripts/src/response-entry.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { ungzip } from "pako";
-import { patchWlocBody } from "./core.js";
-import {
- STORAGE_KEY, finishBinary, finishPassthrough, readPersistent, responseBytes
-} from "./runtime.js";
-
-try {
- const settings = readPersistent(STORAGE_KEY);
- const input = responseBytes();
- if (!settings || !settings.enabled || !input.length) {
- finishPassthrough();
- } else {
- const isGzip = input.length >= 2 && input[0] === 0x1f && input[1] === 0x8b;
- const body = isGzip ? ungzip(input) : input;
- const patched = patchWlocBody(body, {
- latitude: Number(settings.latitude),
- longitude: Number(settings.longitude),
- accuracy: Number(settings.accuracy != null ? settings.accuracy : 25),
- motionSimulationEnabled: settings.motionSimulationEnabled === true
- });
- finishBinary(patched.data);
- }
-} catch (error) {
- console.log(`[Location Spoofer] ${error && error.message ? error.message : error}`);
- finishPassthrough();
-}
diff --git a/ThirdParty/WlocScripts/src/runtime.js b/ThirdParty/WlocScripts/src/runtime.js
deleted file mode 100644
index 0423b9e..0000000
--- a/ThirdParty/WlocScripts/src/runtime.js
+++ /dev/null
@@ -1,109 +0,0 @@
-export const MODULE_VERSION = "1.0.0";
-export const PROTOCOL_VERSION = 1;
-export const CAPABILITIES = [
- "wifi", "cellTower", "arpc", "marker", "synthetic", "bare", "motionSimulation"
-];
-export const STORAGE_KEY = "locationSpoofer.settings.v1";
-
-export function environment() {
- if (typeof $task !== "undefined") return "quantumultX";
- if (typeof $loon !== "undefined") return "loon";
- if (typeof $rocket !== "undefined") return "shadowrocket";
- if (typeof Egern !== "undefined") return "egern";
- if (typeof $environment !== "undefined" && $environment["stash-version"]) return "stash";
- if (typeof $environment !== "undefined" && $environment["surge-version"]) return "surge";
- return "unknown";
-}
-
-export function readPersistent(key) {
- const raw = environment() === "quantumultX"
- ? $prefs.valueForKey(key)
- : $persistentStore.read(key);
- if (!raw) return null;
- try { return JSON.parse(raw); } catch { return null; }
-}
-
-export function writePersistent(key, value) {
- const raw = value == null ? "" : JSON.stringify(value);
- return environment() === "quantumultX"
- ? $prefs.setValueForKey(raw, key)
- : $persistentStore.write(raw, key);
-}
-
-export function responseBytes() {
- const response = typeof $response === "undefined" ? null : $response;
- const value = response && response.bodyBytes != null ? response.bodyBytes : response && response.body;
- if (value instanceof ArrayBuffer) return new Uint8Array(value);
- if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
- if (typeof value === "string") {
- return Uint8Array.from(value, (character) => character.charCodeAt(0) & 0xff);
- }
- return new Uint8Array();
-}
-
-function cleanHeaders(headers, length) {
- const out = Object.assign({}, headers || {});
- for (const name of ["Content-Encoding", "content-encoding", "Transfer-Encoding", "transfer-encoding"]) {
- delete out[name];
- }
- out["Content-Length"] = String(length);
- return out;
-}
-
-export function finishBinary(bytes) {
- const response = typeof $response === "undefined" ? {} : $response;
- const headers = cleanHeaders(response.headers, bytes.length);
- const env = environment();
- if (env === "quantumultX") {
- delete headers["Content-Length"];
- $done({ status: "HTTP/1.1 200 OK", headers, bodyBytes: bytes.buffer });
- } else if (env === "stash") {
- $done(Object.assign({}, response, { status: 200, headers, body: bytes }));
- } else {
- $done({ response: Object.assign({}, response, { status: 200, headers, body: bytes }) });
- }
-}
-
-export function finishPassthrough() {
- $done({});
-}
-
-export function finishJSON(value) {
- const response = {
- status: 200,
- headers: { "Content-Type": "application/json; charset=utf-8" },
- body: JSON.stringify(value)
- };
- if (environment() === "quantumultX") {
- $done(Object.assign({}, response, { status: "HTTP/1.1 200 OK" }));
- } else if (environment() === "stash") {
- $done(response);
- } else {
- $done({ response });
- }
-}
-
-export function queryParameters(url) {
- const query = url.split("?")[1] || "";
- const values = {};
- query.split("&").forEach((item) => {
- if (!item) return;
- const separator = item.indexOf("=");
- const rawKey = separator < 0 ? item : item.slice(0, separator);
- const rawValue = separator < 0 ? "" : item.slice(separator + 1);
- let key = rawKey;
- let value = rawValue;
- try { key = decodeURIComponent(rawKey.replace(/\+/g, " ")); } catch {}
- try { value = decodeURIComponent(rawValue.replace(/\+/g, " ")); } catch {}
- if (!Object.prototype.hasOwnProperty.call(values, key)) values[key] = value;
- });
- return values;
-}
-
-export function requestPath(url) {
- const withoutQuery = url.split("?")[0];
- const scheme = withoutQuery.indexOf("://");
- if (scheme < 0) return withoutQuery;
- const path = withoutQuery.indexOf("/", scheme + 3);
- return path < 0 ? "/" : withoutQuery.slice(path);
-}
diff --git a/ThirdParty/WlocScripts/src/settings-entry.js b/ThirdParty/WlocScripts/src/settings-entry.js
deleted file mode 100644
index 626d0d8..0000000
--- a/ThirdParty/WlocScripts/src/settings-entry.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import {
- CAPABILITIES, MODULE_VERSION, PROTOCOL_VERSION, STORAGE_KEY,
- finishJSON, queryParameters, readPersistent, requestPath, writePersistent
-} from "./runtime.js";
-
-const url = typeof $request === "undefined" ? "" : ($request.url || "");
-const path = requestPath(url);
-const parameters = queryParameters(url);
-
-if (path === "/wloc-settings/version") {
- finishJSON({
- success: true,
- moduleVersion: MODULE_VERSION,
- protocolVersion: PROTOCOL_VERSION,
- capabilities: CAPABILITIES
- });
-} else if (parameters.action === "query") {
- const settings = readPersistent(STORAGE_KEY);
- finishJSON(settings && settings.enabled
- ? { success: true, longitude: settings.longitude, latitude: settings.latitude,
- accuracy: settings.accuracy, motionSimulationEnabled: settings.motionSimulationEnabled === true }
- : { success: false, error: "无已保存的坐标" });
-} else if (parameters.action === "clear") {
- writePersistent(STORAGE_KEY, null);
- finishJSON({ success: true });
-} else {
- const longitude = Number(parameters.lon != null ? parameters.lon : parameters.longitude);
- const latitude = Number(parameters.lat != null ? parameters.lat : parameters.latitude);
- const accuracy = Number(parameters.acc != null
- ? parameters.acc
- : (parameters.accuracy != null ? parameters.accuracy : 25));
- if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {
- finishJSON({ success: false, error: "缺少 lon/lat 参数" });
- } else {
- const settings = {
- enabled: true,
- longitude,
- latitude,
- accuracy,
- motionSimulationEnabled: parameters.motion === "1"
- };
- const success = writePersistent(STORAGE_KEY, settings);
- finishJSON(success
- ? { success: true, longitude, latitude, accuracy,
- motionSimulationEnabled: settings.motionSimulationEnabled }
- : { success: false, error: "保存配置失败" });
- }
-}
diff --git a/ThirdParty/WlocScripts/test/bundle-compatibility.test.js b/ThirdParty/WlocScripts/test/bundle-compatibility.test.js
index 10b5b71..e466d5f 100644
--- a/ThirdParty/WlocScripts/test/bundle-compatibility.test.js
+++ b/ThirdParty/WlocScripts/test/bundle-compatibility.test.js
@@ -1,52 +1,52 @@
import test from "node:test";
import assert from "node:assert/strict";
+import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import vm from "node:vm";
-const bundles = [
- new URL("../dist/v1/wloc.js", import.meta.url),
- new URL("../dist/v1/wloc-settings.js", import.meta.url)
-];
+const files = new Map([
+ [new URL("../dist/v1/wloc.js", import.meta.url), "a1b361e60f0b434585260fb59c65d1ddbe3bff89ace3639f592e7d8af432b3c1"],
+ [new URL("../dist/v1/wloc-settings.js", import.meta.url), "cbff047a7f42055615ee19e208ddfc2ec66833e6f2b75555eac84f1c299a66cf"],
+ [new URL("../LICENSE", import.meta.url), "8486a10c4393cee1c25392769ddd3b2d6c242d6ec7928e1414efff7dfb2f07ef"]
+]);
-test("generated bundles avoid newer JavaScriptCore runtime requirements", async () => {
- for (const bundle of bundles) {
- const source = await readFile(bundle, "utf8");
- for (const unsupported of [
- /\bBigInt\b/,
- /\bglobalThis\b/,
- /\bURLSearchParams\b/,
- /\bObject\.fromEntries\b/,
- /\?\./,
- /\?\?/
- ]) {
- assert.equal(unsupported.test(source), false, `${bundle.pathname} contains ${unsupported}`);
- }
+test("vendored upstream files retain their pinned SHA-256 hashes", async () => {
+ for (const [file, expectedHash] of files) {
+ const contents = await readFile(file);
+ const actualHash = createHash("sha256").update(contents).digest("hex");
+ assert.equal(actualHash, expectedHash, file.pathname);
}
});
-test("settings bundle runs without modern URL and text globals", async () => {
- const source = await readFile(bundles[1], "utf8");
- let result;
+test("settings bundle saves and queries wloc_settings in Shadowrocket", async () => {
+ const source = await readFile(new URL("../dist/v1/wloc-settings.js", import.meta.url), "utf8");
const storage = new Map();
- vm.runInNewContext(source, {
- $rocket: {},
- $request: {
- url: "https://gs-loc.apple.com/wloc-settings/save?lon=121.1&lat=31.2&acc=25"
- },
- $persistentStore: {
- read: (key) => storage.get(key) || null,
- write: (value, key) => {
- storage.set(key, value);
- return true;
- }
- },
- $done: (value) => { result = value; },
- JSON,
- Number,
- Object,
- String,
- decodeURIComponent
- });
- assert.equal(JSON.parse(result.response.body).success, true);
+ const run = (url) => {
+ let result;
+ vm.runInNewContext(source, {
+ $rocket: {},
+ $request: { url },
+ $persistentStore: {
+ read: (key) => storage.get(key) ?? null,
+ write: (value, key) => {
+ storage.set(key, value);
+ return true;
+ }
+ },
+ $done: (value) => { result = value; },
+ console
+ });
+ return JSON.parse(result.response.body);
+ };
+
+ const saved = run("https://gs-loc.apple.com/wloc-settings/save?lon=121.1&lat=31.2&acc=25");
+ assert.equal(saved.success, true);
+ assert.equal(storage.has("wloc_settings"), true);
+
+ const queried = run("https://gs-loc.apple.com/wloc-settings/save?action=query");
+ assert.deepEqual(
+ { success: queried.success, longitude: queried.longitude, latitude: queried.latitude, accuracy: queried.accuracy },
+ { success: true, longitude: 121.1, latitude: 31.2, accuracy: 25 }
+ );
});
diff --git a/ThirdParty/WlocScripts/test/core.test.js b/ThirdParty/WlocScripts/test/core.test.js
deleted file mode 100644
index ad1733b..0000000
--- a/ThirdParty/WlocScripts/test/core.test.js
+++ /dev/null
@@ -1,85 +0,0 @@
-import test from "node:test";
-import assert from "node:assert/strict";
-import {
- MOTION_ACTIVITY_CONFIDENCE, MOTION_ACTIVITY_TYPE, internals, parseFields, patchWlocBody
-} from "../src/core.js";
-
-const { concat, writeVarint, writeTag, writeLengthDelimited } = internals;
-
-function location(withMotion = false) {
- const fields = [
- concat(writeTag(1, 0), writeVarint(100)),
- concat(writeTag(2, 0), writeVarint(200)),
- concat(writeTag(3, 0), writeVarint(25))
- ];
- if (withMotion) {
- fields.push(concat(writeTag(11, 0), writeVarint(7)));
- fields.push(concat(writeTag(12, 0), writeVarint(88)));
- }
- return concat(...fields);
-}
-
-function wifiPayload(value = location()) {
- const device = concat(
- writeLengthDelimited(1, new TextEncoder().encode("aa:bb:cc:dd:ee:ff")),
- writeLengthDelimited(2, value)
- );
- return writeLengthDelimited(2, device);
-}
-
-function frame(payload) {
- return concat(Uint8Array.from([0, 1, 0, 0, 0, 1, 0, 0]),
- Uint8Array.from([payload.length >> 8, payload.length & 0xff]), payload);
-}
-
-const config = {
- latitude: 31.230416,
- longitude: 121.473701,
- accuracy: 50,
- motionSimulationEnabled: false
-};
-
-test("patches synthetic Wi-Fi response", () => {
- const result = patchWlocBody(frame(wifiPayload()), config);
- assert.equal(result.stats.wifi, 1);
- assert.equal(result.stats.locations, 1);
-});
-
-test("preserves motion fields while disabled", () => {
- const result = patchWlocBody(frame(wifiPayload(location(true))), config);
- const payload = result.data.slice(10);
- assert.ok(payload.includes(7));
- assert.ok(payload.includes(88));
-});
-
-test("replaces motion fields while enabled", () => {
- const result = patchWlocBody(frame(wifiPayload(location(true))), {
- ...config, motionSimulationEnabled: true
- });
- const root = parseFields(result.data.slice(10));
- const device = parseFields(root[0].value);
- const fields = parseFields(device.find((field) => field.number === 2).value);
- const motionType = fields.find((field) => field.number === 11);
- const motionConfidence = fields.find((field) => field.number === 12);
- assert.deepEqual(motionType.value, writeVarint(MOTION_ACTIVITY_TYPE));
- assert.deepEqual(motionConfidence.value, writeVarint(MOTION_ACTIVITY_CONFIDENCE));
-});
-
-test("patches CellTower fields 22 and 24", () => {
- for (const number of [22, 24]) {
- const cell = writeLengthDelimited(5, location());
- const result = patchWlocBody(frame(writeLengthDelimited(number, cell)), config);
- assert.equal(result.stats.cell, 1);
- }
-});
-
-test("encodes signed int64 coordinates without BigInt", () => {
- assert.deepEqual(
- Array.from(writeVarint(-18_000_000_000)),
- [128, 152, 247, 248, 188, 255, 255, 255, 255, 1]
- );
- assert.deepEqual(
- Array.from(writeVarint(18_000_000_000)),
- [128, 232, 136, 135, 67]
- );
-});
diff --git a/build.sh b/build.sh
index 38ec743..ae87d4d 100755
--- a/build.sh
+++ b/build.sh
@@ -8,7 +8,7 @@ usage() {
cat <<'USAGE'
Usage: ./build.sh [--test]
-Builds dist/PaopaoLocationSpoofer-unsigned.ipa without signing it.
+Builds an unsigned IPA with both stable and timestamped filenames in dist/.
Options:
--test After the unsigned IPA is created, run iOS Simulator unit tests.
diff --git a/docs/THIRD_PARTY_MODULES.md b/docs/THIRD_PARTY_MODULES.md
index 8c4bc04..b896098 100644
--- a/docs/THIRD_PARTY_MODULES.md
+++ b/docs/THIRD_PARTY_MODULES.md
@@ -1,26 +1,23 @@
# Third-party proxy modules
-The third-party proxy modules and WLOC scripts are maintained in this
-repository. The original `Yu9191/wloc` repository was deleted, and its Raw
-URLs now return HTTP 404, so it is retained only as provenance and is not a
-runtime dependency.
+The third-party proxy modules and recovered WLOC scripts are hosted in this
+repository. The original `Yu9191/wloc` repository was deleted, so it is retained
+as provenance and is not a runtime dependency.
## Hosted files
- Mirrored module subscriptions: `Resources/ThirdPartyProxyModules/`
- Direct module subscriptions: `ThirdParty/WlocScripts/modules/direct/`
-- Versioned generated scripts: `ThirdParty/WlocScripts/dist/v1/`
-- Script source and tests: `ThirdParty/WlocScripts/src/` and
- `ThirdParty/WlocScripts/test/`
+- Versioned recovered scripts: `ThirdParty/WlocScripts/dist/v1/`
+- Integrity and runtime tests: `ThirdParty/WlocScripts/test/`
-The App appends `?v=1.0.7` to module subscription URLs, and every module uses
-the same query parameter for its generated script URLs, to invalidate client
-caches:
+The App appends `?v=1.0.8` to module subscription URLs, and every module uses
+the same cache version for its script URLs:
- default mirror:
- `https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/Resources/ThirdPartyProxyModules/?v=1.0.7`
+ `https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/Resources/ThirdPartyProxyModules/?v=1.0.8`
- direct:
- `https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/modules/direct/?v=1.0.7`
+ `https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/modules/direct/?v=1.0.8`
| Module file | Client |
|---|---|
@@ -30,36 +27,39 @@ caches:
| `wloc.lpx` | Loon |
| `wloc.stoverride` | Stash |
-The hosted files become downloadable from these URLs after this change is
-merged into `main`. Until then, validate them from the checked-out paths.
+These URLs become downloadable after the change is merged into `main`. Until
+then, validate them from the checked-out paths.
## Script protocol
`wloc.js` patches Apple WLOC responses and reads coordinates from the
-`wloc_settings` persistent key or the module `argument` config.
-`wloc-settings.js` implements `wloc-settings/save` (query/clear/save) using
+`wloc_settings` persistent key or module arguments. `wloc-settings.js`
+implements `wloc-settings/save` query, clear, and save actions using
`lon`/`lat`/`acc`/`randomRadius` parameters.
-The App's third-party save sends `lon`/`lat`/`acc`. Motion-state simulation
-(fields 11/12) is unavailable in third-party mode; it remains available in
-App Mode through the built-in proxy.
+The App's third-party save sends WGS-84 `lon`/`lat`/`acc` values. Motion-state
+simulation is unavailable in third-party mode; it remains available in App Mode
+through the built-in proxy.
## Provenance and maintenance
-The response-rewrite approach and original module structure were derived from
-`Yu9191/wloc`. The repository is no longer available, but its attribution is
-preserved in module metadata and project acknowledgements. Bundled dependency
-notices are recorded in `ThirdParty/WlocScripts/THIRD_PARTY_NOTICES.md`.
+The prebuilt scripts and license were copied byte-for-byte from the
+`xepes0/wloc` community restoration pinned at
+`7f28c5e4fb6b802862988735b92e5c800382f2a2`. The recovered original baseline is
+`529fcd841952571e79f40faf2d3e0ef90a7bdfa6`. Module metadata keeps the original
+author attribution while runtime URLs point to this project.
-Build and test the scripts with:
+Full hashes, local differences, regression checks, licensing notes, and the
+maintenance exit condition are recorded in
+`ThirdParty/WlocScripts/UPSTREAM.md` and
+`ThirdParty/WlocScripts/THIRD_PARTY_NOTICES.md`.
+
+Test the scripts with:
```bash
cd ThirdParty/WlocScripts
-npm ci
npm test
-npm run build
```
-If an authoritative, maintained upstream returns, compare its license,
-protocol compatibility, tests, and release guarantees before considering a
-switch away from the project-owned copies.
+There is no local rebuild command because the restoration did not recover a
+complete reproducible source tree for these prebuilt artifacts.