@leeguoo/pwtk-network-debugger 1.2.34 → 1.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -15,4 +15,4 @@ e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function n(e){
15
15
 
16
16
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
17
  */
18
- function(){var t=e,n=t.lib,r=n.WordArray,o=n.Hasher,i=t.algo,s=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=r.create([0,1518500249,1859775393,2400959708,2840853838]),h=r.create([1352829926,1548603684,1836072691,2053994217,0]),u=i.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,o=e[r];e[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,u,w,x,m,k,_,S,B,C,D,T=this._hash.words,R=d.words,A=h.words,z=s.words,E=a.words,P=c.words,W=l.words;for(k=i=T[0],_=u=T[1],S=w=T[2],B=x=T[3],C=m=T[4],n=0;n<80;n+=1)D=i+e[t+z[n]]|0,D+=n<16?p(u,w,x)+R[0]:n<32?g(u,w,x)+R[1]:n<48?f(u,w,x)+R[2]:n<64?y(u,w,x)+R[3]:b(u,w,x)+R[4],D=(D=v(D|=0,P[n]))+m|0,i=m,m=x,x=v(w,10),w=u,u=D,D=k+e[t+E[n]]|0,D+=n<16?b(_,S,B)+A[0]:n<32?y(_,S,B)+A[1]:n<48?f(_,S,B)+A[2]:n<64?g(_,S,B)+A[3]:p(_,S,B)+A[4],D=(D=v(D|=0,W[n]))+C|0,k=C,C=B,B=v(S,10),S=_,_=D;D=T[1]+w+B|0,T[1]=T[2]+x+C|0,T[2]=T[3]+m+k|0,T[3]=T[4]+i+_|0,T[4]=T[0]+u+S|0,T[0]=D},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,s=0;s<5;s++){var a=i[s];i[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,n){return e^t^n}function g(e,t,n){return e&t|~e&n}function f(e,t,n){return(e|~t)^n}function y(e,t,n){return e&n|t&~n}function b(e,t,n){return e^(t|~n)}function v(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(u),t.HmacRIPEMD160=o._createHmacHelper(u)}(),e.RIPEMD160));var e}(),I(),function(){return X?J.exports:(X=1,J.exports=(l=a(),z(),I(),t=(e=l).lib,n=t.Base,r=t.WordArray,o=e.algo,i=o.SHA256,s=o.HMAC,c=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=s.create(n.hasher,e),i=r.create(),a=r.create([1]),c=i.words,l=a.words,d=n.keySize,h=n.iterations;c.length<d;){var u=o.update(t).finalize(a);o.reset();for(var p=u.words,g=p.length,f=u,y=1;y<h;y++){f=o.finalize(f),o.reset();for(var b=f.words,v=0;v<g;v++)p[v]^=b[v]}i.concat(u),l[0]++}return i.sigBytes=4*d,i}}),e.PBKDF2=function(e,t,n){return c.create(n).compute(e,t)},l.PBKDF2));var e,t,n,r,o,i,s,c,l}(),V(),ee(),function(){return te?ne.exports:(te=1,ne.exports=(e=a(),ee(),e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var o,i=this._iv;i?(o=i.slice(0),this._iv=void 0):o=this._prevBlock,r.encryptBlock(o,0);for(var s=0;s<n;s++)e[t+s]^=o[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize;n.call(this,e,t,o,r),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=e.slice(t,t+o);n.call(this,e,t,o,r),this._prevBlock=i}}),t}(),e.mode.CFB));var e}(),function(){return re?oe.exports:(re=1,oe.exports=(n=a(),ee(),n.mode.CTR=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var s=i.slice(0);n.encryptBlock(s,0),i[r-1]=i[r-1]+1|0;for(var a=0;a<r;a++)e[t+a]^=s[a]}}),e.Decryptor=t,e),n.mode.CTR));var e,t,n}(),ae(),function(){return ce?le.exports:(ce=1,le.exports=(n=a(),ee(),n.mode.OFB=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),n.encryptBlock(i,0);for(var s=0;s<r;s++)e[t+s]^=i[s]}}),e.Decryptor=t,e),n.mode.OFB));var e,t,n}(),function(){return de?he.exports:(de=1,he.exports=(t=a(),ee(),t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e),t.mode.ECB));var e,t}(),function(){return ue?pe.exports:(ue=1,pe.exports=(e=a(),ee(),e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,o=r-n%r,i=n+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923));var e}(),function(){return ge?fe.exports:(ge=1,fe.exports=(e=a(),ee(),e.pad.Iso10126={pad:function(t,n){var r=4*n,o=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126));var e}(),function(){return ye?be.exports:(ye=1,be.exports=(e=a(),ee(),e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971));var e}(),function(){return ve?we.exports:(ve=1,we.exports=(e=a(),ee(),e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding));var e}(),function(){return xe?me.exports:(xe=1,me.exports=(e=a(),ee(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding));var e}(),function(){return ke?_e.exports:(ke=1,_e.exports=(r=a(),ee(),t=(e=r).lib.CipherParams,n=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var r=n.parse(e);return t.create({ciphertext:r})}},r.format.Hex));var e,t,n,r}(),function(){return Se?Be.exports:(Se=1,Be.exports=(e=a(),w(),B(),V(),ee(),function(){var t=e,n=t.lib.BlockCipher,r=t.algo,o=[],i=[],s=[],a=[],c=[],l=[],d=[],h=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var g=r^r<<1^r<<2^r<<3^r<<4;g=g>>>8^255&g^99,o[n]=g,i[g]=n;var f=e[n],y=e[f],b=e[y],v=257*e[g]^16843008*g;s[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,c[n]=v<<8|v>>>24,l[n]=v,v=16843009*b^65537*y^257*f^16843008*n,d[g]=v<<24|v>>>8,h[g]=v<<16|v>>>16,u[g]=v<<8|v>>>24,p[g]=v,n?(n=f^e[e[e[b^f]]],r^=e[e[r]]):n=r=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],f=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],s=0;s<r;s++)s<n?i[s]=t[s]:(l=i[s-1],s%n?n>6&&s%n==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=g[s/n|0]<<24),i[s]=i[s-n]^l);for(var a=this._invKeySchedule=[],c=0;c<r;c++){if(s=r-c,c%4)var l=i[s];else l=i[s-4];a[c]=c<4||s<=4?l:d[o[l>>>24]]^h[o[l>>>16&255]]^u[o[l>>>8&255]]^p[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,l,o)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,d,h,u,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,o,i,s,a){for(var c=this._nRounds,l=e[t]^n[0],d=e[t+1]^n[1],h=e[t+2]^n[2],u=e[t+3]^n[3],p=4,g=1;g<c;g++){var f=r[l>>>24]^o[d>>>16&255]^i[h>>>8&255]^s[255&u]^n[p++],y=r[d>>>24]^o[h>>>16&255]^i[u>>>8&255]^s[255&l]^n[p++],b=r[h>>>24]^o[u>>>16&255]^i[l>>>8&255]^s[255&d]^n[p++],v=r[u>>>24]^o[l>>>16&255]^i[d>>>8&255]^s[255&h]^n[p++];l=f,d=y,h=b,u=v}f=(a[l>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^n[p++],y=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^n[p++],b=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&d])^n[p++],v=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^n[p++],e[t]=f,e[t+1]=y,e[t+2]=b,e[t+3]=v},keySize:8});t.AES=n._createHelper(f)}(),e.AES));var e}(),Te(),function(){return Re?Ae.exports:(Re=1,Ae.exports=(e=a(),w(),B(),V(),ee(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=r.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,r=this._S=[],o=0;o<256;o++)r[o]=o;o=0;for(var i=0;o<256;o++){var s=o%n,a=t[s>>>2]>>>24-s%4*8&255;i=(i+r[o]+a)%256;var c=r[o];r[o]=r[i],r[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,n=this._j,r=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[n],e[n]=i,r|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,r}t.RC4=n._createHelper(o);var s=r.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=n._createHelper(s)}(),e.RC4));var e}(),function(){return ze?Ee.exports:(ze=1,Ee.exports=(e=a(),w(),B(),V(),ee(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)o[n]^=r[n+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(o[0]^=l,o[1]^=h,o[2]^=d,o[3]^=u,o[4]^=l,o[5]^=h,o[6]^=d,o[7]^=u,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.Rabbit=n._createHelper(a)}(),e.Rabbit));var e}(),function(){return Pe?We.exports:(Pe=1,We.exports=(e=a(),w(),B(),V(),ee(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)r[o]^=n[o+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(r[0]^=l,r[1]^=h,r[2]^=d,r[3]^=u,r[4]^=l,r[5]^=h,r[6]^=d,r[7]^=u,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.RabbitLegacy=n._createHelper(a)}(),e.RabbitLegacy));var e}(),Le())));const Ie=new class{constructor(){this.panel=null,this.enableBrowserConsole=!1,this.logLevel="debug",this.buffer=[],this.maxBufferSize=100,this.enableBrowserConsole=!1,this.logLevel="debug"}configure(e){void 0!==e.enableBrowserConsole&&(this.enableBrowserConsole=e.enableBrowserConsole),void 0!==e.logLevel&&(this.logLevel=e.logLevel)}setPanel(e){this.panel=e,this.flushBuffer()}flushBuffer(){this.panel&&(this.buffer.forEach(({message:e,type:t})=>{this.panel.logToConsole(e,t)}),this.buffer=[])}shouldLog(e){const t=["debug","info","warn","error"],n=t.indexOf(this.logLevel);return t.indexOf(e)>=n}formatMessage(e,t,n){const r=n.map(e=>{if("object"==typeof e)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}).join(" ");return r?`${t} ${r}`:t}output(e,t,n){this.panel?this.panel.logToConsole(e,t):(this.buffer.push({message:e,type:t,timestamp:new Date}),this.buffer.length>this.maxBufferSize&&this.buffer.shift()),this.enableBrowserConsole}debug(e,...t){if(!this.shouldLog("debug"))return;const n=this.formatMessage("[DEBUG]",e,t);this.output(n,"log","log")}log(e,...t){if(!this.shouldLog("info"))return;const n=this.formatMessage("",e,t);this.output(n,"log","log")}info(e,...t){if(!this.shouldLog("info"))return;const n=this.formatMessage("[INFO]",e,t);this.output(n,"log","log")}warn(e,...t){if(!this.shouldLog("warn"))return;const n=this.formatMessage("[WARN]",e,t);this.output(n,"warn","warn")}error(e,...t){if(!this.shouldLog("error"))return;const n=this.formatMessage("[ERROR]",e,t);this.output(n,"error","error")}consoleDirect(e,...t){}};class Xe{constructor(){this.requests=new Map,this.listeners=[],this.decryptConfig={enabled:!1},window.__originalFetch=window.fetch,this.interceptXHR(),this.interceptFetch()}enableDecryption(e){this.decryptConfig.enabled=!0,e?.keyExtractor&&(this.decryptConfig.keyExtractor=e.keyExtractor),e?.slkExtractor&&(this.decryptConfig.slkExtractor=e.slkExtractor),void 0!==e?.autoFetchKeys&&(this.decryptConfig.autoFetchKeys=e.autoFetchKeys),e?.keyApiUrl&&(this.decryptConfig.keyApiUrl=e.keyApiUrl)}addListener(e){this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}getRequests(){return Array.from(this.requests.values()).sort((e,t)=>t.timestamp-e.timestamp)}clearRequests(){this.requests.clear()}generateRequestId(){return Math.random().toString(36).substr(2,9)}isInternalUrl(e){return e.includes("/api/dokv/storage")||e.includes("/api/share")}notifyListeners(e){this.listeners.forEach(t=>{try{t(e)}catch(n){Ie.warn("NetworkDebugger: Listener error:",n)}})}extractUrlParams(e){try{const t=new URL(e),n={};return t.searchParams.forEach((e,t)=>{n[t]=e}),Object.keys(n).length>0?1===Object.keys(n).length&&n.data?n.data:n:null}catch(t){return null}}async tryDecrypt(e,t){if(Ie.debug("[PWTK Debug] tryDecrypt called:",{dataType:typeof e,dataLength:"string"==typeof e?e.length:JSON.stringify(e).length,dataPreview:"string"==typeof e?e.substring(0,100):JSON.stringify(e).substring(0,100),headers:Object.keys(t),decryptEnabled:this.decryptConfig.enabled,hasWindowDecrypt:"function"==typeof window.decrypt}),!this.decryptConfig.enabled||!e)return Ie.debug("[PWTK Debug] Decrypt disabled or no data"),null;try{let r="",o="";if(t.cid&&!1!==this.decryptConfig.autoFetchKeys){Ie.debug("[PWTK Debug] Trying to fetch key with cid:",t.cid);try{const e=this.decryptConfig.keyApiUrl||"https://gw-card-pay.buyacard.cc/ip/getSK",n={cid:t.cid,client:t.client||"S_WEB",device:t.device||"Web",language:t.language||"CN"};Ie.debug("[PWTK Debug] Fetching key from:",e,"with headers:",n);const o=window.__originalFetch||window.fetch,i=await o(e,{headers:n}),s=await i.json();if(Ie.debug("[PWTK Debug] getSK API response:",s),s.success&&s.data){const e=String(s.data);Ie.debug("[PWTK Debug] getSK returned num:",e,"length:",e.length),e.length>=9?(r=e.charAt(2)+e.charAt(5)+e.charAt(8),Ie.debug("[PWTK Debug] Extracted key from getSK:",r)):Ie.debug("[PWTK Debug] getSK num too short:",e)}else Ie.debug("[PWTK Debug] getSK failed:",s)}catch(n){Ie.warn("[PWTK Debug] getSK API error:",n)}}else Ie.debug("[PWTK Debug] No cid or autoFetchKeys disabled");!r&&this.decryptConfig.keyExtractor?(r=this.decryptConfig.keyExtractor(t),Ie.debug("[PWTK Debug] Key from custom extractor:",r)):r||(r=t.decryptKey||t.keys||t.cid||"",Ie.debug("[PWTK Debug] Key from headers:",r,"from:",t.decryptKey?"decryptKey":t.keys?"keys":t.cid?"cid":"none")),this.decryptConfig.slkExtractor?(o=this.decryptConfig.slkExtractor(t),Ie.debug("[PWTK Debug] SLK from custom extractor:",o)):(o=t.decryptSlk||t.slk||"",Ie.debug("[PWTK Debug] SLK from headers:",o,"from:",t.decryptSlk?"decryptSlk":t.slk?"slk":"none"));const i=r+o;if(Ie.debug("[PWTK Debug] Full decrypt key:",i?`"${i}" (length: ${i.length})`:"empty"),i){let t=e,r=!1;if("object"==typeof e&&null!==e&&e.data&&"string"==typeof e.data)Ie.debug('[PWTK Debug] Data is wrapped in {"data": "..."} format, extracting inner data'),t=e.data,r=!0;else if("string"==typeof e)try{const n=JSON.parse(e);n.data&&"string"==typeof n.data&&(Ie.debug("[PWTK Debug] Data is JSON string with data field, extracting"),t=n.data,r=!0)}catch{}const o="string"==typeof t?t:JSON.stringify(t);Ie.debug("[PWTK Debug] Calling decrypt with:",{dataLength:o.length,dataPreview:o.substring(0,50),key:i,isWrapped:r});const s=function(e,t){if(Ie.debug("[PWTK Decrypt] decrypt function called:",{dataLength:e?.length,dataPreview:e?.substring(0,50),keyStr:t,hasWindowDecrypt:"function"==typeof window.decrypt,hasWindowEncrypt:"function"==typeof window.encrypt}),!e||e.startsWith("{")||e.startsWith("[")){Ie.debug("[PWTK Decrypt] Data looks like JSON, parsing directly");try{const t=JSON.parse(e);return Ie.debug("[PWTK Decrypt] Successfully parsed as JSON"),t}catch{return Ie.debug("[PWTK Decrypt] Failed to parse as JSON, returning as string"),e}}if(window.decrypt&&t){Ie.debug("[PWTK Decrypt] Trying WebAssembly decrypt"),Ie.debug("[PWTK Decrypt] Input to window.decrypt:",{data:e.substring(0,100)+"...",key:t});try{const n=window.decrypt(e,t);if(Ie.debug("[PWTK Decrypt] window.decrypt returned:",{type:typeof n,length:n?.length,preview:n?n.substring(0,200)+(n.length>200?"...":""):null,sameAsInput:n===e,hasInvalidChars:n?.includes("�")}),n&&n!==e&&!n.includes("�"))try{const e=JSON.parse(n);return Ie.debug("[PWTK Decrypt] ✅ WebAssembly decryption successful, parsed as JSON:",e),e}catch{if(n.length>0)return Ie.debug("[PWTK Decrypt] ✅ WebAssembly decryption successful, returning as string"),n}else Ie.debug("[PWTK Decrypt] window.decrypt did not change the data or returned invalid result")}catch(n){Ie.debug("[PWTK Decrypt] WebAssembly decrypt error:",n)}}else Ie.debug("[PWTK Decrypt] WebAssembly not available:",{hasWindowDecrypt:!!window.decrypt,hasKey:!!t,windowDecryptType:typeof window.decrypt});const r=[t,"thisisakey123456","VITE_CRYPTO_KEY"].filter(Boolean);for(const o of r)if(o)try{const t=Ue.enc.Utf8.parse(o.padEnd(16,"0").slice(0,16)),n=Ue.enc.Utf8.parse(o.padEnd(16,"0").slice(0,16)),r=Ue.AES.decrypt(e,t,{iv:n,mode:Ue.mode.CBC,padding:Ue.pad.Pkcs7}).toString(Ue.enc.Utf8);if(r)try{return JSON.parse(r)}catch{return r}}catch(n){}try{const t=atob(e);try{return JSON.parse(t)}catch{return t}}catch{}return Ie.debug("[PWTK Decrypt] ❌ All decryption methods failed, returning original data"),e}(o,i);if(Ie.debug("[PWTK Debug] Decrypt result:",{success:s&&s!==o,decryptedType:typeof s,decryptedLength:s?"string"==typeof s?s.length:JSON.stringify(s).length:0,preview:s?"string"==typeof s?s.substring(0,100):JSON.stringify(s).substring(0,100):null}),s&&s!==o)return Ie.debug("[PWTK Debug] ✅ Decryption successful! Result:",s),s;Ie.debug("[PWTK Debug] ❌ Decryption failed or returned same data")}else Ie.debug("[PWTK Debug] No key available, skipping decryption")}catch(r){Ie.error("[PWTK Debug] tryDecrypt error:",r)}return Ie.debug("[PWTK Debug] tryDecrypt returning null"),null}interceptXHR(){const e=window.XMLHttpRequest,t=this;window.XMLHttpRequest=function(...n){const r=new e(...n),o=t.generateRequestId();let i="",s="",a={};const c=Date.now();let l=!1;const d=r.open;r.open=function(e,n,...r){return i=e.toUpperCase(),s=n,l=t.isInternalUrl(s),d.apply(this,[e,n,...r])};const h=r.setRequestHeader;r.setRequestHeader=function(e,t){return a[e]=t,h.call(this,e,t)};const u=r.send;return r.send=function(e){if(l)return u.call(this,e);const n={id:o,url:s,method:i,headers:{...a},requestBody:e,timestamp:c};let r=e;return"GET"!==i||e||(r=t.extractUrlParams(s),r&&(n.requestBody=r)),r&&t.tryDecrypt(r,a).then(e=>{null!==e&&(n.decryptedRequest=e,t.requests.set(o,n),Ie.debug("[PWTK Debug] Request decrypted, notifying UI"),t.notifyListeners(n))}).catch(e=>Ie.warn("解密请求失败:",e)),t.requests.set(o,n),t.notifyListeners(n),u.call(this,e)},r.addEventListener("readystatechange",function(){if(Ie.debug("[PWTK Debug] XHR state changed:",{readyState:r.readyState,readyStateName:["UNSENT","OPENED","HEADERS_RECEIVED","LOADING","DONE"][r.readyState],status:r.status,isInternal:l,requestId:o,url:s}),Ie.debug("[PWTK Debug] Checking response condition:",{readyState:r.readyState,isDone:4===r.readyState,XMLHttpRequestDONE:"undefined"!=typeof XMLHttpRequest?XMLHttpRequest.DONE:"undefined",isInternal:l,shouldProcess:4===r.readyState&&!l}),4===r.readyState&&!l){Ie.debug("[PWTK Debug] XHR completed, processing response");const e=Date.now(),n=t.requests.get(o);if(n){Ie.debug("[PWTK Debug] Found request data, updating with response"),n.status=r.status,n.statusText=r.statusText,n.duration=e-c;const i={},s=r.getAllResponseHeaders();s&&s.split("\r\n").forEach(e=>{const t=e.split(": ");2===t.length&&(i[t[0]]=t[1])}),n.responseHeaders=i;const l=null!==r.responseText&&void 0!==r.responseText&&""!==r.responseText;if(Ie.debug("[PWTK Debug] XHR Response received:",{status:n.status,hasResponseText:l,responseTextLength:r.responseText?.length,responseTextPreview:r.responseText?.substring(0,100)}),l)try{n.responseBody=JSON.parse(r.responseText),Ie.debug("[PWTK Debug] Response parsed as JSON:",n.responseBody)}catch{n.responseBody=r.responseText,Ie.debug("[PWTK Debug] Response kept as text")}else n.responseBody=null,Ie.debug("[PWTK Debug] No response body");Ie.debug("[PWTK Debug] Updating request with response data"),t.requests.set(o,n),t.notifyListeners(n),n.responseBody&&t.tryDecrypt(n.responseBody,{...a,...i}).then(e=>{null!==e&&(n.decryptedResponse=e,t.requests.set(o,n),Ie.debug("[PWTK Debug] Response decrypted, notifying UI:",e),t.notifyListeners(n))}).catch(e=>Ie.warn("解密响应失败:",e))}else Ie.debug("[PWTK Debug] WARNING: Request data not found for ID:",o)}}),r},window.XMLHttpRequest.prototype=e.prototype}interceptFetch(){const e=window.__originalFetch||window.fetch,t=this;window.fetch=async function(n,r){const o=t.generateRequestId(),i=Date.now(),s="string"==typeof n?n:n instanceof URL?n.toString():n.url,a=(r?.method||"GET").toUpperCase();if(t.isInternalUrl(s))return e.call(this,n,r);const c={};r?.headers&&(r.headers instanceof Headers?r.headers.forEach((e,t)=>{c[t]=e}):Array.isArray(r.headers)?r.headers.forEach(([e,t])=>{c[e]=t}):Object.entries(r.headers).forEach(([e,t])=>{c[e]=t}));let l=null;if(r?.body)if("string"==typeof r.body)try{l=JSON.parse(r.body)}catch{l=r.body}else l=r.body;const d={id:o,url:s,method:a,headers:{...c},requestBody:l,timestamp:i};let h=l;"GET"!==a||l||(h=t.extractUrlParams(s),h&&(d.requestBody=h)),h&&t.tryDecrypt(h,c).then(e=>{null!==e&&(d.decryptedRequest=e,t.requests.set(o,d),Ie.debug("[PWTK Debug] Fetch request decrypted, notifying UI"),t.notifyListeners(d))}).catch(e=>Ie.warn("解密请求失败:",e)),t.requests.set(o,d),t.notifyListeners(d);try{const s=await e.call(this,n,r),a=Date.now(),l=s.clone(),d=t.requests.get(o);if(d){d.status=s.status,d.statusText=s.statusText,d.duration=a-i;const e={};s.headers.forEach((t,n)=>{e[n]=t}),d.responseHeaders=e;try{const n=await l.text();Ie.debug("[PWTK Debug] Fetch Response received:",{status:d.status,textLength:n.length,textPreview:n.substring(0,100)});try{d.responseBody=JSON.parse(n)}catch{d.responseBody=n}t.requests.set(o,d),t.notifyListeners(d),d.responseBody&&t.tryDecrypt(d.responseBody,{...c,...e}).then(e=>{null!==e&&(d.decryptedResponse=e,t.requests.set(o,d),Ie.debug("[PWTK Debug] Fetch response decrypted, notifying UI:",e),t.notifyListeners(d))}).catch(e=>Ie.warn("解密响应失败:",e))}catch(u){d.error=`Failed to read response: ${u}`,t.requests.set(o,d),t.notifyListeners(d)}}return s}catch(u){const e=Date.now(),n=t.requests.get(o);throw n&&(n.error=u instanceof Error?u.message:String(u),n.duration=e-i,t.requests.set(o,n),t.notifyListeners(n)),u}}}}class Je{constructor(){this.loaded=!1,this.loading=!1}async loadWasm(e,t){if(Ie.debug("[PWTK WASM] loadWasm called"),Ie.debug("[PWTK WASM] Current state:",{hasWindowDecrypt:"function"==typeof window.decrypt,hasWindowEncrypt:"function"==typeof window.encrypt,hasWindowGo:void 0!==window.Go}),"function"==typeof window.decrypt)return Ie.debug("[PWTK WASM] window.decrypt already exists, skipping WASM load"),this.loaded=!0,!0;if(this.loaded)return!0;if(this.loading)return new Promise(e=>{const t=()=>{this.loaded||!this.loading?e(this.loaded):setTimeout(t,100)};t()});this.loading=!0;try{const i=[e,"/mimlib.wasm","/dist/mimlib.wasm","/assets/mimlib.wasm","https://gw-card-pay.buyacard.cc/mimlib.wasm"].filter(Boolean),s=[t,"/wasm_exec.js","/dist/wasm_exec.js","/assets/wasm_exec.js","https://gw-card-pay.buyacard.cc/wasm_exec.js"].filter(Boolean);let a=!1;for(const e of s)try{if(await this.loadScript(e),void 0!==window.Go){a=!0,Ie.debug("[PWTK WASM] wasm_exec.js loaded successfully from:",e);break}}catch(n){Ie.warn("NetworkDebugger: 尝试加载",e,"失败:",n);continue}if(!a)throw new Error("Unable to load wasm_exec.js from any path");if(void 0===window.Go)throw new Error("Go WebAssembly runtime not available");const c=new window.Go;let l=null;for(const e of i)try{if(!WebAssembly.instantiateStreaming){const t=await fetch(e).then(e=>e.arrayBuffer());l=await WebAssembly.instantiate(t,c.importObject),Ie.info("NetworkDebugger: WebAssembly 加载成功(传统方式):",e);break}try{l=await WebAssembly.instantiateStreaming(fetch(e),c.importObject),Ie.info("NetworkDebugger: WebAssembly 加载成功:",e);break}catch(r){Ie.warn("instantiateStreaming 失败,尝试传统方式:",r);const t=await fetch(e).then(e=>e.arrayBuffer());l=await WebAssembly.instantiate(t,c.importObject),Ie.info("NetworkDebugger: WebAssembly 加载成功(传统方式):",e);break}}catch(o){Ie.warn("NetworkDebugger: 尝试加载",e,"失败:",o);continue}if(!l)throw new Error("Unable to load WebAssembly from any path");return c.run(l.instance),await new Promise(e=>setTimeout(e,100)),Ie.debug("[PWTK WASM] After WASM load, checking functions:",{hasDecrypt:"function"==typeof window.decrypt,hasEncrypt:"function"==typeof window.encrypt,windowKeys:Object.keys(window).filter(e=>e.includes("crypt"))}),"function"==typeof window.decrypt?(this.loaded=!0,Ie.debug("[PWTK WASM] ✅ WebAssembly loaded successfully, decrypt function available"),!0):(Ie.warn("[PWTK WASM] ❌ WebAssembly loaded but decrypt function not available"),!1)}catch(o){return Ie.error("[PWTK WASM] WebAssembly loading failed:",o),!1}finally{this.loading=!1,Ie.debug("[PWTK WASM] Load complete, final state:",{loaded:this.loaded,hasDecrypt:"function"==typeof window.decrypt})}}loadScript(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return void t();const r=document.createElement("script");r.src=e,r.type="text/javascript",r.onload=()=>t(),r.onerror=t=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}isLoaded(){return this.loaded}isLoading(){return this.loading}isDecryptAvailable(){return this.loaded&&"function"==typeof window.decrypt}isEncryptAvailable(){return this.loaded&&"function"==typeof window.encrypt}}function Ge(e){return JSON.stringify(e,null,2)}async function Ye(e){try{const n=function(e){let t=`curl '${e.url}'`;"GET"!==e.method&&(t+=` -X ${e.method}`);e.headers&&Object.entries(e.headers).forEach(([e,n])=>{t+=` -H '${e}: ${n}'`});if(e.requestBody){const n="string"==typeof e.requestBody?e.requestBody:JSON.stringify(e.requestBody);t+=` --data '${n}'`}return t}(e),r={curl:n,response:e.responseBody||null,timestamp:Date.now(),slk:e.headers?.slk||"",debuggerData:{url:e.url,method:e.method,headers:e.headers,status:e.status,statusText:e.statusText,duration:e.duration,responseHeaders:e.responseHeaders,decryptedRequest:e.decryptedRequest,decryptedResponse:e.decryptedResponse,error:e.error,creator:"PWTK Network Debugger by Leo (@leeguoo)",version:"1.2.26"}},o=window.__originalFetch||window.fetch,i="https://curl.bwg.leeguoo.com/api/share";let s;Ie.debug("使用分享API:",i);try{s=await o(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:r})})}catch(t){if("TypeError"===t.name&&t.message.includes("fetch"))throw new Error(`网络连接失败: 无法连接到分享服务器 (${i}). 可能原因: CORS策略限制或网络问题`);throw t}if(!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);const a=await s.json();if(a.shareId){const e=`https://curl.bwg.leeguoo.com/share/${a.shareId}`;return Ie.info(`🔗 分享链接创建成功 (by Leo): ${e}`),e}throw new Error(a.error||"创建分享失败")}catch(n){const e=n.message||n.toString()||"未知错误";throw Ie.error("NetworkDebugger: 创建分享链接失败:",{message:e,name:n.name,stack:n.stack?.split("\n")[0]}),new Error(e)}}const Ve=class e{constructor(e,t={}){this.isDragging=!1,this.isResizing=!1,this.dragStart={x:0,y:0},this.resizeTimeout=null,this.currentTab="network",this.consoleHistory=[],this.requestsCache=[],this.interceptor=e;const n=this.loadConfig();this.config={position:"bottom-right",theme:"dark",minimized:!1,showConsole:!0,...n,...t},this.createPanel(),this.bindEvents(),this.startListening(),Ie.setPanel(this),this.loadPosition()}createPanel(){if(!document.getElementById("network-debugger-styles")){const e=document.createElement("style");e.id="network-debugger-styles",e.textContent="\n/* NetworkDebugger 样式 */\n#network-debugger-panel {\n position: fixed;\n z-index: 999999;\n background: #1a1a1a;\n color: #ffffff;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n border-radius: 8px;\n overflow: hidden;\n max-width: 90vw;\n max-height: 80vh;\n transition: all 0.3s ease;\n}\n\n#network-debugger-panel.minimized {\n height: 35px !important;\n overflow: hidden;\n width: 160px !important;\n max-width: 160px !important;\n}\n\n#network-debugger-panel.minimized .debugger-content {\n display: none;\n}\n\n#network-debugger-panel.minimized .resize-handle {\n display: none;\n}\n\n#network-debugger-panel.fullscreen .resize-handle {\n display: none;\n}\n\n#network-debugger-panel.bottom-right {\n bottom: 20px;\n right: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.bottom-left {\n bottom: 20px;\n left: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.top-right {\n top: 20px;\n right: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.top-left {\n top: 20px;\n left: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.fullscreen {\n top: 0;\n left: 0;\n width: 100vw !important;\n height: 100vh !important;\n border-radius: 0;\n}\n\n.debugger-header {\n background: #333;\n padding: 8px 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: move;\n user-select: none;\n border-bottom: 1px solid #444;\n}\n\n.debugger-title {\n font-weight: bold;\n color: #4CAF50;\n font-size: 14px;\n}\n\n.debugger-controls {\n display: flex;\n gap: 8px;\n}\n\n.debugger-btn {\n background: none;\n border: none;\n color: #fff;\n padding: 4px 8px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n transition: background-color 0.2s;\n}\n\n.debugger-btn:hover {\n background: #555;\n}\n\n.debugger-btn.active {\n background: #4CAF50;\n color: #000;\n}\n\n.debugger-icon {\n width: 16px;\n height: 16px;\n vertical-align: middle;\n}\n\n.debugger-content {\n height: calc(100% - 40px);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n\n.debugger-tabs {\n display: flex;\n background: #2a2a2a;\n border-bottom: 1px solid #444;\n}\n\n.debugger-tab {\n padding: 8px 16px;\n cursor: pointer;\n border: none;\n background: none;\n color: #ccc;\n font-size: 12px;\n transition: all 0.2s;\n border-bottom: 2px solid transparent;\n}\n\n.debugger-tab:hover {\n color: #fff;\n background: #3a3a3a;\n}\n\n.debugger-tab.active {\n color: #4CAF50;\n border-bottom-color: #4CAF50;\n background: #333;\n}\n\n.debugger-panel-content {\n flex: 1;\n overflow: auto;\n padding: 12px;\n}\n\n.request-list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.request-item {\n background: #2a2a2a;\n border: 1px solid #444;\n border-radius: 6px;\n padding: 10px;\n cursor: pointer;\n transition: all 0.2s;\n position: relative;\n}\n\n.request-item:hover {\n background: #333;\n border-color: #666;\n}\n\n.request-item.expanded {\n background: #333;\n border-color: #4CAF50;\n}\n\n.request-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 4px;\n}\n\n.request-method {\n padding: 2px 8px;\n border-radius: 4px;\n font-weight: bold;\n font-size: 10px;\n text-transform: uppercase;\n min-width: 40px;\n text-align: center;\n}\n\n.method-get { background: #4CAF50; color: #000; }\n.method-post { background: #2196F3; color: #fff; }\n.method-put { background: #FF9800; color: #000; }\n.method-delete { background: #F44336; color: #fff; }\n.method-patch { background: #9C27B0; color: #fff; }\n\n.request-url {\n flex: 1;\n margin: 0 8px;\n word-break: break-all;\n white-space: normal;\n color: #fff;\n font-size: 11px;\n line-height: 1.3;\n}\n\n.request-status {\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 10px;\n min-width: 35px;\n text-align: center;\n}\n\n.status-2xx { background: #4CAF50; color: #000; }\n.status-3xx { background: #FF9800; color: #000; }\n.status-4xx { background: #F44336; color: #fff; }\n.status-5xx { background: #9C27B0; color: #fff; }\n.status-error { background: #F44336; color: #fff; }\n\n.request-info {\n display: flex;\n justify-content: space-between;\n font-size: 10px;\n color: #999;\n}\n\n.request-details {\n margin-top: 12px;\n border-top: 1px solid #444;\n padding-top: 12px;\n display: none;\n}\n\n/* 默认折叠headers */\n.request-details .detail-section.collapsible {\n /* 默认折叠状态 */\n}\n\n.request-details .detail-section.collapsible:not(.expanded) .detail-content {\n display: none;\n}\n\n.request-details .detail-section.collapsible:not(.expanded) .collapse-icon {\n transform: rotate(-90deg);\n}\n\n.request-item.expanded .request-details {\n display: block;\n}\n\n.detail-section {\n margin-bottom: 16px;\n}\n\n.detail-title {\n font-weight: bold;\n color: #4CAF50;\n margin-bottom: 8px;\n font-size: 11px;\n text-transform: uppercase;\n border-bottom: 1px solid #444;\n padding-bottom: 4px;\n}\n\n.detail-title.highlight {\n color: #FFD700;\n font-size: 12px;\n background: rgba(255, 215, 0, 0.1);\n padding: 6px 8px;\n border-radius: 4px;\n border-bottom: 2px solid #FFD700;\n}\n\n.detail-title.clickable {\n cursor: pointer;\n user-select: none;\n display: flex;\n align-items: center;\n gap: 4px;\n}\n\n.detail-title.clickable:hover {\n background: rgba(76, 175, 80, 0.1);\n}\n\n.collapse-icon {\n display: inline-block;\n transition: transform 0.2s;\n font-size: 10px;\n}\n\n.detail-section.collapsible {\n position: relative;\n}\n\n.detail-section.collapsible.collapsed .detail-content {\n display: none;\n}\n\n.detail-section.collapsible.collapsed .collapse-icon {\n transform: rotate(-90deg);\n}\n\n.detail-content {\n background: #222;\n padding: 8px;\n border-radius: 4px;\n max-height: 200px;\n overflow: auto;\n}\n\n.json-content {\n white-space: pre-wrap;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 11px;\n line-height: 1.4;\n}\n\n.headers-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 10px;\n}\n\n.headers-table th,\n.headers-table td {\n padding: 4px 8px;\n text-align: left;\n border-bottom: 1px solid #444;\n}\n\n.headers-table th {\n background: #333;\n color: #4CAF50;\n font-weight: bold;\n}\n\n.headers-table td {\n color: #ccc;\n}\n\n.decrypted-badge {\n background: #4CAF50;\n color: #000;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 9px;\n margin-left: 8px;\n font-weight: bold;\n}\n\n.error-badge {\n background: #F44336;\n color: #fff;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 9px;\n margin-left: 8px;\n font-weight: bold;\n}\n\n.share-btn {\n background: #2196F3;\n color: #fff;\n border: none;\n padding: 4px 10px;\n border-radius: 3px;\n font-size: 11px;\n margin-left: 8px;\n cursor: pointer;\n transition: all 0.2s;\n white-space: nowrap;\n}\n\n.share-btn:hover {\n background: #1976D2;\n transform: scale(1.1);\n}\n\n.share-btn:active {\n transform: scale(0.95);\n}\n\n.console-content {\n background: #000;\n color: #0f0;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 11px;\n line-height: 1.4;\n height: 100%;\n overflow: auto;\n padding: 8px;\n}\n\n.console-input {\n display: flex;\n align-items: center;\n background: #333;\n padding: 8px;\n border-top: 1px solid #444;\n}\n\n.console-prompt {\n color: #4CAF50;\n margin-right: 8px;\n font-weight: bold;\n}\n\n.console-cmd {\n flex: 1;\n background: none;\n border: none;\n color: #fff;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n outline: none;\n}\n\n.tools-section {\n padding: 12px;\n background: #2a2a2a;\n border-bottom: 1px solid #444;\n}\n\n.tool-buttons {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.tool-btn {\n padding: 6px 12px;\n background: #4CAF50;\n color: #000;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 11px;\n font-weight: bold;\n transition: background-color 0.2s;\n}\n\n.tool-btn:hover {\n background: #45a049;\n}\n\n.tool-btn:disabled {\n background: #666;\n color: #999;\n cursor: not-allowed;\n}\n\n@media (max-width: 600px) {\n #network-debugger-panel.bottom-right,\n #network-debugger-panel.bottom-left,\n #network-debugger-panel.top-right,\n #network-debugger-panel.top-left {\n width: calc(100vw - 20px) !important;\n left: 10px !important;\n right: auto !important;\n }\n \n /* 最小化时不应用全宽,保持小尺寸 */\n #network-debugger-panel.minimized {\n width: 160px !important;\n max-width: 160px !important;\n height: 35px !important;\n }\n}\n\n::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n}\n\n::-webkit-scrollbar-track {\n background: #333;\n}\n\n::-webkit-scrollbar-thumb {\n background: #666;\n border-radius: 3px;\n}\n\n::-webkit-scrollbar-thumb:hover {\n background: #888;\n}\n\n.resize-handle {\n position: absolute;\n background: transparent;\n}\n\n.resize-handle.n {\n top: -3px;\n left: 0;\n right: 0;\n height: 6px;\n cursor: ns-resize;\n}\n\n.resize-handle.s {\n bottom: -3px;\n left: 0;\n right: 0;\n height: 6px;\n cursor: ns-resize;\n}\n\n.resize-handle.e {\n top: 0;\n right: -3px;\n bottom: 0;\n width: 6px;\n cursor: ew-resize;\n}\n\n.resize-handle.w {\n top: 0;\n left: -3px;\n bottom: 0;\n width: 6px;\n cursor: ew-resize;\n}\n\n.resize-handle.ne {\n top: -3px;\n right: -3px;\n width: 12px;\n height: 12px;\n cursor: ne-resize;\n}\n\n.resize-handle.nw {\n top: -3px;\n left: -3px;\n width: 12px;\n height: 12px;\n cursor: nw-resize;\n}\n\n.resize-handle.se {\n bottom: -3px;\n right: -3px;\n width: 12px;\n height: 12px;\n cursor: se-resize;\n}\n\n.resize-handle.sw {\n bottom: -3px;\n left: -3px;\n width: 12px;\n height: 12px;\n cursor: sw-resize;\n}\n\n.debugger-reopen-btn {\n position: fixed;\n z-index: 999999;\n background: #4CAF50;\n color: #000;\n border: none;\n padding: 8px 10px;\n border-radius: 16px;\n font-weight: bold;\n font-size: 12px;\n box-shadow: 0 4px 12px rgba(0,0,0,0.25);\n cursor: pointer;\n}\n\n.debugger-reopen-btn:hover {\n filter: brightness(0.95);\n}\n",document.head.appendChild(e)}this.container=document.createElement("div"),this.container.id="network-debugger-panel",this.container.className=`${this.config.position} ${this.config.minimized?"minimized":""}`,this.container.innerHTML=`\n <div class="debugger-header">\n <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo</span></div>\n <div class="debugger-controls">\n <button class="debugger-btn" data-action="clear" title="清空"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg></button>\n <button class="debugger-btn" data-action="export" title="导出"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg></button>\n <button class="debugger-btn" data-action="fullscreen" title="全屏"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg></button>\n <button class="debugger-btn" data-action="close" title="关闭"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg></button>\n </div>\n </div>\n <div class="debugger-content">\n <div class="debugger-tabs">\n <button class="debugger-tab active" data-tab="network">网络</button>\n ${this.config.showConsole?'<button class="debugger-tab" data-tab="console">控制台</button>':""}\n <button class="debugger-tab" data-tab="tools">工具</button>\n <button class="debugger-tab" data-tab="about">关于</button>\n </div>\n <div class="debugger-panel-content">\n <div class="network-panel" data-panel="network">\n <div class="request-list"></div>\n </div>\n ${this.config.showConsole?'\n <div class="console-panel" data-panel="console" style="display: none;">\n <div class="console-content"></div>\n <div class="console-input">\n <span class="console-prompt">></span>\n <input class="console-cmd" placeholder="输入 JavaScript 代码..." />\n </div>\n </div>\n ':""}\n <div class="tools-panel" data-panel="tools" style="display: none;">\n <div class="tools-section">\n <div class="tool-buttons">\n <button class="tool-btn" data-tool="parse-curl">解析 cURL</button>\n <button class="tool-btn" data-tool="export-har">导出 HAR</button>\n <button class="tool-btn" data-tool="cors-test">CORS 测试</button>\n <button class="tool-btn" data-tool="decrypt-test">解密测试</button>\n </div>\n </div>\n <div class="tools-content">\n <textarea placeholder="在这里粘贴 cURL 命令或输入要测试的数据..." style="width: 100%; height: 200px; background: #222; color: #fff; border: 1px solid #444; padding: 8px; font-family: monospace;"></textarea>\n </div>\n </div>\n <div class="about-panel" data-panel="about" style="display: none;">\n <div style="padding: 20px; color: #fff; text-align: center;">\n <h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>\n <p style="margin: 10px 0;">Version: 1.2.34</p>\n <p style="margin: 10px 0;">👨‍💻 Created by <strong>Leo (@leeguoo)</strong></p>\n <p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>\n <p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>\n <div style="margin-top: 20px; padding: 15px; background: #333; border-radius: 8px;">\n <p style="margin: 5px 0; font-size: 12px;">本工具专为 PWTK 项目开发</p>\n <p style="margin: 5px 0; font-size: 12px;">提供网络请求拦截、解密、分享等功能</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n `,this.addResizeHandles(),document.body.appendChild(this.container),this.networkTab=this.container.querySelector('[data-panel="network"]'),this.consoleTab=this.container.querySelector('[data-panel="console"]'),this.consoleContent=this.container.querySelector(".console-content")}addResizeHandles(){["n","s","e","w","ne","nw","se","sw"].forEach(e=>{const t=document.createElement("div");t.className=`resize-handle ${e}`,t.dataset.direction=e,this.container.appendChild(t)})}bindEvents(){const e=this.container.querySelector(".debugger-header"),t=this.container.querySelector(".debugger-controls"),n=this.container.querySelectorAll(".debugger-tab"),r=this.container.querySelectorAll("[data-tool]"),o=this.container.querySelector(".console-cmd");e.addEventListener("mousedown",e=>{e.target===t||t.contains(e.target)||this.startDrag(e)}),t.addEventListener("click",e=>{e.stopPropagation();let n=e.target;for(;n&&n!==t&&!n.dataset?.action;)n=n.parentElement;const r=n?.dataset?.action;if(r)switch(r){case"clear":this.clearRequests();break;case"export":this.exportData();break;case"fullscreen":this.toggleFullscreen();break;case"close":this.hide()}}),n.forEach(e=>{e.addEventListener("click",e=>{const t=e.target.dataset.tab;this.switchTab(t)})}),r.forEach(e=>{e.addEventListener("click",e=>{const t=e.target.dataset.tool;this.handleToolAction(t)})}),o&&o.addEventListener("keypress",e=>{"Enter"===e.key&&(this.executeConsoleCommand(o.value),o.value="")});this.container.querySelectorAll(".resize-handle").forEach(e=>{e.addEventListener("mousedown",t=>{t.stopPropagation();const n=e.dataset.direction||e.classList[1]||"se";this.startResize(t,n)})}),document.addEventListener("mousemove",this.handleMouseMove.bind(this)),document.addEventListener("mouseup",this.handleMouseUp.bind(this)),window.addEventListener("resize",this.handleWindowResize.bind(this))}startListening(){this.interceptor.addListener(e=>{this.addRequestToUI(e)}),this.requestsCache=this.interceptor.getRequests(),this.renderRequests()}addRequestToUI(e){Ie.debug("[PWTK UI] Adding/updating request:",{id:e.id,url:e.url,hasResponse:!!e.responseBody,hasDecryptedRequest:!!e.decryptedRequest,hasDecryptedResponse:!!e.decryptedResponse,status:e.status});const t=this.requestsCache.findIndex(t=>t.id===e.id);t>=0?this.requestsCache[t]=e:this.requestsCache.unshift(e),this.requestsCache.length>100&&(this.requestsCache=this.requestsCache.slice(0,100)),this.renderRequests()}renderRequests(){const e=this.container.querySelector(".request-list");e&&(e.innerHTML="",this.requestsCache.forEach(t=>{const n=this.createRequestItem(t);e.appendChild(n)}))}createRequestItem(e){const t=document.createElement("div");t.className="request-item",t.dataset.requestId=e.id;const n=this.getStatusClass(e.status),r=`method-${e.method.toLowerCase()}`;e.decryptedRequest||e.decryptedResponse;const o=e.error;t.innerHTML=`\n <div class="request-header">\n <span class="request-method ${r}">${e.method}</span>\n <span class="request-url" title="${e.url}">${this.truncateUrl(e.url)}</span>\n <span class="request-status ${n}">${e.status?e.status:void 0!==e.duration?"ERR":"Pending"}</span>\n ${o?'<span class="error-badge">⚠️</span>':""}\n <button class="share-btn" title="分享此请求 (by Leo)" onclick="event.stopPropagation()">分享链接</button>\n </div>\n <div class="request-info">\n <span>${new Date(e.timestamp).toLocaleTimeString()}</span>\n <span>${e.duration?`${e.duration}ms`:"Pending"}</span>\n </div>\n <div class="request-details">\n ${this.renderRequestDetails(e)}\n </div>\n `,t.addEventListener("click",e=>{const n=e.target;n.closest(".share-btn")||n.closest('.detail-title[data-toggle="collapse"]')||t.classList.toggle("expanded")});const i=t.querySelector(".share-btn");return i&&i.addEventListener("click",async t=>{t.stopPropagation(),await this.shareRequest(e)}),t.addEventListener("click",e=>{const t=e.target;if(t.closest('.detail-title[data-toggle="collapse"]')){e.stopPropagation();const n=t.closest(".detail-title").parentElement;n&&n.classList.contains("collapsible")&&n.classList.toggle("collapsed")}},{capture:!0}),t}renderRequestDetails(e){let t="";return e.id.replace(/[^a-zA-Z0-9]/g,""),e.decryptedRequest&&(t+=`\n <div class="detail-section">\n <div class="detail-title highlight">解密请求数据</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.decryptedRequest)}</div>\n </div>\n </div>\n `),e.decryptedResponse&&(t+=`\n <div class="detail-section">\n <div class="detail-title highlight">解密响应数据</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.decryptedResponse)}</div>\n </div>\n </div>\n `),Object.keys(e.headers).length>0&&(t+=`\n <div class="detail-section collapsible collapsed">\n <div class="detail-title clickable" data-toggle="collapse">\n <span class="collapse-icon">▼</span> 请求头 (${Object.keys(e.headers).length})\n </div>\n <div class="detail-content">\n <table class="headers-table">\n ${Object.entries(e.headers).map(([e,t])=>`<tr><td>${e}</td><td>${t}</td></tr>`).join("")}\n </table>\n </div>\n </div>\n `),e.responseHeaders&&Object.keys(e.responseHeaders).length>0&&(t+=`\n <div class="detail-section collapsible collapsed">\n <div class="detail-title clickable" data-toggle="collapse">\n <span class="collapse-icon">▼</span> 响应头 (${Object.keys(e.responseHeaders).length})\n </div>\n <div class="detail-content">\n <table class="headers-table">\n ${Object.entries(e.responseHeaders).map(([e,t])=>`<tr><td>${e}</td><td>${t}</td></tr>`).join("")}\n </table>\n </div>\n </div>\n `),e.requestBody&&(t+=`\n <div class="detail-section">\n <div class="detail-title">${e.decryptedRequest?"原始请求数据":"请求数据"}</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.requestBody)}</div>\n </div>\n </div>\n `),e.responseBody&&(t+=`\n <div class="detail-section">\n <div class="detail-title">${e.decryptedResponse?"原始响应数据":"响应数据"}</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.responseBody)}</div>\n </div>\n </div>\n `),e.error&&(t+=`\n <div class="detail-section">\n <div class="detail-title">错误信息</div>\n <div class="detail-content">\n <div class="json-content" style="color: #f44336;">${e.error}</div>\n </div>\n </div>\n `),t}formatData(e){if("string"==typeof e)try{return Ge(JSON.parse(e))}catch{return e}return Ge(e)}getStatusClass(e){return e?e>=200&&e<300?"status-2xx":e>=300&&e<400?"status-3xx":e>=400&&e<500?"status-4xx":e>=500?"status-5xx":"status-error":"status-error"}truncateUrl(e){const t=e.indexOf("?");return t>-1?e.substring(0,t):e}switchTab(e){this.container.querySelectorAll(".debugger-tab").forEach(t=>{t.classList.toggle("active",t.dataset.tab===e)}),this.container.querySelectorAll("[data-panel]").forEach(t=>{t.style.display=t.getAttribute("data-panel")===e?"block":"none"}),this.currentTab=e}clearRequests(){this.requestsCache=[],this.interceptor.clearRequests(),this.renderRequests(),this.logToConsole("✅ 已清空网络请求记录")}exportData(){const e={timestamp:(new Date).toISOString(),requests:this.requestsCache,userAgent:navigator.userAgent,url:window.location.href,creator:"PWTK Network Debugger by Leo (@leeguoo)"},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`network-debug-${Date.now()}.json`,r.click(),URL.revokeObjectURL(n),this.logToConsole("💾 网络数据已导出 (by Leo)")}async shareRequest(e){try{this.logToConsole("📤 正在创建分享链接...");const t=await Ye(e);if(!t)throw new Error("无法创建分享链接");await async function(e){try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(e),!0;{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}}catch(t){return Ie.error("复制到剪贴板失败:",t),!1}}(t)?(this.logToConsole(`✅ 分享链接已复制到剪贴板: ${t}`),alert(`分享链接已复制到剪贴板!\n${t}\n\nCreated by Leo (@leeguoo)`)):(this.logToConsole(`✅ 分享链接: ${t}`),prompt("分享链接已创建,请手动复制:\n\nCreated by Leo (@leeguoo)",t))}catch(t){Ie.error("分享失败:",t),this.logToConsole(`❌ 分享失败: ${t}`),alert("分享失败,请稍后重试")}}toggleFullscreen(){this.container.classList.contains("fullscreen")?(this.container.classList.remove("fullscreen"),this.container.style.top="",this.container.style.left="",this.container.style.width="",this.container.style.height="",this.loadPosition()):(this.container.classList.add("fullscreen"),this.container.style.top="0",this.container.style.left="0",this.container.style.width="100vw",this.container.style.height="100vh",this.container.style.right="auto",this.container.style.bottom="auto")}handleToolAction(e){const t=this.container.querySelector(".tools-content textarea").value.trim();switch(e){case"parse-curl":this.handleParseCurl(t);break;case"export-har":this.exportHAR();break;case"cors-test":this.handleCorsTest(t);break;case"decrypt-test":this.handleDecryptTest(t)}}handleParseCurl(e){if(e)try{const t=function(e){const t=e.split("\\\n").map(e=>e.trim()).join(" "),n=t.match(/c?curl\s+['"]?([^'"\s]+)['"]?/);let r=n?n[1]:"";const o={},i=t.matchAll(/-H\s+['"]([^:]+):\s*([^'"]*)['"]/g);for(const d of i)o[d[1]]=d[2];let s;const a=t.match(/(?:--data-raw|--data|-d)\s+['"]({.+?})['"]/s);if(a){const e=a[1];try{s=JSON.parse(e)}catch{s=e}}if(!a&&r.includes("?"))try{const e=new URL(r,"http://example.com"),t={};e.searchParams.forEach((e,n)=>{t[n]=e}),Object.keys(t).length>0&&(s=1===Object.keys(t).length&&t.data?t.data:t)}catch(l){}const c=t.match(/-X\s+(['"]?)([A-Z]+)\1/);return{url:r,method:c?c[2]:a?"POST":"GET",headers:o,data:s}}(e);this.logToConsole("✅ cURL 解析成功:"),this.logToConsole(t)}catch(t){this.logToConsole(`❌ cURL 解析失败: ${t instanceof Error?t.message:String(t)}`,"error")}else this.logToConsole("❌ 请输入 cURL 命令")}exportHAR(){const e={log:{version:"1.2",creator:{name:"NetworkDebugger",version:"1.0.0",comment:"Created by Leo (@leeguoo)"},entries:this.requestsCache.map(e=>({startedDateTime:new Date(e.timestamp).toISOString(),time:e.duration||0,request:{method:e.method,url:e.url,headers:Object.entries(e.headers).map(([e,t])=>({name:e,value:t})),postData:e.requestBody?{mimeType:"application/json",text:"string"==typeof e.requestBody?e.requestBody:JSON.stringify(e.requestBody)}:void 0},response:{status:e.status||0,statusText:e.statusText||"",headers:e.responseHeaders?Object.entries(e.responseHeaders).map(([e,t])=>({name:e,value:t})):[],content:{size:0,mimeType:"application/json",text:e.responseBody?"string"==typeof e.responseBody?e.responseBody:JSON.stringify(e.responseBody):""}}}))}},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`network-har-${Date.now()}.har`,r.click(),URL.revokeObjectURL(n),this.logToConsole("💾 HAR 文件已导出")}handleCorsTest(e){e?(this.logToConsole(`🔍 开始 CORS 测试: ${e}`),fetch(e,{mode:"cors"}).then(e=>{this.logToConsole(`✅ CORS 测试成功: ${e.status} ${e.statusText}`)}).catch(e=>{this.logToConsole(`❌ CORS 测试失败: ${e.message}`)})):this.logToConsole("❌ 请输入要测试的 URL")}handleDecryptTest(e){e?this.logToConsole("🔓 解密测试功能开发中..."):this.logToConsole("❌ 请输入要解密的数据")}executeConsoleCommand(e){if(e.trim()){this.consoleHistory.push(e),this.logToConsole(`> ${e}`);try{const t=new Function("return "+e)();this.logToConsole(t)}catch(t){try{const t=new Function(e)();this.logToConsole(void 0!==t?t:"undefined")}catch(n){this.logToConsole(`❌ ${t}`,"error")}}}}logToConsole(e,t="log"){if(!this.consoleContent)return;const n=(new Date).toLocaleTimeString(),r="object"==typeof e?JSON.stringify(e,null,2):e,o=document.createElement("div");o.innerHTML=`[${n}] ${r}`,"error"===t?o.style.color="#f44336":"warn"===t&&(o.style.color="#ff9800"),this.consoleContent.appendChild(o),this.consoleContent.scrollTop=this.consoleContent.scrollHeight}startDrag(e){this.isDragging=!0,this.dragStart={x:e.clientX,y:e.clientY},this.container.style.transition="none"}startResize(e,t){this.isResizing=!0,this.dragStart={x:e.clientX,y:e.clientY},this.container.style.transition="none"(this.container).dataset.resizeDirection=t}handleMouseMove(e){if(this.isDragging){const t=e.clientX-this.dragStart.x,n=e.clientY-this.dragStart.y,r=this.container.getBoundingClientRect();this.container.style.left=`${r.left+t}px`,this.container.style.top=`${r.top+n}px`,this.dragStart={x:e.clientX,y:e.clientY}}if(this.isResizing){const t=this.container.dataset.resizeDirection;if(!t)return;const n=e.clientX-this.dragStart.x,r=e.clientY-this.dragStart.y,o=this.container.getBoundingClientRect(),i=300,s=200;let a=o.width,c=o.height,l=o.left,d=o.top;t.includes("e")&&(a=Math.max(i,o.width+n),this.container.style.width=`${a}px`),t.includes("s")&&(c=Math.max(s,o.height+r),this.container.style.height=`${c}px`),t.includes("w")&&(a=Math.max(i,o.width-n),a>i&&(l=o.left+n,this.container.style.width=`${a}px`,this.container.style.left=`${l}px`)),t.includes("n")&&(c=Math.max(s,o.height-r),c>s&&(d=o.top+r,this.container.style.height=`${c}px`,this.container.style.top=`${d}px`)),this.dragStart={x:e.clientX,y:e.clientY}}}handleMouseUp(){(this.isDragging||this.isResizing)&&(this.container.style.transition="all 0.3s ease",this.isDragging&&this.savePosition()),this.isDragging=!1,this.isResizing=!1,delete this.container.dataset.resizeDirection}handleWindowResize(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.adjustPositionForWindowResize()},100)}adjustPositionForWindowResize(){const e=this.container.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight;let r=!1,o=e.left,i=e.top,s=e.width,a=e.height;e.right>t&&(o=t-e.width,r=!0),e.bottom>n&&(i=n-e.height,r=!0),o<0&&(o=0,r=!0),i<0&&(i=0,r=!0),e.width>t&&(s=t-20,o=10,r=!0),e.height>n&&(a=n-20,i=10,r=!0),r&&(this.container.style.left=`${o}px`,this.container.style.top=`${i}px`,this.container.style.right="auto",this.container.style.bottom="auto",(e.width>t||e.height>n)&&(this.container.style.width=`${s}px`,this.container.style.height=`${a}px`),this.savePosition())}show(){this.container.style.display="block",this.removeReopenButton()}hide(){this.container.style.display="none",this.createReopenButton()}createReopenButton(){if(document.getElementById("network-debugger-reopen-btn"))return;const e=document.createElement("button");e.id="network-debugger-reopen-btn",e.className="debugger-reopen-btn",e.title="打开调试面板 (可拖动)",e.textContent="PWTK";const t=this.config.position||"bottom-right";t.includes("bottom")?e.style.bottom="20px":e.style.top="20px",t.includes("right")?e.style.right="20px":e.style.left="20px";let n=!1,r={x:0,y:0},o=null;e.addEventListener("mousedown",t=>{0===t.button&&(n=!1,r={x:t.clientX,y:t.clientY},e.style.transition="none",o=window.setTimeout(()=>{n=!0,e.style.cursor="grabbing"},150),t.preventDefault())});document.addEventListener("mousemove",t=>{if(!n)return;const o=t.clientX-r.x,i=t.clientY-r.y,s=e.getBoundingClientRect(),a=s.left+o,c=s.top+i,l=window.innerWidth-s.width,d=window.innerHeight-s.height,h=Math.max(0,Math.min(l,a)),u=Math.max(0,Math.min(d,c));e.style.position="fixed",e.style.left=`${h}px`,e.style.top=`${u}px`,e.style.right="auto",e.style.bottom="auto",r={x:t.clientX,y:t.clientY}}),document.addEventListener("mouseup",()=>{o&&(clearTimeout(o),o=null),n?(n=!1,e.style.cursor="pointer",e.style.transition="all 0.3s ease"):this.show()}),e.style.cursor="pointer",document.body.appendChild(e)}removeReopenButton(){const e=document.getElementById("network-debugger-reopen-btn");e&&e.remove()}destroy(){this.container.remove();const e=document.getElementById("network-debugger-styles");e&&e.remove(),this.removeReopenButton()}loadConfig(){try{const t=localStorage.getItem(e.STORAGE_KEY);if(t){const e=JSON.parse(t);return Ie.debug("加载保存的配置:",e),e}}catch(t){Ie.error("加载配置失败:",t)}return{}}saveConfig(){try{const t={position:this.config.position,theme:this.config.theme,minimized:this.config.minimized,showConsole:this.config.showConsole};localStorage.setItem(e.STORAGE_KEY,JSON.stringify(t)),Ie.debug("配置已保存:",t)}catch(t){Ie.error("保存配置失败:",t)}}loadPosition(){try{const t=`${e.STORAGE_KEY}-position`,n=localStorage.getItem(t);if(n){const e=JSON.parse(n);void 0!==e.left&&(this.container.style.left=e.left+"px"),void 0!==e.top&&(this.container.style.top=e.top+"px"),void 0!==e.right&&(this.container.style.right=e.right+"px"),void 0!==e.bottom&&(this.container.style.bottom=e.bottom+"px"),Ie.debug("加载保存的位置:",e)}}catch(t){Ie.error("加载位置失败:",t)}}savePosition(){try{const t=`${e.STORAGE_KEY}-position`,n=this.container.getBoundingClientRect(),r={left:n.left,top:n.top,right:window.innerWidth-n.right,bottom:window.innerHeight-n.bottom};localStorage.setItem(t,JSON.stringify(r)),Ie.debug("位置已保存:",r)}catch(t){Ie.error("保存位置失败:",t)}}};Ve.STORAGE_KEY="pwtk-debugger-config";let Ze=Ve;class Qe{constructor(){this.interceptor=null,this.panel=null,this.wasmLoader=null,this.config={},this.initialized=!1}async init(e={}){if(this.initialized)Ie.warn("NetworkDebugger already initialized");else{this.config={autoStart:!0,position:"bottom-right",theme:"dark",minimized:!1,showConsole:!0,wasm:{enabled:!0,...e.wasm},decrypt:{enabled:!0,autoFetchKeys:!0,keyApiUrl:"https://gw-card-pay.buyacard.cc/ip/getSK",...e.decrypt},log:{toBrowserConsole:!1,level:"info",...e.log},...e},Ie.configure({enableBrowserConsole:this.config.log?.toBrowserConsole||!1,logLevel:this.config.log?.level||"info"});try{if(!1!==this.config.wasm?.enabled){Ie.info("[PWTK Init] Starting WASM initialization"),this.wasmLoader=new Je;await this.wasmLoader.loadWasm(this.config.wasm?.wasmUrl,this.config.wasm?.jsUrl)?Ie.info("[PWTK Init] ✅ WASM decrypt function ready"):Ie.warn("[PWTK Init] ⚠️ WASM load failed or decrypt function unavailable, will rely on page-provided decryption")}else Ie.info("[PWTK Init] WASM disabled in config");this.interceptor=new Xe,this.config.decrypt?.enabled&&this.interceptor.enableDecryption({keyExtractor:this.config.decrypt.keyExtractor||this.defaultKeyExtractor,slkExtractor:this.config.decrypt.slkExtractor||this.defaultSlkExtractor,autoFetchKeys:this.config.decrypt.autoFetchKeys,keyApiUrl:this.config.decrypt.keyApiUrl}),!1!==this.config.autoStart&&this.createPanel(),this.initialized=!0,Ie.consoleDirect("\n╔════════════════════════════════════════╗\n║ 🔓 PWTK 解密小工具 v1.2.34 ║\n║ Created by Leo (@leeguoo) ║\n║ 技术支持: 请联系 Leo ║ \n║ 分享服务: curl.bwg.leeguoo.com ║\n╚════════════════════════════════════════╝\n "),Ie.info("🔍 NetworkDebugger initialized successfully")}catch(t){throw Ie.error("NetworkDebugger initialization failed:",t),t}}}show(){this.initialized?this.panel?this.panel.show():this.createPanel():Ie.error("NetworkDebugger not initialized. Call init() first.")}hide(){this.panel&&this.panel.hide()}destroy(){this.panel&&(this.panel.destroy(),this.panel=null),this.initialized=!1,Ie.info("NetworkDebugger destroyed")}getRequests(){return this.interceptor?.getRequests()||[]}clearRequests(){this.interceptor?.clearRequests()}exportData(){return{timestamp:(new Date).toISOString(),requests:this.getRequests(),config:this.config,userAgent:navigator.userAgent,url:window.location.href,author:"Leo (@leeguoo)",tool:"@leeguoo/network-debugger"}}isWasmLoaded(){return this.wasmLoader?.isLoaded()||!1}isInitialized(){return this.initialized}static create(e){const t=new Qe;return t.init(e).then(()=>t)}createPanel(){this.interceptor?this.panel=new Ze(this.interceptor,{position:this.config.position,theme:this.config.theme,minimized:this.config.minimized,showConsole:this.config.showConsole}):Ie.error("Cannot create panel: interceptor not initialized")}defaultKeyExtractor(e){return e.keys||e.cid||e["x-api-key"]||""}defaultSlkExtractor(e){return e.slk||e["x-slk"]||""}}let et=null;const tt={init:async e=>et?(Ie.warn("NetworkDebugger already has a global instance"),et):(et=await Qe.create(e),"undefined"!=typeof window&&(window.NetworkDebugger=et),et),show(){et?.show()},hide(){et?.hide()},destroy(){et?.destroy(),et=null,"undefined"!=typeof window&&delete window.NetworkDebugger},getInstance:()=>et};exports.DebugPanel=Ze,exports.NetworkDebugger=Qe,exports.NetworkInterceptor=Xe,exports.WasmLoader=Je,exports.default=tt;
18
+ function(){var t=e,n=t.lib,r=n.WordArray,o=n.Hasher,i=t.algo,s=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=r.create([0,1518500249,1859775393,2400959708,2840853838]),h=r.create([1352829926,1548603684,1836072691,2053994217,0]),u=i.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,o=e[r];e[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,u,w,x,m,k,_,S,B,C,D,T=this._hash.words,R=d.words,A=h.words,z=s.words,E=a.words,P=c.words,W=l.words;for(k=i=T[0],_=u=T[1],S=w=T[2],B=x=T[3],C=m=T[4],n=0;n<80;n+=1)D=i+e[t+z[n]]|0,D+=n<16?p(u,w,x)+R[0]:n<32?g(u,w,x)+R[1]:n<48?f(u,w,x)+R[2]:n<64?y(u,w,x)+R[3]:b(u,w,x)+R[4],D=(D=v(D|=0,P[n]))+m|0,i=m,m=x,x=v(w,10),w=u,u=D,D=k+e[t+E[n]]|0,D+=n<16?b(_,S,B)+A[0]:n<32?y(_,S,B)+A[1]:n<48?f(_,S,B)+A[2]:n<64?g(_,S,B)+A[3]:p(_,S,B)+A[4],D=(D=v(D|=0,W[n]))+C|0,k=C,C=B,B=v(S,10),S=_,_=D;D=T[1]+w+B|0,T[1]=T[2]+x+C|0,T[2]=T[3]+m+k|0,T[3]=T[4]+i+_|0,T[4]=T[0]+u+S|0,T[0]=D},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,s=0;s<5;s++){var a=i[s];i[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,n){return e^t^n}function g(e,t,n){return e&t|~e&n}function f(e,t,n){return(e|~t)^n}function y(e,t,n){return e&n|t&~n}function b(e,t,n){return e^(t|~n)}function v(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(u),t.HmacRIPEMD160=o._createHmacHelper(u)}(),e.RIPEMD160));var e}(),I(),function(){return X?J.exports:(X=1,J.exports=(l=a(),z(),I(),t=(e=l).lib,n=t.Base,r=t.WordArray,o=e.algo,i=o.SHA256,s=o.HMAC,c=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=s.create(n.hasher,e),i=r.create(),a=r.create([1]),c=i.words,l=a.words,d=n.keySize,h=n.iterations;c.length<d;){var u=o.update(t).finalize(a);o.reset();for(var p=u.words,g=p.length,f=u,y=1;y<h;y++){f=o.finalize(f),o.reset();for(var b=f.words,v=0;v<g;v++)p[v]^=b[v]}i.concat(u),l[0]++}return i.sigBytes=4*d,i}}),e.PBKDF2=function(e,t,n){return c.create(n).compute(e,t)},l.PBKDF2));var e,t,n,r,o,i,s,c,l}(),V(),ee(),function(){return te?ne.exports:(te=1,ne.exports=(e=a(),ee(),e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var o,i=this._iv;i?(o=i.slice(0),this._iv=void 0):o=this._prevBlock,r.encryptBlock(o,0);for(var s=0;s<n;s++)e[t+s]^=o[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize;n.call(this,e,t,o,r),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=e.slice(t,t+o);n.call(this,e,t,o,r),this._prevBlock=i}}),t}(),e.mode.CFB));var e}(),function(){return re?oe.exports:(re=1,oe.exports=(n=a(),ee(),n.mode.CTR=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var s=i.slice(0);n.encryptBlock(s,0),i[r-1]=i[r-1]+1|0;for(var a=0;a<r;a++)e[t+a]^=s[a]}}),e.Decryptor=t,e),n.mode.CTR));var e,t,n}(),ae(),function(){return ce?le.exports:(ce=1,le.exports=(n=a(),ee(),n.mode.OFB=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),n.encryptBlock(i,0);for(var s=0;s<r;s++)e[t+s]^=i[s]}}),e.Decryptor=t,e),n.mode.OFB));var e,t,n}(),function(){return de?he.exports:(de=1,he.exports=(t=a(),ee(),t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e),t.mode.ECB));var e,t}(),function(){return ue?pe.exports:(ue=1,pe.exports=(e=a(),ee(),e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,o=r-n%r,i=n+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923));var e}(),function(){return ge?fe.exports:(ge=1,fe.exports=(e=a(),ee(),e.pad.Iso10126={pad:function(t,n){var r=4*n,o=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126));var e}(),function(){return ye?be.exports:(ye=1,be.exports=(e=a(),ee(),e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971));var e}(),function(){return ve?we.exports:(ve=1,we.exports=(e=a(),ee(),e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding));var e}(),function(){return xe?me.exports:(xe=1,me.exports=(e=a(),ee(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding));var e}(),function(){return ke?_e.exports:(ke=1,_e.exports=(r=a(),ee(),t=(e=r).lib.CipherParams,n=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var r=n.parse(e);return t.create({ciphertext:r})}},r.format.Hex));var e,t,n,r}(),function(){return Se?Be.exports:(Se=1,Be.exports=(e=a(),w(),B(),V(),ee(),function(){var t=e,n=t.lib.BlockCipher,r=t.algo,o=[],i=[],s=[],a=[],c=[],l=[],d=[],h=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var g=r^r<<1^r<<2^r<<3^r<<4;g=g>>>8^255&g^99,o[n]=g,i[g]=n;var f=e[n],y=e[f],b=e[y],v=257*e[g]^16843008*g;s[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,c[n]=v<<8|v>>>24,l[n]=v,v=16843009*b^65537*y^257*f^16843008*n,d[g]=v<<24|v>>>8,h[g]=v<<16|v>>>16,u[g]=v<<8|v>>>24,p[g]=v,n?(n=f^e[e[e[b^f]]],r^=e[e[r]]):n=r=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],f=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],s=0;s<r;s++)s<n?i[s]=t[s]:(l=i[s-1],s%n?n>6&&s%n==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=g[s/n|0]<<24),i[s]=i[s-n]^l);for(var a=this._invKeySchedule=[],c=0;c<r;c++){if(s=r-c,c%4)var l=i[s];else l=i[s-4];a[c]=c<4||s<=4?l:d[o[l>>>24]]^h[o[l>>>16&255]]^u[o[l>>>8&255]]^p[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,l,o)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,d,h,u,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,o,i,s,a){for(var c=this._nRounds,l=e[t]^n[0],d=e[t+1]^n[1],h=e[t+2]^n[2],u=e[t+3]^n[3],p=4,g=1;g<c;g++){var f=r[l>>>24]^o[d>>>16&255]^i[h>>>8&255]^s[255&u]^n[p++],y=r[d>>>24]^o[h>>>16&255]^i[u>>>8&255]^s[255&l]^n[p++],b=r[h>>>24]^o[u>>>16&255]^i[l>>>8&255]^s[255&d]^n[p++],v=r[u>>>24]^o[l>>>16&255]^i[d>>>8&255]^s[255&h]^n[p++];l=f,d=y,h=b,u=v}f=(a[l>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^n[p++],y=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^n[p++],b=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&d])^n[p++],v=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^n[p++],e[t]=f,e[t+1]=y,e[t+2]=b,e[t+3]=v},keySize:8});t.AES=n._createHelper(f)}(),e.AES));var e}(),Te(),function(){return Re?Ae.exports:(Re=1,Ae.exports=(e=a(),w(),B(),V(),ee(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=r.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,r=this._S=[],o=0;o<256;o++)r[o]=o;o=0;for(var i=0;o<256;o++){var s=o%n,a=t[s>>>2]>>>24-s%4*8&255;i=(i+r[o]+a)%256;var c=r[o];r[o]=r[i],r[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,n=this._j,r=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[n],e[n]=i,r|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,r}t.RC4=n._createHelper(o);var s=r.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=n._createHelper(s)}(),e.RC4));var e}(),function(){return ze?Ee.exports:(ze=1,Ee.exports=(e=a(),w(),B(),V(),ee(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)o[n]^=r[n+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(o[0]^=l,o[1]^=h,o[2]^=d,o[3]^=u,o[4]^=l,o[5]^=h,o[6]^=d,o[7]^=u,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.Rabbit=n._createHelper(a)}(),e.Rabbit));var e}(),function(){return Pe?We.exports:(Pe=1,We.exports=(e=a(),w(),B(),V(),ee(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)r[o]^=n[o+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(r[0]^=l,r[1]^=h,r[2]^=d,r[3]^=u,r[4]^=l,r[5]^=h,r[6]^=d,r[7]^=u,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.RabbitLegacy=n._createHelper(a)}(),e.RabbitLegacy));var e}(),Le())));const Ie=new class{constructor(){this.panel=null,this.enableBrowserConsole=!1,this.logLevel="debug",this.buffer=[],this.maxBufferSize=100,this.enableBrowserConsole=!1,this.logLevel="debug"}configure(e){void 0!==e.enableBrowserConsole&&(this.enableBrowserConsole=e.enableBrowserConsole),void 0!==e.logLevel&&(this.logLevel=e.logLevel)}setPanel(e){this.panel=e,this.flushBuffer()}flushBuffer(){this.panel&&(this.buffer.forEach(({message:e,type:t})=>{this.panel.logToConsole(e,t)}),this.buffer=[])}shouldLog(e){const t=["debug","info","warn","error"],n=t.indexOf(this.logLevel);return t.indexOf(e)>=n}formatMessage(e,t,n){const r=n.map(e=>{if("object"==typeof e)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}).join(" ");return r?`${t} ${r}`:t}output(e,t,n){this.panel?this.panel.logToConsole(e,t):(this.buffer.push({message:e,type:t,timestamp:new Date}),this.buffer.length>this.maxBufferSize&&this.buffer.shift()),this.enableBrowserConsole}debug(e,...t){if(!this.shouldLog("debug"))return;const n=this.formatMessage("[DEBUG]",e,t);this.output(n,"log","log")}log(e,...t){if(!this.shouldLog("info"))return;const n=this.formatMessage("",e,t);this.output(n,"log","log")}info(e,...t){if(!this.shouldLog("info"))return;const n=this.formatMessage("[INFO]",e,t);this.output(n,"log","log")}warn(e,...t){if(!this.shouldLog("warn"))return;const n=this.formatMessage("[WARN]",e,t);this.output(n,"warn","warn")}error(e,...t){if(!this.shouldLog("error"))return;const n=this.formatMessage("[ERROR]",e,t);this.output(n,"error","error")}consoleDirect(e,...t){}};class Xe{constructor(){this.requests=new Map,this.listeners=[],this.decryptConfig={enabled:!1},window.__originalFetch=window.fetch,this.interceptXHR(),this.interceptFetch()}enableDecryption(e){this.decryptConfig.enabled=!0,e?.keyExtractor&&(this.decryptConfig.keyExtractor=e.keyExtractor),e?.slkExtractor&&(this.decryptConfig.slkExtractor=e.slkExtractor),void 0!==e?.autoFetchKeys&&(this.decryptConfig.autoFetchKeys=e.autoFetchKeys),e?.keyApiUrl&&(this.decryptConfig.keyApiUrl=e.keyApiUrl)}addListener(e){this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}getRequests(){return Array.from(this.requests.values()).sort((e,t)=>t.timestamp-e.timestamp)}clearRequests(){this.requests.clear()}generateRequestId(){return Math.random().toString(36).substr(2,9)}isInternalUrl(e){return e.includes("/api/dokv/storage")||e.includes("/api/share")}notifyListeners(e){this.listeners.forEach(t=>{try{t(e)}catch(n){Ie.warn("NetworkDebugger: Listener error:",n)}})}extractUrlParams(e){try{const t=new URL(e),n={};return t.searchParams.forEach((e,t)=>{n[t]=e}),Object.keys(n).length>0?1===Object.keys(n).length&&n.data?n.data:n:null}catch(t){return null}}async tryDecrypt(e,t){if(Ie.debug("[PWTK Debug] tryDecrypt called:",{dataType:typeof e,dataLength:"string"==typeof e?e.length:JSON.stringify(e).length,dataPreview:"string"==typeof e?e.substring(0,100):JSON.stringify(e).substring(0,100),headers:Object.keys(t),decryptEnabled:this.decryptConfig.enabled,hasWindowDecrypt:"function"==typeof window.decrypt}),!this.decryptConfig.enabled||!e)return Ie.debug("[PWTK Debug] Decrypt disabled or no data"),null;try{let r="",o="";if(t.cid&&!1!==this.decryptConfig.autoFetchKeys){Ie.debug("[PWTK Debug] Trying to fetch key with cid:",t.cid);try{const e=this.decryptConfig.keyApiUrl||"https://gw-card-pay.buyacard.cc/ip/getSK",n={cid:t.cid,client:t.client||"S_WEB",device:t.device||"Web",language:t.language||"CN"};Ie.debug("[PWTK Debug] Fetching key from:",e,"with headers:",n);const o=window.__originalFetch||window.fetch,i=await o(e,{headers:n}),s=await i.json();if(Ie.debug("[PWTK Debug] getSK API response:",s),s.success&&s.data){const e=String(s.data);Ie.debug("[PWTK Debug] getSK returned num:",e,"length:",e.length),e.length>=9?(r=e.charAt(2)+e.charAt(5)+e.charAt(8),Ie.debug("[PWTK Debug] Extracted key from getSK:",r)):Ie.debug("[PWTK Debug] getSK num too short:",e)}else Ie.debug("[PWTK Debug] getSK failed:",s)}catch(n){Ie.warn("[PWTK Debug] getSK API error:",n)}}else Ie.debug("[PWTK Debug] No cid or autoFetchKeys disabled");!r&&this.decryptConfig.keyExtractor?(r=this.decryptConfig.keyExtractor(t),Ie.debug("[PWTK Debug] Key from custom extractor:",r)):r||(r=t.decryptKey||t.keys||t.cid||"",Ie.debug("[PWTK Debug] Key from headers:",r,"from:",t.decryptKey?"decryptKey":t.keys?"keys":t.cid?"cid":"none")),this.decryptConfig.slkExtractor?(o=this.decryptConfig.slkExtractor(t),Ie.debug("[PWTK Debug] SLK from custom extractor:",o)):(o=t.decryptSlk||t.slk||"",Ie.debug("[PWTK Debug] SLK from headers:",o,"from:",t.decryptSlk?"decryptSlk":t.slk?"slk":"none"));const i=r+o;if(Ie.debug("[PWTK Debug] Full decrypt key:",i?`"${i}" (length: ${i.length})`:"empty"),i){let t=e,r=!1;if("object"==typeof e&&null!==e&&e.data&&"string"==typeof e.data)Ie.debug('[PWTK Debug] Data is wrapped in {"data": "..."} format, extracting inner data'),t=e.data,r=!0;else if("string"==typeof e)try{const n=JSON.parse(e);n.data&&"string"==typeof n.data&&(Ie.debug("[PWTK Debug] Data is JSON string with data field, extracting"),t=n.data,r=!0)}catch{}const o="string"==typeof t?t:JSON.stringify(t);Ie.debug("[PWTK Debug] Calling decrypt with:",{dataLength:o.length,dataPreview:o.substring(0,50),key:i,isWrapped:r});const s=function(e,t){if(Ie.debug("[PWTK Decrypt] decrypt function called:",{dataLength:e?.length,dataPreview:e?.substring(0,50),keyStr:t,hasWindowDecrypt:"function"==typeof window.decrypt,hasWindowEncrypt:"function"==typeof window.encrypt}),!e||e.startsWith("{")||e.startsWith("[")){Ie.debug("[PWTK Decrypt] Data looks like JSON, parsing directly");try{const t=JSON.parse(e);return Ie.debug("[PWTK Decrypt] Successfully parsed as JSON"),t}catch{return Ie.debug("[PWTK Decrypt] Failed to parse as JSON, returning as string"),e}}if(window.decrypt&&t){Ie.debug("[PWTK Decrypt] Trying WebAssembly decrypt"),Ie.debug("[PWTK Decrypt] Input to window.decrypt:",{data:e.substring(0,100)+"...",key:t});try{const n=window.decrypt(e,t);if(Ie.debug("[PWTK Decrypt] window.decrypt returned:",{type:typeof n,length:n?.length,preview:n?n.substring(0,200)+(n.length>200?"...":""):null,sameAsInput:n===e,hasInvalidChars:n?.includes("�")}),n&&n!==e&&!n.includes("�"))try{const e=JSON.parse(n);return Ie.debug("[PWTK Decrypt] ✅ WebAssembly decryption successful, parsed as JSON:",e),e}catch{if(n.length>0)return Ie.debug("[PWTK Decrypt] ✅ WebAssembly decryption successful, returning as string"),n}else Ie.debug("[PWTK Decrypt] window.decrypt did not change the data or returned invalid result")}catch(n){Ie.debug("[PWTK Decrypt] WebAssembly decrypt error:",n)}}else Ie.debug("[PWTK Decrypt] WebAssembly not available:",{hasWindowDecrypt:!!window.decrypt,hasKey:!!t,windowDecryptType:typeof window.decrypt});const r=[t,"thisisakey123456","VITE_CRYPTO_KEY"].filter(Boolean);for(const o of r)if(o)try{const t=Ue.enc.Utf8.parse(o.padEnd(16,"0").slice(0,16)),n=Ue.enc.Utf8.parse(o.padEnd(16,"0").slice(0,16)),r=Ue.AES.decrypt(e,t,{iv:n,mode:Ue.mode.CBC,padding:Ue.pad.Pkcs7}).toString(Ue.enc.Utf8);if(r)try{return JSON.parse(r)}catch{return r}}catch(n){}try{const t=atob(e);try{return JSON.parse(t)}catch{return t}}catch{}return Ie.debug("[PWTK Decrypt] ❌ All decryption methods failed, returning original data"),e}(o,i);if(Ie.debug("[PWTK Debug] Decrypt result:",{success:s&&s!==o,decryptedType:typeof s,decryptedLength:s?"string"==typeof s?s.length:JSON.stringify(s).length:0,preview:s?"string"==typeof s?s.substring(0,100):JSON.stringify(s).substring(0,100):null}),s&&s!==o)return Ie.debug("[PWTK Debug] ✅ Decryption successful! Result:",s),s;Ie.debug("[PWTK Debug] ❌ Decryption failed or returned same data")}else Ie.debug("[PWTK Debug] No key available, skipping decryption")}catch(r){Ie.error("[PWTK Debug] tryDecrypt error:",r)}return Ie.debug("[PWTK Debug] tryDecrypt returning null"),null}interceptXHR(){const e=window.XMLHttpRequest,t=this;window.XMLHttpRequest=function(...n){const r=new e(...n),o=t.generateRequestId();let i="",s="",a={};const c=Date.now();let l=!1;const d=r.open;r.open=function(e,n,...r){return i=e.toUpperCase(),s=n,l=t.isInternalUrl(s),d.apply(this,[e,n,...r])};const h=r.setRequestHeader;r.setRequestHeader=function(e,t){return a[e]=t,h.call(this,e,t)};const u=r.send;return r.send=function(e){if(l)return u.call(this,e);const n={id:o,url:s,method:i,headers:{...a},requestBody:e,timestamp:c};let r=e;return"GET"!==i||e||(r=t.extractUrlParams(s),r&&(n.requestBody=r)),r&&t.tryDecrypt(r,a).then(e=>{null!==e&&(n.decryptedRequest=e,t.requests.set(o,n),Ie.debug("[PWTK Debug] Request decrypted, notifying UI"),t.notifyListeners(n))}).catch(e=>Ie.warn("解密请求失败:",e)),t.requests.set(o,n),t.notifyListeners(n),u.call(this,e)},r.addEventListener("readystatechange",function(){if(Ie.debug("[PWTK Debug] XHR state changed:",{readyState:r.readyState,readyStateName:["UNSENT","OPENED","HEADERS_RECEIVED","LOADING","DONE"][r.readyState],status:r.status,isInternal:l,requestId:o,url:s}),Ie.debug("[PWTK Debug] Checking response condition:",{readyState:r.readyState,isDone:4===r.readyState,XMLHttpRequestDONE:"undefined"!=typeof XMLHttpRequest?XMLHttpRequest.DONE:"undefined",isInternal:l,shouldProcess:4===r.readyState&&!l}),4===r.readyState&&!l){Ie.debug("[PWTK Debug] XHR completed, processing response");const e=Date.now(),n=t.requests.get(o);if(n){Ie.debug("[PWTK Debug] Found request data, updating with response"),n.status=r.status,n.statusText=r.statusText,n.duration=e-c;const i={},s=r.getAllResponseHeaders();s&&s.split("\r\n").forEach(e=>{const t=e.split(": ");2===t.length&&(i[t[0]]=t[1])}),n.responseHeaders=i;const l=null!==r.responseText&&void 0!==r.responseText&&""!==r.responseText;if(Ie.debug("[PWTK Debug] XHR Response received:",{status:n.status,hasResponseText:l,responseTextLength:r.responseText?.length,responseTextPreview:r.responseText?.substring(0,100)}),l)try{n.responseBody=JSON.parse(r.responseText),Ie.debug("[PWTK Debug] Response parsed as JSON:",n.responseBody)}catch{n.responseBody=r.responseText,Ie.debug("[PWTK Debug] Response kept as text")}else n.responseBody=null,Ie.debug("[PWTK Debug] No response body");Ie.debug("[PWTK Debug] Updating request with response data"),t.requests.set(o,n),t.notifyListeners(n),n.responseBody&&t.tryDecrypt(n.responseBody,{...a,...i}).then(e=>{null!==e&&(n.decryptedResponse=e,t.requests.set(o,n),Ie.debug("[PWTK Debug] Response decrypted, notifying UI:",e),t.notifyListeners(n))}).catch(e=>Ie.warn("解密响应失败:",e))}else Ie.debug("[PWTK Debug] WARNING: Request data not found for ID:",o)}}),r},window.XMLHttpRequest.prototype=e.prototype}interceptFetch(){const e=window.__originalFetch||window.fetch,t=this;window.fetch=async function(n,r){const o=t.generateRequestId(),i=Date.now(),s="string"==typeof n?n:n instanceof URL?n.toString():n.url,a=(r?.method||"GET").toUpperCase();if(t.isInternalUrl(s))return e.call(this,n,r);const c={};r?.headers&&(r.headers instanceof Headers?r.headers.forEach((e,t)=>{c[t]=e}):Array.isArray(r.headers)?r.headers.forEach(([e,t])=>{c[e]=t}):Object.entries(r.headers).forEach(([e,t])=>{c[e]=t}));let l=null;if(r?.body)if("string"==typeof r.body)try{l=JSON.parse(r.body)}catch{l=r.body}else l=r.body;const d={id:o,url:s,method:a,headers:{...c},requestBody:l,timestamp:i};let h=l;"GET"!==a||l||(h=t.extractUrlParams(s),h&&(d.requestBody=h)),h&&t.tryDecrypt(h,c).then(e=>{null!==e&&(d.decryptedRequest=e,t.requests.set(o,d),Ie.debug("[PWTK Debug] Fetch request decrypted, notifying UI"),t.notifyListeners(d))}).catch(e=>Ie.warn("解密请求失败:",e)),t.requests.set(o,d),t.notifyListeners(d);try{const s=await e.call(this,n,r),a=Date.now(),l=s.clone(),d=t.requests.get(o);if(d){d.status=s.status,d.statusText=s.statusText,d.duration=a-i;const e={};s.headers.forEach((t,n)=>{e[n]=t}),d.responseHeaders=e;try{const n=await l.text();Ie.debug("[PWTK Debug] Fetch Response received:",{status:d.status,textLength:n.length,textPreview:n.substring(0,100)});try{d.responseBody=JSON.parse(n)}catch{d.responseBody=n}t.requests.set(o,d),t.notifyListeners(d),d.responseBody&&t.tryDecrypt(d.responseBody,{...c,...e}).then(e=>{null!==e&&(d.decryptedResponse=e,t.requests.set(o,d),Ie.debug("[PWTK Debug] Fetch response decrypted, notifying UI:",e),t.notifyListeners(d))}).catch(e=>Ie.warn("解密响应失败:",e))}catch(u){d.error=`Failed to read response: ${u}`,t.requests.set(o,d),t.notifyListeners(d)}}return s}catch(u){const e=Date.now(),n=t.requests.get(o);throw n&&(n.error=u instanceof Error?u.message:String(u),n.duration=e-i,t.requests.set(o,n),t.notifyListeners(n)),u}}}}class Je{constructor(){this.loaded=!1,this.loading=!1}async loadWasm(e,t){if(Ie.debug("[PWTK WASM] loadWasm called"),Ie.debug("[PWTK WASM] Current state:",{hasWindowDecrypt:"function"==typeof window.decrypt,hasWindowEncrypt:"function"==typeof window.encrypt,hasWindowGo:void 0!==window.Go}),"function"==typeof window.decrypt)return Ie.debug("[PWTK WASM] window.decrypt already exists, skipping WASM load"),this.loaded=!0,!0;if(this.loaded)return!0;if(this.loading)return new Promise(e=>{const t=()=>{this.loaded||!this.loading?e(this.loaded):setTimeout(t,100)};t()});this.loading=!0;try{const i=[e,"/mimlib.wasm","/dist/mimlib.wasm","/assets/mimlib.wasm","https://gw-card-pay.buyacard.cc/mimlib.wasm"].filter(Boolean),s=[t,"/wasm_exec.js","/dist/wasm_exec.js","/assets/wasm_exec.js","https://gw-card-pay.buyacard.cc/wasm_exec.js"].filter(Boolean);let a=!1;for(const e of s)try{if(await this.loadScript(e),void 0!==window.Go){a=!0,Ie.debug("[PWTK WASM] wasm_exec.js loaded successfully from:",e);break}}catch(n){Ie.warn("NetworkDebugger: 尝试加载",e,"失败:",n);continue}if(!a)throw new Error("Unable to load wasm_exec.js from any path");if(void 0===window.Go)throw new Error("Go WebAssembly runtime not available");const c=new window.Go;let l=null;for(const e of i)try{if(!WebAssembly.instantiateStreaming){const t=await fetch(e).then(e=>e.arrayBuffer());l=await WebAssembly.instantiate(t,c.importObject),Ie.info("NetworkDebugger: WebAssembly 加载成功(传统方式):",e);break}try{l=await WebAssembly.instantiateStreaming(fetch(e),c.importObject),Ie.info("NetworkDebugger: WebAssembly 加载成功:",e);break}catch(r){Ie.warn("instantiateStreaming 失败,尝试传统方式:",r);const t=await fetch(e).then(e=>e.arrayBuffer());l=await WebAssembly.instantiate(t,c.importObject),Ie.info("NetworkDebugger: WebAssembly 加载成功(传统方式):",e);break}}catch(o){Ie.warn("NetworkDebugger: 尝试加载",e,"失败:",o);continue}if(!l)throw new Error("Unable to load WebAssembly from any path");return c.run(l.instance),await new Promise(e=>setTimeout(e,100)),Ie.debug("[PWTK WASM] After WASM load, checking functions:",{hasDecrypt:"function"==typeof window.decrypt,hasEncrypt:"function"==typeof window.encrypt,windowKeys:Object.keys(window).filter(e=>e.includes("crypt"))}),"function"==typeof window.decrypt?(this.loaded=!0,Ie.debug("[PWTK WASM] ✅ WebAssembly loaded successfully, decrypt function available"),!0):(Ie.warn("[PWTK WASM] ❌ WebAssembly loaded but decrypt function not available"),!1)}catch(o){return Ie.error("[PWTK WASM] WebAssembly loading failed:",o),!1}finally{this.loading=!1,Ie.debug("[PWTK WASM] Load complete, final state:",{loaded:this.loaded,hasDecrypt:"function"==typeof window.decrypt})}}loadScript(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return void t();const r=document.createElement("script");r.src=e,r.type="text/javascript",r.onload=()=>t(),r.onerror=t=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}isLoaded(){return this.loaded}isLoading(){return this.loading}isDecryptAvailable(){return this.loaded&&"function"==typeof window.decrypt}isEncryptAvailable(){return this.loaded&&"function"==typeof window.encrypt}}function Ge(e){return JSON.stringify(e,null,2)}async function Ye(e){try{const n=function(e){let t=`curl '${e.url}'`;"GET"!==e.method&&(t+=` -X ${e.method}`);e.headers&&Object.entries(e.headers).forEach(([e,n])=>{t+=` -H '${e}: ${n}'`});if(e.requestBody){const n="string"==typeof e.requestBody?e.requestBody:JSON.stringify(e.requestBody);t+=` --data '${n}'`}return t}(e),r={curl:n,response:e.responseBody||null,timestamp:Date.now(),slk:e.headers?.slk||"",debuggerData:{url:e.url,method:e.method,headers:e.headers,status:e.status,statusText:e.statusText,duration:e.duration,responseHeaders:e.responseHeaders,decryptedRequest:e.decryptedRequest,decryptedResponse:e.decryptedResponse,error:e.error,creator:"PWTK Network Debugger by Leo (@leeguoo)",version:"1.2.26"}},o=window.__originalFetch||window.fetch,i="https://curl.bwg.leeguoo.com/api/share";let s;Ie.debug("使用分享API:",i);try{s=await o(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:r})})}catch(t){if("TypeError"===t.name&&t.message.includes("fetch"))throw new Error(`网络连接失败: 无法连接到分享服务器 (${i}). 可能原因: CORS策略限制或网络问题`);throw t}if(!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);const a=await s.json();if(a.shareId){const e=`https://curl.bwg.leeguoo.com/share/${a.shareId}`;return Ie.info(`🔗 分享链接创建成功 (by Leo): ${e}`),e}throw new Error(a.error||"创建分享失败")}catch(n){const e=n.message||n.toString()||"未知错误";throw Ie.error("NetworkDebugger: 创建分享链接失败:",{message:e,name:n.name,stack:n.stack?.split("\n")[0]}),new Error(e)}}const Ve=class e{constructor(e,t={}){this.isDragging=!1,this.isResizing=!1,this.dragStart={x:0,y:0},this.resizeTimeout=null,this.resizeDirection="",this.currentTab="network",this.consoleHistory=[],this.requestsCache=[],this.interceptor=e;const n=this.loadConfig();this.config={position:"bottom-right",theme:"dark",minimized:!1,showConsole:!0,...n,...t},this.createPanel(),this.bindEvents(),this.startListening(),Ie.setPanel(this),this.loadPosition()}createPanel(){if(!document.getElementById("network-debugger-styles")){const e=document.createElement("style");e.id="network-debugger-styles",e.textContent="\n/* NetworkDebugger 样式 */\n#network-debugger-panel {\n position: fixed;\n z-index: 999999;\n background: #1a1a1a;\n color: #ffffff;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n border-radius: 8px;\n overflow: hidden;\n max-width: 90vw;\n max-height: 80vh;\n transition: all 0.3s ease;\n}\n\n#network-debugger-panel.minimized {\n height: 35px !important;\n overflow: hidden;\n width: 160px !important;\n max-width: 160px !important;\n}\n\n#network-debugger-panel.minimized .debugger-content {\n display: none;\n}\n\n#network-debugger-panel.minimized .resize-handle {\n display: none;\n}\n\n#network-debugger-panel.fullscreen .resize-handle {\n display: none;\n}\n\n#network-debugger-panel.bottom-right {\n bottom: 20px;\n right: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.bottom-left {\n bottom: 20px;\n left: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.top-right {\n top: 20px;\n right: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.top-left {\n top: 20px;\n left: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.fullscreen {\n top: 0;\n left: 0;\n width: 100vw !important;\n height: 100vh !important;\n border-radius: 0;\n}\n\n.debugger-header {\n background: #333;\n padding: 8px 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: move;\n user-select: none;\n border-bottom: 1px solid #444;\n}\n\n.debugger-title {\n font-weight: bold;\n color: #4CAF50;\n font-size: 14px;\n}\n\n.debugger-controls {\n display: flex;\n gap: 8px;\n}\n\n.debugger-btn {\n background: none;\n border: none;\n color: #fff;\n padding: 4px 8px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n transition: background-color 0.2s;\n}\n\n.debugger-btn:hover {\n background: #555;\n}\n\n.debugger-btn.active {\n background: #4CAF50;\n color: #000;\n}\n\n.debugger-icon {\n width: 16px;\n height: 16px;\n vertical-align: middle;\n}\n\n.debugger-content {\n height: calc(100% - 40px);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n\n.debugger-tabs {\n display: flex;\n background: #2a2a2a;\n border-bottom: 1px solid #444;\n}\n\n.debugger-tab {\n padding: 8px 16px;\n cursor: pointer;\n border: none;\n background: none;\n color: #ccc;\n font-size: 12px;\n transition: all 0.2s;\n border-bottom: 2px solid transparent;\n}\n\n.debugger-tab:hover {\n color: #fff;\n background: #3a3a3a;\n}\n\n.debugger-tab.active {\n color: #4CAF50;\n border-bottom-color: #4CAF50;\n background: #333;\n}\n\n.debugger-panel-content {\n flex: 1;\n overflow: auto;\n padding: 12px;\n}\n\n.request-list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.request-item {\n background: #2a2a2a;\n border: 1px solid #444;\n border-radius: 6px;\n padding: 10px;\n cursor: pointer;\n transition: all 0.2s;\n position: relative;\n}\n\n.request-item:hover {\n background: #333;\n border-color: #666;\n}\n\n.request-item.expanded {\n background: #333;\n border-color: #4CAF50;\n}\n\n.request-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 4px;\n}\n\n.request-method {\n padding: 2px 8px;\n border-radius: 4px;\n font-weight: bold;\n font-size: 10px;\n text-transform: uppercase;\n min-width: 40px;\n text-align: center;\n}\n\n.method-get { background: #4CAF50; color: #000; }\n.method-post { background: #2196F3; color: #fff; }\n.method-put { background: #FF9800; color: #000; }\n.method-delete { background: #F44336; color: #fff; }\n.method-patch { background: #9C27B0; color: #fff; }\n\n.request-url {\n flex: 1;\n margin: 0 8px;\n word-break: break-all;\n white-space: normal;\n color: #fff;\n font-size: 11px;\n line-height: 1.3;\n}\n\n.request-status {\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 10px;\n min-width: 35px;\n text-align: center;\n}\n\n.status-2xx { background: #4CAF50; color: #000; }\n.status-3xx { background: #FF9800; color: #000; }\n.status-4xx { background: #F44336; color: #fff; }\n.status-5xx { background: #9C27B0; color: #fff; }\n.status-error { background: #F44336; color: #fff; }\n\n.request-info {\n display: flex;\n justify-content: space-between;\n font-size: 10px;\n color: #999;\n}\n\n.request-details {\n margin-top: 12px;\n border-top: 1px solid #444;\n padding-top: 12px;\n display: none;\n}\n\n/* 默认折叠headers */\n.request-details .detail-section.collapsible {\n /* 默认折叠状态 */\n}\n\n.request-details .detail-section.collapsible:not(.expanded) .detail-content {\n display: none;\n}\n\n.request-details .detail-section.collapsible:not(.expanded) .collapse-icon {\n transform: rotate(-90deg);\n}\n\n.request-item.expanded .request-details {\n display: block;\n}\n\n.detail-section {\n margin-bottom: 16px;\n}\n\n.detail-title {\n font-weight: bold;\n color: #4CAF50;\n margin-bottom: 8px;\n font-size: 11px;\n text-transform: uppercase;\n border-bottom: 1px solid #444;\n padding-bottom: 4px;\n}\n\n.detail-title.highlight {\n color: #FFD700;\n font-size: 12px;\n background: rgba(255, 215, 0, 0.1);\n padding: 6px 8px;\n border-radius: 4px;\n border-bottom: 2px solid #FFD700;\n}\n\n.detail-title.clickable {\n cursor: pointer;\n user-select: none;\n display: flex;\n align-items: center;\n gap: 4px;\n}\n\n.detail-title.clickable:hover {\n background: rgba(76, 175, 80, 0.1);\n}\n\n.collapse-icon {\n display: inline-block;\n transition: transform 0.2s;\n font-size: 10px;\n}\n\n.detail-section.collapsible {\n position: relative;\n}\n\n.detail-section.collapsible.collapsed .detail-content {\n display: none;\n}\n\n.detail-section.collapsible.collapsed .collapse-icon {\n transform: rotate(-90deg);\n}\n\n.detail-content {\n background: #222;\n padding: 8px;\n border-radius: 4px;\n max-height: 200px;\n overflow: auto;\n}\n\n.json-content {\n white-space: pre-wrap;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 11px;\n line-height: 1.4;\n}\n\n.headers-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 10px;\n}\n\n.headers-table th,\n.headers-table td {\n padding: 4px 8px;\n text-align: left;\n border-bottom: 1px solid #444;\n}\n\n.headers-table th {\n background: #333;\n color: #4CAF50;\n font-weight: bold;\n}\n\n.headers-table td {\n color: #ccc;\n}\n\n.decrypted-badge {\n background: #4CAF50;\n color: #000;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 9px;\n margin-left: 8px;\n font-weight: bold;\n}\n\n.error-badge {\n background: #F44336;\n color: #fff;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 9px;\n margin-left: 8px;\n font-weight: bold;\n}\n\n.share-btn {\n background: #2196F3;\n color: #fff;\n border: none;\n padding: 4px 10px;\n border-radius: 3px;\n font-size: 11px;\n margin-left: 8px;\n cursor: pointer;\n transition: all 0.2s;\n white-space: nowrap;\n}\n\n.share-btn:hover {\n background: #1976D2;\n transform: scale(1.1);\n}\n\n.share-btn:active {\n transform: scale(0.95);\n}\n\n.console-content {\n background: #000;\n color: #0f0;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 11px;\n line-height: 1.4;\n height: 100%;\n overflow: auto;\n padding: 8px;\n}\n\n.console-input {\n display: flex;\n align-items: center;\n background: #333;\n padding: 8px;\n border-top: 1px solid #444;\n}\n\n.console-prompt {\n color: #4CAF50;\n margin-right: 8px;\n font-weight: bold;\n}\n\n.console-cmd {\n flex: 1;\n background: none;\n border: none;\n color: #fff;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n outline: none;\n}\n\n.tools-section {\n padding: 12px;\n background: #2a2a2a;\n border-bottom: 1px solid #444;\n}\n\n.tool-buttons {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.tool-btn {\n padding: 6px 12px;\n background: #4CAF50;\n color: #000;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 11px;\n font-weight: bold;\n transition: background-color 0.2s;\n}\n\n.tool-btn:hover {\n background: #45a049;\n}\n\n.tool-btn:disabled {\n background: #666;\n color: #999;\n cursor: not-allowed;\n}\n\n@media (max-width: 600px) {\n #network-debugger-panel.bottom-right,\n #network-debugger-panel.bottom-left,\n #network-debugger-panel.top-right,\n #network-debugger-panel.top-left {\n width: calc(100vw - 20px) !important;\n left: 10px !important;\n right: auto !important;\n }\n \n /* 最小化时不应用全宽,保持小尺寸 */\n #network-debugger-panel.minimized {\n width: 160px !important;\n max-width: 160px !important;\n height: 35px !important;\n }\n}\n\n::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n}\n\n::-webkit-scrollbar-track {\n background: #333;\n}\n\n::-webkit-scrollbar-thumb {\n background: #666;\n border-radius: 3px;\n}\n\n::-webkit-scrollbar-thumb:hover {\n background: #888;\n}\n\n.resize-handle {\n position: absolute;\n background: transparent;\n}\n\n.resize-handle.n {\n top: -3px;\n left: 0;\n right: 0;\n height: 6px;\n cursor: ns-resize;\n}\n\n.resize-handle.s {\n bottom: -3px;\n left: 0;\n right: 0;\n height: 6px;\n cursor: ns-resize;\n}\n\n.resize-handle.e {\n top: 0;\n right: -3px;\n bottom: 0;\n width: 6px;\n cursor: ew-resize;\n}\n\n.resize-handle.w {\n top: 0;\n left: -3px;\n bottom: 0;\n width: 6px;\n cursor: ew-resize;\n}\n\n.resize-handle.ne {\n top: -3px;\n right: -3px;\n width: 12px;\n height: 12px;\n cursor: ne-resize;\n}\n\n.resize-handle.nw {\n top: -3px;\n left: -3px;\n width: 12px;\n height: 12px;\n cursor: nw-resize;\n}\n\n.resize-handle.se {\n bottom: -3px;\n right: -3px;\n width: 12px;\n height: 12px;\n cursor: se-resize;\n}\n\n.resize-handle.sw {\n bottom: -3px;\n left: -3px;\n width: 12px;\n height: 12px;\n cursor: sw-resize;\n}\n\n.debugger-reopen-btn {\n position: fixed;\n z-index: 999999;\n background: #4CAF50;\n color: #000;\n border: none;\n padding: 8px 10px;\n border-radius: 16px;\n font-weight: bold;\n font-size: 12px;\n box-shadow: 0 4px 12px rgba(0,0,0,0.25);\n cursor: pointer;\n}\n\n.debugger-reopen-btn:hover {\n filter: brightness(0.95);\n}\n",document.head.appendChild(e)}this.container=document.createElement("div"),this.container.id="network-debugger-panel",this.container.className=`${this.config.position} ${this.config.minimized?"minimized":""}`,this.container.innerHTML=`\n <div class="debugger-header">\n <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo</span></div>\n <div class="debugger-controls">\n <button class="debugger-btn" data-action="clear" title="清空"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg></button>\n <button class="debugger-btn" data-action="export" title="导出"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg></button>\n <button class="debugger-btn" data-action="fullscreen" title="全屏"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg></button>\n <button class="debugger-btn" data-action="close" title="关闭"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg></button>\n </div>\n </div>\n <div class="debugger-content">\n <div class="debugger-tabs">\n <button class="debugger-tab active" data-tab="network">网络</button>\n ${this.config.showConsole?'<button class="debugger-tab" data-tab="console">控制台</button>':""}\n <button class="debugger-tab" data-tab="tools">工具</button>\n <button class="debugger-tab" data-tab="about">关于</button>\n </div>\n <div class="debugger-panel-content">\n <div class="network-panel" data-panel="network">\n <div class="request-list"></div>\n </div>\n ${this.config.showConsole?'\n <div class="console-panel" data-panel="console" style="display: none;">\n <div class="console-content"></div>\n <div class="console-input">\n <span class="console-prompt">></span>\n <input class="console-cmd" placeholder="输入 JavaScript 代码..." />\n </div>\n </div>\n ':""}\n <div class="tools-panel" data-panel="tools" style="display: none;">\n <div class="tools-section">\n <div class="tool-buttons">\n <button class="tool-btn" data-tool="parse-curl">解析 cURL</button>\n <button class="tool-btn" data-tool="export-har">导出 HAR</button>\n <button class="tool-btn" data-tool="cors-test">CORS 测试</button>\n <button class="tool-btn" data-tool="decrypt-test">解密测试</button>\n </div>\n </div>\n <div class="tools-content">\n <textarea placeholder="在这里粘贴 cURL 命令或输入要测试的数据..." style="width: 100%; height: 200px; background: #222; color: #fff; border: 1px solid #444; padding: 8px; font-family: monospace;"></textarea>\n </div>\n </div>\n <div class="about-panel" data-panel="about" style="display: none;">\n <div style="padding: 20px; color: #fff; text-align: center;">\n <h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>\n <p style="margin: 10px 0;">Version: 1.2.35</p>\n <p style="margin: 10px 0;">👨‍💻 Created by <strong>Leo (@leeguoo)</strong></p>\n <p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>\n <p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>\n <div style="margin-top: 20px; padding: 15px; background: #333; border-radius: 8px;">\n <p style="margin: 5px 0; font-size: 12px;">本工具专为 PWTK 项目开发</p>\n <p style="margin: 5px 0; font-size: 12px;">提供网络请求拦截、解密、分享等功能</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n `,this.addResizeHandles(),document.body.appendChild(this.container),this.networkTab=this.container.querySelector('[data-panel="network"]'),this.consoleTab=this.container.querySelector('[data-panel="console"]'),this.consoleContent=this.container.querySelector(".console-content")}addResizeHandles(){["n","s","e","w","ne","nw","se","sw"].forEach(e=>{const t=document.createElement("div");t.className=`resize-handle ${e}`,t.dataset.direction=e,this.container.appendChild(t)})}bindEvents(){const e=this.container.querySelector(".debugger-header"),t=this.container.querySelector(".debugger-controls"),n=this.container.querySelectorAll(".debugger-tab"),r=this.container.querySelectorAll("[data-tool]"),o=this.container.querySelector(".console-cmd");e.addEventListener("mousedown",e=>{e.target===t||t.contains(e.target)||this.startDrag(e)}),t.addEventListener("click",e=>{e.stopPropagation();let n=e.target;for(;n&&n!==t&&!n.dataset?.action;)n=n.parentElement;const r=n?.dataset?.action;if(r)switch(r){case"clear":this.clearRequests();break;case"export":this.exportData();break;case"fullscreen":this.toggleFullscreen();break;case"close":this.hide()}}),n.forEach(e=>{e.addEventListener("click",e=>{const t=e.target.dataset.tab;this.switchTab(t)})}),r.forEach(e=>{e.addEventListener("click",e=>{const t=e.target.dataset.tool;this.handleToolAction(t)})}),o&&o.addEventListener("keypress",e=>{"Enter"===e.key&&(this.executeConsoleCommand(o.value),o.value="")});this.container.querySelectorAll(".resize-handle").forEach(e=>{e.addEventListener("mousedown",t=>{t.stopPropagation();const n=e.dataset.direction||e.classList[1]||"se";this.startResize(t,n)})}),document.addEventListener("mousemove",this.handleMouseMove.bind(this)),document.addEventListener("mouseup",this.handleMouseUp.bind(this)),window.addEventListener("resize",this.handleWindowResize.bind(this))}startListening(){this.interceptor.addListener(e=>{this.addRequestToUI(e)}),this.requestsCache=this.interceptor.getRequests(),this.renderRequests()}addRequestToUI(e){Ie.debug("[PWTK UI] Adding/updating request:",{id:e.id,url:e.url,hasResponse:!!e.responseBody,hasDecryptedRequest:!!e.decryptedRequest,hasDecryptedResponse:!!e.decryptedResponse,status:e.status});const t=this.requestsCache.findIndex(t=>t.id===e.id);t>=0?this.requestsCache[t]=e:this.requestsCache.unshift(e),this.requestsCache.length>100&&(this.requestsCache=this.requestsCache.slice(0,100)),this.renderRequests()}renderRequests(){const e=this.container.querySelector(".request-list");e&&(e.innerHTML="",this.requestsCache.forEach(t=>{const n=this.createRequestItem(t);e.appendChild(n)}))}createRequestItem(e){const t=document.createElement("div");t.className="request-item",t.dataset.requestId=e.id;const n=this.getStatusClass(e.status),r=`method-${e.method.toLowerCase()}`;e.decryptedRequest||e.decryptedResponse;const o=e.error;t.innerHTML=`\n <div class="request-header">\n <span class="request-method ${r}">${e.method}</span>\n <span class="request-url" title="${e.url}">${this.truncateUrl(e.url)}</span>\n <span class="request-status ${n}">${e.status?e.status:void 0!==e.duration?"ERR":"Pending"}</span>\n ${o?'<span class="error-badge">⚠️</span>':""}\n <button class="share-btn" title="分享此请求 (by Leo)" onclick="event.stopPropagation()">分享链接</button>\n </div>\n <div class="request-info">\n <span>${new Date(e.timestamp).toLocaleTimeString()}</span>\n <span>${e.duration?`${e.duration}ms`:"Pending"}</span>\n </div>\n <div class="request-details">\n ${this.renderRequestDetails(e)}\n </div>\n `,t.addEventListener("click",e=>{const n=e.target;n.closest(".share-btn")||n.closest('.detail-title[data-toggle="collapse"]')||t.classList.toggle("expanded")});const i=t.querySelector(".share-btn");return i&&i.addEventListener("click",async t=>{t.stopPropagation(),await this.shareRequest(e)}),t.addEventListener("click",e=>{const t=e.target;if(t.closest('.detail-title[data-toggle="collapse"]')){e.stopPropagation();const n=t.closest(".detail-title").parentElement;n&&n.classList.contains("collapsible")&&n.classList.toggle("collapsed")}},{capture:!0}),t}renderRequestDetails(e){let t="";return e.id.replace(/[^a-zA-Z0-9]/g,""),e.decryptedRequest&&(t+=`\n <div class="detail-section">\n <div class="detail-title highlight">解密请求数据</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.decryptedRequest)}</div>\n </div>\n </div>\n `),e.decryptedResponse&&(t+=`\n <div class="detail-section">\n <div class="detail-title highlight">解密响应数据</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.decryptedResponse)}</div>\n </div>\n </div>\n `),Object.keys(e.headers).length>0&&(t+=`\n <div class="detail-section collapsible collapsed">\n <div class="detail-title clickable" data-toggle="collapse">\n <span class="collapse-icon">▼</span> 请求头 (${Object.keys(e.headers).length})\n </div>\n <div class="detail-content">\n <table class="headers-table">\n ${Object.entries(e.headers).map(([e,t])=>`<tr><td>${e}</td><td>${t}</td></tr>`).join("")}\n </table>\n </div>\n </div>\n `),e.responseHeaders&&Object.keys(e.responseHeaders).length>0&&(t+=`\n <div class="detail-section collapsible collapsed">\n <div class="detail-title clickable" data-toggle="collapse">\n <span class="collapse-icon">▼</span> 响应头 (${Object.keys(e.responseHeaders).length})\n </div>\n <div class="detail-content">\n <table class="headers-table">\n ${Object.entries(e.responseHeaders).map(([e,t])=>`<tr><td>${e}</td><td>${t}</td></tr>`).join("")}\n </table>\n </div>\n </div>\n `),e.requestBody&&(t+=`\n <div class="detail-section">\n <div class="detail-title">${e.decryptedRequest?"原始请求数据":"请求数据"}</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.requestBody)}</div>\n </div>\n </div>\n `),e.responseBody&&(t+=`\n <div class="detail-section">\n <div class="detail-title">${e.decryptedResponse?"原始响应数据":"响应数据"}</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.responseBody)}</div>\n </div>\n </div>\n `),e.error&&(t+=`\n <div class="detail-section">\n <div class="detail-title">错误信息</div>\n <div class="detail-content">\n <div class="json-content" style="color: #f44336;">${e.error}</div>\n </div>\n </div>\n `),t}formatData(e){if("string"==typeof e)try{return Ge(JSON.parse(e))}catch{return e}return Ge(e)}getStatusClass(e){return e?e>=200&&e<300?"status-2xx":e>=300&&e<400?"status-3xx":e>=400&&e<500?"status-4xx":e>=500?"status-5xx":"status-error":"status-error"}truncateUrl(e){const t=e.indexOf("?");return t>-1?e.substring(0,t):e}switchTab(e){this.container.querySelectorAll(".debugger-tab").forEach(t=>{t.classList.toggle("active",t.dataset.tab===e)}),this.container.querySelectorAll("[data-panel]").forEach(t=>{t.style.display=t.getAttribute("data-panel")===e?"block":"none"}),this.currentTab=e}clearRequests(){this.requestsCache=[],this.interceptor.clearRequests(),this.renderRequests(),this.logToConsole("✅ 已清空网络请求记录")}exportData(){const e={timestamp:(new Date).toISOString(),requests:this.requestsCache,userAgent:navigator.userAgent,url:window.location.href,creator:"PWTK Network Debugger by Leo (@leeguoo)"},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`network-debug-${Date.now()}.json`,r.click(),URL.revokeObjectURL(n),this.logToConsole("💾 网络数据已导出 (by Leo)")}async shareRequest(e){try{this.logToConsole("📤 正在创建分享链接...");const t=await Ye(e);if(!t)throw new Error("无法创建分享链接");await async function(e){try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(e),!0;{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}}catch(t){return Ie.error("复制到剪贴板失败:",t),!1}}(t)?(this.logToConsole(`✅ 分享链接已复制到剪贴板: ${t}`),alert(`分享链接已复制到剪贴板!\n${t}\n\nCreated by Leo (@leeguoo)`)):(this.logToConsole(`✅ 分享链接: ${t}`),prompt("分享链接已创建,请手动复制:\n\nCreated by Leo (@leeguoo)",t))}catch(t){Ie.error("分享失败:",t),this.logToConsole(`❌ 分享失败: ${t}`),alert("分享失败,请稍后重试")}}toggleFullscreen(){this.container.classList.contains("fullscreen")?(this.container.classList.remove("fullscreen"),this.container.style.top="",this.container.style.left="",this.container.style.width="",this.container.style.height="",this.loadPosition()):(this.container.classList.add("fullscreen"),this.container.style.top="0",this.container.style.left="0",this.container.style.width="100vw",this.container.style.height="100vh",this.container.style.right="auto",this.container.style.bottom="auto")}handleToolAction(e){const t=this.container.querySelector(".tools-content textarea").value.trim();switch(e){case"parse-curl":this.handleParseCurl(t);break;case"export-har":this.exportHAR();break;case"cors-test":this.handleCorsTest(t);break;case"decrypt-test":this.handleDecryptTest(t)}}handleParseCurl(e){if(e)try{const t=function(e){const t=e.split("\\\n").map(e=>e.trim()).join(" "),n=t.match(/c?curl\s+['"]?([^'"\s]+)['"]?/);let r=n?n[1]:"";const o={},i=t.matchAll(/-H\s+['"]([^:]+):\s*([^'"]*)['"]/g);for(const d of i)o[d[1]]=d[2];let s;const a=t.match(/(?:--data-raw|--data|-d)\s+['"]({.+?})['"]/s);if(a){const e=a[1];try{s=JSON.parse(e)}catch{s=e}}if(!a&&r.includes("?"))try{const e=new URL(r,"http://example.com"),t={};e.searchParams.forEach((e,n)=>{t[n]=e}),Object.keys(t).length>0&&(s=1===Object.keys(t).length&&t.data?t.data:t)}catch(l){}const c=t.match(/-X\s+(['"]?)([A-Z]+)\1/);return{url:r,method:c?c[2]:a?"POST":"GET",headers:o,data:s}}(e);this.logToConsole("✅ cURL 解析成功:"),this.logToConsole(t)}catch(t){this.logToConsole(`❌ cURL 解析失败: ${t instanceof Error?t.message:String(t)}`,"error")}else this.logToConsole("❌ 请输入 cURL 命令")}exportHAR(){const e={log:{version:"1.2",creator:{name:"NetworkDebugger",version:"1.0.0",comment:"Created by Leo (@leeguoo)"},entries:this.requestsCache.map(e=>({startedDateTime:new Date(e.timestamp).toISOString(),time:e.duration||0,request:{method:e.method,url:e.url,headers:Object.entries(e.headers).map(([e,t])=>({name:e,value:t})),postData:e.requestBody?{mimeType:"application/json",text:"string"==typeof e.requestBody?e.requestBody:JSON.stringify(e.requestBody)}:void 0},response:{status:e.status||0,statusText:e.statusText||"",headers:e.responseHeaders?Object.entries(e.responseHeaders).map(([e,t])=>({name:e,value:t})):[],content:{size:0,mimeType:"application/json",text:e.responseBody?"string"==typeof e.responseBody?e.responseBody:JSON.stringify(e.responseBody):""}}}))}},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`network-har-${Date.now()}.har`,r.click(),URL.revokeObjectURL(n),this.logToConsole("💾 HAR 文件已导出")}handleCorsTest(e){e?(this.logToConsole(`🔍 开始 CORS 测试: ${e}`),fetch(e,{mode:"cors"}).then(e=>{this.logToConsole(`✅ CORS 测试成功: ${e.status} ${e.statusText}`)}).catch(e=>{this.logToConsole(`❌ CORS 测试失败: ${e.message}`)})):this.logToConsole("❌ 请输入要测试的 URL")}handleDecryptTest(e){e?this.logToConsole("🔓 解密测试功能开发中..."):this.logToConsole("❌ 请输入要解密的数据")}executeConsoleCommand(e){if(e.trim()){this.consoleHistory.push(e),this.logToConsole(`> ${e}`);try{const t=new Function("return "+e)();this.logToConsole(t)}catch(t){try{const t=new Function(e)();this.logToConsole(void 0!==t?t:"undefined")}catch(n){this.logToConsole(`❌ ${t}`,"error")}}}}logToConsole(e,t="log"){if(!this.consoleContent)return;const n=(new Date).toLocaleTimeString(),r="object"==typeof e?JSON.stringify(e,null,2):e,o=document.createElement("div");o.innerHTML=`[${n}] ${r}`,"error"===t?o.style.color="#f44336":"warn"===t&&(o.style.color="#ff9800"),this.consoleContent.appendChild(o),this.consoleContent.scrollTop=this.consoleContent.scrollHeight}startDrag(e){this.isDragging=!0,this.dragStart={x:e.clientX,y:e.clientY},this.container.style.transition="none"}startResize(e,t){this.isResizing=!0,this.resizeDirection=t,this.dragStart={x:e.clientX,y:e.clientY},this.container.style.transition="none"}handleMouseMove(e){if(this.isDragging){const t=e.clientX-this.dragStart.x,n=e.clientY-this.dragStart.y,r=this.container.getBoundingClientRect();this.container.style.left=`${r.left+t}px`,this.container.style.top=`${r.top+n}px`,this.dragStart={x:e.clientX,y:e.clientY}}if(this.isResizing){const t=this.resizeDirection;if(!t)return;const n=e.clientX-this.dragStart.x,r=e.clientY-this.dragStart.y,o=this.container.getBoundingClientRect(),i=300,s=200;let a=o.width,c=o.height,l=o.left,d=o.top;t.includes("e")&&(a=Math.max(i,o.width+n),this.container.style.width=`${a}px`),t.includes("s")&&(c=Math.max(s,o.height+r),this.container.style.height=`${c}px`),t.includes("w")&&(a=Math.max(i,o.width-n),a>i&&(l=o.left+n,this.container.style.width=`${a}px`,this.container.style.left=`${l}px`)),t.includes("n")&&(c=Math.max(s,o.height-r),c>s&&(d=o.top+r,this.container.style.height=`${c}px`,this.container.style.top=`${d}px`)),this.dragStart={x:e.clientX,y:e.clientY}}}handleMouseUp(){(this.isDragging||this.isResizing)&&(this.container.style.transition="all 0.3s ease",this.isDragging&&this.savePosition()),this.isDragging=!1,this.isResizing=!1,this.resizeDirection=""}handleWindowResize(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.adjustPositionForWindowResize()},100)}adjustPositionForWindowResize(){const e=this.container.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight;let r=!1,o=e.left,i=e.top,s=e.width,a=e.height;e.right>t&&(o=t-e.width,r=!0),e.bottom>n&&(i=n-e.height,r=!0),o<0&&(o=0,r=!0),i<0&&(i=0,r=!0),e.width>t&&(s=t-20,o=10,r=!0),e.height>n&&(a=n-20,i=10,r=!0),r&&(this.container.style.left=`${o}px`,this.container.style.top=`${i}px`,this.container.style.right="auto",this.container.style.bottom="auto",(e.width>t||e.height>n)&&(this.container.style.width=`${s}px`,this.container.style.height=`${a}px`),this.savePosition())}show(){this.container.style.display="block",this.removeReopenButton()}hide(){this.container.style.display="none",this.createReopenButton()}createReopenButton(){if(document.getElementById("network-debugger-reopen-btn"))return;const e=document.createElement("button");e.id="network-debugger-reopen-btn",e.className="debugger-reopen-btn",e.title="打开调试面板 (可拖动)",e.textContent="PWTK";const t=this.config.position||"bottom-right";t.includes("bottom")?e.style.bottom="20px":e.style.top="20px",t.includes("right")?e.style.right="20px":e.style.left="20px";let n=!1,r={x:0,y:0},o=null;e.addEventListener("mousedown",t=>{0===t.button&&(n=!1,r={x:t.clientX,y:t.clientY},e.style.transition="none",o=window.setTimeout(()=>{n=!0,e.style.cursor="grabbing"},150),t.preventDefault())});document.addEventListener("mousemove",t=>{if(!n)return;const o=t.clientX-r.x,i=t.clientY-r.y,s=e.getBoundingClientRect(),a=s.left+o,c=s.top+i,l=window.innerWidth-s.width,d=window.innerHeight-s.height,h=Math.max(0,Math.min(l,a)),u=Math.max(0,Math.min(d,c));e.style.position="fixed",e.style.left=`${h}px`,e.style.top=`${u}px`,e.style.right="auto",e.style.bottom="auto",r={x:t.clientX,y:t.clientY}}),document.addEventListener("mouseup",()=>{o&&(clearTimeout(o),o=null),n?(n=!1,e.style.cursor="pointer",e.style.transition="all 0.3s ease"):this.show()}),e.style.cursor="pointer",document.body.appendChild(e)}removeReopenButton(){const e=document.getElementById("network-debugger-reopen-btn");e&&e.remove()}destroy(){this.container.remove();const e=document.getElementById("network-debugger-styles");e&&e.remove(),this.removeReopenButton()}loadConfig(){try{const t=localStorage.getItem(e.STORAGE_KEY);if(t){const e=JSON.parse(t);return Ie.debug("加载保存的配置:",e),e}}catch(t){Ie.error("加载配置失败:",t)}return{}}saveConfig(){try{const t={position:this.config.position,theme:this.config.theme,minimized:this.config.minimized,showConsole:this.config.showConsole};localStorage.setItem(e.STORAGE_KEY,JSON.stringify(t)),Ie.debug("配置已保存:",t)}catch(t){Ie.error("保存配置失败:",t)}}loadPosition(){try{const t=`${e.STORAGE_KEY}-position`,n=localStorage.getItem(t);if(n){const e=JSON.parse(n);void 0!==e.left&&(this.container.style.left=e.left+"px"),void 0!==e.top&&(this.container.style.top=e.top+"px"),void 0!==e.right&&(this.container.style.right=e.right+"px"),void 0!==e.bottom&&(this.container.style.bottom=e.bottom+"px"),Ie.debug("加载保存的位置:",e)}}catch(t){Ie.error("加载位置失败:",t)}}savePosition(){try{const t=`${e.STORAGE_KEY}-position`,n=this.container.getBoundingClientRect(),r={left:n.left,top:n.top,right:window.innerWidth-n.right,bottom:window.innerHeight-n.bottom};localStorage.setItem(t,JSON.stringify(r)),Ie.debug("位置已保存:",r)}catch(t){Ie.error("保存位置失败:",t)}}};Ve.STORAGE_KEY="pwtk-debugger-config";let Ze=Ve;class Qe{constructor(){this.interceptor=null,this.panel=null,this.wasmLoader=null,this.config={},this.initialized=!1}async init(e={}){if(this.initialized)Ie.warn("NetworkDebugger already initialized");else{this.config={autoStart:!0,position:"bottom-right",theme:"dark",minimized:!1,showConsole:!0,wasm:{enabled:!0,...e.wasm},decrypt:{enabled:!0,autoFetchKeys:!0,keyApiUrl:"https://gw-card-pay.buyacard.cc/ip/getSK",...e.decrypt},log:{toBrowserConsole:!1,level:"info",...e.log},...e},Ie.configure({enableBrowserConsole:this.config.log?.toBrowserConsole||!1,logLevel:this.config.log?.level||"info"});try{if(!1!==this.config.wasm?.enabled){Ie.info("[PWTK Init] Starting WASM initialization"),this.wasmLoader=new Je;await this.wasmLoader.loadWasm(this.config.wasm?.wasmUrl,this.config.wasm?.jsUrl)?Ie.info("[PWTK Init] ✅ WASM decrypt function ready"):Ie.warn("[PWTK Init] ⚠️ WASM load failed or decrypt function unavailable, will rely on page-provided decryption")}else Ie.info("[PWTK Init] WASM disabled in config");this.interceptor=new Xe,this.config.decrypt?.enabled&&this.interceptor.enableDecryption({keyExtractor:this.config.decrypt.keyExtractor||this.defaultKeyExtractor,slkExtractor:this.config.decrypt.slkExtractor||this.defaultSlkExtractor,autoFetchKeys:this.config.decrypt.autoFetchKeys,keyApiUrl:this.config.decrypt.keyApiUrl}),!1!==this.config.autoStart&&this.createPanel(),this.initialized=!0,Ie.consoleDirect("\n╔════════════════════════════════════════╗\n║ 🔓 PWTK 解密小工具 v1.2.35 ║\n║ Created by Leo (@leeguoo) ║\n║ 技术支持: 请联系 Leo ║ \n║ 分享服务: curl.bwg.leeguoo.com ║\n╚════════════════════════════════════════╝\n "),Ie.info("🔍 NetworkDebugger initialized successfully")}catch(t){throw Ie.error("NetworkDebugger initialization failed:",t),t}}}show(){this.initialized?this.panel?this.panel.show():this.createPanel():Ie.error("NetworkDebugger not initialized. Call init() first.")}hide(){this.panel&&this.panel.hide()}destroy(){this.panel&&(this.panel.destroy(),this.panel=null),this.initialized=!1,Ie.info("NetworkDebugger destroyed")}getRequests(){return this.interceptor?.getRequests()||[]}clearRequests(){this.interceptor?.clearRequests()}exportData(){return{timestamp:(new Date).toISOString(),requests:this.getRequests(),config:this.config,userAgent:navigator.userAgent,url:window.location.href,author:"Leo (@leeguoo)",tool:"@leeguoo/network-debugger"}}isWasmLoaded(){return this.wasmLoader?.isLoaded()||!1}isInitialized(){return this.initialized}static create(e){const t=new Qe;return t.init(e).then(()=>t)}createPanel(){this.interceptor?this.panel=new Ze(this.interceptor,{position:this.config.position,theme:this.config.theme,minimized:this.config.minimized,showConsole:this.config.showConsole}):Ie.error("Cannot create panel: interceptor not initialized")}defaultKeyExtractor(e){return e.keys||e.cid||e["x-api-key"]||""}defaultSlkExtractor(e){return e.slk||e["x-slk"]||""}}let et=null;const tt={init:async e=>et?(Ie.warn("NetworkDebugger already has a global instance"),et):(et=await Qe.create(e),"undefined"!=typeof window&&(window.NetworkDebugger=et),et),show(){et?.show()},hide(){et?.hide()},destroy(){et?.destroy(),et=null,"undefined"!=typeof window&&delete window.NetworkDebugger},getInstance:()=>et};exports.DebugPanel=Ze,exports.NetworkDebugger=Qe,exports.NetworkInterceptor=Xe,exports.WasmLoader=Je,exports.default=tt;
package/dist/index.esm.js CHANGED
@@ -8148,6 +8148,7 @@ const _DebugPanel = class _DebugPanel {
8148
8148
  this.isResizing = false;
8149
8149
  this.dragStart = { x: 0, y: 0 };
8150
8150
  this.resizeTimeout = null;
8151
+ this.resizeDirection = "";
8151
8152
  this.currentTab = "network";
8152
8153
  this.consoleHistory = [];
8153
8154
  this.requestsCache = [];
@@ -8225,7 +8226,7 @@ const _DebugPanel = class _DebugPanel {
8225
8226
  <div class="about-panel" data-panel="about" style="display: none;">
8226
8227
  <div style="padding: 20px; color: #fff; text-align: center;">
8227
8228
  <h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>
8228
- <p style="margin: 10px 0;">Version: ${"1.2.34"}</p>
8229
+ <p style="margin: 10px 0;">Version: ${"1.2.35"}</p>
8229
8230
  <p style="margin: 10px 0;">👨‍💻 Created by <strong>Leo (@leeguoo)</strong></p>
8230
8231
  <p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>
8231
8232
  <p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>
@@ -8729,8 +8730,9 @@ Created by Leo (@leeguoo)`);
8729
8730
  }
8730
8731
  startResize(e, direction) {
8731
8732
  this.isResizing = true;
8733
+ this.resizeDirection = direction;
8732
8734
  this.dragStart = { x: e.clientX, y: e.clientY };
8733
- this.container.style.transition = "none"(this.container).dataset.resizeDirection = direction;
8735
+ this.container.style.transition = "none";
8734
8736
  }
8735
8737
  handleMouseMove(e) {
8736
8738
  if (this.isDragging) {
@@ -8742,7 +8744,7 @@ Created by Leo (@leeguoo)`);
8742
8744
  this.dragStart = { x: e.clientX, y: e.clientY };
8743
8745
  }
8744
8746
  if (this.isResizing) {
8745
- const direction = this.container.dataset.resizeDirection;
8747
+ const direction = this.resizeDirection;
8746
8748
  if (!direction) return;
8747
8749
  const deltaX = e.clientX - this.dragStart.x;
8748
8750
  const deltaY = e.clientY - this.dragStart.y;
@@ -8789,7 +8791,7 @@ Created by Leo (@leeguoo)`);
8789
8791
  }
8790
8792
  this.isDragging = false;
8791
8793
  this.isResizing = false;
8792
- delete this.container.dataset.resizeDirection;
8794
+ this.resizeDirection = "";
8793
8795
  }
8794
8796
  handleWindowResize() {
8795
8797
  if (this.resizeTimeout) {
@@ -9084,7 +9086,7 @@ class NetworkDebugger {
9084
9086
  this.initialized = true;
9085
9087
  logger.consoleDirect(`
9086
9088
  ╔════════════════════════════════════════╗
9087
- ║ 🔓 PWTK 解密小工具 v${"1.2.34"} ║
9089
+ ║ 🔓 PWTK 解密小工具 v${"1.2.35"} ║
9088
9090
  ║ Created by Leo (@leeguoo) ║
9089
9091
  ║ 技术支持: 请联系 Leo ║
9090
9092
  ║ 分享服务: curl.bwg.leeguoo.com ║
package/dist/index.js CHANGED
@@ -15,4 +15,4 @@ e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function n(e){
15
15
 
16
16
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
17
  */
18
- function(){var t=e,n=t.lib,r=n.WordArray,o=n.Hasher,i=t.algo,s=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=r.create([0,1518500249,1859775393,2400959708,2840853838]),h=r.create([1352829926,1548603684,1836072691,2053994217,0]),u=i.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,o=e[r];e[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,u,w,x,m,k,_,S,B,C,D,T=this._hash.words,R=d.words,A=h.words,z=s.words,E=a.words,P=c.words,W=l.words;for(k=i=T[0],_=u=T[1],S=w=T[2],B=x=T[3],C=m=T[4],n=0;n<80;n+=1)D=i+e[t+z[n]]|0,D+=n<16?p(u,w,x)+R[0]:n<32?g(u,w,x)+R[1]:n<48?f(u,w,x)+R[2]:n<64?y(u,w,x)+R[3]:b(u,w,x)+R[4],D=(D=v(D|=0,P[n]))+m|0,i=m,m=x,x=v(w,10),w=u,u=D,D=k+e[t+E[n]]|0,D+=n<16?b(_,S,B)+A[0]:n<32?y(_,S,B)+A[1]:n<48?f(_,S,B)+A[2]:n<64?g(_,S,B)+A[3]:p(_,S,B)+A[4],D=(D=v(D|=0,W[n]))+C|0,k=C,C=B,B=v(S,10),S=_,_=D;D=T[1]+w+B|0,T[1]=T[2]+x+C|0,T[2]=T[3]+m+k|0,T[3]=T[4]+i+_|0,T[4]=T[0]+u+S|0,T[0]=D},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,s=0;s<5;s++){var a=i[s];i[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,n){return e^t^n}function g(e,t,n){return e&t|~e&n}function f(e,t,n){return(e|~t)^n}function y(e,t,n){return e&n|t&~n}function b(e,t,n){return e^(t|~n)}function v(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(u),t.HmacRIPEMD160=o._createHmacHelper(u)}(),e.RIPEMD160)),j.exports;var e}(),X(),function(){return J||(J=1,G.exports=(l=c(),E(),X(),t=(e=l).lib,n=t.Base,r=t.WordArray,o=e.algo,i=o.SHA256,s=o.HMAC,a=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=s.create(n.hasher,e),i=r.create(),a=r.create([1]),c=i.words,l=a.words,d=n.keySize,h=n.iterations;c.length<d;){var u=o.update(t).finalize(a);o.reset();for(var p=u.words,g=p.length,f=u,y=1;y<h;y++){f=o.finalize(f),o.reset();for(var b=f.words,v=0;v<g;v++)p[v]^=b[v]}i.concat(u),l[0]++}return i.sigBytes=4*d,i}}),e.PBKDF2=function(e,t,n){return a.create(n).compute(e,t)},l.PBKDF2)),G.exports;var e,t,n,r,o,i,s,a,l}(),Z(),te(),function(){return ne||(ne=1,re.exports=(e=c(),te(),e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var o,i=this._iv;i?(o=i.slice(0),this._iv=void 0):o=this._prevBlock,r.encryptBlock(o,0);for(var s=0;s<n;s++)e[t+s]^=o[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize;n.call(this,e,t,o,r),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=e.slice(t,t+o);n.call(this,e,t,o,r),this._prevBlock=i}}),t}(),e.mode.CFB)),re.exports;var e}(),function(){return oe||(oe=1,ie.exports=(n=c(),te(),n.mode.CTR=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var s=i.slice(0);n.encryptBlock(s,0),i[r-1]=i[r-1]+1|0;for(var a=0;a<r;a++)e[t+a]^=s[a]}}),e.Decryptor=t,e),n.mode.CTR)),ie.exports;var e,t,n}(),ce(),function(){return le||(le=1,de.exports=(n=c(),te(),n.mode.OFB=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),n.encryptBlock(i,0);for(var s=0;s<r;s++)e[t+s]^=i[s]}}),e.Decryptor=t,e),n.mode.OFB)),de.exports;var e,t,n}(),function(){return he||(he=1,ue.exports=(t=c(),te(),t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e),t.mode.ECB)),ue.exports;var e,t}(),function(){return pe||(pe=1,ge.exports=(e=c(),te(),e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,o=r-n%r,i=n+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923)),ge.exports;var e}(),function(){return fe||(fe=1,ye.exports=(e=c(),te(),e.pad.Iso10126={pad:function(t,n){var r=4*n,o=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126)),ye.exports;var e}(),function(){return be||(be=1,ve.exports=(e=c(),te(),e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971)),ve.exports;var e}(),function(){return we||(we=1,xe.exports=(e=c(),te(),e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding)),xe.exports;var e}(),function(){return me||(me=1,ke.exports=(e=c(),te(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding)),ke.exports;var e}(),function(){return _e||(_e=1,Se.exports=(r=c(),te(),t=(e=r).lib.CipherParams,n=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var r=n.parse(e);return t.create({ciphertext:r})}},r.format.Hex)),Se.exports;var e,t,n,r}(),function(){return Be||(Be=1,Ce.exports=(e=c(),x(),C(),Z(),te(),function(){var t=e,n=t.lib.BlockCipher,r=t.algo,o=[],i=[],s=[],a=[],c=[],l=[],d=[],h=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var g=r^r<<1^r<<2^r<<3^r<<4;g=g>>>8^255&g^99,o[n]=g,i[g]=n;var f=e[n],y=e[f],b=e[y],v=257*e[g]^16843008*g;s[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,c[n]=v<<8|v>>>24,l[n]=v,v=16843009*b^65537*y^257*f^16843008*n,d[g]=v<<24|v>>>8,h[g]=v<<16|v>>>16,u[g]=v<<8|v>>>24,p[g]=v,n?(n=f^e[e[e[b^f]]],r^=e[e[r]]):n=r=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],f=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],s=0;s<r;s++)s<n?i[s]=t[s]:(l=i[s-1],s%n?n>6&&s%n==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=g[s/n|0]<<24),i[s]=i[s-n]^l);for(var a=this._invKeySchedule=[],c=0;c<r;c++){if(s=r-c,c%4)var l=i[s];else l=i[s-4];a[c]=c<4||s<=4?l:d[o[l>>>24]]^h[o[l>>>16&255]]^u[o[l>>>8&255]]^p[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,l,o)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,d,h,u,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,o,i,s,a){for(var c=this._nRounds,l=e[t]^n[0],d=e[t+1]^n[1],h=e[t+2]^n[2],u=e[t+3]^n[3],p=4,g=1;g<c;g++){var f=r[l>>>24]^o[d>>>16&255]^i[h>>>8&255]^s[255&u]^n[p++],y=r[d>>>24]^o[h>>>16&255]^i[u>>>8&255]^s[255&l]^n[p++],b=r[h>>>24]^o[u>>>16&255]^i[l>>>8&255]^s[255&d]^n[p++],v=r[u>>>24]^o[l>>>16&255]^i[d>>>8&255]^s[255&h]^n[p++];l=f,d=y,h=b,u=v}f=(a[l>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^n[p++],y=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^n[p++],b=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&d])^n[p++],v=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^n[p++],e[t]=f,e[t+1]=y,e[t+2]=b,e[t+3]=v},keySize:8});t.AES=n._createHelper(f)}(),e.AES)),Ce.exports;var e}(),Re(),function(){return Ae||(Ae=1,ze.exports=(e=c(),x(),C(),Z(),te(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=r.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,r=this._S=[],o=0;o<256;o++)r[o]=o;o=0;for(var i=0;o<256;o++){var s=o%n,a=t[s>>>2]>>>24-s%4*8&255;i=(i+r[o]+a)%256;var c=r[o];r[o]=r[i],r[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,n=this._j,r=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[n],e[n]=i,r|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,r}t.RC4=n._createHelper(o);var s=r.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=n._createHelper(s)}(),e.RC4)),ze.exports;var e}(),function(){return Ee||(Ee=1,Pe.exports=(e=c(),x(),C(),Z(),te(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)o[n]^=r[n+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(o[0]^=l,o[1]^=h,o[2]^=d,o[3]^=u,o[4]^=l,o[5]^=h,o[6]^=d,o[7]^=u,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.Rabbit=n._createHelper(a)}(),e.Rabbit)),Pe.exports;var e}(),function(){return We||(We=1,qe.exports=(e=c(),x(),C(),Z(),te(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)r[o]^=n[o+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(r[0]^=l,r[1]^=h,r[2]^=d,r[3]^=u,r[4]^=l,r[5]^=h,r[6]^=d,r[7]^=u,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.RabbitLegacy=n._createHelper(a)}(),e.RabbitLegacy)),qe.exports;var e}(),Ke())),o.exports));const Xe=new class{constructor(){this.panel=null,this.enableBrowserConsole=!1,this.logLevel="debug",this.buffer=[],this.maxBufferSize=100,this.enableBrowserConsole=!1,this.logLevel="debug"}configure(e){void 0!==e.enableBrowserConsole&&(this.enableBrowserConsole=e.enableBrowserConsole),void 0!==e.logLevel&&(this.logLevel=e.logLevel)}setPanel(e){this.panel=e,this.flushBuffer()}flushBuffer(){this.panel&&(this.buffer.forEach(({message:e,type:t})=>{this.panel.logToConsole(e,t)}),this.buffer=[])}shouldLog(e){const t=["debug","info","warn","error"],n=t.indexOf(this.logLevel);return t.indexOf(e)>=n}formatMessage(e,t,n){const r=n.map(e=>{if("object"==typeof e)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}).join(" ");return r?`${t} ${r}`:t}output(e,t,n){this.panel?this.panel.logToConsole(e,t):(this.buffer.push({message:e,type:t,timestamp:new Date}),this.buffer.length>this.maxBufferSize&&this.buffer.shift()),this.enableBrowserConsole}debug(e,...t){if(!this.shouldLog("debug"))return;const n=this.formatMessage("[DEBUG]",e,t);this.output(n,"log","log")}log(e,...t){if(!this.shouldLog("info"))return;const n=this.formatMessage("",e,t);this.output(n,"log","log")}info(e,...t){if(!this.shouldLog("info"))return;const n=this.formatMessage("[INFO]",e,t);this.output(n,"log","log")}warn(e,...t){if(!this.shouldLog("warn"))return;const n=this.formatMessage("[WARN]",e,t);this.output(n,"warn","warn")}error(e,...t){if(!this.shouldLog("error"))return;const n=this.formatMessage("[ERROR]",e,t);this.output(n,"error","error")}consoleDirect(e,...t){}};class Je{constructor(){this.requests=new Map,this.listeners=[],this.decryptConfig={enabled:!1},window.__originalFetch=window.fetch,this.interceptXHR(),this.interceptFetch()}enableDecryption(e){this.decryptConfig.enabled=!0,e?.keyExtractor&&(this.decryptConfig.keyExtractor=e.keyExtractor),e?.slkExtractor&&(this.decryptConfig.slkExtractor=e.slkExtractor),void 0!==e?.autoFetchKeys&&(this.decryptConfig.autoFetchKeys=e.autoFetchKeys),e?.keyApiUrl&&(this.decryptConfig.keyApiUrl=e.keyApiUrl)}addListener(e){this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}getRequests(){return Array.from(this.requests.values()).sort((e,t)=>t.timestamp-e.timestamp)}clearRequests(){this.requests.clear()}generateRequestId(){return Math.random().toString(36).substr(2,9)}isInternalUrl(e){return e.includes("/api/dokv/storage")||e.includes("/api/share")}notifyListeners(e){this.listeners.forEach(t=>{try{t(e)}catch(n){Xe.warn("NetworkDebugger: Listener error:",n)}})}extractUrlParams(e){try{const t=new URL(e),n={};return t.searchParams.forEach((e,t)=>{n[t]=e}),Object.keys(n).length>0?1===Object.keys(n).length&&n.data?n.data:n:null}catch(t){return null}}async tryDecrypt(e,t){if(Xe.debug("[PWTK Debug] tryDecrypt called:",{dataType:typeof e,dataLength:"string"==typeof e?e.length:JSON.stringify(e).length,dataPreview:"string"==typeof e?e.substring(0,100):JSON.stringify(e).substring(0,100),headers:Object.keys(t),decryptEnabled:this.decryptConfig.enabled,hasWindowDecrypt:"function"==typeof window.decrypt}),!this.decryptConfig.enabled||!e)return Xe.debug("[PWTK Debug] Decrypt disabled or no data"),null;try{let r="",o="";if(t.cid&&!1!==this.decryptConfig.autoFetchKeys){Xe.debug("[PWTK Debug] Trying to fetch key with cid:",t.cid);try{const e=this.decryptConfig.keyApiUrl||"https://gw-card-pay.buyacard.cc/ip/getSK",n={cid:t.cid,client:t.client||"S_WEB",device:t.device||"Web",language:t.language||"CN"};Xe.debug("[PWTK Debug] Fetching key from:",e,"with headers:",n);const o=window.__originalFetch||window.fetch,i=await o(e,{headers:n}),s=await i.json();if(Xe.debug("[PWTK Debug] getSK API response:",s),s.success&&s.data){const e=String(s.data);Xe.debug("[PWTK Debug] getSK returned num:",e,"length:",e.length),e.length>=9?(r=e.charAt(2)+e.charAt(5)+e.charAt(8),Xe.debug("[PWTK Debug] Extracted key from getSK:",r)):Xe.debug("[PWTK Debug] getSK num too short:",e)}else Xe.debug("[PWTK Debug] getSK failed:",s)}catch(n){Xe.warn("[PWTK Debug] getSK API error:",n)}}else Xe.debug("[PWTK Debug] No cid or autoFetchKeys disabled");!r&&this.decryptConfig.keyExtractor?(r=this.decryptConfig.keyExtractor(t),Xe.debug("[PWTK Debug] Key from custom extractor:",r)):r||(r=t.decryptKey||t.keys||t.cid||"",Xe.debug("[PWTK Debug] Key from headers:",r,"from:",t.decryptKey?"decryptKey":t.keys?"keys":t.cid?"cid":"none")),this.decryptConfig.slkExtractor?(o=this.decryptConfig.slkExtractor(t),Xe.debug("[PWTK Debug] SLK from custom extractor:",o)):(o=t.decryptSlk||t.slk||"",Xe.debug("[PWTK Debug] SLK from headers:",o,"from:",t.decryptSlk?"decryptSlk":t.slk?"slk":"none"));const i=r+o;if(Xe.debug("[PWTK Debug] Full decrypt key:",i?`"${i}" (length: ${i.length})`:"empty"),i){let t=e,r=!1;if("object"==typeof e&&null!==e&&e.data&&"string"==typeof e.data)Xe.debug('[PWTK Debug] Data is wrapped in {"data": "..."} format, extracting inner data'),t=e.data,r=!0;else if("string"==typeof e)try{const n=JSON.parse(e);n.data&&"string"==typeof n.data&&(Xe.debug("[PWTK Debug] Data is JSON string with data field, extracting"),t=n.data,r=!0)}catch{}const o="string"==typeof t?t:JSON.stringify(t);Xe.debug("[PWTK Debug] Calling decrypt with:",{dataLength:o.length,dataPreview:o.substring(0,50),key:i,isWrapped:r});const s=function(e,t){if(Xe.debug("[PWTK Decrypt] decrypt function called:",{dataLength:e?.length,dataPreview:e?.substring(0,50),keyStr:t,hasWindowDecrypt:"function"==typeof window.decrypt,hasWindowEncrypt:"function"==typeof window.encrypt}),!e||e.startsWith("{")||e.startsWith("[")){Xe.debug("[PWTK Decrypt] Data looks like JSON, parsing directly");try{const t=JSON.parse(e);return Xe.debug("[PWTK Decrypt] Successfully parsed as JSON"),t}catch{return Xe.debug("[PWTK Decrypt] Failed to parse as JSON, returning as string"),e}}if(window.decrypt&&t){Xe.debug("[PWTK Decrypt] Trying WebAssembly decrypt"),Xe.debug("[PWTK Decrypt] Input to window.decrypt:",{data:e.substring(0,100)+"...",key:t});try{const n=window.decrypt(e,t);if(Xe.debug("[PWTK Decrypt] window.decrypt returned:",{type:typeof n,length:n?.length,preview:n?n.substring(0,200)+(n.length>200?"...":""):null,sameAsInput:n===e,hasInvalidChars:n?.includes("�")}),n&&n!==e&&!n.includes("�"))try{const e=JSON.parse(n);return Xe.debug("[PWTK Decrypt] ✅ WebAssembly decryption successful, parsed as JSON:",e),e}catch{if(n.length>0)return Xe.debug("[PWTK Decrypt] ✅ WebAssembly decryption successful, returning as string"),n}else Xe.debug("[PWTK Decrypt] window.decrypt did not change the data or returned invalid result")}catch(n){Xe.debug("[PWTK Decrypt] WebAssembly decrypt error:",n)}}else Xe.debug("[PWTK Decrypt] WebAssembly not available:",{hasWindowDecrypt:!!window.decrypt,hasKey:!!t,windowDecryptType:typeof window.decrypt});const r=[t,"thisisakey123456","VITE_CRYPTO_KEY"].filter(Boolean);for(const o of r)if(o)try{const t=Ie.enc.Utf8.parse(o.padEnd(16,"0").slice(0,16)),n=Ie.enc.Utf8.parse(o.padEnd(16,"0").slice(0,16)),r=Ie.AES.decrypt(e,t,{iv:n,mode:Ie.mode.CBC,padding:Ie.pad.Pkcs7}).toString(Ie.enc.Utf8);if(r)try{return JSON.parse(r)}catch{return r}}catch(n){}try{const t=atob(e);try{return JSON.parse(t)}catch{return t}}catch{}return Xe.debug("[PWTK Decrypt] ❌ All decryption methods failed, returning original data"),e}(o,i);if(Xe.debug("[PWTK Debug] Decrypt result:",{success:s&&s!==o,decryptedType:typeof s,decryptedLength:s?"string"==typeof s?s.length:JSON.stringify(s).length:0,preview:s?"string"==typeof s?s.substring(0,100):JSON.stringify(s).substring(0,100):null}),s&&s!==o)return Xe.debug("[PWTK Debug] ✅ Decryption successful! Result:",s),s;Xe.debug("[PWTK Debug] ❌ Decryption failed or returned same data")}else Xe.debug("[PWTK Debug] No key available, skipping decryption")}catch(r){Xe.error("[PWTK Debug] tryDecrypt error:",r)}return Xe.debug("[PWTK Debug] tryDecrypt returning null"),null}interceptXHR(){const e=window.XMLHttpRequest,t=this;window.XMLHttpRequest=function(...n){const r=new e(...n),o=t.generateRequestId();let i="",s="",a={};const c=Date.now();let l=!1;const d=r.open;r.open=function(e,n,...r){return i=e.toUpperCase(),s=n,l=t.isInternalUrl(s),d.apply(this,[e,n,...r])};const h=r.setRequestHeader;r.setRequestHeader=function(e,t){return a[e]=t,h.call(this,e,t)};const u=r.send;return r.send=function(e){if(l)return u.call(this,e);const n={id:o,url:s,method:i,headers:{...a},requestBody:e,timestamp:c};let r=e;return"GET"!==i||e||(r=t.extractUrlParams(s),r&&(n.requestBody=r)),r&&t.tryDecrypt(r,a).then(e=>{null!==e&&(n.decryptedRequest=e,t.requests.set(o,n),Xe.debug("[PWTK Debug] Request decrypted, notifying UI"),t.notifyListeners(n))}).catch(e=>Xe.warn("解密请求失败:",e)),t.requests.set(o,n),t.notifyListeners(n),u.call(this,e)},r.addEventListener("readystatechange",function(){if(Xe.debug("[PWTK Debug] XHR state changed:",{readyState:r.readyState,readyStateName:["UNSENT","OPENED","HEADERS_RECEIVED","LOADING","DONE"][r.readyState],status:r.status,isInternal:l,requestId:o,url:s}),Xe.debug("[PWTK Debug] Checking response condition:",{readyState:r.readyState,isDone:4===r.readyState,XMLHttpRequestDONE:"undefined"!=typeof XMLHttpRequest?XMLHttpRequest.DONE:"undefined",isInternal:l,shouldProcess:4===r.readyState&&!l}),4===r.readyState&&!l){Xe.debug("[PWTK Debug] XHR completed, processing response");const e=Date.now(),n=t.requests.get(o);if(n){Xe.debug("[PWTK Debug] Found request data, updating with response"),n.status=r.status,n.statusText=r.statusText,n.duration=e-c;const i={},s=r.getAllResponseHeaders();s&&s.split("\r\n").forEach(e=>{const t=e.split(": ");2===t.length&&(i[t[0]]=t[1])}),n.responseHeaders=i;const l=null!==r.responseText&&void 0!==r.responseText&&""!==r.responseText;if(Xe.debug("[PWTK Debug] XHR Response received:",{status:n.status,hasResponseText:l,responseTextLength:r.responseText?.length,responseTextPreview:r.responseText?.substring(0,100)}),l)try{n.responseBody=JSON.parse(r.responseText),Xe.debug("[PWTK Debug] Response parsed as JSON:",n.responseBody)}catch{n.responseBody=r.responseText,Xe.debug("[PWTK Debug] Response kept as text")}else n.responseBody=null,Xe.debug("[PWTK Debug] No response body");Xe.debug("[PWTK Debug] Updating request with response data"),t.requests.set(o,n),t.notifyListeners(n),n.responseBody&&t.tryDecrypt(n.responseBody,{...a,...i}).then(e=>{null!==e&&(n.decryptedResponse=e,t.requests.set(o,n),Xe.debug("[PWTK Debug] Response decrypted, notifying UI:",e),t.notifyListeners(n))}).catch(e=>Xe.warn("解密响应失败:",e))}else Xe.debug("[PWTK Debug] WARNING: Request data not found for ID:",o)}}),r},window.XMLHttpRequest.prototype=e.prototype}interceptFetch(){const e=window.__originalFetch||window.fetch,t=this;window.fetch=async function(n,r){const o=t.generateRequestId(),i=Date.now(),s="string"==typeof n?n:n instanceof URL?n.toString():n.url,a=(r?.method||"GET").toUpperCase();if(t.isInternalUrl(s))return e.call(this,n,r);const c={};r?.headers&&(r.headers instanceof Headers?r.headers.forEach((e,t)=>{c[t]=e}):Array.isArray(r.headers)?r.headers.forEach(([e,t])=>{c[e]=t}):Object.entries(r.headers).forEach(([e,t])=>{c[e]=t}));let l=null;if(r?.body)if("string"==typeof r.body)try{l=JSON.parse(r.body)}catch{l=r.body}else l=r.body;const d={id:o,url:s,method:a,headers:{...c},requestBody:l,timestamp:i};let h=l;"GET"!==a||l||(h=t.extractUrlParams(s),h&&(d.requestBody=h)),h&&t.tryDecrypt(h,c).then(e=>{null!==e&&(d.decryptedRequest=e,t.requests.set(o,d),Xe.debug("[PWTK Debug] Fetch request decrypted, notifying UI"),t.notifyListeners(d))}).catch(e=>Xe.warn("解密请求失败:",e)),t.requests.set(o,d),t.notifyListeners(d);try{const s=await e.call(this,n,r),a=Date.now(),l=s.clone(),d=t.requests.get(o);if(d){d.status=s.status,d.statusText=s.statusText,d.duration=a-i;const e={};s.headers.forEach((t,n)=>{e[n]=t}),d.responseHeaders=e;try{const n=await l.text();Xe.debug("[PWTK Debug] Fetch Response received:",{status:d.status,textLength:n.length,textPreview:n.substring(0,100)});try{d.responseBody=JSON.parse(n)}catch{d.responseBody=n}t.requests.set(o,d),t.notifyListeners(d),d.responseBody&&t.tryDecrypt(d.responseBody,{...c,...e}).then(e=>{null!==e&&(d.decryptedResponse=e,t.requests.set(o,d),Xe.debug("[PWTK Debug] Fetch response decrypted, notifying UI:",e),t.notifyListeners(d))}).catch(e=>Xe.warn("解密响应失败:",e))}catch(u){d.error=`Failed to read response: ${u}`,t.requests.set(o,d),t.notifyListeners(d)}}return s}catch(u){const e=Date.now(),n=t.requests.get(o);throw n&&(n.error=u instanceof Error?u.message:String(u),n.duration=e-i,t.requests.set(o,n),t.notifyListeners(n)),u}}}}class Ge{constructor(){this.loaded=!1,this.loading=!1}async loadWasm(e,t){if(Xe.debug("[PWTK WASM] loadWasm called"),Xe.debug("[PWTK WASM] Current state:",{hasWindowDecrypt:"function"==typeof window.decrypt,hasWindowEncrypt:"function"==typeof window.encrypt,hasWindowGo:void 0!==window.Go}),"function"==typeof window.decrypt)return Xe.debug("[PWTK WASM] window.decrypt already exists, skipping WASM load"),this.loaded=!0,!0;if(this.loaded)return!0;if(this.loading)return new Promise(e=>{const t=()=>{this.loaded||!this.loading?e(this.loaded):setTimeout(t,100)};t()});this.loading=!0;try{const i=[e,"/mimlib.wasm","/dist/mimlib.wasm","/assets/mimlib.wasm","https://gw-card-pay.buyacard.cc/mimlib.wasm"].filter(Boolean),s=[t,"/wasm_exec.js","/dist/wasm_exec.js","/assets/wasm_exec.js","https://gw-card-pay.buyacard.cc/wasm_exec.js"].filter(Boolean);let a=!1;for(const e of s)try{if(await this.loadScript(e),void 0!==window.Go){a=!0,Xe.debug("[PWTK WASM] wasm_exec.js loaded successfully from:",e);break}}catch(n){Xe.warn("NetworkDebugger: 尝试加载",e,"失败:",n);continue}if(!a)throw new Error("Unable to load wasm_exec.js from any path");if(void 0===window.Go)throw new Error("Go WebAssembly runtime not available");const c=new window.Go;let l=null;for(const e of i)try{if(!WebAssembly.instantiateStreaming){const t=await fetch(e).then(e=>e.arrayBuffer());l=await WebAssembly.instantiate(t,c.importObject),Xe.info("NetworkDebugger: WebAssembly 加载成功(传统方式):",e);break}try{l=await WebAssembly.instantiateStreaming(fetch(e),c.importObject),Xe.info("NetworkDebugger: WebAssembly 加载成功:",e);break}catch(r){Xe.warn("instantiateStreaming 失败,尝试传统方式:",r);const t=await fetch(e).then(e=>e.arrayBuffer());l=await WebAssembly.instantiate(t,c.importObject),Xe.info("NetworkDebugger: WebAssembly 加载成功(传统方式):",e);break}}catch(o){Xe.warn("NetworkDebugger: 尝试加载",e,"失败:",o);continue}if(!l)throw new Error("Unable to load WebAssembly from any path");return c.run(l.instance),await new Promise(e=>setTimeout(e,100)),Xe.debug("[PWTK WASM] After WASM load, checking functions:",{hasDecrypt:"function"==typeof window.decrypt,hasEncrypt:"function"==typeof window.encrypt,windowKeys:Object.keys(window).filter(e=>e.includes("crypt"))}),"function"==typeof window.decrypt?(this.loaded=!0,Xe.debug("[PWTK WASM] ✅ WebAssembly loaded successfully, decrypt function available"),!0):(Xe.warn("[PWTK WASM] ❌ WebAssembly loaded but decrypt function not available"),!1)}catch(o){return Xe.error("[PWTK WASM] WebAssembly loading failed:",o),!1}finally{this.loading=!1,Xe.debug("[PWTK WASM] Load complete, final state:",{loaded:this.loaded,hasDecrypt:"function"==typeof window.decrypt})}}loadScript(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return void t();const r=document.createElement("script");r.src=e,r.type="text/javascript",r.onload=()=>t(),r.onerror=t=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}isLoaded(){return this.loaded}isLoading(){return this.loading}isDecryptAvailable(){return this.loaded&&"function"==typeof window.decrypt}isEncryptAvailable(){return this.loaded&&"function"==typeof window.encrypt}}function Ye(e){return JSON.stringify(e,null,2)}async function Ve(e){try{const n=function(e){let t=`curl '${e.url}'`;"GET"!==e.method&&(t+=` -X ${e.method}`);e.headers&&Object.entries(e.headers).forEach(([e,n])=>{t+=` -H '${e}: ${n}'`});if(e.requestBody){const n="string"==typeof e.requestBody?e.requestBody:JSON.stringify(e.requestBody);t+=` --data '${n}'`}return t}(e),r={curl:n,response:e.responseBody||null,timestamp:Date.now(),slk:e.headers?.slk||"",debuggerData:{url:e.url,method:e.method,headers:e.headers,status:e.status,statusText:e.statusText,duration:e.duration,responseHeaders:e.responseHeaders,decryptedRequest:e.decryptedRequest,decryptedResponse:e.decryptedResponse,error:e.error,creator:"PWTK Network Debugger by Leo (@leeguoo)",version:"1.2.26"}},o=window.__originalFetch||window.fetch,i="https://curl.bwg.leeguoo.com/api/share";let s;Xe.debug("使用分享API:",i);try{s=await o(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:r})})}catch(t){if("TypeError"===t.name&&t.message.includes("fetch"))throw new Error(`网络连接失败: 无法连接到分享服务器 (${i}). 可能原因: CORS策略限制或网络问题`);throw t}if(!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);const a=await s.json();if(a.shareId){const e=`https://curl.bwg.leeguoo.com/share/${a.shareId}`;return Xe.info(`🔗 分享链接创建成功 (by Leo): ${e}`),e}throw new Error(a.error||"创建分享失败")}catch(n){const e=n.message||n.toString()||"未知错误";throw Xe.error("NetworkDebugger: 创建分享链接失败:",{message:e,name:n.name,stack:n.stack?.split("\n")[0]}),new Error(e)}}const Ze=class e{constructor(e,t={}){this.isDragging=!1,this.isResizing=!1,this.dragStart={x:0,y:0},this.resizeTimeout=null,this.currentTab="network",this.consoleHistory=[],this.requestsCache=[],this.interceptor=e;const n=this.loadConfig();this.config={position:"bottom-right",theme:"dark",minimized:!1,showConsole:!0,...n,...t},this.createPanel(),this.bindEvents(),this.startListening(),Xe.setPanel(this),this.loadPosition()}createPanel(){if(!document.getElementById("network-debugger-styles")){const e=document.createElement("style");e.id="network-debugger-styles",e.textContent="\n/* NetworkDebugger 样式 */\n#network-debugger-panel {\n position: fixed;\n z-index: 999999;\n background: #1a1a1a;\n color: #ffffff;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n border-radius: 8px;\n overflow: hidden;\n max-width: 90vw;\n max-height: 80vh;\n transition: all 0.3s ease;\n}\n\n#network-debugger-panel.minimized {\n height: 35px !important;\n overflow: hidden;\n width: 160px !important;\n max-width: 160px !important;\n}\n\n#network-debugger-panel.minimized .debugger-content {\n display: none;\n}\n\n#network-debugger-panel.minimized .resize-handle {\n display: none;\n}\n\n#network-debugger-panel.fullscreen .resize-handle {\n display: none;\n}\n\n#network-debugger-panel.bottom-right {\n bottom: 20px;\n right: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.bottom-left {\n bottom: 20px;\n left: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.top-right {\n top: 20px;\n right: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.top-left {\n top: 20px;\n left: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.fullscreen {\n top: 0;\n left: 0;\n width: 100vw !important;\n height: 100vh !important;\n border-radius: 0;\n}\n\n.debugger-header {\n background: #333;\n padding: 8px 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: move;\n user-select: none;\n border-bottom: 1px solid #444;\n}\n\n.debugger-title {\n font-weight: bold;\n color: #4CAF50;\n font-size: 14px;\n}\n\n.debugger-controls {\n display: flex;\n gap: 8px;\n}\n\n.debugger-btn {\n background: none;\n border: none;\n color: #fff;\n padding: 4px 8px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n transition: background-color 0.2s;\n}\n\n.debugger-btn:hover {\n background: #555;\n}\n\n.debugger-btn.active {\n background: #4CAF50;\n color: #000;\n}\n\n.debugger-icon {\n width: 16px;\n height: 16px;\n vertical-align: middle;\n}\n\n.debugger-content {\n height: calc(100% - 40px);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n\n.debugger-tabs {\n display: flex;\n background: #2a2a2a;\n border-bottom: 1px solid #444;\n}\n\n.debugger-tab {\n padding: 8px 16px;\n cursor: pointer;\n border: none;\n background: none;\n color: #ccc;\n font-size: 12px;\n transition: all 0.2s;\n border-bottom: 2px solid transparent;\n}\n\n.debugger-tab:hover {\n color: #fff;\n background: #3a3a3a;\n}\n\n.debugger-tab.active {\n color: #4CAF50;\n border-bottom-color: #4CAF50;\n background: #333;\n}\n\n.debugger-panel-content {\n flex: 1;\n overflow: auto;\n padding: 12px;\n}\n\n.request-list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.request-item {\n background: #2a2a2a;\n border: 1px solid #444;\n border-radius: 6px;\n padding: 10px;\n cursor: pointer;\n transition: all 0.2s;\n position: relative;\n}\n\n.request-item:hover {\n background: #333;\n border-color: #666;\n}\n\n.request-item.expanded {\n background: #333;\n border-color: #4CAF50;\n}\n\n.request-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 4px;\n}\n\n.request-method {\n padding: 2px 8px;\n border-radius: 4px;\n font-weight: bold;\n font-size: 10px;\n text-transform: uppercase;\n min-width: 40px;\n text-align: center;\n}\n\n.method-get { background: #4CAF50; color: #000; }\n.method-post { background: #2196F3; color: #fff; }\n.method-put { background: #FF9800; color: #000; }\n.method-delete { background: #F44336; color: #fff; }\n.method-patch { background: #9C27B0; color: #fff; }\n\n.request-url {\n flex: 1;\n margin: 0 8px;\n word-break: break-all;\n white-space: normal;\n color: #fff;\n font-size: 11px;\n line-height: 1.3;\n}\n\n.request-status {\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 10px;\n min-width: 35px;\n text-align: center;\n}\n\n.status-2xx { background: #4CAF50; color: #000; }\n.status-3xx { background: #FF9800; color: #000; }\n.status-4xx { background: #F44336; color: #fff; }\n.status-5xx { background: #9C27B0; color: #fff; }\n.status-error { background: #F44336; color: #fff; }\n\n.request-info {\n display: flex;\n justify-content: space-between;\n font-size: 10px;\n color: #999;\n}\n\n.request-details {\n margin-top: 12px;\n border-top: 1px solid #444;\n padding-top: 12px;\n display: none;\n}\n\n/* 默认折叠headers */\n.request-details .detail-section.collapsible {\n /* 默认折叠状态 */\n}\n\n.request-details .detail-section.collapsible:not(.expanded) .detail-content {\n display: none;\n}\n\n.request-details .detail-section.collapsible:not(.expanded) .collapse-icon {\n transform: rotate(-90deg);\n}\n\n.request-item.expanded .request-details {\n display: block;\n}\n\n.detail-section {\n margin-bottom: 16px;\n}\n\n.detail-title {\n font-weight: bold;\n color: #4CAF50;\n margin-bottom: 8px;\n font-size: 11px;\n text-transform: uppercase;\n border-bottom: 1px solid #444;\n padding-bottom: 4px;\n}\n\n.detail-title.highlight {\n color: #FFD700;\n font-size: 12px;\n background: rgba(255, 215, 0, 0.1);\n padding: 6px 8px;\n border-radius: 4px;\n border-bottom: 2px solid #FFD700;\n}\n\n.detail-title.clickable {\n cursor: pointer;\n user-select: none;\n display: flex;\n align-items: center;\n gap: 4px;\n}\n\n.detail-title.clickable:hover {\n background: rgba(76, 175, 80, 0.1);\n}\n\n.collapse-icon {\n display: inline-block;\n transition: transform 0.2s;\n font-size: 10px;\n}\n\n.detail-section.collapsible {\n position: relative;\n}\n\n.detail-section.collapsible.collapsed .detail-content {\n display: none;\n}\n\n.detail-section.collapsible.collapsed .collapse-icon {\n transform: rotate(-90deg);\n}\n\n.detail-content {\n background: #222;\n padding: 8px;\n border-radius: 4px;\n max-height: 200px;\n overflow: auto;\n}\n\n.json-content {\n white-space: pre-wrap;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 11px;\n line-height: 1.4;\n}\n\n.headers-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 10px;\n}\n\n.headers-table th,\n.headers-table td {\n padding: 4px 8px;\n text-align: left;\n border-bottom: 1px solid #444;\n}\n\n.headers-table th {\n background: #333;\n color: #4CAF50;\n font-weight: bold;\n}\n\n.headers-table td {\n color: #ccc;\n}\n\n.decrypted-badge {\n background: #4CAF50;\n color: #000;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 9px;\n margin-left: 8px;\n font-weight: bold;\n}\n\n.error-badge {\n background: #F44336;\n color: #fff;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 9px;\n margin-left: 8px;\n font-weight: bold;\n}\n\n.share-btn {\n background: #2196F3;\n color: #fff;\n border: none;\n padding: 4px 10px;\n border-radius: 3px;\n font-size: 11px;\n margin-left: 8px;\n cursor: pointer;\n transition: all 0.2s;\n white-space: nowrap;\n}\n\n.share-btn:hover {\n background: #1976D2;\n transform: scale(1.1);\n}\n\n.share-btn:active {\n transform: scale(0.95);\n}\n\n.console-content {\n background: #000;\n color: #0f0;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 11px;\n line-height: 1.4;\n height: 100%;\n overflow: auto;\n padding: 8px;\n}\n\n.console-input {\n display: flex;\n align-items: center;\n background: #333;\n padding: 8px;\n border-top: 1px solid #444;\n}\n\n.console-prompt {\n color: #4CAF50;\n margin-right: 8px;\n font-weight: bold;\n}\n\n.console-cmd {\n flex: 1;\n background: none;\n border: none;\n color: #fff;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n outline: none;\n}\n\n.tools-section {\n padding: 12px;\n background: #2a2a2a;\n border-bottom: 1px solid #444;\n}\n\n.tool-buttons {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.tool-btn {\n padding: 6px 12px;\n background: #4CAF50;\n color: #000;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 11px;\n font-weight: bold;\n transition: background-color 0.2s;\n}\n\n.tool-btn:hover {\n background: #45a049;\n}\n\n.tool-btn:disabled {\n background: #666;\n color: #999;\n cursor: not-allowed;\n}\n\n@media (max-width: 600px) {\n #network-debugger-panel.bottom-right,\n #network-debugger-panel.bottom-left,\n #network-debugger-panel.top-right,\n #network-debugger-panel.top-left {\n width: calc(100vw - 20px) !important;\n left: 10px !important;\n right: auto !important;\n }\n \n /* 最小化时不应用全宽,保持小尺寸 */\n #network-debugger-panel.minimized {\n width: 160px !important;\n max-width: 160px !important;\n height: 35px !important;\n }\n}\n\n::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n}\n\n::-webkit-scrollbar-track {\n background: #333;\n}\n\n::-webkit-scrollbar-thumb {\n background: #666;\n border-radius: 3px;\n}\n\n::-webkit-scrollbar-thumb:hover {\n background: #888;\n}\n\n.resize-handle {\n position: absolute;\n background: transparent;\n}\n\n.resize-handle.n {\n top: -3px;\n left: 0;\n right: 0;\n height: 6px;\n cursor: ns-resize;\n}\n\n.resize-handle.s {\n bottom: -3px;\n left: 0;\n right: 0;\n height: 6px;\n cursor: ns-resize;\n}\n\n.resize-handle.e {\n top: 0;\n right: -3px;\n bottom: 0;\n width: 6px;\n cursor: ew-resize;\n}\n\n.resize-handle.w {\n top: 0;\n left: -3px;\n bottom: 0;\n width: 6px;\n cursor: ew-resize;\n}\n\n.resize-handle.ne {\n top: -3px;\n right: -3px;\n width: 12px;\n height: 12px;\n cursor: ne-resize;\n}\n\n.resize-handle.nw {\n top: -3px;\n left: -3px;\n width: 12px;\n height: 12px;\n cursor: nw-resize;\n}\n\n.resize-handle.se {\n bottom: -3px;\n right: -3px;\n width: 12px;\n height: 12px;\n cursor: se-resize;\n}\n\n.resize-handle.sw {\n bottom: -3px;\n left: -3px;\n width: 12px;\n height: 12px;\n cursor: sw-resize;\n}\n\n.debugger-reopen-btn {\n position: fixed;\n z-index: 999999;\n background: #4CAF50;\n color: #000;\n border: none;\n padding: 8px 10px;\n border-radius: 16px;\n font-weight: bold;\n font-size: 12px;\n box-shadow: 0 4px 12px rgba(0,0,0,0.25);\n cursor: pointer;\n}\n\n.debugger-reopen-btn:hover {\n filter: brightness(0.95);\n}\n",document.head.appendChild(e)}this.container=document.createElement("div"),this.container.id="network-debugger-panel",this.container.className=`${this.config.position} ${this.config.minimized?"minimized":""}`,this.container.innerHTML=`\n <div class="debugger-header">\n <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo</span></div>\n <div class="debugger-controls">\n <button class="debugger-btn" data-action="clear" title="清空"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg></button>\n <button class="debugger-btn" data-action="export" title="导出"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg></button>\n <button class="debugger-btn" data-action="fullscreen" title="全屏"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg></button>\n <button class="debugger-btn" data-action="close" title="关闭"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg></button>\n </div>\n </div>\n <div class="debugger-content">\n <div class="debugger-tabs">\n <button class="debugger-tab active" data-tab="network">网络</button>\n ${this.config.showConsole?'<button class="debugger-tab" data-tab="console">控制台</button>':""}\n <button class="debugger-tab" data-tab="tools">工具</button>\n <button class="debugger-tab" data-tab="about">关于</button>\n </div>\n <div class="debugger-panel-content">\n <div class="network-panel" data-panel="network">\n <div class="request-list"></div>\n </div>\n ${this.config.showConsole?'\n <div class="console-panel" data-panel="console" style="display: none;">\n <div class="console-content"></div>\n <div class="console-input">\n <span class="console-prompt">></span>\n <input class="console-cmd" placeholder="输入 JavaScript 代码..." />\n </div>\n </div>\n ':""}\n <div class="tools-panel" data-panel="tools" style="display: none;">\n <div class="tools-section">\n <div class="tool-buttons">\n <button class="tool-btn" data-tool="parse-curl">解析 cURL</button>\n <button class="tool-btn" data-tool="export-har">导出 HAR</button>\n <button class="tool-btn" data-tool="cors-test">CORS 测试</button>\n <button class="tool-btn" data-tool="decrypt-test">解密测试</button>\n </div>\n </div>\n <div class="tools-content">\n <textarea placeholder="在这里粘贴 cURL 命令或输入要测试的数据..." style="width: 100%; height: 200px; background: #222; color: #fff; border: 1px solid #444; padding: 8px; font-family: monospace;"></textarea>\n </div>\n </div>\n <div class="about-panel" data-panel="about" style="display: none;">\n <div style="padding: 20px; color: #fff; text-align: center;">\n <h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>\n <p style="margin: 10px 0;">Version: 1.2.34</p>\n <p style="margin: 10px 0;">👨‍💻 Created by <strong>Leo (@leeguoo)</strong></p>\n <p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>\n <p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>\n <div style="margin-top: 20px; padding: 15px; background: #333; border-radius: 8px;">\n <p style="margin: 5px 0; font-size: 12px;">本工具专为 PWTK 项目开发</p>\n <p style="margin: 5px 0; font-size: 12px;">提供网络请求拦截、解密、分享等功能</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n `,this.addResizeHandles(),document.body.appendChild(this.container),this.networkTab=this.container.querySelector('[data-panel="network"]'),this.consoleTab=this.container.querySelector('[data-panel="console"]'),this.consoleContent=this.container.querySelector(".console-content")}addResizeHandles(){["n","s","e","w","ne","nw","se","sw"].forEach(e=>{const t=document.createElement("div");t.className=`resize-handle ${e}`,t.dataset.direction=e,this.container.appendChild(t)})}bindEvents(){const e=this.container.querySelector(".debugger-header"),t=this.container.querySelector(".debugger-controls"),n=this.container.querySelectorAll(".debugger-tab"),r=this.container.querySelectorAll("[data-tool]"),o=this.container.querySelector(".console-cmd");e.addEventListener("mousedown",e=>{e.target===t||t.contains(e.target)||this.startDrag(e)}),t.addEventListener("click",e=>{e.stopPropagation();let n=e.target;for(;n&&n!==t&&!n.dataset?.action;)n=n.parentElement;const r=n?.dataset?.action;if(r)switch(r){case"clear":this.clearRequests();break;case"export":this.exportData();break;case"fullscreen":this.toggleFullscreen();break;case"close":this.hide()}}),n.forEach(e=>{e.addEventListener("click",e=>{const t=e.target.dataset.tab;this.switchTab(t)})}),r.forEach(e=>{e.addEventListener("click",e=>{const t=e.target.dataset.tool;this.handleToolAction(t)})}),o&&o.addEventListener("keypress",e=>{"Enter"===e.key&&(this.executeConsoleCommand(o.value),o.value="")});this.container.querySelectorAll(".resize-handle").forEach(e=>{e.addEventListener("mousedown",t=>{t.stopPropagation();const n=e.dataset.direction||e.classList[1]||"se";this.startResize(t,n)})}),document.addEventListener("mousemove",this.handleMouseMove.bind(this)),document.addEventListener("mouseup",this.handleMouseUp.bind(this)),window.addEventListener("resize",this.handleWindowResize.bind(this))}startListening(){this.interceptor.addListener(e=>{this.addRequestToUI(e)}),this.requestsCache=this.interceptor.getRequests(),this.renderRequests()}addRequestToUI(e){Xe.debug("[PWTK UI] Adding/updating request:",{id:e.id,url:e.url,hasResponse:!!e.responseBody,hasDecryptedRequest:!!e.decryptedRequest,hasDecryptedResponse:!!e.decryptedResponse,status:e.status});const t=this.requestsCache.findIndex(t=>t.id===e.id);t>=0?this.requestsCache[t]=e:this.requestsCache.unshift(e),this.requestsCache.length>100&&(this.requestsCache=this.requestsCache.slice(0,100)),this.renderRequests()}renderRequests(){const e=this.container.querySelector(".request-list");e&&(e.innerHTML="",this.requestsCache.forEach(t=>{const n=this.createRequestItem(t);e.appendChild(n)}))}createRequestItem(e){const t=document.createElement("div");t.className="request-item",t.dataset.requestId=e.id;const n=this.getStatusClass(e.status),r=`method-${e.method.toLowerCase()}`;e.decryptedRequest||e.decryptedResponse;const o=e.error;t.innerHTML=`\n <div class="request-header">\n <span class="request-method ${r}">${e.method}</span>\n <span class="request-url" title="${e.url}">${this.truncateUrl(e.url)}</span>\n <span class="request-status ${n}">${e.status?e.status:void 0!==e.duration?"ERR":"Pending"}</span>\n ${o?'<span class="error-badge">⚠️</span>':""}\n <button class="share-btn" title="分享此请求 (by Leo)" onclick="event.stopPropagation()">分享链接</button>\n </div>\n <div class="request-info">\n <span>${new Date(e.timestamp).toLocaleTimeString()}</span>\n <span>${e.duration?`${e.duration}ms`:"Pending"}</span>\n </div>\n <div class="request-details">\n ${this.renderRequestDetails(e)}\n </div>\n `,t.addEventListener("click",e=>{const n=e.target;n.closest(".share-btn")||n.closest('.detail-title[data-toggle="collapse"]')||t.classList.toggle("expanded")});const i=t.querySelector(".share-btn");return i&&i.addEventListener("click",async t=>{t.stopPropagation(),await this.shareRequest(e)}),t.addEventListener("click",e=>{const t=e.target;if(t.closest('.detail-title[data-toggle="collapse"]')){e.stopPropagation();const n=t.closest(".detail-title").parentElement;n&&n.classList.contains("collapsible")&&n.classList.toggle("collapsed")}},{capture:!0}),t}renderRequestDetails(e){let t="";return e.id.replace(/[^a-zA-Z0-9]/g,""),e.decryptedRequest&&(t+=`\n <div class="detail-section">\n <div class="detail-title highlight">解密请求数据</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.decryptedRequest)}</div>\n </div>\n </div>\n `),e.decryptedResponse&&(t+=`\n <div class="detail-section">\n <div class="detail-title highlight">解密响应数据</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.decryptedResponse)}</div>\n </div>\n </div>\n `),Object.keys(e.headers).length>0&&(t+=`\n <div class="detail-section collapsible collapsed">\n <div class="detail-title clickable" data-toggle="collapse">\n <span class="collapse-icon">▼</span> 请求头 (${Object.keys(e.headers).length})\n </div>\n <div class="detail-content">\n <table class="headers-table">\n ${Object.entries(e.headers).map(([e,t])=>`<tr><td>${e}</td><td>${t}</td></tr>`).join("")}\n </table>\n </div>\n </div>\n `),e.responseHeaders&&Object.keys(e.responseHeaders).length>0&&(t+=`\n <div class="detail-section collapsible collapsed">\n <div class="detail-title clickable" data-toggle="collapse">\n <span class="collapse-icon">▼</span> 响应头 (${Object.keys(e.responseHeaders).length})\n </div>\n <div class="detail-content">\n <table class="headers-table">\n ${Object.entries(e.responseHeaders).map(([e,t])=>`<tr><td>${e}</td><td>${t}</td></tr>`).join("")}\n </table>\n </div>\n </div>\n `),e.requestBody&&(t+=`\n <div class="detail-section">\n <div class="detail-title">${e.decryptedRequest?"原始请求数据":"请求数据"}</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.requestBody)}</div>\n </div>\n </div>\n `),e.responseBody&&(t+=`\n <div class="detail-section">\n <div class="detail-title">${e.decryptedResponse?"原始响应数据":"响应数据"}</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.responseBody)}</div>\n </div>\n </div>\n `),e.error&&(t+=`\n <div class="detail-section">\n <div class="detail-title">错误信息</div>\n <div class="detail-content">\n <div class="json-content" style="color: #f44336;">${e.error}</div>\n </div>\n </div>\n `),t}formatData(e){if("string"==typeof e)try{return Ye(JSON.parse(e))}catch{return e}return Ye(e)}getStatusClass(e){return e?e>=200&&e<300?"status-2xx":e>=300&&e<400?"status-3xx":e>=400&&e<500?"status-4xx":e>=500?"status-5xx":"status-error":"status-error"}truncateUrl(e){const t=e.indexOf("?");return t>-1?e.substring(0,t):e}switchTab(e){this.container.querySelectorAll(".debugger-tab").forEach(t=>{t.classList.toggle("active",t.dataset.tab===e)}),this.container.querySelectorAll("[data-panel]").forEach(t=>{t.style.display=t.getAttribute("data-panel")===e?"block":"none"}),this.currentTab=e}clearRequests(){this.requestsCache=[],this.interceptor.clearRequests(),this.renderRequests(),this.logToConsole("✅ 已清空网络请求记录")}exportData(){const e={timestamp:(new Date).toISOString(),requests:this.requestsCache,userAgent:navigator.userAgent,url:window.location.href,creator:"PWTK Network Debugger by Leo (@leeguoo)"},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`network-debug-${Date.now()}.json`,r.click(),URL.revokeObjectURL(n),this.logToConsole("💾 网络数据已导出 (by Leo)")}async shareRequest(e){try{this.logToConsole("📤 正在创建分享链接...");const t=await Ve(e);if(!t)throw new Error("无法创建分享链接");await async function(e){try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(e),!0;{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}}catch(t){return Xe.error("复制到剪贴板失败:",t),!1}}(t)?(this.logToConsole(`✅ 分享链接已复制到剪贴板: ${t}`),alert(`分享链接已复制到剪贴板!\n${t}\n\nCreated by Leo (@leeguoo)`)):(this.logToConsole(`✅ 分享链接: ${t}`),prompt("分享链接已创建,请手动复制:\n\nCreated by Leo (@leeguoo)",t))}catch(t){Xe.error("分享失败:",t),this.logToConsole(`❌ 分享失败: ${t}`),alert("分享失败,请稍后重试")}}toggleFullscreen(){this.container.classList.contains("fullscreen")?(this.container.classList.remove("fullscreen"),this.container.style.top="",this.container.style.left="",this.container.style.width="",this.container.style.height="",this.loadPosition()):(this.container.classList.add("fullscreen"),this.container.style.top="0",this.container.style.left="0",this.container.style.width="100vw",this.container.style.height="100vh",this.container.style.right="auto",this.container.style.bottom="auto")}handleToolAction(e){const t=this.container.querySelector(".tools-content textarea").value.trim();switch(e){case"parse-curl":this.handleParseCurl(t);break;case"export-har":this.exportHAR();break;case"cors-test":this.handleCorsTest(t);break;case"decrypt-test":this.handleDecryptTest(t)}}handleParseCurl(e){if(e)try{const t=function(e){const t=e.split("\\\n").map(e=>e.trim()).join(" "),n=t.match(/c?curl\s+['"]?([^'"\s]+)['"]?/);let r=n?n[1]:"";const o={},i=t.matchAll(/-H\s+['"]([^:]+):\s*([^'"]*)['"]/g);for(const d of i)o[d[1]]=d[2];let s;const a=t.match(/(?:--data-raw|--data|-d)\s+['"]({.+?})['"]/s);if(a){const e=a[1];try{s=JSON.parse(e)}catch{s=e}}if(!a&&r.includes("?"))try{const e=new URL(r,"http://example.com"),t={};e.searchParams.forEach((e,n)=>{t[n]=e}),Object.keys(t).length>0&&(s=1===Object.keys(t).length&&t.data?t.data:t)}catch(l){}const c=t.match(/-X\s+(['"]?)([A-Z]+)\1/);return{url:r,method:c?c[2]:a?"POST":"GET",headers:o,data:s}}(e);this.logToConsole("✅ cURL 解析成功:"),this.logToConsole(t)}catch(t){this.logToConsole(`❌ cURL 解析失败: ${t instanceof Error?t.message:String(t)}`,"error")}else this.logToConsole("❌ 请输入 cURL 命令")}exportHAR(){const e={log:{version:"1.2",creator:{name:"NetworkDebugger",version:"1.0.0",comment:"Created by Leo (@leeguoo)"},entries:this.requestsCache.map(e=>({startedDateTime:new Date(e.timestamp).toISOString(),time:e.duration||0,request:{method:e.method,url:e.url,headers:Object.entries(e.headers).map(([e,t])=>({name:e,value:t})),postData:e.requestBody?{mimeType:"application/json",text:"string"==typeof e.requestBody?e.requestBody:JSON.stringify(e.requestBody)}:void 0},response:{status:e.status||0,statusText:e.statusText||"",headers:e.responseHeaders?Object.entries(e.responseHeaders).map(([e,t])=>({name:e,value:t})):[],content:{size:0,mimeType:"application/json",text:e.responseBody?"string"==typeof e.responseBody?e.responseBody:JSON.stringify(e.responseBody):""}}}))}},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`network-har-${Date.now()}.har`,r.click(),URL.revokeObjectURL(n),this.logToConsole("💾 HAR 文件已导出")}handleCorsTest(e){e?(this.logToConsole(`🔍 开始 CORS 测试: ${e}`),fetch(e,{mode:"cors"}).then(e=>{this.logToConsole(`✅ CORS 测试成功: ${e.status} ${e.statusText}`)}).catch(e=>{this.logToConsole(`❌ CORS 测试失败: ${e.message}`)})):this.logToConsole("❌ 请输入要测试的 URL")}handleDecryptTest(e){e?this.logToConsole("🔓 解密测试功能开发中..."):this.logToConsole("❌ 请输入要解密的数据")}executeConsoleCommand(e){if(e.trim()){this.consoleHistory.push(e),this.logToConsole(`> ${e}`);try{const t=new Function("return "+e)();this.logToConsole(t)}catch(t){try{const t=new Function(e)();this.logToConsole(void 0!==t?t:"undefined")}catch(n){this.logToConsole(`❌ ${t}`,"error")}}}}logToConsole(e,t="log"){if(!this.consoleContent)return;const n=(new Date).toLocaleTimeString(),r="object"==typeof e?JSON.stringify(e,null,2):e,o=document.createElement("div");o.innerHTML=`[${n}] ${r}`,"error"===t?o.style.color="#f44336":"warn"===t&&(o.style.color="#ff9800"),this.consoleContent.appendChild(o),this.consoleContent.scrollTop=this.consoleContent.scrollHeight}startDrag(e){this.isDragging=!0,this.dragStart={x:e.clientX,y:e.clientY},this.container.style.transition="none"}startResize(e,t){this.isResizing=!0,this.dragStart={x:e.clientX,y:e.clientY},this.container.style.transition="none"(this.container).dataset.resizeDirection=t}handleMouseMove(e){if(this.isDragging){const t=e.clientX-this.dragStart.x,n=e.clientY-this.dragStart.y,r=this.container.getBoundingClientRect();this.container.style.left=`${r.left+t}px`,this.container.style.top=`${r.top+n}px`,this.dragStart={x:e.clientX,y:e.clientY}}if(this.isResizing){const t=this.container.dataset.resizeDirection;if(!t)return;const n=e.clientX-this.dragStart.x,r=e.clientY-this.dragStart.y,o=this.container.getBoundingClientRect(),i=300,s=200;let a=o.width,c=o.height,l=o.left,d=o.top;t.includes("e")&&(a=Math.max(i,o.width+n),this.container.style.width=`${a}px`),t.includes("s")&&(c=Math.max(s,o.height+r),this.container.style.height=`${c}px`),t.includes("w")&&(a=Math.max(i,o.width-n),a>i&&(l=o.left+n,this.container.style.width=`${a}px`,this.container.style.left=`${l}px`)),t.includes("n")&&(c=Math.max(s,o.height-r),c>s&&(d=o.top+r,this.container.style.height=`${c}px`,this.container.style.top=`${d}px`)),this.dragStart={x:e.clientX,y:e.clientY}}}handleMouseUp(){(this.isDragging||this.isResizing)&&(this.container.style.transition="all 0.3s ease",this.isDragging&&this.savePosition()),this.isDragging=!1,this.isResizing=!1,delete this.container.dataset.resizeDirection}handleWindowResize(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.adjustPositionForWindowResize()},100)}adjustPositionForWindowResize(){const e=this.container.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight;let r=!1,o=e.left,i=e.top,s=e.width,a=e.height;e.right>t&&(o=t-e.width,r=!0),e.bottom>n&&(i=n-e.height,r=!0),o<0&&(o=0,r=!0),i<0&&(i=0,r=!0),e.width>t&&(s=t-20,o=10,r=!0),e.height>n&&(a=n-20,i=10,r=!0),r&&(this.container.style.left=`${o}px`,this.container.style.top=`${i}px`,this.container.style.right="auto",this.container.style.bottom="auto",(e.width>t||e.height>n)&&(this.container.style.width=`${s}px`,this.container.style.height=`${a}px`),this.savePosition())}show(){this.container.style.display="block",this.removeReopenButton()}hide(){this.container.style.display="none",this.createReopenButton()}createReopenButton(){if(document.getElementById("network-debugger-reopen-btn"))return;const e=document.createElement("button");e.id="network-debugger-reopen-btn",e.className="debugger-reopen-btn",e.title="打开调试面板 (可拖动)",e.textContent="PWTK";const t=this.config.position||"bottom-right";t.includes("bottom")?e.style.bottom="20px":e.style.top="20px",t.includes("right")?e.style.right="20px":e.style.left="20px";let n=!1,r={x:0,y:0},o=null;e.addEventListener("mousedown",t=>{0===t.button&&(n=!1,r={x:t.clientX,y:t.clientY},e.style.transition="none",o=window.setTimeout(()=>{n=!0,e.style.cursor="grabbing"},150),t.preventDefault())});document.addEventListener("mousemove",t=>{if(!n)return;const o=t.clientX-r.x,i=t.clientY-r.y,s=e.getBoundingClientRect(),a=s.left+o,c=s.top+i,l=window.innerWidth-s.width,d=window.innerHeight-s.height,h=Math.max(0,Math.min(l,a)),u=Math.max(0,Math.min(d,c));e.style.position="fixed",e.style.left=`${h}px`,e.style.top=`${u}px`,e.style.right="auto",e.style.bottom="auto",r={x:t.clientX,y:t.clientY}}),document.addEventListener("mouseup",()=>{o&&(clearTimeout(o),o=null),n?(n=!1,e.style.cursor="pointer",e.style.transition="all 0.3s ease"):this.show()}),e.style.cursor="pointer",document.body.appendChild(e)}removeReopenButton(){const e=document.getElementById("network-debugger-reopen-btn");e&&e.remove()}destroy(){this.container.remove();const e=document.getElementById("network-debugger-styles");e&&e.remove(),this.removeReopenButton()}loadConfig(){try{const t=localStorage.getItem(e.STORAGE_KEY);if(t){const e=JSON.parse(t);return Xe.debug("加载保存的配置:",e),e}}catch(t){Xe.error("加载配置失败:",t)}return{}}saveConfig(){try{const t={position:this.config.position,theme:this.config.theme,minimized:this.config.minimized,showConsole:this.config.showConsole};localStorage.setItem(e.STORAGE_KEY,JSON.stringify(t)),Xe.debug("配置已保存:",t)}catch(t){Xe.error("保存配置失败:",t)}}loadPosition(){try{const t=`${e.STORAGE_KEY}-position`,n=localStorage.getItem(t);if(n){const e=JSON.parse(n);void 0!==e.left&&(this.container.style.left=e.left+"px"),void 0!==e.top&&(this.container.style.top=e.top+"px"),void 0!==e.right&&(this.container.style.right=e.right+"px"),void 0!==e.bottom&&(this.container.style.bottom=e.bottom+"px"),Xe.debug("加载保存的位置:",e)}}catch(t){Xe.error("加载位置失败:",t)}}savePosition(){try{const t=`${e.STORAGE_KEY}-position`,n=this.container.getBoundingClientRect(),r={left:n.left,top:n.top,right:window.innerWidth-n.right,bottom:window.innerHeight-n.bottom};localStorage.setItem(t,JSON.stringify(r)),Xe.debug("位置已保存:",r)}catch(t){Xe.error("保存位置失败:",t)}}};Ze.STORAGE_KEY="pwtk-debugger-config";let Qe=Ze;class et{constructor(){this.interceptor=null,this.panel=null,this.wasmLoader=null,this.config={},this.initialized=!1}async init(e={}){if(this.initialized)Xe.warn("NetworkDebugger already initialized");else{this.config={autoStart:!0,position:"bottom-right",theme:"dark",minimized:!1,showConsole:!0,wasm:{enabled:!0,...e.wasm},decrypt:{enabled:!0,autoFetchKeys:!0,keyApiUrl:"https://gw-card-pay.buyacard.cc/ip/getSK",...e.decrypt},log:{toBrowserConsole:!1,level:"info",...e.log},...e},Xe.configure({enableBrowserConsole:this.config.log?.toBrowserConsole||!1,logLevel:this.config.log?.level||"info"});try{if(!1!==this.config.wasm?.enabled){Xe.info("[PWTK Init] Starting WASM initialization"),this.wasmLoader=new Ge;await this.wasmLoader.loadWasm(this.config.wasm?.wasmUrl,this.config.wasm?.jsUrl)?Xe.info("[PWTK Init] ✅ WASM decrypt function ready"):Xe.warn("[PWTK Init] ⚠️ WASM load failed or decrypt function unavailable, will rely on page-provided decryption")}else Xe.info("[PWTK Init] WASM disabled in config");this.interceptor=new Je,this.config.decrypt?.enabled&&this.interceptor.enableDecryption({keyExtractor:this.config.decrypt.keyExtractor||this.defaultKeyExtractor,slkExtractor:this.config.decrypt.slkExtractor||this.defaultSlkExtractor,autoFetchKeys:this.config.decrypt.autoFetchKeys,keyApiUrl:this.config.decrypt.keyApiUrl}),!1!==this.config.autoStart&&this.createPanel(),this.initialized=!0,Xe.consoleDirect("\n╔════════════════════════════════════════╗\n║ 🔓 PWTK 解密小工具 v1.2.34 ║\n║ Created by Leo (@leeguoo) ║\n║ 技术支持: 请联系 Leo ║ \n║ 分享服务: curl.bwg.leeguoo.com ║\n╚════════════════════════════════════════╝\n "),Xe.info("🔍 NetworkDebugger initialized successfully")}catch(t){throw Xe.error("NetworkDebugger initialization failed:",t),t}}}show(){this.initialized?this.panel?this.panel.show():this.createPanel():Xe.error("NetworkDebugger not initialized. Call init() first.")}hide(){this.panel&&this.panel.hide()}destroy(){this.panel&&(this.panel.destroy(),this.panel=null),this.initialized=!1,Xe.info("NetworkDebugger destroyed")}getRequests(){return this.interceptor?.getRequests()||[]}clearRequests(){this.interceptor?.clearRequests()}exportData(){return{timestamp:(new Date).toISOString(),requests:this.getRequests(),config:this.config,userAgent:navigator.userAgent,url:window.location.href,author:"Leo (@leeguoo)",tool:"@leeguoo/network-debugger"}}isWasmLoaded(){return this.wasmLoader?.isLoaded()||!1}isInitialized(){return this.initialized}static create(e){const t=new et;return t.init(e).then(()=>t)}createPanel(){this.interceptor?this.panel=new Qe(this.interceptor,{position:this.config.position,theme:this.config.theme,minimized:this.config.minimized,showConsole:this.config.showConsole}):Xe.error("Cannot create panel: interceptor not initialized")}defaultKeyExtractor(e){return e.keys||e.cid||e["x-api-key"]||""}defaultSlkExtractor(e){return e.slk||e["x-slk"]||""}}let tt=null;const nt={init:async e=>tt?(Xe.warn("NetworkDebugger already has a global instance"),tt):(tt=await et.create(e),"undefined"!=typeof window&&(window.NetworkDebugger=tt),tt),show(){tt?.show()},hide(){tt?.hide()},destroy(){tt?.destroy(),tt=null,"undefined"!=typeof window&&delete window.NetworkDebugger},getInstance:()=>tt};e.DebugPanel=Qe,e.NetworkDebugger=et,e.NetworkInterceptor=Je,e.WasmLoader=Ge,e.default=nt,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
18
+ function(){var t=e,n=t.lib,r=n.WordArray,o=n.Hasher,i=t.algo,s=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=r.create([0,1518500249,1859775393,2400959708,2840853838]),h=r.create([1352829926,1548603684,1836072691,2053994217,0]),u=i.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,o=e[r];e[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,u,w,x,m,k,_,S,B,C,D,T=this._hash.words,R=d.words,A=h.words,z=s.words,E=a.words,P=c.words,W=l.words;for(k=i=T[0],_=u=T[1],S=w=T[2],B=x=T[3],C=m=T[4],n=0;n<80;n+=1)D=i+e[t+z[n]]|0,D+=n<16?p(u,w,x)+R[0]:n<32?g(u,w,x)+R[1]:n<48?f(u,w,x)+R[2]:n<64?y(u,w,x)+R[3]:b(u,w,x)+R[4],D=(D=v(D|=0,P[n]))+m|0,i=m,m=x,x=v(w,10),w=u,u=D,D=k+e[t+E[n]]|0,D+=n<16?b(_,S,B)+A[0]:n<32?y(_,S,B)+A[1]:n<48?f(_,S,B)+A[2]:n<64?g(_,S,B)+A[3]:p(_,S,B)+A[4],D=(D=v(D|=0,W[n]))+C|0,k=C,C=B,B=v(S,10),S=_,_=D;D=T[1]+w+B|0,T[1]=T[2]+x+C|0,T[2]=T[3]+m+k|0,T[3]=T[4]+i+_|0,T[4]=T[0]+u+S|0,T[0]=D},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,s=0;s<5;s++){var a=i[s];i[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,n){return e^t^n}function g(e,t,n){return e&t|~e&n}function f(e,t,n){return(e|~t)^n}function y(e,t,n){return e&n|t&~n}function b(e,t,n){return e^(t|~n)}function v(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(u),t.HmacRIPEMD160=o._createHmacHelper(u)}(),e.RIPEMD160)),j.exports;var e}(),X(),function(){return J||(J=1,G.exports=(l=c(),E(),X(),t=(e=l).lib,n=t.Base,r=t.WordArray,o=e.algo,i=o.SHA256,s=o.HMAC,a=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,o=s.create(n.hasher,e),i=r.create(),a=r.create([1]),c=i.words,l=a.words,d=n.keySize,h=n.iterations;c.length<d;){var u=o.update(t).finalize(a);o.reset();for(var p=u.words,g=p.length,f=u,y=1;y<h;y++){f=o.finalize(f),o.reset();for(var b=f.words,v=0;v<g;v++)p[v]^=b[v]}i.concat(u),l[0]++}return i.sigBytes=4*d,i}}),e.PBKDF2=function(e,t,n){return a.create(n).compute(e,t)},l.PBKDF2)),G.exports;var e,t,n,r,o,i,s,a,l}(),Z(),te(),function(){return ne||(ne=1,re.exports=(e=c(),te(),e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var o,i=this._iv;i?(o=i.slice(0),this._iv=void 0):o=this._prevBlock,r.encryptBlock(o,0);for(var s=0;s<n;s++)e[t+s]^=o[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize;n.call(this,e,t,o,r),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=e.slice(t,t+o);n.call(this,e,t,o,r),this._prevBlock=i}}),t}(),e.mode.CFB)),re.exports;var e}(),function(){return oe||(oe=1,ie.exports=(n=c(),te(),n.mode.CTR=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var s=i.slice(0);n.encryptBlock(s,0),i[r-1]=i[r-1]+1|0;for(var a=0;a<r;a++)e[t+a]^=s[a]}}),e.Decryptor=t,e),n.mode.CTR)),ie.exports;var e,t,n}(),ce(),function(){return le||(le=1,de.exports=(n=c(),te(),n.mode.OFB=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),n.encryptBlock(i,0);for(var s=0;s<r;s++)e[t+s]^=i[s]}}),e.Decryptor=t,e),n.mode.OFB)),de.exports;var e,t,n}(),function(){return he||(he=1,ue.exports=(t=c(),te(),t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e),t.mode.ECB)),ue.exports;var e,t}(),function(){return pe||(pe=1,ge.exports=(e=c(),te(),e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,o=r-n%r,i=n+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923)),ge.exports;var e}(),function(){return fe||(fe=1,ye.exports=(e=c(),te(),e.pad.Iso10126={pad:function(t,n){var r=4*n,o=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126)),ye.exports;var e}(),function(){return be||(be=1,ve.exports=(e=c(),te(),e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971)),ve.exports;var e}(),function(){return we||(we=1,xe.exports=(e=c(),te(),e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding)),xe.exports;var e}(),function(){return me||(me=1,ke.exports=(e=c(),te(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding)),ke.exports;var e}(),function(){return _e||(_e=1,Se.exports=(r=c(),te(),t=(e=r).lib.CipherParams,n=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var r=n.parse(e);return t.create({ciphertext:r})}},r.format.Hex)),Se.exports;var e,t,n,r}(),function(){return Be||(Be=1,Ce.exports=(e=c(),x(),C(),Z(),te(),function(){var t=e,n=t.lib.BlockCipher,r=t.algo,o=[],i=[],s=[],a=[],c=[],l=[],d=[],h=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var g=r^r<<1^r<<2^r<<3^r<<4;g=g>>>8^255&g^99,o[n]=g,i[g]=n;var f=e[n],y=e[f],b=e[y],v=257*e[g]^16843008*g;s[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,c[n]=v<<8|v>>>24,l[n]=v,v=16843009*b^65537*y^257*f^16843008*n,d[g]=v<<24|v>>>8,h[g]=v<<16|v>>>16,u[g]=v<<8|v>>>24,p[g]=v,n?(n=f^e[e[e[b^f]]],r^=e[e[r]]):n=r=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],f=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],s=0;s<r;s++)s<n?i[s]=t[s]:(l=i[s-1],s%n?n>6&&s%n==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=g[s/n|0]<<24),i[s]=i[s-n]^l);for(var a=this._invKeySchedule=[],c=0;c<r;c++){if(s=r-c,c%4)var l=i[s];else l=i[s-4];a[c]=c<4||s<=4?l:d[o[l>>>24]]^h[o[l>>>16&255]]^u[o[l>>>8&255]]^p[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,l,o)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,d,h,u,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,o,i,s,a){for(var c=this._nRounds,l=e[t]^n[0],d=e[t+1]^n[1],h=e[t+2]^n[2],u=e[t+3]^n[3],p=4,g=1;g<c;g++){var f=r[l>>>24]^o[d>>>16&255]^i[h>>>8&255]^s[255&u]^n[p++],y=r[d>>>24]^o[h>>>16&255]^i[u>>>8&255]^s[255&l]^n[p++],b=r[h>>>24]^o[u>>>16&255]^i[l>>>8&255]^s[255&d]^n[p++],v=r[u>>>24]^o[l>>>16&255]^i[d>>>8&255]^s[255&h]^n[p++];l=f,d=y,h=b,u=v}f=(a[l>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^n[p++],y=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^n[p++],b=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&d])^n[p++],v=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^n[p++],e[t]=f,e[t+1]=y,e[t+2]=b,e[t+3]=v},keySize:8});t.AES=n._createHelper(f)}(),e.AES)),Ce.exports;var e}(),Re(),function(){return Ae||(Ae=1,ze.exports=(e=c(),x(),C(),Z(),te(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=r.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,r=this._S=[],o=0;o<256;o++)r[o]=o;o=0;for(var i=0;o<256;o++){var s=o%n,a=t[s>>>2]>>>24-s%4*8&255;i=(i+r[o]+a)%256;var c=r[o];r[o]=r[i],r[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,n=this._j,r=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[n],e[n]=i,r|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,r}t.RC4=n._createHelper(o);var s=r.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=n._createHelper(s)}(),e.RC4)),ze.exports;var e}(),function(){return Ee||(Ee=1,Pe.exports=(e=c(),x(),C(),Z(),te(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)o[n]^=r[n+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(o[0]^=l,o[1]^=h,o[2]^=d,o[3]^=u,o[4]^=l,o[5]^=h,o[6]^=d,o[7]^=u,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.Rabbit=n._createHelper(a)}(),e.Rabbit)),Pe.exports;var e}(),function(){return We||(We=1,qe.exports=(e=c(),x(),C(),Z(),te(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)r[o]^=n[o+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(r[0]^=l,r[1]^=h,r[2]^=d,r[3]^=u,r[4]^=l,r[5]^=h,r[6]^=d,r[7]^=u,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.RabbitLegacy=n._createHelper(a)}(),e.RabbitLegacy)),qe.exports;var e}(),Ke())),o.exports));const Xe=new class{constructor(){this.panel=null,this.enableBrowserConsole=!1,this.logLevel="debug",this.buffer=[],this.maxBufferSize=100,this.enableBrowserConsole=!1,this.logLevel="debug"}configure(e){void 0!==e.enableBrowserConsole&&(this.enableBrowserConsole=e.enableBrowserConsole),void 0!==e.logLevel&&(this.logLevel=e.logLevel)}setPanel(e){this.panel=e,this.flushBuffer()}flushBuffer(){this.panel&&(this.buffer.forEach(({message:e,type:t})=>{this.panel.logToConsole(e,t)}),this.buffer=[])}shouldLog(e){const t=["debug","info","warn","error"],n=t.indexOf(this.logLevel);return t.indexOf(e)>=n}formatMessage(e,t,n){const r=n.map(e=>{if("object"==typeof e)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}).join(" ");return r?`${t} ${r}`:t}output(e,t,n){this.panel?this.panel.logToConsole(e,t):(this.buffer.push({message:e,type:t,timestamp:new Date}),this.buffer.length>this.maxBufferSize&&this.buffer.shift()),this.enableBrowserConsole}debug(e,...t){if(!this.shouldLog("debug"))return;const n=this.formatMessage("[DEBUG]",e,t);this.output(n,"log","log")}log(e,...t){if(!this.shouldLog("info"))return;const n=this.formatMessage("",e,t);this.output(n,"log","log")}info(e,...t){if(!this.shouldLog("info"))return;const n=this.formatMessage("[INFO]",e,t);this.output(n,"log","log")}warn(e,...t){if(!this.shouldLog("warn"))return;const n=this.formatMessage("[WARN]",e,t);this.output(n,"warn","warn")}error(e,...t){if(!this.shouldLog("error"))return;const n=this.formatMessage("[ERROR]",e,t);this.output(n,"error","error")}consoleDirect(e,...t){}};class Je{constructor(){this.requests=new Map,this.listeners=[],this.decryptConfig={enabled:!1},window.__originalFetch=window.fetch,this.interceptXHR(),this.interceptFetch()}enableDecryption(e){this.decryptConfig.enabled=!0,e?.keyExtractor&&(this.decryptConfig.keyExtractor=e.keyExtractor),e?.slkExtractor&&(this.decryptConfig.slkExtractor=e.slkExtractor),void 0!==e?.autoFetchKeys&&(this.decryptConfig.autoFetchKeys=e.autoFetchKeys),e?.keyApiUrl&&(this.decryptConfig.keyApiUrl=e.keyApiUrl)}addListener(e){this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}getRequests(){return Array.from(this.requests.values()).sort((e,t)=>t.timestamp-e.timestamp)}clearRequests(){this.requests.clear()}generateRequestId(){return Math.random().toString(36).substr(2,9)}isInternalUrl(e){return e.includes("/api/dokv/storage")||e.includes("/api/share")}notifyListeners(e){this.listeners.forEach(t=>{try{t(e)}catch(n){Xe.warn("NetworkDebugger: Listener error:",n)}})}extractUrlParams(e){try{const t=new URL(e),n={};return t.searchParams.forEach((e,t)=>{n[t]=e}),Object.keys(n).length>0?1===Object.keys(n).length&&n.data?n.data:n:null}catch(t){return null}}async tryDecrypt(e,t){if(Xe.debug("[PWTK Debug] tryDecrypt called:",{dataType:typeof e,dataLength:"string"==typeof e?e.length:JSON.stringify(e).length,dataPreview:"string"==typeof e?e.substring(0,100):JSON.stringify(e).substring(0,100),headers:Object.keys(t),decryptEnabled:this.decryptConfig.enabled,hasWindowDecrypt:"function"==typeof window.decrypt}),!this.decryptConfig.enabled||!e)return Xe.debug("[PWTK Debug] Decrypt disabled or no data"),null;try{let r="",o="";if(t.cid&&!1!==this.decryptConfig.autoFetchKeys){Xe.debug("[PWTK Debug] Trying to fetch key with cid:",t.cid);try{const e=this.decryptConfig.keyApiUrl||"https://gw-card-pay.buyacard.cc/ip/getSK",n={cid:t.cid,client:t.client||"S_WEB",device:t.device||"Web",language:t.language||"CN"};Xe.debug("[PWTK Debug] Fetching key from:",e,"with headers:",n);const o=window.__originalFetch||window.fetch,i=await o(e,{headers:n}),s=await i.json();if(Xe.debug("[PWTK Debug] getSK API response:",s),s.success&&s.data){const e=String(s.data);Xe.debug("[PWTK Debug] getSK returned num:",e,"length:",e.length),e.length>=9?(r=e.charAt(2)+e.charAt(5)+e.charAt(8),Xe.debug("[PWTK Debug] Extracted key from getSK:",r)):Xe.debug("[PWTK Debug] getSK num too short:",e)}else Xe.debug("[PWTK Debug] getSK failed:",s)}catch(n){Xe.warn("[PWTK Debug] getSK API error:",n)}}else Xe.debug("[PWTK Debug] No cid or autoFetchKeys disabled");!r&&this.decryptConfig.keyExtractor?(r=this.decryptConfig.keyExtractor(t),Xe.debug("[PWTK Debug] Key from custom extractor:",r)):r||(r=t.decryptKey||t.keys||t.cid||"",Xe.debug("[PWTK Debug] Key from headers:",r,"from:",t.decryptKey?"decryptKey":t.keys?"keys":t.cid?"cid":"none")),this.decryptConfig.slkExtractor?(o=this.decryptConfig.slkExtractor(t),Xe.debug("[PWTK Debug] SLK from custom extractor:",o)):(o=t.decryptSlk||t.slk||"",Xe.debug("[PWTK Debug] SLK from headers:",o,"from:",t.decryptSlk?"decryptSlk":t.slk?"slk":"none"));const i=r+o;if(Xe.debug("[PWTK Debug] Full decrypt key:",i?`"${i}" (length: ${i.length})`:"empty"),i){let t=e,r=!1;if("object"==typeof e&&null!==e&&e.data&&"string"==typeof e.data)Xe.debug('[PWTK Debug] Data is wrapped in {"data": "..."} format, extracting inner data'),t=e.data,r=!0;else if("string"==typeof e)try{const n=JSON.parse(e);n.data&&"string"==typeof n.data&&(Xe.debug("[PWTK Debug] Data is JSON string with data field, extracting"),t=n.data,r=!0)}catch{}const o="string"==typeof t?t:JSON.stringify(t);Xe.debug("[PWTK Debug] Calling decrypt with:",{dataLength:o.length,dataPreview:o.substring(0,50),key:i,isWrapped:r});const s=function(e,t){if(Xe.debug("[PWTK Decrypt] decrypt function called:",{dataLength:e?.length,dataPreview:e?.substring(0,50),keyStr:t,hasWindowDecrypt:"function"==typeof window.decrypt,hasWindowEncrypt:"function"==typeof window.encrypt}),!e||e.startsWith("{")||e.startsWith("[")){Xe.debug("[PWTK Decrypt] Data looks like JSON, parsing directly");try{const t=JSON.parse(e);return Xe.debug("[PWTK Decrypt] Successfully parsed as JSON"),t}catch{return Xe.debug("[PWTK Decrypt] Failed to parse as JSON, returning as string"),e}}if(window.decrypt&&t){Xe.debug("[PWTK Decrypt] Trying WebAssembly decrypt"),Xe.debug("[PWTK Decrypt] Input to window.decrypt:",{data:e.substring(0,100)+"...",key:t});try{const n=window.decrypt(e,t);if(Xe.debug("[PWTK Decrypt] window.decrypt returned:",{type:typeof n,length:n?.length,preview:n?n.substring(0,200)+(n.length>200?"...":""):null,sameAsInput:n===e,hasInvalidChars:n?.includes("�")}),n&&n!==e&&!n.includes("�"))try{const e=JSON.parse(n);return Xe.debug("[PWTK Decrypt] ✅ WebAssembly decryption successful, parsed as JSON:",e),e}catch{if(n.length>0)return Xe.debug("[PWTK Decrypt] ✅ WebAssembly decryption successful, returning as string"),n}else Xe.debug("[PWTK Decrypt] window.decrypt did not change the data or returned invalid result")}catch(n){Xe.debug("[PWTK Decrypt] WebAssembly decrypt error:",n)}}else Xe.debug("[PWTK Decrypt] WebAssembly not available:",{hasWindowDecrypt:!!window.decrypt,hasKey:!!t,windowDecryptType:typeof window.decrypt});const r=[t,"thisisakey123456","VITE_CRYPTO_KEY"].filter(Boolean);for(const o of r)if(o)try{const t=Ie.enc.Utf8.parse(o.padEnd(16,"0").slice(0,16)),n=Ie.enc.Utf8.parse(o.padEnd(16,"0").slice(0,16)),r=Ie.AES.decrypt(e,t,{iv:n,mode:Ie.mode.CBC,padding:Ie.pad.Pkcs7}).toString(Ie.enc.Utf8);if(r)try{return JSON.parse(r)}catch{return r}}catch(n){}try{const t=atob(e);try{return JSON.parse(t)}catch{return t}}catch{}return Xe.debug("[PWTK Decrypt] ❌ All decryption methods failed, returning original data"),e}(o,i);if(Xe.debug("[PWTK Debug] Decrypt result:",{success:s&&s!==o,decryptedType:typeof s,decryptedLength:s?"string"==typeof s?s.length:JSON.stringify(s).length:0,preview:s?"string"==typeof s?s.substring(0,100):JSON.stringify(s).substring(0,100):null}),s&&s!==o)return Xe.debug("[PWTK Debug] ✅ Decryption successful! Result:",s),s;Xe.debug("[PWTK Debug] ❌ Decryption failed or returned same data")}else Xe.debug("[PWTK Debug] No key available, skipping decryption")}catch(r){Xe.error("[PWTK Debug] tryDecrypt error:",r)}return Xe.debug("[PWTK Debug] tryDecrypt returning null"),null}interceptXHR(){const e=window.XMLHttpRequest,t=this;window.XMLHttpRequest=function(...n){const r=new e(...n),o=t.generateRequestId();let i="",s="",a={};const c=Date.now();let l=!1;const d=r.open;r.open=function(e,n,...r){return i=e.toUpperCase(),s=n,l=t.isInternalUrl(s),d.apply(this,[e,n,...r])};const h=r.setRequestHeader;r.setRequestHeader=function(e,t){return a[e]=t,h.call(this,e,t)};const u=r.send;return r.send=function(e){if(l)return u.call(this,e);const n={id:o,url:s,method:i,headers:{...a},requestBody:e,timestamp:c};let r=e;return"GET"!==i||e||(r=t.extractUrlParams(s),r&&(n.requestBody=r)),r&&t.tryDecrypt(r,a).then(e=>{null!==e&&(n.decryptedRequest=e,t.requests.set(o,n),Xe.debug("[PWTK Debug] Request decrypted, notifying UI"),t.notifyListeners(n))}).catch(e=>Xe.warn("解密请求失败:",e)),t.requests.set(o,n),t.notifyListeners(n),u.call(this,e)},r.addEventListener("readystatechange",function(){if(Xe.debug("[PWTK Debug] XHR state changed:",{readyState:r.readyState,readyStateName:["UNSENT","OPENED","HEADERS_RECEIVED","LOADING","DONE"][r.readyState],status:r.status,isInternal:l,requestId:o,url:s}),Xe.debug("[PWTK Debug] Checking response condition:",{readyState:r.readyState,isDone:4===r.readyState,XMLHttpRequestDONE:"undefined"!=typeof XMLHttpRequest?XMLHttpRequest.DONE:"undefined",isInternal:l,shouldProcess:4===r.readyState&&!l}),4===r.readyState&&!l){Xe.debug("[PWTK Debug] XHR completed, processing response");const e=Date.now(),n=t.requests.get(o);if(n){Xe.debug("[PWTK Debug] Found request data, updating with response"),n.status=r.status,n.statusText=r.statusText,n.duration=e-c;const i={},s=r.getAllResponseHeaders();s&&s.split("\r\n").forEach(e=>{const t=e.split(": ");2===t.length&&(i[t[0]]=t[1])}),n.responseHeaders=i;const l=null!==r.responseText&&void 0!==r.responseText&&""!==r.responseText;if(Xe.debug("[PWTK Debug] XHR Response received:",{status:n.status,hasResponseText:l,responseTextLength:r.responseText?.length,responseTextPreview:r.responseText?.substring(0,100)}),l)try{n.responseBody=JSON.parse(r.responseText),Xe.debug("[PWTK Debug] Response parsed as JSON:",n.responseBody)}catch{n.responseBody=r.responseText,Xe.debug("[PWTK Debug] Response kept as text")}else n.responseBody=null,Xe.debug("[PWTK Debug] No response body");Xe.debug("[PWTK Debug] Updating request with response data"),t.requests.set(o,n),t.notifyListeners(n),n.responseBody&&t.tryDecrypt(n.responseBody,{...a,...i}).then(e=>{null!==e&&(n.decryptedResponse=e,t.requests.set(o,n),Xe.debug("[PWTK Debug] Response decrypted, notifying UI:",e),t.notifyListeners(n))}).catch(e=>Xe.warn("解密响应失败:",e))}else Xe.debug("[PWTK Debug] WARNING: Request data not found for ID:",o)}}),r},window.XMLHttpRequest.prototype=e.prototype}interceptFetch(){const e=window.__originalFetch||window.fetch,t=this;window.fetch=async function(n,r){const o=t.generateRequestId(),i=Date.now(),s="string"==typeof n?n:n instanceof URL?n.toString():n.url,a=(r?.method||"GET").toUpperCase();if(t.isInternalUrl(s))return e.call(this,n,r);const c={};r?.headers&&(r.headers instanceof Headers?r.headers.forEach((e,t)=>{c[t]=e}):Array.isArray(r.headers)?r.headers.forEach(([e,t])=>{c[e]=t}):Object.entries(r.headers).forEach(([e,t])=>{c[e]=t}));let l=null;if(r?.body)if("string"==typeof r.body)try{l=JSON.parse(r.body)}catch{l=r.body}else l=r.body;const d={id:o,url:s,method:a,headers:{...c},requestBody:l,timestamp:i};let h=l;"GET"!==a||l||(h=t.extractUrlParams(s),h&&(d.requestBody=h)),h&&t.tryDecrypt(h,c).then(e=>{null!==e&&(d.decryptedRequest=e,t.requests.set(o,d),Xe.debug("[PWTK Debug] Fetch request decrypted, notifying UI"),t.notifyListeners(d))}).catch(e=>Xe.warn("解密请求失败:",e)),t.requests.set(o,d),t.notifyListeners(d);try{const s=await e.call(this,n,r),a=Date.now(),l=s.clone(),d=t.requests.get(o);if(d){d.status=s.status,d.statusText=s.statusText,d.duration=a-i;const e={};s.headers.forEach((t,n)=>{e[n]=t}),d.responseHeaders=e;try{const n=await l.text();Xe.debug("[PWTK Debug] Fetch Response received:",{status:d.status,textLength:n.length,textPreview:n.substring(0,100)});try{d.responseBody=JSON.parse(n)}catch{d.responseBody=n}t.requests.set(o,d),t.notifyListeners(d),d.responseBody&&t.tryDecrypt(d.responseBody,{...c,...e}).then(e=>{null!==e&&(d.decryptedResponse=e,t.requests.set(o,d),Xe.debug("[PWTK Debug] Fetch response decrypted, notifying UI:",e),t.notifyListeners(d))}).catch(e=>Xe.warn("解密响应失败:",e))}catch(u){d.error=`Failed to read response: ${u}`,t.requests.set(o,d),t.notifyListeners(d)}}return s}catch(u){const e=Date.now(),n=t.requests.get(o);throw n&&(n.error=u instanceof Error?u.message:String(u),n.duration=e-i,t.requests.set(o,n),t.notifyListeners(n)),u}}}}class Ge{constructor(){this.loaded=!1,this.loading=!1}async loadWasm(e,t){if(Xe.debug("[PWTK WASM] loadWasm called"),Xe.debug("[PWTK WASM] Current state:",{hasWindowDecrypt:"function"==typeof window.decrypt,hasWindowEncrypt:"function"==typeof window.encrypt,hasWindowGo:void 0!==window.Go}),"function"==typeof window.decrypt)return Xe.debug("[PWTK WASM] window.decrypt already exists, skipping WASM load"),this.loaded=!0,!0;if(this.loaded)return!0;if(this.loading)return new Promise(e=>{const t=()=>{this.loaded||!this.loading?e(this.loaded):setTimeout(t,100)};t()});this.loading=!0;try{const i=[e,"/mimlib.wasm","/dist/mimlib.wasm","/assets/mimlib.wasm","https://gw-card-pay.buyacard.cc/mimlib.wasm"].filter(Boolean),s=[t,"/wasm_exec.js","/dist/wasm_exec.js","/assets/wasm_exec.js","https://gw-card-pay.buyacard.cc/wasm_exec.js"].filter(Boolean);let a=!1;for(const e of s)try{if(await this.loadScript(e),void 0!==window.Go){a=!0,Xe.debug("[PWTK WASM] wasm_exec.js loaded successfully from:",e);break}}catch(n){Xe.warn("NetworkDebugger: 尝试加载",e,"失败:",n);continue}if(!a)throw new Error("Unable to load wasm_exec.js from any path");if(void 0===window.Go)throw new Error("Go WebAssembly runtime not available");const c=new window.Go;let l=null;for(const e of i)try{if(!WebAssembly.instantiateStreaming){const t=await fetch(e).then(e=>e.arrayBuffer());l=await WebAssembly.instantiate(t,c.importObject),Xe.info("NetworkDebugger: WebAssembly 加载成功(传统方式):",e);break}try{l=await WebAssembly.instantiateStreaming(fetch(e),c.importObject),Xe.info("NetworkDebugger: WebAssembly 加载成功:",e);break}catch(r){Xe.warn("instantiateStreaming 失败,尝试传统方式:",r);const t=await fetch(e).then(e=>e.arrayBuffer());l=await WebAssembly.instantiate(t,c.importObject),Xe.info("NetworkDebugger: WebAssembly 加载成功(传统方式):",e);break}}catch(o){Xe.warn("NetworkDebugger: 尝试加载",e,"失败:",o);continue}if(!l)throw new Error("Unable to load WebAssembly from any path");return c.run(l.instance),await new Promise(e=>setTimeout(e,100)),Xe.debug("[PWTK WASM] After WASM load, checking functions:",{hasDecrypt:"function"==typeof window.decrypt,hasEncrypt:"function"==typeof window.encrypt,windowKeys:Object.keys(window).filter(e=>e.includes("crypt"))}),"function"==typeof window.decrypt?(this.loaded=!0,Xe.debug("[PWTK WASM] ✅ WebAssembly loaded successfully, decrypt function available"),!0):(Xe.warn("[PWTK WASM] ❌ WebAssembly loaded but decrypt function not available"),!1)}catch(o){return Xe.error("[PWTK WASM] WebAssembly loading failed:",o),!1}finally{this.loading=!1,Xe.debug("[PWTK WASM] Load complete, final state:",{loaded:this.loaded,hasDecrypt:"function"==typeof window.decrypt})}}loadScript(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return void t();const r=document.createElement("script");r.src=e,r.type="text/javascript",r.onload=()=>t(),r.onerror=t=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}isLoaded(){return this.loaded}isLoading(){return this.loading}isDecryptAvailable(){return this.loaded&&"function"==typeof window.decrypt}isEncryptAvailable(){return this.loaded&&"function"==typeof window.encrypt}}function Ye(e){return JSON.stringify(e,null,2)}async function Ve(e){try{const n=function(e){let t=`curl '${e.url}'`;"GET"!==e.method&&(t+=` -X ${e.method}`);e.headers&&Object.entries(e.headers).forEach(([e,n])=>{t+=` -H '${e}: ${n}'`});if(e.requestBody){const n="string"==typeof e.requestBody?e.requestBody:JSON.stringify(e.requestBody);t+=` --data '${n}'`}return t}(e),r={curl:n,response:e.responseBody||null,timestamp:Date.now(),slk:e.headers?.slk||"",debuggerData:{url:e.url,method:e.method,headers:e.headers,status:e.status,statusText:e.statusText,duration:e.duration,responseHeaders:e.responseHeaders,decryptedRequest:e.decryptedRequest,decryptedResponse:e.decryptedResponse,error:e.error,creator:"PWTK Network Debugger by Leo (@leeguoo)",version:"1.2.26"}},o=window.__originalFetch||window.fetch,i="https://curl.bwg.leeguoo.com/api/share";let s;Xe.debug("使用分享API:",i);try{s=await o(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:r})})}catch(t){if("TypeError"===t.name&&t.message.includes("fetch"))throw new Error(`网络连接失败: 无法连接到分享服务器 (${i}). 可能原因: CORS策略限制或网络问题`);throw t}if(!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);const a=await s.json();if(a.shareId){const e=`https://curl.bwg.leeguoo.com/share/${a.shareId}`;return Xe.info(`🔗 分享链接创建成功 (by Leo): ${e}`),e}throw new Error(a.error||"创建分享失败")}catch(n){const e=n.message||n.toString()||"未知错误";throw Xe.error("NetworkDebugger: 创建分享链接失败:",{message:e,name:n.name,stack:n.stack?.split("\n")[0]}),new Error(e)}}const Ze=class e{constructor(e,t={}){this.isDragging=!1,this.isResizing=!1,this.dragStart={x:0,y:0},this.resizeTimeout=null,this.resizeDirection="",this.currentTab="network",this.consoleHistory=[],this.requestsCache=[],this.interceptor=e;const n=this.loadConfig();this.config={position:"bottom-right",theme:"dark",minimized:!1,showConsole:!0,...n,...t},this.createPanel(),this.bindEvents(),this.startListening(),Xe.setPanel(this),this.loadPosition()}createPanel(){if(!document.getElementById("network-debugger-styles")){const e=document.createElement("style");e.id="network-debugger-styles",e.textContent="\n/* NetworkDebugger 样式 */\n#network-debugger-panel {\n position: fixed;\n z-index: 999999;\n background: #1a1a1a;\n color: #ffffff;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n border-radius: 8px;\n overflow: hidden;\n max-width: 90vw;\n max-height: 80vh;\n transition: all 0.3s ease;\n}\n\n#network-debugger-panel.minimized {\n height: 35px !important;\n overflow: hidden;\n width: 160px !important;\n max-width: 160px !important;\n}\n\n#network-debugger-panel.minimized .debugger-content {\n display: none;\n}\n\n#network-debugger-panel.minimized .resize-handle {\n display: none;\n}\n\n#network-debugger-panel.fullscreen .resize-handle {\n display: none;\n}\n\n#network-debugger-panel.bottom-right {\n bottom: 20px;\n right: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.bottom-left {\n bottom: 20px;\n left: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.top-right {\n top: 20px;\n right: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.top-left {\n top: 20px;\n left: 20px;\n width: 400px;\n height: 300px;\n}\n\n#network-debugger-panel.fullscreen {\n top: 0;\n left: 0;\n width: 100vw !important;\n height: 100vh !important;\n border-radius: 0;\n}\n\n.debugger-header {\n background: #333;\n padding: 8px 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: move;\n user-select: none;\n border-bottom: 1px solid #444;\n}\n\n.debugger-title {\n font-weight: bold;\n color: #4CAF50;\n font-size: 14px;\n}\n\n.debugger-controls {\n display: flex;\n gap: 8px;\n}\n\n.debugger-btn {\n background: none;\n border: none;\n color: #fff;\n padding: 4px 8px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n transition: background-color 0.2s;\n}\n\n.debugger-btn:hover {\n background: #555;\n}\n\n.debugger-btn.active {\n background: #4CAF50;\n color: #000;\n}\n\n.debugger-icon {\n width: 16px;\n height: 16px;\n vertical-align: middle;\n}\n\n.debugger-content {\n height: calc(100% - 40px);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n\n.debugger-tabs {\n display: flex;\n background: #2a2a2a;\n border-bottom: 1px solid #444;\n}\n\n.debugger-tab {\n padding: 8px 16px;\n cursor: pointer;\n border: none;\n background: none;\n color: #ccc;\n font-size: 12px;\n transition: all 0.2s;\n border-bottom: 2px solid transparent;\n}\n\n.debugger-tab:hover {\n color: #fff;\n background: #3a3a3a;\n}\n\n.debugger-tab.active {\n color: #4CAF50;\n border-bottom-color: #4CAF50;\n background: #333;\n}\n\n.debugger-panel-content {\n flex: 1;\n overflow: auto;\n padding: 12px;\n}\n\n.request-list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.request-item {\n background: #2a2a2a;\n border: 1px solid #444;\n border-radius: 6px;\n padding: 10px;\n cursor: pointer;\n transition: all 0.2s;\n position: relative;\n}\n\n.request-item:hover {\n background: #333;\n border-color: #666;\n}\n\n.request-item.expanded {\n background: #333;\n border-color: #4CAF50;\n}\n\n.request-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 4px;\n}\n\n.request-method {\n padding: 2px 8px;\n border-radius: 4px;\n font-weight: bold;\n font-size: 10px;\n text-transform: uppercase;\n min-width: 40px;\n text-align: center;\n}\n\n.method-get { background: #4CAF50; color: #000; }\n.method-post { background: #2196F3; color: #fff; }\n.method-put { background: #FF9800; color: #000; }\n.method-delete { background: #F44336; color: #fff; }\n.method-patch { background: #9C27B0; color: #fff; }\n\n.request-url {\n flex: 1;\n margin: 0 8px;\n word-break: break-all;\n white-space: normal;\n color: #fff;\n font-size: 11px;\n line-height: 1.3;\n}\n\n.request-status {\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 10px;\n min-width: 35px;\n text-align: center;\n}\n\n.status-2xx { background: #4CAF50; color: #000; }\n.status-3xx { background: #FF9800; color: #000; }\n.status-4xx { background: #F44336; color: #fff; }\n.status-5xx { background: #9C27B0; color: #fff; }\n.status-error { background: #F44336; color: #fff; }\n\n.request-info {\n display: flex;\n justify-content: space-between;\n font-size: 10px;\n color: #999;\n}\n\n.request-details {\n margin-top: 12px;\n border-top: 1px solid #444;\n padding-top: 12px;\n display: none;\n}\n\n/* 默认折叠headers */\n.request-details .detail-section.collapsible {\n /* 默认折叠状态 */\n}\n\n.request-details .detail-section.collapsible:not(.expanded) .detail-content {\n display: none;\n}\n\n.request-details .detail-section.collapsible:not(.expanded) .collapse-icon {\n transform: rotate(-90deg);\n}\n\n.request-item.expanded .request-details {\n display: block;\n}\n\n.detail-section {\n margin-bottom: 16px;\n}\n\n.detail-title {\n font-weight: bold;\n color: #4CAF50;\n margin-bottom: 8px;\n font-size: 11px;\n text-transform: uppercase;\n border-bottom: 1px solid #444;\n padding-bottom: 4px;\n}\n\n.detail-title.highlight {\n color: #FFD700;\n font-size: 12px;\n background: rgba(255, 215, 0, 0.1);\n padding: 6px 8px;\n border-radius: 4px;\n border-bottom: 2px solid #FFD700;\n}\n\n.detail-title.clickable {\n cursor: pointer;\n user-select: none;\n display: flex;\n align-items: center;\n gap: 4px;\n}\n\n.detail-title.clickable:hover {\n background: rgba(76, 175, 80, 0.1);\n}\n\n.collapse-icon {\n display: inline-block;\n transition: transform 0.2s;\n font-size: 10px;\n}\n\n.detail-section.collapsible {\n position: relative;\n}\n\n.detail-section.collapsible.collapsed .detail-content {\n display: none;\n}\n\n.detail-section.collapsible.collapsed .collapse-icon {\n transform: rotate(-90deg);\n}\n\n.detail-content {\n background: #222;\n padding: 8px;\n border-radius: 4px;\n max-height: 200px;\n overflow: auto;\n}\n\n.json-content {\n white-space: pre-wrap;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 11px;\n line-height: 1.4;\n}\n\n.headers-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 10px;\n}\n\n.headers-table th,\n.headers-table td {\n padding: 4px 8px;\n text-align: left;\n border-bottom: 1px solid #444;\n}\n\n.headers-table th {\n background: #333;\n color: #4CAF50;\n font-weight: bold;\n}\n\n.headers-table td {\n color: #ccc;\n}\n\n.decrypted-badge {\n background: #4CAF50;\n color: #000;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 9px;\n margin-left: 8px;\n font-weight: bold;\n}\n\n.error-badge {\n background: #F44336;\n color: #fff;\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 9px;\n margin-left: 8px;\n font-weight: bold;\n}\n\n.share-btn {\n background: #2196F3;\n color: #fff;\n border: none;\n padding: 4px 10px;\n border-radius: 3px;\n font-size: 11px;\n margin-left: 8px;\n cursor: pointer;\n transition: all 0.2s;\n white-space: nowrap;\n}\n\n.share-btn:hover {\n background: #1976D2;\n transform: scale(1.1);\n}\n\n.share-btn:active {\n transform: scale(0.95);\n}\n\n.console-content {\n background: #000;\n color: #0f0;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 11px;\n line-height: 1.4;\n height: 100%;\n overflow: auto;\n padding: 8px;\n}\n\n.console-input {\n display: flex;\n align-items: center;\n background: #333;\n padding: 8px;\n border-top: 1px solid #444;\n}\n\n.console-prompt {\n color: #4CAF50;\n margin-right: 8px;\n font-weight: bold;\n}\n\n.console-cmd {\n flex: 1;\n background: none;\n border: none;\n color: #fff;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 12px;\n outline: none;\n}\n\n.tools-section {\n padding: 12px;\n background: #2a2a2a;\n border-bottom: 1px solid #444;\n}\n\n.tool-buttons {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.tool-btn {\n padding: 6px 12px;\n background: #4CAF50;\n color: #000;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 11px;\n font-weight: bold;\n transition: background-color 0.2s;\n}\n\n.tool-btn:hover {\n background: #45a049;\n}\n\n.tool-btn:disabled {\n background: #666;\n color: #999;\n cursor: not-allowed;\n}\n\n@media (max-width: 600px) {\n #network-debugger-panel.bottom-right,\n #network-debugger-panel.bottom-left,\n #network-debugger-panel.top-right,\n #network-debugger-panel.top-left {\n width: calc(100vw - 20px) !important;\n left: 10px !important;\n right: auto !important;\n }\n \n /* 最小化时不应用全宽,保持小尺寸 */\n #network-debugger-panel.minimized {\n width: 160px !important;\n max-width: 160px !important;\n height: 35px !important;\n }\n}\n\n::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n}\n\n::-webkit-scrollbar-track {\n background: #333;\n}\n\n::-webkit-scrollbar-thumb {\n background: #666;\n border-radius: 3px;\n}\n\n::-webkit-scrollbar-thumb:hover {\n background: #888;\n}\n\n.resize-handle {\n position: absolute;\n background: transparent;\n}\n\n.resize-handle.n {\n top: -3px;\n left: 0;\n right: 0;\n height: 6px;\n cursor: ns-resize;\n}\n\n.resize-handle.s {\n bottom: -3px;\n left: 0;\n right: 0;\n height: 6px;\n cursor: ns-resize;\n}\n\n.resize-handle.e {\n top: 0;\n right: -3px;\n bottom: 0;\n width: 6px;\n cursor: ew-resize;\n}\n\n.resize-handle.w {\n top: 0;\n left: -3px;\n bottom: 0;\n width: 6px;\n cursor: ew-resize;\n}\n\n.resize-handle.ne {\n top: -3px;\n right: -3px;\n width: 12px;\n height: 12px;\n cursor: ne-resize;\n}\n\n.resize-handle.nw {\n top: -3px;\n left: -3px;\n width: 12px;\n height: 12px;\n cursor: nw-resize;\n}\n\n.resize-handle.se {\n bottom: -3px;\n right: -3px;\n width: 12px;\n height: 12px;\n cursor: se-resize;\n}\n\n.resize-handle.sw {\n bottom: -3px;\n left: -3px;\n width: 12px;\n height: 12px;\n cursor: sw-resize;\n}\n\n.debugger-reopen-btn {\n position: fixed;\n z-index: 999999;\n background: #4CAF50;\n color: #000;\n border: none;\n padding: 8px 10px;\n border-radius: 16px;\n font-weight: bold;\n font-size: 12px;\n box-shadow: 0 4px 12px rgba(0,0,0,0.25);\n cursor: pointer;\n}\n\n.debugger-reopen-btn:hover {\n filter: brightness(0.95);\n}\n",document.head.appendChild(e)}this.container=document.createElement("div"),this.container.id="network-debugger-panel",this.container.className=`${this.config.position} ${this.config.minimized?"minimized":""}`,this.container.innerHTML=`\n <div class="debugger-header">\n <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo</span></div>\n <div class="debugger-controls">\n <button class="debugger-btn" data-action="clear" title="清空"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg></button>\n <button class="debugger-btn" data-action="export" title="导出"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg></button>\n <button class="debugger-btn" data-action="fullscreen" title="全屏"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg></button>\n <button class="debugger-btn" data-action="close" title="关闭"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg></button>\n </div>\n </div>\n <div class="debugger-content">\n <div class="debugger-tabs">\n <button class="debugger-tab active" data-tab="network">网络</button>\n ${this.config.showConsole?'<button class="debugger-tab" data-tab="console">控制台</button>':""}\n <button class="debugger-tab" data-tab="tools">工具</button>\n <button class="debugger-tab" data-tab="about">关于</button>\n </div>\n <div class="debugger-panel-content">\n <div class="network-panel" data-panel="network">\n <div class="request-list"></div>\n </div>\n ${this.config.showConsole?'\n <div class="console-panel" data-panel="console" style="display: none;">\n <div class="console-content"></div>\n <div class="console-input">\n <span class="console-prompt">></span>\n <input class="console-cmd" placeholder="输入 JavaScript 代码..." />\n </div>\n </div>\n ':""}\n <div class="tools-panel" data-panel="tools" style="display: none;">\n <div class="tools-section">\n <div class="tool-buttons">\n <button class="tool-btn" data-tool="parse-curl">解析 cURL</button>\n <button class="tool-btn" data-tool="export-har">导出 HAR</button>\n <button class="tool-btn" data-tool="cors-test">CORS 测试</button>\n <button class="tool-btn" data-tool="decrypt-test">解密测试</button>\n </div>\n </div>\n <div class="tools-content">\n <textarea placeholder="在这里粘贴 cURL 命令或输入要测试的数据..." style="width: 100%; height: 200px; background: #222; color: #fff; border: 1px solid #444; padding: 8px; font-family: monospace;"></textarea>\n </div>\n </div>\n <div class="about-panel" data-panel="about" style="display: none;">\n <div style="padding: 20px; color: #fff; text-align: center;">\n <h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>\n <p style="margin: 10px 0;">Version: 1.2.35</p>\n <p style="margin: 10px 0;">👨‍💻 Created by <strong>Leo (@leeguoo)</strong></p>\n <p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>\n <p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>\n <div style="margin-top: 20px; padding: 15px; background: #333; border-radius: 8px;">\n <p style="margin: 5px 0; font-size: 12px;">本工具专为 PWTK 项目开发</p>\n <p style="margin: 5px 0; font-size: 12px;">提供网络请求拦截、解密、分享等功能</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n `,this.addResizeHandles(),document.body.appendChild(this.container),this.networkTab=this.container.querySelector('[data-panel="network"]'),this.consoleTab=this.container.querySelector('[data-panel="console"]'),this.consoleContent=this.container.querySelector(".console-content")}addResizeHandles(){["n","s","e","w","ne","nw","se","sw"].forEach(e=>{const t=document.createElement("div");t.className=`resize-handle ${e}`,t.dataset.direction=e,this.container.appendChild(t)})}bindEvents(){const e=this.container.querySelector(".debugger-header"),t=this.container.querySelector(".debugger-controls"),n=this.container.querySelectorAll(".debugger-tab"),r=this.container.querySelectorAll("[data-tool]"),o=this.container.querySelector(".console-cmd");e.addEventListener("mousedown",e=>{e.target===t||t.contains(e.target)||this.startDrag(e)}),t.addEventListener("click",e=>{e.stopPropagation();let n=e.target;for(;n&&n!==t&&!n.dataset?.action;)n=n.parentElement;const r=n?.dataset?.action;if(r)switch(r){case"clear":this.clearRequests();break;case"export":this.exportData();break;case"fullscreen":this.toggleFullscreen();break;case"close":this.hide()}}),n.forEach(e=>{e.addEventListener("click",e=>{const t=e.target.dataset.tab;this.switchTab(t)})}),r.forEach(e=>{e.addEventListener("click",e=>{const t=e.target.dataset.tool;this.handleToolAction(t)})}),o&&o.addEventListener("keypress",e=>{"Enter"===e.key&&(this.executeConsoleCommand(o.value),o.value="")});this.container.querySelectorAll(".resize-handle").forEach(e=>{e.addEventListener("mousedown",t=>{t.stopPropagation();const n=e.dataset.direction||e.classList[1]||"se";this.startResize(t,n)})}),document.addEventListener("mousemove",this.handleMouseMove.bind(this)),document.addEventListener("mouseup",this.handleMouseUp.bind(this)),window.addEventListener("resize",this.handleWindowResize.bind(this))}startListening(){this.interceptor.addListener(e=>{this.addRequestToUI(e)}),this.requestsCache=this.interceptor.getRequests(),this.renderRequests()}addRequestToUI(e){Xe.debug("[PWTK UI] Adding/updating request:",{id:e.id,url:e.url,hasResponse:!!e.responseBody,hasDecryptedRequest:!!e.decryptedRequest,hasDecryptedResponse:!!e.decryptedResponse,status:e.status});const t=this.requestsCache.findIndex(t=>t.id===e.id);t>=0?this.requestsCache[t]=e:this.requestsCache.unshift(e),this.requestsCache.length>100&&(this.requestsCache=this.requestsCache.slice(0,100)),this.renderRequests()}renderRequests(){const e=this.container.querySelector(".request-list");e&&(e.innerHTML="",this.requestsCache.forEach(t=>{const n=this.createRequestItem(t);e.appendChild(n)}))}createRequestItem(e){const t=document.createElement("div");t.className="request-item",t.dataset.requestId=e.id;const n=this.getStatusClass(e.status),r=`method-${e.method.toLowerCase()}`;e.decryptedRequest||e.decryptedResponse;const o=e.error;t.innerHTML=`\n <div class="request-header">\n <span class="request-method ${r}">${e.method}</span>\n <span class="request-url" title="${e.url}">${this.truncateUrl(e.url)}</span>\n <span class="request-status ${n}">${e.status?e.status:void 0!==e.duration?"ERR":"Pending"}</span>\n ${o?'<span class="error-badge">⚠️</span>':""}\n <button class="share-btn" title="分享此请求 (by Leo)" onclick="event.stopPropagation()">分享链接</button>\n </div>\n <div class="request-info">\n <span>${new Date(e.timestamp).toLocaleTimeString()}</span>\n <span>${e.duration?`${e.duration}ms`:"Pending"}</span>\n </div>\n <div class="request-details">\n ${this.renderRequestDetails(e)}\n </div>\n `,t.addEventListener("click",e=>{const n=e.target;n.closest(".share-btn")||n.closest('.detail-title[data-toggle="collapse"]')||t.classList.toggle("expanded")});const i=t.querySelector(".share-btn");return i&&i.addEventListener("click",async t=>{t.stopPropagation(),await this.shareRequest(e)}),t.addEventListener("click",e=>{const t=e.target;if(t.closest('.detail-title[data-toggle="collapse"]')){e.stopPropagation();const n=t.closest(".detail-title").parentElement;n&&n.classList.contains("collapsible")&&n.classList.toggle("collapsed")}},{capture:!0}),t}renderRequestDetails(e){let t="";return e.id.replace(/[^a-zA-Z0-9]/g,""),e.decryptedRequest&&(t+=`\n <div class="detail-section">\n <div class="detail-title highlight">解密请求数据</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.decryptedRequest)}</div>\n </div>\n </div>\n `),e.decryptedResponse&&(t+=`\n <div class="detail-section">\n <div class="detail-title highlight">解密响应数据</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.decryptedResponse)}</div>\n </div>\n </div>\n `),Object.keys(e.headers).length>0&&(t+=`\n <div class="detail-section collapsible collapsed">\n <div class="detail-title clickable" data-toggle="collapse">\n <span class="collapse-icon">▼</span> 请求头 (${Object.keys(e.headers).length})\n </div>\n <div class="detail-content">\n <table class="headers-table">\n ${Object.entries(e.headers).map(([e,t])=>`<tr><td>${e}</td><td>${t}</td></tr>`).join("")}\n </table>\n </div>\n </div>\n `),e.responseHeaders&&Object.keys(e.responseHeaders).length>0&&(t+=`\n <div class="detail-section collapsible collapsed">\n <div class="detail-title clickable" data-toggle="collapse">\n <span class="collapse-icon">▼</span> 响应头 (${Object.keys(e.responseHeaders).length})\n </div>\n <div class="detail-content">\n <table class="headers-table">\n ${Object.entries(e.responseHeaders).map(([e,t])=>`<tr><td>${e}</td><td>${t}</td></tr>`).join("")}\n </table>\n </div>\n </div>\n `),e.requestBody&&(t+=`\n <div class="detail-section">\n <div class="detail-title">${e.decryptedRequest?"原始请求数据":"请求数据"}</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.requestBody)}</div>\n </div>\n </div>\n `),e.responseBody&&(t+=`\n <div class="detail-section">\n <div class="detail-title">${e.decryptedResponse?"原始响应数据":"响应数据"}</div>\n <div class="detail-content">\n <div class="json-content">${this.formatData(e.responseBody)}</div>\n </div>\n </div>\n `),e.error&&(t+=`\n <div class="detail-section">\n <div class="detail-title">错误信息</div>\n <div class="detail-content">\n <div class="json-content" style="color: #f44336;">${e.error}</div>\n </div>\n </div>\n `),t}formatData(e){if("string"==typeof e)try{return Ye(JSON.parse(e))}catch{return e}return Ye(e)}getStatusClass(e){return e?e>=200&&e<300?"status-2xx":e>=300&&e<400?"status-3xx":e>=400&&e<500?"status-4xx":e>=500?"status-5xx":"status-error":"status-error"}truncateUrl(e){const t=e.indexOf("?");return t>-1?e.substring(0,t):e}switchTab(e){this.container.querySelectorAll(".debugger-tab").forEach(t=>{t.classList.toggle("active",t.dataset.tab===e)}),this.container.querySelectorAll("[data-panel]").forEach(t=>{t.style.display=t.getAttribute("data-panel")===e?"block":"none"}),this.currentTab=e}clearRequests(){this.requestsCache=[],this.interceptor.clearRequests(),this.renderRequests(),this.logToConsole("✅ 已清空网络请求记录")}exportData(){const e={timestamp:(new Date).toISOString(),requests:this.requestsCache,userAgent:navigator.userAgent,url:window.location.href,creator:"PWTK Network Debugger by Leo (@leeguoo)"},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`network-debug-${Date.now()}.json`,r.click(),URL.revokeObjectURL(n),this.logToConsole("💾 网络数据已导出 (by Leo)")}async shareRequest(e){try{this.logToConsole("📤 正在创建分享链接...");const t=await Ve(e);if(!t)throw new Error("无法创建分享链接");await async function(e){try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(e),!0;{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}}catch(t){return Xe.error("复制到剪贴板失败:",t),!1}}(t)?(this.logToConsole(`✅ 分享链接已复制到剪贴板: ${t}`),alert(`分享链接已复制到剪贴板!\n${t}\n\nCreated by Leo (@leeguoo)`)):(this.logToConsole(`✅ 分享链接: ${t}`),prompt("分享链接已创建,请手动复制:\n\nCreated by Leo (@leeguoo)",t))}catch(t){Xe.error("分享失败:",t),this.logToConsole(`❌ 分享失败: ${t}`),alert("分享失败,请稍后重试")}}toggleFullscreen(){this.container.classList.contains("fullscreen")?(this.container.classList.remove("fullscreen"),this.container.style.top="",this.container.style.left="",this.container.style.width="",this.container.style.height="",this.loadPosition()):(this.container.classList.add("fullscreen"),this.container.style.top="0",this.container.style.left="0",this.container.style.width="100vw",this.container.style.height="100vh",this.container.style.right="auto",this.container.style.bottom="auto")}handleToolAction(e){const t=this.container.querySelector(".tools-content textarea").value.trim();switch(e){case"parse-curl":this.handleParseCurl(t);break;case"export-har":this.exportHAR();break;case"cors-test":this.handleCorsTest(t);break;case"decrypt-test":this.handleDecryptTest(t)}}handleParseCurl(e){if(e)try{const t=function(e){const t=e.split("\\\n").map(e=>e.trim()).join(" "),n=t.match(/c?curl\s+['"]?([^'"\s]+)['"]?/);let r=n?n[1]:"";const o={},i=t.matchAll(/-H\s+['"]([^:]+):\s*([^'"]*)['"]/g);for(const d of i)o[d[1]]=d[2];let s;const a=t.match(/(?:--data-raw|--data|-d)\s+['"]({.+?})['"]/s);if(a){const e=a[1];try{s=JSON.parse(e)}catch{s=e}}if(!a&&r.includes("?"))try{const e=new URL(r,"http://example.com"),t={};e.searchParams.forEach((e,n)=>{t[n]=e}),Object.keys(t).length>0&&(s=1===Object.keys(t).length&&t.data?t.data:t)}catch(l){}const c=t.match(/-X\s+(['"]?)([A-Z]+)\1/);return{url:r,method:c?c[2]:a?"POST":"GET",headers:o,data:s}}(e);this.logToConsole("✅ cURL 解析成功:"),this.logToConsole(t)}catch(t){this.logToConsole(`❌ cURL 解析失败: ${t instanceof Error?t.message:String(t)}`,"error")}else this.logToConsole("❌ 请输入 cURL 命令")}exportHAR(){const e={log:{version:"1.2",creator:{name:"NetworkDebugger",version:"1.0.0",comment:"Created by Leo (@leeguoo)"},entries:this.requestsCache.map(e=>({startedDateTime:new Date(e.timestamp).toISOString(),time:e.duration||0,request:{method:e.method,url:e.url,headers:Object.entries(e.headers).map(([e,t])=>({name:e,value:t})),postData:e.requestBody?{mimeType:"application/json",text:"string"==typeof e.requestBody?e.requestBody:JSON.stringify(e.requestBody)}:void 0},response:{status:e.status||0,statusText:e.statusText||"",headers:e.responseHeaders?Object.entries(e.responseHeaders).map(([e,t])=>({name:e,value:t})):[],content:{size:0,mimeType:"application/json",text:e.responseBody?"string"==typeof e.responseBody?e.responseBody:JSON.stringify(e.responseBody):""}}}))}},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=`network-har-${Date.now()}.har`,r.click(),URL.revokeObjectURL(n),this.logToConsole("💾 HAR 文件已导出")}handleCorsTest(e){e?(this.logToConsole(`🔍 开始 CORS 测试: ${e}`),fetch(e,{mode:"cors"}).then(e=>{this.logToConsole(`✅ CORS 测试成功: ${e.status} ${e.statusText}`)}).catch(e=>{this.logToConsole(`❌ CORS 测试失败: ${e.message}`)})):this.logToConsole("❌ 请输入要测试的 URL")}handleDecryptTest(e){e?this.logToConsole("🔓 解密测试功能开发中..."):this.logToConsole("❌ 请输入要解密的数据")}executeConsoleCommand(e){if(e.trim()){this.consoleHistory.push(e),this.logToConsole(`> ${e}`);try{const t=new Function("return "+e)();this.logToConsole(t)}catch(t){try{const t=new Function(e)();this.logToConsole(void 0!==t?t:"undefined")}catch(n){this.logToConsole(`❌ ${t}`,"error")}}}}logToConsole(e,t="log"){if(!this.consoleContent)return;const n=(new Date).toLocaleTimeString(),r="object"==typeof e?JSON.stringify(e,null,2):e,o=document.createElement("div");o.innerHTML=`[${n}] ${r}`,"error"===t?o.style.color="#f44336":"warn"===t&&(o.style.color="#ff9800"),this.consoleContent.appendChild(o),this.consoleContent.scrollTop=this.consoleContent.scrollHeight}startDrag(e){this.isDragging=!0,this.dragStart={x:e.clientX,y:e.clientY},this.container.style.transition="none"}startResize(e,t){this.isResizing=!0,this.resizeDirection=t,this.dragStart={x:e.clientX,y:e.clientY},this.container.style.transition="none"}handleMouseMove(e){if(this.isDragging){const t=e.clientX-this.dragStart.x,n=e.clientY-this.dragStart.y,r=this.container.getBoundingClientRect();this.container.style.left=`${r.left+t}px`,this.container.style.top=`${r.top+n}px`,this.dragStart={x:e.clientX,y:e.clientY}}if(this.isResizing){const t=this.resizeDirection;if(!t)return;const n=e.clientX-this.dragStart.x,r=e.clientY-this.dragStart.y,o=this.container.getBoundingClientRect(),i=300,s=200;let a=o.width,c=o.height,l=o.left,d=o.top;t.includes("e")&&(a=Math.max(i,o.width+n),this.container.style.width=`${a}px`),t.includes("s")&&(c=Math.max(s,o.height+r),this.container.style.height=`${c}px`),t.includes("w")&&(a=Math.max(i,o.width-n),a>i&&(l=o.left+n,this.container.style.width=`${a}px`,this.container.style.left=`${l}px`)),t.includes("n")&&(c=Math.max(s,o.height-r),c>s&&(d=o.top+r,this.container.style.height=`${c}px`,this.container.style.top=`${d}px`)),this.dragStart={x:e.clientX,y:e.clientY}}}handleMouseUp(){(this.isDragging||this.isResizing)&&(this.container.style.transition="all 0.3s ease",this.isDragging&&this.savePosition()),this.isDragging=!1,this.isResizing=!1,this.resizeDirection=""}handleWindowResize(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.adjustPositionForWindowResize()},100)}adjustPositionForWindowResize(){const e=this.container.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight;let r=!1,o=e.left,i=e.top,s=e.width,a=e.height;e.right>t&&(o=t-e.width,r=!0),e.bottom>n&&(i=n-e.height,r=!0),o<0&&(o=0,r=!0),i<0&&(i=0,r=!0),e.width>t&&(s=t-20,o=10,r=!0),e.height>n&&(a=n-20,i=10,r=!0),r&&(this.container.style.left=`${o}px`,this.container.style.top=`${i}px`,this.container.style.right="auto",this.container.style.bottom="auto",(e.width>t||e.height>n)&&(this.container.style.width=`${s}px`,this.container.style.height=`${a}px`),this.savePosition())}show(){this.container.style.display="block",this.removeReopenButton()}hide(){this.container.style.display="none",this.createReopenButton()}createReopenButton(){if(document.getElementById("network-debugger-reopen-btn"))return;const e=document.createElement("button");e.id="network-debugger-reopen-btn",e.className="debugger-reopen-btn",e.title="打开调试面板 (可拖动)",e.textContent="PWTK";const t=this.config.position||"bottom-right";t.includes("bottom")?e.style.bottom="20px":e.style.top="20px",t.includes("right")?e.style.right="20px":e.style.left="20px";let n=!1,r={x:0,y:0},o=null;e.addEventListener("mousedown",t=>{0===t.button&&(n=!1,r={x:t.clientX,y:t.clientY},e.style.transition="none",o=window.setTimeout(()=>{n=!0,e.style.cursor="grabbing"},150),t.preventDefault())});document.addEventListener("mousemove",t=>{if(!n)return;const o=t.clientX-r.x,i=t.clientY-r.y,s=e.getBoundingClientRect(),a=s.left+o,c=s.top+i,l=window.innerWidth-s.width,d=window.innerHeight-s.height,h=Math.max(0,Math.min(l,a)),u=Math.max(0,Math.min(d,c));e.style.position="fixed",e.style.left=`${h}px`,e.style.top=`${u}px`,e.style.right="auto",e.style.bottom="auto",r={x:t.clientX,y:t.clientY}}),document.addEventListener("mouseup",()=>{o&&(clearTimeout(o),o=null),n?(n=!1,e.style.cursor="pointer",e.style.transition="all 0.3s ease"):this.show()}),e.style.cursor="pointer",document.body.appendChild(e)}removeReopenButton(){const e=document.getElementById("network-debugger-reopen-btn");e&&e.remove()}destroy(){this.container.remove();const e=document.getElementById("network-debugger-styles");e&&e.remove(),this.removeReopenButton()}loadConfig(){try{const t=localStorage.getItem(e.STORAGE_KEY);if(t){const e=JSON.parse(t);return Xe.debug("加载保存的配置:",e),e}}catch(t){Xe.error("加载配置失败:",t)}return{}}saveConfig(){try{const t={position:this.config.position,theme:this.config.theme,minimized:this.config.minimized,showConsole:this.config.showConsole};localStorage.setItem(e.STORAGE_KEY,JSON.stringify(t)),Xe.debug("配置已保存:",t)}catch(t){Xe.error("保存配置失败:",t)}}loadPosition(){try{const t=`${e.STORAGE_KEY}-position`,n=localStorage.getItem(t);if(n){const e=JSON.parse(n);void 0!==e.left&&(this.container.style.left=e.left+"px"),void 0!==e.top&&(this.container.style.top=e.top+"px"),void 0!==e.right&&(this.container.style.right=e.right+"px"),void 0!==e.bottom&&(this.container.style.bottom=e.bottom+"px"),Xe.debug("加载保存的位置:",e)}}catch(t){Xe.error("加载位置失败:",t)}}savePosition(){try{const t=`${e.STORAGE_KEY}-position`,n=this.container.getBoundingClientRect(),r={left:n.left,top:n.top,right:window.innerWidth-n.right,bottom:window.innerHeight-n.bottom};localStorage.setItem(t,JSON.stringify(r)),Xe.debug("位置已保存:",r)}catch(t){Xe.error("保存位置失败:",t)}}};Ze.STORAGE_KEY="pwtk-debugger-config";let Qe=Ze;class et{constructor(){this.interceptor=null,this.panel=null,this.wasmLoader=null,this.config={},this.initialized=!1}async init(e={}){if(this.initialized)Xe.warn("NetworkDebugger already initialized");else{this.config={autoStart:!0,position:"bottom-right",theme:"dark",minimized:!1,showConsole:!0,wasm:{enabled:!0,...e.wasm},decrypt:{enabled:!0,autoFetchKeys:!0,keyApiUrl:"https://gw-card-pay.buyacard.cc/ip/getSK",...e.decrypt},log:{toBrowserConsole:!1,level:"info",...e.log},...e},Xe.configure({enableBrowserConsole:this.config.log?.toBrowserConsole||!1,logLevel:this.config.log?.level||"info"});try{if(!1!==this.config.wasm?.enabled){Xe.info("[PWTK Init] Starting WASM initialization"),this.wasmLoader=new Ge;await this.wasmLoader.loadWasm(this.config.wasm?.wasmUrl,this.config.wasm?.jsUrl)?Xe.info("[PWTK Init] ✅ WASM decrypt function ready"):Xe.warn("[PWTK Init] ⚠️ WASM load failed or decrypt function unavailable, will rely on page-provided decryption")}else Xe.info("[PWTK Init] WASM disabled in config");this.interceptor=new Je,this.config.decrypt?.enabled&&this.interceptor.enableDecryption({keyExtractor:this.config.decrypt.keyExtractor||this.defaultKeyExtractor,slkExtractor:this.config.decrypt.slkExtractor||this.defaultSlkExtractor,autoFetchKeys:this.config.decrypt.autoFetchKeys,keyApiUrl:this.config.decrypt.keyApiUrl}),!1!==this.config.autoStart&&this.createPanel(),this.initialized=!0,Xe.consoleDirect("\n╔════════════════════════════════════════╗\n║ 🔓 PWTK 解密小工具 v1.2.35 ║\n║ Created by Leo (@leeguoo) ║\n║ 技术支持: 请联系 Leo ║ \n║ 分享服务: curl.bwg.leeguoo.com ║\n╚════════════════════════════════════════╝\n "),Xe.info("🔍 NetworkDebugger initialized successfully")}catch(t){throw Xe.error("NetworkDebugger initialization failed:",t),t}}}show(){this.initialized?this.panel?this.panel.show():this.createPanel():Xe.error("NetworkDebugger not initialized. Call init() first.")}hide(){this.panel&&this.panel.hide()}destroy(){this.panel&&(this.panel.destroy(),this.panel=null),this.initialized=!1,Xe.info("NetworkDebugger destroyed")}getRequests(){return this.interceptor?.getRequests()||[]}clearRequests(){this.interceptor?.clearRequests()}exportData(){return{timestamp:(new Date).toISOString(),requests:this.getRequests(),config:this.config,userAgent:navigator.userAgent,url:window.location.href,author:"Leo (@leeguoo)",tool:"@leeguoo/network-debugger"}}isWasmLoaded(){return this.wasmLoader?.isLoaded()||!1}isInitialized(){return this.initialized}static create(e){const t=new et;return t.init(e).then(()=>t)}createPanel(){this.interceptor?this.panel=new Qe(this.interceptor,{position:this.config.position,theme:this.config.theme,minimized:this.config.minimized,showConsole:this.config.showConsole}):Xe.error("Cannot create panel: interceptor not initialized")}defaultKeyExtractor(e){return e.keys||e.cid||e["x-api-key"]||""}defaultSlkExtractor(e){return e.slk||e["x-slk"]||""}}let tt=null;const nt={init:async e=>tt?(Xe.warn("NetworkDebugger already has a global instance"),tt):(tt=await et.create(e),"undefined"!=typeof window&&(window.NetworkDebugger=tt),tt),show(){tt?.show()},hide(){tt?.hide()},destroy(){tt?.destroy(),tt=null,"undefined"!=typeof window&&delete window.NetworkDebugger},getInstance:()=>tt};e.DebugPanel=Qe,e.NetworkDebugger=et,e.NetworkInterceptor=Je,e.WasmLoader=Ge,e.default=nt,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leeguoo/pwtk-network-debugger",
3
- "version": "1.2.34",
3
+ "version": "1.2.35",
4
4
  "description": "PWTK 解密小工具 - 网络请求拦截、自动解密、分享功能 (Created by Leo)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",