most-box 0.1.3 → 0.1.4
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/out/404/index.html +2 -2
- package/out/404.html +2 -2
- package/out/__next.__PAGE__.txt +5 -5
- package/out/__next._full.txt +13 -13
- package/out/__next._head.txt +3 -3
- package/out/__next._index.txt +6 -6
- package/out/__next._tree.txt +2 -2
- package/out/_next/static/chunks/02zzxfop_k6tl.css +1 -0
- package/out/_next/static/chunks/03gsbg0fr00ey.js +1 -0
- package/out/_next/static/chunks/06lttvu7563zo.css +1 -0
- package/out/_next/static/chunks/0fo9-h4knidcz.js +1 -0
- package/out/_next/static/chunks/0hyds~bp.auvh.js +1 -0
- package/out/_next/static/chunks/0i9sfdypwuw8~.js +1 -0
- package/out/_next/static/chunks/{0_0oph_z1az14.js → 0puk.7e.tr2zy.js} +1 -1
- package/out/_next/static/chunks/0s1k6rlwy02c2.js +1 -0
- package/out/_next/static/chunks/0sgltmtk_9s8p.css +1 -0
- package/out/_next/static/chunks/0snehvtvu1n4q.js +1 -0
- package/out/_next/static/chunks/{12nr19.nnn6s3.js → 0t_3xxx4zkerp.js} +2 -2
- package/out/_next/static/chunks/0u38kke9vhobe.js +1 -0
- package/out/_next/static/chunks/0vd4_a5x-wpdh.js +1 -0
- package/out/_next/static/chunks/0xx_10jns1.s7.css +1 -0
- package/out/_next/static/chunks/{0m_5nb6x8qy._.js → 10f-t2n4y1zx8.js} +1 -1
- package/out/_next/static/chunks/13jdyag9a-~kk.js +1 -0
- package/out/_not-found/__next._full.txt +11 -11
- package/out/_not-found/__next._head.txt +3 -3
- package/out/_not-found/__next._index.txt +6 -6
- package/out/_not-found/__next._not-found.__PAGE__.txt +4 -4
- package/out/_not-found/__next._not-found.txt +3 -3
- package/out/_not-found/__next._tree.txt +1 -1
- package/out/_not-found/index.html +2 -2
- package/out/_not-found/index.txt +11 -11
- package/out/admin/__next._full.txt +12 -12
- package/out/admin/__next._head.txt +3 -3
- package/out/admin/__next._index.txt +6 -6
- package/out/admin/__next._tree.txt +1 -1
- package/out/admin/__next.admin.__PAGE__.txt +4 -4
- package/out/admin/__next.admin.txt +3 -3
- package/out/admin/index.html +2 -2
- package/out/admin/index.txt +12 -12
- package/out/app/__next._full.txt +12 -12
- package/out/app/__next._head.txt +3 -3
- package/out/app/__next._index.txt +6 -6
- package/out/app/__next._tree.txt +1 -1
- package/out/app/__next.app.__PAGE__.txt +4 -4
- package/out/app/__next.app.txt +3 -3
- package/out/app/index.html +2 -2
- package/out/app/index.txt +12 -12
- package/out/chat/__next._full.txt +12 -12
- package/out/chat/__next._head.txt +3 -3
- package/out/chat/__next._index.txt +6 -6
- package/out/chat/__next._tree.txt +1 -1
- package/out/chat/__next.chat.__PAGE__.txt +4 -4
- package/out/chat/__next.chat.txt +3 -3
- package/out/chat/index.html +2 -2
- package/out/chat/index.txt +12 -12
- package/out/chat/join/__next._full.txt +12 -12
- package/out/chat/join/__next._head.txt +3 -3
- package/out/chat/join/__next._index.txt +6 -6
- package/out/chat/join/__next._tree.txt +1 -1
- package/out/chat/join/__next.chat.join.__PAGE__.txt +4 -4
- package/out/chat/join/__next.chat.join.txt +3 -3
- package/out/chat/join/__next.chat.txt +3 -3
- package/out/chat/join/index.html +2 -2
- package/out/chat/join/index.txt +12 -12
- package/out/download/__next._full.txt +16 -16
- package/out/download/__next._head.txt +3 -3
- package/out/download/__next._index.txt +6 -6
- package/out/download/__next._tree.txt +2 -2
- package/out/download/__next.download.__PAGE__.txt +6 -6
- package/out/download/__next.download.txt +3 -3
- package/out/download/index.html +2 -2
- package/out/download/index.txt +16 -16
- package/out/game/__next._full.txt +20 -0
- package/out/game/__next._head.txt +5 -0
- package/out/{gandengyan → game}/__next._index.txt +6 -6
- package/out/game/__next._tree.txt +5 -0
- package/out/game/__next.game.__PAGE__.txt +6 -0
- package/out/game/__next.game.txt +5 -0
- package/out/game/gandengyan/__next._full.txt +26 -0
- package/out/game/gandengyan/__next._head.txt +5 -0
- package/out/game/gandengyan/__next._index.txt +9 -0
- package/out/game/gandengyan/__next._tree.txt +6 -0
- package/out/game/gandengyan/__next.game.gandengyan.__PAGE__.txt +10 -0
- package/out/game/gandengyan/__next.game.gandengyan.txt +5 -0
- package/out/game/gandengyan/__next.game.txt +5 -0
- package/out/game/gandengyan/index.html +15 -0
- package/out/game/gandengyan/index.txt +26 -0
- package/out/game/index.html +1 -0
- package/out/game/index.txt +20 -0
- package/out/game/zhajinhua/__next._full.txt +25 -0
- package/out/game/zhajinhua/__next._head.txt +5 -0
- package/out/game/zhajinhua/__next._index.txt +9 -0
- package/out/game/zhajinhua/__next._tree.txt +5 -0
- package/out/game/zhajinhua/__next.game.txt +5 -0
- package/out/game/zhajinhua/__next.game.zhajinhua.__PAGE__.txt +9 -0
- package/out/game/zhajinhua/__next.game.zhajinhua.txt +5 -0
- package/out/game/zhajinhua/index.html +15 -0
- package/out/game/zhajinhua/index.txt +25 -0
- package/out/index.html +2 -2
- package/out/index.txt +13 -13
- package/out/note/__next._full.txt +12 -12
- package/out/note/__next._head.txt +3 -3
- package/out/note/__next._index.txt +6 -6
- package/out/note/__next._tree.txt +1 -1
- package/out/note/__next.note.__PAGE__.txt +4 -4
- package/out/note/__next.note.txt +3 -3
- package/out/note/index.html +2 -2
- package/out/note/index.txt +12 -12
- package/out/ping/__next._full.txt +12 -12
- package/out/ping/__next._head.txt +3 -3
- package/out/ping/__next._index.txt +6 -6
- package/out/ping/__next._tree.txt +1 -1
- package/out/ping/__next.ping.__PAGE__.txt +4 -4
- package/out/ping/__next.ping.txt +3 -3
- package/out/ping/index.html +2 -2
- package/out/ping/index.txt +12 -12
- package/out/web3/__next._full.txt +12 -12
- package/out/web3/__next._head.txt +3 -3
- package/out/web3/__next._index.txt +6 -6
- package/out/web3/__next._tree.txt +1 -1
- package/out/web3/__next.web3.__PAGE__.txt +4 -4
- package/out/web3/__next.web3.txt +3 -3
- package/out/web3/ed25519/__next._full.txt +10 -10
- package/out/web3/ed25519/__next._head.txt +3 -3
- package/out/web3/ed25519/__next._index.txt +6 -6
- package/out/web3/ed25519/__next._tree.txt +1 -1
- package/out/web3/ed25519/__next.web3.ed25519.__PAGE__.txt +2 -2
- package/out/web3/ed25519/__next.web3.ed25519.txt +3 -3
- package/out/web3/ed25519/__next.web3.txt +3 -3
- package/out/web3/ed25519/index.html +1 -1
- package/out/web3/ed25519/index.txt +10 -10
- package/out/web3/index.html +2 -2
- package/out/web3/index.txt +12 -12
- package/out/web3/tools/__next._full.txt +10 -10
- package/out/web3/tools/__next._head.txt +3 -3
- package/out/web3/tools/__next._index.txt +6 -6
- package/out/web3/tools/__next._tree.txt +1 -1
- package/out/web3/tools/__next.web3.tools.__PAGE__.txt +2 -2
- package/out/web3/tools/__next.web3.tools.txt +3 -3
- package/out/web3/tools/__next.web3.txt +3 -3
- package/out/web3/tools/index.html +1 -1
- package/out/web3/tools/index.txt +10 -10
- package/package.json +2 -1
- package/server/index.js +0 -8
- package/server/src/config.js +1 -1
- package/server/src/core/gameRoom.js +222 -0
- package/server/src/core/zhajinhua.js +563 -0
- package/server/src/games/gandengyan.js +348 -411
- package/server/src/http/app.js +7 -1
- package/server/src/index.js +9 -1
- package/out/_next/static/chunks/04mo7rr..0_1q.js +0 -1
- package/out/_next/static/chunks/06rf3qq5ggs6v.js +0 -1
- package/out/_next/static/chunks/07td.jq7xff84.css +0 -1
- package/out/_next/static/chunks/0cl7d~7abnk_p.css +0 -1
- package/out/_next/static/chunks/0d306t1wvjpdx.js +0 -1
- package/out/_next/static/chunks/0n.ayxmsar6e5.js +0 -1
- package/out/_next/static/chunks/0voe1.ttrh84k.css +0 -1
- package/out/_next/static/chunks/0wtf0xsiicxx6.js +0 -1
- package/out/_next/static/chunks/0x.ky97owcxxs.js +0 -1
- package/out/_next/static/chunks/0ysj5b94vu4ri.js +0 -1
- package/out/_next/static/chunks/184hxsuf-5c84.js +0 -1
- package/out/gandengyan/__next._full.txt +0 -25
- package/out/gandengyan/__next._head.txt +0 -5
- package/out/gandengyan/__next._tree.txt +0 -5
- package/out/gandengyan/__next.gandengyan.__PAGE__.txt +0 -10
- package/out/gandengyan/__next.gandengyan.txt +0 -5
- package/out/gandengyan/index.html +0 -15
- package/out/gandengyan/index.txt +0 -25
- /package/out/_next/static/{aPEZ4zaaR5W3WpSZ0dFsa → sSvbBrwXZY-4lBmcHshga}/_buildManifest.js +0 -0
- /package/out/_next/static/{aPEZ4zaaR5W3WpSZ0dFsa → sSvbBrwXZY-4lBmcHshga}/_clientMiddlewareManifest.js +0 -0
- /package/out/_next/static/{aPEZ4zaaR5W3WpSZ0dFsa → sSvbBrwXZY-4lBmcHshga}/_ssgManifest.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17173,e=>{"use strict";let t,s;var a,r,l,n,i,o=e.i(18050),c=e.i(71645),d=Object.defineProperty,h=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,x=(e,t,s)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,p=(e,t)=>{for(var s in t||(t={}))u.call(t,s)&&x(e,s,t[s]);if(h)for(var s of h(t))m.call(t,s)&&x(e,s,t[s]);return e},f=(e,t)=>{var s={};for(var a in e)u.call(e,a)&&0>t.indexOf(a)&&(s[a]=e[a]);if(null!=e&&h)for(var a of h(e))0>t.indexOf(a)&&m.call(e,a)&&(s[a]=e[a]);return s};(e=>{let t=class t{constructor(e,s,a,l){if(this.version=e,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError("Version value out of range");if(l<-1||l>7)throw RangeError("Mask value out of range");this.size=4*e+17;let n=[];for(let e=0;e<this.size;e++)n.push(!1);for(let e=0;e<this.size;e++)this.modules.push(n.slice()),this.isFunction.push(n.slice());this.drawFunctionPatterns();const i=this.addEccAndInterleave(a);if(this.drawCodewords(i),-1==l){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);const s=this.getPenaltyScore();s<e&&(l=t,e=s),this.applyMask(t)}}r(0<=l&&l<=7),this.mask=l,this.applyMask(l),this.drawFormatBits(l),this.isFunction=[]}static encodeText(s,a){let r=e.QrSegment.makeSegments(s);return t.encodeSegments(r,a)}static encodeBinary(s,a){let r=e.QrSegment.makeBytes(s);return t.encodeSegments([r],a)}static encodeSegments(e,a,l=1,i=40,o=-1,c=!0){let d,h;if(!(t.MIN_VERSION<=l&&l<=i&&i<=t.MAX_VERSION)||o<-1||o>7)throw RangeError("Invalid value");for(d=l;;d++){let s=8*t.getNumDataCodewords(d,a),r=n.getTotalBits(e,d);if(r<=s){h=r;break}if(d>=i)throw RangeError("Data too long")}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])c&&h<=8*t.getNumDataCodewords(d,e)&&(a=e);let u=[];for(let t of e)for(let e of(s(t.mode.modeBits,4,u),s(t.numChars,t.mode.numCharCountBits(d),u),t.getData()))u.push(e);r(u.length==h);let m=8*t.getNumDataCodewords(d,a);r(u.length<=m),s(0,Math.min(4,m-u.length),u),s(0,(8-u.length%8)%8,u),r(u.length%8==0);for(let e=236;u.length<m;e^=253)s(e,8,u);let x=[];for(;8*x.length<u.length;)x.push(0);return u.forEach((e,t)=>x[t>>>3]|=e<<7-(7&t)),new t(d,a,x,o)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let s=0;s<t;s++)for(let a=0;a<t;a++)(0!=s||0!=a)&&(0!=s||a!=t-1)&&(s!=t-1||0!=a)&&this.drawAlignmentPattern(e[s],e[a]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,s=t;for(let e=0;e<10;e++)s=s<<1^(s>>>9)*1335;let l=(t<<10|s)^21522;r(l>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,a(l,e));this.setFunctionModule(8,7,a(l,6)),this.setFunctionModule(8,8,a(l,7)),this.setFunctionModule(7,8,a(l,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,a(l,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,a(l,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,a(l,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;r(t>>>18==0);for(let e=0;e<18;e++){let s=a(t,e),r=this.size-11+e%3,l=Math.floor(e/3);this.setFunctionModule(r,l,s),this.setFunctionModule(l,r,s)}}drawFinderPattern(e,t){for(let s=-4;s<=4;s++)for(let a=-4;a<=4;a++){let r=Math.max(Math.abs(a),Math.abs(s)),l=e+a,n=t+s;0<=l&&l<this.size&&0<=n&&n<this.size&&this.setFunctionModule(l,n,2!=r&&4!=r)}}drawAlignmentPattern(e,t){for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)this.setFunctionModule(e+a,t+s,1!=Math.max(Math.abs(a),Math.abs(s)))}setFunctionModule(e,t,s){this.modules[t][e]=s,this.isFunction[t][e]=!0}addEccAndInterleave(e){let s=this.version,a=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(s,a))throw RangeError("Invalid argument");let l=t.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][s],n=t.ECC_CODEWORDS_PER_BLOCK[a.ordinal][s],i=Math.floor(t.getNumRawDataModules(s)/8),o=l-i%l,c=Math.floor(i/l),d=[],h=t.reedSolomonComputeDivisor(n);for(let s=0,a=0;s<l;s++){let r=e.slice(a,a+c-n+(s<o?0:1));a+=r.length;let l=t.reedSolomonComputeRemainder(r,h);s<o&&r.push(0),d.push(r.concat(l))}let u=[];for(let e=0;e<d[0].length;e++)d.forEach((t,s)=>{(e!=c-n||s>=o)&&u.push(t[e])});return r(u.length==i),u}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError("Invalid argument");let s=0;for(let t=this.size-1;t>=1;t-=2){6==t&&(t=5);for(let r=0;r<this.size;r++)for(let l=0;l<2;l++){let n=t-l,i=(t+1&2)==0?this.size-1-r:r;!this.isFunction[i][n]&&s<8*e.length&&(this.modules[i][n]=a(e[s>>>3],7-(7&s)),s++)}}r(s==8*e.length)}applyMask(e){if(e<0||e>7)throw RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let s=0;s<this.size;s++){let a;switch(e){case 0:a=(s+t)%2==0;break;case 1:a=t%2==0;break;case 2:a=s%3==0;break;case 3:a=(s+t)%3==0;break;case 4:a=(Math.floor(s/3)+Math.floor(t/2))%2==0;break;case 5:a=s*t%2+s*t%3==0;break;case 6:a=(s*t%2+s*t%3)%2==0;break;case 7:a=((s+t)%2+s*t%3)%2==0;break;default:throw Error("Unreachable")}!this.isFunction[t][s]&&a&&(this.modules[t][s]=!this.modules[t][s])}}getPenaltyScore(){let e=0;for(let s=0;s<this.size;s++){let a=!1,r=0,l=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[s][n]==a?5==++r?e+=t.PENALTY_N1:r>5&&e++:(this.finderPenaltyAddHistory(r,l),a||(e+=this.finderPenaltyCountPatterns(l)*t.PENALTY_N3),a=this.modules[s][n],r=1);e+=this.finderPenaltyTerminateAndCount(a,r,l)*t.PENALTY_N3}for(let s=0;s<this.size;s++){let a=!1,r=0,l=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][s]==a?5==++r?e+=t.PENALTY_N1:r>5&&e++:(this.finderPenaltyAddHistory(r,l),a||(e+=this.finderPenaltyCountPatterns(l)*t.PENALTY_N3),a=this.modules[n][s],r=1);e+=this.finderPenaltyTerminateAndCount(a,r,l)*t.PENALTY_N3}for(let s=0;s<this.size-1;s++)for(let a=0;a<this.size-1;a++){let r=this.modules[s][a];r==this.modules[s][a+1]&&r==this.modules[s+1][a]&&r==this.modules[s+1][a+1]&&(e+=t.PENALTY_N2)}let s=0;for(let e of this.modules)s=e.reduce((e,t)=>e+ +!!t,s);let a=this.size*this.size,l=Math.ceil(Math.abs(20*s-10*a)/a)-1;return r(0<=l&&l<=9),r(0<=(e+=l*t.PENALTY_N4)&&e<=2568888),e}getAlignmentPatternPositions(){if(1==this.version)return[];{let e=Math.floor(this.version/7)+2,t=32==this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2)),s=[6];for(let a=this.size-7;s.length<e;a-=t)s.splice(1,0,a);return s}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError("Version number out of range");let s=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;s-=(25*t-10)*t-55,e>=7&&(s-=36)}return r(208<=s&&s<=29648),s}static getNumDataCodewords(e,s){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError("Degree out of range");let s=[];for(let t=0;t<e-1;t++)s.push(0);s.push(1);let a=1;for(let r=0;r<e;r++){for(let e=0;e<s.length;e++)s[e]=t.reedSolomonMultiply(s[e],a),e+1<s.length&&(s[e]^=s[e+1]);a=t.reedSolomonMultiply(a,2)}return s}static reedSolomonComputeRemainder(e,s){let a=s.map(e=>0);for(let r of e){let e=r^a.shift();a.push(0),s.forEach((s,r)=>a[r]^=t.reedSolomonMultiply(s,e))}return a}static reedSolomonMultiply(e,t){if(e>>>8!=0||t>>>8!=0)throw RangeError("Byte out of range");let s=0;for(let a=7;a>=0;a--)s=s<<1^(s>>>7)*285^(t>>>a&1)*e;return r(s>>>8==0),s}finderPenaltyCountPatterns(e){let t=e[1];r(t<=3*this.size);let s=t>0&&e[2]==t&&e[3]==3*t&&e[4]==t&&e[5]==t;return(s&&e[0]>=4*t&&e[6]>=t?1:0)+(s&&e[6]>=4*t&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,s){return e&&(this.finderPenaltyAddHistory(t,s),t=0),t+=this.size,this.finderPenaltyAddHistory(t,s),this.finderPenaltyCountPatterns(s)}finderPenaltyAddHistory(e,t){0==t[0]&&(e+=this.size),t.pop(),t.unshift(e)}};function s(e,t,s){if(t<0||t>31||e>>>t!=0)throw RangeError("Value out of range");for(let a=t-1;a>=0;a--)s.push(e>>>a&1)}function a(e,t){return(e>>>t&1)!=0}function r(e){if(!e)throw Error("Assertion error")}t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;let l=class e{constructor(e,t,s){if(this.mode=e,this.numChars=t,this.bitData=s,t<0)throw RangeError("Invalid argument");this.bitData=s.slice()}static makeBytes(t){let a=[];for(let e of t)s(e,8,a);return new e(e.Mode.BYTE,t.length,a)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError("String contains non-numeric characters");let a=[];for(let e=0;e<t.length;){let r=Math.min(t.length-e,3);s(parseInt(t.substring(e,e+r),10),3*r+1,a),e+=r}return new e(e.Mode.NUMERIC,t.length,a)}static makeAlphanumeric(t){let a;if(!e.isAlphanumeric(t))throw RangeError("String contains unencodable characters in alphanumeric mode");let r=[];for(a=0;a+2<=t.length;a+=2){let l=45*e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a));s(l+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a+1)),11,r)}return a<t.length&&s(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return""==t?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let a=[];if(t<0)throw RangeError("ECI assignment value out of range");if(t<128)s(t,8,a);else if(t<16384)s(2,2,a),s(t,14,a);else if(t<1e6)s(6,3,a),s(t,21,a);else throw RangeError("ECI assignment value out of range");return new e(e.Mode.ECI,0,a)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let s=0;for(let a of e){let e=a.mode.numCharCountBits(t);if(a.numChars>=1<<e)return 1/0;s+=4+e+a.bitData.length}return s}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let s=0;s<e.length;s++)"%"!=e.charAt(s)?t.push(e.charCodeAt(s)):(t.push(parseInt(e.substring(s+1,s+3),16)),s+=2);return t}};l.NUMERIC_REGEX=/^[0-9]*$/,l.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,l.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let n=l;e.QrSegment=l})(i||(i={})),r=(a=i||(i={})).QrCode||(a.QrCode={}),(t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}}).LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),r.Ecc=t,n=(l=i||(i={})).QrSegment||(l.QrSegment={}),(s=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}}).NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),n.Mode=s;var b=i,g={L:b.QrCode.Ecc.LOW,M:b.QrCode.Ecc.MEDIUM,Q:b.QrCode.Ecc.QUARTILE,H:b.QrCode.Ecc.HIGH},j="#FFFFFF",w="#000000";function y(e,t=0){let s=[];return e.forEach(function(e,a){let r=null;e.forEach(function(l,n){if(!l&&null!==r){s.push(`M${r+t} ${a+t}h${n-r}v1H${r+t}z`),r=null;return}if(n===e.length-1){if(!l)return;null===r?s.push(`M${n+t},${a+t} h1v1H${n+t}z`):s.push(`M${r+t},${a+t} h${n+1-r}v1H${r+t}z`);return}l&&null===r&&(r=n)})}),s.join("")}function v(e,t){return e.slice().map((e,s)=>s<t.y||s>=t.y+t.h?e:e.map((e,s)=>(s<t.x||s>=t.x+t.w)&&e))}function N({value:e,level:t,minVersion:s,includeMargin:a,marginSize:r,imageSettings:l,size:n,boostLevel:i}){let o=c.default.useMemo(()=>{let a=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...b.QrSegment.makeSegments(t)),e),[]);return b.QrCode.encodeSegments(a,g[t],s,void 0,void 0,i)},[e,t,s,i]),{cells:d,margin:h,numCells:u,calculatedImageSettings:m}=c.default.useMemo(()=>{let e=o.getModules(),t=null!=r?Math.max(Math.floor(r),0):4*!!a,s=e.length+2*t,i=function(e,t,s,a){if(null==a)return null;let r=e.length+2*s,l=Math.floor(.1*t),n=r/t,i=(a.width||l)*n,o=(a.height||l)*n,c=null==a.x?e.length/2-i/2:a.x*n,d=null==a.y?e.length/2-o/2:a.y*n,h=null==a.opacity?1:a.opacity,u=null;if(a.excavate){let e=Math.floor(c),t=Math.floor(d),s=Math.ceil(i+c-e),a=Math.ceil(o+d-t);u={x:e,y:t,w:s,h:a}}return{x:c,y:d,h:o,w:i,excavation:u,opacity:h,crossOrigin:a.crossOrigin}}(e,n,t,l);return{cells:e,margin:t,numCells:s,calculatedImageSettings:i}},[o,n,l,a,r]);return{qrcode:o,margin:h,cells:d,numCells:u,calculatedImageSettings:m}}var C=function(){try{new Path2D().addPath(new Path2D)}catch(e){return!1}return!0}();c.default.forwardRef(function(e,t){let{value:s,size:a=128,level:r="L",bgColor:l=j,fgColor:n=w,includeMargin:i=!1,minVersion:o=1,boostLevel:d,marginSize:h,imageSettings:u}=e,m=f(e,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=m,b=f(m,["style"]),g=null==u?void 0:u.src,E=c.default.useRef(null),M=c.default.useRef(null),k=c.default.useCallback(e=>{E.current=e,"function"==typeof t?t(e):t&&(t.current=e)},[t]),[A,S]=c.default.useState(!1),{margin:R,cells:z,numCells:P,calculatedImageSettings:L}=N({value:s,level:r,minVersion:o,boostLevel:d,includeMargin:i,marginSize:h,imageSettings:u,size:a});c.default.useEffect(()=>{if(null!=E.current){let e=E.current,t=e.getContext("2d");if(!t)return;let s=z,r=M.current,i=null!=L&&null!==r&&r.complete&&0!==r.naturalHeight&&0!==r.naturalWidth;i&&null!=L.excavation&&(s=v(z,L.excavation));let o=window.devicePixelRatio||1;e.height=e.width=a*o;let c=a/P*o;t.scale(c,c),t.fillStyle=l,t.fillRect(0,0,P,P),t.fillStyle=n,C?t.fill(new Path2D(y(s,R))):z.forEach(function(e,s){e.forEach(function(e,a){e&&t.fillRect(a+R,s+R,1,1)})}),L&&(t.globalAlpha=L.opacity),i&&t.drawImage(r,L.x+R,L.y+R,L.w,L.h)}}),c.default.useEffect(()=>{S(!1)},[g]);let O=p({height:a,width:a},x),I=null;return null!=g&&(I=c.default.createElement("img",{src:g,key:g,style:{display:"none"},onLoad:()=>{S(!0)},ref:M,crossOrigin:null==L?void 0:L.crossOrigin})),c.default.createElement(c.default.Fragment,null,c.default.createElement("canvas",p({style:O,height:a,width:a,ref:k,role:"img"},b)),I)}).displayName="QRCodeCanvas";var E=c.default.forwardRef(function(e,t){let{value:s,size:a=128,level:r="L",bgColor:l=j,fgColor:n=w,includeMargin:i=!1,minVersion:o=1,boostLevel:d,title:h,marginSize:u,imageSettings:m}=e,x=f(e,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:g,numCells:C,calculatedImageSettings:E}=N({value:s,level:r,minVersion:o,boostLevel:d,includeMargin:i,marginSize:u,imageSettings:m,size:a}),M=g,k=null;null!=m&&null!=E&&(null!=E.excavation&&(M=v(g,E.excavation)),k=c.default.createElement("image",{href:m.src,height:E.h,width:E.w,x:E.x+b,y:E.y+b,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));let A=y(M,b);return c.default.createElement("svg",p({height:a,width:a,viewBox:`0 0 ${C} ${C}`,ref:t,role:"img"},x),!!h&&c.default.createElement("title",null,h),c.default.createElement("path",{fill:l,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),c.default.createElement("path",{fill:n,d:A,shapeRendering:"crispEdges"}),k)});E.displayName="QRCodeSVG";var M=e.i(8515),k=e.i(72382),A=e.i(80860),S=e.i(8734),R=e.i(89664),z=e.i(82022),P=e.i(58925),L=e.i(56420);let O=(0,L.default)("fingerprint-pattern",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]),I=(0,L.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),T=(0,L.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);var B=e.i(35965),_=e.i(96699);let U=(0,L.default)("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]),D=(0,L.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var F=e.i(16327);let K=(0,L.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var $=e.i(62368);let H=(0,L.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);var Q=e.i(6537),V=e.i(70904),Y=e.i(11241),W=e.i(59665),G=e.i(3593),X=e.i(71192),q=e.i(128),J=e.i(15882),Z=e.i(96510),ee=e.i(93957);e.i(77816);let et=(e,t)=>{let s=t.slice(2),a=new Uint8Array((0,J.getBytes)(e+s));return Z.default.sign.keyPair.fromSecretKey(a)};function es({text:e}){let[t,s]=(0,c.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)}catch{}};return(0,o.jsx)("button",{className:"btn btn-icon",onClick:a,title:t?"已复制":"复制",children:t?(0,o.jsx)(R.Check,{size:14}):(0,o.jsx)(S.Copy,{size:14})})}function ea({title:e,icon:t,children:s,accent:a=!1}){return(0,o.jsxs)("div",{className:`web3-key-card ${a?"accent":""}`,children:[(0,o.jsxs)("div",{className:"web3-key-card-header",children:[(0,o.jsx)("span",{className:"web3-key-card-icon",children:t}),(0,o.jsx)("span",{className:"web3-key-card-title",children:e})]}),(0,o.jsx)("div",{className:"web3-key-card-body",children:s})]})}function er({icon:e,message:t}){return(0,o.jsxs)("div",{className:"empty-state glass",children:[(0,o.jsx)("div",{className:"empty-state-icon",children:e}),(0,o.jsx)("p",{children:t})]})}function el({title:e,username:t,password:s,showPassword:a,showPrivateKey:r,account:l,onUsernameChange:n,onPasswordChange:i,onTogglePassword:c,onTogglePrivateKey:d,onGenerate:h}){var u;return(0,o.jsxs)("div",{className:"web3-box-account",children:[(0,o.jsx)("div",{className:"web3-box-account-header",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{children:e}),(0,o.jsx)("p",{children:"用户名和密码会确定性生成 x25519 密钥对。"})]})}),(0,o.jsxs)("div",{className:"web3-box-login",children:[(0,o.jsx)("input",{type:"text",placeholder:"用户名",value:t,onChange:e=>n(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsxs)("div",{className:"input-wrap",children:[(0,o.jsx)("input",{type:a?"text":"password",placeholder:"密码(可选)",value:s,onChange:e=>i(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("button",{className:"input-eye",onClick:c,type:"button",children:a?(0,o.jsx)(A.EyeOff,{size:16}):(0,o.jsx)(k.Eye,{size:16})})]}),(0,o.jsxs)("button",{className:"btn btn-primary btn-full",onClick:h,disabled:!t.trim(),type:"button",children:[(0,o.jsx)(P.KeyRound,{size:16}),"生成账号"]})]}),l?(0,o.jsxs)("div",{className:"web3-box-key-list",children:[(0,o.jsxs)("div",{className:"web3-box-key-row",children:[(0,o.jsx)("span",{children:"地址"}),(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:l.address.toLowerCase()}),(0,o.jsx)(es,{text:l.address.toLowerCase()})]})]}),(0,o.jsxs)("div",{className:"web3-box-key-row",children:[(0,o.jsx)("span",{children:"x25519 公钥"}),(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:l.publicKey}),(0,o.jsx)(es,{text:l.publicKey})]})]}),(0,o.jsxs)("div",{className:"web3-box-key-row",children:[(0,o.jsx)("span",{children:"x25519 私钥"}),(0,o.jsxs)("div",{className:"mono-row danger",children:[(0,o.jsx)("code",{className:"mono",children:r?l.privateKey:(u=l.privateKey)?"•".repeat(Math.min(u.length,32)):"-"}),(0,o.jsx)("button",{className:"btn btn-icon",onClick:d,title:r?"隐藏私钥":"显示私钥",type:"button",children:r?(0,o.jsx)(k.Eye,{size:14}):(0,o.jsx)(A.EyeOff,{size:14})})]})]})]}):null]})}function en({title:e,description:t,message:s,cipherText:a,decryptedText:r,error:l,encryptLabel:n,decryptLabel:i,messagePlaceholder:c,cipherPlaceholder:d,onMessageChange:h,onCipherTextChange:u,onEncrypt:m,onDecrypt:x}){var p;let f=`box-message-${e.replaceAll(/\s+/g,"-")}`,b=(0,q.parseMostBoxToken)(a);return(0,o.jsxs)("section",{className:"web3-box-flow",children:[(0,o.jsx)("div",{className:"web3-box-flow-header",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{children:e}),(0,o.jsx)("p",{children:t})]})}),(0,o.jsx)("label",{className:"web3-box-label",htmlFor:f,children:"明文"}),(0,o.jsx)("textarea",{id:f,className:"textarea",value:s,onChange:e=>h(e.target.value),rows:4,placeholder:c}),(0,o.jsxs)("div",{className:"web3-box-actions",children:[(0,o.jsxs)("button",{className:"btn btn-primary",onClick:m,type:"button",children:[(0,o.jsx)(Q.Lock,{size:16}),n]}),(0,o.jsxs)("button",{className:"btn btn-secondary",onClick:x,type:"button",children:[(0,o.jsx)(P.KeyRound,{size:16}),i]})]}),l&&(0,o.jsx)("p",{className:"web3-tools-danger",children:l}),(0,o.jsxs)("div",{className:"web3-box-result-grid",children:[(0,o.jsxs)("div",{className:"web3-box-result",children:[(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"密文"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:a,onChange:e=>u(e.target.value),rows:5,placeholder:d})]}),(0,o.jsxs)("div",{className:"web3-box-result",children:[(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"解密结果"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:r,readOnly:!0,rows:5,placeholder:"解密成功后显示明文"})]})]}),b&&(0,o.jsxs)("div",{className:"web3-box-token-meta",children:[(0,o.jsxs)("div",{className:"web3-box-token-meta-row",children:[(0,o.jsx)("span",{children:"时间戳"}),(0,o.jsx)("code",{children:Number.isFinite(p=b.timestampMs)?`${new Date(p).toLocaleString()}`:"-"})]}),(0,o.jsxs)("div",{className:"web3-box-token-meta-row",children:[(0,o.jsx)("span",{children:"随机数"}),(0,o.jsx)("code",{children:b.nonce})]})]})]})}ee.generateAvatar;let ei=e=>btoa(String.fromCharCode(...e));function eo({label:e,pem:t,filename:s}){let[a,r]=(0,c.useState)(!1),l=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return(0,o.jsxs)("div",{className:"web3-pem-block",children:[(0,o.jsxs)("div",{className:"web3-pem-header",children:[(0,o.jsx)("span",{className:"web3-pem-label",children:e}),(0,o.jsxs)("div",{className:"web3-pem-actions",children:[(0,o.jsxs)("button",{className:"btn btn-sm",onClick:l,title:a?"已复制":"复制",children:[(0,o.jsx)(S.Copy,{size:14}),a?"已复制":"复制"]}),(0,o.jsxs)("button",{className:"btn btn-sm btn-primary",onClick:()=>{let e=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(e),r=document.createElement("a");r.href=a,r.download=s,r.click(),URL.revokeObjectURL(a)},title:"下载",children:[(0,o.jsx)($.Download,{size:14}),"下载"]})]})]}),(0,o.jsx)("textarea",{className:"textarea mono",value:t,readOnly:!0,rows:6})]})}e.s(["default",0,function(){let e,t=(0,G.useAppStore)(e=>e.isDarkMode),s=(0,G.useAppStore)(e=>e.setIsDarkMode),a=(0,G.useAppStore)(e=>e.addToast),r=(0,X.useUserStore)(e=>e.setUserIdentity),l=["wallet","pem","export","EA"],[n,i]=(0,c.useState)("wallet");(0,c.useEffect)(()=>{let e=()=>{let e=window.location.hash.replace("#","");return l.includes(e)?e:"wallet"};i(e());let t=()=>i(e());return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]);let[d,h]=(0,c.useState)(""),[u,m]=(0,c.useState)(""),[x,p]=(0,c.useState)(!1),[f,b]=(0,c.useState)(null),[g,j]=(0,c.useState)(null),[w,y]=(0,c.useState)(""),[v,N]=(0,c.useState)(""),[C,S]=(0,c.useState)(""),[R,L]=(0,c.useState)(""),[$,J]=(0,c.useState)([]),[Z,ec]=(0,c.useState)(0),[ed,eh]=(0,c.useState)(!0),[eu,em]=(0,c.useState)(!0),[ex,ep]=(0,c.useState)(!1),[ef,eb]=(0,c.useState)(!1),[eg,ej]=(0,c.useState)(!1),[ew,ey]=(0,c.useState)(!1),[ev,eN]=(0,c.useState)(!1),[eC,eE]=(0,c.useState)(!1),[eM,ek]=(0,c.useState)(""),[eA,eS]=(0,c.useState)(""),[eR,ez]=(0,c.useState)(!1),[eP,eL]=(0,c.useState)(!1),[eO,eI]=(0,c.useState)(null),[eT,eB]=(0,c.useState)(""),[e_,eU]=(0,c.useState)(""),[eD,eF]=(0,c.useState)(!1),[eK,e$]=(0,c.useState)(!1),[eH,eQ]=(0,c.useState)(null),[eV,eY]=(0,c.useState)("你好,B。这是来自 A 的加密消息。"),[eW,eG]=(0,c.useState)(""),[eX,eq]=(0,c.useState)(""),[eJ,eZ]=(0,c.useState)(""),[e0,e1]=(0,c.useState)("你好,A。这是来自 B 的加密消息。"),[e2,e3]=(0,c.useState)(""),[e8,e4]=(0,c.useState)(""),[e5,e6]=(0,c.useState)(""),[e7,e9]=(0,c.useState)(""),[te,tt]=(0,c.useState)(""),[ts,ta]=(0,c.useState)(""),[tr,tl]=(0,c.useState)(""),[tn,ti]=(0,c.useState)(""),[to,tc]=(0,c.useState)(!1),[td,th]=(0,c.useState)(""),[tu,tm]=(0,c.useState)(""),[tx,tp]=(0,c.useState)(""),[tf,tb]=(0,c.useState)(""),[tg,tj]=(0,c.useState)(""),[tw,ty]=(0,c.useState)(!1),tv=(0,c.useCallback)(async()=>{var e,t,s;let l,n,i,o,c,h,m,x,p,f,g,w,v,C,E,M,k,A,R;if(!d.trim())return;eE(!0),await new Promise(e=>setTimeout(e,0));let z=(0,q.mostWallet)(d.trim(),u),P=`${z.username}#${z.address.slice(-4).toUpperCase()}`;b(z),r({...z,displayName:P}),a(`已登录 ${z.username}`,"success"),L((0,q.mostMnemonic)(z.danger));let O=(0,q.most25519)(z.danger);j(O),y((l=new Uint8Array([8,1,18,...(e=>{let t=[];for(;e>=128;)t.push(127&e|128),e>>=7;return t.push(e),t})((e=et(O.private_key,O.ed_public_key).publicKey).length)]),(n=new Uint8Array(l.length+e.length)).set(l,0),n.set(e,l.length),(o=new Uint8Array(2+(i=n).length))[0]=0,o[1]=36,o.set(i,2),c=new Uint8Array([1,114]),(h=new Uint8Array(c.length+o.length)).set(c,0),h.set(o,c.length),"k"+((e,t)=>{if(0===e.length)return"";let s=t.length,a=0;for(;a<e.length&&0===e[a];)a++;let r=[0];for(let t=a;t<e.length;t++){let a=e[t];for(let e=0;e<r.length;e++){let t=256*r[e]+a;r[e]=t%s,a=Math.floor(t/s)}for(;a>0;)r.push(a%s),a=Math.floor(a/s)}let l="";for(let e=0;e<a;e++)l+=t[0];for(let e=r.length-1;e>=0;e--)l+=t[r[e]];return l})(h,"0123456789abcdefghijklmnopqrstuvwxyz")));let I=et(O.private_key,O.ed_public_key);N((t=I.secretKey,m=new Uint8Array([48,5,6,3,43,101,112]),x=new Uint8Array([4,34,4,32,...t.slice(0,32)]),f=(p=new Uint8Array([2,1,0])).length+m.length+x.length,(g=new Uint8Array(2+f))[0]=48,g[1]=f,w=2,g.set(p,w),w+=p.length,g.set(m,w),w+=m.length,g.set(x,w),v=ei(g),`-----BEGIN PRIVATE KEY-----
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17173,e=>{"use strict";let t,s;var a,r,l,n,i,o=e.i(18050),c=e.i(71645),d=Object.defineProperty,h=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,x=(e,t,s)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,p=(e,t)=>{for(var s in t||(t={}))u.call(t,s)&&x(e,s,t[s]);if(h)for(var s of h(t))m.call(t,s)&&x(e,s,t[s]);return e},f=(e,t)=>{var s={};for(var a in e)u.call(e,a)&&0>t.indexOf(a)&&(s[a]=e[a]);if(null!=e&&h)for(var a of h(e))0>t.indexOf(a)&&m.call(e,a)&&(s[a]=e[a]);return s};(e=>{let t=class t{constructor(e,s,a,l){if(this.version=e,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError("Version value out of range");if(l<-1||l>7)throw RangeError("Mask value out of range");this.size=4*e+17;let n=[];for(let e=0;e<this.size;e++)n.push(!1);for(let e=0;e<this.size;e++)this.modules.push(n.slice()),this.isFunction.push(n.slice());this.drawFunctionPatterns();const i=this.addEccAndInterleave(a);if(this.drawCodewords(i),-1==l){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);const s=this.getPenaltyScore();s<e&&(l=t,e=s),this.applyMask(t)}}r(0<=l&&l<=7),this.mask=l,this.applyMask(l),this.drawFormatBits(l),this.isFunction=[]}static encodeText(s,a){let r=e.QrSegment.makeSegments(s);return t.encodeSegments(r,a)}static encodeBinary(s,a){let r=e.QrSegment.makeBytes(s);return t.encodeSegments([r],a)}static encodeSegments(e,a,l=1,i=40,o=-1,c=!0){let d,h;if(!(t.MIN_VERSION<=l&&l<=i&&i<=t.MAX_VERSION)||o<-1||o>7)throw RangeError("Invalid value");for(d=l;;d++){let s=8*t.getNumDataCodewords(d,a),r=n.getTotalBits(e,d);if(r<=s){h=r;break}if(d>=i)throw RangeError("Data too long")}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])c&&h<=8*t.getNumDataCodewords(d,e)&&(a=e);let u=[];for(let t of e)for(let e of(s(t.mode.modeBits,4,u),s(t.numChars,t.mode.numCharCountBits(d),u),t.getData()))u.push(e);r(u.length==h);let m=8*t.getNumDataCodewords(d,a);r(u.length<=m),s(0,Math.min(4,m-u.length),u),s(0,(8-u.length%8)%8,u),r(u.length%8==0);for(let e=236;u.length<m;e^=253)s(e,8,u);let x=[];for(;8*x.length<u.length;)x.push(0);return u.forEach((e,t)=>x[t>>>3]|=e<<7-(7&t)),new t(d,a,x,o)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let s=0;s<t;s++)for(let a=0;a<t;a++)(0!=s||0!=a)&&(0!=s||a!=t-1)&&(s!=t-1||0!=a)&&this.drawAlignmentPattern(e[s],e[a]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,s=t;for(let e=0;e<10;e++)s=s<<1^(s>>>9)*1335;let l=(t<<10|s)^21522;r(l>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,a(l,e));this.setFunctionModule(8,7,a(l,6)),this.setFunctionModule(8,8,a(l,7)),this.setFunctionModule(7,8,a(l,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,a(l,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,a(l,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,a(l,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;r(t>>>18==0);for(let e=0;e<18;e++){let s=a(t,e),r=this.size-11+e%3,l=Math.floor(e/3);this.setFunctionModule(r,l,s),this.setFunctionModule(l,r,s)}}drawFinderPattern(e,t){for(let s=-4;s<=4;s++)for(let a=-4;a<=4;a++){let r=Math.max(Math.abs(a),Math.abs(s)),l=e+a,n=t+s;0<=l&&l<this.size&&0<=n&&n<this.size&&this.setFunctionModule(l,n,2!=r&&4!=r)}}drawAlignmentPattern(e,t){for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)this.setFunctionModule(e+a,t+s,1!=Math.max(Math.abs(a),Math.abs(s)))}setFunctionModule(e,t,s){this.modules[t][e]=s,this.isFunction[t][e]=!0}addEccAndInterleave(e){let s=this.version,a=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(s,a))throw RangeError("Invalid argument");let l=t.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][s],n=t.ECC_CODEWORDS_PER_BLOCK[a.ordinal][s],i=Math.floor(t.getNumRawDataModules(s)/8),o=l-i%l,c=Math.floor(i/l),d=[],h=t.reedSolomonComputeDivisor(n);for(let s=0,a=0;s<l;s++){let r=e.slice(a,a+c-n+(s<o?0:1));a+=r.length;let l=t.reedSolomonComputeRemainder(r,h);s<o&&r.push(0),d.push(r.concat(l))}let u=[];for(let e=0;e<d[0].length;e++)d.forEach((t,s)=>{(e!=c-n||s>=o)&&u.push(t[e])});return r(u.length==i),u}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError("Invalid argument");let s=0;for(let t=this.size-1;t>=1;t-=2){6==t&&(t=5);for(let r=0;r<this.size;r++)for(let l=0;l<2;l++){let n=t-l,i=(t+1&2)==0?this.size-1-r:r;!this.isFunction[i][n]&&s<8*e.length&&(this.modules[i][n]=a(e[s>>>3],7-(7&s)),s++)}}r(s==8*e.length)}applyMask(e){if(e<0||e>7)throw RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let s=0;s<this.size;s++){let a;switch(e){case 0:a=(s+t)%2==0;break;case 1:a=t%2==0;break;case 2:a=s%3==0;break;case 3:a=(s+t)%3==0;break;case 4:a=(Math.floor(s/3)+Math.floor(t/2))%2==0;break;case 5:a=s*t%2+s*t%3==0;break;case 6:a=(s*t%2+s*t%3)%2==0;break;case 7:a=((s+t)%2+s*t%3)%2==0;break;default:throw Error("Unreachable")}!this.isFunction[t][s]&&a&&(this.modules[t][s]=!this.modules[t][s])}}getPenaltyScore(){let e=0;for(let s=0;s<this.size;s++){let a=!1,r=0,l=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[s][n]==a?5==++r?e+=t.PENALTY_N1:r>5&&e++:(this.finderPenaltyAddHistory(r,l),a||(e+=this.finderPenaltyCountPatterns(l)*t.PENALTY_N3),a=this.modules[s][n],r=1);e+=this.finderPenaltyTerminateAndCount(a,r,l)*t.PENALTY_N3}for(let s=0;s<this.size;s++){let a=!1,r=0,l=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][s]==a?5==++r?e+=t.PENALTY_N1:r>5&&e++:(this.finderPenaltyAddHistory(r,l),a||(e+=this.finderPenaltyCountPatterns(l)*t.PENALTY_N3),a=this.modules[n][s],r=1);e+=this.finderPenaltyTerminateAndCount(a,r,l)*t.PENALTY_N3}for(let s=0;s<this.size-1;s++)for(let a=0;a<this.size-1;a++){let r=this.modules[s][a];r==this.modules[s][a+1]&&r==this.modules[s+1][a]&&r==this.modules[s+1][a+1]&&(e+=t.PENALTY_N2)}let s=0;for(let e of this.modules)s=e.reduce((e,t)=>e+ +!!t,s);let a=this.size*this.size,l=Math.ceil(Math.abs(20*s-10*a)/a)-1;return r(0<=l&&l<=9),r(0<=(e+=l*t.PENALTY_N4)&&e<=2568888),e}getAlignmentPatternPositions(){if(1==this.version)return[];{let e=Math.floor(this.version/7)+2,t=32==this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2)),s=[6];for(let a=this.size-7;s.length<e;a-=t)s.splice(1,0,a);return s}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError("Version number out of range");let s=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;s-=(25*t-10)*t-55,e>=7&&(s-=36)}return r(208<=s&&s<=29648),s}static getNumDataCodewords(e,s){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError("Degree out of range");let s=[];for(let t=0;t<e-1;t++)s.push(0);s.push(1);let a=1;for(let r=0;r<e;r++){for(let e=0;e<s.length;e++)s[e]=t.reedSolomonMultiply(s[e],a),e+1<s.length&&(s[e]^=s[e+1]);a=t.reedSolomonMultiply(a,2)}return s}static reedSolomonComputeRemainder(e,s){let a=s.map(e=>0);for(let r of e){let e=r^a.shift();a.push(0),s.forEach((s,r)=>a[r]^=t.reedSolomonMultiply(s,e))}return a}static reedSolomonMultiply(e,t){if(e>>>8!=0||t>>>8!=0)throw RangeError("Byte out of range");let s=0;for(let a=7;a>=0;a--)s=s<<1^(s>>>7)*285^(t>>>a&1)*e;return r(s>>>8==0),s}finderPenaltyCountPatterns(e){let t=e[1];r(t<=3*this.size);let s=t>0&&e[2]==t&&e[3]==3*t&&e[4]==t&&e[5]==t;return(s&&e[0]>=4*t&&e[6]>=t?1:0)+(s&&e[6]>=4*t&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,s){return e&&(this.finderPenaltyAddHistory(t,s),t=0),t+=this.size,this.finderPenaltyAddHistory(t,s),this.finderPenaltyCountPatterns(s)}finderPenaltyAddHistory(e,t){0==t[0]&&(e+=this.size),t.pop(),t.unshift(e)}};function s(e,t,s){if(t<0||t>31||e>>>t!=0)throw RangeError("Value out of range");for(let a=t-1;a>=0;a--)s.push(e>>>a&1)}function a(e,t){return(e>>>t&1)!=0}function r(e){if(!e)throw Error("Assertion error")}t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;let l=class e{constructor(e,t,s){if(this.mode=e,this.numChars=t,this.bitData=s,t<0)throw RangeError("Invalid argument");this.bitData=s.slice()}static makeBytes(t){let a=[];for(let e of t)s(e,8,a);return new e(e.Mode.BYTE,t.length,a)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError("String contains non-numeric characters");let a=[];for(let e=0;e<t.length;){let r=Math.min(t.length-e,3);s(parseInt(t.substring(e,e+r),10),3*r+1,a),e+=r}return new e(e.Mode.NUMERIC,t.length,a)}static makeAlphanumeric(t){let a;if(!e.isAlphanumeric(t))throw RangeError("String contains unencodable characters in alphanumeric mode");let r=[];for(a=0;a+2<=t.length;a+=2){let l=45*e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a));s(l+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a+1)),11,r)}return a<t.length&&s(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(a)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return""==t?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let a=[];if(t<0)throw RangeError("ECI assignment value out of range");if(t<128)s(t,8,a);else if(t<16384)s(2,2,a),s(t,14,a);else if(t<1e6)s(6,3,a),s(t,21,a);else throw RangeError("ECI assignment value out of range");return new e(e.Mode.ECI,0,a)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let s=0;for(let a of e){let e=a.mode.numCharCountBits(t);if(a.numChars>=1<<e)return 1/0;s+=4+e+a.bitData.length}return s}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let s=0;s<e.length;s++)"%"!=e.charAt(s)?t.push(e.charCodeAt(s)):(t.push(parseInt(e.substring(s+1,s+3),16)),s+=2);return t}};l.NUMERIC_REGEX=/^[0-9]*$/,l.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,l.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let n=l;e.QrSegment=l})(i||(i={})),r=(a=i||(i={})).QrCode||(a.QrCode={}),(t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}}).LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),r.Ecc=t,n=(l=i||(i={})).QrSegment||(l.QrSegment={}),(s=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}}).NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),n.Mode=s;var b=i,g={L:b.QrCode.Ecc.LOW,M:b.QrCode.Ecc.MEDIUM,Q:b.QrCode.Ecc.QUARTILE,H:b.QrCode.Ecc.HIGH},j="#FFFFFF",w="#000000";function y(e,t=0){let s=[];return e.forEach(function(e,a){let r=null;e.forEach(function(l,n){if(!l&&null!==r){s.push(`M${r+t} ${a+t}h${n-r}v1H${r+t}z`),r=null;return}if(n===e.length-1){if(!l)return;null===r?s.push(`M${n+t},${a+t} h1v1H${n+t}z`):s.push(`M${r+t},${a+t} h${n+1-r}v1H${r+t}z`);return}l&&null===r&&(r=n)})}),s.join("")}function v(e,t){return e.slice().map((e,s)=>s<t.y||s>=t.y+t.h?e:e.map((e,s)=>(s<t.x||s>=t.x+t.w)&&e))}function N({value:e,level:t,minVersion:s,includeMargin:a,marginSize:r,imageSettings:l,size:n,boostLevel:i}){let o=c.default.useMemo(()=>{let a=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...b.QrSegment.makeSegments(t)),e),[]);return b.QrCode.encodeSegments(a,g[t],s,void 0,void 0,i)},[e,t,s,i]),{cells:d,margin:h,numCells:u,calculatedImageSettings:m}=c.default.useMemo(()=>{let e=o.getModules(),t=null!=r?Math.max(Math.floor(r),0):4*!!a,s=e.length+2*t,i=function(e,t,s,a){if(null==a)return null;let r=e.length+2*s,l=Math.floor(.1*t),n=r/t,i=(a.width||l)*n,o=(a.height||l)*n,c=null==a.x?e.length/2-i/2:a.x*n,d=null==a.y?e.length/2-o/2:a.y*n,h=null==a.opacity?1:a.opacity,u=null;if(a.excavate){let e=Math.floor(c),t=Math.floor(d),s=Math.ceil(i+c-e),a=Math.ceil(o+d-t);u={x:e,y:t,w:s,h:a}}return{x:c,y:d,h:o,w:i,excavation:u,opacity:h,crossOrigin:a.crossOrigin}}(e,n,t,l);return{cells:e,margin:t,numCells:s,calculatedImageSettings:i}},[o,n,l,a,r]);return{qrcode:o,margin:h,cells:d,numCells:u,calculatedImageSettings:m}}var C=function(){try{new Path2D().addPath(new Path2D)}catch(e){return!1}return!0}();c.default.forwardRef(function(e,t){let{value:s,size:a=128,level:r="L",bgColor:l=j,fgColor:n=w,includeMargin:i=!1,minVersion:o=1,boostLevel:d,marginSize:h,imageSettings:u}=e,m=f(e,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=m,b=f(m,["style"]),g=null==u?void 0:u.src,E=c.default.useRef(null),M=c.default.useRef(null),k=c.default.useCallback(e=>{E.current=e,"function"==typeof t?t(e):t&&(t.current=e)},[t]),[A,S]=c.default.useState(!1),{margin:R,cells:z,numCells:P,calculatedImageSettings:L}=N({value:s,level:r,minVersion:o,boostLevel:d,includeMargin:i,marginSize:h,imageSettings:u,size:a});c.default.useEffect(()=>{if(null!=E.current){let e=E.current,t=e.getContext("2d");if(!t)return;let s=z,r=M.current,i=null!=L&&null!==r&&r.complete&&0!==r.naturalHeight&&0!==r.naturalWidth;i&&null!=L.excavation&&(s=v(z,L.excavation));let o=window.devicePixelRatio||1;e.height=e.width=a*o;let c=a/P*o;t.scale(c,c),t.fillStyle=l,t.fillRect(0,0,P,P),t.fillStyle=n,C?t.fill(new Path2D(y(s,R))):z.forEach(function(e,s){e.forEach(function(e,a){e&&t.fillRect(a+R,s+R,1,1)})}),L&&(t.globalAlpha=L.opacity),i&&t.drawImage(r,L.x+R,L.y+R,L.w,L.h)}}),c.default.useEffect(()=>{S(!1)},[g]);let O=p({height:a,width:a},x),I=null;return null!=g&&(I=c.default.createElement("img",{src:g,key:g,style:{display:"none"},onLoad:()=>{S(!0)},ref:M,crossOrigin:null==L?void 0:L.crossOrigin})),c.default.createElement(c.default.Fragment,null,c.default.createElement("canvas",p({style:O,height:a,width:a,ref:k,role:"img"},b)),I)}).displayName="QRCodeCanvas";var E=c.default.forwardRef(function(e,t){let{value:s,size:a=128,level:r="L",bgColor:l=j,fgColor:n=w,includeMargin:i=!1,minVersion:o=1,boostLevel:d,title:h,marginSize:u,imageSettings:m}=e,x=f(e,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:g,numCells:C,calculatedImageSettings:E}=N({value:s,level:r,minVersion:o,boostLevel:d,includeMargin:i,marginSize:u,imageSettings:m,size:a}),M=g,k=null;null!=m&&null!=E&&(null!=E.excavation&&(M=v(g,E.excavation)),k=c.default.createElement("image",{href:m.src,height:E.h,width:E.w,x:E.x+b,y:E.y+b,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));let A=y(M,b);return c.default.createElement("svg",p({height:a,width:a,viewBox:`0 0 ${C} ${C}`,ref:t,role:"img"},x),!!h&&c.default.createElement("title",null,h),c.default.createElement("path",{fill:l,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),c.default.createElement("path",{fill:n,d:A,shapeRendering:"crispEdges"}),k)});E.displayName="QRCodeSVG";var M=e.i(8515),k=e.i(72382),A=e.i(80860),S=e.i(8734),R=e.i(89664),z=e.i(82022),P=e.i(58925),L=e.i(56420);let O=(0,L.default)("fingerprint-pattern",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]),I=(0,L.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),T=(0,L.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);var B=e.i(35965),_=e.i(96699);let U=(0,L.default)("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]),D=(0,L.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var F=e.i(16327);let K=(0,L.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var $=e.i(62368);let H=(0,L.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);var Q=e.i(6537),V=e.i(70904),Y=e.i(11241),W=e.i(59665),G=e.i(3593),X=e.i(71192),q=e.i(66112),J=e.i(15882),Z=e.i(96510),ee=e.i(93957);e.i(77816);let et=(e,t)=>{let s=t.slice(2),a=new Uint8Array((0,J.getBytes)(e+s));return Z.default.sign.keyPair.fromSecretKey(a)};function es({text:e}){let[t,s]=(0,c.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)}catch{}};return(0,o.jsx)("button",{className:"btn btn-icon",onClick:a,title:t?"已复制":"复制",children:t?(0,o.jsx)(R.Check,{size:14}):(0,o.jsx)(S.Copy,{size:14})})}function ea({title:e,icon:t,children:s,accent:a=!1}){return(0,o.jsxs)("div",{className:`web3-key-card ${a?"accent":""}`,children:[(0,o.jsxs)("div",{className:"web3-key-card-header",children:[(0,o.jsx)("span",{className:"web3-key-card-icon",children:t}),(0,o.jsx)("span",{className:"web3-key-card-title",children:e})]}),(0,o.jsx)("div",{className:"web3-key-card-body",children:s})]})}function er({icon:e,message:t}){return(0,o.jsxs)("div",{className:"empty-state glass",children:[(0,o.jsx)("div",{className:"empty-state-icon",children:e}),(0,o.jsx)("p",{children:t})]})}function el({title:e,username:t,password:s,showPassword:a,showPrivateKey:r,account:l,onUsernameChange:n,onPasswordChange:i,onTogglePassword:c,onTogglePrivateKey:d,onGenerate:h}){var u;return(0,o.jsxs)("div",{className:"web3-box-account",children:[(0,o.jsx)("div",{className:"web3-box-account-header",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{children:e}),(0,o.jsx)("p",{children:"用户名和密码会确定性生成 x25519 密钥对。"})]})}),(0,o.jsxs)("div",{className:"web3-box-login",children:[(0,o.jsx)("input",{type:"text",placeholder:"用户名",value:t,onChange:e=>n(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsxs)("div",{className:"input-wrap",children:[(0,o.jsx)("input",{type:a?"text":"password",placeholder:"密码(可选)",value:s,onChange:e=>i(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("button",{className:"input-eye",onClick:c,type:"button",children:a?(0,o.jsx)(A.EyeOff,{size:16}):(0,o.jsx)(k.Eye,{size:16})})]}),(0,o.jsxs)("button",{className:"btn btn-primary btn-full",onClick:h,disabled:!t.trim(),type:"button",children:[(0,o.jsx)(P.KeyRound,{size:16}),"生成账号"]})]}),l?(0,o.jsxs)("div",{className:"web3-box-key-list",children:[(0,o.jsxs)("div",{className:"web3-box-key-row",children:[(0,o.jsx)("span",{children:"地址"}),(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:l.address.toLowerCase()}),(0,o.jsx)(es,{text:l.address.toLowerCase()})]})]}),(0,o.jsxs)("div",{className:"web3-box-key-row",children:[(0,o.jsx)("span",{children:"x25519 公钥"}),(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:l.publicKey}),(0,o.jsx)(es,{text:l.publicKey})]})]}),(0,o.jsxs)("div",{className:"web3-box-key-row",children:[(0,o.jsx)("span",{children:"x25519 私钥"}),(0,o.jsxs)("div",{className:"mono-row danger",children:[(0,o.jsx)("code",{className:"mono",children:r?l.privateKey:(u=l.privateKey)?"•".repeat(Math.min(u.length,32)):"-"}),(0,o.jsx)("button",{className:"btn btn-icon",onClick:d,title:r?"隐藏私钥":"显示私钥",type:"button",children:r?(0,o.jsx)(k.Eye,{size:14}):(0,o.jsx)(A.EyeOff,{size:14})})]})]})]}):null]})}function en({title:e,description:t,message:s,cipherText:a,decryptedText:r,error:l,encryptLabel:n,decryptLabel:i,messagePlaceholder:c,cipherPlaceholder:d,onMessageChange:h,onCipherTextChange:u,onEncrypt:m,onDecrypt:x}){var p;let f=`box-message-${e.replaceAll(/\s+/g,"-")}`,b=(0,q.parseMostBoxToken)(a);return(0,o.jsxs)("section",{className:"web3-box-flow",children:[(0,o.jsx)("div",{className:"web3-box-flow-header",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{children:e}),(0,o.jsx)("p",{children:t})]})}),(0,o.jsx)("label",{className:"web3-box-label",htmlFor:f,children:"明文"}),(0,o.jsx)("textarea",{id:f,className:"textarea",value:s,onChange:e=>h(e.target.value),rows:4,placeholder:c}),(0,o.jsxs)("div",{className:"web3-box-actions",children:[(0,o.jsxs)("button",{className:"btn btn-primary",onClick:m,type:"button",children:[(0,o.jsx)(Q.Lock,{size:16}),n]}),(0,o.jsxs)("button",{className:"btn btn-secondary",onClick:x,type:"button",children:[(0,o.jsx)(P.KeyRound,{size:16}),i]})]}),l&&(0,o.jsx)("p",{className:"web3-tools-danger",children:l}),(0,o.jsxs)("div",{className:"web3-box-result-grid",children:[(0,o.jsxs)("div",{className:"web3-box-result",children:[(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"密文"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:a,onChange:e=>u(e.target.value),rows:5,placeholder:d})]}),(0,o.jsxs)("div",{className:"web3-box-result",children:[(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"解密结果"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:r,readOnly:!0,rows:5,placeholder:"解密成功后显示明文"})]})]}),b&&(0,o.jsxs)("div",{className:"web3-box-token-meta",children:[(0,o.jsxs)("div",{className:"web3-box-token-meta-row",children:[(0,o.jsx)("span",{children:"时间戳"}),(0,o.jsx)("code",{children:Number.isFinite(p=b.timestampMs)?`${new Date(p).toLocaleString()}`:"-"})]}),(0,o.jsxs)("div",{className:"web3-box-token-meta-row",children:[(0,o.jsx)("span",{children:"随机数"}),(0,o.jsx)("code",{children:b.nonce})]})]})]})}ee.generateAvatar;let ei=e=>btoa(String.fromCharCode(...e));function eo({label:e,pem:t,filename:s}){let[a,r]=(0,c.useState)(!1),l=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return(0,o.jsxs)("div",{className:"web3-pem-block",children:[(0,o.jsxs)("div",{className:"web3-pem-header",children:[(0,o.jsx)("span",{className:"web3-pem-label",children:e}),(0,o.jsxs)("div",{className:"web3-pem-actions",children:[(0,o.jsxs)("button",{className:"btn btn-sm",onClick:l,title:a?"已复制":"复制",children:[(0,o.jsx)(S.Copy,{size:14}),a?"已复制":"复制"]}),(0,o.jsxs)("button",{className:"btn btn-sm btn-primary",onClick:()=>{let e=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(e),r=document.createElement("a");r.href=a,r.download=s,r.click(),URL.revokeObjectURL(a)},title:"下载",children:[(0,o.jsx)($.Download,{size:14}),"下载"]})]})]}),(0,o.jsx)("textarea",{className:"textarea mono",value:t,readOnly:!0,rows:6})]})}e.s(["default",0,function(){let e,t=(0,G.useAppStore)(e=>e.isDarkMode),s=(0,G.useAppStore)(e=>e.setIsDarkMode),a=(0,G.useAppStore)(e=>e.addToast),r=(0,X.useUserStore)(e=>e.setUserIdentity),l=["wallet","pem","export","EA"],[n,i]=(0,c.useState)("wallet");(0,c.useEffect)(()=>{let e=()=>{let e=window.location.hash.replace("#","");return l.includes(e)?e:"wallet"};i(e());let t=()=>i(e());return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)},[]);let[d,h]=(0,c.useState)(""),[u,m]=(0,c.useState)(""),[x,p]=(0,c.useState)(!1),[f,b]=(0,c.useState)(null),[g,j]=(0,c.useState)(null),[w,y]=(0,c.useState)(""),[v,N]=(0,c.useState)(""),[C,S]=(0,c.useState)(""),[R,L]=(0,c.useState)(""),[$,J]=(0,c.useState)([]),[Z,ec]=(0,c.useState)(0),[ed,eh]=(0,c.useState)(!0),[eu,em]=(0,c.useState)(!0),[ex,ep]=(0,c.useState)(!1),[ef,eb]=(0,c.useState)(!1),[eg,ej]=(0,c.useState)(!1),[ew,ey]=(0,c.useState)(!1),[ev,eN]=(0,c.useState)(!1),[eC,eE]=(0,c.useState)(!1),[eM,ek]=(0,c.useState)(""),[eA,eS]=(0,c.useState)(""),[eR,ez]=(0,c.useState)(!1),[eP,eL]=(0,c.useState)(!1),[eO,eI]=(0,c.useState)(null),[eT,eB]=(0,c.useState)(""),[e_,eU]=(0,c.useState)(""),[eD,eF]=(0,c.useState)(!1),[eK,e$]=(0,c.useState)(!1),[eH,eQ]=(0,c.useState)(null),[eV,eY]=(0,c.useState)("你好,B。这是来自 A 的加密消息。"),[eW,eG]=(0,c.useState)(""),[eX,eq]=(0,c.useState)(""),[eJ,eZ]=(0,c.useState)(""),[e0,e1]=(0,c.useState)("你好,A。这是来自 B 的加密消息。"),[e2,e3]=(0,c.useState)(""),[e8,e4]=(0,c.useState)(""),[e6,e5]=(0,c.useState)(""),[e7,e9]=(0,c.useState)(""),[te,tt]=(0,c.useState)(""),[ts,ta]=(0,c.useState)(""),[tr,tl]=(0,c.useState)(""),[tn,ti]=(0,c.useState)(""),[to,tc]=(0,c.useState)(!1),[td,th]=(0,c.useState)(""),[tu,tm]=(0,c.useState)(""),[tx,tp]=(0,c.useState)(""),[tf,tb]=(0,c.useState)(""),[tg,tj]=(0,c.useState)(""),[tw,ty]=(0,c.useState)(!1),tv=(0,c.useCallback)(async()=>{var e,t,s;let l,n,i,o,c,h,m,x,p,f,g,w,v,C,E,M,k,A,R;if(!d.trim())return;eE(!0),await new Promise(e=>setTimeout(e,0));let z=(0,q.mostWallet)(d.trim(),u),P=`${z.username}#${z.address.slice(-4).toUpperCase()}`;b(z),r({...z,displayName:P}),a(`已登录 ${z.username}`,"success"),L((0,q.mostMnemonic)(z.danger));let O=(0,q.most25519)(z.danger);j(O),y((l=new Uint8Array([8,1,18,...(e=>{let t=[];for(;e>=128;)t.push(127&e|128),e>>=7;return t.push(e),t})((e=et(O.private_key,O.ed_public_key).publicKey).length)]),(n=new Uint8Array(l.length+e.length)).set(l,0),n.set(e,l.length),(o=new Uint8Array(2+(i=n).length))[0]=0,o[1]=36,o.set(i,2),c=new Uint8Array([1,114]),(h=new Uint8Array(c.length+o.length)).set(c,0),h.set(o,c.length),"k"+((e,t)=>{if(0===e.length)return"";let s=t.length,a=0;for(;a<e.length&&0===e[a];)a++;let r=[0];for(let t=a;t<e.length;t++){let a=e[t];for(let e=0;e<r.length;e++){let t=256*r[e]+a;r[e]=t%s,a=Math.floor(t/s)}for(;a>0;)r.push(a%s),a=Math.floor(a/s)}let l="";for(let e=0;e<a;e++)l+=t[0];for(let e=r.length-1;e>=0;e--)l+=t[r[e]];return l})(h,"0123456789abcdefghijklmnopqrstuvwxyz")));let I=et(O.private_key,O.ed_public_key);N((t=I.secretKey,m=new Uint8Array([48,5,6,3,43,101,112]),x=new Uint8Array([4,34,4,32,...t.slice(0,32)]),f=(p=new Uint8Array([2,1,0])).length+m.length+x.length,(g=new Uint8Array(2+f))[0]=48,g[1]=f,w=2,g.set(p,w),w+=p.length,g.set(m,w),w+=m.length,g.set(x,w),v=ei(g),`-----BEGIN PRIVATE KEY-----
|
|
2
2
|
${v.match(/.{1,64}/g)?.join("\n")}
|
|
3
3
|
-----END PRIVATE KEY-----`)),S((s=I.publicKey,C=new Uint8Array([48,5,6,3,43,101,112]),E=new Uint8Array([3,33,0,...s]),(k=new Uint8Array(2+(M=C.length+E.length)))[0]=48,k[1]=M,A=2,k.set(C,A),A+=C.length,k.set(E,A),R=ei(k),`-----BEGIN PUBLIC KEY-----
|
|
4
4
|
${R.match(/.{1,64}/g)?.join("\n")}
|
|
5
|
-
-----END PUBLIC KEY-----`)),J([]),ec(0),eb(!1),ej(!1),ey(!1),eN(!1),eE(!1)},[a,u,r,d]);function tN(e,t,s,r){let l=t.trim();if(!l)return;let n=(0,q.mostWallet)(l,s),i=(0,q.most25519)(n.danger);r({username:n.username,address:n.address,publicKey:i.public_key,privateKey:i.private_key}),eq(""),eZ(""),e4(""),e6(""),a("账号已生成","success")}function tC({senderAccount:e,recipientAccount:t,message:s,setCipherText:a,setDecryptedText:r,setError:l}){e&&t?s.trim()?(a((0,q.mostBoxEncrypt)(s,{senderPrivateKey:e.privateKey,recipientPublicKey:t.publicKey})),r(""),l("")):l("请输入要加密的消息"):l("请先生成 A 和 B 两个账号")}function tE({senderAccount:e,recipientAccount:t,cipherText:s,setDecryptedText:a,setError:r}){if(!e||!t)return void r("请先生成 A 和 B 两个账号");if(!s.trim())return void r("请先生成或粘贴密文");let l=(0,q.mostBoxDecrypt)(s,{senderPublicKey:e.publicKey,recipientPrivateKey:t.privateKey});if(!l){r("解密失败,请确认发送方公钥、接收方私钥和密文匹配"),a("");return}a(l),r("")}let tM=!!f,tk=f?.address||"",tA=(0,ee.generateAvatar)(tk||void 0),tS=[{id:"wallet",icon:(0,o.jsx)(H,{size:16}),label:"Web3"},{id:"pem",icon:(0,o.jsx)(Q.Lock,{size:16}),label:"PEM 导出"},{id:"export",icon:(0,o.jsx)(V.Wallet,{size:16}),label:"Wallet 导出"},{id:"EA",icon:(0,o.jsx)(P.KeyRound,{size:16}),label:"非对称加密"}];return(0,o.jsx)(W.default,{sidebar:({closeSidebar:e})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"sidebar-header sidebar-header-link",onClick:()=>window.location.href="/",children:[(0,o.jsx)(Y.ArrowLeft,{size:18}),(0,o.jsx)("h1",{children:"MOST PEOPLE"})]}),(0,o.jsx)("nav",{className:"sidebar-nav",children:tS.map(t=>(0,o.jsxs)("button",{onClick:()=>{var s;i(s=t.id),window.location.hash=s,e()},className:`sidebar-nav-btn ${n===t.id?"active":""}`,children:[t.icon,(0,o.jsx)("span",{children:t.label})]},t.id))})]}),headerTitle:(0,o.jsx)("h2",{className:"header-title",children:"wallet"===n?"Web3":"pem"===n?"PEM 导出":"EA"===n?"非对称加密":"Wallet 导出"}),headerRight:(0,o.jsx)("button",{className:"btn btn-icon",onClick:()=>s(!t),title:"切换主题",children:t?(0,o.jsx)(B.Sun,{size:16}):(0,o.jsx)(_.Moon,{size:16})}),children:(0,o.jsx)("div",{className:"web3-page",children:(0,o.jsxs)("div",{className:`web3-container ${"EA"===n?"wide":""}`,children:["EA"!==n&&(0,o.jsxs)("div",{className:"input-panel",children:[(0,o.jsxs)("div",{className:"web3-tools-inputs",children:[(0,o.jsx)("input",{type:"text",placeholder:"用户名",value:d,onChange:e=>h(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsxs)("div",{className:"input-wrap",children:[(0,o.jsx)("input",{type:x?"text":"password",placeholder:"密码(可选)",value:u,onChange:e=>m(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("button",{className:"input-eye",onClick:()=>p(!x),type:"button",children:x?(0,o.jsx)(A.EyeOff,{size:16}):(0,o.jsx)(k.Eye,{size:16})})]})]}),(0,o.jsx)("button",{className:"btn btn-primary btn-full",onClick:tv,disabled:!d.trim()||eC,type:"button",children:eC?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"spinner"}),"生成中..."]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(V.Wallet,{size:16}),"生成并登录"]})})]}),"wallet"===n&&(0,o.jsx)(o.Fragment,{children:tM&&tk?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"web3-identity-card",children:[(0,o.jsx)("img",{src:tA,alt:"avatar",className:"web3-identity-avatar"}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"web3-identity-name",children:f?.username||"未登录"}),(0,o.jsxs)("div",{className:"web3-identity-address",children:[(0,o.jsx)("code",{children:tk.toLowerCase()}),(0,o.jsx)(es,{text:tk.toLowerCase()}),(0,o.jsxs)("a",{href:`https://debank.com/profile/${tk}`,target:"_blank",rel:"noopener noreferrer",className:"link",children:[(0,o.jsx)(z.ExternalLink,{size:14}),"查看"]})]})]})]}),g&&(0,o.jsxs)("div",{className:"web3-key-grid",children:[(0,o.jsx)(ea,{title:"Ed25519 公钥",icon:(0,o.jsx)(O,{size:18}),children:(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:g.ed_public_key}),(0,o.jsx)(es,{text:g.ed_public_key})]})}),(0,o.jsx)(ea,{title:"x25519 公钥",icon:(0,o.jsx)(P.KeyRound,{size:18}),children:(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:g.public_key}),(0,o.jsx)(es,{text:g.public_key})]})}),(0,o.jsx)(ea,{title:"x25519 & Ed25519 私钥",icon:(0,o.jsx)(I,{size:18}),accent:!0,children:(0,o.jsxs)("div",{className:"mono-row danger",children:[(0,o.jsx)("code",{className:"mono",children:ev?g.private_key:(e=g.private_key)?"•".repeat(Math.min(e.length,32)):"-"}),(0,o.jsx)("button",{className:"btn btn-icon",onClick:()=>eN(!ev),title:ev?"隐藏私钥":"显示私钥",type:"button",children:ev?(0,o.jsx)(k.Eye,{size:14}):(0,o.jsx)(A.EyeOff,{size:14})})]})}),(0,o.jsx)(ea,{title:"IPNS ID",icon:(0,o.jsx)(T,{size:18}),children:(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:w}),(0,o.jsx)(es,{text:w})]})})]})]}):(0,o.jsx)(er,{icon:(0,o.jsx)(H,{size:36}),message:"请输入用户名和密码以查看身份信息"})}),"pem"===n&&(0,o.jsx)(o.Fragment,{children:C&&v?(0,o.jsxs)("div",{className:"web3-pem-list",children:[(0,o.jsx)(eo,{label:`${f?.username||"wallet"}.pub`,pem:C,filename:`${f?.username||"wallet"}.pub`}),(0,o.jsx)(eo,{label:`${f?.username||"wallet"}.pem`,pem:v,filename:`${f?.username||"wallet"}.pem`})]}):(0,o.jsx)(er,{icon:(0,o.jsx)(Q.Lock,{size:36}),message:"请输入用户名和密码以生成 PEM 密钥"})}),"export"===n&&(0,o.jsx)(o.Fragment,{children:tM&&tk?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"web3-tools-section",children:[(0,o.jsxs)("button",{className:"web3-tools-toggle",onClick:()=>eb(!ef),children:[(0,o.jsx)(U,{size:14}),ef?"隐藏地址二维码":"显示地址二维码",ef?(0,o.jsx)(K,{size:14}):(0,o.jsx)(F.ChevronDown,{size:14})]}),ef&&(0,o.jsxs)("div",{className:"web3-mnemonic-reveal",children:[(0,o.jsxs)("div",{className:"web3-mnemonic-card",children:[(0,o.jsx)("p",{className:"web3-mnemonic-text",children:tk}),(0,o.jsx)(es,{text:tk})]}),(0,o.jsx)("div",{className:"qr-wrap",children:(0,o.jsx)(E,{value:tk,size:200})})]})]}),R&&(0,o.jsxs)("div",{className:"web3-tools-section",children:[(0,o.jsxs)("button",{className:"web3-tools-toggle",onClick:()=>ej(!eg),children:[(0,o.jsx)(P.KeyRound,{size:14}),eg?"隐藏助记词":"显示助记词",eg?(0,o.jsx)(K,{size:14}):(0,o.jsx)(F.ChevronDown,{size:14})]}),eg&&(0,o.jsxs)("div",{className:"web3-mnemonic-reveal",children:[(0,o.jsxs)("div",{className:"web3-mnemonic-card",children:[(0,o.jsx)("p",{className:"web3-mnemonic-text",children:R}),(0,o.jsx)(es,{text:R})]}),(0,o.jsxs)("p",{className:"web3-tools-danger",children:[(0,o.jsx)(D,{size:14}),"任何拥有您助记词的人都可以窃取您账户中的任何资产,切勿泄露!!!"]}),(0,o.jsx)("button",{className:"web3-tools-toggle",onClick:()=>ey(!ew),children:ew?"隐藏助记词二维码":"显示助记词二维码"}),ew&&(0,o.jsx)("div",{className:"qr-wrap",children:(0,o.jsx)(E,{value:R,size:260})})]})]}),R&&(0,o.jsxs)("div",{className:"web3-mnemonic-reveal",children:[(0,o.jsx)("div",{children:(0,o.jsxs)("button",{className:"btn btn-primary",onClick:()=>{if(!R)return;let e=[];for(let t=Z;t<Z+10;t++){let s=`m/44'/60'/0'/0/${t}`,a=M.HDNodeWallet.fromPhrase(R,void 0,s);e.push({index:t,address:a.address,privateKey:a.privateKey})}J(t=>[...t,...e]),ec(e=>e+10)},children:["派生 ",10," 个地址"]})}),(0,o.jsxs)("p",{className:"web3-tools-danger",children:[(0,o.jsx)(D,{size:14}),"任何拥有您私钥的人都可以窃取您地址中的任何资产,切勿泄露!!!"]}),$.length>0&&(0,o.jsx)("div",{className:"web3-derive-table-wrap",children:(0,o.jsxs)("table",{className:"web3-derive-table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{onClick:()=>eh(!ed),className:"web3-derive-th",children:"账户"}),(0,o.jsx)("th",{onClick:()=>em(!eu),className:"web3-derive-th",children:"地址"}),(0,o.jsxs)("th",{onClick:()=>ep(!ex),className:"web3-derive-th danger",children:["私钥(点击",ex?"隐藏":"显示",")"]})]})}),(0,o.jsx)("tbody",{children:$.map(e=>(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:ed?e.index+1:""}),(0,o.jsx)("td",{children:eu?e.address:""}),(0,o.jsx)("td",{className:"danger",children:ex?e.privateKey:""})]},e.index))})]})})]})]}):(0,o.jsx)(er,{icon:(0,o.jsx)(V.Wallet,{size:36}),message:"请输入用户名和密码以使用钱包工具"})}),"EA"===n&&(0,o.jsxs)("div",{className:"web3-box-workspace",children:[(0,o.jsxs)("div",{className:"web3-box-grid",children:[(0,o.jsx)(el,{title:"A 账号",username:eM,password:eA,showPassword:eR,showPrivateKey:eP,account:eO,onUsernameChange:ek,onPasswordChange:eS,onTogglePassword:()=>ez(!eR),onTogglePrivateKey:()=>eL(!eP),onGenerate:()=>tN("A",eM,eA,eI)}),(0,o.jsx)(el,{title:"B 账号",username:eT,password:e_,showPassword:eD,showPrivateKey:eK,account:eH,onUsernameChange:eB,onPasswordChange:eU,onTogglePassword:()=>eF(!eD),onTogglePrivateKey:()=>e$(!eK),onGenerate:()=>tN("B",eT,e_,eQ)})]}),(0,o.jsxs)("div",{className:"web3-box-flow-grid",children:[(0,o.jsx)(en,{title:"A → B",description:"加密使用 A 私钥 + B 公钥;解密使用 A 公钥 + B 私钥。",message:eV,cipherText:eW,decryptedText:eX,error:eJ,encryptLabel:"用 A 私钥 + B 公钥加密",decryptLabel:"用 A 公钥 + B 私钥解密",messagePlaceholder:"输入要从 A 发给 B 的消息",cipherPlaceholder:"加密后生成密文,或粘贴已有密文",onMessageChange:eY,onCipherTextChange:eG,onEncrypt:()=>tC({senderAccount:eO,recipientAccount:eH,message:eV,setCipherText:eG,setDecryptedText:eq,setError:eZ}),onDecrypt:()=>tE({senderAccount:eO,recipientAccount:eH,cipherText:eW,setDecryptedText:eq,setError:eZ})}),(0,o.jsx)(en,{title:"B → A",description:"加密使用 B 私钥 + A 公钥;解密使用 B 公钥 + A 私钥。",message:e0,cipherText:e2,decryptedText:e8,error:e5,encryptLabel:"用 B 私钥 + A 公钥加密",decryptLabel:"用 B 公钥 + A 私钥解密",messagePlaceholder:"输入要从 B 发给 A 的消息",cipherPlaceholder:"加密后生成密文,或粘贴已有密文",onMessageChange:e1,onCipherTextChange:e3,onEncrypt:()=>tC({senderAccount:eH,recipientAccount:eO,message:e0,setCipherText:e3,setDecryptedText:e4,setError:e6}),onDecrypt:()=>tE({senderAccount:eH,recipientAccount:eO,cipherText:e2,setDecryptedText:e4,setError:e6})})]}),(0,o.jsxs)("div",{className:"web3-box-flow-grid",children:[(0,o.jsxs)("section",{className:"web3-box-flow",children:[(0,o.jsx)("div",{className:"web3-box-flow-header",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{children:"加密"}),(0,o.jsx)("p",{children:"只输入发送方私钥和接收方公钥即可加密,无需生成完整账号。"})]})}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"发送方"})}),(0,o.jsxs)("div",{className:"input-wrap",children:[(0,o.jsx)("input",{type:tw?"text":"password",placeholder:"发送方 x25519 私钥",value:td,onChange:e=>th(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("button",{className:"input-eye",onClick:()=>ty(!tw),type:"button",children:tw?(0,o.jsx)(A.EyeOff,{size:16}):(0,o.jsx)(k.Eye,{size:16})})]}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"接收方"})}),(0,o.jsx)("input",{type:"text",placeholder:"接收方 x25519 公钥",value:tu,onChange:e=>tm(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"明文"})}),(0,o.jsx)("textarea",{className:"textarea",value:tx,onChange:e=>tp(e.target.value),rows:4,placeholder:"输入要加密的消息"}),(0,o.jsx)("div",{className:"web3-box-actions",children:(0,o.jsxs)("button",{className:"btn btn-primary",onClick:function(){td.trim()?tu.trim()?tx.trim()?(tb((0,q.mostBoxEncrypt)(tx,{senderPrivateKey:td.trim(),recipientPublicKey:tu.trim()})),tj("")):tj("请输入要加密的消息"):tj("请输入接收方公钥"):tj("请输入发送方私钥")},type:"button",children:[(0,o.jsx)(Q.Lock,{size:16}),"加密"]})}),tg&&(0,o.jsx)("p",{className:"web3-tools-danger",children:tg}),(0,o.jsxs)("div",{className:"web3-box-result",children:[(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"密文"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:tf,readOnly:!0,rows:5,placeholder:"加密成功后显示密文"})]})]}),(0,o.jsxs)("section",{className:"web3-box-flow",children:[(0,o.jsx)("div",{className:"web3-box-flow-header",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{children:"解密"}),(0,o.jsx)("p",{children:"只输入发送方公钥和接收方私钥即可解密,无需生成完整账号。"})]})}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"发送方"})}),(0,o.jsx)("input",{type:"text",placeholder:"发送方 x25519 公钥",value:e7,onChange:e=>e9(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"接收方"})}),(0,o.jsxs)("div",{className:"input-wrap",children:[(0,o.jsx)("input",{type:to?"text":"password",placeholder:"接收方 x25519 私钥",value:te,onChange:e=>tt(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("button",{className:"input-eye",onClick:()=>tc(!to),type:"button",children:to?(0,o.jsx)(A.EyeOff,{size:16}):(0,o.jsx)(k.Eye,{size:16})})]}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"密文"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:ts,onChange:e=>ta(e.target.value),rows:5,placeholder:"粘贴要解密的密文"}),(0,o.jsx)("div",{className:"web3-box-actions",children:(0,o.jsxs)("button",{className:"btn btn-secondary",onClick:function(){if(!e7.trim())return void ti("请输入发送方公钥");if(!te.trim())return void ti("请输入接收方私钥");if(!ts.trim())return void ti("请粘贴密文");let e=(0,q.mostBoxDecrypt)(ts,{senderPublicKey:e7.trim(),recipientPrivateKey:te.trim()});if(!e){ti("解密失败,请确认发送方公钥、接收方私钥和密文匹配"),tl("");return}tl(e),ti("")},type:"button",children:[(0,o.jsx)(P.KeyRound,{size:16}),"解密"]})}),tn&&(0,o.jsx)("p",{className:"web3-tools-danger",children:tn}),(0,o.jsxs)("div",{className:"web3-box-result",children:[(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"解密结果"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:tr,readOnly:!0,rows:5,placeholder:"解密成功后显示明文"})]})]})]})]})]})})})}],17173)}]);
|
|
5
|
+
-----END PUBLIC KEY-----`)),J([]),ec(0),eb(!1),ej(!1),ey(!1),eN(!1),eE(!1)},[a,u,r,d]);function tN(e,t,s,r){let l=t.trim();if(!l)return;let n=(0,q.mostWallet)(l,s),i=(0,q.most25519)(n.danger);r({username:n.username,address:n.address,publicKey:i.public_key,privateKey:i.private_key}),eq(""),eZ(""),e4(""),e5(""),a("账号已生成","success")}function tC({senderAccount:e,recipientAccount:t,message:s,setCipherText:a,setDecryptedText:r,setError:l}){e&&t?s.trim()?(a((0,q.mostBoxEncrypt)(s,{senderPrivateKey:e.privateKey,recipientPublicKey:t.publicKey})),r(""),l("")):l("请输入要加密的消息"):l("请先生成 A 和 B 两个账号")}function tE({senderAccount:e,recipientAccount:t,cipherText:s,setDecryptedText:a,setError:r}){if(!e||!t)return void r("请先生成 A 和 B 两个账号");if(!s.trim())return void r("请先生成或粘贴密文");let l=(0,q.mostBoxDecrypt)(s,{senderPublicKey:e.publicKey,recipientPrivateKey:t.privateKey});if(!l){r("解密失败,请确认发送方公钥、接收方私钥和密文匹配"),a("");return}a(l),r("")}let tM=!!f,tk=f?.address||"",tA=(0,ee.generateAvatar)(tk||void 0),tS=[{id:"wallet",icon:(0,o.jsx)(H,{size:16}),label:"Web3"},{id:"pem",icon:(0,o.jsx)(Q.Lock,{size:16}),label:"PEM 导出"},{id:"export",icon:(0,o.jsx)(V.Wallet,{size:16}),label:"Wallet 导出"},{id:"EA",icon:(0,o.jsx)(P.KeyRound,{size:16}),label:"非对称加密"}];return(0,o.jsx)(W.default,{sidebar:({closeSidebar:e})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"sidebar-header sidebar-header-link",onClick:()=>window.location.href="/",children:[(0,o.jsx)(Y.ArrowLeft,{size:18}),(0,o.jsx)("h1",{children:"MOST PEOPLE"})]}),(0,o.jsx)("nav",{className:"sidebar-nav",children:tS.map(t=>(0,o.jsxs)("button",{onClick:()=>{var s;i(s=t.id),window.location.hash=s,e()},className:`sidebar-nav-btn ${n===t.id?"active":""}`,children:[t.icon,(0,o.jsx)("span",{children:t.label})]},t.id))})]}),headerTitle:(0,o.jsx)("h2",{className:"header-title",children:"wallet"===n?"Web3":"pem"===n?"PEM 导出":"EA"===n?"非对称加密":"Wallet 导出"}),headerRight:(0,o.jsx)("button",{className:"btn btn-icon",onClick:()=>s(!t),title:"切换主题",children:t?(0,o.jsx)(B.Sun,{size:16}):(0,o.jsx)(_.Moon,{size:16})}),children:(0,o.jsx)("div",{className:"web3-page",children:(0,o.jsxs)("div",{className:`web3-container ${"EA"===n?"wide":""}`,children:["EA"!==n&&(0,o.jsxs)("div",{className:"input-panel",children:[(0,o.jsxs)("div",{className:"web3-tools-inputs",children:[(0,o.jsx)("input",{type:"text",placeholder:"用户名",value:d,onChange:e=>h(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsxs)("div",{className:"input-wrap",children:[(0,o.jsx)("input",{type:x?"text":"password",placeholder:"密码(可选)",value:u,onChange:e=>m(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("button",{className:"input-eye",onClick:()=>p(!x),type:"button",children:x?(0,o.jsx)(A.EyeOff,{size:16}):(0,o.jsx)(k.Eye,{size:16})})]})]}),(0,o.jsx)("button",{className:"btn btn-primary btn-full",onClick:tv,disabled:!d.trim()||eC,type:"button",children:eC?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"spinner"}),"生成中..."]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(V.Wallet,{size:16}),"生成并登录"]})})]}),"wallet"===n&&(0,o.jsx)(o.Fragment,{children:tM&&tk?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"web3-identity-card",children:[(0,o.jsx)("img",{src:tA,alt:"avatar",className:"web3-identity-avatar"}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"web3-identity-name",children:f?.username||"未登录"}),(0,o.jsxs)("div",{className:"web3-identity-address",children:[(0,o.jsx)("code",{children:tk.toLowerCase()}),(0,o.jsx)(es,{text:tk.toLowerCase()}),(0,o.jsxs)("a",{href:`https://debank.com/profile/${tk}`,target:"_blank",rel:"noopener noreferrer",className:"link",children:[(0,o.jsx)(z.ExternalLink,{size:14}),"查看"]})]})]})]}),g&&(0,o.jsxs)("div",{className:"web3-key-grid",children:[(0,o.jsx)(ea,{title:"Ed25519 公钥",icon:(0,o.jsx)(O,{size:18}),children:(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:g.ed_public_key}),(0,o.jsx)(es,{text:g.ed_public_key})]})}),(0,o.jsx)(ea,{title:"x25519 公钥",icon:(0,o.jsx)(P.KeyRound,{size:18}),children:(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:g.public_key}),(0,o.jsx)(es,{text:g.public_key})]})}),(0,o.jsx)(ea,{title:"x25519 & Ed25519 私钥",icon:(0,o.jsx)(I,{size:18}),accent:!0,children:(0,o.jsxs)("div",{className:"mono-row danger",children:[(0,o.jsx)("code",{className:"mono",children:ev?g.private_key:(e=g.private_key)?"•".repeat(Math.min(e.length,32)):"-"}),(0,o.jsx)("button",{className:"btn btn-icon",onClick:()=>eN(!ev),title:ev?"隐藏私钥":"显示私钥",type:"button",children:ev?(0,o.jsx)(k.Eye,{size:14}):(0,o.jsx)(A.EyeOff,{size:14})})]})}),(0,o.jsx)(ea,{title:"IPNS ID",icon:(0,o.jsx)(T,{size:18}),children:(0,o.jsxs)("div",{className:"mono-row",children:[(0,o.jsx)("code",{className:"mono",children:w}),(0,o.jsx)(es,{text:w})]})})]})]}):(0,o.jsx)(er,{icon:(0,o.jsx)(H,{size:36}),message:"请输入用户名和密码以查看身份信息"})}),"pem"===n&&(0,o.jsx)(o.Fragment,{children:C&&v?(0,o.jsxs)("div",{className:"web3-pem-list",children:[(0,o.jsx)(eo,{label:`${f?.username||"wallet"}.pub`,pem:C,filename:`${f?.username||"wallet"}.pub`}),(0,o.jsx)(eo,{label:`${f?.username||"wallet"}.pem`,pem:v,filename:`${f?.username||"wallet"}.pem`})]}):(0,o.jsx)(er,{icon:(0,o.jsx)(Q.Lock,{size:36}),message:"请输入用户名和密码以生成 PEM 密钥"})}),"export"===n&&(0,o.jsx)(o.Fragment,{children:tM&&tk?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"web3-tools-section",children:[(0,o.jsxs)("button",{className:"web3-tools-toggle",onClick:()=>eb(!ef),children:[(0,o.jsx)(U,{size:14}),ef?"隐藏地址二维码":"显示地址二维码",ef?(0,o.jsx)(K,{size:14}):(0,o.jsx)(F.ChevronDown,{size:14})]}),ef&&(0,o.jsxs)("div",{className:"web3-mnemonic-reveal",children:[(0,o.jsxs)("div",{className:"web3-mnemonic-card",children:[(0,o.jsx)("p",{className:"web3-mnemonic-text",children:tk}),(0,o.jsx)(es,{text:tk})]}),(0,o.jsx)("div",{className:"qr-wrap",children:(0,o.jsx)(E,{value:tk,size:200})})]})]}),R&&(0,o.jsxs)("div",{className:"web3-tools-section",children:[(0,o.jsxs)("button",{className:"web3-tools-toggle",onClick:()=>ej(!eg),children:[(0,o.jsx)(P.KeyRound,{size:14}),eg?"隐藏助记词":"显示助记词",eg?(0,o.jsx)(K,{size:14}):(0,o.jsx)(F.ChevronDown,{size:14})]}),eg&&(0,o.jsxs)("div",{className:"web3-mnemonic-reveal",children:[(0,o.jsxs)("div",{className:"web3-mnemonic-card",children:[(0,o.jsx)("p",{className:"web3-mnemonic-text",children:R}),(0,o.jsx)(es,{text:R})]}),(0,o.jsxs)("p",{className:"web3-tools-danger",children:[(0,o.jsx)(D,{size:14}),"任何拥有您助记词的人都可以窃取您账户中的任何资产,切勿泄露!!!"]}),(0,o.jsx)("button",{className:"web3-tools-toggle",onClick:()=>ey(!ew),children:ew?"隐藏助记词二维码":"显示助记词二维码"}),ew&&(0,o.jsx)("div",{className:"qr-wrap",children:(0,o.jsx)(E,{value:R,size:260})})]})]}),R&&(0,o.jsxs)("div",{className:"web3-mnemonic-reveal",children:[(0,o.jsx)("div",{children:(0,o.jsxs)("button",{className:"btn btn-primary",onClick:()=>{if(!R)return;let e=[];for(let t=Z;t<Z+10;t++){let s=`m/44'/60'/0'/0/${t}`,a=M.HDNodeWallet.fromPhrase(R,void 0,s);e.push({index:t,address:a.address,privateKey:a.privateKey})}J(t=>[...t,...e]),ec(e=>e+10)},children:["派生 ",10," 个地址"]})}),(0,o.jsxs)("p",{className:"web3-tools-danger",children:[(0,o.jsx)(D,{size:14}),"任何拥有您私钥的人都可以窃取您地址中的任何资产,切勿泄露!!!"]}),$.length>0&&(0,o.jsx)("div",{className:"web3-derive-table-wrap",children:(0,o.jsxs)("table",{className:"web3-derive-table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{onClick:()=>eh(!ed),className:"web3-derive-th",children:"账户"}),(0,o.jsx)("th",{onClick:()=>em(!eu),className:"web3-derive-th",children:"地址"}),(0,o.jsxs)("th",{onClick:()=>ep(!ex),className:"web3-derive-th danger",children:["私钥(点击",ex?"隐藏":"显示",")"]})]})}),(0,o.jsx)("tbody",{children:$.map(e=>(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:ed?e.index+1:""}),(0,o.jsx)("td",{children:eu?e.address:""}),(0,o.jsx)("td",{className:"danger",children:ex?e.privateKey:""})]},e.index))})]})})]})]}):(0,o.jsx)(er,{icon:(0,o.jsx)(V.Wallet,{size:36}),message:"请输入用户名和密码以使用钱包工具"})}),"EA"===n&&(0,o.jsxs)("div",{className:"web3-box-workspace",children:[(0,o.jsxs)("div",{className:"web3-box-grid",children:[(0,o.jsx)(el,{title:"A 账号",username:eM,password:eA,showPassword:eR,showPrivateKey:eP,account:eO,onUsernameChange:ek,onPasswordChange:eS,onTogglePassword:()=>ez(!eR),onTogglePrivateKey:()=>eL(!eP),onGenerate:()=>tN("A",eM,eA,eI)}),(0,o.jsx)(el,{title:"B 账号",username:eT,password:e_,showPassword:eD,showPrivateKey:eK,account:eH,onUsernameChange:eB,onPasswordChange:eU,onTogglePassword:()=>eF(!eD),onTogglePrivateKey:()=>e$(!eK),onGenerate:()=>tN("B",eT,e_,eQ)})]}),(0,o.jsxs)("div",{className:"web3-box-flow-grid",children:[(0,o.jsx)(en,{title:"A → B",description:"加密使用 A 私钥 + B 公钥;解密使用 A 公钥 + B 私钥。",message:eV,cipherText:eW,decryptedText:eX,error:eJ,encryptLabel:"用 A 私钥 + B 公钥加密",decryptLabel:"用 A 公钥 + B 私钥解密",messagePlaceholder:"输入要从 A 发给 B 的消息",cipherPlaceholder:"加密后生成密文,或粘贴已有密文",onMessageChange:eY,onCipherTextChange:eG,onEncrypt:()=>tC({senderAccount:eO,recipientAccount:eH,message:eV,setCipherText:eG,setDecryptedText:eq,setError:eZ}),onDecrypt:()=>tE({senderAccount:eO,recipientAccount:eH,cipherText:eW,setDecryptedText:eq,setError:eZ})}),(0,o.jsx)(en,{title:"B → A",description:"加密使用 B 私钥 + A 公钥;解密使用 B 公钥 + A 私钥。",message:e0,cipherText:e2,decryptedText:e8,error:e6,encryptLabel:"用 B 私钥 + A 公钥加密",decryptLabel:"用 B 公钥 + A 私钥解密",messagePlaceholder:"输入要从 B 发给 A 的消息",cipherPlaceholder:"加密后生成密文,或粘贴已有密文",onMessageChange:e1,onCipherTextChange:e3,onEncrypt:()=>tC({senderAccount:eH,recipientAccount:eO,message:e0,setCipherText:e3,setDecryptedText:e4,setError:e5}),onDecrypt:()=>tE({senderAccount:eH,recipientAccount:eO,cipherText:e2,setDecryptedText:e4,setError:e5})})]}),(0,o.jsxs)("div",{className:"web3-box-flow-grid",children:[(0,o.jsxs)("section",{className:"web3-box-flow",children:[(0,o.jsx)("div",{className:"web3-box-flow-header",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{children:"加密"}),(0,o.jsx)("p",{children:"只输入发送方私钥和接收方公钥即可加密,无需生成完整账号。"})]})}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"发送方"})}),(0,o.jsxs)("div",{className:"input-wrap",children:[(0,o.jsx)("input",{type:tw?"text":"password",placeholder:"发送方 x25519 私钥",value:td,onChange:e=>th(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("button",{className:"input-eye",onClick:()=>ty(!tw),type:"button",children:tw?(0,o.jsx)(A.EyeOff,{size:16}):(0,o.jsx)(k.Eye,{size:16})})]}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"接收方"})}),(0,o.jsx)("input",{type:"text",placeholder:"接收方 x25519 公钥",value:tu,onChange:e=>tm(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"明文"})}),(0,o.jsx)("textarea",{className:"textarea",value:tx,onChange:e=>tp(e.target.value),rows:4,placeholder:"输入要加密的消息"}),(0,o.jsx)("div",{className:"web3-box-actions",children:(0,o.jsxs)("button",{className:"btn btn-primary",onClick:function(){td.trim()?tu.trim()?tx.trim()?(tb((0,q.mostBoxEncrypt)(tx,{senderPrivateKey:td.trim(),recipientPublicKey:tu.trim()})),tj("")):tj("请输入要加密的消息"):tj("请输入接收方公钥"):tj("请输入发送方私钥")},type:"button",children:[(0,o.jsx)(Q.Lock,{size:16}),"加密"]})}),tg&&(0,o.jsx)("p",{className:"web3-tools-danger",children:tg}),(0,o.jsxs)("div",{className:"web3-box-result",children:[(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"密文"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:tf,readOnly:!0,rows:5,placeholder:"加密成功后显示密文"})]})]}),(0,o.jsxs)("section",{className:"web3-box-flow",children:[(0,o.jsx)("div",{className:"web3-box-flow-header",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{children:"解密"}),(0,o.jsx)("p",{children:"只输入发送方公钥和接收方私钥即可解密,无需生成完整账号。"})]})}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"发送方"})}),(0,o.jsx)("input",{type:"text",placeholder:"发送方 x25519 公钥",value:e7,onChange:e=>e9(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"接收方"})}),(0,o.jsxs)("div",{className:"input-wrap",children:[(0,o.jsx)("input",{type:to?"text":"password",placeholder:"接收方 x25519 私钥",value:te,onChange:e=>tt(e.target.value),className:"input",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}),(0,o.jsx)("button",{className:"input-eye",onClick:()=>tc(!to),type:"button",children:to?(0,o.jsx)(A.EyeOff,{size:16}):(0,o.jsx)(k.Eye,{size:16})})]}),(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"密文"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:ts,onChange:e=>ta(e.target.value),rows:5,placeholder:"粘贴要解密的密文"}),(0,o.jsx)("div",{className:"web3-box-actions",children:(0,o.jsxs)("button",{className:"btn btn-secondary",onClick:function(){if(!e7.trim())return void ti("请输入发送方公钥");if(!te.trim())return void ti("请输入接收方私钥");if(!ts.trim())return void ti("请粘贴密文");let e=(0,q.mostBoxDecrypt)(ts,{senderPublicKey:e7.trim(),recipientPrivateKey:te.trim()});if(!e){ti("解密失败,请确认发送方公钥、接收方私钥和密文匹配"),tl("");return}tl(e),ti("")},type:"button",children:[(0,o.jsx)(P.KeyRound,{size:16}),"解密"]})}),tn&&(0,o.jsx)("p",{className:"web3-tools-danger",children:tn}),(0,o.jsxs)("div",{className:"web3-box-result",children:[(0,o.jsx)("label",{className:"web3-box-result-header",children:(0,o.jsx)("span",{children:"解密结果"})}),(0,o.jsx)("textarea",{className:"textarea mono",value:tr,readOnly:!0,rows:5,placeholder:"解密成功后显示明文"})]})]})]})]})]})})})}],17173)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,8734,e=>{"use strict";let t=(0,e.i(56420).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,t],8734)},96699,e=>{"use strict";let t=(0,e.i(56420).default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",0,t],96699)},35965,e=>{"use strict";let t=(0,e.i(56420).default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,t],35965)},11241,e=>{"use strict";let t=(0,e.i(56420).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],11241)},59665,e=>{"use strict";var t=e.i(18050),r=e.i(71645),n=e.i(67228);let a=(0,e.i(56420).default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);e.i(22183);var s=e.i(5142);let i=(0,r.createContext)(null);e.s(["default",0,function({sidebar:e,headerTitle:l,headerRight:o,children:d}){let[c,u]=(0,s.useDisclosure)(!1),[h,p]=(0,r.useState)(!1),m=(0,n.useMediaQuery)("(max-width: 768px)"),f=()=>{m?u.open():p(!1)};return(0,t.jsx)(i.Provider,{value:{closeSidebar:u.close,openSidebar:f,isSidebarVisible:m?c:!h},children:(0,t.jsxs)("div",{className:"app-layout",children:[(0,t.jsx)("div",{className:`sidebar-overlay ${c?"visible":""}`,onClick:()=>u.close()}),(0,t.jsx)("div",{className:`sidebar ${c?"open":""} ${h?"collapsed":""}`,children:e({closeSidebar:u.close,openSidebar:f})}),(0,t.jsxs)("div",{className:"main-content",children:[(0,t.jsxs)("header",{className:"app-header",children:[(0,t.jsxs)("div",{className:"header-left",children:[(0,t.jsx)("button",{onClick:()=>{m?u.toggle():p(!h)},className:"btn btn-icon sidebar-toggle-btn","aria-label":m?"打开菜单":h?"展开侧边栏":"收起侧边栏",children:(0,t.jsx)(a,{size:16})}),l]}),(0,t.jsx)("div",{className:"header-right",children:o})]}),d]})]})})},"useAppShell",0,function(){let e=(0,r.useContext)(i);if(!e)throw Error("useAppShell must be used within AppShell");return e}],59665)},27648,e=>{"use strict";var t=e.i(18050),r=e.i(93957),n=e.i(71192);e.s(["default",0,function({className:e=""}){let a=(0,n.useUserStore)(e=>e.identity),s=(0,n.useUserStore)(e=>e.openLoginModal),i=(0,n.useUserStore)(e=>e.logoutUser);return(0,t.jsxs)("div",{className:`chat-sidebar-footer sidebar-account ${e}`,children:[(0,t.jsxs)("div",{className:"user-info",children:[(0,t.jsx)("img",{className:"user-avatar-img",src:(0,r.generateAvatar)(a?.address),alt:"avatar"}),(0,t.jsx)("span",{className:"user-name",title:a?.address,children:a?.displayName||"未登录"})]}),a?(0,t.jsx)("button",{className:"btn btn-ghost logout-btn",onClick:i,children:"退出"}):(0,t.jsx)("button",{className:"btn btn-primary login-btn",onClick:s,children:"登录"})]})}])},23952,87884,e=>{"use strict";var t=e.i(71645),r=e.i(26913);let n={getChannels(e={}){let t=new URLSearchParams;e.type&&t.set("type",e.type),e.excludeType&&t.set("excludeType",e.excludeType);let n=t.toString();return r.api.get(n?`/api/channels?${n}`:"/api/channels").json()},createChannel:(e,t="personal")=>r.api.post("/api/channels",{json:{name:e,type:t}}).json(),leaveChannel:e=>r.api.delete(`/api/channels/${encodeURIComponent(e)}`).json(),getChannelMessages:(e,t=100,n=0)=>r.api.get(`/api/channels/${encodeURIComponent(e)}/messages?limit=${t}&offset=${n}`).json(),sendChannelMessage:({channelName:e,content:t,author:n,authorName:a,attachment:s})=>r.api.post(`/api/channels/${encodeURIComponent(e)}/messages`,{json:s?{content:t,author:n,authorName:a,attachment:s}:{content:t,author:n,authorName:a}}).json(),getChannelPeers:e=>r.api.get(`/api/channels/${encodeURIComponent(e)}/peers`).json(),setChannelRemark:(e,t)=>r.api.put(`/api/channels/${encodeURIComponent(e)}/remark`,{json:{remark:t}}).json()};function a(e){return String(e.id||`${e.author||""}-${e.timestamp||""}-${e.content||""}`)}e.s(["channelApi",0,n],87884),e.s(["useChannelMessages",0,function({isReady:e,enabled:s=!0,channelName:i="",peerId:l="",waitForPeerId:o=!1,limit:d=100,reconnectBaseDelay:c=2500,acceptMessage:u,getMessageKey:h=a,onSyncError:p,onSocketEvent:m}){let[f,y]=(0,t.useState)([]),[g,j]=(0,t.useState)(!1),b=(0,t.useRef)(null),x=(0,t.useRef)(i),v=(0,t.useRef)(null),k=(0,t.useRef)(0),w=(0,t.useRef)(u),C=(0,t.useRef)(h),N=(0,t.useRef)(m),S=(0,t.useRef)(p),A=(0,t.useRef)(l);(0,t.useEffect)(()=>{w.current=u},[u]),(0,t.useEffect)(()=>{C.current=h},[h]),(0,t.useEffect)(()=>{N.current=m},[m]),(0,t.useEffect)(()=>{S.current=p},[p]);let M=(0,t.useCallback)(e=>{let t=w.current;return t?e.filter(t):e},[]),I=(0,t.useCallback)((e,t,r=!0)=>{let n=[...e];for(let e of M(t)){let t=C.current(e);if(r){let r=n.findIndex(t=>t.pending&&t.author?.toLowerCase()===e.author?.toLowerCase()&&t.content===e.content);if(-1!==r){n[r]={...e,id:e.id||t};continue}}n.some(e=>C.current(e)===t)||n.push({...e,id:e.id||t})}return n},[M]),$=(0,t.useCallback)((e,t)=>{b.current?.readyState===WebSocket.OPEN&&b.current.send(JSON.stringify({event:e,data:t}))},[]),z=(0,t.useCallback)(e=>{e&&$("channel:subscribe",{channel:e})},[$]),E=(0,t.useCallback)(e=>{e&&$("channel:unsubscribe",{channel:e})},[$]),R=(0,t.useCallback)(async(t=x.current,r={})=>{if(!t||!e)return[];try{let e=M(await n.getChannelMessages(t,d));return y(t=>r.replace?e:I(t,e,!1)),e}catch(e){return r.replace&&y([]),await S.current?.(e),[]}},[M,e,d,I]);(0,t.useEffect)(()=>{A.current=l,l&&($("register",{peerId:l}),o&&x.current&&(z(x.current),R(x.current,{replace:!0})))},[l,z,R,o,$]);let L=(0,t.useCallback)(()=>{y([])},[]),U=(0,t.useCallback)(async({channelName:e=x.current,content:t,author:r,authorName:a,attachment:s,optimisticId:i})=>{let l=t.trim();if(!e||!l)return null;let o={id:i||`${r}-${Date.now()}-${Math.random().toString(36).slice(2)}`,author:r,authorName:a,content:l,timestamp:Date.now(),pending:!0,attachment:s};y(e=>[...e,o]);try{let t=await n.sendChannelMessage({channelName:e,content:l,author:r,authorName:a,attachment:s});return y(e=>e.map(e=>e.id===o.id?{...t.message,id:t.message.id||C.current(t.message)}:e)),t.message}catch(e){throw y(e=>e.filter(e=>e.id!==o.id)),e}},[]);return(0,t.useEffect)(()=>{let t=x.current;if(x.current=i,t&&t!==i&&E(t),i&&e&&s)return R(i,{replace:!0}),(!o||A.current)&&z(i),()=>E(i)},[i,s,e,z,R,E,o]),(0,t.useEffect)(()=>{if(!e||!s)return void j(!1);let t=!1;async function n(){let e=new WebSocket(await (0,r.getAuthenticatedWebSocketUrl)("/ws"));t?e.close():(e.onopen=()=>{j(!0),k.current=0,A.current&&e.send(JSON.stringify({event:"register",data:{peerId:A.current}})),x.current&&(!o||A.current)&&(z(x.current),R(x.current,{replace:!0}))},e.onmessage=e=>{try{let t=JSON.parse(e.data);N.current?.(t.event,t.data),"channel:message"===t.event&&t.data?.channel===x.current&&t.data?.message&&y(e=>I(e,[t.data.message]))}catch{}},e.onclose=()=>{if(j(!1),t)return;let e=k.current;if(e>=20)return;let r=Math.min(c*Math.pow(2,e),3e4);k.current=e+1,v.current=setTimeout(n,r)},e.onerror=()=>e.close(),b.current=e)}return k.current=0,n(),()=>{t=!0,v.current&&clearTimeout(v.current),b.current?.close(),b.current=null}},[s,e,I,c,z,R,o]),{clearMessages:L,connected:g,messages:f,sendMessage:U,setMessages:y,syncMessages:R}}],23952)},21357,e=>{"use strict";let t=(0,e.i(56420).default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",0,t],21357)},53881,53751,99591,34471,e=>{"use strict";var t=e.i(18050),r=e.i(22016),n=e.i(11241),a=e.i(56420);let s=(0,a.default)("spade",[["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"M2 14.499a5.5 5.5 0 0 0 9.591 3.675.6.6 0 0 1 .818.001A5.5 5.5 0 0 0 22 14.5c0-2.29-1.5-4-3-5.5l-5.492-5.312a2 2 0 0 0-3-.02L5 8.999c-1.5 1.5-3 3.2-3 5.5",key:"1aw2pz"}]]);e.s(["Spade",0,s],53751);let i=(0,a.default)("swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);var l=e.i(27648);let o=[{id:"gandengyan",label:"干瞪眼",href:"/game/gandengyan/",icon:(0,t.jsx)(i,{size:16})},{id:"zhajinhua",label:"炸金花",href:"/game/zhajinhua/",icon:(0,t.jsx)(s,{size:16})}];e.s(["default",0,function({activeGame:e,closeSidebar:a}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(r.default,{href:"/",className:"sidebar-header sidebar-header-link",children:[(0,t.jsx)(n.ArrowLeft,{size:18}),(0,t.jsx)("h1",{children:"MOST PEOPLE"})]}),(0,t.jsx)("nav",{className:"sidebar-nav",children:o.map(n=>(0,t.jsxs)(r.default,{href:n.href,className:`sidebar-nav-btn ${e===n.id?"active":""}`,onClick:a,children:[n.icon,(0,t.jsx)("span",{children:n.label})]},n.id))}),(0,t.jsx)(l.default,{})]})}],53881);var d=e.i(71645);let c="game",u="mostbox.game.event",h=["gandengyan","zhajinhua"],p="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";function m(e){let t=String(e||"").trim().toLowerCase();return h.includes(t)?t:""}function f(e){return String(e||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,8)}function y(e){return/^[A-Z0-9]{4,8}$/.test(String(e||""))}function g(){let e="";for(let t=0;t<6;t++)e+=p[function(e){if(globalThis.crypto?.getRandomValues){let t=new Uint32Array(1);return globalThis.crypto.getRandomValues(t),t[0]%e}return Math.floor(Math.random()*e)}(p.length)];return e}function j(e,t){let r=m(e),n=f(t);return r&&y(n)?`game-${r}-${n.toLowerCase()}`:""}function b({gameId:e,roomCode:t,event:r,payload:n}){var a;let s=m(e);return{kind:u,version:1,gameId:s,roomCode:f(t),event:String(r||""),eventId:(a=s||"game",`${a}_${Date.now()}_${function(){let e=new Uint8Array(4);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(256*Math.random());return[...e].map(e=>e.toString(16).padStart(2,"0")).join("")}()}`),payload:n||{}}}function x(e,t={}){try{let r=JSON.parse(String(e||""));if(!r||r.kind!==u||1!==r.version||"string"!=typeof r.event||"string"!=typeof r.eventId)return null;let n=m(r.gameId),a=f(r.roomCode);if(!n||!y(a)||t.gameId&&n!==m(t.gameId)||t.roomCode&&a!==f(t.roomCode))return null;return{...r,gameId:n,roomCode:a,payload:r.payload&&"object"==typeof r.payload?r.payload:{}}}catch{return null}}function v(e,t){var r;if(!e||"object"!=typeof e)return null;let n=k(e.address||t);if(!n||k(t)!==n)return null;let a=String(e.name||"").trim().slice(0,50)||((r=n)?`${r.slice(0,6)}...${r.slice(-4)}`:"");return{address:n,name:a,publicKey:String(e.publicKey||"").trim(),joinedAt:Number(e.joinedAt||Date.now())}}function k(e){let t=String(e||"").trim();return/^0x[a-fA-F0-9]{40}$/.test(t)?t.toLowerCase():""}function w(e,t,r){let n=t.get(r.address);n?Object.assign(n,r):(e.push(r),t.set(r.address,r))}function C(e){return[...e].sort((e,t)=>Number(e.timestamp||0)-Number(t.timestamp||0))}e.s(["GAME_CHANNEL_TYPE",0,c,"createGameEvent",0,b,"createGameRoomCode",0,g,"deriveGameRoomLobby",0,function(e=[],t={}){let r=[],n=new Map,a="";for(let s of C(e)){let e=x(s.content,t);if(e){if("room:create"===e.event){let t=v(e.payload?.player,s.author);if(!t)continue;a||(a=t.address),w(r,n,t);continue}if("player:join"===e.event){let t=v(e.payload?.player,s.author);t&&w(r,n,t)}}}return{gameId:m(t.gameId),roomCode:f(t.roomCode),hostAddress:a,players:r}},"gameRoomCodeToChannelName",0,j,"getLatestGameState",0,function(e=[],t={}){let r=null;for(let n of C(e)){let e=x(n.content,t);if(!e||"room:state"!==e.event)continue;let a=Number(e.payload?.seq||0);(!r||a>=Number(r.payload?.seq||0))&&(r=e)}return r},"normalizeGameRoomCode",0,f,"parseGameEvent",0,x],99591);var N=e.i(87884),S=e.i(23952),A=e.i(26913),M=e.i(3593),I=e.i(71192);async function $(e,t,r,n,a,s){let i=b({gameId:r,roomCode:n,event:a,payload:s});await N.channelApi.sendChannelMessage({channelName:e,content:JSON.stringify(i),author:t.address,authorName:z(t)})}function z(e){return e.displayName||e.username}e.s(["useGameRoom",0,function({gameId:e,onError:t,getPlayerPayload:r}){let n=(0,M.useAppStore)(e=>e.hasBackend),a=(0,M.useAppStore)(e=>e.checkBackend),s=(0,M.useAppStore)(e=>e.openConnectModal),i=(0,I.useUserStore)(e=>e.identity),l=(0,I.useUserStore)(e=>e.openLoginModal),[o,u]=(0,d.useState)(""),[h,p]=(0,d.useState)(""),[m,y]=(0,d.useState)(!1),v=!0===n,k=(0,d.useCallback)(async(e,r)=>{let n=await (0,A.getApiErrorMessage)(e,r);t&&t(n)},[t]),w=(0,d.useCallback)(t=>!!x(t.content,{gameId:e,roomCode:o}),[e,o]),C=(0,d.useCallback)(t=>{let r=x(t.content,{gameId:e,roomCode:o});return r?`${t.author}-${r.eventId}`:`${t.author}-${t.timestamp}-${t.content}`},[e,o]),{clearMessages:E,connected:R,messages:L,sendMessage:U,syncMessages:P}=(0,S.useChannelMessages)({isReady:v,enabled:!!i,channelName:h,limit:500,acceptMessage:w,getMessageKey:C,onSyncError:e=>k(e,"无法读取房间记录")}),T=(0,d.useMemo)(()=>L.map(t=>({message:t,event:x(t.content,{gameId:e,roomCode:o})})).filter(e=>e.event),[e,L,o]),K=(0,d.useCallback)(()=>i?!!v||(s(),!1):(l(),!1),[v,s,l,i]);(0,d.useEffect)(()=>{null===n&&a()},[a,n]);let D=(0,d.useCallback)(async(n,a=!1)=>{if(!K()||!i)return!1;let s=a?g():f(n),l=j(e,s);if(!l)return t&&t("请输入 4-8 位房间码"),!1;y(!0);try{var o;return await N.channelApi.createChannel(l,c),await $(l,i,e,s,a?"room:create":"player:join",{player:r?r(i):{address:(o=i).address,name:z(o),publicKey:"",joinedAt:Date.now()}}),u(s),p(l),E(),!0}catch(e){return await k(e,a?"创建房间失败":"进入房间失败"),!1}finally{y(!1)}},[K,e,r,t,k,E,i]),B=(0,d.useCallback)(()=>D("",!0),[D]),O=(0,d.useCallback)(e=>D(e),[D]),G=(0,d.useCallback)(async(t,r={})=>{if(!K()||!i||!h||!o)return!1;let n=b({gameId:e,roomCode:o,event:t,payload:r}),a=JSON.stringify(n);try{return await U({channelName:h,content:a,author:i.address,authorName:z(i),optimisticId:`${i.address}-${n.eventId}`}),!0}catch(e){return await k(e,"发送房间事件失败"),!1}},[h,K,e,k,o,U,i]);return{channelName:h,connected:R,createRoom:B,ensureReady:K,isBackendReady:v,joinRoom:O,joining:m,messages:L,roomCode:o,roomEvents:T,sendRoomEvent:G,setRoomCode:u,syncMessages:P,userIdentity:i}}],34471)},39307,e=>{"use strict";var t=e.i(18050),r=e.i(71645),n=e.i(8734),a=e.i(72382),s=e.i(96699),i=e.i(21357);let l=(0,e.i(56420).default)("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);var o=e.i(53751),d=e.i(35965),c=e.i(59665),u=e.i(53881),h=e.i(34471),p=e.i(3593),m=e.i(71192);let f=[10,20,50,100],y=["2","3","4","5","6","7","8","9","10","J","Q","K","A"],g=["D","C","H","S"],j=new Map(y.map((e,t)=>[e,t+2])),b=new Map(g.map((e,t)=>[e,t+1])),x={1:"散牌",2:"对子",3:"顺子",4:"金花",5:"顺金",6:"豹子"};function v(e){return String(e||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,8)}function k(e="zhajinhua"){return`${e}_${Date.now()}_${function(){let e=new Uint8Array(4);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(256*Math.random());return[...e].map(e=>e.toString(16).padStart(2,"0")).join("")}()}`}function w(){let e=[];for(let t of g)for(let r of y)e.push(`${r}${t}`);return e}function C(e){let t=String(e||"").trim().toUpperCase(),r=t.slice(-1),n=t.slice(0,-1);if(!j.has(n)||!b.has(r))throw Error(`Invalid card: ${e}`);return{id:`${n}${r}`,rank:n,suit:r,rankValue:j.get(n),suitValue:b.get(r)}}function N(e){let t;if(!Array.isArray(e)||3!==e.length)throw Error("炸金花手牌必须是 3 张牌");let r=e.map(C),n=r.map(e=>e.rankValue),a=new Map;for(let e of n)a.set(e,(a.get(e)||0)+1);let s=1===new Set(r.map(e=>e.suit)).size,i=3!==(t=[...new Set(n)].sort((e,t)=>e-t)).length?0:2===t[0]&&3===t[1]&&14===t[2]?3:t[0]+1===t[1]&&t[1]+1===t[2]?t[2]:0,l=[...n].sort((e,t)=>t-e),o=Math.max(...r.map(e=>e.suitValue)),d=1,c=l;return 1===a.size?(d=6,c=[l[0]]):i&&s?(d=5,c=[i]):s?(d=4,c=l):i?(d=3,c=[i]):2===a.size&&(d=2,c=[[...a.entries()].find(([,e])=>2===e)[0],[...a.entries()].find(([,e])=>1===e)[0]]),{category:d,label:x[d],tiebreakers:c,tieSuit:o,cards:r.map(e=>e.id)}}function S(e){return e&&"object"==typeof e&&e.roundId&&Array.isArray(e.players)?{roomCode:v(e.roomCode),roundId:String(e.roundId),status:"finished"===e.status?"finished":"playing",host:R(e.host),seq:Number(e.seq)||1,startedAt:Number(e.startedAt)||Date.now(),ante:Number(e.ante)||10,pot:Math.max(0,Number(e.pot)||0),currentBet:Math.max(0,Number(e.currentBet)||10),turnAddress:R(e.turnAddress),players:e.players.map(E).filter(Boolean),lastAction:String(e.lastAction||""),winner:e.winner?R(e.winner):null,showdown:e.showdown&&"object"==typeof e.showdown?L(e.showdown):null,appliedEventIds:Array.isArray(e.appliedEventIds)?e.appliedEventIds.map(String):[]}:null}function A(e,t,r){let n=S(e);if(!n||"playing"!==n.status)return{ok:!1,error:"当前没有进行中的牌局"};let a=R(r),s=n.players.find(e=>e.address===a);if(!s||"active"!==s.status)return{ok:!1,error:"玩家不在本轮牌局中"};if(n.turnAddress!==a)return{ok:!1,error:"还没有轮到你操作"};let i=t?.action;if(!["look","call","raise","compare","fold"].includes(i))return{ok:!1,error:"未知操作"};if("look"===i)return s.looked?{ok:!1,error:"已经看过牌"}:{ok:!0};if("call"===i){let e=Math.max(0,n.currentBet-s.bet);return s.chips>=e?{ok:!0}:{ok:!1,error:"筹码不足,不能跟注"}}if("raise"===i){let e=Number(t.amount);if(!f.includes(e))return{ok:!1,error:"加注档位无效"};let r=n.currentBet+e-s.bet;return s.chips>=r?{ok:!0}:{ok:!1,error:"筹码不足,不能加注"}}if("compare"===i){let e=R(t.target),r=n.players.find(t=>t.address===e);if(!e||e===a||!r||"active"!==r.status)return{ok:!1,error:"请选择有效的比牌对象"};let i=Math.max(0,n.currentBet-s.bet);return s.chips>=i?{ok:!0}:{ok:!1,error:"筹码不足,不能比牌"}}return{ok:!0}}function M(e){return(e?.players||[]).filter(e=>"active"===e.status)}function I(e,t){let r=Math.max(0,e.currentBet-t.bet);t.chips-=r,t.bet+=r,e.pot+=r}function $(e,t){var r,n;let a,s=M(e);return 1===s.length?(r=e,n=s[0].address,(a=r.players.find(e=>e.address===n))&&(a.chips+=r.pot),r.status="finished",r.winner=n,r.turnAddress="",r.showdown=r.hands?L(r.hands):null,r.lastAction=a?`${a.name} 赢得 ${r.pot} 筹码`:"本局结束",r.pot=0,z(r)):(e.turnAddress=function(e,t){let r=e.players,n=Math.max(0,r.findIndex(e=>e.address===R(t)));for(let e=1;e<=r.length;e++){let t=r[(n+e)%r.length];if("active"===t.status)return t.address}return""}(e,t),z(e))}function z(e){return e.seq=Number(e.seq||0)+1,{ok:!0,state:e}}function E(e){var t;if(!e||"object"!=typeof e)return null;let r=R(e.address);return r?{address:r,name:String(e.name||((t=r)?`${t.slice(0,6)}...${t.slice(-4)}`:"")).slice(0,50),publicKey:String(e.publicKey||""),chips:Math.max(0,Number(e.chips)||0),status:"folded"===e.status?"folded":"active",looked:!0===e.looked,bet:Math.max(0,Number(e.bet)||0)}:null}function R(e){let t=String(e||"").trim();return/^0x[a-fA-F0-9]{40}$/.test(t)?t.toLowerCase():""}function L(e){return JSON.parse(JSON.stringify(e))}var U=e.i(99591),P=e.i(66112),T=e.i(93957);let K="zhajinhua";function D(e,t){return String(e||"").toLowerCase()===String(t||"").toLowerCase()}function B(e=""){return e?`${e.slice(0,6)}...${e.slice(-4)}`:""}e.s(["default",0,function(){var e,y;let g,j=(0,p.useAppStore)(e=>e.isDarkMode),b=(0,p.useAppStore)(e=>e.setIsDarkMode),x=(0,p.useAppStore)(e=>e.addToast),C=(0,m.useUserStore)(e=>e.initializeUser),[E,O]=(0,r.useState)(""),[G,V]=(0,r.useState)(!1),[q,J]=(0,r.useState)(20),[_,H]=(0,r.useState)(""),[F,W]=(0,r.useState)({}),Z=(0,r.useRef)(null),Q=(0,r.useRef)(new Set),Y=(0,h.useGameRoom)({gameId:K,onError:e=>x(e,"error"),getPlayerPayload:e=>{let t=(0,P.most25519)(e.danger);return{address:e.address,name:e.displayName||e.username,publicKey:t.public_key,joinedAt:Date.now()}}}),X=(0,r.useMemo)(()=>Y.userIdentity?.danger?(0,P.most25519)(Y.userIdentity.danger):null,[Y.userIdentity?.danger]);(0,r.useEffect)(()=>{C()},[C]),(0,r.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("room")?.toUpperCase();e&&O(e)},[]),(0,r.useEffect)(()=>{if(!Y.roomCode)return;let e=`/game/zhajinhua?room=${Y.roomCode}`;`${window.location.pathname}${window.location.search}`!==e&&window.history.replaceState(null,"",e)},[Y.roomCode]);let ee=(0,r.useMemo)(()=>(0,U.deriveGameRoomLobby)(Y.messages,{gameId:K,roomCode:Y.roomCode}),[Y.messages,Y.roomCode]),et=(0,r.useMemo)(()=>(0,U.getLatestGameState)(Y.messages,{gameId:K,roomCode:Y.roomCode}),[Y.messages,Y.roomCode]),er=et?.payload?.round||null,en=er?.host||ee.hostAddress,ea=D(en,Y.userIdentity?.address),es=Y.userIdentity?.address?.toLowerCase()||"",ei=er?.players.find(e=>D(e.address,es)),el=ei||ee.players.find(e=>D(e.address,es)),eo=F[er?.roundId||""]||null,ed=(er?.showdown&&es?er.showdown[es]:null)||(ei?.looked?eo:null),ec=function(e,t){let r=(e?.players||[]).find(e=>e.address===R(t));if(!e||"playing"!==e.status||!r||"active"!==r.status||e.turnAddress!==r.address)return[];let n=[];return r.looked||n.push("look"),A(e,{action:"call"},r.address).ok&&n.push("call"),f.some(t=>A(e,{action:"raise",amount:t},r.address).ok)&&n.push("raise"),M(e).length>1&&n.push("compare"),n.push("fold"),n}(er,es),eu=M(er),eh=ea&&function(e=[]){let t=e.filter(e=>Number(e.chips)>=10);return t.length>=2&&t.length<=5}(ee.players.map(e=>({...e,chips:er?.players.find(t=>D(t.address,e.address))?.chips??1e3}))),ep=Y.roomCode&&1?`${window.location.origin}/game/zhajinhua?room=${Y.roomCode}`:"";async function em(){await Y.createRoom()&&x("房间已创建","success")}async function ef(e){e.preventDefault(),await Y.joinRoom(E)&&x("已进入房间","success")}async function ey(){ep&&(await navigator.clipboard.writeText(ep),V(!0),setTimeout(()=>V(!1),1400))}async function eg(e){return Y.sendRoomEvent("room:state",{round:function(e){if(!e)return null;let t={...e};return delete t.hands,L(t)}(e),seq:e.seq})}async function ej(){if(!Y.userIdentity||!X||!eh)return void x("至少需要 2 名有足够筹码的玩家","error");try{let e=ee.players.map(e=>({...e,chips:er?.players.find(t=>D(t.address,e.address))?.chips??1e3})),t=function({roomCode:e,players:t,hostAddress:r,roundId:n=k("round"),random:a=Math.random}){let s=t.filter(e=>Number(e.chips)>=10).slice(0,5);if(s.length<2)throw Error("至少需要 2 名有足够筹码的玩家");let i=function(e=w(),t=Math.random){let r=[...e];for(let e=r.length-1;e>0;e--){let n=Math.floor(t()*(e+1));[r[e],r[n]]=[r[n],r[e]]}return r}(w(),a),l={},o=s.map((e,t)=>{let r=i.slice(3*t,3*t+3);return l[e.address]=r,{address:e.address,name:e.name,publicKey:e.publicKey,chips:Number(e.chips)-10,status:"active",looked:!1,bet:10}}),d=Math.max(0,o.findIndex(e=>e.address===R(r))),c=o[(d+1)%o.length].address;return{roomCode:v(e),roundId:n,status:"playing",host:R(r),seq:1,startedAt:Date.now(),ante:10,pot:10*o.length,currentBet:10,turnAddress:c,players:o,lastAction:"本局开始",winner:null,showdown:null,appliedEventIds:[],hands:l}}({roomCode:Y.roomCode,players:e,hostAddress:Y.userIdentity.address});for(let e of(Z.current=t.hands,Q.current.clear(),await eg(t),t.players)){let r=(0,P.mostBoxEncrypt)(JSON.stringify(t.hands[e.address]),{senderPrivateKey:X.private_key,recipientPublicKey:e.publicKey});await Y.sendRoomEvent("deal:private",{roundId:t.roundId,recipient:e.address,senderPublicKey:X.public_key,encrypted:r})}W(e=>({...e,[t.roundId]:t.hands[Y.userIdentity.address.toLowerCase()]})),x("新一局已开始","success")}catch(e){x(e instanceof Error?e.message:"开局失败","error")}}async function eb(e,t={}){if(!er||!Y.userIdentity)return;let r=function({roundId:e,action:t,amount:r,target:n}){return{roundId:e,eventId:k("action"),action:t,amount:r,target:n}}({roundId:er.roundId,action:e,amount:t.amount,target:t.target});await Y.sendRoomEvent("player:action",{actionEvent:r})}(0,r.useEffect)(()=>{if(er&&Y.userIdentity&&X&&en)for(let e of Y.roomEvents){let t=e.event;if(!t||"deal:private"!==t.event)continue;let r=t.payload;if(r.roundId!==er.roundId||!D(r.recipient,Y.userIdentity.address))continue;let n=(0,P.mostBoxDecrypt)(r.encrypted||"",{senderPublicKey:r.senderPublicKey||"",recipientPrivateKey:X.private_key});if(n)try{let e=JSON.parse(n);Array.isArray(e)&&W(t=>({...t,[er.roundId]:e.map(String)}))}catch{}}},[er?.roundId,Y.roomEvents,Y.userIdentity,en,X?.private_key]),(0,r.useEffect)(()=>{if(!ea||!er||"playing"!==er.status)return;let e=Z.current;if(!e)return;let t=Y.roomEvents.filter(e=>{let t=e.event;if(!t||"player:action"!==t.event)return!1;let r=t.payload.actionEvent;return!(!r||r.roundId!==er.roundId||Q.current.has(r.eventId)||er.appliedEventIds?.includes(r.eventId))});if(0===t.length)return;let r=!1;return async function(){let n,a=(n=S(er))&&e&&"object"==typeof e?{...n,hands:L(e)}:null;if(a)for(let e of t){if(r)return;let t=(e.event?.payload).actionEvent,n=function(e,t,r){let n=A(e,t,r);if(!n.ok)return{ok:!1,error:n.error,state:e};let a=L(e),s=R(r),i=a.players.find(e=>e.address===s),l=String(t.eventId);if(a.appliedEventIds?.includes(l))return{ok:!0,state:a,duplicate:!0};if(Array.isArray(a.appliedEventIds)||(a.appliedEventIds=[]),a.appliedEventIds.push(l),"look"===t.action)return i.looked=!0,a.lastAction=`${i.name} 看牌`,z(a);if("fold"===t.action)return i.status="folded",a.lastAction=`${i.name} 弃牌`,$(a,s);if("call"===t.action)return I(a,i),a.lastAction=`${i.name} 跟注`,$(a,s);if("raise"===t.action){let e=Number(t.amount);return a.currentBet+=e,I(a,i),a.lastAction=`${i.name} 加注 ${e}`,$(a,s)}if("compare"===t.action){I(a,i);let e=R(t.target),r=a.players.find(t=>t.address===e),n=function(e,t){let r=N(e),n=N(t);if(r.category!==n.category)return r.category-n.category;let a=function(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let r=e[n]||0,a=t[n]||0;if(r!==a)return r-a}return 0}(r.tiebreakers,n.tiebreakers);return 0!==a?a:r.tieSuit-n.tieSuit}(a.hands?.[s]||[],a.hands?.[e]||[])>=0?r:i;return n.status="folded",a.lastAction=`${i.name} 与 ${r.name} 比牌,${n.name} 出局`,$(a,s)}return{ok:!1,error:"未知操作",state:e}}(a,t,e.message.author);if(n.ok&&(a=n.state,Z.current=n.state.hands,await eg(n.state)&&Q.current.add(t.eventId),"finished"===n.state.status))break}}(),()=>{r=!0}},[er?.roundId,er?.seq,er?.status,Y.roomEvents,ea]);let ex=er?.status==="playing"?D(er.turnAddress,es)?"轮到你操作":er.turnAddress?`等待 ${e=er.turnAddress,y=ee.players,g=e.toLowerCase(),y.find(e=>e.address===g)?.name||B(e)}`:"进行中":er?.status==="finished"?"本局结束":"等待开局",ev=eu.filter(e=>!D(e.address,es));return(0,t.jsx)(c.default,{sidebar:({closeSidebar:e})=>(0,t.jsx)(u.default,{activeGame:"zhajinhua",closeSidebar:e}),headerTitle:(0,t.jsxs)("div",{className:"zjh-header-title",children:[(0,t.jsx)("h2",{className:"header-title",children:"游戏 · 炸金花"}),Y.roomCode&&(0,t.jsxs)("span",{className:"header-badge",children:["房间 ",Y.roomCode]})]}),headerRight:(0,t.jsxs)("div",{className:"header-right-actions",children:[Y.roomCode&&(0,t.jsxs)("button",{className:"btn btn-secondary",onClick:ey,children:[(0,t.jsx)(n.Copy,{size:16}),G?"已复制":"分享房间"]}),(0,t.jsx)("button",{className:"btn btn-icon",onClick:()=>b(!j),title:"切换主题",children:j?(0,t.jsx)(d.Sun,{size:16}):(0,t.jsx)(s.Moon,{size:16})})]}),children:(0,t.jsx)("main",{className:"zjh-page",children:Y.roomCode?(0,t.jsxs)("div",{className:"zjh-board",children:[(0,t.jsxs)("section",{className:"zjh-table",children:[(0,t.jsxs)("div",{className:"zjh-table-center",children:[(0,t.jsx)("span",{children:"底池"}),(0,t.jsx)("strong",{children:er?.pot||0}),(0,t.jsxs)("small",{children:["当前注 ",er?.currentBet||0]})]}),(0,t.jsx)("div",{className:"zjh-seats",children:ee.players.map(e=>{let r=er?.players.find(t=>D(t.address,e.address)),n=er?.turnAddress===e.address,a=er?.winner===e.address;return(0,t.jsxs)("div",{className:`zjh-seat ${n?"turn":""} ${a?"winner":""}`,children:[(0,t.jsx)("img",{className:"zjh-seat-avatar",src:(0,T.generateAvatar)(e.address),alt:"avatar"}),(0,t.jsxs)("div",{className:"zjh-seat-main",children:[(0,t.jsx)("strong",{children:e.name}),(0,t.jsx)("span",{children:B(e.address)})]}),(0,t.jsxs)("div",{className:"zjh-seat-meta",children:[(0,t.jsxs)("span",{children:[r?.chips??1e3," 筹码"]}),(0,t.jsx)("span",{children:r?.status==="folded"?"已弃牌":r?.looked?"已看牌":er?"在局中":"等待开局"})]})]},e.address)})})]}),(0,t.jsxs)("aside",{className:"zjh-panel",children:[(0,t.jsxs)("div",{className:"zjh-panel-section",children:[(0,t.jsxs)("div",{className:"zjh-panel-title",children:[(0,t.jsx)(o.Spade,{size:16}),(0,t.jsx)("span",{children:"我的手牌"})]}),(0,t.jsx)("div",{className:"zjh-hand",children:ed?ed.map(e=>{let r,n,a=(n=(r=String(e||"")).slice(-1),{rank:r.slice(0,-1),suit:({S:"S",H:"H",C:"C",D:"D"})[n]||n,color:"H"===n||"D"===n?"red":"black"});return(0,t.jsxs)("div",{className:`zjh-card ${a.color}`,children:[(0,t.jsx)("span",{children:a.rank}),(0,t.jsx)("strong",{children:a.suit})]},e)}):[0,1,2].map(e=>(0,t.jsx)("div",{className:"zjh-card back",children:(0,t.jsx)(o.Spade,{size:18})},e))}),(0,t.jsx)("p",{className:"zjh-hand-label",children:ed?N(ed).label:eo?"未看牌":"等待房主发牌"})]}),(0,t.jsxs)("div",{className:"zjh-panel-section",children:[(0,t.jsxs)("div",{className:"zjh-panel-title",children:[(0,t.jsx)(i.Play,{size:16}),(0,t.jsx)("span",{children:"操作"})]}),ea?(0,t.jsxs)("button",{className:"btn btn-primary btn-full",onClick:ej,disabled:!eh||er?.status==="playing",children:[(0,t.jsx)(l,{size:16}),"开始本局"]}):(0,t.jsx)("p",{className:"zjh-muted",children:"等待房主开始或继续牌局。"}),(0,t.jsxs)("div",{className:"zjh-actions",children:[(0,t.jsxs)("button",{className:"btn btn-secondary",disabled:!ec.includes("look"),onClick:()=>eb("look"),children:[(0,t.jsx)(a.Eye,{size:16}),"看牌"]}),(0,t.jsx)("button",{className:"btn btn-secondary",disabled:!ec.includes("call"),onClick:()=>eb("call"),children:"跟注"}),(0,t.jsx)("button",{className:"btn btn-secondary",disabled:!ec.includes("fold"),onClick:()=>eb("fold"),children:"弃牌"})]}),(0,t.jsxs)("div",{className:"zjh-raise-row",children:[(0,t.jsx)("select",{className:"input input-compact",value:q,onChange:e=>J(Number(e.target.value)),children:f.map(e=>(0,t.jsxs)("option",{value:e,children:["加 ",e]},e))}),(0,t.jsx)("button",{className:"btn btn-secondary",disabled:!ec.includes("raise"),onClick:()=>eb("raise",{amount:q}),children:"加注"})]}),(0,t.jsxs)("div",{className:"zjh-raise-row",children:[(0,t.jsxs)("select",{className:"input input-compact",value:_,onChange:e=>H(e.target.value),children:[(0,t.jsx)("option",{value:"",children:"选择比牌对象"}),ev.map(e=>(0,t.jsx)("option",{value:e.address,children:e.name},e.address))]}),(0,t.jsx)("button",{className:"btn btn-secondary",disabled:!ec.includes("compare")||!_,onClick:()=>eb("compare",{target:_}),children:"比牌"})]})]}),(0,t.jsxs)("div",{className:"zjh-panel-section",children:[(0,t.jsx)("div",{className:"zjh-panel-title",children:"状态"}),(0,t.jsxs)("div",{className:"zjh-status-grid",children:[(0,t.jsx)("span",{children:"房主"}),(0,t.jsx)("strong",{children:en?B(en):"-"}),(0,t.jsx)("span",{children:"我的筹码"}),(0,t.jsx)("strong",{children:el?.chips??1e3}),(0,t.jsx)("span",{children:"本轮"}),(0,t.jsx)("strong",{children:ex}),(0,t.jsx)("span",{children:"提示"}),(0,t.jsx)("strong",{children:er?.lastAction||"等待玩家加入"})]})]})]})]}):(0,t.jsxs)("section",{className:"zjh-welcome",children:[(0,t.jsx)("div",{className:"zjh-welcome-icon",children:(0,t.jsx)(o.Spade,{size:36})}),(0,t.jsx)("h2",{children:"P2P 炸金花"}),(0,t.jsx)("p",{children:"创建房间邀请朋友,房主在线开始牌局并推进状态。"}),(0,t.jsxs)("div",{className:"zjh-welcome-actions",children:[(0,t.jsxs)("button",{className:"btn btn-primary",disabled:Y.joining,onClick:em,children:[(0,t.jsx)(i.Play,{size:16}),"创建房间"]}),(0,t.jsxs)("form",{className:"zjh-room-input-row",onSubmit:ef,children:[(0,t.jsx)("input",{className:"input input-compact",value:E,onChange:e=>O(e.target.value.toUpperCase()),placeholder:"输入房间码",maxLength:8}),(0,t.jsx)("button",{className:"btn btn-icon",disabled:Y.joining||!E,children:(0,t.jsx)(i.Play,{size:16})})]})]})]})})})}],39307)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,8734,e=>{"use strict";let a=(0,e.i(56420).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,a],8734)},30274,e=>{"use strict";let a=(0,e.i(56420).default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["Send",0,a],30274)},96699,e=>{"use strict";let a=(0,e.i(56420).default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",0,a],96699)},35965,e=>{"use strict";let a=(0,e.i(56420).default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,a],35965)},11241,e=>{"use strict";let a=(0,e.i(56420).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,a],11241)},59665,e=>{"use strict";var a=e.i(18050),t=e.i(71645),n=e.i(67228);let r=(0,e.i(56420).default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);e.i(22183);var s=e.i(5142);let l=(0,t.createContext)(null);e.s(["default",0,function({sidebar:e,headerTitle:i,headerRight:o,children:d}){let[u,c]=(0,s.useDisclosure)(!1),[m,p]=(0,t.useState)(!1),h=(0,n.useMediaQuery)("(max-width: 768px)"),f=()=>{h?c.open():p(!1)};return(0,a.jsx)(l.Provider,{value:{closeSidebar:c.close,openSidebar:f,isSidebarVisible:h?u:!m},children:(0,a.jsxs)("div",{className:"app-layout",children:[(0,a.jsx)("div",{className:`sidebar-overlay ${u?"visible":""}`,onClick:()=>c.close()}),(0,a.jsx)("div",{className:`sidebar ${u?"open":""} ${m?"collapsed":""}`,children:e({closeSidebar:c.close,openSidebar:f})}),(0,a.jsxs)("div",{className:"main-content",children:[(0,a.jsxs)("header",{className:"app-header",children:[(0,a.jsxs)("div",{className:"header-left",children:[(0,a.jsx)("button",{onClick:()=>{h?c.toggle():p(!m)},className:"btn btn-icon sidebar-toggle-btn","aria-label":h?"打开菜单":m?"展开侧边栏":"收起侧边栏",children:(0,a.jsx)(r,{size:16})}),i]}),(0,a.jsx)("div",{className:"header-right",children:o})]}),d]})]})})},"useAppShell",0,function(){let e=(0,t.useContext)(l);if(!e)throw Error("useAppShell must be used within AppShell");return e}],59665)},27648,e=>{"use strict";var a=e.i(18050),t=e.i(93957),n=e.i(71192);e.s(["default",0,function({className:e=""}){let r=(0,n.useUserStore)(e=>e.identity),s=(0,n.useUserStore)(e=>e.openLoginModal),l=(0,n.useUserStore)(e=>e.logoutUser);return(0,a.jsxs)("div",{className:`chat-sidebar-footer sidebar-account ${e}`,children:[(0,a.jsxs)("div",{className:"user-info",children:[(0,a.jsx)("img",{className:"user-avatar-img",src:(0,t.generateAvatar)(r?.address),alt:"avatar"}),(0,a.jsx)("span",{className:"user-name",title:r?.address,children:r?.displayName||"未登录"})]}),r?(0,a.jsx)("button",{className:"btn btn-ghost logout-btn",onClick:l,children:"退出"}):(0,a.jsx)("button",{className:"btn btn-primary login-btn",onClick:s,children:"登录"})]})}])},23952,87884,e=>{"use strict";var a=e.i(71645),t=e.i(26913);let n={getChannels(e={}){let a=new URLSearchParams;e.type&&a.set("type",e.type),e.excludeType&&a.set("excludeType",e.excludeType);let n=a.toString();return t.api.get(n?`/api/channels?${n}`:"/api/channels").json()},createChannel:(e,a="personal")=>t.api.post("/api/channels",{json:{name:e,type:a}}).json(),leaveChannel:e=>t.api.delete(`/api/channels/${encodeURIComponent(e)}`).json(),getChannelMessages:(e,a=100,n=0)=>t.api.get(`/api/channels/${encodeURIComponent(e)}/messages?limit=${a}&offset=${n}`).json(),sendChannelMessage:({channelName:e,content:a,author:n,authorName:r,attachment:s})=>t.api.post(`/api/channels/${encodeURIComponent(e)}/messages`,{json:s?{content:a,author:n,authorName:r,attachment:s}:{content:a,author:n,authorName:r}}).json(),getChannelPeers:e=>t.api.get(`/api/channels/${encodeURIComponent(e)}/peers`).json(),setChannelRemark:(e,a)=>t.api.put(`/api/channels/${encodeURIComponent(e)}/remark`,{json:{remark:a}}).json()};function r(e){return String(e.id||`${e.author||""}-${e.timestamp||""}-${e.content||""}`)}e.s(["channelApi",0,n],87884),e.s(["useChannelMessages",0,function({isReady:e,enabled:s=!0,channelName:l="",peerId:i="",waitForPeerId:o=!1,limit:d=100,reconnectBaseDelay:u=2500,acceptMessage:c,getMessageKey:m=r,onSyncError:p,onSocketEvent:h}){let[f,g]=(0,a.useState)([]),[b,y]=(0,a.useState)(!1),S=(0,a.useRef)(null),_=(0,a.useRef)(l),x=(0,a.useRef)(null),j=(0,a.useRef)(0),v=(0,a.useRef)(c),C=(0,a.useRef)(m),k=(0,a.useRef)(h),N=(0,a.useRef)(p),w=(0,a.useRef)(i);(0,a.useEffect)(()=>{v.current=c},[c]),(0,a.useEffect)(()=>{C.current=m},[m]),(0,a.useEffect)(()=>{k.current=h},[h]),(0,a.useEffect)(()=>{N.current=p},[p]);let A=(0,a.useCallback)(e=>{let a=v.current;return a?e.filter(a):e},[]),$=(0,a.useCallback)((e,a,t=!0)=>{let n=[...e];for(let e of A(a)){let a=C.current(e);if(t){let t=n.findIndex(a=>a.pending&&a.author?.toLowerCase()===e.author?.toLowerCase()&&a.content===e.content);if(-1!==t){n[t]={...e,id:e.id||a};continue}}n.some(e=>C.current(e)===a)||n.push({...e,id:e.id||a})}return n},[A]),M=(0,a.useCallback)((e,a)=>{S.current?.readyState===WebSocket.OPEN&&S.current.send(JSON.stringify({event:e,data:a}))},[]),R=(0,a.useCallback)(e=>{e&&M("channel:subscribe",{channel:e})},[M]),G=(0,a.useCallback)(e=>{e&&M("channel:unsubscribe",{channel:e})},[M]),O=(0,a.useCallback)(async(a=_.current,t={})=>{if(!a||!e)return[];try{let e=A(await n.getChannelMessages(a,d));return g(a=>t.replace?e:$(a,e,!1)),e}catch(e){return t.replace&&g([]),await N.current?.(e),[]}},[A,e,d,$]);(0,a.useEffect)(()=>{w.current=i,i&&(M("register",{peerId:i}),o&&_.current&&(R(_.current),O(_.current,{replace:!0})))},[i,R,O,o,M]);let H=(0,a.useCallback)(()=>{g([])},[]),B=(0,a.useCallback)(async({channelName:e=_.current,content:a,author:t,authorName:r,attachment:s,optimisticId:l})=>{let i=a.trim();if(!e||!i)return null;let o={id:l||`${t}-${Date.now()}-${Math.random().toString(36).slice(2)}`,author:t,authorName:r,content:i,timestamp:Date.now(),pending:!0,attachment:s};g(e=>[...e,o]);try{let a=await n.sendChannelMessage({channelName:e,content:i,author:t,authorName:r,attachment:s});return g(e=>e.map(e=>e.id===o.id?{...a.message,id:a.message.id||C.current(a.message)}:e)),a.message}catch(e){throw g(e=>e.filter(e=>e.id!==o.id)),e}},[]);return(0,a.useEffect)(()=>{let a=_.current;if(_.current=l,a&&a!==l&&G(a),l&&e&&s)return O(l,{replace:!0}),(!o||w.current)&&R(l),()=>G(l)},[l,s,e,R,O,G,o]),(0,a.useEffect)(()=>{if(!e||!s)return void y(!1);let a=!1;async function n(){let e=new WebSocket(await (0,t.getAuthenticatedWebSocketUrl)("/ws"));a?e.close():(e.onopen=()=>{y(!0),j.current=0,w.current&&e.send(JSON.stringify({event:"register",data:{peerId:w.current}})),_.current&&(!o||w.current)&&(R(_.current),O(_.current,{replace:!0}))},e.onmessage=e=>{try{let a=JSON.parse(e.data);k.current?.(a.event,a.data),"channel:message"===a.event&&a.data?.channel===_.current&&a.data?.message&&g(e=>$(e,[a.data.message]))}catch{}},e.onclose=()=>{if(y(!1),a)return;let e=j.current;if(e>=20)return;let t=Math.min(u*Math.pow(2,e),3e4);j.current=e+1,x.current=setTimeout(n,t)},e.onerror=()=>e.close(),S.current=e)}return j.current=0,n(),()=>{a=!0,x.current&&clearTimeout(x.current),S.current?.close(),S.current=null}},[s,e,$,u,R,O,o]),{clearMessages:H,connected:b,messages:f,sendMessage:B,setMessages:g,syncMessages:O}}],23952)},21357,e=>{"use strict";let a=(0,e.i(56420).default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",0,a],21357)},53881,53751,99591,34471,e=>{"use strict";var a=e.i(18050),t=e.i(22016),n=e.i(11241),r=e.i(56420);let s=(0,r.default)("spade",[["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"M2 14.499a5.5 5.5 0 0 0 9.591 3.675.6.6 0 0 1 .818.001A5.5 5.5 0 0 0 22 14.5c0-2.29-1.5-4-3-5.5l-5.492-5.312a2 2 0 0 0-3-.02L5 8.999c-1.5 1.5-3 3.2-3 5.5",key:"1aw2pz"}]]);e.s(["Spade",0,s],53751);let l=(0,r.default)("swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);var i=e.i(27648);let o=[{id:"gandengyan",label:"干瞪眼",href:"/game/gandengyan/",icon:(0,a.jsx)(l,{size:16})},{id:"zhajinhua",label:"炸金花",href:"/game/zhajinhua/",icon:(0,a.jsx)(s,{size:16})}];e.s(["default",0,function({activeGame:e,closeSidebar:r}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.default,{href:"/",className:"sidebar-header sidebar-header-link",children:[(0,a.jsx)(n.ArrowLeft,{size:18}),(0,a.jsx)("h1",{children:"MOST PEOPLE"})]}),(0,a.jsx)("nav",{className:"sidebar-nav",children:o.map(n=>(0,a.jsxs)(t.default,{href:n.href,className:`sidebar-nav-btn ${e===n.id?"active":""}`,onClick:r,children:[n.icon,(0,a.jsx)("span",{children:n.label})]},n.id))}),(0,a.jsx)(i.default,{})]})}],53881);var d=e.i(71645);let u="game",c="mostbox.game.event",m=["gandengyan","zhajinhua"],p="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";function h(e){let a=String(e||"").trim().toLowerCase();return m.includes(a)?a:""}function f(e){return String(e||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,8)}function g(e){return/^[A-Z0-9]{4,8}$/.test(String(e||""))}function b(){let e="";for(let a=0;a<6;a++)e+=p[function(e){if(globalThis.crypto?.getRandomValues){let a=new Uint32Array(1);return globalThis.crypto.getRandomValues(a),a[0]%e}return Math.floor(Math.random()*e)}(p.length)];return e}function y(e,a){let t=h(e),n=f(a);return t&&g(n)?`game-${t}-${n.toLowerCase()}`:""}function S({gameId:e,roomCode:a,event:t,payload:n}){var r;let s=h(e);return{kind:c,version:1,gameId:s,roomCode:f(a),event:String(t||""),eventId:(r=s||"game",`${r}_${Date.now()}_${function(){let e=new Uint8Array(4);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(e);else for(let a=0;a<e.length;a++)e[a]=Math.floor(256*Math.random());return[...e].map(e=>e.toString(16).padStart(2,"0")).join("")}()}`),payload:n||{}}}function _(e,a={}){try{let t=JSON.parse(String(e||""));if(!t||t.kind!==c||1!==t.version||"string"!=typeof t.event||"string"!=typeof t.eventId)return null;let n=h(t.gameId),r=f(t.roomCode);if(!n||!g(r)||a.gameId&&n!==h(a.gameId)||a.roomCode&&r!==f(a.roomCode))return null;return{...t,gameId:n,roomCode:r,payload:t.payload&&"object"==typeof t.payload?t.payload:{}}}catch{return null}}function x(e,a){var t;if(!e||"object"!=typeof e)return null;let n=j(e.address||a);if(!n||j(a)!==n)return null;let r=String(e.name||"").trim().slice(0,50)||((t=n)?`${t.slice(0,6)}...${t.slice(-4)}`:"");return{address:n,name:r,publicKey:String(e.publicKey||"").trim(),joinedAt:Number(e.joinedAt||Date.now())}}function j(e){let a=String(e||"").trim();return/^0x[a-fA-F0-9]{40}$/.test(a)?a.toLowerCase():""}function v(e,a,t){let n=a.get(t.address);n?Object.assign(n,t):(e.push(t),a.set(t.address,t))}function C(e){return[...e].sort((e,a)=>Number(e.timestamp||0)-Number(a.timestamp||0))}e.s(["GAME_CHANNEL_TYPE",0,u,"createGameEvent",0,S,"createGameRoomCode",0,b,"deriveGameRoomLobby",0,function(e=[],a={}){let t=[],n=new Map,r="";for(let s of C(e)){let e=_(s.content,a);if(e){if("room:create"===e.event){let a=x(e.payload?.player,s.author);if(!a)continue;r||(r=a.address),v(t,n,a);continue}if("player:join"===e.event){let a=x(e.payload?.player,s.author);a&&v(t,n,a)}}}return{gameId:h(a.gameId),roomCode:f(a.roomCode),hostAddress:r,players:t}},"gameRoomCodeToChannelName",0,y,"getLatestGameState",0,function(e=[],a={}){let t=null;for(let n of C(e)){let e=_(n.content,a);if(!e||"room:state"!==e.event)continue;let r=Number(e.payload?.seq||0);(!t||r>=Number(t.payload?.seq||0))&&(t=e)}return t},"normalizeGameRoomCode",0,f,"parseGameEvent",0,_],99591);var k=e.i(87884),N=e.i(23952),w=e.i(26913),A=e.i(3593),$=e.i(71192);async function M(e,a,t,n,r,s){let l=S({gameId:t,roomCode:n,event:r,payload:s});await k.channelApi.sendChannelMessage({channelName:e,content:JSON.stringify(l),author:a.address,authorName:R(a)})}function R(e){return e.displayName||e.username}e.s(["useGameRoom",0,function({gameId:e,onError:a,getPlayerPayload:t}){let n=(0,A.useAppStore)(e=>e.hasBackend),r=(0,A.useAppStore)(e=>e.checkBackend),s=(0,A.useAppStore)(e=>e.openConnectModal),l=(0,$.useUserStore)(e=>e.identity),i=(0,$.useUserStore)(e=>e.openLoginModal),[o,c]=(0,d.useState)(""),[m,p]=(0,d.useState)(""),[h,g]=(0,d.useState)(!1),x=!0===n,j=(0,d.useCallback)(async(e,t)=>{let n=await (0,w.getApiErrorMessage)(e,t);a&&a(n)},[a]),v=(0,d.useCallback)(a=>!!_(a.content,{gameId:e,roomCode:o}),[e,o]),C=(0,d.useCallback)(a=>{let t=_(a.content,{gameId:e,roomCode:o});return t?`${a.author}-${t.eventId}`:`${a.author}-${a.timestamp}-${a.content}`},[e,o]),{clearMessages:G,connected:O,messages:H,sendMessage:B,syncMessages:I}=(0,N.useChannelMessages)({isReady:x,enabled:!!l,channelName:m,limit:500,acceptMessage:v,getMessageKey:C,onSyncError:e=>j(e,"无法读取房间记录")}),E=(0,d.useMemo)(()=>H.map(a=>({message:a,event:_(a.content,{gameId:e,roomCode:o})})).filter(e=>e.event),[e,H,o]),P=(0,d.useCallback)(()=>l?!!x||(s(),!1):(i(),!1),[x,s,i,l]);(0,d.useEffect)(()=>{null===n&&r()},[r,n]);let W=(0,d.useCallback)(async(n,r=!1)=>{if(!P()||!l)return!1;let s=r?b():f(n),i=y(e,s);if(!i)return a&&a("请输入 4-8 位房间码"),!1;g(!0);try{var o;return await k.channelApi.createChannel(i,u),await M(i,l,e,s,r?"room:create":"player:join",{player:t?t(l):{address:(o=l).address,name:R(o),publicKey:"",joinedAt:Date.now()}}),c(s),p(i),G(),!0}catch(e){return await j(e,r?"创建房间失败":"进入房间失败"),!1}finally{g(!1)}},[P,e,t,a,j,G,l]),L=(0,d.useCallback)(()=>W("",!0),[W]),U=(0,d.useCallback)(e=>W(e),[W]),z=(0,d.useCallback)(async(a,t={})=>{if(!P()||!l||!m||!o)return!1;let n=S({gameId:e,roomCode:o,event:a,payload:t}),r=JSON.stringify(n);try{return await B({channelName:m,content:r,author:l.address,authorName:R(l),optimisticId:`${l.address}-${n.eventId}`}),!0}catch(e){return await j(e,"发送房间事件失败"),!1}},[m,P,e,j,o,B,l]);return{channelName:m,connected:O,createRoom:L,ensureReady:P,isBackendReady:x,joinRoom:U,joining:h,messages:H,roomCode:o,roomEvents:E,sendRoomEvent:z,setRoomCode:c,syncMessages:I,userIdentity:l}}],34471)},45309,e=>{e.v({accountLine:"page-module__bH9uOG__accountLine",actions:"page-module__bH9uOG__actions",active:"page-module__bH9uOG__active",avatar:"page-module__bH9uOG__avatar",badges:"page-module__bH9uOG__badges",black:"page-module__bH9uOG__black",card:"page-module__bH9uOG__card",cardButton:"page-module__bH9uOG__cardButton",cardMark:"page-module__bH9uOG__cardMark",centerTable:"page-module__bH9uOG__centerTable",dangerBadge:"page-module__bH9uOG__dangerBadge",deckBox:"page-module__bH9uOG__deckBox",entry:"page-module__bH9uOG__entry",entryBrand:"page-module__bH9uOG__entryBrand",entryPanel:"page-module__bH9uOG__entryPanel",gameGrid:"page-module__bH9uOG__gameGrid",hand:"page-module__bH9uOG__hand",handPanel:"page-module__bH9uOG__handPanel",headerActions:"page-module__bH9uOG__headerActions",joinForm:"page-module__bH9uOG__joinForm",logPanel:"page-module__bH9uOG__logPanel",notice:"page-module__bH9uOG__notice",page:"page-module__bH9uOG__page",panel:"page-module__bH9uOG__panel",picked:"page-module__bH9uOG__picked",playedBox:"page-module__bH9uOG__playedBox",playedCards:"page-module__bH9uOG__playedCards",player:"page-module__bH9uOG__player",preview:"page-module__bH9uOG__preview",red:"page-module__bH9uOG__red",roomBar:"page-module__bH9uOG__roomBar",scoreMeta:"page-module__bH9uOG__scoreMeta",scoreRow:"page-module__bH9uOG__scoreRow",seats:"page-module__bH9uOG__seats",sidePanel:"page-module__bH9uOG__sidePanel",small:"page-module__bH9uOG__small",status:"page-module__bH9uOG__status",tablePanel:"page-module__bH9uOG__tablePanel",valid:"page-module__bH9uOG__valid",winner:"page-module__bH9uOG__winner"})},31678,e=>{"use strict";var a=e.i(18050),t=e.i(71645),n=e.i(8734),r=e.i(96699),s=e.i(21357);let l=(0,e.i(56420).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var i=e.i(30274),o=e.i(35965),d=e.i(59665),u=e.i(53881),c=e.i(34471),m=e.i(3593),p=e.i(71192);let h=["S","H","C","D"],f=["3","4","5","6","7","8","9","10","J","Q","K","A","2"],g=f.filter(e=>"2"!==e),b=new Map(f.map((e,a)=>[e,a+3]));function y(e){return e?{id:e.id,ownerAddress:e.ownerAddress,status:e.status,seq:Number(e.seq||1),deckCount:e.deck?.length||Number(e.deckCount||0),discardCount:e.discard?.length||Number(e.discardCount||0),currentSeat:Number(e.currentSeat||0),lastWinnerSeat:null===e.lastWinnerSeat||void 0===e.lastWinnerSeat?null:Number(e.lastWinnerSeat),previousWinnerSeat:null===e.previousWinnerSeat||void 0===e.previousWinnerSeat?null:Number(e.previousWinnerSeat),baseScore:Number(e.baseScore||1),bombCount:Number(e.bombCount||0),diceRolls:Array.isArray(e.diceRolls)?e.diceRolls:[],roundResult:e.roundResult||null,table:e.table?{...e.table,cards:e.table.cards.map(B)}:null,passSeats:Array.isArray(e.passSeats)?e.passSeats:[],winnerSeat:null===e.winnerSeat||void 0===e.winnerSeat?null:Number(e.winnerSeat),log:Array.isArray(e.log)?e.log.slice(0,18):[],players:A(e).map(e=>({address:e.address,name:e.name,seat:e.seat,handCount:e.hand?.length??e.handCount??0,score:Number(e.score||0),playedCards:Number(e.playedCards||0),hand:Array.isArray(e.hand)?e.hand.map(B):[]}))}:null}function S(e){return e&&"object"==typeof e?{id:String(e.id||"").toUpperCase(),ownerAddress:L(e.ownerAddress),status:"playing"===e.status||"finished"===e.status?e.status:"lobby",seq:Number(e.seq||1),players:Array.isArray(e.players)?e.players.map(v).filter(Boolean):[],deck:Array.isArray(e.deck)?e.deck.map(C).filter(Boolean):[],discard:Array.isArray(e.discard)?e.discard.map(C).filter(Boolean):[],table:e.table&&"object"==typeof e.table?{...e.table,cards:Array.isArray(e.table.cards)?e.table.cards.map(C).filter(Boolean):[]}:null,currentSeat:Number(e.currentSeat||0),lastWinnerSeat:null===e.lastWinnerSeat||void 0===e.lastWinnerSeat?null:Number(e.lastWinnerSeat),previousWinnerSeat:null===e.previousWinnerSeat||void 0===e.previousWinnerSeat?null:Number(e.previousWinnerSeat),passSeats:Array.isArray(e.passSeats)?e.passSeats.map(Number):[],baseScore:Number(e.baseScore||1),bombCount:Number(e.bombCount||0),diceRolls:Array.isArray(e.diceRolls)?e.diceRolls:[],roundResult:e.roundResult||null,log:Array.isArray(e.log)?e.log.map(String):[],winnerSeat:null===e.winnerSeat||void 0===e.winnerSeat?null:Number(e.winnerSeat)}:null}function _(e){if(!e?.length)return null;let a=e.filter(O).length,t=e.filter(e=>!O(e));if(0===t.length)return null;let n=function(e,a,t){if(e.length<3||!M(a,t))return null;let n=function(e){return G(e[0])}(a);return x("bomb",n,e.length,Array(e.length).fill(n),0===t)}(e,t,a);if(n)return n;if(1===e.length&&0===a)return x("single",G(e[0]),1,[G(e[0])]);if(2===e.length&&M(t,a)){let e=G(t[0]);return x("pair",e,2,[e,e])}return function(e){if(e.length<3)return null;for(let a=0;a<=g.length-e.length;a+=1){let t=g.slice(a,a+e.length).map(e=>b.get(e));if(e.every((e,a)=>O(e)||G(e)===t[a]))return x("straight",t.at(-1),e.length,t)}return null}(e)||function(e){if(e.length<4||e.length%2!=0)return null;let a=e.length/2;for(let t=0;t<=g.length-a;t+=1){let n=g.slice(t,t+a).map(e=>b.get(e)),r=n.flatMap(e=>[e,e]);if(e.every((e,a)=>O(e)||G(e)===r[a]))return x("pairStraight",n.at(-1),e.length,r)}return null}(e)}function x(e,a,t,n,r=!0){var s;let l;return{type:e,value:a,length:t,resolvedValues:n,pure:r,label:(s={type:e,value:a,length:t,resolvedValues:n,pure:r},l=s.resolvedValues?.length?`(${s.resolvedValues.map(P).join(" ")})`:"",`${({single:"单张",pair:"对子",straight:"顺子",pairStraight:"连对",bomb:s.pure?"纯炸弹":"带王炸弹"})[s.type]}${l}`)}}function j(e){let a=new Set;return e.map(e=>({address:L(e.address),name:U(e.name),publicKey:String(e.publicKey||"")})).filter(e=>!(!e.address||a.has(e.address))&&(a.add(e.address),!0))}function v(e){let a=L(e.address);return a?{address:a,name:U(e.name),seat:Number(e.seat||0),hand:Array.isArray(e.hand)?e.hand.map(C).filter(Boolean):[],handCount:Number(e.handCount||0),score:Number(e.score||0),playedCards:Number(e.playedCards||0)}:null}function C(e){if(!e||"object"!=typeof e)return null;let a=String(e.rank||""),t=String(e.suit||"");return(b.has(a)||"SJ"===a||"BJ"===a)&&(h.includes(t)||"Joker"===t)?{id:String(e.id||`${t}-${a}`),suit:t,rank:a,label:e.label||I({suit:t,rank:a}),color:e.color||E({suit:t,rank:a})}:null}function k(e,a){return e.deck.splice(0,a)}function N(e){return e.players.find(a=>a.seat===e.currentSeat)}function w(e){return A(e).filter(e=>e.hand.length>0)}function A(e){return[...e?.players||[]].sort((e,a)=>e.seat-a.seat)}function $(e){let a=w(e).map(e=>e.seat),t=a.indexOf(e.currentSeat);e.currentSeat=a[(t+1)%a.length]}function M(e,a=0){if(0===e.length)return!1;let t=e[0].rank;return e.every(e=>e.rank===t)&&e.length+a>=2}function R(e,a){return G(e)-G(a)||H(e.suit)-H(a.suit)}function G(e){return b.get(e.rank)||99}function O(e){return"SJ"===e.rank||"BJ"===e.rank}function H(e){return({D:0,C:1,H:2,S:3,Joker:4})[e]||0}function B(e){return{id:e.id,suit:e.suit,rank:e.rank,label:I(e),color:E(e)}}function I(e){return"SJ"===e.rank?"小王":"BJ"===e.rank?"大王":`${({S:"♠",H:"♥",C:"♣",D:"♦"})[e.suit]||""}${e.rank}`}function E(e){return"H"===e.suit||"D"===e.suit||"BJ"===e.rank?"red":"black"}function P(e){return f.find(a=>b.get(a)===e)||String(e)}function W(e){let a=f.findIndex(a=>b.get(a)===e);return -1===a||a>=f.length-1?null:b.get(f[a+1])}function L(e){let a=String(e||"").trim();return/^0x[a-fA-F0-9]{40}$/.test(a)?a.toLowerCase():""}function U(e){return String(e||"玩家").trim().slice(0,16)||"玩家"}var z=e.i(99591),J=e.i(45309);let T="gandengyan";function q(...e){return e.filter(Boolean).join(" ")}function D(e,a){return String(e||"").toLowerCase()===String(a||"").toLowerCase()}function K({player:e,active:t,winner:n,relation:r=""}){return e?(0,a.jsxs)("div",{className:q(J.default.player,t&&J.default.active,n&&J.default.winner),children:[(0,a.jsx)("div",{className:J.default.avatar,children:e.name.slice(0,1)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("strong",{children:e.name}),(0,a.jsxs)("span",{children:[r,r?" · ":"",e.handCount," 张"]})]})]}):null}function V({card:e,small:t=!1}){return(0,a.jsxs)("div",{className:q(J.default.card,J.default[e.color],t&&J.default.small),children:[(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("i",{children:"Joker"===e.suit?"*":e.label.slice(0,1)})]})}e.s(["default",0,function(){let e=(0,m.useAppStore)(e=>e.isDarkMode),g=(0,m.useAppStore)(e=>e.setIsDarkMode),x=(0,m.useAppStore)(e=>e.addToast),v=(0,p.useUserStore)(e=>e.initializeUser),[C,M]=(0,t.useState)(""),[G,O]=(0,t.useState)([]),[H,E]=(0,t.useState)(!1),P=(0,c.useGameRoom)({gameId:T,onError:e=>x(e,"error")});(0,t.useEffect)(()=>{v()},[v]),(0,t.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("room")?.toUpperCase();e&&M(e)},[]),(0,t.useEffect)(()=>{if(!P.roomCode)return;let e=`/game/gandengyan?room=${P.roomCode}`;`${window.location.pathname}${window.location.search}`!==e&&window.history.replaceState(null,"",e)},[P.roomCode]);let F=(0,t.useMemo)(()=>(0,z.deriveGameRoomLobby)(P.messages,P.roomCode?{gameId:T,roomCode:P.roomCode}:{gameId:T}),[P.messages,P.roomCode]),Q=(0,t.useMemo)(()=>(0,z.getLatestGameState)(P.messages,{gameId:T,roomCode:P.roomCode}),[P.messages,P.roomCode]),Z=Q?.payload?.state,Y=Z?.players.find(e=>D(e.address,P.userIdentity?.address)),X=D(Z?.ownerAddress||F.hostAddress,P.userIdentity?.address),ee=Z?.status==="playing"&&Z.currentSeat===Y?.seat,ea=(0,t.useMemo)(()=>G.map(e=>Y?.hand.find(a=>a.id===e)).filter(Boolean),[G,Y]),et=(0,t.useMemo)(()=>_(ea),[ea]),en=P.roomCode&&1?`${window.location.origin}/game/gandengyan?room=${P.roomCode}`:"",er=!!(Z&&"playing"===Z.status&&Z.deckCount<3);async function es(){await P.createRoom()&&x("房间已创建","success")}async function el(e){e.preventDefault(),await P.joinRoom(C)&&x("已进入房间","success")}async function ei(){en&&(await navigator.clipboard.writeText(en),E(!0),setTimeout(()=>E(!1),1400))}async function eo(e){await P.sendRoomEvent("room:state",{state:e,seq:e.seq})}async function ed(){if(Z&&X)try{await eo(function(e,a=Math.random){let t=S(e);if(!t||t.players.length<2)throw Error("至少需要 2 名玩家");for(let e of(t.deck=function(e,a){let t=[...e];for(let e=t.length-1;e>0;e-=1){let n=Math.floor(a()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}(function(){let e=[];for(let a of h)for(let t of f)e.push({id:`${a}-${t}`,suit:a,rank:t});return e.push({id:"SJ",suit:"Joker",rank:"SJ"}),e.push({id:"BJ",suit:"Joker",rank:"BJ"}),e.map(B)}(),a),t.discard=[],t.table=null,t.passSeats=[],t.winnerSeat=null,t.roundResult=null,t.baseScore=1,t.bombCount=0,t.status="playing",A(t)))e.hand=k(t,5),e.handCount=e.hand.length,e.playedCards=0,e.hand.sort(R);let n=function(e,a){if(null!==e.previousWinnerSeat)return e.diceRolls=[],A(e).find(a=>a.seat===e.previousWinnerSeat)||A(e)[0];let t=A(e),n=[];for(;t.length>1;){let r=Math.max(...(n=t.map(e=>{var t;return{seat:e.seat,name:e.name,value:(t=a,Math.floor(6*t())+1)}})).map(e=>e.value)),s=n.filter(e=>e.value===r);if(1===s.length)return e.diceRolls=n,t.find(e=>e.seat===s[0].seat);t=t.filter(e=>s.some(a=>a.seat===e.seat))}return e.diceRolls=n,t[0]}(t,a);return t.currentSeat=n.seat,t.lastWinnerSeat=null,t.log=[`新一局开始,${n.name} 先出牌`],t.diceRolls.length>0&&t.log.unshift(`骰子结果:${t.diceRolls.map(e=>`${e.name} ${e.value}`).join(",")}`),t.seq+=1,y(t)}(Z))}catch(e){x(e instanceof Error?e.message:"开局失败","error")}}async function eu(){await ed()}async function ec(){if(!Z||!P.userIdentity)return;let e=function(e,a,t){var n,r;let s=S(e),l=N(s),i=L(a);if(!l||l.address!==i)return{ok:!1,error:"还没轮到你",state:y(s)};let o=t.map(e=>l.hand.find(a=>a.id===e));if(0===o.length||o.some(e=>!e))return{ok:!1,error:"手牌不存在",state:y(s)};let d=_(o);return d?(n=d,r=s.table?.combo,n&&(!r||"bomb"===n.type&&"bomb"!==r.type||n.type===r.type&&("bomb"===n.type?n.length!==r.length?n.length>r.length:n.value!==r.value?n.value>r.value:n.pure&&!r.pure:n.length===r.length&&("single"===n.type||"pair"===n.type?n.value===W(r.value)||n.value===b.get("2"):n.value===W(r.value)))))?(l.hand=l.hand.filter(e=>!t.includes(e.id)),l.handCount=l.hand.length,l.playedCards+=o.length,s.discard.push(...o),s.table={seat:l.seat,playerName:l.name,cards:o,combo:d},s.passSeats=[],s.lastWinnerSeat=l.seat,"bomb"===d.type&&(s.bombCount+=1,s.baseScore*=2),s.log.unshift(`${l.name} 出 ${d.label} ${o.map(I).join(" ")}${"bomb"===d.type?`,底分 ${s.baseScore}`:""}`),0===l.hand.length?function(e,a){e.status="finished",e.winnerSeat=a.seat,e.previousWinnerSeat=a.seat;let t=[],n=0;for(let r of A(e)){if(r.seat===a.seat)continue;let s=0===r.playedCards,l=s?15:r.hand.length*e.baseScore;r.score-=l,n+=l,t.push({seat:r.seat,name:r.name,loss:l,sealed:s,cardsLeft:r.hand.length})}a.score+=n,e.roundResult={winnerSeat:a.seat,winnerName:a.name,winnerGain:n,baseScore:e.baseScore,bombCount:e.bombCount,losers:t},e.log.unshift(`${a.name} 获胜,赢 ${n} 分`)}(s,l):$(s),s.seq+=1,{ok:!0,state:y(s)}):{ok:!1,error:"出的牌压不过上一手",state:y(s)}:{ok:!1,error:"这个牌型不合法",state:y(s)}}(Z,P.userIdentity.address,G);e.ok?await eo(e.state):x(e.error||"出牌失败","error")}async function em(){var e;let a,t,n;if(!Z||!P.userIdentity)return;let r=(e=P.userIdentity.address,t=N(a=S(Z)),n=L(e),t&&t.address===n?a.table?(a.passSeats.includes(t.seat)||a.passSeats.push(t.seat),a.log.unshift(`${t.name} 不要`),w(a).map(e=>e.seat).filter(e=>e!==a.lastWinnerSeat).every(e=>a.passSeats.includes(e))?(function(e){for(let a of w(e)){if(0===e.deck.length)break;a.hand.push(...k(e,1)),a.handCount=a.hand.length,a.hand.sort(R)}}(a),a.currentSeat=a.lastWinnerSeat,a.table=null,a.passSeats=[],a.log.unshift("本轮结束,所有玩家各补 1 张,重新领出")):$(a),a.seq+=1,{ok:!0,state:y(a)}):{ok:!1,error:"领出时不能不要",state:y(a)}:{ok:!1,error:"还没轮到你",state:y(a)});r.ok?await eo(r.state):x(r.error||"操作失败","error")}return(0,t.useEffect)(()=>{O([])},[Z?.seq]),(0,t.useEffect)(()=>{if(!X||!P.roomCode||!P.userIdentity||Q||0===F.players.length)return;let e=function({roomCode:e,ownerAddress:a,ownerName:t,players:n=[],random:r=Math.random}){let s=j(n);return s.some(e=>e.address===L(a))||s.unshift({address:L(a),name:U(t)}),y({id:String(e||"").toUpperCase(),ownerAddress:L(a),status:"lobby",seq:1,players:s.slice(0,6).map((e,a)=>({address:e.address,name:U(e.name),seat:a,hand:[],handCount:0,score:0,playedCards:0})),deck:[],discard:[],table:null,currentSeat:0,lastWinnerSeat:null,previousWinnerSeat:null,passSeats:[],baseScore:1,bombCount:0,diceRolls:[],roundResult:null,log:["房间已创建"],winnerSeat:null,random:r})}({roomCode:P.roomCode,ownerAddress:P.userIdentity.address,ownerName:P.userIdentity.displayName||P.userIdentity.username,players:F.players});P.sendRoomEvent("room:state",{state:e,seq:e.seq})},[P,X,Q,F.players]),(0,t.useEffect)(()=>{if(!Z||!X||"lobby"!==Z.status)return;let e=function(e,a=[]){let t=S(e);if(!t||"lobby"!==t.status)return t;let n=new Map(t.players.map(e=>[e.address,e.score]));return t.players=j(a).slice(0,6).map((e,a)=>({address:e.address,name:U(e.name),seat:a,hand:[],handCount:0,score:n.get(e.address)||0,playedCards:0})),t.seq+=1,y(t)}(Z,F.players);e&&e.players.length!==Z.players.length&&P.sendRoomEvent("room:state",{state:e,seq:e.seq})},[P,X,F.players,Z]),(0,a.jsx)(d.default,{sidebar:({closeSidebar:e})=>(0,a.jsx)(u.default,{activeGame:"gandengyan",closeSidebar:e}),headerTitle:(0,a.jsx)("h2",{className:"header-title",children:"游戏 · 干瞪眼"}),headerRight:(0,a.jsxs)("div",{className:J.default.headerActions,children:[Z&&(0,a.jsxs)("button",{className:"btn btn-sm",onClick:ei,children:[(0,a.jsx)(n.Copy,{size:14}),H?"已复制":"分享房间"]}),(0,a.jsx)("button",{className:"btn btn-icon",onClick:()=>g(!e),title:"切换主题",children:e?(0,a.jsx)(o.Sun,{size:16}):(0,a.jsx)(r.Moon,{size:16})})]}),children:(0,a.jsx)("main",{className:J.default.page,children:Z?(0,a.jsxs)("section",{className:J.default.gameGrid,children:[(0,a.jsxs)("div",{className:J.default.tablePanel,children:[(0,a.jsxs)("div",{className:J.default.roomBar,children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("strong",{children:["房间 ",Z.id]}),(0,a.jsx)("span",{children:"lobby"===Z.status?"等待开局":"finished"===Z.status?"本局结束":"进行中"})]}),(0,a.jsxs)("div",{className:J.default.badges,children:[er&&(0,a.jsx)("span",{className:J.default.dangerBadge,children:"牌堆不足 3 张"}),(0,a.jsx)("span",{children:P.connected?"在线":"离线"})]})]}),(0,a.jsx)("div",{className:J.default.seats,children:Z.players.map(e=>(0,a.jsx)(K,{player:e,active:Z.currentSeat===e.seat,winner:Z.winnerSeat===e.seat,relation:function(e,a,t){if(!e)return`座位 ${a.seat+1}`;let n=(a.seat-e.seat+t)%t;return 0===n?"我":2===t?"对手位":3===t?1===n?"下家/对手位":"上家/对手位":4===t?1===n?"下家/对手位":2===n?"对家/队友位":"上家/对手位":n%2==0?`座位 ${a.seat+1}/队友位`:`座位 ${a.seat+1}/对手位`}(Y,e,Z.players.length)},e.seat))}),(0,a.jsxs)("div",{className:J.default.centerTable,children:[(0,a.jsxs)("div",{className:J.default.deckBox,children:[(0,a.jsx)("span",{children:"牌堆"}),(0,a.jsx)("strong",{children:Z.deckCount})]}),(0,a.jsx)("div",{className:J.default.playedBox,children:Z.table?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("strong",{children:[Z.table.playerName," 出 ",Z.table.combo?.label||"牌"]}),(0,a.jsx)("div",{className:J.default.playedCards,children:Z.table.cards.map(e=>(0,a.jsx)(V,{card:e,small:!0},e.id))})]}):(0,a.jsx)("span",{children:"等待领出"})}),(0,a.jsxs)("div",{className:J.default.deckBox,children:[(0,a.jsx)("span",{children:"底分"}),(0,a.jsx)("strong",{children:Z.baseScore})]})]}),(0,a.jsx)("div",{className:J.default.notice,children:"finished"===Z.status?`${Z.players.find(e=>e.seat===Z.winnerSeat)?.name} 获胜`:ee?"轮到你出牌":`等待 ${Z.players.find(e=>e.seat===Z.currentSeat)?.name||"玩家"}`})]}),(0,a.jsxs)("aside",{className:J.default.sidePanel,children:[(0,a.jsxs)("section",{className:J.default.panel,children:[(0,a.jsx)("h3",{children:"牌局"}),X&&"lobby"===Z.status&&(0,a.jsxs)("button",{className:"btn btn-primary",disabled:Z.players.length<2,onClick:ed,children:[(0,a.jsx)(s.Play,{size:16}),"开始游戏"]}),X&&"finished"===Z.status&&(0,a.jsxs)("button",{className:"btn btn-primary",onClick:eu,children:[(0,a.jsx)(l,{size:16}),"再来一局"]}),!X&&(0,a.jsx)("p",{className:J.default.status,children:"等待房主操作。"})]}),(0,a.jsxs)("section",{className:J.default.panel,children:[(0,a.jsx)("h3",{children:"分数"}),(0,a.jsxs)("div",{className:J.default.scoreMeta,children:[(0,a.jsxs)("span",{children:["炸弹 ",Z.bombCount," 次"]}),(0,a.jsxs)("span",{children:["弃牌 ",Z.discardCount," 张"]})]}),Z.players.map(e=>(0,a.jsxs)("div",{className:J.default.scoreRow,children:[(0,a.jsx)("span",{children:e.name}),(0,a.jsx)("strong",{children:e.score>0?`+${e.score}`:e.score})]},e.seat))]}),(0,a.jsxs)("section",{className:q(J.default.panel,J.default.logPanel),children:[(0,a.jsx)("h3",{children:"牌局记录"}),Z.log.map((e,t)=>(0,a.jsx)("p",{children:e},`${e}-${t}`))]})]}),(0,a.jsxs)("div",{className:J.default.handPanel,children:[(0,a.jsx)(K,{player:Y,active:ee,winner:Z.winnerSeat===Y?.seat}),(0,a.jsx)("div",{className:J.default.hand,children:Y?.hand.map(e=>(0,a.jsx)("button",{className:q(J.default.cardButton,G.includes(e.id)&&J.default.picked),onClick:()=>{var a;return a=e.id,void O(e=>e.includes(a)?e.filter(e=>e!==a):[...e,a])},children:(0,a.jsx)(V,{card:e})},e.id))}),(0,a.jsxs)("div",{className:J.default.actions,children:[(0,a.jsxs)("div",{className:q(J.default.preview,et&&J.default.valid),children:[(0,a.jsx)("strong",{children:et?et.label:G.length?"牌型不合法":"先选牌"}),(0,a.jsx)("span",{children:ea.map(e=>e.label).join(" ")||"按选择顺序解释大小王"})]}),(0,a.jsxs)("button",{className:"btn btn-primary",disabled:!ee||0===G.length||!et,onClick:ec,children:[(0,a.jsx)(i.Send,{size:16}),"出牌"]}),(0,a.jsx)("button",{className:"btn",disabled:!ee||!Z.table,onClick:em,children:"不要"})]})]})]}):(0,a.jsxs)("section",{className:J.default.entry,children:[(0,a.jsxs)("div",{className:J.default.entryBrand,children:[(0,a.jsx)("div",{className:J.default.cardMark,children:"干"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{children:"干瞪眼牌桌"}),(0,a.jsx)("p",{children:"创建房间码邀请朋友加入,房间状态通过 MostBox P2P 频道同步。"})]})]}),(0,a.jsxs)("div",{className:J.default.entryPanel,children:[(0,a.jsxs)("div",{className:J.default.accountLine,children:[(0,a.jsx)("span",{children:"当前账号"}),(0,a.jsx)("strong",{children:P.userIdentity?.displayName||"未登录"})]}),(0,a.jsxs)("button",{className:"btn btn-primary",disabled:P.joining,onClick:es,children:[(0,a.jsx)(s.Play,{size:16}),"创建房间"]}),(0,a.jsxs)("form",{onSubmit:el,className:J.default.joinForm,children:[(0,a.jsxs)("label",{children:["房间号",(0,a.jsx)("input",{value:C,maxLength:8,onChange:e=>M(e.target.value.toUpperCase()),placeholder:"输入房间号"})]}),(0,a.jsx)("button",{className:"btn",disabled:P.joining||!C,children:"加入房间"})]}),(0,a.jsx)("p",{className:J.default.status,children:P.isBackendReady?"节点已连接":"正在连接节点..."})]})]})})})}],31678)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.download-page{flex-direction:column;min-height:100dvh;display:flex}.download-hero{text-align:center;padding:64px 24px 48px}.download-hero-icon{border-radius:var(--radius-lg);background:var(--accent-soft);width:72px;height:72px;color:var(--accent);justify-content:center;align-items:center;margin-bottom:24px;display:inline-flex}.download-hero-title{letter-spacing:-.02px;background:linear-gradient(135deg, var(--text-primary), var(--accent));-webkit-text-fill-color:transparent;-webkit-background-clip:text;background-clip:text;margin-bottom:16px;font-size:40px;font-weight:700;line-height:1.1}.download-hero-desc{color:var(--text-secondary);max-width:48ch;margin:0 auto;font-size:16px;line-height:1.6}.download-platforms{padding:48px 24px}.download-section-title{text-align:center;color:var(--text-primary);margin-bottom:32px;font-size:24px;font-weight:600}.download-options{gap:20px;display:grid}.download-source-note{text-align:center;color:var(--text-secondary);margin:0;font-size:14px}.download-source-tabs{background:var(--glass-bg);border:1px solid var(--glass-border);border-radius:var(--radius-md);grid-template-columns:repeat(2,minmax(0,1fr));justify-self:center;gap:4px;padding:4px;display:inline-grid}.download-source-tab{border-radius:var(--radius-sm);min-height:40px;color:var(--text-secondary);font:inherit;cursor:pointer;transition:all var(--transition);background:0 0;border:0;justify-content:center;align-items:center;gap:8px;padding:0 16px;font-size:14px;font-weight:600;display:inline-flex}.download-source-tab:hover:not(:disabled){color:var(--text-primary);background:var(--glass-bg-heavy)}.download-source-tab.is-active{color:var(--accent);background:var(--accent-soft)}.download-source-tab:disabled{opacity:.45;cursor:not-allowed}.download-platform-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;display:grid}.download-platform-card{background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);border-radius:var(--radius-lg);color:var(--text-primary);transition:all var(--transition);align-items:flex-start;gap:18px;padding:32px 24px;display:flex;position:relative}.download-platform-card:hover{background:var(--glass-bg-heavy);box-shadow:var(--glass-shadow);border-color:var(--accent);transform:translateY(-2px)}.download-platform-icon{color:var(--accent);border-radius:var(--radius-md);background:var(--accent-soft);flex-shrink:0;justify-content:center;align-items:center;width:48px;height:48px;display:inline-flex}.download-platform-content{flex:1;gap:12px;min-width:0;display:grid}.download-platform-heading{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.download-platform-heading h3{margin:0;font-size:18px;font-weight:600}.download-platform-heading span,.download-recommended-badge{border-radius:var(--radius-sm);background:var(--glass-bg-heavy);border:1px solid var(--glass-border);min-height:24px;color:var(--text-secondary);align-items:center;padding:0 10px;font-size:12px;font-weight:600;display:inline-flex}.download-platform-card p{color:var(--text-secondary);margin:0;font-size:13px;line-height:1.5}.download-platform-meta{gap:8px;margin:0;display:grid}.download-platform-meta div{grid-template-columns:56px minmax(0,1fr);align-items:center;gap:8px;display:grid}.download-platform-meta dt,.download-platform-meta dd{margin:0;font-size:12px;line-height:1.4}.download-platform-meta dt{color:var(--text-muted)}.download-platform-meta dd{color:var(--text-secondary);overflow-wrap:anywhere}.download-platform-actions{flex-wrap:wrap;align-items:center;gap:12px;margin-top:4px;display:flex}.download-platform-actions .btn{gap:8px}.download-recommended-badge{background:var(--accent-soft);color:var(--accent);border-color:var(--accent);position:absolute;top:16px;right:16px}.download-platform-card.is-recommended{border-color:var(--accent)}.download-comparison{background:var(--glass-bg-subtle);border-top:1px solid var(--glass-border);border-bottom:1px solid var(--glass-border);padding:48px 24px}.download-table-wrap{overflow-x:auto}.download-table{border-collapse:collapse;width:100%;max-width:600px;margin:0 auto}.download-table th,.download-table td{text-align:left;border-bottom:1px solid var(--glass-border);padding:14px 20px}.download-table th{color:var(--text-primary);font-size:14px;font-weight:600}.download-table td{color:var(--text-secondary);font-size:14px}.download-table td.col-web{color:var(--warning)}.download-table td.col-desktop{color:var(--success);font-weight:500}.download-cta{text-align:center;padding:64px 24px}.download-cta-desc{color:var(--text-secondary);margin-bottom:24px;font-size:16px;line-height:1.6}@media (max-width:768px){.download-hero-title{font-size:32px}.download-platform-grid{grid-template-columns:1fr;gap:16px}.download-source-tabs{width:100%}.download-platform-card{gap:16px;padding:20px}.download-platform-icon{flex-shrink:0;margin-bottom:0}.download-recommended-badge{align-self:flex-start;position:static}.download-platform-meta div{grid-template-columns:48px minmax(0,1fr)}}
|